@acronis-platform/ui-react 0.62.0 → 2.0.0

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 (237) hide show
  1. package/dist/components/ui/alert/alert.js +118 -60
  2. package/dist/components/ui/alert/alert.js.map +1 -1
  3. package/dist/components/ui/button-group/button-group.js +57 -0
  4. package/dist/components/ui/button-group/button-group.js.map +1 -0
  5. package/dist/components/ui/button-icon-menu/button-icon-menu.js +26 -0
  6. package/dist/components/ui/button-icon-menu/button-icon-menu.js.map +1 -0
  7. package/dist/components/ui/calendar-panel/calendar-panel.js.map +1 -1
  8. package/dist/components/ui/checkbox/checkbox.js +1 -1
  9. package/dist/components/ui/checkbox/checkbox.js.map +1 -1
  10. package/dist/components/ui/chip/chip.js +33 -33
  11. package/dist/components/ui/chip/chip.js.map +1 -1
  12. package/dist/components/ui/data-table/data-table-bulk-actions-bar.js +38 -0
  13. package/dist/components/ui/data-table/data-table-bulk-actions-bar.js.map +1 -0
  14. package/dist/components/ui/data-table/data-table-column-header.js +23 -20
  15. package/dist/components/ui/data-table/data-table-column-header.js.map +1 -1
  16. package/dist/components/ui/data-table/data-table-expand-trigger.js +23 -15
  17. package/dist/components/ui/data-table/data-table-expand-trigger.js.map +1 -1
  18. package/dist/components/ui/data-table/data-table-pagination.js +29 -28
  19. package/dist/components/ui/data-table/data-table-pagination.js.map +1 -1
  20. package/dist/components/ui/data-table/data-table-selection.js +7 -0
  21. package/dist/components/ui/data-table/data-table-selection.js.map +1 -0
  22. package/dist/components/ui/data-table/data-table-toolbar.js +21 -23
  23. package/dist/components/ui/data-table/data-table-toolbar.js.map +1 -1
  24. package/dist/components/ui/data-table/data-table-view-options.js +12 -10
  25. package/dist/components/ui/data-table/data-table-view-options.js.map +1 -1
  26. package/dist/components/ui/data-table/data-table.js +347 -183
  27. package/dist/components/ui/data-table/data-table.js.map +1 -1
  28. package/dist/components/ui/date-range-picker/date-range-picker-utils.js +11 -23
  29. package/dist/components/ui/date-range-picker/date-range-picker-utils.js.map +1 -1
  30. package/dist/components/ui/date-range-picker/date-range-picker.js +94 -134
  31. package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
  32. package/dist/components/ui/dropdown-menu/dropdown-menu.js +129 -72
  33. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  34. package/dist/components/ui/filter-chips/filter-chips.js +44 -0
  35. package/dist/components/ui/filter-chips/filter-chips.js.map +1 -0
  36. package/dist/components/ui/filter-search/filter-search.js +184 -138
  37. package/dist/components/ui/filter-search/filter-search.js.map +1 -1
  38. package/dist/components/ui/fitted-actions/fitted-actions.js +139 -0
  39. package/dist/components/ui/fitted-actions/fitted-actions.js.map +1 -0
  40. package/dist/components/ui/input-date-picker/input-date-picker.js +103 -93
  41. package/dist/components/ui/input-date-picker/input-date-picker.js.map +1 -1
  42. package/dist/components/ui/input-password/input-password.js +76 -66
  43. package/dist/components/ui/input-password/input-password.js.map +1 -1
  44. package/dist/components/ui/input-search/input-search.js +9 -9
  45. package/dist/components/ui/input-search/input-search.js.map +1 -1
  46. package/dist/components/ui/input-select/input-select.js +8 -8
  47. package/dist/components/ui/input-select/input-select.js.map +1 -1
  48. package/dist/components/ui/input-text/input-text.js +77 -66
  49. package/dist/components/ui/input-text/input-text.js.map +1 -1
  50. package/dist/components/ui/input-text-area/input-text-area.js +76 -66
  51. package/dist/components/ui/input-text-area/input-text-area.js.map +1 -1
  52. package/dist/components/ui/link/link.js +50 -35
  53. package/dist/components/ui/link/link.js.map +1 -1
  54. package/dist/components/ui/number-field/number-field.js +1 -1
  55. package/dist/components/ui/number-field/number-field.js.map +1 -1
  56. package/dist/components/ui/popover/popover.js +75 -56
  57. package/dist/components/ui/popover/popover.js.map +1 -1
  58. package/dist/components/ui/scroll-area/scroll-area.js +46 -30
  59. package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
  60. package/dist/components/ui/stepper/stepper.js +70 -0
  61. package/dist/components/ui/stepper/stepper.js.map +1 -0
  62. package/dist/components/ui/stepper-item/stepper-item.js +97 -0
  63. package/dist/components/ui/stepper-item/stepper-item.js.map +1 -0
  64. package/dist/components/ui/table/table-pagination.js +54 -47
  65. package/dist/components/ui/table/table-pagination.js.map +1 -1
  66. package/dist/components/ui/table/table-view-options.js +32 -19
  67. package/dist/components/ui/table/table-view-options.js.map +1 -1
  68. package/dist/components/ui/table/table.js +112 -63
  69. package/dist/components/ui/table/table.js.map +1 -1
  70. package/dist/components/ui/timeline/timeline.js +10 -10
  71. package/dist/components/ui/timeline/timeline.js.map +1 -1
  72. package/dist/components/ui/timer/timer.js +47 -0
  73. package/dist/components/ui/timer/timer.js.map +1 -0
  74. package/dist/components/ui/toast/toast.js +168 -61
  75. package/dist/components/ui/toast/toast.js.map +1 -1
  76. package/dist/components/ui/truncate-text/middle-truncate.js +20 -0
  77. package/dist/components/ui/truncate-text/middle-truncate.js.map +1 -0
  78. package/dist/components/ui/truncate-text/text-width.js +12 -0
  79. package/dist/components/ui/truncate-text/text-width.js.map +1 -0
  80. package/dist/components/ui/truncate-text/truncate-text.js +152 -0
  81. package/dist/components/ui/truncate-text/truncate-text.js.map +1 -0
  82. package/dist/index.js +516 -471
  83. package/dist/index.js.map +1 -1
  84. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/addDays.js +5 -5
  85. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/addDays.js.map +1 -1
  86. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/constants.js +3 -6
  87. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/constants.js.map +1 -1
  88. package/dist/react.js +516 -471
  89. package/dist/react.js.map +1 -1
  90. package/dist/src/components/ui/alert/alert.d.ts +34 -3
  91. package/dist/src/components/ui/alert/index.d.ts +2 -2
  92. package/dist/src/components/ui/button/button.d.ts +1 -1
  93. package/dist/src/components/ui/button-group/button-group.d.ts +38 -0
  94. package/dist/src/components/ui/button-group/index.d.ts +1 -0
  95. package/dist/src/components/ui/button-icon/button-icon.d.ts +1 -1
  96. package/dist/src/components/ui/button-icon-menu/button-icon-menu.d.ts +28 -0
  97. package/dist/src/components/ui/button-icon-menu/index.d.ts +1 -0
  98. package/dist/src/components/ui/button-menu/button-menu.d.ts +1 -1
  99. package/dist/src/components/ui/calendar-panel/calendar-panel.d.ts +2 -2
  100. package/dist/src/components/ui/chip/chip.d.ts +1 -1
  101. package/dist/src/components/ui/data-table/data-table-bulk-actions-bar.d.ts +26 -0
  102. package/dist/src/components/ui/data-table/data-table-column-header.d.ts +6 -1
  103. package/dist/src/components/ui/data-table/data-table-expand-trigger.d.ts +4 -0
  104. package/dist/src/components/ui/data-table/data-table-pagination.d.ts +15 -1
  105. package/dist/src/components/ui/data-table/data-table-selection.d.ts +11 -0
  106. package/dist/src/components/ui/data-table/data-table-view-options.d.ts +3 -2
  107. package/dist/src/components/ui/data-table/data-table.d.ts +88 -3
  108. package/dist/src/components/ui/data-table/data-table.docs.d.ts +61 -1
  109. package/dist/src/components/ui/data-table/index.d.ts +3 -1
  110. package/dist/src/components/ui/date-range-picker/date-range-picker-utils.d.ts +10 -16
  111. package/dist/src/components/ui/date-range-picker/date-range-picker.d.ts +46 -2
  112. package/dist/src/components/ui/dropdown-menu/dropdown-menu.d.ts +8 -1
  113. package/dist/src/components/ui/dropdown-menu/index.d.ts +1 -1
  114. package/dist/src/components/ui/filter-chips/filter-chips.d.ts +25 -0
  115. package/dist/src/components/ui/filter-chips/index.d.ts +1 -0
  116. package/dist/src/components/ui/filter-search/filter-search.d.ts +39 -1
  117. package/dist/src/components/ui/fitted-actions/fitted-actions.d.ts +50 -0
  118. package/dist/src/components/ui/fitted-actions/fitted-actions.docs.d.ts +45 -0
  119. package/dist/src/components/ui/fitted-actions/index.d.ts +1 -0
  120. package/dist/src/components/ui/link/index.d.ts +1 -1
  121. package/dist/src/components/ui/link/link.d.ts +22 -4
  122. package/dist/src/components/ui/metric/metric.d.ts +1 -1
  123. package/dist/src/components/ui/popover/popover.d.ts +30 -1
  124. package/dist/src/components/ui/popover/popover.docs.d.ts +27 -2
  125. package/dist/src/components/ui/scroll-area/scroll-area.d.ts +24 -0
  126. package/dist/src/components/ui/stepper/index.d.ts +1 -0
  127. package/dist/src/components/ui/stepper/stepper.d.ts +40 -0
  128. package/dist/src/components/ui/stepper-item/index.d.ts +1 -0
  129. package/dist/src/components/ui/stepper-item/stepper-item.d.ts +41 -0
  130. package/dist/src/components/ui/table/index.d.ts +1 -1
  131. package/dist/src/components/ui/table/table-pagination.d.ts +21 -0
  132. package/dist/src/components/ui/table/table-view-options.d.ts +9 -2
  133. package/dist/src/components/ui/table/table.d.ts +40 -1
  134. package/dist/src/components/ui/tag/tag.d.ts +1 -1
  135. package/dist/src/components/ui/timer/index.d.ts +1 -0
  136. package/dist/src/components/ui/timer/timer.d.ts +28 -0
  137. package/dist/src/components/ui/toast/index.d.ts +1 -1
  138. package/dist/src/components/ui/toast/toast.d.ts +51 -18
  139. package/dist/src/components/ui/toast/toast.docs.d.ts +4 -0
  140. package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +1 -1
  141. package/dist/src/components/ui/truncate-text/__tests__/middle-truncate.test.d.ts +1 -0
  142. package/dist/src/components/ui/truncate-text/index.d.ts +3 -0
  143. package/dist/src/components/ui/truncate-text/middle-truncate.d.ts +13 -0
  144. package/dist/src/components/ui/truncate-text/text-width.d.ts +11 -0
  145. package/dist/src/components/ui/truncate-text/truncate-text.d.ts +45 -0
  146. package/dist/src/components/ui/truncate-text/truncate-text.docs.d.ts +35 -0
  147. package/dist/src/index.d.ts +8 -0
  148. package/dist/ui-react.css +1 -1
  149. package/package.json +4 -4
  150. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getDefaultOptions.js +0 -8
  151. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getDefaultOptions.js.map +0 -1
  152. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getISODay.js +0 -9
  153. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getISODay.js.map +0 -1
  154. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Parser.js +0 -23
  155. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Parser.js.map +0 -1
  156. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Setter.js +0 -42
  157. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Setter.js.map +0 -1
  158. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/constants.js +0 -50
  159. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/constants.js.map +0 -1
  160. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js +0 -50
  161. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js.map +0 -1
  162. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js +0 -50
  163. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js.map +0 -1
  164. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DateParser.js +0 -62
  165. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DateParser.js.map +0 -1
  166. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js +0 -52
  167. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js.map +0 -1
  168. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayParser.js +0 -50
  169. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayParser.js.map +0 -1
  170. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js +0 -50
  171. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js.map +0 -1
  172. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/EraParser.js +0 -34
  173. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/EraParser.js.map +0 -1
  174. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js +0 -22
  175. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js.map +0 -1
  176. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js +0 -23
  177. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js.map +0 -1
  178. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js +0 -33
  179. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js.map +0 -1
  180. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js +0 -33
  181. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js.map +0 -1
  182. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js +0 -34
  183. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js.map +0 -1
  184. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js +0 -34
  185. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js.map +0 -1
  186. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js +0 -106
  187. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js.map +0 -1
  188. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js +0 -49
  189. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js.map +0 -1
  190. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js +0 -49
  191. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js.map +0 -1
  192. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js +0 -50
  193. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js.map +0 -1
  194. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js +0 -41
  195. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js.map +0 -1
  196. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js +0 -81
  197. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js.map +0 -1
  198. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js +0 -49
  199. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js.map +0 -1
  200. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js +0 -70
  201. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js.map +0 -1
  202. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js +0 -33
  203. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js.map +0 -1
  204. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MonthParser.js +0 -78
  205. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MonthParser.js.map +0 -1
  206. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js +0 -76
  207. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js.map +0 -1
  208. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/SecondParser.js +0 -33
  209. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/SecondParser.js.map +0 -1
  210. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js +0 -81
  211. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js.map +0 -1
  212. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js +0 -78
  213. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js.map +0 -1
  214. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js +0 -76
  215. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js.map +0 -1
  216. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js +0 -23
  217. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js.map +0 -1
  218. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js +0 -23
  219. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js.map +0 -1
  220. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/YearParser.js +0 -50
  221. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/YearParser.js.map +0 -1
  222. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers.js +0 -68
  223. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers.js.map +0 -1
  224. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/utils.js +0 -104
  225. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/utils.js.map +0 -1
  226. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse.js +0 -86
  227. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse.js.map +0 -1
  228. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setDay.js +0 -12
  229. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setDay.js.map +0 -1
  230. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISODay.js +0 -11
  231. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISODay.js.map +0 -1
  232. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISOWeek.js +0 -10
  233. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISOWeek.js.map +0 -1
  234. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setWeek.js +0 -10
  235. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setWeek.js.map +0 -1
  236. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/transpose.js +0 -18
  237. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/transpose.js.map +0 -1
