@eccenca/gui-elements 23.3.1 → 23.4.0-rc.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 (110) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +61 -19
  3. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  4. package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js +4 -18
  5. package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
  6. package/dist/cjs/components/AutoSuggestion/ExtendedCodeEditor.js +65 -0
  7. package/dist/cjs/components/AutoSuggestion/ExtendedCodeEditor.js.map +1 -0
  8. package/dist/cjs/components/AutoSuggestion/index.js +3 -3
  9. package/dist/cjs/components/AutoSuggestion/index.js.map +1 -1
  10. package/dist/cjs/components/Card/CardHeader.js +19 -18
  11. package/dist/cjs/components/Card/CardHeader.js.map +1 -1
  12. package/dist/cjs/components/Grid/GridColumn.js +3 -3
  13. package/dist/cjs/components/Grid/GridColumn.js.map +1 -1
  14. package/dist/cjs/components/PropertyValuePair/PropertyName.js +4 -2
  15. package/dist/cjs/components/PropertyValuePair/PropertyName.js.map +1 -1
  16. package/dist/cjs/components/PropertyValuePair/PropertyValue.js +6 -4
  17. package/dist/cjs/components/PropertyValuePair/PropertyValue.js.map +1 -1
  18. package/dist/cjs/components/PropertyValuePair/PropertyValuePair.js +13 -3
  19. package/dist/cjs/components/PropertyValuePair/PropertyValuePair.js.map +1 -1
  20. package/dist/cjs/components/Skeleton/Skeleton.js +30 -0
  21. package/dist/cjs/components/Skeleton/Skeleton.js.map +1 -0
  22. package/dist/cjs/components/Skeleton/classnames.js +6 -0
  23. package/dist/cjs/components/Skeleton/classnames.js.map +1 -0
  24. package/dist/cjs/components/Table/TableCell.js +3 -2
  25. package/dist/cjs/components/Table/TableCell.js.map +1 -1
  26. package/dist/cjs/components/TextField/useTextValidation.js.map +1 -1
  27. package/dist/cjs/components/index.js +1 -0
  28. package/dist/cjs/components/index.js.map +1 -1
  29. package/dist/cjs/index.js +2 -0
  30. package/dist/cjs/index.js.map +1 -1
  31. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +82 -40
  32. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  33. package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js +6 -20
  34. package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
  35. package/dist/esm/components/AutoSuggestion/ExtendedCodeEditor.js +70 -0
  36. package/dist/esm/components/AutoSuggestion/ExtendedCodeEditor.js.map +1 -0
  37. package/dist/esm/components/AutoSuggestion/index.js +2 -2
  38. package/dist/esm/components/AutoSuggestion/index.js.map +1 -1
  39. package/dist/esm/components/Card/CardHeader.js +15 -14
  40. package/dist/esm/components/Card/CardHeader.js.map +1 -1
  41. package/dist/esm/components/Grid/GridColumn.js +3 -3
  42. package/dist/esm/components/Grid/GridColumn.js.map +1 -1
  43. package/dist/esm/components/PropertyValuePair/PropertyName.js +4 -2
  44. package/dist/esm/components/PropertyValuePair/PropertyName.js.map +1 -1
  45. package/dist/esm/components/PropertyValuePair/PropertyValue.js +6 -4
  46. package/dist/esm/components/PropertyValuePair/PropertyValue.js.map +1 -1
  47. package/dist/esm/components/PropertyValuePair/PropertyValuePair.js +13 -3
  48. package/dist/esm/components/PropertyValuePair/PropertyValuePair.js.map +1 -1
  49. package/dist/esm/components/Skeleton/Skeleton.js +24 -0
  50. package/dist/esm/components/Skeleton/Skeleton.js.map +1 -0
  51. package/dist/esm/components/Skeleton/classnames.js +3 -0
  52. package/dist/esm/components/Skeleton/classnames.js.map +1 -0
  53. package/dist/esm/components/Table/TableCell.js +4 -3
  54. package/dist/esm/components/Table/TableCell.js.map +1 -1
  55. package/dist/esm/components/TextField/useTextValidation.js.map +1 -1
  56. package/dist/esm/components/index.js +1 -0
  57. package/dist/esm/components/index.js.map +1 -1
  58. package/dist/esm/index.js +2 -0
  59. package/dist/esm/index.js.map +1 -1
  60. package/dist/types/components/AutoSuggestion/AutoSuggestion.d.ts +8 -2
  61. package/dist/types/components/AutoSuggestion/AutoSuggestionList.d.ts +6 -4
  62. package/dist/types/components/AutoSuggestion/{SingleLineCodeEditor.d.ts → ExtendedCodeEditor.d.ts} +7 -4
  63. package/dist/types/components/AutoSuggestion/index.d.ts +3 -3
  64. package/dist/types/components/Card/CardHeader.d.ts +2 -2
  65. package/dist/types/components/Grid/GridColumn.d.ts +1 -0
  66. package/dist/types/components/PropertyValuePair/PropertyName.d.ts +7 -1
  67. package/dist/types/components/PropertyValuePair/PropertyValue.d.ts +7 -1
  68. package/dist/types/components/PropertyValuePair/PropertyValuePair.d.ts +5 -1
  69. package/dist/types/components/Skeleton/Skeleton.d.ts +13 -0
  70. package/dist/types/components/Skeleton/classnames.d.ts +1 -0
  71. package/dist/types/components/Table/TableCell.d.ts +7 -2
  72. package/dist/types/components/TextField/useTextValidation.d.ts +1 -0
  73. package/dist/types/components/index.d.ts +1 -0
  74. package/dist/types/index.d.ts +3 -0
  75. package/package.json +1 -1
  76. package/src/components/AutoSuggestion/AutoSuggestion.tsx +84 -31
  77. package/src/components/AutoSuggestion/AutoSuggestionList.tsx +11 -42
  78. package/src/components/AutoSuggestion/ExtendedCodeEditor.tsx +129 -0
  79. package/src/components/AutoSuggestion/index.ts +3 -11
  80. package/src/components/AutoSuggestion/tests/AutoSuggestionList.test.tsx +83 -84
  81. package/src/components/AutoSuggestion/tests/{SingleLineCodeEditor.test.tsx → ExtendedCodeEditor.test.tsx} +7 -7
  82. package/src/components/Card/CardHeader.tsx +23 -25
  83. package/src/components/Grid/GridColumn.tsx +15 -13
  84. package/src/components/Pagination/pagination.scss +6 -1
  85. package/src/components/PropertyValuePair/PropertyName.tsx +21 -2
  86. package/src/components/PropertyValuePair/PropertyValue.tsx +21 -5
  87. package/src/components/PropertyValuePair/PropertyValuePair.tsx +23 -4
  88. package/src/components/PropertyValuePair/propertyvalue.scss +6 -1
  89. package/src/components/PropertyValuePair/stories/PropertyName.stories.tsx +18 -0
  90. package/src/components/PropertyValuePair/stories/PropertyValue.stories.tsx +18 -0
  91. package/src/components/PropertyValuePair/stories/PropertyValueList.stories.tsx +33 -0
  92. package/src/components/PropertyValuePair/stories/PropertyValuePair.stories.tsx +29 -0
  93. package/src/components/Skeleton/Skeleton.stories.tsx +29 -0
  94. package/src/components/Skeleton/Skeleton.tsx +32 -0
  95. package/src/components/Skeleton/classnames.ts +3 -0
  96. package/src/components/Skeleton/skeleton.scss +1 -0
  97. package/src/components/Table/TableCell.tsx +12 -8
  98. package/src/components/Table/stories/TableCell.stories.tsx +30 -0
  99. package/src/components/Table/table.scss +96 -50
  100. package/src/components/TextField/stories/TextField.stories.tsx +21 -18
  101. package/src/components/TextField/useTextValidation.ts +82 -68
  102. package/src/components/index.scss +1 -0
  103. package/src/components/index.ts +1 -0
  104. package/src/extensions/codemirror/_codemirror.scss +1 -0
  105. package/src/index.ts +2 -0
  106. package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js +0 -53
  107. package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js.map +0 -1
  108. package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js +0 -47
  109. package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js.map +0 -1
  110. 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;
