@eccenca/gui-elements 24.0.0-rc.4 → 24.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/CHANGELOG.md +50 -28
- package/dist/cjs/cmem/markdown/Markdown.js +2 -2
- package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
- package/dist/cjs/components/Application/helper.js +25 -2
- package/dist/cjs/components/Application/helper.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +21 -11
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/extensions/markText.js +2 -2
- package/dist/cjs/components/AutoSuggestion/extensions/markText.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +3 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/Typography/HtmlContentBlock.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +18 -20
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js +4 -3
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -1
- package/dist/esm/cmem/markdown/Markdown.js +2 -2
- package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
- package/dist/esm/components/Application/helper.js +25 -2
- package/dist/esm/components/Application/helper.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +32 -22
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/extensions/markText.js +2 -2
- package/dist/esm/components/AutoSuggestion/extensions/markText.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +3 -1
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/Typography/HtmlContentBlock.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js +18 -20
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleTools.js +4 -3
- package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -1
- package/dist/types/cmem/markdown/Markdown.d.ts +8 -3
- package/dist/types/components/AutoSuggestion/AutoSuggestion.d.ts +4 -1
- package/dist/types/components/CodeAutocompleteField/CodeAutocompleteField.d.ts +2 -1
- package/dist/types/components/Icon/canonicalIconNames.d.ts +3 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/components/Typography/HtmlContentBlock.d.ts +16 -4
- package/package.json +5 -2
- package/src/cmem/markdown/Markdown.tsx +14 -4
- package/src/components/Application/helper.ts +30 -2
- package/src/components/Application/stories/Application.stories.tsx +11 -1
- package/src/components/AutoSuggestion/AutoSuggestion.tsx +44 -26
- package/src/components/AutoSuggestion/extensions/markText.ts +1 -2
- package/src/components/CodeAutocompleteField/CodeAutocompleteField.tsx +1 -1
- package/src/components/Depiction/stories/Depiction.stories.tsx +18 -1
- package/src/components/Icon/canonicalIconNames.tsx +3 -1
- package/src/components/OverviewItem/overviewitem.scss +18 -7
- package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +1 -1
- package/src/components/OverviewItem/stories/OverviewItemDepiction.stories.tsx +25 -7
- package/src/components/Pagination/pagination.scss +1 -0
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/Typography/HtmlContentBlock.tsx +16 -4
- package/src/components/Typography/stories/HtmlContentBlock.stories.tsx +50 -0
- package/src/components/Typography/stories/WhiteSpaceContainer.stories.tsx +15 -30
- package/src/extensions/react-flow/handles/HandleContent.tsx +1 -1
- package/src/extensions/react-flow/handles/HandleDefault.tsx +21 -33
- package/src/extensions/react-flow/handles/HandleTools.tsx +4 -3
- package/src/extensions/react-flow/handles/_handles.scss +2 -1
- package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +12 -9
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export interface HtmlContentBlockProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Content block uses smaller font size.
|
|
5
|
+
*/
|
|
4
6
|
small?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* 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.
|
|
9
|
+
*/
|
|
10
|
+
linebreakForced?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* No automatic line breaks are inserted.
|
|
13
|
+
*/
|
|
14
|
+
linebreakPrevented?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Sub elements like code blocks are displayed without own scrollbars.
|
|
17
|
+
* This option may infer with `linebreakForced` and `linebreakPrevented`.
|
|
18
|
+
*/
|
|
19
|
+
noScrollbarsOnChildren?: boolean;
|
|
5
20
|
/** currently not supported */
|
|
6
21
|
large?: boolean;
|
|
7
22
|
/** currently not supported */
|
|
8
23
|
muted?: boolean;
|
|
9
24
|
/** currently not supported */
|
|
10
25
|
disabled?: boolean;
|
|
11
|
-
linebreakForced?: boolean;
|
|
12
|
-
linebreakPrevented?: boolean;
|
|
13
|
-
noScrollbarsOnChildren?: boolean;
|
|
14
26
|
}
|
|
15
27
|
export declare const HtmlContentBlock: ({ className, children, small, large, muted, disabled, linebreakForced, linebreakPrevented, noScrollbarsOnChildren, ...otherProps }: HtmlContentBlockProps) => React.JSX.Element;
|
|
16
28
|
export default HtmlContentBlock;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eccenca/gui-elements",
|
|
3
3
|
"description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
|
|
4
|
-
"version": "24.0.0
|
|
4
|
+
"version": "24.0.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/eccenca/gui-elements",
|
|
7
7
|
"bugs": "https://github.com/eccenca/gui-elements/issues",
|
|
@@ -137,6 +137,7 @@
|
|
|
137
137
|
"jest-pnp-resolver": "^1.2.3",
|
|
138
138
|
"lint-staged": "^15.2.9",
|
|
139
139
|
"node-sass-package-importer": "^5.3.3",
|
|
140
|
+
"path": "^0.12.7",
|
|
140
141
|
"prettier": "^2.8.8",
|
|
141
142
|
"react-app-polyfill": "^3.0.0",
|
|
142
143
|
"react-lorem-ipsum": "^1.4.9",
|
|
@@ -161,7 +162,9 @@
|
|
|
161
162
|
},
|
|
162
163
|
"resolutions": {
|
|
163
164
|
"**/@types/react": "^17.0.80",
|
|
164
|
-
"node-sass-package-importer/**/postcss": "^8.4.41"
|
|
165
|
+
"node-sass-package-importer/**/postcss": "^8.4.41",
|
|
166
|
+
"**/cross-spawn": "^7.0.5 ",
|
|
167
|
+
"**/micromatch": "^4.0.8"
|
|
165
168
|
},
|
|
166
169
|
"husky": {
|
|
167
170
|
"hooks": {
|
|
@@ -9,7 +9,7 @@ import { remarkDefinitionList } from "remark-definition-list";
|
|
|
9
9
|
import remarkGfm from "remark-gfm";
|
|
10
10
|
|
|
11
11
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
12
|
-
import { HtmlContentBlock, TestableComponent } from "../../index";
|
|
12
|
+
import { HtmlContentBlock, HtmlContentBlockProps, TestableComponent } from "../../index";
|
|
13
13
|
|
|
14
14
|
export interface MarkdownProps extends TestableComponent {
|
|
15
15
|
children: string;
|
|
@@ -28,7 +28,8 @@ export interface MarkdownProps extends TestableComponent {
|
|
|
28
28
|
*/
|
|
29
29
|
allowedElements?: string[];
|
|
30
30
|
/**
|
|
31
|
-
* Do not wrap
|
|
31
|
+
* Do not wrap content in a `HtmlContentBlock` component.
|
|
32
|
+
* This option is ignored if `htmlContentBlockProps` or `data-test-id` is given.
|
|
32
33
|
*/
|
|
33
34
|
inheritBlock?: boolean;
|
|
34
35
|
/**
|
|
@@ -41,6 +42,10 @@ export interface MarkdownProps extends TestableComponent {
|
|
|
41
42
|
* Set to `false` to disable this feature.
|
|
42
43
|
*/
|
|
43
44
|
linkTargetName?: false | string;
|
|
45
|
+
/**
|
|
46
|
+
* Configure the `HtmlContentBlock` component that is automatically used as wrapper for the parsed Markdown content.
|
|
47
|
+
*/
|
|
48
|
+
htmlContentBlockProps?: Omit<HtmlContentBlockProps, "children" | "className" | "data-test-id">;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
const configDefault = {
|
|
@@ -102,6 +107,7 @@ export const Markdown = ({
|
|
|
102
107
|
allowedElements,
|
|
103
108
|
reHypePlugins,
|
|
104
109
|
linkTargetName = "_mdref",
|
|
110
|
+
htmlContentBlockProps,
|
|
105
111
|
...otherProps
|
|
106
112
|
}: MarkdownProps) => {
|
|
107
113
|
const configHtml = allowHtml
|
|
@@ -162,10 +168,14 @@ export const Markdown = ({
|
|
|
162
168
|
|
|
163
169
|
// @ts-ignore because against the lib spec it does not allow a function for linkTarget.
|
|
164
170
|
const markdownDisplay = <ReactMarkdown {...reactMarkdownProperties} />;
|
|
165
|
-
return inheritBlock ? (
|
|
171
|
+
return inheritBlock && !(otherProps["data-test-id"] || htmlContentBlockProps) ? (
|
|
166
172
|
markdownDisplay
|
|
167
173
|
) : (
|
|
168
|
-
<HtmlContentBlock
|
|
174
|
+
<HtmlContentBlock
|
|
175
|
+
{...htmlContentBlockProps}
|
|
176
|
+
className={`${eccgui}-markdown__container`}
|
|
177
|
+
data-test-id={otherProps["data-test-id"]}
|
|
178
|
+
>
|
|
169
179
|
{markdownDisplay}
|
|
170
180
|
</HtmlContentBlock>
|
|
171
181
|
);
|
|
@@ -28,20 +28,48 @@ export const useApplicationHeaderOverModals = (elevate: boolean, className: stri
|
|
|
28
28
|
export const useDropzoneMonitor = (enabledTypes: string[]) => {
|
|
29
29
|
React.useEffect(() => {
|
|
30
30
|
const monitor = window.document.body;
|
|
31
|
+
let timestampMonitorEnabled = 0;
|
|
32
|
+
let processDragleave: any;
|
|
31
33
|
|
|
32
34
|
const addMonitor = (event: DragEvent) => {
|
|
35
|
+
// stop default, so that also no files cannot executed by browser without demand
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
|
|
38
|
+
if (processDragleave) {
|
|
39
|
+
// stop removeMonitor process if it happend shortly before
|
|
40
|
+
clearTimeout(processDragleave);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// only process if monitor is not already enabled
|
|
44
|
+
if (timestampMonitorEnabled > 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// stop the event here to prevent double execution
|
|
49
|
+
event.stopImmediatePropagation();
|
|
50
|
+
|
|
51
|
+
// enable monitoring only for supported types of dragged elements
|
|
33
52
|
const types = event.dataTransfer?.types || [];
|
|
34
53
|
const monitorTypes = [...new Set(types.filter((type) => enabledTypes.includes(type)))];
|
|
35
54
|
if (monitorTypes.length > 0 && !monitor.dataset.monitorDropzone) {
|
|
36
55
|
monitor.dataset.monitorDropzone = monitorTypes.join(" ");
|
|
37
56
|
}
|
|
38
|
-
|
|
57
|
+
|
|
58
|
+
timestampMonitorEnabled = Date.now();
|
|
39
59
|
};
|
|
40
60
|
|
|
41
61
|
const removeMonitor = (event: DragEvent) => {
|
|
42
|
-
|
|
62
|
+
const removeAction = () => {
|
|
43
63
|
delete monitor.dataset.monitorDropzone;
|
|
44
64
|
event.preventDefault();
|
|
65
|
+
timestampMonitorEnabled = 0;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
if (event.type === "dragleave") {
|
|
69
|
+
// use timeout function for dragleave to prevent useless removeMonitor actions
|
|
70
|
+
processDragleave = setTimeout(removeAction, 250);
|
|
71
|
+
} else {
|
|
72
|
+
removeAction();
|
|
45
73
|
}
|
|
46
74
|
};
|
|
47
75
|
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
Button,
|
|
18
18
|
Depiction,
|
|
19
19
|
Icon,
|
|
20
|
+
OverviewItem,
|
|
20
21
|
WorkspaceHeader,
|
|
21
22
|
} from "../../../index";
|
|
22
23
|
|
|
@@ -76,7 +77,16 @@ const TemplateBasicExample: StoryFn<typeof ApplicationBasicExample> = (args) =>
|
|
|
76
77
|
<code>Menu</code> with <code>MenuItem</code>s.
|
|
77
78
|
</ApplicationSidebarNavigation>
|
|
78
79
|
|
|
79
|
-
<WorkspaceHeader id={"ApplicationBasicExample"}
|
|
80
|
+
<WorkspaceHeader id={"ApplicationBasicExample"}>
|
|
81
|
+
<OverviewItem>
|
|
82
|
+
<Depiction
|
|
83
|
+
image={<Icon name={"application-homepage"} />}
|
|
84
|
+
backgroundColor={"dark"}
|
|
85
|
+
padding="medium"
|
|
86
|
+
ratio="1:1"
|
|
87
|
+
/>
|
|
88
|
+
</OverviewItem>
|
|
89
|
+
</WorkspaceHeader>
|
|
80
90
|
|
|
81
91
|
<ApplicationToolbar>
|
|
82
92
|
<ApplicationToolbarSection>
|
|
@@ -161,6 +161,10 @@ export interface AutoSuggestionProps {
|
|
|
161
161
|
multiline?: boolean;
|
|
162
162
|
// The editor theme, e.g. "sparql"
|
|
163
163
|
mode?: SupportedCodeEditorModes;
|
|
164
|
+
|
|
165
|
+
/** If this is enabled the value of the editor is replaced with the initialValue if it changes.
|
|
166
|
+
* FIXME: This property is a workaround for some "controlled" usages of the component via the initialValue property. */
|
|
167
|
+
reInitOnInitialValueChange?: boolean;
|
|
164
168
|
}
|
|
165
169
|
|
|
166
170
|
// Meta data regarding a request
|
|
@@ -192,6 +196,7 @@ const AutoSuggestion = ({
|
|
|
192
196
|
validationRequestDelay = 200,
|
|
193
197
|
mode,
|
|
194
198
|
multiline = false,
|
|
199
|
+
reInitOnInitialValueChange = false,
|
|
195
200
|
}: AutoSuggestionProps) => {
|
|
196
201
|
const value = React.useRef<string>(initialValue);
|
|
197
202
|
const cursorPosition = React.useRef(0);
|
|
@@ -229,6 +234,14 @@ const AutoSuggestion = ({
|
|
|
229
234
|
|
|
230
235
|
const pathIsValid = validationResponse?.valid ?? true;
|
|
231
236
|
|
|
237
|
+
React.useEffect(() => {
|
|
238
|
+
if (reInitOnInitialValueChange && initialValue != null && cm) {
|
|
239
|
+
dispatch({
|
|
240
|
+
changes: { from: 0, to: cm?.state?.doc.length, insert: initialValue },
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}, [initialValue, cm, reInitOnInitialValueChange]);
|
|
244
|
+
|
|
232
245
|
const setCurrentIndex = (newIndex: number) => {
|
|
233
246
|
editorState.index = newIndex;
|
|
234
247
|
setFocusedIndex(newIndex);
|
|
@@ -240,15 +253,9 @@ const AutoSuggestion = ({
|
|
|
240
253
|
}, [cm, editorState]);
|
|
241
254
|
|
|
242
255
|
const dispatch = // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
if (initialValue != null && cm) {
|
|
247
|
-
dispatch({
|
|
248
|
-
changes: { from: 0, to: cm?.state?.doc.length, insert: initialValue },
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
}, [initialValue, cm]);
|
|
256
|
+
(
|
|
257
|
+
typeof editorState?.cm?.dispatch === "function" ? editorState?.cm?.dispatch : () => {}
|
|
258
|
+
) as EditorView["dispatch"];
|
|
252
259
|
|
|
253
260
|
React.useEffect(() => {
|
|
254
261
|
editorState.dropdownShown = shouldShowDropdown;
|
|
@@ -610,23 +617,34 @@ const AutoSuggestion = ({
|
|
|
610
617
|
);
|
|
611
618
|
|
|
612
619
|
const codeEditor = React.useMemo(() => {
|
|
613
|
-
return
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
620
|
+
return (
|
|
621
|
+
<ExtendedCodeEditor
|
|
622
|
+
mode={mode}
|
|
623
|
+
setCM={setCM}
|
|
624
|
+
onChange={handleChange}
|
|
625
|
+
onCursorChange={handleCursorChange}
|
|
626
|
+
initialValue={initialValue}
|
|
627
|
+
onFocusChange={handleInputFocus}
|
|
628
|
+
onKeyDown={handleInputEditorKeyPress}
|
|
629
|
+
enableTab={useTabForCompletions}
|
|
630
|
+
placeholder={placeholder}
|
|
631
|
+
onSelection={onSelection}
|
|
632
|
+
showScrollBar={showScrollBar}
|
|
633
|
+
multiline={multiline}
|
|
634
|
+
onMouseDown={handleInputMouseDown}
|
|
635
|
+
/>
|
|
636
|
+
);
|
|
637
|
+
}, [
|
|
638
|
+
mode,
|
|
639
|
+
setCM,
|
|
640
|
+
handleChange,
|
|
641
|
+
initialValue,
|
|
642
|
+
useTabForCompletions,
|
|
643
|
+
placeholder,
|
|
644
|
+
showScrollBar,
|
|
645
|
+
multiline,
|
|
646
|
+
handleInputMouseDown,
|
|
647
|
+
]);
|
|
630
648
|
|
|
631
649
|
const hasError = !!value.current && !pathIsValid && !pathValidationPending;
|
|
632
650
|
const autoSuggestionInput = (
|
|
@@ -35,7 +35,6 @@ type marksConfig = {
|
|
|
35
35
|
|
|
36
36
|
export const markText = (config: marksConfig) => {
|
|
37
37
|
const docLength = config.view.state.doc.length;
|
|
38
|
-
if (!docLength) return { from: 0, to: 0 };
|
|
39
38
|
const strikeMark = Decoration.mark({
|
|
40
39
|
class: config.className,
|
|
41
40
|
attributes: {
|
|
@@ -43,10 +42,10 @@ export const markText = (config: marksConfig) => {
|
|
|
43
42
|
},
|
|
44
43
|
});
|
|
45
44
|
const stopRange = Math.min(config.to, docLength);
|
|
45
|
+
if (!docLength || config.from === stopRange) return { from: 0, to: 0 };
|
|
46
46
|
config.view.dispatch({
|
|
47
47
|
effects: addMarks.of([strikeMark.range(config.from, stopRange)] as any),
|
|
48
48
|
});
|
|
49
|
-
|
|
50
49
|
return { from: config.from, to: stopRange };
|
|
51
50
|
};
|
|
52
51
|
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
4
|
import AutoSuggestion, { AutoSuggestionProps } from "../AutoSuggestion/AutoSuggestion";
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export interface CodeAutocompleteFieldProps extends AutoSuggestionProps {}
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Input component that allows partial, fine-grained auto-completion, i.e. of sub-strings of the input string.
|
|
@@ -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-
|
|
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,
|
|
@@ -123,6 +124,7 @@ const canonicalIcons = {
|
|
|
123
124
|
"operation-filteredit": icons.FilterEdit,
|
|
124
125
|
"operation-filterremove": icons.FilterRemove,
|
|
125
126
|
"operation-filter": icons.Filter,
|
|
127
|
+
"operation-format-codeblock": icons.CodeBlock,
|
|
126
128
|
"operation-fix": icons.Tools,
|
|
127
129
|
"operation-link": icons.Link,
|
|
128
130
|
"operation-logout": icons.Logout,
|
|
@@ -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
|
-
|
|
49
|
+
place-content: stretch flex-start;
|
|
50
50
|
align-items: stretch;
|
|
51
|
-
justify-content: flex-start;
|
|
52
51
|
max-width: 100%;
|
|
53
|
-
height:
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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 {
|
|
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
|
|
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
|
-
<
|
|
22
|
+
<OverviewItem>
|
|
23
|
+
<OverviewItemDepiction {...args}></OverviewItemDepiction>
|
|
24
|
+
</OverviewItem>
|
|
21
25
|
);
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
};
|
|
@@ -20,7 +20,7 @@ export interface TooltipProps extends Omit<BlueprintTooltipProps, "position"> {
|
|
|
20
20
|
*/
|
|
21
21
|
size?: "small" | "medium" | "large";
|
|
22
22
|
/**
|
|
23
|
-
* The
|
|
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
|
-
|
|
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
|
+
};
|