@homefile/components-v2 2.48.0 → 2.48.2

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.
@@ -14,8 +14,6 @@ export * from './PartnerFooter';
14
14
  export * from './PartnerHomeHeader';
15
15
  export * from './PartnerHeader';
16
16
  export * from './PartnerImage';
17
- export * from './PartnerServiceTicketsToolbar';
18
- export * from './PartnerServiceTicketsWrapper';
19
17
  export * from './PartnerTileWrapper';
20
18
  export * from './PartnerSidebarMenu';
21
19
  export * from './ShortPartnerTile';
@@ -14,8 +14,6 @@ export * from './PartnerFooter';
14
14
  export * from './PartnerHomeHeader';
15
15
  export * from './PartnerHeader';
16
16
  export * from './PartnerImage';
17
- export * from './PartnerServiceTicketsToolbar';
18
- export * from './PartnerServiceTicketsWrapper';
19
17
  export * from './PartnerTileWrapper';
20
18
  export * from './PartnerSidebarMenu';
21
19
  export * from './ShortPartnerTile';
@@ -1,2 +1,2 @@
1
1
  import { PartnerServiceTicketCardI } from '../../../interfaces';
2
- export declare const PartnerServiceTicketCard: ({ customerName, description, footerActionLabel, headerLabel, infoBackground, meta, onFooterActionClick, onStatusChange, statusOptions, statusValue, }: PartnerServiceTicketCardI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const PartnerServiceTicketCard: ({ customerName, display, description, footerActionLabel, headerLabel, infoBackground, meta, onFooterActionClick, }: PartnerServiceTicketCardI) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Container, Flex, Grid, IconButton, Stack, Text, } from '@chakra-ui/react';
3
3
  import { TicketBookmark } from '../../../components';
