@veracity/vui 2.29.0-beta.0 → 2.29.0-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veracity/vui",
3
- "version": "2.29.0-beta.0",
3
+ "version": "2.29.0-beta.1",
4
4
  "description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
5
5
  "module": "./dist/esm/index.js",
6
6
  "main": "./dist/cjs/index.js",
@@ -79,6 +79,7 @@ export const Sidemenu = vui<'div', SidemenuProps>((props, ref) => {
79
79
  ? items?.map?.((item: SidemenuItemProps, key: number) => (
80
80
  <SidemenuItem
81
81
  isActive={isActivePath(item?.path)}
82
+ isTitleVisible={isExpandedHorizontally}
82
83
  key={key}
83
84
  {...item}
84
85
  onClick={() => onItemClick(item)}
@@ -33,6 +33,8 @@ export type SidemenuItemProps = BoxProps & {
33
33
  isActive?: boolean
34
34
  /** Whether the item is expanded vertically */
35
35
  isExpanded?: boolean
36
+ /** Whether the title is visible, should be hidden if the parent is collapsed @default true*/
37
+ isTitleVisible?: boolean
36
38
  /** On click callback */
37
39
  onClick?: () => void
38
40
  /** On collapse callback @default true */
@@ -20,7 +20,9 @@ export const SidemenuItem = vui<'button', SidemenuItemProps>((props, ref) => {
20
20
  iconSize = 'md',
21
21
  isActive,
22
22
  isExpanded = true,
23
+ isTitleVisible = true,
23
24
  pl = 0,
25
+ py = 0,
24
26
  onClick,
25
27
  onCollapse,
26
28
  onExpand,
@@ -38,10 +40,10 @@ export const SidemenuItem = vui<'button', SidemenuItemProps>((props, ref) => {
38
40
 
39
41
  const hasChildrenExpanded = !!children && isExpandedHorizontally
40
42
 
41
- const innerContent = (
43
+ const InnerContent = () => (
42
44
  <Box centerV px={2} py={1} w="100%" whiteSpace="pre">
43
- {!!icon && <Icon ml={iconSize === 'sm' ? '4px' : 0} name={icon} size={iconSize} />}
44
- <T isTruncated ml={icon ? 2 : 0} pl={isExpandedHorizontally ? 0 : 1}>
45
+ {icon && <Icon ml={iconSize === 'sm' ? '4px' : 0} name={icon} size={iconSize} />}
46
+ <T isTruncated ml={icon ? 2 : 0} visibility={isTitleVisible ? 'visible' : 'hidden'}>
45
47
  {title}
46
48
  </T>
47
49
  </Box>
@@ -65,6 +67,7 @@ export const SidemenuItem = vui<'button', SidemenuItemProps>((props, ref) => {
65
67
  justifyContent: 'space-between',
66
68
  onClick: () => onClick?.(),
67
69
  pl,
70
+ py,
68
71
  size: 'md',
69
72
  variant: isDark ? 'tertiaryLight' : 'tertiaryDark',
70
73
  w: '100%',
@@ -80,7 +83,7 @@ export const SidemenuItem = vui<'button', SidemenuItemProps>((props, ref) => {
80
83
  <Popover offset={[0, -expandedWidth + collapsedWidth + 9]} placement="right-start" trigger="mouseenter">
81
84
  <Popover.Trigger as={Box} className={cs('vui-sidemenu-item-popover', className)}>
82
85
  <Box {...buttonStyles} borderLeft={`3px solid ${isDark ? 'digiGreen.main' : 'seaBlue.main'}`}>
83
- {innerContent}
86
+ <InnerContent />
84
87
  </Box>
85
88
  </Popover.Trigger>
86
89
  <Popover.Content elevation="none">
@@ -91,7 +94,7 @@ export const SidemenuItem = vui<'button', SidemenuItemProps>((props, ref) => {
91
94
  </Popover>
92
95
  ) : (
93
96
  <Button className={cs('vui-sidemenu-item', className)} {...buttonStyles}>
94
- {innerContent}
97
+ <InnerContent />
95
98
  {hasChildrenExpanded && (
96
99
  <Button
97
100
  aria-label={isExpandedVertically ? 'Collapse' : 'Expand'}