@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.
Files changed (240) hide show
  1. package/dist/components/Accordion/index.d.ts +2 -0
  2. package/dist/components/AccordionV2/accordionV2.animations.d.ts +1 -1
  3. package/dist/components/Alert/index.d.ts +1 -0
  4. package/dist/components/Avatar/index.d.ts +1 -0
  5. package/dist/components/Breadcrumb/index.d.ts +1 -0
  6. package/dist/components/Button/index.d.ts +1 -0
  7. package/dist/components/ButtonGroup/index.d.ts +1 -0
  8. package/dist/components/Card/index.d.ts +1 -0
  9. package/dist/components/CardV2/CardV2.d.ts +45 -0
  10. package/dist/components/CardV2/CardV2.utils.d.ts +14 -0
  11. package/dist/components/CardV2/CardV2Components.d.ts +8 -0
  12. package/dist/components/CardV2/CardV2Context.d.ts +14 -0
  13. package/dist/components/CardV2/CardV2Skeleton.d.ts +6 -0
  14. package/dist/components/CardV2/accessibility/CardV2AccessibilityReport.d.ts +2 -0
  15. package/dist/components/CardV2/accessibility/index.d.ts +1 -0
  16. package/dist/components/CardV2/cardV2.dark.tokens.d.ts +3 -0
  17. package/dist/components/CardV2/cardV2.light.tokens.d.ts +3 -0
  18. package/dist/components/CardV2/cardV2.tokens.d.ts +5 -0
  19. package/dist/components/CardV2/cardV2.tokens.types.d.ts +92 -0
  20. package/dist/components/CardV2/cardV2.types.d.ts +106 -0
  21. package/dist/components/CardV2/index.d.ts +5 -0
  22. package/dist/components/Charts/index.d.ts +10 -0
  23. package/dist/components/Charts/types.d.ts +2 -0
  24. package/dist/components/ChatInput/index.d.ts +1 -0
  25. package/dist/components/Checkbox/index.d.ts +1 -0
  26. package/dist/components/CodeEditor/index.d.ts +1 -0
  27. package/dist/components/DataTable/PivotTableModal/pivotModal.styled.d.ts +184 -0
  28. package/dist/components/DataTable/TableBody/types.d.ts +3 -1
  29. package/dist/components/DataTable/hooks/index.d.ts +2 -0
  30. package/dist/components/DataTable/hooks/useReducedMotion.d.ts +1 -0
  31. package/dist/components/DataTable/hooks/useRowFlip.d.ts +6 -0
  32. package/dist/components/DataTable/types.d.ts +26 -0
  33. package/dist/components/DateRangePicker/CalendarGrid.d.ts +5 -2
  34. package/dist/components/DateRangePicker/types.d.ts +3 -1
  35. package/dist/components/DateRangePicker/utils.d.ts +5 -5
  36. package/dist/components/Directory/Directory.d.ts +1 -1
  37. package/dist/components/Directory/NavItem.d.ts +1 -1
  38. package/dist/components/Directory/Section.d.ts +1 -1
  39. package/dist/components/Directory/VirtualizedDirectory.d.ts +3 -0
  40. package/dist/components/Directory/directory.tokens.d.ts +7 -0
  41. package/dist/components/Directory/types.d.ts +38 -1
  42. package/dist/components/Directory/utils.d.ts +3 -1
  43. package/dist/components/Drawer/index.d.ts +1 -0
  44. package/dist/components/Inputs/MultiValueInput/index.d.ts +1 -0
  45. package/dist/components/Inputs/NumberInput/index.d.ts +1 -0
  46. package/dist/components/Inputs/OTPInput/index.d.ts +1 -0
  47. package/dist/components/Inputs/SearchInput/index.d.ts +1 -0
  48. package/dist/components/Inputs/TextArea/index.d.ts +1 -0
  49. package/dist/components/Inputs/TextInput/index.d.ts +1 -0
  50. package/dist/components/InputsV2/TextAreaV2/utils.d.ts +2 -1
  51. package/dist/components/InputsV2/TextInputV2/utils.d.ts +2 -1
  52. package/dist/components/InputsV2/UploadV2/UploadContainerV2.d.ts +24 -0
  53. package/dist/components/InputsV2/UploadV2/UploadV2.d.ts +31 -0
  54. package/dist/components/InputsV2/UploadV2/UploadV2.dark.tokens.d.ts +3 -0
  55. package/dist/components/InputsV2/UploadV2/UploadV2.light.tokens.d.ts +3 -0
  56. package/dist/components/InputsV2/UploadV2/UploadV2.tokens.d.ts +5 -0
  57. package/dist/components/InputsV2/UploadV2/UploadV2.tokens.types.d.ts +115 -0
  58. package/dist/components/InputsV2/UploadV2/UploadV2.types.d.ts +56 -0
  59. package/dist/components/InputsV2/UploadV2/index.d.ts +3 -0
  60. package/dist/components/InputsV2/UploadV2/utils.d.ts +32 -0
  61. package/dist/components/KeyValuePair/index.d.ts +1 -0
  62. package/dist/components/Menu/Menu.d.ts +1 -1
  63. package/dist/components/Menu/index.d.ts +1 -0
  64. package/dist/components/Menu/types.d.ts +7 -0
  65. package/dist/components/Menu/utils.d.ts +10 -2
  66. package/dist/components/Modal/index.d.ts +1 -0
  67. package/dist/components/ModalV2/ModalV2.d.ts +22 -0
  68. package/dist/components/ModalV2/ModalV2Footer.d.ts +10 -0
  69. package/dist/components/ModalV2/ModalV2Header.d.ts +15 -0
  70. package/dist/components/ModalV2/ModalV2Skeleton.d.ts +4 -0
  71. package/dist/components/ModalV2/index.d.ts +4 -0
  72. package/dist/components/ModalV2/mobileModalV2.d.ts +23 -0
  73. package/dist/components/ModalV2/modalAnimationV2.d.ts +3 -0
  74. package/dist/components/ModalV2/modalV2.dark.tokens.d.ts +3 -0
  75. package/dist/components/ModalV2/modalV2.light.tokens.d.ts +3 -0
  76. package/dist/components/ModalV2/modalV2.tokens.d.ts +5 -0
  77. package/dist/components/ModalV2/modalV2.tokens.types.d.ts +91 -0
  78. package/dist/components/ModalV2/modalV2.types.d.ts +66 -0
  79. package/dist/components/MultiSelect/index.d.ts +2 -0
  80. package/dist/components/Popover/index.d.ts +1 -0
  81. package/dist/components/Primitives/Block/Block.d.ts +1 -1
  82. package/dist/components/ProgressBar/index.d.ts +1 -0
  83. package/dist/components/Radio/index.d.ts +2 -0
  84. package/dist/components/Sidebar/SidebarContent.d.ts +9 -1
  85. package/dist/components/Sidebar/index.d.ts +1 -0
  86. package/dist/components/Sidebar/types.d.ts +9 -1
  87. package/dist/components/SidebarV2/SidebarV2Panel.d.ts +10 -2
  88. package/dist/components/SidebarV2/types.d.ts +9 -1
  89. package/dist/components/SingleSelect/index.d.ts +1 -0
  90. package/dist/components/Skeleton/SkeletonCompound.d.ts +24 -33
  91. package/dist/components/Snackbar/index.d.ts +2 -0
  92. package/dist/components/StatCard/index.d.ts +1 -0
  93. package/dist/components/Stepper/index.d.ts +1 -0
  94. package/dist/components/Switch/index.d.ts +2 -0
  95. package/dist/components/Tabs/index.d.ts +1 -0
  96. package/dist/components/Tags/index.d.ts +1 -0
  97. package/dist/components/Timeline/Timeline.d.ts +13 -37
  98. package/dist/components/Tooltip/index.d.ts +1 -0
  99. package/dist/components/Topbar/index.d.ts +1 -0
  100. package/dist/components/Upload/index.d.ts +1 -0
  101. package/dist/context/ThemeContext.d.ts +6 -0
  102. package/dist/context/useComponentToken.d.ts +4 -1
  103. package/dist/main.d.ts +6 -0
  104. package/dist/main.js +45081 -41934
  105. package/dist/node-B3rrXW84.js +1023 -0
  106. package/dist/node.d.ts +2 -0
  107. package/dist/node.js +21 -18
  108. package/dist/token-engine.js +1 -1
  109. package/lib/components/Accordion/AccordionItem.tsx +2 -6
  110. package/lib/components/Accordion/index.ts +2 -0
  111. package/lib/components/AccordionV2/AccordionV2Item.tsx +1 -1
  112. package/lib/components/AccordionV2/accordionV2.animations.ts +1 -5
  113. package/lib/components/Alert/index.ts +1 -0
  114. package/lib/components/Avatar/index.ts +1 -0
  115. package/lib/components/Breadcrumb/index.ts +1 -0
  116. package/lib/components/Button/index.ts +1 -0
  117. package/lib/components/ButtonGroup/index.ts +1 -0
  118. package/lib/components/Card/index.ts +1 -0
  119. package/lib/components/CardV2/CardV2.tsx +327 -0
  120. package/lib/components/CardV2/CardV2.utils.tsx +77 -0
  121. package/lib/components/CardV2/CardV2Components.tsx +297 -0
  122. package/lib/components/CardV2/CardV2Context.tsx +18 -0
  123. package/lib/components/CardV2/CardV2Skeleton.tsx +40 -0
  124. package/lib/components/CardV2/accessibility/CardV2AccessibilityReport.ts +284 -0
  125. package/lib/components/CardV2/accessibility/index.ts +1 -0
  126. package/lib/components/CardV2/cardV2.dark.tokens.ts +177 -0
  127. package/lib/components/CardV2/cardV2.light.tokens.ts +177 -0
  128. package/lib/components/CardV2/cardV2.tokens.ts +21 -0
  129. package/lib/components/CardV2/cardV2.tokens.types.ts +94 -0
  130. package/lib/components/CardV2/cardV2.types.ts +131 -0
  131. package/lib/components/CardV2/index.ts +13 -0
  132. package/lib/components/Charts/ChartLegend.tsx +25 -5
  133. package/lib/components/Charts/Charts.tsx +10 -0
  134. package/lib/components/Charts/index.ts +10 -0
  135. package/lib/components/Charts/types.tsx +2 -0
  136. package/lib/components/ChatInput/index.tsx +1 -0
  137. package/lib/components/Checkbox/index.ts +1 -0
  138. package/lib/components/CodeEditor/index.ts +1 -0
  139. package/lib/components/DataTable/DataTable.tsx +8 -0
  140. package/lib/components/DataTable/TableBody/index.tsx +47 -11
  141. package/lib/components/DataTable/TableBody/types.ts +7 -1
  142. package/lib/components/DataTable/TableCell/index.tsx +1 -1
  143. package/lib/components/DataTable/hooks/index.ts +2 -0
  144. package/lib/components/DataTable/hooks/useReducedMotion.ts +19 -0
  145. package/lib/components/DataTable/hooks/useRowFlip.ts +170 -0
  146. package/lib/components/DataTable/types.ts +32 -0
  147. package/lib/components/DateRangePicker/CalendarGrid.tsx +36 -6
  148. package/lib/components/DateRangePicker/DateRangePicker.tsx +22 -3
  149. package/lib/components/DateRangePicker/types.ts +6 -1
  150. package/lib/components/DateRangePicker/utils.ts +123 -12
  151. package/lib/components/Directory/Directory.tsx +31 -0
  152. package/lib/components/Directory/NavItem.tsx +177 -86
  153. package/lib/components/Directory/Section.tsx +9 -0
  154. package/lib/components/Directory/VirtualizedDirectory.tsx +670 -0
  155. package/lib/components/Directory/directory.tokens.ts +21 -0
  156. package/lib/components/Directory/types.ts +43 -1
  157. package/lib/components/Directory/utils.ts +81 -1
  158. package/lib/components/Drawer/index.ts +1 -0
  159. package/lib/components/Inputs/DropdownInput/DropdownInput.tsx +6 -2
  160. package/lib/components/Inputs/MultiValueInput/index.ts +1 -0
  161. package/lib/components/Inputs/NumberInput/NumberInput.tsx +6 -2
  162. package/lib/components/Inputs/NumberInput/index.ts +1 -0
  163. package/lib/components/Inputs/OTPInput/index.ts +1 -0
  164. package/lib/components/Inputs/SearchInput/index.ts +1 -0
  165. package/lib/components/Inputs/TextArea/TextArea.tsx +4 -2
  166. package/lib/components/Inputs/TextArea/index.ts +1 -0
  167. package/lib/components/Inputs/TextInput/TextInput.tsx +6 -2
  168. package/lib/components/Inputs/TextInput/index.ts +1 -0
  169. package/lib/components/Inputs/UnitInput/UnitInput.tsx +6 -2
  170. package/lib/components/InputsV2/NumberInputV2/NumberInputV2.tsx +6 -2
  171. package/lib/components/InputsV2/TextAreaV2/TextAreaV2.tsx +2 -1
  172. package/lib/components/InputsV2/TextAreaV2/utils.ts +3 -1
  173. package/lib/components/InputsV2/TextInputV2/TextInputV2.tsx +1 -0
  174. package/lib/components/InputsV2/TextInputV2/utils.ts +6 -8
  175. package/lib/components/InputsV2/UploadV2/UploadContainerV2.tsx +470 -0
  176. package/lib/components/InputsV2/UploadV2/UploadV2.dark.tokens.ts +348 -0
  177. package/lib/components/InputsV2/UploadV2/UploadV2.light.tokens.ts +348 -0
  178. package/lib/components/InputsV2/UploadV2/UploadV2.tokens.ts +20 -0
  179. package/lib/components/InputsV2/UploadV2/UploadV2.tokens.types.ts +117 -0
  180. package/lib/components/InputsV2/UploadV2/UploadV2.tsx +336 -0
  181. package/lib/components/InputsV2/UploadV2/UploadV2.types.ts +67 -0
  182. package/lib/components/InputsV2/UploadV2/index.ts +3 -0
  183. package/lib/components/InputsV2/UploadV2/utils.ts +170 -0
  184. package/lib/components/KeyValuePair/index.ts +1 -0
  185. package/lib/components/Menu/Menu.tsx +18 -2
  186. package/lib/components/Menu/SubMenu.tsx +25 -3
  187. package/lib/components/Menu/index.ts +1 -0
  188. package/lib/components/Menu/types.tsx +14 -0
  189. package/lib/components/Menu/utils.ts +46 -3
  190. package/lib/components/Modal/index.ts +1 -0
  191. package/lib/components/ModalV2/ModalV2.tsx +269 -0
  192. package/lib/components/ModalV2/ModalV2Footer.tsx +76 -0
  193. package/lib/components/ModalV2/ModalV2Header.tsx +144 -0
  194. package/lib/components/ModalV2/ModalV2Skeleton.tsx +80 -0
  195. package/lib/components/ModalV2/index.ts +4 -0
  196. package/lib/components/ModalV2/mobileModalV2.tsx +411 -0
  197. package/lib/components/ModalV2/modalAnimationV2.tsx +19 -0
  198. package/lib/components/ModalV2/modalV2.dark.tokens.ts +183 -0
  199. package/lib/components/ModalV2/modalV2.light.tokens.ts +183 -0
  200. package/lib/components/ModalV2/modalV2.tokens.ts +21 -0
  201. package/lib/components/ModalV2/modalV2.tokens.types.ts +94 -0
  202. package/lib/components/ModalV2/modalV2.types.ts +80 -0
  203. package/lib/components/MultiSelect/MultiSelect.tsx +2 -1
  204. package/lib/components/MultiSelect/MultiSelectTrigger.tsx +2 -1
  205. package/lib/components/MultiSelect/index.ts +2 -0
  206. package/lib/components/MultiSelectV2/MultiSelectV2Trigger.tsx +4 -1
  207. package/lib/components/Popover/index.ts +1 -0
  208. package/lib/components/Primitives/Block/Block.tsx +1 -1
  209. package/lib/components/ProgressBar/index.ts +1 -0
  210. package/lib/components/Radio/index.ts +2 -0
  211. package/lib/components/Sidebar/Sidebar.tsx +38 -0
  212. package/lib/components/Sidebar/SidebarContent.tsx +25 -1
  213. package/lib/components/Sidebar/index.ts +1 -0
  214. package/lib/components/Sidebar/types.ts +13 -1
  215. package/lib/components/SidebarV2/SidebarV2.tsx +30 -0
  216. package/lib/components/SidebarV2/SidebarV2Panel.tsx +25 -1
  217. package/lib/components/SidebarV2/types.ts +9 -1
  218. package/lib/components/SingleSelect/SingleSelect.tsx +2 -1
  219. package/lib/components/SingleSelect/SingleSelectTrigger.tsx +3 -1
  220. package/lib/components/SingleSelect/index.ts +1 -0
  221. package/lib/components/SingleSelectV2/SingleSelectV2Trigger.tsx +3 -1
  222. package/lib/components/Skeleton/SkeletonCompound.tsx +45 -31
  223. package/lib/components/Snackbar/index.ts +2 -0
  224. package/lib/components/StatCard/index.ts +1 -0
  225. package/lib/components/Stepper/index.ts +1 -0
  226. package/lib/components/Switch/index.ts +2 -0
  227. package/lib/components/Tabs/index.ts +1 -0
  228. package/lib/components/Tags/index.ts +1 -0
  229. package/lib/components/Timeline/Timeline.tsx +9 -1
  230. package/lib/components/Tooltip/index.ts +1 -0
  231. package/lib/components/Topbar/index.ts +1 -0
  232. package/lib/components/Upload/index.ts +1 -0
  233. package/lib/context/ThemeContext.tsx +16 -0
  234. package/lib/context/initComponentTokens.ts +11 -0
  235. package/lib/context/useComponentToken.ts +15 -1
  236. package/lib/hooks/useResponsiveTokens.ts +63 -0
  237. package/lib/main.ts +16 -0
  238. package/lib/node.ts +2 -0
  239. package/package.json +1 -1
  240. /package/dist/{node-CovJEwot.js → breadcrumbV2.tokens-CovJEwot.js} +0 -0
