@veracity/vui 2.29.0-beta.0 → 2.29.0-beta.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.
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.2",
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",
@@ -1,3 +1,3 @@
1
- export const collapsedWidth = 64
1
+ export const collapsedWidth = 52
2
2
 
3
- export const expandedWidth = 280
3
+ export const expandedWidth = 240
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useMemo, useState } from 'react'
1
+ import { useEffect, useMemo, useState } from 'react'
2
2
 
3
3
  import Box from '../box'
4
4
  import Button from '../button'
@@ -71,9 +71,10 @@ export const Sidemenu = vui<'div', SidemenuProps>((props, ref) => {
71
71
  flexDirection="column"
72
72
  flexGrow={1}
73
73
  justifyContent="flex-start"
74
+ minW={expandedWidth}
74
75
  overflowX="hidden"
75
76
  overflowY="auto"
76
- w={expandedWidth - 14}
77
+ w="100%"
77
78
  >
78
79
  {items
79
80
  ? items?.map?.((item: SidemenuItemProps, key: number) => (
@@ -93,6 +94,7 @@ export const Sidemenu = vui<'div', SidemenuProps>((props, ref) => {
93
94
  justifyContent={justifyContent}
94
95
  minH={size === 'lg' ? '56px' : '40px'}
95
96
  onClick={onToggle}
97
+ pl={0}
96
98
  size="md"
97
99
  variant={isDark ? 'tertiaryLight' : 'tertiaryDark'}
98
100
  w="100%"
@@ -21,6 +21,7 @@ export const SidemenuItem = vui<'button', SidemenuItemProps>((props, ref) => {
21
21
  isActive,
22
22
  isExpanded = true,
23
23
  pl = 0,
24
+ py = 0,
24
25
  onClick,
25
26
  onCollapse,
26
27
  onExpand,
@@ -38,10 +39,10 @@ export const SidemenuItem = vui<'button', SidemenuItemProps>((props, ref) => {
38
39
 
39
40
  const hasChildrenExpanded = !!children && isExpandedHorizontally
40
41
 
41
- const innerContent = (
42
- <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}>
42
+ const InnerContent = () => (
43
+ <Box centerV px={1.5} py={1} w="100%" whiteSpace="pre">
44
+ {icon && <Icon ml={iconSize === 'sm' ? '4px' : 0} name={icon} size={iconSize} />}
45
+ <T isTruncated ml={icon ? 2 : 0}>
45
46
  {title}
46
47
  </T>
47
48
  </Box>
@@ -65,6 +66,7 @@ export const SidemenuItem = vui<'button', SidemenuItemProps>((props, ref) => {
65
66
  justifyContent: 'space-between',
66
67
  onClick: () => onClick?.(),
67
68
  pl,
69
+ py,
68
70
  size: 'md',
69
71
  variant: isDark ? 'tertiaryLight' : 'tertiaryDark',
70
72
  w: '100%',
@@ -77,10 +79,10 @@ export const SidemenuItem = vui<'button', SidemenuItemProps>((props, ref) => {
77
79
  return (
78
80
  <Box flexDirection="column" ref={ref} w="100%">
79
81
  {!hasChildrenExpanded && children ? (
80
- <Popover offset={[0, -expandedWidth + collapsedWidth + 9]} placement="right-start" trigger="mouseenter">
82
+ <Popover offset={[0, collapsedWidth - expandedWidth - 2]} placement="right-start" trigger="mouseenter">
81
83
  <Popover.Trigger as={Box} className={cs('vui-sidemenu-item-popover', className)}>
82
84
  <Box {...buttonStyles} borderLeft={`3px solid ${isDark ? 'digiGreen.main' : 'seaBlue.main'}`}>
83
- {innerContent}
85
+ <InnerContent />
84
86
  </Box>
85
87
  </Popover.Trigger>
86
88
  <Popover.Content elevation="none">
@@ -91,13 +93,12 @@ export const SidemenuItem = vui<'button', SidemenuItemProps>((props, ref) => {
91
93
  </Popover>
92
94
  ) : (
93
95
  <Button className={cs('vui-sidemenu-item', className)} {...buttonStyles}>
94
- {innerContent}
96
+ <InnerContent />
95
97
  {hasChildrenExpanded && (
96
98
  <Button
97
99
  aria-label={isExpandedVertically ? 'Collapse' : 'Expand'}
98
100
  className="vui-sidemenu-item-expand"
99
101
  icon={isExpandedVertically ? 'falChevronUp' : 'falChevronDown'}
100
- mr={1}
101
102
  onClick={toggle}
102
103
  size="sm"
103
104
  variant={isDark ? 'tertiaryLight' : 'tertiaryDark'}
@@ -1,21 +1,24 @@
1
1
  import { Box } from '../box'
2
2
  import { omitThemingProps, useStyleConfig } from '../core'
3
3
  import { cs } from '../utils'
4
- import { useSidemenuContext } from './context'
4
+ import { collapsedWidth } from './consts'
5
5
  import { SidemenuTopProps } from './sidemenu.types'
6
6
 
7
7
  /** Top container. */
8
8
  export const SidemenuTop = (props: SidemenuTopProps) => {
9
9
  const { className, leftSlot, rightSlot, ...rest } = omitThemingProps(props)
10
10
  const styles = useStyleConfig('Sidemenu', props)
11
- const { isExpandedHorizontally } = useSidemenuContext()
12
11
 
13
12
  if (!leftSlot && !rightSlot) return null
14
13
 
15
14
  return (
16
15
  <Box className={cs('vui-sidemenu-top', className)} mb={1} w="100%" {...styles.sidemenuTop} {...rest}>
17
- {!!leftSlot && leftSlot}
18
- {!!rightSlot && rightSlot}
16
+ {!!leftSlot && (
17
+ <Box alignItems="center" className="vui-sidemenu-top-left" minW={collapsedWidth}>
18
+ {leftSlot}
19
+ </Box>
20
+ )}
21
+ {!!rightSlot && <Box className="vui-sidemenu-top-left">{rightSlot}</Box>}
19
22
  </Box>
20
23
  )
21
24
  }