@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.
- package/buttons/button/Button.css +17 -17
- package/buttons/button/Button.js +1 -1
- package/buttons/button/Button.sty.js +4 -4
- package/content/progress/ProgressBar.css +71 -71
- package/content/progress/ProgressBar.d.ts +0 -7
- package/content/progress/ProgressBar.js +19 -45
- package/content/progress/ProgressBar.sty.js +5 -5
- package/content/progress/ProgressBarIcon.css +2 -2
- package/content/progress/ProgressBarIcon.sty.js +1 -1
- package/content/progress/ProgressBarLabel.css +3 -3
- package/content/progress/ProgressBarLabel.js +1 -1
- package/content/progress/ProgressBarLabel.sty.js +1 -1
- package/content/progress/ProgressBarValue.css +5 -5
- package/content/progress/ProgressBarValue.js +1 -1
- package/content/progress/ProgressBarValue.sty.js +1 -1
- package/content/progress/ProgressCircle.css +40 -40
- package/content/progress/ProgressCircle.d.ts +0 -7
- package/content/progress/ProgressCircle.js +2 -10
- package/content/progress/ProgressCircle.sty.js +5 -5
- package/content/progress/hooks/useProgressBarPropsContext.d.ts +5 -2
- package/content/progress/hooks/useProgressBarPropsContext.js +2 -2
- package/content/skeleton/Skeleton.css +6 -6
- package/content/skeleton/Skeleton.sty.js +1 -1
- package/core/components/app-root/AppRoot.css +0 -57
- package/core/hooks/useFontsUpdated.d.ts +1 -1
- package/core/hooks/useFontsUpdated.js +2 -2
- package/core/index.d.ts +0 -2
- package/core/index.js +0 -2
- package/core/styles/focusRing.css +66 -66
- package/core/styles/focusRing.sty.js +2 -2
- package/core/utils/colorUtils.css +60 -60
- package/core/utils/colorUtils.sty.js +2 -2
- package/esm/buttons/button/Button.css +17 -17
- package/esm/buttons/button/Button.js +1 -1
- package/esm/buttons/button/Button.js.map +2 -2
- package/esm/buttons/button/Button.sty.js +4 -4
- package/esm/buttons/button/Button.sty.js.map +2 -2
- package/esm/content/progress/ProgressBar.css +71 -71
- package/esm/content/progress/ProgressBar.js +19 -45
- package/esm/content/progress/ProgressBar.js.map +2 -2
- package/esm/content/progress/ProgressBar.sty.js +5 -5
- package/esm/content/progress/ProgressBar.sty.js.map +2 -2
- package/esm/content/progress/ProgressBarIcon.css +2 -2
- package/esm/content/progress/ProgressBarIcon.sty.js +1 -1
- package/esm/content/progress/ProgressBarIcon.sty.js.map +1 -1
- package/esm/content/progress/ProgressBarLabel.css +3 -3
- package/esm/content/progress/ProgressBarLabel.js +2 -2
- package/esm/content/progress/ProgressBarLabel.js.map +2 -2
- package/esm/content/progress/ProgressBarLabel.sty.js +1 -1
- package/esm/content/progress/ProgressBarLabel.sty.js.map +2 -2
- package/esm/content/progress/ProgressBarValue.css +5 -5
- package/esm/content/progress/ProgressBarValue.js +2 -2
- package/esm/content/progress/ProgressBarValue.js.map +2 -2
- package/esm/content/progress/ProgressBarValue.sty.js +1 -1
- package/esm/content/progress/ProgressBarValue.sty.js.map +2 -2
- package/esm/content/progress/ProgressCircle.css +40 -40
- package/esm/content/progress/ProgressCircle.js +2 -10
- package/esm/content/progress/ProgressCircle.js.map +2 -2
- package/esm/content/progress/ProgressCircle.sty.js +5 -5
- package/esm/content/progress/ProgressCircle.sty.js.map +2 -2
- package/esm/content/progress/hooks/useProgressBarPropsContext.js +2 -2
- package/esm/content/progress/hooks/useProgressBarPropsContext.js.map +2 -2
- package/esm/content/skeleton/Skeleton.css +6 -6
- package/esm/content/skeleton/Skeleton.sty.js +1 -1
- package/esm/content/skeleton/Skeleton.sty.js.map +2 -2
- package/esm/core/components/app-root/AppRoot.css +0 -57
- package/esm/core/hooks/useFontsUpdated.js +2 -2
- package/esm/core/hooks/useFontsUpdated.js.map +2 -2
- package/esm/core/index.js +0 -2
- package/esm/core/index.js.map +2 -2
- package/esm/core/styles/focusRing.css +66 -66
- package/esm/core/styles/focusRing.sty.js +2 -2
- package/esm/core/styles/focusRing.sty.js.map +2 -2
- package/esm/core/utils/colorUtils.css +60 -60
- package/esm/core/utils/colorUtils.sty.js +2 -2
- package/esm/core/utils/colorUtils.sty.js.map +2 -2
- package/esm/layouts/container/Container.css +4 -4
- package/esm/layouts/container/Container.sty.js +1 -1
- package/esm/layouts/container/Container.sty.js.map +1 -1
- package/esm/layouts/divider/Divider.css +6 -6
- package/esm/layouts/divider/Divider.sty.js +1 -1
- package/esm/layouts/divider/Divider.sty.js.map +2 -2
- package/esm/layouts/input-group/InputGroup.css +4 -4
- package/esm/layouts/input-group/InputGroup.sty.js +2 -2
- package/esm/layouts/input-group/InputGroup.sty.js.map +1 -1
- package/esm/layouts/surface/Surface.css +39 -39
- package/esm/layouts/surface/Surface.sty.js +2 -2
- package/esm/layouts/surface/Surface.sty.js.map +2 -2
- package/esm/layouts/surface/variables.sty.js +1 -1
- package/esm/layouts/surface/variables.sty.js.map +1 -1
- package/esm/styles/colorUtils.css +60 -60
- package/esm/styles/colorUtils.sty.js +2 -2
- package/esm/styles/colorUtils.sty.js.map +2 -2
- package/esm/styles/container.css +47 -47
- package/esm/styles/container.sty.js +2 -2
- package/esm/styles/container.sty.js.map +2 -2
- package/esm/styles/ellipsis.css +1 -1
- package/esm/styles/ellipsis.sty.js +1 -1
- package/esm/styles/ellipsis.sty.js.map +1 -1
- package/esm/styles/field.css +153 -153
- package/esm/styles/field.sty.js +2 -2
- package/esm/styles/field.sty.js.map +2 -2
- package/esm/styles/sprinkles.css +262 -262
- package/esm/styles/sprinkles.sty.js +1 -1
- package/esm/styles/sprinkles.sty.js.map +2 -2
- package/esm/styles/textStyle.css +8 -8
- package/esm/styles/textStyle.sty.js +1 -1
- package/esm/styles/textStyle.sty.js.map +2 -2
- package/esm/typography/block-quote/Blockquote.css +2 -2
- package/esm/typography/block-quote/Blockquote.sty.js +1 -1
- package/esm/typography/block-quote/Blockquote.sty.js.map +1 -1
- package/esm/typography/code/Code.css +1 -1
- package/esm/typography/code/Code.sty.js +1 -1
- package/esm/typography/code/Code.sty.js.map +1 -1
- package/esm/typography/emphasis/Emphasis.css +1 -1
- package/esm/typography/emphasis/Emphasis.sty.js +1 -1
- package/esm/typography/emphasis/Emphasis.sty.js.map +1 -1
- package/esm/typography/external-link/ExternalLink.css +6 -6
- package/esm/typography/external-link/ExternalLink.sty.js +1 -1
- package/esm/typography/external-link/ExternalLink.sty.js.map +1 -1
- package/esm/typography/heading/Heading.css +7 -7
- package/esm/typography/heading/Heading.sty.js +1 -1
- package/esm/typography/heading/Heading.sty.js.map +2 -2
- package/esm/typography/highlight/Highlight.css +1 -1
- package/esm/typography/highlight/Highlight.sty.js +1 -1
- package/esm/typography/highlight/Highlight.sty.js.map +1 -1
- package/esm/typography/index.js +12 -12
- package/esm/typography/index.js.map +2 -2
- package/esm/typography/link/Link.css +4 -4
- package/esm/typography/link/Link.sty.js +1 -1
- package/esm/typography/link/Link.sty.js.map +1 -1
- package/esm/typography/list/List.css +4 -4
- package/esm/typography/list/List.sty.js +2 -2
- package/esm/typography/list/List.sty.js.map +1 -1
- package/esm/typography/paragraph/Paragraph.css +3 -3
- package/esm/typography/paragraph/Paragraph.sty.js +1 -1
- package/esm/typography/paragraph/Paragraph.sty.js.map +2 -2
- package/esm/typography/strikethrough/Strikethrough.css +1 -1
- package/esm/typography/strikethrough/Strikethrough.sty.js +1 -1
- package/esm/typography/strikethrough/Strikethrough.sty.js.map +1 -1
- package/esm/typography/strong/Strong.css +1 -1
- package/esm/typography/strong/Strong.sty.js +1 -1
- package/esm/typography/strong/Strong.sty.js.map +1 -1
- package/esm/typography/text/Text.css +3 -3
- package/esm/typography/text/Text.sty.js +1 -1
- package/esm/typography/text/Text.sty.js.map +2 -2
- package/esm/typography/text-ellipsis/TextEllipsis.css +4 -4
- package/esm/typography/text-ellipsis/TextEllipsis.js +45 -45
- package/esm/typography/text-ellipsis/TextEllipsis.js.map +2 -2
- package/esm/typography/text-ellipsis/TextEllipsis.sty.js +1 -1
- package/esm/typography/text-ellipsis/TextEllipsis.sty.js.map +2 -2
- package/esm/typography/utils.js +19 -19
- package/esm/typography/utils.js.map +2 -2
- package/layouts/container/Container.css +4 -4
- package/layouts/container/Container.sty.js +1 -1
- package/layouts/divider/Divider.css +6 -6
- package/layouts/divider/Divider.sty.js +1 -1
- package/layouts/input-group/InputGroup.css +4 -4
- package/layouts/input-group/InputGroup.sty.js +2 -2
- package/layouts/surface/Surface.css +39 -39
- package/layouts/surface/Surface.sty.js +2 -2
- package/layouts/surface/variables.sty.js +1 -1
- package/package.json +15 -26
- package/styles/colorUtils.css +60 -60
- package/styles/colorUtils.sty.js +2 -2
- package/styles/container.css +47 -47
- package/styles/container.sty.js +2 -2
- package/styles/ellipsis.css +1 -1
- package/styles/ellipsis.sty.js +1 -1
- package/styles/field.css +153 -153
- package/styles/field.sty.js +2 -2
- package/styles/sprinkles.css +262 -262
- package/styles/sprinkles.sty.js +1 -1
- package/styles/textStyle.css +8 -8
- package/styles/textStyle.sty.js +1 -1
- package/typography/block-quote/Blockquote.css +2 -2
- package/typography/block-quote/Blockquote.sty.js +1 -1
- package/typography/code/Code.css +1 -1
- package/typography/code/Code.sty.js +1 -1
- package/typography/emphasis/Emphasis.css +1 -1
- package/typography/emphasis/Emphasis.sty.js +1 -1
- package/typography/external-link/ExternalLink.css +6 -6
- package/typography/external-link/ExternalLink.sty.js +1 -1
- package/typography/heading/Heading.css +7 -7
- package/typography/heading/Heading.sty.js +1 -1
- package/typography/highlight/Highlight.css +1 -1
- package/typography/highlight/Highlight.sty.js +1 -1
- package/typography/index.d.ts +3 -3
- package/typography/index.js +6 -6
- package/typography/link/Link.css +4 -4
- package/typography/link/Link.sty.js +1 -1
- package/typography/list/List.css +4 -4
- package/typography/list/List.sty.js +2 -2
- package/typography/paragraph/Paragraph.css +3 -3
- package/typography/paragraph/Paragraph.sty.js +1 -1
- package/typography/strikethrough/Strikethrough.css +1 -1
- package/typography/strikethrough/Strikethrough.sty.js +1 -1
- package/typography/strong/Strong.css +1 -1
- package/typography/strong/Strong.sty.js +1 -1
- package/typography/text/Text.css +3 -3
- package/typography/text/Text.sty.js +1 -1
- package/typography/text-ellipsis/TextEllipsis.css +4 -4
- package/typography/text-ellipsis/TextEllipsis.d.ts +2 -2
- package/typography/text-ellipsis/TextEllipsis.js +44 -44
- package/typography/text-ellipsis/TextEllipsis.sty.js +1 -1
- package/typography/utils.d.ts +14 -11
- package/typography/utils.js +19 -19
- package/core/types/role-variant.d.ts +0 -12
- package/core/types/role-variant.js +0 -30
- package/esm/core/types/role-variant.js +0 -12
- package/esm/core/types/role-variant.js.map +0 -7
- package/testing/custom-render.d.ts +0 -12
- package/testing/custom-render.js +0 -62
- package/testing/index.d.ts +0 -22
- package/testing/index.js +0 -91
- package/testing/jest/index.d.ts +0 -1
- package/testing/jest/index.js +0 -5
- package/testing/jest/jest-preset.d.ts +0 -10
- package/testing/jest/jest-preset.js +0 -13
- package/testing/jest/resolver.d.ts +0 -0
- package/testing/jest/resolver.js +0 -27
- package/testing/mocks/bounding-client-rect-mock.d.ts +0 -8
- package/testing/mocks/bounding-client-rect-mock.js +0 -36
- package/testing/mocks/canvas-mock.d.ts +0 -14
- package/testing/mocks/canvas-mock.js +0 -192
- package/testing/mocks/create-mock-element.d.ts +0 -14
- package/testing/mocks/create-mock-element.js +0 -99
- package/testing/mocks/create-range-mock.d.ts +0 -10
- package/testing/mocks/create-range-mock.js +0 -47
- package/testing/mocks/dom-rect-mock.d.ts +0 -19
- package/testing/mocks/dom-rect-mock.js +0 -56
- package/testing/mocks/fetch-mock.d.ts +0 -9
- package/testing/mocks/fetch-mock.js +0 -38
- package/testing/mocks/intersection-observer-mock.d.ts +0 -10
- package/testing/mocks/intersection-observer-mock.js +0 -58
- package/testing/mocks/match-media-mock.d.ts +0 -10
- package/testing/mocks/match-media-mock.js +0 -45
- package/testing/mocks/offset-height-mock.d.ts +0 -8
- package/testing/mocks/offset-height-mock.js +0 -39
- package/testing/mocks/offset-width-mock.d.ts +0 -8
- package/testing/mocks/offset-width-mock.js +0 -39
- package/testing/mocks/pointer-event-mock.d.ts +0 -8
- package/testing/mocks/pointer-event-mock.js +0 -42
- package/testing/mocks/resize-observer-mock.d.ts +0 -11
- package/testing/mocks/resize-observer-mock.js +0 -42
- package/testing/mocks/screen-size-mock.d.ts +0 -8
- package/testing/mocks/screen-size-mock.js +0 -34
- package/testing/mocks/scroll-into-view-mock.d.ts +0 -10
- package/testing/mocks/scroll-into-view-mock.js +0 -34
- package/testing/mocks/scroll-width-mock.d.ts +0 -8
- package/testing/mocks/scroll-width-mock.js +0 -39
- package/testing/mocks/select-mock.d.ts +0 -11
- package/testing/mocks/select-mock.js +0 -45
- package/testing/mocks/table-virtualization-mock.d.ts +0 -10
- package/testing/mocks/table-virtualization-mock.js +0 -50
- package/testing/mocks/text-ellipsis-mock.d.ts +0 -8
- package/testing/mocks/text-ellipsis-mock.js +0 -43
- package/testing/setup.d.ts +0 -8
- 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,
|
|
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-
|
|
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-
|
|
7
|
+
._1iksxp40-1-0-0:hover {
|
|
8
8
|
color: var(--dt-colors-text-primary-default-hover, #3332ae);
|
|
9
9
|
}
|
|
10
|
-
._1iksxp40-0-
|
|
10
|
+
._1iksxp40-1-0-0:active {
|
|
11
11
|
color: var(--dt-colors-text-primary-default-active, #241193);
|
|
12
12
|
}
|
|
13
|
-
._1iksxp40-0-
|
|
13
|
+
._1iksxp40-1-0-0:focus-visible {
|
|
14
14
|
text-decoration: none;
|
|
15
15
|
}
|
|
@@ -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-
|
|
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-
|
|
1
|
+
._16276mt0-1-0-0 {
|
|
2
2
|
margin: 0;
|
|
3
3
|
padding-left: var(--dt-spacings-size-40, 40px);
|
|
4
4
|
}
|
|
5
|
-
._16276mt0-0-
|
|
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-
|
|
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-
|
|
14
|
+
._16276mt1-1-0-0::marker {
|
|
15
15
|
font-weight: var(--dt-typography-text-base-emphasized-weight, 500);
|
|
16
16
|
}
|
|
@@ -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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
5
|
-
"mappings": "AAAA,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,eAAe,OAAO,EAAC,kBAAiB,
|
|
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,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-
|
|
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,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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
5
|
-
"mappings": "AAAA,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,UAAU,OAAO,EAAC,kBAAiB,
|
|
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-
|
|
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-
|
|
12
|
+
._1mnpbqs1-1-0-0 {
|
|
13
13
|
text-overflow: ellipsis;
|
|
14
14
|
direction: rtl;
|
|
15
15
|
text-align: left;
|
|
16
16
|
}
|
|
17
|
-
._1mnpbqs2-0-
|
|
17
|
+
._1mnpbqs2-1-0-0 {
|
|
18
18
|
text-overflow: clip;
|
|
19
19
|
}
|
|
20
|
-
._1mnpbqs3-0-
|
|
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 {
|
|
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 {
|
|
12
|
-
|
|
13
|
-
|
|
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(
|
|
21
|
+
function isNativeEllipsisActive(innerSpanElement, containerWidth) {
|
|
22
22
|
const originalTextWidth = Math.max(
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
32
|
-
if (containerElement
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
}, [
|
|
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 {
|
|
5
|
-
"mappings": "AAAA,OAAO,UAAU;AACjB,OAAO;AAAA,EACL;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP,OAAO,uBAAuB;AAE9B,SAAS,uBAAuB;AAChC,SAAS,
|
|
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": "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",
|
|
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-
|
|
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-
|
|
5
|
-
"mappings": "AAAA,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,kBAAkB,OAAO,EAAC,kBAAiB,
|
|
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
|
}
|
package/esm/typography/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const ELLIPSIS_CHARACTER = "\u2026";
|
|
2
|
+
const ELLIPSIS_APPROXIMATION_THRESHOLD = 15;
|
|
3
3
|
let inMemContext2d;
|
|
4
|
-
function
|
|
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
|
|
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
|
|
22
|
-
const ellipsisInfo =
|
|
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
|
|
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}${
|
|
49
|
-
approximatedTextWidth =
|
|
48
|
+
ellipsizedText = `${prefix}${ELLIPSIS_CHARACTER}${suffix}`;
|
|
49
|
+
approximatedTextWidth = getTextWidth(ellipsizedText, textFont);
|
|
50
50
|
attempt++;
|
|
51
|
-
} while (attempt <=
|
|
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
|
|
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 =
|
|
73
|
+
const textWidth = getTextWidth(originalText, textFont);
|
|
74
74
|
const avgLetterWidth = textWidth / originalTextLength;
|
|
75
75
|
return textWidth > maxWidthInPx ? {
|
|
76
|
-
ellipsisWidth:
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
ELLIPSIS_APPROXIMATION_THRESHOLD,
|
|
95
|
+
ELLIPSIS_CHARACTER,
|
|
96
|
+
calculateEllipsisInfo,
|
|
97
|
+
centerEllipsizeText,
|
|
98
|
+
getTextHeight,
|
|
99
|
+
getTextWidth
|
|
100
100
|
};
|
|
101
101
|
//# sourceMappingURL=utils.js.map
|