@acronis-platform/ui-react 0.62.0 → 1.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 (190) hide show
  1. package/dist/components/ui/alert/alert.js +115 -57
  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/chip/chip.js +33 -33
  9. package/dist/components/ui/chip/chip.js.map +1 -1
  10. package/dist/components/ui/date-range-picker/date-range-picker-utils.js +11 -23
  11. package/dist/components/ui/date-range-picker/date-range-picker-utils.js.map +1 -1
  12. package/dist/components/ui/date-range-picker/date-range-picker.js +94 -134
  13. package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
  14. package/dist/components/ui/dropdown-menu/dropdown-menu.js +129 -72
  15. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  16. package/dist/components/ui/filter-chips/filter-chips.js +44 -0
  17. package/dist/components/ui/filter-chips/filter-chips.js.map +1 -0
  18. package/dist/components/ui/filter-search/filter-search.js +184 -138
  19. package/dist/components/ui/filter-search/filter-search.js.map +1 -1
  20. package/dist/components/ui/fitted-actions/fitted-actions.js +139 -0
  21. package/dist/components/ui/fitted-actions/fitted-actions.js.map +1 -0
  22. package/dist/components/ui/input-date-picker/input-date-picker.js +103 -93
  23. package/dist/components/ui/input-date-picker/input-date-picker.js.map +1 -1
  24. package/dist/components/ui/input-password/input-password.js +76 -66
  25. package/dist/components/ui/input-password/input-password.js.map +1 -1
  26. package/dist/components/ui/input-search/input-search.js +9 -9
  27. package/dist/components/ui/input-search/input-search.js.map +1 -1
  28. package/dist/components/ui/input-select/input-select.js +8 -8
  29. package/dist/components/ui/input-select/input-select.js.map +1 -1
  30. package/dist/components/ui/input-text/input-text.js +77 -66
  31. package/dist/components/ui/input-text/input-text.js.map +1 -1
  32. package/dist/components/ui/input-text-area/input-text-area.js +76 -66
  33. package/dist/components/ui/input-text-area/input-text-area.js.map +1 -1
  34. package/dist/components/ui/link/link.js +50 -35
  35. package/dist/components/ui/link/link.js.map +1 -1
  36. package/dist/components/ui/number-field/number-field.js +1 -1
  37. package/dist/components/ui/number-field/number-field.js.map +1 -1
  38. package/dist/components/ui/popover/popover.js +75 -56
  39. package/dist/components/ui/popover/popover.js.map +1 -1
  40. package/dist/components/ui/scroll-area/scroll-area.js +46 -30
  41. package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
  42. package/dist/components/ui/timer/timer.js +47 -0
  43. package/dist/components/ui/timer/timer.js.map +1 -0
  44. package/dist/components/ui/toast/toast.js +168 -61
  45. package/dist/components/ui/toast/toast.js.map +1 -1
  46. package/dist/components/ui/truncate-text/middle-truncate.js +20 -0
  47. package/dist/components/ui/truncate-text/middle-truncate.js.map +1 -0
  48. package/dist/components/ui/truncate-text/text-width.js +12 -0
  49. package/dist/components/ui/truncate-text/text-width.js.map +1 -0
  50. package/dist/components/ui/truncate-text/truncate-text.js +152 -0
  51. package/dist/components/ui/truncate-text/truncate-text.js.map +1 -0
  52. package/dist/index.js +505 -473
  53. package/dist/index.js.map +1 -1
  54. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/addDays.js +5 -5
  55. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/addDays.js.map +1 -1
  56. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/constants.js +3 -6
  57. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/constants.js.map +1 -1
  58. package/dist/react.js +505 -473
  59. package/dist/react.js.map +1 -1
  60. package/dist/src/components/ui/alert/alert.d.ts +34 -3
  61. package/dist/src/components/ui/alert/index.d.ts +2 -2
  62. package/dist/src/components/ui/button/button.d.ts +1 -1
  63. package/dist/src/components/ui/button-group/button-group.d.ts +38 -0
  64. package/dist/src/components/ui/button-group/index.d.ts +1 -0
  65. package/dist/src/components/ui/button-icon/button-icon.d.ts +1 -1
  66. package/dist/src/components/ui/button-icon-menu/button-icon-menu.d.ts +28 -0
  67. package/dist/src/components/ui/button-icon-menu/index.d.ts +1 -0
  68. package/dist/src/components/ui/button-menu/button-menu.d.ts +1 -1
  69. package/dist/src/components/ui/calendar-panel/calendar-panel.d.ts +2 -2
  70. package/dist/src/components/ui/chip/chip.d.ts +1 -1
  71. package/dist/src/components/ui/date-range-picker/date-range-picker-utils.d.ts +10 -16
  72. package/dist/src/components/ui/date-range-picker/date-range-picker.d.ts +46 -2
  73. package/dist/src/components/ui/dropdown-menu/dropdown-menu.d.ts +8 -1
  74. package/dist/src/components/ui/dropdown-menu/index.d.ts +1 -1
  75. package/dist/src/components/ui/filter-chips/filter-chips.d.ts +25 -0
  76. package/dist/src/components/ui/filter-chips/index.d.ts +1 -0
  77. package/dist/src/components/ui/filter-search/filter-search.d.ts +39 -1
  78. package/dist/src/components/ui/fitted-actions/fitted-actions.d.ts +50 -0
  79. package/dist/src/components/ui/fitted-actions/fitted-actions.docs.d.ts +45 -0
  80. package/dist/src/components/ui/fitted-actions/index.d.ts +1 -0
  81. package/dist/src/components/ui/link/index.d.ts +1 -1
  82. package/dist/src/components/ui/link/link.d.ts +22 -4
  83. package/dist/src/components/ui/metric/metric.d.ts +1 -1
  84. package/dist/src/components/ui/popover/popover.d.ts +30 -1
  85. package/dist/src/components/ui/popover/popover.docs.d.ts +27 -2
  86. package/dist/src/components/ui/scroll-area/scroll-area.d.ts +24 -0
  87. package/dist/src/components/ui/tag/tag.d.ts +1 -1
  88. package/dist/src/components/ui/timer/index.d.ts +1 -0
  89. package/dist/src/components/ui/timer/timer.d.ts +28 -0
  90. package/dist/src/components/ui/toast/index.d.ts +1 -1
  91. package/dist/src/components/ui/toast/toast.d.ts +51 -18
  92. package/dist/src/components/ui/toast/toast.docs.d.ts +4 -0
  93. package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +1 -1
  94. package/dist/src/components/ui/truncate-text/__tests__/middle-truncate.test.d.ts +1 -0
  95. package/dist/src/components/ui/truncate-text/index.d.ts +3 -0
  96. package/dist/src/components/ui/truncate-text/middle-truncate.d.ts +13 -0
  97. package/dist/src/components/ui/truncate-text/text-width.d.ts +11 -0
  98. package/dist/src/components/ui/truncate-text/truncate-text.d.ts +45 -0
  99. package/dist/src/components/ui/truncate-text/truncate-text.docs.d.ts +35 -0
  100. package/dist/src/index.d.ts +6 -0
  101. package/dist/ui-react.css +1 -1
  102. package/package.json +3 -3
  103. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getDefaultOptions.js +0 -8
  104. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getDefaultOptions.js.map +0 -1
  105. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getISODay.js +0 -9
  106. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/getISODay.js.map +0 -1
  107. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Parser.js +0 -23
  108. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Parser.js.map +0 -1
  109. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Setter.js +0 -42
  110. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/Setter.js.map +0 -1
  111. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/constants.js +0 -50
  112. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/constants.js.map +0 -1
  113. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js +0 -50
  114. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js.map +0 -1
  115. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js +0 -50
  116. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js.map +0 -1
  117. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DateParser.js +0 -62
  118. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DateParser.js.map +0 -1
  119. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js +0 -52
  120. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js.map +0 -1
  121. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayParser.js +0 -50
  122. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayParser.js.map +0 -1
  123. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js +0 -50
  124. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js.map +0 -1
  125. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/EraParser.js +0 -34
  126. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/EraParser.js.map +0 -1
  127. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js +0 -22
  128. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js.map +0 -1
  129. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js +0 -23
  130. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js.map +0 -1
  131. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js +0 -33
  132. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js.map +0 -1
  133. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js +0 -33
  134. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js.map +0 -1
  135. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js +0 -34
  136. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js.map +0 -1
  137. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js +0 -34
  138. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js.map +0 -1
  139. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js +0 -106
  140. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js.map +0 -1
  141. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js +0 -49
  142. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js.map +0 -1
  143. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js +0 -49
  144. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js.map +0 -1
  145. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js +0 -50
  146. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js.map +0 -1
  147. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js +0 -41
  148. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js.map +0 -1
  149. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js +0 -81
  150. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js.map +0 -1
  151. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js +0 -49
  152. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js.map +0 -1
  153. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js +0 -70
  154. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js.map +0 -1
  155. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js +0 -33
  156. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js.map +0 -1
  157. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MonthParser.js +0 -78
  158. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/MonthParser.js.map +0 -1
  159. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js +0 -76
  160. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js.map +0 -1
  161. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/SecondParser.js +0 -33
  162. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/SecondParser.js.map +0 -1
  163. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js +0 -81
  164. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js.map +0 -1
  165. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js +0 -78
  166. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js.map +0 -1
  167. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js +0 -76
  168. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js.map +0 -1
  169. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js +0 -23
  170. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js.map +0 -1
  171. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js +0 -23
  172. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js.map +0 -1
  173. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/YearParser.js +0 -50
  174. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers/YearParser.js.map +0 -1
  175. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers.js +0 -68
  176. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/parsers.js.map +0 -1
  177. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/utils.js +0 -104
  178. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse/_lib/utils.js.map +0 -1
  179. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse.js +0 -86
  180. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/parse.js.map +0 -1
  181. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setDay.js +0 -12
  182. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setDay.js.map +0 -1
  183. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISODay.js +0 -11
  184. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISODay.js.map +0 -1
  185. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISOWeek.js +0 -10
  186. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setISOWeek.js.map +0 -1
  187. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setWeek.js +0 -10
  188. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/setWeek.js.map +0 -1
  189. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/transpose.js +0 -18
  190. package/dist/node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/transpose.js.map +0 -1
@@ -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;AACA,UAAMK,IAAWb,EAAM,OAA+B,IAAI,GACpD,CAACc,GAAWC,CAAY,IAAIf,EAAM,SAAS,EAAK,GAIhDgB,IAAShB,EAAM;AAAA,MACnB,CAACiB,MAAiC;AAChC,QAAAJ,EAAS,UAAUI,GACf,O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