@eccenca/gui-elements 23.3.1 → 23.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +3 -2
  3. package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
  4. package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js +11 -6
  5. package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
  6. package/dist/cjs/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js +7 -4
  7. package/dist/cjs/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js.map +1 -1
  8. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +61 -19
  9. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  10. package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js +4 -18
  11. package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
  12. package/dist/cjs/components/AutoSuggestion/ExtendedCodeEditor.js +65 -0
  13. package/dist/cjs/components/AutoSuggestion/ExtendedCodeEditor.js.map +1 -0
  14. package/dist/cjs/components/AutoSuggestion/index.js +3 -3
  15. package/dist/cjs/components/AutoSuggestion/index.js.map +1 -1
  16. package/dist/cjs/components/Card/CardHeader.js +19 -18
  17. package/dist/cjs/components/Card/CardHeader.js.map +1 -1
  18. package/dist/cjs/components/Grid/GridColumn.js +3 -3
  19. package/dist/cjs/components/Grid/GridColumn.js.map +1 -1
  20. package/dist/cjs/components/Icon/TestIcon.js +4 -4
  21. package/dist/cjs/components/Icon/TestIcon.js.map +1 -1
  22. package/dist/cjs/components/Icon/canonicalIconNames.js +5 -0
  23. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  24. package/dist/cjs/components/PropertyValuePair/PropertyName.js +4 -2
  25. package/dist/cjs/components/PropertyValuePair/PropertyName.js.map +1 -1
  26. package/dist/cjs/components/PropertyValuePair/PropertyValue.js +6 -4
  27. package/dist/cjs/components/PropertyValuePair/PropertyValue.js.map +1 -1
  28. package/dist/cjs/components/PropertyValuePair/PropertyValuePair.js +13 -3
  29. package/dist/cjs/components/PropertyValuePair/PropertyValuePair.js.map +1 -1
  30. package/dist/cjs/components/Skeleton/Skeleton.js +30 -0
  31. package/dist/cjs/components/Skeleton/Skeleton.js.map +1 -0
  32. package/dist/cjs/components/Skeleton/classnames.js +6 -0
  33. package/dist/cjs/components/Skeleton/classnames.js.map +1 -0
  34. package/dist/cjs/components/Table/TableCell.js +3 -2
  35. package/dist/cjs/components/Table/TableCell.js.map +1 -1
  36. package/dist/cjs/components/TextField/useTextValidation.js.map +1 -1
  37. package/dist/cjs/components/index.js +1 -0
  38. package/dist/cjs/components/index.js.map +1 -1
  39. package/dist/cjs/index.js +2 -0
  40. package/dist/cjs/index.js.map +1 -1
  41. package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +3 -2
  42. package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
  43. package/dist/esm/cmem/ActivityControl/SilkActivityControl.js +14 -9
  44. package/dist/esm/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
  45. package/dist/esm/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js +8 -4
  46. package/dist/esm/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js.map +1 -1
  47. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +82 -40
  48. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  49. package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js +6 -20
  50. package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
  51. package/dist/esm/components/AutoSuggestion/ExtendedCodeEditor.js +70 -0
  52. package/dist/esm/components/AutoSuggestion/ExtendedCodeEditor.js.map +1 -0
  53. package/dist/esm/components/AutoSuggestion/index.js +2 -2
  54. package/dist/esm/components/AutoSuggestion/index.js.map +1 -1
  55. package/dist/esm/components/Card/CardHeader.js +15 -14
  56. package/dist/esm/components/Card/CardHeader.js.map +1 -1
  57. package/dist/esm/components/Grid/GridColumn.js +3 -3
  58. package/dist/esm/components/Grid/GridColumn.js.map +1 -1
  59. package/dist/esm/components/Icon/TestIcon.js +4 -4
  60. package/dist/esm/components/Icon/TestIcon.js.map +1 -1
  61. package/dist/esm/components/Icon/canonicalIconNames.js +5 -0
  62. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  63. package/dist/esm/components/PropertyValuePair/PropertyName.js +4 -2
  64. package/dist/esm/components/PropertyValuePair/PropertyName.js.map +1 -1
  65. package/dist/esm/components/PropertyValuePair/PropertyValue.js +6 -4
  66. package/dist/esm/components/PropertyValuePair/PropertyValue.js.map +1 -1
  67. package/dist/esm/components/PropertyValuePair/PropertyValuePair.js +13 -3
  68. package/dist/esm/components/PropertyValuePair/PropertyValuePair.js.map +1 -1
  69. package/dist/esm/components/Skeleton/Skeleton.js +24 -0
  70. package/dist/esm/components/Skeleton/Skeleton.js.map +1 -0
  71. package/dist/esm/components/Skeleton/classnames.js +3 -0
  72. package/dist/esm/components/Skeleton/classnames.js.map +1 -0
  73. package/dist/esm/components/Table/TableCell.js +4 -3
  74. package/dist/esm/components/Table/TableCell.js.map +1 -1
  75. package/dist/esm/components/TextField/useTextValidation.js.map +1 -1
  76. package/dist/esm/components/index.js +1 -0
  77. package/dist/esm/components/index.js.map +1 -1
  78. package/dist/esm/index.js +2 -0
  79. package/dist/esm/index.js.map +1 -1
  80. package/dist/types/cmem/ActivityControl/ActivityControlTypes.d.ts +1 -0
  81. package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +4 -0
  82. package/dist/types/cmem/ActivityControl/SilkActivityControl.d.ts +8 -4
  83. package/dist/types/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.d.ts +5 -4
  84. package/dist/types/components/AutoSuggestion/AutoSuggestion.d.ts +8 -2
  85. package/dist/types/components/AutoSuggestion/AutoSuggestionList.d.ts +6 -4
  86. package/dist/types/components/AutoSuggestion/{SingleLineCodeEditor.d.ts → ExtendedCodeEditor.d.ts} +7 -4
  87. package/dist/types/components/AutoSuggestion/index.d.ts +3 -3
  88. package/dist/types/components/Card/CardHeader.d.ts +2 -2
  89. package/dist/types/components/Grid/GridColumn.d.ts +1 -0
  90. package/dist/types/components/Icon/TestIcon.d.ts +2 -1
  91. package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
  92. package/dist/types/components/PropertyValuePair/PropertyName.d.ts +7 -1
  93. package/dist/types/components/PropertyValuePair/PropertyValue.d.ts +7 -1
  94. package/dist/types/components/PropertyValuePair/PropertyValuePair.d.ts +5 -1
  95. package/dist/types/components/Skeleton/Skeleton.d.ts +13 -0
  96. package/dist/types/components/Skeleton/classnames.d.ts +1 -0
  97. package/dist/types/components/Table/TableCell.d.ts +7 -2
  98. package/dist/types/components/TextField/useTextValidation.d.ts +1 -0
  99. package/dist/types/components/index.d.ts +1 -0
  100. package/dist/types/index.d.ts +3 -0
  101. package/package.json +6 -3
  102. package/src/cmem/ActivityControl/ActivityControlTypes.ts +2 -0
  103. package/src/cmem/ActivityControl/ActivityControlWidget.tsx +6 -0
  104. package/src/cmem/ActivityControl/SilkActivityControl.tsx +78 -46
  105. package/src/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.tsx +12 -4
  106. package/src/components/AutoSuggestion/AutoSuggestion.tsx +84 -31
  107. package/src/components/AutoSuggestion/AutoSuggestionList.tsx +11 -42
  108. package/src/components/AutoSuggestion/ExtendedCodeEditor.tsx +129 -0
  109. package/src/components/AutoSuggestion/index.ts +3 -11
  110. package/src/components/AutoSuggestion/tests/AutoSuggestionList.test.tsx +83 -84
  111. package/src/components/AutoSuggestion/tests/{SingleLineCodeEditor.test.tsx → ExtendedCodeEditor.test.tsx} +7 -7
  112. package/src/components/Card/CardHeader.tsx +23 -25
  113. package/src/components/Grid/GridColumn.tsx +15 -13
  114. package/src/components/Icon/TestIcon.tsx +9 -13
  115. package/src/components/Icon/canonicalIconNames.tsx +10 -0
  116. package/src/components/Icon/stories/Icon.stories.tsx +17 -30
  117. package/src/components/Icon/stories/TestIcon.stories.tsx +8 -9
  118. package/src/components/OverviewItem/overviewitem.scss +27 -33
  119. package/src/components/Pagination/pagination.scss +6 -1
  120. package/src/components/PropertyValuePair/PropertyName.tsx +21 -2
  121. package/src/components/PropertyValuePair/PropertyValue.tsx +21 -5
  122. package/src/components/PropertyValuePair/PropertyValuePair.tsx +23 -4
  123. package/src/components/PropertyValuePair/propertyvalue.scss +6 -1
  124. package/src/components/PropertyValuePair/stories/PropertyName.stories.tsx +18 -0
  125. package/src/components/PropertyValuePair/stories/PropertyValue.stories.tsx +18 -0
  126. package/src/components/PropertyValuePair/stories/PropertyValueList.stories.tsx +33 -0
  127. package/src/components/PropertyValuePair/stories/PropertyValuePair.stories.tsx +29 -0
  128. package/src/components/Skeleton/Skeleton.stories.tsx +29 -0
  129. package/src/components/Skeleton/Skeleton.tsx +32 -0
  130. package/src/components/Skeleton/classnames.ts +3 -0
  131. package/src/components/Skeleton/skeleton.scss +1 -0
  132. package/src/components/Table/TableCell.tsx +12 -8
  133. package/src/components/Table/stories/TableCell.stories.tsx +30 -0
  134. package/src/components/Table/table.scss +96 -50
  135. package/src/components/TextField/stories/TextField.stories.tsx +21 -18
  136. package/src/components/TextField/useTextValidation.ts +82 -68
  137. package/src/components/index.scss +1 -0
  138. package/src/components/index.ts +1 -0
  139. package/src/extensions/codemirror/_codemirror.scss +1 -0
  140. package/src/index.ts +2 -0
  141. package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js +0 -53
  142. package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js.map +0 -1
  143. package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js +0 -47
  144. package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js.map +0 -1
  145. package/src/components/AutoSuggestion/SingleLineCodeEditor.tsx +0 -110
