@eccenca/gui-elements 24.0.0-rc.3 → 24.0.0-rc.5

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 (74) hide show
  1. package/CHANGELOG.md +45 -26
  2. package/dist/cjs/cmem/markdown/Markdown.js +7 -5
  3. package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
  4. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +14 -10
  5. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  6. package/dist/cjs/components/Icon/canonicalIconNames.js +2 -1
  7. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  8. package/dist/cjs/components/MultiSelect/MultiSelect.js +27 -1
  9. package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
  10. package/dist/cjs/components/Typography/HtmlContentBlock.js.map +1 -1
  11. package/dist/cjs/extensions/codemirror/CodeMirror.js +4 -3
  12. package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
  13. package/dist/cjs/extensions/react-flow/handles/HandleContent.js +1 -1
  14. package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
  15. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +18 -20
  16. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  17. package/dist/cjs/extensions/react-flow/handles/HandleTools.js +4 -3
  18. package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -1
  19. package/dist/esm/cmem/markdown/Markdown.js +7 -5
  20. package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
  21. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +14 -10
  22. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  23. package/dist/esm/components/Icon/canonicalIconNames.js +2 -1
  24. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  25. package/dist/esm/components/MultiSelect/MultiSelect.js +29 -3
  26. package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
  27. package/dist/esm/components/Typography/HtmlContentBlock.js.map +1 -1
  28. package/dist/esm/extensions/codemirror/CodeMirror.js +4 -3
  29. package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
  30. package/dist/esm/extensions/react-flow/handles/HandleContent.js +1 -1
  31. package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
  32. package/dist/esm/extensions/react-flow/handles/HandleDefault.js +18 -20
  33. package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  34. package/dist/esm/extensions/react-flow/handles/HandleTools.js +4 -3
  35. package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -1
  36. package/dist/types/cmem/markdown/Markdown.d.ts +8 -3
  37. package/dist/types/components/Icon/canonicalIconNames.d.ts +2 -1
  38. package/dist/types/components/MultiSelect/MultiSelect.d.ts +7 -1
  39. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  40. package/dist/types/components/Typography/HtmlContentBlock.d.ts +16 -4
  41. package/dist/types/extensions/codemirror/CodeMirror.d.ts +2 -2
  42. package/package.json +28 -26
  43. package/src/cmem/markdown/Markdown.stories.tsx +6 -0
  44. package/src/cmem/markdown/Markdown.tsx +21 -7
  45. package/src/components/Application/_config.scss +1 -1
  46. package/src/components/Application/stories/Application.stories.tsx +11 -1
  47. package/src/components/AutoSuggestion/AutoSuggestion.scss +21 -8
  48. package/src/components/AutoSuggestion/AutoSuggestion.tsx +34 -24
  49. package/src/components/Breadcrumb/breadcrumb.scss +8 -1
  50. package/src/components/Depiction/stories/Depiction.stories.tsx +18 -1
  51. package/src/components/Icon/canonicalIconNames.tsx +2 -1
  52. package/src/components/MultiSelect/MultiSelect.tsx +37 -0
  53. package/src/components/MultiSuggestField/MultiSuggestField.stories.tsx +22 -19
  54. package/src/components/MultiSuggestField/_multisuggestfield.scss +8 -0
  55. package/src/components/MultiSuggestField/tests/MultiSuggestField.test.tsx +103 -9
  56. package/src/components/OverviewItem/overviewitem.scss +18 -7
  57. package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +1 -1
  58. package/src/components/OverviewItem/stories/OverviewItemDepiction.stories.tsx +25 -7
  59. package/src/components/TextField/textfield.scss +1 -2
  60. package/src/components/Tooltip/Tooltip.tsx +1 -1
  61. package/src/components/Typography/HtmlContentBlock.tsx +16 -4
  62. package/src/components/Typography/stories/HtmlContentBlock.stories.tsx +50 -0
  63. package/src/components/Typography/stories/WhiteSpaceContainer.stories.tsx +15 -30
  64. package/src/components/Typography/typography.scss +10 -0
  65. package/src/components/index.scss +1 -1
  66. package/src/extensions/_index.scss +1 -6
  67. package/src/extensions/codemirror/CodeMirror.tsx +10 -7
  68. package/src/extensions/codemirror/_codemirror.scss +1 -1
  69. package/src/extensions/react-flow/handles/HandleContent.tsx +1 -1
  70. package/src/extensions/react-flow/handles/HandleDefault.tsx +21 -33
  71. package/src/extensions/react-flow/handles/HandleTools.tsx +4 -3
  72. package/src/extensions/react-flow/handles/_handles.scss +2 -1
  73. package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +12 -9
  74. package/src/index.scss +0 -1
