@dynatrace/strato-components 0.85.110 → 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 (259) hide show
  1. package/buttons/button/Button.css +17 -17
  2. package/buttons/button/Button.js +1 -1
  3. package/buttons/button/Button.sty.js +4 -4
  4. package/content/progress/ProgressBar.css +71 -71
  5. package/content/progress/ProgressBar.d.ts +0 -7
  6. package/content/progress/ProgressBar.js +19 -45
  7. package/content/progress/ProgressBar.sty.js +5 -5
  8. package/content/progress/ProgressBarIcon.css +2 -2
  9. package/content/progress/ProgressBarIcon.sty.js +1 -1
  10. package/content/progress/ProgressBarLabel.css +3 -3
  11. package/content/progress/ProgressBarLabel.js +1 -1
  12. package/content/progress/ProgressBarLabel.sty.js +1 -1
  13. package/content/progress/ProgressBarValue.css +5 -5
  14. package/content/progress/ProgressBarValue.js +1 -1
  15. package/content/progress/ProgressBarValue.sty.js +1 -1
  16. package/content/progress/ProgressCircle.css +40 -40
  17. package/content/progress/ProgressCircle.d.ts +0 -7
  18. package/content/progress/ProgressCircle.js +2 -10
  19. package/content/progress/ProgressCircle.sty.js +5 -5
  20. package/content/progress/hooks/useProgressBarPropsContext.d.ts +5 -2
  21. package/content/progress/hooks/useProgressBarPropsContext.js +2 -2
  22. package/content/skeleton/Skeleton.css +6 -6
  23. package/content/skeleton/Skeleton.sty.js +1 -1
  24. package/core/components/app-root/AppRoot.css +0 -57
  25. package/core/hooks/useFontsUpdated.d.ts +1 -1
  26. package/core/hooks/useFontsUpdated.js +2 -2
  27. package/core/index.d.ts +0 -2
  28. package/core/index.js +0 -2
  29. package/core/styles/focusRing.css +66 -66
  30. package/core/styles/focusRing.sty.js +2 -2
  31. package/core/utils/colorUtils.css +60 -60
  32. package/core/utils/colorUtils.sty.js +2 -2
  33. package/esm/buttons/button/Button.css +17 -17
  34. package/esm/buttons/button/Button.js +1 -1
  35. package/esm/buttons/button/Button.js.map +2 -2
  36. package/esm/buttons/button/Button.sty.js +4 -4
  37. package/esm/buttons/button/Button.sty.js.map +2 -2
  38. package/esm/content/progress/ProgressBar.css +71 -71
  39. package/esm/content/progress/ProgressBar.js +19 -45
  40. package/esm/content/progress/ProgressBar.js.map +2 -2
  41. package/esm/content/progress/ProgressBar.sty.js +5 -5
  42. package/esm/content/progress/ProgressBar.sty.js.map +2 -2
  43. package/esm/content/progress/ProgressBarIcon.css +2 -2
  44. package/esm/content/progress/ProgressBarIcon.sty.js +1 -1
  45. package/esm/content/progress/ProgressBarIcon.sty.js.map +1 -1
  46. package/esm/content/progress/ProgressBarLabel.css +3 -3
  47. package/esm/content/progress/ProgressBarLabel.js +2 -2
  48. package/esm/content/progress/ProgressBarLabel.js.map +2 -2
  49. package/esm/content/progress/ProgressBarLabel.sty.js +1 -1
  50. package/esm/content/progress/ProgressBarLabel.sty.js.map +2 -2
  51. package/esm/content/progress/ProgressBarValue.css +5 -5
  52. package/esm/content/progress/ProgressBarValue.js +2 -2
  53. package/esm/content/progress/ProgressBarValue.js.map +2 -2
  54. package/esm/content/progress/ProgressBarValue.sty.js +1 -1
  55. package/esm/content/progress/ProgressBarValue.sty.js.map +2 -2
  56. package/esm/content/progress/ProgressCircle.css +40 -40
  57. package/esm/content/progress/ProgressCircle.js +2 -10
  58. package/esm/content/progress/ProgressCircle.js.map +2 -2
  59. package/esm/content/progress/ProgressCircle.sty.js +5 -5
  60. package/esm/content/progress/ProgressCircle.sty.js.map +2 -2
  61. package/esm/content/progress/hooks/useProgressBarPropsContext.js +2 -2
  62. package/esm/content/progress/hooks/useProgressBarPropsContext.js.map +2 -2
  63. package/esm/content/skeleton/Skeleton.css +6 -6
  64. package/esm/content/skeleton/Skeleton.sty.js +1 -1
  65. package/esm/content/skeleton/Skeleton.sty.js.map +2 -2
  66. package/esm/core/components/app-root/AppRoot.css +0 -57
  67. package/esm/core/hooks/useFontsUpdated.js +2 -2
  68. package/esm/core/hooks/useFontsUpdated.js.map +2 -2
  69. package/esm/core/index.js +0 -2
  70. package/esm/core/index.js.map +2 -2
  71. package/esm/core/styles/focusRing.css +66 -66
  72. package/esm/core/styles/focusRing.sty.js +2 -2
  73. package/esm/core/styles/focusRing.sty.js.map +2 -2
  74. package/esm/core/utils/colorUtils.css +60 -60
  75. package/esm/core/utils/colorUtils.sty.js +2 -2
  76. package/esm/core/utils/colorUtils.sty.js.map +2 -2
  77. package/esm/layouts/container/Container.css +4 -4
  78. package/esm/layouts/container/Container.sty.js +1 -1
  79. package/esm/layouts/container/Container.sty.js.map +1 -1
  80. package/esm/layouts/divider/Divider.css +6 -6
  81. package/esm/layouts/divider/Divider.sty.js +1 -1
  82. package/esm/layouts/divider/Divider.sty.js.map +2 -2
  83. package/esm/layouts/input-group/InputGroup.css +4 -4
  84. package/esm/layouts/input-group/InputGroup.sty.js +2 -2
  85. package/esm/layouts/input-group/InputGroup.sty.js.map +1 -1
  86. package/esm/layouts/surface/Surface.css +39 -39
  87. package/esm/layouts/surface/Surface.sty.js +2 -2
  88. package/esm/layouts/surface/Surface.sty.js.map +2 -2
  89. package/esm/layouts/surface/variables.sty.js +1 -1
  90. package/esm/layouts/surface/variables.sty.js.map +1 -1
  91. package/esm/styles/colorUtils.css +60 -60
  92. package/esm/styles/colorUtils.sty.js +2 -2
  93. package/esm/styles/colorUtils.sty.js.map +2 -2
  94. package/esm/styles/container.css +47 -47
  95. package/esm/styles/container.sty.js +2 -2
  96. package/esm/styles/container.sty.js.map +2 -2
  97. package/esm/styles/ellipsis.css +1 -1
  98. package/esm/styles/ellipsis.sty.js +1 -1
  99. package/esm/styles/ellipsis.sty.js.map +1 -1
  100. package/esm/styles/field.css +153 -153
  101. package/esm/styles/field.sty.js +2 -2
  102. package/esm/styles/field.sty.js.map +2 -2
  103. package/esm/styles/sprinkles.css +262 -262
  104. package/esm/styles/sprinkles.sty.js +1 -1
  105. package/esm/styles/sprinkles.sty.js.map +2 -2
  106. package/esm/styles/textStyle.css +8 -8
  107. package/esm/styles/textStyle.sty.js +1 -1
  108. package/esm/styles/textStyle.sty.js.map +2 -2
  109. package/esm/typography/block-quote/Blockquote.css +2 -2
  110. package/esm/typography/block-quote/Blockquote.sty.js +1 -1
  111. package/esm/typography/block-quote/Blockquote.sty.js.map +1 -1
  112. package/esm/typography/code/Code.css +1 -1
  113. package/esm/typography/code/Code.sty.js +1 -1
  114. package/esm/typography/code/Code.sty.js.map +1 -1
  115. package/esm/typography/emphasis/Emphasis.css +1 -1
  116. package/esm/typography/emphasis/Emphasis.sty.js +1 -1
  117. package/esm/typography/emphasis/Emphasis.sty.js.map +1 -1
  118. package/esm/typography/external-link/ExternalLink.css +6 -6
  119. package/esm/typography/external-link/ExternalLink.sty.js +1 -1
  120. package/esm/typography/external-link/ExternalLink.sty.js.map +1 -1
  121. package/esm/typography/heading/Heading.css +7 -7
  122. package/esm/typography/heading/Heading.sty.js +1 -1
  123. package/esm/typography/heading/Heading.sty.js.map +2 -2
  124. package/esm/typography/highlight/Highlight.css +1 -1
  125. package/esm/typography/highlight/Highlight.sty.js +1 -1
  126. package/esm/typography/highlight/Highlight.sty.js.map +1 -1
  127. package/esm/typography/index.js +12 -12
  128. package/esm/typography/index.js.map +2 -2
  129. package/esm/typography/link/Link.css +4 -4
  130. package/esm/typography/link/Link.sty.js +1 -1
  131. package/esm/typography/link/Link.sty.js.map +1 -1
  132. package/esm/typography/list/List.css +4 -4
  133. package/esm/typography/list/List.sty.js +2 -2
  134. package/esm/typography/list/List.sty.js.map +1 -1
  135. package/esm/typography/paragraph/Paragraph.css +3 -3
  136. package/esm/typography/paragraph/Paragraph.sty.js +1 -1
  137. package/esm/typography/paragraph/Paragraph.sty.js.map +2 -2
  138. package/esm/typography/strikethrough/Strikethrough.css +1 -1
  139. package/esm/typography/strikethrough/Strikethrough.sty.js +1 -1
  140. package/esm/typography/strikethrough/Strikethrough.sty.js.map +1 -1
  141. package/esm/typography/strong/Strong.css +1 -1
  142. package/esm/typography/strong/Strong.sty.js +1 -1
  143. package/esm/typography/strong/Strong.sty.js.map +1 -1
  144. package/esm/typography/text/Text.css +3 -3
  145. package/esm/typography/text/Text.sty.js +1 -1
  146. package/esm/typography/text/Text.sty.js.map +2 -2
  147. package/esm/typography/text-ellipsis/TextEllipsis.css +4 -4
  148. package/esm/typography/text-ellipsis/TextEllipsis.js +45 -45
  149. package/esm/typography/text-ellipsis/TextEllipsis.js.map +2 -2
  150. package/esm/typography/text-ellipsis/TextEllipsis.sty.js +1 -1
  151. package/esm/typography/text-ellipsis/TextEllipsis.sty.js.map +2 -2
  152. package/esm/typography/utils.js +19 -19
  153. package/esm/typography/utils.js.map +2 -2
  154. package/layouts/container/Container.css +4 -4
  155. package/layouts/container/Container.sty.js +1 -1
  156. package/layouts/divider/Divider.css +6 -6
  157. package/layouts/divider/Divider.sty.js +1 -1
  158. package/layouts/input-group/InputGroup.css +4 -4
  159. package/layouts/input-group/InputGroup.sty.js +2 -2
  160. package/layouts/surface/Surface.css +39 -39
  161. package/layouts/surface/Surface.sty.js +2 -2
  162. package/layouts/surface/variables.sty.js +1 -1
  163. package/package.json +15 -26
  164. package/styles/colorUtils.css +60 -60
  165. package/styles/colorUtils.sty.js +2 -2
  166. package/styles/container.css +47 -47
  167. package/styles/container.sty.js +2 -2
  168. package/styles/ellipsis.css +1 -1
  169. package/styles/ellipsis.sty.js +1 -1
  170. package/styles/field.css +153 -153
  171. package/styles/field.sty.js +2 -2
  172. package/styles/sprinkles.css +262 -262
  173. package/styles/sprinkles.sty.js +1 -1
  174. package/styles/textStyle.css +8 -8
  175. package/styles/textStyle.sty.js +1 -1
  176. package/typography/block-quote/Blockquote.css +2 -2
  177. package/typography/block-quote/Blockquote.sty.js +1 -1
  178. package/typography/code/Code.css +1 -1
  179. package/typography/code/Code.sty.js +1 -1
  180. package/typography/emphasis/Emphasis.css +1 -1
  181. package/typography/emphasis/Emphasis.sty.js +1 -1
  182. package/typography/external-link/ExternalLink.css +6 -6
  183. package/typography/external-link/ExternalLink.sty.js +1 -1
  184. package/typography/heading/Heading.css +7 -7
  185. package/typography/heading/Heading.sty.js +1 -1
  186. package/typography/highlight/Highlight.css +1 -1
  187. package/typography/highlight/Highlight.sty.js +1 -1
  188. package/typography/index.d.ts +3 -3
  189. package/typography/index.js +6 -6
  190. package/typography/link/Link.css +4 -4
  191. package/typography/link/Link.sty.js +1 -1
  192. package/typography/list/List.css +4 -4
  193. package/typography/list/List.sty.js +2 -2
  194. package/typography/paragraph/Paragraph.css +3 -3
  195. package/typography/paragraph/Paragraph.sty.js +1 -1
  196. package/typography/strikethrough/Strikethrough.css +1 -1
  197. package/typography/strikethrough/Strikethrough.sty.js +1 -1
  198. package/typography/strong/Strong.css +1 -1
  199. package/typography/strong/Strong.sty.js +1 -1
  200. package/typography/text/Text.css +3 -3
  201. package/typography/text/Text.sty.js +1 -1
  202. package/typography/text-ellipsis/TextEllipsis.css +4 -4
  203. package/typography/text-ellipsis/TextEllipsis.d.ts +2 -2
  204. package/typography/text-ellipsis/TextEllipsis.js +44 -44
  205. package/typography/text-ellipsis/TextEllipsis.sty.js +1 -1
  206. package/typography/utils.d.ts +14 -11
  207. package/typography/utils.js +19 -19
  208. package/core/types/role-variant.d.ts +0 -12
  209. package/core/types/role-variant.js +0 -30
  210. package/esm/core/types/role-variant.js +0 -12
  211. package/esm/core/types/role-variant.js.map +0 -7
  212. package/testing/custom-render.d.ts +0 -12
  213. package/testing/custom-render.js +0 -62
  214. package/testing/index.d.ts +0 -22
  215. package/testing/index.js +0 -91
  216. package/testing/jest/index.d.ts +0 -1
  217. package/testing/jest/index.js +0 -5
  218. package/testing/jest/jest-preset.d.ts +0 -10
  219. package/testing/jest/jest-preset.js +0 -13
  220. package/testing/jest/resolver.d.ts +0 -0
  221. package/testing/jest/resolver.js +0 -27
  222. package/testing/mocks/bounding-client-rect-mock.d.ts +0 -8
  223. package/testing/mocks/bounding-client-rect-mock.js +0 -36
  224. package/testing/mocks/canvas-mock.d.ts +0 -14
  225. package/testing/mocks/canvas-mock.js +0 -192
  226. package/testing/mocks/create-mock-element.d.ts +0 -14
  227. package/testing/mocks/create-mock-element.js +0 -99
  228. package/testing/mocks/create-range-mock.d.ts +0 -10
  229. package/testing/mocks/create-range-mock.js +0 -47
  230. package/testing/mocks/dom-rect-mock.d.ts +0 -19
  231. package/testing/mocks/dom-rect-mock.js +0 -56
  232. package/testing/mocks/fetch-mock.d.ts +0 -9
  233. package/testing/mocks/fetch-mock.js +0 -38
  234. package/testing/mocks/intersection-observer-mock.d.ts +0 -10
  235. package/testing/mocks/intersection-observer-mock.js +0 -58
  236. package/testing/mocks/match-media-mock.d.ts +0 -10
  237. package/testing/mocks/match-media-mock.js +0 -45
  238. package/testing/mocks/offset-height-mock.d.ts +0 -8
  239. package/testing/mocks/offset-height-mock.js +0 -39
  240. package/testing/mocks/offset-width-mock.d.ts +0 -8
  241. package/testing/mocks/offset-width-mock.js +0 -39
  242. package/testing/mocks/pointer-event-mock.d.ts +0 -8
  243. package/testing/mocks/pointer-event-mock.js +0 -42
  244. package/testing/mocks/resize-observer-mock.d.ts +0 -11
  245. package/testing/mocks/resize-observer-mock.js +0 -42
  246. package/testing/mocks/screen-size-mock.d.ts +0 -8
  247. package/testing/mocks/screen-size-mock.js +0 -34
  248. package/testing/mocks/scroll-into-view-mock.d.ts +0 -10
  249. package/testing/mocks/scroll-into-view-mock.js +0 -34
  250. package/testing/mocks/scroll-width-mock.d.ts +0 -8
  251. package/testing/mocks/scroll-width-mock.js +0 -39
  252. package/testing/mocks/select-mock.d.ts +0 -11
  253. package/testing/mocks/select-mock.js +0 -45
  254. package/testing/mocks/table-virtualization-mock.d.ts +0 -10
  255. package/testing/mocks/table-virtualization-mock.js +0 -50
  256. package/testing/mocks/text-ellipsis-mock.d.ts +0 -8
  257. package/testing/mocks/text-ellipsis-mock.js +0 -43
  258. package/testing/setup.d.ts +0 -8
  259. package/testing/setup.js +0 -57
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/typography/index.ts"],
4
- "sourcesContent": ["export { Blockquote } from './block-quote/Blockquote.js';\nexport type { BlockquoteProps } from './block-quote/Blockquote.js';\nexport { Code } from './code/Code.js';\nexport type { CodeProps } from './code/Code.js';\nexport { Emphasis } from './emphasis/Emphasis.js';\nexport type { EmphasisProps } from './emphasis/Emphasis.js';\nexport { ExternalLink } from './external-link/ExternalLink.js';\nexport type { ExternalLinkProps } from './external-link/ExternalLink.js';\nexport { Heading } from './heading/Heading.js';\nexport type { HeadingProps } from './heading/Heading.js';\nexport { Highlight } from './highlight/Highlight.js';\nexport type { HighlightProps } from './highlight/Highlight.js';\nexport { Link } from './link/Link.js';\nexport type { LinkProps } from './link/Link.js';\nexport { List } from './list/List.js';\nexport type { ListProps } from './list/List.js';\nexport { Paragraph } from './paragraph/Paragraph.js';\nexport type { ParagraphProps } from './paragraph/Paragraph.js';\nexport { Strikethrough } from './strikethrough/Strikethrough.js';\nexport type { StrikethroughProps } from './strikethrough/Strikethrough.js';\nexport { Strong } from './strong/Strong.js';\nexport type { StrongProps } from './strong/Strong.js';\nexport { Text } from './text/Text.js';\nexport type { TextOwnProps, TextProps } from './text/Text.js';\nexport { TextEllipsis } from './text-ellipsis/TextEllipsis.js';\nexport type {\n TextEllipsisProps,\n _TruncationMode,\n} from './text-ellipsis/TextEllipsis.js';\nexport {\n _calculateEllipsisInfo,\n _getTextHeight,\n _centerEllipsizeText,\n _getTextWidth,\n _ELLIPSIS_APPROXIMATION_THRESHOLD,\n _ELLIPSIS_CHARACTER,\n} from './utils.js';\nexport type { _Font } from './utils.js';\n"],
5
- "mappings": "AAAA,SAAS,kBAAkB;AAE3B,SAAS,YAAY;AAErB,SAAS,gBAAgB;AAEzB,SAAS,oBAAoB;AAE7B,SAAS,eAAe;AAExB,SAAS,iBAAiB;AAE1B,SAAS,YAAY;AAErB,SAAS,YAAY;AAErB,SAAS,iBAAiB;AAE1B,SAAS,qBAAqB;AAE9B,SAAS,cAAc;AAEvB,SAAS,YAAY;AAErB,SAAS,oBAAoB;AAK7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
4
+ "sourcesContent": ["export { Blockquote } from './block-quote/Blockquote.js';\nexport type { BlockquoteProps } from './block-quote/Blockquote.js';\nexport { Code } from './code/Code.js';\nexport type { CodeProps } from './code/Code.js';\nexport { Emphasis } from './emphasis/Emphasis.js';\nexport type { EmphasisProps } from './emphasis/Emphasis.js';\nexport { ExternalLink } from './external-link/ExternalLink.js';\nexport type { ExternalLinkProps } from './external-link/ExternalLink.js';\nexport { Heading } from './heading/Heading.js';\nexport type { HeadingProps } from './heading/Heading.js';\nexport { Highlight } from './highlight/Highlight.js';\nexport type { HighlightProps } from './highlight/Highlight.js';\nexport { Link } from './link/Link.js';\nexport type { LinkProps } from './link/Link.js';\nexport { List } from './list/List.js';\nexport type { ListProps } from './list/List.js';\nexport { Paragraph } from './paragraph/Paragraph.js';\nexport type { ParagraphProps } from './paragraph/Paragraph.js';\nexport { Strikethrough } from './strikethrough/Strikethrough.js';\nexport type { StrikethroughProps } from './strikethrough/Strikethrough.js';\nexport { Strong } from './strong/Strong.js';\nexport type { StrongProps } from './strong/Strong.js';\nexport { Text } from './text/Text.js';\nexport type { TextOwnProps, TextProps } from './text/Text.js';\nexport { TextEllipsis } from './text-ellipsis/TextEllipsis.js';\nexport type {\n TextEllipsisProps,\n TruncationMode as _TruncationMode,\n} from './text-ellipsis/TextEllipsis.js';\nexport {\n calculateEllipsisInfo as _calculateEllipsisInfo,\n getTextHeight as _getTextHeight,\n centerEllipsizeText as _centerEllipsizeText,\n getTextWidth as _getTextWidth,\n ELLIPSIS_APPROXIMATION_THRESHOLD as _ELLIPSIS_APPROXIMATION_THRESHOLD,\n ELLIPSIS_CHARACTER as _ELLIPSIS_CHARACTER,\n} from './utils.js';\nexport type { Font as _Font } from './utils.js';\n"],
5
+ "mappings": "AAAA,SAAS,kBAAkB;AAE3B,SAAS,YAAY;AAErB,SAAS,gBAAgB;AAEzB,SAAS,oBAAoB;AAE7B,SAAS,eAAe;AAExB,SAAS,iBAAiB;AAE1B,SAAS,YAAY;AAErB,SAAS,YAAY;AAErB,SAAS,iBAAiB;AAE1B,SAAS,qBAAqB;AAE9B,SAAS,cAAc;AAEvB,SAAS,YAAY;AAErB,SAAS,oBAAoB;AAK7B;AAAA,EAC2B;AAAA,EACR;AAAA,EACM;AAAA,EACP;AAAA,EACoB;AAAA,EACd;AAAA,OACjB;",
6
6
  "names": []
