@eccenca/gui-elements 25.0.0-rc.2 → 25.1.0-featurev2510colorfield.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 +94 -18
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +17 -13
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- 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/common/index.js +4 -1
- package/dist/cjs/common/index.js.map +1 -1
- package/dist/cjs/common/utils/colorHash.js +25 -11
- package/dist/cjs/common/utils/colorHash.js.map +1 -1
- package/dist/cjs/common/utils/reduceToText.js +26 -1
- package/dist/cjs/common/utils/reduceToText.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/ColorField/ColorField.js +115 -0
- package/dist/cjs/components/ColorField/ColorField.js.map +1 -0
- package/dist/cjs/components/ContextOverlay/ContextMenu.js +2 -2
- package/dist/cjs/components/ContextOverlay/ContextMenu.js.map +1 -1
- package/dist/cjs/components/ContextOverlay/ContextOverlay.js +67 -29
- package/dist/cjs/components/ContextOverlay/ContextOverlay.js.map +1 -1
- package/dist/cjs/components/DecoupledOverlay/DecoupledOverlay.js +47 -0
- package/dist/cjs/components/DecoupledOverlay/DecoupledOverlay.js.map +1 -0
- package/dist/cjs/components/Icon/IconButton.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +3 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/Icon/transformIcon.js +14 -0
- package/dist/cjs/components/Icon/transformIcon.js.map +1 -0
- package/dist/cjs/components/MultiSelect/MultiSelect.js +2 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/cjs/components/RadioButton/RadioButton.js +5 -2
- package/dist/cjs/components/RadioButton/RadioButton.js.map +1 -1
- package/dist/cjs/components/TextReducer/TextReducer.js +15 -3
- package/dist/cjs/components/TextReducer/TextReducer.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/components/VisualTour/VisualTour.js +24 -32
- package/dist/cjs/components/VisualTour/VisualTour.js.map +1 -1
- package/dist/cjs/components/index.js +2 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/extensions/codemirror/CodeMirror.js +18 -6
- 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/EdgeLabel.js +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.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/ActivityControlWidget.js +19 -14
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.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/common/index.js +5 -2
- package/dist/esm/common/index.js.map +1 -1
- package/dist/esm/common/utils/colorHash.js +25 -12
- package/dist/esm/common/utils/colorHash.js.map +1 -1
- package/dist/esm/common/utils/reduceToText.js +37 -1
- package/dist/esm/common/utils/reduceToText.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/ColorField/ColorField.js +141 -0
- package/dist/esm/components/ColorField/ColorField.js.map +1 -0
- package/dist/esm/components/ContextOverlay/ContextMenu.js +2 -2
- package/dist/esm/components/ContextOverlay/ContextMenu.js.map +1 -1
- package/dist/esm/components/ContextOverlay/ContextOverlay.js +67 -29
- package/dist/esm/components/ContextOverlay/ContextOverlay.js.map +1 -1
- package/dist/esm/components/DecoupledOverlay/DecoupledOverlay.js +41 -0
- package/dist/esm/components/DecoupledOverlay/DecoupledOverlay.js.map +1 -0
- package/dist/esm/components/Icon/IconButton.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +3 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/Icon/transformIcon.js +21 -0
- package/dist/esm/components/Icon/transformIcon.js.map +1 -0
- package/dist/esm/components/MultiSelect/MultiSelect.js +3 -2
- package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/components/RadioButton/RadioButton.js +6 -2
- package/dist/esm/components/RadioButton/RadioButton.js.map +1 -1
- package/dist/esm/components/TextReducer/TextReducer.js +14 -3
- package/dist/esm/components/TextReducer/TextReducer.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/components/VisualTour/VisualTour.js +25 -33
- package/dist/esm/components/VisualTour/VisualTour.js.map +1 -1
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/extensions/codemirror/CodeMirror.js +19 -7
- 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/EdgeLabel.js +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.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/ActivityControl/ActivityControlWidget.d.ts +9 -0
- package/dist/types/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.d.ts +26 -10
- package/dist/types/common/index.d.ts +4 -1
- package/dist/types/common/utils/colorHash.d.ts +4 -3
- package/dist/types/common/utils/reduceToText.d.ts +1 -1
- package/dist/types/components/Application/ApplicationViewability.d.ts +36 -0
- package/dist/types/components/Application/index.d.ts +1 -0
- package/dist/types/components/ColorField/ColorField.d.ts +31 -0
- package/dist/types/components/ContextOverlay/ContextMenu.d.ts +1 -1
- package/dist/types/components/ContextOverlay/ContextOverlay.d.ts +7 -1
- package/dist/types/components/DecoupledOverlay/DecoupledOverlay.d.ts +20 -0
- package/dist/types/components/Icon/IconButton.d.ts +1 -1
- package/dist/types/components/Icon/canonicalIconNames.d.ts +2 -0
- package/dist/types/components/Icon/transformIcon.d.ts +2 -0
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/types/components/RadioButton/RadioButton.d.ts +8 -2
- package/dist/types/components/Structure/TitleSubsection.d.ts +1 -1
- package/dist/types/components/Tabs/Tab.d.ts +2 -2
- package/dist/types/components/TextReducer/TextReducer.d.ts +13 -1
- package/dist/types/components/Typography/InlineText.d.ts +13 -0
- package/dist/types/components/Typography/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +2 -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 +54 -53
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +68 -35
- 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/common/index.ts +8 -3
- package/src/common/utils/colorHash.ts +36 -18
- package/src/common/utils/reduceToText.tsx +30 -2
- package/src/components/Application/ApplicationViewability.tsx +61 -0
- package/src/components/Application/_colors.scss +15 -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/ColorField/ColorField.stories.tsx +69 -0
- package/src/components/ColorField/ColorField.test.tsx +125 -0
- package/src/components/ColorField/ColorField.tsx +200 -0
- package/src/components/ColorField/_colorfield.scss +56 -0
- package/src/components/ContentGroup/_contentgroup.scss +9 -0
- package/src/components/ContextOverlay/ContextMenu.tsx +4 -1
- package/src/components/ContextOverlay/ContextOverlay.tsx +94 -25
- package/src/components/ContextOverlay/tests/ContextMenu.test.tsx +43 -0
- package/src/components/ContextOverlay/tests/ContextOverlay.test.tsx +71 -0
- package/src/components/DecoupledOverlay/DecoupledOverlay.stories.tsx +30 -0
- package/src/components/DecoupledOverlay/DecoupledOverlay.tsx +97 -0
- package/src/components/DecoupledOverlay/_decoupledoverlay.scss +46 -0
- package/src/components/Depiction/depiction.scss +6 -0
- package/src/components/Dialog/stories/Modal.stories.tsx +12 -150
- package/src/components/Dialog/stories/ModalContext.stories.tsx +153 -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/Icon/canonicalIconNames.tsx +3 -0
- package/src/components/Icon/transformIcon.tsx +17 -0
- package/src/components/Link/Link.stories.tsx +30 -0
- package/src/components/Link/link.scss +28 -2
- package/src/components/MultiSelect/MultiSelect.tsx +12 -3
- 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/RadioButton/RadioButton.tsx +15 -3
- package/src/components/RadioButton/radiobutton.scss +13 -0
- 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.stories.tsx +2 -1
- package/src/components/TextReducer/TextReducer.test.tsx +44 -0
- package/src/components/TextReducer/TextReducer.tsx +14 -4
- 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/components/VisualTour/VisualTour.tsx +30 -50
- package/src/components/VisualTour/visualTour.scss +0 -34
- package/src/components/index.scss +2 -0
- package/src/components/index.ts +2 -0
- package/src/configuration/_customproperties.scss +32 -0
- package/src/configuration/stories/customproperties.stories.tsx +118 -0
- package/src/extensions/codemirror/CodeMirror.tsx +20 -9
- package/src/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.ts +1 -2
- package/src/extensions/codemirror/tests/codemirrorTestHelper.ts +3 -3
- package/src/extensions/react-flow/_config.scss +3 -3
- package/src/extensions/react-flow/edges/EdgeLabel.tsx +5 -3
- package/src/extensions/react-flow/edges/EdgeNew.tsx +2 -1
- package/src/extensions/react-flow/edges/_edges.scss +3 -2
- 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
- package/src/index.scss +1 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
|
|
4
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
5
|
+
|
|
6
|
+
type media = "print" | "screen";
|
|
7
|
+
|
|
8
|
+
interface ApplicationViewabilityShow {
|
|
9
|
+
/**
|
|
10
|
+
* Show on media type.
|
|
11
|
+
* If used, `hide` cannot be set.
|
|
12
|
+
*/
|
|
13
|
+
show: media;
|
|
14
|
+
hide?: never;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ApplicationViewabilityHide {
|
|
18
|
+
/**
|
|
19
|
+
* Hide on media type.
|
|
20
|
+
* If used, `show` cannot be set.
|
|
21
|
+
*/
|
|
22
|
+
hide: media;
|
|
23
|
+
show?: never;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface ApplicationViewabilityUndecided {
|
|
27
|
+
/**
|
|
28
|
+
* Only one child allowed.
|
|
29
|
+
* Need to process the `className` property.
|
|
30
|
+
*/
|
|
31
|
+
children: React.ReactElement<{ className?: string }>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type ApplicationViewabilityProps = ApplicationViewabilityUndecided &
|
|
35
|
+
(ApplicationViewabilityShow | ApplicationViewabilityHide);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Sets the viewability of the the contained element regarding media.
|
|
39
|
+
* Can be used to hide elements, e.g. when the page is printed.
|
|
40
|
+
*/
|
|
41
|
+
export const ApplicationViewability = ({ children, show, hide }: ApplicationViewabilityProps) => {
|
|
42
|
+
if (!show && !hide) {
|
|
43
|
+
return children;
|
|
44
|
+
}
|
|
45
|
+
if (show === hide) {
|
|
46
|
+
// eslint-disable-next-line no-console
|
|
47
|
+
console.warn("`<ApplicationViewability/>` used with same media type for `hide` and `show`.");
|
|
48
|
+
return children;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const enhancedClone = React.cloneElement(children, {
|
|
52
|
+
className: classNames(children.props.className, {
|
|
53
|
+
[`${eccgui}-application__hide--${hide}`]: hide,
|
|
54
|
+
[`${eccgui}-application__show--${show}`]: show,
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return enhancedClone;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default ApplicationViewability;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@use "sass:list";
|
|
3
3
|
|
|
4
4
|
:root {
|
|
5
|
+
// creating css custom properties from palette colors
|
|
5
6
|
@each $palette-group-name, $palette-group-tints in $eccgui-color-palette-light {
|
|
6
7
|
@each $palette-tint-name, $palette-tint-colors in $palette-group-tints {
|
|
7
8
|
@for $i from 1 through list.length($palette-tint-colors) {
|
|
@@ -12,4 +13,18 @@
|
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
}
|
|
16
|
+
|
|
17
|
+
// set aliases for base colors
|
|
18
|
+
--#{$eccgui}-color-primary: #{$eccgui-color-primary};
|
|
19
|
+
--#{$eccgui}-color-primary-contrast: #{$eccgui-color-primary-contrast};
|
|
20
|
+
--#{$eccgui}-color-accent: #{$eccgui-color-accent};
|
|
21
|
+
--#{$eccgui}-color-accent-contrast: #{$eccgui-color-accent-contrast};
|
|
22
|
+
--#{$eccgui}-color-success-foreground: #{$eccgui-color-success-text};
|
|
23
|
+
--#{$eccgui}-color-success-background: #{$eccgui-color-success-background};
|
|
24
|
+
--#{$eccgui}-color-info-foreground: #{$eccgui-color-info-text};
|
|
25
|
+
--#{$eccgui}-color-info-background: #{$eccgui-color-info-background};
|
|
26
|
+
--#{$eccgui}-color-warning-foreground: #{$eccgui-color-warning-text};
|
|
27
|
+
--#{$eccgui}-color-warning-background: #{$eccgui-color-warning-background};
|
|
28
|
+
--#{$eccgui}-color-danger-foreground: #{$eccgui-color-danger-text};
|
|
29
|
+
--#{$eccgui}-color-danger-background: #{$eccgui-color-danger-background};
|
|
15
30
|
}
|
|
@@ -25,3 +25,10 @@ $ui-02: $eccgui-color-workspace-background !default;
|
|
|
25
25
|
.#{$eccgui}-application__content--railsidebar {
|
|
26
26
|
margin-left: mini-units(8);
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
@media print {
|
|
30
|
+
.#{$eccgui}-application__content {
|
|
31
|
+
padding: $eccgui-size-block-whitespace 0 0 0 !important;
|
|
32
|
+
margin: 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -98,10 +98,10 @@ span.#{$prefix}--header__name {
|
|
|
98
98
|
.#{$eccgui}-application__title--content {
|
|
99
99
|
display: inline-block;
|
|
100
100
|
overflow: hidden;
|
|
101
|
+
text-overflow: ellipsis;
|
|
101
102
|
font-size: $eccgui-size-typo-caption;
|
|
102
103
|
font-weight: $eccgui-font-weight-bold;
|
|
103
104
|
line-height: $eccgui-size-typo-caption-lineheight;
|
|
104
|
-
text-overflow: ellipsis;
|
|
105
105
|
letter-spacing: $eccgui-font-spacing-wide;
|
|
106
106
|
white-space: nowrap;
|
|
107
107
|
}
|
|
@@ -122,7 +122,7 @@ span.#{$prefix}--header__name {
|
|
|
122
122
|
height: auto;
|
|
123
123
|
max-height: mini-units(5);
|
|
124
124
|
padding: 0;
|
|
125
|
-
margin: mini-units(1.4) 0 mini-units(1.6)
|
|
125
|
+
margin: mini-units(1.4) 0 mini-units(1.6);
|
|
126
126
|
vertical-align: middle;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
@@ -195,9 +195,9 @@ a.#{$prefix}--header__menu-item:active {
|
|
|
195
195
|
.#{$prefix}--header__action.#{$prefix}--btn--primary:focus,
|
|
196
196
|
a.#{$prefix}--header__name:focus,
|
|
197
197
|
a.#{$prefix}--header__menu-item:focus {
|
|
198
|
-
border: none;
|
|
199
198
|
outline: 1px dotted $shell-header-focus;
|
|
200
199
|
outline-offset: -1px;
|
|
200
|
+
border: none;
|
|
201
201
|
box-shadow: none;
|
|
202
202
|
}
|
|
203
203
|
.#{$prefix}--header__menu-title[aria-expanded="true"] {
|
|
@@ -267,3 +267,12 @@ a.#{$prefix}--header__menu-item:focus > svg {
|
|
|
267
267
|
margin: 0;
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
+
|
|
271
|
+
@media print {
|
|
272
|
+
.#{$eccgui}-application__header {
|
|
273
|
+
position: relative;
|
|
274
|
+
& > :not(.#{$eccgui}-workspace__header) {
|
|
275
|
+
display: none;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@media print {
|
|
2
|
+
.#{eccgui}-application__hide--print,
|
|
3
|
+
.#{eccgui}-application__show--screen {
|
|
4
|
+
display: none !important;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@media screen {
|
|
9
|
+
.#{eccgui}-application__hide--screen,
|
|
10
|
+
.#{eccgui}-application__show--print {
|
|
11
|
+
display: none !important;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LoremIpsum } from "react-lorem-ipsum";
|
|
3
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { ApplicationViewability } from "../../../index";
|
|
6
|
+
export default {
|
|
7
|
+
title: "Components/Application/Viewability",
|
|
8
|
+
component: ApplicationViewability,
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: {
|
|
11
|
+
control: false,
|
|
12
|
+
},
|
|
13
|
+
hide: {
|
|
14
|
+
control: {
|
|
15
|
+
type: "radio",
|
|
16
|
+
},
|
|
17
|
+
options: ["print", "screen"],
|
|
18
|
+
},
|
|
19
|
+
show: {
|
|
20
|
+
control: {
|
|
21
|
+
type: "radio",
|
|
22
|
+
},
|
|
23
|
+
options: ["print", "screen"],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
} as Meta<typeof ApplicationViewability>;
|
|
27
|
+
|
|
28
|
+
const TemplateBasicExample: StoryFn<typeof ApplicationViewability> = (args) => <ApplicationViewability {...args} />;
|
|
29
|
+
|
|
30
|
+
export const Default = TemplateBasicExample.bind({});
|
|
31
|
+
Default.args = {
|
|
32
|
+
children: (
|
|
33
|
+
<div>
|
|
34
|
+
<LoremIpsum random={false} />
|
|
35
|
+
</div>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { expect } from "@storybook/test";
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
|
+
|
|
5
|
+
import "@testing-library/jest-dom";
|
|
6
|
+
|
|
7
|
+
import { ApplicationViewability, ApplicationViewabilityProps, CLASSPREFIX as eccgui } from "../../../index";
|
|
8
|
+
|
|
9
|
+
import { Default as ApplicationViewabilityStory } from "./../stories/ApplicationViewability.stories";
|
|
10
|
+
|
|
11
|
+
const applyViewabilityAndCheckClass = (props: Omit<ApplicationViewabilityProps, "children">) => {
|
|
12
|
+
const { container } = render(<ApplicationViewability {...ApplicationViewabilityStory.args} {...props} />);
|
|
13
|
+
const element = container.getElementsByClassName(
|
|
14
|
+
props.hide ? `${eccgui}-application__hide--${props.hide}` : `${eccgui}-application__show--${props.show}`
|
|
15
|
+
);
|
|
16
|
+
expect(element.length).toBe(1);
|
|
17
|
+
return element;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe("ApplicationViewability", () => {
|
|
21
|
+
it("should be visible on `show=screen`", () => {
|
|
22
|
+
applyViewabilityAndCheckClass({ show: "screen" });
|
|
23
|
+
/**
|
|
24
|
+
* Currently we cannot really test visibility via jest if it is defined by S/CSS rules because those styles are not known.
|
|
25
|
+
* Looks like it is not too easy to include and test them.
|
|
26
|
+
* So we only test for the correct CSS class.
|
|
27
|
+
*/
|
|
28
|
+
// console.log(window.getComputedStyle(element.item(0)??new Element).getPropertyValue("display"));
|
|
29
|
+
// waitFor(() => expect(element).toBeVisible());
|
|
30
|
+
});
|
|
31
|
+
it("should not be visible on `hide=screen`", () => {
|
|
32
|
+
applyViewabilityAndCheckClass({ hide: "screen" });
|
|
33
|
+
// waitFor(() => expect(element).not.toBeVisible());
|
|
34
|
+
});
|
|
35
|
+
it("should be visible on `hide=print`", () => {
|
|
36
|
+
applyViewabilityAndCheckClass({ hide: "print" });
|
|
37
|
+
// waitFor(() => expect(element).toBeVisible());
|
|
38
|
+
});
|
|
39
|
+
it("should not be visible on `show=print`", () => {
|
|
40
|
+
applyViewabilityAndCheckClass({ show: "print" });
|
|
41
|
+
// waitFor(() => expect(element).not.toBeVisible());
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -24,9 +24,15 @@ $control-indicator-spacing: $eccgui-size-inline-whitespace !default;
|
|
|
24
24
|
// $switch-background-color-active: rgba($gray1, 0.5) !default;
|
|
25
25
|
// $switch-background-color-disabled: $button-background-color-disabled !default;
|
|
26
26
|
$switch-checked-background-color: $eccgui-color-accent !default;
|
|
27
|
-
$switch-checked-background-color-hover: eccgui-color-rgba(
|
|
27
|
+
$switch-checked-background-color-hover: eccgui-color-rgba(
|
|
28
|
+
$switch-checked-background-color,
|
|
29
|
+
$eccgui-opacity-narrow
|
|
30
|
+
) !default;
|
|
28
31
|
$switch-checked-background-color-active: $switch-checked-background-color-hover !default;
|
|
29
|
-
$switch-checked-background-color-disabled: eccgui-color-rgba(
|
|
32
|
+
$switch-checked-background-color-disabled: eccgui-color-rgba(
|
|
33
|
+
$switch-checked-background-color,
|
|
34
|
+
$eccgui-opacity-disabled
|
|
35
|
+
) !default;
|
|
30
36
|
|
|
31
37
|
@import "~@blueprintjs/core/src/components/forms/controls"; // Checkbox, Radio, Switch
|
|
32
38
|
|
|
@@ -73,3 +79,9 @@ $switch-checked-background-color-disabled: eccgui-color-rgba($switch-checked-bac
|
|
|
73
79
|
display: inline-block;
|
|
74
80
|
vertical-align: text-top;
|
|
75
81
|
}
|
|
82
|
+
|
|
83
|
+
@media print {
|
|
84
|
+
.#{$ns}-control {
|
|
85
|
+
print-color-adjust: exact;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import textFieldTest from "../TextField/stories/TextField.stories";
|
|
5
|
+
|
|
6
|
+
import { ColorField, ColorFieldProps } from "./ColorField";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Forms/ColorField",
|
|
10
|
+
component: ColorField,
|
|
11
|
+
argTypes: {
|
|
12
|
+
...textFieldTest.argTypes,
|
|
13
|
+
},
|
|
14
|
+
} as Meta<typeof ColorField>;
|
|
15
|
+
|
|
16
|
+
const Template: StoryFn<typeof ColorField> = (args) => <ColorField {...args}></ColorField>;
|
|
17
|
+
|
|
18
|
+
export const Default = Template.bind({});
|
|
19
|
+
Default.args = {
|
|
20
|
+
onChange: (e) => {
|
|
21
|
+
alert(e.target.value);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const NoPalettePresets = Template.bind({});
|
|
26
|
+
NoPalettePresets.args = {
|
|
27
|
+
...Default.args,
|
|
28
|
+
includeColorWeight: [],
|
|
29
|
+
includePaletteGroup: [],
|
|
30
|
+
allowCustomColor: true,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
interface TemplateColorHashProps
|
|
34
|
+
extends Pick<ColorFieldProps, "onChange" | "allowCustomColor" | "includeColorWeight" | "includePaletteGroup"> {
|
|
35
|
+
stringForColorHashValue: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const TemplateColorHash: StoryFn<TemplateColorHashProps> = (args: TemplateColorHashProps) => (
|
|
39
|
+
<ColorField
|
|
40
|
+
allowCustomColor={args.allowCustomColor}
|
|
41
|
+
includeColorWeight={args.includeColorWeight}
|
|
42
|
+
includePaletteGroup={args.includePaletteGroup}
|
|
43
|
+
value={ColorField.calculateColorHashValue(args.stringForColorHashValue, {
|
|
44
|
+
allowCustomColor: args.allowCustomColor,
|
|
45
|
+
includeColorWeight: args.includeColorWeight,
|
|
46
|
+
includePaletteGroup: args.includePaletteGroup,
|
|
47
|
+
})}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Component provides a helper function to calculate a color hash from a text,
|
|
53
|
+
* that can be used as `value` or `defaultValue`.
|
|
54
|
+
*
|
|
55
|
+
* ```
|
|
56
|
+
* <ColorField value={ColorField.calculateColorHashValue("MyText")} />
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* You can add `options` to set the config for the color palette filters.
|
|
60
|
+
* The same default values like on `ColorField` are used for them.
|
|
61
|
+
*/
|
|
62
|
+
export const ColorHashValue = TemplateColorHash.bind({});
|
|
63
|
+
ColorHashValue.args = {
|
|
64
|
+
...Default.args,
|
|
65
|
+
allowCustomColor: true,
|
|
66
|
+
includeColorWeight: [300, 500, 700],
|
|
67
|
+
includePaletteGroup: ["layout", "extra"],
|
|
68
|
+
stringForColorHashValue: "My text that will used to create a color hash as initial value.",
|
|
69
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
|
|
5
|
+
import "@testing-library/jest-dom";
|
|
6
|
+
|
|
7
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
8
|
+
|
|
9
|
+
import { ColorField } from "./ColorField";
|
|
10
|
+
|
|
11
|
+
describe("ColorField", () => {
|
|
12
|
+
describe("rendering", () => {
|
|
13
|
+
it("renders without crashing, and correct component CSS class is applied", () => {
|
|
14
|
+
const { container } = render(<ColorField />);
|
|
15
|
+
expect(container).not.toBeEmptyDOMElement();
|
|
16
|
+
expect(container.getElementsByClassName(`${eccgui}-colorfield`).length).toBe(1);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("renders a color input by default (no palette presets)", () => {
|
|
20
|
+
const { container } = render(
|
|
21
|
+
<ColorField includePaletteGroup={[]} includeColorWeight={[]} allowCustomColor={true} />
|
|
22
|
+
);
|
|
23
|
+
expect(container.querySelector("input[type='color']")).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Jest cannot test this because it does not (cannot) load Styles where the palette isconfigured
|
|
27
|
+
/*
|
|
28
|
+
it("renders a readonly text input when palette colors are configured, and custom picker CSS class is applied", () => {
|
|
29
|
+
const { container } = render(<ColorField className="my-custom-class" />);
|
|
30
|
+
// With default palette settings, a text input with readOnly is shown
|
|
31
|
+
expect(container.querySelector("input[type='text']")).toBeInTheDocument();
|
|
32
|
+
expect(container.querySelector("input[readonly]")).toBeInTheDocument();
|
|
33
|
+
expect(container.querySelector(`.${eccgui}-colorfield--custom-picker`)).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
it("applies additional className", () => {
|
|
38
|
+
render(
|
|
39
|
+
<ColorField
|
|
40
|
+
className="my-custom-class"
|
|
41
|
+
includePaletteGroup={[]}
|
|
42
|
+
includeColorWeight={[]}
|
|
43
|
+
allowCustomColor={true}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
expect(document.querySelector(".my-custom-class")).toBeInTheDocument();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe("value handling", () => {
|
|
51
|
+
it("uses defaultValue as initial color", () => {
|
|
52
|
+
render(
|
|
53
|
+
<ColorField
|
|
54
|
+
defaultValue="#ff0000"
|
|
55
|
+
includePaletteGroup={[]}
|
|
56
|
+
includeColorWeight={[]}
|
|
57
|
+
allowCustomColor={true}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
const input = document.querySelector("input") as HTMLInputElement;
|
|
61
|
+
expect(input.value).toBe("#ff0000");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("uses value prop as initial color", () => {
|
|
65
|
+
render(
|
|
66
|
+
<ColorField value="#00ff00" includePaletteGroup={[]} includeColorWeight={[]} allowCustomColor={true} />
|
|
67
|
+
);
|
|
68
|
+
const input = document.querySelector("input") as HTMLInputElement;
|
|
69
|
+
expect(input.value).toBe("#00ff00");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("falls back to #000000 when no value or defaultValue is provided", () => {
|
|
73
|
+
render(<ColorField includePaletteGroup={[]} includeColorWeight={[]} allowCustomColor={true} />);
|
|
74
|
+
const input = document.querySelector("input") as HTMLInputElement;
|
|
75
|
+
expect(input.value).toBe("#000000");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("updates displayed value when value prop changes", () => {
|
|
79
|
+
const { rerender } = render(
|
|
80
|
+
<ColorField value="#ff0000" includePaletteGroup={[]} includeColorWeight={[]} allowCustomColor={true} />
|
|
81
|
+
);
|
|
82
|
+
let input = document.querySelector("input") as HTMLInputElement;
|
|
83
|
+
expect(input.value).toBe("#ff0000");
|
|
84
|
+
|
|
85
|
+
rerender(
|
|
86
|
+
<ColorField value="#0000ff" includePaletteGroup={[]} includeColorWeight={[]} allowCustomColor={true} />
|
|
87
|
+
);
|
|
88
|
+
input = document.querySelector("input") as HTMLInputElement;
|
|
89
|
+
expect(input.value).toBe("#0000ff");
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe("disabled state", () => {
|
|
94
|
+
it("is disabled when disabled prop is true", () => {
|
|
95
|
+
render(<ColorField disabled includePaletteGroup={[]} includeColorWeight={[]} allowCustomColor={true} />);
|
|
96
|
+
const input = document.querySelector("input") as HTMLInputElement;
|
|
97
|
+
expect(input).toBeDisabled();
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("is disabled when no palette colors and allowCustomColor is false", () => {
|
|
101
|
+
render(<ColorField includePaletteGroup={[]} includeColorWeight={[]} allowCustomColor={false} />);
|
|
102
|
+
const input = document.querySelector("input") as HTMLInputElement;
|
|
103
|
+
expect(input).toBeDisabled();
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe("onChange callback", () => {
|
|
108
|
+
it("calls onChange when native color input changes", async () => {
|
|
109
|
+
const user = userEvent.setup();
|
|
110
|
+
const onChange = jest.fn();
|
|
111
|
+
render(
|
|
112
|
+
<ColorField
|
|
113
|
+
onChange={onChange}
|
|
114
|
+
includePaletteGroup={[]}
|
|
115
|
+
includeColorWeight={[]}
|
|
116
|
+
allowCustomColor={true}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
const input = document.querySelector("input[type='color']") as HTMLInputElement;
|
|
120
|
+
input.type = "text"; // for unknown reasons Jest seems not able to test it on color inputs
|
|
121
|
+
await user.type(input, "#123456");
|
|
122
|
+
expect(onChange).toHaveBeenCalled();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
});
|