oolib 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/stories/v2/components/Dropdown/dropdownOptions.d.ts +28 -2
- package/dist/stories/v2/components/Dropdown/dropdownOptions.js +7 -1
- package/dist/stories/v2/components/List.stories.js +1 -0
- package/dist/v2/components/List/comps/ListItem.d.ts +1 -1
- package/dist/v2/components/List/comps/ListItem.js +6 -3
- package/dist/v2/components/Tooltip/index.d.ts +1 -1
- package/dist/v2/components/Tooltip/index.js +10 -8
- package/dist/v2/components/Tooltip/types.d.ts +9 -0
- package/package.json +1 -1
|
@@ -2,6 +2,17 @@ export const dropdownOptions: ({
|
|
|
2
2
|
display: string;
|
|
3
3
|
value: string;
|
|
4
4
|
color: string;
|
|
5
|
+
iconAfter?: undefined;
|
|
6
|
+
iconAfterColor?: undefined;
|
|
7
|
+
desc?: undefined;
|
|
8
|
+
icon?: undefined;
|
|
9
|
+
image?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
display: string;
|
|
12
|
+
value: string;
|
|
13
|
+
color: string;
|
|
14
|
+
iconAfter: string;
|
|
15
|
+
iconAfterColor: string;
|
|
5
16
|
desc?: undefined;
|
|
6
17
|
icon?: undefined;
|
|
7
18
|
image?: undefined;
|
|
@@ -10,6 +21,8 @@ export const dropdownOptions: ({
|
|
|
10
21
|
value: string;
|
|
11
22
|
color: string;
|
|
12
23
|
desc: string;
|
|
24
|
+
iconAfter?: undefined;
|
|
25
|
+
iconAfterColor?: undefined;
|
|
13
26
|
icon?: undefined;
|
|
14
27
|
image?: undefined;
|
|
15
28
|
} | {
|
|
@@ -17,6 +30,8 @@ export const dropdownOptions: ({
|
|
|
17
30
|
value: string;
|
|
18
31
|
color: string;
|
|
19
32
|
icon: string;
|
|
33
|
+
iconAfter?: undefined;
|
|
34
|
+
iconAfterColor?: undefined;
|
|
20
35
|
desc?: undefined;
|
|
21
36
|
image?: undefined;
|
|
22
37
|
} | {
|
|
@@ -24,6 +39,8 @@ export const dropdownOptions: ({
|
|
|
24
39
|
value: string;
|
|
25
40
|
color: string;
|
|
26
41
|
image: string;
|
|
42
|
+
iconAfter?: undefined;
|
|
43
|
+
iconAfterColor?: undefined;
|
|
27
44
|
desc?: undefined;
|
|
28
45
|
icon?: undefined;
|
|
29
46
|
} | {
|
|
@@ -33,14 +50,23 @@ export const dropdownOptions: ({
|
|
|
33
50
|
image: string;
|
|
34
51
|
icon: string;
|
|
35
52
|
desc: string;
|
|
53
|
+
iconAfter?: undefined;
|
|
54
|
+
iconAfterColor?: undefined;
|
|
36
55
|
})[];
|
|
37
56
|
export const dropdownOptionsGroup: {
|
|
38
57
|
display: string;
|
|
39
58
|
value: string;
|
|
40
|
-
options: {
|
|
59
|
+
options: ({
|
|
41
60
|
display: string;
|
|
42
61
|
value: string;
|
|
43
62
|
color: string;
|
|
44
63
|
desc: string;
|
|
45
|
-
|
|
64
|
+
iconAfter?: undefined;
|
|
65
|
+
} | {
|
|
66
|
+
display: string;
|
|
67
|
+
value: string;
|
|
68
|
+
desc: string;
|
|
69
|
+
color: string;
|
|
70
|
+
iconAfter: string;
|
|
71
|
+
})[];
|
|
46
72
|
}[];
|
|
@@ -17,6 +17,9 @@ exports.dropdownOptions = [
|
|
|
17
17
|
color: themes_1.colors.invertRed,
|
|
18
18
|
// image: "xyz",
|
|
19
19
|
// icon: "Trash",
|
|
20
|
+
iconAfter: "WarningDiamond",
|
|
21
|
+
// Per-option colour too; omit it and the icon stays the default grey.
|
|
22
|
+
iconAfterColor: themes_1.colors.red,
|
|
20
23
|
// desc: "This is a story about schnil-tu, a.k.a tubito senpai. Tubito senpai loves to say bhai-god. Lol.",
|
|
21
24
|
},
|
|
22
25
|
{
|
|
@@ -1889,7 +1892,10 @@ exports.dropdownOptionsGroup = [
|
|
|
1889
1892
|
display: "Mumbai",
|
|
1890
1893
|
value: "mumbai",
|
|
1891
1894
|
desc: "Mumbai is India's financial center and largest city with a population of over 20 million people.",
|
|
1892
|
-
color: themes_1.colors.lightBlue
|
|
1895
|
+
color: themes_1.colors.lightBlue,
|
|
1896
|
+
// Same per-option marker, but inside a GROUP — covers the ListGroup path,
|
|
1897
|
+
// which is what grouped consumers (e.g. the field-type dropdown) hit.
|
|
1898
|
+
iconAfter: "WarningDiamond"
|
|
1893
1899
|
}
|
|
1894
1900
|
],
|
|
1895
1901
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function ListItem({ id, option, isSelected, isFocussed, scrollFocussedOpIntoView, onChange: parentOnChange, setSearchString, optionsClassName, S, observerRef, isTagsStyle, isMulti, value, index, alignCheckbox, iconAfter }: {
|
|
1
|
+
export function ListItem({ id, option, isSelected, isFocussed, scrollFocussedOpIntoView, onChange: parentOnChange, setSearchString, optionsClassName, S, observerRef, isTagsStyle, isMulti, value, index, alignCheckbox, iconAfter: allOptionsIconAfter }: {
|
|
2
2
|
id: any;
|
|
3
3
|
option: any;
|
|
4
4
|
isSelected: any;
|
|
@@ -62,10 +62,12 @@ var styled_1 = require("./styled");
|
|
|
62
62
|
var Tooltip_1 = __importDefault(require("../../Tooltip"));
|
|
63
63
|
var grey40 = themes_1.colors.grey40, grey80 = themes_1.colors.grey80, grey60 = themes_1.colors.grey60;
|
|
64
64
|
var ListItem = function (_a) {
|
|
65
|
-
var id = _a.id, option = _a.option, isSelected = _a.isSelected, isFocussed = _a.isFocussed, scrollFocussedOpIntoView = _a.scrollFocussedOpIntoView, parentOnChange = _a.onChange, setSearchString = _a.setSearchString, optionsClassName = _a.optionsClassName, S = _a.S, observerRef = _a.observerRef, isTagsStyle = _a.isTagsStyle, isMulti = _a.isMulti, value = _a.value, index = _a.index, _b = _a.alignCheckbox, alignCheckbox = _b === void 0 ? "left" : _b,
|
|
65
|
+
var id = _a.id, option = _a.option, isSelected = _a.isSelected, isFocussed = _a.isFocussed, scrollFocussedOpIntoView = _a.scrollFocussedOpIntoView, parentOnChange = _a.onChange, setSearchString = _a.setSearchString, optionsClassName = _a.optionsClassName, S = _a.S, observerRef = _a.observerRef, isTagsStyle = _a.isTagsStyle, isMulti = _a.isMulti, value = _a.value, index = _a.index, _b = _a.alignCheckbox, alignCheckbox = _b === void 0 ? "left" : _b, allOptionsIconAfter = _a.iconAfter // might not be used anywhere keeping it here just in case
|
|
66
|
+
;
|
|
66
67
|
var theme = (0, styled_components_1.useTheme)();
|
|
67
68
|
var TypoComp = S ? Typo2_1.UI_BODY_SM_DF : Typo2_1.UI_BODY_SM_DF;
|
|
68
|
-
var image = option.image, display = option.display, icon = option.icon, desc = option.desc, color = option.color, loading = option.loading, disabled = option.disabled, tooltip = option.tooltip;
|
|
69
|
+
var image = option.image, display = option.display, icon = option.icon, desc = option.desc, color = option.color, loading = option.loading, disabled = option.disabled, tooltip = option.tooltip, optionIconAfter = option.iconAfter, iconAfterColor = option.iconAfterColor;
|
|
70
|
+
var iconAfter = allOptionsIconAfter || optionIconAfter;
|
|
69
71
|
var handleClick = function () {
|
|
70
72
|
if (!loading) {
|
|
71
73
|
parentOnChange(id, option);
|
|
@@ -117,7 +119,8 @@ var ListItem = function (_a) {
|
|
|
117
119
|
icon: iconAfter,
|
|
118
120
|
S: S,
|
|
119
121
|
className: "OKE-Dropdown__optionIcon",
|
|
120
|
-
disabled: disabled
|
|
122
|
+
disabled: disabled,
|
|
123
|
+
color: iconAfterColor
|
|
121
124
|
}))));
|
|
122
125
|
if (tooltip) {
|
|
123
126
|
var tooltipProps = typeof tooltip === 'string' ? { text: tooltip } : tooltip;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TooltipProps } from './types';
|
|
3
|
-
export default function Tooltip({ text, heading, primaryContent, secondaryContent, progressiveDelay, progressiveGap, children, placement, showPointer, showDelay, hideDelay, animation, followCursor, cursorOffset, invert, wrapperDisplay, wrapperStyle, trigger, style, }: TooltipProps): React.JSX.Element;
|
|
3
|
+
export default function Tooltip({ text, heading, primaryContent, secondaryContent, progressiveDelay, progressiveGap, children, placement, showPointer, showDelay, hideDelay, animation, followCursor, cursorOffset, invert, wrapperDisplay, wrapperStyle, trigger, pinOnClick, style, }: TooltipProps): React.JSX.Element;
|
|
@@ -53,15 +53,15 @@ var utils_1 = require("./utils");
|
|
|
53
53
|
var styled_1 = require("./styled");
|
|
54
54
|
var CURSOR_HEIGHT = 20;
|
|
55
55
|
function Tooltip(_a) {
|
|
56
|
-
var text = _a.text, heading = _a.heading, primaryContent = _a.primaryContent, secondaryContent = _a.secondaryContent, _b = _a.progressiveDelay, progressiveDelay = _b === void 0 ? 600 : _b, _c = _a.progressiveGap, progressiveGap = _c === void 0 ? 8 : _c, children = _a.children, _d = _a.placement, placement = _d === void 0 ? 'top' : _d, _e = _a.showPointer, showPointer = _e === void 0 ? true : _e, _f = _a.showDelay, showDelay = _f === void 0 ? 600 : _f, _g = _a.hideDelay, hideDelay = _g === void 0 ? 0 : _g, _h = _a.animation, animation = _h === void 0 ? 'fade' : _h, _j = _a.followCursor, followCursor = _j === void 0 ? false : _j, _k = _a.cursorOffset, cursorOffset = _k === void 0 ? 10 : _k, _l = _a.invert, invert = _l === void 0 ? false : _l, wrapperDisplay = _a.wrapperDisplay, wrapperStyle = _a.wrapperStyle, _m = _a.trigger, trigger = _m === void 0 ? 'hover' : _m, style = _a.style;
|
|
56
|
+
var text = _a.text, heading = _a.heading, primaryContent = _a.primaryContent, secondaryContent = _a.secondaryContent, _b = _a.progressiveDelay, progressiveDelay = _b === void 0 ? 600 : _b, _c = _a.progressiveGap, progressiveGap = _c === void 0 ? 8 : _c, children = _a.children, _d = _a.placement, placement = _d === void 0 ? 'top' : _d, _e = _a.showPointer, showPointer = _e === void 0 ? true : _e, _f = _a.showDelay, showDelay = _f === void 0 ? 600 : _f, _g = _a.hideDelay, hideDelay = _g === void 0 ? 0 : _g, _h = _a.animation, animation = _h === void 0 ? 'fade' : _h, _j = _a.followCursor, followCursor = _j === void 0 ? false : _j, _k = _a.cursorOffset, cursorOffset = _k === void 0 ? 10 : _k, _l = _a.invert, invert = _l === void 0 ? false : _l, wrapperDisplay = _a.wrapperDisplay, wrapperStyle = _a.wrapperStyle, _m = _a.trigger, trigger = _m === void 0 ? 'hover' : _m, _o = _a.pinOnClick, pinOnClick = _o === void 0 ? true : _o, style = _a.style;
|
|
57
57
|
var bgColor = invert ? __1.colors2.white : __1.colors2.black;
|
|
58
58
|
var textColor = invert ? __1.colors2.black : __1.colors2.white;
|
|
59
59
|
var resolvedPrimaryContent = (0, utils_1.resolvePrimaryContent)(text, heading, primaryContent);
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
-
var
|
|
63
|
-
var
|
|
64
|
-
var
|
|
60
|
+
var _p = (0, react_1.useState)(false), isOpen = _p[0], setIsOpen = _p[1];
|
|
61
|
+
var _q = (0, react_1.useState)(false), showSecondary = _q[0], setShowSecondary = _q[1];
|
|
62
|
+
var _r = (0, react_1.useState)(false), isPinned = _r[0], setIsPinned = _r[1];
|
|
63
|
+
var _s = (0, react_1.useState)({ x: 0, y: 0 }), mousePos = _s[0], setMousePos = _s[1];
|
|
64
|
+
var _t = (0, react_1.useState)({}), cursorTooltipStyle = _t[0], setCursorTooltipStyle = _t[1];
|
|
65
65
|
var progressiveTimerRef = (0, react_1.useRef)(null);
|
|
66
66
|
var containerRef = (0, react_1.useRef)(null);
|
|
67
67
|
var arrowRef = (0, react_1.useRef)(null);
|
|
@@ -89,7 +89,7 @@ function Tooltip(_a) {
|
|
|
89
89
|
close: { opacity: 0 },
|
|
90
90
|
} : undefined;
|
|
91
91
|
var isClickTrigger = trigger === 'click';
|
|
92
|
-
var
|
|
92
|
+
var _u = (0, useFloatingPosition_1.useFloatingPosition)({
|
|
93
93
|
open: isOpen,
|
|
94
94
|
onOpenChange: function (open) {
|
|
95
95
|
if (followCursor)
|
|
@@ -129,7 +129,7 @@ function Tooltip(_a) {
|
|
|
129
129
|
shift: { enabled: true, config: { padding: 8 } },
|
|
130
130
|
flip: { enabled: true, config: followCursor ? { fallbackPlacements: ['top-start'] } : { fallbackAxisSideDirection: 'start' } },
|
|
131
131
|
},
|
|
132
|
-
}), refs =
|
|
132
|
+
}), refs = _u.refs, floatingStyles = _u.floatingStyles, context = _u.context, getReferenceProps = _u.getReferenceProps, getFloatingProps = _u.getFloatingProps, isMounted = _u.isMounted, transitionStyles = _u.transitionStyles;
|
|
133
133
|
var handleMouseMove = (0, react_1.useCallback)(function (e) {
|
|
134
134
|
if (followCursor) {
|
|
135
135
|
setMousePos({ x: e.clientX, y: e.clientY });
|
|
@@ -149,6 +149,8 @@ function Tooltip(_a) {
|
|
|
149
149
|
var handleClick = function (e) {
|
|
150
150
|
if (followCursor || isClickTrigger)
|
|
151
151
|
return; //useClick
|
|
152
|
+
if (!pinOnClick)
|
|
153
|
+
return; // clickable child owns the click — don't swallow or pin
|
|
152
154
|
e.stopPropagation();
|
|
153
155
|
if (isOpen) {
|
|
154
156
|
setIsPinned(false);
|
|
@@ -61,6 +61,15 @@ export interface TooltipProps {
|
|
|
61
61
|
*/
|
|
62
62
|
wrapperStyle?: React.CSSProperties;
|
|
63
63
|
trigger?: 'hover' | 'click';
|
|
64
|
+
/**
|
|
65
|
+
* Hover-trigger only. By default, clicking the wrapped child pins the
|
|
66
|
+
* tooltip open AND stops the click from propagating — which silently
|
|
67
|
+
* swallows clicks meant for an interactive child (or an ancestor click
|
|
68
|
+
* handler, e.g. a popover trigger wrapping this tooltip). Set false when
|
|
69
|
+
* `children` is clickable: the click passes through untouched and the
|
|
70
|
+
* tooltip never pins.
|
|
71
|
+
*/
|
|
72
|
+
pinOnClick?: boolean;
|
|
64
73
|
style?: React.CSSProperties;
|
|
65
74
|
}
|
|
66
75
|
export interface GetBorderRadiusOptions {
|