@eccenca/gui-elements 24.4.1-featurepreparefinalnextcmem6943.2 → 25.0.0-featureimproveprintstylescmem6985.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/CHANGELOG.md +74 -19
  2. package/dist/cjs/cmem/markdown/Markdown.js +1 -2
  3. package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
  4. package/dist/cjs/common/index.js +4 -0
  5. package/dist/cjs/common/index.js.map +1 -1
  6. package/dist/cjs/common/utils/reduceToText.js +94 -0
  7. package/dist/cjs/common/utils/reduceToText.js.map +1 -0
  8. package/dist/cjs/components/Application/ApplicationViewability.js +33 -0
  9. package/dist/cjs/components/Application/ApplicationViewability.js.map +1 -0
  10. package/dist/cjs/components/Application/index.js +1 -0
  11. package/dist/cjs/components/Application/index.js.map +1 -1
  12. package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +1 -1
  13. package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
  14. package/dist/cjs/components/Button/Button.js +1 -1
  15. package/dist/cjs/components/Button/Button.js.map +1 -1
  16. package/dist/cjs/components/ContextOverlay/ContextMenu.js +2 -2
  17. package/dist/cjs/components/ContextOverlay/ContextMenu.js.map +1 -1
  18. package/dist/cjs/components/ContextOverlay/ContextOverlay.js +65 -18
  19. package/dist/cjs/components/ContextOverlay/ContextOverlay.js.map +1 -1
  20. package/dist/cjs/components/Dialog/Modal.js +15 -3
  21. package/dist/cjs/components/Dialog/Modal.js.map +1 -1
  22. package/dist/cjs/components/Dialog/ModalContext.js +51 -0
  23. package/dist/cjs/components/Dialog/ModalContext.js.map +1 -0
  24. package/dist/cjs/components/Dialog/index.js +1 -0
  25. package/dist/cjs/components/Dialog/index.js.map +1 -1
  26. package/dist/cjs/components/Icon/canonicalIconNames.js +25 -2
  27. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  28. package/dist/cjs/components/Spinner/Spinner.js +2 -1
  29. package/dist/cjs/components/Spinner/Spinner.js.map +1 -1
  30. package/dist/cjs/components/TextReducer/TextReducer.js +17 -63
  31. package/dist/cjs/components/TextReducer/TextReducer.js.map +1 -1
  32. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +2 -2
  33. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  34. package/dist/esm/cmem/markdown/Markdown.js +1 -2
  35. package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
  36. package/dist/esm/common/index.js +4 -0
  37. package/dist/esm/common/index.js.map +1 -1
  38. package/dist/esm/common/utils/reduceToText.js +75 -0
  39. package/dist/esm/common/utils/reduceToText.js.map +1 -0
  40. package/dist/esm/components/Application/ApplicationViewability.js +28 -0
  41. package/dist/esm/components/Application/ApplicationViewability.js.map +1 -0
  42. package/dist/esm/components/Application/index.js +1 -0
  43. package/dist/esm/components/Application/index.js.map +1 -1
  44. package/dist/esm/components/AutocompleteField/AutoCompleteField.js +1 -1
  45. package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
  46. package/dist/esm/components/Button/Button.js +1 -1
  47. package/dist/esm/components/Button/Button.js.map +1 -1
  48. package/dist/esm/components/ContextOverlay/ContextMenu.js +2 -2
  49. package/dist/esm/components/ContextOverlay/ContextMenu.js.map +1 -1
  50. package/dist/esm/components/ContextOverlay/ContextOverlay.js +69 -22
  51. package/dist/esm/components/ContextOverlay/ContextOverlay.js.map +1 -1
  52. package/dist/esm/components/Dialog/Modal.js +15 -3
  53. package/dist/esm/components/Dialog/Modal.js.map +1 -1
  54. package/dist/esm/components/Dialog/ModalContext.js +69 -0
  55. package/dist/esm/components/Dialog/ModalContext.js.map +1 -0
  56. package/dist/esm/components/Dialog/index.js +1 -0
  57. package/dist/esm/components/Dialog/index.js.map +1 -1
  58. package/dist/esm/components/Icon/canonicalIconNames.js +25 -2
  59. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  60. package/dist/esm/components/Spinner/Spinner.js +2 -1
  61. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  62. package/dist/esm/components/TextReducer/TextReducer.js +17 -41
  63. package/dist/esm/components/TextReducer/TextReducer.js.map +1 -1
  64. package/dist/esm/extensions/react-flow/nodes/NodeContent.js +2 -2
  65. package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  66. package/dist/types/cmem/react-flow/StickyNoteModal/StickyNoteModal.d.ts +1 -1
  67. package/dist/types/common/index.d.ts +3 -0
  68. package/dist/types/common/utils/reduceToText.d.ts +10 -0
  69. package/dist/types/components/Application/ApplicationViewability.d.ts +36 -0
  70. package/dist/types/components/Application/index.d.ts +1 -0
  71. package/dist/types/components/Button/Button.d.ts +14 -7
  72. package/dist/types/components/ContextOverlay/ContextMenu.d.ts +1 -1
  73. package/dist/types/components/Dialog/Modal.d.ts +9 -1
  74. package/dist/types/components/Dialog/ModalContext.d.ts +13 -0
  75. package/dist/types/components/Dialog/index.d.ts +1 -0
  76. package/dist/types/components/Icon/canonicalIconNames.d.ts +23 -0
  77. package/dist/types/components/Spinner/Spinner.d.ts +11 -4
  78. package/dist/types/components/Tabs/Tab.d.ts +2 -2
  79. package/dist/types/components/TextReducer/TextReducer.d.ts +13 -1
  80. package/dist/types/extensions/react-flow/edges/EdgeLabel.d.ts +1 -1
  81. package/package.json +5 -3
  82. package/src/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.tsx +1 -1
  83. package/src/cmem/markdown/Markdown.tsx +1 -2
  84. package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +1 -1
  85. package/src/cmem/react-flow/_minimap.scss +10 -0
  86. package/src/cmem/react-flow/configuration/_colors-graph.scss +12 -12
  87. package/src/cmem/react-flow/configuration/_colors-linking.scss +8 -8
  88. package/src/cmem/react-flow/configuration/_colors-workflow.scss +11 -11
  89. package/src/common/index.ts +6 -0
  90. package/src/common/scss/_color-functions.scss +5 -0
  91. package/src/common/utils/reduceToText.tsx +82 -0
  92. package/src/components/Application/ApplicationViewability.tsx +61 -0
  93. package/src/components/Application/_content.scss +7 -0
  94. package/src/components/Application/_header.scss +12 -3
  95. package/src/components/Application/_viewability.scss +13 -0
  96. package/src/components/Application/application.scss +1 -0
  97. package/src/components/Application/index.ts +1 -0
  98. package/src/components/Application/stories/ApplicationViewability.stories.tsx +37 -0
  99. package/src/components/Application/tests/ApplicationViewability.test.tsx +43 -0
  100. package/src/components/AutocompleteField/AutoCompleteField.tsx +1 -0
  101. package/src/components/Button/Button.stories.tsx +7 -1
  102. package/src/components/Button/Button.tsx +16 -9
  103. package/src/components/Button/button.scss +86 -24
  104. package/src/components/Card/card.scss +6 -0
  105. package/src/components/Chat/stories/ChatField.stories.tsx +6 -1
  106. package/src/components/Checkbox/checkbox.scss +14 -2
  107. package/src/components/ContentGroup/_contentgroup.scss +9 -0
  108. package/src/components/ContextOverlay/ContextMenu.tsx +4 -1
  109. package/src/components/ContextOverlay/ContextOverlay.tsx +77 -18
  110. package/src/components/ContextOverlay/tests/ContextMenu.test.tsx +43 -0
  111. package/src/components/ContextOverlay/tests/ContextOverlay.test.tsx +71 -0
  112. package/src/components/Depiction/depiction.scss +6 -0
  113. package/src/components/Dialog/Modal.tsx +28 -3
  114. package/src/components/Dialog/ModalContext.tsx +56 -0
  115. package/src/components/Dialog/index.ts +1 -0
  116. package/src/components/Dialog/stories/Modal.stories.tsx +10 -7
  117. package/src/components/Dialog/stories/ModalContext.stories.tsx +153 -0
  118. package/src/components/FlexibleLayout/flexiblelayout.scss +16 -0
  119. package/src/components/Grid/grid.scss +17 -0
  120. package/src/components/Grid/stories/Grid.stories.tsx +10 -7
  121. package/src/components/Grid/stories/GridRow.stories.tsx +13 -7
  122. package/src/components/Icon/canonicalIconNames.tsx +25 -2
  123. package/src/components/Icon/icon.scss +6 -0
  124. package/src/components/Icon/stories/Icon.stories.tsx +65 -5
  125. package/src/components/Icon/stories/IconButton.stories.tsx +2 -1
  126. package/src/components/Notification/Notification.stories.tsx +20 -6
  127. package/src/components/Notification/notification.scss +14 -3
  128. package/src/components/OverviewItem/overviewitem.scss +9 -0
  129. package/src/components/ProgressBar/Stories/ProgressBar.stories.tsx +7 -1
  130. package/src/components/PropertyValuePair/propertyvalue.scss +23 -1
  131. package/src/components/Select/Select.stories.tsx +1 -1
  132. package/src/components/Separation/separation.scss +6 -0
  133. package/src/components/Spinner/Spinner.tsx +13 -3
  134. package/src/components/Spinner/Stories/spinner.stories.tsx +1 -1
  135. package/src/components/Spinner/spinner.scss +5 -1
  136. package/src/components/Table/table.scss +22 -0
  137. package/src/components/Tag/tag.scss +95 -68
  138. package/src/components/TextField/textfield.scss +23 -15
  139. package/src/components/TextReducer/TextReducer.stories.tsx +2 -1
  140. package/src/components/TextReducer/TextReducer.test.tsx +44 -0
  141. package/src/components/TextReducer/TextReducer.tsx +17 -44
  142. package/src/components/VisualTour/stories/VisualTour.stories.tsx +1 -1
  143. package/src/configuration/_palettes.scss +2 -1
  144. package/src/extensions/react-flow/_config.scss +8 -3
  145. package/src/extensions/react-flow/_react-flow_v12.scss +10 -14
  146. package/src/extensions/react-flow/edges/EdgeLabel.tsx +1 -1
  147. package/src/extensions/react-flow/edges/_edges.scss +15 -7
  148. package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +5 -5
  149. package/src/extensions/react-flow/nodes/NodeContent.tsx +2 -2