4
- export const PartnerServiceTicketCard = ({ customerName, description, footerActionLabel, headerLabel, infoBackground = '#e6ddf1', meta, onFooterActionClick, onStatusChange, statusOptions, statusValue, }) => {
5
- const hasStatusSelect = Boolean((statusOptions === null || statusOptions === void 0 ? void 0 : statusOptions.length) && statusValue);
6
- const getValue = (item) => typeof item === 'string' ? item : String(item._id);
7
- return (_jsxs(Container, { variant: "launchpad", w: "180px", overflow: "hidden", bg: "neutral.white", children: [_jsx(Box, { p: "2", children: _jsx(Text, { fontSize: "xs", fontWeight: "medium", textTransform: "uppercase", children: headerLabel }) }), _jsx(Box, { bg: infoBackground, p: "base", children: _jsx(_Fragment, { children: meta.map(({ label, value }) => (_jsxs(Grid, { templateColumns: "40% 60%", gap: "0", children: [_jsx(Text, { fontFamily: "secondary", fontSize: "xxs", textTransform: "uppercase", lineHeight: "1.4", children: label }), _jsx(Text, { fontFamily: "secondary", fontSize: "xxs", fontWeight: "bold", textTransform: "uppercase", lineHeight: "1.4", children: value })] }, label))) }) }), _jsxs(Stack, { spacing: "1", p: "base", borderBottom: "1px solid", borderColor: "lightBlue.2", children: [_jsx(Text, { textTransform: "uppercase", fontWeight: "medium", children: customerName }), _jsx(Text, { fontFamily: "secondary", fontSize: "sm", lineHeight: "1.2", children: description })] }), _jsx(Flex, { h: "40px", p: "base", align: "center", justify: "space-between", children: _jsx(IconButton, { "aria-label": footerActionLabel !== null && footerActionLabel !== void 0 ? footerActionLabel : 'Save ticket', variant: "icon", width: "fit-content", onClick: onFooterActionClick, children: _jsx(TicketBookmark, { boxSize: "5" }) }) })] }));
4
+ export const PartnerServiceTicketCard = ({ customerName, display = 'grid', description, footerActionLabel, headerLabel, infoBackground = '#e6ddf1', meta, onFooterActionClick, }) => {
5
+ const isListDisplay = display === 'list';
6
+ const dividerColor = 'lightBlue.2';
7
+ const cardWidth = isListDisplay ? '100%' : '180px';
8
+ const renderMeta = () => (_jsx(Box, { bg: infoBackground, p: "base", minW: { base: '100%', md: '220px' }, children: meta.map(({ label, value }) => (_jsxs(Grid, { templateColumns: "40% 60%", gap: "0", children: [_jsx(Text, { fontFamily: "secondary", fontSize: "xxs", textTransform: "uppercase", lineHeight: "1.4", children: label }), _jsx(Text, { fontFamily: "secondary", fontSize: "xxs", fontWeight: "bold", textTransform: "uppercase", lineHeight: "1.4", children: value })] }, label))) }));
9
+ const renderBody = () => (_jsxs(Stack, { spacing: "1", p: "base", borderBottom: "1px solid", borderColor: dividerColor, flex: "1", justify: "center", children: [_jsx(Text, { textTransform: "uppercase", fontWeight: "medium", children: customerName }), _jsx(Text, { fontFamily: "secondary", fontSize: "sm", lineHeight: "1.2", children: description })] }));
10
+ if (isListDisplay) {
11
+ return (_jsx(Container, { variant: "launchpad", w: cardWidth, maxW: "none", mx: "0", overflow: "hidden", bg: "neutral.white", children: _jsxs(Flex, { direction: { base: 'column', md: 'row' }, align: "stretch", children: [_jsx(Flex, { p: "2", align: "center", minW: { base: '100%', md: '130px' }, borderBottomWidth: { base: '1px', md: '0' }, borderBottomStyle: "solid", borderRightWidth: { base: '0', md: '1px' }, borderRightStyle: "solid", borderBottomColor: dividerColor, borderRightColor: dividerColor, children: _jsx(Text, { fontSize: "xs", fontWeight: "medium", textTransform: "uppercase", children: headerLabel }) }), renderMeta(), _jsxs(Stack, { spacing: "1", p: "base", flex: "1", justify: "center", minW: "0", children: [_jsx(Text, { textTransform: "uppercase", fontWeight: "medium", children: customerName }), _jsx(Text, { fontFamily: "secondary", fontSize: "sm", lineHeight: "1.2", children: description })] }), _jsx(Flex, { p: "base", align: "center", justify: "center", borderTopWidth: { base: '1px', md: '0' }, borderTopStyle: "solid", borderLeftWidth: { base: '0', md: '1px' }, borderLeftStyle: "solid", borderTopColor: dividerColor, borderLeftColor: dividerColor, minW: { base: '100%', md: '64px' }, children: _jsx(IconButton, { "aria-label": footerActionLabel !== null && footerActionLabel !== void 0 ? footerActionLabel : 'Save ticket', variant: "icon", width: "fit-content", onClick: onFooterActionClick, children: _jsx(TicketBookmark, { boxSize: "5" }) }) })] }) }));
12
+ }
13
+ return (_jsxs(Container, { variant: "launchpad", w: cardWidth, maxW: "none", mx: "0", overflow: "hidden", bg: "neutral.white", children: [_jsx(Box, { p: "2", children: _jsx(Text, { fontSize: "xs", fontWeight: "medium", textTransform: "uppercase", children: headerLabel }) }), renderMeta(), renderBody(), _jsx(Flex, { h: "40px", p: "base", align: "center", justify: "space-between", children: _jsx(IconButton, { "aria-label": footerActionLabel !== null && footerActionLabel !== void 0 ? footerActionLabel : 'Save ticket', variant: "icon", width: "fit-content", onClick: onFooterActionClick, children: _jsx(TicketBookmark, { boxSize: "5" }) }) })] }));
8
14
  };
@@ -1,2 +1,2 @@
1
- import { PartnerServiceTicketsToolbarI } from '../../interfaces';
1
+ import { PartnerServiceTicketsToolbarI } from '../../../interfaces';
2
2
  export declare const PartnerServiceTicketsToolbar: ({ ageItems, initialAge, initialDisplay, initialPriority, initialStatus, newTicketLabel, onAgeChange, onDisplayChange, onNewTicketClick, onPriorityChange, onStatusChange, priorityItems, showNewTicketButton, statusItems, }: PartnerServiceTicketsToolbarI) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Button, Flex } from '@chakra-ui/react';