@@ -1,126 +1,125 @@
1
- import React from 'react';
2
- import '@testing-library/jest-dom'
3
- import {fireEvent, render, waitFor} from '@testing-library/react'
4
- import {CLASSPREFIX as eccgui} from "../../../configuration/constants";
5
- import {AutoSuggestionList, AutoSuggestionListProps} from '../AutoSuggestionList'
1
+ import React from "react";
2
+ import "@testing-library/jest-dom";
3
+ import { fireEvent, render, waitFor } from "@testing-library/react";
4
+ import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
5
+ import { AutoSuggestionList, AutoSuggestionListProps } from "../AutoSuggestionList";
6
6
 
7
7
  describe("Dropdown list", () => {
8
- let props:AutoSuggestionListProps, mockOptions
8
+ let props: AutoSuggestionListProps, mockOptions;
9
9
  beforeEach(() => {
10
- props = {
10
+ props = {
11
11
  currentlyFocusedIndex: 0,
12
12
  loading: false,
13
13
  isOpen: false,
14
14
  options: [],
15
15
  itemToHighlight: () => {},
16
- onItemSelectionChange: () => {}
17
- }
16
+ onItemSelectionChange: () => {},
17
+ };
18
18
 
19
19
  mockOptions = [
20
20
  {
21
- query:"organizations",
21
+ query: "organizations",
22
22
  from: 0,
23
23
  length: 13,
24
- value:"organizations/name"
24
+ value: "organizations/name",
25
25
  },
26
26
  {
27
- query:"",
27
+ query: "",
28
28
  from: 13,
29
- length:0,
30
- value:"/"
31
- }
32
- ]
33
- })
34
-
29
+ length: 0,
30
+ value: "/",
31
+ },
32
+ ];
33
+ });
35
34
 
