se-design 1.0.61-dev → 1.0.62-dev

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 (307) hide show
  1. package/dist/assets/colors.css +22 -9
  2. package/dist/assets/icons/command.svg +1 -1
  3. package/dist/assets/style.css +1 -1
  4. package/dist/components/BreadCrumbs/index.d.ts +2 -0
  5. package/dist/components/Button/index.d.ts +5 -1
  6. package/dist/index.js +23 -21
  7. package/dist/index.js.map +1 -1
  8. package/dist/index100.js +1 -1
  9. package/dist/index100.js.map +1 -1
  10. package/dist/index101.js +1 -1
  11. package/dist/index101.js.map +1 -1
  12. package/dist/index102.js +2 -2
  13. package/dist/index102.js.map +1 -1
  14. package/dist/index103.js +1 -1
  15. package/dist/index103.js.map +1 -1
  16. package/dist/index104.js +2 -2
  17. package/dist/index104.js.map +1 -1
  18. package/dist/index105.js +1 -1
  19. package/dist/index105.js.map +1 -1
  20. package/dist/index106.js +1 -1
  21. package/dist/index106.js.map +1 -1
  22. package/dist/index107.js +1 -1
  23. package/dist/index107.js.map +1 -1
  24. package/dist/index108.js +2 -2
  25. package/dist/index108.js.map +1 -1
  26. package/dist/index109.js +1 -1
  27. package/dist/index109.js.map +1 -1
  28. package/dist/index110.js +2 -2
  29. package/dist/index110.js.map +1 -1
  30. package/dist/index111.js +2 -2
  31. package/dist/index111.js.map +1 -1
  32. package/dist/index112.js +2 -2
  33. package/dist/index112.js.map +1 -1
  34. package/dist/index113.js +2 -2
  35. package/dist/index113.js.map +1 -1
  36. package/dist/index114.js +1 -1
  37. package/dist/index114.js.map +1 -1
  38. package/dist/index115.js +1 -1
  39. package/dist/index115.js.map +1 -1
  40. package/dist/index116.js +1 -1
  41. package/dist/index116.js.map +1 -1
  42. package/dist/index117.js +2 -2
  43. package/dist/index117.js.map +1 -1
  44. package/dist/index118.js +2 -2
  45. package/dist/index118.js.map +1 -1
  46. package/dist/index119.js +2 -2
  47. package/dist/index119.js.map +1 -1
  48. package/dist/index120.js +1 -1
  49. package/dist/index120.js.map +1 -1
  50. package/dist/index121.js +1 -1
  51. package/dist/index121.js.map +1 -1
  52. package/dist/index122.js +1 -1
  53. package/dist/index122.js.map +1 -1
  54. package/dist/index123.js +1 -1
  55. package/dist/index123.js.map +1 -1
  56. package/dist/index124.js +1 -1
  57. package/dist/index124.js.map +1 -1
  58. package/dist/index125.js +1 -1
  59. package/dist/index125.js.map +1 -1
  60. package/dist/index126.js +1 -1
  61. package/dist/index126.js.map +1 -1
  62. package/dist/index127.js +1 -1
  63. package/dist/index127.js.map +1 -1
  64. package/dist/index128.js +2 -2
  65. package/dist/index128.js.map +1 -1
  66. package/dist/index129.js +2 -2
  67. package/dist/index129.js.map +1 -1
  68. package/dist/index130.js +1 -1
  69. package/dist/index130.js.map +1 -1
  70. package/dist/index131.js +1 -1
  71. package/dist/index131.js.map +1 -1
  72. package/dist/index132.js +1 -1
  73. package/dist/index132.js.map +1 -1
  74. package/dist/index133.js +1 -1
  75. package/dist/index133.js.map +1 -1
  76. package/dist/index134.js +1 -1
  77. package/dist/index134.js.map +1 -1
  78. package/dist/index135.js +1 -1
  79. package/dist/index135.js.map +1 -1
  80. package/dist/index136.js +2 -2
  81. package/dist/index136.js.map +1 -1
  82. package/dist/index137.js +1 -1
  83. package/dist/index137.js.map +1 -1
  84. package/dist/index138.js +2 -2
  85. package/dist/index138.js.map +1 -1
  86. package/dist/index139.js +2 -2
  87. package/dist/index139.js.map +1 -1
  88. package/dist/index140.js +2 -2
  89. package/dist/index140.js.map +1 -1
  90. package/dist/index141.js +2 -2
  91. package/dist/index141.js.map +1 -1
  92. package/dist/index142.js +1 -1
  93. package/dist/index142.js.map +1 -1
  94. package/dist/index143.js +1 -1
  95. package/dist/index143.js.map +1 -1
  96. package/dist/index144.js +1 -1
  97. package/dist/index144.js.map +1 -1
  98. package/dist/index145.js +1 -1
  99. package/dist/index145.js.map +1 -1
  100. package/dist/index146.js +1 -1
  101. package/dist/index146.js.map +1 -1
  102. package/dist/index147.js +1 -1
  103. package/dist/index147.js.map +1 -1
  104. package/dist/index148.js +1 -1
  105. package/dist/index148.js.map +1 -1
  106. package/dist/index149.js +1 -1
  107. package/dist/index149.js.map +1 -1
  108. package/dist/index15.js +2 -2
  109. package/dist/index150.js +1 -1
  110. package/dist/index150.js.map +1 -1
  111. package/dist/index151.js +1 -1
  112. package/dist/index151.js.map +1 -1
  113. package/dist/index152.js +1 -1
  114. package/dist/index152.js.map +1 -1
  115. package/dist/index153.js +1 -1
  116. package/dist/index153.js.map +1 -1
  117. package/dist/index154.js +1 -1
  118. package/dist/index154.js.map +1 -1
  119. package/dist/index155.js +1 -1
  120. package/dist/index155.js.map +1 -1
  121. package/dist/index156.js +1 -1
  122. package/dist/index156.js.map +1 -1
  123. package/dist/index157.js +1 -1
  124. package/dist/index157.js.map +1 -1
  125. package/dist/index158.js +1 -1
  126. package/dist/index158.js.map +1 -1
  127. package/dist/index159.js +1 -1
  128. package/dist/index159.js.map +1 -1
  129. package/dist/index160.js +1 -1
  130. package/dist/index160.js.map +1 -1
  131. package/dist/index161.js +1 -1
  132. package/dist/index161.js.map +1 -1
  133. package/dist/index162.js +1 -1
  134. package/dist/index162.js.map +1 -1
  135. package/dist/index163.js +1 -1
  136. package/dist/index163.js.map +1 -1
  137. package/dist/index164.js +1 -1
  138. package/dist/index164.js.map +1 -1
  139. package/dist/index165.js +2 -2
  140. package/dist/index165.js.map +1 -1
  141. package/dist/index166.js +2 -2
  142. package/dist/index166.js.map +1 -1
  143. package/dist/index167.js +1 -1
  144. package/dist/index167.js.map +1 -1
  145. package/dist/index168.js +1 -1
  146. package/dist/index168.js.map +1 -1
  147. package/dist/index169.js +2 -2
  148. package/dist/index169.js.map +1 -1
  149. package/dist/index17.js +1 -1
  150. package/dist/index170.js +2 -2
  151. package/dist/index170.js.map +1 -1
  152. package/dist/index171.js +1 -1
  153. package/dist/index171.js.map +1 -1
  154. package/dist/index172.js +1 -1
  155. package/dist/index172.js.map +1 -1
  156. package/dist/index173.js +1 -1
  157. package/dist/index173.js.map +1 -1
  158. package/dist/index174.js +1 -1
  159. package/dist/index174.js.map +1 -1
  160. package/dist/index175.js +1 -1
  161. package/dist/index175.js.map +1 -1
  162. package/dist/index176.js +1 -1
  163. package/dist/index176.js.map +1 -1
  164. package/dist/index177.js +1 -1
  165. package/dist/index177.js.map +1 -1
  166. package/dist/index178.js +1 -1
  167. package/dist/index178.js.map +1 -1
  168. package/dist/index179.js +2 -2
  169. package/dist/index179.js.map +1 -1
  170. package/dist/index18.js +2 -2
  171. package/dist/index180.js +2 -2
  172. package/dist/index180.js.map +1 -1
  173. package/dist/index181.js +2 -2
  174. package/dist/index181.js.map +1 -1
  175. package/dist/index182.js +2 -149
  176. package/dist/index182.js.map +1 -1
  177. package/dist/index183.js +149 -9
  178. package/dist/index183.js.map +1 -1
  179. package/dist/index184.js +8 -5
  180. package/dist/index184.js.map +1 -1
  181. package/dist/index185.js +5 -4
  182. package/dist/index185.js.map +1 -1
  183. package/dist/index186.js +8 -0
  184. package/dist/index186.js.map +1 -0
  185. package/dist/index189.js +20 -58
  186. package/dist/index189.js.map +1 -1
  187. package/dist/index191.js +1 -1
  188. package/dist/index212.js +1 -1
  189. package/dist/index22.js +3 -3
  190. package/dist/index224.js +1 -1
  191. package/dist/index225.js +1 -1
  192. package/dist/index226.js +9 -21
  193. package/dist/index226.js.map +1 -1
  194. package/dist/index227.js +9 -18
  195. package/dist/index227.js.map +1 -1
  196. package/dist/index228.js +4 -9
  197. package/dist/index228.js.map +1 -1
  198. package/dist/index229.js +170 -10
  199. package/dist/index229.js.map +1 -1
  200. package/dist/index230.js +11 -5
  201. package/dist/index230.js.map +1 -1
  202. package/dist/index231.js +22 -170
  203. package/dist/index231.js.map +1 -1
  204. package/dist/index232.js +19 -11
  205. package/dist/index232.js.map +1 -1
  206. package/dist/index24.js +2 -2
  207. package/dist/index24.js.map +1 -1
  208. package/dist/index27.js +1 -1
  209. package/dist/index29.js +1 -1
  210. package/dist/index3.js +23 -21
  211. package/dist/index3.js.map +1 -1
  212. package/dist/index31.js +10 -11
  213. package/dist/index34.js +1 -1
  214. package/dist/index36.js +35 -38
  215. package/dist/index36.js.map +1 -1
  216. package/dist/index37.js +4 -5
  217. package/dist/index37.js.map +1 -1
  218. package/dist/index38.js +3 -3
  219. package/dist/index41.js +7 -8
  220. package/dist/index42.js +6 -7
  221. package/dist/index43.js +16 -16
  222. package/dist/index43.js.map +1 -1
  223. package/dist/index44.js +2 -2
  224. package/dist/index45.js +2 -2
  225. package/dist/index48.js +1 -1
  226. package/dist/index49.js +48 -30
  227. package/dist/index49.js.map +1 -1
  228. package/dist/index5.js +113 -113
  229. package/dist/index50.js +2 -2
  230. package/dist/index50.js.map +1 -1
  231. package/dist/index54.js +21 -22
  232. package/dist/index56.js +2 -2
  233. package/dist/index56.js.map +1 -1
  234. package/dist/index6.js +2 -3
  235. package/dist/index63.js +1 -1
  236. package/dist/index64.js +2 -3
  237. package/dist/index66.js +19 -17
  238. package/dist/index66.js.map +1 -1
  239. package/dist/index68.js +55 -5
  240. package/dist/index68.js.map +1 -1
  241. package/dist/index69.js +5 -9
  242. package/dist/index69.js.map +1 -1
  243. package/dist/index70.js +12 -0
  244. package/dist/index70.js.map +1 -0
  245. package/dist/index72.js +2 -2
  246. package/dist/index72.js.map +1 -1
  247. package/dist/index73.js +2 -2
  248. package/dist/index73.js.map +1 -1
  249. package/dist/index74.js +2 -2
  250. package/dist/index74.js.map +1 -1
  251. package/dist/index75.js +1 -1
  252. package/dist/index75.js.map +1 -1
  253. package/dist/index76.js +1 -1
  254. package/dist/index76.js.map +1 -1
  255. package/dist/index77.js +1 -1
  256. package/dist/index77.js.map +1 -1
  257. package/dist/index78.js +1 -1
  258. package/dist/index78.js.map +1 -1
  259. package/dist/index79.js +1 -1
  260. package/dist/index79.js.map +1 -1
  261. package/dist/index8.js +5 -5
  262. package/dist/index8.js.map +1 -1
  263. package/dist/index80.js +1 -1
  264. package/dist/index80.js.map +1 -1
  265. package/dist/index81.js +1 -1
  266. package/dist/index81.js.map +1 -1
  267. package/dist/index82.js +1 -1
  268. package/dist/index82.js.map +1 -1
  269. package/dist/index83.js +1 -1
  270. package/dist/index83.js.map +1 -1
  271. package/dist/index84.js +1 -1
  272. package/dist/index84.js.map +1 -1
  273. package/dist/index85.js +1 -1
  274. package/dist/index85.js.map +1 -1
  275. package/dist/index86.js +1 -1
  276. package/dist/index86.js.map +1 -1
  277. package/dist/index87.js +1 -1
  278. package/dist/index87.js.map +1 -1
  279. package/dist/index88.js +1 -1
  280. package/dist/index88.js.map +1 -1
  281. package/dist/index89.js +1 -1
  282. package/dist/index89.js.map +1 -1
  283. package/dist/index90.js +1 -1
  284. package/dist/index90.js.map +1 -1
  285. package/dist/index91.js +1 -1
  286. package/dist/index91.js.map +1 -1
  287. package/dist/index92.js +1 -1
  288. package/dist/index92.js.map +1 -1
  289. package/dist/index93.js +1 -1
  290. package/dist/index93.js.map +1 -1
  291. package/dist/index94.js +1 -1
  292. package/dist/index94.js.map +1 -1
  293. package/dist/index95.js +1 -1
  294. package/dist/index95.js.map +1 -1
  295. package/dist/index96.js +1 -1
  296. package/dist/index96.js.map +1 -1
  297. package/dist/index97.js +2 -2
  298. package/dist/index97.js.map +1 -1
  299. package/dist/index98.js +1 -1
  300. package/dist/index98.js.map +1 -1
  301. package/dist/index99.js +2 -2
  302. package/dist/index99.js.map +1 -1
  303. package/package.json +2 -3
  304. package/dist/index188.js +0 -27
  305. package/dist/index188.js.map +0 -1
  306. package/dist/index71.js +0 -5
  307. package/dist/index71.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index50.js","sources":["../src/components/DatePicker/index.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { Button } from '../Button';\nimport { Icon } from '../Icon';\nimport { Dropdown } from '../Dropdown';\n\nimport './style.scss';\n\nexport interface DateRange {\n startDate: Date | null;\n endDate: Date | null;\n}\n\nexport interface DatePickerProps {\n title?: string;\n isOpen?: boolean;\n initialStartDate?: Date;\n initialEndDate?: Date;\n onApply?: (dateRange: DateRange) => void;\n onClose?: () => void;\n shouldAllowFutureDateSelection?: boolean;\n maxDays?: number;\n disablePastDates?: boolean;\n singleDateSelection?: boolean;\n minYearOption?: number;\n showQuickActions?: boolean;\n className?: string;\n automationId?: string;\n showHeader?: boolean;\n showSingleMonth?: boolean;\n labels?: {\n title?: string;\n clear?: string;\n apply?: string;\n };\n}\n\nconst weekDays = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];\nconst quickActions = ['Today', 'Yesterday', 'This Week', 'Last Week', 'This Month', 'Last Month'];\n\nconst months = [\n { value: 'january', label: 'January' },\n { value: 'february', label: 'February' },\n { value: 'march', label: 'March' },\n { value: 'april', label: 'April' },\n { value: 'may', label: 'May' },\n { value: 'june', label: 'June' },\n { value: 'july', label: 'July' },\n { value: 'august', label: 'August' },\n { value: 'september', label: 'September' },\n { value: 'october', label: 'October' },\n { value: 'november', label: 'November' },\n { value: 'december', label: 'December' }\n];\n\nexport const DatePicker: React.FC<DatePickerProps> = ({\n title = 'Select modified date',\n // isOpen = true,\n showHeader = true,\n initialStartDate,\n initialEndDate,\n onApply = () => {},\n onClose,\n shouldAllowFutureDateSelection = false,\n maxDays,\n disablePastDates = false,\n singleDateSelection = false,\n minYearOption,\n showQuickActions = false,\n showSingleMonth = false,\n className = '',\n automationId = 'datepicker',\n labels = {\n clear: 'Clear',\n apply: 'Apply'\n }\n}) => {\n const getDefaultDateRange = (): DateRange => {\n // If initial start and end dates are provided, use them\n if (initialStartDate && initialEndDate) {\n return {\n startDate: initialStartDate,\n endDate: initialEndDate\n };\n }\n\n // If no initial dates are provided, use today's date\n const endDate = new Date();\n endDate.setHours(23, 59, 59, 999); // End of today\n\n const startDate = new Date();\n startDate.setHours(0, 0, 0, 0); // Start of today\n\n return { startDate, endDate };\n };\n\n const getDefaultMonths = (): [Date, Date] => {\n const today = new Date();\n const lastMonth = new Date();\n\n // Set both to first day of their respective months\n today.setDate(1);\n lastMonth.setDate(1);\n\n if (!showSingleMonth) {\n lastMonth.setMonth(lastMonth.getMonth() - 1);\n }\n\n today.setHours(0, 0, 0, 0);\n lastMonth.setHours(0, 0, 0, 0);\n\n return [lastMonth, today];\n };\n\n const [selectedRange, setSelectedRange] = useState<DateRange>(getDefaultDateRange);\n const [defaultMonths, _] = useState(getDefaultMonths);\n const [leftMonth, setLeftMonth] = useState(() => defaultMonths[0]);\n const [rightMonth, setRightMonth] = useState(() => defaultMonths[1]);\n\n const getDaysInMonth = (year: number, month: number) => {\n return new Date(year, month + 1, 0).getDate();\n };\n\n const getFirstDayOfMonth = (year: number, month: number) => {\n return new Date(year, month, 1).getDay();\n };\n\n const generateCalendarDays = (year: number, month: number) => {\n const daysInMonth = getDaysInMonth(year, month);\n const firstDay = getFirstDayOfMonth(year, month);\n const days = [];\n\n // Add empty cells for days before the first day of the month\n for (let i = 0; i < firstDay; i++) {\n days.push(null);\n }\n\n // Add the days of the month\n for (let day = 1; day <= daysInMonth; day++) {\n const date = new Date(year, month, day);\n date.setHours(0, 0, 0, 0); // Normalize to start of day for consistent comparisons\n days.push(date);\n }\n\n return days;\n };\n\n const isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n };\n\n const isDateInRange = (date: Date) => {\n if (!selectedRange.startDate || !selectedRange.endDate) return false;\n\n const compareDate = new Date(date);\n compareDate.setHours(12, 0, 0, 0); // Noon to avoid any timezone issues\n\n const startDate = new Date(selectedRange.startDate);\n startDate.setHours(0, 0, 0, 0);\n\n const endDate = new Date(selectedRange.endDate);\n endDate.setHours(23, 59, 59, 999);\n\n return compareDate >= startDate && compareDate <= endDate;\n };\n\n const isToday = (date: Date) => {\n const today = new Date();\n return (\n date.getDate() === today.getDate() &&\n date.getMonth() === today.getMonth() &&\n date.getFullYear() === today.getFullYear()\n );\n };\n\n const isDateDisabled = (date: Date | null) => {\n if (!date) return true;\n\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n const dateToCheck = new Date(date);\n dateToCheck.setHours(0, 0, 0, 0);\n\n // If disablePastDates is true, disable dates before today\n if (disablePastDates && dateToCheck < today) {\n return true;\n }\n\n // If maxDays is specified, disable dates after maxDays from today\n if (maxDays !== undefined && maxDays !== null) {\n const maxDate = new Date(today);\n maxDate.setDate(maxDate.getDate() + maxDays);\n maxDate.setHours(0, 0, 0, 0); // Normalize to start of day\n // Disable all dates after maxDays (dates strictly after maxDate should be disabled)\n // Dates up to and including maxDate (today + maxDays) are allowed\n if (dateToCheck > maxDate) {\n return true;\n }\n // If maxDays is set, we're done checking - don't check shouldAllowFutureDateSelection\n return false;\n }\n\n // If shouldAllowFutureDateSelection is false and maxDays is not specified, disable dates after today\n if (!shouldAllowFutureDateSelection) {\n return dateToCheck > today;\n }\n\n return false;\n };\n\n const handleDateClick = (date: Date) => {\n if (isDateDisabled(date)) return;\n\n const clickedDate = new Date(date);\n clickedDate.setHours(12, 0, 0, 0); // Set to noon to avoid timezone issues\n\n // Single date selection mode - immediately apply on click\n if (singleDateSelection) {\n setSelectedRange({ startDate: clickedDate, endDate: clickedDate });\n onApply({ startDate: clickedDate, endDate: clickedDate });\n onClose?.();\n return;\n }\n\n // Range selection mode (original behavior)\n if (!selectedRange.startDate || selectedRange.endDate) {\n // No dates selected yet, or both dates are selected - start new selection\n setSelectedRange({ startDate: clickedDate, endDate: null });\n } else {\n // Only start date is selected, set end date\n const currentStart = new Date(selectedRange.startDate);\n currentStart.setHours(12, 0, 0, 0);\n\n const endDate = clickedDate > currentStart ? clickedDate : currentStart;\n const startDate = clickedDate > currentStart ? currentStart : clickedDate;\n\n setSelectedRange({ startDate, endDate });\n }\n };\n\n const handleMonthNavigation = (date: Date, increment: boolean) => {\n const newDate = new Date(date);\n newDate.setMonth(newDate.getMonth() + (increment ? 1 : -1));\n return newDate;\n };\n\n const ensureDateInCorrectOrder = (leftDate: Date, rightDate: Date): [Date, Date] => {\n if (leftDate.getTime() > rightDate.getTime()) {\n return [rightDate, leftDate];\n }\n return [leftDate, rightDate];\n };\n\n const handleMonthChange = (newDate: Date, isLeftCalendar: boolean) => {\n // For single month view, we only need to set the left month\n if (showSingleMonth) {\n setLeftMonth(newDate);\n return;\n }\n\n // For double month view, we need to ensure the dates are in the correct order\n if (isLeftCalendar) {\n const [newLeft, newRight] = ensureDateInCorrectOrder(newDate, rightMonth);\n setLeftMonth(newLeft);\n if (newRight !== rightMonth) {\n setRightMonth(newRight);\n }\n } else {\n const [newLeft, newRight] = ensureDateInCorrectOrder(leftMonth, newDate);\n if (newLeft !== leftMonth) {\n setLeftMonth(newLeft);\n }\n setRightMonth(newRight);\n }\n };\n\n const isStartDate = (date: Date): boolean => {\n if (!selectedRange?.startDate) return false;\n return isSameDay(date, selectedRange.startDate);\n };\n\n const isEndDate = (date: Date): boolean => {\n if (!selectedRange?.endDate) return false;\n return isSameDay(date, selectedRange?.endDate);\n };\n\n const isSameStartAndEndDate = (date: Date): boolean => {\n if (!selectedRange.startDate || !selectedRange.endDate) return false;\n return isSameDay(selectedRange.startDate, selectedRange.endDate) && isSameDay(date, selectedRange.startDate);\n };\n\n const getYearOptions = (currentYear: number, calendarYear: number) => {\n const startYear = minYearOption || currentYear - 10;\n let endYear = shouldAllowFutureDateSelection ? currentYear + 10 : currentYear;\n\n // If maxDays is specified, calculate the maximum year\n if (maxDays) {\n const today = new Date();\n const maxDate = new Date(today);\n maxDate.setDate(maxDate.getDate() + maxDays);\n const maxYear = maxDate.getFullYear();\n // Use the smaller of the two limits\n endYear = Math.min(endYear, maxYear);\n }\n\n endYear = Math.max(endYear, calendarYear);\n\n const yearCount = endYear - startYear + 1;\n\n return Array.from({ length: yearCount }, (_, i) => ({\n value: startYear + i,\n label: (startYear + i).toString()\n })).filter((year) => {\n if (year.value === calendarYear) {\n return true;\n }\n if (!shouldAllowFutureDateSelection && year.value > currentYear) {\n return false;\n }\n // If maxDays is specified, filter out years beyond maxDate\n if (maxDays) {\n const today = new Date();\n const maxDate = new Date(today);\n maxDate.setDate(maxDate.getDate() + maxDays);\n return year.value <= maxDate.getFullYear();\n }\n return true;\n });\n };\n\n const handleClear = () => {\n const today = new Date();\n const startDate = new Date();\n\n // Set start date to beginning of today\n startDate.setHours(0, 0, 0, 0);\n\n // Set end date to end of today\n today.setHours(23, 59, 59, 999);\n\n const defaultRange = { startDate, endDate: today };\n setSelectedRange(defaultRange);\n };\n\n const getStartOfDay = (date: Date) => {\n const newDate = new Date(date);\n newDate.setHours(0, 0, 0, 0);\n return newDate;\n };\n\n const getEndOfDay = (date: Date) => {\n const newDate = new Date(date);\n newDate.setHours(23, 59, 59, 999);\n return newDate;\n };\n\n const handleQuickAction = (action: string) => {\n const today = new Date();\n let startDate = new Date();\n let endDate = new Date();\n\n switch (action) {\n case 'Today':\n startDate = getStartOfDay(today);\n endDate = getEndOfDay(today);\n break;\n case 'Yesterday':\n startDate = getStartOfDay(new Date(today.setDate(today.getDate() - 1)));\n endDate = getEndOfDay(new Date(today));\n break;\n case 'This Week':\n const firstDayOfWeek = new Date(today.setDate(today.getDate() - today.getDay()));\n startDate = getStartOfDay(firstDayOfWeek);\n endDate = getEndOfDay(new Date());\n break;\n case 'Last Week':\n const lastWeekStart = new Date(today.setDate(today.getDate() - today.getDay() - 7));\n const lastWeekEnd = new Date(today.setDate(lastWeekStart.getDate() + 6));\n startDate = getStartOfDay(lastWeekStart);\n endDate = getEndOfDay(lastWeekEnd);\n break;\n case 'This Month':\n startDate = getStartOfDay(new Date(today.getFullYear(), today.getMonth(), 1));\n endDate = getEndOfDay(new Date());\n break;\n case 'Last Month':\n startDate = getStartOfDay(new Date(today.getFullYear(), today.getMonth() - 1, 1));\n endDate = getEndOfDay(new Date(today.getFullYear(), today.getMonth(), 0));\n break;\n }\n\n setSelectedRange({ startDate, endDate });\n };\n\n const renderQuickActions = () => {\n return (\n <div className=\"w-[147px] p-4 border-r border-[var(--color-gray-200)]\">\n <div className=\"flex flex-col gap-3\">\n {quickActions.map((action) => (\n <Button key={action} label={action} type=\"link\" onClick={() => handleQuickAction(action)} />\n ))}\n </div>\n </div>\n );\n };\n\n const handleApply = () => {\n const { startDate = null, endDate = null } = selectedRange;\n\n if (startDate && endDate) {\n onApply({ startDate, endDate });\n return;\n }\n\n if (startDate || endDate) {\n const selectedDate = startDate || endDate;\n onApply({ startDate: selectedDate, endDate: selectedDate });\n }\n };\n\n const renderCalendar = (date: Date) => {\n const year = date.getFullYear();\n const month = date.getMonth();\n const days = generateCalendarDays(year, month);\n const currentYear = new Date().getFullYear();\n const isLeftCalendar = date.getTime() === leftMonth.getTime();\n const yearOptions = getYearOptions(currentYear, year);\n\n return (\n <div className=\"se-design-calendar-container w-fit p-4\">\n <div className=\"flex justify-between items-center\">\n <Icon\n name=\"chevron\"\n rotation=\"90\"\n size={16}\n onClick={() => {\n const newDate = handleMonthNavigation(date, false);\n // Check if navigating back would go before today when disablePastDates is true\n if (disablePastDates) {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n if (newDate < today && newDate.getMonth() !== today.getMonth()) {\n return; // Don't navigate to past months\n }\n }\n handleMonthChange(newDate, isLeftCalendar);\n }}\n className={`datepicker-navigation-icon ${\n disablePastDates &&\n date.getMonth() === new Date().getMonth() &&\n date.getFullYear() === new Date().getFullYear()\n ? 'disabled'\n : ''\n }`}\n automationId={`${automationId}-previous-month`}\n />\n\n <div className=\"flex gap-2\" onClick={(e) => e.stopPropagation()}>\n <Dropdown\n type=\"select\"\n dropDownOptions={months}\n defaultSelectedValue={months[month]}\n selectBy=\"label\"\n optionsUniqueBy=\"value\"\n displaySelected={true}\n onOptionClick={(selectedOption) => {\n const newDate = new Date(date);\n newDate.setMonth(months.findIndex((m) => m.value === selectedOption.value));\n handleMonthChange(newDate, isLeftCalendar);\n }}\n className=\"w-[124px] dropdown-option-container\"\n />\n <Dropdown\n type=\"select\"\n dropDownOptions={yearOptions}\n defaultSelectedValue={yearOptions.find((y) => y.value === year)}\n selectBy=\"label\"\n optionsUniqueBy=\"value\"\n displaySelected={true}\n onOptionClick={(selectedOption) => {\n const newDate = new Date(date);\n newDate.setFullYear(selectedOption.value);\n handleMonthChange(newDate, isLeftCalendar);\n }}\n className=\"w-[104px] dropdown-option-container\"\n />\n </div>\n\n <Icon\n name=\"chevron\"\n rotation=\"270\"\n size={16}\n className={`datepicker-navigation-icon ${\n (!shouldAllowFutureDateSelection &&\n month === new Date().getMonth() &&\n year === new Date().getFullYear()) ||\n (maxDays !== undefined &&\n (() => {\n const today = new Date();\n const maxDate = new Date(today);\n maxDate.setDate(maxDate.getDate() + maxDays);\n return date.getMonth() === maxDate.getMonth() && date.getFullYear() === maxDate.getFullYear();\n })())\n ? 'disabled'\n : ''\n }`}\n onClick={() => {\n const newDate = handleMonthNavigation(date, true);\n // Check if the new date would exceed maxDays\n if (maxDays !== undefined) {\n const today = new Date();\n const maxDate = new Date(today);\n maxDate.setDate(maxDate.getDate() + maxDays);\n if (newDate > maxDate) {\n return;\n }\n }\n handleMonthChange(newDate, isLeftCalendar);\n }}\n automationId={`${automationId}-next-month`}\n />\n </div>\n <div className=\"grid grid-cols-7 gap-2 mt-3\">\n {weekDays.map((day, index) => (\n <div key={`${day}-${index}`} className=\"datepicker-weekdays\">\n {day}\n </div>\n ))}\n {days.map((date, index) => {\n const isStart = date && isStartDate(date);\n const isEnd = date && isEndDate(date);\n const isSameStartEnd = date && isSameStartAndEndDate(date);\n const inRange = date && !isStart && !isEnd && isDateInRange(date);\n const todayDate = date && isToday(date);\n const disabled = isDateDisabled(date);\n const dateValue = date?.getDate();\n\n return (\n <div\n key={`${date}-${index}`}\n onClick={() => !disabled && date && handleDateClick(date)}\n className={`\n relative h-10 w-10 flex items-center justify-center transition-colors rounded-md\n ${\n disabled ? 'cursor-not-allowed text-[var(--color-gray-600)] hover:bg-transparent' : 'cursor-pointer'\n }\n ${\n isSameStartEnd\n ? 'bg-[var(--color-blue-500)] text-[var(--color-white)] hover:bg-[var(--color-blue-600)]'\n : ''\n }\n ${\n !isSameStartEnd && isStart\n ? 'bg-[var(--color-blue-500)] text-[var(--color-white)] hover:bg-[var(--color-blue-600)]'\n : ''\n }\n ${\n !isSameStartEnd && isEnd\n ? 'bg-[var(--color-blue-500)] text-[var(--color-white)] hover:bg-[var(--color-blue-600)]'\n : ''\n }\n ${!isStart && !isEnd && inRange ? 'bg-[var(--color-blue-100)] text-[var(--color-blue-600)]' : ''}\n ${!isStart && !isEnd && !inRange && !disabled ? 'hover:bg-[var(--color-blue-100)]' : ''}\n ${todayDate && !isStart && !isEnd ? 'text-[var(--color-blue-500)]' : ''}\n ${!disabled && !isStart && !isEnd && !todayDate ? 'text-[var(--color-gray-700)]' : ''}\n `}\n data-automation-id={`${automationId}-date-${dateValue}`}\n >\n {date ? (\n <>\n {dateValue}\n {!isSameStartEnd && (isStart || isEnd) && (\n <div\n className={`absolute top-0 bottom-0 ${isStart ? 'right-[-8px]' : 'left-[-8px]'} w-[8px]\n bg-[var(--color-blue-100)] -z-10`}\n />\n )}\n </>\n ) : (\n ''\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n };\n\n return (\n <div\n className={`se-design-datepicker-container flex flex-col bg-[var(--color-white)] rounded-md shadow-md w-max ${className}`}\n >\n {showHeader && (\n <div className=\"se-design-datepicker-header flex justify-between items-center border-b border-[var(--color-gray-200)] p-4\">\n <h2 className=\"datepicker-title\">{title}</h2>\n {onClose && (\n <Icon\n name=\"close\"\n size={16}\n onClick={onClose}\n className=\"cursor-pointer\"\n automationId={`${automationId}-close`}\n />\n )}\n </div>\n )}\n <div className=\"se-design-datepicker-content flex\">\n {showQuickActions && renderQuickActions()}\n <div className=\"flex\">\n {showSingleMonth ? (\n renderCalendar(leftMonth)\n ) : (\n <>\n {renderCalendar(leftMonth)}\n <div className=\"h-full w-[1px] border-r border-[var(--color-gray-200)]\"></div>\n {renderCalendar(rightMonth)}\n </>\n )}\n </div>\n </div>\n {!singleDateSelection && (\n <div className=\"se-design-datepicker-footer flex justify-end items-center gap-5 p-4 border-t border-[var(--color-gray-200)]\">\n <Button\n label={labels?.clear || 'Clear'}\n type=\"link\"\n onClick={handleClear}\n data-automation-id={`${automationId}-clear-button`}\n />\n <Button\n label={labels?.apply || 'Apply'}\n type=\"primary\"\n onClick={handleApply}\n data-automation-id={`${automationId}-apply-button`}\n />\n </div>\n )}\n </div>\n );\n};\n"],"names":["React__default","useState","Button","Icon","Dropdown","weekDays","quickActions","months","value","label","DatePicker","title","showHeader","initialStartDate","initialEndDate","onApply","onClose","shouldAllowFutureDateSelection","maxDays","disablePastDates","singleDateSelection","minYearOption","showQuickActions","showSingleMonth","className","automationId","labels","clear","apply","getDefaultDateRange","startDate","endDate","Date","setHours","getDefaultMonths","today","lastMonth","setDate","setMonth","getMonth","selectedRange","setSelectedRange","defaultMonths","leftMonth","setLeftMonth","rightMonth","setRightMonth","getDaysInMonth","year","month","getDate","getFirstDayOfMonth","getDay","generateCalendarDays","daysInMonth","firstDay","days","i","push","day","date","isSameDay","date1","date2","getFullYear","isDateInRange","compareDate","isToday","isDateDisabled","dateToCheck","maxDate","handleDateClick","clickedDate","currentStart","handleMonthNavigation","increment","newDate","ensureDateInCorrectOrder","leftDate","rightDate","getTime","handleMonthChange","isLeftCalendar","newLeft","newRight","isStartDate","isEndDate","isSameStartAndEndDate","getYearOptions","currentYear","calendarYear","startYear","endYear","maxYear","Math","min","max","yearCount","Array","from","length","_","toString","filter","handleClear","getStartOfDay","getEndOfDay","handleQuickAction","action","firstDayOfWeek","lastWeekStart","lastWeekEnd","renderQuickActions","React","createElement","map","key","type","onClick","handleApply","selectedDate","renderCalendar","yearOptions","name","rotation","size","e","stopPropagation","dropDownOptions","defaultSelectedValue","selectBy","optionsUniqueBy","displaySelected","onOptionClick","selectedOption","findIndex","m","find","y","setFullYear","undefined","index","isStart","isEnd","isSameStartEnd","inRange","todayDate","disabled","dateValue","Fragment"],"mappings":"AAqCA,OAAAA,KAAA,YAAAC,SAAA;AAAA,SAAA,UAAAC,S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iG,EAAe5E,CAAU,CAC1B,CAED,CACF,GACJ,CAACzB,KACA6F,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAK1F,WAAU;AAAA,EAAA,GACbyF,gBAAAA,EAAAC,cAAChH,GAAM;AAAA,IACLO,OAAOiB,GAAQC,SAAS;AAAA,IACxB0F,MAAK;AAAA,IACLC,SAASd;AAAAA,IACT,sBAAoB,GAAG/E,CAAY;AAAA,EAAA,CACpC,GACDwF,gBAAAA,EAAAC,cAAChH,GAAM;AAAA,IACLO,OAAOiB,GAAQE,SAAS;AAAA,IACxByF,MAAK;AAAA,IACLC,SAASC;AAAAA,IACT,sBAAoB,GAAG9F,CAAY;AAAA,EAAA,CACpC,CACE,CAEJ;AAET;"}
1
+ {"version":3,"file":"index50.js","sources":["../src/components/DatePicker/index.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { Button } from '../Button';\nimport { Icon } from '../Icon';\nimport { Dropdown } from '../Dropdown';\n\nimport './style.scss';\n\nexport interface DateRange {\n startDate: Date | null;\n endDate: Date | null;\n}\n\nexport interface DatePickerProps {\n title?: string;\n isOpen?: boolean;\n initialStartDate?: Date;\n initialEndDate?: Date;\n onApply?: (dateRange: DateRange) => void;\n onClose?: () => void;\n shouldAllowFutureDateSelection?: boolean;\n maxDays?: number;\n disablePastDates?: boolean;\n singleDateSelection?: boolean;\n minYearOption?: number;\n showQuickActions?: boolean;\n className?: string;\n automationId?: string;\n showHeader?: boolean;\n showSingleMonth?: boolean;\n labels?: {\n title?: string;\n clear?: string;\n apply?: string;\n };\n}\n\nconst weekDays = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];\nconst quickActions = ['Today', 'Yesterday', 'This Week', 'Last Week', 'This Month', 'Last Month'];\n\nconst months = [\n { value: 'january', label: 'January' },\n { value: 'february', label: 'February' },\n { value: 'march', label: 'March' },\n { value: 'april', label: 'April' },\n { value: 'may', label: 'May' },\n { value: 'june', label: 'June' },\n { value: 'july', label: 'July' },\n { value: 'august', label: 'August' },\n { value: 'september', label: 'September' },\n { value: 'october', label: 'October' },\n { value: 'november', label: 'November' },\n { value: 'december', label: 'December' }\n];\n\nexport const DatePicker: React.FC<DatePickerProps> = ({\n title = 'Select modified date',\n // isOpen = true,\n showHeader = true,\n initialStartDate,\n initialEndDate,\n onApply = () => {},\n onClose,\n shouldAllowFutureDateSelection = false,\n maxDays,\n disablePastDates = false,\n singleDateSelection = false,\n minYearOption,\n showQuickActions = false,\n showSingleMonth = false,\n className = '',\n automationId = 'datepicker',\n labels = {\n clear: 'Clear',\n apply: 'Apply'\n }\n}) => {\n const getDefaultDateRange = (): DateRange => {\n // If initial start and end dates are provided, use them\n if (initialStartDate && initialEndDate) {\n return {\n startDate: initialStartDate,\n endDate: initialEndDate\n };\n }\n\n // If no initial dates are provided, use today's date\n const endDate = new Date();\n endDate.setHours(23, 59, 59, 999); // End of today\n\n const startDate = new Date();\n startDate.setHours(0, 0, 0, 0); // Start of today\n\n return { startDate, endDate };\n };\n\n const getDefaultMonths = (): [Date, Date] => {\n const today = new Date();\n const lastMonth = new Date();\n\n // Set both to first day of their respective months\n today.setDate(1);\n lastMonth.setDate(1);\n\n if (!showSingleMonth) {\n lastMonth.setMonth(lastMonth.getMonth() - 1);\n }\n\n today.setHours(0, 0, 0, 0);\n lastMonth.setHours(0, 0, 0, 0);\n\n return [lastMonth, today];\n };\n\n const [selectedRange, setSelectedRange] = useState<DateRange>(getDefaultDateRange);\n const [defaultMonths, _] = useState(getDefaultMonths);\n const [leftMonth, setLeftMonth] = useState(() => defaultMonths[0]);\n const [rightMonth, setRightMonth] = useState(() => defaultMonths[1]);\n\n const getDaysInMonth = (year: number, month: number) => {\n return new Date(year, month + 1, 0).getDate();\n };\n\n const getFirstDayOfMonth = (year: number, month: number) => {\n return new Date(year, month, 1).getDay();\n };\n\n const generateCalendarDays = (year: number, month: number) => {\n const daysInMonth = getDaysInMonth(year, month);\n const firstDay = getFirstDayOfMonth(year, month);\n const days = [];\n\n // Add empty cells for days before the first day of the month\n for (let i = 0; i < firstDay; i++) {\n days.push(null);\n }\n\n // Add the days of the month\n for (let day = 1; day <= daysInMonth; day++) {\n const date = new Date(year, month, day);\n date.setHours(0, 0, 0, 0); // Normalize to start of day for consistent comparisons\n days.push(date);\n }\n\n return days;\n };\n\n const isSameDay = (date1: Date, date2: Date): boolean => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n };\n\n const isDateInRange = (date: Date) => {\n if (!selectedRange.startDate || !selectedRange.endDate) return false;\n\n const compareDate = new Date(date);\n compareDate.setHours(12, 0, 0, 0); // Noon to avoid any timezone issues\n\n const startDate = new Date(selectedRange.startDate);\n startDate.setHours(0, 0, 0, 0);\n\n const endDate = new Date(selectedRange.endDate);\n endDate.setHours(23, 59, 59, 999);\n\n return compareDate >= startDate && compareDate <= endDate;\n };\n\n const isToday = (date: Date) => {\n const today = new Date();\n return (\n date.getDate() === today.getDate() &&\n date.getMonth() === today.getMonth() &&\n date.getFullYear() === today.getFullYear()\n );\n };\n\n const isDateDisabled = (date: Date | null) => {\n if (!date) return true;\n\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n const dateToCheck = new Date(date);\n dateToCheck.setHours(0, 0, 0, 0);\n\n // If disablePastDates is true, disable dates before today\n if (disablePastDates && dateToCheck < today) {\n return true;\n }\n\n // If maxDays is specified, disable dates after maxDays from today\n if (maxDays !== undefined && maxDays !== null) {\n const maxDate = new Date(today);\n maxDate.setDate(maxDate.getDate() + maxDays);\n maxDate.setHours(0, 0, 0, 0); // Normalize to start of day\n // Disable all dates after maxDays (dates strictly after maxDate should be disabled)\n // Dates up to and including maxDate (today + maxDays) are allowed\n if (dateToCheck > maxDate) {\n return true;\n }\n // If maxDays is set, we're done checking - don't check shouldAllowFutureDateSelection\n return false;\n }\n\n // If shouldAllowFutureDateSelection is false and maxDays is not specified, disable dates after today\n if (!shouldAllowFutureDateSelection) {\n return dateToCheck > today;\n }\n\n return false;\n };\n\n const handleDateClick = (date: Date) => {\n if (isDateDisabled(date)) return;\n\n const clickedDate = new Date(date);\n clickedDate.setHours(12, 0, 0, 0); // Set to noon to avoid timezone issues\n\n // Single date selection mode - immediately apply on click\n if (singleDateSelection) {\n setSelectedRange({ startDate: clickedDate, endDate: clickedDate });\n onApply({ startDate: clickedDate, endDate: clickedDate });\n onClose?.();\n return;\n }\n\n // Range selection mode (original behavior)\n if (!selectedRange.startDate || selectedRange.endDate) {\n // No dates selected yet, or both dates are selected - start new selection\n setSelectedRange({ startDate: clickedDate, endDate: null });\n } else {\n // Only start date is selected, set end date\n const currentStart = new Date(selectedRange.startDate);\n currentStart.setHours(12, 0, 0, 0);\n\n const endDate = clickedDate > currentStart ? clickedDate : currentStart;\n const startDate = clickedDate > currentStart ? currentStart : clickedDate;\n\n setSelectedRange({ startDate, endDate });\n }\n };\n\n const handleMonthNavigation = (date: Date, increment: boolean) => {\n const newDate = new Date(date);\n newDate.setMonth(newDate.getMonth() + (increment ? 1 : -1));\n return newDate;\n };\n\n const ensureDateInCorrectOrder = (leftDate: Date, rightDate: Date): [Date, Date] => {\n if (leftDate.getTime() > rightDate.getTime()) {\n return [rightDate, leftDate];\n }\n return [leftDate, rightDate];\n };\n\n const handleMonthChange = (newDate: Date, isLeftCalendar: boolean) => {\n // For single month view, we only need to set the left month\n if (showSingleMonth) {\n setLeftMonth(newDate);\n return;\n }\n\n // For double month view, we need to ensure the dates are in the correct order\n if (isLeftCalendar) {\n const [newLeft, newRight] = ensureDateInCorrectOrder(newDate, rightMonth);\n setLeftMonth(newLeft);\n if (newRight !== rightMonth) {\n setRightMonth(newRight);\n }\n } else {\n const [newLeft, newRight] = ensureDateInCorrectOrder(leftMonth, newDate);\n if (newLeft !== leftMonth) {\n setLeftMonth(newLeft);\n }\n setRightMonth(newRight);\n }\n };\n\n const isStartDate = (date: Date): boolean => {\n if (!selectedRange?.startDate) return false;\n return isSameDay(date, selectedRange.startDate);\n };\n\n const isEndDate = (date: Date): boolean => {\n if (!selectedRange?.endDate) return false;\n return isSameDay(date, selectedRange?.endDate);\n };\n\n const isSameStartAndEndDate = (date: Date): boolean => {\n if (!selectedRange.startDate || !selectedRange.endDate) return false;\n return isSameDay(selectedRange.startDate, selectedRange.endDate) && isSameDay(date, selectedRange.startDate);\n };\n\n const getYearOptions = (currentYear: number, calendarYear: number) => {\n const startYear = minYearOption || currentYear - 10;\n let endYear = shouldAllowFutureDateSelection ? currentYear + 10 : currentYear;\n\n // If maxDays is specified, calculate the maximum year\n if (maxDays) {\n const today = new Date();\n const maxDate = new Date(today);\n maxDate.setDate(maxDate.getDate() + maxDays);\n const maxYear = maxDate.getFullYear();\n // Use the smaller of the two limits\n endYear = Math.min(endYear, maxYear);\n }\n\n endYear = Math.max(endYear, calendarYear);\n\n const yearCount = endYear - startYear + 1;\n\n return Array.from({ length: yearCount }, (_, i) => ({\n value: startYear + i,\n label: (startYear + i).toString()\n })).filter((year) => {\n if (year.value === calendarYear) {\n return true;\n }\n if (!shouldAllowFutureDateSelection && year.value > currentYear) {\n return false;\n }\n // If maxDays is specified, filter out years beyond maxDate\n if (maxDays) {\n const today = new Date();\n const maxDate = new Date(today);\n maxDate.setDate(maxDate.getDate() + maxDays);\n return year.value <= maxDate.getFullYear();\n }\n return true;\n });\n };\n\n const handleClear = () => {\n const today = new Date();\n const startDate = new Date();\n\n // Set start date to beginning of today\n startDate.setHours(0, 0, 0, 0);\n\n // Set end date to end of today\n today.setHours(23, 59, 59, 999);\n\n const defaultRange = { startDate, endDate: today };\n setSelectedRange(defaultRange);\n };\n\n const getStartOfDay = (date: Date) => {\n const newDate = new Date(date);\n newDate.setHours(0, 0, 0, 0);\n return newDate;\n };\n\n const getEndOfDay = (date: Date) => {\n const newDate = new Date(date);\n newDate.setHours(23, 59, 59, 999);\n return newDate;\n };\n\n const handleQuickAction = (action: string) => {\n const today = new Date();\n let startDate = new Date();\n let endDate = new Date();\n\n switch (action) {\n case 'Today':\n startDate = getStartOfDay(today);\n endDate = getEndOfDay(today);\n break;\n case 'Yesterday':\n startDate = getStartOfDay(new Date(today.setDate(today.getDate() - 1)));\n endDate = getEndOfDay(new Date(today));\n break;\n case 'This Week':\n const firstDayOfWeek = new Date(today.setDate(today.getDate() - today.getDay()));\n startDate = getStartOfDay(firstDayOfWeek);\n endDate = getEndOfDay(new Date());\n break;\n case 'Last Week':\n const lastWeekStart = new Date(today.setDate(today.getDate() - today.getDay() - 7));\n const lastWeekEnd = new Date(today.setDate(lastWeekStart.getDate() + 6));\n startDate = getStartOfDay(lastWeekStart);\n endDate = getEndOfDay(lastWeekEnd);\n break;\n case 'This Month':\n startDate = getStartOfDay(new Date(today.getFullYear(), today.getMonth(), 1));\n endDate = getEndOfDay(new Date());\n break;\n case 'Last Month':\n startDate = getStartOfDay(new Date(today.getFullYear(), today.getMonth() - 1, 1));\n endDate = getEndOfDay(new Date(today.getFullYear(), today.getMonth(), 0));\n break;\n }\n\n setSelectedRange({ startDate, endDate });\n };\n\n const renderQuickActions = () => {\n return (\n <div className=\"w-[147px] p-4 border-r border-[var(--color-gray-200)]\">\n <div className=\"flex flex-col gap-3\">\n {quickActions.map((action) => (\n <Button key={action} label={action} type=\"link\" onClick={() => handleQuickAction(action)} />\n ))}\n </div>\n </div>\n );\n };\n\n const handleApply = () => {\n const { startDate = null, endDate = null } = selectedRange;\n\n if (startDate && endDate) {\n onApply({ startDate, endDate });\n return;\n }\n\n if (startDate || endDate) {\n const selectedDate = startDate || endDate;\n onApply({ startDate: selectedDate, endDate: selectedDate });\n }\n };\n\n const renderCalendar = (date: Date) => {\n const year = date.getFullYear();\n const month = date.getMonth();\n const days = generateCalendarDays(year, month);\n const currentYear = new Date().getFullYear();\n const isLeftCalendar = date.getTime() === leftMonth.getTime();\n const yearOptions = getYearOptions(currentYear, year);\n\n return (\n <div className=\"se-design-calendar-container w-fit p-4\">\n <div className=\"flex justify-between items-center\">\n <Icon\n name=\"chevron\"\n rotation=\"90\"\n size={16}\n onClick={() => {\n const newDate = handleMonthNavigation(date, false);\n // Check if navigating back would go before today when disablePastDates is true\n if (disablePastDates) {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n if (newDate < today && newDate.getMonth() !== today.getMonth()) {\n return; // Don't navigate to past months\n }\n }\n handleMonthChange(newDate, isLeftCalendar);\n }}\n className={`datepicker-navigation-icon ${\n disablePastDates &&\n date.getMonth() === new Date().getMonth() &&\n date.getFullYear() === new Date().getFullYear()\n ? 'disabled'\n : ''\n }`}\n automationId={`${automationId}-previous-month`}\n />\n\n <div className=\"flex gap-2\" onClick={(e) => e.stopPropagation()}>\n <Dropdown\n type=\"select\"\n dropDownOptions={months}\n defaultSelectedValue={months[month]}\n selectBy=\"label\"\n optionsUniqueBy=\"value\"\n displaySelected={true}\n onOptionClick={(selectedOption) => {\n const newDate = new Date(date);\n newDate.setMonth(months.findIndex((m) => m.value === selectedOption.value));\n handleMonthChange(newDate, isLeftCalendar);\n }}\n className=\"w-[124px] dropdown-option-container\"\n />\n <Dropdown\n type=\"select\"\n dropDownOptions={yearOptions}\n defaultSelectedValue={yearOptions.find((y) => y.value === year)}\n selectBy=\"label\"\n optionsUniqueBy=\"value\"\n displaySelected={true}\n onOptionClick={(selectedOption) => {\n const newDate = new Date(date);\n newDate.setFullYear(selectedOption.value);\n handleMonthChange(newDate, isLeftCalendar);\n }}\n className=\"w-[104px] dropdown-option-container\"\n />\n </div>\n\n <Icon\n name=\"chevron\"\n rotation=\"270\"\n size={16}\n className={`datepicker-navigation-icon ${\n (!shouldAllowFutureDateSelection &&\n month === new Date().getMonth() &&\n year === new Date().getFullYear()) ||\n (maxDays !== undefined &&\n (() => {\n const today = new Date();\n const maxDate = new Date(today);\n maxDate.setDate(maxDate.getDate() + maxDays);\n return date.getMonth() === maxDate.getMonth() && date.getFullYear() === maxDate.getFullYear();\n })())\n ? 'disabled'\n : ''\n }`}\n onClick={() => {\n const newDate = handleMonthNavigation(date, true);\n // Check if the new date would exceed maxDays\n if (maxDays !== undefined) {\n const today = new Date();\n const maxDate = new Date(today);\n maxDate.setDate(maxDate.getDate() + maxDays);\n if (newDate > maxDate) {\n return;\n }\n }\n handleMonthChange(newDate, isLeftCalendar);\n }}\n automationId={`${automationId}-next-month`}\n />\n </div>\n <div className=\"grid grid-cols-7 gap-2 mt-3\">\n {weekDays.map((day, index) => (\n <div key={`${day}-${index}`} className=\"datepicker-weekdays\">\n {day}\n </div>\n ))}\n {days.map((date, index) => {\n const isStart = date && isStartDate(date);\n const isEnd = date && isEndDate(date);\n const isSameStartEnd = date && isSameStartAndEndDate(date);\n const inRange = date && !isStart && !isEnd && isDateInRange(date);\n const todayDate = date && isToday(date);\n const disabled = isDateDisabled(date);\n const dateValue = date?.getDate();\n\n return (\n <div\n key={`${date}-${index}`}\n onClick={() => !disabled && date && handleDateClick(date)}\n className={`\n relative h-10 w-10 flex items-center justify-center transition-colors rounded-md\n ${\n disabled ? 'cursor-not-allowed text-[var(--color-gray-600)] hover:bg-transparent' : 'cursor-pointer'\n }\n ${\n isSameStartEnd\n ? 'bg-[var(--color-blue-500)] text-[var(--color-white)] hover:bg-[var(--color-blue-600)]'\n : ''\n }\n ${\n !isSameStartEnd && isStart\n ? 'bg-[var(--color-blue-500)] text-[var(--color-white)] hover:bg-[var(--color-blue-600)]'\n : ''\n }\n ${\n !isSameStartEnd && isEnd\n ? 'bg-[var(--color-blue-500)] text-[var(--color-white)] hover:bg-[var(--color-blue-600)]'\n : ''\n }\n ${!isStart && !isEnd && inRange ? 'bg-[var(--color-blue-100)] text-[var(--color-blue-600)]' : ''}\n ${!isStart && !isEnd && !inRange && !disabled ? 'hover:bg-[var(--color-blue-100)]' : ''}\n ${todayDate && !isStart && !isEnd ? 'text-[var(--color-blue-500)] bg-[var(--color-blue-100)]' : ''}\n ${!disabled && !isStart && !isEnd && !todayDate ? 'text-[var(--color-gray-700)]' : ''}\n `}\n data-automation-id={`${automationId}-date-${dateValue}`}\n >\n {date ? (\n <>\n {dateValue}\n {!isSameStartEnd && (isStart || isEnd) && (\n <div\n className={`absolute top-0 bottom-0 ${isStart ? 'right-[-8px]' : 'left-[-8px]'} w-[8px]\n bg-[var(--color-blue-100)] -z-10`}\n />\n )}\n </>\n ) : (\n ''\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n };\n\n return (\n <div\n className={`se-design-datepicker-container flex flex-col bg-[var(--color-white)] rounded-md shadow-md w-max ${className}`}\n >\n {showHeader && (\n <div className=\"se-design-datepicker-header flex justify-between items-center border-b border-[var(--color-gray-200)] p-4\">\n <h2 className=\"datepicker-title\">{title}</h2>\n {onClose && (\n <Icon\n name=\"close\"\n size={16}\n onClick={onClose}\n className=\"cursor-pointer\"\n automationId={`${automationId}-close`}\n />\n )}\n </div>\n )}\n <div className=\"se-design-datepicker-content flex\">\n {showQuickActions && renderQuickActions()}\n <div className=\"flex\">\n {showSingleMonth ? (\n renderCalendar(leftMonth)\n ) : (\n <>\n {renderCalendar(leftMonth)}\n <div className=\"h-full w-[1px] border-r border-[var(--color-gray-200)]\"></div>\n {renderCalendar(rightMonth)}\n </>\n )}\n </div>\n </div>\n {!singleDateSelection && (\n <div className=\"se-design-datepicker-footer flex justify-end items-center gap-5 p-4 border-t border-[var(--color-gray-200)]\">\n <Button\n label={labels?.clear || 'Clear'}\n type=\"ghost\"\n onClick={handleClear}\n data-automation-id={`${automationId}-clear-button`}\n />\n <Button\n label={labels?.apply || 'Apply'}\n type=\"primary\"\n onClick={handleApply}\n data-automation-id={`${automationId}-apply-button`}\n />\n </div>\n )}\n </div>\n );\n};\n"],"names":["React__default","useState","Button","Icon","Dropdown","weekDays","quickActions","months","value","label","DatePicker","title","showHeader","initialStartDate","initialEndDate","onApply","onClose","shouldAllowFutureDateSelection","maxDays","disablePastDates","singleDateSelection","minYearOption","showQuickActions","showSingleMonth","className","automationId","labels","clear","apply","getDefaultDateRange","startDate","endDate","Date","setHours","getDefaultMonths","today","lastMonth","setDate","setMonth","getMonth","selectedRange","setSelectedRange","defaultMonths","leftMonth","setLeftMonth","rightMonth","setRightMonth","getDaysInMonth","year","month","getDate","getFirstDayOfMonth","getDay","generateCalendarDays","daysInMonth","firstDay","days","i","push","day","date","isSameDay","date1","date2","getFullYear","isDateInRange","compareDate","isToday","isDateDisabled","dateToCheck","maxDate","handleDateClick","clickedDate","currentStart","handleMonthNavigation","increment","newDate","ensureDateInCorrectOrder","leftDate","rightDate","getTime","handleMonthChange","isLeftCalendar","newLeft","newRight","isStartDate","isEndDate","isSameStartAndEndDate","getYearOptions","currentYear","calendarYear","startYear","endYear","maxYear","Math","min","max","yearCount","Array","from","length","_","toString","filter","handleClear","getStartOfDay","getEndOfDay","handleQuickAction","action","firstDayOfWeek","lastWeekStart","lastWeekEnd","renderQuickActions","React","createElement","map","key","type","onClick","handleApply","selectedDate","renderCalendar","yearOptions","name","rotation","size","e","stopPropagation","dropDownOptions","defaultSelectedValue","selectBy","optionsUniqueBy","displaySelected","onOptionClick","selectedOption","findIndex","m","find","y","setFullYear","undefined","index","isStart","isEnd","isSameStartEnd","inRange","todayDate","disabled","dateValue","Fragment"],"mappings":"AAqCA,OAAAA,KAAA,YAAAC,SAAA;AAAA,SAAA,UAAAC,SAAA;AAAA,SAAA,QAAAC,SAAA;AAAA,SAAA,YAAAC,SAAA;AAAA,OAAA;AAAA,MAAMC,KAAW,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,GAAG,GAC7CC,KAAe,CAAC,SAAS,aAAa,aAAa,aAAa,cAAc,YAAY,GAE1FC,IAAS,CACb;AAAA,EAAEC,OAAO;AAAA,EAAWC,OAAO;AAAU,GACrC;AAAA,EAAED,OAAO;AAAA,EAAYC,OAAO;AAAW,GACvC;AAAA,EAAED,OAAO;AAAA,EAASC,OAAO;AAAQ,GACjC;AAAA,EAAED,OAAO;AAAA,EAASC,OAAO;AAAQ,GACjC;AAAA,EAAED,OAAO;AAAA,EAAOC,OAAO;AAAM,GAC7B;AAAA,EAAED,OAAO;AAAA,EAAQC,OAAO;AAAO,GAC/B;AA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d from "react";
2
2
  /* empty css */
3
3
  const n = ({
4
4
  element: e,
@@ -6,7 +6,7 @@ const n = ({
6
6
  baseColor: r,
7
7
  highlightColor: s
8
8
  }) => {
9
- const d = {
9
+ const t = {
10
10
  width: typeof e.width == "number" ? `${e.width}px` : e.width,
11
11
  height: typeof e.height == "number" ? `${e.height}px` : e.height,
12
12
  borderRadius: e.borderRadius ? typeof e.borderRadius == "number" ? `${e.borderRadius}px` : e.borderRadius : void 0,
@@ -15,12 +15,12 @@ const n = ({
15
15
  "--shimmer-base-color": r,
16
16
  "--shimmer-highlight-color": s
17
17
  }, m = `se-design-shimmer-element se-design-shimmer-${e.type}`;
18
- return /* @__PURE__ */ i.createElement("div", {
18
+ return /* @__PURE__ */ d.createElement("div", {
19
19
  className: m,
20
- style: d
21
- }, e.children && e.children.map((t, p) => /* @__PURE__ */ i.createElement(n, {
20
+ style: t
21
+ }, e.children && e.children.map((i, p) => /* @__PURE__ */ d.createElement(n, {
22
22
  key: p,
23
- element: t,
23
+ element: i,
24
24
  animationDuration: a,
25
25
  baseColor: r,
26
26
  highlightColor: s
@@ -31,18 +31,18 @@ const n = ({
31
31
  baseColor: r,
32
32
  highlightColor: s
33
33
  }) => {
34
- const d = {
34
+ const t = {
35
35
  display: "flex",
36
36
  flexDirection: e.direction || "column",
37
37
  gap: typeof e.gap == "number" ? `${e.gap}px` : e.gap,
38
38
  padding: e.padding,
39
39
  margin: e.margin
40
40
  };
41
- return /* @__PURE__ */ i.createElement("div", {
41
+ return /* @__PURE__ */ d.createElement("div", {
42
42
  className: `se-design-shimmer-container ${e.className || ""}`,
43
- style: d
44
- }, e.children.map((m, t) => /* @__PURE__ */ i.createElement(n, {
45
- key: t,
43
+ style: t
44
+ }, e.children.map((m, i) => /* @__PURE__ */ d.createElement(n, {
45
+ key: i,
46
46
  element: m,
47
47
  animationDuration: a,
48
48
  baseColor: r,
@@ -53,36 +53,35 @@ const n = ({
53
53
  className: a = "",
54
54
  animationDuration: r = 1.5,
55
55
  baseColor: s = "#f0f0f0",
56
- highlightColor: d = "#e0e0e0",
56
+ highlightColor: t = "#e0e0e0",
57
57
  width: m,
58
- height: t
58
+ height: i
59
59
  }) => {
60
60
  const p = {
61
61
  width: m ? typeof m == "number" ? `${m}px` : m : "100%",
62
- height: t ? typeof t == "number" ? `${t}px` : t : "auto",
62
+ height: i ? typeof i == "number" ? `${i}px` : i : "auto",
63
63
  "--shimmer-duration": `${r}s`,
64
64
  "--shimmer-base-color": s,
65
- "--shimmer-highlight-color": d
65
+ "--shimmer-highlight-color": t
66
66
  };
67
- return /* @__PURE__ */ i.createElement("div", {
67
+ return /* @__PURE__ */ d.createElement("div", {
68
68
  className: `se-design-shimmer-loader ${a}`,
69
69
  style: p
70
- }, e.map((c, o) => c.type === "container" ? /* @__PURE__ */ i.createElement(h, {
70
+ }, e.map((c, o) => c.type === "container" ? /* @__PURE__ */ d.createElement(h, {
71
71
  key: o,
72
72
  container: c,
73
73
  animationDuration: r,
74
74
  baseColor: s,
75
- highlightColor: d
76
- }) : /* @__PURE__ */ i.createElement(n, {
75
+ highlightColor: t
76
+ }) : /* @__PURE__ */ d.createElement(n, {
77
77
  key: o,
78
78
  element: c,
79
79
  animationDuration: r,
80
80
  baseColor: s,
81
- highlightColor: d
81
+ highlightColor: t
82
82
  })));
83
83
  };
84
84
  export {
85
- f as ShimmerLoader,
86
- f as default
85
+ f as ShimmerLoader
87
86
  };
88
87
  //# sourceMappingURL=index54.js.map
package/dist/index56.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import p, { useState as A, useRef as O, useEffect as j } from "react";
2
- import { useStableId as W } from "./index184.js";
2
+ import { useStableId as W } from "./index185.js";
3
3
  /* empty css */
4
4
  const M = ({
5
5
  length: n = 6,
@@ -131,7 +131,7 @@ const M = ({
131
131
  outline-none
132
132
  transition-colors
133
133
  disabled:bg-gray-50 disabled:cursor-not-allowed
134
- ${i ? "border-[var(--color-gray-300)] text-gray-400" : I ? "border-[var(--color-red-400)] text-gray-900 focus:border-[var(--color-red-400)] focus:ring-1 focus:ring-[var(--color-red-400)]" : "border-[var(--color-gray-300)] text-gray-900 focus:border-[var(--color-blue-500)] focus:ring-1 focus:ring-[var(--color-blue-500)]"}
134
+ ${i ? "border-[var(--color-gray-300)] text-gray-400" : I ? "border-[var(--color-red-500)] text-gray-900 focus:border-[var(--color-red-500)] focus:ring-1 focus:ring-[var(--color-red-500)]" : "border-[var(--color-gray-600)] text-gray-900 focus:border-[var(--color-blue-500)] focus:ring-1 focus:ring-[var(--color-blue-500)]"}
135
135
  `,
136
136
  style: {
137
137
  gap: "var(--Spacer-6px, 6px)"
@@ -1 +1 @@
1
- {"version":3,"file":"index56.js","sources":["../src/components/OTPInput/index.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect, KeyboardEvent, ChangeEvent, ClipboardEvent, FC } from 'react';\nimport { useStableId } from '../../utils/useStableId';\nimport './style.scss';\n\nexport interface OTPInputProps {\n length?: number;\n onChange?: (value: string) => void;\n onComplete?: (value: string) => void;\n label?: string;\n disabled?: boolean;\n className?: string;\n autoFocus?: boolean;\n error?: boolean;\n errorMessage?: string;\n validateOnBlur?: boolean;\n onValidate?: (value: string) => boolean | string;\n id?: string;\n}\n\nexport const OTPInput: FC<OTPInputProps> = ({\n length = 6,\n onChange,\n onComplete,\n label,\n disabled = false,\n className = '',\n autoFocus = true,\n error = false,\n errorMessage,\n validateOnBlur = false,\n onValidate,\n id\n}) => {\n const [values, setValues] = useState<string[]>(Array(length).fill(''));\n const [internalError, setInternalError] = useState<string | null>(null);\n const inputRefs = useRef<(HTMLInputElement | null)[]>([]);\n const isBackspacePressed = useRef<boolean>(false);\n \n // Generate stable IDs for ARIA attributes\n const baseId = useStableId(id, 'se-otp-input');\n const labelId = `${baseId}-label`;\n const errorId = `${baseId}-error`;\n\n // Helper: Check if a string is a single digit\n const isDigit = (char: string): boolean => /^\\d$/.test(char);\n\n // Helper: Check if OTP is complete\n const isComplete = (otpValue: string): boolean => {\n return otpValue.length === length && values.every((val) => val !== '');\n };\n\n // Helper: Update value at specific index\n const updateValue = (index: number, value: string, shouldFocusNext = false) => {\n const newValues = [...values];\n newValues[index] = value;\n setValues(newValues);\n\n if (shouldFocusNext && value && index < length - 1) {\n focusInput(index + 1);\n }\n };\n\n // Helper: Clear value at specific index\n const clearValue = (index: number) => {\n updateValue(index, '');\n };\n\n // Helper: Focus input at index\n const focusInput = (index: number) => {\n inputRefs.current[index]?.focus();\n };\n\n useEffect(() => {\n if (autoFocus && inputRefs.current[0] && !disabled) {\n focusInput(0);\n }\n }, [autoFocus, disabled]);\n\n // Internal validation\n const validateOTP = (otpValue: string): string | null => {\n // Empty validation\n if (otpValue.length === 0) {\n return errorMessage || 'Please enter the verification code';\n }\n\n // Incomplete validation\n if (otpValue.length < length || !isComplete(otpValue)) {\n return errorMessage || 'Please enter all digits';\n }\n\n // Custom validation\n if (onValidate) {\n const validationResult = onValidate(otpValue);\n if (validationResult === false) {\n return errorMessage || 'Invalid verification code';\n }\n if (typeof validationResult === 'string') {\n return validationResult;\n }\n }\n\n return null;\n };\n\n useEffect(() => {\n const otpValue = values.join('');\n onChange?.(otpValue);\n\n // Clear error when user starts typing\n if (internalError && otpValue.length > 0) {\n setInternalError(null);\n }\n\n if (isComplete(otpValue)) {\n // Validate on complete\n if (onValidate) {\n const validationResult = onValidate(otpValue);\n if (validationResult === false || typeof validationResult === 'string') {\n const errorMsg =\n typeof validationResult === 'string' ? validationResult : errorMessage || 'Invalid verification code';\n setInternalError(errorMsg);\n } else {\n setInternalError(null);\n }\n }\n onComplete?.(otpValue);\n }\n }, [values, length, onChange, onComplete, onValidate, errorMessage]);\n\n const handleChange = (index: number, value: string) => {\n // Only allow single digit or empty\n if (value && !isDigit(value)) {\n return;\n }\n\n updateValue(index, value, true);\n };\n\n const handleKeyDown = (index: number, e: KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n const currentValue = values[index];\n\n // Handle backspace\n if (e.key === 'Backspace') {\n isBackspacePressed.current = true;\n if (currentValue) {\n clearValue(index);\n } else if (index > 0) {\n clearValue(index - 1);\n focusInput(index - 1);\n }\n // Reset backspace flag after a short delay\n setTimeout(() => {\n isBackspacePressed.current = false;\n }, 100);\n e.preventDefault();\n return;\n }\n\n // Handle delete\n if (e.key === 'Delete') {\n isBackspacePressed.current = true;\n clearValue(index);\n // Reset backspace flag after a short delay\n setTimeout(() => {\n isBackspacePressed.current = false;\n }, 100);\n e.preventDefault();\n return;\n }\n\n // Handle navigation keys\n const navigationHandlers: Record<string, () => void> = {\n ArrowLeft: () => index > 0 && focusInput(index - 1),\n ArrowRight: () => index < length - 1 && focusInput(index + 1),\n Home: () => focusInput(0),\n End: () => focusInput(length - 1)\n };\n\n if (navigationHandlers[e.key]) {\n navigationHandlers[e.key]();\n e.preventDefault();\n return;\n }\n\n // Allow digits, but prevent if already filled\n if (isDigit(e.key)) {\n if (currentValue) {\n updateValue(index, e.key, true);\n }\n }\n };\n\n const handlePaste = (e: ClipboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n e.preventDefault();\n const pastedData = e.clipboardData.getData('text/plain').trim();\n\n // Extract only digits\n const digits = pastedData.replace(/\\D/g, '').slice(0, length);\n\n if (digits.length > 0) {\n const newValues = [...values];\n\n // Fill inputs starting from the current index\n const startIndex = inputRefs.current.findIndex((ref) => ref === document.activeElement);\n const actualStartIndex = startIndex >= 0 ? startIndex : 0;\n\n for (let i = 0; i < digits.length && actualStartIndex + i < length; i++) {\n newValues[actualStartIndex + i] = digits[i];\n }\n\n setValues(newValues);\n\n // Focus the next empty input or the last input\n const nextEmptyIndex = newValues.findIndex((val, idx) => idx >= actualStartIndex && val === '');\n const focusIndex = nextEmptyIndex >= 0 ? nextEmptyIndex : Math.min(actualStartIndex + digits.length, length - 1);\n focusInput(focusIndex);\n }\n };\n\n const handleFocus = (index: number) => {\n inputRefs.current[index]?.select();\n };\n\n const handleBlur = () => {\n // Don't validate on blur if backspace/delete was just pressed\n if (validateOnBlur && !isBackspacePressed.current) {\n const otpValue = values.join('');\n const validationError = validateOTP(otpValue);\n setInternalError(validationError);\n }\n };\n\n const hasError = error || !!internalError;\n // Priority: errorMessage prop > internalError\n const displayError = hasError && (errorMessage || internalError);\n \n const ariaDescribedByError = displayError ? errorId : undefined;\n\n return (\n <div className={`se-design-otp-input ${className || ''}`} data-automation-id=\"otp-input-container\">\n {label && <div id={labelId} className=\"se-design-otp-input-label\">{label}</div>}\n <div className=\"flex items-center gap-[12px]\" role=\"group\" aria-labelledby={label ? labelId : undefined}>\n {values.map((value, index) => (\n <input\n key={index}\n ref={(el) => {\n inputRefs.current[index] = el;\n }}\n type=\"text\"\n inputMode=\"numeric\"\n maxLength={1}\n value={value}\n onChange={(e: ChangeEvent<HTMLInputElement>) => handleChange(index, e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => handleKeyDown(index, e)}\n onPaste={handlePaste}\n onFocus={() => handleFocus(index)}\n onBlur={handleBlur}\n disabled={disabled}\n className={`\n w-12 h-12 \n flex flex-col items-start \n text-center text-lg font-medium\n border rounded-md\n outline-none\n transition-colors\n disabled:bg-gray-50 disabled:cursor-not-allowed\n ${\n disabled\n ? 'border-[var(--color-gray-300)] text-gray-400'\n : hasError\n ? 'border-[var(--color-red-400)] text-gray-900 focus:border-[var(--color-red-400)] focus:ring-1 focus:ring-[var(--color-red-400)]'\n : 'border-[var(--color-gray-300)] text-gray-900 focus:border-[var(--color-blue-500)] focus:ring-1 focus:ring-[var(--color-blue-500)]'\n }\n `}\n style={{\n gap: 'var(--Spacer-6px, 6px)'\n }}\n aria-label={`OTP digit ${index + 1} of ${length}`}\n aria-invalid={hasError}\n aria-describedby={ariaDescribedByError}\n data-automation-id={`otp-input-${index}`}\n />\n ))}\n </div>\n {displayError && <div id={errorId} className=\"se-design-otp-input-error\" role=\"alert\">{displayError}</div>}\n </div>\n );\n};\n"],"names":["OTPInput","length","onChange","onComplete","label","disabled","className","autoFocus","error","errorMessage","validateOnBlur","onValidate","id","values","setValues","useState","Array","fill","internalError","setInternalError","inputRefs","useRef","isBackspacePressed","baseId","useStableId","labelId","errorId","isDigit","char","test","isComplete","otpValue","every","val","updateValue","index","value","shouldFocusNext","newValues","focusInput","clearValue","current","focus","useEffect","validateOTP","validationResult","join","handleChange","handleKeyDown","e","currentValue","key","setTimeout","preventDefault","navigationHandlers","ArrowLeft","ArrowRight","Home","End","handlePaste","digits","clipboardData","getData","trim","replace","slice","startIndex","findIndex","ref","document","activeElement","actualStartIndex","i","nextEmptyIndex","idx","focusIndex","Math","min","handleFocus","select","handleBlur","validationError","hasError","displayError","ariaDescribedByError","undefined","React","createElement","role","map","el","type","inputMode","maxLength","target","onKeyDown","onPaste","onFocus","onBlur","style","gap"],"mappings":";;;AAmBO,MAAMA,IAA8BA,CAAC;AAAA,EAC1CC,QAAAA,IAAS;AAAA,EACTC,UAAAA;AAAAA,EACAC,YAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EACXC,WAAAA,IAAY;AAAA,EACZC,WAAAA,IAAY;AAAA,EACZC,OAAAA,IAAQ;AAAA,EACRC,cAAAA;AAAAA,EACAC,gBAAAA,IAAiB;AAAA,EACjBC,YAAAA;AAAAA,EACAC,IAAAA;AACF,MAAM;AACJ,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAmBC,MAAMf,CAAM,EAAEgB,KAAK,EAAE,CAAC,GAC/D,CAACC,GAAeC,CAAgB,IAAIJ,EAAwB,IAAI,GAChEK,IAAYC,EAAoC,EAAE,GAClDC,IAAqBD,EAAgB,EAAK,GAG1CE,IAASC,EAAYZ,GAAI,cAAc,GACvCa,IAAU,GAAGF,CAAM,UACnBG,IAAU,GAAGH,CAAM,UAGnBI,IAAUA,CAACC,MAA0B,OAAOC,KAAKD,CAAI,GAGrDE,IAAaA,CAACC,MACXA,EAAS9B,WAAWA,KAAUY,EAAOmB,MAAOC,CAAAA,MAAQA,MAAQ,EAAE,GAIjEC,IAAcA,CAACC,GAAeC,GAAeC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A,EAAAC,cAAA,OAAA;AAAA,IAAK3E,IAAIc;AAAAA,IAASpB,WAAU;AAAA,IAA4BkF,MAAK;AAAA,EAAA,GAASL,CAAkB,CACtG;AAET;"}
1
+ {"version":3,"file":"index56.js","sources":["../src/components/OTPInput/index.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect, KeyboardEvent, ChangeEvent, ClipboardEvent, FC } from 'react';\nimport { useStableId } from '../../utils/useStableId';\nimport './style.scss';\n\nexport interface OTPInputProps {\n length?: number;\n onChange?: (value: string) => void;\n onComplete?: (value: string) => void;\n label?: string;\n disabled?: boolean;\n className?: string;\n autoFocus?: boolean;\n error?: boolean;\n errorMessage?: string;\n validateOnBlur?: boolean;\n onValidate?: (value: string) => boolean | string;\n id?: string;\n}\n\nexport const OTPInput: FC<OTPInputProps> = ({\n length = 6,\n onChange,\n onComplete,\n label,\n disabled = false,\n className = '',\n autoFocus = true,\n error = false,\n errorMessage,\n validateOnBlur = false,\n onValidate,\n id\n}) => {\n const [values, setValues] = useState<string[]>(Array(length).fill(''));\n const [internalError, setInternalError] = useState<string | null>(null);\n const inputRefs = useRef<(HTMLInputElement | null)[]>([]);\n const isBackspacePressed = useRef<boolean>(false);\n \n // Generate stable IDs for ARIA attributes\n const baseId = useStableId(id, 'se-otp-input');\n const labelId = `${baseId}-label`;\n const errorId = `${baseId}-error`;\n\n // Helper: Check if a string is a single digit\n const isDigit = (char: string): boolean => /^\\d$/.test(char);\n\n // Helper: Check if OTP is complete\n const isComplete = (otpValue: string): boolean => {\n return otpValue.length === length && values.every((val) => val !== '');\n };\n\n // Helper: Update value at specific index\n const updateValue = (index: number, value: string, shouldFocusNext = false) => {\n const newValues = [...values];\n newValues[index] = value;\n setValues(newValues);\n\n if (shouldFocusNext && value && index < length - 1) {\n focusInput(index + 1);\n }\n };\n\n // Helper: Clear value at specific index\n const clearValue = (index: number) => {\n updateValue(index, '');\n };\n\n // Helper: Focus input at index\n const focusInput = (index: number) => {\n inputRefs.current[index]?.focus();\n };\n\n useEffect(() => {\n if (autoFocus && inputRefs.current[0] && !disabled) {\n focusInput(0);\n }\n }, [autoFocus, disabled]);\n\n // Internal validation\n const validateOTP = (otpValue: string): string | null => {\n // Empty validation\n if (otpValue.length === 0) {\n return errorMessage || 'Please enter the verification code';\n }\n\n // Incomplete validation\n if (otpValue.length < length || !isComplete(otpValue)) {\n return errorMessage || 'Please enter all digits';\n }\n\n // Custom validation\n if (onValidate) {\n const validationResult = onValidate(otpValue);\n if (validationResult === false) {\n return errorMessage || 'Invalid verification code';\n }\n if (typeof validationResult === 'string') {\n return validationResult;\n }\n }\n\n return null;\n };\n\n useEffect(() => {\n const otpValue = values.join('');\n onChange?.(otpValue);\n\n // Clear error when user starts typing\n if (internalError && otpValue.length > 0) {\n setInternalError(null);\n }\n\n if (isComplete(otpValue)) {\n // Validate on complete\n if (onValidate) {\n const validationResult = onValidate(otpValue);\n if (validationResult === false || typeof validationResult === 'string') {\n const errorMsg =\n typeof validationResult === 'string' ? validationResult : errorMessage || 'Invalid verification code';\n setInternalError(errorMsg);\n } else {\n setInternalError(null);\n }\n }\n onComplete?.(otpValue);\n }\n }, [values, length, onChange, onComplete, onValidate, errorMessage]);\n\n const handleChange = (index: number, value: string) => {\n // Only allow single digit or empty\n if (value && !isDigit(value)) {\n return;\n }\n\n updateValue(index, value, true);\n };\n\n const handleKeyDown = (index: number, e: KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n const currentValue = values[index];\n\n // Handle backspace\n if (e.key === 'Backspace') {\n isBackspacePressed.current = true;\n if (currentValue) {\n clearValue(index);\n } else if (index > 0) {\n clearValue(index - 1);\n focusInput(index - 1);\n }\n // Reset backspace flag after a short delay\n setTimeout(() => {\n isBackspacePressed.current = false;\n }, 100);\n e.preventDefault();\n return;\n }\n\n // Handle delete\n if (e.key === 'Delete') {\n isBackspacePressed.current = true;\n clearValue(index);\n // Reset backspace flag after a short delay\n setTimeout(() => {\n isBackspacePressed.current = false;\n }, 100);\n e.preventDefault();\n return;\n }\n\n // Handle navigation keys\n const navigationHandlers: Record<string, () => void> = {\n ArrowLeft: () => index > 0 && focusInput(index - 1),\n ArrowRight: () => index < length - 1 && focusInput(index + 1),\n Home: () => focusInput(0),\n End: () => focusInput(length - 1)\n };\n\n if (navigationHandlers[e.key]) {\n navigationHandlers[e.key]();\n e.preventDefault();\n return;\n }\n\n // Allow digits, but prevent if already filled\n if (isDigit(e.key)) {\n if (currentValue) {\n updateValue(index, e.key, true);\n }\n }\n };\n\n const handlePaste = (e: ClipboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n e.preventDefault();\n const pastedData = e.clipboardData.getData('text/plain').trim();\n\n // Extract only digits\n const digits = pastedData.replace(/\\D/g, '').slice(0, length);\n\n if (digits.length > 0) {\n const newValues = [...values];\n\n // Fill inputs starting from the current index\n const startIndex = inputRefs.current.findIndex((ref) => ref === document.activeElement);\n const actualStartIndex = startIndex >= 0 ? startIndex : 0;\n\n for (let i = 0; i < digits.length && actualStartIndex + i < length; i++) {\n newValues[actualStartIndex + i] = digits[i];\n }\n\n setValues(newValues);\n\n // Focus the next empty input or the last input\n const nextEmptyIndex = newValues.findIndex((val, idx) => idx >= actualStartIndex && val === '');\n const focusIndex = nextEmptyIndex >= 0 ? nextEmptyIndex : Math.min(actualStartIndex + digits.length, length - 1);\n focusInput(focusIndex);\n }\n };\n\n const handleFocus = (index: number) => {\n inputRefs.current[index]?.select();\n };\n\n const handleBlur = () => {\n // Don't validate on blur if backspace/delete was just pressed\n if (validateOnBlur && !isBackspacePressed.current) {\n const otpValue = values.join('');\n const validationError = validateOTP(otpValue);\n setInternalError(validationError);\n }\n };\n\n const hasError = error || !!internalError;\n // Priority: errorMessage prop > internalError\n const displayError = hasError && (errorMessage || internalError);\n \n const ariaDescribedByError = displayError ? errorId : undefined;\n\n return (\n <div className={`se-design-otp-input ${className || ''}`} data-automation-id=\"otp-input-container\">\n {label && <div id={labelId} className=\"se-design-otp-input-label\">{label}</div>}\n <div className=\"flex items-center gap-[12px]\" role=\"group\" aria-labelledby={label ? labelId : undefined}>\n {values.map((value, index) => (\n <input\n key={index}\n ref={(el) => {\n inputRefs.current[index] = el;\n }}\n type=\"text\"\n inputMode=\"numeric\"\n maxLength={1}\n value={value}\n onChange={(e: ChangeEvent<HTMLInputElement>) => handleChange(index, e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => handleKeyDown(index, e)}\n onPaste={handlePaste}\n onFocus={() => handleFocus(index)}\n onBlur={handleBlur}\n disabled={disabled}\n className={`\n w-12 h-12 \n flex flex-col items-start \n text-center text-lg font-medium\n border rounded-md\n outline-none\n transition-colors\n disabled:bg-gray-50 disabled:cursor-not-allowed\n ${\n disabled\n ? 'border-[var(--color-gray-300)] text-gray-400'\n : hasError\n ? 'border-[var(--color-red-500)] text-gray-900 focus:border-[var(--color-red-500)] focus:ring-1 focus:ring-[var(--color-red-500)]'\n : 'border-[var(--color-gray-600)] text-gray-900 focus:border-[var(--color-blue-500)] focus:ring-1 focus:ring-[var(--color-blue-500)]'\n }\n `}\n style={{\n gap: 'var(--Spacer-6px, 6px)'\n }}\n aria-label={`OTP digit ${index + 1} of ${length}`}\n aria-invalid={hasError}\n aria-describedby={ariaDescribedByError}\n data-automation-id={`otp-input-${index}`}\n />\n ))}\n </div>\n {displayError && <div id={errorId} className=\"se-design-otp-input-error\" role=\"alert\">{displayError}</div>}\n </div>\n );\n};\n"],"names":["OTPInput","length","onChange","onComplete","label","disabled","className","autoFocus","error","errorMessage","validateOnBlur","onValidate","id","values","setValues","useState","Array","fill","internalError","setInternalError","inputRefs","useRef","isBackspacePressed","baseId","useStableId","labelId","errorId","isDigit","char","test","isComplete","otpValue","every","val","updateValue","index","value","shouldFocusNext","newValues","focusInput","clearValue","current","focus","useEffect","validateOTP","validationResult","join","handleChange","handleKeyDown","e","currentValue","key","setTimeout","preventDefault","navigationHandlers","ArrowLeft","ArrowRight","Home","End","handlePaste","digits","clipboardData","getData","trim","replace","slice","startIndex","findIndex","ref","document","activeElement","actualStartIndex","i","nextEmptyIndex","idx","focusIndex","Math","min","handleFocus","select","handleBlur","validationError","hasError","displayError","ariaDescribedByError","undefined","React","createElement","role","map","el","type","inputMode","maxLength","target","onKeyDown","onPaste","onFocus","onBlur","style","gap"],"mappings":";;;AAmBO,MAAMA,IAA8BA,CAAC;AAAA,EAC1CC,QAAAA,IAAS;AAAA,EACTC,UAAAA;AAAAA,EACAC,YAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EACXC,WAAAA,IAAY;AAAA,EACZC,WAAAA,IAAY;AAAA,EACZC,OAAAA,IAAQ;AAAA,EACRC,cAAAA;AAAAA,EACAC,gBAAAA,IAAiB;AAAA,EACjBC,YAAAA;AAAAA,EACAC,IAAAA;AACF,MAAM;AACJ,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAmBC,MAAMf,CAAM,EAAEgB,KAAK,EAAE,CAAC,GAC/D,CAACC,GAAeC,CAAgB,IAAIJ,EAAwB,IAAI,GAChEK,IAAYC,EAAoC,EAAE,GAClDC,IAAqBD,EAAgB,EAAK,GAG1CE,IAASC,EAAYZ,GAAI,cAAc,GACvCa,IAAU,GAAGF,CAAM,UACnBG,IAAU,GAAGH,CAAM,UAGnBI,IAAUA,CAACC,MAA0B,OAAOC,KAAKD,CAAI,GAGrDE,IAAaA,CAACC,MACXA,EAAS9B,WAAWA,KAAUY,EAAOmB,MAAOC,CAAAA,MAAQA,MAAQ,EAAE,GAIjEC,IAAcA,CAACC,GAAeC,GAAeC,IAAkB,OAAU;AAC7E,UAAMC,IAAY,CAAC,GAAGzB,CAAM;AAC5ByB,IAAAA,EAAUH,CAAK,IAAIC,GACnBtB,EAAUwB,CAAS,GAEfD,KAAmBD,KAASD,IAAQlC,IAAS,KAC/CsC,EAAWJ,IAAQ,CAAC;AAAA,EAExB,GAGMK,IAAaA,CAACL,MAAkB;AACpCD,IAAAA,EAAYC,GAAO,EAAE;AAAA,EACvB,GAGMI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AA;AAAA,IAAKjF,WAAU;AAAA,IAA+BkF,MAAK;AAAA,IAAQ,mBAAiBpF,IAAQqB,IAAU4D;AAAAA,EAAAA,GAC3FxE,EAAO4E,IAAI,CAACrD,GAAOD,MAClBmD,gBAAAA,EAAAC,cAAA,SAAA;AAAA,IACEpC,KAAKhB;AAAAA,IACLiC,KAAMsB,CAAAA,MAAO;AACXtE,MAAAA,EAAUqB,QAAQN,CAAK,IAAIuD;AAAAA,IAC7B;AAAA,IACAC,MAAK;AAAA,IACLC,WAAU;AAAA,IACVC,WAAW;AAAA,IACXzD,OAAAA;AAAAA,IACAlC,UAAUA,CAAC+C,MAAqCF,EAAaZ,GAAOc,EAAE6C,OAAO1D,KAAK;AAAA,IAClF2D,WAAWA,CAAC9C,MAAuCD,EAAcb,GAAOc,CAAC;AAAA,IACzE+C,SAASrC;AAAAA,IACTsC,SAASA,MAAMnB,EAAY3C,CAAK;AAAA,IAChC+D,QAAQlB;AAAAA,IACR3E,UAAAA;AAAAA,IACAC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBASPD,IACI,iDACA6E,IACA,mIACA,mIAAmI;AAAA;AAAA,IAG3IiB,OAAO;AAAA,MACLC,KAAK;AAAA,IAAA;AAAA,IAEP,cAAY,aAAajE,IAAQ,CAAC,OAAOlC,CAAM;AAAA,IAC/C,gBAAciF;AAAAA,IACd,oBAAkBE;AAAAA,IAClB,sBAAoB,aAAajD,CAAK;AAAA,EAAA,CACvC,CACF,CACE,GACJgD,KAAgBG,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAK3E,IAAIc;AAAAA,IAASpB,WAAU;AAAA,IAA4BkF,MAAK;AAAA,EAAA,GAASL,CAAkB,CACtG;AAET;"}
package/dist/index6.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import l, { useState as d, useCallback as o } from "react";
2
- import { isElementVisible as m } from "./index183.js";
2
+ import { isElementVisible as m } from "./index184.js";
3
3
  const g = ({
4
4
  skipLinks: n,
5
5
  className: s = ""
@@ -31,7 +31,6 @@ const g = ({
31
31
  }, e.label)));
32
32
  };
33
33
  export {
34
- g as SkipLinksBar,
35
- g as default
34
+ g as SkipLinksBar
36
35
  };
37
36
  //# sourceMappingURL=index6.js.map
package/dist/index63.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import N, { forwardRef as _ } from "react";
2
- import { getA11yNameAttributes as k } from "./index69.js";
2
+ import { getA11yNameAttributes as k } from "./index70.js";
3
3
  /* empty css */
4
4
  function a() {
5
5
  return a = Object.assign ? Object.assign.bind() : function(r) {
package/dist/index64.js CHANGED
@@ -5,7 +5,7 @@ import { Icon as D } from "./index5.js";
5
5
  import { Link as G } from "./index63.js";
6
6
  import { CustomModal as H } from "./index12.js";
7
7
  import { useFocusTrap as J } from "./index224.js";
8
- import { useStableId as K } from "./index184.js";
8
+ import { useStableId as K } from "./index185.js";
9
9
  /* empty css */
10
10
  const O = {
11
11
  lg: {
@@ -137,7 +137,6 @@ const O = {
137
137
  }));
138
138
  };
139
139
  export {
140
- ca as Paywall,
141
- ca as default
140
+ ca as Paywall
142
141
  };
143
142
  //# sourceMappingURL=index64.js.map
package/dist/index66.js CHANGED
@@ -1,40 +1,42 @@
1
1
  import * as t from "react";
2
- import { isVirtualClick as C } from "./index68.js";
3
- function h({
2
+ import { isVirtualClick as w } from "./index69.js";
3
+ function R({
4
4
  disabled: p = !1,
5
5
  loading: i = !1,
6
6
  onClick: u,
7
- onKeyboardActivate: n,
7
+ onKeyboardActivate: s,
8
8
  isNative: l = !0,
9
9
  role: d = "button",
10
10
  tabIndex: D = 0,
11
11
  stopPropagation: c = !1,
12
- preventDefault: f = !1
12
+ preventDefault: f = !1,
13
+ pressed: P
13
14
  } = {}) {
14
- const e = p || i, s = t.useRef(!1), o = t.useCallback(() => {
15
- s.current = !0;
16
- }, []), P = t.useCallback((r) => {
15
+ const e = p || i, n = t.useRef(!1), o = t.useCallback(() => {
16
+ n.current = !0;
17
+ }, []), m = t.useCallback((r) => {
17
18
  if (e) return;
18
19
  c && r.stopPropagation(), f && r.preventDefault();
19
- const v = C(r.nativeEvent), y = s.current;
20
- s.current = !1;
21
- const b = v ? "virtual" : y ? "pointer" : "keyboard";
22
- if ((b === "keyboard" || b === "virtual") && n) {
23
- n(r);
20
+ const y = w(r.nativeEvent), C = n.current;
21
+ n.current = !1;
22
+ const b = y ? "virtual" : C ? "pointer" : "keyboard";
23
+ if ((b === "keyboard" || b === "virtual") && s) {
24
+ s(r);
24
25
  return;
25
26
  }
26
27
  u?.(r);
27
- }, [e, u, n, c, f]), m = t.useCallback((r) => {
28
+ }, [e, u, s, c, f]), v = t.useCallback((r) => {
28
29
  e || (r.key === "Enter" || r.key === " ") && (r.preventDefault(), r.currentTarget.click());
29
30
  }, [e]), k = {
30
31
  onPointerDown: o,
31
32
  onMouseDown: o,
32
33
  onTouchStart: o,
33
- onClick: P,
34
+ onClick: m,
34
35
  "aria-disabled": e ? "true" : void 0,
35
- "aria-busy": i ? "true" : void 0
36
+ "aria-busy": i ? "true" : void 0,
37
+ "aria-pressed": P
36
38
  };
37
- l || (k.onKeyDown = m);
39
+ l || (k.onKeyDown = v);
38
40
  const a = {
39
41
  pressProps: k,
40
42
  isDisabled: e
@@ -42,6 +44,6 @@ function h({
42
44
  return l || (a.role = d, a.tabIndex = e ? -1 : D), a;
43
45
  }
44
46
  export {
45
- h as useAccessiblePress
47
+ R as useAccessiblePress
46
48
  };
47
49
  //# sourceMappingURL=index66.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index66.js","sources":["../src/utils/a11y/useAccessiblePress.ts"],"sourcesContent":["import * as React from 'react';\nimport { isVirtualClick } from '../virtualClick';\n\n/**\n * Hook for accessible press interactions (pointer vs keyboard vs virtual click).\n *\n * Handles:\n * - Pointer intent tracking (mouse/touch)\n * - Virtual click detection (NVDA browse mode, etc.)\n * - Routing to appropriate handler (onClick vs onKeyboardActivate)\n * - For non-native elements: Enter/Space → activation\n * - Optional stopPropagation and preventDefault\n *\n * @example\n * // Native button (isNative=true, the default)\n * const { pressProps } = useAccessiblePress({ onClick, disabled });\n * <button {...pressProps}>Click me</button>\n *\n * @example\n * // Non-native element (div acting as button)\n * const { pressProps, role, tabIndex } = useAccessiblePress({ onClick, isNative: false });\n * <div role={role} tabIndex={tabIndex} {...pressProps}>Click me</div>\n *\n * @example\n * // Element nested inside clickable parent (prevent event bubbling)\n * const { pressProps, tabIndex } = useAccessiblePress({ \n * onClick, \n * isNative: false, \n * stopPropagation: true \n * });\n * <div role=\"button\" tabIndex={tabIndex} {...pressProps}>Click me</div>\n */\n\ntype InputKind = 'pointer' | 'keyboard' | 'virtual';\n\nexport type UseAccessiblePressOptions = {\n /**\n * Whether the element is disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the element is in a loading state (will also disable)\n */\n loading?: boolean;\n\n /**\n * Handler for pointer/touch activations (or all activations if onKeyboardActivate is not provided)\n */\n onClick?: (e: React.MouseEvent<HTMLElement>) => void;\n\n /**\n * Handler for keyboard + assistive tech virtual activation.\n * If omitted, onClick is used for all activations.\n */\n onKeyboardActivate?: (e: React.MouseEvent<HTMLElement>) => void;\n\n /**\n * If true, this is a native <button> (or other native pressable) and we MUST NOT add Enter/Space handling.\n * Default: true\n */\n isNative?: boolean;\n\n /**\n * Only for non-native elements (div/span). Defaults to 'button'.\n */\n role?: string;\n\n /**\n * Only for non-native elements. Defaults to 0.\n */\n tabIndex?: number;\n\n /**\n * If true, calls e.stopPropagation() before invoking onClick handler.\n * Useful when element is nested inside another clickable element.\n * Default: false\n */\n stopPropagation?: boolean;\n\n /**\n * If true, calls e.preventDefault() before invoking onClick handler.\n * Note: For non-native elements, preventDefault is already called on Space/Enter keys.\n * Default: false\n */\n preventDefault?: boolean;\n};\n\nexport type UseAccessiblePressReturn = {\n /**\n * Props to spread onto the element. Includes event handlers and ARIA attributes.\n * Does NOT include role/tabIndex — apply those separately.\n */\n pressProps: React.HTMLAttributes<HTMLElement> & {\n 'aria-disabled'?: 'true';\n 'aria-busy'?: 'true';\n };\n\n /**\n * Combined disabled state (disabled || loading)\n */\n isDisabled: boolean;\n\n /**\n * Role for non-native elements (e.g., 'button', 'menuitem').\n * Only returned when isNative=false.\n */\n role?: string;\n\n /**\n * TabIndex for non-native elements.\n * Returns -1 when disabled, otherwise the provided tabIndex (default 0).\n * Only returned when isNative=false.\n */\n tabIndex?: number;\n};\n\nexport function useAccessiblePress({\n disabled = false,\n loading = false,\n onClick,\n onKeyboardActivate,\n isNative = true,\n role = 'button',\n tabIndex = 0,\n stopPropagation = false,\n preventDefault = false\n}: UseAccessiblePressOptions = {}): UseAccessiblePressReturn {\n const isDisabled = disabled || loading;\n const lastWasPointerRef = React.useRef(false);\n\n const markPointer = React.useCallback(() => {\n lastWasPointerRef.current = true;\n }, []);\n\n const handleClick = React.useCallback(\n (e: React.MouseEvent<HTMLElement>) => {\n if (isDisabled) return;\n\n // Handle event control flags\n if (stopPropagation) e.stopPropagation();\n if (preventDefault) e.preventDefault();\n\n const virtual = isVirtualClick(e.nativeEvent as any);\n const isPointer = lastWasPointerRef.current;\n lastWasPointerRef.current = false;\n\n const input: InputKind = virtual ? 'virtual' : isPointer ? 'pointer' : 'keyboard';\n\n // If we have a keyboard handler, route keyboard + virtual clicks there.\n if ((input === 'keyboard' || input === 'virtual') && onKeyboardActivate) {\n onKeyboardActivate(e);\n return;\n }\n\n onClick?.(e);\n },\n [isDisabled, onClick, onKeyboardActivate, stopPropagation, preventDefault]\n );\n\n // Only used for non-native elements: Enter/Space should trigger click(), reusing the same click routing.\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n if (isDisabled) return;\n\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n // Trigger native click event so all routing goes through handleClick\n (e.currentTarget as HTMLElement).click();\n }\n },\n [isDisabled]\n );\n\n const pressProps: UseAccessiblePressReturn['pressProps'] = {\n onPointerDown: markPointer,\n onMouseDown: markPointer,\n onTouchStart: markPointer,\n onClick: handleClick,\n 'aria-disabled': isDisabled ? 'true' : undefined,\n 'aria-busy': loading ? 'true' : undefined\n };\n\n // For non-native elements, add Enter/Space handling\n if (!isNative) {\n pressProps.onKeyDown = handleKeyDown;\n }\n\n // Return role/tabIndex separately (only for non-native elements)\n const result: UseAccessiblePressReturn = { pressProps, isDisabled };\n\n if (!isNative) {\n result.role = role;\n result.tabIndex = isDisabled ? -1 : tabIndex;\n }\n\n return result;\n}\n\n"],"names":["React","isVirtualClick","useAccessiblePress","disabled","loading","onClick","onKeyboardActivate","isNative","role","tabIndex","stopPropagation","preventDefault","isDisabled","lastWasPointerRef","useRef","markPointer","useCallback","current","handleClick","e","virtual","nativeEvent","isPointer","input","handleKeyDown","key","currentTarget","click","pressProps","onPointerDown","onMouseDown","onTouchStart","undefined","onKeyDown","result"],"mappings":"AAqHO,YAAAA,OAAA;AAAA,SAAA,kBAAAC,SAAA;AAAA,SAASC,EAAmB;AAAA,EACjCC,UAAAA,IAAW;AAAA,EACXC,SAAAA,IAAU;AAAA,EACVC,SAAAA;AAAAA,EACAC,oBAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EACXC,MAAAA,IAAO;AAAA,EACPC,UAAAA,IAAW;AAAA,EACXC,iBAAAA,IAAkB;AAAA,EAClBC,gBAAAA,IAAiB;AACQ,IAAI,IAA8B;AAC3D,QAAMC,IAAaT,KAAYC,GACzBS,IAAoBb,EAAMc,OAAO,EAAK,GAEtCC,IAAcf,EAAMgB,YAAY,MAAM;AAC1CH,IAAAA,EAAkBI,UAAU;AAAA,EAC9B,GAAG,CAAA,CAAE,GAECC,IAAclB,EAAMgB,YACxB,CAACG,MAAqC;AACpC,QAAIP,EAAY;AAGhB,IAAIF,OAAmBA,gBAAAA,GACnBC,OAAkBA,eAAAA;AAEtB,UAAMS,IAAUnB,EAAekB,EAAEE,WAAkB,GAC7CC,IAAYT,EAAkBI;AACpCJ,IAAAA,EAAkBI,UAAU;AAE5B,UAAMM,IAAmBH,IAAU,YAAYE,IAAY,YAAY;AAGvE,SAAKC,MAAU,cAAcA,MAAU,cAAcjB,GAAoB;AACvEA,MAAAA,EAAmBa,CAAC;AACpB;AAAA,IACF;AAEAd,IAAAA,IAAUc,CAAC;AAAA,EACb,GACA,CAACP,GAAYP,GAASC,GAAoBI,GAAiBC,CAAc,CAC3E,GAGMa,IAAgBxB,EAAMgB,YAC1B,CAACG,MAAwC;AACvC,IAAIP,MAEAO,EAAEM,QAAQ,WAAWN,EAAEM,QAAQ,SACjCN,EAAER,eAAAA,GAEDQ,EAAEO,cAA8BC,MAAAA;AAAAA,EAErC,GACA,CAACf,CAAU,CACb,GAEMgB,IAAqD;AAAA,IACzDC,eAAed;AAAAA,IACfe,aAAaf;AAAAA,IACbgB,cAAchB;AAAAA,IACdV,SAASa;AAAAA,IACT,iBAAiBN,IAAa,SAASoB;AAAAA,IACvC,aAAa5B,IAAU,SAAS4B;AAAAA,EAAAA;AAIlC,EAAKzB,MACHqB,EAAWK,YAAYT;AAIzB,QAAMU,IAAmC;AAAA,IAAEN,YAAAA;AAAAA,IAAYhB,YAAAA;AAAAA,EAAAA;AAEvD,SAAKL,MACH2B,EAAO1B,OAAOA,GACd0B,EAAOzB,WAAWG,IAAa,KAAKH,IAG/ByB;AACT;"}
1
+ {"version":3,"file":"index66.js","sources":["../src/utils/a11y/useAccessiblePress.ts"],"sourcesContent":["import * as React from 'react';\nimport { isVirtualClick } from '../virtualClick';\n\n/**\n * Hook for accessible press interactions (pointer vs keyboard vs virtual click).\n *\n * Handles:\n * - Pointer intent tracking (mouse/touch)\n * - Virtual click detection (NVDA browse mode, etc.)\n * - Routing to appropriate handler (onClick vs onKeyboardActivate)\n * - For non-native elements: Enter/Space → activation\n * - Optional stopPropagation and preventDefault\n *\n * @example\n * // Native button (isNative=true, the default)\n * const { pressProps } = useAccessiblePress({ onClick, disabled });\n * <button {...pressProps}>Click me</button>\n *\n * @example\n * // Non-native element (div acting as button)\n * const { pressProps, role, tabIndex } = useAccessiblePress({ onClick, isNative: false });\n * <div role={role} tabIndex={tabIndex} {...pressProps}>Click me</div>\n *\n * @example\n * // Element nested inside clickable parent (prevent event bubbling)\n * const { pressProps, tabIndex } = useAccessiblePress({ \n * onClick, \n * isNative: false, \n * stopPropagation: true \n * });\n * <div role=\"button\" tabIndex={tabIndex} {...pressProps}>Click me</div>\n */\n\ntype InputKind = 'pointer' | 'keyboard' | 'virtual';\n\nexport type UseAccessiblePressOptions = {\n /**\n * Whether the element is disabled\n */\n disabled?: boolean;\n\n /**\n * Whether the element is in a loading state (will also disable)\n */\n loading?: boolean;\n\n /**\n * Handler for pointer/touch activations (or all activations if onKeyboardActivate is not provided)\n */\n onClick?: (e: React.MouseEvent<HTMLElement>) => void;\n\n /**\n * Handler for keyboard + assistive tech virtual activation.\n * If omitted, onClick is used for all activations.\n */\n onKeyboardActivate?: (e: React.MouseEvent<HTMLElement>) => void;\n\n /**\n * If true, this is a native <button> (or other native pressable) and we MUST NOT add Enter/Space handling.\n * Default: true\n */\n isNative?: boolean;\n\n /**\n * Only for non-native elements (div/span). Defaults to 'button'.\n */\n role?: string;\n\n /**\n * Only for non-native elements. Defaults to 0.\n */\n tabIndex?: number;\n\n /**\n * If true, calls e.stopPropagation() before invoking onClick handler.\n * Useful when element is nested inside another clickable element.\n * Default: false\n */\n stopPropagation?: boolean;\n\n /**\n * If true, calls e.preventDefault() before invoking onClick handler.\n * Note: For non-native elements, preventDefault is already called on Space/Enter keys.\n * Default: false\n */\n preventDefault?: boolean;\n\n /**\n * Toggle/pressed state. When true or false, sets aria-pressed on the element (e.g. selected color swatch).\n * Omit for non-toggle buttons.\n */\n pressed?: boolean;\n};\n\nexport type UseAccessiblePressReturn = {\n /**\n * Props to spread onto the element. Includes event handlers and ARIA attributes.\n * Does NOT include role/tabIndex — apply those separately.\n */\n pressProps: React.HTMLAttributes<HTMLElement> & {\n 'aria-disabled'?: 'true';\n 'aria-busy'?: 'true';\n 'aria-pressed'?: boolean;\n };\n\n /**\n * Combined disabled state (disabled || loading)\n */\n isDisabled: boolean;\n\n /**\n * Role for non-native elements (e.g., 'button', 'menuitem').\n * Only returned when isNative=false.\n */\n role?: string;\n\n /**\n * TabIndex for non-native elements.\n * Returns -1 when disabled, otherwise the provided tabIndex (default 0).\n * Only returned when isNative=false.\n */\n tabIndex?: number;\n};\n\nexport function useAccessiblePress({\n disabled = false,\n loading = false,\n onClick,\n onKeyboardActivate,\n isNative = true,\n role = 'button',\n tabIndex = 0,\n stopPropagation = false,\n preventDefault = false,\n pressed\n}: UseAccessiblePressOptions = {}): UseAccessiblePressReturn {\n const isDisabled = disabled || loading;\n const lastWasPointerRef = React.useRef(false);\n\n const markPointer = React.useCallback(() => {\n lastWasPointerRef.current = true;\n }, []);\n\n const handleClick = React.useCallback(\n (e: React.MouseEvent<HTMLElement>) => {\n if (isDisabled) return;\n\n // Handle event control flags\n if (stopPropagation) e.stopPropagation();\n if (preventDefault) e.preventDefault();\n\n const virtual = isVirtualClick(e.nativeEvent as any);\n const isPointer = lastWasPointerRef.current;\n lastWasPointerRef.current = false;\n\n const input: InputKind = virtual ? 'virtual' : isPointer ? 'pointer' : 'keyboard';\n\n // If we have a keyboard handler, route keyboard + virtual clicks there.\n if ((input === 'keyboard' || input === 'virtual') && onKeyboardActivate) {\n onKeyboardActivate(e);\n return;\n }\n\n onClick?.(e);\n },\n [isDisabled, onClick, onKeyboardActivate, stopPropagation, preventDefault]\n );\n\n // Only used for non-native elements: Enter/Space should trigger click(), reusing the same click routing.\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n if (isDisabled) return;\n\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n // Trigger native click event so all routing goes through handleClick\n (e.currentTarget as HTMLElement).click();\n }\n },\n [isDisabled]\n );\n\n const pressProps: UseAccessiblePressReturn['pressProps'] = {\n onPointerDown: markPointer,\n onMouseDown: markPointer,\n onTouchStart: markPointer,\n onClick: handleClick,\n 'aria-disabled': isDisabled ? 'true' : undefined,\n 'aria-busy': loading ? 'true' : undefined,\n 'aria-pressed': pressed\n };\n\n // For non-native elements, add Enter/Space handling\n if (!isNative) {\n pressProps.onKeyDown = handleKeyDown;\n }\n\n // Return role/tabIndex separately (only for non-native elements)\n const result: UseAccessiblePressReturn = { pressProps, isDisabled };\n\n if (!isNative) {\n result.role = role;\n result.tabIndex = isDisabled ? -1 : tabIndex;\n }\n\n return result;\n}\n\n"],"names":["React","isVirtualClick","useAccessiblePress","disabled","loading","onClick","onKeyboardActivate","isNative","role","tabIndex","stopPropagation","preventDefault","pressed","isDisabled","lastWasPointerRef","useRef","markPointer","useCallback","current","handleClick","e","virtual","nativeEvent","isPointer","input","handleKeyDown","key","currentTarget","click","pressProps","onPointerDown","onMouseDown","onTouchStart","undefined","onKeyDown","result"],"mappings":"AA4HO,YAAAA,OAAA;AAAA,SAAA,kBAAAC,SAAA;AAAA,SAASC,EAAmB;AAAA,EACjCC,UAAAA,IAAW;AAAA,EACXC,SAAAA,IAAU;AAAA,EACVC,SAAAA;AAAAA,EACAC,oBAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EACXC,MAAAA,IAAO;AAAA,EACPC,UAAAA,IAAW;AAAA,EACXC,iBAAAA,IAAkB;AAAA,EAClBC,gBAAAA,IAAiB;AAAA,EACjBC,SAAAA;AACyB,IAAI,IAA8B;AAC3D,QAAMC,IAAaV,KAAYC,GACzBU,IAAoBd,EAAMe,OAAO,EAAK,GAEtCC,IAAchB,EAAMiB,YAAY,MAAM;AAC1CH,IAAAA,EAAkBI,UAAU;AAAA,EAC9B,GAAG,CAAA,CAAE,GAECC,IAAcnB,EAAMiB,YACxB,CAACG,MAAqC;AACpC,QAAIP,EAAY;AAGhB,IAAIH,OAAmBA,gBAAAA,GACnBC,OAAkBA,eAAAA;AAEtB,UAAMU,IAAUpB,EAAemB,EAAEE,WAAkB,GAC7CC,IAAYT,EAAkBI;AACpCJ,IAAAA,EAAkBI,UAAU;AAE5B,UAAMM,IAAmBH,IAAU,YAAYE,IAAY,YAAY;AAGvE,SAAKC,MAAU,cAAcA,MAAU,cAAclB,GAAoB;AACvEA,MAAAA,EAAmBc,CAAC;AACpB;AAAA,IACF;AAEAf,IAAAA,IAAUe,CAAC;AAAA,EACb,GACA,CAACP,GAAYR,GAASC,GAAoBI,GAAiBC,CAAc,CAC3E,GAGMc,IAAgBzB,EAAMiB,YAC1B,CAACG,MAAwC;AACvC,IAAIP,MAEAO,EAAEM,QAAQ,WAAWN,EAAEM,QAAQ,SACjCN,EAAET,eAAAA,GAEDS,EAAEO,cAA8BC,MAAAA;AAAAA,EAErC,GACA,CAACf,CAAU,CACb,GAEMgB,IAAqD;AAAA,IACzDC,eAAed;AAAAA,IACfe,aAAaf;AAAAA,IACbgB,cAAchB;AAAAA,IACdX,SAASc;AAAAA,IACT,iBAAiBN,IAAa,SAASoB;AAAAA,IACvC,aAAa7B,IAAU,SAAS6B;AAAAA,IAChC,gBAAgBrB;AAAAA,EAAAA;AAIlB,EAAKL,MACHsB,EAAWK,YAAYT;AAIzB,QAAMU,IAAmC;AAAA,IAAEN,YAAAA;AAAAA,IAAYhB,YAAAA;AAAAA,EAAAA;AAEvD,SAAKN,MACH4B,EAAO3B,OAAOA,GACd2B,EAAO1B,WAAWI,IAAa,KAAKJ,IAG/B0B;AACT;"}
package/dist/index68.js CHANGED
@@ -1,8 +1,58 @@
1
- const t = () => typeof navigator < "u" && /Android/i.test(navigator.userAgent), o = (i) => {
2
- const r = "pointerType" in i ? i.pointerType : void 0;
3
- return r === "" && i.isTrusted ? !0 : t() && r ? i.type === "click" && i.buttons === 1 : i.detail === 0 && !r;
4
- };
1
+ import * as a from "react";
2
+ function R({
3
+ itemIds: n,
4
+ tabIndex: i = 0,
5
+ defaultFocusedId: s,
6
+ orientation: o = "horizontal",
7
+ cols: u,
8
+ loop: h = !0,
9
+ onFocusChange: k
10
+ }) {
11
+ const [c, x] = a.useState(s || n[0] || ""), g = a.useRef({});
12
+ a.useEffect(() => {
13
+ if (n.length > 0 && !n.includes(c)) {
14
+ const e = s || n[0] || "";
15
+ x(e);
16
+ }
17
+ }, [n, c, s]);
18
+ const w = a.useCallback((e) => {
19
+ x(e), k?.(e);
20
+ }, [k]), b = a.useCallback((e, t = 1) => {
21
+ if (n.length === 0) return;
22
+ const l = n.indexOf(c), f = Math.max(0, l);
23
+ let r = f;
24
+ switch (e) {
25
+ case "first":
26
+ r = 0;
27
+ break;
28
+ case "last":
29
+ r = n.length - 1;
30
+ break;
31
+ case "prev":
32
+ h ? r = (f - t + n.length) % n.length : r = Math.max(0, f - t);
33
+ break;
34
+ case "next":
35
+ h ? r = (f + t) % n.length : r = Math.min(n.length - 1, f + t);
36
+ break;
37
+ }
38
+ const v = n[r];
39
+ v && g.current[v]?.focus();
40
+ }, [n, c, h]), y = a.useCallback((e) => ({
41
+ ref: (t) => {
42
+ g.current[e] = t;
43
+ },
44
+ tabIndex: c === e ? i : -1
45
+ }), [c, i]), p = a.useCallback((e) => {
46
+ let t = null, l = 1;
47
+ e.key === "Home" ? t = "first" : e.key === "End" ? t = "last" : (o !== "vertical" && (e.key === "ArrowLeft" ? t = "prev" : e.key === "ArrowRight" && (t = "next")), !t && o !== "horizontal" && (e.key === "ArrowUp" ? t = "prev" : e.key === "ArrowDown" && (t = "next"), t && u && (l = u))), t && (e.preventDefault(), e.stopPropagation(), b(t, l));
48
+ }, [o, u, b]);
49
+ return {
50
+ setFocusedId: w,
51
+ handleKeyDown: p,
52
+ getRovingItemProps: y
53
+ };
54
+ }
5
55
  export {
6
- o as isVirtualClick
56
+ R as useRovingFocus
7
57
  };
8
58
  //# sourceMappingURL=index68.js.map