3
+ import { DisplayOptionsButtons, Plus, SelectInput } from '../../../components';
4
+ export const PartnerServiceTicketsToolbar = ({ ageItems, initialAge, initialDisplay = 'grid', initialPriority, initialStatus, newTicketLabel = 'TICKET', onAgeChange, onDisplayChange, onNewTicketClick, onPriorityChange, onStatusChange, priorityItems, showNewTicketButton = false, statusItems, }) => {
5
+ const getValue = (item) => typeof item === 'string' ? item : String(item._id);
6
+ const getButtonAriaLabel = () => {
7
+ const sanitizedLabel = newTicketLabel.trim();
8
+ if (!sanitizedLabel.length) {
9
+ return 'Create service ticket';
10
+ }
11
+ return `Create ${sanitizedLabel.toLowerCase()}`;
12
+ };
13
+ return (_jsx(Box, { p: "base", as: "section", "aria-label": "Service tickets toolbar", children: _jsxs(Flex, { align: { base: 'stretch', md: 'center' }, justify: "space-between", direction: { base: 'column', md: 'row' }, gap: "base", children: [_jsxs(Flex, { flex: "1", minW: "0", align: { base: 'stretch', md: 'center' }, direction: { base: 'column', md: 'row' }, gap: "base", children: [showNewTicketButton && (_jsx(Box, { ml: "-base", flexShrink: 0, children: _jsx(Button, { id: "addServiceTicketButton", size: "md", onClick: onNewTicketClick, leftIcon: _jsx(Plus, {}), variant: "rightRounded", w: { base: '100%', sm: 'auto' }, "aria-label": getButtonAriaLabel(), children: newTicketLabel }) })), _jsxs(Flex, { flex: "1", minW: "0", gap: "base", wrap: { base: 'wrap', md: 'nowrap' }, align: "stretch", children: [_jsx(Box, { flex: { base: '1 1 100%', md: '1 1 120px' }, minW: { base: '100%', md: '96px' }, maxW: { md: '140px' }, children: _jsx(SelectInput, { height: "md", width: "100%", handleClick: (item) => onAgeChange(getValue(item)), items: ageItems, initialValue: initialAge }) }), _jsx(Box, { flex: { base: '1 1 100%', md: '1 1 120px' }, minW: { base: '100%', md: '96px' }, maxW: { md: '140px' }, children: _jsx(SelectInput, { height: "md", width: "100%", handleClick: (item) => onPriorityChange(getValue(item)), items: priorityItems, initialValue: initialPriority }) }), _jsx(Box, { flex: { base: '1 1 100%', md: '1.4 1 160px' }, minW: { base: '100%', md: '120px' }, maxW: { md: '200px' }, children: _jsx(SelectInput, { height: "md", width: "100%", handleClick: (item) => onStatusChange(getValue(item)), items: statusItems, initialValue: initialStatus }) })] })] }), _jsx(Box, { alignSelf: { base: 'flex-end', md: 'center' }, flexShrink: 0, children: _jsx(DisplayOptionsButtons, { displays: ['list', 'grid'], initialDisplay: initialDisplay, onDisplayClick: onDisplayChange, iconSize: 6 }) })] }) }));
14
+ };
@@ -1,2 +1,2 @@
1
- import { PartnerServiceTicketsWrapperI } from '../../interfaces';
1
+ import { PartnerServiceTicketsWrapperI } from '../../../interfaces';
2
2
  export declare const PartnerServiceTicketsWrapper: ({ children, menuItems, onHelpClick, showHelp, title, titleIcon, tooltipLabel, }: PartnerServiceTicketsWrapperI) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Container } from '@chakra-ui/react';