36
35
  it("doesn't render when not focused", () => {
37
- const {container} = render(<AutoSuggestionList {...props} />)
38
- expect(container).toBeEmptyDOMElement()
39
- })
36
+ const { container } = render(<AutoSuggestionList {...props} />);
37
+ expect(container).toBeEmptyDOMElement();
38
+ });
40
39
 
41
40
  it("should be able to display loading state, when fetching suggestions", () => {
42
41
  props = {
43
42
  ...props,
44
43
  loading: true,
45
- isOpen: true
46
- }
47
- const {getByText} = render(<AutoSuggestionList {...props} />)
48
- expect(getByText("Fetching suggestions")).toBeTruthy()
49
- })
44
+ isOpen: true,
45
+ };
46
+ const { getByText } = render(<AutoSuggestionList {...props} />);
47
+ expect(getByText("Fetching suggestions")).toBeTruthy();
48
+ });
50
49
 
51
50
  it("should render list when suggestions are fetched", () => {
52
- props = {
53
- ...props,
54
- loading: false,
55
- isOpen:true,
56
- options: mockOptions
57
- }
58
- const {container} = render(<AutoSuggestionList {...props} />)
59
- const dropdownItems = container.getElementsByTagName("li")
60
- expect(container).not.toBeEmptyDOMElement()
61
- expect(dropdownItems.length).toBe(2)
62
- })
51
+ props = {
52
+ ...props,
53
+ loading: false,
54
+ isOpen: true,
55
+ options: mockOptions,
56
+ };
57
+ const { container } = render(<AutoSuggestionList {...props} />);
58
+ const dropdownItems = container.getElementsByTagName("li");
59
+ expect(container).not.toBeEmptyDOMElement();
60
+ expect(dropdownItems.length).toBe(2);
61
+ });
63
62
 
