@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,97 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
import { Classes as BlueprintClasses } from "@blueprintjs/core";
|
|
4
|
+
import { createPopper } from "@popperjs/core";
|
|
5
|
+
|
|
6
|
+
import { CLASSPREFIX as eccgui, ContextOverlayProps, TestableComponent, TooltipSize, WhiteSpaceContainer } from "../../index";
|
|
7
|
+
|
|
8
|
+
export interface DecoupledOverlayProps
|
|
9
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
10
|
+
TestableComponent,
|
|
11
|
+
Pick<ContextOverlayProps, "usePortal" | "portalContainer" | "placement" | "minimal" | "paddingSize"> {
|
|
12
|
+
/**
|
|
13
|
+
* Element that should be used. The step content is displayed as a tooltip instead of a modal.
|
|
14
|
+
* In case of an array, the first match is highlighted. */
|
|
15
|
+
targetSelectorOrElement: string | Element;
|
|
16
|
+
/**
|
|
17
|
+
* The size of the overlay.
|
|
18
|
+
* */
|
|
19
|
+
size?: TooltipSize;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Use an overlay popover without the necessity to use a target that need to be rendered in place.
|
|
24
|
+
* The target is referenced by a selector string or element object.
|
|
25
|
+
* It can exist somewhere in the DOM, but it must exist when the overlay is rendered.
|
|
26
|
+
* It is always displayed, close it by removement.
|
|
27
|
+
*/
|
|
28
|
+
export const DecoupledOverlay = ({
|
|
29
|
+
targetSelectorOrElement,
|
|
30
|
+
usePortal = true,
|
|
31
|
+
portalContainer = document.body,
|
|
32
|
+
minimal = false,
|
|
33
|
+
placement = "auto",
|
|
34
|
+
size = "large",
|
|
35
|
+
paddingSize,
|
|
36
|
+
children,
|
|
37
|
+
}: DecoupledOverlayProps) => {
|
|
38
|
+
const overlayRef = React.useCallback(
|
|
39
|
+
(overlay: HTMLDivElement | null) => {
|
|
40
|
+
const target =
|
|
41
|
+
typeof targetSelectorOrElement === "string"
|
|
42
|
+
? document.querySelector(targetSelectorOrElement)
|
|
43
|
+
: targetSelectorOrElement;
|
|
44
|
+
if (overlay && target) {
|
|
45
|
+
createPopper(target, overlay, {
|
|
46
|
+
placement: placement,
|
|
47
|
+
modifiers: [
|
|
48
|
+
{
|
|
49
|
+
name: "offset",
|
|
50
|
+
options: {
|
|
51
|
+
offset: [0, 15],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
[targetSelectorOrElement]
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const overlay = (
|
|
62
|
+
<div
|
|
63
|
+
className={
|
|
64
|
+
`${eccgui}-decoupled-overlay` +
|
|
65
|
+
` ${eccgui}-decoupled-overlay--${size}` +
|
|
66
|
+
` ${BlueprintClasses.POPOVER}` +
|
|
67
|
+
(minimal ? ` ${BlueprintClasses.MINIMAL}` : "")
|
|
68
|
+
}
|
|
69
|
+
role="tooltip"
|
|
70
|
+
ref={overlayRef}
|
|
71
|
+
>
|
|
72
|
+
{!minimal && (
|
|
73
|
+
<div
|
|
74
|
+
className={`${eccgui}-decoupled-overlay__arrow ${BlueprintClasses.POPOVER_ARROW}`}
|
|
75
|
+
data-popper-arrow
|
|
76
|
+
aria-hidden
|
|
77
|
+
/>
|
|
78
|
+
)}
|
|
79
|
+
<div className={`${BlueprintClasses.POPOVER_CONTENT} ${eccgui}-decoupled-overlay__content`}>
|
|
80
|
+
{paddingSize ? (
|
|
81
|
+
<WhiteSpaceContainer
|
|
82
|
+
paddingTop={paddingSize}
|
|
83
|
+
paddingRight={paddingSize}
|
|
84
|
+
paddingBottom={paddingSize}
|
|
85
|
+
paddingLeft={paddingSize}
|
|
86
|
+
>
|
|
87
|
+
{children}
|
|
88
|
+
</WhiteSpaceContainer>
|
|
89
|
+
) : children}
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
return usePortal ? createPortal(overlay, portalContainer) : overlay;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default DecoupledOverlay;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.#{$eccgui}-decoupled-overlay__arrow {
|
|
2
|
+
&::before {
|
|
3
|
+
background: $card-background-color;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.#{$eccgui}-decoupled-overlay[data-popper-placement="top"] & {
|
|
7
|
+
bottom: -0.5 * $eccgui-size-block-whitespace;
|
|
8
|
+
}
|
|
9
|
+
.#{$eccgui}-decoupled-overlay[data-popper-placement="right"] & {
|
|
10
|
+
left: -0.5 * $eccgui-size-block-whitespace;
|
|
11
|
+
}
|
|
12
|
+
.#{$eccgui}-decoupled-overlay[data-popper-placement="bottom"] & {
|
|
13
|
+
top: -0.5 * $eccgui-size-block-whitespace;
|
|
14
|
+
}
|
|
15
|
+
.#{$eccgui}-decoupled-overlay[data-popper-placement="left"] & {
|
|
16
|
+
right: -0.5 * $eccgui-size-block-whitespace;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.#{$eccgui}-decoupled-overlay {
|
|
21
|
+
&.#{$prefix-blueprintjs}-popover {
|
|
22
|
+
z-index: 8001;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&--small {
|
|
26
|
+
@extend .#{$eccgui}-tooltip--small;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&--medium {
|
|
30
|
+
@extend .#{$eccgui}-tooltip--medium;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&--large {
|
|
34
|
+
@extend .#{$eccgui}-tooltip--large;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:has(.#{$eccgui}-decoupled-overlay__arrow) {
|
|
38
|
+
.#{$eccgui}-decoupled-overlay__content {
|
|
39
|
+
min-height: 30px; // height of blueprint arrow
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.#{$eccgui}-decoupled-overlay__content {
|
|
45
|
+
padding: 0.1px; // force margins of children to stay inside
|
|
46
|
+
}
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { OverlaysProvider } from "@blueprintjs/core";
|
|
3
3
|
import { Meta, StoryFn } from "@storybook/react";
|
|
4
4
|
import { fn } from "@storybook/test";
|
|
5
5
|
|
|
6
6
|
import { SimpleCard } from "../../Card/stories/Card.stories";
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
Button,
|
|
10
|
-
Card,
|
|
11
|
-
CardContent,
|
|
12
|
-
Modal,
|
|
13
|
-
ModalContext,
|
|
14
|
-
ModalSize,
|
|
15
|
-
Spacing,
|
|
16
|
-
useModalContext,
|
|
17
|
-
} from "./../../../../index";
|
|
8
|
+
import { Card, Modal } from "./../../../../index";
|
|
18
9
|
|
|
19
10
|
export default {
|
|
20
11
|
title: "Components/Dialog/Modal",
|
|
@@ -24,15 +15,18 @@ export default {
|
|
|
24
15
|
control: false,
|
|
25
16
|
},
|
|
26
17
|
},
|
|
18
|
+
decorators: [
|
|
19
|
+
(Story) => (
|
|
20
|
+
<OverlaysProvider>
|
|
21
|
+
<div style={{ height: "400px" }}>
|
|
22
|
+
<Story />
|
|
23
|
+
</div>
|
|
24
|
+
</OverlaysProvider>
|
|
25
|
+
),
|
|
26
|
+
],
|
|
27
27
|
} as Meta<typeof Modal>;
|
|
28
28
|
|
|
29
|
-
const Template: StoryFn<typeof Modal> = (args) =>
|
|
30
|
-
<OverlaysProvider>
|
|
31
|
-
<div style={{ height: "400px" }}>
|
|
32
|
-
<Modal {...args} />
|
|
33
|
-
</div>
|
|
34
|
-
</OverlaysProvider>
|
|
35
|
-
);
|
|
29
|
+
const Template: StoryFn<typeof Modal> = (args) => <Modal {...args} />;
|
|
36
30
|
|
|
37
31
|
export const Default = Template.bind({});
|
|
38
32
|
Default.args = {
|
|
@@ -42,135 +36,3 @@ Default.args = {
|
|
|
42
36
|
onOpening: fn(),
|
|
43
37
|
onClosing: fn(),
|
|
44
38
|
};
|
|
45
|
-
|
|
46
|
-
const ContextTemplate = ({ children }: React.HTMLAttributes<HTMLDivElement>) => {
|
|
47
|
-
const { setModalOpen, openModalStack } = useModalContext();
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<OverlaysProvider>
|
|
51
|
-
<div style={{ height: "70vh", position: "relative" }} id={"modalPortal"}>
|
|
52
|
-
<ModalContext.Provider value={{ setModalOpen, openModalStack }}>{children}</ModalContext.Provider>
|
|
53
|
-
</div>
|
|
54
|
-
</OverlaysProvider>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const ModalContent = ({ children }: React.HTMLAttributes<HTMLDivElement>) => {
|
|
59
|
-
return (
|
|
60
|
-
<Card style={{ height: "100%" }}>
|
|
61
|
-
<CardContent>{children}</CardContent>
|
|
62
|
-
</Card>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/** Component for nested modals. */
|
|
67
|
-
const ExampleModal = ({
|
|
68
|
-
id,
|
|
69
|
-
size,
|
|
70
|
-
children,
|
|
71
|
-
}: {
|
|
72
|
-
id?: string;
|
|
73
|
-
size: ModalSize;
|
|
74
|
-
children?: React.HTMLAttributes<HTMLDivElement>["children"];
|
|
75
|
-
}) => {
|
|
76
|
-
const [isOpen, setIsOpen] = React.useState(true);
|
|
77
|
-
const [portalElement, setPortalElement] = React.useState<HTMLElement | undefined>();
|
|
78
|
-
|
|
79
|
-
React.useEffect(() => {
|
|
80
|
-
setPortalElement(document.getElementById("modalPortal")!);
|
|
81
|
-
}, []);
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<Modal
|
|
85
|
-
modalId={id}
|
|
86
|
-
size={size}
|
|
87
|
-
isOpen={isOpen}
|
|
88
|
-
usePortal={true}
|
|
89
|
-
portalContainer={portalElement}
|
|
90
|
-
hasBackdrop={true}
|
|
91
|
-
onOpened={() => {
|
|
92
|
-
// workaround, Blueprint attach a class to body tht prevents scrolling, probably it is attached to the wrong portal
|
|
93
|
-
document.body.classList.remove(Classes.OVERLAY_OPEN);
|
|
94
|
-
}}
|
|
95
|
-
>
|
|
96
|
-
<ModalContent>
|
|
97
|
-
Modal with constant modal ID "{id}".
|
|
98
|
-
<Spacing />
|
|
99
|
-
<TrackingContent />
|
|
100
|
-
<Spacing />
|
|
101
|
-
{children}
|
|
102
|
-
<Spacing />
|
|
103
|
-
<Button key={"close"} onClick={() => setIsOpen(false)}>
|
|
104
|
-
Close
|
|
105
|
-
</Button>
|
|
106
|
-
</ModalContent>
|
|
107
|
-
</Modal>
|
|
108
|
-
);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const InnerModal = () => {
|
|
112
|
-
return <ExampleModal id="innerModal" size="small" />;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const MiddleModal = () => {
|
|
116
|
-
return (
|
|
117
|
-
<ExampleModal id="middleModal" size="regular">
|
|
118
|
-
<InnerModal />
|
|
119
|
-
</ExampleModal>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
/** Shows the current stack of open modals. */
|
|
124
|
-
const TrackingContent = () => {
|
|
125
|
-
const modalContext = React.useContext(ModalContext);
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<ul>
|
|
129
|
-
{(modalContext.openModalStack() ?? []).map((modalId, idx) => (
|
|
130
|
-
<li key={modalId}>
|
|
131
|
-
{idx + 1}. {modalId}
|
|
132
|
-
</li>
|
|
133
|
-
))}
|
|
134
|
-
</ul>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* `ModalContext` can be used as provider to track a stack of modals.
|
|
140
|
-
*
|
|
141
|
-
* ```(Javascript)
|
|
142
|
-
* const ContextTemplate = () => {
|
|
143
|
-
* const { setModalOpen, openModalStack } = useModalContext();
|
|
144
|
-
* return (
|
|
145
|
-
* <ModalContext.Provider value={{ setModalOpen, openModalStack }}>
|
|
146
|
-
* <SimpleDialog size="large" isOpen>
|
|
147
|
-
* <OtherModal />
|
|
148
|
-
* </SimpleDialog>
|
|
149
|
-
* </ModalContext.Provider>
|
|
150
|
-
* );
|
|
151
|
-
* };
|
|
152
|
-
*
|
|
153
|
-
* const OtherModal = () => {
|
|
154
|
-
* const modalContext = React.useContext(ModalContext);
|
|
155
|
-
* return (
|
|
156
|
-
* <SimpleDialog size="small">
|
|
157
|
-
* <ul>
|
|
158
|
-
* {(modalContext.openModalStack ?? []).map((modalId, idx) => (
|
|
159
|
-
* <li key={modalId}>
|
|
160
|
-
* {idx + 1}. {modalId}
|
|
161
|
-
* </li>
|
|
162
|
-
* ))}
|
|
163
|
-
* </ul>
|
|
164
|
-
* </SimpleDialog>
|
|
165
|
-
* );
|
|
166
|
-
* };
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
export const NestedModalWithContext = ContextTemplate.bind({});
|
|
170
|
-
NestedModalWithContext.args = {
|
|
171
|
-
children: [
|
|
172
|
-
<ExampleModal id="rootModal" size="large">
|
|
173
|
-
<MiddleModal />
|
|
174
|
-
</ExampleModal>,
|
|
175
|
-
],
|
|
176
|
-
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Classes, OverlaysProvider } from "@blueprintjs/core";
|
|
3
|
+
import { Meta } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Button,
|
|
7
|
+
Card,
|
|
8
|
+
CardContent,
|
|
9
|
+
Modal,
|
|
10
|
+
ModalContext,
|
|
11
|
+
ModalContextProps,
|
|
12
|
+
ModalSize,
|
|
13
|
+
Spacing,
|
|
14
|
+
useModalContext,
|
|
15
|
+
} from "./../../../../index";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `ModalContext` can be used as provider to track a stack of modals.
|
|
19
|
+
*
|
|
20
|
+
* ```(Javascript)
|
|
21
|
+
* import { ModalContext, SimpleDialog } from "@eccenca/gui-elements";
|
|
22
|
+
*
|
|
23
|
+
* const ContextTemplate = () => {
|
|
24
|
+
* const { setModalOpen, openModalStack } = useModalContext();
|
|
25
|
+
* return (
|
|
26
|
+
* <ModalContext.Provider value={{ setModalOpen, openModalStack }}>
|
|
27
|
+
* <SimpleDialog size="large" isOpen>
|
|
28
|
+
* <OtherModal />
|
|
29
|
+
* </SimpleDialog>
|
|
30
|
+
* </ModalContext.Provider>
|
|
31
|
+
* );
|
|
32
|
+
* };
|
|
33
|
+
*
|
|
34
|
+
* const OtherModal = () => {
|
|
35
|
+
* const modalContext = React.useContext(ModalContext);
|
|
36
|
+
* return (
|
|
37
|
+
* <SimpleDialog size="small">
|
|
38
|
+
* <ul>
|
|
39
|
+
* {(modalContext.openModalStack ?? []).map((modalId, idx) => (
|
|
40
|
+
* <li key={modalId}>
|
|
41
|
+
* {idx + 1}. {modalId}
|
|
42
|
+
* </li>
|
|
43
|
+
* ))}
|
|
44
|
+
* </ul>
|
|
45
|
+
* </SimpleDialog>
|
|
46
|
+
* );
|
|
47
|
+
* };
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export default {
|
|
51
|
+
title: "Components/Dialog/ModalContext",
|
|
52
|
+
decorators: [
|
|
53
|
+
(Story) => (
|
|
54
|
+
<OverlaysProvider>
|
|
55
|
+
<div style={{ height: "70vh", position: "relative" }} id={"modalPortal"}>
|
|
56
|
+
<Story />
|
|
57
|
+
</div>
|
|
58
|
+
</OverlaysProvider>
|
|
59
|
+
),
|
|
60
|
+
],
|
|
61
|
+
} as Meta<ModalContextProps>;
|
|
62
|
+
|
|
63
|
+
export const Usage = () => {
|
|
64
|
+
const { setModalOpen, openModalStack } = useModalContext();
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<ModalContext.Provider value={{ setModalOpen, openModalStack }}>
|
|
68
|
+
<ExampleModal id="rootModal" size="large">
|
|
69
|
+
<MiddleModal />
|
|
70
|
+
</ExampleModal>
|
|
71
|
+
</ModalContext.Provider>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const ModalContent = ({ children }: React.HTMLAttributes<HTMLDivElement>) => {
|
|
76
|
+
return (
|
|
77
|
+
<Card style={{ height: "100%" }}>
|
|
78
|
+
<CardContent>{children}</CardContent>
|
|
79
|
+
</Card>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** Component for nested modals. */
|
|
84
|
+
const ExampleModal = ({
|
|
85
|
+
id,
|
|
86
|
+
size,
|
|
87
|
+
children,
|
|
88
|
+
}: {
|
|
89
|
+
id?: string;
|
|
90
|
+
size: ModalSize;
|
|
91
|
+
children?: React.HTMLAttributes<HTMLDivElement>["children"];
|
|
92
|
+
}) => {
|
|
93
|
+
const [isOpen, setIsOpen] = React.useState(true);
|
|
94
|
+
const [portalElement, setPortalElement] = React.useState<HTMLElement | undefined>();
|
|
95
|
+
|
|
96
|
+
React.useEffect(() => {
|
|
97
|
+
setPortalElement(document.getElementById("modalPortal")!);
|
|
98
|
+
}, []);
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<Modal
|
|
102
|
+
modalId={id}
|
|
103
|
+
size={size}
|
|
104
|
+
isOpen={isOpen}
|
|
105
|
+
usePortal={true}
|
|
106
|
+
portalContainer={portalElement}
|
|
107
|
+
hasBackdrop={true}
|
|
108
|
+
onOpened={() => {
|
|
109
|
+
// workaround, Blueprint attach a class to body tht prevents scrolling, probably it is attached to the wrong portal
|
|
110
|
+
document.body.classList.remove(Classes.OVERLAY_OPEN);
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<ModalContent>
|
|
114
|
+
Modal with constant modal ID "{id}".
|
|
115
|
+
<Spacing />
|
|
116
|
+
<TrackingContent />
|
|
117
|
+
<Spacing />
|
|
118
|
+
{children}
|
|
119
|
+
<Spacing />
|
|
120
|
+
<Button key={"close"} onClick={() => setIsOpen(false)}>
|
|
121
|
+
Close
|
|
122
|
+
</Button>
|
|
123
|
+
</ModalContent>
|
|
124
|
+
</Modal>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const InnerModal = () => {
|
|
129
|
+
return <ExampleModal id="innerModal" size="small" />;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const MiddleModal = () => {
|
|
133
|
+
return (
|
|
134
|
+
<ExampleModal id="middleModal" size="regular">
|
|
135
|
+
<InnerModal />
|
|
136
|
+
</ExampleModal>
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/** Shows the current stack of open modals. */
|
|
141
|
+
const TrackingContent = () => {
|
|
142
|
+
const modalContext = React.useContext(ModalContext);
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<ul>
|
|
146
|
+
{(modalContext.openModalStack() ?? []).map((modalId, idx) => (
|
|
147
|
+
<li key={modalId}>
|
|
148
|
+
{idx + 1}. {modalId}
|
|
149
|
+
</li>
|
|
150
|
+
))}
|
|
151
|
+
</ul>
|
|
152
|
+
);
|
|
153
|
+
};
|
|
@@ -46,3 +46,19 @@
|
|
|
46
46
|
flex-basis: auto;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
@media print {
|
|
51
|
+
.#{$eccgui}-flexible__container,
|
|
52
|
+
.#{$eccgui}-flexible__item {
|
|
53
|
+
position: relative;
|
|
54
|
+
display: block;
|
|
55
|
+
width: auto;
|
|
56
|
+
height: auto;
|
|
57
|
+
padding: 0;
|
|
58
|
+
margin: 0;
|
|
59
|
+
|
|
60
|
+
&:is(.#{$eccgui}-flexible__item) {
|
|
61
|
+
margin-bottom: $eccgui-size-block-whitespace;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -86,3 +86,20 @@ $grid-gutter: rem($eccgui-size-grid-gutter);
|
|
|
86
86
|
flex-wrap: nowrap;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
|
|
90
|
+
@media print {
|
|
91
|
+
.#{$eccgui}-grid,
|
|
92
|
+
.#{$eccgui}-grid__row,
|
|
93
|
+
.#{$eccgui}-grid__column {
|
|
94
|
+
position: relative;
|
|
95
|
+
display: block;
|
|
96
|
+
width: auto;
|
|
97
|
+
height: auto;
|
|
98
|
+
padding: 0;
|
|
99
|
+
margin: 0;
|
|
100
|
+
|
|
101
|
+
&:is(.#{$eccgui}-grid__column) {
|
|
102
|
+
margin-bottom: $eccgui-size-block-whitespace;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -11,19 +11,22 @@ export default {
|
|
|
11
11
|
subcomponents: { GridRow, GridColumn },
|
|
12
12
|
argTypes: {
|
|
13
13
|
children: {
|
|
14
|
-
control:
|
|
14
|
+
control: false,
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
+
decorators: [
|
|
18
|
+
(Story) => (
|
|
19
|
+
<div style={{ minHeight: "30vh", position: "relative" }}>
|
|
20
|
+
<Story />
|
|
21
|
+
</div>
|
|
22
|
+
),
|
|
23
|
+
],
|
|
17
24
|
} as Meta<typeof Grid>;
|
|
18
25
|
|
|
19
|
-
const Template: StoryFn<typeof Grid> = (args) =>
|
|
20
|
-
<div style={{ minHeight: "30vh", position: "relative" }}>
|
|
21
|
-
<Grid {...args} />
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
26
|
+
const Template: StoryFn<typeof Grid> = (args) => <Grid {...args} />;
|
|
24
27
|
|
|
25
28
|
export const Default = Template.bind({});
|
|
26
29
|
Default.args = {
|
|
27
|
-
children: <GridRow {...RowExample.args} verticalStretched />,
|
|
30
|
+
children: [<GridRow {...RowExample.args} verticalStretched />, <GridRow {...RowExample.args} verticalStretched />],
|
|
28
31
|
verticalStretchable: true,
|
|
29
32
|
};
|
|
@@ -10,21 +10,27 @@ export default {
|
|
|
10
10
|
component: GridRow,
|
|
11
11
|
argTypes: {
|
|
12
12
|
children: {
|
|
13
|
-
control:
|
|
13
|
+
control: false,
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
} as Meta<typeof GridRow>;
|
|
17
17
|
|
|
18
|
-
const Template: StoryFn<typeof GridRow> = (args) =>
|
|
19
|
-
<Grid style={{ minHeight: "30vh" }} verticalStretchable>
|
|
20
|
-
<GridRow {...args} />
|
|
21
|
-
</Grid>
|
|
22
|
-
);
|
|
18
|
+
const Template: StoryFn<typeof GridRow> = (args) => <GridRow {...args} />;
|
|
23
19
|
|
|
24
20
|
export const Default = Template.bind({});
|
|
25
21
|
Default.args = {
|
|
26
|
-
children:
|
|
22
|
+
children: [
|
|
23
|
+
<GridColumn {...ColumnExample.args} verticalAlign="center" key="col1" />,
|
|
24
|
+
<GridColumn {...ColumnExample.args} verticalAlign="center" key="col1" />,
|
|
25
|
+
],
|
|
27
26
|
};
|
|
27
|
+
Default.decorators = [
|
|
28
|
+
(Story) => (
|
|
29
|
+
<Grid style={{ minHeight: "30vh" }} verticalStretchable>
|
|
30
|
+
<Story />
|
|
31
|
+
</Grid>
|
|
32
|
+
),
|
|
33
|
+
];
|
|
28
34
|
|
|
29
35
|
const TemplateStretched: StoryFn<typeof GridRow> = (args) => (
|
|
30
36
|
<Grid style={{ minHeight: "50vh" }} verticalStretchable>
|
|
@@ -2,11 +2,11 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
4
|
import Button, { ButtonProps } from "../Button/Button";
|
|
5
|
+
import {TestableComponent} from "../interfaces";
|
|
5
6
|
|
|
6
7
|
import { ValidIconName } from "./canonicalIconNames";
|
|
7
8
|
import Icon, { IconProps } from "./Icon";
|
|
8
9
|
import { TestIconProps } from "./TestIcon";
|
|
9
|
-
import {TestableComponent} from "../interfaces";
|
|
10
10
|
|
|
11
11
|
interface ExtendedButtonProps
|
|
12
12
|
extends Omit<ButtonProps, "name" | "icon" | "rightIcon" | "text" | "minimal" | "tooltip">, TestableComponent {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as icons from "@carbon/react/icons";
|
|
2
2
|
import { CarbonIconType as IconType } from "@carbon/react/icons";
|
|
3
|
+
import { transform} from "./transformIcon";
|
|
3
4
|
|
|
4
5
|
const canonicalIcons = {
|
|
5
6
|
"application-activities": icons.Activity,
|
|
@@ -172,8 +173,10 @@ const canonicalIcons = {
|
|
|
172
173
|
"state-checked": icons.CheckboxChecked,
|
|
173
174
|
"state-checkedsimple": icons.Checkmark,
|
|
174
175
|
"state-confirmed": icons.ThumbsUp,
|
|
176
|
+
"state-confirmed-all": icons.ThumbsUpDouble,
|
|
175
177
|
"state-danger": icons.ErrorFilled,
|
|
176
178
|
"state-declined": icons.ThumbsDown,
|
|
179
|
+
"state-declined-all": transform(icons.ThumbsUpDouble, 0, false, true),
|
|
177
180
|
"state-flagged": icons.Flag,
|
|
178
181
|
"state-info": icons.InformationFilled,
|
|
179
182
|
"state-locked": icons.Locked,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CarbonIconType, CarbonIconProps } from "@carbon/react/icons";
|
|
3
|
+
|
|
4
|
+
export const transform = (IconSymbol: CarbonIconType, rotate: number = 0, flipH: boolean = false, flipV: boolean = false) : CarbonIconType => {
|
|
5
|
+
return React.forwardRef((props: CarbonIconProps, ref: React.ForwardedRef<React.ReactSVGElement>) => {
|
|
6
|
+
return (
|
|
7
|
+
<IconSymbol
|
|
8
|
+
{...props}
|
|
9
|
+
ref={ref}
|
|
10
|
+
transform={
|
|
11
|
+
`scale(${flipH ? "-1" : "1"}, ${flipV ? "-1" : "1"}) rotate(${rotate})`
|
|
12
|
+
}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import { Link } from "../../../index";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Components/Link",
|
|
8
|
+
component: Link,
|
|
9
|
+
argTypes: {
|
|
10
|
+
target: {
|
|
11
|
+
control: "select",
|
|
12
|
+
options: ["_self", "_blank", "_parent", "_top"],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
} as Meta<typeof Link>;
|
|
16
|
+
|
|
17
|
+
const Template: StoryFn<typeof Link> = (args) => <Link {...args} />;
|
|
18
|
+
|
|
19
|
+
export const Default = Template.bind({});
|
|
20
|
+
Default.args = {
|
|
21
|
+
children: "Example link",
|
|
22
|
+
href: "https://example.com/",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const Disabled = Template.bind({});
|
|
26
|
+
Disabled.args = {
|
|
27
|
+
children: "Disabled link",
|
|
28
|
+
href: "https://example.com/",
|
|
29
|
+
disabled: true,
|
|
30
|
+
};
|