@veracity/vui 2.30.1-beta.1 → 2.31.0
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/cjs/button/theme.d.ts.map +1 -1
- package/dist/cjs/button/theme.js +0 -2
- package/dist/cjs/button/theme.js.map +1 -1
- package/dist/cjs/sidemenuV2/sidemenuItemV2.d.ts +3 -0
- package/dist/cjs/sidemenuV2/sidemenuItemV2.d.ts.map +1 -1
- package/dist/cjs/sidemenuV2/sidemenuItemV2.js +15 -6
- package/dist/cjs/sidemenuV2/sidemenuItemV2.js.map +1 -1
- package/dist/cjs/sidemenuV2/sidemenuV2.js +1 -1
- package/dist/cjs/sidemenuV2/sidemenuV2.js.map +1 -1
- package/dist/cjs/tutorial/tutorialCard.js +1 -1
- package/dist/cjs/tutorial/tutorialCard.js.map +1 -1
- package/dist/esm/button/theme.d.ts.map +1 -1
- package/dist/esm/button/theme.js +0 -2
- package/dist/esm/button/theme.js.map +1 -1
- package/dist/esm/sidemenuV2/sidemenuItemV2.d.ts +3 -0
- package/dist/esm/sidemenuV2/sidemenuItemV2.d.ts.map +1 -1
- package/dist/esm/sidemenuV2/sidemenuItemV2.js +13 -4
- package/dist/esm/sidemenuV2/sidemenuItemV2.js.map +1 -1
- package/dist/esm/sidemenuV2/sidemenuV2.js +1 -1
- package/dist/esm/sidemenuV2/sidemenuV2.js.map +1 -1
- package/dist/esm/tutorial/tutorialCard.js +1 -1
- package/dist/esm/tutorial/tutorialCard.js.map +1 -1
- package/dist/tsconfig.legacy.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/button/theme.ts +0 -2
- package/src/sidemenuV2/sidemenuItemV2.tsx +66 -19
- package/src/sidemenuV2/sidemenuV2.tsx +1 -1
- package/src/tutorial/tutorialCard.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.0",
|
|
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",
|
|
@@ -54,4 +54,4 @@
|
|
|
54
54
|
"dist",
|
|
55
55
|
"src"
|
|
56
56
|
]
|
|
57
|
-
}
|
|
57
|
+
}
|
package/src/button/theme.ts
CHANGED
|
@@ -279,7 +279,6 @@ const variants: Record<string, Record<string, Record<string, string>>> = {
|
|
|
279
279
|
bg: '#ffffff',
|
|
280
280
|
hoverBg: '#D3EEF8',
|
|
281
281
|
activeBg: '#E9F7FC',
|
|
282
|
-
hoverActiveBg: '#D3EEF8',
|
|
283
282
|
disabledBg: '#F8F7F7',
|
|
284
283
|
borderColor: 'transparent',
|
|
285
284
|
hoverBorderColor: '#003591',
|
|
@@ -297,7 +296,6 @@ const variants: Record<string, Record<string, Record<string, string>>> = {
|
|
|
297
296
|
bg: '#0F204B',
|
|
298
297
|
hoverBg: '#003591',
|
|
299
298
|
activeBg: '#0041B2',
|
|
300
|
-
hoverActiveBg: '#003591',
|
|
301
299
|
disabledBg: '#0F204B',
|
|
302
300
|
borderColor: 'transparent',
|
|
303
301
|
hoverBorderColor: '#91FFB4',
|
|
@@ -6,7 +6,7 @@ import type { BadgeProps } from '../badge/badge.types'
|
|
|
6
6
|
import Box from '../box'
|
|
7
7
|
import Button from '../button'
|
|
8
8
|
import type { VuiComponent } from '../core'
|
|
9
|
-
import { omitThemingProps, vui } from '../core'
|
|
9
|
+
import { omitThemingProps, styled, th, vui } from '../core'
|
|
10
10
|
import Icon from '../icon'
|
|
11
11
|
import type { IconProp } from '../icon'
|
|
12
12
|
import Popover from '../popover'
|
|
@@ -21,19 +21,42 @@ interface SidemenuItemContentProps {
|
|
|
21
21
|
icon?: IconProp
|
|
22
22
|
iconSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
23
23
|
title: string
|
|
24
|
-
isMenuExpanded
|
|
24
|
+
isMenuExpanded?: boolean
|
|
25
|
+
isInPopover?: boolean
|
|
25
26
|
badge?: Pick<BadgeProps, 'text' | 'variant'>
|
|
26
27
|
badgeLinkUrl?: string
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
const SidemenuItemContent = memo<SidemenuItemContentProps>(
|
|
30
|
-
({ icon, iconSize = 'sm', title, isMenuExpanded, badge, badgeLinkUrl }) => {
|
|
31
|
+
({ icon, iconSize = 'sm', title, isMenuExpanded, isInPopover, badge, badgeLinkUrl }) => {
|
|
31
32
|
// Calculate dynamic margins based on menu state
|
|
32
33
|
const iconBaseMarginLeft = 13 / 8 // 1.625rem (13px)
|
|
33
34
|
const iconMarginRight = isMenuExpanded
|
|
34
35
|
? 10 / 8 // 1.25rem (10px) when expanded
|
|
35
36
|
: 20 / 8 // 2.5rem (20px) when collapsed
|
|
36
37
|
|
|
38
|
+
if (isInPopover)
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
<T isTruncated size="sm" display="inline-block" fontWeight="500" ml={iconBaseMarginLeft}>
|
|
42
|
+
{title}
|
|
43
|
+
</T>
|
|
44
|
+
{badge && typeof badge === 'object' && typeof badge.text === 'string' && badge.text.trim() !== '' && (
|
|
45
|
+
<Badge
|
|
46
|
+
{...badge}
|
|
47
|
+
data-link={btoa(badgeLinkUrl ?? '#')}
|
|
48
|
+
variant={badge.variant ?? 'subtleGreen'}
|
|
49
|
+
size="sm"
|
|
50
|
+
minW="32px"
|
|
51
|
+
fontSize="12px"
|
|
52
|
+
lineHeight="16px"
|
|
53
|
+
ml="10px"
|
|
54
|
+
mr="10px"
|
|
55
|
+
/>
|
|
56
|
+
)}
|
|
57
|
+
</>
|
|
58
|
+
)
|
|
59
|
+
|
|
37
60
|
return (
|
|
38
61
|
<>
|
|
39
62
|
{/* Icon container with responsive margins */}
|
|
@@ -65,6 +88,15 @@ const SidemenuItemContent = memo<SidemenuItemContentProps>(
|
|
|
65
88
|
|
|
66
89
|
SidemenuItemContent.displayName = 'SidemenuItemContent'
|
|
67
90
|
|
|
91
|
+
export const PopoverHovered = styled.div<{ hoverColor: string }>`
|
|
92
|
+
&:hover .vui-sidemenu-item-popover .vui-button.vui-button {
|
|
93
|
+
background: ${p => th.color(p.hoverColor)};
|
|
94
|
+
}
|
|
95
|
+
&:hover div:last-child .tippy-content .vui-sidemenu-item-content > .vui-box > .vui-button.vui-button {
|
|
96
|
+
background: ${p => th.color(p.hoverColor)};
|
|
97
|
+
}
|
|
98
|
+
`
|
|
99
|
+
|
|
68
100
|
/** A menu item. */
|
|
69
101
|
export const SidemenuItemV2 = vui<'button', SidemenuItemV2Props>((props, ref) => {
|
|
70
102
|
const {
|
|
@@ -218,7 +250,6 @@ export const SidemenuItemV2 = vui<'button', SidemenuItemV2Props>((props, ref) =>
|
|
|
218
250
|
bg: 'transparent',
|
|
219
251
|
hoverBg: 'transparent',
|
|
220
252
|
activeBg: 'transparent',
|
|
221
|
-
hoverActiveBg: 'transparent',
|
|
222
253
|
}
|
|
223
254
|
}, [isSubmenuOpen, themeValues.buttonVariant])
|
|
224
255
|
|
|
@@ -226,21 +257,37 @@ export const SidemenuItemV2 = vui<'button', SidemenuItemV2Props>((props, ref) =>
|
|
|
226
257
|
<Box flexDirection="column" ref={ref} w="100%" mt={onBottom ? 'auto' : 0} id={computedItemId}>
|
|
227
258
|
{!isMenuExpanded && children ? (
|
|
228
259
|
<Popover offset={[0, collapsedWidth - expandedWidth - 2]} placement="right-start" trigger="mouseenter">
|
|
229
|
-
|
|
230
|
-
<
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
260
|
+
{({ isOpen }) => (
|
|
261
|
+
<PopoverHovered hoverColor={isDark ?'#003591' : '#d3eef8'}>
|
|
262
|
+
<Popover.Trigger as={Box} className={cs('vui-sidemenu-item-popover', className)}>
|
|
263
|
+
<Button
|
|
264
|
+
{...buttonStyles}
|
|
265
|
+
borderLeft={`3px solid ${isDark ? 'digiGreen.main' : 'seaBlue.main'}`}
|
|
266
|
+
isActive={isExactlyActive}
|
|
267
|
+
>
|
|
268
|
+
<SidemenuItemContent
|
|
269
|
+
icon={icon}
|
|
270
|
+
iconSize={buttonStyles.iconSize}
|
|
271
|
+
title={title}
|
|
272
|
+
isMenuExpanded={isMenuExpanded}
|
|
273
|
+
/>
|
|
274
|
+
</Button>
|
|
275
|
+
</Popover.Trigger>
|
|
276
|
+
<Popover.Content elevation="none" className={cs('vui-sidemenu-item-content', className)}>
|
|
277
|
+
<Box flexDirection="column" justifyContent="start" w="100%">
|
|
278
|
+
<Button
|
|
279
|
+
{...buttonStyles}
|
|
280
|
+
borderLeftColor={'transparent!important'}
|
|
281
|
+
minW={'240px'}
|
|
282
|
+
isActive={isOpen && isExactlyActive}
|
|
283
|
+
>
|
|
284
|
+
<SidemenuItemContent title={title} isInPopover={true} />
|
|
285
|
+
</Button>
|
|
286
|
+
{children}
|
|
287
|
+
</Box>
|
|
288
|
+
</Popover.Content>
|
|
289
|
+
</PopoverHovered>
|
|
290
|
+
)}
|
|
244
291
|
</Popover>
|
|
245
292
|
) : (
|
|
246
293
|
<Button
|
|
@@ -56,7 +56,7 @@ const SidemenuInner = vui<'div', SidemenuV2Props>((props, ref) => {
|
|
|
56
56
|
|
|
57
57
|
// Get state from context
|
|
58
58
|
const context = useSidemenuContext()
|
|
59
|
-
const { isMenuExpanded =
|
|
59
|
+
const { isMenuExpanded = false, setIsExpanded } = context || {}
|
|
60
60
|
|
|
61
61
|
// Get styles configuration early
|
|
62
62
|
const styles = useStyleConfig('SidemenuV2', props)
|