@datarobot/design-system 29.1.0 → 29.1.2
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/cjs/dropdown-menu/dropdown-item-title.d.ts +1 -0
- package/cjs/dropdown-menu/dropdown-item-title.js +9 -7
- package/cjs/dropdown-menu/dropdown-menu-trigger.js +1 -1
- package/cjs/dropdown-menu/dropdown-selectbox-trigger.js +3 -2
- package/cjs/hooks/use-analytics/use-analytics.test.js +0 -10
- package/esm/dropdown-menu/dropdown-item-title.d.ts +1 -0
- package/esm/dropdown-menu/dropdown-item-title.js +8 -7
- package/esm/dropdown-menu/dropdown-menu-trigger.js +1 -1
- package/esm/dropdown-menu/dropdown-selectbox-trigger.js +3 -2
- package/esm/hooks/use-analytics/use-analytics.test.js +0 -10
- package/js/bundle/bundle.js +17 -7
- package/js/bundle/bundle.min.js +1 -1
- package/package.json +1 -1
- package/styles/index.css +4 -0
- package/styles/index.min.css +1 -1
- package/styles/themes/alpine-light.css +1 -1
- package/styles/themes/alpine-light.min.css +1 -1
- package/styles/themes/midnight-gray.css +1 -1
- package/styles/themes/midnight-gray.min.css +1 -1
|
@@ -3,6 +3,7 @@ import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
|
3
3
|
import { TooltipPlacementsType } from '../tooltip';
|
|
4
4
|
import './dropdown-item-title.less';
|
|
5
5
|
export type DropdownItemTitleOption = {
|
|
6
|
+
key: string | number;
|
|
6
7
|
iconClass?: string;
|
|
7
8
|
icon?: IconProp;
|
|
8
9
|
title?: ReactNode;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _faChevronRight = require("@fortawesome/free-solid-svg-icons/faChevronRight");
|
|
10
10
|
var _fontAwesomeIcon = require("../font-awesome-icon");
|
|
@@ -12,6 +12,7 @@ var _truncateWithTooltip = require("../truncate-with-tooltip");
|
|
|
12
12
|
var _tooltip = require("../tooltip");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
16
|
const DropdownItemTitle = ({
|
|
16
17
|
option,
|
|
17
18
|
isMultiLevelHandler = false
|
|
@@ -25,7 +26,8 @@ const DropdownItemTitle = ({
|
|
|
25
26
|
tooltipPlacement,
|
|
26
27
|
tooltipText,
|
|
27
28
|
tooltipDocsLink,
|
|
28
|
-
tooltipTestId
|
|
29
|
+
tooltipTestId,
|
|
30
|
+
key
|
|
29
31
|
} = option;
|
|
30
32
|
const props = {
|
|
31
33
|
tooltipText,
|
|
@@ -59,14 +61,14 @@ const DropdownItemTitle = ({
|
|
|
59
61
|
})
|
|
60
62
|
});
|
|
61
63
|
const withTruncatableText = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
62
|
-
children: [/*#__PURE__*/(0,
|
|
64
|
+
children: [/*#__PURE__*/(0, _react.createElement)(_truncateWithTooltip.TruncateWithTooltip, {
|
|
63
65
|
...props,
|
|
64
|
-
|
|
65
|
-
}), subtext && /*#__PURE__*/(0,
|
|
66
|
+
key: key
|
|
67
|
+
}, itemTitle), subtext && /*#__PURE__*/(0, _react.createElement)(_truncateWithTooltip.TruncateWithTooltip, {
|
|
66
68
|
...props,
|
|
67
69
|
tooltipTestId: `${tooltipTestId}-subtext`,
|
|
68
|
-
|
|
69
|
-
})]
|
|
70
|
+
key: `${key}-subtext`
|
|
71
|
+
}, itemSubText)]
|
|
70
72
|
});
|
|
71
73
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
72
74
|
className: (0, _classnames.default)('drop-item-content-wrap', {
|
|
@@ -22,7 +22,7 @@ const DefaultTriggerContent = ({
|
|
|
22
22
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
23
23
|
children: selectedItem?.title ?? defaultTriggerText
|
|
24
24
|
})
|
|
25
|
-
});
|
|
25
|
+
}, selectedItem?.key ?? 0);
|
|
26
26
|
const DropdownMenuTrigger = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
27
27
|
onClick,
|
|
28
28
|
isOpen,
|
|
@@ -31,6 +31,7 @@ const DefaultTriggerContent = function ({
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
const triggerContent = getGenericTriggerContent(selectedItem, options);
|
|
34
|
+
const key = selectedItem?.key;
|
|
34
35
|
if (triggerContent) {
|
|
35
36
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
36
37
|
className: "selected-item-details",
|
|
@@ -38,7 +39,7 @@ const DefaultTriggerContent = function ({
|
|
|
38
39
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
39
40
|
children: triggerContent
|
|
40
41
|
})
|
|
41
|
-
})
|
|
42
|
+
}, key)
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_truncateWithTooltip.TruncateWithTooltip, {
|
|
@@ -46,7 +47,7 @@ const DefaultTriggerContent = function ({
|
|
|
46
47
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
47
48
|
children: defaultTriggerText
|
|
48
49
|
})
|
|
49
|
-
});
|
|
50
|
+
}, key);
|
|
50
51
|
};
|
|
51
52
|
function getGenericTriggerContent(selectedItem, options) {
|
|
52
53
|
const selectedOptions = options.filter(option => option.isChecked).map(option => option.title);
|
|
@@ -94,15 +94,5 @@ describe('useAnalytics', function () {
|
|
|
94
94
|
prop: 'value'
|
|
95
95
|
}]);
|
|
96
96
|
});
|
|
97
|
-
it('should pass custom event to provider', function () {
|
|
98
|
-
(0, _react.act)(() => hook.result.current.track({
|
|
99
|
-
event: 'project_created',
|
|
100
|
-
label: 'example_dataset',
|
|
101
|
-
property: 'industry',
|
|
102
|
-
value: 42
|
|
103
|
-
}));
|
|
104
|
-
expect(provider.getLastMediator().method).toEqual(_constants.ANALYTICS_METHODS.TRACK);
|
|
105
|
-
expect(provider.getLastMediator().args).toEqual(['page.key', 'project_created', 'example_dataset', 'industry', 42, false]);
|
|
106
|
-
});
|
|
107
97
|
});
|
|
108
98
|
});
|
|
@@ -3,6 +3,7 @@ import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
|
3
3
|
import { TooltipPlacementsType } from '../tooltip';
|
|
4
4
|
import './dropdown-item-title.less';
|
|
5
5
|
export type DropdownItemTitleOption = {
|
|
6
|
+
key: string | number;
|
|
6
7
|
iconClass?: string;
|
|
7
8
|
icon?: IconProp;
|
|
8
9
|
title?: ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { createElement as _createElement } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { faChevronRight } from '@fortawesome/free-solid-svg-icons/faChevronRight';
|
|
4
4
|
import { FontAwesomeIcon } from '../font-awesome-icon';
|
|
@@ -18,7 +18,8 @@ const DropdownItemTitle = ({
|
|
|
18
18
|
tooltipPlacement,
|
|
19
19
|
tooltipText,
|
|
20
20
|
tooltipDocsLink,
|
|
21
|
-
tooltipTestId
|
|
21
|
+
tooltipTestId,
|
|
22
|
+
key
|
|
22
23
|
} = option;
|
|
23
24
|
const props = {
|
|
24
25
|
tooltipText,
|
|
@@ -52,14 +53,14 @@ const DropdownItemTitle = ({
|
|
|
52
53
|
})
|
|
53
54
|
});
|
|
54
55
|
const withTruncatableText = /*#__PURE__*/_jsxs(_Fragment, {
|
|
55
|
-
children: [/*#__PURE__*/
|
|
56
|
+
children: [/*#__PURE__*/_createElement(TruncateWithTooltip, {
|
|
56
57
|
...props,
|
|
57
|
-
|
|
58
|
-
}), subtext && /*#__PURE__*/
|
|
58
|
+
key: key
|
|
59
|
+
}, itemTitle), subtext && /*#__PURE__*/_createElement(TruncateWithTooltip, {
|
|
59
60
|
...props,
|
|
60
61
|
tooltipTestId: `${tooltipTestId}-subtext`,
|
|
61
|
-
|
|
62
|
-
})]
|
|
62
|
+
key: `${key}-subtext`
|
|
63
|
+
}, itemSubText)]
|
|
63
64
|
});
|
|
64
65
|
return /*#__PURE__*/_jsx("div", {
|
|
65
66
|
className: classnames('drop-item-content-wrap', {
|
|
@@ -23,6 +23,7 @@ const DefaultTriggerContent = function ({
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
const triggerContent = getGenericTriggerContent(selectedItem, options);
|
|
26
|
+
const key = selectedItem?.key;
|
|
26
27
|
if (triggerContent) {
|
|
27
28
|
return /*#__PURE__*/_jsx("span", {
|
|
28
29
|
className: "selected-item-details",
|
|
@@ -30,7 +31,7 @@ const DefaultTriggerContent = function ({
|
|
|
30
31
|
children: /*#__PURE__*/_jsx("span", {
|
|
31
32
|
children: triggerContent
|
|
32
33
|
})
|
|
33
|
-
})
|
|
34
|
+
}, key)
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
return /*#__PURE__*/_jsx(TruncateWithTooltip, {
|
|
@@ -38,7 +39,7 @@ const DefaultTriggerContent = function ({
|
|
|
38
39
|
children: /*#__PURE__*/_jsx("span", {
|
|
39
40
|
children: defaultTriggerText
|
|
40
41
|
})
|
|
41
|
-
});
|
|
42
|
+
}, key);
|
|
42
43
|
};
|
|
43
44
|
function getGenericTriggerContent(selectedItem, options) {
|
|
44
45
|
const selectedOptions = options.filter(option => option.isChecked).map(option => option.title);
|
|
@@ -93,15 +93,5 @@ describe('useAnalytics', function () {
|
|
|
93
93
|
prop: 'value'
|
|
94
94
|
}]);
|
|
95
95
|
});
|
|
96
|
-
it('should pass custom event to provider', function () {
|
|
97
|
-
act(() => hook.result.current.track({
|
|
98
|
-
event: 'project_created',
|
|
99
|
-
label: 'example_dataset',
|
|
100
|
-
property: 'industry',
|
|
101
|
-
value: 42
|
|
102
|
-
}));
|
|
103
|
-
expect(provider.getLastMediator().method).toEqual(ANALYTICS_METHODS.TRACK);
|
|
104
|
-
expect(provider.getLastMediator().args).toEqual(['page.key', 'project_created', 'example_dataset', 'industry', 42, false]);
|
|
105
|
-
});
|
|
106
96
|
});
|
|
107
97
|
});
|
package/js/bundle/bundle.js
CHANGED
|
@@ -50824,7 +50824,8 @@ var DropdownItemTitle = function DropdownItemTitle(_ref) {
|
|
|
50824
50824
|
tooltipPlacement = option.tooltipPlacement,
|
|
50825
50825
|
tooltipText = option.tooltipText,
|
|
50826
50826
|
tooltipDocsLink = option.tooltipDocsLink,
|
|
50827
|
-
tooltipTestId = option.tooltipTestId
|
|
50827
|
+
tooltipTestId = option.tooltipTestId,
|
|
50828
|
+
key = option.key;
|
|
50828
50829
|
var props = {
|
|
50829
50830
|
tooltipText: tooltipText,
|
|
50830
50831
|
tooltipPlacement: tooltipPlacement || _tooltip__WEBPACK_IMPORTED_MODULE_5__.TOOLTIP_PLACEMENT_TYPES.RIGHT,
|
|
@@ -50852,8 +50853,11 @@ var DropdownItemTitle = function DropdownItemTitle(_ref) {
|
|
|
50852
50853
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
50853
50854
|
className: "menu-item-subtext"
|
|
50854
50855
|
}, subtext));
|
|
50855
|
-
var withTruncatableText = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_truncate_with_tooltip__WEBPACK_IMPORTED_MODULE_4__.TruncateWithTooltip,
|
|
50856
|
-
|
|
50856
|
+
var withTruncatableText = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_truncate_with_tooltip__WEBPACK_IMPORTED_MODULE_4__.TruncateWithTooltip, _extends({}, props, {
|
|
50857
|
+
key: key
|
|
50858
|
+
}), itemTitle), subtext && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_truncate_with_tooltip__WEBPACK_IMPORTED_MODULE_4__.TruncateWithTooltip, _extends({}, props, {
|
|
50859
|
+
tooltipTestId: "".concat(tooltipTestId, "-subtext"),
|
|
50860
|
+
key: "".concat(key, "-subtext")
|
|
50857
50861
|
}), itemSubText));
|
|
50858
50862
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
50859
50863
|
className: classnames__WEBPACK_IMPORTED_MODULE_1___default()('drop-item-content-wrap', {
|
|
@@ -51541,10 +51545,12 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
51541
51545
|
|
|
51542
51546
|
|
|
51543
51547
|
var DefaultTriggerContent = function DefaultTriggerContent(_ref) {
|
|
51544
|
-
var _selectedItem$title;
|
|
51548
|
+
var _selectedItem$key, _selectedItem$title;
|
|
51545
51549
|
var selectedItem = _ref.selectedItem,
|
|
51546
51550
|
defaultTriggerText = _ref.defaultTriggerText;
|
|
51547
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_truncate_with_tooltip__WEBPACK_IMPORTED_MODULE_4__.TruncateWithTooltip,
|
|
51551
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_truncate_with_tooltip__WEBPACK_IMPORTED_MODULE_4__.TruncateWithTooltip, {
|
|
51552
|
+
key: (_selectedItem$key = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.key) !== null && _selectedItem$key !== void 0 ? _selectedItem$key : 0
|
|
51553
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null, (_selectedItem$title = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.title) !== null && _selectedItem$title !== void 0 ? _selectedItem$title : defaultTriggerText));
|
|
51548
51554
|
};
|
|
51549
51555
|
var DropdownMenuTrigger = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (_ref2, ref) {
|
|
51550
51556
|
var onClick = _ref2.onClick,
|
|
@@ -52186,13 +52192,17 @@ var DefaultTriggerContent = function DefaultTriggerContent(_ref) {
|
|
|
52186
52192
|
});
|
|
52187
52193
|
}
|
|
52188
52194
|
var triggerContent = getGenericTriggerContent(selectedItem, options);
|
|
52195
|
+
var key = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.key;
|
|
52189
52196
|
if (triggerContent) {
|
|
52190
52197
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
52191
52198
|
className: "selected-item-details"
|
|
52192
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_truncate_with_tooltip__WEBPACK_IMPORTED_MODULE_5__.TruncateWithTooltip,
|
|
52199
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_truncate_with_tooltip__WEBPACK_IMPORTED_MODULE_5__.TruncateWithTooltip, {
|
|
52200
|
+
key: key
|
|
52201
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null, triggerContent)));
|
|
52193
52202
|
}
|
|
52194
52203
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_truncate_with_tooltip__WEBPACK_IMPORTED_MODULE_5__.TruncateWithTooltip, {
|
|
52195
|
-
className: "placeholder"
|
|
52204
|
+
className: "placeholder",
|
|
52205
|
+
key: key
|
|
52196
52206
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null, defaultTriggerText));
|
|
52197
52207
|
};
|
|
52198
52208
|
function getGenericTriggerContent(selectedItem, options) {
|