@eccenca/gui-elements 24.0.1 → 24.1.0-featureimprovepublishingprocesscmem6356.1
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 +82 -0
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +7 -2
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +3 -3
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +13 -3
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/ExtendedCodeEditor.js +3 -3
- package/dist/cjs/components/AutoSuggestion/ExtendedCodeEditor.js.map +1 -1
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +4 -2
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/cjs/components/Card/CardActions.js +2 -1
- package/dist/cjs/components/Card/CardActions.js.map +1 -1
- package/dist/cjs/components/Card/CardContent.js +4 -6
- package/dist/cjs/components/Card/CardContent.js.map +1 -1
- package/dist/cjs/components/ContentGroup/ContentGroup.js +95 -0
- package/dist/cjs/components/ContentGroup/ContentGroup.js.map +1 -0
- package/dist/cjs/components/Dialog/SimpleDialog.js +3 -3
- package/dist/cjs/components/Dialog/SimpleDialog.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +12 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/Label/Label.js +8 -3
- package/dist/cjs/components/Label/Label.js.map +1 -1
- package/dist/cjs/components/Menu/MenuItem.js +3 -2
- package/dist/cjs/components/Menu/MenuItem.js.map +1 -1
- package/dist/cjs/components/OverviewItem/OverviewItem.js +5 -2
- package/dist/cjs/components/OverviewItem/OverviewItem.js.map +1 -1
- package/dist/cjs/components/OverviewItem/OverviewItemList.js +2 -2
- package/dist/cjs/components/OverviewItem/OverviewItemList.js.map +1 -1
- package/dist/cjs/components/Switch/Switch.js +6 -4
- package/dist/cjs/components/Switch/Switch.js.map +1 -1
- package/dist/cjs/components/Tag/TagList.js +1 -1
- package/dist/cjs/components/Tag/TagList.js.map +1 -1
- package/dist/cjs/components/TextField/SearchField.js +19 -2
- package/dist/cjs/components/TextField/SearchField.js.map +1 -1
- package/dist/cjs/components/Typography/OverflowText.js +1 -1
- package/dist/cjs/components/Typography/OverflowText.js.map +1 -1
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/extensions/codemirror/CodeMirror.js +93 -11
- package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/cjs/extensions/codemirror/debouncedLinter.js +18 -0
- package/dist/cjs/extensions/codemirror/debouncedLinter.js.map +1 -0
- 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/linters/jsLinter.js +36 -0
- package/dist/cjs/extensions/codemirror/linters/jsLinter.js.map +1 -0
- package/dist/cjs/extensions/codemirror/linters/turtleLinter.js +81 -0
- package/dist/cjs/extensions/codemirror/linters/turtleLinter.js.map +1 -0
- package/dist/cjs/extensions/codemirror/tests/codemirrorTestHelper.js +4 -1
- package/dist/cjs/extensions/codemirror/tests/codemirrorTestHelper.js.map +1 -1
- package/dist/cjs/extensions/codemirror/toolbars/commands/markdown.command.js +278 -0
- package/dist/cjs/extensions/codemirror/toolbars/commands/markdown.command.js.map +1 -0
- package/dist/cjs/extensions/codemirror/toolbars/markdown.toolbar.js +47 -0
- package/dist/cjs/extensions/codemirror/toolbars/markdown.toolbar.js.map +1 -0
- package/dist/cjs/extensions/codemirror/types.js +3 -0
- package/dist/cjs/extensions/codemirror/types.js.map +1 -0
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +140 -41
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/nodeUtils.js +5 -6
- package/dist/cjs/extensions/react-flow/nodes/nodeUtils.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +7 -2
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +4 -4
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +13 -3
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/ExtendedCodeEditor.js +14 -3
- package/dist/esm/components/AutoSuggestion/ExtendedCodeEditor.js.map +1 -1
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js +4 -3
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/esm/components/Card/CardActions.js +2 -1
- package/dist/esm/components/Card/CardActions.js.map +1 -1
- package/dist/esm/components/Card/CardContent.js +4 -5
- package/dist/esm/components/Card/CardContent.js.map +1 -1
- package/dist/esm/components/ContentGroup/ContentGroup.js +100 -0
- package/dist/esm/components/ContentGroup/ContentGroup.js.map +1 -0
- package/dist/esm/components/Dialog/SimpleDialog.js +4 -4
- package/dist/esm/components/Dialog/SimpleDialog.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +12 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/Label/Label.js +8 -3
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +3 -2
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/OverviewItem/OverviewItem.js +5 -2
- package/dist/esm/components/OverviewItem/OverviewItem.js.map +1 -1
- package/dist/esm/components/OverviewItem/OverviewItemList.js +2 -2
- package/dist/esm/components/OverviewItem/OverviewItemList.js.map +1 -1
- package/dist/esm/components/Switch/Switch.js +7 -5
- package/dist/esm/components/Switch/Switch.js.map +1 -1
- package/dist/esm/components/Tag/TagList.js +1 -1
- package/dist/esm/components/Tag/TagList.js.map +1 -1
- package/dist/esm/components/TextField/SearchField.js +35 -2
- package/dist/esm/components/TextField/SearchField.js.map +1 -1
- package/dist/esm/components/Typography/OverflowText.js +1 -1
- package/dist/esm/components/Typography/OverflowText.js.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/extensions/codemirror/CodeMirror.js +94 -13
- package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/esm/extensions/codemirror/debouncedLinter.js +15 -0
- package/dist/esm/extensions/codemirror/debouncedLinter.js.map +1 -0
- 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/linters/jsLinter.js +32 -0
- package/dist/esm/extensions/codemirror/linters/jsLinter.js.map +1 -0
- package/dist/esm/extensions/codemirror/linters/turtleLinter.js +77 -0
- package/dist/esm/extensions/codemirror/linters/turtleLinter.js.map +1 -0
- package/dist/esm/extensions/codemirror/tests/codemirrorTestHelper.js +4 -0
- package/dist/esm/extensions/codemirror/tests/codemirrorTestHelper.js.map +1 -1
- package/dist/esm/extensions/codemirror/toolbars/commands/markdown.command.js +283 -0
- package/dist/esm/extensions/codemirror/toolbars/commands/markdown.command.js.map +1 -0
- package/dist/esm/extensions/codemirror/toolbars/markdown.toolbar.js +41 -0
- package/dist/esm/extensions/codemirror/toolbars/markdown.toolbar.js.map +1 -0
- package/dist/esm/extensions/codemirror/types.js +2 -0
- package/dist/esm/extensions/codemirror/types.js.map +1 -0
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js +149 -48
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/nodeUtils.js +5 -6
- package/dist/esm/extensions/react-flow/nodes/nodeUtils.js.map +1 -1
- package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +1 -1
- package/dist/types/cmem/react-flow/StickyNoteModal/StickyNoteModal.d.ts +5 -1
- package/dist/types/components/AutoSuggestion/ExtendedCodeEditor.d.ts +11 -6
- package/dist/types/components/Card/CardActions.d.ts +5 -1
- package/dist/types/components/Card/CardContent.d.ts +1 -2
- package/dist/types/components/ContentGroup/ContentGroup.d.ts +78 -0
- package/dist/types/components/Dialog/SimpleDialog.d.ts +4 -1
- package/dist/types/components/Icon/canonicalIconNames.d.ts +12 -0
- package/dist/types/components/Label/Label.d.ts +7 -1
- package/dist/types/components/Menu/MenuItem.d.ts +8 -1
- package/dist/types/components/OverviewItem/OverviewItem.d.ts +13 -1
- package/dist/types/components/OverviewItem/OverviewItemList.d.ts +3 -2
- package/dist/types/components/ProgressBar/ProgressBar.d.ts +2 -2
- package/dist/types/components/Structure/TitleSubsection.d.ts +7 -0
- package/dist/types/components/Switch/Switch.d.ts +3 -3
- package/dist/types/components/Tabs/Tab.d.ts +14 -0
- package/dist/types/components/TextField/SearchField.d.ts +1 -1
- package/dist/types/components/Typography/OverflowText.d.ts +23 -2
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/extensions/codemirror/CodeMirror.d.ts +32 -5
- package/dist/types/extensions/codemirror/debouncedLinter.d.ts +4 -0
- package/dist/types/extensions/codemirror/linters/jsLinter.d.ts +5 -0
- package/dist/types/extensions/codemirror/linters/turtleLinter.d.ts +5 -0
- package/dist/types/extensions/codemirror/tests/codemirrorTestHelper.d.ts +1 -0
- package/dist/types/extensions/codemirror/toolbars/commands/markdown.command.d.ts +55 -0
- package/dist/types/extensions/codemirror/toolbars/markdown.toolbar.d.ts +12 -0
- package/dist/types/extensions/codemirror/types.d.ts +5 -0
- package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +18 -4
- package/dist/types/extensions/react-flow/nodes/nodeUtils.d.ts +7 -6
- package/package.json +50 -47
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +5 -2
- package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +16 -2
- package/src/cmem/react-flow/configuration/_colors-graph.scss +4 -1
- package/src/cmem/react-flow/configuration/_colors-workflow.scss +3 -0
- package/src/components/AutoSuggestion/AutoSuggestion.tsx +14 -3
- package/src/components/AutoSuggestion/ExtendedCodeEditor.tsx +29 -6
- package/src/components/AutocompleteField/AutoCompleteField.tsx +5 -3
- package/src/components/Card/CardActions.tsx +6 -0
- package/src/components/Card/CardContent.tsx +8 -4
- package/src/components/Card/card.scss +15 -0
- package/src/components/CodeAutocompleteField/CodeAutocompleteField.stories.tsx +3 -2
- package/src/components/ContentGroup/ContentGroup.stories.tsx +47 -0
- package/src/components/ContentGroup/ContentGroup.tsx +256 -0
- package/src/components/ContentGroup/_contentgroup.scss +56 -0
- package/src/components/ContextOverlay/ContextOverlay.stories.tsx +15 -4
- package/src/components/Depiction/depiction.scss +7 -0
- package/src/components/Dialog/SimpleDialog.tsx +9 -2
- package/src/components/Dialog/stories/AlertDialog.stories.tsx +5 -1
- package/src/components/Dialog/stories/Modal.stories.tsx +4 -2
- package/src/components/Dialog/stories/SimpleDialog.stories.tsx +5 -2
- package/src/components/Icon/canonicalIconNames.tsx +12 -0
- package/src/components/Label/Label.stories.tsx +2 -1
- package/src/components/Label/Label.tsx +17 -1
- package/src/components/Label/label.scss +5 -1
- package/src/components/Menu/MenuItem.tsx +27 -1
- package/src/components/Menu/menu.scss +1 -0
- package/src/components/OverviewItem/OverviewItem.tsx +24 -1
- package/src/components/OverviewItem/OverviewItemList.tsx +3 -2
- package/src/components/OverviewItem/overviewitem.scss +4 -1
- package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +6 -12
- package/src/components/Select/Select.stories.tsx +4 -1
- package/src/components/Switch/Switch.tsx +27 -8
- package/src/components/Tag/TagList.tsx +2 -2
- package/src/components/TextField/SearchField.tsx +37 -9
- package/src/components/TextField/stories/SearchField.stories.tsx +15 -1
- package/src/components/TextField/stories/TextField.stories.tsx +2 -1
- package/src/components/TextField/textfield.scss +17 -3
- package/src/components/Typography/OverflowText.tsx +24 -3
- package/src/components/Typography/stories/OverflowText.stories.tsx +33 -0
- package/src/components/index.scss +1 -0
- package/src/components/index.ts +1 -0
- package/src/extensions/codemirror/CodeMirror.stories.tsx +19 -1
- package/src/extensions/codemirror/CodeMirror.tsx +154 -16
- package/src/extensions/codemirror/_codemirror.scss +130 -1
- package/src/extensions/codemirror/debouncedLinter.ts +26 -0
- package/src/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.ts +1 -1
- package/src/extensions/codemirror/linters/jsLinter.ts +38 -0
- package/src/extensions/codemirror/linters/turtleLinter.ts +102 -0
- package/src/extensions/codemirror/tests/codemirrorTestHelper.ts +4 -0
- package/src/extensions/codemirror/toolbars/commands/markdown.command.ts +340 -0
- package/src/extensions/codemirror/toolbars/markdown.toolbar.tsx +117 -0
- package/src/extensions/codemirror/types.ts +7 -0
- package/src/extensions/react-flow/_config.scss +1 -0
- package/src/extensions/react-flow/nodes/NodeContent.tsx +170 -52
- package/src/extensions/react-flow/nodes/_nodes.scss +71 -35
- package/src/extensions/react-flow/nodes/nodeUtils.tsx +16 -14
- package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +51 -12
|
@@ -19,6 +19,9 @@ const canonicalIcons = {
|
|
|
19
19
|
"artefact-commit": icons.Commit,
|
|
20
20
|
"artefact-task-deleteprojectfiles": icons.TrashCan,
|
|
21
21
|
"artefact-task-downloadfile": icons.CloudDownload,
|
|
22
|
+
"artefact-task-pivot": icons.Transpose,
|
|
23
|
+
"artefact-task-unpivot": icons.Transpose,
|
|
24
|
+
"artefact-task-concatenatetofile": icons.DocumentExport,
|
|
22
25
|
"artefact-dataset-csv": icons.Csv,
|
|
23
26
|
"artefact-dataset-eccencadataplatform": icons.DataVis_1,
|
|
24
27
|
"artefact-dataset-excel": icons.Xls,
|
|
@@ -65,6 +68,7 @@ const canonicalIcons = {
|
|
|
65
68
|
"item-download": icons.Download,
|
|
66
69
|
"item-draggable": icons.Draggable,
|
|
67
70
|
"item-edit": icons.Edit,
|
|
71
|
+
"item-magic-edit": icons.MagicWand,
|
|
68
72
|
"item-evaluation": icons.Analytics,
|
|
69
73
|
"item-execution": icons.Run,
|
|
70
74
|
"item-info": icons.Information,
|
|
@@ -84,6 +88,7 @@ const canonicalIcons = {
|
|
|
84
88
|
"item-vertmenu": icons.OverflowMenuHorizontal,
|
|
85
89
|
"item-viewdetails": icons.View,
|
|
86
90
|
"item-hidedetails": icons.ViewOff,
|
|
91
|
+
"item-image": icons.Image,
|
|
87
92
|
|
|
88
93
|
"list-sortasc": icons.ArrowDown,
|
|
89
94
|
"list-sortdesc": icons.ArrowUp,
|
|
@@ -125,6 +130,13 @@ const canonicalIcons = {
|
|
|
125
130
|
"operation-filterremove": icons.FilterRemove,
|
|
126
131
|
"operation-filter": icons.Filter,
|
|
127
132
|
"operation-format-codeblock": icons.CodeBlock,
|
|
133
|
+
"operation-format-text-code": icons.Code,
|
|
134
|
+
"operation-format-text-bold": icons.TextBold,
|
|
135
|
+
"operation-format-text-italic": icons.TextItalic,
|
|
136
|
+
"operation-format-text-strikethrough": icons.TextStrikethrough,
|
|
137
|
+
"operation-format-list-bullet": icons.ListBulleted,
|
|
138
|
+
"operation-format-list-checked": icons.ListChecked,
|
|
139
|
+
"operation-format-list-numbered": icons.ListNumbered,
|
|
128
140
|
"operation-fix": icons.Tools,
|
|
129
141
|
"operation-link": icons.Link,
|
|
130
142
|
"operation-logout": icons.Logout,
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { loremIpsum } from "react-lorem-ipsum";
|
|
3
3
|
import { Meta, StoryFn } from "@storybook/react";
|
|
4
4
|
|
|
5
|
-
import { Label } from "../../index";
|
|
5
|
+
import { Icon, Label } from "../../index";
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: "Forms/Label",
|
|
@@ -19,4 +19,5 @@ Default.args = {
|
|
|
19
19
|
tooltip: loremIpsum({ p: 1, avgSentencesPerParagraph: 2, startWithLoremIpsum: false, random: false }).toString(),
|
|
20
20
|
disabled: false,
|
|
21
21
|
htmlFor: "inputid",
|
|
22
|
+
additionalElements: <Icon name={"state-warning"} tooltipText={"message"} small />,
|
|
22
23
|
};
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
4
|
import Icon from "../Icon/Icon";
|
|
5
|
+
import Spacing from "../Separation/Spacing";
|
|
5
6
|
import Tooltip, { TooltipProps } from "../Tooltip/Tooltip";
|
|
6
7
|
|
|
7
8
|
export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
@@ -34,6 +35,12 @@ export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement>
|
|
|
34
35
|
* visual appearance of the label
|
|
35
36
|
*/
|
|
36
37
|
emphasis?: "strong" | "normal";
|
|
38
|
+
/**
|
|
39
|
+
* Add other elements to the end of the label content
|
|
40
|
+
*/
|
|
41
|
+
additionalElements?: React.ReactNode | React.ReactNode[];
|
|
42
|
+
/** Force label to get displayed as inline block element. */
|
|
43
|
+
inline?: boolean;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
export const Label = ({
|
|
@@ -46,6 +53,8 @@ export const Label = ({
|
|
|
46
53
|
tooltipProps,
|
|
47
54
|
isLayoutForElement = "label",
|
|
48
55
|
emphasis = "normal",
|
|
56
|
+
additionalElements,
|
|
57
|
+
inline,
|
|
49
58
|
...otherLabelProps
|
|
50
59
|
}: LabelProps) => {
|
|
51
60
|
let htmlElementstring = isLayoutForElement;
|
|
@@ -63,16 +72,23 @@ export const Label = ({
|
|
|
63
72
|
</span>
|
|
64
73
|
)}
|
|
65
74
|
{children && <span className={`${eccgui}-label__other`}>{children}</span>}
|
|
75
|
+
{additionalElements && (
|
|
76
|
+
<>
|
|
77
|
+
<Spacing vertical size="tiny" />
|
|
78
|
+
{additionalElements}
|
|
79
|
+
</>
|
|
80
|
+
)}
|
|
66
81
|
</>
|
|
67
82
|
);
|
|
68
83
|
|
|
69
|
-
return !!text || !!info || !!tooltip || !!children ? (
|
|
84
|
+
return !!text || !!info || !!tooltip || !!children || !!additionalElements ? (
|
|
70
85
|
React.createElement(
|
|
71
86
|
htmlElementstring,
|
|
72
87
|
{
|
|
73
88
|
className:
|
|
74
89
|
`${eccgui}-label ${eccgui}-label--${emphasis}` +
|
|
75
90
|
(className ? " " + className : "") +
|
|
91
|
+
(inline ? ` ${eccgui}-label--inline` : "") +
|
|
76
92
|
(disabled ? ` ${eccgui}-label--disabled` : ""),
|
|
77
93
|
...otherLabelProps,
|
|
78
94
|
},
|
|
@@ -8,7 +8,6 @@ $eccgui-color-label-info: rgba($eccgui-color-workspace-text, $eccgui-opacity-mut
|
|
|
8
8
|
font-size: $eccgui-size-typo-label;
|
|
9
9
|
line-height: $eccgui-size-typo-label-lineheight;
|
|
10
10
|
color: $eccgui-color-label-text;
|
|
11
|
-
vertical-align: middle;
|
|
12
11
|
|
|
13
12
|
.#{$eccgui}-typography__overflowtext--passdown > & {
|
|
14
13
|
display: flex;
|
|
@@ -17,6 +16,11 @@ $eccgui-color-label-info: rgba($eccgui-color-workspace-text, $eccgui-opacity-mut
|
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
|
|
19
|
+
.#{$eccgui}-label--inline {
|
|
20
|
+
display: inline-block;
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
.#{$eccgui}-label--disabled {
|
|
21
25
|
opacity: $eccgui-opacity-disabled;
|
|
22
26
|
}
|
|
@@ -5,6 +5,7 @@ import { openInNewTab } from "../../common/utils/openInNewTab";
|
|
|
5
5
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
6
6
|
import { ValidIconName } from "../Icon/canonicalIconNames";
|
|
7
7
|
import Icon from "../Icon/Icon";
|
|
8
|
+
import Tooltip from "../Tooltip/Tooltip";
|
|
8
9
|
|
|
9
10
|
import { TestIconProps } from "./../Icon/TestIcon";
|
|
10
11
|
|
|
@@ -15,16 +16,41 @@ export interface MenuItemProps
|
|
|
15
16
|
* If set the icon is diplayed on the left side of the menu item.
|
|
16
17
|
*/
|
|
17
18
|
icon?: ValidIconName | string[] | React.ReactElement<TestIconProps>;
|
|
19
|
+
/**
|
|
20
|
+
* Submenu.
|
|
21
|
+
*/
|
|
18
22
|
children?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Tooltip, but only added to the label, not to the full menu item.
|
|
25
|
+
*/
|
|
26
|
+
tooltip?: string | JSX.Element;
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
/**
|
|
22
30
|
* Single item, used as child inside `Menu`.
|
|
23
31
|
*/
|
|
24
|
-
export const MenuItem = ({
|
|
32
|
+
export const MenuItem = ({
|
|
33
|
+
children,
|
|
34
|
+
className = "",
|
|
35
|
+
icon,
|
|
36
|
+
onClick,
|
|
37
|
+
href,
|
|
38
|
+
text,
|
|
39
|
+
tooltip,
|
|
40
|
+
...restProps
|
|
41
|
+
}: MenuItemProps) => {
|
|
25
42
|
return (
|
|
26
43
|
<BlueprintMenuItem
|
|
27
44
|
{...restProps}
|
|
45
|
+
text={
|
|
46
|
+
tooltip ? (
|
|
47
|
+
<Tooltip content={tooltip} fill>
|
|
48
|
+
{text}
|
|
49
|
+
</Tooltip>
|
|
50
|
+
) : (
|
|
51
|
+
text
|
|
52
|
+
)
|
|
53
|
+
}
|
|
28
54
|
href={href}
|
|
29
55
|
onClick={(e: React.MouseEvent<HTMLElement>) =>
|
|
30
56
|
openInNewTab(e as React.MouseEvent<HTMLAnchorElement>, onClick, href)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
|
+
import Card, { CardProps } from "../Card/Card";
|
|
4
5
|
|
|
5
6
|
export interface OverviewItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
7
|
/**
|
|
@@ -11,6 +12,17 @@ export interface OverviewItemProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
11
12
|
* Add a bit white space around the element.
|
|
12
13
|
*/
|
|
13
14
|
hasSpacing?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Uses a `Card` element to wrap the `OverviewItem` inside.
|
|
17
|
+
* It is always used with `isOnlyLayout` set to `true`.
|
|
18
|
+
* Should be used together with `hasSpacing`.
|
|
19
|
+
*/
|
|
20
|
+
hasCardWrapper?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Forwarding basic `Card` properties to the wrapper element.
|
|
23
|
+
* Only used if `hasCardWrapper` is set to `true`.
|
|
24
|
+
*/
|
|
25
|
+
cardProps?: Omit<CardProps, "children" | "isOnlyLayout" | "fullHeight" | "whitespaceAmount" | "compact">;
|
|
14
26
|
}
|
|
15
27
|
|
|
16
28
|
/**
|
|
@@ -22,6 +34,8 @@ export const OverviewItem = ({
|
|
|
22
34
|
className = "",
|
|
23
35
|
densityHigh = false,
|
|
24
36
|
hasSpacing = false,
|
|
37
|
+
hasCardWrapper = false,
|
|
38
|
+
cardProps,
|
|
25
39
|
...otherProps
|
|
26
40
|
}: OverviewItemProps) => {
|
|
27
41
|
const item = (
|
|
@@ -38,6 +52,7 @@ export const OverviewItem = ({
|
|
|
38
52
|
</div>
|
|
39
53
|
);
|
|
40
54
|
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
56
|
const accessibilityParameters: { [key: string]: any } = Object.create(null);
|
|
42
57
|
if (typeof otherProps.onClick !== "undefined" || typeof otherProps.onKeyDown !== "undefined") {
|
|
43
58
|
accessibilityParameters["tabIndex"] = 0;
|
|
@@ -46,7 +61,15 @@ export const OverviewItem = ({
|
|
|
46
61
|
accessibilityParameters["role"] = "button";
|
|
47
62
|
}
|
|
48
63
|
|
|
49
|
-
|
|
64
|
+
const element = React.cloneElement(item, accessibilityParameters);
|
|
65
|
+
|
|
66
|
+
return hasCardWrapper ? (
|
|
67
|
+
<Card isOnlyLayout {...cardProps}>
|
|
68
|
+
{element}
|
|
69
|
+
</Card>
|
|
70
|
+
) : (
|
|
71
|
+
element
|
|
72
|
+
);
|
|
50
73
|
};
|
|
51
74
|
|
|
52
75
|
export default OverviewItem;
|
|
@@ -5,6 +5,7 @@ import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
|
5
5
|
export interface OverviewItemListProps extends React.HTMLAttributes<HTMLOListElement> {
|
|
6
6
|
/**
|
|
7
7
|
* Displays the element using reduced height and less white space inside.
|
|
8
|
+
* @deprecated (v25) use property directly on `OverviewItem` children.
|
|
8
9
|
*/
|
|
9
10
|
densityHigh?: boolean;
|
|
10
11
|
/**
|
|
@@ -23,8 +24,8 @@ export interface OverviewItemListProps extends React.HTMLAttributes<HTMLOListEle
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
|
-
* This
|
|
27
|
-
*
|
|
27
|
+
* This component is a listing container for multiple `OverviewItem` elements.
|
|
28
|
+
* It should only contains `OverviewItem` children but it does not check and control that condition.
|
|
28
29
|
*/
|
|
29
30
|
export const OverviewItemList = ({
|
|
30
31
|
children,
|
|
@@ -193,7 +193,10 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
|
|
|
193
193
|
|
|
194
194
|
.#{$eccgui}-overviewitem__item:hover &,
|
|
195
195
|
.#{$eccgui}-overviewitem__item:focus &,
|
|
196
|
-
.#{$eccgui}-overviewitem__item:active
|
|
196
|
+
.#{$eccgui}-overviewitem__item:active &,
|
|
197
|
+
&:focus-within,
|
|
198
|
+
&:has(.#{$ns}-active),
|
|
199
|
+
&:has(.#{$ns}-popover-open) {
|
|
197
200
|
display: flex;
|
|
198
201
|
}
|
|
199
202
|
}
|
|
@@ -27,7 +27,7 @@ export default {
|
|
|
27
27
|
},
|
|
28
28
|
argTypes: {
|
|
29
29
|
children: {
|
|
30
|
-
control:
|
|
30
|
+
control: false,
|
|
31
31
|
description: "Elements used as depiction, text and interactive elements of an overview-item.",
|
|
32
32
|
},
|
|
33
33
|
},
|
|
@@ -47,6 +47,9 @@ ItemExample.args = {
|
|
|
47
47
|
<OverviewItemActions children={ActionsExample.args.children[0]} hiddenInteractions key="hiddenactions" />,
|
|
48
48
|
<OverviewItemActions children={ActionsExample.args.children[1]} key="actions" />,
|
|
49
49
|
],
|
|
50
|
+
densityHigh: false,
|
|
51
|
+
hasSpacing: false,
|
|
52
|
+
hasCardWrapper: false,
|
|
50
53
|
};
|
|
51
54
|
|
|
52
55
|
export const ItemWithDepictionElement = Template.bind({});
|
|
@@ -69,16 +72,7 @@ ItemWithDepictionElement.args = {
|
|
|
69
72
|
<OverviewItemActions children={ActionsExample.args.children[0]} hiddenInteractions />,
|
|
70
73
|
<OverviewItemActions children={ActionsExample.args.children[1]} />,
|
|
71
74
|
],
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const TemplateCard: StoryFn<typeof OverviewItem> = (args) => (
|
|
75
|
-
<Card isOnlyLayout>
|
|
76
|
-
<OverviewItem {...args}></OverviewItem>
|
|
77
|
-
</Card>
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
export const ItemInCard = TemplateCard.bind({});
|
|
81
|
-
ItemInCard.args = {
|
|
82
|
-
...ItemExample.args,
|
|
75
|
+
densityHigh: false,
|
|
83
76
|
hasSpacing: true,
|
|
77
|
+
hasCardWrapper: true,
|
|
84
78
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { loremIpsum } from "react-lorem-ipsum";
|
|
3
3
|
import { Meta, StoryFn } from "@storybook/react";
|
|
4
|
+
import { fn } from "@storybook/test";
|
|
4
5
|
|
|
5
6
|
import { helpersArgTypes } from "../../../.storybook/helpers";
|
|
6
7
|
import { Button, Depiction, MenuItem, Select } from "../../index";
|
|
@@ -30,7 +31,7 @@ Default.args = {
|
|
|
30
31
|
return { label: item };
|
|
31
32
|
}),
|
|
32
33
|
itemRenderer: (item, props) => {
|
|
33
|
-
return <MenuItem text={item.label} title={item.label} />;
|
|
34
|
+
return <MenuItem text={item.label} title={item.label} {...props} />;
|
|
34
35
|
},
|
|
35
36
|
fill: true,
|
|
36
37
|
};
|
|
@@ -53,6 +54,7 @@ ControlledTarget.args = {
|
|
|
53
54
|
...Default.args,
|
|
54
55
|
fill: false,
|
|
55
56
|
children: <Button text="Controlled select target" intent="primary" />,
|
|
57
|
+
onActiveItemChange: fn(),
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
/**
|
|
@@ -70,4 +72,5 @@ ClearanceOption.args = {
|
|
|
70
72
|
onClearanceHandler: () => {
|
|
71
73
|
alert("Reset now.");
|
|
72
74
|
},
|
|
75
|
+
onActiveItemChange: fn(),
|
|
73
76
|
};
|
|
@@ -1,26 +1,45 @@
|
|
|
1
|
-
import React, { memo
|
|
2
|
-
import {
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Classes as BlueprintClasses,
|
|
4
|
+
Switch as BlueprintSwitch,
|
|
5
|
+
SwitchProps as BlueprintSwitchProps,
|
|
6
|
+
} from "@blueprintjs/core";
|
|
3
7
|
|
|
4
8
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
9
|
+
import { Label } from "../Label/Label";
|
|
5
10
|
|
|
6
11
|
export interface SwitchProps extends Omit<BlueprintSwitchProps, "onChange"> {
|
|
7
12
|
/**
|
|
8
13
|
* Event handler for changed state.
|
|
9
14
|
*/
|
|
10
|
-
onChange?: (value: boolean) =>
|
|
15
|
+
onChange?: (value: boolean) => void;
|
|
11
16
|
/**
|
|
12
17
|
* class names
|
|
13
18
|
*/
|
|
14
19
|
className?: string;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
export const Switch = ({ onChange, className, ...otherProps }: SwitchProps) => {
|
|
18
|
-
const handleChange = (e:
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
export const Switch = ({ onChange, className, label, ...otherProps }: SwitchProps) => {
|
|
23
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
24
|
+
if (onChange) {
|
|
25
|
+
onChange(!!e.target?.checked);
|
|
26
|
+
}
|
|
21
27
|
};
|
|
22
28
|
|
|
23
|
-
return
|
|
29
|
+
return (
|
|
30
|
+
<BlueprintSwitch
|
|
31
|
+
className={`${eccgui}-switch ${className ?? ""} ${
|
|
32
|
+
label && !otherProps.labelElement ? BlueprintClasses.INLINE : ""
|
|
33
|
+
}`}
|
|
34
|
+
labelElement={
|
|
35
|
+
label ? (
|
|
36
|
+
<Label text={label} isLayoutForElement="span" disabled={otherProps.disabled} inline />
|
|
37
|
+
) : undefined
|
|
38
|
+
}
|
|
39
|
+
{...otherProps}
|
|
40
|
+
onChange={handleChange}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
24
43
|
};
|
|
25
44
|
|
|
26
45
|
export default memo(Switch);
|
|
@@ -10,11 +10,11 @@ function TagList({ children, className = "", label = "", ...otherProps }: TagLis
|
|
|
10
10
|
const tagList = (
|
|
11
11
|
<ul className={`${eccgui}-tag__list` + (className && !label ? " " + className : "")} {...otherProps}>
|
|
12
12
|
{React.Children.map(children, (child, i) => {
|
|
13
|
-
return (
|
|
13
|
+
return child ? (
|
|
14
14
|
<li className={`${eccgui}-tag__list-item`} key={"tagitem_" + i}>
|
|
15
15
|
{child}
|
|
16
16
|
</li>
|
|
17
|
-
);
|
|
17
|
+
) : null;
|
|
18
18
|
})}
|
|
19
19
|
</ul>
|
|
20
20
|
);
|
|
@@ -35,10 +35,38 @@ export const SearchField = ({
|
|
|
35
35
|
className = "",
|
|
36
36
|
emptySearchInputMessage = "Enter search term",
|
|
37
37
|
onClearanceHandler,
|
|
38
|
-
onClearanceText = "Clear
|
|
38
|
+
onClearanceText = "Clear current search term",
|
|
39
|
+
onChange,
|
|
39
40
|
leftIcon = <Icon name="operation-search" />,
|
|
41
|
+
rightElement,
|
|
40
42
|
...otherProps
|
|
41
43
|
}: SearchFieldProps) => {
|
|
44
|
+
const [value, setValue] = React.useState<string>("");
|
|
45
|
+
|
|
46
|
+
const clearanceButton =
|
|
47
|
+
onClearanceHandler && value ? (
|
|
48
|
+
<IconButton
|
|
49
|
+
data-test-id={otherProps["data-test-id"] && `${otherProps["data-test-id"]}-clear-btn`}
|
|
50
|
+
name="operation-clear"
|
|
51
|
+
text={onClearanceText}
|
|
52
|
+
onClick={() => {
|
|
53
|
+
setValue("");
|
|
54
|
+
onClearanceHandler();
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
) : undefined;
|
|
58
|
+
|
|
59
|
+
const changeHandlerProcess = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
60
|
+
setValue(e.target.value);
|
|
61
|
+
if (onChange) {
|
|
62
|
+
onChange(e);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
React.useEffect(() => {
|
|
67
|
+
setValue(otherProps.value ?? otherProps.defaultValue ?? "");
|
|
68
|
+
}, [otherProps.value, otherProps.defaultValue]);
|
|
69
|
+
|
|
42
70
|
return (
|
|
43
71
|
<TextField
|
|
44
72
|
className={
|
|
@@ -50,16 +78,16 @@ export const SearchField = ({
|
|
|
50
78
|
placeholder={emptySearchInputMessage}
|
|
51
79
|
aria-label={emptySearchInputMessage}
|
|
52
80
|
rightElement={
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/>
|
|
60
|
-
) : undefined
|
|
81
|
+
(clearanceButton || rightElement) && (
|
|
82
|
+
<>
|
|
83
|
+
{rightElement}
|
|
84
|
+
{clearanceButton}
|
|
85
|
+
</>
|
|
86
|
+
)
|
|
61
87
|
}
|
|
88
|
+
onChange={changeHandlerProcess}
|
|
62
89
|
{...otherProps}
|
|
90
|
+
value={value}
|
|
63
91
|
type={"search"}
|
|
64
92
|
leftIcon={leftIcon}
|
|
65
93
|
round={true}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Meta, StoryFn } from "@storybook/react";
|
|
3
3
|
|
|
4
|
+
import { helpersArgTypes } from "../../../../.storybook/helpers";
|
|
5
|
+
|
|
4
6
|
import SearchField from "./../SearchField";
|
|
5
7
|
|
|
6
8
|
export default {
|
|
7
9
|
title: "Components/SearchField",
|
|
8
10
|
component: SearchField,
|
|
9
11
|
argTypes: {
|
|
12
|
+
leftIcon: {
|
|
13
|
+
...helpersArgTypes.exampleIcon,
|
|
14
|
+
},
|
|
15
|
+
rightElement: {
|
|
16
|
+
...helpersArgTypes.exampleIcon,
|
|
17
|
+
},
|
|
10
18
|
hasStatePrimary: { table: { disable: true } },
|
|
11
19
|
hasStateSuccess: { table: { disable: true } },
|
|
12
20
|
hasStateWarning: { table: { disable: true } },
|
|
@@ -23,7 +31,7 @@ Default.args = {
|
|
|
23
31
|
onClearanceText: "",
|
|
24
32
|
};
|
|
25
33
|
|
|
26
|
-
|
|
34
|
+
const SearchFieldWithClearanceIconTemplate: StoryFn<typeof SearchField> = (args) => {
|
|
27
35
|
const [query, setQuery] = React.useState<string>("");
|
|
28
36
|
return (
|
|
29
37
|
<SearchField
|
|
@@ -34,3 +42,9 @@ export const SearchFieldWithClearanceIcon: StoryFn<typeof SearchField> = (args)
|
|
|
34
42
|
/>
|
|
35
43
|
);
|
|
36
44
|
};
|
|
45
|
+
|
|
46
|
+
export const SearchFieldWithClearanceIcon = SearchFieldWithClearanceIconTemplate.bind({});
|
|
47
|
+
SearchFieldWithClearanceIcon.args = {
|
|
48
|
+
onClearanceHandler: null,
|
|
49
|
+
onClearanceText: "Clear field",
|
|
50
|
+
};
|
|
@@ -31,6 +31,7 @@ Default.args = {
|
|
|
31
31
|
fullWidth: false,
|
|
32
32
|
placeholder: "placeholder text",
|
|
33
33
|
readOnly: false,
|
|
34
|
+
disabled: false,
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
/** Text field with default value that contains a zero width/invisible character.
|
|
@@ -46,7 +47,7 @@ const invisibleCharacterWarningProps: TextFieldProps = {
|
|
|
46
47
|
const codePointsString = [...Array.from(codePoints)]
|
|
47
48
|
.map((n) => {
|
|
48
49
|
const info = characters.invisibleZeroWidthCharacters.codePointMap.get(n);
|
|
49
|
-
return info
|
|
50
|
+
return info?.fullLabel;
|
|
50
51
|
})
|
|
51
52
|
.join(", ");
|
|
52
53
|
alert("Invisible character detected in input string. Code points: " + codePointsString);
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
// own vars
|
|
5
5
|
$eccgui-size-textfield-height-small: $eccgui-size-block-whitespace * 2 !default;
|
|
6
6
|
$eccgui-size-textfield-height-regular: $eccgui-size-textfield-height-small * $eccgui-size-type-levelratio !default;
|
|
7
|
-
$eccgui-size-textfield-height-large: $eccgui-size-textfield-height-regular * $eccgui-size-type-levelratio *
|
|
7
|
+
$eccgui-size-textfield-height-large: $eccgui-size-textfield-height-regular * $eccgui-size-type-levelratio *
|
|
8
|
+
$eccgui-size-type-levelratio !default;
|
|
8
9
|
$eccgui-size-textfield-padding-horizontal-regular: $eccgui-size-inline-whitespace !default;
|
|
9
10
|
$eccgui-size-textfield-padding-horizontal-small: $eccgui-size-inline-whitespace * 0.5 !default;
|
|
10
11
|
$eccgui-typo-textfield-fontweight: $eccgui-font-weight-regular !default;
|
|
@@ -50,10 +51,23 @@ $input-button-height-small: math.div($eccgui-size-textfield-height-small, $eccgu
|
|
|
50
51
|
height: 100%;
|
|
51
52
|
max-height: $input-button-height-large;
|
|
52
53
|
|
|
53
|
-
& >
|
|
54
|
+
& > * {
|
|
55
|
+
vertical-align: middle;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
& > .#{eccgui}-icon,
|
|
59
|
+
& > .#{eccgui}-tooltip__wrapper {
|
|
54
60
|
display: inline-flex;
|
|
61
|
+
align-items: center;
|
|
55
62
|
height: 100%;
|
|
56
|
-
|
|
63
|
+
|
|
64
|
+
&:first-child {
|
|
65
|
+
margin-left: 0.5 * $eccgui-size-block-whitespace;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&:last-child {
|
|
69
|
+
margin-right: 0.5 * $eccgui-size-block-whitespace;
|
|
70
|
+
}
|
|
57
71
|
}
|
|
58
72
|
}
|
|
59
73
|
}
|
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
|
+
import { TestableComponent } from "../../components/interfaces";
|
|
4
5
|
|
|
5
|
-
export interface OverflowTextProps {
|
|
6
|
-
|
|
6
|
+
export interface OverflowTextProps extends React.HTMLAttributes<HTMLElement>, TestableComponent {
|
|
7
|
+
/**
|
|
8
|
+
* How is ellipsis used to cut text overflows.
|
|
9
|
+
* Use `reverse`to use the ellipis on text start and display the end of the text.
|
|
10
|
+
*/
|
|
11
|
+
ellipsis?: "add" | "reverse" | "none";
|
|
12
|
+
/**
|
|
13
|
+
* Display component as inline element.
|
|
14
|
+
*/
|
|
7
15
|
inline?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Using text overflow on all children elements.
|
|
18
|
+
*/
|
|
8
19
|
passDown?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Additional CSS class name.
|
|
22
|
+
*/
|
|
9
23
|
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* HTML element that is used for the component.
|
|
26
|
+
*/
|
|
10
27
|
useHtmlElement?: "p" | "div" | "span";
|
|
28
|
+
/**
|
|
29
|
+
* Used for all other necessary properties.
|
|
30
|
+
* @deprecated (v25) we will allow only basic HTML element properties and testing IDs
|
|
31
|
+
*/
|
|
11
32
|
[key: string]: any;
|
|
12
33
|
}
|
|
13
34
|
|
|
@@ -15,7 +36,7 @@ export interface OverflowTextProps {
|
|
|
15
36
|
export const OverflowText = ({
|
|
16
37
|
className = "",
|
|
17
38
|
children,
|
|
18
|
-
ellipsis,
|
|
39
|
+
ellipsis = "add",
|
|
19
40
|
inline = false,
|
|
20
41
|
passDown = false,
|
|
21
42
|
useHtmlElement,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import LoremIpsum, { loremIpsum } from "react-lorem-ipsum";
|
|
3
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { OverflowText } from "../../../index";
|
|
6
|
+
|
|
7
|
+
const config = {
|
|
8
|
+
title: "Components/Typography/OverflowText",
|
|
9
|
+
component: OverflowText,
|
|
10
|
+
argTypes: {
|
|
11
|
+
children: {
|
|
12
|
+
control: "select",
|
|
13
|
+
options: ["simple text", "2 paragraphs"],
|
|
14
|
+
mapping: {
|
|
15
|
+
"simple text": loremIpsum({
|
|
16
|
+
p: 1,
|
|
17
|
+
avgSentencesPerParagraph: 4,
|
|
18
|
+
random: false,
|
|
19
|
+
}),
|
|
20
|
+
"2 paragraphs": <LoremIpsum p={2} avgSentencesPerParagraph={4} random={false} />
|
|
21
|
+
},
|
|
22
|
+
description: "Content of the element.",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
} as Meta<typeof OverflowText>;
|
|
26
|
+
export default config;
|
|
27
|
+
|
|
28
|
+
const Template: StoryFn<typeof OverflowText> = (args) => <OverflowText {...args} />;
|
|
29
|
+
|
|
30
|
+
export const Default = Template.bind({});
|
|
31
|
+
Default.args = {
|
|
32
|
+
children: config?.argTypes?.children?.mapping ? config.argTypes.children.mapping["simple text"] : "Overflow text",
|
|
33
|
+
};
|