3
- import { Manager } from '../../assets/images';
4
- import { ContainerHeader, MoreHorizontal, TileTooltip } from '../../components';
3
+ import { Manager } from '../../../assets/images';
4
+ import { ContainerHeader, MoreHorizontal, TileTooltip } from '../../../components';
5
5
  export const PartnerServiceTicketsWrapper = ({ children, menuItems = [], onHelpClick, showHelp = false, title = 'Service Tickets', titleIcon = Manager, tooltipLabel = 'Service Tickets', }) => {
6
6
  return (_jsx(TileTooltip, { label: tooltipLabel, children: _jsxs(Container, { variant: "launchpad", h: "full", maxW: "none", p: "0", position: "relative", overflow: "hidden", bg: "lightBlue.1", children: [_jsx(ContainerHeader, { title: title, titleIcon: titleIcon, icon: _jsx(MoreHorizontal, { size: 38 }), menuItems: menuItems, onHelpClick: onHelpClick, showHelp: showHelp, fontWeight: "normal" }), _jsx(Box, { minH: "420px", bg: "lightBlue.1", children: children })] }) }));
7
7
  };
@@ -1 +1,3 @@
1
1
  export * from './PartnerServiceTicketCard';
2
+ export * from './PartnerServiceTicketsToolbar';
3
+ export * from './PartnerServiceTicketsWrapper';
@@ -1 +1,3 @@
1
1
  export * from './PartnerServiceTicketCard';
2
+ export * from './PartnerServiceTicketsToolbar';
3
+ export * from './PartnerServiceTicketsWrapper';
@@ -6,6 +6,7 @@ export interface PartnerServiceTicketMetaI {
6
6
  }
7
7
  export interface PartnerServiceTicketCardI {
8
8
  customerName: string;
9
+ display?: 'grid' | 'list';
9
10
  description: string;
10
11
  footerActionLabel?: string;
11
12
  headerLabel: string;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
2
3
  import { Box, Wrap, WrapItem } from '@chakra-ui/react';
3
4
  import { action } from '@storybook/addon-actions';
4
5
  import { PartnerServiceTicketCard, PartnerServiceTicketsToolbar, PartnerServiceTicketsWrapper, } from '../../components';
@@ -29,23 +30,25 @@ export default {
29
30
  },
30
31
  };
