@juspay/blend-design-system 0.0.37-beta.7 → 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.
Files changed (290) hide show
  1. package/dist/{node-C_DmV86X.js → breadcrumbV2.tokens-CovJEwot.js} +16 -0
  2. package/dist/components/Accordion/index.d.ts +2 -0
  3. package/dist/components/AccordionV2/accordionV2.animations.d.ts +1 -1
  4. package/dist/components/Alert/index.d.ts +1 -0
  5. package/dist/components/Avatar/index.d.ts +1 -0
  6. package/dist/components/Breadcrumb/index.d.ts +1 -0
  7. package/dist/components/Button/index.d.ts +1 -0
  8. package/dist/components/ButtonGroup/index.d.ts +1 -0
  9. package/dist/components/Card/index.d.ts +1 -0
  10. package/dist/components/CardV2/CardV2.d.ts +45 -0
  11. package/dist/components/CardV2/CardV2.utils.d.ts +14 -0
  12. package/dist/components/CardV2/CardV2Components.d.ts +8 -0
  13. package/dist/components/CardV2/CardV2Context.d.ts +14 -0
  14. package/dist/components/CardV2/CardV2Skeleton.d.ts +6 -0
  15. package/dist/components/CardV2/accessibility/CardV2AccessibilityReport.d.ts +2 -0
  16. package/dist/components/CardV2/accessibility/index.d.ts +1 -0
  17. package/dist/components/CardV2/cardV2.dark.tokens.d.ts +3 -0
  18. package/dist/components/CardV2/cardV2.light.tokens.d.ts +3 -0
  19. package/dist/components/CardV2/cardV2.tokens.d.ts +5 -0
  20. package/dist/components/CardV2/cardV2.tokens.types.d.ts +92 -0
  21. package/dist/components/CardV2/cardV2.types.d.ts +106 -0
  22. package/dist/components/CardV2/index.d.ts +5 -0
  23. package/dist/components/Charts/index.d.ts +10 -0
  24. package/dist/components/Charts/types.d.ts +2 -0
  25. package/dist/components/ChatInput/index.d.ts +1 -0
  26. package/dist/components/Checkbox/index.d.ts +1 -0
  27. package/dist/components/CodeEditor/index.d.ts +1 -0
  28. package/dist/components/CodeEditor/types.d.ts +22 -2
  29. package/dist/components/CodeEditorV2/CodeEditorV2.d.ts +1 -1
  30. package/dist/components/CodeEditorV2/codeEditorV2.types.d.ts +23 -2
  31. package/dist/components/DataTable/PivotTableModal/pivotModal.styled.d.ts +184 -0
  32. package/dist/components/DataTable/TableBody/types.d.ts +3 -1
  33. package/dist/components/DataTable/hooks/index.d.ts +2 -0
  34. package/dist/components/DataTable/hooks/useReducedMotion.d.ts +1 -0
  35. package/dist/components/DataTable/hooks/useRowFlip.d.ts +6 -0
  36. package/dist/components/DataTable/types.d.ts +26 -0
  37. package/dist/components/DateRangePicker/CalendarGrid.d.ts +5 -2
  38. package/dist/components/DateRangePicker/types.d.ts +3 -1
  39. package/dist/components/DateRangePicker/utils.d.ts +5 -5
  40. package/dist/components/Directory/Directory.d.ts +1 -1
  41. package/dist/components/Directory/NavItem.d.ts +1 -1
  42. package/dist/components/Directory/Section.d.ts +1 -1
  43. package/dist/components/Directory/VirtualizedDirectory.d.ts +3 -0
  44. package/dist/components/Directory/directory.tokens.d.ts +7 -0
  45. package/dist/components/Directory/types.d.ts +38 -1
  46. package/dist/components/Directory/utils.d.ts +3 -1
  47. package/dist/components/Drawer/index.d.ts +1 -0
  48. package/dist/components/Inputs/MultiValueInput/index.d.ts +1 -0
  49. package/dist/components/Inputs/NumberInput/index.d.ts +1 -0
  50. package/dist/components/Inputs/OTPInput/index.d.ts +1 -0
  51. package/dist/components/Inputs/SearchInput/index.d.ts +1 -0
  52. package/dist/components/Inputs/TextArea/index.d.ts +1 -0
  53. package/dist/components/Inputs/TextInput/index.d.ts +1 -0
  54. package/dist/components/InputsV2/TextAreaV2/utils.d.ts +2 -1
  55. package/dist/components/InputsV2/TextInputV2/utils.d.ts +2 -1
  56. package/dist/components/InputsV2/UploadV2/UploadContainerV2.d.ts +24 -0
  57. package/dist/components/InputsV2/UploadV2/UploadV2.d.ts +31 -0
  58. package/dist/components/InputsV2/UploadV2/UploadV2.dark.tokens.d.ts +3 -0
  59. package/dist/components/InputsV2/UploadV2/UploadV2.light.tokens.d.ts +3 -0
  60. package/dist/components/InputsV2/UploadV2/UploadV2.tokens.d.ts +5 -0
  61. package/dist/components/InputsV2/UploadV2/UploadV2.tokens.types.d.ts +115 -0
  62. package/dist/components/InputsV2/UploadV2/UploadV2.types.d.ts +56 -0
  63. package/dist/components/InputsV2/UploadV2/index.d.ts +3 -0
  64. package/dist/components/InputsV2/UploadV2/utils.d.ts +32 -0
  65. package/dist/components/KeyValuePair/index.d.ts +1 -0
  66. package/dist/components/Menu/Menu.d.ts +1 -1
  67. package/dist/components/Menu/index.d.ts +1 -0
  68. package/dist/components/Menu/types.d.ts +7 -0
  69. package/dist/components/Menu/utils.d.ts +10 -2
  70. package/dist/components/MenuV2/MenuV2Content.d.ts +1 -0
  71. package/dist/components/MenuV2/menuV2.types.d.ts +5 -0
  72. package/dist/components/MenuV2/menuV2.utils.d.ts +10 -2
  73. package/dist/components/Modal/index.d.ts +1 -0
  74. package/dist/components/ModalV2/ModalV2.d.ts +22 -0
  75. package/dist/components/ModalV2/ModalV2Footer.d.ts +10 -0
  76. package/dist/components/ModalV2/ModalV2Header.d.ts +15 -0
  77. package/dist/components/ModalV2/ModalV2Skeleton.d.ts +4 -0
  78. package/dist/components/ModalV2/index.d.ts +4 -0
  79. package/dist/components/ModalV2/mobileModalV2.d.ts +23 -0
  80. package/dist/components/ModalV2/modalAnimationV2.d.ts +3 -0
  81. package/dist/components/ModalV2/modalV2.dark.tokens.d.ts +3 -0
  82. package/dist/components/ModalV2/modalV2.light.tokens.d.ts +3 -0
  83. package/dist/components/ModalV2/modalV2.tokens.d.ts +5 -0
  84. package/dist/components/ModalV2/modalV2.tokens.types.d.ts +91 -0
  85. package/dist/components/ModalV2/modalV2.types.d.ts +66 -0
  86. package/dist/components/MultiSelect/MultiSelect.d.ts +1 -1
  87. package/dist/components/MultiSelect/MultiSelectMenu.d.ts +1 -1
  88. package/dist/components/MultiSelect/index.d.ts +2 -0
  89. package/dist/components/MultiSelect/types.d.ts +2 -0
  90. package/dist/components/MultiSelectV2/MultiSelectV2.d.ts +1 -1
  91. package/dist/components/MultiSelectV2/MultiSelectV2Menu.d.ts +1 -1
  92. package/dist/components/MultiSelectV2/multiSelectV2.types.d.ts +2 -0
  93. package/dist/components/Popover/index.d.ts +1 -0
  94. package/dist/components/Primitives/Block/Block.d.ts +1 -1
  95. package/dist/components/ProgressBar/index.d.ts +1 -0
  96. package/dist/components/Radio/index.d.ts +2 -0
  97. package/dist/components/Sidebar/SidebarContent.d.ts +9 -1
  98. package/dist/components/Sidebar/index.d.ts +1 -0
  99. package/dist/components/Sidebar/types.d.ts +9 -1
  100. package/dist/components/SidebarV2/SidebarV2Panel.d.ts +10 -2
  101. package/dist/components/SidebarV2/types.d.ts +9 -1
  102. package/dist/components/SingleSelect/SingleSelect.d.ts +1 -1
  103. package/dist/components/SingleSelect/SingleSelectMenu.d.ts +2 -1
  104. package/dist/components/SingleSelect/index.d.ts +1 -0
  105. package/dist/components/SingleSelect/types.d.ts +1 -0
  106. package/dist/components/SingleSelectV2/SingleSelectV2.d.ts +1 -1
  107. package/dist/components/SingleSelectV2/SingleSelectV2Menu.d.ts +1 -1
  108. package/dist/components/SingleSelectV2/singleSelectV2.tokens.types.d.ts +8 -0
  109. package/dist/components/SingleSelectV2/singleSelectV2.types.d.ts +2 -0
  110. package/dist/components/Skeleton/SkeletonCompound.d.ts +24 -33
  111. package/dist/components/Snackbar/Snackbar.d.ts +1 -1
  112. package/dist/components/Snackbar/index.d.ts +2 -0
  113. package/dist/components/Snackbar/snackbar.tokens.d.ts +1 -0
  114. package/dist/components/Snackbar/types.d.ts +2 -0
  115. package/dist/components/StatCard/index.d.ts +1 -0
  116. package/dist/components/Stepper/index.d.ts +1 -0
  117. package/dist/components/Switch/index.d.ts +2 -0
  118. package/dist/components/Tabs/index.d.ts +1 -0
  119. package/dist/components/Tags/index.d.ts +1 -0
  120. package/dist/components/Timeline/Timeline.d.ts +13 -37
  121. package/dist/components/Tooltip/index.d.ts +1 -0
  122. package/dist/components/Topbar/index.d.ts +1 -0
  123. package/dist/components/Upload/index.d.ts +1 -0
  124. package/dist/context/ThemeContext.d.ts +6 -0
  125. package/dist/context/useComponentToken.d.ts +4 -1
  126. package/dist/main.d.ts +6 -0
  127. package/dist/main.js +45436 -42186
  128. package/dist/node-B3rrXW84.js +1023 -0
  129. package/dist/node.d.ts +2 -0
  130. package/dist/node.js +21 -18
  131. package/dist/{tokens.js → token-engine.js} +1 -1
  132. package/lib/components/Accordion/AccordionItem.tsx +2 -6
  133. package/lib/components/Accordion/index.ts +2 -0
  134. package/lib/components/AccordionV2/AccordionV2Item.tsx +1 -1
  135. package/lib/components/AccordionV2/accordionV2.animations.ts +1 -5
  136. package/lib/components/Alert/index.ts +1 -0
  137. package/lib/components/Avatar/index.ts +1 -0
  138. package/lib/components/Breadcrumb/index.ts +1 -0
  139. package/lib/components/Button/index.ts +1 -0
  140. package/lib/components/ButtonGroup/index.ts +1 -0
  141. package/lib/components/Card/index.ts +1 -0
  142. package/lib/components/CardV2/CardV2.tsx +327 -0
  143. package/lib/components/CardV2/CardV2.utils.tsx +77 -0
  144. package/lib/components/CardV2/CardV2Components.tsx +297 -0
  145. package/lib/components/CardV2/CardV2Context.tsx +18 -0
  146. package/lib/components/CardV2/CardV2Skeleton.tsx +40 -0
  147. package/lib/components/CardV2/accessibility/CardV2AccessibilityReport.ts +284 -0
  148. package/lib/components/CardV2/accessibility/index.ts +1 -0
  149. package/lib/components/CardV2/cardV2.dark.tokens.ts +177 -0
  150. package/lib/components/CardV2/cardV2.light.tokens.ts +177 -0
  151. package/lib/components/CardV2/cardV2.tokens.ts +21 -0
  152. package/lib/components/CardV2/cardV2.tokens.types.ts +94 -0
  153. package/lib/components/CardV2/cardV2.types.ts +131 -0
  154. package/lib/components/CardV2/index.ts +13 -0
  155. package/lib/components/Charts/ChartLegend.tsx +25 -5
  156. package/lib/components/Charts/Charts.tsx +10 -0
  157. package/lib/components/Charts/index.ts +10 -0
  158. package/lib/components/Charts/types.tsx +2 -0
  159. package/lib/components/ChatInput/index.tsx +1 -0
  160. package/lib/components/Checkbox/index.ts +1 -0
  161. package/lib/components/CodeEditor/MonacoEditorWrapper.tsx +6 -2
  162. package/lib/components/CodeEditor/index.ts +1 -0
  163. package/lib/components/CodeEditor/types.ts +52 -2
  164. package/lib/components/CodeEditorV2/MonacoEditor/MonacoEditorWrapper.tsx +6 -2
  165. package/lib/components/CodeEditorV2/codeEditorV2.types.ts +44 -5
  166. package/lib/components/DataTable/DataTable.tsx +8 -0
  167. package/lib/components/DataTable/TableBody/index.tsx +47 -11
  168. package/lib/components/DataTable/TableBody/types.ts +7 -1
  169. package/lib/components/DataTable/TableCell/index.tsx +1 -1
  170. package/lib/components/DataTable/hooks/index.ts +2 -0
  171. package/lib/components/DataTable/hooks/useReducedMotion.ts +19 -0
  172. package/lib/components/DataTable/hooks/useRowFlip.ts +170 -0
  173. package/lib/components/DataTable/types.ts +32 -0
  174. package/lib/components/DateRangePicker/CalendarGrid.tsx +39 -6
  175. package/lib/components/DateRangePicker/DateRangePicker.tsx +27 -4
  176. package/lib/components/DateRangePicker/types.ts +6 -1
  177. package/lib/components/DateRangePicker/utils.ts +123 -12
  178. package/lib/components/Directory/Directory.tsx +31 -0
  179. package/lib/components/Directory/NavItem.tsx +177 -86
  180. package/lib/components/Directory/Section.tsx +9 -0
  181. package/lib/components/Directory/VirtualizedDirectory.tsx +670 -0
  182. package/lib/components/Directory/directory.tokens.ts +21 -0
  183. package/lib/components/Directory/types.ts +43 -1
  184. package/lib/components/Directory/utils.ts +81 -1
  185. package/lib/components/Drawer/index.ts +1 -0
  186. package/lib/components/Inputs/DropdownInput/DropdownInput.tsx +6 -2
  187. package/lib/components/Inputs/MultiValueInput/index.ts +1 -0
  188. package/lib/components/Inputs/NumberInput/NumberInput.tsx +6 -2
  189. package/lib/components/Inputs/NumberInput/index.ts +1 -0
  190. package/lib/components/Inputs/OTPInput/index.ts +1 -0
  191. package/lib/components/Inputs/SearchInput/index.ts +1 -0
  192. package/lib/components/Inputs/TextArea/TextArea.tsx +4 -2
  193. package/lib/components/Inputs/TextArea/index.ts +1 -0
  194. package/lib/components/Inputs/TextInput/TextInput.tsx +6 -2
  195. package/lib/components/Inputs/TextInput/index.ts +1 -0
  196. package/lib/components/Inputs/UnitInput/UnitInput.tsx +6 -2
  197. package/lib/components/InputsV2/NumberInputV2/NumberInputV2.tsx +6 -2
  198. package/lib/components/InputsV2/TextAreaV2/TextAreaV2.tsx +2 -1
  199. package/lib/components/InputsV2/TextAreaV2/utils.ts +3 -1
  200. package/lib/components/InputsV2/TextInputV2/TextInputV2.tsx +1 -0
  201. package/lib/components/InputsV2/TextInputV2/utils.ts +6 -8
  202. package/lib/components/InputsV2/UploadV2/UploadContainerV2.tsx +470 -0
  203. package/lib/components/InputsV2/UploadV2/UploadV2.dark.tokens.ts +348 -0
  204. package/lib/components/InputsV2/UploadV2/UploadV2.light.tokens.ts +348 -0
  205. package/lib/components/InputsV2/UploadV2/UploadV2.tokens.ts +20 -0
  206. package/lib/components/InputsV2/UploadV2/UploadV2.tokens.types.ts +117 -0
  207. package/lib/components/InputsV2/UploadV2/UploadV2.tsx +336 -0
  208. package/lib/components/InputsV2/UploadV2/UploadV2.types.ts +67 -0
  209. package/lib/components/InputsV2/UploadV2/index.ts +3 -0
  210. package/lib/components/InputsV2/UploadV2/utils.ts +170 -0
  211. package/lib/components/KeyValuePair/index.ts +1 -0
  212. package/lib/components/Menu/Menu.tsx +18 -2
  213. package/lib/components/Menu/SubMenu.tsx +25 -3
  214. package/lib/components/Menu/index.ts +1 -0
  215. package/lib/components/Menu/types.tsx +14 -0
  216. package/lib/components/Menu/utils.ts +46 -3
  217. package/lib/components/MenuV2/MenuV2.tsx +9 -2
  218. package/lib/components/MenuV2/MenuV2Content.tsx +6 -0
  219. package/lib/components/MenuV2/MenuV2SubMenu.tsx +16 -2
  220. package/lib/components/MenuV2/menuV2.types.ts +11 -0
  221. package/lib/components/MenuV2/menuV2.utils.ts +45 -3
  222. package/lib/components/Modal/index.ts +1 -0
  223. package/lib/components/ModalV2/ModalV2.tsx +269 -0
  224. package/lib/components/ModalV2/ModalV2Footer.tsx +76 -0
  225. package/lib/components/ModalV2/ModalV2Header.tsx +144 -0
  226. package/lib/components/ModalV2/ModalV2Skeleton.tsx +80 -0
  227. package/lib/components/ModalV2/index.ts +4 -0
  228. package/lib/components/ModalV2/mobileModalV2.tsx +411 -0
  229. package/lib/components/ModalV2/modalAnimationV2.tsx +19 -0
  230. package/lib/components/ModalV2/modalV2.dark.tokens.ts +183 -0
  231. package/lib/components/ModalV2/modalV2.light.tokens.ts +183 -0
  232. package/lib/components/ModalV2/modalV2.tokens.ts +21 -0
  233. package/lib/components/ModalV2/modalV2.tokens.types.ts +94 -0
  234. package/lib/components/ModalV2/modalV2.types.ts +80 -0
  235. package/lib/components/MultiSelect/MultiSelect.tsx +4 -1
  236. package/lib/components/MultiSelect/MultiSelectMenu.tsx +8 -0
  237. package/lib/components/MultiSelect/MultiSelectTrigger.tsx +2 -1
  238. package/lib/components/MultiSelect/index.ts +2 -0
  239. package/lib/components/MultiSelect/types.ts +2 -0
  240. package/lib/components/MultiSelectV2/MultiSelectV2.tsx +2 -0
  241. package/lib/components/MultiSelectV2/MultiSelectV2Menu.tsx +8 -0
  242. package/lib/components/MultiSelectV2/MultiSelectV2Trigger.tsx +4 -1
  243. package/lib/components/MultiSelectV2/multiSelectV2.types.ts +2 -0
  244. package/lib/components/Popover/index.ts +1 -0
  245. package/lib/components/Primitives/Block/Block.tsx +1 -1
  246. package/lib/components/ProgressBar/index.ts +1 -0
  247. package/lib/components/Radio/index.ts +2 -0
  248. package/lib/components/Sidebar/Sidebar.tsx +38 -0
  249. package/lib/components/Sidebar/SidebarContent.tsx +25 -1
  250. package/lib/components/Sidebar/index.ts +1 -0
  251. package/lib/components/Sidebar/types.ts +13 -1
  252. package/lib/components/SidebarV2/SidebarV2.tsx +30 -0
  253. package/lib/components/SidebarV2/SidebarV2Panel.tsx +25 -1
  254. package/lib/components/SidebarV2/types.ts +9 -1
  255. package/lib/components/SingleSelect/SingleSelect.tsx +4 -1
  256. package/lib/components/SingleSelect/SingleSelectMenu.tsx +171 -138
  257. package/lib/components/SingleSelect/SingleSelectTrigger.tsx +3 -1
  258. package/lib/components/SingleSelect/index.ts +1 -0
  259. package/lib/components/SingleSelect/types.ts +1 -0
  260. package/lib/components/SingleSelectV2/SingleSelectV2.tsx +2 -0
  261. package/lib/components/SingleSelectV2/SingleSelectV2Menu.tsx +84 -58
  262. package/lib/components/SingleSelectV2/SingleSelectV2Search.tsx +1 -0
  263. package/lib/components/SingleSelectV2/SingleSelectV2Trigger.tsx +3 -1
  264. package/lib/components/SingleSelectV2/singleSelectV2.dark.tokens.ts +8 -0
  265. package/lib/components/SingleSelectV2/singleSelectV2.light.tokens.ts +8 -0
  266. package/lib/components/SingleSelectV2/singleSelectV2.tokens.types.ts +8 -0
  267. package/lib/components/SingleSelectV2/singleSelectV2.types.ts +2 -0
  268. package/lib/components/Skeleton/SkeletonCompound.tsx +45 -31
  269. package/lib/components/Snackbar/Snackbar.tsx +18 -8
  270. package/lib/components/Snackbar/index.ts +2 -0
  271. package/lib/components/Snackbar/snackbar.tokens.ts +6 -0
  272. package/lib/components/Snackbar/types.ts +2 -0
  273. package/lib/components/StatCard/StatCard.tsx +29 -0
  274. package/lib/components/StatCard/index.ts +1 -0
  275. package/lib/components/Stepper/index.ts +1 -0
  276. package/lib/components/Switch/index.ts +2 -0
  277. package/lib/components/Tabs/index.ts +1 -0
  278. package/lib/components/Tags/index.ts +1 -0
  279. package/lib/components/Timeline/Timeline.tsx +9 -1
  280. package/lib/components/Tooltip/index.ts +1 -0
  281. package/lib/components/Topbar/index.ts +1 -0
  282. package/lib/components/Upload/index.ts +1 -0
  283. package/lib/context/ThemeContext.tsx +16 -0
  284. package/lib/context/initComponentTokens.ts +11 -0
  285. package/lib/context/useComponentToken.ts +15 -1
  286. package/lib/hooks/useResponsiveTokens.ts +63 -0
  287. package/lib/main.ts +16 -0
  288. package/lib/node.ts +2 -0
  289. package/package.json +5 -4
  290. package/dist/tokens.d.ts +0 -2