64
63
  it("should move horizontally for every cursor movement", async () => {
65
- const offset = 10
66
- props = {
67
- ...props,
68
- options: mockOptions,
69
- loading: false,
70
- isOpen: true,
71
- registerForHorizontalShift: (callback => callback(offset)),
72
- }
73
- const {container} = render(<AutoSuggestionList {...props} />)
74
- await waitFor(() => {
75
- const parentDiv:HTMLElement = container.querySelector(`.${eccgui}-autosuggestion__dropdown`)!!
76
- const leftOffset = Number(parentDiv.style.left.replace(/px$/,""));
77
- expect(leftOffset).toBe(offset)
78
- })
79
- })
64
+ const offset = 10;
65
+ props = {
66
+ ...props,
67
+ options: mockOptions,
68
+ loading: false,
69
+ isOpen: true,
70
+ offsetValues: { x: 10, y: 0 },
71
+ };
72
+ const { container } = render(<AutoSuggestionList {...props} />);
73
+ await waitFor(() => {
74
+ const parentDiv: HTMLElement = container.querySelector(`.${eccgui}-autosuggestion__dropdown`)!!;
75
+ const leftOffset = Number(parentDiv.style.left.replace(/px$/, ""));
76
+ expect(leftOffset).toBe(offset);
77
+ });
78
+ });
80
79
 
81
80
  it("should have one active item at a time", () => {
82
81
  props = {
83
82
  ...props,
84
83
  loading: false,
85
- isOpen:true,
86
- options: mockOptions
87
- }
88
- const {container} = render(<AutoSuggestionList {...props} />)
89
- const activeListItems = Array.from(container.querySelectorAll("li .bp4-menu-item.bp4-active"))
90
- expect(activeListItems.length).toBe(1)
91
- })
84
+ isOpen: true,
85
+ options: mockOptions,
86
+ };
87
+ const { container } = render(<AutoSuggestionList {...props} />);
88
+ const activeListItems = Array.from(container.querySelectorAll("li .bp4-menu-item.bp4-active"));
89
+ expect(activeListItems.length).toBe(1);
90
+ });
92
91
 
93
- it("should respond to click on each item and pass the clicked item to autosuggestion", () => {
94
- const mockOnItemSelection = jest.fn((item) => {})
92
+ it("should respond to click on each item and pass the clicked item to autosuggestion", () => {
93
+ const mockOnItemSelection = jest.fn((item) => {});
95
94
  props = {
96
95
  ...props,
97
96
  loading: false,
98
- isOpen:true,
97
+ isOpen: true,
99
98
  options: mockOptions,
100
- onItemSelectionChange: mockOnItemSelection
101
- }
102
- const {getByText} = render(<AutoSuggestionList {...props}/>)
103
- const dropdownListItem = getByText(props.options[0].query).closest(`.${eccgui}-menu__item`);
104
- fireEvent.click(dropdownListItem!!)
105
- expect(mockOnItemSelection).toHaveBeenCalledTimes(1)
106
- expect(mockOnItemSelection).toHaveBeenCalledWith(props.options[0])
107
- })
99
+ onItemSelectionChange: mockOnItemSelection,
100
+ };
101
+ const { getByText } = render(<AutoSuggestionList {...props} />);
102
+ const dropdownListItem = getByText(props.options[0].query).closest(`.${eccgui}-menu__item`);
103
+ fireEvent.click(dropdownListItem!!);
104
+ expect(mockOnItemSelection).toHaveBeenCalledTimes(1);
105
+ expect(mockOnItemSelection).toHaveBeenCalledWith(props.options[0]);
106
+ });
108
107
 