31
32
  export const PartnerServiceTicketsWrapperComponent = (args) => {
32
- return (_jsx(Box, { p: "base", children: _jsxs(PartnerServiceTicketsWrapper, Object.assign({}, args, { children: [_jsx(PartnerServiceTicketsToolbar, { ageItems: ageItems, priorityItems: priorityItems, statusItems: statusItems, initialAge: "Age", initialPriority: "Priority", initialStatus: "Show All", initialDisplay: "grid", showNewTicketButton: true, onAgeChange: action('onAgeChange'), onDisplayChange: action('onDisplayChange'), onNewTicketClick: action('onNewTicketClick'), onPriorityChange: action('onPriorityChange'), onStatusChange: action('onStatusChange') }), _jsxs(Wrap, { spacing: "base", p: "base", align: "start", children: [_jsx(WrapItem, { children: _jsx(PartnerServiceTicketCard, { customerName: "Gerry Jones", description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do", headerLabel: "New Service", infoBackground: "#d9d5e9", meta: [
33
- { label: 'Customer', value: 'New Customer' },
34
- { label: 'Received', value: '9:30 AM' },
35
- { label: 'ID', value: '553HMF 8422324-D' },
36
- ], onFooterActionClick: action('onFooterActionClick') }) }), _jsx(WrapItem, { children: _jsx(PartnerServiceTicketCard, { customerName: "Jane Smith", description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do", headerLabel: "Support", statusValue: "HP", statusOptions: [
37
- { _id: 'hp', name: 'HP' },
38
- { _id: 'p', name: 'P' },
39
- ], infoBackground: "#efdaf6", meta: [
40
- { label: 'Customer', value: 'Existing' },
41
- { label: 'Received', value: '9:30 AM' },
42
- { label: 'ID', value: '553HMF 8422324-D' },
43
- ], onFooterActionClick: action('onFooterActionClick') }) }), _jsx(WrapItem, { children: _jsx(PartnerServiceTicketCard, { customerName: "Michael Smith", description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do", headerLabel: "Support", statusValue: "P", statusOptions: [
44
- { _id: 'hp', name: 'HP' },
45
- { _id: 'p', name: 'P' },
46
- ], infoBackground: "#f5e3d7", meta: [
47
- { label: 'Customer', value: 'Existing' },
48
- { label: 'Received', value: '9:30 AM' },
49
- { label: 'ID', value: '553HMF 8422324-D' },
50
- ], onFooterActionClick: action('onFooterActionClick') }) })] })] })) }));
33
+ const [displayType, setDisplayType] = useState('grid');
34
+ const handleDisplayChange = (display) => {
35
+ if (display === 'grid' || display === 'list') {
36
+ setDisplayType(display);
37
+ }
38
+ action('onDisplayChange')(display);
39
+ };
40
+ const isListDisplay = displayType === 'list';
41
+ return (_jsx(Box, { p: ['0', 'base'], children: _jsxs(PartnerServiceTicketsWrapper, Object.assign({}, args, { children: [_jsx(PartnerServiceTicketsToolbar, { ageItems: ageItems, priorityItems: priorityItems, statusItems: statusItems, initialAge: "Age", initialPriority: "Priority", initialStatus: "Show All", initialDisplay: displayType, showNewTicketButton: true, onAgeChange: action('onAgeChange'), onDisplayChange: handleDisplayChange, onNewTicketClick: action('onNewTicketClick'), onPriorityChange: action('onPriorityChange'), onStatusChange: action('onStatusChange') }), _jsxs(Wrap, { spacing: "base", p: "base", align: "start", direction: isListDisplay ? 'column' : 'row', w: "100%", children: [_jsx(WrapItem, { w: isListDisplay ? '100%' : 'auto', children: _jsx(Box, { w: isListDisplay ? '100%' : 'auto', children: _jsx(PartnerServiceTicketCard, { display: displayType, customerName: "Gerry Jones", description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do", headerLabel: "New Service", infoBackground: "#d9d5e9", meta: [
42
+ { label: 'Customer', value: 'New Customer' },
43
+ { label: 'Received', value: '9:30 AM' },
44
+ { label: 'ID', value: '553HMF 8422324-D' },
45
+ ], onFooterActionClick: action('onFooterActionClick') }) }) }), _jsx(WrapItem, { w: isListDisplay ? '100%' : 'auto', children: _jsx(Box, { w: isListDisplay ? '100%' : 'auto', children: _jsx(PartnerServiceTicketCard, { display: displayType, customerName: "Jane Smith", description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do", headerLabel: "Support", infoBackground: "#efdaf6", meta: [
46
+ { label: 'Customer', value: 'Existing' },
47
+ { label: 'Received', value: '9:30 AM' },
48
+ { label: 'ID', value: '553HMF 8422324-D' },
49
+ ], onFooterActionClick: action('onFooterActionClick') }) }) }), _jsx(WrapItem, { w: isListDisplay ? '100%' : 'auto', children: _jsx(Box, { w: isListDisplay ? '100%' : 'auto', children: _jsx(PartnerServiceTicketCard, { display: displayType, customerName: "Michael Smith", description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do", headerLabel: "Support", infoBackground: "#f5e3d7", meta: [
50
+ { label: 'Customer', value: 'Existing' },
51
+ { label: 'Received', value: '9:30 AM' },
52
+ { label: 'ID', value: '553HMF 8422324-D' },
53
+ ], onFooterActionClick: action('onFooterActionClick') }) }) })] })] })) }));
51
54
  };
