@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,47 +0,0 @@
1
- import "codemirror/addon/display/placeholder.js";
2
- import "codemirror/mode/sparql/sparql.js";
3
- import React from "react";
4
- import { UnControlled as UnControlledEditor } from "react-codemirror2";
5
- import { Classes as BlueprintClassNames } from "@blueprintjs/core";
6
- import { CLASSPREFIX as eccgui } from "../../configuration/constants.js";
7
- /** A single-line code editor. */
8
- export var SingleLineCodeEditor = function (_a) {
9
- var setEditorInstance = _a.setEditorInstance, onChange = _a.onChange, onCursorChange = _a.onCursorChange, mode = _a.mode, initialValue = _a.initialValue, onFocusChange = _a.onFocusChange, onKeyDown = _a.onKeyDown, onSelection = _a.onSelection, _b = _a.enableTab, enableTab = _b === void 0 ? false : _b, placeholder = _a.placeholder, _c = _a.showScrollBar, showScrollBar = _c === void 0 ? true : _c;
10
- var singleLineInitialContent = React.useRef(initialValue.replace(/[\r\n]/g, " "));
11
- return (React.createElement("div", { className: eccgui + "-singlelinecodeeditor " + BlueprintClassNames.INPUT },
12
- React.createElement(UnControlledEditor, { editorDidMount: function (editor) {
13
- editor.on("beforeChange", function (_, change) {
14
- // Prevent the user from entering new-line characters, since this is supposed to be a one-line editor.
15
- if (change.update && typeof change.update === "function" && change.text.length > 1) {
16
- change.update(change.from, change.to, [change.text.join("")]);
17
- }
18
- return true;
19
- });
20
- setEditorInstance(editor);
21
- }, value: singleLineInitialContent.current, onFocus: function () { return onFocusChange(true); }, onBlur: function () { return onFocusChange(false); }, options: {
22
- mode: mode,
23
- lineNumbers: false,
24
- theme: "xq-light",
25
- extraKeys: enableTab ? undefined : { Tab: false },
26
- placeholder: placeholder,
27
- scrollbarStyle: showScrollBar ? "native" : "null"
28
- }, onSelection: function (_editor, data) {
29
- if (Array.isArray(data === null || data === void 0 ? void 0 : data.ranges)) {
30
- onSelection(data.ranges
31
- .map(function (r) { return ({ from: r.from().ch, to: r.to().ch }); })
32
- .filter(function (r) { return r.from !== r.to; }));
33
- }
34
- }, onCursor: function (editor, data) {
35
- onCursorChange(data, editor.cursorCoords(true, "local"), editor.getScrollInfo());
36
- }, onBeforeChange: function (_editor, data, _, next) {
37
- // Reduce multiple lines to a single line
38
- if (data.text.length > 1) {
39
- _editor.setValue(data.text.join(""));
40
- }
41
- next();
42
- }, onChange: function (_editor, _data, value) {
43
- onChange(value);
44
- }, onKeyDown: function (_, event) { return onKeyDown(event); } })));
45
- };
46
- export default SingleLineCodeEditor;
47
- //# sourceMappingURL=SingleLineCodeEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SingleLineCodeEditor.js","sourceRoot":"","sources":["../../../../src/components/AutoSuggestion/SingleLineCodeEditor.tsx"],"names":[],"mappings":"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"}
@@ -1,110 +0,0 @@
1
- import "codemirror/addon/display/placeholder.js"
2
- import "codemirror/mode/sparql/sparql.js";
3
- import React from "react";
4
- import {UnControlled as UnControlledEditor} from "react-codemirror2";
5
- import {Classes as BlueprintClassNames} from "@blueprintjs/core";
6
- import {Editor as CodeMirrorEditor} from "codemirror";
7
- import {CLASSPREFIX as eccgui} from "../../configuration/constants";
8
-
9
- export interface IRange {
10
- from: number
11
- to: number
12
- }
13
-
14
- export interface SingleLineCodeEditorProps {
15
- // Is called with the editor instance that allows access via the CodeMirror API
16
- setEditorInstance: (editor: CodeMirrorEditor) => any
17
- // Called whenever the editor content changes
18
- onChange: (value: string) => any
19
- // Called when the cursor position changes
20
- onCursorChange: (pos: any, coords: any, scrollinfo: any) => any
21
- // The editor theme, e.g. "sparql"
22
- mode?: string
23
- // The initial value of the editor
24
- initialValue: string
25
- // Called when the focus status changes
26
- onFocusChange: (focused: boolean) => any
27
- // Called when the user presses a key
28
- onKeyDown: (event: KeyboardEvent) => any
29
- // Called when the user selects text
30
- onSelection: (ranges: IRange[]) => any
31
- // If the <Tab> key is enabled as normal input, i.e. it won't have the behavior of changing to the next input element, expected in a web app.
32
- enableTab?: boolean
33
- /** Placeholder tobe shown when no text has been entered, yet. */
34
- placeholder?: string
35
- showScrollBar?: boolean
36
- }
37
-
38
- export type IEditorProps = SingleLineCodeEditorProps;
39
-
40
- /** A single-line code editor. */
41
- export const SingleLineCodeEditor = ({
42
- setEditorInstance,
43
- onChange,
44
- onCursorChange,
45
- mode,
46
- initialValue,
47
- onFocusChange,
48
- onKeyDown,
49
- onSelection,
50
- enableTab = false,
51
- placeholder,
52
- showScrollBar = true
53
- }: SingleLineCodeEditorProps) => {
54
- const singleLineInitialContent = React.useRef(initialValue.replace(/[\r\n]/g, " "))
55
- return (
56
- <div className={`${eccgui}-singlelinecodeeditor ${BlueprintClassNames.INPUT}`}>
57
- <UnControlledEditor
58
- editorDidMount={(editor: any) => {
59
- editor.on("beforeChange", (_: any, change: any) => {
60
- // Prevent the user from entering new-line characters, since this is supposed to be a one-line editor.
61
- if (change.update && typeof change.update === "function" && change.text.length > 1) {
62
- change.update(change.from, change.to, [change.text.join("")]);
63
- }
64
- return true;
65
- });
66
- setEditorInstance(editor);
67
- }}
68
- value={singleLineInitialContent.current}
69
- onFocus={() => onFocusChange(true)}
70
- onBlur={() => onFocusChange(false)}
71
- options={{
72
- mode: mode,
73
- lineNumbers: false,
74
- theme: "xq-light",
75
- extraKeys: enableTab ? undefined : {Tab: false},
76
- placeholder,
77
- scrollbarStyle: showScrollBar ? "native" : "null"
78
- }}
79
- onSelection={(_editor, data) => {
80
- if(Array.isArray(data?.ranges)) {
81
- onSelection(data.ranges
82
- .map((r: any) => ({from: r.from().ch, to: r.to().ch}))
83
- .filter((r: any) => r.from !== r.to))
84
- }
85
- }}
86
- onCursor={(editor, data) => {
87
- onCursorChange(
88
- data,
89
- editor.cursorCoords(true, "local"),
90
- editor.getScrollInfo()
91
- );
92
- }}
93
- onBeforeChange={(_editor, data, _, next) => {
94
- // Reduce multiple lines to a single line
95
- if (data.text.length > 1) {
96
- _editor.setValue(data.text.join(""))
97
- }
98
- next()
99
- }}
100
- onChange={(_editor, _data, value) => {
101
- onChange(value);
102
- }
103
- }
104
- onKeyDown={(_, event) => onKeyDown(event)}
105
- />
106
- </div>
107
- );
108
- };
109
-
110
- export default SingleLineCodeEditor;