109
- it("should call highlight function when list item is mouse hovered",() => {
110
- const mockItemToHighlight = jest.fn((item) => {})
108
+ it("should call highlight function when list item is mouse hovered", () => {
109
+ const mockItemToHighlight = jest.fn((item) => {});
111
110
  props = {
112
111
  ...props,
113
112
  loading: false,
114
- isOpen:true,
113
+ isOpen: true,
115
114
  options: mockOptions,
116
- itemToHighlight: mockItemToHighlight
117
- }
118
- const {container} = render(<AutoSuggestionList {...props}/>)
119
- const firstItem = container.querySelector("li");
120
- fireEvent.mouseEnter(firstItem!!)
121
- expect(mockItemToHighlight).toHaveBeenCalledWith(props.options[0])
122
- expect(mockItemToHighlight).toHaveBeenCalledTimes(1)
123
- fireEvent.mouseLeave(firstItem!!)
124
- expect(mockItemToHighlight).toHaveBeenCalledTimes(1)
125
- })
126
- })
115
+ itemToHighlight: mockItemToHighlight,
116
+ };
117
+ const { container } = render(<AutoSuggestionList {...props} />);
118
+ const firstItem = container.querySelector("li");
119
+ fireEvent.mouseEnter(firstItem!!);
120
+ expect(mockItemToHighlight).toHaveBeenCalledWith(props.options[0]);
121
+ expect(mockItemToHighlight).toHaveBeenCalledTimes(1);
122
+ fireEvent.mouseLeave(firstItem!!);
123
+ expect(mockItemToHighlight).toHaveBeenCalledTimes(1);
124
+ });
125
+ });
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
2
  import "@testing-library/jest-dom";
3
3
  import { render } from "@testing-library/react";
4
- import { SingleLineCodeEditor, SingleLineCodeEditorProps } from "../../../../index";
4
+ import { ExtendedCodeEditor, ExtendedCodeEditorProps } from "../../../../index";
5
5
  import CodeMirror from "codemirror";
6
6
  import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
7
7
 
