@datarobot/design-system 30.1.2 → 30.2.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/cjs/collapsible-panel/collapsible-panel.js +1 -0
- package/cjs/loading-backdrop/loading-backdrop.js +5 -1
- package/cjs/selectable-tiles/index.d.ts +2 -0
- package/cjs/selectable-tiles/index.js +7 -0
- package/cjs/selectable-tiles/selectable-tiles-item.d.ts +3 -1
- package/cjs/selectable-tiles/selectable-tiles-item.js +2 -1
- package/cjs/selectable-tiles/selectable-tiles.d.ts +4 -1
- package/cjs/selectable-tiles/selectable-tiles.js +5 -2
- package/cjs/selectable-tiles/types.d.ts +6 -0
- package/cjs/selectable-tiles/types.js +10 -0
- 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/collapsible-panel/collapsible-panel.js +1 -0
- package/esm/loading-backdrop/loading-backdrop.js +4 -1
- package/esm/selectable-tiles/index.d.ts +2 -0
- package/esm/selectable-tiles/index.js +1 -0
- package/esm/selectable-tiles/selectable-tiles-item.d.ts +3 -1
- package/esm/selectable-tiles/selectable-tiles-item.js +2 -1
- package/esm/selectable-tiles/selectable-tiles.d.ts +4 -1
- package/esm/selectable-tiles/selectable-tiles.js +5 -2
- package/esm/selectable-tiles/types.d.ts +6 -0
- package/esm/selectable-tiles/types.js +4 -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 +58 -12
- package/js/bundle/bundle.min.js +1 -1
- package/js/bundle/index.d.ts +13 -2
- package/package.json +1 -1
- package/styles/index.css +10 -4
- package/styles/index.min.css +1 -1
- package/styles/themes/alpine-light.css +2 -1
- package/styles/themes/alpine-light.min.css +1 -1
- package/styles/themes/light.css +2 -1
- package/styles/themes/light.min.css +1 -1
- package/styles/themes/midnight-gray.css +2 -1
- package/styles/themes/midnight-gray.min.css +1 -1
|
@@ -98,6 +98,7 @@ const CollapsiblePanel = ({
|
|
|
98
98
|
}),
|
|
99
99
|
children: [headerPlacement === COLLAPSIBLE_PANEL_PLACEMENT.TOP && headerContainer, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
|
|
100
100
|
...transitionProps,
|
|
101
|
+
nodeRef: wrapperRef,
|
|
101
102
|
in: expanded,
|
|
102
103
|
onEntering: onEntering,
|
|
103
104
|
onEntered: onEntered,
|
|
@@ -4,13 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.LoadingBackdrop = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _reactTransitionGroup = require("react-transition-group");
|
|
10
10
|
var _message = require("../message");
|
|
11
11
|
var _useTranslation = require("../hooks/use-translation");
|
|
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
|
/** Shows loader when content is not ready
|
|
15
16
|
* [CAPITALIZATION] Use sentence case
|
|
16
17
|
* @midnight-gray-supported
|
|
@@ -26,13 +27,16 @@ const LoadingBackdrop = ({
|
|
|
26
27
|
const {
|
|
27
28
|
t
|
|
28
29
|
} = (0, _useTranslation.useTranslation)();
|
|
30
|
+
const nodeRef = (0, _react.useRef)(null);
|
|
29
31
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
|
|
30
32
|
classNames: "loading-backdrop",
|
|
33
|
+
nodeRef: nodeRef,
|
|
31
34
|
in: isLoading,
|
|
32
35
|
onExited: onTransitionEnd,
|
|
33
36
|
timeout: 500,
|
|
34
37
|
appear: true,
|
|
35
38
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
39
|
+
ref: nodeRef,
|
|
36
40
|
className: (0, _classnames.default)('loading-backdrop center-status ', customClassName),
|
|
37
41
|
"test-id": testId,
|
|
38
42
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_message.Message, {
|
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "SELECTABLE_TILES_SIZES", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _types.SELECTABLE_TILES_SIZES;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "SelectableTiles", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
9
15
|
return _selectableTiles.default;
|
|
10
16
|
}
|
|
11
17
|
});
|
|
18
|
+
var _types = require("./types");
|
|
12
19
|
var _selectableTiles = _interopRequireDefault(require("./selectable-tiles"));
|
|
13
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
import { TooltipPlacementsType } from '../tooltip';
|
|
4
|
+
import type { SelectableTilesSize } from './types';
|
|
4
5
|
type SelectableTilesItemProps = {
|
|
5
6
|
id: string;
|
|
6
7
|
label?: string;
|
|
@@ -12,9 +13,10 @@ type SelectableTilesItemProps = {
|
|
|
12
13
|
isDisabled?: boolean;
|
|
13
14
|
itemClassName?: string;
|
|
14
15
|
itemAriaLabel?: string;
|
|
16
|
+
size: SelectableTilesSize;
|
|
15
17
|
customContent?: ReactElement;
|
|
16
18
|
tooltipText?: string;
|
|
17
19
|
tooltipPlacement?: TooltipPlacementsType;
|
|
18
20
|
};
|
|
19
|
-
export declare function SelectableTilesItem({ id, label, imgSrc, icon, itemTestId, selectedKey, onItemSelect, isDisabled, itemClassName, itemAriaLabel, customContent, tooltipText, tooltipPlacement, }: SelectableTilesItemProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function SelectableTilesItem({ id, label, imgSrc, icon, itemTestId, size, selectedKey, onItemSelect, isDisabled, itemClassName, itemAriaLabel, customContent, tooltipText, tooltipPlacement, }: SelectableTilesItemProps): import("react/jsx-runtime").JSX.Element;
|
|
20
22
|
export {};
|
|
@@ -16,6 +16,7 @@ function SelectableTilesItem({
|
|
|
16
16
|
imgSrc,
|
|
17
17
|
icon,
|
|
18
18
|
itemTestId,
|
|
19
|
+
size,
|
|
19
20
|
selectedKey,
|
|
20
21
|
onItemSelect,
|
|
21
22
|
isDisabled,
|
|
@@ -51,7 +52,7 @@ function SelectableTilesItem({
|
|
|
51
52
|
content: tooltipText,
|
|
52
53
|
placement: tooltipPlacement,
|
|
53
54
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
54
|
-
className: (0, _classnames.default)('selectable-tiles-item', itemClassName, {
|
|
55
|
+
className: (0, _classnames.default)('selectable-tiles-item', itemClassName, size, {
|
|
55
56
|
'selectable-tiles-item-selected': isItemSelected,
|
|
56
57
|
'selectable-tiles-item-disabled': isDisabled,
|
|
57
58
|
'label-with-image': !!imgSrc
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
import { TooltipPlacementsType } from '../tooltip';
|
|
4
|
+
import { SelectableTilesSize } from './types';
|
|
4
5
|
import './selectable-tiles.less';
|
|
5
6
|
export type SelectableTileOptions = {
|
|
6
7
|
id: string;
|
|
@@ -42,11 +43,13 @@ export type SelectableTilesProps = {
|
|
|
42
43
|
isDisabled?: boolean;
|
|
43
44
|
/** Allows for aria label to be associated with the component */
|
|
44
45
|
labelledBy?: string;
|
|
46
|
+
/** size of the tiles */
|
|
47
|
+
size?: SelectableTilesSize;
|
|
45
48
|
};
|
|
46
49
|
/** SelectableTiles let user choose on of the options represented in the form of tiles
|
|
47
50
|
* [CAPITALIZATION] Sentence case (capitalize proper nouns i.e., Holdout).
|
|
48
51
|
* @midnight-gray-supported
|
|
49
52
|
* @alpine-light-supported
|
|
50
53
|
*/
|
|
51
|
-
declare function SelectableTiles({ options, selectedKey, onItemSelect, containerClassName, itemClassName, optionId, isDisabled, labelledBy, }: SelectableTilesProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
declare function SelectableTiles({ options, selectedKey, onItemSelect, containerClassName, itemClassName, optionId, isDisabled, labelledBy, size, }: SelectableTilesProps): import("react/jsx-runtime").JSX.Element;
|
|
52
55
|
export default SelectableTiles;
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _selectableTilesItem = require("./selectable-tiles-item");
|
|
10
|
+
var _types = require("./types");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
/** SelectableTiles let user choose on of the options represented in the form of tiles
|
|
@@ -22,7 +23,8 @@ function SelectableTiles({
|
|
|
22
23
|
itemClassName,
|
|
23
24
|
optionId = 'id',
|
|
24
25
|
isDisabled,
|
|
25
|
-
labelledBy
|
|
26
|
+
labelledBy,
|
|
27
|
+
size = _types.SELECTABLE_TILES_SIZES.MD
|
|
26
28
|
}) {
|
|
27
29
|
const onSelect = key => {
|
|
28
30
|
if (key === selectedKey) {
|
|
@@ -63,7 +65,8 @@ function SelectableTiles({
|
|
|
63
65
|
customContent: customContent,
|
|
64
66
|
tooltipText: tooltipText,
|
|
65
67
|
tooltipPlacement: tooltipPlacement,
|
|
66
|
-
itemAriaLabel: itemAriaLabel
|
|
68
|
+
itemAriaLabel: itemAriaLabel,
|
|
69
|
+
size: size
|
|
67
70
|
}, tileId);
|
|
68
71
|
})
|
|
69
72
|
});
|
|
@@ -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 */
|
|
@@ -90,6 +90,7 @@ const CollapsiblePanel = ({
|
|
|
90
90
|
}),
|
|
91
91
|
children: [headerPlacement === COLLAPSIBLE_PANEL_PLACEMENT.TOP && headerContainer, /*#__PURE__*/_jsx(CSSTransition, {
|
|
92
92
|
...transitionProps,
|
|
93
|
+
nodeRef: wrapperRef,
|
|
93
94
|
in: expanded,
|
|
94
95
|
onEntering: onEntering,
|
|
95
96
|
onEntered: onEntered,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { CSSTransition } from 'react-transition-group';
|
|
4
4
|
import { Message, MESSAGE_TYPES } from '../message';
|
|
@@ -19,13 +19,16 @@ export const LoadingBackdrop = ({
|
|
|
19
19
|
const {
|
|
20
20
|
t
|
|
21
21
|
} = useTranslation();
|
|
22
|
+
const nodeRef = useRef(null);
|
|
22
23
|
return /*#__PURE__*/_jsx(CSSTransition, {
|
|
23
24
|
classNames: "loading-backdrop",
|
|
25
|
+
nodeRef: nodeRef,
|
|
24
26
|
in: isLoading,
|
|
25
27
|
onExited: onTransitionEnd,
|
|
26
28
|
timeout: 500,
|
|
27
29
|
appear: true,
|
|
28
30
|
children: /*#__PURE__*/_jsx("div", {
|
|
31
|
+
ref: nodeRef,
|
|
29
32
|
className: classNames('loading-backdrop center-status ', customClassName),
|
|
30
33
|
"test-id": testId,
|
|
31
34
|
children: /*#__PURE__*/_jsx(Message, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
import { TooltipPlacementsType } from '../tooltip';
|
|
4
|
+
import type { SelectableTilesSize } from './types';
|
|
4
5
|
type SelectableTilesItemProps = {
|
|
5
6
|
id: string;
|
|
6
7
|
label?: string;
|
|
@@ -12,9 +13,10 @@ type SelectableTilesItemProps = {
|
|
|
12
13
|
isDisabled?: boolean;
|
|
13
14
|
itemClassName?: string;
|
|
14
15
|
itemAriaLabel?: string;
|
|
16
|
+
size: SelectableTilesSize;
|
|
15
17
|
customContent?: ReactElement;
|
|
16
18
|
tooltipText?: string;
|
|
17
19
|
tooltipPlacement?: TooltipPlacementsType;
|
|
18
20
|
};
|
|
19
|
-
export declare function SelectableTilesItem({ id, label, imgSrc, icon, itemTestId, selectedKey, onItemSelect, isDisabled, itemClassName, itemAriaLabel, customContent, tooltipText, tooltipPlacement, }: SelectableTilesItemProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function SelectableTilesItem({ id, label, imgSrc, icon, itemTestId, size, selectedKey, onItemSelect, isDisabled, itemClassName, itemAriaLabel, customContent, tooltipText, tooltipPlacement, }: SelectableTilesItemProps): import("react/jsx-runtime").JSX.Element;
|
|
20
22
|
export {};
|
|
@@ -9,6 +9,7 @@ export function SelectableTilesItem({
|
|
|
9
9
|
imgSrc,
|
|
10
10
|
icon,
|
|
11
11
|
itemTestId,
|
|
12
|
+
size,
|
|
12
13
|
selectedKey,
|
|
13
14
|
onItemSelect,
|
|
14
15
|
isDisabled,
|
|
@@ -44,7 +45,7 @@ export function SelectableTilesItem({
|
|
|
44
45
|
content: tooltipText,
|
|
45
46
|
placement: tooltipPlacement,
|
|
46
47
|
children: /*#__PURE__*/_jsx("div", {
|
|
47
|
-
className: classnames('selectable-tiles-item', itemClassName, {
|
|
48
|
+
className: classnames('selectable-tiles-item', itemClassName, size, {
|
|
48
49
|
'selectable-tiles-item-selected': isItemSelected,
|
|
49
50
|
'selectable-tiles-item-disabled': isDisabled,
|
|
50
51
|
'label-with-image': !!imgSrc
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
import { TooltipPlacementsType } from '../tooltip';
|
|
4
|
+
import { SelectableTilesSize } from './types';
|
|
4
5
|
import './selectable-tiles.less';
|
|
5
6
|
export type SelectableTileOptions = {
|
|
6
7
|
id: string;
|
|
@@ -42,11 +43,13 @@ export type SelectableTilesProps = {
|
|
|
42
43
|
isDisabled?: boolean;
|
|
43
44
|
/** Allows for aria label to be associated with the component */
|
|
44
45
|
labelledBy?: string;
|
|
46
|
+
/** size of the tiles */
|
|
47
|
+
size?: SelectableTilesSize;
|
|
45
48
|
};
|
|
46
49
|
/** SelectableTiles let user choose on of the options represented in the form of tiles
|
|
47
50
|
* [CAPITALIZATION] Sentence case (capitalize proper nouns i.e., Holdout).
|
|
48
51
|
* @midnight-gray-supported
|
|
49
52
|
* @alpine-light-supported
|
|
50
53
|
*/
|
|
51
|
-
declare function SelectableTiles({ options, selectedKey, onItemSelect, containerClassName, itemClassName, optionId, isDisabled, labelledBy, }: SelectableTilesProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
declare function SelectableTiles({ options, selectedKey, onItemSelect, containerClassName, itemClassName, optionId, isDisabled, labelledBy, size, }: SelectableTilesProps): import("react/jsx-runtime").JSX.Element;
|
|
52
55
|
export default SelectableTiles;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { SelectableTilesItem } from './selectable-tiles-item';
|
|
4
|
+
import { SELECTABLE_TILES_SIZES } from './types';
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
/** SelectableTiles let user choose on of the options represented in the form of tiles
|
|
6
7
|
* [CAPITALIZATION] Sentence case (capitalize proper nouns i.e., Holdout).
|
|
@@ -15,7 +16,8 @@ function SelectableTiles({
|
|
|
15
16
|
itemClassName,
|
|
16
17
|
optionId = 'id',
|
|
17
18
|
isDisabled,
|
|
18
|
-
labelledBy
|
|
19
|
+
labelledBy,
|
|
20
|
+
size = SELECTABLE_TILES_SIZES.MD
|
|
19
21
|
}) {
|
|
20
22
|
const onSelect = key => {
|
|
21
23
|
if (key === selectedKey) {
|
|
@@ -56,7 +58,8 @@ function SelectableTiles({
|
|
|
56
58
|
customContent: customContent,
|
|
57
59
|
tooltipText: tooltipText,
|
|
58
60
|
tooltipPlacement: tooltipPlacement,
|
|
59
|
-
itemAriaLabel: itemAriaLabel
|
|
61
|
+
itemAriaLabel: itemAriaLabel,
|
|
62
|
+
size: size
|
|
60
63
|
}, tileId);
|
|
61
64
|
})
|
|
62
65
|
});
|
|
@@ -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 */
|