@eccenca/gui-elements 23.0.0-rc.7 → 23.1.0-rc.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 +58 -20
- package/README.md +7 -0
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js +7 -2
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +3 -7
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/cjs/cmem/react-flow/extensions/scrollOnDragHook.js +200 -0
- package/dist/cjs/cmem/react-flow/extensions/scrollOnDragHook.js.map +1 -0
- package/dist/cjs/common/Intent/index.js +7 -3
- package/dist/cjs/common/Intent/index.js.map +1 -1
- package/dist/cjs/common/utils/characters.js +82 -0
- package/dist/cjs/common/utils/characters.js.map +1 -0
- package/dist/cjs/components/Application/ApplicationTitle.js +2 -2
- package/dist/cjs/components/Application/ApplicationTitle.js.map +1 -1
- package/dist/cjs/components/Badge/Badge.js +44 -0
- package/dist/cjs/components/Badge/Badge.js.map +1 -0
- package/dist/cjs/components/Depiction/Depiction.js +111 -0
- package/dist/cjs/components/Depiction/Depiction.js.map +1 -0
- package/dist/cjs/components/Grid/Grid.js +7 -2
- package/dist/cjs/components/Grid/Grid.js.map +1 -1
- package/dist/cjs/components/Grid/GridColumn.js +6 -2
- package/dist/cjs/components/Grid/GridColumn.js.map +1 -1
- package/dist/cjs/components/Grid/GridRow.js +3 -0
- package/dist/cjs/components/Grid/GridRow.js.map +1 -1
- package/dist/cjs/components/Icon/BaseIcon.js +38 -0
- package/dist/cjs/components/Icon/BaseIcon.js.map +1 -0
- package/dist/cjs/components/Icon/Icon.js +9 -24
- package/dist/cjs/components/Icon/Icon.js.map +1 -1
- package/dist/cjs/components/Icon/IconButton.js +8 -1
- package/dist/cjs/components/Icon/IconButton.js.map +1 -1
- package/dist/cjs/components/Icon/TestIcon.js +35 -0
- package/dist/cjs/components/Icon/TestIcon.js.map +1 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js +123 -621
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/Icon/index.js +11 -0
- package/dist/cjs/components/Icon/index.js.map +1 -0
- package/dist/cjs/components/Menu/MenuItem.js +1 -1
- package/dist/cjs/components/Menu/MenuItem.js.map +1 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js +56 -23
- package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/cjs/components/Notification/Notification.js +10 -2
- package/dist/cjs/components/Notification/Notification.js.map +1 -1
- package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js +24 -0
- package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
- package/dist/cjs/components/Tag/Tag.js +6 -2
- package/dist/cjs/components/Tag/Tag.js.map +1 -1
- package/dist/cjs/components/TextField/TextArea.js +4 -2
- package/dist/cjs/components/TextField/TextArea.js.map +1 -1
- package/dist/cjs/components/TextField/TextField.js +4 -2
- package/dist/cjs/components/TextField/TextField.js.map +1 -1
- package/dist/cjs/components/TextField/useTextValidation.js +84 -0
- package/dist/cjs/components/TextField/useTextValidation.js.map +1 -0
- package/dist/cjs/components/Tree/Tree.js.map +1 -1
- package/dist/cjs/components/Typography/Highlighter.js.map +1 -1
- package/dist/cjs/components/Typography/OverflowText.js.map +1 -1
- package/dist/cjs/components/Typography/WhiteSpaceContainer.js +35 -12
- package/dist/cjs/components/Typography/WhiteSpaceContainer.js.map +1 -1
- package/dist/cjs/components/Typography/index.js +21 -0
- package/dist/cjs/components/Typography/index.js.map +1 -0
- package/dist/cjs/components/Workspace/WorkspaceContent.js +1 -1
- package/dist/cjs/components/Workspace/WorkspaceContent.js.map +1 -1
- package/dist/cjs/components/index.js +18 -0
- package/dist/cjs/components/index.js.map +1 -0
- package/dist/cjs/index.js +7 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +7 -2
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +3 -6
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/esm/cmem/react-flow/extensions/scrollOnDragHook.js +194 -0
- package/dist/esm/cmem/react-flow/extensions/scrollOnDragHook.js.map +1 -0
- package/dist/esm/common/Intent/index.js +5 -13
- package/dist/esm/common/Intent/index.js.map +1 -1
- package/dist/esm/common/utils/characters.js +96 -0
- package/dist/esm/common/utils/characters.js.map +1 -0
- package/dist/esm/components/Application/ApplicationTitle.js +2 -2
- package/dist/esm/components/Application/ApplicationTitle.js.map +1 -1
- package/dist/esm/components/Badge/Badge.js +48 -0
- package/dist/esm/components/Badge/Badge.js.map +1 -0
- package/dist/esm/components/Depiction/Depiction.js +96 -0
- package/dist/esm/components/Depiction/Depiction.js.map +1 -0
- package/dist/esm/components/Grid/Grid.js +7 -2
- package/dist/esm/components/Grid/Grid.js.map +1 -1
- package/dist/esm/components/Grid/GridColumn.js +6 -2
- package/dist/esm/components/Grid/GridColumn.js.map +1 -1
- package/dist/esm/components/Grid/GridRow.js +3 -0
- package/dist/esm/components/Grid/GridRow.js.map +1 -1
- package/dist/esm/components/Icon/BaseIcon.js +44 -0
- package/dist/esm/components/Icon/BaseIcon.js.map +1 -0
- package/dist/esm/components/Icon/Icon.js +9 -24
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/Icon/IconButton.js +8 -1
- package/dist/esm/components/Icon/IconButton.js.map +1 -1
- package/dist/esm/components/Icon/TestIcon.js +41 -0
- package/dist/esm/components/Icon/TestIcon.js.map +1 -0
- package/dist/esm/components/Icon/canonicalIconNames.js +123 -621
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/Icon/index.js +4 -0
- package/dist/esm/components/Icon/index.js.map +1 -0
- package/dist/esm/components/Menu/MenuItem.js +1 -1
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/MultiSelect/MultiSelect.js +61 -44
- package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/components/Notification/Notification.js +12 -4
- package/dist/esm/components/Notification/Notification.js.map +1 -1
- package/dist/esm/components/OverviewItem/OverviewItemDepiction.js +24 -0
- package/dist/esm/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
- package/dist/esm/components/Tag/Tag.js +6 -2
- package/dist/esm/components/Tag/Tag.js.map +1 -1
- package/dist/esm/components/TextField/TextArea.js +4 -2
- package/dist/esm/components/TextField/TextArea.js.map +1 -1
- package/dist/esm/components/TextField/TextField.js +4 -2
- package/dist/esm/components/TextField/TextField.js.map +1 -1
- package/dist/esm/components/TextField/useTextValidation.js +78 -0
- package/dist/esm/components/TextField/useTextValidation.js.map +1 -0
- package/dist/esm/components/Tree/Tree.js.map +1 -1
- package/dist/esm/components/Typography/Highlighter.js.map +1 -1
- package/dist/esm/components/Typography/OverflowText.js.map +1 -1
- package/dist/esm/components/Typography/WhiteSpaceContainer.js +16 -14
- package/dist/esm/components/Typography/WhiteSpaceContainer.js.map +1 -1
- package/dist/esm/components/Typography/index.js +12 -0
- package/dist/esm/components/Typography/index.js.map +1 -0
- package/dist/esm/components/Workspace/WorkspaceContent.js +1 -1
- package/dist/esm/components/Workspace/WorkspaceContent.js.map +1 -1
- package/dist/esm/components/index.js +6 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/index.js +5 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +2 -1
- package/dist/types/cmem/react-flow/ReactFlow/ReactFlow.d.ts +14 -0
- package/dist/types/cmem/react-flow/extensions/scrollOnDragHook.d.ts +22 -0
- package/dist/types/common/Intent/index.d.ts +4 -3
- package/dist/types/common/utils/characters.d.ts +19 -0
- package/dist/types/components/Badge/Badge.d.ts +42 -0
- package/dist/types/components/Depiction/Depiction.d.ts +71 -0
- package/dist/types/components/Grid/Grid.d.ts +21 -2
- package/dist/types/components/Grid/GridColumn.d.ts +20 -2
- package/dist/types/components/Grid/GridRow.d.ts +17 -1
- package/dist/types/components/Icon/BaseIcon.d.ts +45 -0
- package/dist/types/components/Icon/Icon.d.ts +7 -34
- package/dist/types/components/Icon/IconButton.d.ts +3 -2
- package/dist/types/components/Icon/TestIcon.d.ts +20 -0
- package/dist/types/components/Icon/canonicalIconNames.d.ts +9 -7
- package/dist/types/components/Icon/index.d.ts +4 -0
- package/dist/types/components/Menu/MenuItem.d.ts +2 -1
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +3 -1
- package/dist/types/components/Notification/Notification.d.ts +13 -4
- package/dist/types/components/Tabs/Tab.d.ts +2 -0
- package/dist/types/components/Tag/Tag.d.ts +16 -3
- package/dist/types/components/TextField/TextArea.d.ts +7 -2
- package/dist/types/components/TextField/TextField.d.ts +6 -1
- package/dist/types/components/TextField/useTextValidation.d.ts +28 -0
- package/dist/types/components/Tree/Tree.d.ts +2 -1
- package/dist/types/components/Typography/Highlighter.d.ts +2 -2
- package/dist/types/components/Typography/OverflowText.d.ts +2 -2
- package/dist/types/components/Typography/WhiteSpaceContainer.d.ts +45 -4
- package/dist/types/components/Typography/index.d.ts +12 -0
- package/dist/types/components/index.d.ts +5 -0
- package/dist/types/index.d.ts +6 -11
- package/package.json +13 -16
- package/scripts/compile-sass.ts +9 -1
- package/src/_shame.scss +1 -1
- package/src/cmem/ActivityControl/ActivityControlWidget.stories.tsx +6 -4
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +3 -2
- package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +26 -1
- package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +10 -6
- package/src/cmem/react-flow/extensions/scrollOnDragHook.ts +247 -0
- package/src/common/Intent/index.ts +16 -12
- package/src/common/utils/characters.ts +111 -0
- package/src/components/Accordion/accordion.scss +4 -3
- package/src/components/Application/ApplicationTitle.tsx +2 -2
- package/src/components/Application/_config.scss +1 -1
- package/src/components/Application/_content.scss +1 -1
- package/src/components/Application/_header.scss +2 -2
- package/src/components/Application/_sidebar.scss +2 -9
- package/src/components/Application/_toolbar.scss +1 -1
- package/src/components/Application/application.scss +4 -4
- package/src/components/AutocompleteField/autoCompleteFieldUtils.tsx +13 -8
- package/src/components/Badge/Badge.stories.tsx +47 -0
- package/src/components/Badge/Badge.tsx +93 -0
- package/src/components/Badge/badge.scss +44 -0
- package/src/components/Depiction/Depiction.tsx +198 -0
- package/src/components/Depiction/depiction.scss +176 -0
- package/src/components/Depiction/stories/Depiction.stories.tsx +69 -0
- package/src/components/Depiction/stories/test-16to9.png +0 -0
- package/src/components/Depiction/stories/test-16to9.svg +41 -0
- package/src/components/Depiction/stories/test-16to9.tobase64.svg +41 -0
- package/src/components/Depiction/stories/test-16to9.tsx +44 -0
- package/src/components/Depiction/stories/test-9to16.png +0 -0
- package/src/components/Depiction/stories/test-9to16.svg +44 -0
- package/src/components/Depiction/stories/test-9to16.tobase64.svg +44 -0
- package/src/components/Depiction/stories/test-9to16.tsx +48 -0
- package/src/components/Grid/Grid.tsx +22 -4
- package/src/components/Grid/GridColumn.tsx +23 -6
- package/src/components/Grid/GridRow.tsx +17 -2
- package/src/components/Grid/grid.scss +8 -11
- package/src/components/Grid/stories/Grid.stories.tsx +27 -0
- package/src/components/Grid/stories/GridColumn.stories.tsx +66 -0
- package/src/components/Grid/stories/GridRow.stories.tsx +47 -0
- package/src/components/Icon/BaseIcon.tsx +84 -0
- package/src/components/Icon/Icon.tsx +23 -82
- package/src/components/Icon/IconButton.tsx +18 -14
- package/src/components/Icon/TestIcon.tsx +39 -0
- package/src/components/Icon/canonicalIconNames.tsx +132 -633
- package/src/components/Icon/index.ts +5 -0
- package/src/components/Icon/stories/Icon.stories.tsx +13 -0
- package/src/components/Icon/stories/IconButton.stories.tsx +14 -7
- package/src/components/Icon/stories/TestIcon.stories.tsx +28 -0
- package/src/components/Link/link.scss +2 -1
- package/src/components/Menu/MenuItem.tsx +14 -4
- package/src/components/Menu/Stories/MenuItem.stories.tsx +16 -2
- package/src/components/MultiSelect/MultiSelect.tsx +58 -27
- package/src/components/Notification/Notification.stories.tsx +4 -0
- package/src/components/Notification/Notification.tsx +26 -6
- package/src/components/OverviewItem/OverviewItemDepiction.tsx +31 -0
- package/src/components/OverviewItem/overviewitem.scss +2 -1
- package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +22 -1
- package/src/components/OverviewItem/stories/OverviewItemDepiction.stories.tsx +8 -3
- package/src/components/Pagination/pagination.scss +3 -2
- package/src/components/SimpleTable/simpletable.scss +11 -12
- package/src/components/Tag/Tag.stories.tsx +7 -2
- package/src/components/Tag/Tag.tsx +24 -4
- package/src/components/Tag/tag.scss +84 -3
- package/src/components/TagInput/taginput.scss +6 -0
- package/src/components/TextField/TextArea.tsx +10 -1
- package/src/components/TextField/TextField.tsx +9 -0
- package/src/components/TextField/stories/SearchField.stories.tsx +1 -1
- package/src/components/TextField/textfield.scss +12 -0
- package/src/components/TextField/useTextValidation.ts +103 -0
- package/src/components/Tooltip/tooltip.scss +1 -1
- package/src/components/Tree/Tree.stories.tsx +7 -1
- package/src/components/Tree/Tree.tsx +2 -1
- package/src/components/Typography/Highlighter.tsx +2 -2
- package/src/components/Typography/OverflowText.tsx +2 -2
- package/src/components/Typography/WhiteSpaceContainer.tsx +69 -21
- package/src/components/Typography/index.ts +25 -0
- package/src/components/Typography/stories/WhiteSpaceContainer.stories.tsx +55 -0
- package/src/components/Typography/typography.scss +3 -2
- package/src/components/Workspace/WorkspaceContent.tsx +1 -1
- package/src/components/index.scss +5 -0
- package/src/components/index.ts +5 -0
- package/src/includes/carbon-components/_components.scss +11 -0
- package/src/includes/carbon-components/_requisits.scss +18 -0
- package/src/includes/carbon-components/_variables.scss +50 -53
- package/src/index.scss +4 -105
- package/src/index.ts +6 -16
|
@@ -10,6 +10,9 @@ export default {
|
|
|
10
10
|
icon: {
|
|
11
11
|
...helpersArgTypes.exampleIcon,
|
|
12
12
|
},
|
|
13
|
+
intent: {
|
|
14
|
+
...helpersArgTypes.exampleIntent,
|
|
15
|
+
},
|
|
13
16
|
backgroundColor: {
|
|
14
17
|
control: "color",
|
|
15
18
|
},
|
|
@@ -24,10 +27,12 @@ export default {
|
|
|
24
27
|
} as ComponentMeta<typeof Tag>;
|
|
25
28
|
|
|
26
29
|
const Template: ComponentStory<typeof Tag> = (args) => (
|
|
27
|
-
<Tag {...args}
|
|
30
|
+
<Tag {...args} />
|
|
28
31
|
);
|
|
29
32
|
|
|
30
33
|
export const Default = Template.bind({});
|
|
31
34
|
Default.args = {
|
|
32
|
-
|
|
35
|
+
children: "Tag label",
|
|
36
|
+
onClick: undefined,
|
|
37
|
+
onRemove: undefined,
|
|
33
38
|
};
|
|
@@ -4,20 +4,26 @@ import {
|
|
|
4
4
|
TagProps as BlueprintTagProps
|
|
5
5
|
} from "@blueprintjs/core";
|
|
6
6
|
import Color from "color";
|
|
7
|
+
import Icon, { IconProps } from "../Icon/Icon";
|
|
8
|
+
import { TestIconProps } from "../Icon/TestIcon";
|
|
9
|
+
import { ValidIconName } from "../Icon/canonicalIconNames";
|
|
10
|
+
import {
|
|
11
|
+
IntentTypes,
|
|
12
|
+
intentClassName
|
|
13
|
+
} from "../../common/Intent";
|
|
7
14
|
import decideContrastColorValue from "./../../common/utils/colorDecideContrastvalue";
|
|
8
15
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
9
16
|
|
|
10
|
-
interface TagProps extends Omit<
|
|
17
|
+
export interface TagProps extends Omit<
|
|
11
18
|
BlueprintTagProps,
|
|
12
19
|
// currently not supported
|
|
13
20
|
"active" |
|
|
14
21
|
"fill" |
|
|
22
|
+
"icon" |
|
|
23
|
+
"intent" |
|
|
15
24
|
"large" |
|
|
16
25
|
"multiline" |
|
|
17
|
-
"intent" |
|
|
18
26
|
"rightIcon"
|
|
19
|
-
// Removed round to have chip-like elements, since they are currently missing
|
|
20
|
-
// "round"
|
|
21
27
|
> {
|
|
22
28
|
// own properties
|
|
23
29
|
|
|
@@ -42,10 +48,19 @@ interface TagProps extends Omit<
|
|
|
42
48
|
* display tag in a large version
|
|
43
49
|
*/
|
|
44
50
|
large?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Meaning of the tag.
|
|
53
|
+
*/
|
|
54
|
+
intent?: IntentTypes;
|
|
55
|
+
/**
|
|
56
|
+
* Icon displayed left from the tag label.
|
|
57
|
+
*/
|
|
58
|
+
icon?: ValidIconName | React.ReactElement<IconProps> | React.ReactElement<TestIconProps>;
|
|
45
59
|
|
|
46
60
|
// deprecated
|
|
47
61
|
|
|
48
62
|
/**
|
|
63
|
+
* @deprecated
|
|
49
64
|
* **deprecated**, use `minimal=false` plus `emphasis="stronger"`
|
|
50
65
|
*/
|
|
51
66
|
emphasized?: never;
|
|
@@ -54,6 +69,8 @@ interface TagProps extends Omit<
|
|
|
54
69
|
function Tag({
|
|
55
70
|
children,
|
|
56
71
|
className = '',
|
|
72
|
+
intent,
|
|
73
|
+
icon,
|
|
57
74
|
emphasis = "normal",
|
|
58
75
|
minimal = true,
|
|
59
76
|
small = false,
|
|
@@ -79,16 +96,19 @@ function Tag({
|
|
|
79
96
|
}
|
|
80
97
|
}
|
|
81
98
|
}
|
|
99
|
+
const leftIcon = (!!icon && typeof icon === "string") ? <Icon name={icon} /> : icon;
|
|
82
100
|
return (
|
|
83
101
|
<BlueprintTag
|
|
84
102
|
{...otherProps}
|
|
85
103
|
className={
|
|
86
104
|
`${eccgui}-tag__item ${eccgui}-tag--${emphasis}emphasis` +
|
|
105
|
+
(!!intent ? ` ${intentClassName(intent)}` : '') +
|
|
87
106
|
(small ? ` ${eccgui}-tag--small` : '') +
|
|
88
107
|
(large ? ` ${eccgui}-tag--large` : '') +
|
|
89
108
|
(className ? ' ' + className : '')
|
|
90
109
|
}
|
|
91
110
|
minimal={minimal}
|
|
111
|
+
icon={!!leftIcon ? React.cloneElement(leftIcon, { small: !large}) : undefined}
|
|
92
112
|
>
|
|
93
113
|
{children}
|
|
94
114
|
</BlueprintTag>
|
|
@@ -15,7 +15,7 @@ $tag-padding: $tag-padding-top * 2; // !default;
|
|
|
15
15
|
$tag-margin: 0; // !default;
|
|
16
16
|
$tag-height-small: $eccgui-size-typo-tag; // !default;
|
|
17
17
|
$tag-line-height-small: $tag-height-small; // !default;
|
|
18
|
-
$tag-padding-small: $tag-padding * 0.5; // !default;
|
|
18
|
+
$tag-padding-small: $tag-padding-top * 0.5; // !default;
|
|
19
19
|
$tag-height-large: $eccgui-size-typo-tag-large * $eccgui-size-typo-tag-large-lineheight; // !default;
|
|
20
20
|
$tag-line-height-large: $eccgui-size-typo-tag-large; // !default;
|
|
21
21
|
$tag-padding-large: ($tag-height-large - $tag-line-height-large); // !default;
|
|
@@ -30,11 +30,22 @@ $tag-round-adjustment: 0px !default;
|
|
|
30
30
|
flex-grow: 0;
|
|
31
31
|
max-height: calc(#{$tag-height} - 2px);
|
|
32
32
|
min-height: calc(#{$tag-height} - 2px);
|
|
33
|
+
min-width: calc(#{$tag-height} - 2px);
|
|
34
|
+
padding: 0 $tag-padding-top;
|
|
33
35
|
|
|
34
36
|
&.#{$ns}-round {
|
|
35
37
|
border-radius: $tag-height * 0.5;
|
|
36
38
|
}
|
|
37
39
|
|
|
40
|
+
.#{$ns}-fill {
|
|
41
|
+
padding: $tag-padding-top 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.#{$ns}-tag-remove {
|
|
45
|
+
margin: 0 !important;
|
|
46
|
+
padding: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
38
49
|
.#{$eccgui}-overviewitem__description > & {
|
|
39
50
|
max-width: 39%;
|
|
40
51
|
}
|
|
@@ -44,11 +55,15 @@ $tag-round-adjustment: 0px !default;
|
|
|
44
55
|
min-height: calc(#{$tag-height-small} + #{$tag-padding-small} - 2px);
|
|
45
56
|
min-width: calc(#{$tag-height-small} + #{$tag-padding-small} - 2px);
|
|
46
57
|
line-height: calc(#{$tag-height-small} - 2px);
|
|
47
|
-
padding:
|
|
58
|
+
padding: 0 $tag-padding-small;
|
|
48
59
|
|
|
49
60
|
&.#{$ns}-round {
|
|
50
61
|
border-radius: $tag-height-small * 0.5;
|
|
51
62
|
}
|
|
63
|
+
|
|
64
|
+
.#{$ns}-fill {
|
|
65
|
+
padding: $tag-padding-small 0;
|
|
66
|
+
}
|
|
52
67
|
}
|
|
53
68
|
|
|
54
69
|
&.#{$eccgui}-tag--large {
|
|
@@ -57,7 +72,6 @@ $tag-round-adjustment: 0px !default;
|
|
|
57
72
|
min-width: calc(#{$tag-height-large} + #{$tag-padding-large} - 2px);
|
|
58
73
|
line-height: calc(#{$tag-height-large} - 2px);
|
|
59
74
|
font-size: $eccgui-size-typo-tag-large;
|
|
60
|
-
padding: $tag-padding-large * 0.5 $tag-padding-large;
|
|
61
75
|
|
|
62
76
|
&.#{$ns}-round {
|
|
63
77
|
border-radius: $tag-height-large * 0.5;
|
|
@@ -102,10 +116,12 @@ $tag-round-adjustment: 0px !default;
|
|
|
102
116
|
}
|
|
103
117
|
|
|
104
118
|
.#{$ns}-tag-remove {
|
|
119
|
+
color: inherit !important;
|
|
105
120
|
.#{$ns}-icon,
|
|
106
121
|
svg {
|
|
107
122
|
height: $eccgui-size-typo-tag;
|
|
108
123
|
width: $eccgui-size-typo-tag;
|
|
124
|
+
fill: currentColor;
|
|
109
125
|
}
|
|
110
126
|
}
|
|
111
127
|
|
|
@@ -158,5 +174,70 @@ $tag-round-adjustment: 0px !default;
|
|
|
158
174
|
background-color: rgba(mix(rgba($tag-default-color, 0), #fff), 0.5);
|
|
159
175
|
}
|
|
160
176
|
}
|
|
177
|
+
|
|
178
|
+
&.#{$eccgui}-intent--primary {
|
|
179
|
+
border-color: $eccgui-color-primary;
|
|
180
|
+
background-color: $eccgui-color-primary;
|
|
181
|
+
color: $eccgui-color-primary-contrast;
|
|
182
|
+
}
|
|
183
|
+
&.#{$eccgui}-intent--accent {
|
|
184
|
+
border-color: $eccgui-color-accent;
|
|
185
|
+
background-color: $eccgui-color-accent;
|
|
186
|
+
color: $eccgui-color-accent-contrast;
|
|
187
|
+
}
|
|
188
|
+
&.#{$eccgui}-intent--info {
|
|
189
|
+
border-color: $eccgui-color-info-text;
|
|
190
|
+
background-color: $eccgui-color-info-text;
|
|
191
|
+
color: $eccgui-color-info-background;
|
|
192
|
+
}
|
|
193
|
+
&.#{$eccgui}-intent--success {
|
|
194
|
+
border-color: $eccgui-color-success-text;
|
|
195
|
+
background-color: $eccgui-color-success-text;
|
|
196
|
+
color: $eccgui-color-success-background;
|
|
197
|
+
}
|
|
198
|
+
&.#{$eccgui}-intent--warning {
|
|
199
|
+
border-color: $eccgui-color-warning-text;
|
|
200
|
+
background-color: $eccgui-color-warning-text;
|
|
201
|
+
color: $eccgui-color-warning-background;
|
|
202
|
+
}
|
|
203
|
+
&.#{$eccgui}-intent--danger {
|
|
204
|
+
border-color: $eccgui-color-danger-text;
|
|
205
|
+
background-color: $eccgui-color-danger-text;
|
|
206
|
+
color: $eccgui-color-danger-background;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&.#{$ns}-minimal,
|
|
210
|
+
&.#{$ns}-minimal.#{$ns}-interactive {
|
|
211
|
+
&.#{$eccgui}-intent--primary {
|
|
212
|
+
border-color: $eccgui-color-primary;
|
|
213
|
+
color: $eccgui-color-primary;
|
|
214
|
+
background-color: $eccgui-color-primary-contrast;
|
|
215
|
+
}
|
|
216
|
+
&.#{$eccgui}-intent--accent {
|
|
217
|
+
border-color: $eccgui-color-accent;
|
|
218
|
+
color: $eccgui-color-accent;
|
|
219
|
+
background-color: $eccgui-color-accent-contrast;
|
|
220
|
+
}
|
|
221
|
+
&.#{$eccgui}-intent--info {
|
|
222
|
+
border-color: $eccgui-color-info-text;
|
|
223
|
+
color: $eccgui-color-info-text;
|
|
224
|
+
background-color: $eccgui-color-info-background;
|
|
225
|
+
}
|
|
226
|
+
&.#{$eccgui}-intent--success {
|
|
227
|
+
border-color: $eccgui-color-success-text;
|
|
228
|
+
color: $eccgui-color-success-text;
|
|
229
|
+
background-color: $eccgui-color-success-background;
|
|
230
|
+
}
|
|
231
|
+
&.#{$eccgui}-intent--warning {
|
|
232
|
+
border-color: $eccgui-color-warning-text;
|
|
233
|
+
color: $eccgui-color-warning-text;
|
|
234
|
+
background-color: $eccgui-color-warning-background;
|
|
235
|
+
}
|
|
236
|
+
&.#{$eccgui}-intent--danger {
|
|
237
|
+
border-color: $eccgui-color-danger-text;
|
|
238
|
+
color: $eccgui-color-danger-text;
|
|
239
|
+
background-color: $eccgui-color-danger-background;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
161
242
|
}
|
|
162
243
|
}
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
TextAreaProps as BlueprintTextAreaProps,
|
|
6
6
|
} from "@blueprintjs/core";
|
|
7
7
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
8
|
+
import {InvisibleCharacterWarningProps, useTextValidation} from "./useTextValidation";
|
|
8
9
|
|
|
9
|
-
interface TextAreaProps extends Partial<BlueprintTextAreaProps> {
|
|
10
|
+
export interface TextAreaProps extends Partial<BlueprintTextAreaProps> {
|
|
10
11
|
/**
|
|
11
12
|
* when set to true the input takes a blue border color
|
|
12
13
|
*/
|
|
@@ -23,6 +24,10 @@ interface TextAreaProps extends Partial<BlueprintTextAreaProps> {
|
|
|
23
24
|
* when set to true the input takes a red border color
|
|
24
25
|
*/
|
|
25
26
|
hasStateDanger?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* If set, allows to be informed of invisible, hard to spot characters in the string value.
|
|
29
|
+
*/
|
|
30
|
+
invisibleCharacterWarning?: InvisibleCharacterWarningProps
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
function TextArea({
|
|
@@ -32,6 +37,7 @@ function TextArea({
|
|
|
32
37
|
hasStateWarning = false,
|
|
33
38
|
hasStateDanger = false,
|
|
34
39
|
rows = 5,
|
|
40
|
+
invisibleCharacterWarning,
|
|
35
41
|
...otherProps
|
|
36
42
|
}: TextAreaProps) {
|
|
37
43
|
let intent;
|
|
@@ -52,6 +58,8 @@ function TextArea({
|
|
|
52
58
|
break;
|
|
53
59
|
}
|
|
54
60
|
|
|
61
|
+
const maybeWrappedOnChange = useTextValidation({...otherProps, invisibleCharacterWarning})
|
|
62
|
+
|
|
55
63
|
return (
|
|
56
64
|
<BlueprintTextArea
|
|
57
65
|
className={`${eccgui}-textarea ` + className}
|
|
@@ -59,6 +67,7 @@ function TextArea({
|
|
|
59
67
|
rows={rows ? rows : undefined}
|
|
60
68
|
{...otherProps}
|
|
61
69
|
dir={"auto"}
|
|
70
|
+
onChange={maybeWrappedOnChange}
|
|
62
71
|
/>
|
|
63
72
|
);
|
|
64
73
|
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import Icon from "../Icon/Icon";
|
|
11
11
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
12
12
|
import {ValidIconName} from "../Icon/canonicalIconNames";
|
|
13
|
+
import {InvisibleCharacterWarningProps, useTextValidation} from "./useTextValidation";
|
|
13
14
|
|
|
14
15
|
export interface TextFieldProps extends Partial<Omit<InputGroupProps, "intent" | "leftIcon"> & HTMLInputProps> {
|
|
15
16
|
/**
|
|
@@ -36,6 +37,10 @@ export interface TextFieldProps extends Partial<Omit<InputGroupProps, "intent" |
|
|
|
36
37
|
* Left aligned icon, can be a canonical icon name or an `Icon` element.
|
|
37
38
|
*/
|
|
38
39
|
leftIcon?: ValidIconName | MaybeElement;
|
|
40
|
+
/**
|
|
41
|
+
* If set, allows to be informed of invisible, hard to spot characters in the string value.
|
|
42
|
+
*/
|
|
43
|
+
invisibleCharacterWarning?: InvisibleCharacterWarningProps
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
/**
|
|
@@ -49,6 +54,7 @@ function TextField({
|
|
|
49
54
|
hasStateDanger = false,
|
|
50
55
|
fullWidth = true,
|
|
51
56
|
leftIcon,
|
|
57
|
+
invisibleCharacterWarning,
|
|
52
58
|
...otherProps
|
|
53
59
|
}: TextFieldProps) {
|
|
54
60
|
let intent;
|
|
@@ -69,6 +75,8 @@ function TextField({
|
|
|
69
75
|
break;
|
|
70
76
|
}
|
|
71
77
|
|
|
78
|
+
const maybeWrappedOnChange = useTextValidation({...otherProps, invisibleCharacterWarning})
|
|
79
|
+
|
|
72
80
|
if ((otherProps.readOnly || otherProps.disabled) && !!otherProps.value && !otherProps.title) {
|
|
73
81
|
otherProps["title"] = otherProps.value;
|
|
74
82
|
}
|
|
@@ -93,6 +101,7 @@ function TextField({
|
|
|
93
101
|
) : undefined
|
|
94
102
|
}
|
|
95
103
|
dir={"auto"}
|
|
104
|
+
onChange={maybeWrappedOnChange}
|
|
96
105
|
/>
|
|
97
106
|
);
|
|
98
107
|
}
|
|
@@ -41,6 +41,18 @@ $input-button-height-small: math.div($eccgui-size-textfield-height-small, $eccgu
|
|
|
41
41
|
&.#{$ns}-fill {
|
|
42
42
|
display: block;
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
.#{$ns}-input-action {
|
|
46
|
+
// right element need to be adjusted for cases when there are no button with the same hight like the input
|
|
47
|
+
height: 100%;
|
|
48
|
+
max-height: $input-button-height-large;
|
|
49
|
+
|
|
50
|
+
& > .#{eccgui}-icon {
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
height: 100%;
|
|
53
|
+
margin: 0 0.5 * $eccgui-size-block-whitespace;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
44
56
|
}
|
|
45
57
|
|
|
46
58
|
// enhancements
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, {ChangeEventHandler} from "react";
|
|
2
|
+
import chars from "../../common/utils/characters"
|
|
3
|
+
|
|
4
|
+
export interface InvisibleCharacterWarningProps {
|
|
5
|
+
/**
|
|
6
|
+
* If set, the function is called after every value change what invisible characters have been detected.
|
|
7
|
+
*/
|
|
8
|
+
callback: (detectedCodePoints: Set<number>) => any
|
|
9
|
+
/**
|
|
10
|
+
* The delay in milliseconds after which an input string should be checked. Only the most recent value will be checked.
|
|
11
|
+
* A higher value will reduce the probability that the typing stalls.
|
|
12
|
+
*
|
|
13
|
+
* Default: 500
|
|
14
|
+
*/
|
|
15
|
+
callbackDelay?: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface Props<T = Element> {
|
|
19
|
+
/** Forwarded TextField props */
|
|
20
|
+
value?: string | ReadonlyArray<string> | number | undefined;
|
|
21
|
+
readOnly?: boolean | undefined;
|
|
22
|
+
disabled?: boolean | undefined;
|
|
23
|
+
onChange?: ChangeEventHandler<T>
|
|
24
|
+
/**
|
|
25
|
+
* If set, allows to be informed of invisible, hard to spot characters in the string value.
|
|
26
|
+
*/
|
|
27
|
+
invisibleCharacterWarning?: InvisibleCharacterWarningProps
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Validates the string value for invisible characters. */
|
|
31
|
+
export const useTextValidation = <T>({value, onChange, invisibleCharacterWarning}: Props<T>) => {
|
|
32
|
+
const callback = invisibleCharacterWarning?.callback
|
|
33
|
+
const callbackDelay = invisibleCharacterWarning?.callbackDelay
|
|
34
|
+
const state = React.useRef<{
|
|
35
|
+
checkedValue?: string | ReadonlyArray<string> | number,
|
|
36
|
+
timeout?: number,
|
|
37
|
+
detectedCodePoints: Set<number>
|
|
38
|
+
}>({detectedCodePoints: new Set()})
|
|
39
|
+
const clearState = React.useCallback(() => {
|
|
40
|
+
state.current.timeout && clearTimeout(state.current.timeout)
|
|
41
|
+
state.current.checkedValue = undefined
|
|
42
|
+
state.current.detectedCodePoints = new Set()
|
|
43
|
+
}, [])
|
|
44
|
+
const detectionRegex = React.useMemo(() => chars.invisibleZeroWidthCharacters.createRegex(), [])
|
|
45
|
+
const detectIssues = React.useCallback((value: string): void => {
|
|
46
|
+
detectionRegex.lastIndex = 0
|
|
47
|
+
let matchArray = detectionRegex.exec(value)
|
|
48
|
+
while(matchArray) {
|
|
49
|
+
const codePoint = matchArray[0].codePointAt(0)
|
|
50
|
+
if(codePoint) {
|
|
51
|
+
state.current.detectedCodePoints.add(codePoint)
|
|
52
|
+
}
|
|
53
|
+
matchArray = detectionRegex.exec(value)
|
|
54
|
+
}
|
|
55
|
+
}, [detectionRegex])
|
|
56
|
+
// Checks if the value contains any problematic characters with a small delay.
|
|
57
|
+
const checkValue = React.useCallback((value: string | ReadonlyArray<string> | number) => {
|
|
58
|
+
state.current.detectedCodePoints = new Set()
|
|
59
|
+
if(typeof value === "number") {
|
|
60
|
+
clearState()
|
|
61
|
+
} else if(typeof value === "string") {
|
|
62
|
+
detectIssues(value)
|
|
63
|
+
} else {
|
|
64
|
+
value.forEach((arrayValue) => detectIssues(arrayValue))
|
|
65
|
+
}
|
|
66
|
+
callback?.(state.current.detectedCodePoints)
|
|
67
|
+
}, [callback, clearState, detectIssues])
|
|
68
|
+
const scheduleCheck = React.useCallback((value: string | ReadonlyArray<string> | number) => {
|
|
69
|
+
if(state.current.checkedValue === value) {
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
state.current.checkedValue = value
|
|
73
|
+
state.current.timeout = window.setTimeout(() => {
|
|
74
|
+
if(state.current.checkedValue === value) {
|
|
75
|
+
checkValue(value)
|
|
76
|
+
clearState()
|
|
77
|
+
}
|
|
78
|
+
}, callbackDelay ?? 500)
|
|
79
|
+
}, [checkValue, clearState, callbackDelay])
|
|
80
|
+
// Do check via onChange handler
|
|
81
|
+
const wrappedOnChangeHandler: ChangeEventHandler<T> = React.useCallback((event) => {
|
|
82
|
+
const {value} = event.target as any
|
|
83
|
+
if(value != null && typeof value === "string") {
|
|
84
|
+
scheduleCheck(value)
|
|
85
|
+
} else {
|
|
86
|
+
clearState()
|
|
87
|
+
}
|
|
88
|
+
onChange?.(event)
|
|
89
|
+
}, [clearState, onChange, scheduleCheck])
|
|
90
|
+
// No callback, return
|
|
91
|
+
if(!callback) {
|
|
92
|
+
return onChange
|
|
93
|
+
}
|
|
94
|
+
if(value == null && onChange == null) {
|
|
95
|
+
return onChange
|
|
96
|
+
}
|
|
97
|
+
if(value != null) {
|
|
98
|
+
scheduleCheck(value)
|
|
99
|
+
return onChange
|
|
100
|
+
} else {
|
|
101
|
+
return wrappedOnChangeHandler
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -16,7 +16,7 @@ $tooltip2-padding-horizontal: $eccgui-size-block-whitespace * 0.5; // !default;
|
|
|
16
16
|
font-size: $eccgui-size-typo-tooltip;
|
|
17
17
|
line-height: $eccgui-size-typo-tooltip-lineheight;
|
|
18
18
|
white-space: normal;
|
|
19
|
-
|
|
19
|
+
overflow-wrap: break-word;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.#{$eccgui}-tooltip--small {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
-
import {
|
|
3
|
+
import { LogoReact } from "@carbon/icons-react";
|
|
4
|
+
import { Tree, TreeNodeInfo, Tag, OverflowText, Icon, TestIcon } from "./../../index";
|
|
4
5
|
import { TreeNodeShadow as TreeNode } from "./Tree";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
@@ -52,6 +53,11 @@ Default.args = {
|
|
|
52
53
|
label: "Tree item 1d with icon",
|
|
53
54
|
icon: <Icon name="item-info" />
|
|
54
55
|
},
|
|
56
|
+
{
|
|
57
|
+
id: 5,
|
|
58
|
+
label: "Tree item 1e with test icon",
|
|
59
|
+
icon: <TestIcon tryout={LogoReact} />
|
|
60
|
+
},
|
|
55
61
|
]
|
|
56
62
|
},
|
|
57
63
|
{
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
TreeNodeInfo as BlueprintTreeNodeInfo,
|
|
7
7
|
} from "@blueprintjs/core";
|
|
8
8
|
import { IconProps } from "./../Icon/Icon";
|
|
9
|
+
import { TestIconProps } from "./../Icon/TestIcon";
|
|
9
10
|
|
|
10
11
|
/* This is basically a tunnel to the Blueprint elements but we change a view thigs regarding the icons */
|
|
11
12
|
|
|
@@ -19,7 +20,7 @@ export interface TreeNodeInfo<T = {}> extends Omit<BlueprintTreeNodeInfo<T>, "ch
|
|
|
19
20
|
/**
|
|
20
21
|
* `<Icon />` element to render next to the node's label.
|
|
21
22
|
*/
|
|
22
|
-
icon?: React.ReactElement<IconProps>;
|
|
23
|
+
icon?: React.ReactElement<IconProps> | React.ReactElement<TestIconProps>;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
//export const TreeNode = BlueprintTreeNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
export interface HighlighterProps {
|
|
4
4
|
label?: string;
|
|
5
5
|
searchValue?: string;
|
|
6
6
|
}
|
|
@@ -10,7 +10,7 @@ interface IHighlighterProps {
|
|
|
10
10
|
* @param label The string to highlight.
|
|
11
11
|
* @param searchValue The mutli-word search query from which single words should be highlighted in the label.
|
|
12
12
|
*/
|
|
13
|
-
function Highlighter({ label, searchValue }:
|
|
13
|
+
function Highlighter({ label, searchValue }: HighlighterProps) {
|
|
14
14
|
return <>{getSearchHighlight(label, searchValue)}</>;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface OverflowTextProps {
|
|
5
5
|
ellipsis?: "reverse" | "none"
|
|
6
6
|
inline?: boolean
|
|
7
7
|
passDown?: boolean
|
|
@@ -19,7 +19,7 @@ function OverflowText({
|
|
|
19
19
|
passDown = false,
|
|
20
20
|
useHtmlElement,
|
|
21
21
|
...otherProps
|
|
22
|
-
}:
|
|
22
|
+
}: OverflowTextProps) {
|
|
23
23
|
const defaultHtmlElement = inline ? "span" : "div";
|
|
24
24
|
const overflowtextElement = useHtmlElement
|
|
25
25
|
? React.createElement(useHtmlElement)
|
|
@@ -1,19 +1,66 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
3
|
+
import * as TypographyClassNames from "./classnames";
|
|
3
4
|
|
|
5
|
+
type WhiteSpaceSizes = "tiny" | "small" | "regular" | "large" | "xlarge";
|
|
6
|
+
|
|
7
|
+
export interface WhiteSpaceContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/**
|
|
9
|
+
* Insert line breaks within an otherwise unbreakable string to prevent text from overflowing the container.
|
|
10
|
+
*/
|
|
11
|
+
linebreakForced?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Size of top margin around the container.
|
|
14
|
+
*/
|
|
15
|
+
marginTop?: WhiteSpaceSizes;
|
|
16
|
+
/**
|
|
17
|
+
* Size of right margin around the container.
|
|
18
|
+
*/
|
|
19
|
+
marginRight?: WhiteSpaceSizes;
|
|
20
|
+
/**
|
|
21
|
+
* Size of bottom margin around the container.
|
|
22
|
+
*/
|
|
23
|
+
marginBottom?: WhiteSpaceSizes;
|
|
24
|
+
/**
|
|
25
|
+
* Size of left margin around the container.
|
|
26
|
+
*/
|
|
27
|
+
marginLeft?: WhiteSpaceSizes;
|
|
28
|
+
/**
|
|
29
|
+
* Size of top padding inside the container.
|
|
30
|
+
*/
|
|
31
|
+
paddingTop?: WhiteSpaceSizes;
|
|
32
|
+
/**
|
|
33
|
+
* Size of right padding inside the container.
|
|
34
|
+
*/
|
|
35
|
+
paddingRight?: WhiteSpaceSizes;
|
|
36
|
+
/**
|
|
37
|
+
* Size of bottom padding inside the container.
|
|
38
|
+
*/
|
|
39
|
+
paddingBottom?: WhiteSpaceSizes;
|
|
40
|
+
/**
|
|
41
|
+
* Size of left padding inside the container.
|
|
42
|
+
*/
|
|
43
|
+
paddingLeft?: WhiteSpaceSizes;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Simple container to add whitespace inside and around of it without adding style attributes directly.
|
|
48
|
+
* This way the added whitespace keeps visually connected to the other whitespaces used in the application.
|
|
49
|
+
*/
|
|
4
50
|
function WhiteSpaceContainer({
|
|
5
|
-
className
|
|
51
|
+
className,
|
|
6
52
|
children,
|
|
7
|
-
marginTop
|
|
8
|
-
marginRight
|
|
9
|
-
marginBottom
|
|
10
|
-
marginLeft
|
|
11
|
-
paddingTop
|
|
12
|
-
paddingRight
|
|
13
|
-
paddingBottom
|
|
14
|
-
paddingLeft
|
|
15
|
-
|
|
16
|
-
|
|
53
|
+
marginTop,
|
|
54
|
+
marginRight,
|
|
55
|
+
marginBottom,
|
|
56
|
+
marginLeft,
|
|
57
|
+
paddingTop,
|
|
58
|
+
paddingRight,
|
|
59
|
+
paddingBottom,
|
|
60
|
+
paddingLeft,
|
|
61
|
+
linebreakForced = false,
|
|
62
|
+
...otherDivProps
|
|
63
|
+
}: WhiteSpaceContainerProps) {
|
|
17
64
|
|
|
18
65
|
const elementClassName = `${eccgui}-typography__whitespace`;
|
|
19
66
|
|
|
@@ -21,17 +68,18 @@ function WhiteSpaceContainer({
|
|
|
21
68
|
<div
|
|
22
69
|
className={
|
|
23
70
|
elementClassName +
|
|
24
|
-
(className ? " " + className : "") +
|
|
25
|
-
(marginTop ? ` ${elementClassName}-margintop-${marginTop}` : "") +
|
|
26
|
-
(marginRight ? ` ${elementClassName}-marginright-${marginRight}` : "") +
|
|
27
|
-
(marginBottom ? ` ${elementClassName}-marginbottom-${marginBottom}` : "") +
|
|
28
|
-
(marginLeft ? ` ${elementClassName}-marginleft-${marginLeft}` : "") +
|
|
29
|
-
(paddingTop ? ` ${elementClassName}-paddingtop-${paddingTop}` : "") +
|
|
30
|
-
(paddingRight ? ` ${elementClassName}-paddingright-${paddingRight}` : "") +
|
|
31
|
-
(paddingBottom ? ` ${elementClassName}-paddingbottom-${paddingBottom}` : "") +
|
|
32
|
-
(paddingLeft ? ` ${elementClassName}-paddingleft-${paddingLeft}` : "")
|
|
71
|
+
(!!className ? " " + className : "") +
|
|
72
|
+
(!!marginTop ? ` ${elementClassName}-margintop-${marginTop}` : "") +
|
|
73
|
+
(!!marginRight ? ` ${elementClassName}-marginright-${marginRight}` : "") +
|
|
74
|
+
(!!marginBottom ? ` ${elementClassName}-marginbottom-${marginBottom}` : "") +
|
|
75
|
+
(!!marginLeft ? ` ${elementClassName}-marginleft-${marginLeft}` : "") +
|
|
76
|
+
(!!paddingTop ? ` ${elementClassName}-paddingtop-${paddingTop}` : "") +
|
|
77
|
+
(!!paddingRight ? ` ${elementClassName}-paddingright-${paddingRight}` : "") +
|
|
78
|
+
(!!paddingBottom ? ` ${elementClassName}-paddingbottom-${paddingBottom}` : "") +
|
|
79
|
+
(!!paddingLeft ? ` ${elementClassName}-paddingleft-${paddingLeft}` : "") +
|
|
80
|
+
(linebreakForced ? " " + TypographyClassNames.FORCELINEBREAK : "")
|
|
33
81
|
}
|
|
34
|
-
{...
|
|
82
|
+
{...otherDivProps}
|
|
35
83
|
>
|
|
36
84
|
{children}
|
|
37
85
|
</div>
|