@eccenca/gui-elements 23.0.0-rc.3-unofficial.0 → 23.0.0-rc.4
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 +17 -1
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +2 -1
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/common/utils/colorDecideContrastvalue.js +18 -0
- package/dist/cjs/common/utils/colorDecideContrastvalue.js.map +1 -0
- package/dist/cjs/common/utils/getColorConfiguration.js +9 -5
- package/dist/cjs/common/utils/getColorConfiguration.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +18 -16
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js +15 -2
- package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js +3 -2
- package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js.map +1 -1
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +9 -7
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/cjs/components/Breadcrumb/BreadcrumbItem.js +13 -4
- package/dist/cjs/components/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/dist/cjs/components/Breadcrumb/BreadcrumbList.js +36 -9
- package/dist/cjs/components/Breadcrumb/BreadcrumbList.js.map +1 -1
- package/dist/cjs/components/Card/Card.js +1 -1
- package/dist/cjs/components/Card/CardContent.js.map +1 -1
- package/dist/cjs/components/ContextOverlay/ContextMenu.js +3 -3
- package/dist/cjs/components/ContextOverlay/ContextMenu.js.map +1 -1
- package/dist/cjs/components/Form/FieldItem.js +4 -1
- package/dist/cjs/components/Form/FieldItem.js.map +1 -1
- package/dist/cjs/components/Form/FieldItemRow.js +7 -6
- package/dist/cjs/components/Form/FieldItemRow.js.map +1 -1
- package/dist/cjs/components/Grid/Grid.js +1 -1
- package/dist/cjs/components/Grid/Grid.js.map +1 -1
- package/dist/cjs/components/Grid/GridColumn.js +1 -1
- package/dist/cjs/components/Grid/GridColumn.js.map +1 -1
- package/dist/cjs/components/Grid/GridRow.js.map +1 -1
- package/dist/cjs/components/HoverToggler/HoverToggler.js +33 -0
- package/dist/cjs/components/HoverToggler/HoverToggler.js.map +1 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js +35 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/InteractionGate/InteractionGate.js +66 -0
- package/dist/cjs/components/InteractionGate/InteractionGate.js.map +1 -0
- package/dist/cjs/components/Pagination/Pagination.js.map +1 -1
- package/dist/cjs/components/Spinner/Spinner.js +6 -6
- package/dist/cjs/components/Spinner/Spinner.js.map +1 -1
- package/dist/cjs/components/Switch/Switch.js +4 -2
- package/dist/cjs/components/Switch/Switch.js.map +1 -1
- package/dist/cjs/components/Tabs/Tab.js +2 -1
- package/dist/cjs/components/Tabs/Tab.js.map +1 -1
- package/dist/cjs/components/Tag/Tag.js +2 -1
- package/dist/cjs/components/Tag/Tag.js.map +1 -1
- package/dist/cjs/components/Tag/TagList.js +1 -1
- package/dist/cjs/components/Tag/TagList.js.map +1 -1
- package/dist/cjs/components/TextField/TextField.js +3 -0
- package/dist/cjs/components/TextField/TextField.js.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +9 -2
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/Tree/Tree.js +37 -0
- package/dist/cjs/components/Tree/Tree.js.map +1 -0
- package/dist/cjs/index.js +12 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +2 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/common/utils/colorDecideContrastvalue.js +14 -0
- package/dist/esm/common/utils/colorDecideContrastvalue.js.map +1 -0
- package/dist/esm/common/utils/getColorConfiguration.js +9 -5
- package/dist/esm/common/utils/getColorConfiguration.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +35 -33
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js +25 -2
- package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js +3 -2
- package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js.map +1 -1
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js +15 -13
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/esm/components/Breadcrumb/BreadcrumbItem.js +13 -4
- package/dist/esm/components/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/dist/esm/components/Breadcrumb/BreadcrumbList.js +17 -9
- package/dist/esm/components/Breadcrumb/BreadcrumbList.js.map +1 -1
- package/dist/esm/components/Card/Card.js +1 -1
- package/dist/esm/components/Card/CardContent.js.map +1 -1
- package/dist/esm/components/ContextOverlay/ContextMenu.js +3 -3
- package/dist/esm/components/ContextOverlay/ContextMenu.js.map +1 -1
- package/dist/esm/components/Form/FieldItem.js +4 -1
- package/dist/esm/components/Form/FieldItem.js.map +1 -1
- package/dist/esm/components/Form/FieldItemRow.js +7 -6
- package/dist/esm/components/Form/FieldItemRow.js.map +1 -1
- package/dist/esm/components/Grid/Grid.js +1 -1
- package/dist/esm/components/Grid/Grid.js.map +1 -1
- package/dist/esm/components/Grid/GridColumn.js +1 -1
- package/dist/esm/components/Grid/GridColumn.js.map +1 -1
- package/dist/esm/components/Grid/GridRow.js.map +1 -1
- package/dist/esm/components/HoverToggler/HoverToggler.js +37 -0
- package/dist/esm/components/HoverToggler/HoverToggler.js.map +1 -0
- package/dist/esm/components/Icon/canonicalIconNames.js +35 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/InteractionGate/InteractionGate.js +53 -0
- package/dist/esm/components/InteractionGate/InteractionGate.js.map +1 -0
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/Spinner/Spinner.js +7 -7
- package/dist/esm/components/Spinner/Spinner.js.map +1 -1
- package/dist/esm/components/Switch/Switch.js +4 -2
- package/dist/esm/components/Switch/Switch.js.map +1 -1
- package/dist/esm/components/Tabs/Tab.js +2 -1
- package/dist/esm/components/Tabs/Tab.js.map +1 -1
- package/dist/esm/components/Tag/Tag.js +2 -1
- package/dist/esm/components/Tag/Tag.js.map +1 -1
- package/dist/esm/components/Tag/TagList.js +1 -1
- package/dist/esm/components/Tag/TagList.js.map +1 -1
- package/dist/esm/components/TextField/TextField.js +3 -0
- package/dist/esm/components/TextField/TextField.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +9 -2
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/Tree/Tree.js +40 -0
- package/dist/esm/components/Tree/Tree.js.map +1 -0
- package/dist/esm/index.js +9 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/types/cmem/markdown/Markdown.d.ts +1 -2
- package/dist/types/common/utils/colorDecideContrastvalue.d.ts +9 -0
- package/dist/types/components/AutoSuggestion/AutoSuggestion.d.ts +7 -1
- package/dist/types/components/AutoSuggestion/AutoSuggestionList.d.ts +3 -3
- package/dist/types/components/AutoSuggestion/SingleLineCodeEditor.d.ts +1 -1
- package/dist/types/components/Breadcrumb/BreadcrumbItem.d.ts +7 -3
- package/dist/types/components/Breadcrumb/BreadcrumbList.d.ts +20 -8
- package/dist/types/components/Card/CardContent.d.ts +2 -2
- package/dist/types/components/ContextOverlay/ContextMenu.d.ts +3 -1
- package/dist/types/components/Form/FieldItem.d.ts +6 -3
- package/dist/types/components/Form/FieldItemRow.d.ts +11 -3
- package/dist/types/components/Grid/Grid.d.ts +6 -1
- package/dist/types/components/Grid/GridColumn.d.ts +8 -1
- package/dist/types/components/Grid/GridRow.d.ts +7 -1
- package/dist/types/components/HoverToggler/HoverToggler.d.ts +24 -0
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- package/dist/types/components/InteractionGate/InteractionGate.d.ts +23 -0
- package/dist/types/components/Notification/Notification.d.ts +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +21 -4
- package/dist/types/components/Spinner/Spinner.d.ts +7 -1
- package/dist/types/components/Switch/Switch.d.ts +5 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +12 -1
- package/dist/types/components/Tree/Tree.d.ts +43 -0
- package/dist/types/index.d.ts +5 -2
- package/package.json +12 -11
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +2 -1
- package/src/cmem/markdown/Markdown.tsx +1 -1
- package/src/common/utils/colorDecideContrastvalue.ts +28 -0
- package/src/common/utils/getColorConfiguration.ts +10 -5
- package/src/components/AutoSuggestion/AutoSuggestion.scss +16 -10
- package/src/components/AutoSuggestion/AutoSuggestion.tsx +81 -52
- package/src/components/AutoSuggestion/AutoSuggestionList.tsx +5 -2
- package/src/components/AutoSuggestion/SingleLineCodeEditor.tsx +8 -3
- package/src/components/AutoSuggestion/tests/AutoSuggestionList.test.tsx +1 -1
- package/src/components/AutoSuggestion/tests/SingleLineCodeEditor.test.tsx +2 -1
- package/src/components/AutocompleteField/AutoCompleteField.tsx +5 -2
- package/src/components/AutocompleteField/stories/AutoCompleteField.stories.tsx +15 -4
- package/src/components/Breadcrumb/BreadcrumbItem.tsx +15 -6
- package/src/components/Breadcrumb/BreadcrumbList.tsx +41 -17
- package/src/components/Breadcrumb/breadcrumb.scss +28 -1
- package/src/components/Breadcrumb/stories/BreadcrumbItem.stories.tsx +19 -0
- package/src/components/Breadcrumb/stories/BreadcrumbList.stories.tsx +27 -0
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Card/CardContent.tsx +2 -2
- package/src/components/ContextOverlay/ContextMenu.tsx +4 -0
- package/src/components/Form/FieldItem.tsx +6 -3
- package/src/components/Form/FieldItemRow.tsx +28 -6
- package/src/components/Form/form.scss +6 -0
- package/src/components/Grid/Grid.tsx +9 -3
- package/src/components/Grid/GridColumn.tsx +10 -2
- package/src/components/Grid/GridRow.tsx +8 -1
- package/src/components/HoverToggler/HoverToggler.stories.tsx +20 -0
- package/src/components/HoverToggler/HoverToggler.tsx +58 -0
- package/src/components/HoverToggler/hovertoggler.scss +45 -0
- package/src/components/Icon/canonicalIconNames.tsx +46 -0
- package/src/components/InteractionGate/InteractionGate.stories.tsx +32 -0
- package/src/components/InteractionGate/InteractionGate.tsx +65 -0
- package/src/components/InteractionGate/interactiongate.scss +11 -0
- package/src/components/Link/link.scss +9 -0
- package/src/components/Notification/Notification.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +22 -6
- package/src/components/SimpleTable/simpletable.scss +62 -2
- package/src/components/Spinner/Spinner.tsx +13 -5
- package/src/components/Spinner/spinner.scss +14 -0
- package/src/components/Switch/Switch.tsx +10 -5
- package/src/components/Tabs/Tab.tsx +2 -1
- package/src/components/Tag/Tag.tsx +2 -1
- package/src/components/Tag/TagList.tsx +1 -1
- package/src/components/Tag/tag.scss +1 -0
- package/src/components/TextField/TextField.tsx +4 -0
- package/src/components/TextField/stories/TextField.stories.tsx +1 -0
- package/src/components/TextField/textfield.scss +25 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +15 -7
- package/src/components/Tooltip/Tooltip.tsx +24 -1
- package/src/components/Tree/Tree.stories.tsx +63 -0
- package/src/components/Tree/Tree.tsx +61 -0
- package/src/components/Tree/tree.scss +28 -0
- package/src/includes/carbon-components/_variables.scss +3 -1
- package/src/index.scss +5 -2
- package/src/index.ts +14 -5
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { HoverToggler } from "./../../index";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/HoverToggler",
|
|
7
|
+
component: HoverToggler,
|
|
8
|
+
argTypes: {
|
|
9
|
+
},
|
|
10
|
+
} as ComponentMeta<typeof HoverToggler>;
|
|
11
|
+
|
|
12
|
+
const Template: ComponentStory<typeof HoverToggler> = (args) => (
|
|
13
|
+
<HoverToggler {...args} style={{height: "auto"}} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const Default = Template.bind({});
|
|
17
|
+
Default.args = {
|
|
18
|
+
baseContent: "Base content.",
|
|
19
|
+
hoverContent: <>Content<br/>on <a href="#">hover</a>.</>
|
|
20
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
3
|
+
|
|
4
|
+
interface HoverTogglerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
5
|
+
/**
|
|
6
|
+
* Additional CSS class name.
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The content that is shown when not hovered.
|
|
11
|
+
*/
|
|
12
|
+
baseContent: JSX.Element;
|
|
13
|
+
baseContentProps?: Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
|
|
14
|
+
/**
|
|
15
|
+
* The content that is shown when hovered.
|
|
16
|
+
*/
|
|
17
|
+
hoverContent: JSX.Element;
|
|
18
|
+
hoverContentProps?: Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
|
|
19
|
+
/**
|
|
20
|
+
* Display as inline element.
|
|
21
|
+
*/
|
|
22
|
+
inline?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Displays a specific element. Displays another element when hovered. */
|
|
26
|
+
export const HoverToggler = ({
|
|
27
|
+
className = "",
|
|
28
|
+
baseContent,
|
|
29
|
+
baseContentProps,
|
|
30
|
+
hoverContent,
|
|
31
|
+
hoverContentProps,
|
|
32
|
+
inline = false,
|
|
33
|
+
style,
|
|
34
|
+
...otherProps
|
|
35
|
+
}: HoverTogglerProps) => {
|
|
36
|
+
return (<div
|
|
37
|
+
className={
|
|
38
|
+
`${eccgui}-hovertoggler__wrapper` +
|
|
39
|
+
(inline ? ` ${eccgui}-hovertoggler--inline` : "")
|
|
40
|
+
}
|
|
41
|
+
style={style}
|
|
42
|
+
>
|
|
43
|
+
<div
|
|
44
|
+
className={
|
|
45
|
+
`${eccgui}-hovertoggler` +
|
|
46
|
+
(className ? ` ${className}` : "")
|
|
47
|
+
}
|
|
48
|
+
{...otherProps}
|
|
49
|
+
>
|
|
50
|
+
<div className={`${eccgui}-hovertoggler__basecontent`}>
|
|
51
|
+
<div className={`${eccgui}-hovertoggler__wrappercontent`} {...baseContentProps}>{ baseContent }</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div className={`${eccgui}-hovertoggler__hovercontent`}>
|
|
54
|
+
<div tabIndex={0} className={`${eccgui}-hovertoggler__wrappercontent`} {...hoverContentProps}>{ hoverContent }</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>);
|
|
58
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.#{$eccgui}-hovertoggler__wrapper {
|
|
2
|
+
width: 100%;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: flex-start;
|
|
6
|
+
align-items: center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.#{$eccgui}-hovertoggler--inline {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
width: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.#{$eccgui}-hovertoggler {
|
|
15
|
+
display: flex;
|
|
16
|
+
width: 200%;
|
|
17
|
+
justify-content: flex-start;
|
|
18
|
+
align-items: stretch;
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
|
|
21
|
+
.#{$eccgui}-hovertoggler--inline > & {
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.#{$eccgui}-hovertoggler__basecontent,
|
|
27
|
+
.#{$eccgui}-hovertoggler__hovercontent {
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
order: 1;
|
|
30
|
+
flex-grow: 0;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
width: 50%;
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.#{$eccgui}-hovertoggler__hovercontent {
|
|
39
|
+
order: 2;
|
|
40
|
+
|
|
41
|
+
.#{$eccgui}-hovertoggler:hover > &,
|
|
42
|
+
&:focus-within {
|
|
43
|
+
order: 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -57,8 +57,10 @@ export type ValidIconName =
|
|
|
57
57
|
| "item-start"
|
|
58
58
|
| "item-stop"
|
|
59
59
|
| "item-reload"
|
|
60
|
+
| "item-reset"
|
|
60
61
|
| "item-shuffle"
|
|
61
62
|
| "item-draggable"
|
|
63
|
+
| "item-settings"
|
|
62
64
|
| "operation-search"
|
|
63
65
|
| "operation-clear"
|
|
64
66
|
| "operation-undo"
|
|
@@ -84,6 +86,8 @@ export type ValidIconName =
|
|
|
84
86
|
| "state-checked"
|
|
85
87
|
| "state-checkedsimple"
|
|
86
88
|
| "state-partlychecked"
|
|
89
|
+
| "state-declined"
|
|
90
|
+
| "state-confirmed"
|
|
87
91
|
| "artefact-project"
|
|
88
92
|
| "artefact-workflow"
|
|
89
93
|
| "artefact-dataset"
|
|
@@ -116,6 +120,9 @@ export type ValidIconName =
|
|
|
116
120
|
| "operation-auto-graph-layout"
|
|
117
121
|
| "unlinked-item"
|
|
118
122
|
| "write-protected"
|
|
123
|
+
| "settings"
|
|
124
|
+
| "favorite-empty"
|
|
125
|
+
| "favorite-filled"
|
|
119
126
|
| "undefined"
|
|
120
127
|
| "Undefined";
|
|
121
128
|
|
|
@@ -397,6 +404,11 @@ const canonicalIconNames: Record<ValidIconName, IconSized> = {
|
|
|
397
404
|
normal: icons.Renew20,
|
|
398
405
|
large: icons.Renew32,
|
|
399
406
|
},
|
|
407
|
+
"item-reset": {
|
|
408
|
+
small: icons.Reset16,
|
|
409
|
+
normal: icons.Reset20,
|
|
410
|
+
large: icons.Reset32,
|
|
411
|
+
},
|
|
400
412
|
"item-comment": {
|
|
401
413
|
small: icons.AddComment16,
|
|
402
414
|
normal: icons.AddComment20,
|
|
@@ -412,6 +424,11 @@ const canonicalIconNames: Record<ValidIconName, IconSized> = {
|
|
|
412
424
|
normal: icons.Draggable20,
|
|
413
425
|
large: icons.Draggable32,
|
|
414
426
|
},
|
|
427
|
+
"item-settings": {
|
|
428
|
+
small: icons.Settings16,
|
|
429
|
+
normal: icons.Settings20,
|
|
430
|
+
large: icons.Settings32,
|
|
431
|
+
},
|
|
415
432
|
|
|
416
433
|
"operation-search": {
|
|
417
434
|
small: icons.Search16,
|
|
@@ -541,6 +558,17 @@ const canonicalIconNames: Record<ValidIconName, IconSized> = {
|
|
|
541
558
|
normal: icons.CheckboxIndeterminate20,
|
|
542
559
|
large: icons.CheckboxIndeterminate32,
|
|
543
560
|
},
|
|
561
|
+
"state-declined": {
|
|
562
|
+
small: icons.ThumbsDown16,
|
|
563
|
+
normal: icons.ThumbsDown20,
|
|
564
|
+
large: icons.ThumbsDown32
|
|
565
|
+
},
|
|
566
|
+
"state-confirmed": {
|
|
567
|
+
small: icons.ThumbsUp16,
|
|
568
|
+
normal: icons.ThumbsUp20,
|
|
569
|
+
large: icons.ThumbsUp32
|
|
570
|
+
},
|
|
571
|
+
|
|
544
572
|
|
|
545
573
|
"artefact-project": {
|
|
546
574
|
small: icons.Folder16,
|
|
@@ -708,6 +736,24 @@ const canonicalIconNames: Record<ValidIconName, IconSized> = {
|
|
|
708
736
|
large: icons.DocumentProtected32,
|
|
709
737
|
},
|
|
710
738
|
|
|
739
|
+
"settings": {
|
|
740
|
+
small: icons.Settings16,
|
|
741
|
+
normal: icons.Settings20,
|
|
742
|
+
large: icons.Settings32
|
|
743
|
+
},
|
|
744
|
+
|
|
745
|
+
"favorite-empty": {
|
|
746
|
+
small: icons.Star16,
|
|
747
|
+
normal: icons.Star20,
|
|
748
|
+
large: icons.Star32
|
|
749
|
+
},
|
|
750
|
+
|
|
751
|
+
"favorite-filled": {
|
|
752
|
+
small: icons.StarFilled16,
|
|
753
|
+
normal: icons.StarFilled20,
|
|
754
|
+
large: icons.StarFilled32
|
|
755
|
+
},
|
|
756
|
+
|
|
711
757
|
undefined: {
|
|
712
758
|
small: icons.Undefined16,
|
|
713
759
|
normal: icons.Undefined20,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { LoremIpsum } from 'react-lorem-ipsum';
|
|
4
|
+
|
|
5
|
+
import { InteractionGate, Spinner, Link, Button, HtmlContentBlock } from "./../../index";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Components/InteractionGate",
|
|
9
|
+
component: InteractionGate,
|
|
10
|
+
subcomponents: { Spinner },
|
|
11
|
+
argTypes: {
|
|
12
|
+
children: {
|
|
13
|
+
control: "none",
|
|
14
|
+
description: "Any sub lements, could contain elements that provide options for user interactions."
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
} as ComponentMeta<typeof InteractionGate>;
|
|
18
|
+
|
|
19
|
+
const Template: ComponentStory<typeof InteractionGate> = (args) => (
|
|
20
|
+
<InteractionGate {...args}></InteractionGate>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const Default = Template.bind({});
|
|
24
|
+
Default.args = {
|
|
25
|
+
children: (
|
|
26
|
+
<HtmlContentBlock>
|
|
27
|
+
<LoremIpsum p={1} avgSentencesPerParagraph={4} random={false} />
|
|
28
|
+
<p><Link href="https://example.net">Link</Link></p>
|
|
29
|
+
<p><Button onClick={() => alert("click")}>Button</Button></p>
|
|
30
|
+
</HtmlContentBlock>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from "react";
|
|
2
|
+
// FIXME: re-evaluate if polyfill is necessary
|
|
3
|
+
// we currently need a polyfill for inert because Firefox do not support it natively atm
|
|
4
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert#browser_compatibility
|
|
5
|
+
import "wicg-inert";
|
|
6
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
7
|
+
import Spinner, { SpinnerProps } from "./../Spinner/Spinner";
|
|
8
|
+
|
|
9
|
+
export interface InteractionGateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "inert"> {
|
|
10
|
+
/**
|
|
11
|
+
* Prevent interaction with sub elements and narrow them in their visibility.
|
|
12
|
+
*/
|
|
13
|
+
inert?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Displays a spinner centered over the sub element.
|
|
16
|
+
*/
|
|
17
|
+
showSpinner?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Configure the included `<Spinner />` element.
|
|
20
|
+
*/
|
|
21
|
+
spinnerProps?: SpinnerProps;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Wrap content that need to be blocked from user interactions
|
|
26
|
+
* It also has options to display a spinner as overlay.
|
|
27
|
+
*/
|
|
28
|
+
function InteractionGate({
|
|
29
|
+
children,
|
|
30
|
+
className,
|
|
31
|
+
inert = false,
|
|
32
|
+
showSpinner = false,
|
|
33
|
+
spinnerProps = {},
|
|
34
|
+
...otherProps
|
|
35
|
+
}: InteractionGateProps) {
|
|
36
|
+
const domRef = useRef<HTMLDivElement>(null);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
// we currently cannot add inert property directly to the div because react types module seem not to know it
|
|
40
|
+
if (inert) {
|
|
41
|
+
domRef.current!.setAttribute('inert', '');
|
|
42
|
+
} else {
|
|
43
|
+
domRef.current!.removeAttribute('inert');
|
|
44
|
+
}
|
|
45
|
+
}, [inert]);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className={`${eccgui}-interactiongate__wrapper`}>
|
|
49
|
+
<div
|
|
50
|
+
ref={domRef}
|
|
51
|
+
className={
|
|
52
|
+
`${eccgui}-interactiongate` +
|
|
53
|
+
(inert ? ` ${eccgui}-interactiongate--inert` : "") +
|
|
54
|
+
(className ? ` ${className}` : "")
|
|
55
|
+
}
|
|
56
|
+
{...otherProps}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
</div>
|
|
60
|
+
{showSpinner && <Spinner showLocalBackdrop={true} {...spinnerProps} className={`${eccgui}-interactiongate__spinner`} />}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default InteractionGate;
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import {Pagination as CarbonPagination} from "carbon-components-react";
|
|
2
|
+
import {Pagination as CarbonPagination, PaginationProps as CarbonPaginationProps} from "carbon-components-react";
|
|
3
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
4
|
|
|
5
|
+
interface PaginationProps extends CarbonPaginationProps {
|
|
6
|
+
/**
|
|
7
|
+
Hide the select option to set how many items per page are displayed.
|
|
8
|
+
*/
|
|
9
|
+
hidePageSizeConfiguration?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
Hide info about the item numbers that are currently displayed.
|
|
12
|
+
*/
|
|
13
|
+
hideInfoText?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
Hide select box to switch between pages.
|
|
16
|
+
*/
|
|
17
|
+
hidePageSelect?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
Hide buttons to switch beteen nex/prev pages.
|
|
20
|
+
*/
|
|
21
|
+
hideNavigationArrows?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
5
24
|
function Pagination({
|
|
6
25
|
className,
|
|
7
26
|
hidePageSizeConfiguration = false,
|
|
@@ -9,7 +28,7 @@ function Pagination({
|
|
|
9
28
|
hidePageSelect = false,
|
|
10
29
|
hideNavigationArrows = false,
|
|
11
30
|
...otherProps
|
|
12
|
-
}:
|
|
31
|
+
}: PaginationProps) {
|
|
13
32
|
return (
|
|
14
33
|
<CarbonPagination
|
|
15
34
|
{...otherProps}
|
|
@@ -38,10 +57,7 @@ interface IPaginationOptions {
|
|
|
38
57
|
// The option of page sizes
|
|
39
58
|
pageSizes?: number[];
|
|
40
59
|
// Presentation options
|
|
41
|
-
presentation?:
|
|
42
|
-
// For narrow space requirements, the info text in the middle can be hidden
|
|
43
|
-
hideInfoText?: boolean;
|
|
44
|
-
};
|
|
60
|
+
presentation?: Omit<PaginationProps, "onChange" | "totalItems" | "pageSizes" | "page" | "pageSize">;
|
|
45
61
|
}
|
|
46
62
|
|
|
47
63
|
// Custom hook to add pagination. Currently only use-cases are supported where paging has no further side effects, e.g. REST calls.
|
|
@@ -7,9 +7,14 @@ $eccgui-size-tablecell-height-tall: mini-units(6) !default;
|
|
|
7
7
|
$eccgui-size-tablecell-padding-tall: ($eccgui-size-tablecell-height-tall - carbon--rem($eccgui-size-typo-text)) * 0.5 !default;
|
|
8
8
|
$eccgui-size-tablecell-font-weight: $eccgui-font-weight-regular !default;
|
|
9
9
|
$eccgui-size-tableheader-font-weight: $eccgui-font-weight-bold !default;
|
|
10
|
+
$eccgui-color-tableheader-background: lighten($menu-item-color-hover, 15%) !default; // rgba($ui-03, alpha($ui-03) * $eccgui-opacity-muted);
|
|
11
|
+
$eccgui-color-tablerow-background-even: $card-background-color !default;
|
|
12
|
+
$eccgui-color-tablerow-background-odd: lighten($menu-item-color-hover, 24%) !default;
|
|
13
|
+
$eccgui-color-tablerow-hover: $menu-item-color-hover !default;
|
|
14
|
+
$eccgui-color-tablerow-selected: rgba($eccgui-color-accent, 0.1) !default;
|
|
15
|
+
$eccgui-color-tablerow-selected-hover: mix($eccgui-color-tablerow-selected, $eccgui-color-tablerow-hover, 50%) !default;
|
|
10
16
|
|
|
11
17
|
// lib vars
|
|
12
|
-
/* already defined */
|
|
13
18
|
// import libs
|
|
14
19
|
// currently not needed @import '~carbon-components/scss/components/data-table/data-table-action';
|
|
15
20
|
@import "~carbon-components/scss/components/data-table/data-table-core";
|
|
@@ -23,6 +28,10 @@ $eccgui-size-tableheader-font-weight: $eccgui-font-weight-bold !default;
|
|
|
23
28
|
min-width: unset;
|
|
24
29
|
}
|
|
25
30
|
|
|
31
|
+
.#{$prefix}--data-table-header {
|
|
32
|
+
background-color: $eccgui-color-tablerow-background-even;
|
|
33
|
+
}
|
|
34
|
+
|
|
26
35
|
.#{$prefix}--data-table {
|
|
27
36
|
min-width: 100%;
|
|
28
37
|
}
|
|
@@ -33,9 +42,12 @@ $eccgui-size-tableheader-font-weight: $eccgui-font-weight-bold !default;
|
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
.#{$prefix}--data-table th {
|
|
36
|
-
background-color:
|
|
45
|
+
background-color: $eccgui-color-tableheader-background;
|
|
37
46
|
font-weight: $eccgui-size-tableheader-font-weight;
|
|
38
47
|
}
|
|
48
|
+
.#{$prefix}--data-table th.#{$prefix}--table-column-checkbox {
|
|
49
|
+
background: $eccgui-color-tableheader-background;
|
|
50
|
+
}
|
|
39
51
|
|
|
40
52
|
.#{$prefix}--data-table thead tr,
|
|
41
53
|
.#{$prefix}--data-table tbody tr,
|
|
@@ -72,6 +84,50 @@ $eccgui-size-tableheader-font-weight: $eccgui-font-weight-bold !default;
|
|
|
72
84
|
}
|
|
73
85
|
}
|
|
74
86
|
|
|
87
|
+
.#{$prefix}--data-table td,
|
|
88
|
+
.#{$prefix}--data-table tbody th {
|
|
89
|
+
border-top: 1px solid $eccgui-color-tablerow-background-even;
|
|
90
|
+
background-color: $eccgui-color-tablerow-background-even;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.#{$prefix}--data-table tbody {
|
|
94
|
+
background-color: $eccgui-color-tablerow-background-even;
|
|
95
|
+
|
|
96
|
+
tr {
|
|
97
|
+
&:hover {
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
|
|
100
|
+
th, td {
|
|
101
|
+
border-top: 1px solid $eccgui-color-tablerow-hover;
|
|
102
|
+
border-bottom: 1px solid $eccgui-color-tablerow-hover;
|
|
103
|
+
background-color: $eccgui-color-tablerow-hover;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.#{$prefix}--data-table--selected {
|
|
108
|
+
th {
|
|
109
|
+
border-top: 1px solid mix($eccgui-color-tablerow-selected, $eccgui-color-tableheader-background, 50%);
|
|
110
|
+
background-color: mix($eccgui-color-tablerow-selected, $eccgui-color-tableheader-background, 50%);
|
|
111
|
+
}
|
|
112
|
+
td {
|
|
113
|
+
border-top: 1px solid $eccgui-color-tablerow-selected;
|
|
114
|
+
background-color: $eccgui-color-tablerow-selected;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&:hover {
|
|
118
|
+
th {
|
|
119
|
+
border-top: 1px solid mix($eccgui-color-tablerow-selected-hover, $eccgui-color-tableheader-background, 50%);
|
|
120
|
+
background-color: mix($eccgui-color-tablerow-selected-hover, $eccgui-color-tableheader-background, 50%);
|
|
121
|
+
}
|
|
122
|
+
td {
|
|
123
|
+
border-top: 1px solid $eccgui-color-tablerow-selected-hover;
|
|
124
|
+
background-color: $eccgui-color-tablerow-selected-hover;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
75
131
|
// Compact
|
|
76
132
|
|
|
77
133
|
.#{$prefix}--data-table--compact thead tr,
|
|
@@ -110,6 +166,10 @@ $eccgui-size-tableheader-font-weight: $eccgui-font-weight-bold !default;
|
|
|
110
166
|
|
|
111
167
|
// Sticky header
|
|
112
168
|
|
|
169
|
+
.#{$prefix}--data-table_inner-container {
|
|
170
|
+
background-color: $eccgui-color-tableheader-background;
|
|
171
|
+
}
|
|
172
|
+
|
|
113
173
|
.#{$prefix}--data-table--sticky-header {
|
|
114
174
|
thead tr th {
|
|
115
175
|
// border-bottom-color: $active-ui;
|
|
@@ -23,6 +23,12 @@ export interface SpinnerProps extends Partial<BlueprintOverlayProps & Omit<Bluep
|
|
|
23
23
|
stroke?: SpinnerStroke
|
|
24
24
|
// Delay when to show the spinner in ms, default: 0
|
|
25
25
|
delay?: number
|
|
26
|
+
/**
|
|
27
|
+
* Includes a backdrop behind the spinner that narrows visibility of the area behind the spinner.
|
|
28
|
+
* This option only works with "local" spinners, for "inline" spinners there is no backdrop, "global" spinners always have backdrops.
|
|
29
|
+
* The backdrop and the spinner are located over the nearest parent element that is styled by `position: relative` or soe equivalent CSS rule.
|
|
30
|
+
*/
|
|
31
|
+
showLocalBackdrop?: boolean
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
function Spinner({
|
|
@@ -32,6 +38,7 @@ function Spinner({
|
|
|
32
38
|
position = "local",
|
|
33
39
|
size,
|
|
34
40
|
stroke,
|
|
41
|
+
showLocalBackdrop = false,
|
|
35
42
|
delay = 0,
|
|
36
43
|
...otherProps
|
|
37
44
|
}: SpinnerProps) {
|
|
@@ -80,11 +87,12 @@ function Spinner({
|
|
|
80
87
|
tagName={spinnerElement}
|
|
81
88
|
className={
|
|
82
89
|
`${eccgui}-spinner` +
|
|
83
|
-
|
|
84
|
-
` ${eccgui}-spinner--intent
|
|
85
|
-
|
|
86
|
-
` ${eccgui}-spinner--
|
|
87
|
-
|
|
90
|
+
` ${eccgui}-spinner--position-${position}` +
|
|
91
|
+
` ${eccgui}-spinner--intent-${spinnerIntent}` +
|
|
92
|
+
` ${eccgui}-spinner--size-${spinnerSize}` +
|
|
93
|
+
(showLocalBackdrop ? ` ${eccgui}-spinner--localbackdrop` : "") +
|
|
94
|
+
(className ? " " + className : "")
|
|
95
|
+
|
|
88
96
|
}
|
|
89
97
|
{...otherProps}
|
|
90
98
|
/>
|
|
@@ -69,6 +69,20 @@ span.#{$eccgui}-spinner {
|
|
|
69
69
|
width: 1em;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
.#{$eccgui}-spinner--localbackdrop {
|
|
73
|
+
position: absolute;
|
|
74
|
+
top: 0;
|
|
75
|
+
right: 0;
|
|
76
|
+
bottom: 0;
|
|
77
|
+
left: 0;
|
|
78
|
+
|
|
79
|
+
background-color: rgba($eccgui-color-workspace-background, $eccgui-opacity-muted);
|
|
80
|
+
|
|
81
|
+
.#{$eccgui}-card & {
|
|
82
|
+
background-color: rgba($card-background-color, $eccgui-opacity-muted);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
72
86
|
.#{$eccgui}-spinner__overlay {
|
|
73
87
|
position: fixed;
|
|
74
88
|
display: flex;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Switch as BlueprintSwitch } from "@blueprintjs/core";
|
|
1
|
+
import React, {memo, SyntheticEvent} from 'react';
|
|
2
|
+
import { Switch as BlueprintSwitch, SwitchProps } from "@blueprintjs/core";
|
|
3
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
interface Props extends Omit<SwitchProps, "onChange"> {
|
|
6
|
+
onChange?: (value: boolean) => any
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function Switch({onChange, ...otherProps}: Props) {
|
|
10
|
+
const handleChange = (e: SyntheticEvent<HTMLInputElement>) => {
|
|
11
|
+
const checked = !!(e as any).target?.checked
|
|
12
|
+
onChange && onChange(checked);
|
|
8
13
|
};
|
|
9
14
|
|
|
10
15
|
return <BlueprintSwitch
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
TabProps as BlueprintTabProps
|
|
5
5
|
} from "@blueprintjs/core";
|
|
6
6
|
import Color from "color";
|
|
7
|
+
import decideContrastColorValue from "./../../common/utils/colorDecideContrastvalue";
|
|
7
8
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
8
9
|
import TabTitle, { TabTitleProps } from "./TabTitle";
|
|
9
10
|
|
|
@@ -47,7 +48,7 @@ export const transformTabProperties = ({
|
|
|
47
48
|
}
|
|
48
49
|
colorStyles = {
|
|
49
50
|
backgroundColor: `${color.rgb().toString()}`,
|
|
50
|
-
color:
|
|
51
|
+
color: decideContrastColorValue({testColor: color}),
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
const extraStyles = (dontShrink || !!backgroundColor) ? {style: {...flexStyles, ...colorStyles}} : {};
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
TagProps as BlueprintTagProps
|
|
5
5
|
} from "@blueprintjs/core";
|
|
6
6
|
import Color from "color";
|
|
7
|
+
import decideContrastColorValue from "./../../common/utils/colorDecideContrastvalue";
|
|
7
8
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
8
9
|
|
|
9
10
|
interface TagProps extends Omit<
|
|
@@ -74,7 +75,7 @@ function Tag({
|
|
|
74
75
|
...additionalStyles,
|
|
75
76
|
...{
|
|
76
77
|
backgroundColor: color.rgb().toString(),
|
|
77
|
-
color:
|
|
78
|
+
color: decideContrastColorValue({testColor: color}),
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
}
|
|
@@ -69,6 +69,10 @@ function TextField({
|
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
if ((!!otherProps.readOnly || !!otherProps.disabled) && !!otherProps.value && !otherProps.title) {
|
|
73
|
+
otherProps["title"] = otherProps.value;
|
|
74
|
+
}
|
|
75
|
+
|
|
72
76
|
return (
|
|
73
77
|
<BlueprintInputGroup
|
|
74
78
|
className={`${eccgui}-textfield ` + className}
|