@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
|
@@ -13,8 +13,9 @@ import {
|
|
|
13
13
|
Tooltip,
|
|
14
14
|
} from "./../../";
|
|
15
15
|
import { ISuggestionWithReplacementInfo } from "./AutoSuggestion";
|
|
16
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
16
17
|
|
|
17
|
-
export interface IDropdownProps {
|
|
18
|
+
export interface IDropdownProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
18
19
|
// The options of the drop down
|
|
19
20
|
options: Array<ISuggestionWithReplacementInfo>;
|
|
20
21
|
// Called when an item has been selected from the drop down
|
|
@@ -78,6 +79,7 @@ export const AutoSuggestionList = ({
|
|
|
78
79
|
left,
|
|
79
80
|
currentlyFocusedIndex,
|
|
80
81
|
itemToHighlight,
|
|
82
|
+
...otherDivProps
|
|
81
83
|
}: IDropdownProps) => {
|
|
82
84
|
const [hoveredItem, setHoveredItem] = React.useState<
|
|
83
85
|
ISuggestionWithReplacementInfo | undefined
|
|
@@ -132,7 +134,8 @@ export const AutoSuggestionList = ({
|
|
|
132
134
|
if (!loadingOrHasSuggestions || !isOpen) return null;
|
|
133
135
|
return (
|
|
134
136
|
<div
|
|
135
|
-
|
|
137
|
+
{...otherDivProps}
|
|
138
|
+
className={`${eccgui}-autosuggestion__dropdown`}
|
|
136
139
|
style={{ left }}
|
|
137
140
|
ref={dropdownRef}
|
|
138
141
|
>
|
|
@@ -4,6 +4,7 @@ import React from "react";
|
|
|
4
4
|
import { Controlled as ControlledEditor } from "react-codemirror2";
|
|
5
5
|
import { Classes as BlueprintClassNames } from "@blueprintjs/core";
|
|
6
6
|
import {Editor as CodeMirrorEditor} from "codemirror";
|
|
7
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
7
8
|
|
|
8
9
|
export interface IEditorProps {
|
|
9
10
|
// Is called with the editor instance that allows access via the CodeMirror API
|
|
@@ -11,7 +12,7 @@ export interface IEditorProps {
|
|
|
11
12
|
// Called whenever the editor content changes
|
|
12
13
|
onChange: (value: string) => any
|
|
13
14
|
// Called when the cursor position changes
|
|
14
|
-
onCursorChange: (pos: any, coords: any) => any
|
|
15
|
+
onCursorChange: (pos: any, coords: any, scrollinfo: any) => any
|
|
15
16
|
// The editor theme, e.g. "sparql"
|
|
16
17
|
mode?: string
|
|
17
18
|
// The initial value of the editor
|
|
@@ -49,7 +50,7 @@ const SingleLineCodeEditor = ({
|
|
|
49
50
|
showScrollBar = true
|
|
50
51
|
}: IEditorProps) => {
|
|
51
52
|
return (
|
|
52
|
-
<div className={
|
|
53
|
+
<div className={`${eccgui}-singlelinecodeeditor ${BlueprintClassNames.INPUT}`}>
|
|
53
54
|
<ControlledEditor
|
|
54
55
|
editorDidMount={(editor) => {
|
|
55
56
|
editor.on("beforeChange", (_, change) => {
|
|
@@ -82,7 +83,11 @@ const SingleLineCodeEditor = ({
|
|
|
82
83
|
}
|
|
83
84
|
}}
|
|
84
85
|
onCursor={(editor, data) => {
|
|
85
|
-
onCursorChange(
|
|
86
|
+
onCursorChange(
|
|
87
|
+
data,
|
|
88
|
+
editor.cursorCoords(true, "local"),
|
|
89
|
+
editor.getScrollInfo()
|
|
90
|
+
);
|
|
86
91
|
}}
|
|
87
92
|
onBeforeChange={(_editor, _data, value) => {
|
|
88
93
|
const trimmedValue = value.replace(/\n/g, "");
|
|
@@ -71,7 +71,7 @@ describe("Dropdown list", () => {
|
|
|
71
71
|
left: 10
|
|
72
72
|
}
|
|
73
73
|
const {container} = render(<AutoSuggestionList {...props} />)
|
|
74
|
-
const parentDiv:HTMLElement = container.querySelector(
|
|
74
|
+
const parentDiv:HTMLElement = container.querySelector(`.${eccgui}-autosuggestion__dropdown`)!!
|
|
75
75
|
const leftOffset = Number(parentDiv.style.left.replace(/px$/,""));
|
|
76
76
|
expect(leftOffset).toBe(props.left)
|
|
77
77
|
})
|
|
@@ -5,6 +5,7 @@ import SingleLineEditor, {
|
|
|
5
5
|
IEditorProps,
|
|
6
6
|
} from "../SingleLineCodeEditor";
|
|
7
7
|
import CodeMirror from "codemirror";
|
|
8
|
+
import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
|
|
8
9
|
|
|
9
10
|
describe("SingleLineCodeEditor", () => {
|
|
10
11
|
let props: IEditorProps,
|
|
@@ -26,7 +27,7 @@ describe("SingleLineCodeEditor", () => {
|
|
|
26
27
|
|
|
27
28
|
it("should render properly", () => {
|
|
28
29
|
const { container } = render(<SingleLineEditor {...props} />);
|
|
29
|
-
expect(container.querySelector(
|
|
30
|
+
expect(container.querySelector(`.${eccgui}-singlelinecodeeditor`)).not.toBeNull();
|
|
30
31
|
});
|
|
31
32
|
|
|
32
33
|
it("should set the editorInstance immediately it's mounted", () => {
|
|
@@ -223,7 +223,7 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
223
223
|
);
|
|
224
224
|
|
|
225
225
|
useEffect(() => {
|
|
226
|
-
if (!disabled && hasFocus) {
|
|
226
|
+
if (!disabled && !otherProps.inputProps?.readOnly && hasFocus) {
|
|
227
227
|
setListLoading(true);
|
|
228
228
|
const timeout: number = window.setTimeout(async () => {
|
|
229
229
|
fetchQueryResults(query);
|
|
@@ -351,7 +351,7 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
351
351
|
return <Notification danger={true} message={requestError} />
|
|
352
352
|
}
|
|
353
353
|
// Optional clear button to reset the selected value
|
|
354
|
-
const clearButton = reset &&
|
|
354
|
+
const clearButton = !disabled && reset &&
|
|
355
355
|
selectedItem != null &&
|
|
356
356
|
reset.resettableValue(selectedItem) ? (
|
|
357
357
|
<IconButton
|
|
@@ -370,7 +370,9 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
370
370
|
onBlur: handleOnFocusOut,
|
|
371
371
|
onFocus: handleOnFocusIn,
|
|
372
372
|
...otherProps.inputProps,
|
|
373
|
+
title: (selectedItem !== undefined && (!!otherProps.inputProps?.readOnly || disabled)) ? itemValueString(selectedItem) : otherProps.inputProps?.title,
|
|
373
374
|
};
|
|
375
|
+
const preventOverlayOnReadonly = !!otherProps.inputProps?.readOnly ? { isOpen: false } : {}
|
|
374
376
|
const updatedContextOverlayProps: Partial<Omit<ContextOverlayProps, "content" | "children">> = {
|
|
375
377
|
minimal: true,
|
|
376
378
|
placement: "bottom-start",
|
|
@@ -378,6 +380,7 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
378
380
|
rootBoundary: "viewport",
|
|
379
381
|
onClosed: onPopoverClose,
|
|
380
382
|
...otherProps.contextOverlayProps,
|
|
383
|
+
...preventOverlayOnReadonly,
|
|
381
384
|
}
|
|
382
385
|
if(selectedItem !== undefined) {
|
|
383
386
|
// Makes sure that even when an empty string is selected, the placeholder won't be shown.
|
|
@@ -20,6 +20,7 @@ export const Default = Template.bind({});
|
|
|
20
20
|
export const AdaptQueryAfterSelection = Template.bind({})
|
|
21
21
|
export const AllowReset = Template.bind({})
|
|
22
22
|
export const AllowCustomValues = Template.bind({})
|
|
23
|
+
export const ReadOnlyState = Template.bind({})
|
|
23
24
|
|
|
24
25
|
// Renders string values as string
|
|
25
26
|
const defaultRenderer = (item: string) => item
|
|
@@ -37,7 +38,7 @@ const defaultArgs: IAutoCompleteFieldProps<string, string> = {
|
|
|
37
38
|
console.log(`Entry '${elem}' selected!`)
|
|
38
39
|
},
|
|
39
40
|
itemValueSelector: defaultRenderer,
|
|
40
|
-
noResultText: "No result"
|
|
41
|
+
noResultText: "No result",
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
// Changes the search query for the selected item, e.g. when the rendered item text should be different from the query finding this item.
|
|
@@ -67,9 +68,19 @@ const allowCustomValues: IAutoCompleteFieldProps<string, string> = {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
// Changes the search query for the selected item, e.g. when the rendered item text should be different from the query finding this item.
|
|
72
|
+
const readOnlyState: IAutoCompleteFieldProps<string, string> = {
|
|
73
|
+
...defaultArgs,
|
|
74
|
+
initialValue: "search item B",
|
|
75
|
+
inputProps: {
|
|
76
|
+
readOnly: true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
70
80
|
Default.args = defaultArgs;
|
|
71
|
-
AdaptQueryAfterSelection.args = adaptQueryAfterSelection
|
|
72
|
-
AllowReset.args = resetSelection
|
|
73
|
-
AllowCustomValues.args = allowCustomValues
|
|
81
|
+
AdaptQueryAfterSelection.args = adaptQueryAfterSelection;
|
|
82
|
+
AllowReset.args = resetSelection;
|
|
83
|
+
AllowCustomValues.args = allowCustomValues;
|
|
84
|
+
ReadOnlyState.args = readOnlyState;
|
|
74
85
|
|
|
75
86
|
export default AutoCompleteFieldStory
|
|
@@ -2,14 +2,14 @@ import React from "react";
|
|
|
2
2
|
// import PropTypes from 'prop-types';
|
|
3
3
|
import {
|
|
4
4
|
Breadcrumb as BlueprintBreadcrumbItem,
|
|
5
|
-
|
|
5
|
+
BreadcrumbProps as BlueprintBreadcrumbItemProps,
|
|
6
6
|
} from "@blueprintjs/core";
|
|
7
7
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
8
8
|
import { openInNewTab } from "../../common/utils/openInNewTab";
|
|
9
9
|
|
|
10
10
|
// FIXME: enforce href and remove onClick later
|
|
11
|
-
export type
|
|
12
|
-
|
|
11
|
+
export type BreadcrumbItemProps = Omit<
|
|
12
|
+
BlueprintBreadcrumbItemProps,
|
|
13
13
|
// we remove some properties that are currently not necessary, required usage should be discussed
|
|
14
14
|
"icon" |
|
|
15
15
|
"iconTitle" |
|
|
@@ -17,13 +17,17 @@ export type IBreadcrumbItemProps = Omit<
|
|
|
17
17
|
"target"
|
|
18
18
|
>;
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Item of the breadcrumbs list.
|
|
22
|
+
* It cannot be used directly but the properties can be used within the elements of the `BreadcrumbList.items` property.
|
|
23
|
+
*/
|
|
20
24
|
function BreadcrumbItem({
|
|
21
25
|
className = "",
|
|
22
26
|
onClick,
|
|
23
27
|
href,
|
|
24
28
|
//itemDivider='',
|
|
25
29
|
...otherBlueprintBreadcrumbProps
|
|
26
|
-
}:
|
|
30
|
+
}: BreadcrumbItemProps) {
|
|
27
31
|
|
|
28
32
|
/*
|
|
29
33
|
FIXME: adding `data-divider` does not work this way because BlueprintJS
|
|
@@ -32,11 +36,16 @@ function BreadcrumbItem({
|
|
|
32
36
|
CSS/Sass as content for the pseudo element, currently done static in CSS
|
|
33
37
|
with slash char.
|
|
34
38
|
*/
|
|
39
|
+
|
|
40
|
+
const allowActions = !otherBlueprintBreadcrumbProps.current && !otherBlueprintBreadcrumbProps.disabled;
|
|
41
|
+
const actions = allowActions ? {
|
|
42
|
+
href,
|
|
43
|
+
onClick: (e:React.MouseEvent<HTMLElement>) => openInNewTab(e, onClick, href),
|
|
44
|
+
} : {};
|
|
35
45
|
return (
|
|
36
46
|
<BlueprintBreadcrumbItem
|
|
37
47
|
{...otherBlueprintBreadcrumbProps}
|
|
38
|
-
|
|
39
|
-
onClick={(e) => openInNewTab(e, onClick, href)}
|
|
48
|
+
{...actions}
|
|
40
49
|
className={`${eccgui}-breadcrumb__item ` + className}
|
|
41
50
|
/* data-divider={itemDivider ? itemDivider : ''} */
|
|
42
51
|
/>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, {useCallback} from "react";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "@blueprintjs/
|
|
3
|
+
Breadcrumbs2 as BlueprintBreadcrumbList,
|
|
4
|
+
Breadcrumbs2Props as BlueprintBreadcrumbsProps,
|
|
5
|
+
} from "@blueprintjs/popover2";
|
|
6
6
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
7
7
|
import BreadcrumbItem from "./BreadcrumbItem";
|
|
8
|
-
import {
|
|
8
|
+
import { BreadcrumbItemProps } from "./BreadcrumbItem";
|
|
9
9
|
|
|
10
10
|
type ReducedBreadcrumbsProps = Omit<
|
|
11
|
-
|
|
11
|
+
BlueprintBreadcrumbsProps,
|
|
12
12
|
// we remove some properties that are currently not necessary, required usage should be discussed
|
|
13
13
|
"breadcrumbRenderer" |
|
|
14
14
|
"collapseFrom" |
|
|
@@ -19,15 +19,15 @@ type ReducedBreadcrumbsProps = Omit<
|
|
|
19
19
|
>;
|
|
20
20
|
|
|
21
21
|
// FIXME: enforce onItemClick later when href value can always be routed correctly
|
|
22
|
-
interface
|
|
22
|
+
interface BreadcrumbListProps extends ReducedBreadcrumbsProps {
|
|
23
23
|
/**
|
|
24
24
|
list of breadcrumb items to display
|
|
25
25
|
*/
|
|
26
|
-
items:
|
|
26
|
+
items: BreadcrumbItemProps[];
|
|
27
27
|
/**
|
|
28
28
|
click handler used on breadcrumb items
|
|
29
29
|
*/
|
|
30
|
-
onItemClick?(itemUrl: string, event: object): any;
|
|
30
|
+
onItemClick?(itemUrl: string | undefined, event: object): any;
|
|
31
31
|
/**
|
|
32
32
|
native attributes for the unordered HTML list (ul)
|
|
33
33
|
*/
|
|
@@ -35,17 +35,32 @@ interface IBreadcrumbListProps extends ReducedBreadcrumbsProps {
|
|
|
35
35
|
/**
|
|
36
36
|
char that devides breadcrumb items, default: "/" (currently unsupported)
|
|
37
37
|
*/
|
|
38
|
-
itemDivider?: never;
|
|
38
|
+
//itemDivider?: never;
|
|
39
|
+
/**
|
|
40
|
+
* Do not re-render breadcrumbs in a shortened version if they overflow the available space.
|
|
41
|
+
*/
|
|
42
|
+
ignoreOverflow?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* If set to `true` then breadcrumb items can shrink.
|
|
45
|
+
* This way we cannot prevent overflowing breadcrumbs completely but this happens very late.
|
|
46
|
+
* You should enable this when `ignoreOverflow` is `true`.
|
|
47
|
+
*/
|
|
48
|
+
latenOverflow?: boolean;
|
|
39
49
|
}
|
|
40
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Navigation path to the currently show resource or view in the application.
|
|
53
|
+
*/
|
|
41
54
|
function BreadcrumbList({
|
|
42
55
|
className = "",
|
|
43
56
|
// itemDivider = "/",
|
|
44
57
|
onItemClick,
|
|
45
58
|
htmlUlProps,
|
|
59
|
+
ignoreOverflow = false,
|
|
60
|
+
latenOverflow = false,
|
|
46
61
|
...otherBlueprintBreadcrumbsProps
|
|
47
|
-
}:
|
|
48
|
-
const renderBreadcrumb = (propsBreadcrumb:
|
|
62
|
+
}: BreadcrumbListProps) {
|
|
63
|
+
const renderBreadcrumb = useCallback((propsBreadcrumb: BreadcrumbItemProps) => {
|
|
49
64
|
const {onClick, ...otherProps} = propsBreadcrumb;
|
|
50
65
|
return (
|
|
51
66
|
<BreadcrumbItem
|
|
@@ -60,20 +75,29 @@ function BreadcrumbList({
|
|
|
60
75
|
}
|
|
61
76
|
/>
|
|
62
77
|
);
|
|
63
|
-
};
|
|
78
|
+
}, [onItemClick]);
|
|
79
|
+
|
|
80
|
+
const renderCurrentBreadcrumb = React.useCallback((propsBreadcrumb: BreadcrumbItemProps) => {
|
|
81
|
+
return <BreadcrumbItem {...propsBreadcrumb} current={true} /*itemDivider={itemDivider}*/ />;
|
|
82
|
+
}, []);
|
|
64
83
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
}
|
|
84
|
+
const overflowListProps = React.useMemo(() => ignoreOverflow ? {
|
|
85
|
+
minVisibleItems: otherBlueprintBreadcrumbsProps.items.length,
|
|
86
|
+
} : {}, [ignoreOverflow, otherBlueprintBreadcrumbsProps.items.length])
|
|
68
87
|
|
|
69
88
|
return (
|
|
70
89
|
<BlueprintBreadcrumbList
|
|
71
90
|
{...otherBlueprintBreadcrumbsProps}
|
|
72
91
|
{...htmlUlProps}
|
|
73
|
-
className={
|
|
92
|
+
className={
|
|
93
|
+
`${eccgui}-breadcrumb__list` +
|
|
94
|
+
(latenOverflow ? ` ${eccgui}-breadcrumb__list--latenoverflow` : "") +
|
|
95
|
+
(className ? ` ${className}` : "")
|
|
96
|
+
}
|
|
74
97
|
minVisibleItems={1}
|
|
75
98
|
breadcrumbRenderer={renderBreadcrumb}
|
|
76
99
|
currentBreadcrumbRenderer={renderCurrentBreadcrumb}
|
|
100
|
+
overflowListProps={overflowListProps}
|
|
77
101
|
/>
|
|
78
102
|
);
|
|
79
103
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
height: auto;
|
|
6
6
|
|
|
7
7
|
& > li {
|
|
8
|
-
|
|
9
8
|
&:last-of-type {
|
|
10
9
|
min-width: 0;
|
|
11
10
|
}
|
|
@@ -39,9 +38,37 @@
|
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
|
|
41
|
+
.#{$eccgui}-breadcrumb__list--latenoverflow {
|
|
42
|
+
& > li {
|
|
43
|
+
flex-shrink: 1;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.#{$eccgui}-breadcrumb__item > * {
|
|
48
|
+
text-overflow: ellipsis;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
vertical-align: middle;
|
|
51
|
+
display: inline;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
.#{$eccgui}-breadcrumb__item {
|
|
43
56
|
font-size: inherit;
|
|
44
57
|
overflow: hidden;
|
|
45
58
|
text-overflow: ellipsis;
|
|
46
59
|
display: inline-block;
|
|
47
60
|
}
|
|
61
|
+
|
|
62
|
+
a.#{$eccgui}-breadcrumb__item {
|
|
63
|
+
&:not(.#{$ns}-breadcrumb-current):not(.#{$ns}-disabled) {
|
|
64
|
+
text-decoration: underline;
|
|
65
|
+
&:hover,
|
|
66
|
+
&:focus {
|
|
67
|
+
text-decoration: none;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
a {
|
|
71
|
+
@extend .#{$eccgui}-breadcrumb__item;
|
|
72
|
+
@extend .#{$ns}-breadcrumb;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { BreadcrumbItem } from './../../../index';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/Breadcrumbs/Item",
|
|
7
|
+
component: BreadcrumbItem,
|
|
8
|
+
argTypes: {
|
|
9
|
+
},
|
|
10
|
+
} as ComponentMeta<typeof BreadcrumbItem>
|
|
11
|
+
|
|
12
|
+
const Template: ComponentStory<typeof BreadcrumbItem> = (args) => (
|
|
13
|
+
<BreadcrumbItem {...args} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const Default = Template.bind({});
|
|
17
|
+
Default.args = {
|
|
18
|
+
text : 'Breadcrumb item',
|
|
19
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { BreadcrumbList, BreadcrumbItem } from './../../../index';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/Breadcrumbs/List",
|
|
7
|
+
component: BreadcrumbList,
|
|
8
|
+
subcomponents: { BreadcrumbItem },
|
|
9
|
+
argTypes: {
|
|
10
|
+
},
|
|
11
|
+
} as ComponentMeta<typeof BreadcrumbList>
|
|
12
|
+
|
|
13
|
+
const Template: ComponentStory<typeof BreadcrumbList> = (args) => (
|
|
14
|
+
<BreadcrumbList {...args} />
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const Default = Template.bind({});
|
|
18
|
+
Default.args = {
|
|
19
|
+
items : [
|
|
20
|
+
{text: "Root page", href : "#" },
|
|
21
|
+
{text: "Main click category", onClick: () => alert("Breadcrumb click")},
|
|
22
|
+
{text: <div>Sub category item</div>, href: "#"},
|
|
23
|
+
{text: <span>Disabled breadcrumb with a very long title</span>, disabled: true},
|
|
24
|
+
{text: <a href="#wrong">Wrongly placed link inside link</a>},
|
|
25
|
+
{text: "Current breadcrumb item", current: true}
|
|
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}
|