@@ -3,3 +3,4 @@ import { PartnerServiceTicketCardI } from '../../../interfaces';
3
3
  declare const _default: Meta<PartnerServiceTicketCardI>;
4
4
  export default _default;
5
5
  export declare const PartnerServiceTicketCardComponent: (args: PartnerServiceTicketCardI) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const PartnerServiceTicketCardListComponent: (args: PartnerServiceTicketCardI) => import("react/jsx-runtime").JSX.Element;
@@ -10,21 +10,18 @@ export default {
10
10
  description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do',
11
11
  headerLabel: 'Support',
12
12
  typeLabel: 'Support',
13
- statusValue: 'HP',
14
- statusOptions: [
15
- { _id: 'hp', name: 'HP' },
16
- { _id: 'p', name: 'P' },
17
- ],
18
13
  infoBackground: '#efdaf6',
19
14
  meta: [
20
15
  { label: 'Customer', value: 'Existing' },
21
16
  { label: 'Received', value: '9:30 AM' },
22
17
  { label: 'ID', value: '553HMF 8422324-D' },
23
18
  ],
24
- onStatusChange: action('onStatusChange'),
25
19
  onFooterActionClick: action('onFooterActionClick'),
26
20
  },
27
21
  };
28
22
  export const PartnerServiceTicketCardComponent = (args) => {
29
23
  return (_jsx(Box, { w: "180px", children: _jsx(PartnerServiceTicketCard, Object.assign({}, args)) }));
30
24
  };
25
+ export const PartnerServiceTicketCardListComponent = (args) => {
26
+ return (_jsx(Box, { w: "full", children: _jsx(PartnerServiceTicketCard, Object.assign({}, args, { display: "list" })) }));
27
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.48.0",
3
+ "version": "2.48.2",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Button, Flex } from '@chakra-ui/react';
3
- import { DisplayOptionsButtons, Plus, SelectInput } from '../../components';
4
- export const PartnerServiceTicketsToolbar = ({ ageItems, initialAge, initialDisplay = 'grid', initialPriority, initialStatus, newTicketLabel = 'TICKET', onAgeChange, onDisplayChange, onNewTicketClick, onPriorityChange, onStatusChange, priorityItems, showNewTicketButton = false, statusItems, }) => {
5
- const getValue = (item) => typeof item === 'string' ? item : String(item._id);
6
- return (_jsx(Box, { p: "base", children: _jsxs(Flex, { align: "center", justify: "space-between", gap: "base", wrap: "nowrap", children: [_jsxs(Flex, { gap: "12", align: "center", children: [showNewTicketButton && (_jsx(Box, { ml: "-base", children: _jsx(Button, { id: "addServiceTicketButton", size: "md", onClick: onNewTicketClick, leftIcon: _jsx(Plus, {}), variant: "rightRounded", children: newTicketLabel }) })), _jsxs(Flex, { gap: "base", children: [_jsx(SelectInput, { height: "md", width: "140px", handleClick: (item) => onAgeChange(getValue(item)), items: ageItems, initialValue: initialAge }), _jsx(SelectInput, { height: "md", width: "140px", handleClick: (item) => onPriorityChange(getValue(item)), items: priorityItems, initialValue: initialPriority }), _jsx(SelectInput, { height: "md", width: "200px", handleClick: (item) => onStatusChange(getValue(item)), items: statusItems, initialValue: initialStatus })] })] }), _jsx(DisplayOptionsButtons, { displays: ['list', 'grid'], initialDisplay: initialDisplay, onDisplayClick: onDisplayChange, iconSize: 6 })] }) }));
7
- };