@dynatrace/strato-components 1.6.2 → 1.7.2

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 (207) hide show
  1. package/buttons/button/Button.css +16 -16
  2. package/buttons/button/Button.js +1 -1
  3. package/buttons/button/Button.sty.js +4 -4
  4. package/buttons/intent-button/IntentButton.js +1 -1
  5. package/content/progress/ProgressBar.css +71 -71
  6. package/content/progress/ProgressBar.sty.js +5 -5
  7. package/content/progress/ProgressBarIcon.css +2 -2
  8. package/content/progress/ProgressBarIcon.sty.js +1 -1
  9. package/content/progress/ProgressBarLabel.css +3 -3
  10. package/content/progress/ProgressBarLabel.sty.js +1 -1
  11. package/content/progress/ProgressBarValue.css +5 -5
  12. package/content/progress/ProgressBarValue.sty.js +1 -1
  13. package/content/progress/ProgressCircle.css +40 -40
  14. package/content/progress/ProgressCircle.sty.js +5 -5
  15. package/content/skeleton/Skeleton.css +6 -6
  16. package/content/skeleton/Skeleton.sty.js +1 -1
  17. package/core/index.d.ts +0 -4
  18. package/core/index.js +0 -8
  19. package/core/styles/focusRing.css +66 -66
  20. package/core/styles/focusRing.sty.js +2 -2
  21. package/core/utils/colorUtils.css +60 -60
  22. package/core/utils/colorUtils.sty.js +2 -2
  23. package/core/utils/isBrowser.js +1 -1
  24. package/esm/buttons/button/Button.css +16 -16
  25. package/esm/buttons/button/Button.js +1 -1
  26. package/esm/buttons/button/Button.js.map +2 -2
  27. package/esm/buttons/button/Button.sty.js +4 -4
  28. package/esm/buttons/button/Button.sty.js.map +1 -1
  29. package/esm/buttons/intent-button/IntentButton.js +1 -1
  30. package/esm/buttons/intent-button/IntentButton.js.map +1 -1
  31. package/esm/content/progress/ProgressBar.css +71 -71
  32. package/esm/content/progress/ProgressBar.js.map +2 -2
  33. package/esm/content/progress/ProgressBar.sty.js +5 -5
  34. package/esm/content/progress/ProgressBar.sty.js.map +1 -1
  35. package/esm/content/progress/ProgressBarIcon.css +2 -2
  36. package/esm/content/progress/ProgressBarIcon.js.map +2 -2
  37. package/esm/content/progress/ProgressBarIcon.sty.js +1 -1
  38. package/esm/content/progress/ProgressBarIcon.sty.js.map +1 -1
  39. package/esm/content/progress/ProgressBarLabel.css +3 -3
  40. package/esm/content/progress/ProgressBarLabel.js.map +2 -2
  41. package/esm/content/progress/ProgressBarLabel.sty.js +1 -1
  42. package/esm/content/progress/ProgressBarLabel.sty.js.map +1 -1
  43. package/esm/content/progress/ProgressBarValue.css +5 -5
  44. package/esm/content/progress/ProgressBarValue.js.map +2 -2
  45. package/esm/content/progress/ProgressBarValue.sty.js +1 -1
  46. package/esm/content/progress/ProgressBarValue.sty.js.map +1 -1
  47. package/esm/content/progress/ProgressCircle.css +40 -40
  48. package/esm/content/progress/ProgressCircle.js.map +2 -2
  49. package/esm/content/progress/ProgressCircle.sty.js +5 -5
  50. package/esm/content/progress/ProgressCircle.sty.js.map +1 -1
  51. package/esm/content/progress/contexts/SharedProgressBarPropsContext.js.map +2 -2
  52. package/esm/content/skeleton/Skeleton.css +6 -6
  53. package/esm/content/skeleton/Skeleton.sty.js +1 -1
  54. package/esm/content/skeleton/Skeleton.sty.js.map +1 -1
  55. package/esm/core/index.js +0 -8
  56. package/esm/core/index.js.map +2 -2
  57. package/esm/core/styles/focusRing.css +66 -66
  58. package/esm/core/styles/focusRing.sty.js +2 -2
  59. package/esm/core/styles/focusRing.sty.js.map +1 -1
  60. package/esm/core/utils/colorUtils.css +60 -60
  61. package/esm/core/utils/colorUtils.sty.js +2 -2
  62. package/esm/core/utils/colorUtils.sty.js.map +1 -1
  63. package/esm/core/utils/isBrowser.js +1 -1
  64. package/esm/core/utils/isBrowser.js.map +1 -1
  65. package/esm/core/utils/merge-props.js.map +2 -2
  66. package/esm/layouts/container/Container.css +4 -4
  67. package/esm/layouts/container/Container.sty.js +1 -1
  68. package/esm/layouts/container/Container.sty.js.map +1 -1
  69. package/esm/layouts/divider/Divider.css +6 -6
  70. package/esm/layouts/divider/Divider.sty.js +1 -1
  71. package/esm/layouts/divider/Divider.sty.js.map +1 -1
  72. package/esm/layouts/surface/Surface.css +39 -39
  73. package/esm/layouts/surface/Surface.sty.js +2 -2
  74. package/esm/layouts/surface/Surface.sty.js.map +1 -1
  75. package/esm/layouts/surface/variables.sty.js +1 -1
  76. package/esm/layouts/surface/variables.sty.js.map +1 -1
  77. package/esm/styles/colorUtils.css +60 -60
  78. package/esm/styles/colorUtils.sty.js +2 -2
  79. package/esm/styles/colorUtils.sty.js.map +1 -1
  80. package/esm/styles/container.css +47 -47
  81. package/esm/styles/container.sty.js +2 -2
  82. package/esm/styles/container.sty.js.map +1 -1
  83. package/esm/styles/ellipsis.css +1 -1
  84. package/esm/styles/ellipsis.sty.js +1 -1
  85. package/esm/styles/ellipsis.sty.js.map +1 -1
  86. package/esm/styles/field.css +153 -153
  87. package/esm/styles/field.sty.js +2 -2
  88. package/esm/styles/field.sty.js.map +1 -1
  89. package/esm/styles/sprinkles.css +262 -262
  90. package/esm/styles/sprinkles.sty.js +1 -1
  91. package/esm/styles/sprinkles.sty.js.map +1 -1
  92. package/esm/styles/textStyle.css +8 -8
  93. package/esm/styles/textStyle.sty.js +1 -1
  94. package/esm/styles/textStyle.sty.js.map +1 -1
  95. package/esm/typography/block-quote/Blockquote.css +2 -2
  96. package/esm/typography/block-quote/Blockquote.sty.js +1 -1
  97. package/esm/typography/block-quote/Blockquote.sty.js.map +1 -1
  98. package/esm/typography/code/Code.css +1 -1
  99. package/esm/typography/code/Code.sty.js +1 -1
  100. package/esm/typography/code/Code.sty.js.map +1 -1
  101. package/esm/typography/emphasis/Emphasis.css +1 -1
  102. package/esm/typography/emphasis/Emphasis.sty.js +1 -1
  103. package/esm/typography/emphasis/Emphasis.sty.js.map +1 -1
  104. package/esm/typography/external-link/ExternalLink.css +6 -6
  105. package/esm/typography/external-link/ExternalLink.sty.js +1 -1
  106. package/esm/typography/external-link/ExternalLink.sty.js.map +1 -1
  107. package/esm/typography/heading/Heading.css +7 -7
  108. package/esm/typography/heading/Heading.sty.js +1 -1
  109. package/esm/typography/heading/Heading.sty.js.map +1 -1
  110. package/esm/typography/highlight/Highlight.css +1 -1
  111. package/esm/typography/highlight/Highlight.js +1 -1
  112. package/esm/typography/highlight/Highlight.js.map +2 -2
  113. package/esm/typography/highlight/Highlight.sty.js +1 -1
  114. package/esm/typography/highlight/Highlight.sty.js.map +1 -1
  115. package/esm/typography/index.js.map +1 -1
  116. package/esm/typography/link/Link.css +4 -4
  117. package/esm/typography/link/Link.sty.js +1 -1
  118. package/esm/typography/link/Link.sty.js.map +1 -1
  119. package/esm/typography/list/List.css +4 -4
  120. package/esm/typography/list/List.sty.js +2 -2
  121. package/esm/typography/list/List.sty.js.map +1 -1
  122. package/esm/typography/paragraph/Paragraph.css +3 -3
  123. package/esm/typography/paragraph/Paragraph.sty.js +1 -1
  124. package/esm/typography/paragraph/Paragraph.sty.js.map +1 -1
  125. package/esm/typography/strikethrough/Strikethrough.css +1 -1
  126. package/esm/typography/strikethrough/Strikethrough.sty.js +1 -1
  127. package/esm/typography/strikethrough/Strikethrough.sty.js.map +1 -1
  128. package/esm/typography/strong/Strong.css +1 -1
  129. package/esm/typography/strong/Strong.sty.js +1 -1
  130. package/esm/typography/strong/Strong.sty.js.map +1 -1
  131. package/esm/typography/text/Text.css +3 -3
  132. package/esm/typography/text/Text.sty.js +1 -1
  133. package/esm/typography/text/Text.sty.js.map +1 -1
  134. package/esm/typography/text-ellipsis/TextEllipsis.css +6 -6
  135. package/esm/typography/text-ellipsis/TextEllipsis.js +1 -9
  136. package/esm/typography/text-ellipsis/TextEllipsis.js.map +2 -2
  137. package/esm/typography/text-ellipsis/TextEllipsis.sty.js +2 -2
  138. package/esm/typography/text-ellipsis/TextEllipsis.sty.js.map +1 -1
  139. package/esm/typography/utils.js +16 -4
  140. package/esm/typography/utils.js.map +2 -2
  141. package/layouts/container/Container.css +4 -4
  142. package/layouts/container/Container.sty.js +1 -1
  143. package/layouts/divider/Divider.css +6 -6
  144. package/layouts/divider/Divider.sty.js +1 -1
  145. package/layouts/surface/Surface.css +39 -39
  146. package/layouts/surface/Surface.sty.js +2 -2
  147. package/layouts/surface/variables.sty.js +1 -1
  148. package/package.json +3 -3
  149. package/styles/colorUtils.css +60 -60
  150. package/styles/colorUtils.sty.js +2 -2
  151. package/styles/container.css +47 -47
  152. package/styles/container.sty.js +2 -2
  153. package/styles/ellipsis.css +1 -1
  154. package/styles/ellipsis.sty.js +1 -1
  155. package/styles/field.css +153 -153
  156. package/styles/field.sty.js +2 -2
  157. package/styles/sprinkles.css +262 -262
  158. package/styles/sprinkles.sty.js +1 -1
  159. package/styles/textStyle.css +8 -8
  160. package/styles/textStyle.sty.js +1 -1
  161. package/typography/block-quote/Blockquote.css +2 -2
  162. package/typography/block-quote/Blockquote.sty.js +1 -1
  163. package/typography/code/Code.css +1 -1
  164. package/typography/code/Code.sty.js +1 -1
  165. package/typography/emphasis/Emphasis.css +1 -1
  166. package/typography/emphasis/Emphasis.sty.js +1 -1
  167. package/typography/external-link/ExternalLink.css +6 -6
  168. package/typography/external-link/ExternalLink.sty.js +1 -1
  169. package/typography/heading/Heading.css +7 -7
  170. package/typography/heading/Heading.sty.js +1 -1
  171. package/typography/highlight/Highlight.css +1 -1
  172. package/typography/highlight/Highlight.js +1 -1
  173. package/typography/highlight/Highlight.sty.js +1 -1
  174. package/typography/index.d.ts +1 -1
  175. package/typography/link/Link.css +4 -4
  176. package/typography/link/Link.sty.js +1 -1
  177. package/typography/list/List.css +4 -4
  178. package/typography/list/List.sty.js +2 -2
  179. package/typography/paragraph/Paragraph.css +3 -3
  180. package/typography/paragraph/Paragraph.sty.js +1 -1
  181. package/typography/strikethrough/Strikethrough.css +1 -1
  182. package/typography/strikethrough/Strikethrough.sty.js +1 -1
  183. package/typography/strong/Strong.css +1 -1
  184. package/typography/strong/Strong.sty.js +1 -1
  185. package/typography/text/Text.css +3 -3
  186. package/typography/text/Text.sty.js +1 -1
  187. package/typography/text-ellipsis/TextEllipsis.css +6 -6
  188. package/typography/text-ellipsis/TextEllipsis.d.ts +2 -2
  189. package/typography/text-ellipsis/TextEllipsis.js +1 -9
  190. package/typography/text-ellipsis/TextEllipsis.sty.js +2 -2
  191. package/typography/utils.js +16 -4
  192. package/core/hooks/useId.d.ts +0 -12
  193. package/core/hooks/useId.js +0 -33
  194. package/core/utils/_is-string-children.d.ts +0 -6
  195. package/core/utils/_is-string-children.js +0 -35
  196. package/core/utils/seed-random.d.ts +0 -5
  197. package/core/utils/seed-random.js +0 -35
  198. package/core/utils/uuidv4.d.ts +0 -5
  199. package/core/utils/uuidv4.js +0 -32
  200. package/esm/core/hooks/useId.js +0 -14
  201. package/esm/core/hooks/useId.js.map +0 -7
  202. package/esm/core/utils/_is-string-children.js +0 -16
  203. package/esm/core/utils/_is-string-children.js.map +0 -7
  204. package/esm/core/utils/seed-random.js +0 -16
  205. package/esm/core/utils/seed-random.js.map +0 -7
  206. package/esm/core/utils/uuidv4.js +0 -13
  207. package/esm/core/utils/uuidv4.js.map +0 -7
