@datarobot/design-system 30.1.2 → 30.1.3
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/sidebar-cards/sidebar-card.d.ts +3 -1
- package/cjs/sidebar-cards/sidebar-card.js +14 -7
- package/cjs/sidebar-cards/sidebar-cards.js +1 -0
- package/cjs/sidebar-cards/types.d.ts +2 -0
- package/esm/sidebar-cards/sidebar-card.d.ts +3 -1
- package/esm/sidebar-cards/sidebar-card.js +13 -7
- package/esm/sidebar-cards/sidebar-cards.js +1 -0
- package/esm/sidebar-cards/types.d.ts +2 -0
- package/js/bundle/bundle.js +20 -5
- package/js/bundle/bundle.min.js +1 -1
- package/js/bundle/index.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { SidebarCardProps } from './types';
|
|
2
3
|
import './sidebar-card.less';
|
|
3
4
|
/** A SidebarCards: Card
|
|
@@ -6,4 +7,5 @@ import './sidebar-card.less';
|
|
|
6
7
|
* @midnight-gray-supported
|
|
7
8
|
* @alpine-light-supported
|
|
8
9
|
* */
|
|
9
|
-
|
|
10
|
+
declare const SidebarCard: React.ForwardRefExoticComponent<SidebarCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export default SidebarCard;
|
|
@@ -3,21 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
7
|
-
var _react =
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _sidebarCardHeader = _interopRequireDefault(require("./sidebar-card-header"));
|
|
10
10
|
var _sidebarCardContent = _interopRequireDefault(require("./sidebar-card-content"));
|
|
11
11
|
var _hooks = require("../hooks");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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); }
|
|
14
15
|
/** A SidebarCards: Card
|
|
15
16
|
* with optional customized header and footer
|
|
16
17
|
* @uxr-only-supported
|
|
17
18
|
* @midnight-gray-supported
|
|
18
19
|
* @alpine-light-supported
|
|
19
20
|
* */
|
|
20
|
-
function SidebarCard({
|
|
21
|
+
const SidebarCard = /*#__PURE__*/_react.default.forwardRef(function SidebarCard({
|
|
21
22
|
testId = 'sidebar-card',
|
|
22
23
|
id,
|
|
23
24
|
isDisabled = false,
|
|
@@ -37,10 +38,10 @@ function SidebarCard({
|
|
|
37
38
|
className = '',
|
|
38
39
|
shouldSelectTileOnEnter,
|
|
39
40
|
...other
|
|
40
|
-
}) {
|
|
41
|
+
}, forwardedRef) {
|
|
41
42
|
const {
|
|
42
43
|
listItemAttrs,
|
|
43
|
-
ref
|
|
44
|
+
ref: listItemRef
|
|
44
45
|
} = (0, _hooks.useListItemNavigation)({
|
|
45
46
|
id,
|
|
46
47
|
isSelected,
|
|
@@ -55,6 +56,11 @@ function SidebarCard({
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
});
|
|
59
|
+
const [setForwardedRef] = (0, _hooks.useForwardRef)(forwardedRef);
|
|
60
|
+
const mergedRef = (0, _react.useCallback)(el => {
|
|
61
|
+
listItemRef(el);
|
|
62
|
+
setForwardedRef(el);
|
|
63
|
+
}, [listItemRef, setForwardedRef]);
|
|
58
64
|
return (
|
|
59
65
|
/*#__PURE__*/
|
|
60
66
|
// useListItemNavigation returns onKeyDown, role and tabIndex
|
|
@@ -67,7 +73,7 @@ function SidebarCard({
|
|
|
67
73
|
}),
|
|
68
74
|
...other,
|
|
69
75
|
...listItemAttrs,
|
|
70
|
-
ref:
|
|
76
|
+
ref: mergedRef,
|
|
71
77
|
children: [leftItem, /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
72
78
|
className: "sidebar-card-content-section",
|
|
73
79
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarCardHeader.default, {
|
|
@@ -90,4 +96,5 @@ function SidebarCard({
|
|
|
90
96
|
})]
|
|
91
97
|
})
|
|
92
98
|
);
|
|
93
|
-
}
|
|
99
|
+
});
|
|
100
|
+
var _default = exports.default = SidebarCard;
|
|
@@ -47,6 +47,7 @@ function SidebarCards({
|
|
|
47
47
|
const isSelected = Boolean(item.isSelected);
|
|
48
48
|
const isCheckboxDisabled = Boolean(item.isCheckboxDisabled ?? isDisabled);
|
|
49
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarCard.default, {
|
|
50
|
+
ref: item.ref,
|
|
50
51
|
id: item.id,
|
|
51
52
|
leftItem: item.leftItem,
|
|
52
53
|
testId: itemTestId,
|
|
@@ -65,6 +65,8 @@ export type SidebarCardItemProps = {
|
|
|
65
65
|
className?: string;
|
|
66
66
|
/** Defines if left item should be added */
|
|
67
67
|
leftItem?: React.ReactNode | null;
|
|
68
|
+
/** Optional ref to attach to the card's root element */
|
|
69
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
68
70
|
};
|
|
69
71
|
export type SidebarCardProps = {
|
|
70
72
|
/** Test id */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { SidebarCardProps } from './types';
|
|
2
3
|
import './sidebar-card.less';
|
|
3
4
|
/** A SidebarCards: Card
|
|
@@ -6,4 +7,5 @@ import './sidebar-card.less';
|
|
|
6
7
|
* @midnight-gray-supported
|
|
7
8
|
* @alpine-light-supported
|
|
8
9
|
* */
|
|
9
|
-
|
|
10
|
+
declare const SidebarCard: React.ForwardRefExoticComponent<SidebarCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export default SidebarCard;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import SidebarCardHeader from './sidebar-card-header';
|
|
4
4
|
import SidebarCardContent from './sidebar-card-content';
|
|
5
|
-
import { useListItemNavigation } from '../hooks';
|
|
5
|
+
import { useListItemNavigation, useForwardRef } from '../hooks';
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
/** A SidebarCards: Card
|
|
8
8
|
* with optional customized header and footer
|
|
@@ -10,7 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
* @midnight-gray-supported
|
|
11
11
|
* @alpine-light-supported
|
|
12
12
|
* */
|
|
13
|
-
|
|
13
|
+
const SidebarCard = /*#__PURE__*/React.forwardRef(function SidebarCard({
|
|
14
14
|
testId = 'sidebar-card',
|
|
15
15
|
id,
|
|
16
16
|
isDisabled = false,
|
|
@@ -30,10 +30,10 @@ export default function SidebarCard({
|
|
|
30
30
|
className = '',
|
|
31
31
|
shouldSelectTileOnEnter,
|
|
32
32
|
...other
|
|
33
|
-
}) {
|
|
33
|
+
}, forwardedRef) {
|
|
34
34
|
const {
|
|
35
35
|
listItemAttrs,
|
|
36
|
-
ref
|
|
36
|
+
ref: listItemRef
|
|
37
37
|
} = useListItemNavigation({
|
|
38
38
|
id,
|
|
39
39
|
isSelected,
|
|
@@ -48,6 +48,11 @@ export default function SidebarCard({
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
+
const [setForwardedRef] = useForwardRef(forwardedRef);
|
|
52
|
+
const mergedRef = useCallback(el => {
|
|
53
|
+
listItemRef(el);
|
|
54
|
+
setForwardedRef(el);
|
|
55
|
+
}, [listItemRef, setForwardedRef]);
|
|
51
56
|
return (
|
|
52
57
|
/*#__PURE__*/
|
|
53
58
|
// useListItemNavigation returns onKeyDown, role and tabIndex
|
|
@@ -60,7 +65,7 @@ export default function SidebarCard({
|
|
|
60
65
|
}),
|
|
61
66
|
...other,
|
|
62
67
|
...listItemAttrs,
|
|
63
|
-
ref:
|
|
68
|
+
ref: mergedRef,
|
|
64
69
|
children: [leftItem, /*#__PURE__*/_jsxs("div", {
|
|
65
70
|
className: "sidebar-card-content-section",
|
|
66
71
|
children: [/*#__PURE__*/_jsx(SidebarCardHeader, {
|
|
@@ -83,4 +88,5 @@ export default function SidebarCard({
|
|
|
83
88
|
})]
|
|
84
89
|
})
|
|
85
90
|
);
|
|
86
|
-
}
|
|
91
|
+
});
|
|
92
|
+
export default SidebarCard;
|
|
@@ -39,6 +39,7 @@ export default function SidebarCards({
|
|
|
39
39
|
const isSelected = Boolean(item.isSelected);
|
|
40
40
|
const isCheckboxDisabled = Boolean(item.isCheckboxDisabled ?? isDisabled);
|
|
41
41
|
return /*#__PURE__*/_jsx(SidebarCard, {
|
|
42
|
+
ref: item.ref,
|
|
42
43
|
id: item.id,
|
|
43
44
|
leftItem: item.leftItem,
|
|
44
45
|
testId: itemTestId,
|
|
@@ -65,6 +65,8 @@ export type SidebarCardItemProps = {
|
|
|
65
65
|
className?: string;
|
|
66
66
|
/** Defines if left item should be added */
|
|
67
67
|
leftItem?: React.ReactNode | null;
|
|
68
|
+
/** Optional ref to attach to the card's root element */
|
|
69
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
68
70
|
};
|
|
69
71
|
export type SidebarCardProps = {
|
|
70
72
|
/** Test id */
|
package/js/bundle/bundle.js
CHANGED
|
@@ -75257,7 +75257,7 @@ var SidebarCardHeader = function SidebarCardHeader(_ref) {
|
|
|
75257
75257
|
|
|
75258
75258
|
"use strict";
|
|
75259
75259
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
75260
|
-
/* harmony export */ "default": () => (
|
|
75260
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
75261
75261
|
/* harmony export */ });
|
|
75262
75262
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
75263
75263
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -75270,6 +75270,12 @@ var SidebarCardHeader = function SidebarCardHeader(_ref) {
|
|
|
75270
75270
|
/* harmony import */ var _sidebar_card_less__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_sidebar_card_less__WEBPACK_IMPORTED_MODULE_5__);
|
|
75271
75271
|
var _excluded = ["testId", "id", "isDisabled", "isSelected", "isReadOnly", "hasCheckbox", "isChecked", "leftItem", "checkboxTooltip", "isCheckboxDisabled", "title", "titleTooltip", "headerContentLeft", "headerContentRight", "content", "onCheckboxSelect", "className", "shouldSelectTileOnEnter"];
|
|
75272
75272
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
75273
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
75274
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
75275
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
75276
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
75277
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
75278
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
75273
75279
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
75274
75280
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
75275
75281
|
|
|
@@ -75285,7 +75291,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
75285
75291
|
* @midnight-gray-supported
|
|
75286
75292
|
* @alpine-light-supported
|
|
75287
75293
|
* */
|
|
75288
|
-
function SidebarCard(_ref) {
|
|
75294
|
+
var SidebarCard = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef(function SidebarCard(_ref, forwardedRef) {
|
|
75289
75295
|
var _ref$testId = _ref.testId,
|
|
75290
75296
|
testId = _ref$testId === void 0 ? 'sidebar-card' : _ref$testId,
|
|
75291
75297
|
id = _ref.id,
|
|
@@ -75329,7 +75335,14 @@ function SidebarCard(_ref) {
|
|
|
75329
75335
|
}
|
|
75330
75336
|
}),
|
|
75331
75337
|
listItemAttrs = _useListItemNavigatio.listItemAttrs,
|
|
75332
|
-
|
|
75338
|
+
listItemRef = _useListItemNavigatio.ref;
|
|
75339
|
+
var _useForwardRef = (0,_hooks__WEBPACK_IMPORTED_MODULE_4__.useForwardRef)(forwardedRef),
|
|
75340
|
+
_useForwardRef2 = _slicedToArray(_useForwardRef, 1),
|
|
75341
|
+
setForwardedRef = _useForwardRef2[0];
|
|
75342
|
+
var mergedRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (el) {
|
|
75343
|
+
listItemRef(el);
|
|
75344
|
+
setForwardedRef(el);
|
|
75345
|
+
}, [listItemRef, setForwardedRef]);
|
|
75333
75346
|
return (
|
|
75334
75347
|
/*#__PURE__*/
|
|
75335
75348
|
// useListItemNavigation returns onKeyDown, role and tabIndex
|
|
@@ -75341,7 +75354,7 @@ function SidebarCard(_ref) {
|
|
|
75341
75354
|
'is-selected-card': isSelected
|
|
75342
75355
|
})
|
|
75343
75356
|
}, other, listItemAttrs, {
|
|
75344
|
-
ref:
|
|
75357
|
+
ref: mergedRef
|
|
75345
75358
|
}), leftItem, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
75346
75359
|
className: "sidebar-card-content-section"
|
|
75347
75360
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_sidebar_card_header__WEBPACK_IMPORTED_MODULE_2__["default"], {
|
|
@@ -75362,7 +75375,8 @@ function SidebarCard(_ref) {
|
|
|
75362
75375
|
content: content
|
|
75363
75376
|
})))
|
|
75364
75377
|
);
|
|
75365
|
-
}
|
|
75378
|
+
});
|
|
75379
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SidebarCard);
|
|
75366
75380
|
|
|
75367
75381
|
/***/ }),
|
|
75368
75382
|
|
|
@@ -75429,6 +75443,7 @@ function SidebarCards(_ref) {
|
|
|
75429
75443
|
var isCheckboxDisabled = Boolean((_item$isCheckboxDisab = item.isCheckboxDisabled) !== null && _item$isCheckboxDisab !== void 0 ? _item$isCheckboxDisab : isDisabled);
|
|
75430
75444
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_sidebar_card__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
|
75431
75445
|
key: item.id,
|
|
75446
|
+
ref: item.ref,
|
|
75432
75447
|
id: item.id,
|
|
75433
75448
|
leftItem: item.leftItem,
|
|
75434
75449
|
testId: itemTestId,
|