@@ -1,6 +1,8 @@
1
1
  @import "~@blueprintjs/core/src/components/breadcrumbs/breadcrumbs";
2
2
  @import "~@blueprintjs/core/src/components/overflow-list/overflow-list";
3
3
 
4
+ $eccgui-color-breadcrumb-link: $eccgui-color-accent !default;
5
+
4
6
  .#{$eccgui}-breadcrumb__list {
5
7
  height: auto;
6
8
 
@@ -19,7 +21,7 @@
19
21
  margin: 0;
20
22
  text-align: center;
21
23
  vertical-align: middle;
22
- content: "/";
24
+ content: ">";
23
25
  background: none;
24
26
  }
25
27
 
@@ -65,10 +67,15 @@
65
67
  a {
66
68
  @extend .#{$eccgui}-breadcrumb__item;
67
69
  @extend .#{$ns}-breadcrumb;
70
+
71
+ color: $eccgui-color-breadcrumb-link;
72
+ cursor: pointer;
68
73
  }
69
74
  }
70
75
 
71
76
  a.#{$eccgui}-breadcrumb__item {
77
+ color: $eccgui-color-breadcrumb-link;
78
+ cursor: pointer;
72
79
  &:not(.#{$ns}-breadcrumb-current):not(.#{$ns}-disabled) {
73
80
  text-decoration: underline;
74
81
 
@@ -3,7 +3,7 @@ import { OverlaysProvider } from "@blueprintjs/core";
3
3
  import { LogoReact } from "@carbon/icons-react";
4
4
  import { Meta, StoryFn } from "@storybook/react";
5
5
 
6
- import { Badge, Depiction, Icon, TestIcon } from "../../../index";
6
+ import { Badge, Depiction, Icon, OverviewItem, TestIcon } from "../../../index";
7
7
 
8
8
  import canonicalIcons from "./../../Icon/canonicalIconNames";
9
9
  import { Svg9to16 } from "./test-9to16";
@@ -81,8 +81,25 @@ const TemplateFull: StoryFn<typeof Depiction> = (args) => (
81
81
  </OverlaysProvider>
82
82
  );
83
83
 
84
+ const TemplateInsideOverviewItem: StoryFn<typeof Depiction> = (args) => (
85
+ <OverlaysProvider>
86
+ <OverviewItem>
87
+ <Depiction {...args} />
88
+ </OverviewItem>
89
+ </OverlaysProvider>
90
+ );
91
+
84
92
  export const FullExample = TemplateFull.bind({});
85
93
  FullExample.args = {
86
94
  image: <img src={png16to9} />,
87
95
  caption: "This is a test description for the image.",
88
96
  };
97
+
98
+ export const InsideOverviewItem = TemplateInsideOverviewItem.bind({});
99
+ InsideOverviewItem.args = {
100
+ ...FullExample.args,
101
+ backgroundColor: "dark",
102
+ ratio: "1:1",
103
+ padding: "medium",
104
+ resizing: "contain",
105
+ };
@@ -17,7 +17,8 @@ const canonicalIcons = {
17
17
 
18
18
  "artefact-chatlog": icons.Chat,
19
19
  "artefact-commit": icons.Commit,
20
- "artefact-customtask": icons.Script,
20
+ "artefact-task-deleteprojectfiles": icons.TrashCan,
21
+ "artefact-task-downloadfile": icons.CloudDownload,
21
22
  "artefact-dataset-csv": icons.Csv,
22
23
  "artefact-dataset-eccencadataplatform": icons.DataVis_1,
23
24
  "artefact-dataset-excel": icons.Xls,
@@ -119,6 +119,12 @@ interface MultiSelectCommonProps<T>
119
119
  * If not provided, values are filtered by their labels
120
120
  */
121
121
  searchPredicate?: (item: T, query: string) => boolean;
122
+ /**
123
+ * Limits the height of the input target plus its dropdown menu when it is opened.
124
+ * Need to be a `number not greater than 100` (as `vh`, a unit describing a length relative to the viewport height) or `true` (equals 100).
125
+ * If not set than the dropdown menu cannot be larger that appr. the half of the available viewport hight.
126
+ */
127
+ limitHeightOpened?: boolean | number;
122
128
  }
123
129
 
124
130
  /** @deprecated (v25) use MultiSuggestFieldProps */
@@ -172,6 +178,7 @@ function MultiSelect<T>({
172
178
  "data-testid": dataTestid,
173
179
  wrapperProps,
174
180
  searchPredicate,
181
+ limitHeightOpened,
175
182
  ...otherMultiSelectProps
176
183
  }: MultiSelectProps<T>) {
177
184
  // Options created by a user
@@ -184,6 +191,8 @@ function MultiSelect<T>({
184
191
  const [selectedItems, setSelectedItems] = React.useState<T[]>(() =>
185
192
  prePopulateWithItems ? [...items] : externalSelectedItems ? [...externalSelectedItems] : []
186
193
  );
194
+ // Max height of the menu
195
+ const [calculatedMaxHeight, setCalculatedMaxHeight] = React.useState<string | null>(null);
187
196
 
188
197
  //currently focused element in popover list
189
198
  const [focusedItem, setFocusedItem] = React.useState<T | null>(null);
@@ -244,6 +253,29 @@ function MultiSelect<T>({
244
253
  setSelectedItems(externalSelectedItems);
245
254
  }, [externalSelectedItems?.map((item) => itemId(item)).join("|")]);
246
255
 
256
+ React.useEffect(() => {
257
+ const calculateMaxHeight = () => {
258
+ if (inputRef.current) {
259
+ // Get the height of the input target
260
+ const inputTargetHeight = inputRef.current.getBoundingClientRect().height;
261
+ // Calculate the menu dropdown by using the limited height reduced by the target height
262
+ setCalculatedMaxHeight(`calc(${maxHeightToProcess}vh - ${inputTargetHeight}px)`);
263
+ }
264
+ };
265
+
266
+ const removeListener = () => {
267
+ window.removeEventListener("resize", calculateMaxHeight);
268
+ };
269
+
270
+ if (!limitHeightOpened || (typeof limitHeightOpened === "number" && limitHeightOpened > 100))
271
+ return removeListener;
272
+ const maxHeightToProcess = typeof limitHeightOpened === "number" ? limitHeightOpened : 100;
273
+
274
+ calculateMaxHeight();
275
+ window.addEventListener("resize", calculateMaxHeight);
276
+ return removeListener;
277
+ }, [limitHeightOpened, selectedItems]);
278
+
247
279
  /**
248
280
  * using the equality prop specified checks if an item has already been selected
249
281
  * @param matcher
@@ -514,6 +546,11 @@ function MultiSelect<T>({
514
546
  {
515
547
  "data-test-id": dataTestId ? dataTestId + "_drowpdown" : undefined,
516
548
  "data-testid": dataTestid ? dataTestid + "_dropdown" : undefined,
549
+ style: calculatedMaxHeight
550
+ ? ({
551
+ "--eccgui-multisuggestfield-max-height": `${calculatedMaxHeight}`,
552
+ } as React.CSSProperties)
553
+ : undefined,
517
554
  } as BlueprintMultiSelectProps<T>["popoverContentProps"]
518
555
  }
519
556
  />
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useMemo, useState } from "react";
2
2
  import { loremIpsum } from "react-lorem-ipsum";
3
+ import { OverlaysProvider } from "@blueprintjs/core";
3
4
  import { Meta, StoryFn } from "@storybook/react";
4
5
  import { fn } from "@storybook/test";
5
6
 
@@ -7,7 +8,7 @@ import { MultiSuggestField, MultiSuggestFieldSelectionProps, SimpleDialog } from
7
8
 
8
9
  const testLabels = loremIpsum({
9
10
  p: 1,
10
- avgSentencesPerParagraph: 5,
11
+ avgSentencesPerParagraph: 50,
11
12
  avgWordsPerSentence: 1,
12
13
  startWithLoremIpsum: false,
13
14
  random: false,
@@ -16,8 +17,8 @@ const testLabels = loremIpsum({
16
17
  .split(".")
17
18
  .map((item) => item.trim());
18
19
 
19
- const items = new Array(5).fill(undefined).map((_, id) => {
20
- const testLabel = testLabels[id];
20
+ const items = new Array(50).fill(undefined).map((_, id) => {
21
+ const testLabel = `${testLabels[id]}${id + 1}`;
21
22
  return { testLabel, testId: `${testLabel}-id` };
22
23
  });
23
24
 
@@ -36,9 +37,9 @@ export default {
36
37
 
37
38
  const Template: StoryFn<typeof MultiSuggestField> = (args) => {
38
39
  return (
39
- <div>
40
+ <OverlaysProvider>
40
41
  <MultiSuggestField {...args} />
41
- </div>
42
+ </OverlaysProvider>
42
43
  );
43
44
  };
44
45
 
@@ -91,7 +92,7 @@ const DeferredSelectionTemplate: StoryFn = () => {
91
92
  const identity = useCallback((item: string): string => item, []);
92
93
 
93
94
  return (
94
- <>
95
+ <OverlaysProvider>
95
96
  <div>Selected items loaded: {loaded.toString()}</div>
96
97
 
97
98
  <br />
@@ -107,7 +108,7 @@ const DeferredSelectionTemplate: StoryFn = () => {
107
108
  <br />
108
109
 
109
110
  <button onClick={() => setLoaded((prev) => !prev)}>Toggle selected</button>
110
- </>
111
+ </OverlaysProvider>
111
112
  );
112
113
  };
113
114
 
@@ -142,14 +143,16 @@ const CreationTemplate: StoryFn = () => {
142
143
  }, []);
143
144
 
144
145
  return (
145
- <MultiSuggestField<string>
146
- items={items}
147
- selectedItems={selectedValues}
148
- onSelection={handleOnSelect}
149
- itemId={identity}
150
- itemLabel={identity}
151
- createNewItemFromQuery={identity}
152
- />
146
+ <OverlaysProvider>
147
+ <MultiSuggestField<string>
148
+ items={items}
149
+ selectedItems={selectedValues}
150
+ onSelection={handleOnSelect}
151
+ itemId={identity}
152
+ itemLabel={identity}
153
+ createNewItemFromQuery={identity}
154
+ />
155
+ </OverlaysProvider>
153
156
  );
154
157
  };
155
158
 
@@ -173,7 +176,7 @@ const WithResetButtonComponent = (): JSX.Element => {
173
176
  };
174
177
 
175
178
  return (
176
- <div>
179
+ <OverlaysProvider>
177
180
  <button onClick={handleReset}>Reset</button>
178
181
  <br />
179
182
  <br />
@@ -185,7 +188,7 @@ const WithResetButtonComponent = (): JSX.Element => {
185
188
  itemLabel={({ testLabel }) => testLabel}
186
189
  createNewItemFromQuery={(query) => ({ testId: `${query}-id`, testLabel: query })}
187
190
  />
188
- </div>
191
+ </OverlaysProvider>
189
192
  );
190
193
  };
191
194
 
@@ -215,7 +218,7 @@ const WithinModal = (): JSX.Element => {
215
218
  };
216
219
 
217
220
  return (
218
- <>
221
+ <OverlaysProvider>
219
222
  <button onClick={() => setIsOpen(true)}>open modal</button>
220
223
 
221
224
  <SimpleDialog isOpen={isOpen} onClose={() => setIsOpen(false)} canOutsideClickClose>
@@ -233,7 +236,7 @@ const WithinModal = (): JSX.Element => {
233
236
  />
234
237
  </div>
235
238
  </SimpleDialog>
236
- </>
239
+ </OverlaysProvider>
237
240
  );
238
241
  };
239
242
 
@@ -0,0 +1,8 @@
1
+ @import "~@blueprintjs/select/src/components/multi-select/multi-select";
2
+
3
+ .#{$ns}-multi-select-popover {
4
+ .#{$ns}-menu {
5
+ max-width: unset;
6
+ max-height: var(--eccgui-multisuggestfield-max-height, 45vh);
7
+ }
8
+ }
@@ -6,10 +6,10 @@ import "@testing-library/jest-dom";
6
6
  import { MultiSuggestField } from "../../../../index";
7
7
  import { CustomSearch, Default, dropdownOnFocus, predefinedNotControlledValues } from "../MultiSuggestField.stories";
8
8
 
9
- const testLabels = ["label1", "label2", "label3", "label4", "label5"];
9
+ //const testLabels = ["label1", "label2", "label3", "label4", "label5"];
10
10
 
11
- const items = new Array(5).fill(undefined).map((_, id) => {
12
- const testLabel = testLabels[id];
11
+ const items = new Array(50).fill(undefined).map((_, id) => {
12
+ const testLabel = `label${id + 1}`;
13
13
  return { testLabel, testId: `${testLabel}-id` };
14
14
  });
15
15
 
@@ -108,7 +108,7 @@ describe("MultiSuggestField", () => {
108
108
  expect(menuItems.length).toBe(dropdownOnFocus.args.items.length);
109
109
  });
110
110
 
111
- fireEvent.change(input, { target: { value: "ex" } });
111
+ fireEvent.change(input, { target: { value: "cras" } });
112
112
 
113
113
  await waitFor(() => {
114
114
  const listbox = screen.getByRole("listbox");
@@ -277,7 +277,7 @@ describe("MultiSuggestField", () => {
277
277
  expect(menuItems.length).toBe(CustomSearch.args.items.length);
278
278
  });
279
279
 
280
- fireEvent.change(input, { target: { value: "label1" } });
280
+ fireEvent.change(input, { target: { value: "label11" } });
281
281
 
282
282
  await waitFor(() => {
283
283
  const listbox = screen.getByRole("listbox");
@@ -289,10 +289,10 @@ describe("MultiSuggestField", () => {
289
289
  const item = menuItems[0];
290
290
 
291
291
  const [div] = item.getElementsByTagName("div");
292
- expect(div.textContent).toBe("label1");
292
+ expect(div.textContent).toBe("label11");
293
293
  });
294
294
 
295
- fireEvent.change(input, { target: { value: "label1-id" } });
295
+ fireEvent.change(input, { target: { value: "label11-id" } });
296
296
 
297
297
  await waitFor(() => {
298
298
  const listbox = screen.getByRole("listbox");
@@ -304,10 +304,10 @@ describe("MultiSuggestField", () => {
304
304
  const item = menuItems[0];
305
305
 
306
306
  const [div] = item.getElementsByTagName("div");
307
- expect(div.textContent).toBe("label1");
307
+ expect(div.textContent).toBe("label11");
308
308
  });
309
309
 
310
- fireEvent.change(input, { target: { value: "label1-id-other" } });
310
+ fireEvent.change(input, { target: { value: "label11-id-other" } });
311
311
 
312
312
  await waitFor(() => {
313
313
  const listbox = screen.getByRole("listbox");
@@ -549,5 +549,99 @@ describe("MultiSuggestField", () => {
549
549
  const tagsAfterRemove = container.querySelectorAll("span[data-tag-index]");
550
550
  expect(tagsAfterRemove.length).toBe(0);
551
551
  });
552
+
553
+ it("should not contain the custom css property when limitHeightOpened not provided", async () => {
554
+ const { container } = render(
555
+ <MultiSuggestField {...Default.args} openOnKeyDown={false} data-testid="multi-suggest-field" />
556
+ );
557
+
558
+ const [inputTargetContainer] = container.getElementsByClassName("eccgui-multiselect");
559
+
560
+ fireEvent.click(inputTargetContainer);
561
+
562
+ await waitFor(() => {
563
+ const dropdown = screen.getByTestId("multi-suggest-field_dropdown");
564
+ const customProperty = (dropdown as HTMLElement)?.style?.getPropertyValue(
565
+ "--eccgui-multisuggestfield-max-height"
566
+ );
567
+
568
+ expect(customProperty).toBeFalsy();
569
+ });
570
+ });
571
+
572
+ it("should notcontain the custom css property when limitHeightOpened greater than 100", async () => {
573
+ const { container } = render(
574
+ <MultiSuggestField
575
+ {...Default.args}
576
+ openOnKeyDown={false}
577
+ limitHeightOpened={110}
578
+ data-testid="multi-suggest-field"
579
+ />
580
+ );
581
+
582
+ const [inputTargetContainer] = container.getElementsByClassName("eccgui-multiselect");
583
+
584
+ fireEvent.click(inputTargetContainer);
585
+
586
+ await waitFor(() => {
587
+ const dropdown = screen.getByTestId("multi-suggest-field_dropdown");
588
+
589
+ const customProperty = (dropdown as HTMLElement)?.style?.getPropertyValue(
590
+ "--eccgui-multisuggestfield-max-height"
591
+ );
592
+
593
+ expect(customProperty).toBeFalsy();
594
+ });
595
+ });
596
+
597
+ it("should contain the custom css property when limitHeightOpened is true", async () => {
598
+ const { container } = render(
599
+ <MultiSuggestField
600
+ {...Default.args}
601
+ openOnKeyDown={false}
602
+ limitHeightOpened
603
+ data-testid="multi-suggest-field"
604
+ />
605
+ );
606
+
607
+ const [inputTargetContainer] = container.getElementsByClassName("eccgui-multiselect");
608
+
609
+ fireEvent.click(inputTargetContainer);
610
+
611
+ await waitFor(() => {
612
+ const dropdown = screen.getByTestId("multi-suggest-field_dropdown");
613
+
614
+ const customProperty = (dropdown as HTMLElement)?.style?.getPropertyValue(
615
+ "--eccgui-multisuggestfield-max-height"
616
+ );
617
+
618
+ expect(customProperty).toBeDefined();
619
+ });
620
+ });
621
+
622
+ it("should contain the custom css property when limitHeightOpened a valid number value", async () => {
623
+ const { container } = render(
624
+ <MultiSuggestField
625
+ {...Default.args}
626
+ openOnKeyDown={false}
627
+ limitHeightOpened={80}
628
+ data-testid="multi-suggest-field"
629
+ />
630
+ );
631
+
632
+ const [inputTargetContainer] = container.getElementsByClassName("eccgui-multiselect");
633
+
634
+ fireEvent.click(inputTargetContainer);
635
+
636
+ await waitFor(() => {
637
+ const dropdown = screen.getByTestId("multi-suggest-field_dropdown");
638
+
639
+ const customProperty = (dropdown as HTMLElement)?.style?.getPropertyValue(
640
+ "--eccgui-multisuggestfield-max-height"
641
+ );
642
+
643
+ expect(customProperty).toBeDefined();
644
+ });
645
+ });
552
646
  });
553
647
  });
@@ -46,11 +46,19 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
46
46
  .#{$eccgui}-overviewitem__item {
47
47
  display: flex;
48
48
  flex-flow: row nowrap;
49
- align-content: stretch;
49
+ place-content: stretch flex-start;
50
50
  align-items: stretch;
51
- justify-content: flex-start;
52
51
  max-width: 100%;
53
- height: mini-units(6);
52
+ height: auto;
53
+
54
+ // TODO: we may revalidate later again
55
+ // @see http://localhost:6006/?path=/docs/components-application--docs as testcase
56
+ // there is a weird bug in Firefox v132+
57
+ // with a fixed height the calculation of `asprect-ratio` for child elements seems to be broken in some situations (especially in combination with top/bottom `padding`)
58
+ // however, it is working when we set min- and max-height (what leads basically to the same layout like a fixed height)
59
+ // height: mini-units(6);
60
+ min-height: mini-units(6);
61
+ max-height: mini-units(6);
54
62
 
55
63
  &[tabindex]:not([tabindex="-1"]) {
56
64
  cursor: pointer;
@@ -70,7 +78,10 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
70
78
 
71
79
  .#{$eccgui}-overviewitem__item--highdensity,
72
80
  .#{$eccgui}-overviewitem__list--highdensity > li > .#{$eccgui}-overviewitem__item {
73
- height: $button-height; // mini-units(4);
81
+ // same fix for Firefox v132+ like for the normal element height
82
+ // height: $button-height; // mini-units(4);
83
+ min-height: $button-height;
84
+ max-height: $button-height;
74
85
 
75
86
  & > .#{$eccgui}-overviewitem__depiction {
76
87
  width: $button-height; // mini-units(4);
@@ -107,9 +118,10 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
107
118
 
108
119
  & > * {
109
120
  display: block;
110
- width: auto;
121
+ max-width: 100%;
111
122
  max-height: 100%;
112
123
  margin: 0 auto;
124
+ object-fit: contain;
113
125
  }
114
126
 
115
127
  &:not(.#{$eccgui}-overviewitem__depiction--keepcolors) {
@@ -127,9 +139,8 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
127
139
  flex-direction: column;
128
140
  flex-grow: 1;
129
141
  flex-shrink: 1;
130
- align-content: stretch;
142
+ place-content: stretch flex-start;
131
143
  align-items: stretch;
132
- justify-content: flex-start;
133
144
  overflow: hidden;
134
145
 
135
146
  .#{$eccgui}-overviewitem__depiction + & {
@@ -13,7 +13,7 @@ import {
13
13
  } from "./../../../../index";
14
14
  import { FullExample as OtherDepictionExample } from "./../../Depiction/stories/Depiction.stories";
15
15
  import { Default as ActionsExample } from "./OverviewItemActions.stories";
16
- import { Default as DepictionExample } from "./OverviewItemDepiction.stories";
16
+ import { AutoTransform as DepictionExample } from "./OverviewItemDepiction.stories";
17
17
  import { Default as DescriptionExample } from "./OverviewItemDescription.stories";
18
18
 
19
19
  export default {
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
2
  import { Meta, StoryFn } from "@storybook/react";
3
3
 
4
- import { Depiction, Icon, OverviewItemDepiction } from "./../../../../index";
4
+ import png16to9 from "../../Depiction/stories/test-16to9.png";
5
+
6
+ import { Depiction, Icon, OverviewItem, OverviewItemDepiction } from "./../../../../index";
5
7
  import { FullExample as DepictionExample } from "./../../Depiction/stories/Depiction.stories";
6
8
 
7
9
  export default {
@@ -17,11 +19,24 @@ export default {
17
19
  } as Meta<typeof OverviewItemDepiction>;
18
20
 
19
21
  const Template: StoryFn<typeof OverviewItemDepiction> = (args) => (
20
- <OverviewItemDepiction {...args}></OverviewItemDepiction>
22
+ <OverviewItem>
23
+ <OverviewItemDepiction {...args}></OverviewItemDepiction>
24
+ </OverviewItem>
21
25
  );
22
26
 
23
- export const Default = Template.bind({});
24
- Default.args = {
27
+ /**
28
+ * If a `<Depiction/>` is used as only content then it is returned directly by `<OverviewItemDepiction/>`.
29
+ */
30
+ export const UseDepictionElement = Template.bind({});
31
+ UseDepictionElement.args = {
32
+ children: <Depiction {...DepictionExample.args} resizing="contain" />,
33
+ };
34
+
35
+ /**
36
+ * If an `<Icon/>` (or `<TestIcon/>`) is used as only content for `<OverviewItemDepiction/>` then it returns automatically a `<Depiction/>` element setting the `image` property to that icon.
37
+ */
38
+ export const AutoTransform = Template.bind({});
39
+ AutoTransform.args = {
25
40
  children: (
26
41
  <>
27
42
  <Icon name="artefact-dataset" />
@@ -29,7 +44,10 @@ Default.args = {
29
44
  ),
30
45
  };
31
46
 
32
- export const UseDepictionElement = Template.bind({});
33
- UseDepictionElement.args = {
34
- children: <Depiction {...DepictionExample.args} resizing="contain" />,
47
+ /**
48
+ * For all other content the `<OverviewItemDepiction/>` wrapper is set around it to keep it in the allowed size. This works mainly for image content.
49
+ */
50
+ export const Default = Template.bind({});
51
+ Default.args = {
52
+ children: <img src={png16to9} />,
35
53
  };
@@ -4,8 +4,7 @@
4
4
  // own vars
5
5
  $eccgui-size-textfield-height-small: $eccgui-size-block-whitespace * 2 !default;
6
6
  $eccgui-size-textfield-height-regular: $eccgui-size-textfield-height-small * $eccgui-size-type-levelratio !default;
7
- $eccgui-size-textfield-height-large: $eccgui-size-textfield-height-regular * $eccgui-size-type-levelratio *
8
- $eccgui-size-type-levelratio !default;
7
+ $eccgui-size-textfield-height-large: $eccgui-size-textfield-height-regular * $eccgui-size-type-levelratio * $eccgui-size-type-levelratio !default;
9
8
  $eccgui-size-textfield-padding-horizontal-regular: $eccgui-size-inline-whitespace !default;
10
9
  $eccgui-size-textfield-padding-horizontal-small: $eccgui-size-inline-whitespace * 0.5 !default;
11
10
  $eccgui-typo-textfield-fontweight: $eccgui-font-weight-regular !default;
@@ -20,7 +20,7 @@ export interface TooltipProps extends Omit<BlueprintTooltipProps, "position"> {
20
20
  */
21
21
  size?: "small" | "medium" | "large";
22
22
  /**
23
- * The tolltip will be attached to this element when it is hovered.
23
+ * The tooltip will be attached to this element when it is hovered.
24
24
  */
25
25
  children: React.ReactNode | React.ReactNode[];
26
26
  /**
@@ -7,17 +7,29 @@ import * as TypographyClassNames from "./classnames";
7
7
  // FIXME: CMEM-3742: comment + add story
8
8
 
9
9
  export interface HtmlContentBlockProps extends React.HTMLAttributes<HTMLDivElement> {
10
- className?: string;
10
+ /**
11
+ * Content block uses smaller font size.
12
+ */
11
13
  small?: boolean;
14
+ /**
15
+ * To prevent overflow, an otherwise unbreakable string of characters — like a long word or URL — may be broken at any point if there are no otherwise-acceptable break points in the line.
16
+ */
17
+ linebreakForced?: boolean;
18
+ /**
19
+ * No automatic line breaks are inserted.
20
+ */
21
+ linebreakPrevented?: boolean;
22
+ /**
23
+ * Sub elements like code blocks are displayed without own scrollbars.
24
+ * This option may infer with `linebreakForced` and `linebreakPrevented`.
25
+ */
26
+ noScrollbarsOnChildren?: boolean;
12
27
  /** currently not supported */
13
28
  large?: boolean;
14
29
  /** currently not supported */
15
30
  muted?: boolean;
16
31
  /** currently not supported */
17
32
  disabled?: boolean;
18
- linebreakForced?: boolean;
19
- linebreakPrevented?: boolean;
20
- noScrollbarsOnChildren?: boolean;
21
33
  }
22
34
 
23
35
  export const HtmlContentBlock = ({
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+ import LoremIpsum, { loremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { HtmlContentBlock } from "../../../index";
6
+
7
+ const whiteSpaceSizeOptions = {
8
+ control: "select",
9
+ options: {
10
+ "not set": undefined,
11
+ tiny: "tiny",
12
+ small: "small",
13
+ regular: "regular",
14
+ large: "large",
15
+ xlarge: "xlarge",
16
+ },
17
+ };
18
+
19
+ export default {
20
+ title: "Components/Typography/HtmlContentBlock",
21
+ component: HtmlContentBlock,
22
+ argTypes: {
23
+ children: { control: false },
24
+ },
25
+ } as Meta<typeof HtmlContentBlock>;
26
+
27
+ const Template: StoryFn<typeof HtmlContentBlock> = (args) => <HtmlContentBlock {...args} />;
28
+
29
+ const testContent = (
30
+ <>
31
+ <LoremIpsum p={2} avgSentencesPerParagraph={4} random={false} />
32
+ <p>
33
+ <strong>
34
+ {loremIpsum({
35
+ p: 2,
36
+ avgSentencesPerParagraph: 4,
37
+ random: false,
38
+ })
39
+ .toString()
40
+ .replaceAll(" ", "")}
41
+ </strong>
42
+ </p>
43
+ <LoremIpsum p={3} avgSentencesPerParagraph={5} random={false} />
44
+ </>
45
+ );
46
+
47
+ export const Default = Template.bind({});
48
+ Default.args = {
49
+ children: testContent,
50
+ };