@@ -264,13 +264,16 @@ type CalendarSectionProps = {
264
264
  disablePastDates: boolean
265
265
  hideFutureDates: boolean
266
266
  hidePastDates: boolean
267
- customDisableDates?: (date: Date) => boolean
267
+ customDisableDates?: (date: Date, currentRange?: DateRange) => boolean
268
268
  customRangeConfig?: import('./types').CustomRangeConfig
269
269
  onDateSelect: (range: DateRange) => void
270
270
  showDateTimePicker: boolean
271
271
  timezone?: string
272
272
  isSingleDatePicker?: boolean
273
273
  maxYearOffset?: number
274
+ minDate?: Date
275
+ maxDate?: Date
276
+ maxRangeDays?: number
274
277
  }
275
278
 
276
279
  const CalendarSection: React.FC<
@@ -291,6 +294,9 @@ const CalendarSection: React.FC<
291
294
  timezone,
292
295
  isSingleDatePicker,
293
296
  maxYearOffset,
297
+ minDate,
298
+ maxDate,
299
+ maxRangeDays,
294
300
  }) => (
295
301
  <Block flexGrow={1} minHeight={0} overflow="auto">
296
302
  <CalendarGrid
@@ -309,6 +315,9 @@ const CalendarSection: React.FC<
309
315
  timezone={timezone}
310
316
  isSingleDatePicker={isSingleDatePicker}
311
317
  maxYearOffset={maxYearOffset}
318
+ minDate={minDate}
319
+ maxDate={maxDate}
320
+ maxRangeDays={maxRangeDays}
312
321
  />
313
322
  </Block>
314
323
  )