@@ -5,9 +5,9 @@
5
5
  }
6
6
 
7
7
  .#{$eccgui}-propertyvalue__pair {
8
+ clear: both;
8
9
  display: block;
9
10
  width: 100%;
10
- clear: both;
11
11
 
12
12
  &.#{$eccgui}-propertyvalue__pair--hasdivider {
13
13
  &:not(:last-child) {
@@ -94,3 +94,25 @@
94
94
  }
95
95
  }
96
96
  }
97
+
98
+ @media print {
99
+ .#{$eccgui}-propertyvalue__pair,
100
+ .#{$eccgui}-propertyvalue__property,
101
+ .#{$eccgui}-propertyvalue__value {
102
+ position: relative;
103
+ float: none !important;
104
+ display: block;
105
+ width: auto;
106
+ height: auto;
107
+ min-height: 0 !important;
108
+ padding: 0;
109
+ margin: 0 !important;
110
+
111
+ &:is(.#{$eccgui}-propertyvalue__property) {
112
+ margin-bottom: 0.25 * $eccgui-size-block-whitespace !important;
113
+ }
114
+ &:is(.#{$eccgui}-propertyvalue__pair) {
115
+ margin-bottom: 0.5 * $eccgui-size-block-whitespace !important;
116
+ }
117
+ }
118
+ }
@@ -53,7 +53,7 @@ export const ControlledTarget = Template.bind({});
53
53
  ControlledTarget.args = {
54
54
  ...Default.args,
55
55
  fill: false,
56
- children: <Button text="Controlled select target" intent="primary" />,
56
+ children: <Button text="Controlled select target" elevated />,
57
57
  onActiveItemChange: fn(),
58
58
  };
