@datarobot/design-system 29.2.0 → 29.3.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/dropdown-menu/dropdown-menu-trigger.js +10 -5
- package/cjs/table-react/components/table.js +3 -1
- package/cjs/table-react/hooks/useInnerStateFallback.js +1 -1
- package/esm/dropdown-menu/dropdown-menu-trigger.js +11 -6
- package/esm/table-react/components/table.js +3 -1
- package/esm/table-react/hooks/useInnerStateFallback.js +1 -1
- package/js/bundle/bundle.js +10 -5
- package/js/bundle/bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -18,11 +18,16 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
18
18
|
const DefaultTriggerContent = ({
|
|
19
19
|
selectedItem,
|
|
20
20
|
defaultTriggerText
|
|
21
|
-
}) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
}) => {
|
|
22
|
+
const id = (0, _react.useId)();
|
|
23
|
+
const title = selectedItem?.title ?? defaultTriggerText;
|
|
24
|
+
const key = typeof title === 'string' && title.length ? title : id;
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_truncateWithTooltip.TruncateWithTooltip, {
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
27
|
+
children: title
|
|
28
|
+
})
|
|
29
|
+
}, key);
|
|
30
|
+
};
|
|
26
31
|
const DropdownMenuTrigger = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
27
32
|
onClick,
|
|
28
33
|
isOpen,
|
|
@@ -147,7 +147,9 @@ function Table({
|
|
|
147
147
|
}
|
|
148
148
|
// Component width depends on Vertical scroll
|
|
149
149
|
}, [columnSizing, width, isVerticalScrollPresent]);
|
|
150
|
-
const decoratedColumns = (0, _useColumns.useColumns)(columns, enableCheckBoxes, width - (isVerticalScrollPresent ? _types.COLUMN_SIZE.SCROLL_OFFSET : 0),
|
|
150
|
+
const decoratedColumns = (0, _useColumns.useColumns)(columns, enableCheckBoxes, width - (isVerticalScrollPresent ? _types.COLUMN_SIZE.SCROLL_OFFSET : 0), visible || visibility,
|
|
151
|
+
// we do not update internal state when external one is updated so visibility might fall behind
|
|
152
|
+
columnSizing, isRowExpandEnabled, !!getRowActions, localizationProps?.tableBody);
|
|
151
153
|
const onChangeSize = fn => {
|
|
152
154
|
const nextData = typeof fn === 'function' ? fn(columnSizing) : fn;
|
|
153
155
|
const targetData = typeof fn === 'function' ? fn({}) : fn;
|
|
@@ -20,7 +20,7 @@ function useInnerStateFallback(onExternalStateUpdate, externalState, decoratorFn
|
|
|
20
20
|
const onChangeState = fn => {
|
|
21
21
|
// we are setting innerState and outer externalState as the same object "nextData"
|
|
22
22
|
// it means that their links should be equal. If their links are not equal, it means externalState was altered by the user
|
|
23
|
-
// thus
|
|
23
|
+
// thus external state should take precedence over inner state that has fallen behind
|
|
24
24
|
const currentState = externalState && externalState !== innerState ? externalState : innerState;
|
|
25
25
|
const nextData = typeof fn === 'function' ? fn(currentState) : fn;
|
|
26
26
|
const nextDecoratedData = decoratorFn(nextData);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, useId } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { faChevronDown } from '@fortawesome/free-solid-svg-icons/faChevronDown';
|
|
4
4
|
import { FontAwesomeIcon } from '../font-awesome-icon';
|
|
@@ -10,11 +10,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
const DefaultTriggerContent = ({
|
|
11
11
|
selectedItem,
|
|
12
12
|
defaultTriggerText
|
|
13
|
-
}) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
}) => {
|
|
14
|
+
const id = useId();
|
|
15
|
+
const title = selectedItem?.title ?? defaultTriggerText;
|
|
16
|
+
const key = typeof title === 'string' && title.length ? title : id;
|
|
17
|
+
return /*#__PURE__*/_jsx(TruncateWithTooltip, {
|
|
18
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
19
|
+
children: title
|
|
20
|
+
})
|
|
21
|
+
}, key);
|
|
22
|
+
};
|
|
18
23
|
const DropdownMenuTrigger = /*#__PURE__*/forwardRef(({
|
|
19
24
|
onClick,
|
|
20
25
|
isOpen,
|
|
@@ -139,7 +139,9 @@ export function Table({
|
|
|
139
139
|
}
|
|
140
140
|
// Component width depends on Vertical scroll
|
|
141
141
|
}, [columnSizing, width, isVerticalScrollPresent]);
|
|
142
|
-
const decoratedColumns = useColumns(columns, enableCheckBoxes, width - (isVerticalScrollPresent ? COLUMN_SIZE.SCROLL_OFFSET : 0),
|
|
142
|
+
const decoratedColumns = useColumns(columns, enableCheckBoxes, width - (isVerticalScrollPresent ? COLUMN_SIZE.SCROLL_OFFSET : 0), visible || visibility,
|
|
143
|
+
// we do not update internal state when external one is updated so visibility might fall behind
|
|
144
|
+
columnSizing, isRowExpandEnabled, !!getRowActions, localizationProps?.tableBody);
|
|
143
145
|
const onChangeSize = fn => {
|
|
144
146
|
const nextData = typeof fn === 'function' ? fn(columnSizing) : fn;
|
|
145
147
|
const targetData = typeof fn === 'function' ? fn({}) : fn;
|
|
@@ -14,7 +14,7 @@ export function useInnerStateFallback(onExternalStateUpdate, externalState, deco
|
|
|
14
14
|
const onChangeState = fn => {
|
|
15
15
|
// we are setting innerState and outer externalState as the same object "nextData"
|
|
16
16
|
// it means that their links should be equal. If their links are not equal, it means externalState was altered by the user
|
|
17
|
-
// thus
|
|
17
|
+
// thus external state should take precedence over inner state that has fallen behind
|
|
18
18
|
const currentState = externalState && externalState !== innerState ? externalState : innerState;
|
|
19
19
|
const nextData = typeof fn === 'function' ? fn(currentState) : fn;
|
|
20
20
|
const nextDecoratedData = decoratorFn(nextData);
|
package/js/bundle/bundle.js
CHANGED
|
@@ -51546,12 +51546,15 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
51546
51546
|
|
|
51547
51547
|
|
|
51548
51548
|
var DefaultTriggerContent = function DefaultTriggerContent(_ref) {
|
|
51549
|
-
var _selectedItem$
|
|
51549
|
+
var _selectedItem$title;
|
|
51550
51550
|
var selectedItem = _ref.selectedItem,
|
|
51551
51551
|
defaultTriggerText = _ref.defaultTriggerText;
|
|
51552
|
+
var id = (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)();
|
|
51553
|
+
var title = (_selectedItem$title = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.title) !== null && _selectedItem$title !== void 0 ? _selectedItem$title : defaultTriggerText;
|
|
51554
|
+
var key = typeof title === 'string' && title.length ? title : id;
|
|
51552
51555
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_truncate_with_tooltip__WEBPACK_IMPORTED_MODULE_4__.TruncateWithTooltip, {
|
|
51553
|
-
key:
|
|
51554
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null,
|
|
51556
|
+
key: key
|
|
51557
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null, title));
|
|
51555
51558
|
};
|
|
51556
51559
|
var DropdownMenuTrigger = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (_ref2, ref) {
|
|
51557
51560
|
var onClick = _ref2.onClick,
|
|
@@ -78001,7 +78004,9 @@ function Table(_ref) {
|
|
|
78001
78004
|
}
|
|
78002
78005
|
// Component width depends on Vertical scroll
|
|
78003
78006
|
}, [columnSizing, width, isVerticalScrollPresent]);
|
|
78004
|
-
var decoratedColumns = (0,_hooks_useColumns__WEBPACK_IMPORTED_MODULE_9__.useColumns)(columns, enableCheckBoxes, width - (isVerticalScrollPresent ? _types__WEBPACK_IMPORTED_MODULE_18__.COLUMN_SIZE.SCROLL_OFFSET : 0),
|
|
78007
|
+
var decoratedColumns = (0,_hooks_useColumns__WEBPACK_IMPORTED_MODULE_9__.useColumns)(columns, enableCheckBoxes, width - (isVerticalScrollPresent ? _types__WEBPACK_IMPORTED_MODULE_18__.COLUMN_SIZE.SCROLL_OFFSET : 0), visible || visibility,
|
|
78008
|
+
// we do not update internal state when external one is updated so visibility might fall behind
|
|
78009
|
+
columnSizing, isRowExpandEnabled, !!getRowActions, localizationProps === null || localizationProps === void 0 ? void 0 : localizationProps.tableBody);
|
|
78005
78010
|
var onChangeSize = function onChangeSize(fn) {
|
|
78006
78011
|
var nextData = typeof fn === 'function' ? fn(columnSizing) : fn;
|
|
78007
78012
|
var targetData = typeof fn === 'function' ? fn({}) : fn;
|
|
@@ -78495,7 +78500,7 @@ function useInnerStateFallback(onExternalStateUpdate, externalState) {
|
|
|
78495
78500
|
var onChangeState = function onChangeState(fn) {
|
|
78496
78501
|
// we are setting innerState and outer externalState as the same object "nextData"
|
|
78497
78502
|
// it means that their links should be equal. If their links are not equal, it means externalState was altered by the user
|
|
78498
|
-
// thus
|
|
78503
|
+
// thus external state should take precedence over inner state that has fallen behind
|
|
78499
78504
|
var currentState = externalState && externalState !== innerState ? externalState : innerState;
|
|
78500
78505
|
var nextData = typeof fn === 'function' ? fn(currentState) : fn;
|
|
78501
78506
|
var nextDecoratedData = decoratorFn(nextData);
|