@@ -6,8 +6,8 @@ $eccgui-color-pagination-text: $eccgui-color-workspace-text !default;
6
6
  $eccgui-size-typo-pagination: $eccgui-size-typo-caption !default;
7
7
 
8
8
  .#{$prefix}--pagination {
9
- background-color: $eccgui-color-pagination-background;
10
9
  font-size: $eccgui-size-typo-pagination;
10
+ background-color: $eccgui-color-pagination-background;
11
11
 
12
12
  .#{$prefix}--form-item,
13
13
  .#{$prefix}--select-input {
@@ -29,6 +29,11 @@ span.#{$prefix}--pagination__text {
29
29
  }
30
30
  }
31
31
 
32
+ .#{$prefix}--pagination__button--no-index {
33
+ // TODO: revalidate if this is still necessary using the latest version of carbon lib
34
+ color: rgba($eccgui-color-workspace-text, $eccgui-opacity-disabled);
35
+ }
36
+
32
37
  .#{$eccgui}-pagination--hideinfotext {
33
38
  .#{$prefix}--pagination__left > .#{$prefix}--pagination__text:last-child {
34
39
  display: none;
@@ -2,12 +2,19 @@ import React from "react";
2
2
 
3
3
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
4
4
  import Label, { LabelProps } from "../Label/Label";