59
59
 
@@ -101,3 +101,9 @@ $eccgui-color-separation-divider: $pt-divider-black !default;
101
101
  margin: 0 $eccgui-size-separation-spacing-medium;
102
102
  }
103
103
  }
104
+
105
+ @media print {
106
+ .#{$eccgui}-separation__divider-horizontal {
107
+ print-color-adjust: exact;
108
+ }
109
+ }
@@ -9,10 +9,11 @@ import Color from "color";
9
9
 
10
10
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
11
11
 
12
+ import { ButtonProps } from "./../Button/Button";
13
+
12
14
  type SpinnerPosition = "local" | "inline" | "global";
13
15
  type SpinnerSize = "tiny" | "small" | "medium" | "large" | "xlarge" | "inherit";
14
16
  type SpinnerStroke = "thin" | "medium" | "bold";
15
- type Intent = "primary" | "success" | "warning" | "danger";
16
17
 
17
18
  /** A spinner that is either displayed globally or locally. */
18
19
  export interface SpinnerProps extends Omit<BlueprintSpinnerProps, "size" | "intent" | "color"> {
@@ -22,9 +23,16 @@ export interface SpinnerProps extends Omit<BlueprintSpinnerProps, "size" | "inte
22
23
  */
23
24
  color?: Color | string | "inherit";
24
25
  /**
25
- * Intent state of the field item.
26
+ * Intent state of the spinner.
27
+ * When used the spinner is colored.
28
+ * Property overwrites `elevated` setting.
29
+ */
30
+ intent?: ButtonProps["intent"];
31
+ /**
32
+ * Highlight the spinner.
33
+ * It is displayed with accent color intent.
26
34
  */
27
- intent?: Intent;
35
+ elevated?: boolean;
28
36
  /**
29
37
  * Additional CSS class names.
30
38
  */
@@ -67,6 +75,7 @@ export const Spinner = ({
67
75
  className = "",
68
76
  color = "inherit",
69
77
  intent,
78
+ elevated,
70
79
  position = "local",
71
80
  size,
72
81
  stroke,
@@ -119,6 +128,7 @@ export const Spinner = ({
119
128
  className={
120
129
  `${eccgui}-spinner` +
121
130
  ` ${eccgui}-spinner--position-${position}` +
131
+ (elevated ? ` ${eccgui}-spinner--intent-accent` : "") +
122
132
  (intent ? ` ${eccgui}-spinner--intent-${intent}` : "") +
123
133
  ` ${eccgui}-spinner--size-${spinnerSize}` +
124
134
  (showLocalBackdrop ? ` ${eccgui}-spinner--localbackdrop` : "") +
@@ -10,7 +10,7 @@ export default {
10
10
  color: { control: "color" },
11
11
  intent: {
12
12
  ...helpersArgTypes.exampleIntent,
13
- options: ["UNDEFINED", "primary", "success", "warning", "danger", "none"],
13
+ options: ["UNDEFINED", "primary", "accent", "success", "warning", "danger", "none"],
14
14
  },
15
15
  position: { control: "radio", options: ["local", "inline", "global"] },
16
16
  size: { control: "radio", options: ["tiny", "small", "medium", "large", "xlarge", "inherit"] },
@@ -29,10 +29,14 @@ span.#{$eccgui}-spinner {
29
29
  color: inherit;
30
30
  }
31
31
 
32
- .#{$eccgui}-spinner--intent-primary {
32
+ .#{$eccgui}-spinner--intent-accent {
33
33
  color: $eccgui-color-accent;
34
34
  }
35
35
 
36
+ .#{$eccgui}-spinner--intent-primary {
37
+ color: $eccgui-color-primary;
38
+ }
39
+
36
40
  .#{$eccgui}-spinner--intent-success {
37
41
  color: $eccgui-color-success-text;
38
42
  }
@@ -356,3 +356,25 @@ tr.#{$prefix}--parent-row.#{$prefix}--expandable-row + tr[data-child-row] {
356
356
  min-height: $eccgui-size-tablecell-height-regular;
357
357
  }
358
358
  }
359
+
360
+ @media print {
361
+ .#{$eccgui}-simpletable:has(.#{$eccgui}-simpletable__cell > .#{$eccgui}-typography__overflowtext) {
362
+ // allow 2 lines of text in `<OverflowText />` elements that are direct children of table cells
363
+ .#{$eccgui}-simpletable__cell {
364
+ & > .#{$eccgui}-typography__overflowtext,
365
+ & > .#{$eccgui}-typography__overflowtext--passdown {
366
+ display: inline;
367
+ overflow: visible;
368
+ text-overflow: unset;
369
+ white-space: unset;
370
+ }
371
+ & > .#{$eccgui}-typography__overflowtext {
372
+ display: -webkit-box;
373
+ overflow: hidden;
374
+ -webkit-line-clamp: 2;
375
+ line-clamp: 2;
376
+ -webkit-box-orient: vertical;
377
+ }
378
+ }
379
+ }
380
+ }
@@ -7,19 +7,21 @@ $eccgui-size-margin-tag: $eccgui-size-inline-whitespace * 0.5 !default;
7
7
  $eccgui-color-tag-background-emphasized: $eccgui-color-workspace-text !default;