@@ -1,85 +1,192 @@
1
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
2
- import { Toast as o } from "@base-ui/react/toast";
3
- import { TimesIcon as d, CircleTimesIcon as m, TriangleWarningIcon as u, CircleInfoIcon as f, CircleCheckIcon as x } from "@acronis-platform/icons-react/stroke-mono";
4
- import { cn as g } from "../../../lib/utils.js";
5
- import { usePortalContainer as p } from "../../../lib/portal-container.js";
6
- import { Spinner as v } from "../spinner/spinner.js";
7
- const i = o.createToastManager();
8
- function a(t, e, n = {}) {
9
- const { action: r, ...l } = n;
10
- return i.add({
1
+ import { jsx as o, jsxs as u } from "react/jsx-runtime";
2
+ import { Toast as r } from "@base-ui/react/toast";
3
+ import { cva as v } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
4
+ import { TimesIcon as m } from "@acronis-platform/icons-react/stroke-mono";
5
+ import { DiamondWarningRedIcon as x, CircleWarningOrangeIcon as w, TriangleWarningYellowIcon as y, CircleCheckGreenIcon as h, CircleInfoBlueIcon as C } from "@acronis-platform/icons-react/stroke-multi";
6
+ import { cn as N } from "../../../lib/utils.js";
7
+ import { usePortalContainer as T } from "../../../lib/portal-container.js";
8
+ import { Spinner as I } from "../spinner/spinner.js";
9
+ import { Button as k } from "../button/button.js";
10
+ import { ButtonIcon as z } from "../button-icon/button-icon.js";
11
+ const _ = v(
12
+ "relative flex w-full items-start overflow-clip [overflow-clip-margin:border-box] border-solid gap-[var(--ui-toast-global-container-gap)] px-[var(--ui-toast-global-container-padding-x)] py-[var(--ui-toast-global-container-padding-y)] rounded-[var(--ui-toast-global-container-border-radius)] border-[length:var(--ui-toast-global-container-border-width)] bg-[var(--ui-toast-global-container-background)] shadow-[var(--ui-toast-global-container-shadow)] before:absolute before:content-[''] before:-inset-y-px before:start-[-1px] before:w-[var(--ui-toast-global-container-status-width)]",
13
+ {
14
+ variants: {
15
+ variant: {
16
+ info: "border-[color:var(--ui-toast-info-border-color)] before:bg-[var(--ui-toast-info-left-line)]",
17
+ success: "border-[color:var(--ui-toast-success-border-color)] before:bg-[var(--ui-toast-success-left-line)]",
18
+ warning: "border-[color:var(--ui-toast-warning-border-color)] before:bg-[var(--ui-toast-warning-left-line)]",
19
+ critical: "border-[color:var(--ui-toast-critical-border-color)] before:bg-[var(--ui-toast-critical-left-line)]",
20
+ danger: "border-[color:var(--ui-toast-danger-border-color)] before:bg-[var(--ui-toast-danger-left-line)]"
21
+ }
22
+ },
23
+ defaultVariants: {
24
+ variant: "info"
25
+ }
26
+ }
27
+ ), B = {
28
+ info: C,
29
+ success: h,
30
+ warning: y,
31
+ critical: w,
32
+ danger: x
33
+ }, P = {
34
+ info: "info",
35
+ success: "success",
36
+ warning: "warning",
37
+ critical: "critical",
38
+ danger: "danger",
39
+ error: "danger",
40
+ loading: "info"
41
+ }, d = r.createToastManager();
42
+ function s(t, a, n = {}) {
43
+ const { actions: i, dismissable: l, ...e } = n;
44
+ return d.add({
11
45
  title: t,
12
- type: e,
13
- actionProps: r ? { children: r.label, onClick: r.onClick } : void 0,
14
- ...l
46
+ type: a,
47
+ data: { actions: i, dismissable: l },
48
+ ...e
15
49
  });
16
50
  }
17
- const I = Object.assign(
18
- (t, e) => a(t, void 0, e),
51
+ const G = Object.assign(
52
+ (t, a) => s(t, void 0, a),
19
53
  {
20
- success: (t, e) => a(t, "success", e),
21
- info: (t, e) => a(t, "info", e),
22
- warning: (t, e) => a(t, "warning", e),
23
- error: (t, e) => a(t, "error", e),
24
- loading: (t, e) => a(t, "loading", { timeout: 0, ...e }),
25
- dismiss: (t) => i.close(t),
26
- promise: i.promise
54
+ info: (t, a) => s(t, "info", a),
55
+ success: (t, a) => s(t, "success", a),
56
+ warning: (t, a) => s(t, "warning", a),
57
+ critical: (t, a) => s(t, "critical", a),
58
+ danger: (t, a) => s(t, "danger", a),
59
+ loading: (t, a) => s(t, "loading", { timeout: 0, ...a }),
60
+ dismiss: (t) => d.close(t),
61
+ promise: d.promise
27
62
  }
28
- ), N = {
29
- success: /* @__PURE__ */ s(x, { className: "size-4 text-[var(--ui-text-on-status-success)]" }),
30
- info: /* @__PURE__ */ s(f, { className: "size-4 text-[var(--ui-text-on-status-info)]" }),
31
- warning: /* @__PURE__ */ s(u, { className: "size-4 text-[var(--ui-text-on-status-warning)]" }),
32
- error: /* @__PURE__ */ s(m, { className: "size-4 text-[var(--ui-text-on-status-danger)]" }),
33
- loading: /* @__PURE__ */ s(v, { size: "sm", className: "size-4" })
34
- };
35
- function b() {
36
- const { toasts: t } = o.useToastManager();
37
- return t.map((e) => {
38
- const n = N[e.type];
39
- return /* @__PURE__ */ c(
40
- o.Root,
63
+ );
64
+ function S({ closeAriaLabel: t }) {
65
+ const { toasts: a } = r.useToastManager();
66
+ return a.map((n) => {
67
+ var b, p;
68
+ const i = P[n.type ?? ""] ?? "info", l = B[i], e = (b = n.data) == null ? void 0 : b.actions, c = ((p = n.data) == null ? void 0 : p.dismissable) ?? !0;
69
+ return /* @__PURE__ */ u(
70
+ r.Root,
41
71
  {
42
- toast: e,
43
- className: g(
44
- "relative flex w-full items-start gap-3 rounded border border-border bg-background p-4 shadow-md",
72
+ toast: n,
73
+ "data-slot": "toast",
74
+ "data-variant": i,
75
+ swipeDirection: c ? void 0 : [],
76
+ className: N(
77
+ _({ variant: i }),
45
78
  "transition-all data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",
46
- "data-[starting-style]:translate-x-4 data-[ending-style]:translate-x-4"
79
+ // The stack sits on the inline-end edge, so a toast slides in from the
80
+ // right in LTR and from the left in RTL.
81
+ "data-[ending-style]:translate-x-4 data-[starting-style]:translate-x-4",
82
+ "rtl:data-[ending-style]:-translate-x-4 rtl:data-[starting-style]:-translate-x-4"
47
83
  ),
48
84
  children: [
49
- n ? /* @__PURE__ */ s("span", { className: "mt-0.5 shrink-0", children: n }) : null,
50
- /* @__PURE__ */ c("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
51
- /* @__PURE__ */ s(o.Title, { className: "text-sm font-semibold leading-5 text-foreground" }),
52
- /* @__PURE__ */ s(o.Description, { className: "text-sm leading-5 text-muted-foreground" }),
53
- e.actionProps ? /* @__PURE__ */ s(o.Action, { className: "mt-1 self-start text-sm font-semibold text-secondary hover:underline" }) : null
54
- ] }),
55
- /* @__PURE__ */ s(
56
- o.Close,
85
+ /* @__PURE__ */ o(
86
+ "div",
87
+ {
88
+ "data-slot": "toast-icon",
89
+ className: "flex shrink-0 items-start px-[var(--ui-toast-global-icon-padding-x)] py-[var(--ui-toast-global-icon-padding-y)] [&_svg]:size-[var(--ui-toast-global-icon-size)] [&_svg]:shrink-0",
90
+ children: n.type === "loading" ? /* @__PURE__ */ o(
91
+ I,
92
+ {
93
+ size: "sm",
94
+ className: "size-[var(--ui-toast-global-icon-size)]"
95
+ }
96
+ ) : /* @__PURE__ */ o(l, { size: 16 })
97
+ }
98
+ ),
99
+ /* @__PURE__ */ u(
100
+ "div",
101
+ {
102
+ "data-slot": "toast-content",
103
+ className: "flex min-w-0 flex-1 flex-col items-start gap-[var(--ui-toast-global-content-gap)] px-[var(--ui-toast-global-content-padding-x)] py-[var(--ui-toast-global-content-padding-y)]",
104
+ children: [
105
+ /* @__PURE__ */ u(
106
+ "div",
107
+ {
108
+ "data-slot": "toast-text",
109
+ className: "flex w-full shrink-0 flex-col items-start gap-[var(--ui-toast-global-content-text-container-gap)] px-[var(--ui-toast-global-content-text-container-padding-x)] py-[var(--ui-toast-global-content-text-container-padding-y)] [word-break:break-word]",
110
+ children: [
111
+ /* @__PURE__ */ o(
112
+ r.Title,
113
+ {
114
+ "data-slot": "toast-title",
115
+ render: /* @__PURE__ */ o("h5", {}),
116
+ className: "ui-toast-global-content-text-container-title-text-style mb-0 w-full text-[var(--ui-toast-global-content-text-container-title-color)]"
117
+ }
118
+ ),
119
+ n.description ? /* @__PURE__ */ o(
120
+ r.Description,
121
+ {
122
+ "data-slot": "toast-description",
123
+ className: "ui-toast-global-content-text-container-description-text-style line-clamp-3 w-full text-[var(--ui-toast-global-content-text-container-description-color)]"
124
+ }
125
+ ) : null
126
+ ]
127
+ }
128
+ ),
129
+ e != null && e.length ? /* @__PURE__ */ o(
130
+ "div",
131
+ {
132
+ "data-slot": "toast-actions",
133
+ className: "flex w-full shrink-0 flex-wrap content-start items-start gap-x-[var(--ui-toast-global-content-actions-container-gap-x)] gap-y-[var(--ui-toast-global-content-actions-container-gap-y)] px-[var(--ui-toast-global-content-actions-container-padding-x)] py-[var(--ui-toast-global-content-actions-container-padding-y)]",
134
+ children: e.map((g, f) => /* @__PURE__ */ o(
135
+ k,
136
+ {
137
+ variant: g.variant ?? (f === 0 ? "secondary" : "ghost"),
138
+ onClick: g.onClick,
139
+ children: g.label
140
+ },
141
+ f
142
+ ))
143
+ }
144
+ ) : null
145
+ ]
146
+ }
147
+ ),
148
+ c ? /* @__PURE__ */ o(
149
+ r.Close,
57
150
  {
58
- "aria-label": "Close",
59
- className: "shrink-0 rounded text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ui-focus-primary)]",
60
- children: /* @__PURE__ */ s(d, { className: "size-4" })
151
+ "aria-label": t,
152
+ "data-slot": "toast-close",
153
+ render: /* @__PURE__ */ o(z, { variant: "ghost", children: /* @__PURE__ */ o(m, {}) })
61
154
  }
62
- )
155
+ ) : null
63
156
  ]
64
157
  },
65
- e.id
158
+ n.id
66
159
  );
67
160
  });
68
161
  }
69
- function k({ timeout: t, limit: e, portalContainer: n }) {
70
- const r = p(), l = n ?? r;
71
- return /* @__PURE__ */ s(
72
- o.Provider,
162
+ function L({
163
+ timeout: t,
164
+ limit: a,
165
+ label: n = "Notifications",
166
+ closeAriaLabel: i = "Close",
167
+ portalContainer: l
168
+ }) {
169
+ const e = T(), c = l ?? e;
170
+ return /* @__PURE__ */ o(
171
+ r.Provider,
73
172
  {
74
- toastManager: i,
173
+ toastManager: d,
75
174
  timeout: t,
76
- limit: e,
77
- children: /* @__PURE__ */ s(o.Portal, { container: l, children: /* @__PURE__ */ s(o.Viewport, { className: "fixed bottom-4 end-4 z-[100] flex w-[384px] max-w-[calc(100vw-2rem)] flex-col gap-3 outline-none", children: /* @__PURE__ */ s(b, {}) }) })
175
+ limit: a,
176
+ children: /* @__PURE__ */ o(r.Portal, { container: c, children: /* @__PURE__ */ o(
177
+ r.Viewport,
178
+ {
179
+ "aria-label": n,
180
+ className: "fixed bottom-4 end-4 z-[100] flex w-[var(--ui-toast-global-container-width-min)] max-w-[calc(100vw-2rem)] flex-col gap-3 outline-none",
181
+ children: /* @__PURE__ */ o(S, { closeAriaLabel: i })
182
+ }
183
+ ) })
78
184
  }
79
185
  );
80
186
  }
81
187
  export {
82
- k as Toaster,
83
- I as toast
188
+ L as Toaster,
189
+ G as toast,
190
+ _ as toastVariants
84
191
  };
85
192
  //# sourceMappingURL=toast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toast.js","sources":["../../../../src/components/ui/toast/toast.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Toast as ToastPrimitive } from '@base-ui/react/toast';\nimport {\n CircleCheckIcon,\n CircleInfoIcon,\n CircleTimesIcon,\n TimesIcon,\n TriangleWarningIcon,\n} from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\nimport { Spinner } from '../spinner';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `sonner`\n// (packages/ui-legacy/src/components/ui/sonner.tsx), which wrapped the Sonner\n// library. Rebuilt on the Base UI toast primitive (the ui-react convention), so\n// no Sonner dependency. The contract is preserved: drop a single `<Toaster />`\n// at the app root and call the imperative `toast(...)` / `toast.success(...)`\n// API from anywhere. No `--ui-toast-*` tier yet, so this design-pending v1 is a\n// neutral surface (bg-background + border-border + shadow) with the status\n// conveyed by a colored leading icon (`--ui-text-on-status-*`); per-status\n// surface tinting is design-pending. Auto-dismiss after `timeout` (default\n// 5000ms); `loading` toasts persist until updated or dismissed.\n\n// A module-level manager so `toast(...)` works outside React (like Sonner's\n// `toast`). `<Toaster />` subscribes this manager to its provider.\nconst toastManager = ToastPrimitive.createToastManager();\n\nexport type ToastType = 'success' | 'info' | 'warning' | 'error' | 'loading';\n\nexport interface ToastOptions {\n /** Secondary line under the title. */\n description?: React.ReactNode;\n /** Auto-dismiss delay in ms; `0` keeps the toast until dismissed. */\n timeout?: number;\n /** A single inline action button (e.g. Undo). */\n action?: { label: React.ReactNode; onClick?: () => void };\n /** Stable id — re-adding with the same id updates the toast in place. */\n id?: string;\n}\n\nfunction add(title: React.ReactNode, type?: ToastType, options: ToastOptions = {}) {\n const { action, ...rest } = options;\n return toastManager.add({\n title,\n type,\n actionProps: action\n ? { children: action.label, onClick: action.onClick }\n : undefined,\n ...rest,\n });\n}\n\n/**\n * Imperative toast API. `toast(title, options)` shows a neutral toast;\n * `toast.success` / `info` / `warning` / `error` / `loading` set the variant.\n * `toast.dismiss(id?)` closes one (or all) and `toast.promise` ties a toast to a\n * promise's lifecycle.\n */\nconst toast = Object.assign(\n (title: React.ReactNode, options?: ToastOptions) => add(title, undefined, options),\n {\n success: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'success', options),\n info: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'info', options),\n warning: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'warning', options),\n error: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'error', options),\n loading: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'loading', { timeout: 0, ...options }),\n dismiss: (id?: string) => toastManager.close(id),\n promise: toastManager.promise,\n }\n);\n\nconst ICON_BY_TYPE: Record<ToastType, React.ReactNode> = {\n success: (\n <CircleCheckIcon className=\"size-4 text-[var(--ui-text-on-status-success)]\" />\n ),\n info: (\n <CircleInfoIcon className=\"size-4 text-[var(--ui-text-on-status-info)]\" />\n ),\n warning: (\n <TriangleWarningIcon className=\"size-4 text-[var(--ui-text-on-status-warning)]\" />\n ),\n error: (\n <CircleTimesIcon className=\"size-4 text-[var(--ui-text-on-status-danger)]\" />\n ),\n loading: <Spinner size=\"sm\" className=\"size-4\" />,\n};\n\nfunction ToastList() {\n const { toasts } = ToastPrimitive.useToastManager();\n return toasts.map((item) => {\n const icon = ICON_BY_TYPE[item.type as ToastType];\n return (\n <ToastPrimitive.Root\n key={item.id}\n toast={item}\n className={cn(\n 'relative flex w-full items-start gap-3 rounded border border-border bg-background p-4 shadow-md',\n 'transition-all data-[ending-style]:opacity-0 data-[starting-style]:opacity-0',\n 'data-[starting-style]:translate-x-4 data-[ending-style]:translate-x-4'\n )}\n >\n {icon ? <span className=\"mt-0.5 shrink-0\">{icon}</span> : null}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <ToastPrimitive.Title className=\"text-sm font-semibold leading-5 text-foreground\" />\n <ToastPrimitive.Description className=\"text-sm leading-5 text-muted-foreground\" />\n {item.actionProps ? (\n <ToastPrimitive.Action className=\"mt-1 self-start text-sm font-semibold text-secondary hover:underline\" />\n ) : null}\n </div>\n <ToastPrimitive.Close\n aria-label=\"Close\"\n className=\"shrink-0 rounded text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ui-focus-primary)]\"\n >\n <TimesIcon className=\"size-4\" />\n </ToastPrimitive.Close>\n </ToastPrimitive.Root>\n );\n });\n}\n\nexport interface ToasterProps {\n /** Default auto-dismiss delay in ms for toasts that don't set one. */\n timeout?: number;\n /** Max toasts shown at once; the oldest is dropped past the limit. */\n limit?: number;\n /**\n * Portal container for the toast stack. Pass a shadow-root mount for\n * isolated-style previews (the docs demos do this via `useShadowMount`).\n */\n portalContainer?: ToastPrimitive.Portal.Props['container'];\n}\n\n/**\n * The toast region. Render once near the app root; it portals a bottom-right\n * stack and renders every queued toast. Trigger toasts with the `toast` API.\n */\nfunction Toaster({ timeout, limit, portalContainer }: ToasterProps) {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n return (\n <ToastPrimitive.Provider\n toastManager={toastManager}\n timeout={timeout}\n limit={limit}\n >\n <ToastPrimitive.Portal container={resolvedContainer}>\n <ToastPrimitive.Viewport className=\"fixed bottom-4 end-4 z-[100] flex w-[384px] max-w-[calc(100vw-2rem)] flex-col gap-3 outline-none\">\n <ToastList />\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n </ToastPrimitive.Provider>\n );\n}\n\nexport { toast, Toaster };\n"],"names":["toastManager","ToastPrimitive","add","title","type","options","action","rest","toast","id","ICON_BY_TYPE","jsx","CircleCheckIcon","CircleInfoIcon","TriangleWarningIcon","CircleTimesIcon","Spinner","ToastList","toasts","item","icon","jsxs","cn","TimesIcon","Toaster","timeout","limit","portalContainer","ctxContainer","usePortalContainer","resolvedContainer"],"mappings":";;;;;;AA6BA,MAAMA,IAAeC,EAAe,mBAAA;AAepC,SAASC,EAAIC,GAAwBC,GAAkBC,IAAwB,CAAA,GAAI;AACjF,QAAM,EAAE,QAAAC,GAAQ,GAAGC,EAAA,IAASF;AAC5B,SAAOL,EAAa,IAAI;AAAA,IACtB,OAAAG;AAAA,IACA,MAAAC;AAAA,IACA,aAAaE,IACT,EAAE,UAAUA,EAAO,OAAO,SAASA,EAAO,QA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UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAGD,UAAA;AAAA,UAAAF,IAAO,gBAAAT,EAAC,QAAA,EAAK,WAAU,mBAAmB,aAAK,IAAU;AAAA,UAC1D,gBAAAU,EAAC,OAAA,EAAI,WAAU,sCACb,UAAA;AAAA,YAAA,gBAAAV,EAACV,EAAe,OAAf,EAAqB,WAAU,kDAAA,CAAkD;AAAA,YAClF,gBAAAU,EAACV,EAAe,aAAf,EAA2B,WAAU,0CAAA,CAA0C;AAAA,YAC/EkB,EAAK,cACJ,gBAAAR,EAACV,EAAe,QAAf,EAAsB,WAAU,wEAAuE,IACtG;AAAA,UAAA,GACN;AAAA,UACA,gBAAAU;AAAA,YAACV,EAAe;AAAA,YAAf;AAAA,cACC,cAAW;AAAA,cACX,WAAU;AAAA,cAEV,UAAA,gBAAAU,EAACY,GAAA,EAAU,WAAU,SAAA,CAAS;AAAA,YAAA;AAAA,UAAA;AAAA,QAChC;AAAA,MAAA;AAAA,MArBKJ,EAAK;AAAA,IAAA;AAAA,EAwBhB,CAAC;AACH;AAkBA,SAASK,EAAQ,EAAE,SAAAC,GAAS,OAAAC,GAAO,iBAAAC,KAAiC;AAClE,QAAMC,IAAeC,EAAA,GACfC,IAAoBH,KAAmBC;AAE7C,SACE,gBAAAjB;AAAA,IAACV,EAAe;AAAA,IAAf;AAAA,MACC,cAAAD;AAAA,MACA,SAAAyB;AAAA,MACA,OAAAC;AAAA,MAEA,UAAA,gBAAAf,EAACV,EAAe,QAAf,EAAsB,WAAW6B,GAChC,UAAA,gBAAAnB,EAACV,EAAe,UAAf,EAAwB,WAAU,oGACjC,UAAA,gBAAAU,EAACM,GAAA,CAAA,CAAU,GACb,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"toast.js","sources":["../../../../src/components/ui/toast/toast.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Toast as ToastPrimitive } from '@base-ui/react/toast';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { TimesIcon } from '@acronis-platform/icons-react/stroke-mono';\nimport {\n CircleCheckGreenIcon,\n CircleInfoBlueIcon,\n CircleWarningOrangeIcon,\n DiamondWarningRedIcon,\n TriangleWarningYellowIcon,\n type IconProps,\n} from '@acronis-platform/icons-react/stroke-multi';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\nimport { Button } from '../button';\nimport { ButtonIcon } from '../button-icon';\nimport { Spinner } from '../spinner';\n\n// Mirrors the Figma \"Toast\" component set (node 7421:126262), which is the Alert\n// banner plus a drop shadow: a *neutral* surface — not a status tint — with the\n// severity carried by a 1px border in the status color and a 6px status line down\n// the leading edge. Geometry, colors, and spacing all come from the dedicated\n// `--ui-toast-*` tier (imported in `src/styles/index.css`).\n//\n// The delivery mechanism is unchanged from the Sonner-compatible port: a single\n// `<Toaster />` at the app root plus the imperative `toast(...)` API, built on the\n// Base UI toast manager (no Sonner dependency). Only the rendered surface and the\n// variant vocabulary changed.\n//\n// The Figma's `hasDescription` / `hasActions` / `dismissable` booleans map onto\n// per-toast options rather than props, since there is no per-toast component to\n// take them: omitting `description` or `actions` drops those parts, and\n// `dismissable: false` drops the close control. `dismissable` also has to switch\n// off Base UI's swipe-to-dismiss, which is on by default — see the `Root` below.\n//\n// The status line is a `::before` pseudo-element rather than a DOM node: it is\n// never optional and never a slot, so a real element would only add markup for\n// consumers to get wrong. It is bled 1px outwards on three sides so it paints\n// *over* the border it sits on (matching the Figma, where the line covers the\n// leading border), and the root's clip rounds its square corners to the\n// container radius. `start-` keeps it on the leading edge under `dir=\"rtl\"`.\n//\n// `overflow-clip-margin: border-box` is load-bearing, not decoration. `overflow:\n// clip` alone clips at the *padding* box, which is exactly where the bleed has to\n// reach — and an absolutely positioned pseudo-element's containing block is that\n// same padding box — so the outward 1px gets shaved off and the line renders 5px\n// wide starting *inside* the border. Since the border and the line are different\n// tokens, that reads as two adjacent stripes rather than one 6px line. Moving the\n// clip edge out to the border box lets the bleed survive while still rounding the\n// corners.\n//\n// Typography comes from the Toast tier's own emitted classes rather than\n// hand-written utilities: one for the title (Inter Regular 18 / 24 — the same\n// treatment Alert's title uses) and one for the description (Inter Regular\n// 14 / 24). The title previously borrowed the semantic\n// `ui-typography-headings-lead` because the tier emitted no title class; it does\n// now, and the two resolve identically today. Only the *colors* are separate\n// token references.\n//\n// One deliberate deviation from the Figma: `container/widthMin` (384px) is applied\n// to the viewport, not to the card. A fixed-position stack with a 384px\n// `min-width` overflows a narrow phone viewport (min-width always beats\n// max-width), so the viewport owns the width and clamps it with `max-w`, and the\n// card just fills it.\nconst toastVariants = cva(\n 'relative flex w-full items-start overflow-clip [overflow-clip-margin:border-box] border-solid ' +\n 'gap-[var(--ui-toast-global-container-gap)] ' +\n 'px-[var(--ui-toast-global-container-padding-x)] py-[var(--ui-toast-global-container-padding-y)] ' +\n 'rounded-[var(--ui-toast-global-container-border-radius)] ' +\n 'border-[length:var(--ui-toast-global-container-border-width)] ' +\n 'bg-[var(--ui-toast-global-container-background)] ' +\n 'shadow-[var(--ui-toast-global-container-shadow)] ' +\n \"before:absolute before:content-[''] before:-inset-y-px before:start-[-1px] \" +\n 'before:w-[var(--ui-toast-global-container-status-width)]',\n {\n variants: {\n variant: {\n info: 'border-[color:var(--ui-toast-info-border-color)] before:bg-[var(--ui-toast-info-left-line)]',\n success:\n 'border-[color:var(--ui-toast-success-border-color)] before:bg-[var(--ui-toast-success-left-line)]',\n warning:\n 'border-[color:var(--ui-toast-warning-border-color)] before:bg-[var(--ui-toast-warning-left-line)]',\n critical:\n 'border-[color:var(--ui-toast-critical-border-color)] before:bg-[var(--ui-toast-critical-left-line)]',\n danger:\n 'border-[color:var(--ui-toast-danger-border-color)] before:bg-[var(--ui-toast-danger-left-line)]',\n },\n },\n defaultVariants: {\n variant: 'info',\n },\n }\n);\n\nexport type ToastVariant = NonNullable<\n VariantProps<typeof toastVariants>['variant']\n>;\n\n/**\n * A toast's kind. The five severities match the Figma variants; `loading` has no\n * Figma variant — it is the spinner state `toast.promise` needs.\n */\nexport type ToastType = ToastVariant | 'loading';\n\n// The Figma binds exactly one icon to each variant, and they are multicolor\n// (`stroke-multi`) glyphs that carry their own fills — so nothing here tints them.\nconst STATUS_ICON: Record<ToastVariant, React.ComponentType<IconProps>> = {\n info: CircleInfoBlueIcon,\n success: CircleCheckGreenIcon,\n warning: TriangleWarningYellowIcon,\n critical: CircleWarningOrangeIcon,\n danger: DiamondWarningRedIcon,\n};\n\n// Base UI's `promise` helper hardcodes `type: 'loading' | 'success' | 'error'`\n// *after* spreading the caller's options, so `'error'` reaches us even though the\n// public API only offers `toast.danger` — it has to resolve to the danger chrome.\n// `loading` has no Figma variant, so its spinner borrows info's border and status\n// line. Anything else (including a bare `toast(...)`) falls back to info, the\n// Figma's default variant.\nconst VARIANT_BY_TYPE: Record<string, ToastVariant> = {\n info: 'info',\n success: 'success',\n warning: 'warning',\n critical: 'critical',\n danger: 'danger',\n error: 'danger',\n loading: 'info',\n};\n\nexport interface ToastAction {\n /** The button's label. */\n label: React.ReactNode;\n /** Invoked on click. The toast is not dismissed automatically. */\n onClick?: () => void;\n /**\n * Button style. Defaults to `secondary` for the first action and `ghost` for\n * the rest, matching the Figma's button pairing.\n */\n variant?: 'secondary' | 'ghost';\n}\n\n/** Custom per-toast payload carried through the Base UI manager. */\ninterface ToastData {\n actions?: ToastAction[];\n dismissable?: boolean;\n}\n\n// A module-level manager so `toast(...)` works outside React (like Sonner's\n// `toast`). `<Toaster />` subscribes this manager to its provider.\n//\n// Module-level means it is a *per-package-instance* singleton, which matters in a\n// micro-frontend host. Two copies of this package — an MFE bundling its own, or\n// module federation without `singleton: true` — get two independent managers, and\n// then `toast(...)` called through one copy is invisible to the `<Toaster />`\n// rendered by the other: the toast is queued and simply never appears. Two\n// `<Toaster />`s also both pin to `bottom-4 end-4`, so they overlap in the same\n// corner, and `timeout` / `limit` are per-region props that drift independently.\n//\n// So: share one ui-react instance across MFEs and mount exactly one `<Toaster />`\n// for the page (typically in the shell). See apps/docs `shadow-dom.mdx` for the\n// MFE integration contract, and use `PortalContainerProvider` when the single\n// region has to render inside a shadow root.\nconst toastManager = ToastPrimitive.createToastManager<ToastData>();\n\nexport interface ToastOptions {\n /** Secondary line under the title; clamped to three lines. */\n description?: React.ReactNode;\n /** Auto-dismiss delay in ms; `0` keeps the toast until dismissed. */\n timeout?: number;\n /** Action buttons rendered in a wrapping row under the text. */\n actions?: ToastAction[];\n /**\n * Whether the toast shows its dismiss control and can be swiped away.\n * Defaults to `true`. A non-dismissable toast with `timeout: 0` can only be\n * removed with `toast.dismiss(id)`.\n */\n dismissable?: boolean;\n /** Stable id — re-adding with the same id updates the toast in place. */\n id?: string;\n}\n\nfunction add(title: React.ReactNode, type?: ToastType, options: ToastOptions = {}) {\n const { actions, dismissable, ...rest } = options;\n return toastManager.add({\n title,\n type,\n data: { actions, dismissable },\n ...rest,\n });\n}\n\n/**\n * Imperative toast API. `toast(title, options)` shows an info toast;\n * `toast.info` / `success` / `warning` / `critical` / `danger` set the severity\n * and `toast.loading` shows a persistent spinner. `toast.dismiss(id?)` closes one\n * (or all) and `toast.promise` ties a toast to a promise's lifecycle.\n */\nconst toast = Object.assign(\n (title: React.ReactNode, options?: ToastOptions) => add(title, undefined, options),\n {\n info: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'info', options),\n success: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'success', options),\n warning: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'warning', options),\n critical: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'critical', options),\n danger: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'danger', options),\n loading: (title: React.ReactNode, options?: ToastOptions) =>\n add(title, 'loading', { timeout: 0, ...options }),\n dismiss: (id?: string) => toastManager.close(id),\n promise: toastManager.promise,\n }\n);\n\nfunction ToastList({ closeAriaLabel }: { closeAriaLabel: string }) {\n const { toasts } = ToastPrimitive.useToastManager<ToastData>();\n return toasts.map((item) => {\n const variant = VARIANT_BY_TYPE[item.type ?? ''] ?? 'info';\n const StatusIcon = STATUS_ICON[variant];\n const actions = item.data?.actions;\n const dismissable = item.data?.dismissable ?? true;\n return (\n <ToastPrimitive.Root\n key={item.id}\n toast={item}\n data-slot=\"toast\"\n data-variant={variant}\n // Base UI enables swipe-to-dismiss by default (`['down', 'right']`), so\n // a non-dismissable toast has to opt out of it too — otherwise hiding\n // the close button would only hide the *control*, not the capability.\n swipeDirection={dismissable ? undefined : []}\n className={cn(\n toastVariants({ variant }),\n 'transition-all data-[ending-style]:opacity-0 data-[starting-style]:opacity-0',\n // The stack sits on the inline-end edge, so a toast slides in from the\n // right in LTR and from the left in RTL.\n 'data-[ending-style]:translate-x-4 data-[starting-style]:translate-x-4',\n 'rtl:data-[ending-style]:-translate-x-4 rtl:data-[starting-style]:-translate-x-4'\n )}\n >\n {/* The icon box's padding (4/8) is what optically aligns the 16px glyph\n with the first line of the title: glyph centre 8 + 8 = 16, title\n centre (the text block's 4px padding) 4 + 12 = 16. */}\n <div\n data-slot=\"toast-icon\"\n className=\"flex shrink-0 items-start px-[var(--ui-toast-global-icon-padding-x)] py-[var(--ui-toast-global-icon-padding-y)] [&_svg]:size-[var(--ui-toast-global-icon-size)] [&_svg]:shrink-0\"\n >\n {item.type === 'loading' ? (\n <Spinner\n size=\"sm\"\n className=\"size-[var(--ui-toast-global-icon-size)]\"\n />\n ) : (\n <StatusIcon size={16} />\n )}\n </div>\n <div\n data-slot=\"toast-content\"\n className=\"flex min-w-0 flex-1 flex-col items-start gap-[var(--ui-toast-global-content-gap)] px-[var(--ui-toast-global-content-padding-x)] py-[var(--ui-toast-global-content-padding-y)]\"\n >\n <div\n data-slot=\"toast-text\"\n className=\"flex w-full shrink-0 flex-col items-start gap-[var(--ui-toast-global-content-text-container-gap)] px-[var(--ui-toast-global-content-text-container-padding-x)] py-[var(--ui-toast-global-content-text-container-padding-y)] [word-break:break-word]\"\n >\n <ToastPrimitive.Title\n data-slot=\"toast-title\"\n // `h5` overrides Base UI's `h2` default to match Alert — a toast\n // is not a page-level heading.\n render={<h5 />}\n className=\"ui-toast-global-content-text-container-title-text-style mb-0 w-full text-[var(--ui-toast-global-content-text-container-title-color)]\"\n />\n {item.description ? (\n <ToastPrimitive.Description\n data-slot=\"toast-description\"\n className=\"ui-toast-global-content-text-container-description-text-style line-clamp-3 w-full text-[var(--ui-toast-global-content-text-container-description-color)]\"\n />\n ) : null}\n </div>\n {actions?.length ? (\n <div\n data-slot=\"toast-actions\"\n className=\"flex w-full shrink-0 flex-wrap content-start items-start gap-x-[var(--ui-toast-global-content-actions-container-gap-x)] gap-y-[var(--ui-toast-global-content-actions-container-gap-y)] px-[var(--ui-toast-global-content-actions-container-padding-x)] py-[var(--ui-toast-global-content-actions-container-padding-y)]\"\n >\n {actions.map((action, index) => (\n <Button\n key={index}\n variant={action.variant ?? (index === 0 ? 'secondary' : 'ghost')}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n ))}\n </div>\n ) : null}\n </div>\n {dismissable ? (\n <ToastPrimitive.Close\n aria-label={closeAriaLabel}\n data-slot=\"toast-close\"\n render={\n <ButtonIcon variant=\"ghost\">\n <TimesIcon />\n </ButtonIcon>\n }\n />\n ) : null}\n </ToastPrimitive.Root>\n );\n });\n}\n\nexport interface ToasterProps {\n /** Default auto-dismiss delay in ms for toasts that don't set one. */\n timeout?: number;\n /** Max toasts shown at once; the oldest is dropped past the limit. */\n limit?: number;\n /** Accessible name for the toast region. */\n label?: string;\n /** Accessible name for each toast's dismiss control. */\n closeAriaLabel?: string;\n /**\n * Portal container for the toast stack. Pass a shadow-root mount for\n * isolated-style previews (the docs demos do this via `useShadowMount`).\n */\n portalContainer?: ToastPrimitive.Portal.Props['container'];\n}\n\n/**\n * The toast region. Render once near the app root; it portals a bottom-end stack\n * and renders every queued toast. Trigger toasts with the `toast` API.\n */\nfunction Toaster({\n timeout,\n limit,\n label = 'Notifications',\n closeAriaLabel = 'Close',\n portalContainer,\n}: ToasterProps) {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n return (\n <ToastPrimitive.Provider\n toastManager={toastManager}\n timeout={timeout}\n limit={limit}\n >\n <ToastPrimitive.Portal container={resolvedContainer}>\n <ToastPrimitive.Viewport\n aria-label={label}\n className=\"fixed bottom-4 end-4 z-[100] flex w-[var(--ui-toast-global-container-width-min)] max-w-[calc(100vw-2rem)] flex-col gap-3 outline-none\"\n >\n <ToastList closeAriaLabel={closeAriaLabel} />\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n </ToastPrimitive.Provider>\n );\n}\n\nexport { toast, Toaster, toastVariants };\n"],"names":["toastVariants","cva","STATUS_ICON","CircleInfoBlueIcon","CircleCheckGreenIcon","TriangleWarningYellowIcon","CircleWarningOrangeIcon","DiamondWarningRedIcon","VARIANT_BY_TYPE","toastManager","ToastPrimitive","add","title","type","options","actions","dismissable","rest","toast","id","ToastList","closeAriaLabel","toasts","item","variant","StatusIcon","_a","_b","jsxs","cn","jsx","Spinner","action","index","Button","ButtonIcon","TimesIcon","Toaster","timeout","limit","label","portalContainer","ctxContainer","usePortalContainer","resolvedContainer"],"mappings":";;;;;;;;;;AAmEA,MAAMA,IAAgBC;AAAA,EACpB;AAAA,EASA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,MAAM;AAAA,QACN,SACE;AAAA,QACF,SACE;AAAA,QACF,UACE;AAAA,QACF,QACE;AAAA,MAAA;AAAA,IACJ;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ,GAcMC,IAAoE;AAAA,EACxE,MAAMC;AAAA,EACN,SAASC;AAAA,EACT,SAASC;AAAA,EACT,UAAUC;AAAA,EACV,QAAQC;AACV,GAQMC,IAAgD;AAAA,EACpD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,OAAO;AA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: l, ellipsis: i = "…" }) {
2
+ if (c <= 0) return "";
3
+ if (l(n) <= c) return n;
4
+ if (l(i) > c) return "";
5
+ const f = (r) => {
6
+ if (r <= 0) return i;
7
+ const t = Math.ceil(r / 2), h = r - t;
8
+ return h > 0 ? `${n.slice(0, t)}${i}${n.slice(n.length - h)}` : `${n.slice(0, t)}${i}`;
9
+ };
10
+ let e = 0, o = n.length;
11
+ for (; o - e > 1; ) {
12
+ const r = Math.floor((e + o) / 2);
13
+ l(f(r)) <= c ? e = r : o = r;
14
+ }
15
+ return f(e);
16
+ }
17
+ export {
18
+ u as middleTruncate
19
+ };
20
+ //# sourceMappingURL=middle-truncate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middle-truncate.js","sources":["../../../../src/components/ui/truncate-text/middle-truncate.ts"],"sourcesContent":["// The pure search behind `<TruncateText mode=\"middle\">`: given a string, a pixel budget, and a\n// way to measure a candidate's rendered width, find the longest start+end slice\n// (joined by an ellipsis) that still fits — preserving both ends of the string\n// rather than just the start, which is what a plain CSS end-ellipsis already does\n// and is useless for a URL, hash or path whose distinguishing part is at the tail.\n//\n// Binary search over \"how many non-ellipsis characters to keep\", not over the split\n// point between start/end — the split is always the same proportion (kept chars\n// divided evenly, the extra one going to the start on an odd count), so there is\n// exactly one candidate per kept-count and `measure` is called O(log n) times\n// rather than O(n). `measure` is injected rather than hard-coded to\n// `canvas.measureText` specifically so this file has no DOM dependency: the real\n// component supplies a canvas-backed measurer (see `truncate-text.tsx`), and\n// these tests supply a deterministic fake — jsdom has no layout engine, so a test\n// asserting real pixel widths would need the browser project for no benefit here,\n// the search logic does not care what \"width\" means.\n\nexport interface MiddleTruncateOptions {\n /** Returns the rendered width of `candidate`, in the same unit as `maxWidth`. */\n readonly measure: (candidate: string) => number;\n /** Inserted between the kept start and end slices. Defaults to `'…'`. */\n readonly ellipsis?: string;\n}\n\n/**\n * Returns `text` unchanged if it already fits `maxWidth`, otherwise the widest\n * start+ellipsis+end slice that does. Never returns something wider than\n * `maxWidth`, even when nothing meaningful fits — the degenerate result is the\n * bare ellipsis, or `''` if `maxWidth` cannot fit that either.\n */\nexport function middleTruncate(\n text: string,\n maxWidth: number,\n { measure, ellipsis = '…' }: MiddleTruncateOptions\n): string {\n if (maxWidth <= 0) return '';\n if (measure(text) <= maxWidth) return text;\n\n const ellipsisWidth = measure(ellipsis);\n if (ellipsisWidth > maxWidth) return '';\n\n const candidateFor = (kept: number): string => {\n if (kept <= 0) return ellipsis;\n const startLen = Math.ceil(kept / 2);\n const endLen = kept - startLen;\n return endLen > 0\n ? `${text.slice(0, startLen)}${ellipsis}${text.slice(text.length - endLen)}`\n : `${text.slice(0, startLen)}${ellipsis}`;\n };\n\n // Invariant: `low` is always a kept-count that fits (0 does, by the ellipsis\n // check above); `high` is always one that does not (`text.length` does not, by\n // the \"already fits\" check above). The loop halves the gap until they meet,\n // so `low` ends on the largest fitting count.\n let low = 0;\n let high = text.length;\n while (high - low > 1) {\n const mid = Math.floor((low + high) / 2);\n if (measure(candidateFor(mid)) <= maxWidth) {\n low = mid;\n } else {\n high = mid;\n }\n }\n return candidateFor(low);\n}\n"],"names":["middleTruncate","text","maxWidth","measure","ellipsis","candidateFor","kept","startLen","endLen","low","high","mid"],"mappings":"AA8BO,SAASA,EACdC,GACAC,GACA,EAAE,SAAAC,GAAS,UAAAC,IAAW,OACd;AACR,MAAIF,KAAY,EAAG,QAAO;AAC1B,MAAIC,EAAQF,CAAI,KAAKC,EAAU,QAAOD;AAGtC,MADsBE,EAAQC,CAAQ,IAClBF,EAAU,QAAO;AAErC,QAAMG,IAAe,CAACC,MAAyB;AAC7C,QAAIA,KAAQ,EAAG,QAAOF;AACtB,UAAMG,IAAW,KAAK,KAAKD,IAAO,CAAC,GAC7BE,IAASF,IAAOC;AACtB,WAAOC,IAAS,IACZ,GAAGP,EAAK,MAAM,GAAGM,CAAQ,CAAC,GAAGH,CAAQ,GAAGH,EAAK,MAAMA,EAAK,SAASO,CAAM,CAAC,KACxE,GAAGP,EAAK,MAAM,GAAGM,CAAQ,CAAC,GAAGH,CAAQ;AAAA,EAC3C;AAMA,MAAIK,IAAM,GACNC,IAAOT,EAAK;AAChB,SAAOS,IAAOD,IAAM,KAAG;AACrB,UAAME,IAAM,KAAK,OAAOF,IAAMC,KAAQ,CAAC;AACvC,IAAIP,EAAQE,EAAaM,CAAG,CAAC,KAAKT,IAChCO,IAAME,IAEND,IAAOC;AAAA,EAEX;AACA,SAAON,EAAaI,CAAG;AACzB;"}
@@ -0,0 +1,12 @@
1
+ let e;
2
+ function o() {
3
+ return e === void 0 && (e = document.createElement("canvas").getContext("2d")), e;
4
+ }
5
+ function u(n, r) {
6
+ const t = o();
7
+ return t === null ? n.length * 8 : (t.font = r, t.measureText(n).width);
8
+ }
9
+ export {
10
+ u as measureTextWidth
11
+ };
12
+ //# sourceMappingURL=text-width.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-width.js","sources":["../../../../src/components/ui/truncate-text/text-width.ts"],"sourcesContent":["// A single offscreen canvas, reused across every `<TruncateText mode=\"middle\">` instance and\n// every candidate it measures. `canvas.measureText` is O(1) per call — no layout,\n// no reflow — which is why `middleTruncate`'s binary search calls `measure` a\n// handful of times per resize without it being a performance concern the way a\n// DOM-clone measurement (render, read `offsetWidth`, repeat per candidate) would\n// be for a search space the size of a whole string.\nlet sharedContext: CanvasRenderingContext2D | null | undefined;\n\nfunction getSharedContext(): CanvasRenderingContext2D | null {\n if (sharedContext === undefined) {\n sharedContext = document.createElement('canvas').getContext('2d');\n }\n return sharedContext;\n}\n\n/**\n * The rendered width of `text` in `font` (a CSS `font` shorthand string, e.g. from\n * `getComputedStyle(el).font`), in CSS pixels.\n *\n * Falls back to a fixed per-character estimate when `canvas` 2D contexts are\n * unavailable (jsdom's default; the real component is exercised by the browser\n * test project instead) — a rough width is enough to keep the search from\n * throwing, and nothing in the unit project renders far enough to compare it\n * against a pixel budget.\n */\nexport function measureTextWidth(text: string, font: string): number {\n const context = getSharedContext();\n if (context === null) return text.length * 8;\n context.font = font;\n return context.measureText(text).width;\n}\n"],"names":["sharedContext","getSharedContext","measureTextWidth","text","font","context"],"mappings":"AAMA,IAAIA;AAEJ,SAASC,IAAoD;AAC3D,SAAID,MAAkB,WACpBA,IAAgB,SAAS,cAAc,QAAQ,EAAE,WAAW,IAAI,IAE3DA;AACT;AAYO,SAASE,EAAiBC,GAAcC,GAAsB;AACnE,QAAMC,IAAUJ,EAAA;AAChB,SAAII,MAAY,OAAaF,EAAK,SAAS,KAC3CE,EAAQ,OAAOD,GACRC,EAAQ,YAAYF,CAAI,EAAE;AACnC;"}
@@ -0,0 +1,152 @@
1
+ import { jsx as l, jsxs as k } from "react/jsx-runtime";
2
+ import * as n from "react";
3
+ import { cn as x } from "../../../lib/utils.js";
4
+ import { middleTruncate as C } from "./middle-truncate.js";
5
+ import { measureTextWidth as E } from "./text-width.js";
6
+ import { Tooltip as W, TooltipTrigger as g, TooltipContent as S } from "../tooltip/tooltip.js";
7
+ const R = n.forwardRef(
8
+ function({ children: e, mode: f = "end", className: s, side: a = "top", lines: o = 1, defaultOpen: c, portalContainer: r }, u) {
9
+ return f === "middle" ? /* @__PURE__ */ l(
10
+ z,
11
+ {
12
+ ref: u,
13
+ text: e,
14
+ side: a,
15
+ portalContainer: r,
16
+ className: s
17
+ }
18
+ ) : /* @__PURE__ */ l(
19
+ O,
20
+ {
21
+ ref: u,
22
+ text: e,
23
+ side: a,
24
+ lines: o,
25
+ defaultOpen: c,
26
+ portalContainer: r,
27
+ className: s
28
+ }
29
+ );
30
+ }
31
+ ), O = n.forwardRef(
32
+ function({ text: e, side: f, lines: s, defaultOpen: a, portalContainer: o, className: c }, r) {
33
+ const u = n.useRef(null), [d, v] = n.useState(!1), m = n.useCallback(
34
+ (t) => {
35
+ u.current = t, typeof r == "function" ? r(t) : r && (r.current = t);
36
+ },
37
+ [r]
38
+ );
39
+ n.useLayoutEffect(() => {
40
+ const t = u.current;
41
+ if (!t) return;
42
+ const p = () => v(
43
+ s > 1 ? t.scrollHeight > t.clientHeight + 1 : t.scrollWidth > t.clientWidth + 1
44
+ );
45
+ p();
46
+ const b = new ResizeObserver(p);
47
+ return b.observe(t), () => b.disconnect();
48
+ }, [e, s, d]);
49
+ const T = s > 1, h = T ? {
50
+ display: "-webkit-box",
51
+ WebkitLineClamp: s,
52
+ WebkitBoxOrient: "vertical",
53
+ overflow: "hidden"
54
+ } : void 0, i = /* @__PURE__ */ l(
55
+ "span",
56
+ {
57
+ ref: m,
58
+ className: x("block", T ? "overflow-hidden" : "truncate", c),
59
+ style: h,
60
+ children: e
61
+ }
62
+ );
63
+ return d ? /* @__PURE__ */ k(W, { defaultOpen: a, children: [
64
+ /* @__PURE__ */ l(g, { render: i }),
65
+ /* @__PURE__ */ l(S, { side: f, portalContainer: o, children: e })
66
+ ] }) : i;
67
+ }
68
+ ), z = n.forwardRef(
69
+ function({ text: e, side: f, portalContainer: s, className: a }, o) {
70
+ const [c, r] = n.useState(null), [u, d] = n.useState(e), [v, m] = n.useState(!1), T = n.useCallback(
71
+ (i) => {
72
+ r(i), typeof o == "function" ? o(i) : o && (o.current = i);
73
+ },
74
+ [o]
75
+ );
76
+ n.useLayoutEffect(() => {
77
+ if (m(!1), c === null || typeof ResizeObserver > "u") {
78
+ d(e);
79
+ return;
80
+ }
81
+ const i = () => {
82
+ const p = c.clientWidth;
83
+ if (p === 0) return;
84
+ const b = getComputedStyle(c).font;
85
+ d(
86
+ C(e, p, {
87
+ measure: (w) => E(w, b)
88
+ })
89
+ ), m(!0);
90
+ };
91
+ i();
92
+ const t = new ResizeObserver(i);
93
+ return t.observe(c), () => t.disconnect();
94
+ }, [c, e]);
95
+ const h = /* @__PURE__ */ l(
96
+ "span",
97
+ {
98
+ ref: T,
99
+ className: x(
100
+ // `flex-1` (`flex: 1 1 0%`) only takes effect when the parent this
101
+ // renders into happens to itself be a flex container — inert
102
+ // otherwise, so it's safe alongside `block`. It's not decorative:
103
+ // without it, a `display: block` element with no explicit width
104
+ // only *auto-fills a plain block parent* — the browser's default
105
+ // "fill available width" rule for `width: auto` is specific to
106
+ // block layout. Nested inside a flex parent (a caller's own cell
107
+ // wrapping this next to an icon button, say), the same element
108
+ // becomes a flex item instead, where `flex-basis: auto` means
109
+ // "size to your own content" — and this component's own content
110
+ // is whatever it truncated itself to *last* time. Once shrunk, it
111
+ // would then measure its own shrunken self forever, growing back
112
+ // only if some ancestor's width changed enough to force a reflow
113
+ // for an unrelated reason — not when the column actually had more
114
+ // room to give it all along.
115
+ "block min-w-0 flex-1",
116
+ // Nowrap + clip only once `measured` — *before* that, this is the
117
+ // string's first-ever render, and if it already clips and refuses to
118
+ // wrap, it dictates its own column's width to `table-layout: auto`
119
+ // before `ResizeObserver` ever gets a turn: nowrap makes an unbroken
120
+ // string's min-content the string's *entire* rendered width, so the
121
+ // browser hands the column exactly that much room — measuring
122
+ // `clientWidth` after the fact just reads back the width this same
123
+ // element inflated the column to, not the width some other column
124
+ // needed and this one gave up.
125
+ //
126
+ // Left at the browser's own default on the unmeasured pass rather than
127
+ // forced to `overflow-wrap: anywhere` — tried that first, and it
128
+ // overcorrects: telling `auto`-layout this column's min-content is a
129
+ // single character makes it treat the column as free to take almost
130
+ // nothing, starving it in favor of siblings with a normal (space- and
131
+ // punctuation-driven) min-content. The browser's own line-breaking
132
+ // already finds break opportunities in a URL — after `/`, around `?`,
133
+ // `=`, `_` — without being told everything is breakable, which is
134
+ // exactly the multi-line wrap this component exists to replace: worse
135
+ // than what `nowrap` would give it, but a real, usable column width to
136
+ // hand to the first `ResizeObserver` measurement, not a starved one.
137
+ v && "overflow-hidden whitespace-nowrap",
138
+ a
139
+ ),
140
+ children: u
141
+ }
142
+ );
143
+ return u === e ? h : /* @__PURE__ */ k(W, { children: [
144
+ /* @__PURE__ */ l(g, { render: h }),
145
+ /* @__PURE__ */ l(S, { side: f, portalContainer: s, children: e })
146
+ ] });
147
+ }
148
+ );
149
+ export {
150
+ R as TruncateText
151
+ };
152
+ //# sourceMappingURL=truncate-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"truncate-text.js","sources":["../../../../src/components/ui/truncate-text/truncate-text.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '@/lib/utils';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';\n\nimport { middleTruncate } from './middle-truncate';\nimport { measureTextWidth } from './text-width';\n\ntype TooltipContentProps = React.ComponentProps<typeof TooltipContent>;\n\nexport interface TruncateTextProps {\n /** The text to display. Also used verbatim as the tooltip body when truncated. */\n children: string;\n /**\n * Where the ellipsis goes. `'end'` (default) is the familiar CSS\n * `text-overflow: ellipsis` — reach for `'middle'` when the distinguishing\n * part of the value is at the tail (a URL, a hash) rather than the start.\n */\n mode?: 'middle' | 'end';\n /** Which side the tooltip opens on. Defaults to `top`. */\n side?: 'top' | 'bottom' | 'left' | 'right';\n /**\n * Max lines before truncating, in `'end'` mode only: `1` (default) =\n * single-line ellipsis; `>1` = a multi-line clamp. Ignored in `'middle'`\n * mode, which is inherently single-line.\n */\n lines?: number;\n /**\n * Force the tooltip open on mount (only has effect when the text is truncated).\n * Mainly for stories / visual review; normal usage reveals it on hover/focus.\n */\n defaultOpen?: boolean;\n /**\n * Container the tooltip popup portals into. Pass a shadow root (e.g. a\n * micro-frontend mount point) so the popup inherits the kit's styles; defaults\n * to the document body.\n */\n portalContainer?: TooltipContentProps['portalContainer'];\n /** Merged onto the rendered `<span>`. */\n className?: string;\n}\n\n/**\n * Text that truncates with an ellipsis and reveals its full value in a tooltip\n * **only when it's actually clipped** — the tooltip is skipped when everything\n * fits, so short cells don't get a pointless hover target. Ideal for table cells.\n *\n * `'end'`-mode truncation is detected by comparing scroll vs client size and\n * re-checked on resize; `'middle'`-mode measures a real font metric via canvas\n * (there is no native CSS middle-ellipsis) and re-measures the same way.\n */\nexport const TruncateText = React.forwardRef<HTMLSpanElement, TruncateTextProps>(\n function TruncateText(\n { children, mode = 'end', className, side = 'top', lines = 1, defaultOpen, portalContainer },\n forwardedRef\n ) {\n if (mode === 'middle') {\n return (\n <TruncateTextMiddle\n ref={forwardedRef}\n text={children}\n side={side}\n portalContainer={portalContainer}\n className={className}\n />\n );\n }\n\n return (\n <TruncateTextEnd\n ref={forwardedRef}\n text={children}\n side={side}\n lines={lines}\n defaultOpen={defaultOpen}\n portalContainer={portalContainer}\n className={className}\n />\n );\n }\n);\n\ninterface TruncateTextEndProps {\n text: string;\n side: 'top' | 'bottom' | 'left' | 'right';\n lines: number;\n defaultOpen: boolean | undefined;\n portalContainer: TooltipContentProps['portalContainer'];\n className: string | undefined;\n}\n\n/** The CSS end-ellipsis / multi-line-clamp half of `TruncateText`. */\nconst TruncateTextEnd = React.forwardRef<HTMLSpanElement, TruncateTextEndProps>(\n function TruncateTextEnd(\n { text, side, lines, defaultOpen, portalContainer, className },\n forwardedRef\n ) {\n const innerRef = React.useRef<HTMLSpanElement | null>(null);\n const [truncated, setTruncated] = React.useState(false);\n\n // The component owns a ref for overflow measurement; still forward it so\n // callers can reach the underlying span.\n const setRef = React.useCallback(\n (node: HTMLSpanElement | null) => {\n innerRef.current = node;\n if (typeof forwardedRef === 'function') forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef]\n );\n\n React.useLayoutEffect(() => {\n const node = innerRef.current;\n if (!node) return;\n // +1 guards against sub-pixel rounding falsely reporting overflow.\n // Genuine DOM-measuring layout effect: overflow can only be read after\n // layout, so the sync setState here is required, not incidental.\n const check = () =>\n setTruncated(\n lines > 1\n ? node.scrollHeight > node.clientHeight + 1\n : node.scrollWidth > node.clientWidth + 1\n );\n check();\n const observer = new ResizeObserver(check);\n observer.observe(node);\n return () => observer.disconnect();\n // `truncated` is a dep so the observer re-attaches to the span after it moves\n // into / out of the tooltip trigger on the truncation flip.\n }, [text, lines, truncated]);\n\n const multiline = lines > 1;\n const style: React.CSSProperties | undefined = multiline\n ? {\n display: '-webkit-box',\n WebkitLineClamp: lines,\n WebkitBoxOrient: 'vertical',\n overflow: 'hidden',\n }\n : undefined;\n\n const span = (\n <span\n ref={setRef}\n className={cn('block', multiline ? 'overflow-hidden' : 'truncate', className)}\n style={style}\n >\n {text}\n </span>\n );\n\n if (!truncated) return span;\n\n return (\n <Tooltip defaultOpen={defaultOpen}>\n <TooltipTrigger render={span} />\n <TooltipContent side={side} portalContainer={portalContainer}>\n {text}\n </TooltipContent>\n </Tooltip>\n );\n }\n);\n\ninterface TruncateTextMiddleProps {\n text: string;\n side: 'top' | 'bottom' | 'left' | 'right';\n portalContainer: TooltipContentProps['portalContainer'];\n className: string | undefined;\n}\n\n/**\n * The middle-ellipsis half of `TruncateText`. Sizes to the container, not the\n * other way around — it needs no `size`/`maxSize` on a column or wrapper to\n * have something to truncate against: it measures whatever width it is\n * actually rendered at, however that width was arrived at, and re-measures\n * via `ResizeObserver` if it changes.\n */\nconst TruncateTextMiddle = React.forwardRef<HTMLSpanElement, TruncateTextMiddleProps>(\n function TruncateTextMiddle({ text, side, portalContainer, className }, forwardedRef) {\n const [node, setNode] = React.useState<HTMLSpanElement | null>(null);\n const [display, setDisplay] = React.useState(text);\n // Distinct from `display !== text`: that's also true before the first\n // measurement (the initial state is the untruncated `text`), and this needs\n // to tell \"genuinely fits, confirmed by measuring\" apart from \"haven't\n // measured yet\" — see the class-name comment below for why they can't share\n // one flag.\n const [measured, setMeasured] = React.useState(false);\n\n const setRefs = React.useCallback(\n (element: HTMLSpanElement | null) => {\n setNode(element);\n if (typeof forwardedRef === 'function') forwardedRef(element);\n else if (forwardedRef) forwardedRef.current = element;\n },\n [forwardedRef]\n );\n\n // Depends on `node`, not just `text` — the trigger/no-trigger branch below\n // swaps this span between being `<Tooltip>`'s child and being the whole\n // return value, which are different positions in the tree, so React remounts\n // it (a new DOM node) rather than reusing the old one. A `[text]`-only effect\n // would keep observing the now-detached old node and never see the\n // replacement, silently going stale the moment truncation state flips.\n React.useLayoutEffect(() => {\n setMeasured(false);\n if (node === null || typeof ResizeObserver === 'undefined') {\n setDisplay(text);\n return;\n }\n\n const recompute = () => {\n const width = node.clientWidth;\n // 0 during the node's first layout tick (or while a hidden ancestor is\n // still collapsed) — skip rather than truncate against a width that\n // isn't real yet; the observer fires again once it settles.\n if (width === 0) return;\n const font = getComputedStyle(node).font;\n setDisplay(\n middleTruncate(text, width, {\n measure: (candidate) => measureTextWidth(candidate, font),\n })\n );\n setMeasured(true);\n };\n\n recompute();\n const observer = new ResizeObserver(recompute);\n observer.observe(node);\n return () => observer.disconnect();\n }, [node, text]);\n\n const span = (\n <span\n ref={setRefs}\n className={cn(\n // `flex-1` (`flex: 1 1 0%`) only takes effect when the parent this\n // renders into happens to itself be a flex container — inert\n // otherwise, so it's safe alongside `block`. It's not decorative:\n // without it, a `display: block` element with no explicit width\n // only *auto-fills a plain block parent* — the browser's default\n // \"fill available width\" rule for `width: auto` is specific to\n // block layout. Nested inside a flex parent (a caller's own cell\n // wrapping this next to an icon button, say), the same element\n // becomes a flex item instead, where `flex-basis: auto` means\n // \"size to your own content\" — and this component's own content\n // is whatever it truncated itself to *last* time. Once shrunk, it\n // would then measure its own shrunken self forever, growing back\n // only if some ancestor's width changed enough to force a reflow\n // for an unrelated reason — not when the column actually had more\n // room to give it all along.\n 'block min-w-0 flex-1',\n // Nowrap + clip only once `measured` — *before* that, this is the\n // string's first-ever render, and if it already clips and refuses to\n // wrap, it dictates its own column's width to `table-layout: auto`\n // before `ResizeObserver` ever gets a turn: nowrap makes an unbroken\n // string's min-content the string's *entire* rendered width, so the\n // browser hands the column exactly that much room — measuring\n // `clientWidth` after the fact just reads back the width this same\n // element inflated the column to, not the width some other column\n // needed and this one gave up.\n //\n // Left at the browser's own default on the unmeasured pass rather than\n // forced to `overflow-wrap: anywhere` — tried that first, and it\n // overcorrects: telling `auto`-layout this column's min-content is a\n // single character makes it treat the column as free to take almost\n // nothing, starving it in favor of siblings with a normal (space- and\n // punctuation-driven) min-content. The browser's own line-breaking\n // already finds break opportunities in a URL — after `/`, around `?`,\n // `=`, `_` — without being told everything is breakable, which is\n // exactly the multi-line wrap this component exists to replace: worse\n // than what `nowrap` would give it, but a real, usable column width to\n // hand to the first `ResizeObserver` measurement, not a starved one.\n measured && 'overflow-hidden whitespace-nowrap',\n className\n )}\n >\n {display}\n </span>\n );\n\n if (display === text) return span;\n\n return (\n <Tooltip>\n <TooltipTrigger render={span} />\n <TooltipContent side={side} portalContainer={portalContainer}>\n {text}\n </TooltipContent>\n </Tooltip>\n );\n }\n);\n"],"names":["TruncateText","React","children","mode","className","side","lines","defaultOpen","portalContainer","forwardedRef","jsx","TruncateTextMiddle","TruncateTextEnd","text","innerRef","truncated","setTruncated","setRef","node","check","observer","multiline","style","span","cn","jsxs","Tooltip","TooltipTrigger","TooltipContent","setNode","display","setDisplay","measured","setMeasured","setRefs","element","recompute","width","font","middleTruncate","candidate","measureTextWidth"],"mappings":";;;;;;AAmDO,MAAMA,IAAeC,EAAM;AAAA,EAChC,SACE,EAAE,UAAAC,GAAU,MAAAC,IAAO,OAAO,WAAAC,GAAW,MAAAC,IAAO,OAAO,OAAAC,IAAQ,GAAG,aAAAC,GAAa,iBAAAC,EAAA,GAC3EC,GACA;AACA,WAAIN,MAAS,WAET,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAKF;AAAA,QACL,MAAMP;AAAA,QACN,MAAAG;AAAA,QACA,iBAAAG;AAAA,QACA,WAAAJ;AAAA,MAAA;AAAA,IAAA,IAMJ,gBAAAM;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,KAAKH;AAAA,QACL,MAAMP;AAAA,QACN,MAAAG;AAAA,QACA,OAAAC;AAAA,QACA,aAAAC;AAAA,QACA,iBAAAC;AAAA,QACA,WAAAJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF,GAYMQ,IAAkBX,EAAM;AAAA,EAC5B,SACE,EAAE,MAAAY,GAAM,MAAAR,GAAM,OAAAC,GAAO,aAAAC,GAAa,iBAAAC,GAAiB,WAAAJ,EAAA,GACnDK,GACA;AAC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