@@ -1,15 +1,15 @@
1
- ._1iksxp40-1-6-2 {
1
+ ._1iksxp40-1-7-2 {
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-1-6-2:hover {
7
+ ._1iksxp40-1-7-2:hover {
8
8
  color: var(--dt-colors-text-primary-default-hover, #3332ae);
9
9
  }
10
- ._1iksxp40-1-6-2:active {
10
+ ._1iksxp40-1-7-2:active {
11
11
  color: var(--dt-colors-text-primary-default-active, #241193);
12
12
  }
13
- ._1iksxp40-1-6-2:focus-visible {
13
+ ._1iksxp40-1-7-2:focus-visible {
14
14
  text-decoration: none;
15
15
  }
@@ -1,5 +1,5 @@
1
1
  import "./Link.css";
2
- var linkCSS = "_1iksxp40-1-6-2";
2
+ var linkCSS = "_1iksxp40-1-7-2";
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-1-6-2';"],
4
+ "sourcesContent": ["import './Link.css';\nexport var linkCSS = '_1iksxp40-1-7-2';"],
5
5
  "mappings": "AAAA,OAAO;AACA,IAAI,UAAU;",
6
6
  "names": []
7
7
  }
@@ -1,16 +1,16 @@
1
- ._16276mt0-1-6-2 {
1
+ ._16276mt0-1-7-2 {
2
2
  margin: 0;
3
3
  padding-left: var(--dt-spacings-size-40, 40px);
4
4
  }
5
- ._16276mt0-1-6-2 ._16276mt0-1-6-2 {
5
+ ._16276mt0-1-7-2 ._16276mt0-1-7-2 {
6
6
  margin-block: var(--dt-spacings-size-4, 4px);
7
7
  padding-left: var(--dt-spacings-size-28, 28px);
8
8
  }
9
- ._16276mt1-1-6-2 {
9
+ ._16276mt1-1-7-2 {
10
10
  position: relative;
11
11
  overflow-wrap: break-word;
12
12
  margin-block: var(--dt-spacings-size-2, 2px);
13
13
  }
14
- ._16276mt1-1-6-2::marker {
14
+ ._16276mt1-1-7-2::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-1-6-2";
3
- var listItemCSS = "_16276mt1-1-6-2";
2
+ var listCSS = "_16276mt0-1-7-2";
3
+ var listItemCSS = "_16276mt1-1-7-2";
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-1-6-2';\nexport var listItemCSS = '_16276mt1-1-6-2';"],
4
+ "sourcesContent": ["import './List.css';\nexport var listCSS = '_16276mt0-1-7-2';\nexport var listItemCSS = '_16276mt1-1-7-2';"],
5
5
  "mappings": "AAAA,OAAO;AACA,IAAI,UAAU;AACd,IAAI,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,17 +1,17 @@
1
- ._487p2n0-1-6-2 {
1
+ ._487p2n0-1-7-2 {
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-1-6-2 {
8
+ ._487p2n1-1-7-2 {
9
9
  display: block;
10
10
  white-space: nowrap;
11
11
  text-overflow: ellipsis;
12
12
  overflow: hidden;
13
13
  }
14
- ._487p2n2-1-6-2 {
14
+ ._487p2n2-1-7-2 {
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-1-6-2", variantClassNames: { ellipsis: { singleLine: "_487p2n1-1-6-2", multiLine: "_487p2n2-1-6-2" } }, defaultVariants: {}, compoundVariants: [] });
3
+ var paragraphCSS = _7a468({ defaultClassName: "_487p2n0-1-7-2", variantClassNames: { ellipsis: { singleLine: "_487p2n1-1-7-2", multiLine: "_487p2n2-1-7-2" } }, 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-1-6-2',variantClassNames:{ellipsis:{singleLine:'_487p2n1-1-6-2',multiLine:'_487p2n2-1-6-2'}},defaultVariants:{},compoundVariants:[]});"],
4
+ "sourcesContent": ["import './Paragraph.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var paragraphCSS = _7a468({defaultClassName:'_487p2n0-1-7-2',variantClassNames:{ellipsis:{singleLine:'_487p2n1-1-7-2',multiLine:'_487p2n2-1-7-2'}},defaultVariants:{},compoundVariants:[]});"],
5
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-1-6-2 {
1
+ ._4oao6y0-1-7-2 {
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-1-6-2";
2
+ var strikethroughCSS = "_4oao6y0-1-7-2";
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-1-6-2';"],
4
+ "sourcesContent": ["import './Strikethrough.css';\nexport var strikethroughCSS = '_4oao6y0-1-7-2';"],
5
5
  "mappings": "AAAA,OAAO;AACA,IAAI,mBAAmB;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- ._wxp4dd0-1-6-2 {
1
+ ._wxp4dd0-1-7-2 {
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-1-6-2";
2
+ var strongCSS = "_wxp4dd0-1-7-2";
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-1-6-2';"],
4
+ "sourcesContent": ["import './Strong.css';\nexport var strongCSS = '_wxp4dd0-1-7-2';"],
5
5
  "mappings": "AAAA,OAAO;AACA,IAAI,YAAY;",
6
6
  "names": []
7
7
  }
@@ -1,16 +1,16 @@
1
- ._rup8ap0-1-6-2 {
1
+ ._rup8ap0-1-7-2 {
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-1-6-2 {
7
+ ._rup8ap1-1-7-2 {
8
8
  display: block;
9
9
  white-space: nowrap;
10
10
  text-overflow: ellipsis;
11
11
  overflow: hidden;
12
12
  }
13
- ._rup8ap2-1-6-2 {
13
+ ._rup8ap2-1-7-2 {
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-1-6-2", variantClassNames: { ellipsis: { singleLine: "_rup8ap1-1-6-2", multiLine: "_rup8ap2-1-6-2" } }, defaultVariants: {}, compoundVariants: [] });
3
+ var textCSS = _7a468({ defaultClassName: "_rup8ap0-1-7-2", variantClassNames: { ellipsis: { singleLine: "_rup8ap1-1-7-2", multiLine: "_rup8ap2-1-7-2" } }, 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-1-6-2',variantClassNames:{ellipsis:{singleLine:'_rup8ap1-1-6-2',multiLine:'_rup8ap2-1-6-2'}},defaultVariants:{},compoundVariants:[]});"],
4
+ "sourcesContent": ["import './Text.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var textCSS = _7a468({defaultClassName:'_rup8ap0-1-7-2',variantClassNames:{ellipsis:{singleLine:'_rup8ap1-1-7-2',multiLine:'_rup8ap2-1-7-2'}},defaultVariants:{},compoundVariants:[]});"],
5
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
- ._1mnpbqs1-1-6-2 {
1
+ ._1mnpbqs1-1-7-2 {
2
2
  display: inline-block;
3
3
  box-sizing: border-box;
4
4
  vertical-align: middle;
@@ -9,18 +9,18 @@
9
9
  text-decoration: inherit;
10
10
  width: 100%;
11
11
  }
12
- ._1mnpbqs2-1-6-2 {
12
+ ._1mnpbqs2-1-7-2 {
13
13
  text-overflow: ellipsis;
14
14
  direction: rtl;
15
15
  text-align: left;
16
16
  }
17
- ._1mnpbqs2-1-6-2::after {
17
+ ._1mnpbqs2-1-7-2::after {
18
18
  content: "‎";
19
19
  }
20
- ._1mnpbqs3-1-6-2 {
20
+ ._1mnpbqs3-1-7-2 {
21
21
  text-overflow: clip;
22
22
  }
23
- ._1mnpbqs3-1-6-2._1mnpbqs0-1-6-2:after {
23
+ ._1mnpbqs3-1-7-2._1mnpbqs0-1-7-2:after {
24
24
  content: attr(data-sourcetext) / "";
25
25
  color: transparent;
26
26
  display: table;
@@ -28,6 +28,6 @@
28
28
  line-height: 0;
29
29
  user-select: none;
30
30
  }
31
- ._1mnpbqs4-1-6-2 {
31
+ ._1mnpbqs4-1-7-2 {
32
32
  text-overflow: ellipsis;
33
33
  }
@@ -142,15 +142,7 @@ const CssTextEllipsis = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
142
142
  });
143
143
  const TextEllipsis = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
144
144
  const cssOnlyEllipsis = !props.onTextOverflow && props.truncationMode !== "middle";
145
- return cssOnlyEllipsis ? (
146
- /* eslint-disable-next-line deprecated-jsx-props/deprecated-props -- The plugin can not properly analyze spread props:
147
- 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. */
148
- /* @__PURE__ */ jsx(CssTextEllipsis, { ref: forwardedRef, ...props })
149
- ) : (
150
- /* eslint-disable-next-line deprecated-jsx-props/deprecated-props -- The plugin can not properly analyze spread props:
151
- 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. */
152
- /* @__PURE__ */ jsx(ComputedTextEllipsis, { ref: forwardedRef, ...props })
153
- );
145
+ return cssOnlyEllipsis ? /* @__PURE__ */ jsx(CssTextEllipsis, { ref: forwardedRef, ...props }) : /* @__PURE__ */ jsx(ComputedTextEllipsis, { ref: forwardedRef, ...props });
154
146
  });
155
147
  TextEllipsis.displayName = "TextEllipsis";
156
148
  export {
@@ -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 {\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 { ellipsisCSS, isActiveCSS } 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 | null>,\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-sourcetext={children}\n data-ellipsis\n data-testid={dataTestId}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n className={clsx(ellipsisCSS({ truncationMode }), consumerClassName, {\n [isActiveCSS]: ellipsisStateRef.current,\n })}\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(ellipsisCSS({ 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": "AAqNM;AArNN,OAAO,UAAU;AACjB;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP,OAAO,uBAAuB;AAE9B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAI7B,SAAS,2BAAsC;AAC/C,SAAS,aAAa,mBAAmB;AAmCzC,SAAS,aAAa,kBAAyC;AAC7D,QAAM,gBAAgB,OAAO,iBAAiB,kBAAkB,IAAI;AAEpE,SAAO;AAAA,IACL,WAAW,cAAc,iBAAiB,Y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AG;AAAA,EACL,IAAI;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,cAAY;AAAA,MACZ,iBAAa;AAAA,MACb,eAAa;AAAA,MACb,WAAW,KAAK,YAAY,EAAE,eAAe,CAAC,GAAG,iBAAiB;AAAA,MAClE,OAAO;AAAA,MACN,GAAG;AAAA,MAEJ,8BAAC,UAAM,UAAS;AAAA;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,oBAAC,mBAAgB,KAAK,cAAe,GAAG,OAAO;AAAA;AAAA;AAAA;AAAA,IAI/C,oBAAC,wBAAqB,KAAK,cAAe,GAAG,OAAO;AAAA;AAExD,CAAC;AAEA,aAA+D,cAC9D;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport {\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 { ellipsisCSS, isActiveCSS } from './TextEllipsis.sty.js';\n\n/**\n * Available modes for how overly long text is truncated and where the ellipsis is placed.\n * @public\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?: TruncationMode;\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 | null>,\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-sourcetext={children}\n data-ellipsis\n data-testid={dataTestId}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n className={clsx(ellipsisCSS({ truncationMode }), consumerClassName, {\n [isActiveCSS]: ellipsisStateRef.current,\n })}\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(ellipsisCSS({ 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 <CssTextEllipsis ref={forwardedRef} {...props} />\n ) : (\n <ComputedTextEllipsis ref={forwardedRef} {...props} />\n );\n});\n\n(TextEllipsis as typeof TextEllipsis & { displayName: string }).displayName =\n 'TextEllipsis';\n"],
5
+ "mappings": "AAqNM;AArNN,OAAO,UAAU;AACjB;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP,OAAO,uBAAuB;AAE9B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAI7B,SAAS,2BAAsC;AAC/C,SAAS,aAAa,mBAAmB;AAmCzC,SAAS,aAAa,kBAAyC;AAC7D,QAAM,gBAAgB,OAAO,iBAAiB,kBAAkB,IAAI;AAEpE,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,kBACA,gBACS;AAGT,QAAM,oBAAoB,KAAK;AAAA,IAC7B,iBAAiB,sBAAsB,EAAE;AAAA,IACzC,iBAAiB;AAAA,EACnB;AACA,QAAM,YAAY,KAAK,MAAM,oBAAoB,GAAG,IAAI;AAExD,SAAO,YAAY;AACrB;AAEA,SAAS,cACP,kBACA,cACA;AACA,MAAI,iBAAiB,gBAAgB,cAAc;AACjD,qBAAiB,cAAc;AAAA,EACjC;AACF;AAEA,SAAS,SAAS,SAA0B;AAC1C,SAAO,KAAK,IAAI,QAAQ,sBAAsB,EAAE,OAAO,QAAQ,WAAW;AAC5E;AAEA,SAAS,kBAAkB,kBAAmC;AAC5D,SAAO,KAAK,KAAK,SAAS,gBAAgB,IAAI,GAAG,IAAI;AACvD;AAEA,SAAS,uBACP,SACA,eACA,gBACA;AACA,MAAI,kBAAkB,YAAY,eAAe;AAC/C,mBAAe,OAAO;AAAA,EACxB;AACF;AAcA,SAAS,qBACP,cACA,gBACA,cACA,eACA,gBACS;AACT,QAAM,mBAA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a;AAAA,MACb,eAAa;AAAA,MACb,mBAAiB;AAAA,MACjB,oBAAkB;AAAA,MAClB,WAAW,KAAK,YAAY,EAAE,eAAe,CAAC,GAAG,mBAAmB;AAAA,QAClE,CAAC,WAAW,GAAG,iBAAiB;AAAA,MAClC,CAAC;AAAA,MACD,OAAO;AAAA,MACN,GAAG;AAAA,MAEJ,8BAAC,UAAM,UAAS;AAAA;AAAA,EAClB;AAEJ,CAAC;AAED,MAAM,kBAAkC,2BAGtC,CAAC,OAAO,iBAAiB;AACzB,QAAM;AAAA,IACJ;AAAA,IACA,iBAAiB;AAAA,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,YAAY,EAAE,eAAe,CAAC,GAAG,iBAAiB;AAAA,MAClE,OAAO;AAAA,MACN,GAAG;AAAA,MAEJ,8BAAC,UAAM,UAAS;AAAA;AAAA,EAClB;AAEJ,CAAC;AASM,MAAM,eAA+B,2BAG1C,CAAC,OAAO,iBAAiB;AAGzB,QAAM,kBACJ,CAAC,MAAM,kBAAkB,MAAM,mBAAmB;AAEpD,SAAO,kBACL,oBAAC,mBAAgB,KAAK,cAAe,GAAG,OAAO,IAE/C,oBAAC,wBAAqB,KAAK,cAAe,GAAG,OAAO;AAExD,CAAC;AAEA,aAA+D,cAC9D;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import "./TextEllipsis.css";
2
2
  import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntimeFn";
3
- var ellipsisCSS = _7a468({ defaultClassName: "_1mnpbqs1-1-6-2", variantClassNames: { truncationMode: { start: "_1mnpbqs2-1-6-2", middle: "_1mnpbqs3-1-6-2", end: "_1mnpbqs4-1-6-2" } }, defaultVariants: {}, compoundVariants: [] });
4
- var isActiveCSS = "_1mnpbqs0-1-6-2";
3
+ var ellipsisCSS = _7a468({ defaultClassName: "_1mnpbqs1-1-7-2", variantClassNames: { truncationMode: { start: "_1mnpbqs2-1-7-2", middle: "_1mnpbqs3-1-7-2", end: "_1mnpbqs4-1-7-2" } }, defaultVariants: {}, compoundVariants: [] });
4
+ var isActiveCSS = "_1mnpbqs0-1-7-2";
5
5
  export {
6
6
  ellipsisCSS,
7
7
  isActiveCSS
@@ -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 ellipsisCSS = _7a468({defaultClassName:'_1mnpbqs1-1-6-2',variantClassNames:{truncationMode:{start:'_1mnpbqs2-1-6-2',middle:'_1mnpbqs3-1-6-2',end:'_1mnpbqs4-1-6-2'}},defaultVariants:{},compoundVariants:[]});\nexport var isActiveCSS = '_1mnpbqs0-1-6-2';"],
4
+ "sourcesContent": ["import './TextEllipsis.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var ellipsisCSS = _7a468({defaultClassName:'_1mnpbqs1-1-7-2',variantClassNames:{truncationMode:{start:'_1mnpbqs2-1-7-2',middle:'_1mnpbqs3-1-7-2',end:'_1mnpbqs4-1-7-2'}},defaultVariants:{},compoundVariants:[]});\nexport var isActiveCSS = '_1mnpbqs0-1-7-2';"],
5
5
  "mappings": "AAAA,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,cAAc,OAAO,EAAC,kBAAiB,mBAAkB,mBAAkB,EAAC,gBAAe,EAAC,OAAM,mBAAkB,QAAO,mBAAkB,KAAI,kBAAiB,EAAC,GAAE,iBAAgB,CAAC,GAAE,kBAAiB,CAAC,EAAC,CAAC;AAChN,IAAI,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,7 @@
1
+ import { getLanguage } from "@dynatrace-sdk/user-preferences";
2
+ const localizedSegmenter = new Intl.Segmenter(getLanguage(), {
3
+ granularity: "grapheme"
4
+ });
1
5
  const ELLIPSIS_CHARACTER = "\u2026";
2
6
  const ELLIPSIS_APPROXIMATION_THRESHOLD = 15;
3
7
  let inMemContext2d;
@@ -40,11 +44,15 @@ function centerEllipsizeText(originalText, textFont, maxWidthInPx) {
40
44
  let attempt = 1;
41
45
  let prefixLength = initialPrefixSuffixLength;
42
46
  let suffixLength = initialPrefixSuffixLength;
47
+ const originalSegmentedText = Array.from(
48
+ localizedSegmenter.segment(originalText)
49
+ ).map((segment) => segment.segment);
43
50
  do {
51
+ const originalSegmentedTextCopy = [...originalSegmentedText];
44
52
  prefixLength -= attempt % 2 === 1 ? 1 : 0;
45
53
  suffixLength -= attempt % 2 === 0 ? 1 : 0;
46
- prefix = originalText.substring(0, prefixLength);
47
- suffix = originalText.substring(originalText.length - suffixLength);
54
+ prefix = originalSegmentedTextCopy.slice(0, prefixLength).join("");
55
+ suffix = originalSegmentedTextCopy.slice(suffixLength * -1).join("");
48
56
  ellipsizedText = `${prefix}${ELLIPSIS_CHARACTER}${suffix}`;
49
57
  approximatedTextWidth = getTextWidth(ellipsizedText, textFont);
50
58
  attempt++;
@@ -66,7 +74,9 @@ function getFontString(textFont) {
66
74
  ).join(" ");
67
75
  }
68
76
  function calculateEllipsisInfo(originalText, textFont, maxWidthInPx) {
69
- const originalTextLength = originalText.length;
77
+ const originalTextLength = Array.from(
78
+ localizedSegmenter.segment(originalText)
79
+ ).length;
70
80
  if (originalTextLength <= 1) {
71
81
  return null;
72
82
  }
@@ -79,7 +89,9 @@ function calculateEllipsisInfo(originalText, textFont, maxWidthInPx) {
79
89
  }
80
90
  function getCanvasContext2d() {
81
91
  if (!inMemContext2d) {
82
- const context = document.createElement("canvas").getContext("2d");
92
+ const canvas = document.createElement("canvas");
93
+ canvas.hidden = true;
94
+ const context = canvas.getContext("2d", { alpha: false });
83
95
  if (context !== null) {
84
96
  context.imageSmoothingEnabled = false;
85
97
  context.imageSmoothingQuality = "low";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/typography/utils.ts"],
4
- "sourcesContent": ["/**\n * Properties describing how a piece of text is formatted.\n * @internal\n */\nexport type Font = {\n fontStyle?: string;\n fontWeight?: string;\n fontSize: string;\n fontFamily: string;\n};\n\n/**\n * The Unicode character representing an ellipsis.\n * @internal\n */\nexport const ELLIPSIS_CHARACTER = '\\u2026';\n\n/**\n * Max iterations for finding the perfect truncated text for a given width\n * @internal\n */\nexport const ELLIPSIS_APPROXIMATION_THRESHOLD = 15;\n\nlet inMemContext2d: CanvasRenderingContext2D;\n\n/**\n * Calculates the width of formatted text in pixels.\n *\n * @param text - The text to calculate the width of\n * @param textFont - The font settings for the text\n * @internal\n */\nexport function getTextWidth(text: string, textFont: Font): number {\n const context = getCanvasContext2d();\n\n context.font = getFontString(textFont);\n\n const textMetrics = context.measureText(text);\n\n // this branch is relevant for mocked canvas API in unit tests\n if (textMetrics.width < 0) {\n return textMetrics.width;\n }\n\n // more accurate than using metrics width\n // see https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics#measuring_text_width\n const actualTextWidth =\n Math.abs(textMetrics.actualBoundingBoxLeft) +\n Math.abs(textMetrics.actualBoundingBoxRight);\n\n // Scrap sub-pixel accuracy and always round up to be on the safer side\n return Math.ceil(actualTextWidth);\n}\n\n/**\n * Calculates the height of formatted text in pixels.\n * @param text - The text to calculate the height of\n * @param textFont - The font settings for the text\n * @internal\n */\nexport function getTextHeight(text: string, textFont: Font): number {\n const context = getCanvasContext2d();\n\n context.font = getFontString(textFont);\n\n const textMetrics = context.measureText(text);\n\n const actualTextHeight =\n Math.abs(textMetrics.actualBoundingBoxAscent) +\n Math.abs(textMetrics.actualBoundingBoxDescent);\n\n // Scrap sub-pixel accuracy and always round up to be on the safer side\n return Math.ceil(actualTextHeight);\n}\n\n/**\n * Cuts off text that exceeds the maximum width in the center and\n * concatenates both shortened ends of the text with an ellipsis.\n *\n * @param originalText - The text to be truncated if its width exceeds <code>maxWidthInPx</code>\n * @param textFont - Different font settings to be considered when determining the width of the text\n * @param maxWidthInPx - If the text's width exceeds this value, the text will be truncated to a string whose width is guaranteed to be below it\n * @internal\n */\nexport function centerEllipsizeText(\n originalText: string,\n textFont: Font,\n maxWidthInPx: number,\n): string {\n const ellipsisInfo = calculateEllipsisInfo(\n originalText,\n textFont,\n maxWidthInPx,\n );\n\n if (ellipsisInfo === null) {\n return originalText;\n }\n\n const { ellipsisWidth, avgLetterWidth } = ellipsisInfo;\n const availableTextWidth = maxWidthInPx - ellipsisWidth;\n\n if (availableTextWidth <= ellipsisWidth) {\n return ELLIPSIS_CHARACTER;\n }\n\n const initialPrefixSuffixLength =\n Math.floor(availableTextWidth / avgLetterWidth / 2) + 1;\n\n let prefix: string;\n let suffix: string;\n let ellipsizedText: string;\n let approximatedTextWidth: number;\n let attempt = 1;\n let prefixLength = initialPrefixSuffixLength;\n let suffixLength = initialPrefixSuffixLength;\n\n do {\n prefixLength -= attempt % 2 === 1 ? 1 : 0;\n suffixLength -= attempt % 2 === 0 ? 1 : 0;\n\n prefix = originalText.substring(0, prefixLength);\n suffix = originalText.substring(originalText.length - suffixLength);\n\n ellipsizedText = `${prefix}${ELLIPSIS_CHARACTER}${suffix}`;\n approximatedTextWidth = getTextWidth(ellipsizedText, textFont);\n\n attempt++;\n } while (\n attempt <= ELLIPSIS_APPROXIMATION_THRESHOLD &&\n approximatedTextWidth >= maxWidthInPx\n );\n\n return ellipsizedText;\n}\n\n/**\n * Transforms a font settings object into a CSS font specifier string\n * that can be used on 2D canvas contexts.\n */\nfunction getFontString(textFont: Font): string {\n const { fontStyle, fontWeight, fontSize, fontFamily } = textFont;\n\n // Note: always drop default values for fontStyle and fontWeight as\n // these can randomly (!) break text width detection!\n return [\n fontStyle === 'normal' ? '' : fontStyle,\n fontWeight === '400' ? '' : fontWeight,\n fontSize,\n fontFamily,\n ]\n .filter((value) => value !== undefined && value !== '')\n .map((value) =>\n // we need to resolve CSS variables manually because they are not supported by the canvas API\n value?.trim().startsWith('var(')\n ? value.replace(/^\\s*var\\(--[0-9A-Za-z-]+,\\s*([^)]+)\\)\\s*$/, '$1')\n : value,\n )\n .join(' ');\n}\n\n/**\n * Returns an object containing the width of a given formatted text and the\n * width of an ellipsis character with the same text format or `null`\n * if the text width does not exceed its maximum available width.\n * @internal\n */\nexport function calculateEllipsisInfo(\n originalText: string,\n textFont: Font,\n maxWidthInPx: number,\n): { ellipsisWidth: number; avgLetterWidth: number } | null {\n const originalTextLength = originalText.length;\n\n if (originalTextLength <= 1) {\n return null;\n }\n\n const textWidth = getTextWidth(originalText, textFont);\n const avgLetterWidth = textWidth / originalTextLength;\n\n return textWidth > maxWidthInPx\n ? {\n ellipsisWidth: getTextWidth(ELLIPSIS_CHARACTER, textFont),\n avgLetterWidth,\n }\n : null;\n}\n\n/** Returns the canvas 2D context used for measuring the width of formatted text. */\nfunction getCanvasContext2d() {\n if (!inMemContext2d) {\n const context = document.createElement('canvas').getContext('2d');\n\n if (context !== null) {\n context.imageSmoothingEnabled = false;\n context.imageSmoothingQuality = 'low';\n inMemContext2d = context;\n } else {\n throw new Error('Failed to create a Canvas 2D context');\n }\n }\n\n return inMemContext2d;\n}\n"],
5
- "mappings": "AAeO,MAAM,qBAAqB;AAM3B,MAAM,mCAAmC;AAEhD,IAAI;AASG,SAAS,aAAa,MAAc,UAAwB;AACjE,QAAM,UAAU,mBAAmB;AAEnC,UAAQ,OAAO,cAAc,QAAQ;AAErC,QAAM,cAAc,QAAQ,YAAY,IAAI;AAG5C,MAAI,YAAY,QAAQ,GAAG;AACzB,WAAO,YAAY;AAAA,EACrB;AAIA,QAAM,kBACJ,KAAK,IAAI,YAAY,qBAAqB,IAC1C,KAAK,IAAI,YAAY,sBAAsB;AAG7C,SAAO,KAAK,KAAK,eAAe;AAClC;A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AI,CAAC;AAAA;AAAA,MAEJ,OAAO,KAAK,EAAE,WAAW,MAAM,IAC3B,MAAM,QAAQ,6CAA6C,IAAI,IAC/D;AAAA;AAAA,EACN,EACC,KAAK,GAAG;AACb;AAQO,SAAS,sBACd,cACA,UACA,cAC0D;AAC1D,QAAM,qBAAqB,aAAa;AAExC,MAAI,sBAAsB,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,aAAa,cAAc,QAAQ;AACrD,QAAM,iBAAiB,YAAY;AAEnC,SAAO,YAAY,eACf;AAAA,IACE,eAAe,aAAa,oBAAoB,QAAQ;AAAA,IACxD;AAAA,EACF,IACA;AACN;AAGA,SAAS,qBAAqB;AAC5B,MAAI,CAAC,gBAAgB;AACnB,UAAM,UAAU,SAAS,cAAc,QAAQ,EAAE,WAAW,IAAI;AAEhE,QAAI,YAAY,MAAM;AACpB,cAAQ,wBAAwB;AAChC,cAAQ,wBAAwB;AAChC,uBAAiB;AAAA,IACnB,OAAO;AACL,YAAM,IAAI,MAAM,sCAAsC;AAAA,IACxD;AAAA,EACF;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import { getLanguage } from '@dynatrace-sdk/user-preferences';\n\n/**\n * Properties describing how a piece of text is formatted.\n * @internal\n */\nexport type Font = {\n fontStyle?: string;\n fontWeight?: string;\n fontSize: string;\n fontFamily: string;\n};\n\nconst localizedSegmenter = new Intl.Segmenter(getLanguage(), {\n granularity: 'grapheme',\n});\n\n/**\n * The Unicode character representing an ellipsis.\n * @internal\n */\nexport const ELLIPSIS_CHARACTER = '\\u2026';\n\n/**\n * Max iterations for finding the perfect truncated text for a given width\n * @internal\n */\nexport const ELLIPSIS_APPROXIMATION_THRESHOLD = 15;\n\nlet inMemContext2d: CanvasRenderingContext2D;\n\n/**\n * Calculates the width of formatted text in pixels.\n *\n * @param text - The text to calculate the width of\n * @param textFont - The font settings for the text\n * @internal\n */\nexport function getTextWidth(text: string, textFont: Font): number {\n const context = getCanvasContext2d();\n\n context.font = getFontString(textFont);\n\n const textMetrics = context.measureText(text);\n\n // this branch is relevant for mocked canvas API in unit tests\n if (textMetrics.width < 0) {\n return textMetrics.width;\n }\n\n // Development note: On macOS Chrome and macOS Firefox, emojis passed to the\n // text measurement return a faulty measurement. This is most likely related to\n // this chromium bug https://issues.chromium.org/issues/40461560, which is at the time of writing\n // still open. If a text only consists of emojis, the measurement will be fairly off, which will\n // in turn break the average character width calculation following afterwards.\n // In most cases we anticipate that other letter characters measurements will smooth out the average calculation.\n\n // more accurate than using metrics width\n // see https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics#measuring_text_width\n const actualTextWidth =\n Math.abs(textMetrics.actualBoundingBoxLeft) +\n Math.abs(textMetrics.actualBoundingBoxRight);\n\n // Scrap sub-pixel accuracy and always round up to be on the safer side\n return Math.ceil(actualTextWidth);\n}\n\n/**\n * Calculates the height of formatted text in pixels.\n * @param text - The text to calculate the height of\n * @param textFont - The font settings for the text\n * @internal\n */\nexport function getTextHeight(text: string, textFont: Font): number {\n const context = getCanvasContext2d();\n\n context.font = getFontString(textFont);\n\n const textMetrics = context.measureText(text);\n\n const actualTextHeight =\n Math.abs(textMetrics.actualBoundingBoxAscent) +\n Math.abs(textMetrics.actualBoundingBoxDescent);\n\n // Scrap sub-pixel accuracy and always round up to be on the safer side\n return Math.ceil(actualTextHeight);\n}\n\n/**\n * Cuts off text that exceeds the maximum width in the center and\n * concatenates both shortened ends of the text with an ellipsis.\n *\n * @param originalText - The text to be truncated if its width exceeds <code>maxWidthInPx</code>\n * @param textFont - Different font settings to be considered when determining the width of the text\n * @param maxWidthInPx - If the text's width exceeds this value, the text will be truncated to a string whose width is guaranteed to be below it\n * @internal\n */\nexport function centerEllipsizeText(\n originalText: string,\n textFont: Font,\n maxWidthInPx: number,\n): string {\n const ellipsisInfo = calculateEllipsisInfo(\n originalText,\n textFont,\n maxWidthInPx,\n );\n\n if (ellipsisInfo === null) {\n return originalText;\n }\n\n const { ellipsisWidth, avgLetterWidth } = ellipsisInfo;\n const availableTextWidth = maxWidthInPx - ellipsisWidth;\n\n if (availableTextWidth <= ellipsisWidth) {\n return ELLIPSIS_CHARACTER;\n }\n\n const initialPrefixSuffixLength =\n Math.floor(availableTextWidth / avgLetterWidth / 2) + 1;\n\n let prefix: string;\n let suffix: string;\n let ellipsizedText: string;\n let approximatedTextWidth: number;\n let attempt = 1;\n let prefixLength = initialPrefixSuffixLength;\n let suffixLength = initialPrefixSuffixLength;\n\n const originalSegmentedText = Array.from(\n localizedSegmenter.segment(originalText),\n ).map((segment) => segment.segment);\n\n do {\n // Need to copy the original segmented array, because slice does mutate the array\n // it is called on, and that can lead to unwanted side effects when running this\n // loop more often.\n const originalSegmentedTextCopy = [...originalSegmentedText];\n prefixLength -= attempt % 2 === 1 ? 1 : 0;\n suffixLength -= attempt % 2 === 0 ? 1 : 0;\n\n prefix = originalSegmentedTextCopy.slice(0, prefixLength).join('');\n suffix = originalSegmentedTextCopy.slice(suffixLength * -1).join('');\n\n ellipsizedText = `${prefix}${ELLIPSIS_CHARACTER}${suffix}`;\n approximatedTextWidth = getTextWidth(ellipsizedText, textFont);\n\n attempt++;\n } while (\n attempt <= ELLIPSIS_APPROXIMATION_THRESHOLD &&\n approximatedTextWidth >= maxWidthInPx\n );\n\n return ellipsizedText;\n}\n\n/**\n * Transforms a font settings object into a CSS font specifier string\n * that can be used on 2D canvas contexts.\n */\nfunction getFontString(textFont: Font): string {\n const { fontStyle, fontWeight, fontSize, fontFamily } = textFont;\n\n // Note: always drop default values for fontStyle and fontWeight as\n // these can randomly (!) break text width detection!\n return [\n fontStyle === 'normal' ? '' : fontStyle,\n fontWeight === '400' ? '' : fontWeight,\n fontSize,\n fontFamily,\n ]\n .filter((value) => value !== undefined && value !== '')\n .map((value) =>\n // we need to resolve CSS variables manually because they are not supported by the canvas API\n value?.trim().startsWith('var(')\n ? value.replace(/^\\s*var\\(--[0-9A-Za-z-]+,\\s*([^)]+)\\)\\s*$/, '$1')\n : value,\n )\n .join(' ');\n}\n\n/**\n * Returns an object containing the width of a given formatted text and the\n * width of an ellipsis character with the same text format or `null`\n * if the text width does not exceed its maximum available width.\n * @internal\n */\nexport function calculateEllipsisInfo(\n originalText: string,\n textFont: Font,\n maxWidthInPx: number,\n): { ellipsisWidth: number; avgLetterWidth: number } | null {\n const originalTextLength = Array.from(\n localizedSegmenter.segment(originalText),\n ).length;\n\n if (originalTextLength <= 1) {\n return null;\n }\n\n const textWidth = getTextWidth(originalText, textFont);\n const avgLetterWidth = textWidth / originalTextLength;\n\n return textWidth > maxWidthInPx\n ? {\n ellipsisWidth: getTextWidth(ELLIPSIS_CHARACTER, textFont),\n avgLetterWidth,\n }\n : null;\n}\n\n/** Returns the canvas 2D context used for measuring the width of formatted text. */\nfunction getCanvasContext2d() {\n if (!inMemContext2d) {\n const canvas = document.createElement('canvas');\n canvas.hidden = true;\n const context = canvas.getContext('2d', { alpha: false });\n\n if (context !== null) {\n context.imageSmoothingEnabled = false;\n context.imageSmoothingQuality = 'low';\n inMemContext2d = context;\n } else {\n throw new Error('Failed to create a Canvas 2D context');\n }\n }\n\n return inMemContext2d;\n}\n"],
5
+ "mappings": "AAAA,SAAS,mBAAmB;AAa5B,MAAM,qBAAqB,IAAI,KAAK,UAAU,YAAY,GAAG;AAAA,EAC3D,aAAa;AACf,CAAC;AAMM,MAAM,qBAAqB;AAM3B,MAAM,mCAAmC;AAEhD,IAAI;AASG,SAAS,aAAa,MAAc,UAAwB;AACjE,QAAM,UAAU,mBAAmB;AAEnC,UAAQ,OAAO,cAAc,QAAQ;AAErC,QAAM,cAAc,QAAQ,YAAY,IAAI;AAG5C,MAAI,YAAY,QAAQ,GAAG;AACzB,WAAO,YAAY;AAAA,EACrB;AAWA,QAAM,kBACJ,KAAK,IAAI,YAAY,qBAAqB,IAC1C,KAAK,IAAI,YAAY,sBAAsB;AAG7C,SAAO,KAAK,KAAK,eAAe;AAClC;AAQO,SAAS,cAAc,MAAc,UAAwB;AAClE,QAAM,UAAU,mBA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KAAK;AAAA,IAC9B,eAAe,QAAQ,KAAK;AAAA,IAC5B;AAAA,IACA;AAAA,EACF,EACG,OAAO,CAAC,UAAU,UAAU,UAAa,UAAU,EAAE,EACrD;AAAA,IAAI,CAAC;AAAA;AAAA,MAEJ,OAAO,KAAK,EAAE,WAAW,MAAM,IAC3B,MAAM,QAAQ,6CAA6C,IAAI,IAC/D;AAAA;AAAA,EACN,EACC,KAAK,GAAG;AACb;AAQO,SAAS,sBACd,cACA,UACA,cAC0D;AAC1D,QAAM,qBAAqB,MAAM;AAAA,IAC/B,mBAAmB,QAAQ,YAAY;AAAA,EACzC,EAAE;AAEF,MAAI,sBAAsB,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,aAAa,cAAc,QAAQ;AACrD,QAAM,iBAAiB,YAAY;AAEnC,SAAO,YAAY,eACf;AAAA,IACE,eAAe,aAAa,oBAAoB,QAAQ;AAAA,IACxD;AAAA,EACF,IACA;AACN;AAGA,SAAS,qBAAqB;AAC5B,MAAI,CAAC,gBAAgB;AACnB,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,SAAS;AAChB,UAAM,UAAU,OAAO,WAAW,MAAM,EAAE,OAAO,MAAM,CAAC;AAExD,QAAI,YAAY,MAAM;AACpB,cAAQ,wBAAwB;AAChC,cAAQ,wBAAwB;AAChC,uBAAiB;AAAA,IACnB,OAAO;AACL,YAAM,IAAI,MAAM,sCAAsC;AAAA,IACxD;AAAA,EACF;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,8 @@
1
- ._f32lcd0-1-6-2 {
1
+ ._f32lcd0-1-7-2 {
2
2
  border-style: var(--dt-borders-style-default, solid);
3
3
  border-width: var(--dt-borders-width-emphasized, 2px);
4
4
  border-radius: var(--dt-borders-radius-container-default, 12px);
5
- color: var(--_6levse0-1-6-2);
6
- border-color: var(--_6levse2-1-6-2);
7
- background-color: var(--_6levse1-1-6-2);
5
+ color: var(--_6levse0-1-7-2);
6
+ border-color: var(--_6levse2-1-7-2);
7
+ background-color: var(--_6levse1-1-7-2);
8
8
  }
@@ -23,4 +23,4 @@ __export(Container_css_exports, {
23
23
  module.exports = __toCommonJS(Container_css_exports);
24
24
  var import_container_css_ts_vanilla = require("../../styles/container.css");
25
25
  var import_Container_css_ts_vanilla = require("./Container.css");
26
- var containerCSS = "_f32lcd0-1-6-2";
26
+ var containerCSS = "_f32lcd0-1-7-2";
@@ -1,21 +1,21 @@
1
- ._1thxv8m0-1-6-2 {
1
+ ._1thxv8m0-1-7-2 {
2
2
  border: none;
3
3
  margin: 0;
4
4
  overflow-wrap: break-word;
5
- background-color: var(--_k096v42-1-6-2);
5
+ background-color: var(--_k096v42-1-7-2);
6
6
  }
7
- ._1thxv8m1-1-6-2 {
7
+ ._1thxv8m1-1-7-2 {
8
8
  width: 100%;
9
9
  height: var(--dt-borders-width-default, 1px);
10
10
  }
11
- ._1thxv8m2-1-6-2 {
11
+ ._1thxv8m2-1-7-2 {
12
12
  width: var(--dt-borders-width-default, 1px);
13
13
  height: 100%;
14
14
  }
15
- ._1thxv8m5-1-6-2 {
15
+ ._1thxv8m5-1-7-2 {
16
16
  flex-shrink: 0;
17
17
  }
18
- ._1thxv8m6-1-6-2 {
18
+ ._1thxv8m6-1-7-2 {
19
19
  flex-shrink: 0;
20
20
  width: var(--dt-borders-width-default, 1px);
21
21
  height: auto;
@@ -24,4 +24,4 @@ module.exports = __toCommonJS(Divider_css_exports);
24
24
  var import_colorUtils_css_ts_vanilla = require("../../core/utils/colorUtils.css");
25
25
  var import_Divider_css_ts_vanilla = require("./Divider.css");
26
26
  var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
27
- var dividerCSS = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_1thxv8m0-1-6-2", variantClassNames: { orientation: { horizontal: "_1thxv8m1-1-6-2", vertical: "_1thxv8m2-1-6-2" }, flexItem: { true: "_1thxv8m3-1-6-2", false: "_1thxv8m4-1-6-2" } }, defaultVariants: {}, compoundVariants: [[{ orientation: "horizontal", flexItem: false }, "_1thxv8m5-1-6-2"], [{ orientation: "vertical", flexItem: true }, "_1thxv8m6-1-6-2"]] });
27
+ var dividerCSS = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_1thxv8m0-1-7-2", variantClassNames: { orientation: { horizontal: "_1thxv8m1-1-7-2", vertical: "_1thxv8m2-1-7-2" }, flexItem: { true: "_1thxv8m3-1-7-2", false: "_1thxv8m4-1-7-2" } }, defaultVariants: {}, compoundVariants: [[{ orientation: "horizontal", flexItem: false }, "_1thxv8m5-1-7-2"], [{ orientation: "vertical", flexItem: true }, "_1thxv8m6-1-7-2"]] });