8
8
 
9
9
  // lib vars
10
- $tag-default-color: $eccgui-color-tag-background-emphasized; // !default;
10
+ $tag-default-color: $eccgui-color-tag-background-emphasized;
11
+
11
12
  // $dark-tag-default-color: $gray5 !default;
12
- $tag-height: $eccgui-size-typo-tag * $eccgui-size-typo-tag-lineheight; // !default;
13
- $tag-line-height: $eccgui-size-typo-tag; // !default;
14
- $tag-padding-top: ($tag-height - $tag-line-height) * 0.5; // !default;
15
- $tag-padding: $tag-padding-top * 2; // !default;
16
- $tag-margin: 0; // !default;
17
- $tag-height-small: $eccgui-size-typo-tag; // !default;
18
- $tag-line-height-small: $tag-height-small; // !default;
19
- $tag-padding-small: $tag-padding-top * 0.5; // !default;
20
- $tag-height-large: $eccgui-size-typo-tag-large * $eccgui-size-typo-tag-large-lineheight; // !default;
21
- $tag-line-height-large: $eccgui-size-typo-tag-large; // !default;
22
- $tag-padding-large: ($tag-height-large - $tag-line-height-large); // !default;
13
+ $tag-height: $eccgui-size-typo-tag * $eccgui-size-typo-tag-lineheight;
14
+ $tag-line-height: $eccgui-size-typo-tag;
15
+ $tag-padding-top: ($tag-height - $tag-line-height) * 0.5;
16
+ $tag-padding: $tag-padding-top * 2;
17
+ $tag-margin: 0;
18
+ $tag-height-small: $eccgui-size-typo-tag;
19
+ $tag-line-height-small: $tag-height-small;
20
+ $tag-padding-small: $tag-padding-top * 0.5;
21
+ $tag-height-large: $eccgui-size-typo-tag-large * $eccgui-size-typo-tag-large-lineheight;
22
+ $tag-line-height-large: $eccgui-size-typo-tag-large;
23
+ $tag-padding-large: ($tag-height-large - $tag-line-height-large);
24
+
23
25
  // $tag-icon-spacing: ($tag-height - 12px) * 0.5 !default;
24
26
  // $tag-icon-spacing-large: ($tag-height-large - $pt-icon-size-standard) * 0.5 !default;
25
27
  $tag-round-adjustment: 0 !default;
@@ -139,110 +141,135 @@ $tag-round-adjustment: 0 !default;
139
141
  border-width: 1px;
140
142
 
141
143
  &:not([class*="#{$ns}-intent-"]) {
144
+ --eccgui-tag-bg: #{$tag-default-color};
145
+ --eccgui-tag-border: #{$tag-default-color};
146
+ --eccgui-tag-text: #{eccgui-color-var("identity", "text", "100")};
147
+ --eccgui-tag-emfactor: 100%;
148
+
149
+ color: var(--eccgui-tag-text);
150
+ background-color: eccgui-color-mix(
151
+ var(--eccgui-tag-bg) var(--eccgui-tag-emfactor),
152
+ eccgui-color-var("identity", "background", "100")
153
+ );
154
+ border-color: var(--eccgui-tag-border);
155
+
142
156
  &.#{$eccgui}-tag--strongeremphasis {
143
- background-color: $tag-default-color;
144
- border-color: $tag-default-color;
157
+ --eccgui-tag-emfactor: 95%;
145
158
  }
146
159
  &.#{$eccgui}-tag--strongemphasis {
147
- background-color: eccgui-color-rgba($tag-default-color, 0.875);
148
- border-color: eccgui-color-rgba($tag-default-color, 0.875);
160
+ --eccgui-tag-emfactor: 90%;
149
161
  }
150
162
  &.#{$eccgui}-tag--normalemphasis {
151
- background-color: eccgui-color-rgba($tag-default-color, 0.75);
152
- border-color: eccgui-color-rgba($tag-default-color, 0.75);
163
+ --eccgui-tag-emfactor: 85%;
153
164
  }
154
165
  &.#{$eccgui}-tag--weakemphasis {
155
- background-color: eccgui-color-rgba($tag-default-color, 0.625);
156
- border-color: eccgui-color-rgba($tag-default-color, 0.625);
166
+ --eccgui-tag-emfactor: 80%;
157
167
  }
158
168
  &.#{$eccgui}-tag--weakeremphasis {
159
- background-color: eccgui-color-rgba($tag-default-color, 0.5);
160
- border-color: eccgui-color-rgba($tag-default-color, 0.5);
169
+ --eccgui-tag-emfactor: 75%;
161
170
  }
162
171
 
163
172
  &.#{$eccgui}-intent--primary {
