@eccenca/gui-elements 25.0.0-rc.1 → 25.0.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 +26 -18
- package/dist/cjs/common/index.js +3 -1
- package/dist/cjs/common/index.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/ContextOverlay/ContextMenu.js +2 -2
- package/dist/cjs/components/ContextOverlay/ContextMenu.js.map +1 -1
- package/dist/cjs/components/ContextOverlay/ContextOverlay.js +62 -24
- package/dist/cjs/components/ContextOverlay/ContextOverlay.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +2 -2
- package/dist/cjs/components/Icon/canonicalIconNames.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/esm/common/index.js +3 -1
- package/dist/esm/common/index.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/ContextOverlay/ContextMenu.js +2 -2
- package/dist/esm/components/ContextOverlay/ContextMenu.js.map +1 -1
- package/dist/esm/components/ContextOverlay/ContextOverlay.js +66 -28
- package/dist/esm/components/ContextOverlay/ContextOverlay.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +2 -2
- package/dist/esm/components/Icon/canonicalIconNames.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/types/common/index.d.ts +2 -0
- package/dist/types/common/utils/reduceToText.d.ts +1 -1
- package/dist/types/components/ContextOverlay/ContextMenu.d.ts +1 -1
- package/dist/types/components/TextReducer/TextReducer.d.ts +13 -1
- package/package.json +5 -3
- package/src/common/index.ts +6 -2
- package/src/common/utils/reduceToText.tsx +30 -2
- package/src/components/ContextOverlay/ContextMenu.tsx +4 -1
- package/src/components/ContextOverlay/ContextOverlay.tsx +74 -24
- package/src/components/ContextOverlay/tests/ContextMenu.test.tsx +43 -0
- package/src/components/ContextOverlay/tests/ContextOverlay.test.tsx +71 -0
- package/src/components/Dialog/stories/Modal.stories.tsx +12 -150
- package/src/components/Dialog/stories/ModalContext.stories.tsx +153 -0
- package/src/components/Icon/canonicalIconNames.tsx +3 -3
- 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
|
@@ -37,56 +37,94 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
37
37
|
return ar;
|
|
38
38
|
};
|
|
39
39
|
import React from "react";
|
|
40
|
-
import { Classes as BlueprintClasses, Popover as BlueprintPopover, Utils as BlueprintUtils, } from "@blueprintjs/core";
|
|
40
|
+
import { Classes as BlueprintClasses, Popover as BlueprintPopover, PopoverInteractionKind as InteractionKind, Utils as BlueprintUtils, } from "@blueprintjs/core";
|
|
41
41
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants.js";
|
|
42
42
|
/**
|
|
43
43
|
* Element displays connected content by interacting with a target element.
|
|
44
44
|
* Full list of available option can be seen at https://blueprintjs.com/docs/#popover2-package/popover2
|
|
45
45
|
*/
|
|
46
46
|
export var ContextOverlay = function (_a) {
|
|
47
|
-
var _b;
|
|
48
|
-
var children = _a.children, portalClassName = _a.portalClassName, preventTopPosition = _a.preventTopPosition,
|
|
47
|
+
var _b, _c;
|
|
48
|
+
var children = _a.children, portalClassName = _a.portalClassName, preventTopPosition = _a.preventTopPosition, _d = _a.className, className = _d === void 0 ? "" : _d, _e = _a.usePlaceholder, usePlaceholder = _e === void 0 ? false : _e, otherPopoverProps = __rest(_a, ["children", "portalClassName", "preventTopPosition", "className", "usePlaceholder"]);
|
|
49
49
|
var placeholderRef = React.useRef(null);
|
|
50
50
|
var eventMemory = React.useRef(undefined);
|
|
51
51
|
var swapDelay = React.useRef(null);
|
|
52
|
+
var interactionKind = React.useRef((_b = otherPopoverProps.interactionKind) !== null && _b !== void 0 ? _b : InteractionKind.CLICK);
|
|
52
53
|
var swapDelayTime = 15;
|
|
53
|
-
var
|
|
54
|
+
var _f = __read(React.useState(
|
|
54
55
|
// use placeholder only for "simple" overlays without special states
|
|
55
56
|
!otherPopoverProps.disabled &&
|
|
56
57
|
!otherPopoverProps.defaultIsOpen &&
|
|
57
58
|
!otherPopoverProps.isOpen &&
|
|
58
59
|
otherPopoverProps.renderTarget === undefined &&
|
|
59
|
-
usePlaceholder), 2), placeholder =
|
|
60
|
+
usePlaceholder), 2), placeholder = _f[0], setPlaceholder = _f[1];
|
|
61
|
+
var swap = function (ev) {
|
|
62
|
+
var waitForClick = interactionKind.current === InteractionKind.CLICK ||
|
|
63
|
+
interactionKind.current === InteractionKind.CLICK_TARGET_ONLY;
|
|
64
|
+
if (swapDelay.current) {
|
|
65
|
+
clearTimeout(swapDelay.current);
|
|
66
|
+
}
|
|
67
|
+
var replacePlaceholder = function () {
|
|
68
|
+
eventMemory.current = ev.type;
|
|
69
|
+
setPlaceholder(false);
|
|
70
|
+
};
|
|
71
|
+
if (waitForClick) {
|
|
72
|
+
ev.stopImmediatePropagation();
|
|
73
|
+
replacePlaceholder();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
swapDelay.current = setTimeout(replacePlaceholder,
|
|
77
|
+
// we delay the swap for hover/focus to prevent unwanted effects
|
|
78
|
+
// (e.g. event hickup after replacing elements when it is not really necessary)
|
|
79
|
+
swapDelayTime);
|
|
80
|
+
};
|
|
60
81
|
React.useEffect(function () {
|
|
82
|
+
var _a;
|
|
83
|
+
interactionKind.current = (_a = otherPopoverProps.interactionKind) !== null && _a !== void 0 ? _a : InteractionKind.CLICK;
|
|
84
|
+
var waitForClick = interactionKind.current === InteractionKind.CLICK ||
|
|
85
|
+
interactionKind.current === InteractionKind.CLICK_TARGET_ONLY;
|
|
86
|
+
var removeEvents = function () {
|
|
87
|
+
if (placeholderRef.current) {
|
|
88
|
+
placeholderRef.current.removeEventListener("click", swap);
|
|
89
|
+
placeholderRef.current.removeEventListener("mouseenter", swap);
|
|
90
|
+
placeholderRef.current.removeEventListener("focusin", swap);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
};
|
|
61
94
|
if (placeholderRef.current) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
setPlaceholder(false);
|
|
71
|
-
}, swapDelayTime);
|
|
72
|
-
};
|
|
73
|
-
placeholderRef.current.addEventListener("mouseenter", swap_1);
|
|
74
|
-
placeholderRef.current.addEventListener("focusin", swap_1);
|
|
95
|
+
removeEvents(); // remove events in case of interaction kind changed during existence
|
|
96
|
+
if (waitForClick) {
|
|
97
|
+
placeholderRef.current.addEventListener("click", swap);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
placeholderRef.current.addEventListener("mouseenter", swap);
|
|
101
|
+
placeholderRef.current.addEventListener("focusin", swap);
|
|
102
|
+
}
|
|
75
103
|
return function () {
|
|
76
|
-
|
|
77
|
-
placeholderRef.current.removeEventListener("mouseenter", swap_1);
|
|
78
|
-
placeholderRef.current.removeEventListener("focusin", swap_1);
|
|
79
|
-
}
|
|
104
|
+
removeEvents();
|
|
80
105
|
};
|
|
81
106
|
}
|
|
82
107
|
return function () { };
|
|
83
|
-
}, [!!placeholderRef.current]);
|
|
108
|
+
}, [!!placeholderRef.current, otherPopoverProps.interactionKind]);
|
|
84
109
|
var refocus = React.useCallback(function (node) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
110
|
+
var target = node === null || node === void 0 ? void 0 : node.targetRef.current.children[0];
|
|
111
|
+
if (!eventMemory.current || !target) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
switch (eventMemory.current) {
|
|
115
|
+
case "focusin":
|
|
88
116
|
target.focus();
|
|
89
|
-
|
|
117
|
+
break;
|
|
118
|
+
case "click":
|
|
119
|
+
target.click();
|
|
120
|
+
break;
|
|
121
|
+
case "mouseenter":
|
|
122
|
+
// re-check if the cursor is still over the element after swapping the placeholder before triggering the event to bubble up
|
|
123
|
+
target.addEventListener("mouseover", function () { return target.dispatchEvent(new MouseEvent("mouseover", { bubbles: true })); }, {
|
|
124
|
+
capture: true,
|
|
125
|
+
once: true,
|
|
126
|
+
});
|
|
127
|
+
break;
|
|
90
128
|
}
|
|
91
129
|
}, []);
|
|
92
130
|
var targetClassName = "".concat(eccgui, "-contextoverlay") + (className ? " ".concat(className) : "");
|
|
@@ -101,7 +139,7 @@ export var ContextOverlay = function (_a) {
|
|
|
101
139
|
};
|
|
102
140
|
var portalClassNameFinal = (preventTopPosition ? "".concat(eccgui, "-contextoverlay__portal--lowertop") : "") +
|
|
103
141
|
(portalClassName ? " ".concat(portalClassName) : "");
|
|
104
|
-
return placeholder ? (displayPlaceholder()) : (React.createElement(BlueprintPopover, __assign({ placement: "bottom" }, otherPopoverProps, { className: targetClassName, portalClassName: (
|
|
142
|
+
return placeholder ? (displayPlaceholder()) : (React.createElement(BlueprintPopover, __assign({ placement: "bottom" }, otherPopoverProps, { className: targetClassName, portalClassName: (_c = portalClassNameFinal.trim()) !== null && _c !== void 0 ? _c : undefined, ref: refocus }), children));
|
|
105
143
|
};
|
|
106
144
|
export default ContextOverlay;
|
|
107
145
|
//# sourceMappingURL=ContextOverlay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextOverlay.js","sourceRoot":"","sources":["../../../../src/components/ContextOverlay/ContextOverlay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACH,OAAO,IAAI,gBAAgB,EAC3B,OAAO,IAAI,gBAAgB,
|
|
1
|
+
{"version":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BAAiB,uBAAjB,iBAAiB,CAAE,QAAQ,CAAA,KAAI,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,iBAAiB,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAC5F,CACL,CAAC;IACN,CAAC,CAAC;IAEF,IAAM,oBAAoB,GACtB,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAG,MAAM,sCAAmC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,CAAC,eAAe,CAAC,CAAC,CAAC,WAAI,eAAe,CAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEnD,OAAO,WAAW,CAAC,CAAC,CAAC,CACjB,kBAAkB,EAAE,CACvB,CAAC,CAAC,CAAC,CACA,oBAAC,gBAAgB,aACb,SAAS,EAAC,QAAQ,IACd,iBAAiB,IACrB,SAAS,EAAE,eAAe,EAC1B,eAAe,EAAE,MAAA,oBAAoB,CAAC,IAAI,EAAE,mCAAI,SAAS,EACzD,GAAG,EAAE,OAAO,KAEX,QAAQ,CACM,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -99,8 +99,8 @@ var canonicalIcons = {
|
|
|
99
99
|
"item-viewdetails": icons.View,
|
|
100
100
|
"item-hidedetails": icons.ViewOff,
|
|
101
101
|
"item-image": icons.Image,
|
|
102
|
-
"list-sortasc": icons.
|
|
103
|
-
"list-sortdesc": icons.
|
|
102
|
+
"list-sortasc": icons.ArrowUp,
|
|
103
|
+
"list-sortdesc": icons.ArrowDown,
|
|
104
104
|
"list-sort": icons.ArrowsVertical,
|
|
105
105
|
"module-accesscontrol": icons.UserAdmin,
|
|
106
106
|
"module-annotation": icons.WatsonHealthTextAnnotationToggle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonicalIconNames.js","sourceRoot":"","sources":["../../../../src/components/Icon/canonicalIconNames.tsx"],"names":[],"mappings":"AAAA,OAAO,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BAAkB,EAAE,KAAK,CAAC,QAAQ;IAClC,eAAe,EAAE,KAAK,CAAC,UAAU;IACjC,gBAAgB,EAAE,KAAK,CAAC,aAAa;IACrC,kBAAkB,EAAE,KAAK,CAAC,WAAW;IACrC,mBAAmB,EAAE,KAAK,CAAC,YAAY;IACvC,cAAc,EAAE,KAAK,CAAC,IAAI;IAC1B,eAAe,EAAE,KAAK,CAAC,WAAW;IAClC,uBAAuB,EAAE,KAAK,CAAC,kBAAkB;IACjD,mBAAmB,EAAE,KAAK,CAAC,SAAS;IACpC,qBAAqB,EAAE,KAAK,CAAC,WAAW;IACxC,kBAAkB,EAAE,KAAK,CAAC,SAAS;IACnC,kBAAkB,EAAE,KAAK,CAAC,WAAW;IACrC,oBAAoB,EAAE,KAAK,CAAC,IAAI;IAChC,qBAAqB,EAAE,KAAK,CAAC,UAAU;IACvC,eAAe,EAAE,KAAK,CAAC,KAAK;IAC5B,cAAc,EAAE,KAAK,CAAC,WAAW;IAEjC,eAAe,EAAE,KAAK,CAAC,SAAS;IAEhC,SAAS,EAAE,KAAK,CAAC,SAAS;CAC7B,CAAC;AAEF,IAAM,kBAAkB,GAA0C,cAAc,CAAC;AAIjF,eAAe,kBAAkB,CAAC"}
|
|
@@ -9,8 +9,19 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
12
23
|
import React from "react";
|
|
13
|
-
import {
|
|
24
|
+
import { utils } from "../../common/index.js";
|
|
14
25
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants.js";
|
|
15
26
|
import { OverflowText } from "./../Typography/index.js";
|
|
16
27
|
/**
|
|
@@ -18,11 +29,11 @@ import { OverflowText } from "./../Typography/index.js";
|
|
|
18
29
|
* Display can be wrapped easily in `OverflowText`.
|
|
19
30
|
*/
|
|
20
31
|
export var TextReducer = function (_a) {
|
|
21
|
-
var children = _a.children,
|
|
32
|
+
var children = _a.children, useOverflowTextWrapper = _a.useOverflowTextWrapper, overflowTextProps = _a.overflowTextProps, reduceToTextOptions = __rest(_a, ["children", "useOverflowTextWrapper", "overflowTextProps"]);
|
|
22
33
|
if (typeof children === "undefined") {
|
|
23
34
|
return React.createElement(React.Fragment, null);
|
|
24
35
|
}
|
|
25
|
-
var shrinkedContent = reduceToText(children,
|
|
36
|
+
var shrinkedContent = utils.reduceToText(children, reduceToTextOptions);
|
|
26
37
|
return useOverflowTextWrapper ? (React.createElement(OverflowText, __assign({}, overflowTextProps, { className: "".concat(eccgui, "-textreducer") +
|
|
27
38
|
(overflowTextProps && overflowTextProps.className ? " ".concat(overflowTextProps.className) : "") }), shrinkedContent)) : (React.createElement(React.Fragment, null, shrinkedContent));
|
|
28
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextReducer.js","sourceRoot":"","sources":["../../../../src/components/TextReducer/TextReducer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextReducer.js","sourceRoot":"","sources":["../../../../src/components/TextReducer/TextReducer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA6B,KAAK,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAqB,MAAM,iBAAiB,CAAC;AAkClE;;;GAGG;AACH,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,EAKT;IAJf,IAAA,QAAQ,cAAA,EACR,sBAAsB,4BAAA,EACtB,iBAAiB,uBAAA,EACd,mBAAmB,cAJE,2DAK3B,CADyB;IAEtB,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,yCAAK,CAAC;IACjB,CAAC;IAED,IAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;IAE1E,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAC5B,oBAAC,YAAY,eACL,iBAAiB,IACrB,SAAS,EACL,UAAG,MAAM,iBAAc;YACvB,CAAC,iBAAiB,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,WAAI,iBAAiB,CAAC,SAAS,CAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAG9F,eAAe,CACL,CAClB,CAAC,CAAC,CAAC,CACA,0CAAG,eAAe,CAAI,CACzB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getEnabledColorsFromPalette, textToColorHash } from "./utils/colorHash";
|
|
2
|
+
export type { DecodeOptions as DecodeHtmlEntitiesOptions } from "he";
|
|
2
3
|
export type { IntentTypes as IntentBaseTypes } from "./Intent";
|
|
3
4
|
export declare const utils: {
|
|
4
5
|
openInNewTab: (event: React.MouseEvent<HTMLAnchorElement>, handler?: (e: React.MouseEvent<HTMLAnchorElement>) => void, url?: string) => void;
|
|
@@ -27,4 +28,5 @@ export declare const utils: {
|
|
|
27
28
|
getEnabledColorsFromPalette: typeof getEnabledColorsFromPalette;
|
|
28
29
|
textToColorHash: typeof textToColorHash;
|
|
29
30
|
reduceToText: import("./utils/reduceToText").ReduceToTextFuncType;
|
|
31
|
+
decodeHtmlEntities: import("he").Decode;
|
|
30
32
|
};
|
|
@@ -5,6 +5,6 @@ export interface ReduceToTextFuncType {
|
|
|
5
5
|
/**
|
|
6
6
|
* Component or text to reduce HTML markup content to plain text.
|
|
7
7
|
*/
|
|
8
|
-
input: React.ReactNode | React.ReactNode[] | string, options?: Pick<TextReducerProps, "maxNodes" | "maxLength">): string;
|
|
8
|
+
input: React.ReactNode | React.ReactNode[] | string, options?: Pick<TextReducerProps, "maxNodes" | "maxLength" | "decodeHtmlEntities" | "decodeHtmlEntitiesOptions">): string;
|
|
9
9
|
}
|
|
10
10
|
export declare const reduceToText: ReduceToTextFuncType;
|
|
@@ -47,5 +47,5 @@ export interface ContextMenuProps extends TestableComponent {
|
|
|
47
47
|
/**
|
|
48
48
|
* Element displays menu items after toggler is clicked.
|
|
49
49
|
*/
|
|
50
|
-
export declare const ContextMenu: ({ children, className, togglerElement, togglerText, contextOverlayProps, disabled, togglerLarge, tooltipAsTitle, preventPlaceholder, ...restProps }: ContextMenuProps) => React.JSX.Element;
|
|
50
|
+
export declare const ContextMenu: ({ children, className, togglerElement, togglerText, contextOverlayProps, disabled, togglerLarge, tooltipAsTitle, preventPlaceholder, "data-test-id": dataTestId, "data-testid": dataTestid, ...restProps }: ContextMenuProps) => React.JSX.Element;
|
|
51
51
|
export default ContextMenu;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { DecodeHtmlEntitiesOptions } from "../../common";
|
|
2
3
|
import { OverflowTextProps } from "./../Typography";
|
|
3
4
|
export interface TextReducerProps extends Pick<React.HTMLAttributes<HTMLElement>, "children"> {
|
|
4
5
|
/**
|
|
@@ -19,10 +20,21 @@ export interface TextReducerProps extends Pick<React.HTMLAttributes<HTMLElement>
|
|
|
19
20
|
* Specify more `OverflowText` properties used when `useOverflowTextWrapper` is set to `true`.
|
|
20
21
|
*/
|
|
21
22
|
overflowTextProps?: Omit<OverflowTextProps, "passDown">;
|
|
23
|
+
/**
|
|
24
|
+
* If you transform HTML markup to text then the result could contain HTML entity encoded strings.
|
|
25
|
+
* By enabling this option they are decoded back to it's original char.
|
|
26
|
+
*/
|
|
27
|
+
decodeHtmlEntities?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Set the options used to decode the HTML entities, if `decodeHtmlEntities` is enabled.
|
|
30
|
+
* Internally we use `he` library, see their [documentation on decode options](https://www.npmjs.com/package/he#hedecodehtml-options).
|
|
31
|
+
* If not set we use `{ isAttributeValue: true, strict: true }` as default value.
|
|
32
|
+
*/
|
|
33
|
+
decodeHtmlEntitiesOptions?: DecodeHtmlEntitiesOptions;
|
|
22
34
|
}
|
|
23
35
|
/**
|
|
24
36
|
* Component to reduce HTML markup content to simple text.
|
|
25
37
|
* Display can be wrapped easily in `OverflowText`.
|
|
26
38
|
*/
|
|
27
|
-
export declare const TextReducer: ({ children,
|
|
39
|
+
export declare const TextReducer: ({ children, useOverflowTextWrapper, overflowTextProps, ...reduceToTextOptions }: TextReducerProps) => React.JSX.Element;
|
|
28
40
|
export default TextReducer;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eccenca/gui-elements",
|
|
3
3
|
"description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
|
|
4
|
-
"version": "25.0.0
|
|
4
|
+
"version": "25.0.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/eccenca/gui-elements",
|
|
7
7
|
"bugs": "https://github.com/eccenca/gui-elements/issues",
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"codemirror": "^6.0.1",
|
|
88
88
|
"color": "^4.2.3",
|
|
89
89
|
"compute-scroll-into-view": "^3.1.1",
|
|
90
|
+
"he": "^1.2.0",
|
|
90
91
|
"jshint": "^2.13.6",
|
|
91
92
|
"lodash": "^4.17.21",
|
|
92
93
|
"n3": "^1.25.1",
|
|
@@ -134,6 +135,7 @@
|
|
|
134
135
|
"@testing-library/react": "^12.1.5",
|
|
135
136
|
"@types/codemirror": "^5.60.15",
|
|
136
137
|
"@types/color": "^3.0.6",
|
|
138
|
+
"@types/he": "^1.2.3",
|
|
137
139
|
"@types/jest": "^29.5.14",
|
|
138
140
|
"@types/jshint": "^2.12.4",
|
|
139
141
|
"@types/lodash": "^4.17.16",
|
|
@@ -150,8 +152,8 @@
|
|
|
150
152
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
151
153
|
"husky": "4",
|
|
152
154
|
"identity-obj-proxy": "^3.0.0",
|
|
153
|
-
"jest": "^30.0
|
|
154
|
-
"jest-environment-jsdom": "^30.0
|
|
155
|
+
"jest": "^30.2.0",
|
|
156
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
155
157
|
"jest-pnp-resolver": "^1.2.3",
|
|
156
158
|
"lint-staged": "^15.5.1",
|
|
157
159
|
"node-sass-package-importer": "^5.3.3",
|
package/src/common/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { decode } from "he";
|
|
2
|
+
|
|
1
3
|
import { invisibleZeroWidthCharacters } from "./utils/characters";
|
|
2
4
|
import { colorCalculateDistance } from "./utils/colorCalculateDistance";
|
|
3
5
|
import decideContrastColorValue from "./utils/colorDecideContrastvalue";
|
|
@@ -6,7 +8,8 @@ import getColorConfiguration from "./utils/getColorConfiguration";
|
|
|
6
8
|
import { getScrollParent } from "./utils/getScrollParent";
|
|
7
9
|
import { getGlobalVar, setGlobalVar } from "./utils/globalVars";
|
|
8
10
|
import { openInNewTab } from "./utils/openInNewTab";
|
|
9
|
-
import { reduceToText } from "./utils/reduceToText"
|
|
11
|
+
import { reduceToText } from "./utils/reduceToText";
|
|
12
|
+
export type { DecodeOptions as DecodeHtmlEntitiesOptions } from "he";
|
|
10
13
|
export type { IntentTypes as IntentBaseTypes } from "./Intent";
|
|
11
14
|
|
|
12
15
|
export const utils = {
|
|
@@ -20,5 +23,6 @@ export const utils = {
|
|
|
20
23
|
getScrollParent,
|
|
21
24
|
getEnabledColorsFromPalette,
|
|
22
25
|
textToColorHash,
|
|
23
|
-
reduceToText
|
|
26
|
+
reduceToText,
|
|
27
|
+
decodeHtmlEntities: decode,
|
|
24
28
|
};
|
|
@@ -3,6 +3,7 @@ import { renderToString } from "react-dom/server";
|
|
|
3
3
|
import * as ReactIs from "react-is";
|
|
4
4
|
|
|
5
5
|
import { TextReducerProps } from "./../../components/TextReducer/TextReducer";
|
|
6
|
+
import { DecodeHtmlEntitiesOptions, utils } from "./../";
|
|
6
7
|
|
|
7
8
|
export interface ReduceToTextFuncType {
|
|
8
9
|
(
|
|
@@ -10,12 +11,12 @@ export interface ReduceToTextFuncType {
|
|
|
10
11
|
* Component or text to reduce HTML markup content to plain text.
|
|
11
12
|
*/
|
|
12
13
|
input: React.ReactNode | React.ReactNode[] | string,
|
|
13
|
-
options?: Pick<TextReducerProps, "maxNodes" | "maxLength">
|
|
14
|
+
options?: Pick<TextReducerProps, "maxNodes" | "maxLength" | "decodeHtmlEntities" | "decodeHtmlEntitiesOptions">
|
|
14
15
|
): string;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export const reduceToText: ReduceToTextFuncType = (input, options) => {
|
|
18
|
-
const { maxNodes, maxLength } = options || {};
|
|
19
|
+
const { maxNodes, maxLength, decodeHtmlEntities } = options || {};
|
|
19
20
|
const content: React.ReactNode | React.ReactNode[] = input;
|
|
20
21
|
let nodeCount = 0;
|
|
21
22
|
|
|
@@ -46,6 +47,33 @@ export const reduceToText: ReduceToTextFuncType = (input, options) => {
|
|
|
46
47
|
// Basic HTML cleanup
|
|
47
48
|
text = text.replace(/<[^\s][^>]*>/g, "").replace(/\n/g, " ");
|
|
48
49
|
|
|
50
|
+
if (decodeHtmlEntities) {
|
|
51
|
+
const decodeDefaultOptions = {
|
|
52
|
+
isAttributeValue: true,
|
|
53
|
+
strict: true,
|
|
54
|
+
} as DecodeHtmlEntitiesOptions;
|
|
55
|
+
let decodeErrors = 0;
|
|
56
|
+
// we decode in pieces to apply some error tolerance even in strict mode
|
|
57
|
+
text = text
|
|
58
|
+
.split(" ")
|
|
59
|
+
.map((value) => {
|
|
60
|
+
try {
|
|
61
|
+
return utils.decodeHtmlEntities(value, {
|
|
62
|
+
...decodeDefaultOptions,
|
|
63
|
+
...options?.decodeHtmlEntitiesOptions,
|
|
64
|
+
});
|
|
65
|
+
} catch {
|
|
66
|
+
decodeErrors++;
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
.join(" ");
|
|
71
|
+
if (decodeErrors > 0) {
|
|
72
|
+
// eslint-disable-next-line no-console
|
|
73
|
+
console.warn(`${decodeErrors} parse error(s) for decodeHtmlEntities, return un-decoded text`, text);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
49
77
|
if (typeof maxLength === "number") {
|
|
50
78
|
text = text.slice(0, maxLength);
|
|
51
79
|
}
|
|
@@ -66,6 +66,8 @@ export const ContextMenu = ({
|
|
|
66
66
|
so by default we use the title attribute instead of Tooltip. */
|
|
67
67
|
tooltipAsTitle = true,
|
|
68
68
|
preventPlaceholder = false,
|
|
69
|
+
"data-test-id": dataTestId,
|
|
70
|
+
"data-testid": dataTestid,
|
|
69
71
|
...restProps
|
|
70
72
|
}: ContextMenuProps) => {
|
|
71
73
|
const toggleButton =
|
|
@@ -76,7 +78,8 @@ export const ContextMenu = ({
|
|
|
76
78
|
text={togglerText}
|
|
77
79
|
large={togglerLarge}
|
|
78
80
|
disabled={!!disabled}
|
|
79
|
-
data-test-id={
|
|
81
|
+
data-test-id={dataTestId ?? undefined}
|
|
82
|
+
data-testid={dataTestid ?? undefined}
|
|
80
83
|
/>
|
|
81
84
|
) : (
|
|
82
85
|
(togglerElement as ReactElement)
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
Classes as BlueprintClasses,
|
|
4
4
|
Popover as BlueprintPopover,
|
|
5
|
+
PopoverInteractionKind as InteractionKind,
|
|
5
6
|
PopoverProps as BlueprintPopoverProps,
|
|
6
7
|
Utils as BlueprintUtils,
|
|
7
8
|
} from "@blueprintjs/core";
|
|
@@ -37,9 +38,10 @@ export const ContextOverlay = ({
|
|
|
37
38
|
usePlaceholder = false,
|
|
38
39
|
...otherPopoverProps
|
|
39
40
|
}: ContextOverlayProps) => {
|
|
40
|
-
const placeholderRef = React.useRef(null);
|
|
41
|
-
const eventMemory = React.useRef<undefined | "
|
|
41
|
+
const placeholderRef = React.useRef<HTMLElement>(null);
|
|
42
|
+
const eventMemory = React.useRef<undefined | "mouseenter" | "focusin" | "click">(undefined);
|
|
42
43
|
const swapDelay = React.useRef<null | NodeJS.Timeout>(null);
|
|
44
|
+
const interactionKind = React.useRef<InteractionKind>(otherPopoverProps.interactionKind ?? InteractionKind.CLICK);
|
|
43
45
|
const swapDelayTime = 15;
|
|
44
46
|
const [placeholder, setPlaceholder] = React.useState<boolean>(
|
|
45
47
|
// use placeholder only for "simple" overlays without special states
|
|
@@ -50,37 +52,85 @@ export const ContextOverlay = ({
|
|
|
50
52
|
usePlaceholder
|
|
51
53
|
);
|
|
52
54
|
|
|
55
|
+
const swap = (ev: MouseEvent | globalThis.FocusEvent) => {
|
|
56
|
+
const waitForClick =
|
|
57
|
+
interactionKind.current === InteractionKind.CLICK ||
|
|
58
|
+
interactionKind.current === InteractionKind.CLICK_TARGET_ONLY;
|
|
59
|
+
|
|
60
|
+
if (swapDelay.current) {
|
|
61
|
+
clearTimeout(swapDelay.current);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const replacePlaceholder = () => {
|
|
65
|
+
eventMemory.current = ev.type as "mouseenter" | "focusin" | "click";
|
|
66
|
+
setPlaceholder(false);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
if (waitForClick) {
|
|
70
|
+
ev.stopImmediatePropagation();
|
|
71
|
+
replacePlaceholder();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
swapDelay.current = setTimeout(
|
|
76
|
+
replacePlaceholder,
|
|
77
|
+
// we delay the swap for hover/focus to prevent unwanted effects
|
|
78
|
+
// (e.g. event hickup after replacing elements when it is not really necessary)
|
|
79
|
+
swapDelayTime
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
53
83
|
React.useEffect(() => {
|
|
84
|
+
interactionKind.current = otherPopoverProps.interactionKind ?? InteractionKind.CLICK;
|
|
85
|
+
const waitForClick =
|
|
86
|
+
interactionKind.current === InteractionKind.CLICK ||
|
|
87
|
+
interactionKind.current === InteractionKind.CLICK_TARGET_ONLY;
|
|
88
|
+
const removeEvents = () => {
|
|
89
|
+
if (placeholderRef.current) {
|
|
90
|
+
placeholderRef.current.removeEventListener("click", swap);
|
|
91
|
+
placeholderRef.current.removeEventListener("mouseenter", swap);
|
|
92
|
+
placeholderRef.current.removeEventListener("focusin", swap);
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
};
|
|
54
96
|
if (placeholderRef.current) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
eventMemory.current = ev.type === "focusin" ? "afterfocus" : "afterhover";
|
|
63
|
-
setPlaceholder(false);
|
|
64
|
-
}, swapDelayTime);
|
|
65
|
-
};
|
|
66
|
-
(placeholderRef.current as HTMLElement).addEventListener("mouseenter", swap);
|
|
67
|
-
(placeholderRef.current as HTMLElement).addEventListener("focusin", swap);
|
|
97
|
+
removeEvents(); // remove events in case of interaction kind changed during existence
|
|
98
|
+
if (waitForClick) {
|
|
99
|
+
placeholderRef.current.addEventListener("click", swap);
|
|
100
|
+
} else {
|
|
101
|
+
placeholderRef.current.addEventListener("mouseenter", swap);
|
|
102
|
+
placeholderRef.current.addEventListener("focusin", swap);
|
|
103
|
+
}
|
|
68
104
|
return () => {
|
|
69
|
-
|
|
70
|
-
(placeholderRef.current as HTMLElement).removeEventListener("mouseenter", swap);
|
|
71
|
-
(placeholderRef.current as HTMLElement).removeEventListener("focusin", swap);
|
|
72
|
-
}
|
|
105
|
+
removeEvents();
|
|
73
106
|
};
|
|
74
107
|
}
|
|
75
108
|
return () => {};
|
|
76
|
-
}, [!!placeholderRef.current]);
|
|
109
|
+
}, [!!placeholderRef.current, otherPopoverProps.interactionKind]);
|
|
77
110
|
|
|
78
111
|
const refocus = React.useCallback((node) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
112
|
+
const target = node?.targetRef.current.children[0];
|
|
113
|
+
if (!eventMemory.current || !target) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
switch (eventMemory.current) {
|
|
117
|
+
case "focusin":
|
|
82
118
|
target.focus();
|
|
83
|
-
|
|
119
|
+
break;
|
|
120
|
+
case "click":
|
|
121
|
+
target.click();
|
|
122
|
+
break;
|
|
123
|
+
case "mouseenter":
|
|
124
|
+
// re-check if the cursor is still over the element after swapping the placeholder before triggering the event to bubble up
|
|
125
|
+
(target as HTMLElement).addEventListener(
|
|
126
|
+
"mouseover",
|
|
127
|
+
() => (target as HTMLElement).dispatchEvent(new MouseEvent("mouseover", { bubbles: true })),
|
|
128
|
+
{
|
|
129
|
+
capture: true,
|
|
130
|
+
once: true,
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
break;
|
|
84
134
|
}
|
|
85
135
|
}, []);
|
|
86
136
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
3
|
+
|
|
4
|
+
import "@testing-library/jest-dom";
|
|
5
|
+
|
|
6
|
+
import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
|
|
7
|
+
|
|
8
|
+
import ContextMenu from "./../ContextMenu";
|
|
9
|
+
import { Default as ContextMenuStory } from "./../ContextMenu.stories";
|
|
10
|
+
|
|
11
|
+
const overlayWrapper = `${eccgui}-contextoverlay`;
|
|
12
|
+
const placeholderClass = `${overlayWrapper}__wrapper--placeholder`;
|
|
13
|
+
|
|
14
|
+
const checkForPlaceholderClass = (container: HTMLElement, tobe: number) => {
|
|
15
|
+
expect(container.getElementsByClassName(placeholderClass).length).toBe(tobe);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe("ContextMenu", () => {
|
|
19
|
+
it("should render placeholder automatically", () => {
|
|
20
|
+
const { container } = render(<ContextMenu {...ContextMenuStory.args} />);
|
|
21
|
+
checkForPlaceholderClass(container, 1);
|
|
22
|
+
});
|
|
23
|
+
it("should not render placeholder when `preventPlaceholder===true`", () => {
|
|
24
|
+
const { container } = render(<ContextMenu {...ContextMenuStory.args} preventPlaceholder={true} />);
|
|
25
|
+
checkForPlaceholderClass(container, 0);
|
|
26
|
+
});
|
|
27
|
+
it("should render placeholder when `preventPlaceholder===false`", () => {
|
|
28
|
+
const { container } = render(<ContextMenu {...ContextMenuStory.args} preventPlaceholder={false} />);
|
|
29
|
+
checkForPlaceholderClass(container, 1);
|
|
30
|
+
});
|
|
31
|
+
it("if no placeholder is used the menu should be displayed on click", async () => {
|
|
32
|
+
const { container } = render(<ContextMenu {...ContextMenuStory.args} preventPlaceholder={true} />);
|
|
33
|
+
checkForPlaceholderClass(container, 0);
|
|
34
|
+
fireEvent.click(container.getElementsByClassName(overlayWrapper)[0]);
|
|
35
|
+
expect(await screen.findByText("First option")).toBeVisible();
|
|
36
|
+
});
|
|
37
|
+
it("if placeholder is used the menu should be displayed on click", async () => {
|
|
38
|
+
const { container } = render(<ContextMenu {...ContextMenuStory.args} preventPlaceholder={false} />);
|
|
39
|
+
checkForPlaceholderClass(container, 1);
|
|
40
|
+
fireEvent.click(container.getElementsByClassName(overlayWrapper)[0]);
|
|
41
|
+
expect(await screen.findByText("First option")).toBeVisible();
|
|
42
|
+
});
|
|
43
|
+
});
|