@@ -0,0 +1,144 @@
1
+ import { useResponsiveTokens } from '../../hooks/useResponsiveTokens'
2
+ import type { ReactNode } from 'react'
3
+ import { SkeletonVariant } from '../Skeleton'
4
+ import type { ModalV2TokensType } from './modalV2.tokens.types'
5
+ import ModalV2Skeleton from './ModalV2Skeleton'
6
+ import Block from '../Primitives/Block/Block'
7
+ import Text from '../Text/Text'
8
+ import { ButtonV2, ButtonV2Type, ButtonV2SubType } from '../ButtonV2'
9
+ import { XIcon } from '@phosphor-icons/react'
10
+
11
+ const formatLineHeight = (value: string | number | undefined) =>
12
+ typeof value === 'number' ? `${value}px` : value
13
+
14
+ const ModalV2Header = ({
15
+ title,
16
+ subtitle,
17
+ onClose,
18
+ showCloseButton,
19
+ headerSlot,
20
+ showDivider,
21
+ showSkeleton,
22
+ skeletonVariant,
23
+ titleId,
24
+ subtitleId,
25
+ }: {
26
+ title?: string
27
+ subtitle?: string
28
+ onClose: () => void
29
+ showCloseButton?: boolean
30
+ headerSlot?: ReactNode
31
+ showDivider?: boolean
32
+ showSkeleton?: boolean
33
+ skeletonVariant?: SkeletonVariant
34
+ titleId?: string
35
+ subtitleId?: string
36
+ }) => {
37
+ const modalTokens = useResponsiveTokens<ModalV2TokensType>('MODALV2')
38
+
39
+ if (showSkeleton) {
40
+ return (
41
+ <ModalV2Skeleton
42
+ modalTokens={modalTokens}
43
+ headerSkeleton={{
44
+ show: showSkeleton || false,
45
+ showDivider: showDivider || false,
46
+ showCloseButton: showCloseButton || false,
47
+ }}
48
+ skeletonVariant={
49
+ skeletonVariant || ('pulse' as SkeletonVariant)
50
+ }
51
+ />
52
+ )
53
+ }
54
+
55
+ if (!title && !subtitle && !headerSlot && !showCloseButton) return null
56
+
57
+ return (
58
+ <Block
59
+ display="flex"
60
+ justifyContent="space-between"
61
+ alignItems="flex-start"
62
+ paddingTop={modalTokens.header.paddingTop}
63
+ paddingRight={modalTokens.header.paddingRight}
64
+ paddingBottom={modalTokens.header.paddingBottom}
65
+ paddingLeft={modalTokens.header.paddingLeft}
66
+ flexShrink={0}
67
+ overflow="auto"
68
+ maxHeight={modalTokens.header.maxHeight}
69
+ gap={modalTokens.header.gap}
70
+ backgroundColor={modalTokens.header.backgroundColor}
71
+ borderTopLeftRadius={modalTokens.header.borderTopLeftRadius}
72
+ borderTopRightRadius={modalTokens.header.borderTopRightRadius}
73
+ borderBottom={
74
+ showDivider ? modalTokens.header.borderBottom : undefined
75
+ }
76
+ >
77
+ <Block display="flex" flexDirection="column">
78
+ <Block
79
+ display="flex"
80
+ flexDirection="row"
81
+ gap={modalTokens.header.slot.gap}
82
+ alignItems="center"
83
+ >
84
+ {title && (
85
+ <Text
86
+ id={titleId}
87
+ data-element="header"
88
+ data-id={title ?? ''}
89
+ as="span"
90
+ fontSize={modalTokens.header.text.title.fontSize}
91
+ fontWeight={
92
+ modalTokens.header.text.title.fontWeight
93
+ }
94
+ lineHeight={formatLineHeight(
95
+ modalTokens.header.text.title.lineHeight
96
+ )}
97
+ color={modalTokens.header.text.title.color}
98
+ >
99
+ {title}
100
+ </Text>
101
+ )}
102
+ {headerSlot}
103
+ </Block>
104
+
105
+ {subtitle && (
106
+ <Text
107
+ id={subtitleId}
108
+ data-element="header-subtitle"
109
+ data-id={subtitle}
110
+ as="span"
111
+ fontSize={modalTokens.header.text.subtitle.fontSize}
112
+ color={modalTokens.header.text.subtitle.color}
113
+ fontWeight={modalTokens.header.text.subtitle.fontWeight}
114
+ lineHeight={formatLineHeight(
115
+ modalTokens.header.text.subtitle.lineHeight
116
+ )}
117
+ >
118
+ {subtitle}
119
+ </Text>
120
+ )}
121
+ </Block>
122
+ {showCloseButton && (
123
+ <ButtonV2
124
+ subType={ButtonV2SubType.INLINE}
125
+ buttonType={ButtonV2Type.SECONDARY}
126
+ leftSlot={{
127
+ slot: (
128
+ <XIcon
129
+ size={modalTokens.closeButton.width}
130
+ color={modalTokens.closeButton.color}
131
+ aria-hidden="true"
132
+ />
133
+ ),
134
+ maxHeight: modalTokens.closeButton.height,
135
+ }}
136
+ onClick={onClose}
137
+ aria-label="Close modal"
138
+ />
139
+ )}
140
+ </Block>
141
+ )
142
+ }
143
+
144
+ export default ModalV2Header
@@ -0,0 +1,80 @@
1
+ import Block from '../Primitives/Block/Block'
2
+ import { Skeleton } from '../Skeleton'
3
+ import type { FC } from 'react'
4
+ import type { ModalV2SkeletonProps } from './modalV2.types'
5
+
6
+ const ModalV2Skeleton: FC<ModalV2SkeletonProps> = ({
7
+ modalTokens,
8
+ headerSkeleton,
9
+ bodySkeleton,
10
+ footerSkeleton,
11
+
12
+ skeletonVariant,
13
+ }) => {
14
+ const {
15
+ show: showHeaderSkeleton = false,
16
+ showDivider: showHeaderDivider = false,
17
+ } = headerSkeleton || {}
18
+ const { show: showBodySkeleton = false, width, height } = bodySkeleton || {}
19
+ const { show: showFooterSkeleton = false } = footerSkeleton || {}
20
+
21
+ if (showHeaderSkeleton) {
22
+ return (
23
+ <Block
24
+ display="flex"
25
+ justifyContent="space-between"
26
+ alignItems="flex-start"
27
+ paddingTop={modalTokens.skeleton.header.paddingTop}
28
+ paddingRight={modalTokens.skeleton.header.paddingRight}
29
+ paddingBottom={modalTokens.skeleton.header.paddingBottom}
30
+ paddingLeft={modalTokens.skeleton.header.paddingLeft}
31
+ flexShrink={0}
32
+ gap={modalTokens.skeleton.header.gap}
33
+ borderBottom={
34
+ showHeaderDivider
35
+ ? modalTokens.skeleton.header.borderBottom
36
+ : undefined
37
+ }
38
+ >
39
+ <Block
40
+ display="flex"
41
+ flexDirection="column"
42
+ flexGrow={1}
43
+ gap={modalTokens.skeleton.header.gap}
44
+ >
45
+ <Skeleton
46
+ variant={skeletonVariant}
47
+ width={modalTokens.skeleton.header.width}
48
+ height={modalTokens.skeleton.header.height}
49
+ borderRadius={modalTokens.skeleton.header.borderRadius}
50
+ />
51
+ </Block>
52
+ </Block>
53
+ )
54
+ }
55
+
56
+ if (showBodySkeleton) {
57
+ return (
58
+ <Block
59
+ display="flex"
60
+ flexDirection="column"
61
+ gap={modalTokens.skeleton.body.gap}
62
+ >
63
+ <Skeleton
64
+ variant={skeletonVariant}
65
+ width={width || modalTokens.skeleton.body.width}
66
+ height={height || modalTokens.skeleton.body.height}
67
+ borderRadius={modalTokens.skeleton.body.borderRadius}
68
+ />
69
+ </Block>
70
+ )
71
+ }
72
+
73
+ if (showFooterSkeleton) {
74
+ return null
75
+ }
76
+
77
+ return null
78
+ }
79
+
80
+ export default ModalV2Skeleton
@@ -0,0 +1,4 @@
1
+ export { default as ModalV2 } from './ModalV2'
2
+ export * from './modalV2.tokens'
3
+ export * from './modalV2.tokens.types'
4
+ export * from './modalV2.types'
@@ -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