@juspay/blend-design-system 0.0.37-beta.8 → 0.0.37
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/components/Accordion/index.d.ts +2 -0
- package/dist/components/AccordionV2/accordionV2.animations.d.ts +1 -1
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Breadcrumb/index.d.ts +1 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/ButtonGroup/index.d.ts +1 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/CardV2/CardV2.d.ts +45 -0
- package/dist/components/CardV2/CardV2.utils.d.ts +14 -0
- package/dist/components/CardV2/CardV2Components.d.ts +8 -0
- package/dist/components/CardV2/CardV2Context.d.ts +14 -0
- package/dist/components/CardV2/CardV2Skeleton.d.ts +6 -0
- package/dist/components/CardV2/accessibility/CardV2AccessibilityReport.d.ts +2 -0
- package/dist/components/CardV2/accessibility/index.d.ts +1 -0
- package/dist/components/CardV2/cardV2.dark.tokens.d.ts +3 -0
- package/dist/components/CardV2/cardV2.light.tokens.d.ts +3 -0
- package/dist/components/CardV2/cardV2.tokens.d.ts +5 -0
- package/dist/components/CardV2/cardV2.tokens.types.d.ts +92 -0
- package/dist/components/CardV2/cardV2.types.d.ts +106 -0
- package/dist/components/CardV2/index.d.ts +5 -0
- package/dist/components/Charts/index.d.ts +10 -0
- package/dist/components/Charts/types.d.ts +2 -0
- package/dist/components/ChatInput/index.d.ts +1 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/CodeEditor/index.d.ts +1 -0
- package/dist/components/DataTable/PivotTableModal/pivotModal.styled.d.ts +184 -0
- package/dist/components/DataTable/TableBody/types.d.ts +3 -1
- package/dist/components/DataTable/hooks/index.d.ts +2 -0
- package/dist/components/DataTable/hooks/useReducedMotion.d.ts +1 -0
- package/dist/components/DataTable/hooks/useRowFlip.d.ts +6 -0
- package/dist/components/DataTable/types.d.ts +26 -0
- package/dist/components/DateRangePicker/CalendarGrid.d.ts +5 -2
- package/dist/components/DateRangePicker/types.d.ts +3 -1
- package/dist/components/DateRangePicker/utils.d.ts +5 -5
- package/dist/components/Directory/Directory.d.ts +1 -1
- package/dist/components/Directory/NavItem.d.ts +1 -1
- package/dist/components/Directory/Section.d.ts +1 -1
- package/dist/components/Directory/VirtualizedDirectory.d.ts +3 -0
- package/dist/components/Directory/directory.tokens.d.ts +7 -0
- package/dist/components/Directory/types.d.ts +38 -1
- package/dist/components/Directory/utils.d.ts +3 -1
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Inputs/MultiValueInput/index.d.ts +1 -0
- package/dist/components/Inputs/NumberInput/index.d.ts +1 -0
- package/dist/components/Inputs/OTPInput/index.d.ts +1 -0
- package/dist/components/Inputs/SearchInput/index.d.ts +1 -0
- package/dist/components/Inputs/TextArea/index.d.ts +1 -0
- package/dist/components/Inputs/TextInput/index.d.ts +1 -0
- package/dist/components/InputsV2/TextAreaV2/utils.d.ts +2 -1
- package/dist/components/InputsV2/TextInputV2/utils.d.ts +2 -1
- package/dist/components/InputsV2/UploadV2/UploadContainerV2.d.ts +24 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.d.ts +31 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.dark.tokens.d.ts +3 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.light.tokens.d.ts +3 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.tokens.d.ts +5 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.tokens.types.d.ts +115 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.types.d.ts +56 -0
- package/dist/components/InputsV2/UploadV2/index.d.ts +3 -0
- package/dist/components/InputsV2/UploadV2/utils.d.ts +32 -0
- package/dist/components/KeyValuePair/index.d.ts +1 -0
- package/dist/components/Menu/Menu.d.ts +1 -1
- package/dist/components/Menu/index.d.ts +1 -0
- package/dist/components/Menu/types.d.ts +7 -0
- package/dist/components/Menu/utils.d.ts +10 -2
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/ModalV2/ModalV2.d.ts +22 -0
- package/dist/components/ModalV2/ModalV2Footer.d.ts +10 -0
- package/dist/components/ModalV2/ModalV2Header.d.ts +15 -0
- package/dist/components/ModalV2/ModalV2Skeleton.d.ts +4 -0
- package/dist/components/ModalV2/index.d.ts +4 -0
- package/dist/components/ModalV2/mobileModalV2.d.ts +23 -0
- package/dist/components/ModalV2/modalAnimationV2.d.ts +3 -0
- package/dist/components/ModalV2/modalV2.dark.tokens.d.ts +3 -0
- package/dist/components/ModalV2/modalV2.light.tokens.d.ts +3 -0
- package/dist/components/ModalV2/modalV2.tokens.d.ts +5 -0
- package/dist/components/ModalV2/modalV2.tokens.types.d.ts +91 -0
- package/dist/components/ModalV2/modalV2.types.d.ts +66 -0
- package/dist/components/MultiSelect/index.d.ts +2 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Primitives/Block/Block.d.ts +1 -1
- package/dist/components/ProgressBar/index.d.ts +1 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Sidebar/SidebarContent.d.ts +9 -1
- package/dist/components/Sidebar/index.d.ts +1 -0
- package/dist/components/Sidebar/types.d.ts +9 -1
- package/dist/components/SidebarV2/SidebarV2Panel.d.ts +10 -2
- package/dist/components/SidebarV2/types.d.ts +9 -1
- package/dist/components/SingleSelect/index.d.ts +1 -0
- package/dist/components/Skeleton/SkeletonCompound.d.ts +24 -33
- package/dist/components/Snackbar/index.d.ts +2 -0
- package/dist/components/StatCard/index.d.ts +1 -0
- package/dist/components/Stepper/index.d.ts +1 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tags/index.d.ts +1 -0
- package/dist/components/Timeline/Timeline.d.ts +13 -37
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Topbar/index.d.ts +1 -0
- package/dist/components/Upload/index.d.ts +1 -0
- package/dist/context/ThemeContext.d.ts +6 -0
- package/dist/context/useComponentToken.d.ts +4 -1
- package/dist/main.d.ts +6 -0
- package/dist/main.js +45081 -41934
- package/dist/node-B3rrXW84.js +1023 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +21 -18
- package/dist/token-engine.js +1 -1
- package/lib/components/Accordion/AccordionItem.tsx +2 -6
- package/lib/components/Accordion/index.ts +2 -0
- package/lib/components/AccordionV2/AccordionV2Item.tsx +1 -1
- package/lib/components/AccordionV2/accordionV2.animations.ts +1 -5
- package/lib/components/Alert/index.ts +1 -0
- package/lib/components/Avatar/index.ts +1 -0
- package/lib/components/Breadcrumb/index.ts +1 -0
- package/lib/components/Button/index.ts +1 -0
- package/lib/components/ButtonGroup/index.ts +1 -0
- package/lib/components/Card/index.ts +1 -0
- package/lib/components/CardV2/CardV2.tsx +327 -0
- package/lib/components/CardV2/CardV2.utils.tsx +77 -0
- package/lib/components/CardV2/CardV2Components.tsx +297 -0
- package/lib/components/CardV2/CardV2Context.tsx +18 -0
- package/lib/components/CardV2/CardV2Skeleton.tsx +40 -0
- package/lib/components/CardV2/accessibility/CardV2AccessibilityReport.ts +284 -0
- package/lib/components/CardV2/accessibility/index.ts +1 -0
- package/lib/components/CardV2/cardV2.dark.tokens.ts +177 -0
- package/lib/components/CardV2/cardV2.light.tokens.ts +177 -0
- package/lib/components/CardV2/cardV2.tokens.ts +21 -0
- package/lib/components/CardV2/cardV2.tokens.types.ts +94 -0
- package/lib/components/CardV2/cardV2.types.ts +131 -0
- package/lib/components/CardV2/index.ts +13 -0
- package/lib/components/Charts/ChartLegend.tsx +25 -5
- package/lib/components/Charts/Charts.tsx +10 -0
- package/lib/components/Charts/index.ts +10 -0
- package/lib/components/Charts/types.tsx +2 -0
- package/lib/components/ChatInput/index.tsx +1 -0
- package/lib/components/Checkbox/index.ts +1 -0
- package/lib/components/CodeEditor/index.ts +1 -0
- package/lib/components/DataTable/DataTable.tsx +8 -0
- package/lib/components/DataTable/TableBody/index.tsx +47 -11
- package/lib/components/DataTable/TableBody/types.ts +7 -1
- package/lib/components/DataTable/TableCell/index.tsx +1 -1
- package/lib/components/DataTable/hooks/index.ts +2 -0
- package/lib/components/DataTable/hooks/useReducedMotion.ts +19 -0
- package/lib/components/DataTable/hooks/useRowFlip.ts +170 -0
- package/lib/components/DataTable/types.ts +32 -0
- package/lib/components/DateRangePicker/CalendarGrid.tsx +36 -6
- package/lib/components/DateRangePicker/DateRangePicker.tsx +22 -3
- package/lib/components/DateRangePicker/types.ts +6 -1
- package/lib/components/DateRangePicker/utils.ts +123 -12
- package/lib/components/Directory/Directory.tsx +31 -0
- package/lib/components/Directory/NavItem.tsx +177 -86
- package/lib/components/Directory/Section.tsx +9 -0
- package/lib/components/Directory/VirtualizedDirectory.tsx +670 -0
- package/lib/components/Directory/directory.tokens.ts +21 -0
- package/lib/components/Directory/types.ts +43 -1
- package/lib/components/Directory/utils.ts +81 -1
- package/lib/components/Drawer/index.ts +1 -0
- package/lib/components/Inputs/DropdownInput/DropdownInput.tsx +6 -2
- package/lib/components/Inputs/MultiValueInput/index.ts +1 -0
- package/lib/components/Inputs/NumberInput/NumberInput.tsx +6 -2
- package/lib/components/Inputs/NumberInput/index.ts +1 -0
- package/lib/components/Inputs/OTPInput/index.ts +1 -0
- package/lib/components/Inputs/SearchInput/index.ts +1 -0
- package/lib/components/Inputs/TextArea/TextArea.tsx +4 -2
- package/lib/components/Inputs/TextArea/index.ts +1 -0
- package/lib/components/Inputs/TextInput/TextInput.tsx +6 -2
- package/lib/components/Inputs/TextInput/index.ts +1 -0
- package/lib/components/Inputs/UnitInput/UnitInput.tsx +6 -2
- package/lib/components/InputsV2/NumberInputV2/NumberInputV2.tsx +6 -2
- package/lib/components/InputsV2/TextAreaV2/TextAreaV2.tsx +2 -1
- package/lib/components/InputsV2/TextAreaV2/utils.ts +3 -1
- package/lib/components/InputsV2/TextInputV2/TextInputV2.tsx +1 -0
- package/lib/components/InputsV2/TextInputV2/utils.ts +6 -8
- package/lib/components/InputsV2/UploadV2/UploadContainerV2.tsx +470 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.dark.tokens.ts +348 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.light.tokens.ts +348 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.tokens.ts +20 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.tokens.types.ts +117 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.tsx +336 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.types.ts +67 -0
- package/lib/components/InputsV2/UploadV2/index.ts +3 -0
- package/lib/components/InputsV2/UploadV2/utils.ts +170 -0
- package/lib/components/KeyValuePair/index.ts +1 -0
- package/lib/components/Menu/Menu.tsx +18 -2
- package/lib/components/Menu/SubMenu.tsx +25 -3
- package/lib/components/Menu/index.ts +1 -0
- package/lib/components/Menu/types.tsx +14 -0
- package/lib/components/Menu/utils.ts +46 -3
- package/lib/components/Modal/index.ts +1 -0
- package/lib/components/ModalV2/ModalV2.tsx +269 -0
- package/lib/components/ModalV2/ModalV2Footer.tsx +76 -0
- package/lib/components/ModalV2/ModalV2Header.tsx +144 -0
- package/lib/components/ModalV2/ModalV2Skeleton.tsx +80 -0
- package/lib/components/ModalV2/index.ts +4 -0
- package/lib/components/ModalV2/mobileModalV2.tsx +411 -0
- package/lib/components/ModalV2/modalAnimationV2.tsx +19 -0
- package/lib/components/ModalV2/modalV2.dark.tokens.ts +183 -0
- package/lib/components/ModalV2/modalV2.light.tokens.ts +183 -0
- package/lib/components/ModalV2/modalV2.tokens.ts +21 -0
- package/lib/components/ModalV2/modalV2.tokens.types.ts +94 -0
- package/lib/components/ModalV2/modalV2.types.ts +80 -0
- package/lib/components/MultiSelect/MultiSelect.tsx +2 -1
- package/lib/components/MultiSelect/MultiSelectTrigger.tsx +2 -1
- package/lib/components/MultiSelect/index.ts +2 -0
- package/lib/components/MultiSelectV2/MultiSelectV2Trigger.tsx +4 -1
- package/lib/components/Popover/index.ts +1 -0
- package/lib/components/Primitives/Block/Block.tsx +1 -1
- package/lib/components/ProgressBar/index.ts +1 -0
- package/lib/components/Radio/index.ts +2 -0
- package/lib/components/Sidebar/Sidebar.tsx +38 -0
- package/lib/components/Sidebar/SidebarContent.tsx +25 -1
- package/lib/components/Sidebar/index.ts +1 -0
- package/lib/components/Sidebar/types.ts +13 -1
- package/lib/components/SidebarV2/SidebarV2.tsx +30 -0
- package/lib/components/SidebarV2/SidebarV2Panel.tsx +25 -1
- package/lib/components/SidebarV2/types.ts +9 -1
- package/lib/components/SingleSelect/SingleSelect.tsx +2 -1
- package/lib/components/SingleSelect/SingleSelectTrigger.tsx +3 -1
- package/lib/components/SingleSelect/index.ts +1 -0
- package/lib/components/SingleSelectV2/SingleSelectV2Trigger.tsx +3 -1
- package/lib/components/Skeleton/SkeletonCompound.tsx +45 -31
- package/lib/components/Snackbar/index.ts +2 -0
- package/lib/components/StatCard/index.ts +1 -0
- package/lib/components/Stepper/index.ts +1 -0
- package/lib/components/Switch/index.ts +2 -0
- package/lib/components/Tabs/index.ts +1 -0
- package/lib/components/Tags/index.ts +1 -0
- package/lib/components/Timeline/Timeline.tsx +9 -1
- package/lib/components/Tooltip/index.ts +1 -0
- package/lib/components/Topbar/index.ts +1 -0
- package/lib/components/Upload/index.ts +1 -0
- package/lib/context/ThemeContext.tsx +16 -0
- package/lib/context/initComponentTokens.ts +11 -0
- package/lib/context/useComponentToken.ts +15 -1
- package/lib/hooks/useResponsiveTokens.ts +63 -0
- package/lib/main.ts +16 -0
- package/lib/node.ts +2 -0
- package/package.json +1 -1
- /package/dist/{node-CovJEwot.js → breadcrumbV2.tokens-CovJEwot.js} +0 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { FoundationTokenType } from '../../tokens/theme.token'
|
|
2
|
+
import { CardV2Orientation, CardV2Padding, CardV2Variant } from './cardV2.types'
|
|
3
|
+
import type { ResponsiveCardV2Tokens } from './cardV2.tokens.types'
|
|
4
|
+
|
|
5
|
+
export const getCardV2DarkTokens = (
|
|
6
|
+
foundationToken: FoundationTokenType
|
|
7
|
+
): ResponsiveCardV2Tokens => {
|
|
8
|
+
const lgTokens = {
|
|
9
|
+
width: '100%',
|
|
10
|
+
minWidth: '0',
|
|
11
|
+
maxWidth: '100%',
|
|
12
|
+
borderRadius: foundationToken.border.radius[12],
|
|
13
|
+
border: {
|
|
14
|
+
[CardV2Variant.OUTLINED]: `1px solid ${foundationToken.colors.gray[700]}`,
|
|
15
|
+
[CardV2Variant.ELEVATED]: `1px solid ${foundationToken.colors.gray[700]}`,
|
|
16
|
+
[CardV2Variant.GHOST]: '1px solid transparent',
|
|
17
|
+
},
|
|
18
|
+
backgroundColor: {
|
|
19
|
+
[CardV2Variant.OUTLINED]: foundationToken.colors.gray[900],
|
|
20
|
+
[CardV2Variant.ELEVATED]: foundationToken.colors.gray[900],
|
|
21
|
+
[CardV2Variant.GHOST]: 'transparent',
|
|
22
|
+
},
|
|
23
|
+
boxShadow: {
|
|
24
|
+
[CardV2Variant.OUTLINED]: 'none',
|
|
25
|
+
[CardV2Variant.ELEVATED]: foundationToken.shadows.sm,
|
|
26
|
+
[CardV2Variant.GHOST]: 'none',
|
|
27
|
+
},
|
|
28
|
+
state: {
|
|
29
|
+
hover: {
|
|
30
|
+
border: `1px solid ${foundationToken.colors.gray[600]}`,
|
|
31
|
+
boxShadow: foundationToken.shadows.sm,
|
|
32
|
+
},
|
|
33
|
+
selected: {
|
|
34
|
+
border: `1px solid ${foundationToken.colors.primary[400]}`,
|
|
35
|
+
boxShadow: `0 0 0 3px ${foundationToken.colors.primary[900]}`,
|
|
36
|
+
},
|
|
37
|
+
focus: {
|
|
38
|
+
outline: `2px solid ${foundationToken.colors.primary[400]}`,
|
|
39
|
+
outlineOffset: foundationToken.unit[2],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
padding: {
|
|
43
|
+
[CardV2Padding.NONE]: {
|
|
44
|
+
x: '0',
|
|
45
|
+
y: '0',
|
|
46
|
+
},
|
|
47
|
+
[CardV2Padding.COMPACT]: {
|
|
48
|
+
x: foundationToken.unit[10],
|
|
49
|
+
y: foundationToken.unit[10],
|
|
50
|
+
},
|
|
51
|
+
[CardV2Padding.COMFORTABLE]: {
|
|
52
|
+
x: foundationToken.unit[12],
|
|
53
|
+
y: foundationToken.unit[12],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
layout: {
|
|
57
|
+
gap: foundationToken.unit[10],
|
|
58
|
+
mediaGap: {
|
|
59
|
+
[CardV2Orientation.VERTICAL]: foundationToken.unit[10],
|
|
60
|
+
[CardV2Orientation.HORIZONTAL]: foundationToken.unit[12],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
media: {
|
|
64
|
+
width: foundationToken.unit[64],
|
|
65
|
+
height: foundationToken.unit[64],
|
|
66
|
+
minHeight: '96px',
|
|
67
|
+
borderRadius: foundationToken.border.radius[8],
|
|
68
|
+
backgroundColor: foundationToken.colors.gray[800],
|
|
69
|
+
},
|
|
70
|
+
header: {
|
|
71
|
+
gap: foundationToken.unit[6],
|
|
72
|
+
eyebrow: {
|
|
73
|
+
fontSize: foundationToken.font.fontSize[12],
|
|
74
|
+
fontWeight: foundationToken.font.weight[600],
|
|
75
|
+
lineHeight: foundationToken.font.lineHeight[18],
|
|
76
|
+
color: foundationToken.colors.gray[300],
|
|
77
|
+
},
|
|
78
|
+
title: {
|
|
79
|
+
fontSize: foundationToken.font.fontSize[16],
|
|
80
|
+
fontWeight: foundationToken.font.weight[600],
|
|
81
|
+
lineHeight: foundationToken.font.lineHeight[24],
|
|
82
|
+
color: foundationToken.colors.gray[50],
|
|
83
|
+
},
|
|
84
|
+
subtitle: {
|
|
85
|
+
fontSize: foundationToken.font.fontSize[14],
|
|
86
|
+
fontWeight: foundationToken.font.weight[500],
|
|
87
|
+
lineHeight: foundationToken.font.lineHeight[20],
|
|
88
|
+
color: foundationToken.colors.gray[300],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
body: {
|
|
92
|
+
gap: foundationToken.unit[10],
|
|
93
|
+
description: {
|
|
94
|
+
fontSize: foundationToken.font.fontSize[14],
|
|
95
|
+
fontWeight: foundationToken.font.weight[400],
|
|
96
|
+
lineHeight: foundationToken.font.lineHeight[20],
|
|
97
|
+
color: foundationToken.colors.gray[200],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
footer: {
|
|
101
|
+
gap: foundationToken.unit[8],
|
|
102
|
+
paddingTop: foundationToken.unit[10],
|
|
103
|
+
borderTop: `1px solid ${foundationToken.colors.gray[700]}`,
|
|
104
|
+
},
|
|
105
|
+
actions: {
|
|
106
|
+
gap: foundationToken.unit[8],
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const smTokens = {
|
|
111
|
+
...lgTokens,
|
|
112
|
+
borderRadius: foundationToken.border.radius[8],
|
|
113
|
+
padding: {
|
|
114
|
+
[CardV2Padding.NONE]: {
|
|
115
|
+
x: '0',
|
|
116
|
+
y: '0',
|
|
117
|
+
},
|
|
118
|
+
[CardV2Padding.COMPACT]: {
|
|
119
|
+
x: foundationToken.unit[8],
|
|
120
|
+
y: foundationToken.unit[8],
|
|
121
|
+
},
|
|
122
|
+
[CardV2Padding.COMFORTABLE]: {
|
|
123
|
+
x: foundationToken.unit[10],
|
|
124
|
+
y: foundationToken.unit[10],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
layout: {
|
|
128
|
+
gap: foundationToken.unit[8],
|
|
129
|
+
mediaGap: {
|
|
130
|
+
[CardV2Orientation.VERTICAL]: foundationToken.unit[8],
|
|
131
|
+
[CardV2Orientation.HORIZONTAL]: foundationToken.unit[10],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
media: {
|
|
135
|
+
...lgTokens.media,
|
|
136
|
+
width: foundationToken.unit[56],
|
|
137
|
+
height: foundationToken.unit[56],
|
|
138
|
+
minHeight: '80px',
|
|
139
|
+
},
|
|
140
|
+
header: {
|
|
141
|
+
...lgTokens.header,
|
|
142
|
+
gap: foundationToken.unit[4],
|
|
143
|
+
title: {
|
|
144
|
+
...lgTokens.header.title,
|
|
145
|
+
fontSize: foundationToken.font.fontSize[14],
|
|
146
|
+
lineHeight: foundationToken.font.lineHeight[20],
|
|
147
|
+
},
|
|
148
|
+
subtitle: {
|
|
149
|
+
...lgTokens.header.subtitle,
|
|
150
|
+
fontSize: foundationToken.font.fontSize[12],
|
|
151
|
+
lineHeight: foundationToken.font.lineHeight[18],
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
body: {
|
|
155
|
+
...lgTokens.body,
|
|
156
|
+
gap: foundationToken.unit[8],
|
|
157
|
+
description: {
|
|
158
|
+
...lgTokens.body.description,
|
|
159
|
+
fontSize: foundationToken.font.fontSize[12],
|
|
160
|
+
lineHeight: foundationToken.font.lineHeight[18],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
footer: {
|
|
164
|
+
...lgTokens.footer,
|
|
165
|
+
gap: foundationToken.unit[6],
|
|
166
|
+
paddingTop: foundationToken.unit[8],
|
|
167
|
+
},
|
|
168
|
+
actions: {
|
|
169
|
+
gap: foundationToken.unit[6],
|
|
170
|
+
},
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
sm: smTokens,
|
|
175
|
+
lg: lgTokens,
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { FoundationTokenType } from '../../tokens/theme.token'
|
|
2
|
+
import { CardV2Orientation, CardV2Padding, CardV2Variant } from './cardV2.types'
|
|
3
|
+
import type { ResponsiveCardV2Tokens } from './cardV2.tokens.types'
|
|
4
|
+
|
|
5
|
+
export const getCardV2LightTokens = (
|
|
6
|
+
foundationToken: FoundationTokenType
|
|
7
|
+
): ResponsiveCardV2Tokens => {
|
|
8
|
+
const lgTokens = {
|
|
9
|
+
width: '100%',
|
|
10
|
+
minWidth: '0',
|
|
11
|
+
maxWidth: '100%',
|
|
12
|
+
borderRadius: foundationToken.border.radius[12],
|
|
13
|
+
border: {
|
|
14
|
+
[CardV2Variant.OUTLINED]: `1px solid ${foundationToken.colors.gray[200]}`,
|
|
15
|
+
[CardV2Variant.ELEVATED]: `1px solid ${foundationToken.colors.gray[100]}`,
|
|
16
|
+
[CardV2Variant.GHOST]: '1px solid transparent',
|
|
17
|
+
},
|
|
18
|
+
backgroundColor: {
|
|
19
|
+
[CardV2Variant.OUTLINED]: foundationToken.colors.gray[0],
|
|
20
|
+
[CardV2Variant.ELEVATED]: foundationToken.colors.gray[0],
|
|
21
|
+
[CardV2Variant.GHOST]: 'transparent',
|
|
22
|
+
},
|
|
23
|
+
boxShadow: {
|
|
24
|
+
[CardV2Variant.OUTLINED]: 'none',
|
|
25
|
+
[CardV2Variant.ELEVATED]: foundationToken.shadows.sm,
|
|
26
|
+
[CardV2Variant.GHOST]: 'none',
|
|
27
|
+
},
|
|
28
|
+
state: {
|
|
29
|
+
hover: {
|
|
30
|
+
border: `1px solid ${foundationToken.colors.gray[300]}`,
|
|
31
|
+
boxShadow: foundationToken.shadows.sm,
|
|
32
|
+
},
|
|
33
|
+
selected: {
|
|
34
|
+
border: `1px solid ${foundationToken.colors.primary[500]}`,
|
|
35
|
+
boxShadow: `0 0 0 3px ${foundationToken.colors.primary[50]}`,
|
|
36
|
+
},
|
|
37
|
+
focus: {
|
|
38
|
+
outline: `2px solid ${foundationToken.colors.primary[500]}`,
|
|
39
|
+
outlineOffset: foundationToken.unit[2],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
padding: {
|
|
43
|
+
[CardV2Padding.NONE]: {
|
|
44
|
+
x: '0',
|
|
45
|
+
y: '0',
|
|
46
|
+
},
|
|
47
|
+
[CardV2Padding.COMPACT]: {
|
|
48
|
+
x: foundationToken.unit[10],
|
|
49
|
+
y: foundationToken.unit[10],
|
|
50
|
+
},
|
|
51
|
+
[CardV2Padding.COMFORTABLE]: {
|
|
52
|
+
x: foundationToken.unit[12],
|
|
53
|
+
y: foundationToken.unit[12],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
layout: {
|
|
57
|
+
gap: foundationToken.unit[10],
|
|
58
|
+
mediaGap: {
|
|
59
|
+
[CardV2Orientation.VERTICAL]: foundationToken.unit[10],
|
|
60
|
+
[CardV2Orientation.HORIZONTAL]: foundationToken.unit[12],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
media: {
|
|
64
|
+
width: foundationToken.unit[64],
|
|
65
|
+
height: foundationToken.unit[64],
|
|
66
|
+
minHeight: '96px',
|
|
67
|
+
borderRadius: foundationToken.border.radius[8],
|
|
68
|
+
backgroundColor: foundationToken.colors.gray[50],
|
|
69
|
+
},
|
|
70
|
+
header: {
|
|
71
|
+
gap: foundationToken.unit[6],
|
|
72
|
+
eyebrow: {
|
|
73
|
+
fontSize: foundationToken.font.fontSize[12],
|
|
74
|
+
fontWeight: foundationToken.font.weight[600],
|
|
75
|
+
lineHeight: foundationToken.font.lineHeight[18],
|
|
76
|
+
color: foundationToken.colors.gray[500],
|
|
77
|
+
},
|
|
78
|
+
title: {
|
|
79
|
+
fontSize: foundationToken.font.fontSize[16],
|
|
80
|
+
fontWeight: foundationToken.font.weight[600],
|
|
81
|
+
lineHeight: foundationToken.font.lineHeight[24],
|
|
82
|
+
color: foundationToken.colors.gray[800],
|
|
83
|
+
},
|
|
84
|
+
subtitle: {
|
|
85
|
+
fontSize: foundationToken.font.fontSize[14],
|
|
86
|
+
fontWeight: foundationToken.font.weight[500],
|
|
87
|
+
lineHeight: foundationToken.font.lineHeight[20],
|
|
88
|
+
color: foundationToken.colors.gray[500],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
body: {
|
|
92
|
+
gap: foundationToken.unit[10],
|
|
93
|
+
description: {
|
|
94
|
+
fontSize: foundationToken.font.fontSize[14],
|
|
95
|
+
fontWeight: foundationToken.font.weight[400],
|
|
96
|
+
lineHeight: foundationToken.font.lineHeight[20],
|
|
97
|
+
color: foundationToken.colors.gray[600],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
footer: {
|
|
101
|
+
gap: foundationToken.unit[8],
|
|
102
|
+
paddingTop: foundationToken.unit[10],
|
|
103
|
+
borderTop: `1px solid ${foundationToken.colors.gray[100]}`,
|
|
104
|
+
},
|
|
105
|
+
actions: {
|
|
106
|
+
gap: foundationToken.unit[8],
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const smTokens = {
|
|
111
|
+
...lgTokens,
|
|
112
|
+
borderRadius: foundationToken.border.radius[8],
|
|
113
|
+
padding: {
|
|
114
|
+
[CardV2Padding.NONE]: {
|
|
115
|
+
x: '0',
|
|
116
|
+
y: '0',
|
|
117
|
+
},
|
|
118
|
+
[CardV2Padding.COMPACT]: {
|
|
119
|
+
x: foundationToken.unit[8],
|
|
120
|
+
y: foundationToken.unit[8],
|
|
121
|
+
},
|
|
122
|
+
[CardV2Padding.COMFORTABLE]: {
|
|
123
|
+
x: foundationToken.unit[10],
|
|
124
|
+
y: foundationToken.unit[10],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
layout: {
|
|
128
|
+
gap: foundationToken.unit[8],
|
|
129
|
+
mediaGap: {
|
|
130
|
+
[CardV2Orientation.VERTICAL]: foundationToken.unit[8],
|
|
131
|
+
[CardV2Orientation.HORIZONTAL]: foundationToken.unit[10],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
media: {
|
|
135
|
+
...lgTokens.media,
|
|
136
|
+
width: foundationToken.unit[56],
|
|
137
|
+
height: foundationToken.unit[56],
|
|
138
|
+
minHeight: '80px',
|
|
139
|
+
},
|
|
140
|
+
header: {
|
|
141
|
+
...lgTokens.header,
|
|
142
|
+
gap: foundationToken.unit[4],
|
|
143
|
+
title: {
|
|
144
|
+
...lgTokens.header.title,
|
|
145
|
+
fontSize: foundationToken.font.fontSize[14],
|
|
146
|
+
lineHeight: foundationToken.font.lineHeight[20],
|
|
147
|
+
},
|
|
148
|
+
subtitle: {
|
|
149
|
+
...lgTokens.header.subtitle,
|
|
150
|
+
fontSize: foundationToken.font.fontSize[12],
|
|
151
|
+
lineHeight: foundationToken.font.lineHeight[18],
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
body: {
|
|
155
|
+
...lgTokens.body,
|
|
156
|
+
gap: foundationToken.unit[8],
|
|
157
|
+
description: {
|
|
158
|
+
...lgTokens.body.description,
|
|
159
|
+
fontSize: foundationToken.font.fontSize[12],
|
|
160
|
+
lineHeight: foundationToken.font.lineHeight[18],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
footer: {
|
|
164
|
+
...lgTokens.footer,
|
|
165
|
+
gap: foundationToken.unit[6],
|
|
166
|
+
paddingTop: foundationToken.unit[8],
|
|
167
|
+
},
|
|
168
|
+
actions: {
|
|
169
|
+
gap: foundationToken.unit[6],
|
|
170
|
+
},
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
sm: smTokens,
|
|
175
|
+
lg: lgTokens,
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FoundationTokenType } from '../../tokens/theme.token'
|
|
2
|
+
import { Theme } from '../../context/theme.enum'
|
|
3
|
+
import { getCardV2DarkTokens } from './cardV2.dark.tokens'
|
|
4
|
+
import { getCardV2LightTokens } from './cardV2.light.tokens'
|
|
5
|
+
import type { ResponsiveCardV2Tokens } from './cardV2.tokens.types'
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
CardV2TokensType,
|
|
9
|
+
ResponsiveCardV2Tokens,
|
|
10
|
+
} from './cardV2.tokens.types'
|
|
11
|
+
|
|
12
|
+
export const getCardV2Tokens = (
|
|
13
|
+
foundationToken: FoundationTokenType,
|
|
14
|
+
theme: Theme | string = Theme.LIGHT
|
|
15
|
+
): ResponsiveCardV2Tokens => {
|
|
16
|
+
if (theme === Theme.DARK || theme === 'dark') {
|
|
17
|
+
return getCardV2DarkTokens(foundationToken)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return getCardV2LightTokens(foundationToken)
|
|
21
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { CSSObject } from 'styled-components'
|
|
2
|
+
import type { BreakpointType } from '../../breakpoints/breakPoints'
|
|
3
|
+
import { CardV2Orientation, CardV2Padding, CardV2Variant } from './cardV2.types'
|
|
4
|
+
|
|
5
|
+
export type CardV2TokensType = {
|
|
6
|
+
width: CSSObject['width']
|
|
7
|
+
minWidth: CSSObject['minWidth']
|
|
8
|
+
maxWidth: CSSObject['maxWidth']
|
|
9
|
+
borderRadius: CSSObject['borderRadius']
|
|
10
|
+
border: {
|
|
11
|
+
[key in CardV2Variant]: CSSObject['border']
|
|
12
|
+
}
|
|
13
|
+
backgroundColor: {
|
|
14
|
+
[key in CardV2Variant]: CSSObject['backgroundColor']
|
|
15
|
+
}
|
|
16
|
+
boxShadow: {
|
|
17
|
+
[key in CardV2Variant]: CSSObject['boxShadow']
|
|
18
|
+
}
|
|
19
|
+
state: {
|
|
20
|
+
hover: {
|
|
21
|
+
border: CSSObject['border']
|
|
22
|
+
boxShadow: CSSObject['boxShadow']
|
|
23
|
+
}
|
|
24
|
+
selected: {
|
|
25
|
+
border: CSSObject['border']
|
|
26
|
+
boxShadow: CSSObject['boxShadow']
|
|
27
|
+
}
|
|
28
|
+
focus: {
|
|
29
|
+
outline: CSSObject['outline']
|
|
30
|
+
outlineOffset: CSSObject['outlineOffset']
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
padding: {
|
|
34
|
+
[key in CardV2Padding]: {
|
|
35
|
+
x: CSSObject['padding']
|
|
36
|
+
y: CSSObject['padding']
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
layout: {
|
|
40
|
+
gap: CSSObject['gap']
|
|
41
|
+
mediaGap: {
|
|
42
|
+
[key in CardV2Orientation]: CSSObject['gap']
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
media: {
|
|
46
|
+
width: CSSObject['width']
|
|
47
|
+
height: CSSObject['height']
|
|
48
|
+
minHeight: CSSObject['minHeight']
|
|
49
|
+
borderRadius: CSSObject['borderRadius']
|
|
50
|
+
backgroundColor: CSSObject['backgroundColor']
|
|
51
|
+
}
|
|
52
|
+
header: {
|
|
53
|
+
gap: CSSObject['gap']
|
|
54
|
+
eyebrow: {
|
|
55
|
+
fontSize: CSSObject['fontSize']
|
|
56
|
+
fontWeight: CSSObject['fontWeight']
|
|
57
|
+
lineHeight: CSSObject['lineHeight']
|
|
58
|
+
color: CSSObject['color']
|
|
59
|
+
}
|
|
60
|
+
title: {
|
|
61
|
+
fontSize: CSSObject['fontSize']
|
|
62
|
+
fontWeight: CSSObject['fontWeight']
|
|
63
|
+
lineHeight: CSSObject['lineHeight']
|
|
64
|
+
color: CSSObject['color']
|
|
65
|
+
}
|
|
66
|
+
subtitle: {
|
|
67
|
+
fontSize: CSSObject['fontSize']
|
|
68
|
+
fontWeight: CSSObject['fontWeight']
|
|
69
|
+
lineHeight: CSSObject['lineHeight']
|
|
70
|
+
color: CSSObject['color']
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
body: {
|
|
74
|
+
gap: CSSObject['gap']
|
|
75
|
+
description: {
|
|
76
|
+
fontSize: CSSObject['fontSize']
|
|
77
|
+
fontWeight: CSSObject['fontWeight']
|
|
78
|
+
lineHeight: CSSObject['lineHeight']
|
|
79
|
+
color: CSSObject['color']
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
footer: {
|
|
83
|
+
gap: CSSObject['gap']
|
|
84
|
+
paddingTop: CSSObject['paddingTop']
|
|
85
|
+
borderTop: CSSObject['borderTop']
|
|
86
|
+
}
|
|
87
|
+
actions: {
|
|
88
|
+
gap: CSSObject['gap']
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type ResponsiveCardV2Tokens = {
|
|
93
|
+
[key in keyof BreakpointType]: CardV2TokensType
|
|
94
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FC,
|
|
3
|
+
ForwardRefExoticComponent,
|
|
4
|
+
ReactNode,
|
|
5
|
+
RefAttributes,
|
|
6
|
+
} from 'react'
|
|
7
|
+
import type { CSSObject } from 'styled-components'
|
|
8
|
+
import type { ButtonV2Props } from '../ButtonV2/buttonV2.types'
|
|
9
|
+
import type { SkeletonVariant } from '../Skeleton/types'
|
|
10
|
+
|
|
11
|
+
export enum CardV2Variant {
|
|
12
|
+
OUTLINED = 'outlined',
|
|
13
|
+
ELEVATED = 'elevated',
|
|
14
|
+
GHOST = 'ghost',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum CardV2Orientation {
|
|
18
|
+
VERTICAL = 'vertical',
|
|
19
|
+
HORIZONTAL = 'horizontal',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export enum CardV2Padding {
|
|
23
|
+
NONE = 'none',
|
|
24
|
+
COMPACT = 'compact',
|
|
25
|
+
COMFORTABLE = 'comfortable',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export enum CardV2ActionPlacement {
|
|
29
|
+
BODY = 'body',
|
|
30
|
+
FOOTER = 'footer',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type CardV2SkeletonProps = {
|
|
34
|
+
show?: boolean
|
|
35
|
+
variant?: SkeletonVariant
|
|
36
|
+
height?: CSSObject['height']
|
|
37
|
+
width?: CSSObject['width']
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type CardV2Action = ButtonV2Props
|
|
41
|
+
|
|
42
|
+
export type CardV2SectionProps = {
|
|
43
|
+
children?: ReactNode
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type CardV2HeaderProps = {
|
|
47
|
+
title?: ReactNode
|
|
48
|
+
truncateTitle?: boolean
|
|
49
|
+
subtitle?: ReactNode
|
|
50
|
+
eyebrow?: ReactNode
|
|
51
|
+
leadingSlot?: ReactNode
|
|
52
|
+
trailingSlot?: ReactNode
|
|
53
|
+
centered?: boolean
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type CardV2MetaProps = Pick<
|
|
57
|
+
CardV2HeaderProps,
|
|
58
|
+
'title' | 'truncateTitle' | 'subtitle' | 'eyebrow' | 'centered'
|
|
59
|
+
>
|
|
60
|
+
|
|
61
|
+
export type CardV2MediaProps = CardV2SectionProps & {
|
|
62
|
+
orientation?: CardV2Orientation
|
|
63
|
+
width?: CSSObject['width']
|
|
64
|
+
height?: CSSObject['height']
|
|
65
|
+
minHeight?: CSSObject['minHeight']
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type CardV2BodyProps = CardV2SectionProps & {
|
|
69
|
+
description?: ReactNode
|
|
70
|
+
actions?: CardV2Action | CardV2Action[]
|
|
71
|
+
centered?: boolean
|
|
72
|
+
scrollable?: boolean
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type CardV2ActionsProps = {
|
|
76
|
+
actions?: CardV2Action | CardV2Action[]
|
|
77
|
+
centered?: boolean
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type CardV2FooterProps = CardV2SectionProps & {
|
|
81
|
+
actions?: CardV2Action | CardV2Action[]
|
|
82
|
+
centered?: boolean
|
|
83
|
+
divider?: boolean
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type CardV2Props = {
|
|
87
|
+
variant?: CardV2Variant
|
|
88
|
+
orientation?: CardV2Orientation
|
|
89
|
+
padding?: CardV2Padding
|
|
90
|
+
title?: ReactNode
|
|
91
|
+
truncateTitle?: boolean
|
|
92
|
+
subtitle?: ReactNode
|
|
93
|
+
description?: ReactNode
|
|
94
|
+
eyebrow?: ReactNode
|
|
95
|
+
media?: ReactNode
|
|
96
|
+
mediaWidth?: CSSObject['width']
|
|
97
|
+
mediaHeight?: CSSObject['height']
|
|
98
|
+
mediaMinHeight?: CSSObject['minHeight']
|
|
99
|
+
leadingSlot?: ReactNode
|
|
100
|
+
trailingSlot?: ReactNode
|
|
101
|
+
footer?: ReactNode
|
|
102
|
+
actions?: CardV2Action | CardV2Action[]
|
|
103
|
+
actionPlacement?: CardV2ActionPlacement
|
|
104
|
+
centered?: boolean
|
|
105
|
+
interactive?: boolean
|
|
106
|
+
selected?: boolean
|
|
107
|
+
skeleton?: CardV2SkeletonProps
|
|
108
|
+
width?: CSSObject['width']
|
|
109
|
+
minWidth?: CSSObject['minWidth']
|
|
110
|
+
maxWidth?: CSSObject['maxWidth']
|
|
111
|
+
height?: CSSObject['height']
|
|
112
|
+
minHeight?: CSSObject['minHeight']
|
|
113
|
+
maxHeight?: CSSObject['maxHeight']
|
|
114
|
+
scrollable?: boolean
|
|
115
|
+
children?: ReactNode
|
|
116
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'children'>
|
|
117
|
+
|
|
118
|
+
export type CardV2Component = ForwardRefExoticComponent<
|
|
119
|
+
CardV2Props & RefAttributes<HTMLDivElement>
|
|
120
|
+
> & {
|
|
121
|
+
Header: FC<CardV2HeaderProps>
|
|
122
|
+
Meta: FC<CardV2MetaProps>
|
|
123
|
+
Media: FC<CardV2MediaProps>
|
|
124
|
+
Body: FC<CardV2BodyProps>
|
|
125
|
+
Content: FC<CardV2SectionProps>
|
|
126
|
+
Actions: FC<CardV2ActionsProps>
|
|
127
|
+
Footer: FC<CardV2FooterProps>
|
|
128
|
+
Skeleton: FC<{
|
|
129
|
+
skeleton?: CardV2SkeletonProps
|
|
130
|
+
}>
|
|
131
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as CardV2 } from './CardV2'
|
|
2
|
+
export {
|
|
3
|
+
CardV2Actions,
|
|
4
|
+
CardV2Body,
|
|
5
|
+
CardV2Content,
|
|
6
|
+
CardV2Footer,
|
|
7
|
+
CardV2Header,
|
|
8
|
+
CardV2Media,
|
|
9
|
+
CardV2Meta,
|
|
10
|
+
} from './CardV2Components'
|
|
11
|
+
export { default as CardV2Skeleton } from './CardV2Skeleton'
|
|
12
|
+
export * from './cardV2.types'
|
|
13
|
+
export * from './cardV2.tokens'
|
|
@@ -196,6 +196,7 @@ const ChartLegendsComponent: React.FC<ChartLegendsProps> = ({
|
|
|
196
196
|
stacked = false,
|
|
197
197
|
isSmallScreen = false,
|
|
198
198
|
stackedLegendsData,
|
|
199
|
+
showAllLegends = false,
|
|
199
200
|
}) => {
|
|
200
201
|
const chartTokens = useResponsiveTokens<ChartTokensType>('CHARTS')
|
|
201
202
|
const legendTokens = chartTokens.content.legend
|
|
@@ -211,6 +212,12 @@ const ChartLegendsComponent: React.FC<ChartLegendsProps> = ({
|
|
|
211
212
|
const isExpanding = useRef<boolean>(false)
|
|
212
213
|
// Have to revisit from optimizaion POV.
|
|
213
214
|
const handleResize = useCallback(() => {
|
|
215
|
+
if (showAllLegends) {
|
|
216
|
+
setCuttOffIndex(displayLegends.length)
|
|
217
|
+
setIsLoading(false)
|
|
218
|
+
return
|
|
219
|
+
}
|
|
220
|
+
|
|
214
221
|
if (!legendItemsContainerRef.current) {
|
|
215
222
|
setIsLoading(false)
|
|
216
223
|
return
|
|
@@ -270,11 +277,16 @@ const ChartLegendsComponent: React.FC<ChartLegendsProps> = ({
|
|
|
270
277
|
const newCutoff = Math.max(1, Math.min(optimalCutoff, totalLegends))
|
|
271
278
|
setCuttOffIndex(newCutoff)
|
|
272
279
|
setIsLoading(false)
|
|
273
|
-
}, [displayLegends, legendTokens.gap])
|
|
280
|
+
}, [displayLegends, legendTokens.gap, showAllLegends])
|
|
274
281
|
|
|
275
282
|
const debouncedResize = useDebounce(handleResize, 150)
|
|
276
283
|
|
|
277
284
|
useResizeObserver(chartContainerRef, ({ width }) => {
|
|
285
|
+
if (showAllLegends) {
|
|
286
|
+
lastWidth.current = width
|
|
287
|
+
return
|
|
288
|
+
}
|
|
289
|
+
|
|
278
290
|
if (width && Math.abs(width - lastWidth.current) > 10) {
|
|
279
291
|
setIsLoading(true)
|
|
280
292
|
if (width > lastWidth.current + 20) {
|
|
@@ -287,6 +299,13 @@ const ChartLegendsComponent: React.FC<ChartLegendsProps> = ({
|
|
|
287
299
|
})
|
|
288
300
|
|
|
289
301
|
useEffect(() => {
|
|
302
|
+
if (showAllLegends) {
|
|
303
|
+
setIsLoading(false)
|
|
304
|
+
setCuttOffIndex(displayLegends.length)
|
|
305
|
+
isExpanding.current = false
|
|
306
|
+
return
|
|
307
|
+
}
|
|
308
|
+
|
|
290
309
|
setIsLoading(true)
|
|
291
310
|
setCuttOffIndex(displayLegends.length)
|
|
292
311
|
isExpanding.current = false
|
|
@@ -296,7 +315,7 @@ const ChartLegendsComponent: React.FC<ChartLegendsProps> = ({
|
|
|
296
315
|
}, 150)
|
|
297
316
|
|
|
298
317
|
return () => clearTimeout(timeoutId)
|
|
299
|
-
}, [displayLegends, handleResize])
|
|
318
|
+
}, [displayLegends, handleResize, showAllLegends])
|
|
300
319
|
|
|
301
320
|
const getItemOpacity = (dataKey: string) => {
|
|
302
321
|
if (hoveredKey) {
|
|
@@ -367,11 +386,12 @@ const ChartLegendsComponent: React.FC<ChartLegendsProps> = ({
|
|
|
367
386
|
<Block
|
|
368
387
|
ref={legendItemsContainerRef}
|
|
369
388
|
display="flex"
|
|
370
|
-
height={FOUNDATION_THEME.unit[28]}
|
|
389
|
+
height={showAllLegends ? 'auto' : FOUNDATION_THEME.unit[28]}
|
|
371
390
|
alignItems="center"
|
|
372
|
-
|
|
391
|
+
flexWrap={showAllLegends ? 'wrap' : 'nowrap'}
|
|
392
|
+
overflowX={showAllLegends ? 'visible' : 'hidden'}
|
|
373
393
|
overflowY="visible"
|
|
374
|
-
whiteSpace=
|
|
394
|
+
whiteSpace={showAllLegends ? 'normal' : 'nowrap'}
|
|
375
395
|
style={{ flex: 1, opacity: isLoading ? 0 : 1 }}
|
|
376
396
|
justifyContent={isSmallScreen ? 'center' : 'start'}
|
|
377
397
|
gap={legendTokens.gap}
|