@@ -386,6 +395,9 @@ const DateRangePicker = forwardRef<HTMLDivElement, DateRangePickerProps>(
386
395
  hidePastDates = false,
387
396
  customDisableDates,
388
397
  customRangeConfig,
398
+ minDate,
399
+ maxDate,
400
+ maxRangeDays,
389
401
  triggerElement = null,
390
402
  useDrawerOnMobile = true,
391
403
  skipQuickFiltersOnMobile = false,
@@ -534,7 +546,11 @@ const DateRangePicker = forwardRef<HTMLDivElement, DateRangePickerProps>(
534
546
  setSelectedRange(normalizedRange)
535
547
  setActivePreset(
536
548
  normalizedRange
537
- ? detectPresetFromRange(normalizedRange, timezone)
549
+ ? detectPresetFromRange(
550
+ normalizedRange,
551
+ timezone,
552
+ presetConfigs
553
+ )
538
554
  : DateRangePreset.CUSTOM
539
555
  )
540
556
  setStartDate(
@@ -573,7 +589,7 @@ const DateRangePicker = forwardRef<HTMLDivElement, DateRangePickerProps>(
573
589
  error: 'none',
574
590
  })
575
591
  },
576
- [timezone, dateFormat]
592
+ [timezone, dateFormat, presetConfigs]
577
593
  )
