@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,411 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import Block from '../Primitives/Block/Block'
|
|
3
|
+
import { ButtonV2, ButtonV2SubType, ButtonV2Type } from '../ButtonV2'
|
|
4
|
+
import type { ModalV2Props } from './modalV2.types'
|
|
5
|
+
import { type SkeletonVariant } from '../Skeleton'
|
|
6
|
+
import { useResponsiveTokens } from '../../hooks/useResponsiveTokens'
|
|
7
|
+
import type { ModalV2TokensType } from './modalV2.tokens.types'
|
|
8
|
+
import ModalV2Skeleton from './ModalV2Skeleton'
|
|
9
|
+
import {
|
|
10
|
+
DrawerV2,
|
|
11
|
+
DrawerV2Body,
|
|
12
|
+
DrawerV2Close,
|
|
13
|
+
DrawerV2Content,
|
|
14
|
+
DrawerV2Description,
|
|
15
|
+
DrawerV2Footer,
|
|
16
|
+
DrawerV2Header,
|
|
17
|
+
DrawerV2Overlay,
|
|
18
|
+
DrawerV2Portal,
|
|
19
|
+
DrawerV2Title,
|
|
20
|
+
} from '../DrawerV2'
|
|
21
|
+
import { XIcon } from '@phosphor-icons/react'
|
|
22
|
+
type MobileModalV2Props = ModalV2Props
|
|
23
|
+
|
|
24
|
+
const formatLineHeight = (value: string | number | undefined) =>
|
|
25
|
+
typeof value === 'number' ? `${value}px` : value
|
|
26
|
+
|
|
27
|
+
const visuallyHiddenStyle: React.CSSProperties = {
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
width: 1,
|
|
30
|
+
height: 1,
|
|
31
|
+
padding: 0,
|
|
32
|
+
margin: -1,
|
|
33
|
+
overflow: 'hidden',
|
|
34
|
+
clip: 'rect(0, 0, 0, 0)',
|
|
35
|
+
clipPath: 'inset(50%)',
|
|
36
|
+
whiteSpace: 'nowrap',
|
|
37
|
+
borderWidth: 0,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const MobileModalV2 = forwardRef<HTMLDivElement, MobileModalV2Props>(
|
|
41
|
+
(
|
|
42
|
+
{
|
|
43
|
+
isOpen,
|
|
44
|
+
onClose,
|
|
45
|
+
title,
|
|
46
|
+
subtitle,
|
|
47
|
+
children,
|
|
48
|
+
primaryAction,
|
|
49
|
+
secondaryAction,
|
|
50
|
+
showCloseButton = true,
|
|
51
|
+
showHeader = true,
|
|
52
|
+
showFooter = true,
|
|
53
|
+
closeOnBackdropClick = true,
|
|
54
|
+
customHeader,
|
|
55
|
+
customFooter,
|
|
56
|
+
headerSlot,
|
|
57
|
+
skeleton,
|
|
58
|
+
showDivider = true,
|
|
59
|
+
...props
|
|
60
|
+
},
|
|
61
|
+
ref
|
|
62
|
+
) => {
|
|
63
|
+
const modalTokens = useResponsiveTokens<ModalV2TokensType>('MODALV2')
|
|
64
|
+
|
|
65
|
+
const shouldShowSkeleton = skeleton?.show
|
|
66
|
+
const skeletonVariant: SkeletonVariant =
|
|
67
|
+
(skeleton?.variant as SkeletonVariant) || 'pulse'
|
|
68
|
+
|
|
69
|
+
const bodySkeletonWidth = skeleton?.bodySkeletonProps?.width || '100%'
|
|
70
|
+
const bodySkeletonHeight = skeleton?.bodySkeletonProps?.height || 200
|
|
71
|
+
const headerPaddingStyle = {
|
|
72
|
+
paddingTop: modalTokens.header.paddingTop,
|
|
73
|
+
paddingRight: modalTokens.header.paddingRight,
|
|
74
|
+
paddingBottom: modalTokens.header.paddingBottom,
|
|
75
|
+
paddingLeft: modalTokens.header.paddingLeft,
|
|
76
|
+
}
|
|
77
|
+
const bodyPaddingStyle = {
|
|
78
|
+
paddingTop: modalTokens.body.paddingTop,
|
|
79
|
+
paddingRight: modalTokens.body.paddingRight,
|
|
80
|
+
paddingBottom: modalTokens.body.paddingBottom,
|
|
81
|
+
paddingLeft: modalTokens.body.paddingLeft,
|
|
82
|
+
}
|
|
83
|
+
const footerPaddingStyle = {
|
|
84
|
+
paddingTop: modalTokens.footer.paddingTop,
|
|
85
|
+
paddingRight: modalTokens.footer.paddingRight,
|
|
86
|
+
paddingBottom: modalTokens.footer.paddingBottom,
|
|
87
|
+
paddingLeft: modalTokens.footer.paddingLeft,
|
|
88
|
+
}
|
|
89
|
+
const contentClassName =
|
|
90
|
+
'fixed z-[1001] outline-none flex flex-col overflow-hidden max-h-[85vh]'
|
|
91
|
+
const contentStyle = {
|
|
92
|
+
left: modalTokens.overlay.offset,
|
|
93
|
+
right: modalTokens.overlay.offset,
|
|
94
|
+
bottom: modalTokens.overlay.offset,
|
|
95
|
+
backgroundColor: modalTokens.backgroundColor,
|
|
96
|
+
boxShadow: modalTokens.boxShadow,
|
|
97
|
+
borderRadius: modalTokens.borderRadius,
|
|
98
|
+
border: `1px solid ${modalTokens.divider.borderColor}`,
|
|
99
|
+
height: 'auto',
|
|
100
|
+
}
|
|
101
|
+
const shouldShowBodySkeleton = Boolean(
|
|
102
|
+
shouldShowSkeleton && skeleton?.bodySkeletonProps?.show
|
|
103
|
+
)
|
|
104
|
+
const hasFooterContent = Boolean(
|
|
105
|
+
customFooter ||
|
|
106
|
+
primaryAction ||
|
|
107
|
+
secondaryAction ||
|
|
108
|
+
shouldShowSkeleton
|
|
109
|
+
)
|
|
110
|
+
const {
|
|
111
|
+
'aria-label': ariaLabel,
|
|
112
|
+
'aria-labelledby': ariaLabelledBy,
|
|
113
|
+
'aria-describedby': ariaDescribedBy,
|
|
114
|
+
...contentProps
|
|
115
|
+
} = props
|
|
116
|
+
const shouldUseGeneratedTitle = Boolean(
|
|
117
|
+
showHeader && !customHeader && title
|
|
118
|
+
)
|
|
119
|
+
const effectiveAriaLabel =
|
|
120
|
+
ariaLabel ??
|
|
121
|
+
(ariaLabelledBy || shouldUseGeneratedTitle
|
|
122
|
+
? undefined
|
|
123
|
+
: title || 'Modal dialog')
|
|
124
|
+
const hiddenTitle = ariaLabel || title || 'Modal dialog'
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<DrawerV2
|
|
128
|
+
open={isOpen}
|
|
129
|
+
onOpenChange={(open) => {
|
|
130
|
+
if (!open) onClose()
|
|
131
|
+
}}
|
|
132
|
+
direction="bottom"
|
|
133
|
+
modal={true}
|
|
134
|
+
dismissible={closeOnBackdropClick}
|
|
135
|
+
>
|
|
136
|
+
<DrawerV2Portal>
|
|
137
|
+
<DrawerV2Overlay
|
|
138
|
+
className={'fixed inset-0 z-[1000]'}
|
|
139
|
+
style={{
|
|
140
|
+
backgroundColor:
|
|
141
|
+
modalTokens.overlay.backgroundColor,
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
|
+
<DrawerV2Content
|
|
145
|
+
{...contentProps}
|
|
146
|
+
ref={ref}
|
|
147
|
+
className={contentClassName}
|
|
148
|
+
style={contentStyle}
|
|
149
|
+
aria-label={effectiveAriaLabel}
|
|
150
|
+
aria-labelledby={ariaLabelledBy}
|
|
151
|
+
aria-describedby={ariaDescribedBy}
|
|
152
|
+
>
|
|
153
|
+
{!shouldUseGeneratedTitle && (
|
|
154
|
+
<DrawerV2Title style={visuallyHiddenStyle}>
|
|
155
|
+
{hiddenTitle}
|
|
156
|
+
</DrawerV2Title>
|
|
157
|
+
)}
|
|
158
|
+
<Block
|
|
159
|
+
alignSelf="center"
|
|
160
|
+
flexShrink={0}
|
|
161
|
+
width="48px"
|
|
162
|
+
height="4px"
|
|
163
|
+
borderRadius="999px"
|
|
164
|
+
backgroundColor={modalTokens.divider.borderColor}
|
|
165
|
+
marginTop="8px"
|
|
166
|
+
marginBottom="4px"
|
|
167
|
+
aria-hidden="true"
|
|
168
|
+
/>
|
|
169
|
+
{/* Header */}
|
|
170
|
+
{showHeader &&
|
|
171
|
+
(customHeader ??
|
|
172
|
+
(!shouldShowSkeleton ? (
|
|
173
|
+
<DrawerV2Header style={headerPaddingStyle}>
|
|
174
|
+
<Block
|
|
175
|
+
display="flex"
|
|
176
|
+
justifyContent="space-between"
|
|
177
|
+
alignItems="center"
|
|
178
|
+
>
|
|
179
|
+
<Block
|
|
180
|
+
display="flex"
|
|
181
|
+
flexDirection="column"
|
|
182
|
+
gap={
|
|
183
|
+
modalTokens.header.slot.gap
|
|
184
|
+
}
|
|
185
|
+
>
|
|
186
|
+
{(title || headerSlot) && (
|
|
187
|
+
<DrawerV2Title>
|
|
188
|
+
<Block
|
|
189
|
+
display="flex"
|
|
190
|
+
flexDirection="row"
|
|
191
|
+
gap={
|
|
192
|
+
modalTokens
|
|
193
|
+
.header.slot
|
|
194
|
+
.gap
|
|
195
|
+
}
|
|
196
|
+
color={
|
|
197
|
+
modalTokens
|
|
198
|
+
.header.text
|
|
199
|
+
.title.color
|
|
200
|
+
}
|
|
201
|
+
fontWeight={
|
|
202
|
+
modalTokens
|
|
203
|
+
.header.text
|
|
204
|
+
.title
|
|
205
|
+
.fontWeight
|
|
206
|
+
}
|
|
207
|
+
fontSize={
|
|
208
|
+
modalTokens
|
|
209
|
+
.header.text
|
|
210
|
+
.title
|
|
211
|
+
.fontSize
|
|
212
|
+
}
|
|
213
|
+
lineHeight={formatLineHeight(
|
|
214
|
+
modalTokens
|
|
215
|
+
.header.text
|
|
216
|
+
.title
|
|
217
|
+
.lineHeight
|
|
218
|
+
)}
|
|
219
|
+
>
|
|
220
|
+
{title}
|
|
221
|
+
{headerSlot}
|
|
222
|
+
</Block>
|
|
223
|
+
</DrawerV2Title>
|
|
224
|
+
)}
|
|
225
|
+
{subtitle && (
|
|
226
|
+
<DrawerV2Description
|
|
227
|
+
style={{
|
|
228
|
+
color: modalTokens
|
|
229
|
+
.header.text
|
|
230
|
+
.subtitle.color,
|
|
231
|
+
fontWeight:
|
|
232
|
+
modalTokens
|
|
233
|
+
.header.text
|
|
234
|
+
.subtitle
|
|
235
|
+
.fontWeight,
|
|
236
|
+
fontSize:
|
|
237
|
+
modalTokens
|
|
238
|
+
.header.text
|
|
239
|
+
.subtitle
|
|
240
|
+
.fontSize,
|
|
241
|
+
lineHeight:
|
|
242
|
+
formatLineHeight(
|
|
243
|
+
modalTokens
|
|
244
|
+
.header
|
|
245
|
+
.text
|
|
246
|
+
.subtitle
|
|
247
|
+
.lineHeight
|
|
248
|
+
),
|
|
249
|
+
}}
|
|
250
|
+
>
|
|
251
|
+
{subtitle}
|
|
252
|
+
</DrawerV2Description>
|
|
253
|
+
)}
|
|
254
|
+
</Block>
|
|
255
|
+
{showCloseButton && (
|
|
256
|
+
<DrawerV2Close asChild>
|
|
257
|
+
<ButtonV2
|
|
258
|
+
subType={
|
|
259
|
+
ButtonV2SubType.INLINE
|
|
260
|
+
}
|
|
261
|
+
buttonType={
|
|
262
|
+
ButtonV2Type.SECONDARY
|
|
263
|
+
}
|
|
264
|
+
leftSlot={{
|
|
265
|
+
slot: (
|
|
266
|
+
<XIcon
|
|
267
|
+
size={
|
|
268
|
+
modalTokens
|
|
269
|
+
.closeButton
|
|
270
|
+
.width
|
|
271
|
+
}
|
|
272
|
+
color={
|
|
273
|
+
modalTokens
|
|
274
|
+
.closeButton
|
|
275
|
+
.color
|
|
276
|
+
}
|
|
277
|
+
aria-hidden="true"
|
|
278
|
+
/>
|
|
279
|
+
),
|
|
280
|
+
maxHeight:
|
|
281
|
+
modalTokens
|
|
282
|
+
.closeButton
|
|
283
|
+
.height,
|
|
284
|
+
}}
|
|
285
|
+
aria-label="Close modal"
|
|
286
|
+
/>
|
|
287
|
+
</DrawerV2Close>
|
|
288
|
+
)}
|
|
289
|
+
</Block>
|
|
290
|
+
</DrawerV2Header>
|
|
291
|
+
) : (
|
|
292
|
+
<ModalV2Skeleton
|
|
293
|
+
modalTokens={modalTokens}
|
|
294
|
+
headerSkeleton={{
|
|
295
|
+
show: shouldShowSkeleton || false,
|
|
296
|
+
showCloseButton:
|
|
297
|
+
showCloseButton || false,
|
|
298
|
+
showDivider: showDivider,
|
|
299
|
+
}}
|
|
300
|
+
skeletonVariant={skeletonVariant}
|
|
301
|
+
/>
|
|
302
|
+
)))}
|
|
303
|
+
{showHeader && showDivider && !shouldShowSkeleton && (
|
|
304
|
+
<hr
|
|
305
|
+
style={{
|
|
306
|
+
borderColor:
|
|
307
|
+
modalTokens.divider.borderColor,
|
|
308
|
+
}}
|
|
309
|
+
/>
|
|
310
|
+
)}
|
|
311
|
+
{/* Body */}
|
|
312
|
+
{!shouldShowBodySkeleton ? (
|
|
313
|
+
<DrawerV2Body
|
|
314
|
+
style={{
|
|
315
|
+
...bodyPaddingStyle,
|
|
316
|
+
borderRadius:
|
|
317
|
+
!showFooter || !hasFooterContent
|
|
318
|
+
? `0 0 ${modalTokens.borderRadius} ${modalTokens.borderRadius}`
|
|
319
|
+
: undefined,
|
|
320
|
+
flex: '1 1 auto',
|
|
321
|
+
minHeight: 0,
|
|
322
|
+
overflowY: 'auto',
|
|
323
|
+
}}
|
|
324
|
+
>
|
|
325
|
+
{children}
|
|
326
|
+
</DrawerV2Body>
|
|
327
|
+
) : (
|
|
328
|
+
<Block
|
|
329
|
+
style={{
|
|
330
|
+
...bodyPaddingStyle,
|
|
331
|
+
borderRadius:
|
|
332
|
+
!showFooter || !hasFooterContent
|
|
333
|
+
? `0 0 ${modalTokens.borderRadius} ${modalTokens.borderRadius}`
|
|
334
|
+
: undefined,
|
|
335
|
+
}}
|
|
336
|
+
>
|
|
337
|
+
<ModalV2Skeleton
|
|
338
|
+
modalTokens={modalTokens}
|
|
339
|
+
bodySkeleton={{
|
|
340
|
+
show: true,
|
|
341
|
+
width: bodySkeletonWidth,
|
|
342
|
+
height: bodySkeletonHeight,
|
|
343
|
+
}}
|
|
344
|
+
skeletonVariant={skeletonVariant}
|
|
345
|
+
/>
|
|
346
|
+
</Block>
|
|
347
|
+
)}
|
|
348
|
+
{showFooter &&
|
|
349
|
+
hasFooterContent &&
|
|
350
|
+
showDivider &&
|
|
351
|
+
!shouldShowSkeleton && (
|
|
352
|
+
<hr
|
|
353
|
+
style={{
|
|
354
|
+
borderColor:
|
|
355
|
+
modalTokens.divider.borderColor,
|
|
356
|
+
}}
|
|
357
|
+
/>
|
|
358
|
+
)}
|
|
359
|
+
{/* Footer */}
|
|
360
|
+
{showFooter && hasFooterContent && (
|
|
361
|
+
<DrawerV2Footer>
|
|
362
|
+
{customFooter ??
|
|
363
|
+
(!shouldShowSkeleton ? (
|
|
364
|
+
<Block
|
|
365
|
+
display="flex"
|
|
366
|
+
gap={modalTokens.footer.gap}
|
|
367
|
+
justifyContent="flex-end"
|
|
368
|
+
style={footerPaddingStyle}
|
|
369
|
+
>
|
|
370
|
+
{secondaryAction && (
|
|
371
|
+
<ButtonV2
|
|
372
|
+
{...secondaryAction}
|
|
373
|
+
buttonType={
|
|
374
|
+
secondaryAction.buttonType ||
|
|
375
|
+
ButtonV2Type.SECONDARY
|
|
376
|
+
}
|
|
377
|
+
/>
|
|
378
|
+
)}
|
|
379
|
+
{primaryAction && (
|
|
380
|
+
<ButtonV2
|
|
381
|
+
{...primaryAction}
|
|
382
|
+
buttonType={
|
|
383
|
+
primaryAction.buttonType ||
|
|
384
|
+
ButtonV2Type.PRIMARY
|
|
385
|
+
}
|
|
386
|
+
/>
|
|
387
|
+
)}
|
|
388
|
+
</Block>
|
|
389
|
+
) : (
|
|
390
|
+
<ModalV2Skeleton
|
|
391
|
+
modalTokens={modalTokens}
|
|
392
|
+
footerSkeleton={{
|
|
393
|
+
show:
|
|
394
|
+
shouldShowSkeleton || false,
|
|
395
|
+
showDivider: showDivider,
|
|
396
|
+
}}
|
|
397
|
+
skeletonVariant={skeletonVariant}
|
|
398
|
+
/>
|
|
399
|
+
))}
|
|
400
|
+
</DrawerV2Footer>
|
|
401
|
+
)}
|
|
402
|
+
</DrawerV2Content>
|
|
403
|
+
</DrawerV2Portal>
|
|
404
|
+
</DrawerV2>
|
|
405
|
+
)
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
MobileModalV2.displayName = 'MobileModalV2'
|
|
410
|
+
|
|
411
|
+
export default MobileModalV2
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
const easingIn = 'cubic-bezier(0.16, 0, 0.3, 1)'
|
|
4
|
+
const easingOut = 'cubic-bezier(0.25, 0.46, 0.45, 0.94)'
|
|
5
|
+
const duration = 300
|
|
6
|
+
|
|
7
|
+
export const modalBackdropAnimationsV2 = (isAnimatingIn: boolean) => css`
|
|
8
|
+
transition: opacity ${duration}ms ${isAnimatingIn ? easingIn : easingOut};
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
export const modalContentAnimationsV2 = (isAnimatingIn: boolean) => css`
|
|
12
|
+
opacity: ${isAnimatingIn ? 1 : 0};
|
|
13
|
+
transform: scale(${isAnimatingIn ? 1 : 0.97});
|
|
14
|
+
transition:
|
|
15
|
+
opacity ${duration}ms ${isAnimatingIn ? easingIn : easingOut},
|
|
16
|
+
transform ${duration}ms ${isAnimatingIn ? easingIn : easingOut};
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
export const ANIMATION_DURATION = duration
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { type FoundationTokenType } from '../../tokens/theme.token'
|
|
2
|
+
import type { ResponsiveModalV2Tokens } from './modalV2.tokens.types'
|
|
3
|
+
|
|
4
|
+
export const getModalV2DarkToken = (
|
|
5
|
+
foundationToken: FoundationTokenType
|
|
6
|
+
): ResponsiveModalV2Tokens => {
|
|
7
|
+
return {
|
|
8
|
+
sm: {
|
|
9
|
+
backgroundColor: foundationToken.colors.gray[700],
|
|
10
|
+
paddingTop: foundationToken.unit[16],
|
|
11
|
+
paddingRight: foundationToken.unit[16],
|
|
12
|
+
paddingBottom: foundationToken.unit[16],
|
|
13
|
+
paddingLeft: foundationToken.unit[16],
|
|
14
|
+
boxShadow: foundationToken.shadows.xs,
|
|
15
|
+
borderRadius: foundationToken.border.radius[16],
|
|
16
|
+
overlay: {
|
|
17
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
18
|
+
offset: foundationToken.unit[16],
|
|
19
|
+
},
|
|
20
|
+
divider: {
|
|
21
|
+
borderColor: foundationToken.colors.gray[200],
|
|
22
|
+
},
|
|
23
|
+
skeleton: {
|
|
24
|
+
header: {
|
|
25
|
+
gap: foundationToken.unit[16],
|
|
26
|
+
paddingTop: foundationToken.unit[20],
|
|
27
|
+
paddingRight: foundationToken.unit[20],
|
|
28
|
+
paddingBottom: foundationToken.unit[20],
|
|
29
|
+
paddingLeft: foundationToken.unit[20],
|
|
30
|
+
borderBottom: `1px solid ${foundationToken.colors.gray[200]}`,
|
|
31
|
+
width: '60%',
|
|
32
|
+
height: 24,
|
|
33
|
+
borderRadius: foundationToken.border.radius[4],
|
|
34
|
+
},
|
|
35
|
+
body: {
|
|
36
|
+
gap: foundationToken.unit[12],
|
|
37
|
+
width: '100%',
|
|
38
|
+
height: 300,
|
|
39
|
+
borderRadius: foundationToken.border.radius[4],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
header: {
|
|
43
|
+
slot: {
|
|
44
|
+
gap: foundationToken.unit[8],
|
|
45
|
+
},
|
|
46
|
+
gap: foundationToken.unit[16],
|
|
47
|
+
paddingTop: foundationToken.unit[16],
|
|
48
|
+
paddingRight: foundationToken.unit[16],
|
|
49
|
+
paddingBottom: foundationToken.unit[16],
|
|
50
|
+
paddingLeft: foundationToken.unit[16],
|
|
51
|
+
maxHeight: '20vh',
|
|
52
|
+
borderBottom: `1px solid ${foundationToken.colors.gray[200]}`,
|
|
53
|
+
backgroundColor: foundationToken.colors.gray[700],
|
|
54
|
+
borderTopLeftRadius: foundationToken.border.radius[16],
|
|
55
|
+
borderTopRightRadius: foundationToken.border.radius[16],
|
|
56
|
+
text: {
|
|
57
|
+
title: {
|
|
58
|
+
color: foundationToken.colors.gray[0],
|
|
59
|
+
fontSize: foundationToken.font.size.body.md.fontSize,
|
|
60
|
+
fontWeight: foundationToken.font.weight[600],
|
|
61
|
+
lineHeight: foundationToken.font.lineHeight[20],
|
|
62
|
+
},
|
|
63
|
+
subtitle: {
|
|
64
|
+
color: foundationToken.colors.gray[100],
|
|
65
|
+
fontSize: foundationToken.font.size.body.sm.fontSize,
|
|
66
|
+
fontWeight: foundationToken.font.weight[400],
|
|
67
|
+
lineHeight: foundationToken.font.lineHeight[20],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
body: {
|
|
73
|
+
paddingTop: foundationToken.unit[16],
|
|
74
|
+
paddingRight: foundationToken.unit[16],
|
|
75
|
+
paddingBottom: foundationToken.unit[16],
|
|
76
|
+
paddingLeft: foundationToken.unit[16],
|
|
77
|
+
backgroundColor: foundationToken.colors.gray[700],
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
footer: {
|
|
81
|
+
paddingTop: foundationToken.unit[16],
|
|
82
|
+
paddingRight: foundationToken.unit[16],
|
|
83
|
+
paddingBottom: foundationToken.unit[16],
|
|
84
|
+
paddingLeft: foundationToken.unit[16],
|
|
85
|
+
borderTop: `1px solid ${foundationToken.colors.gray[200]}`,
|
|
86
|
+
backgroundColor: foundationToken.colors.gray[700],
|
|
87
|
+
gap: foundationToken.unit[12],
|
|
88
|
+
},
|
|
89
|
+
closeButton: {
|
|
90
|
+
color: foundationToken.colors.gray[100],
|
|
91
|
+
width: foundationToken.unit[16],
|
|
92
|
+
height: foundationToken.unit[16],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
lg: {
|
|
96
|
+
backgroundColor: foundationToken.colors.gray[700],
|
|
97
|
+
paddingTop: foundationToken.unit[16],
|
|
98
|
+
paddingRight: foundationToken.unit[16],
|
|
99
|
+
paddingBottom: foundationToken.unit[16],
|
|
100
|
+
paddingLeft: foundationToken.unit[16],
|
|
101
|
+
boxShadow: foundationToken.shadows.lg,
|
|
102
|
+
borderRadius: foundationToken.border.radius[16],
|
|
103
|
+
overlay: {
|
|
104
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
105
|
+
offset: foundationToken.unit[16],
|
|
106
|
+
},
|
|
107
|
+
divider: {
|
|
108
|
+
borderColor: foundationToken.colors.gray[200],
|
|
109
|
+
},
|
|
110
|
+
skeleton: {
|
|
111
|
+
header: {
|
|
112
|
+
gap: foundationToken.unit[16],
|
|
113
|
+
paddingTop: foundationToken.unit[20],
|
|
114
|
+
paddingRight: foundationToken.unit[20],
|
|
115
|
+
paddingBottom: foundationToken.unit[20],
|
|
116
|
+
paddingLeft: foundationToken.unit[20],
|
|
117
|
+
borderBottom: `1px solid ${foundationToken.colors.gray[200]}`,
|
|
118
|
+
width: '60%',
|
|
119
|
+
height: 24,
|
|
120
|
+
borderRadius: foundationToken.border.radius[4],
|
|
121
|
+
},
|
|
122
|
+
body: {
|
|
123
|
+
gap: foundationToken.unit[12],
|
|
124
|
+
width: '100%',
|
|
125
|
+
height: 300,
|
|
126
|
+
borderRadius: foundationToken.border.radius[4],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
header: {
|
|
130
|
+
gap: foundationToken.unit[16],
|
|
131
|
+
paddingTop: foundationToken.unit[20],
|
|
132
|
+
paddingRight: foundationToken.unit[20],
|
|
133
|
+
paddingBottom: foundationToken.unit[20],
|
|
134
|
+
paddingLeft: foundationToken.unit[20],
|
|
135
|
+
maxHeight: '20vh',
|
|
136
|
+
borderBottom: `1px solid ${foundationToken.colors.gray[200]}`,
|
|
137
|
+
backgroundColor: foundationToken.colors.gray[700],
|
|
138
|
+
borderTopLeftRadius: foundationToken.border.radius[16],
|
|
139
|
+
borderTopRightRadius: foundationToken.border.radius[16],
|
|
140
|
+
slot: {
|
|
141
|
+
gap: foundationToken.unit[8],
|
|
142
|
+
},
|
|
143
|
+
text: {
|
|
144
|
+
title: {
|
|
145
|
+
color: foundationToken.colors.gray[0],
|
|
146
|
+
fontSize: foundationToken.font.size.body.lg.fontSize,
|
|
147
|
+
fontWeight: foundationToken.font.weight[600],
|
|
148
|
+
lineHeight: foundationToken.font.lineHeight[20],
|
|
149
|
+
},
|
|
150
|
+
subtitle: {
|
|
151
|
+
color: foundationToken.colors.gray[100],
|
|
152
|
+
fontSize: foundationToken.font.size.body.md.fontSize,
|
|
153
|
+
fontWeight: foundationToken.font.weight[400],
|
|
154
|
+
lineHeight: foundationToken.font.lineHeight[20],
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
body: {
|
|
160
|
+
paddingTop: foundationToken.unit[20],
|
|
161
|
+
paddingRight: foundationToken.unit[20],
|
|
162
|
+
paddingBottom: foundationToken.unit[20],
|
|
163
|
+
paddingLeft: foundationToken.unit[20],
|
|
164
|
+
backgroundColor: foundationToken.colors.gray[700],
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
footer: {
|
|
168
|
+
paddingTop: foundationToken.unit[20],
|
|
169
|
+
paddingRight: foundationToken.unit[20],
|
|
170
|
+
paddingBottom: foundationToken.unit[20],
|
|
171
|
+
paddingLeft: foundationToken.unit[20],
|
|
172
|
+
borderTop: `1px solid ${foundationToken.colors.gray[200]}`,
|
|
173
|
+
backgroundColor: foundationToken.colors.gray[700],
|
|
174
|
+
gap: foundationToken.unit[16],
|
|
175
|
+
},
|
|
176
|
+
closeButton: {
|
|
177
|
+
color: foundationToken.colors.gray[100],
|
|
178
|
+
width: foundationToken.unit[16],
|
|
179
|
+
height: foundationToken.unit[16],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
}
|
|
183
|
+
}
|