164
- color: $eccgui-color-primary-contrast;
165
- background-color: $eccgui-color-primary;
166
- border-color: $eccgui-color-primary;
173
+ --eccgui-tag-bg: #{$eccgui-color-primary};
174
+ --eccgui-tag-border: #{$eccgui-color-primary};
175
+ --eccgui-tag-text: #{$eccgui-color-primary-contrast};
167
176
  }
168
177
  &.#{$eccgui}-intent--accent {
169
- color: $eccgui-color-accent-contrast;
170
- background-color: $eccgui-color-accent;
171
- border-color: $eccgui-color-accent;
178
+ --eccgui-tag-bg: #{$eccgui-color-accent};
179
+ --eccgui-tag-border: #{$eccgui-color-accent};
180
+ --eccgui-tag-text: #{$eccgui-color-accent-contrast};
172
181
  }
173
182
  &.#{$eccgui}-intent--info {
174
- color: $eccgui-color-info-background;
175
- background-color: $eccgui-color-info-text;
176
- border-color: $eccgui-color-info-text;
183
+ --eccgui-tag-bg: #{$eccgui-color-info-text};
184
+ --eccgui-tag-border: #{$eccgui-color-info-text};
185
+ --eccgui-tag-text: #{$eccgui-color-info-background};
177
186
  }
178
187
  &.#{$eccgui}-intent--success {
179
- color: $eccgui-color-success-background;
180
- background-color: $eccgui-color-success-text;
181
- border-color: $eccgui-color-success-text;
188
+ --eccgui-tag-bg: #{$eccgui-color-success-text};
189
+ --eccgui-tag-border: #{$eccgui-color-success-text};
190
+ --eccgui-tag-text: #{$eccgui-color-success-background};
182
191
  }
183
192
  &.#{$eccgui}-intent--warning {
184
- color: $eccgui-color-warning-background;
185
- background-color: $eccgui-color-warning-text;
186
- border-color: $eccgui-color-warning-text;
193
+ --eccgui-tag-bg: #{$eccgui-color-warning-text};
194
+ --eccgui-tag-border: #{$eccgui-color-warning-text};
195
+ --eccgui-tag-text: #{$eccgui-color-warning-background};
187
196
  }
188
197
  &.#{$eccgui}-intent--danger {
189
- color: $eccgui-color-danger-background;
190
- background-color: $eccgui-color-danger-text;
191
- border-color: $eccgui-color-danger-text;
198
+ --eccgui-tag-bg: #{$eccgui-color-danger-text};
199
+ --eccgui-tag-border: #{$eccgui-color-danger-text};
200
+ --eccgui-tag-text: #{$eccgui-color-danger-background};
192
201
  }
193
202
 
194
203
  &.#{$ns}-minimal,
195
204
  &.#{$ns}-minimal.#{$ns}-interactive {
205
+ --eccgui-tag-bg: #{eccgui-color-var("identity", "background", "500")};
206
+ --eccgui-tag-border: #{$tag-default-color};
207
+ --eccgui-tag-text: #{$tag-default-color};
208
+
209
+ color: var(--eccgui-tag-text);
210
+ background-color: eccgui-color-mix(
211
+ var(--eccgui-tag-bg) var(--eccgui-tag-emfactor),
212
+ eccgui-color-var("identity", "background", "100")
213
+ );
214
+ border-color: var(--eccgui-tag-border);
215
+
196
216
  &.#{$eccgui}-tag--strongeremphasis {
197
- background-color: eccgui-color-rgba(eccgui-color-var("identity", "background", "900"), 1);
198
- border-color: eccgui-color-rgba($tag-default-color, 0.3);
217
+ --eccgui-tag-emfactor: 100%;
199
218
  }
200
219
  &.#{$eccgui}-tag--strongemphasis {
201
- background-color: eccgui-color-rgba(eccgui-color-var("identity", "background", "700"), 0.875);
202
- border-color: eccgui-color-rgba($tag-default-color, 0.225);
220
+ --eccgui-tag-emfactor: 90%;
203
221
  }
204
222
  &.#{$eccgui}-tag--normalemphasis {
205
- background-color: eccgui-color-rgba(eccgui-color-var("identity", "background", "500"), 0.75);
206
- border-color: eccgui-color-rgba($tag-default-color, 0.15);
223
+ --eccgui-tag-emfactor: 80%;
207
224
  }
208
225
  &.#{$eccgui}-tag--weakemphasis {
209
- background-color: eccgui-color-rgba(eccgui-color-var("identity", "background", "300"), 0.625);
210
- border-color: eccgui-color-rgba($tag-default-color, 0.075);
226
+ --eccgui-tag-emfactor: 70%;
211
227
  }
212
228
  &.#{$eccgui}-tag--weakeremphasis {
213
- background-color: eccgui-color-rgba(eccgui-color-var("identity", "background", "100"), 0.5);
214
- border-color: eccgui-color-rgba($tag-default-color, 0.15);
229
+ --eccgui-tag-emfactor: 60%;
215
230
  }
231
+
232
+ &[class*="#{$eccgui}-intent--"] {
233
+ color: eccgui-color-rgba(var(--eccgui-tag-text), var(--eccgui-tag-emfactor));
234
+ border-color: eccgui-color-rgba(var(--eccgui-tag-border), var(--eccgui-tag-emfactor));
235
+ }
236
+
216
237
  &.#{$eccgui}-intent--primary {
217
- color: $eccgui-color-primary;
218
- background-color: $eccgui-color-primary-contrast;
219
- border-color: $eccgui-color-primary;
238
+ --eccgui-tag-text: #{$eccgui-color-primary};
239
+ --eccgui-tag-border: #{$eccgui-color-primary};
240
+ --eccgui-tag-bg: #{$eccgui-color-primary-contrast};
220
241
  }