8
8
  describe("SingleLineCodeEditor", () => {
9
- let props: SingleLineCodeEditorProps,
9
+ let props: ExtendedCodeEditorProps,
10
10
  codeMirrorEditorInstance: CodeMirror.Editor = null as any;
11
11
 
12
12
  beforeAll(() => {
@@ -40,12 +40,12 @@ describe("SingleLineCodeEditor", () => {
40
40
  });
41
41
 
42
42
  it("should render properly", () => {
43
- const { container } = render(<SingleLineCodeEditor {...props} />);
43
+ const { container } = render(<ExtendedCodeEditor {...props} />);
44
44
  expect(container.querySelector(`.${eccgui}-singlelinecodeeditor`)).not.toBeNull();
45
45
  });
46
46
 
47
47
  it("should set the editorInstance immediately it's mounted", () => {
48
- render(<SingleLineCodeEditor {...props} />);
48
+ render(<ExtendedCodeEditor {...props} />);
49
49
  expect(props.setEditorInstance).toHaveBeenCalledTimes(1);
50
50
  expect(codeMirrorEditorInstance).not.toBeNull();
51
51
  });
@@ -55,19 +55,19 @@ describe("SingleLineCodeEditor", () => {
55
55
  ...props,
56
56
  initialValue: "This is the initial input",
57
57
  };
58
- const { getByText } = render(<SingleLineCodeEditor {...props} />);
58
+ const { getByText } = render(<ExtendedCodeEditor {...props} />);
59
59
  expect(codeMirrorEditorInstance.getValue()).toBe(props.initialValue);
60
60
  expect(getByText(props.initialValue)).toBeTruthy();
61
61
  });
62
62
 
63
63
  it("should not allow user to create new lines", () => {
64
- render(<SingleLineCodeEditor {...props} />);
64
+ render(<ExtendedCodeEditor {...props} />);
65
65
  codeMirrorEditorInstance.getDoc().setValue("I'm entering a new line \n character");
66
66
  expect(codeMirrorEditorInstance.lineCount()).toBe(1);
67
67
  });
68
68
 
69
69
  it("should convert multiple lines to a single line", () => {
70
- render(<SingleLineCodeEditor {...{ ...props, initialValue: "1\n2\n3" }} />);
70
+ render(<ExtendedCodeEditor {...{ ...props, initialValue: "1\n2\n3" }} />);
71
71
  expect(codeMirrorEditorInstance.lineCount()).toBe(1);
72
72
  });
73
73
  });
@@ -1,43 +1,41 @@
1
1
  import React from "react";
2
- import OverviewItem, { OverviewItemProps } from "./../OverviewItem/OverviewItem";
3
- import { OverviewItemDescription } from "./../OverviewItem";
2
+
4
3
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5
- import CardTitle from "./CardTitle";
4
+
5
+ import { OverviewItemDescription } from "./../OverviewItem";
6
+ import OverviewItem, { OverviewItemProps } from "./../OverviewItem/OverviewItem";
6
7
  import CardOptions from "./CardOptions";
8
+ import CardTitle from "./CardTitle";
7
9
 
8
10
  export interface CardHeaderProps extends Omit<OverviewItemProps, "densityHigh" | "hasSpacing"> {
9
11
  children: JSX.Element | (JSX.Element | undefined | null)[] | null | undefined;
10
12
  /**
11
- * @deprecated
13
+ * @deprecated use `whitespaceAmount` option of `<Card />`
12
14
  */
13
15
  densityHigh?: OverviewItemProps["densityHigh"];
14
16
  /**
15
- * @deprecated
17
+ * @deprecated use `whitespaceAmount` option of `<Card />`
16
18
  */
17
19
  hasSpacing?: OverviewItemProps["hasSpacing"];
18
20
  }
19
21
 
20
- export const CardHeader = ({
21
- children,
22
- className = "",
23
- densityHigh = true,
24
- ...otherProps
25
- }: CardHeaderProps) => {
26
- let actions: any[] = [];
27
- let description: any[] = [];
22
+ export const CardHeader = ({ children, className = "", densityHigh = true, ...otherProps }: CardHeaderProps) => {
23
+ const actions: any[] = [];
24
+ const description: any[] = [];
28
25
 
29
- children && (Array.isArray(children) ? children : [children]).forEach((child) => {
30
- if (typeof child === "object" && child && !!child.type) {
31
- switch (child.type) {
32
- case CardTitle:
33
- description.push(child);
34
- break;
35
- case CardOptions:
36
- actions.push(child);
37
- break;
26
+ children &&
27
+ (Array.isArray(children) ? children : [children]).forEach((child) => {
28
+ if (typeof child === "object" && child && !!child.type) {
29
+ switch (child.type) {
30
+ case CardTitle:
31
+ description.push(child);
32
+ break;
33
+ case CardOptions:
34
+ actions.push(child);
35
+ break;
36
+ }
38
37
  }
39
- }
40
- });
38
+ });
41
39
 
42
40
  return (
43
41
  <header>
@@ -47,6 +45,6 @@ export const CardHeader = ({
47
45
  </OverviewItem>
48
46
  </header>
49
47
  );
50
- }
48
+ };
51
49
 
52
50
  export default CardHeader;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  // import PropTypes from 'prop-types';
3
3
  import { Column as CarbonColumn, ColumnDefaultProps } from "carbon-components-react";
4
+
4
5
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5
6
 
6
7
  export interface GridColumnProps extends Omit<ColumnDefaultProps, "max" | "xlg" | "lg" | "md" | "sm"> {
@@ -8,24 +9,25 @@ export interface GridColumnProps extends Omit<ColumnDefaultProps, "max" | "xlg"
8
9
  * Column width is small, using 3 (or 2, on medium viewports) parts out of 16.
9
10
  * This boolean property is basically a quick switch for setting `{ md:2, lg:3 }`.
10
11
  */
11
- small?: boolean
12
+ small?: boolean;
12
13
  /**
13
14
  * Column width is medium, using 5 (or 3, on medium viewports) parts out of 16.
14
15
  * This boolean property is basically a quick switch for setting `{ md:3, lg:5 }`.
15
16
  */
16
- medium?: boolean
17
+ medium?: boolean;
17
18
  /**
18
19
  * Alignment of column content.
19
20
  */
20
- verticalAlign?: "top" | "center"
21
+ verticalAlign?: "top" | "center";
21
22
  /**
22
23
  * Overwrite column sizes by using the original size config of the Carbon grid column.
23
24
  */
24
- carbonSizeConfig?: Pick<ColumnDefaultProps, "max" | "xlg" | "lg" | "md" | "sm">
25
+ carbonSizeConfig?: Pick<ColumnDefaultProps, "max" | "xlg" | "lg" | "md" | "sm">;
25
26
  /**
26
27
  * @deprecated
28
+ * Grid column always uses full width if it is the only column and does not have any othe size config.
27
29
  */
28
- full?: boolean
30
+ full?: boolean;
29
31
  }
30
32
 
31
33
  /**
@@ -34,7 +36,7 @@ export interface GridColumnProps extends Omit<ColumnDefaultProps, "max" | "xlg"
34
36
  */
35
37
  export const GridColumn = ({
36
38
  children,
37
- className = '',
39
+ className = "",
38
40
  small = false,
39
41
  medium = false,
40
42
  full,
@@ -43,8 +45,8 @@ export const GridColumn = ({
43
45
  ...otherProps
44
46
  }: GridColumnProps) => {
45
47
  let sizeConfig = {};
46
- if (small) sizeConfig = { md:2, lg:3 };
47
- if (medium) sizeConfig = { md:3, lg:5 };
48
+ if (small) sizeConfig = { md: 2, lg: 3 };
49
+ if (medium) sizeConfig = { md: 3, lg: 5 };
48
50
  return (
49
51
  <CarbonColumn
50
52
  {...sizeConfig}
@@ -52,13 +54,13 @@ export const GridColumn = ({
52
54
  {...otherProps}
53
55
  className={
54
56
  `${eccgui}-grid__column` +
55
- (verticalAlign ? ` ${eccgui}-grid__column--vertical-` + verticalAlign : '') +
56
- (className ? ' '+className : '')
57
+ (verticalAlign ? ` ${eccgui}-grid__column--vertical-` + verticalAlign : "") +
58
+ (className ? " " + className : "")
57
59
  }
58
60
  >
59
- { children }
61
+ {children}
60
62
  </CarbonColumn>
61
- )
62
- }
63
+ );
64
+ };
63
65
 
64
66
  export default GridColumn;
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
- import BaseIcon, { BaseIconProps } from "./BaseIcon";
3
- import { CarbonIconType } from "./canonicalIconNames"
2
+
4
3
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5
4
 
5
+ import BaseIcon, { BaseIconProps } from "./BaseIcon";
6
+ import { CarbonIconType } from "./canonicalIconNames";
7
+
6
8
  export interface TestIconProps extends Omit<BaseIconProps, "iconComponent"> {
7
9
  /**
8
10
  * Carbon icon that is used instead of the via `name` defined canonical named icon.
@@ -16,24 +18,18 @@ export interface TestIconProps extends Omit<BaseIconProps, "iconComponent"> {
16
18
  * Example usage:
17
19
  * ```
18
20
  * import { LogoReact } from "@carbon/icons-react";
19
- * const testIcon = <TestIcon tryout={LogoReact} />
21
+ * import { TestIcon } from "@eccenca/gui-elements";
22
+ * const testIcon = <TestIcon tryout={LogoReact} />;
20
23
  * ```
21
24
  */
22
- export const TestIcon = ({
23
- className = "",
24
- tryout,
25
- ...otherBaseIconProps
26
- }: TestIconProps) => {
25
+ export const TestIcon = ({ className = "", tryout, ...otherBaseIconProps }: TestIconProps) => {
27
26
  return (
28
27
  <BaseIcon
29
28
  iconComponent={tryout}
30
- className={
31
- `${eccgui}-icon--test` +
32
- (className ? ` ${className}` : "")
33
- }
29
+ className={`${eccgui}-icon--test` + (className ? ` ${className}` : "")}
34
30
  {...otherBaseIconProps}
35
31
  />
36
32
  );
37
- }
33
+ };
38
34
 
39
35
  export default TestIcon;
@@ -45,6 +45,11 @@ export type ValidIconName =
45
45
  | "artefact-workflow"
46
46
  | "data-sourcepath"
47
47
  | "data-targetpath"
48
+ | "data-string"
49
+ | "data-date"
50
+ | "data-time"
51
+ | "data-datetime"
52
+ | "data-number"
48
53
  | "entity-human"
49
54
  | "entity-robot"
50
55
  | "item-add-artefact"
@@ -201,6 +206,11 @@ const canonicalIconNames: Record<ValidIconName, CarbonIconType> = {
201
206
 
202
207
  "data-sourcepath": icons.Data_2,
203
208
  "data-targetpath": icons.Data_1,
209
+ "data-string": icons.StringText,
210
+ "data-date": icons.Calendar,
211
+ "data-time": icons.Time,
212
+ "data-datetime": icons.EventSchedule,
213
+ "data-number": icons.StringInteger,
204
214
 
205
215
  "entity-human": icons.User,
206
216
  "entity-robot": icons.Bot,
@@ -1,12 +1,10 @@
1
1
  import React from "react";
2
- import { ComponentStory, ComponentMeta } from "@storybook/react";
2
+ import { Meta, StoryFn } from "@storybook/react";
3
3
 
4
- import {
5
- Icon,
6
- Button,
7
- } from "../../../index";
8
- import canonicalIcons, { ValidIconName } from "./../canonicalIconNames";
9
4
  import { Definitions } from "../../../common/Intent";
5
+ import { Button, Icon } from "../../../index";
6
+
7
+ import canonicalIcons, { ValidIconName } from "./../canonicalIconNames";
10
8
 
11
9
  export default {
12
10
  title: "Components/Icon",
@@ -14,25 +12,23 @@ export default {
14
12
  argTypes: {
15
13
  name: {
16
14
  control: "select",
17
- options: [...(Object.keys(canonicalIcons))],
15
+ options: [...Object.keys(canonicalIcons)],
18
16
  },
19
17
  intent: {
20
18
  control: "select",
21
- options: {...Definitions},
19
+ options: { ...Definitions },
22
20
  },
23
21
  },
24
- } as ComponentMeta<typeof Icon>;
22
+ } as Meta<typeof Icon>;
25
23
 
26
- const Template: ComponentStory<typeof Icon> = (args) => (
27
- <Icon {...args} tooltipText={args.name?.toString()}/>
28
- );
24
+ const Template: StoryFn<typeof Icon> = (args) => <Icon {...args} tooltipText={args.name?.toString()} />;
29
25
 
30
26
  export const Default = Template.bind({});
31
27
  Default.args = {
32
- name: "undefined"
33
- }
28
+ name: "undefined",
29
+ };
34
30
 
35
- const TemplateSizes: ComponentStory<typeof Icon> = (args) => (
31
+ const TemplateSizes: StoryFn<typeof Icon> = (args) => (
36
32
  <>
37
33
  <Icon {...args} small />
38
34
  <Icon {...args} />
@@ -42,24 +38,15 @@ const TemplateSizes: ComponentStory<typeof Icon> = (args) => (
42
38
 
43
39
  export const IconSizes = TemplateSizes.bind({});
44
40
  IconSizes.args = {
45
- name: "undefined"
46
- }
41
+ name: "undefined",
42
+ };
47
43
 
48
44
  export const IconsOverview = () => {
49
45
  return (
50
46
  <>
51
- {
52
- Object.keys(canonicalIcons).map((iconName) => {
53
- return (
54
- <Button
55
- icon={iconName as ValidIconName}
56
- outlined
57
- large
58
- tooltip={iconName}
59
- />
60
- )
61
- })
62
- }
47
+ {Object.keys(canonicalIcons).map((iconName) => {
48
+ return <Button icon={iconName as ValidIconName} outlined large tooltip={iconName} />;
49
+ })}
63
50
  </>
64
51
  );
65
- }
52
+ };
@@ -1,11 +1,12 @@
1
1
  import React from "react";
2
- import { ComponentStory, ComponentMeta } from "@storybook/react";
3
2
  import { LogoReact } from "@carbon/icons-react";
4
- import { TestIcon } from "../../../index";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
5
  import { Definitions } from "../../../common/Intent";
6
+ import { TestIcon } from "../../../index";
6
7
 
7
8
  export default {
8
- title: "Components/Icon",
9
+ title: "Components/Icon/TestIcon",
9
10
  component: TestIcon,
10
11
  argTypes: {
11
12
  tryout: {
@@ -13,16 +14,14 @@ export default {
13
14
  },
14
15
  intent: {
15
16
  control: "select",
16
- options: {...Definitions},
17
+ options: { ...Definitions },
17
18
  },
18
19
  },
19
- } as ComponentMeta<typeof TestIcon>;
20
+ } as Meta<typeof TestIcon>;
20
21
 
21
- const Template: ComponentStory<typeof TestIcon> = (args) => (
22
- <TestIcon {...args} />
23
- );
22
+ const Template: StoryFn<typeof TestIcon> = (args) => <TestIcon {...args} />;
24
23
 
25
24
  export const TestingAnIcon = Template.bind({});
26
25
  TestingAnIcon.args = {
27
26
  tryout: LogoReact,
28
- }
27
+ };