5
+ import OverflowText from "../Typography/OverflowText";
5
6
 
6
7
  export interface PropertyNameProps extends React.HTMLAttributes<HTMLElement> {
7
8
  /**
8
9
  * Increase or decrease the width used for the property name.
9
10
  */
10
11
  size?: "small" | "medium" | "large";
12
+ /**
13
+ * Force label to get displayed without line breaks.
14
+ * This works best if you use a simple string as content.
15
+ * Otherwise you may need to take care yourself about it.
16
+ */
17
+ nowrap?: boolean;
11
18
  /**
12
19
  * Additional label properties, e.g. `tooltip`.
13
20
  * It is only used if the `PropertyName` has simple text input.
@@ -15,19 +22,31 @@ export interface PropertyNameProps extends React.HTMLAttributes<HTMLElement> {
15
22
  labelProps?: LabelProps;
16
23
  }
17
24
 
18
- export const PropertyName = ({ className = "", size, children, labelProps, ...otherDtProps }: PropertyNameProps) => {
25
+ export const PropertyName = ({
26
+ children,
27
+ className = "",
28
+ size,
29
+ nowrap,
30
+ labelProps,
31
+ ...otherDtProps
32
+ }: PropertyNameProps) => {
19
33
  return (
20
34
  <dt
21
35
  className={
22
36
  `${eccgui}-propertyvalue__property` +
23
37
  (size ? ` ${eccgui}-propertyvalue__property--${size}` : "") +
38
+ (nowrap ? ` ${eccgui}-propertyvalue__property--nowrap` : "") +
24
39
  (className ? " " + className : "")
25
40
  }
26
41
  {...otherDtProps}
27
42
  >
28
43
  <div>
29
44
  {typeof children === "string" ? (
30
- <Label text={children} isLayoutForElement="span" {...labelProps} />
45
+ <Label
46
+ text={nowrap ? <OverflowText inline>{children}</OverflowText> : children}
47
+ isLayoutForElement="span"
48
+ {...labelProps}
49
+ />
31
50
  ) : (
32
51
  children
33
52
  )}
@@ -1,14 +1,30 @@
1
1
  import React from "react";
2
+
2
3
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
4
+ import OverflowText from "../Typography/OverflowText";
3
5
 
4
- export interface PropertyValueProps extends React.HTMLAttributes<HTMLElement> {};
6
+ export interface PropertyValueProps extends React.HTMLAttributes<HTMLElement> {
7
+ /**
8
+ * Force value to get displayed without line breaks.
9
+ * This works best if you use a string or inline element as content.
10
+ * Otherwise you may need to take care yourself about it.
11
+ */
12
+ nowrap?: boolean;
13
+ }
5
14
 
6
- export const PropertyValue = ({ className = "", children, ...otherProps }: PropertyValueProps) => {
15
+ export const PropertyValue = ({ children, className = "", nowrap, ...otherDdProps }: PropertyValueProps) => {
7
16
  return (
8
- <dd className={`${eccgui}-propertyvalue__value` + (className ? " " + className : "")} {...otherProps}>
9
- <div>{children}</div>
17
+ <dd
18
+ className={
19
+ `${eccgui}-propertyvalue__value` +
20
+ (nowrap ? ` ${eccgui}-propertyvalue__value--nowrap` : "") +
21
+ (className ? " " + className : "")
22
+ }
23
+ {...otherDdProps}
24
+ >
25
+ <div>{nowrap ? <OverflowText passDown>{children}</OverflowText> : children}</div>
10
26
  </dd>
11
27
  );
12
- }
28
+ };
13
29
 