221
242
  &.#{$eccgui}-intent--accent {
222
- color: $eccgui-color-accent;
223
- background-color: $eccgui-color-accent-contrast;
224
- border-color: $eccgui-color-accent;
243
+ --eccgui-tag-text: #{$eccgui-color-accent};
244
+ --eccgui-tag-border: #{$eccgui-color-accent};
245
+ --eccgui-tag-bg: #{$eccgui-color-accent-contrast};
225
246
  }
226
247
  &.#{$eccgui}-intent--info {
227
- color: $eccgui-color-info-text;
228
- background-color: $eccgui-color-info-background;
229
- border-color: $eccgui-color-info-text;
248
+ --eccgui-tag-text: #{$eccgui-color-info-text};
249
+ --eccgui-tag-border: #{$eccgui-color-info-text};
250
+ --eccgui-tag-bg: #{$eccgui-color-info-background};
230
251
  }
231
252
  &.#{$eccgui}-intent--success {
232
- color: $eccgui-color-success-text;
233
- background-color: $eccgui-color-success-background;
234
- border-color: $eccgui-color-success-text;
253
+ --eccgui-tag-text: #{$eccgui-color-success-text};
254
+ --eccgui-tag-border: #{$eccgui-color-success-text};
255
+ --eccgui-tag-bg: #{$eccgui-color-success-background};
235
256
  }
236
257
  &.#{$eccgui}-intent--warning {
237
- color: $eccgui-color-warning-text;
238
- background-color: $eccgui-color-warning-background;
239
- border-color: $eccgui-color-warning-text;
258
+ --eccgui-tag-text: #{$eccgui-color-warning-text};
259
+ --eccgui-tag-border: #{$eccgui-color-warning-text};
260
+ --eccgui-tag-bg: #{$eccgui-color-warning-background};
240
261
  }
241
262
  &.#{$eccgui}-intent--danger {
242
- color: $eccgui-color-danger-text;
243
- background-color: $eccgui-color-danger-background;
244
- border-color: $eccgui-color-danger-text;
263
+ --eccgui-tag-text: #{$eccgui-color-danger-text};
264
+ --eccgui-tag-border: #{$eccgui-color-danger-text};
265
+ --eccgui-tag-bg: #{$eccgui-color-danger-background};
245
266
  }
246
267
  }
247
268
  }
248
269
  }
270
+
271
+ @media print {
272
+ .#{$eccgui}-tag__item {
273
+ print-color-adjust: exact;
274
+ }
275
+ }
@@ -10,7 +10,8 @@ $eccgui-size-textfield-padding-horizontal-regular: $eccgui-size-inline-whitespac
10
10
  $eccgui-size-textfield-padding-horizontal-small: $eccgui-size-inline-whitespace * 0.5 !default;
11
11
  $eccgui-typo-textfield-fontweight: $eccgui-font-weight-regular !default;
12
12
  $eccgui-color-textfield-text: $eccgui-color-workspace-text !default;
13
- $eccgui-color-textfield-background: white !default; // TODO define global var for it
13
+ $eccgui-color-textfield-background: eccgui-color-var("identity", "background", 100) !default;
14
+
14
15
  // lib vars
15
16
  $pt-input-height: $eccgui-size-textfield-height-regular; // !default;
16
17
  $pt-input-height-large: $eccgui-size-textfield-height-large; // !default;
@@ -191,33 +192,40 @@ $eccgui-map-intent-bgcolors: (
191
192
  position: absolute;
192
193
  top: 0;
193
194
  left: 0;
195
+ margin-top: -1 * $eccgui-size-textfield-padding-horizontal-small;
196
+ margin-right: -1 * $eccgui-size-textfield-padding-horizontal-small;
197
+
198
+ .#{$ns}-input.#{$ns}-small ~ & {
199
+ margin-top: -0.5 * $eccgui-size-textfield-padding-horizontal-small;
200
+ margin-right: -0.5 * $eccgui-size-textfield-padding-horizontal-small;
201
+ }
194
202
  }
195
203
 
196
204
  .#{$eccgui}-textarea__options {
197
205
  position: absolute;
198
206
  top: 0;
199
207
  right: 0;
208
+ margin-top: -1 * $eccgui-size-textfield-padding-horizontal-small;
209
+ margin-right: -1 * $eccgui-size-textfield-padding-horizontal-small;
210
+ text-align: right;
200
211
  filter: grayscale(1);
201
212
 
213
+ .#{$ns}-input.#{$ns}-small ~ & {
214
+ margin-top: -0.5 * $eccgui-size-textfield-padding-horizontal-small;
215
+ margin-right: -0.5 * $eccgui-size-textfield-padding-horizontal-small;
216
+ }
217
+
202
218
  &:hover,
203
219
  .#{$eccgui}-textarea:focus ~ & {
204
220
  filter: none;
205
221
  }
206
222
 
207
- & > .#{$eccgui}-button--icon {
208
- margin-top: -1 * $eccgui-size-textfield-padding-horizontal-regular;
209
-
210
- &:last-of-type {
211
- margin-right: -1 * $eccgui-size-textfield-padding-horizontal-regular;
212
- }
213
- }
214
-
215
- .#{$ns}-input.#{$ns}-small ~ & > .#{$eccgui}-button--icon {
216
- margin-top: -1 * $eccgui-size-textfield-padding-horizontal-small;
217
-
218
- &:last-of-type {
219
- margin-right: -1 * $eccgui-size-textfield-padding-horizontal-small;
220
- }
223
+ & > .#{$eccgui}-button,
224
+ & > .#{$eccgui}-icon,
225
+ & > .#{$eccgui}-contextoverlay,
226
+ & > .#{$eccgui}-tooltip__wrapper {
227
+ display: inline-block;
228
+ vertical-align: middle;
221
229
  }