7
7
  }
@@ -1,15 +1,15 @@
1
- ._1iksxp40-0-85-110 {
1
+ ._1iksxp40-1-0-0 {
2
2
  display: inline;
3
3
  color: var(--dt-colors-text-primary-default, #454cc9);
4
4
  text-decoration: underline;
5
5
  overflow-wrap: anywhere;
6
6
  }
7
- ._1iksxp40-0-85-110:hover {
7
+ ._1iksxp40-1-0-0:hover {
8
8
  color: var(--dt-colors-text-primary-default-hover, #3332ae);
9
9
  }
10
- ._1iksxp40-0-85-110:active {
10
+ ._1iksxp40-1-0-0:active {
11
11
  color: var(--dt-colors-text-primary-default-active, #241193);
12
12
  }
13
- ._1iksxp40-0-85-110:focus-visible {
13
+ ._1iksxp40-1-0-0:focus-visible {
14
14
  text-decoration: none;
15
15
  }
@@ -1,5 +1,5 @@
1
1
  import "./Link.css";
2
- var linkCSS = "_1iksxp40-0-85-110";
2
+ var linkCSS = "_1iksxp40-1-0-0";
3
3
  export {
4
4
  linkCSS
5
5
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/typography/link/Link.css.ts"],
4
- "sourcesContent": ["import './Link.css';\nexport var linkCSS = '_1iksxp40-0-85-110';"],
4
+ "sourcesContent": ["import './Link.css';\nexport var linkCSS = '_1iksxp40-1-0-0';"],
5
5
  "mappings": "AAAA,OAAO;AACA,IAAI,UAAU;",
6
6
  "names": []
7
7
  }
@@ -1,16 +1,16 @@
1
- ._16276mt0-0-85-110 {
1
+ ._16276mt0-1-0-0 {
2
2
  margin: 0;
3
3
  padding-left: var(--dt-spacings-size-40, 40px);
4
4
  }
5
- ._16276mt0-0-85-110 ._16276mt0-0-85-110 {
5
+ ._16276mt0-1-0-0 ._16276mt0-1-0-0 {
6
6
  margin-block: var(--dt-spacings-size-4, 4px);
7
7
  padding-left: var(--dt-spacings-size-28, 28px);
8
8
  }
9
- ._16276mt1-0-85-110 {
9
+ ._16276mt1-1-0-0 {
10
10
  position: relative;
11
11
  overflow-wrap: break-word;
12
12
  margin-block: var(--dt-spacings-size-2, 2px);
13
13
  }
14
- ._16276mt1-0-85-110::marker {
14
+ ._16276mt1-1-0-0::marker {
15
15
  font-weight: var(--dt-typography-text-base-emphasized-weight, 500);
16
16
  }
@@ -1,6 +1,6 @@
1
1
  import "./List.css";
2
- var listCSS = "_16276mt0-0-85-110";
3
- var listItemCSS = "_16276mt1-0-85-110";
2
+ var listCSS = "_16276mt0-1-0-0";
3
+ var listItemCSS = "_16276mt1-1-0-0";
4
4
  export {
5
5
  listCSS,
6
6
  listItemCSS
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/typography/list/List.css.ts"],
4
- "sourcesContent": ["import './List.css';\nexport var listCSS = '_16276mt0-0-85-110';\nexport var listItemCSS = '_16276mt1-0-85-110';"],
4
+ "sourcesContent": ["import './List.css';\nexport var listCSS = '_16276mt0-1-0-0';\nexport var listItemCSS = '_16276mt1-1-0-0';"],
5
5
  "mappings": "AAAA,OAAO;AACA,IAAI,UAAU;AACd,IAAI,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,17 +1,17 @@
1
- ._487p2n0-0-85-110 {
1
+ ._487p2n0-1-0-0 {
2
2
  margin-top: 0;
3
3
  margin-bottom: 0;
4
4
  overflow-wrap: break-word;
5
5
  color: inherit;
6
6
  font-style: normal;
7
7
  }
8
- ._487p2n1-0-85-110 {
8
+ ._487p2n1-1-0-0 {
9
9
  display: block;
10
10
  white-space: nowrap;
11
11
  text-overflow: ellipsis;
12
12
  overflow: hidden;
13
13
  }
14
- ._487p2n2-0-85-110 {
14
+ ._487p2n2-1-0-0 {
15
15
  display: -webkit-box;
16
16
  -webkit-line-clamp: var(--strato-ellipsis-line-clamp);
17
17
  -webkit-box-orient: vertical;
@@ -1,6 +1,6 @@
1
1
  import "./Paragraph.css";
2
2
  import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntimeFn";
3
- var paragraphCSS = _7a468({ defaultClassName: "_487p2n0-0-85-110", variantClassNames: { ellipsis: { singleLine: "_487p2n1-0-85-110", multiLine: "_487p2n2-0-85-110" } }, defaultVariants: {}, compoundVariants: [] });
3
+ var paragraphCSS = _7a468({ defaultClassName: "_487p2n0-1-0-0", variantClassNames: { ellipsis: { singleLine: "_487p2n1-1-0-0", multiLine: "_487p2n2-1-0-0" } }, defaultVariants: {}, compoundVariants: [] });
4
4
  export {
5
5
  paragraphCSS
6
6
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/typography/paragraph/Paragraph.css.ts"],
4
- "sourcesContent": ["import './Paragraph.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var paragraphCSS = _7a468({defaultClassName:'_487p2n0-0-85-110',variantClassNames:{ellipsis:{singleLine:'_487p2n1-0-85-110',multiLine:'_487p2n2-0-85-110'}},defaultVariants:{},compoundVariants:[]});"],
5
- "mappings": "AAAA,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,eAAe,OAAO,EAAC,kBAAiB,qBAAoB,mBAAkB,EAAC,UAAS,EAAC,YAAW,qBAAoB,WAAU,oBAAmB,EAAC,GAAE,iBAAgB,CAAC,GAAE,kBAAiB,CAAC,EAAC,CAAC;",
4
+ "sourcesContent": ["import './Paragraph.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var paragraphCSS = _7a468({defaultClassName:'_487p2n0-1-0-0',variantClassNames:{ellipsis:{singleLine:'_487p2n1-1-0-0',multiLine:'_487p2n2-1-0-0'}},defaultVariants:{},compoundVariants:[]});"],
5
+ "mappings": "AAAA,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,eAAe,OAAO,EAAC,kBAAiB,kBAAiB,mBAAkB,EAAC,UAAS,EAAC,YAAW,kBAAiB,WAAU,iBAAgB,EAAC,GAAE,iBAAgB,CAAC,GAAE,kBAAiB,CAAC,EAAC,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- ._4oao6y0-0-85-110 {
1
+ ._4oao6y0-1-0-0 {
2
2
  text-decoration: line-through;
3
3
  text-decoration-style: solid;
4
4
  overflow-wrap: break-word;
@@ -1,5 +1,5 @@
1
1
  import "./Strikethrough.css";
2
- var strikethroughCSS = "_4oao6y0-0-85-110";
2
+ var strikethroughCSS = "_4oao6y0-1-0-0";
3
3
  export {
4
4
  strikethroughCSS
5
5
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/typography/strikethrough/Strikethrough.css.ts"],
4
- "sourcesContent": ["import './Strikethrough.css';\nexport var strikethroughCSS = '_4oao6y0-0-85-110';"],
4
+ "sourcesContent": ["import './Strikethrough.css';\nexport var strikethroughCSS = '_4oao6y0-1-0-0';"],
5
5
  "mappings": "AAAA,OAAO;AACA,IAAI,mBAAmB;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- ._wxp4dd0-0-85-110 {
1
+ ._wxp4dd0-1-0-0 {
2
2
  font-weight: var(--dt-typography-text-base-emphasized-weight, 500);
3
3
  overflow-wrap: break-word;
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import "./Strong.css";
2
- var strongCSS = "_wxp4dd0-0-85-110";
2
+ var strongCSS = "_wxp4dd0-1-0-0";
3
3
  export {
4
4
  strongCSS
5
5
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/typography/strong/Strong.css.ts"],
4
- "sourcesContent": ["import './Strong.css';\nexport var strongCSS = '_wxp4dd0-0-85-110';"],
4
+ "sourcesContent": ["import './Strong.css';\nexport var strongCSS = '_wxp4dd0-1-0-0';"],
5
5
  "mappings": "AAAA,OAAO;AACA,IAAI,YAAY;",
6
6
  "names": []
7
7
  }
@@ -1,16 +1,16 @@
1
- ._rup8ap0-0-85-110 {
1
+ ._rup8ap0-1-0-0 {
2
2
  margin-top: 0;
3
3
  margin-bottom: 0;
4
4
  min-width: 0;
5
5
  overflow-wrap: break-word;
6
6
  }
7
- ._rup8ap1-0-85-110 {
7
+ ._rup8ap1-1-0-0 {
8
8
  display: block;
9
9
  white-space: nowrap;
10
10
  text-overflow: ellipsis;
11
11
  overflow: hidden;
12
12
  }
13
- ._rup8ap2-0-85-110 {
13
+ ._rup8ap2-1-0-0 {
14
14
  display: -webkit-box;
15
15
  -webkit-line-clamp: var(--strato-ellipsis-line-clamp);
16
16
  -webkit-box-orient: vertical;
@@ -1,6 +1,6 @@
1
1
  import "./Text.css";
2
2
  import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntimeFn";
3
- var textCSS = _7a468({ defaultClassName: "_rup8ap0-0-85-110", variantClassNames: { ellipsis: { singleLine: "_rup8ap1-0-85-110", multiLine: "_rup8ap2-0-85-110" } }, defaultVariants: {}, compoundVariants: [] });
3
+ var textCSS = _7a468({ defaultClassName: "_rup8ap0-1-0-0", variantClassNames: { ellipsis: { singleLine: "_rup8ap1-1-0-0", multiLine: "_rup8ap2-1-0-0" } }, defaultVariants: {}, compoundVariants: [] });
4
4
  export {
5
5
  textCSS
6
6
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/typography/text/Text.css.ts"],
4
- "sourcesContent": ["import './Text.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var textCSS = _7a468({defaultClassName:'_rup8ap0-0-85-110',variantClassNames:{ellipsis:{singleLine:'_rup8ap1-0-85-110',multiLine:'_rup8ap2-0-85-110'}},defaultVariants:{},compoundVariants:[]});"],
5
- "mappings": "AAAA,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,UAAU,OAAO,EAAC,kBAAiB,qBAAoB,mBAAkB,EAAC,UAAS,EAAC,YAAW,qBAAoB,WAAU,oBAAmB,EAAC,GAAE,iBAAgB,CAAC,GAAE,kBAAiB,CAAC,EAAC,CAAC;",
4
+ "sourcesContent": ["import './Text.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var textCSS = _7a468({defaultClassName:'_rup8ap0-1-0-0',variantClassNames:{ellipsis:{singleLine:'_rup8ap1-1-0-0',multiLine:'_rup8ap2-1-0-0'}},defaultVariants:{},compoundVariants:[]});"],
5
+ "mappings": "AAAA,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,UAAU,OAAO,EAAC,kBAAiB,kBAAiB,mBAAkB,EAAC,UAAS,EAAC,YAAW,kBAAiB,WAAU,iBAAgB,EAAC,GAAE,iBAAgB,CAAC,GAAE,kBAAiB,CAAC,EAAC,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- ._1mnpbqs0-0-85-110 {
1
+ ._1mnpbqs0-1-0-0 {
2
2
  display: inline-block;
3
3
  box-sizing: border-box;
4
4
  vertical-align: middle;
@@ -9,14 +9,14 @@
9
9
  text-decoration: inherit;
10
10
  width: 100%;
11
11
  }
12
- ._1mnpbqs1-0-85-110 {
12
+ ._1mnpbqs1-1-0-0 {
13
13
  text-overflow: ellipsis;
14
14
  direction: rtl;
15
15
  text-align: left;
16
16
  }
17
- ._1mnpbqs2-0-85-110 {
17
+ ._1mnpbqs2-1-0-0 {
18
18
  text-overflow: clip;
19
19
  }
20
- ._1mnpbqs3-0-85-110 {
20
+ ._1mnpbqs3-1-0-0 {
21
21
  text-overflow: ellipsis;
22
22
  }
@@ -5,12 +5,12 @@ import React, {
5
5
  useRef
6
6
  } from "react";
7
7
  import useResizeObserver from "use-resize-observer";
8
- import { textEllipsisCSS } from "./TextEllipsis.sty.js";
9
- import { _useFontsUpdated } from "../../core/hooks/useFontsUpdated.js";
8
+ import { useFontsUpdated } from "../../core/hooks/useFontsUpdated.js";
10
9
  import { useMergeRefs } from "../../core/hooks/useMergeRefs.js";
11
- import { _centerEllipsizeText } from "../utils.js";
12
- function getFontProps(textWrapper) {
13
- const computedStyle = window.getComputedStyle(textWrapper, null);
10
+ import { centerEllipsizeText } from "../utils.js";
11
+ import { textEllipsisCSS } from "./TextEllipsis.sty.js";
12
+ function getFontProps(innerSpanElement) {
13
+ const computedStyle = window.getComputedStyle(innerSpanElement, null);
14
14
  return {
15
15
  fontStyle: computedStyle.getPropertyValue("font-style"),
16
16
  fontWeight: computedStyle.getPropertyValue("font-weight"),
@@ -18,50 +18,51 @@ function getFontProps(textWrapper) {
18
18
  fontFamily: computedStyle.getPropertyValue("font-family")
19
19
  };
20
20
  }
21
- function isNativeEllipsisActive(textWrapper, containerWidth) {
21
+ function isNativeEllipsisActive(innerSpanElement, containerWidth) {
22
22
  const originalTextWidth = Math.max(
23
- textWrapper.getBoundingClientRect().width,
24
- textWrapper.scrollWidth
23
+ innerSpanElement.getBoundingClientRect().width,
24
+ innerSpanElement.scrollWidth
25
25
  );
26
26
  const textWidth = Math.floor(originalTextWidth * 100) / 100;
27
27
  return textWidth > containerWidth;
28
28
  }
29
+ function resetFullText(innerSpanElement, originalText) {
30
+ if (innerSpanElement.textContent !== originalText) {
31
+ innerSpanElement.textContent = originalText;
32
+ }
33
+ }
34
+ function getWidth(element) {
35
+ return Math.max(element.getBoundingClientRect().width, element.clientWidth);
36
+ }
37
+ function getContainerWidth(containerElement) {
38
+ return Math.ceil(getWidth(containerElement) * 100) / 100;
39
+ }
40
+ function onTextOverflowCallback(current, wasEllipsized, onTextOverflow) {
41
+ if (onTextOverflow && current !== wasEllipsized) {
42
+ onTextOverflow(current);
43
+ }
44
+ }
29
45
  function renderEllipsizedText(originalText, truncationMode, containerRef, wasEllipsized, onTextOverflow) {
30
46
  const containerElement = containerRef.current;
31
- const textWrapper = containerElement?.firstElementChild || null;
32
- if (containerElement !== null && textWrapper !== null) {
33
- if (textWrapper.textContent !== originalText) {
34
- textWrapper.textContent = originalText;
35
- }
36
- const containerWidth = Math.ceil(containerElement.getBoundingClientRect().width * 100) / 100;
37
- if (truncationMode === "middle") {
38
- if (isNativeEllipsisActive(textWrapper, containerWidth)) {
39
- const ellipsizedText = _centerEllipsizeText(
40
- originalText,
41
- getFontProps(textWrapper),
42
- containerWidth
43
- );
44
- textWrapper.textContent = ellipsizedText;
45
- if (ellipsizedText !== originalText) {
46
- if (onTextOverflow && !wasEllipsized) {
47
- onTextOverflow(true);
48
- }
49
- return true;
50
- }
51
- }
52
- if (onTextOverflow && wasEllipsized) {
53
- onTextOverflow(false);
54
- }
55
- } else if (isNativeEllipsisActive(textWrapper, containerWidth)) {
56
- if (onTextOverflow && !wasEllipsized) {
57
- onTextOverflow(true);
58
- }
59
- return true;
60
- } else if (onTextOverflow && wasEllipsized) {
61
- onTextOverflow(false);
62
- }
47
+ const innerSpanElement = containerElement?.firstElementChild || null;
48
+ if (containerElement === null || innerSpanElement === null) {
49
+ return false;
50
+ }
51
+ resetFullText(innerSpanElement, originalText);
52
+ const containerWidth = getContainerWidth(containerElement);
53
+ if (!isNativeEllipsisActive(innerSpanElement, containerWidth)) {
54
+ onTextOverflowCallback(false, wasEllipsized, onTextOverflow);
55
+ return false;
56
+ }
57
+ if (truncationMode === "middle") {
58
+ innerSpanElement.textContent = centerEllipsizeText(
59
+ originalText,
60
+ getFontProps(innerSpanElement),
61
+ containerWidth
62
+ );
63
63
  }
64
- return false;
64
+ onTextOverflowCallback(true, wasEllipsized, onTextOverflow);
65
+ return true;
65
66
  }
66
67
  const ComputedTextEllipsis = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
67
68
  const {
@@ -75,7 +76,7 @@ const ComputedTextEllipsis = /* @__PURE__ */ forwardRef((props, forwardedRef) =>
75
76
  "data-dtrum-allow": dataDtrumAllow,
76
77
  ...remainingProps
77
78
  } = props;
78
- const { ref: observerContainerRef } = useResizeObserver();
79
+ const { ref: observerContainerRef, width } = useResizeObserver();
79
80
  const containerRef = useRef(null);
80
81
  const ellipsisStateRef = useRef(false);
81
82
  const mergedRef = useMergeRefs([
@@ -85,8 +86,7 @@ const ComputedTextEllipsis = /* @__PURE__ */ forwardRef((props, forwardedRef) =>
85
86
  },
86
87
  forwardedRef
87
88
  ]);
88
- const containerWidth = containerRef.current?.getBoundingClientRect().width;
89
- const fontsUpdated = _useFontsUpdated();
89
+ const fontsUpdated = useFontsUpdated();
90
90
  useLayoutEffect(() => {
91
91
  ellipsisStateRef.current = renderEllipsizedText(
92
92
  children,
@@ -95,7 +95,7 @@ const ComputedTextEllipsis = /* @__PURE__ */ forwardRef((props, forwardedRef) =>
95
95
  ellipsisStateRef.current,
96
96
  onTextOverflow
97
97
  );
98
- }, [containerWidth, children, truncationMode, fontsUpdated, onTextOverflow]);
98
+ }, [width, children, truncationMode, fontsUpdated, onTextOverflow]);
99
99
  return /* @__PURE__ */ React.createElement(
100
100
  "span",
101
101
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/typography/text-ellipsis/TextEllipsis.tsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport React, {\n forwardRef,\n HTMLAttributes,\n RefObject,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport useResizeObserver from 'use-resize-observer';\n\nimport { textEllipsisCSS } from './TextEllipsis.sty.js';\nimport { _useFontsUpdated } from '../../core/hooks/useFontsUpdated.js';\nimport { useMergeRefs } from '../../core/hooks/useMergeRefs.js';\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type MaskingProps } from '../../core/types/masking-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { type _Font } from '../utils.js';\nimport { _centerEllipsizeText } from '../utils.js';\n\n/**\n * Available modes for how overly long text is truncated and where the ellipsis is placed.\n * @internal\n */\nexport type _TruncationMode = 'start' | 'middle' | 'end';\n\n/**\n * The props for the TextEllipsis component.\n * @public\n */\nexport interface TextEllipsisProps\n extends HTMLAttributes<HTMLSpanElement>,\n StylingProps,\n DataTestId,\n MaskingProps {\n /** The children (as text) passed to the component. */\n children: string;\n /**\n * The mode used for for truncating the text, either at the start, in the middle or at the end.\n * @defaultValue 'end'\n */\n truncationMode?: 'start' | 'middle' | 'end';\n /** Gets called when text needs to get truncated due to lack of horizontal space. */\n onTextOverflow?: (ellipsized: boolean) => void;\n}\n\n/**\n * Returns an object containing all font-related CSS properties from\n * a given DOM element that are relevant for rendering formatted text\n * in a 2D canvas context.\n *\n * @param textWrapper - The HTML element to extract the CSS properties from\n */\nfunction getFontProps(textWrapper: HTMLSpanElement): _Font {\n const computedStyle = window.getComputedStyle(textWrapper, null);\n\n return {\n fontStyle: computedStyle.getPropertyValue('font-style'),\n fontWeight: computedStyle.getPropertyValue('font-weight'),\n fontSize: computedStyle.getPropertyValue('font-size'),\n fontFamily: computedStyle.getPropertyValue('font-family'),\n };\n}\n\n/**\n * Determines whether a CSS text-ellipsis is currently rendered in a container.\n * Note: `containerWidth` is only passed to avoid unnecessary reflows by calling `getBoundingClientRect()`\n */\nfunction isNativeEllipsisActive(\n textWrapper: HTMLSpanElement,\n containerWidth: number,\n): boolean {\n // Sometimes there already is an ellipsis, which means `getBoundingClientRect().width` and `containerWidth` are the same.\n // In that case, `scrollWidth` specifies the actual width of the text if it was fully visible.\n const originalTextWidth = Math.max(\n textWrapper.getBoundingClientRect().width,\n textWrapper.scrollWidth,\n );\n const textWidth = Math.floor(originalTextWidth * 100) / 100;\n\n return textWidth > containerWidth;\n}\n\n/**\n * Detects whether a given formatted text has enough space within its\n * parent container and applies or removes an ellipsis accordingly.\n *\n * @param originalText - The text to be truncated if its width exceeds <code>maxWidthInPx</code>\n * @param truncationMode - The mode used for for truncating the text, either at the start, in the middle or at the end\n * @param containerRef - Object ref pointing towards the root element of the TextEllipsis component\n * @param wasEllipsized - Whether an ellipsis was applied during the last render cycle\n * @param onTextOverflow - Callback that gets called whenever the state of the ellipsis changes since the last render cycle\n */\nfunction renderEllipsizedText(\n originalText: string,\n truncationMode: TextEllipsisProps['truncationMode'],\n containerRef: RefObject<HTMLSpanElement>,\n wasEllipsized: boolean,\n onTextOverflow?: (ellipsized: boolean) => void,\n): boolean {\n const containerElement = containerRef.current;\n const textWrapper: HTMLSpanElement | null =\n (containerElement?.firstElementChild as HTMLSpanElement) || null;\n\n if (containerElement !== null && textWrapper !== null) {\n if (textWrapper.textContent !== originalText) {\n textWrapper.textContent = originalText; // always reset to full text before measuring container width\n }\n\n const containerWidth =\n Math.ceil(containerElement.getBoundingClientRect().width * 100) / 100;\n\n if (truncationMode === 'middle') {\n if (isNativeEllipsisActive(textWrapper, containerWidth)) {\n const ellipsizedText = _centerEllipsizeText(\n originalText,\n getFontProps(textWrapper),\n containerWidth,\n );\n textWrapper.textContent = ellipsizedText;\n\n if (ellipsizedText !== originalText) {\n if (onTextOverflow && !wasEllipsized) {\n onTextOverflow(true);\n }\n\n return true;\n }\n }\n\n if (onTextOverflow && wasEllipsized) {\n onTextOverflow(false);\n }\n } else if (isNativeEllipsisActive(textWrapper, containerWidth)) {\n if (onTextOverflow && !wasEllipsized) {\n onTextOverflow(true);\n }\n\n return true;\n } else if (onTextOverflow && wasEllipsized) {\n onTextOverflow(false);\n }\n }\n\n return false;\n}\n\nconst ComputedTextEllipsis = /* @__PURE__ */ forwardRef<\n HTMLSpanElement,\n TextEllipsisProps\n>((props, forwardedRef) => {\n const {\n children,\n truncationMode = 'end',\n onTextOverflow,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n ...remainingProps\n } = props;\n\n // resize observer is needed to re-render the component in case of resizing\n const { ref: observerContainerRef } = useResizeObserver<HTMLSpanElement>();\n const containerRef = useRef<HTMLSpanElement | null>(null);\n const ellipsisStateRef = useRef<boolean>(false);\n const mergedRef = useMergeRefs<HTMLSpanElement | null>([\n observerContainerRef,\n (instance: HTMLSpanElement) => {\n containerRef.current = instance;\n },\n forwardedRef,\n ]);\n const containerWidth = containerRef.current?.getBoundingClientRect().width;\n const fontsUpdated = _useFontsUpdated();\n\n useLayoutEffect(() => {\n ellipsisStateRef.current = renderEllipsizedText(\n children,\n truncationMode,\n containerRef,\n ellipsisStateRef.current,\n onTextOverflow,\n );\n }, [containerWidth, children, truncationMode, fontsUpdated, onTextOverflow]);\n\n return (\n <span\n ref={mergedRef}\n aria-label={children}\n data-ellipsis\n data-testid={dataTestId}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n className={clsx(textEllipsisCSS({ truncationMode }), consumerClassName)}\n style={consumerStyle}\n {...remainingProps}\n >\n <span>{children}</span>\n </span>\n );\n});\n\nconst CssTextEllipsis = /* @__PURE__ */ forwardRef<\n HTMLSpanElement,\n TextEllipsisProps\n>((props, forwardedRef) => {\n const {\n children,\n truncationMode = 'end',\n onTextOverflow,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n ...remainingProps\n } = props;\n\n return (\n <span\n ref={forwardedRef}\n aria-label={children}\n data-ellipsis\n data-testid={dataTestId}\n className={clsx(textEllipsisCSS({ truncationMode }), consumerClassName)}\n style={consumerStyle}\n {...remainingProps}\n >\n <span>{children}</span>\n </span>\n );\n});\n\n/**\n * Use the `TextEllipsis` component to truncate text and show an ellipsis whenever\n * there is insufficient space to render the entire text. While some of our Strato\n * components provide ellipsis out of the box, you need to take care of this yourself\n * when writing your own components.\n * @public\n */\nexport const TextEllipsis = /* @__PURE__ */ forwardRef<\n HTMLSpanElement,\n TextEllipsisProps\n>((props, forwardedRef) => {\n // in case onTextOverflow is not defined and the ellipsis is start or end\n // we can use css only which is significantly more performant\n const cssOnlyEllipsis =\n !props.onTextOverflow && props.truncationMode !== 'middle';\n\n return cssOnlyEllipsis ? (\n /* eslint-disable-next-line deprecated-jsx-props/deprecated-props -- The plugin can not properly analyze spread props:\n https://github.com/sebakerckhof/eslint-plugin-deprecated-jsx-props?tab=readme-ov-file#configuration, the deprecations here are in the HTMLAttributes type, which is fine. */\n <CssTextEllipsis ref={forwardedRef} {...props} />\n ) : (\n /* eslint-disable-next-line deprecated-jsx-props/deprecated-props -- The plugin can not properly analyze spread props:\n https://github.com/sebakerckhof/eslint-plugin-deprecated-jsx-props?tab=readme-ov-file#configuration, the deprecations here are in the HTMLAttributes type, which is fine. */\n <ComputedTextEllipsis ref={forwardedRef} {...props} />\n );\n});\n\n(TextEllipsis as typeof TextEllipsis & { displayName: string }).displayName =\n 'TextEllipsis';\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AACjB,OAAO;AAAA,EACL;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP,OAAO,uBAAuB;AAE9B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAK7B,SAAS,4BAA4B;AAmCrC,SAAS,aAAa,aAAqC;AACzD,QAAM,gBAAgB,OAAO,iBAAiB,aAAa,IAAI;AAE/D,SAAO;AAAA,IACL,WAAW,cAAc,iBAAiB,YAAY;AAAA,IACtD,YAAY,cAAc,iBAAiB,aAAa;AAAA,IACxD,UAAU,cAAc,iBAAiB,WAAW;AAAA,IACpD,YAAY,cAAc,iBAAiB,aAAa;AAAA,EAC1D;AACF;AAMA,SAAS,uBACP,aACA,gBACS;AAGT,QAAM,oBAAoB,KAAK;AAAA,IAC7B,YAAY,sBAAsB,EAAE;AAAA,IACpC,YAAY;AAAA,EACd;AACA,QAAM,YAAY,KAAK,MAAM,oBAAoB,GAAG,IAAI;AAExD,SAAO,YAAY;AACrB;AAYA,SAAS,qBACP,cACA,gBACA,cACA,eACA,gBACS;AACT,QAAM,mBAAmB,aAAa;AACtC,QAAM,cACH,kBAAkB,qBAAyC;AAE9D,MAAI,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CAAC;AAEA,aAA+D,cAC9D;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport React, {\n forwardRef,\n type HTMLAttributes,\n type RefObject,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport useResizeObserver from 'use-resize-observer';\n\nimport { useFontsUpdated } from '../../core/hooks/useFontsUpdated.js';\nimport { useMergeRefs } from '../../core/hooks/useMergeRefs.js';\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type MaskingProps } from '../../core/types/masking-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { centerEllipsizeText, type Font } from '../utils.js';\nimport { textEllipsisCSS } from './TextEllipsis.sty.js';\n\n/**\n * Available modes for how overly long text is truncated and where the ellipsis is placed.\n * @internal\n */\nexport type TruncationMode = 'start' | 'middle' | 'end';\n\n/**\n * The props for the TextEllipsis component.\n * @public\n */\nexport interface TextEllipsisProps\n extends HTMLAttributes<HTMLSpanElement>,\n StylingProps,\n DataTestId,\n MaskingProps {\n /** The children (as text) passed to the component. */\n children: string;\n /**\n * The mode used for for truncating the text, either at the start, in the middle or at the end.\n * @defaultValue 'end'\n */\n truncationMode?: 'start' | 'middle' | 'end';\n /** Gets called when text needs to get truncated due to lack of horizontal space. */\n onTextOverflow?: (ellipsized: boolean) => void;\n}\n\n/**\n * Returns an object containing all font-related CSS properties from\n * a given DOM element that are relevant for rendering formatted text\n * in a 2D canvas context.\n *\n * @param innerSpanElement - The HTML element to extract the CSS properties from\n */\nfunction getFontProps(innerSpanElement: HTMLSpanElement): Font {\n const computedStyle = window.getComputedStyle(innerSpanElement, null);\n\n return {\n fontStyle: computedStyle.getPropertyValue('font-style'),\n fontWeight: computedStyle.getPropertyValue('font-weight'),\n fontSize: computedStyle.getPropertyValue('font-size'),\n fontFamily: computedStyle.getPropertyValue('font-family'),\n };\n}\n\n/**\n * Determines whether a CSS text-ellipsis is currently rendered in a container.\n * Note: `containerWidth` is only passed to avoid unnecessary reflows by calling `getBoundingClientRect()`\n */\nfunction isNativeEllipsisActive(\n innerSpanElement: HTMLSpanElement,\n containerWidth: number,\n): boolean {\n // Sometimes there already is an ellipsis, which means `getBoundingClientRect().width` and `containerWidth` are the same.\n // In that case, `scrollWidth` specifies the actual width of the text if it was fully visible.\n const originalTextWidth = Math.max(\n innerSpanElement.getBoundingClientRect().width,\n innerSpanElement.scrollWidth,\n );\n const textWidth = Math.floor(originalTextWidth * 100) / 100;\n\n return textWidth > containerWidth;\n}\n\nfunction resetFullText(\n innerSpanElement: HTMLSpanElement,\n originalText: string,\n) {\n if (innerSpanElement.textContent !== originalText) {\n innerSpanElement.textContent = originalText;\n }\n}\n\nfunction getWidth(element: HTMLSpanElement) {\n return Math.max(element.getBoundingClientRect().width, element.clientWidth);\n}\n\nfunction getContainerWidth(containerElement: HTMLSpanElement) {\n return Math.ceil(getWidth(containerElement) * 100) / 100;\n}\n\nfunction onTextOverflowCallback(\n current: boolean,\n wasEllipsized: boolean,\n onTextOverflow: ((ellipsized: boolean) => void) | undefined,\n) {\n if (onTextOverflow && current !== wasEllipsized) {\n onTextOverflow(current);\n }\n}\n\n/**\n * Detects whether a given formatted text has enough space within its\n * parent container and applies or removes an ellipsis accordingly.\n *\n * @param originalText - The text to be truncated if its width exceeds the container width\n * @param truncationMode - The mode used for truncating the text, either at the start, in the middle or at the end\n * @param containerRef - Object ref pointing towards the root element of the TextEllipsis component\n * @param wasEllipsized - Whether an ellipsis was applied during the last render cycle\n * @param onTextOverflow - Callback that gets called whenever the state of the ellipsis changes since the last render cycle\n *\n * @returns true, if the given text was ellipsized, false otherwise.\n */\nfunction renderEllipsizedText(\n originalText: string,\n truncationMode: TextEllipsisProps['truncationMode'],\n containerRef: RefObject<HTMLSpanElement>,\n wasEllipsized: boolean,\n onTextOverflow?: (ellipsized: boolean) => void,\n): boolean {\n const containerElement = containerRef.current;\n\n const innerSpanElement: HTMLSpanElement | null =\n (containerElement?.firstElementChild as HTMLSpanElement) || null;\n\n if (containerElement === null || innerSpanElement === null) {\n return false;\n }\n\n // always reset to full text before measuring container width\n resetFullText(innerSpanElement, originalText);\n const containerWidth = getContainerWidth(containerElement);\n\n if (!isNativeEllipsisActive(innerSpanElement, containerWidth)) {\n onTextOverflowCallback(false, wasEllipsized, onTextOverflow);\n return false;\n }\n\n if (truncationMode === 'middle') {\n innerSpanElement.textContent = centerEllipsizeText(\n originalText,\n getFontProps(innerSpanElement),\n containerWidth,\n );\n }\n\n onTextOverflowCallback(true, wasEllipsized, onTextOverflow);\n return true;\n}\n\nconst ComputedTextEllipsis = /* @__PURE__ */ forwardRef<\n HTMLSpanElement,\n TextEllipsisProps\n>((props, forwardedRef) => {\n const {\n children,\n truncationMode = 'end',\n onTextOverflow,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n ...remainingProps\n } = props;\n\n // resize observer is needed to re-calculate the ellipsis in case of resizing\n const { ref: observerContainerRef, width } =\n useResizeObserver<HTMLSpanElement>();\n const containerRef = useRef<HTMLSpanElement | null>(null);\n const ellipsisStateRef = useRef<boolean>(false);\n const mergedRef = useMergeRefs<HTMLSpanElement | null>([\n observerContainerRef,\n (instance: HTMLSpanElement) => {\n containerRef.current = instance;\n },\n forwardedRef,\n ]);\n\n const fontsUpdated = useFontsUpdated();\n\n useLayoutEffect(() => {\n ellipsisStateRef.current = renderEllipsizedText(\n children,\n truncationMode,\n containerRef,\n ellipsisStateRef.current,\n onTextOverflow,\n );\n }, [width, children, truncationMode, fontsUpdated, onTextOverflow]);\n\n return (\n <span\n ref={mergedRef}\n aria-label={children}\n data-ellipsis\n data-testid={dataTestId}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n className={clsx(textEllipsisCSS({ truncationMode }), consumerClassName)}\n style={consumerStyle}\n {...remainingProps}\n >\n <span>{children}</span>\n </span>\n );\n});\n\nconst CssTextEllipsis = /* @__PURE__ */ forwardRef<\n HTMLSpanElement,\n TextEllipsisProps\n>((props, forwardedRef) => {\n const {\n children,\n truncationMode = 'end',\n onTextOverflow,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n ...remainingProps\n } = props;\n\n return (\n <span\n ref={forwardedRef}\n aria-label={children}\n data-ellipsis\n data-testid={dataTestId}\n className={clsx(textEllipsisCSS({ truncationMode }), consumerClassName)}\n style={consumerStyle}\n {...remainingProps}\n >\n <span>{children}</span>\n </span>\n );\n});\n\n/**\n * Use the `TextEllipsis` component to truncate text and show an ellipsis whenever\n * there is insufficient space to render the entire text. While some of our Strato\n * components provide ellipsis out of the box, you need to take care of this yourself\n * when writing your own components.\n * @public\n */\nexport const TextEllipsis = /* @__PURE__ */ forwardRef<\n HTMLSpanElement,\n TextEllipsisProps\n>((props, forwardedRef) => {\n // in case onTextOverflow is not defined and the ellipsis is start or end\n // we can use css only which is significantly more performant\n const cssOnlyEllipsis =\n !props.onTextOverflow && props.truncationMode !== 'middle';\n\n return cssOnlyEllipsis ? (\n /* eslint-disable-next-line deprecated-jsx-props/deprecated-props -- The plugin can not properly analyze spread props:\n https://github.com/sebakerckhof/eslint-plugin-deprecated-jsx-props?tab=readme-ov-file#configuration, the deprecations here are in the HTMLAttributes type, which is fine. */\n <CssTextEllipsis ref={forwardedRef} {...props} />\n ) : (\n /* eslint-disable-next-line deprecated-jsx-props/deprecated-props -- The plugin can not properly analyze spread props:\n https://github.com/sebakerckhof/eslint-plugin-deprecated-jsx-props?tab=readme-ov-file#configuration, the deprecations here are in the HTMLAttributes type, which is fine. */\n <ComputedTextEllipsis ref={forwardedRef} {...props} />\n );\n});\n\n(TextEllipsis as typeof TextEllipsis & { displayName: string }).displayName =\n 'TextEllipsis';\n"],
5
+ "mappings": "AAAA,OAAO,UAAU;AACjB,OAAO;AAAA,EACL;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP,OAAO,uBAAuB;AAE9B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAI7B,SAAS,2BAAsC;A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,IACjB;AAAA,IACA,WAAW;AAAA,IACX,OAAO;AAAA,IACP,eAAe;AAAA,IACf,GAAG;AAAA,EACL,IAAI;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,cAAY;AAAA,MACZ,iBAAa;AAAA,MACb,eAAa;AAAA,MACb,WAAW,KAAK,gBAAgB,EAAE,eAAe,CAAC,GAAG,iBAAiB;AAAA,MACtE,OAAO;AAAA,MACN,GAAG;AAAA;AAAA,IAEJ,oCAAC,cAAM,QAAS;AAAA,EAClB;AAEJ,CAAC;AASM,MAAM,eAA+B,2BAG1C,CAAC,OAAO,iBAAiB;AAGzB,QAAM,kBACJ,CAAC,MAAM,kBAAkB,MAAM,mBAAmB;AAEpD,SAAO;AAAA;AAAA;AAAA,IAGL,oCAAC,mBAAgB,KAAK,cAAe,GAAG,OAAO;AAAA;AAAA;AAAA;AAAA,IAI/C,oCAAC,wBAAqB,KAAK,cAAe,GAAG,OAAO;AAAA;AAExD,CAAC;AAEA,aAA+D,cAC9D;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import "./TextEllipsis.css";
2
2
  import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntimeFn";
3
- var textEllipsisCSS = _7a468({ defaultClassName: "_1mnpbqs0-0-85-110", variantClassNames: { truncationMode: { start: "_1mnpbqs1-0-85-110", middle: "_1mnpbqs2-0-85-110", end: "_1mnpbqs3-0-85-110" } }, defaultVariants: {}, compoundVariants: [] });
3
+ var textEllipsisCSS = _7a468({ defaultClassName: "_1mnpbqs0-1-0-0", variantClassNames: { truncationMode: { start: "_1mnpbqs1-1-0-0", middle: "_1mnpbqs2-1-0-0", end: "_1mnpbqs3-1-0-0" } }, defaultVariants: {}, compoundVariants: [] });
4
4
  export {
5
5
  textEllipsisCSS
6
6
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/typography/text-ellipsis/TextEllipsis.css.ts"],
4
- "sourcesContent": ["import './TextEllipsis.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var textEllipsisCSS = _7a468({defaultClassName:'_1mnpbqs0-0-85-110',variantClassNames:{truncationMode:{start:'_1mnpbqs1-0-85-110',middle:'_1mnpbqs2-0-85-110',end:'_1mnpbqs3-0-85-110'}},defaultVariants:{},compoundVariants:[]});"],
5
- "mappings": "AAAA,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,kBAAkB,OAAO,EAAC,kBAAiB,sBAAqB,mBAAkB,EAAC,gBAAe,EAAC,OAAM,sBAAqB,QAAO,sBAAqB,KAAI,qBAAoB,EAAC,GAAE,iBAAgB,CAAC,GAAE,kBAAiB,CAAC,EAAC,CAAC;",
4
+ "sourcesContent": ["import './TextEllipsis.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var textEllipsisCSS = _7a468({defaultClassName:'_1mnpbqs0-1-0-0',variantClassNames:{truncationMode:{start:'_1mnpbqs1-1-0-0',middle:'_1mnpbqs2-1-0-0',end:'_1mnpbqs3-1-0-0'}},defaultVariants:{},compoundVariants:[]});"],
5
+ "mappings": "AAAA,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,kBAAkB,OAAO,EAAC,kBAAiB,mBAAkB,mBAAkB,EAAC,gBAAe,EAAC,OAAM,mBAAkB,QAAO,mBAAkB,KAAI,kBAAiB,EAAC,GAAE,iBAAgB,CAAC,GAAE,kBAAiB,CAAC,EAAC,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
- const _ELLIPSIS_CHARACTER = "\u2026";
2
- const _ELLIPSIS_APPROXIMATION_THRESHOLD = 15;
1
+ const ELLIPSIS_CHARACTER = "\u2026";
2
+ const ELLIPSIS_APPROXIMATION_THRESHOLD = 15;
3
3
  let inMemContext2d;
4
- function _getTextWidth(text, textFont) {
4
+ function getTextWidth(text, textFont) {
5
5
  const context = getCanvasContext2d();
6
6
  context.font = getFontString(textFont);
7
7
  const textMetrics = context.measureText(text);
@@ -11,15 +11,15 @@ function _getTextWidth(text, textFont) {
11
11
  const actualTextWidth = Math.abs(textMetrics.actualBoundingBoxLeft) + Math.abs(textMetrics.actualBoundingBoxRight);
12
12
  return Math.ceil(actualTextWidth);
13
13
  }
14
- function _getTextHeight(text, textFont) {
14
+ function getTextHeight(text, textFont) {
15
15
  const context = getCanvasContext2d();
16
16
  context.font = getFontString(textFont);
17
17
  const textMetrics = context.measureText(text);
18
18
  const actualTextHeight = Math.abs(textMetrics.actualBoundingBoxAscent) + Math.abs(textMetrics.actualBoundingBoxDescent);
19
19
  return Math.ceil(actualTextHeight);
20
20
  }
21
- function _centerEllipsizeText(originalText, textFont, maxWidthInPx) {
22
- const ellipsisInfo = _calculateEllipsisInfo(
21
+ function centerEllipsizeText(originalText, textFont, maxWidthInPx) {
22
+ const ellipsisInfo = calculateEllipsisInfo(
23
23
  originalText,
24
24
  textFont,
25
25
  maxWidthInPx
@@ -30,7 +30,7 @@ function _centerEllipsizeText(originalText, textFont, maxWidthInPx) {
30
30
  const { ellipsisWidth, avgLetterWidth } = ellipsisInfo;
31
31
  const availableTextWidth = maxWidthInPx - ellipsisWidth;
32
32
  if (availableTextWidth <= ellipsisWidth) {
33
- return _ELLIPSIS_CHARACTER;
33
+ return ELLIPSIS_CHARACTER;
34
34
  }
35
35
  const initialPrefixSuffixLength = Math.floor(availableTextWidth / avgLetterWidth / 2) + 1;
36
36
  let prefix;
@@ -45,10 +45,10 @@ function _centerEllipsizeText(originalText, textFont, maxWidthInPx) {
45
45
  suffixLength -= attempt % 2 === 0 ? 1 : 0;
46
46
  prefix = originalText.substring(0, prefixLength);
47
47
  suffix = originalText.substring(originalText.length - suffixLength);
48
- ellipsizedText = `${prefix}${_ELLIPSIS_CHARACTER}${suffix}`;
49
- approximatedTextWidth = _getTextWidth(ellipsizedText, textFont);
48
+ ellipsizedText = `${prefix}${ELLIPSIS_CHARACTER}${suffix}`;
49
+ approximatedTextWidth = getTextWidth(ellipsizedText, textFont);
50
50
  attempt++;
51
- } while (attempt <= _ELLIPSIS_APPROXIMATION_THRESHOLD && approximatedTextWidth >= maxWidthInPx);
51
+ } while (attempt <= ELLIPSIS_APPROXIMATION_THRESHOLD && approximatedTextWidth >= maxWidthInPx);
52
52
  return ellipsizedText;
53
53
  }
54
54
  function getFontString(textFont) {
@@ -65,15 +65,15 @@ function getFontString(textFont) {
65
65
  )
66
66
  ).join(" ");
67
67
  }
68
- function _calculateEllipsisInfo(originalText, textFont, maxWidthInPx) {
68
+ function calculateEllipsisInfo(originalText, textFont, maxWidthInPx) {
69
69
  const originalTextLength = originalText.length;
70
70
  if (originalTextLength <= 1) {
71
71
  return null;
72
72
  }
73
- const textWidth = _getTextWidth(originalText, textFont);
73
+ const textWidth = getTextWidth(originalText, textFont);
74
74
  const avgLetterWidth = textWidth / originalTextLength;
75
75
  return textWidth > maxWidthInPx ? {
76
- ellipsisWidth: _getTextWidth(_ELLIPSIS_CHARACTER, textFont),
76
+ ellipsisWidth: getTextWidth(ELLIPSIS_CHARACTER, textFont),
77
77
  avgLetterWidth
78
78
  } : null;
79
79
  }
@@ -91,11 +91,11 @@ function getCanvasContext2d() {
91
91
  return inMemContext2d;
92
92
  }
93
93
  export {
94
- _ELLIPSIS_APPROXIMATION_THRESHOLD,
95
- _ELLIPSIS_CHARACTER,
96
- _calculateEllipsisInfo,
97
- _centerEllipsizeText,
98
- _getTextHeight,
99
- _getTextWidth
94
+ ELLIPSIS_APPROXIMATION_THRESHOLD,
95
+ ELLIPSIS_CHARACTER,
96
+ calculateEllipsisInfo,
97
+ centerEllipsizeText,
98
+ getTextHeight,
99
+ getTextWidth
100
100
  };
101
101
  //# sourceMappingURL=utils.js.map