@eccenca/gui-elements 23.0.0-rc.3 → 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 +13 -0
- 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/BreadcrumbList.js +28 -8
- 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/BreadcrumbList.js +9 -8
- 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/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 +3 -2
- 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/BreadcrumbList.tsx +10 -8
- package/src/components/Breadcrumb/breadcrumb.scss +4 -0
- package/src/components/Breadcrumb/stories/BreadcrumbList.stories.tsx +1 -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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, {useCallback} from "react";
|
|
2
2
|
import {
|
|
3
3
|
Breadcrumbs2 as BlueprintBreadcrumbList,
|
|
4
4
|
Breadcrumbs2Props as BlueprintBreadcrumbsProps,
|
|
@@ -60,7 +60,7 @@ function BreadcrumbList({
|
|
|
60
60
|
latenOverflow = false,
|
|
61
61
|
...otherBlueprintBreadcrumbsProps
|
|
62
62
|
}: BreadcrumbListProps) {
|
|
63
|
-
const renderBreadcrumb = (propsBreadcrumb: BreadcrumbItemProps) => {
|
|
63
|
+
const renderBreadcrumb = useCallback((propsBreadcrumb: BreadcrumbItemProps) => {
|
|
64
64
|
const {onClick, ...otherProps} = propsBreadcrumb;
|
|
65
65
|
return (
|
|
66
66
|
<BreadcrumbItem
|
|
@@ -75,11 +75,15 @@ function BreadcrumbList({
|
|
|
75
75
|
}
|
|
76
76
|
/>
|
|
77
77
|
);
|
|
78
|
-
};
|
|
78
|
+
}, [onItemClick]);
|
|
79
79
|
|
|
80
|
-
const renderCurrentBreadcrumb = (propsBreadcrumb: BreadcrumbItemProps) => {
|
|
80
|
+
const renderCurrentBreadcrumb = React.useCallback((propsBreadcrumb: BreadcrumbItemProps) => {
|
|
81
81
|
return <BreadcrumbItem {...propsBreadcrumb} current={true} /*itemDivider={itemDivider}*/ />;
|
|
82
|
-
};
|
|
82
|
+
}, []);
|
|
83
|
+
|
|
84
|
+
const overflowListProps = React.useMemo(() => ignoreOverflow ? {
|
|
85
|
+
minVisibleItems: otherBlueprintBreadcrumbsProps.items.length,
|
|
86
|
+
} : {}, [ignoreOverflow, otherBlueprintBreadcrumbsProps.items.length])
|
|
83
87
|
|
|
84
88
|
return (
|
|
85
89
|
<BlueprintBreadcrumbList
|
|
@@ -93,9 +97,7 @@ function BreadcrumbList({
|
|
|
93
97
|
minVisibleItems={1}
|
|
94
98
|
breadcrumbRenderer={renderBreadcrumb}
|
|
95
99
|
currentBreadcrumbRenderer={renderCurrentBreadcrumb}
|
|
96
|
-
overflowListProps={
|
|
97
|
-
minVisibleItems: otherBlueprintBreadcrumbsProps.items.length,
|
|
98
|
-
} : {}}
|
|
100
|
+
overflowListProps={overflowListProps}
|
|
99
101
|
/>
|
|
100
102
|
);
|
|
101
103
|
}
|
|
@@ -21,6 +21,7 @@ Default.args = {
|
|
|
21
21
|
{text: "Main click category", onClick: () => alert("Breadcrumb click")},
|
|
22
22
|
{text: <div>Sub category item</div>, href: "#"},
|
|
23
23
|
{text: <span>Disabled breadcrumb with a very long title</span>, disabled: true},
|
|
24
|
+
{text: <a href="#wrong">Wrongly placed link inside link</a>},
|
|
24
25
|
{text: "Current breadcrumb item", current: true}
|
|
25
26
|
],
|
|
26
27
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface CardContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -12,7 +12,7 @@ function CardContent({
|
|
|
12
12
|
children,
|
|
13
13
|
className='',
|
|
14
14
|
...otherProps
|
|
15
|
-
}:
|
|
15
|
+
}: CardContentProps) {
|
|
16
16
|
return (
|
|
17
17
|
<div
|
|
18
18
|
{...otherProps}
|
|
@@ -38,6 +38,8 @@ interface ContextMenuProps extends TestableComponent {
|
|
|
38
38
|
* Props to spread to `ContextOverlay` that is used to display the dropdown.
|
|
39
39
|
*/
|
|
40
40
|
contextOverlayProps?: Partial<Omit<ContextOverlayProps, "content" | "children" | "className">>
|
|
41
|
+
/** Disables the button to open the menu. */
|
|
42
|
+
disabled?: boolean
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -49,6 +51,7 @@ function ContextMenu({
|
|
|
49
51
|
togglerElement = "item-moremenu",
|
|
50
52
|
togglerText = "Show more options",
|
|
51
53
|
contextOverlayProps,
|
|
54
|
+
disabled,
|
|
52
55
|
togglerLarge = false,
|
|
53
56
|
/* FIXME: The Tooltip component can interfere with the opened menu, since it is implemented via portal and may cover the menu,
|
|
54
57
|
so by default we use the title attribute instead of Tooltip. */
|
|
@@ -68,6 +71,7 @@ function ContextMenu({
|
|
|
68
71
|
name={[togglerElement]}
|
|
69
72
|
text={togglerText}
|
|
70
73
|
large={togglerLarge}
|
|
74
|
+
disabled={!!disabled}
|
|
71
75
|
data-test-id={restProps["data-test-id"]}
|
|
72
76
|
/>
|
|
73
77
|
) : (
|
|
@@ -13,7 +13,7 @@ import {TestableComponent} from "../interfaces";
|
|
|
13
13
|
* input id could be created when not given
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
interface
|
|
16
|
+
export interface FieldItemProps extends React.HTMLAttributes<HTMLDivElement>, TestableComponent {
|
|
17
17
|
hasStatePrimary?: boolean
|
|
18
18
|
hasStateSuccess?: boolean
|
|
19
19
|
hasStateWarning?: boolean
|
|
@@ -26,6 +26,9 @@ interface IProps extends TestableComponent {
|
|
|
26
26
|
messageText?: string
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Form element that manages the combination of label, helper texts, input element and feedback messages.
|
|
31
|
+
*/
|
|
29
32
|
function FieldItem({
|
|
30
33
|
hasStatePrimary = false,
|
|
31
34
|
hasStateSuccess = false,
|
|
@@ -38,7 +41,7 @@ function FieldItem({
|
|
|
38
41
|
helperText,
|
|
39
42
|
messageText,
|
|
40
43
|
...otherProps
|
|
41
|
-
}:
|
|
44
|
+
}: FieldItemProps) {
|
|
42
45
|
let classIntent = "";
|
|
43
46
|
switch (true) {
|
|
44
47
|
case hasStatePrimary:
|
|
@@ -79,10 +82,10 @@ function FieldItem({
|
|
|
79
82
|
|
|
80
83
|
return (
|
|
81
84
|
<div
|
|
82
|
-
data-test-id={otherProps["data-test-id"]}
|
|
83
85
|
className={
|
|
84
86
|
`${eccgui}-fielditem` + (className ? " " + className : "") + (disabled ? ` ${eccgui}-fielditem--disabled` : "")
|
|
85
87
|
}
|
|
88
|
+
{...otherProps}
|
|
86
89
|
>
|
|
87
90
|
{label}
|
|
88
91
|
{userhelp}
|
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
export interface FieldItemRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* If set to `true` all `FieldItem` childrens have the same width.
|
|
7
|
+
*/
|
|
8
|
+
justifyItemWidths?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Allows to display `FieldItem` children horizontally in one row.
|
|
13
|
+
*/
|
|
14
|
+
function FieldItemRow({
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
justifyItemWidths = false,
|
|
18
|
+
...otherProps
|
|
19
|
+
}: FieldItemRowProps) {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
className={
|
|
23
|
+
`${eccgui}-fielditem__row` +
|
|
24
|
+
(justifyItemWidths ? ` ${eccgui}-fielditem__row--justified` : "") +
|
|
25
|
+
(className ? ` ${className}` : "")
|
|
26
|
+
}
|
|
27
|
+
{...otherProps}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
10
32
|
}
|
|
11
33
|
|
|
12
34
|
export default FieldItemRow;
|
|
@@ -2,14 +2,20 @@ import React from "react";
|
|
|
2
2
|
// import PropTypes from 'prop-types';
|
|
3
3
|
import { Grid as CarbonGrid } from "carbon-components-react";
|
|
4
4
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
5
|
+
import {GridDefaultProps} from "carbon-components-react/lib/components/Grid/Grid";
|
|
6
|
+
|
|
7
|
+
interface GridProps extends GridDefaultProps {
|
|
8
|
+
verticalStretchable?: boolean
|
|
9
|
+
useAbsoluteSpace?: boolean
|
|
10
|
+
}
|
|
5
11
|
|
|
6
12
|
function Grid({
|
|
7
13
|
children,
|
|
8
|
-
verticalStretchable,
|
|
9
|
-
useAbsoluteSpace,
|
|
14
|
+
verticalStretchable = false,
|
|
15
|
+
useAbsoluteSpace = false,
|
|
10
16
|
className = '',
|
|
11
17
|
...restProps
|
|
12
|
-
}:
|
|
18
|
+
}: GridProps) {
|
|
13
19
|
return (
|
|
14
20
|
<CarbonGrid
|
|
15
21
|
{...restProps}
|
|
@@ -2,6 +2,14 @@ import React from "react";
|
|
|
2
2
|
// import PropTypes from 'prop-types';
|
|
3
3
|
import { Column as CarbonColumn } from "carbon-components-react";
|
|
4
4
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
5
|
+
import {ColumnDefaultProps} from "carbon-components-react/lib/components/Grid/Column";
|
|
6
|
+
|
|
7
|
+
interface GridColumnProps extends ColumnDefaultProps {
|
|
8
|
+
small?: boolean
|
|
9
|
+
medium?: boolean
|
|
10
|
+
full?: boolean
|
|
11
|
+
verticalAlign?: "center"
|
|
12
|
+
}
|
|
5
13
|
|
|
6
14
|
function GridColumn({
|
|
7
15
|
children,
|
|
@@ -9,9 +17,9 @@ function GridColumn({
|
|
|
9
17
|
small = false,
|
|
10
18
|
medium = false,
|
|
11
19
|
full = true,
|
|
12
|
-
verticalAlign
|
|
20
|
+
verticalAlign,
|
|
13
21
|
...otherProps
|
|
14
|
-
}:
|
|
22
|
+
}: GridColumnProps) {
|
|
15
23
|
let sizeConfig = {};
|
|
16
24
|
if (small) sizeConfig = { md:2, lg:3 };
|
|
17
25
|
if (medium) sizeConfig = { md:3, lg:5 };
|
|
@@ -2,6 +2,13 @@ import React from "react";
|
|
|
2
2
|
// import PropTypes from 'prop-types';
|
|
3
3
|
import { Row as CarbonRow } from "carbon-components-react";
|
|
4
4
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
5
|
+
import {RowDefaultProps} from "carbon-components-react/lib/components/Grid/Row";
|
|
6
|
+
|
|
7
|
+
interface GridRowProps extends RowDefaultProps {
|
|
8
|
+
dontWrapColumns?: boolean
|
|
9
|
+
fullHeight?: boolean
|
|
10
|
+
verticalStretched?: boolean
|
|
11
|
+
}
|
|
5
12
|
|
|
6
13
|
function GridRow({
|
|
7
14
|
children,
|
|
@@ -10,7 +17,7 @@ function GridRow({
|
|
|
10
17
|
fullHeight = false,
|
|
11
18
|
verticalStretched,
|
|
12
19
|
...otherProps
|
|
13
|
-
}:
|
|
20
|
+
}: GridRowProps) {
|
|
14
21
|
return (
|
|
15
22
|
<CarbonRow
|
|
16
23
|
{...otherProps}
|
|
@@ -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;
|