222
230
  }
223
231
 
@@ -18,8 +18,9 @@ Default.args = {
18
18
  <LoremIpsum p={1} avgSentencesPerParagraph={1} random={false} />,
19
19
  "Simple text with URL http://example.com/ that should not get parsed.",
20
20
  "a < b to test equations in text like b > a.",
21
+ `Something with a "quote" in it.`,
21
22
  <>
22
- <Markdown>{`* This\n* is\n* a\n* list\n\nwritten in Markdown.`}</Markdown>
23
+ <Markdown>{`* This\n* is\n* a\n* list\n\nwritten in Markdown\n* containing a few HTML 'entities' & "quotes".`}</Markdown>
23
24
  <HtmlContentBlock>
24
25
  <h1>Block with sub elements</h1>
25
26
  <LoremIpsum p={3} avgSentencesPerParagraph={3} random={false} />
@@ -0,0 +1,44 @@
1
+ import React from "react";
2
+ import {render, RenderResult} from "@testing-library/react";
3
+
4
+ import "@testing-library/jest-dom";
5
+
6
+ import { Markdown, TextReducer } from "./../../";
7
+ import { Default as TextReducerStory } from "./TextReducer.stories";
8
+
9
+ describe("TextReducer", () => {
10
+ const textMustExist = (queryByText: RenderResult["queryByText"], text: string) => {
11
+ expect(queryByText(text, { exact: false })).not.toBeNull();
12
+ }
13
+ const textMustNotExist = (queryByText: RenderResult["queryByText"], text: string) => {
14
+ expect(queryByText(text, { exact: false })).toBeNull();
15
+ }
16
+ it("should display encoded HTML entities by default if they are used in the transformed markup", () => {
17
+ const { queryByText } = render(<TextReducer {...TextReducerStory.args} />);
18
+ textMustExist(queryByText, "&#x27;entities&#x27; &amp; &quot;quotes&quot;");
19
+ textMustNotExist(queryByText, `'entities' & "quotes"`);
20
+ });
21
+ it("should not display encoded HTML entities if `decodeHtmlEntities` is enabled", () => {
22
+ const { queryByText } = render(<TextReducer {...TextReducerStory.args} decodeHtmlEntities />);
23
+ textMustNotExist(queryByText, "&#x27;entities&#x27; &amp; &quot;quotes&quot;");
24
+ textMustExist(queryByText, `'entities' & "quotes"`);
25
+ });
26
+ it("should only decode if correct encoded HTML entities are found (strict mode)", () => {
27
+ const { queryByText } = render(
28
+ <TextReducer decodeHtmlEntities>
29
+ <Markdown>&</Markdown>&amp foo&ampbar
30
+ </TextReducer>
31
+ );
32
+ textMustExist(queryByText, "& &amp foo&ampbar");
33
+ textMustNotExist(queryByText, "& & foo&ampbar");
34
+ });
35
+ it("should allow decoding non-strict encoded HTML entities", () => {
36
+ const { queryByText } = render(
37
+ <TextReducer decodeHtmlEntities decodeHtmlEntitiesOptions={{ strict: false }}>
38
+ <Markdown>&</Markdown>&amp foo&ampbar
39
+ </TextReducer>
40
+ );
41
+ textMustNotExist(queryByText, "& &amp foo&ampbar");
42
+ textMustExist(queryByText, "& & foo&ampbar");
43
+ });
44
+ });
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
- import { renderToString } from "react-dom/server";
3
- import * as ReactIs from "react-is";
4
2
 
3
+ import { DecodeHtmlEntitiesOptions, utils } from "../../common";
5
4
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
6
5
 
7
6
  import { OverflowText, OverflowTextProps } from "./../Typography";
@@ -25,6 +24,17 @@ export interface TextReducerProps extends Pick<React.HTMLAttributes<HTMLElement>
25
24
  * Specify more `OverflowText` properties used when `useOverflowTextWrapper` is set to `true`.
26
25
  */
27
26
  overflowTextProps?: Omit<OverflowTextProps, "passDown">;
27
+ /**
28
+ * If you transform HTML markup to text then the result could contain HTML entity encoded strings.
29
+ * By enabling this option they are decoded back to it's original char.
30
+ */
31
+ decodeHtmlEntities?: boolean;
32
+ /**
33
+ * Set the options used to decode the HTML entities, if `decodeHtmlEntities` is enabled.
34
+ * Internally we use `he` library, see their [documentation on decode options](https://www.npmjs.com/package/he#hedecodehtml-options).
35
+ * If not set we use `{ isAttributeValue: true, strict: true }` as default value.
36
+ */
37
+ decodeHtmlEntitiesOptions?: DecodeHtmlEntitiesOptions;
28
38
  }
29
39
 
30
40
  /**
@@ -33,52 +43,15 @@ export interface TextReducerProps extends Pick<React.HTMLAttributes<HTMLElement>
33
43
  */