14
30
  export default PropertyValue;
@@ -1,6 +1,10 @@
1
1
  import React from "react";
2
+
2
3
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
3
4
 
5
+ import PropertyName from "./PropertyName";
6
+ import PropertyValue from "./PropertyValue";
7
+
4
8
  export interface PropertyValuePairProps extends React.HTMLAttributes<HTMLDivElement> {
5
9
  /**
6
10
  * Add a bit white space to the bottom of the element.
@@ -10,15 +14,30 @@ export interface PropertyValuePairProps extends React.HTMLAttributes<HTMLDivElem
10
14
  * Add a horizontal rule to the bottom of the element.
11
15
  */
12
16
  hasDivider?: boolean;
13
- };
17
+ /**
18
+ * Forward the `nowrap` option to it `PropertyName` and `PropertyValue` children.
19
+ */
20
+ nowrap?: boolean;
21
+ }
14
22
 
15
23
  export const PropertyValuePair = ({
16
- className = "",
17
24
  children,
25
+ className = "",
26
+ nowrap,
18
27
  hasSpacing = false,
19
28
  hasDivider = false,
20
29
  ...otherProps
21
30
  }: PropertyValuePairProps) => {
31
+ const alteredChildren = nowrap
32
+ ? React.Children.map(children, (child) => {
33
+ const originalChild = child as React.ReactElement;
34
+ if (originalChild.type && (originalChild.type === PropertyName || originalChild.type === PropertyValue)) {
35
+ return React.cloneElement(originalChild, { nowrap: true });
36
+ }
37
+ return child;
38
+ })
39
+ : children;
40
+
22
41
  return (
23
42
  <div
24
43
  className={
@@ -29,9 +48,9 @@ export const PropertyValuePair = ({
29
48
  }
30
49
  {...otherProps}
31
50
  >
32
- {children}
51
+ {alteredChildren}
33
52
  </div>
34
53
  );
35
- }
54
+ };
36
55
 
37
56
  export default PropertyValuePair;
@@ -6,7 +6,7 @@
6
6
 
7
7
  .#{$eccgui}-propertyvalue__pair {
8
8
  display: block;
9
- max-width: 100%;
9
+ width: 100%;
10
10
  clear: both;
11
11
 
12
12
  &.#{$eccgui}-propertyvalue__pair--hasdivider {
@@ -63,6 +63,11 @@
63
63
  }
64
64
  }
65
65
 
66
+ .#{$eccgui}-propertyvalue__property--nowrap {
67
+ overflow: visible;
68
+ white-space: nowrap;
69
+ }
70
+
66
71
  .#{$eccgui}-propertyvalue__value {
67
72
  box-sizing: content-box;
68
73
  margin-left: math.div(3, 16) * 100%;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { loremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { PropertyName } from "../../../index";
6
+
7
+ export default {
8
+ title: "Components/PropertyValuePair/Name",
9
+ component: PropertyName,
10
+ argTypes: {},
11
+ } as Meta<typeof PropertyName>;
12
+
13
+ const Template: StoryFn<typeof PropertyName> = (args) => <PropertyName {...args} />;
14
+
15
+ export const Default = Template.bind({});
16
+ Default.args = {
17
+ children: loremIpsum({ p: 1, avgSentencesPerParagraph: 1, avgWordsPerSentence: 4, random: false }).toString(),
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { loremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { PropertyValue } from "../../../index";
6
+
7
+ export default {
8
+ title: "Components/PropertyValuePair/Value",
9
+ component: PropertyValue,
10
+ argTypes: {},
11
+ } as Meta<typeof PropertyValue>;
12
+
13
+ const Template: StoryFn<typeof PropertyValue> = (args) => <PropertyValue {...args} />;
14
+
15
+ export const Default = Template.bind({});
16
+ Default.args = {
17
+ children: loremIpsum({ p: 3, avgSentencesPerParagraph: 5, avgWordsPerSentence: 8, random: false }).toString(),
18
+ };