@eccenca/gui-elements 25.0.0 → 25.1.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.
- package/CHANGELOG.md +39 -0
- package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js +1 -3
- package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
- package/dist/cjs/cmem/ContentBlobToggler/ContentBlobToggler.js +1 -0
- package/dist/cjs/cmem/ContentBlobToggler/ContentBlobToggler.js.map +1 -1
- package/dist/cjs/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.js +34 -11
- package/dist/cjs/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.js.map +1 -1
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlowV12.js.map +1 -1
- package/dist/cjs/common/Intent/index.js +1 -1
- package/dist/cjs/common/Intent/index.js.map +1 -1
- package/dist/cjs/components/Application/ApplicationViewability.js +33 -0
- package/dist/cjs/components/Application/ApplicationViewability.js.map +1 -0
- package/dist/cjs/components/Application/index.js +1 -0
- package/dist/cjs/components/Application/index.js.map +1 -1
- package/dist/cjs/components/Icon/IconButton.js.map +1 -1
- package/dist/cjs/components/Typography/InlineText.js +29 -0
- package/dist/cjs/components/Typography/InlineText.js.map +1 -0
- package/dist/cjs/components/Typography/index.js +1 -0
- package/dist/cjs/components/Typography/index.js.map +1 -1
- package/dist/cjs/extensions/codemirror/CodeMirror.js +2 -2
- package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/cjs/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js +1 -1
- package/dist/cjs/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js.map +1 -1
- package/dist/cjs/extensions/codemirror/tests/codemirrorTestHelper.js +2 -2
- package/dist/cjs/extensions/codemirror/tests/codemirrorTestHelper.js.map +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeNew.js +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeNew.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/minimap/MiniMap.js +1 -1
- package/dist/cjs/extensions/react-flow/minimap/MiniMap.js.map +1 -1
- package/dist/cjs/extensions/react-flow/minimap/MiniMapV12.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/nodeUtils.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/SilkActivityControl.js +1 -3
- package/dist/esm/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
- package/dist/esm/cmem/ContentBlobToggler/ContentBlobToggler.js +1 -0
- package/dist/esm/cmem/ContentBlobToggler/ContentBlobToggler.js.map +1 -1
- package/dist/esm/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.js +32 -9
- package/dist/esm/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.js.map +1 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlowV12.js.map +1 -1
- package/dist/esm/common/Intent/index.js +1 -1
- package/dist/esm/common/Intent/index.js.map +1 -1
- package/dist/esm/components/Application/ApplicationViewability.js +28 -0
- package/dist/esm/components/Application/ApplicationViewability.js.map +1 -0
- package/dist/esm/components/Application/index.js +1 -0
- package/dist/esm/components/Application/index.js.map +1 -1
- package/dist/esm/components/Icon/IconButton.js.map +1 -1
- package/dist/esm/components/Typography/InlineText.js +33 -0
- package/dist/esm/components/Typography/InlineText.js.map +1 -0
- package/dist/esm/components/Typography/index.js +1 -0
- package/dist/esm/components/Typography/index.js.map +1 -1
- package/dist/esm/extensions/codemirror/CodeMirror.js +3 -3
- package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/esm/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js +1 -1
- package/dist/esm/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js.map +1 -1
- package/dist/esm/extensions/codemirror/tests/codemirrorTestHelper.js +3 -3
- package/dist/esm/extensions/codemirror/tests/codemirrorTestHelper.js.map +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeNew.js +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeNew.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/minimap/MiniMap.js +1 -1
- package/dist/esm/extensions/react-flow/minimap/MiniMap.js.map +1 -1
- package/dist/esm/extensions/react-flow/minimap/MiniMapV12.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/nodeUtils.js.map +1 -1
- package/dist/types/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.d.ts +26 -10
- package/dist/types/components/Application/ApplicationViewability.d.ts +36 -0
- package/dist/types/components/Application/index.d.ts +1 -0
- package/dist/types/components/Icon/IconButton.d.ts +1 -1
- package/dist/types/components/Structure/TitleSubsection.d.ts +1 -1
- package/dist/types/components/Tabs/Tab.d.ts +2 -2
- package/dist/types/components/Typography/InlineText.d.ts +13 -0
- package/dist/types/components/Typography/index.d.ts +1 -0
- package/dist/types/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.d.ts +1 -1
- package/dist/types/extensions/codemirror/tests/codemirrorTestHelper.d.ts +1 -1
- package/package.json +50 -51
- package/src/cmem/ActivityControl/SilkActivityControl.tsx +1 -1
- package/src/cmem/ContentBlobToggler/ContentBlobToggler.tsx +1 -1
- package/src/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.tsx +66 -18
- package/src/cmem/ContentBlobToggler/stories/StringPreviewContentBlobToggler.stories.tsx +27 -0
- package/src/cmem/ContentBlobToggler/tests/StringPreviewContentBlobToggler.test.tsx +98 -0
- package/src/cmem/react-flow/ReactFlow/ReactFlowV12.tsx +1 -0
- package/src/common/Intent/index.ts +2 -1
- package/src/components/Application/ApplicationViewability.tsx +61 -0
- package/src/components/Application/_content.scss +7 -0
- package/src/components/Application/_header.scss +12 -3
- package/src/components/Application/_viewability.scss +13 -0
- package/src/components/Application/application.scss +1 -0
- package/src/components/Application/index.ts +1 -0
- package/src/components/Application/stories/ApplicationViewability.stories.tsx +37 -0
- package/src/components/Application/tests/ApplicationViewability.test.tsx +43 -0
- package/src/components/AutoSuggestion/tests/ExtendedCodeEditor.test.tsx +1 -1
- package/src/components/Card/card.scss +6 -0
- package/src/components/Checkbox/checkbox.scss +14 -2
- package/src/components/ContentGroup/_contentgroup.scss +9 -0
- package/src/components/Depiction/depiction.scss +6 -0
- package/src/components/FlexibleLayout/flexiblelayout.scss +16 -0
- package/src/components/Grid/grid.scss +17 -0
- package/src/components/Grid/stories/Grid.stories.tsx +10 -7
- package/src/components/Grid/stories/GridRow.stories.tsx +13 -7
- package/src/components/Icon/IconButton.tsx +1 -1
- package/src/components/Notification/notification.scss +6 -0
- package/src/components/OverviewItem/overviewitem.scss +9 -0
- package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +28 -0
- package/src/components/OverviewItem/stories/OverviewItemActions.stories.tsx +2 -2
- package/src/components/OverviewItem/stories/OverviewItemDescription.stories.tsx +1 -1
- package/src/components/OverviewItem/stories/OverviewItemLine.stories.tsx +1 -1
- package/src/components/PropertyValuePair/propertyvalue.scss +23 -1
- package/src/components/Separation/separation.scss +6 -0
- package/src/components/Table/table.scss +22 -0
- package/src/components/Tabs/stories/TabTitle.stories.tsx +7 -2
- package/src/components/Tag/stories/TagList.stories.tsx +2 -2
- package/src/components/Tag/tag.scss +19 -9
- package/src/components/TextReducer/TextReducer.test.tsx +3 -3
- package/src/components/Typography/InlineText.tsx +24 -0
- package/src/components/Typography/_reset.scss +1 -0
- package/src/components/Typography/index.ts +1 -0
- package/src/components/Typography/stories/InlineText.stories.tsx +27 -0
- package/src/components/Typography/typography.scss +28 -2
- package/src/extensions/codemirror/CodeMirror.tsx +4 -4
- package/src/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.ts +1 -2
- package/src/extensions/codemirror/tests/codemirrorTestHelper.ts +3 -3
- package/src/extensions/react-flow/edges/EdgeNew.tsx +2 -1
- package/src/extensions/react-flow/handles/HandleDefault.tsx +2 -2
- package/src/extensions/react-flow/minimap/MiniMap.tsx +2 -1
- package/src/extensions/react-flow/minimap/MiniMapV12.tsx +1 -1
- package/src/extensions/react-flow/nodes/_nodes.scss +4 -3
- package/src/extensions/react-flow/nodes/nodeUtils.tsx +1 -0
- package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +2 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type media = "print" | "screen";
|
|
3
|
+
interface ApplicationViewabilityShow {
|
|
4
|
+
/**
|
|
5
|
+
* Show on media type.
|
|
6
|
+
* If used, `hide` cannot be set.
|
|
7
|
+
*/
|
|
8
|
+
show: media;
|
|
9
|
+
hide?: never;
|
|
10
|
+
}
|
|
11
|
+
interface ApplicationViewabilityHide {
|
|
12
|
+
/**
|
|
13
|
+
* Hide on media type.
|
|
14
|
+
* If used, `show` cannot be set.
|
|
15
|
+
*/
|
|
16
|
+
hide: media;
|
|
17
|
+
show?: never;
|
|
18
|
+
}
|
|
19
|
+
interface ApplicationViewabilityUndecided {
|
|
20
|
+
/**
|
|
21
|
+
* Only one child allowed.
|
|
22
|
+
* Need to process the `className` property.
|
|
23
|
+
*/
|
|
24
|
+
children: React.ReactElement<{
|
|
25
|
+
className?: string;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export type ApplicationViewabilityProps = ApplicationViewabilityUndecided & (ApplicationViewabilityShow | ApplicationViewabilityHide);
|
|
29
|
+
/**
|
|
30
|
+
* Sets the viewability of the the contained element regarding media.
|
|
31
|
+
* Can be used to hide elements, e.g. when the page is printed.
|
|
32
|
+
*/
|
|
33
|
+
export declare const ApplicationViewability: ({ children, show, hide }: ApplicationViewabilityProps) => React.ReactElement<{
|
|
34
|
+
className?: string;
|
|
35
|
+
}, string | React.JSXElementConstructor<any>>;
|
|
36
|
+
export default ApplicationViewability;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ButtonProps } from "../Button/Button";
|
|
3
|
+
import { TestableComponent } from "../interfaces";
|
|
3
4
|
import { ValidIconName } from "./canonicalIconNames";
|
|
4
5
|
import { TestIconProps } from "./TestIcon";
|
|
5
|
-
import { TestableComponent } from "../interfaces";
|
|
6
6
|
interface ExtendedButtonProps extends Omit<ButtonProps, "name" | "icon" | "rightIcon" | "text" | "minimal" | "tooltip">, TestableComponent {
|
|
7
7
|
/**
|
|
8
8
|
* Canonical icon name, or an array of strings.
|
|
@@ -132,7 +132,7 @@ export declare const TitleSubsection: ({ children, className, useHtmlElement, ..
|
|
|
132
132
|
onBlurCapture?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
133
133
|
onChange?: React.FormEventHandler<HTMLElement> | undefined;
|
|
134
134
|
onChangeCapture?: React.FormEventHandler<HTMLElement> | undefined;
|
|
135
|
-
onBeforeInput?: React.
|
|
135
|
+
onBeforeInput?: React.InputEventHandler<HTMLElement> | undefined;
|
|
136
136
|
onBeforeInputCapture?: React.FormEventHandler<HTMLElement> | undefined;
|
|
137
137
|
onInput?: React.FormEventHandler<HTMLElement> | undefined;
|
|
138
138
|
onInputCapture?: React.FormEventHandler<HTMLElement> | undefined;
|
|
@@ -154,7 +154,7 @@ export declare const transformTabProperties: ({ title, dontShrink, className, ba
|
|
|
154
154
|
onBlurCapture?: React.FocusEventHandler<HTMLDivElement> | undefined;
|
|
155
155
|
onChange?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
156
156
|
onChangeCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
157
|
-
onBeforeInput?: React.
|
|
157
|
+
onBeforeInput?: React.InputEventHandler<HTMLDivElement> | undefined;
|
|
158
158
|
onBeforeInputCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
159
159
|
onInput?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
160
160
|
onInputCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
@@ -432,7 +432,7 @@ export declare const transformTabProperties: ({ title, dontShrink, className, ba
|
|
|
432
432
|
onBlurCapture?: React.FocusEventHandler<HTMLDivElement> | undefined;
|
|
433
433
|
onChange?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
434
434
|
onChangeCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
435
|
-
onBeforeInput?: React.
|
|
435
|
+
onBeforeInput?: React.InputEventHandler<HTMLDivElement> | undefined;
|
|
436
436
|
onBeforeInputCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
437
437
|
onInput?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
438
438
|
onInputCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TestableComponent } from "../interfaces";
|
|
3
|
+
export interface InlineTextProps extends React.HTMLAttributes<HTMLElement>, TestableComponent {
|
|
4
|
+
/**
|
|
5
|
+
* Additional CSS class name.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Forces all children to be displayed as inline content.
|
|
11
|
+
*/
|
|
12
|
+
export declare const InlineText: ({ className, children, ...otherProps }: InlineTextProps) => React.JSX.Element;
|
|
13
|
+
export default InlineText;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { html } from "@codemirror/lang-html";
|
|
1
2
|
import { javascript } from "@codemirror/lang-javascript";
|
|
2
3
|
import { json } from "@codemirror/lang-json";
|
|
3
4
|
import { markdown } from "@codemirror/lang-markdown";
|
|
4
5
|
import { sql } from "@codemirror/lang-sql";
|
|
5
6
|
import { xml } from "@codemirror/lang-xml";
|
|
6
7
|
import { yaml } from "@codemirror/lang-yaml";
|
|
7
|
-
import { html } from "@codemirror/lang-html";
|
|
8
8
|
import { StreamParser } from "@codemirror/language";
|
|
9
9
|
declare const supportedModes: {
|
|
10
10
|
readonly markdown: typeof markdown;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 'EditorView is not a constructor'
|
|
6
6
|
* This errors do not exist during compilation only during testing.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { Compartment, Extension } from "@codemirror/state";
|
|
9
9
|
/** placeholder extension, current error '_view.placeholder is not a function' */
|
|
10
10
|
export declare const adaptedPlaceholder: (text?: string) => Extension;
|
|
11
11
|
/** current error '_view.Editor is not a constructor' */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eccenca/gui-elements",
|
|
3
3
|
"description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
|
|
4
|
-
"version": "25.0.0",
|
|
4
|
+
"version": "25.1.0-rc.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/eccenca/gui-elements",
|
|
7
7
|
"bugs": "https://github.com/eccenca/gui-elements/issues",
|
|
@@ -68,29 +68,29 @@
|
|
|
68
68
|
"autolint:all": "yarn autolint:scripts && yarn autolint:styles && yarn autolint:prettier"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@blueprintjs/colors": "^5.1.
|
|
72
|
-
"@blueprintjs/core": "^5.
|
|
73
|
-
"@blueprintjs/select": "^5.3.
|
|
74
|
-
"@carbon/icons": "^11.
|
|
75
|
-
"@carbon/react": "^1.
|
|
76
|
-
"@codemirror/lang-html": "^6.4.
|
|
77
|
-
"@codemirror/lang-javascript": "^6.2.
|
|
78
|
-
"@codemirror/lang-json": "^6.0.
|
|
79
|
-
"@codemirror/lang-markdown": "^6.
|
|
80
|
-
"@codemirror/lang-sql": "^6.
|
|
71
|
+
"@blueprintjs/colors": "^5.1.11",
|
|
72
|
+
"@blueprintjs/core": "^5.19.1",
|
|
73
|
+
"@blueprintjs/select": "^5.3.21",
|
|
74
|
+
"@carbon/icons": "^11.70.0",
|
|
75
|
+
"@carbon/react": "^1.96.0",
|
|
76
|
+
"@codemirror/lang-html": "^6.4.11",
|
|
77
|
+
"@codemirror/lang-javascript": "^6.2.4",
|
|
78
|
+
"@codemirror/lang-json": "^6.0.2",
|
|
79
|
+
"@codemirror/lang-markdown": "^6.5.0",
|
|
80
|
+
"@codemirror/lang-sql": "^6.10.0",
|
|
81
81
|
"@codemirror/lang-xml": "^6.1.0",
|
|
82
82
|
"@codemirror/lang-yaml": "^6.1.2",
|
|
83
|
-
"@codemirror/legacy-modes": "^6.5.
|
|
83
|
+
"@codemirror/legacy-modes": "^6.5.2",
|
|
84
84
|
"@mavrin/remark-typograf": "^2.2.0",
|
|
85
|
-
"@xyflow/react": "^12.
|
|
85
|
+
"@xyflow/react": "^12.9.3",
|
|
86
86
|
"classnames": "^2.5.1",
|
|
87
|
-
"codemirror": "^6.0.
|
|
87
|
+
"codemirror": "^6.0.2",
|
|
88
88
|
"color": "^4.2.3",
|
|
89
89
|
"compute-scroll-into-view": "^3.1.1",
|
|
90
90
|
"he": "^1.2.0",
|
|
91
91
|
"jshint": "^2.13.6",
|
|
92
92
|
"lodash": "^4.17.21",
|
|
93
|
-
"n3": "^1.
|
|
93
|
+
"n3": "^1.26.0",
|
|
94
94
|
"re-resizable": "^6.10.3",
|
|
95
95
|
"react": "^16.13.1",
|
|
96
96
|
"react-dom": "^16.14.0",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"react-inlinesvg": "^3.0.3",
|
|
99
99
|
"react-is": "^16.13.1",
|
|
100
100
|
"react-markdown": "^10.1.0",
|
|
101
|
-
"react-syntax-highlighter": "^15.6.
|
|
101
|
+
"react-syntax-highlighter": "^15.6.6",
|
|
102
102
|
"rehype-external-links": "^3.0.0",
|
|
103
103
|
"rehype-raw": "^7.0.0",
|
|
104
104
|
"remark-definition-list": "^2.0.0",
|
|
@@ -107,55 +107,54 @@
|
|
|
107
107
|
"reset-css": "^5.0.2",
|
|
108
108
|
"unified": "^11.0.5",
|
|
109
109
|
"wicg-inert": "^3.1.3",
|
|
110
|
-
"xml-formatter": "^3.6.
|
|
110
|
+
"xml-formatter": "^3.6.7"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@babel/core": "^7.
|
|
114
|
-
"@babel/plugin-transform-class-properties": "^7.
|
|
115
|
-
"@babel/plugin-transform-private-methods": "^7.
|
|
116
|
-
"@babel/plugin-transform-private-property-in-object": "^7.
|
|
117
|
-
"@babel/preset-env": "^7.
|
|
118
|
-
"@babel/preset-flow": "^7.
|
|
119
|
-
"@babel/preset-react": "^7.
|
|
120
|
-
"@babel/preset-typescript": "^7.
|
|
121
|
-
"@eslint/compat": "^1.
|
|
113
|
+
"@babel/core": "^7.28.5",
|
|
114
|
+
"@babel/plugin-transform-class-properties": "^7.27.1",
|
|
115
|
+
"@babel/plugin-transform-private-methods": "^7.27.1",
|
|
116
|
+
"@babel/plugin-transform-private-property-in-object": "^7.27.1",
|
|
117
|
+
"@babel/preset-env": "^7.28.5",
|
|
118
|
+
"@babel/preset-flow": "^7.27.1",
|
|
119
|
+
"@babel/preset-react": "^7.28.5",
|
|
120
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
121
|
+
"@eslint/compat": "^1.4.1",
|
|
122
122
|
"@eslint/eslintrc": "^3.3.1",
|
|
123
|
-
"@eslint/js": "^9.
|
|
124
|
-
"@storybook/addon-actions": "^8.6.
|
|
125
|
-
"@storybook/addon-essentials": "^8.6.
|
|
126
|
-
"@storybook/addon-jest": "^8.6.
|
|
127
|
-
"@storybook/addon-links": "^8.6.
|
|
123
|
+
"@eslint/js": "^9.39.1",
|
|
124
|
+
"@storybook/addon-actions": "^8.6.14",
|
|
125
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
126
|
+
"@storybook/addon-jest": "^8.6.14",
|
|
127
|
+
"@storybook/addon-links": "^8.6.14",
|
|
128
128
|
"@storybook/addon-webpack5-compiler-babel": "^3.0.6",
|
|
129
|
-
"@storybook/cli": "^8.6.
|
|
129
|
+
"@storybook/cli": "^8.6.14",
|
|
130
130
|
"@storybook/preset-scss": "^1.0.3",
|
|
131
|
-
"@storybook/react": "^8.6.
|
|
132
|
-
"@storybook/react-webpack5": "^8.6.
|
|
133
|
-
"@storybook/test": "^8.6.
|
|
134
|
-
"@testing-library/jest-dom": "^6.
|
|
131
|
+
"@storybook/react": "^8.6.14",
|
|
132
|
+
"@storybook/react-webpack5": "^8.6.14",
|
|
133
|
+
"@storybook/test": "^8.6.14",
|
|
134
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
135
135
|
"@testing-library/react": "^12.1.5",
|
|
136
|
-
"@types/codemirror": "^5.60.15",
|
|
137
136
|
"@types/color": "^3.0.6",
|
|
138
137
|
"@types/he": "^1.2.3",
|
|
139
|
-
"@types/jest": "^
|
|
138
|
+
"@types/jest": "^30.0.0",
|
|
140
139
|
"@types/jshint": "^2.12.4",
|
|
141
|
-
"@types/lodash": "^4.17.
|
|
142
|
-
"@types/n3": "^1.
|
|
143
|
-
"@types/react-is": "^19.
|
|
140
|
+
"@types/lodash": "^4.17.21",
|
|
141
|
+
"@types/n3": "^1.26.1",
|
|
142
|
+
"@types/react-is": "^19.2.0",
|
|
144
143
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
145
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
146
|
-
"@typescript-eslint/parser": "^8.
|
|
147
|
-
"babel-jest": "^
|
|
148
|
-
"chromatic": "^
|
|
149
|
-
"eslint": "^9.
|
|
144
|
+
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
145
|
+
"@typescript-eslint/parser": "^8.47.0",
|
|
146
|
+
"babel-jest": "^30.2.0",
|
|
147
|
+
"chromatic": "^13.3.4",
|
|
148
|
+
"eslint": "^9.39.1",
|
|
150
149
|
"eslint-plugin-react": "^7.37.5",
|
|
151
|
-
"eslint-plugin-react-hooks": "^
|
|
150
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
152
151
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
153
152
|
"husky": "4",
|
|
154
153
|
"identity-obj-proxy": "^3.0.0",
|
|
155
154
|
"jest": "^30.2.0",
|
|
156
155
|
"jest-environment-jsdom": "^30.2.0",
|
|
157
156
|
"jest-pnp-resolver": "^1.2.3",
|
|
158
|
-
"lint-staged": "^15.5.
|
|
157
|
+
"lint-staged": "^15.5.2",
|
|
159
158
|
"node-sass-package-importer": "^5.3.3",
|
|
160
159
|
"path": "^0.12.7",
|
|
161
160
|
"prettier": "^2.8.8",
|
|
@@ -165,7 +164,7 @@
|
|
|
165
164
|
"rimraf": "^5.0.10",
|
|
166
165
|
"sass": "1.62.1",
|
|
167
166
|
"sass-loader": "10.3.1",
|
|
168
|
-
"storybook": "^8.6.
|
|
167
|
+
"storybook": "^8.6.14",
|
|
169
168
|
"stylelint": "^16.18.0",
|
|
170
169
|
"stylelint-config-recess-order": "^6.0.0",
|
|
171
170
|
"stylelint-config-standard-scss": "^14.0.0",
|
|
@@ -180,8 +179,8 @@
|
|
|
180
179
|
"react": ">=16"
|
|
181
180
|
},
|
|
182
181
|
"resolutions": {
|
|
183
|
-
"**/@types/react": "^17.0.
|
|
184
|
-
"node-sass-package-importer/**/postcss": "^8.
|
|
182
|
+
"**/@types/react": "^17.0.90",
|
|
183
|
+
"node-sass-package-importer/**/postcss": "^8.5.6",
|
|
185
184
|
"string-width": "^4.2.3",
|
|
186
185
|
"wrap-ansi": "^7.0.0",
|
|
187
186
|
"hast-util-from-parse5": "8.0.0"
|
|
@@ -1,30 +1,46 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import { ContentBlobToggler, ContentBlobTogglerProps, Markdown } from "
|
|
3
|
+
import { ContentBlobToggler, ContentBlobTogglerProps, InlineText, Markdown, utils } from "./../../index";
|
|
4
4
|
|
|
5
5
|
export interface StringPreviewContentBlobTogglerProps
|
|
6
6
|
extends Omit<ContentBlobTogglerProps, "previewContent" | "enableToggler"> {
|
|
7
7
|
/**
|
|
8
|
-
The preview content will be cut to this length if it is too long.
|
|
8
|
+
* The preview content will be cut to this length if it is too long.
|
|
9
9
|
*/
|
|
10
10
|
previewMaxLength?: number;
|
|
11
11
|
/**
|
|
12
|
-
The content string.
|
|
12
|
+
* The content string.
|
|
13
|
+
* If it is smaller than `previewMaxLength` this will be displayed in full, else `fullviewContent` will be displayed.
|
|
13
14
|
*/
|
|
14
15
|
content: string;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Use only parts of `content` in the preview.
|
|
18
|
+
* `firstMarkdownSection` uses the content until the first double line return.
|
|
19
|
+
* Currently overwritten by `firstNonEmptyLineOnly`.
|
|
20
|
+
*/
|
|
21
|
+
useOnly?: "firstNonEmptyLine" | "firstMarkdownSection";
|
|
22
|
+
/**
|
|
23
|
+
* If enabled the preview is rendered as Markdown.
|
|
24
|
+
*/
|
|
18
25
|
renderPreviewAsMarkdown?: boolean;
|
|
19
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* White-listing of HTML elements that will be rendered when renderPreviewAsMarkdown is enabled.
|
|
28
|
+
*/
|
|
20
29
|
allowedHtmlElementsInPreview?: string[];
|
|
21
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Allows to add non-string elements at the end of the content if the full description is shown, i.e. no toggler is necessary.
|
|
22
32
|
* This allows to add non-string elements to both the full-view content and the pure string content.
|
|
23
33
|
*/
|
|
24
34
|
noTogglerContentSuffix?: JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* If only the first non-empty line should be shown in the preview.
|
|
37
|
+
* This will in addition also be shortened according to `previewMaxLength`.
|
|
38
|
+
* @deprecated (v26) use `useOnly="firstNonEmptyLine"` instead
|
|
39
|
+
*/
|
|
40
|
+
firstNonEmptyLineOnly?: boolean;
|
|
25
41
|
}
|
|
26
42
|
|
|
27
|
-
/** Version of the content toggler for text
|
|
43
|
+
/** Version of the content toggler for text centric content. */
|
|
28
44
|
export function StringPreviewContentBlobToggler({
|
|
29
45
|
className = "",
|
|
30
46
|
previewMaxLength,
|
|
@@ -33,14 +49,28 @@ export function StringPreviewContentBlobToggler({
|
|
|
33
49
|
content,
|
|
34
50
|
fullviewContent,
|
|
35
51
|
startExtended,
|
|
36
|
-
|
|
52
|
+
useOnly,
|
|
37
53
|
renderPreviewAsMarkdown = false,
|
|
38
54
|
allowedHtmlElementsInPreview,
|
|
39
55
|
noTogglerContentSuffix,
|
|
56
|
+
firstNonEmptyLineOnly,
|
|
40
57
|
}: StringPreviewContentBlobTogglerProps) {
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
58
|
+
// need to test `firstNonEmptyLineOnly` until property is removed
|
|
59
|
+
const useOnlyTest: StringPreviewContentBlobTogglerProps["useOnly"] = firstNonEmptyLineOnly
|
|
60
|
+
? "firstNonEmptyLine"
|
|
61
|
+
: useOnly;
|
|
62
|
+
|
|
63
|
+
let previewString = content;
|
|
64
|
+
switch (useOnlyTest) {
|
|
65
|
+
case "firstNonEmptyLine":
|
|
66
|
+
previewString = useOnlyPart(content, regexFirstNonEmptyLine);
|
|
67
|
+
break;
|
|
68
|
+
case "firstMarkdownSection":
|
|
69
|
+
previewString = useOnlyPart(content, regexFirstMarkdownSection);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let enableToggler = previewString !== content;
|
|
73
|
+
|
|
44
74
|
let previewContent = renderPreviewAsMarkdown ? (
|
|
45
75
|
<Markdown key="markdown-content" allowedElements={allowedHtmlElementsInPreview}>
|
|
46
76
|
{previewString}
|
|
@@ -48,6 +78,15 @@ export function StringPreviewContentBlobToggler({
|
|
|
48
78
|
) : (
|
|
49
79
|
previewString
|
|
50
80
|
);
|
|
81
|
+
|
|
82
|
+
if (
|
|
83
|
+
previewMaxLength &&
|
|
84
|
+
utils.reduceToText(previewContent, { decodeHtmlEntities: true }).length > previewMaxLength
|
|
85
|
+
) {
|
|
86
|
+
previewContent = utils.reduceToText(previewContent, { decodeHtmlEntities: true }).slice(0, previewMaxLength);
|
|
87
|
+
enableToggler = true;
|
|
88
|
+
}
|
|
89
|
+
|
|
51
90
|
if (!enableToggler && noTogglerContentSuffix) {
|
|
52
91
|
previewContent = (
|
|
53
92
|
<>
|
|
@@ -60,7 +99,7 @@ export function StringPreviewContentBlobToggler({
|
|
|
60
99
|
return (
|
|
61
100
|
<ContentBlobToggler
|
|
62
101
|
className={className}
|
|
63
|
-
previewContent={previewContent}
|
|
102
|
+
previewContent={<InlineText>{previewContent}</InlineText>}
|
|
64
103
|
toggleExtendText={toggleExtendText}
|
|
65
104
|
toggleReduceText={toggleReduceText}
|
|
66
105
|
fullviewContent={fullviewContent}
|
|
@@ -70,17 +109,26 @@ export function StringPreviewContentBlobToggler({
|
|
|
70
109
|
);
|
|
71
110
|
}
|
|
72
111
|
|
|
73
|
-
const
|
|
112
|
+
const regexFirstNonEmptyLine = new RegExp("\r|\n"); // eslint-disable-line
|
|
113
|
+
const regexFirstMarkdownSection = new RegExp("\r\n\r\n|\n\n"); // eslint-disable-line
|
|
74
114
|
|
|
75
115
|
/**
|
|
76
116
|
* Takes the first non-empty line from a preview string.
|
|
77
117
|
*/
|
|
78
118
|
function firstNonEmptyLine(preview: string) {
|
|
119
|
+
return useOnlyPart(preview, regexFirstNonEmptyLine);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Returns only the first part from a preview string.
|
|
124
|
+
* Or the full string as fallback.
|
|
125
|
+
*/
|
|
126
|
+
function useOnlyPart(preview: string, regexTest: RegExp): string {
|
|
79
127
|
const previewString = preview.trim();
|
|
80
|
-
const result =
|
|
81
|
-
return result !== null ?
|
|
128
|
+
const result = regexTest.exec(previewString);
|
|
129
|
+
return result !== null ? result.input.slice(0, result.index) : previewString;
|
|
82
130
|
}
|
|
83
131
|
|
|
84
132
|
export const stringPreviewContentBlobTogglerUtils = {
|
|
85
133
|
firstNonEmptyLine,
|
|
86
|
-
};
|
|
134
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import { Markdown, StringPreviewContentBlobToggler } from "../../../index";
|
|
5
|
+
|
|
6
|
+
const config = {
|
|
7
|
+
title: "CMEM/ContentBlobToggler/StringPreview",
|
|
8
|
+
component: StringPreviewContentBlobToggler,
|
|
9
|
+
} as Meta<typeof StringPreviewContentBlobToggler>;
|
|
10
|
+
export default config;
|
|
11
|
+
|
|
12
|
+
const Template: StoryFn<typeof StringPreviewContentBlobToggler> = (args) => (
|
|
13
|
+
<StringPreviewContentBlobToggler {...args} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
const initialTeststring =
|
|
17
|
+
"A library for GUI elements.\nIn order to create graphical user interfaces, please have look at the documentation at [Github](https://github.com/eccenca/gui-elements).";
|
|
18
|
+
|
|
19
|
+
export const Default = Template.bind({});
|
|
20
|
+
Default.args = {
|
|
21
|
+
content: initialTeststring,
|
|
22
|
+
fullviewContent: <Markdown htmlContentBlockProps={{ large: true }}>{initialTeststring}</Markdown>,
|
|
23
|
+
previewMaxLength: 64,
|
|
24
|
+
renderPreviewAsMarkdown: true,
|
|
25
|
+
toggleExtendText: "show more",
|
|
26
|
+
toggleReduceText: "show less",
|
|
27
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, RenderResult } from "@testing-library/react";
|
|
3
|
+
|
|
4
|
+
import "@testing-library/jest-dom";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
StringPreviewContentBlobToggler,
|
|
8
|
+
StringPreviewContentBlobTogglerProps,
|
|
9
|
+
} from "../StringPreviewContentBlobToggler";
|
|
10
|
+
|
|
11
|
+
import { Default as StringPreviewContentBlobTogglerStory } from "./../stories/StringPreviewContentBlobToggler.stories";
|
|
12
|
+
|
|
13
|
+
describe("StringPreviewContentBlobToggler", () => {
|
|
14
|
+
const textMustExist = (queryByText: RenderResult["queryByText"], text: string) => {
|
|
15
|
+
expect(queryByText(text, { exact: false })).not.toBeNull();
|
|
16
|
+
};
|
|
17
|
+
const textMustNotExist = (queryByText: RenderResult["queryByText"], text: string) => {
|
|
18
|
+
expect(queryByText(text, { exact: false })).toBeNull();
|
|
19
|
+
};
|
|
20
|
+
it("should cut preview and show toggler to extend", () => {
|
|
21
|
+
const { queryByText } = render(
|
|
22
|
+
<StringPreviewContentBlobToggler
|
|
23
|
+
{...(StringPreviewContentBlobTogglerStory.args as StringPreviewContentBlobTogglerProps)}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
textMustExist(queryByText, "A library for GUI elements.");
|
|
27
|
+
textMustNotExist(
|
|
28
|
+
queryByText,
|
|
29
|
+
"In order to create graphical user interfaces, please have look at the documentation at"
|
|
30
|
+
);
|
|
31
|
+
textMustExist(queryByText, "show more");
|
|
32
|
+
});
|
|
33
|
+
it("should display full view if `startExtended` is enabled, and show toggler to reduce", () => {
|
|
34
|
+
const { queryByText } = render(
|
|
35
|
+
<StringPreviewContentBlobToggler
|
|
36
|
+
{...(StringPreviewContentBlobTogglerStory.args as StringPreviewContentBlobTogglerProps)}
|
|
37
|
+
startExtended
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
textMustExist(
|
|
41
|
+
queryByText,
|
|
42
|
+
"In order to create graphical user interfaces, please have look at the documentation at"
|
|
43
|
+
);
|
|
44
|
+
textMustExist(queryByText, "show less");
|
|
45
|
+
});
|
|
46
|
+
it('should display only first content line on `useOnly={"firstNonEmptyLine"}`', () => {
|
|
47
|
+
const { queryByText } = render(
|
|
48
|
+
<StringPreviewContentBlobToggler
|
|
49
|
+
{...(StringPreviewContentBlobTogglerStory.args as StringPreviewContentBlobTogglerProps)}
|
|
50
|
+
useOnly={"firstNonEmptyLine"}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
textMustExist(queryByText, "A library for GUI elements.");
|
|
54
|
+
textMustNotExist(queryByText, "In order to create");
|
|
55
|
+
});
|
|
56
|
+
it('should use first Markdown paragraph as preview content on `useOnly={"firstMarkdownSection"}` but shorten it', () => {
|
|
57
|
+
const { queryByText } = render(
|
|
58
|
+
<StringPreviewContentBlobToggler
|
|
59
|
+
{...(StringPreviewContentBlobTogglerStory.args as StringPreviewContentBlobTogglerProps)}
|
|
60
|
+
useOnly={"firstMarkdownSection"}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
textMustExist(queryByText, "A library for GUI elements.");
|
|
64
|
+
textMustExist(queryByText, "In order to create");
|
|
65
|
+
textMustNotExist(queryByText, "please have look at the documentation at");
|
|
66
|
+
});
|
|
67
|
+
it("should display full preview and no toggler if content is short enough", () => {
|
|
68
|
+
const { queryByText } = render(
|
|
69
|
+
<StringPreviewContentBlobToggler
|
|
70
|
+
{...(StringPreviewContentBlobTogglerStory.args as StringPreviewContentBlobTogglerProps)}
|
|
71
|
+
previewMaxLength={144}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
textMustExist(queryByText, "A library for GUI elements.");
|
|
75
|
+
textMustExist(
|
|
76
|
+
queryByText,
|
|
77
|
+
"In order to create graphical user interfaces, please have look at the documentation at"
|
|
78
|
+
);
|
|
79
|
+
textMustNotExist(queryByText, "https://github.com/"); // test if Markdown was rendered
|
|
80
|
+
textMustNotExist(queryByText, "show more");
|
|
81
|
+
});
|
|
82
|
+
it("should not use Markdown rendering on `renderPreviewAsMarkdown={false}`", () => {
|
|
83
|
+
const { queryByText } = render(
|
|
84
|
+
<StringPreviewContentBlobToggler
|
|
85
|
+
{...(StringPreviewContentBlobTogglerStory.args as StringPreviewContentBlobTogglerProps)}
|
|
86
|
+
previewMaxLength={144}
|
|
87
|
+
renderPreviewAsMarkdown={false}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
textMustExist(queryByText, "A library for GUI elements.");
|
|
91
|
+
textMustExist(
|
|
92
|
+
queryByText,
|
|
93
|
+
"In order to create graphical user interfaces, please have look at the documentation at"
|
|
94
|
+
);
|
|
95
|
+
textMustExist(queryByText, "https://github.com/"); // test if Markdown was rendered
|
|
96
|
+
textMustExist(queryByText, "show more");
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
2
1
|
import { Intent as BlueprintIntent } from "@blueprintjs/core";
|
|
3
2
|
|
|
3
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
|
+
|
|
4
5
|
export type IntentBlueprint = BlueprintIntent;
|
|
5
6
|
export const DefinitionsBlueprint = BlueprintIntent;
|
|
6
7
|
|