34
44
  export const TextReducer = ({
35
45
  children,
36
- maxNodes,
37
- maxLength,
38
46
  useOverflowTextWrapper,
39
47
  overflowTextProps,
48
+ ...reduceToTextOptions
40
49
  }: TextReducerProps) => {
41
- const nodesCount = 0;
42
-
43
- const onlyText = (children: React.ReactNode | React.ReactNode[], maxNodes?: number): string => {
44
- if (typeof maxNodes !== "undefined" && nodesCount >= maxNodes) {
45
- return "";
46
- }
47
-
48
- if (children instanceof Array) {
49
- return children
50
- .slice(0, maxNodes)
51
- .map((child: React.ReactNode) => {
52
- return onlyText(child, maxNodes);
53
- })
54
- .join(" ");
55
- }
56
-
57
- return React.Children.toArray(children)
58
- .slice(0, maxNodes)
59
- .map((child) => {
60
- if (ReactIs.isFragment(child)) {
61
- return onlyText(child.props?.children, maxNodes);
62
- }
63
- if (typeof child === "string") {
64
- return child;
65
- }
66
- if (typeof child === "number") {
67
- return child.toString();
68
- }
69
- if (ReactIs.isElement(child)) {
70
- // for some reasons `renderToString` returns empty string if not wrappe in a `span`
71
- return renderToString(<span>{child}</span>);
72
- }
73
- return "";
74
- })
75
- .join(" ")
76
- .replaceAll("\n", " ");
77
- };
50
+ if (typeof children === "undefined") {
51
+ return <></>;
52
+ }
78
53
 
79
- const shrinkedContent = onlyText(children, maxNodes)
80
- .replaceAll(/<[^\s][^>]*>/g, "")
81
- .slice(0, maxLength);
54
+ const shrinkedContent = utils.reduceToText(children, reduceToTextOptions);
82
55
 
83
56
  return useOverflowTextWrapper ? (
84
57
  <OverflowText
@@ -35,7 +35,7 @@ const Template: StoryFn<typeof VisualTour> = (args: VisualTourProps) => {
35
35
  <ToolbarSection id={"buttonSection"}>
36
36
  <Button id={"actionA"}>Action A</Button>
37
37
  <Button id={"actionB"}>Action B</Button>
38
- <Button id={"startTour"} intent={"primary"} onClick={() => setIsOpen(true)}>
38
+ <Button id={"startTour"} elevated onClick={() => setIsOpen(true)}>
39
39
  Start tour!
40
40
  </Button>
41
41
  </ToolbarSection>
@@ -13,7 +13,7 @@ $eccgui-color-palette-light: (
13
13
  ),
14
14
  "semantic": (
15
15
  "info": eccgui-create-color-tints(#e5f4fb #aecfe3 #77aaca #4086b2 #096199),
16
- "success": eccgui-create-color-tints(#e8f5e9 #b2c6b4 #7c967e #466749 #2f5e3a),
16
+ "success": eccgui-create-color-tints(#e8f5e9 #b1d4b7 #7ab286 #429154 #0b6f22),
17
17
  "warning": eccgui-create-color-tints(#fff3e0 #fad2b3 #f5b287 #f0915a #eb702d),
18
18
  "danger": eccgui-create-color-tints(#fff5f6 #edbfc0 #db8989 #c95253 #b71c1c),
19
19
  ),
@@ -24,6 +24,7 @@ $eccgui-color-palette-light: (
24
24
  "pink": eccgui-create-color-tints(#fde4f1 #e6b4ce #d08aae #bb5f8e #711c4d),
25
25
  "violet": eccgui-create-color-tints(#f4e3f4 #d8b0d8 #b377b3 #904490 #6e1f6e),
26
26
  "indigo": eccgui-create-color-tints(#efe4fb #b89ee0 #8f72c5 #6547aa #3b1e8f),
27
+ "petrol": eccgui-create-color-tints(#e7eef2 #b0c8d4 #7aa2b5 #437c97 #0c5678),
27
28
  "cyan": eccgui-create-color-tints(#dff9fc #86d6e5 #5abfd4 #2da9c4 #006a8f),
28
29
  "teal": eccgui-create-color-tints(#dff4ef #a3ddd3 #6dc0b2 #479d8d #104c42),
29
30
  "lime": eccgui-create-color-tints(#e4f3ea #d2edd6 #9dcd99 #688a55 #5a7b2c),
@@ -7,9 +7,14 @@ $reactflow-node-color: $eccgui-color-workspace-text !default;
7
7
  $reactflow-node-font-size: $eccgui-size-typo-caption !default;
8
8
  $reactflow-node-border-width: 2 * $button-border-width !default;
9
9
  $reactflow-node-border-radius: $button-border-radius !default;
10
- $reactflow-edge-stroke-opacity-default: 0.8 !default;
11
- $reactflow-edge-stroke-opacity-hover: 0.9 !default;
12
- $reactflow-edge-stroke-opacity-selected: 1 !default;
10
+ $reactflow-edge-rendering: geometricprecision !default;
11
+ $reactflow-edge-stroke-width-default: 2px !default;
12
+ $reactflow-edge-stroke-width-hover: 2px !default;
13
+ $reactflow-edge-stroke-width-selected: 2px !default;
14
+ $reactflow-edge-stroke-opacity-default: $eccgui-opacity-muted !default;
15
+ $reactflow-edge-stroke-opacity-hover: $eccgui-opacity-narrow !default;
16
+ $reactflow-edge-stroke-opacity-selected: $eccgui-opacity-regular !default;
17
+ $reactflow-edge-stroke-opacity-interaction-ratio: $eccgui-opacity-ghostly !default;
13
18
  $reactflow-edge-stroke-color-default: #{eccgui-color-var("identity", "text", "700")} !default;
14
19
  $reactflow-edge-stroke-color-hover: $reactflow-edge-stroke-color-default !default;
15
20
  $reactflow-edge-stroke-color-selected: $eccgui-color-accent !default;