578
594
 
579
595
  useEffect(() => {
@@ -1279,6 +1295,9 @@ const DateRangePicker = forwardRef<HTMLDivElement, DateRangePickerProps>(
1279
1295
  timezone={timezone}
1280
1296
  isSingleDatePicker={isSingleDatePicker}
1281
1297
  maxYearOffset={maxYearOffset}
1298
+ minDate={minDate}
1299
+ maxDate={maxDate}
1300
+ maxRangeDays={maxRangeDays}
1282
1301
  />
1283
1302
 
1284
1303
  <FooterControls
@@ -207,9 +207,13 @@ export type PresetsConfig = (
207
207
  /**
208
208
  * Function type for custom date disabling logic
209
209
  * @param date The date to check
210
+ * @param currentRange The current in-progress selected range (if any)
210
211
  * @returns true if the date should be disabled, false otherwise
211
212
  */
212
- export type CustomDateDisableFunction = (date: Date) => boolean
213
+ export type CustomDateDisableFunction = (
214
+ date: Date,
215
+ currentRange?: DateRange
216
+ ) => boolean
213
217
 
214
218
  /**
215
219
  * Function type for custom range calculation
@@ -317,6 +321,7 @@ export type DateRangePickerProps = {
317
321
  icon?: ReactNode
318
322
  minDate?: Date
319
323
  maxDate?: Date
324
+ maxRangeDays?: number
320
325
  dateFormat?: string
321
326
  allowSingleDateSelection?: boolean
322
327
  isSingleDatePicker?: boolean
@@ -1040,6 +1040,10 @@ export const createSingleDateRange = (
1040
1040
  return { startDate, endDate }
1041
1041
  }
1042
1042
 
1043
+ /** Normalizes a date to midnight so comparisons only consider the calendar day. */
1044
+ const startOfDay = (date: Date): Date =>
1045
+ new Date(date.getFullYear(), date.getMonth(), date.getDate())
1046
+
1043
1047
  /**
1044
1048
  * Creates a date at start of day (00:00:00)
1045
1049
  */
@@ -1115,7 +1119,11 @@ export const handleCalendarDateClick = (
1115
1119
  isDoubleClick: boolean = false,
1116
1120
  timezone?: string,
1117
1121
  selectedRange?: DateRange,
1118
- isSingleDatePicker?: boolean
1122
+ isSingleDatePicker?: boolean,
1123
+ minDate?: Date,
1124
+ maxDate?: Date,
1125
+ customDisableDates?: (date: Date, currentRange?: DateRange) => boolean,
1126
+ maxRangeDays?: number
1119
1127
  ): DateRange | null => {
1120
1128
  // Validate date is not disabled
1121
1129
  if (
@@ -1125,6 +1133,24 @@ export const handleCalendarDateClick = (
1125
1133
  return null
1126
1134
  }
1127
1135
 
1136
+ // minDate / maxDate hard bounds (day-level comparison)
1137
+ if (minDate && startOfDay(clickedDate) < startOfDay(minDate)) return null
1138
+ if (maxDate && startOfDay(clickedDate) > startOfDay(maxDate)) return null
1139
+ // customDisableDates honoured in the click path
1140
+ if (customDisableDates && customDisableDates(clickedDate, selectedRange))
1141
+ return null
1142
+ // maxRangeDays: block clicks on days beyond start + maxRangeDays
1143
+ if (maxRangeDays && selectedRange?.startDate && !selectedRange.endDate) {
1144
+ const diffDays = Math.abs(
1145
+ Math.floor(
1146
+ (startOfDay(clickedDate).getTime() -
1147
+ startOfDay(selectedRange.startDate).getTime()) /
1148
+ (1000 * 60 * 60 * 24)
1149
+ )
1150
+ )
1151
+ if (diffDays > maxRangeDays) return null
1152
+ }
1153
+
1128
1154
  // Create clean date without time components for comparison
1129
1155
  const clickedDateOnly = new Date(
1130
1156
  clickedDate.getFullYear(),
@@ -1504,15 +1530,33 @@ export const getDateCellStates = (
1504
1530
  today: Date,
1505
1531
  disableFutureDates: boolean = false,
1506
1532
  disablePastDates: boolean = false,
1507
- customDisableDates?: (date: Date) => boolean,
1533
+ customDisableDates?: (date: Date, currentRange?: DateRange) => boolean,
1508
1534
  timezone?: string,
1509
- isSingleDatePicker?: boolean
1535
+ isSingleDatePicker?: boolean,
1536
+ minDate?: Date,
1537
+ maxDate?: Date,
1538
+ maxRangeDays?: number
1510
1539
  ) => {
1511
1540
  const isTodayDay = isDateToday(date, today)
1541
+
1542
+ // maxRangeDays: only active while a range is half-selected (start picked,
1543
+ // end not yet chosen). Once both start and end are set, a new click resets
1544
+ // to a fresh start, so capping is not needed there.
1545
+ let isBeyondMaxRange = false
1546
+ if (maxRangeDays && selectedRange?.startDate && !selectedRange.endDate) {
1547
+ const start = selectedRange.startDate
1548
+ const diffMs = startOfDay(date).getTime() - startOfDay(start).getTime()
1549
+ const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24))
1550
+ isBeyondMaxRange = Math.abs(diffDays) > maxRangeDays
1551
+ }
1552
+
1512
1553
  const isDisabled = Boolean(
1513
1554
  (disableFutureDates && date > today) ||
1514
1555
  (disablePastDates && date < today) ||
1515
- (customDisableDates && customDisableDates(date))
1556
+ (minDate && startOfDay(date) < startOfDay(minDate)) ||
1557
+ (maxDate && startOfDay(date) > startOfDay(maxDate)) ||
1558
+ (customDisableDates && customDisableDates(date, selectedRange)) ||
1559
+ isBeyondMaxRange
1516
1560
  )
1517
1561
 
1518
1562
  if (!selectedRange) {
@@ -2249,9 +2293,12 @@ export const calculateDayCellProps = (
2249
2293
  disableFutureDates: boolean,
2250
2294
  disablePastDates: boolean,
2251
2295
  calendarToken: CalendarTokenType,
2252
- customDisableDates?: (date: Date) => boolean,
2296
+ customDisableDates?: (date: Date, currentRange?: DateRange) => boolean,
2253
2297
  timezone?: string,
2254
- isSingleDatePicker?: boolean
2298
+ isSingleDatePicker?: boolean,
2299
+ minDate?: Date,
2300
+ maxDate?: Date,
2301
+ maxRangeDays?: number
2255
2302
  ): {
2256
2303
  dateStates: ReturnType<typeof getDateCellStates>
2257
2304
  styles: Record<string, unknown>
@@ -2266,7 +2313,10 @@ export const calculateDayCellProps = (
2266
2313
  disablePastDates,
2267
2314
  customDisableDates,
2268
2315
  timezone,
2269
- isSingleDatePicker
2316
+ isSingleDatePicker,
2317
+ minDate,
2318
+ maxDate,
2319
+ maxRangeDays
2270
2320
  )
2271
2321
 
2272
2322
  const getCellStyles = () => {
@@ -3597,7 +3647,11 @@ export const handleCustomRangeCalendarDateClick = (
3597
3647
  isDoubleClick: boolean = false,
3598
3648
  timezone?: string,
3599
3649
  selectedRange?: DateRange,
3600
- isSingleDatePicker?: boolean
3650
+ isSingleDatePicker?: boolean,
3651
+ minDate?: Date,
3652
+ maxDate?: Date,
3653
+ customDisableDates?: (date: Date, currentRange?: DateRange) => boolean,
3654
+ maxRangeDays?: number
3601
3655
  ): DateRange | null => {
3602
3656
  // Validate date is not disabled
3603
3657
  if (
@@ -3607,6 +3661,24 @@ export const handleCustomRangeCalendarDateClick = (
3607
3661
  return null
3608
3662
  }
3609
3663
 
3664
+ // minDate / maxDate hard bounds (day-level comparison)
3665
+ if (minDate && startOfDay(clickedDate) < startOfDay(minDate)) return null
3666
+ if (maxDate && startOfDay(clickedDate) > startOfDay(maxDate)) return null
3667
+ // customDisableDates honoured in the click path
3668
+ if (customDisableDates && customDisableDates(clickedDate, selectedRange))
3669
+ return null
3670
+ // maxRangeDays: block clicks on days beyond start + maxRangeDays
3671
+ if (maxRangeDays && selectedRange?.startDate && !selectedRange.endDate) {
3672
+ const diffDays = Math.abs(
3673
+ Math.floor(
3674
+ (startOfDay(clickedDate).getTime() -
3675
+ startOfDay(selectedRange.startDate).getTime()) /
3676
+ (1000 * 60 * 60 * 24)
3677
+ )
3678
+ )
3679
+ if (diffDays > maxRangeDays) return null
3680
+ }
3681
+
3610
3682
  // If no custom range config, use standard logic
3611
3683
  if (!customRangeConfig) {
3612
3684
  return handleCalendarDateClick(
@@ -3618,7 +3690,11 @@ export const handleCustomRangeCalendarDateClick = (
3618
3690
  isDoubleClick,
3619
3691
  timezone,
3620
3692
  selectedRange,
3621
- isSingleDatePicker
3693
+ isSingleDatePicker,
3694
+ minDate,
3695
+ maxDate,
3696
+ customDisableDates,
3697
+ maxRangeDays
3622
3698
  )
3623
3699
  }
3624
3700
 
@@ -3666,7 +3742,11 @@ export const handleCustomRangeCalendarDateClick = (
3666
3742
  isDoubleClick,
3667
3743
  timezone,
3668
3744
  selectedRange,
3669
- isSingleDatePicker
3745
+ isSingleDatePicker,
3746
+ minDate,
3747
+ maxDate,
3748
+ customDisableDates,
3749
+ maxRangeDays
3670
3750
  )
3671
3751
  }
3672
3752
  endDate = calculatedDate
@@ -3681,7 +3761,11 @@ export const handleCustomRangeCalendarDateClick = (
3681
3761
  isDoubleClick,
3682
3762
  timezone,
3683
3763
  selectedRange,
3684
- isSingleDatePicker
3764
+ isSingleDatePicker,
3765
+ minDate,
3766
+ maxDate,
3767
+ customDisableDates,
3768
+ maxRangeDays
3685
3769
  )
3686
3770
  }
3687
3771
 
@@ -3974,7 +4058,8 @@ export const matchesLastMonthPreset = (range: DateRange): boolean => {
3974
4058
  */
3975
4059
  export const detectPresetFromRange = (
3976
4060
  range: DateRange,
3977
- timezone?: string
4061
+ timezone?: string,
4062
+ presetConfigs?: CustomPresetConfig[]
3978
4063
  ): DateRangePreset => {
3979
4064
  if (!range.startDate || !range.endDate) {
3980
4065
  return DateRangePreset.CUSTOM
@@ -4119,6 +4204,32 @@ export const detectPresetFromRange = (
4119
4204
  return DateRangePreset.NEXT_12_MONTHS
4120
4205
  }
4121
4206
 
4207
+ // Check custom preset definitions (from customPresets prop) before giving up.
4208
+ if (presetConfigs && presetConfigs.length > 0) {
4209
+ const toleranceMs =
4210
+ DATE_RANGE_PICKER_CONSTANTS.PRESET_DETECTION_TOLERANCE_MS
4211
+ for (const config of presetConfigs) {
4212
+ const definition = getCustomPresetDefinition(
4213
+ config.preset as string
4214
+ )
4215
+ if (!definition) continue
4216
+
4217
+ const presetRange = definition.getDateRange()
4218
+ if (
4219
+ presetRange.startDate &&
4220
+ presetRange.endDate &&
4221
+ Math.abs(
4222
+ range.startDate.getTime() - presetRange.startDate.getTime()
4223
+ ) <= toleranceMs &&
4224
+ Math.abs(
4225
+ range.endDate.getTime() - presetRange.endDate.getTime()
4226
+ ) <= toleranceMs
4227
+ ) {
4228
+ return config.preset
4229
+ }
4230
+ }
4231
+ }
4232
+
4122
4233
  return DateRangePreset.CUSTOM
4123
4234
  }
4124
4235
 
@@ -4,6 +4,7 @@ import React from 'react'
4
4
  import { createRef, useEffect, useRef } from 'react'
5
5
  import type { DirectoryProps } from './types'
6
6
  import Section from './Section'
7
+ import VirtualizedDirectory from './VirtualizedDirectory'
7
8
  import Block from '../Primitives/Block/Block'
8
9
  import { handleSectionNavigation, normalizeDirectoryData } from './utils'
9
10
  import { ActiveItemProvider } from './NavItem'
@@ -17,6 +18,14 @@ const Directory = ({
17
18
  onActiveItemChange,
18
19
  defaultActiveItem,
19
20
  iconOnlyMode = false,
21
+ showHierarchyLines = false,
22
+ hierarchyLineBorderRadius = 0,
23
+ expandedItems,
24
+ defaultExpandedItems,
25
+ onExpandedItemsChange,
26
+ onItemExpand,
27
+ enableVirtualization = false,
28
+ virtualization,
20
29
  }: DirectoryProps) => {
21
30
  const directoryData = normalizeDirectoryData(directoryDataProp)
22
31
  const sectionRefs = useRef<Array<React.RefObject<HTMLDivElement | null>>>(
@@ -30,6 +39,26 @@ const Directory = ({
30
39
  )
31
40
  }, [directoryData])
32
41
 
42
+ if (enableVirtualization && !iconOnlyMode) {
43
+ return (
44
+ <VirtualizedDirectory
45
+ directoryData={directoryData}
46
+ idPrefix={idPrefix}
47
+ activeItem={activeItem}
48
+ onActiveItemChange={onActiveItemChange}
49
+ defaultActiveItem={defaultActiveItem}
50
+ showHierarchyLines={showHierarchyLines}
51
+ hierarchyLineBorderRadius={hierarchyLineBorderRadius}
52
+ expandedItems={expandedItems}
53
+ defaultExpandedItems={defaultExpandedItems}
54
+ onExpandedItemsChange={onExpandedItemsChange}
55
+ onItemExpand={onItemExpand}
56
+ enableVirtualization={enableVirtualization}
57
+ virtualization={virtualization}
58
+ />
59
+ )
60
+ }
61
+
33
62
  return (
34
63
  <ActiveItemProvider
35
64
  activeItem={activeItem}
@@ -57,6 +86,8 @@ const Directory = ({
57
86
  sectionIndex={sectionIndex}
58
87
  idPrefix={idPrefix}
59
88
  iconOnlyMode={iconOnlyMode}
89
+ showHierarchyLines={showHierarchyLines}
90
+ hierarchyLineBorderRadius={hierarchyLineBorderRadius}
60
91
  onNavigateBetweenSections={(direction, currentIndex) =>
61
92
  handleSectionNavigation(
62
93
  direction,