@datarobot/design-system 29.3.0 → 29.4.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.
@@ -12,7 +12,7 @@ export type ChildrenWrapperTypes = {
12
12
  export type PopperDropdownWrapperChildren = ((props: ChildrenWrapperTypes) => ReactNode) | ReactNode;
13
13
  export type PopperDropdownWrapperProps = {
14
14
  children: PopperDropdownWrapperChildren;
15
- closeDropdown: () => void;
15
+ closeDropdown: (e?: Event) => void;
16
16
  anchorRef?: AnchorEl;
17
17
  open: boolean;
18
18
  openedWithKeyboard?: boolean;
@@ -147,9 +147,7 @@ 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), 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);
150
+ const decoratedColumns = (0, _useColumns.useColumns)(columns, enableCheckBoxes, width - (isVerticalScrollPresent ? _types.COLUMN_SIZE.SCROLL_OFFSET : 0), visibility, columnSizing, isRowExpandEnabled, !!getRowActions, localizationProps?.tableBody);
153
151
  const onChangeSize = fn => {
154
152
  const nextData = typeof fn === 'function' ? fn(columnSizing) : fn;
155
153
  const targetData = typeof fn === 'function' ? fn({}) : fn;
@@ -208,7 +208,7 @@ function Typeahead({
208
208
  const showClearButton = isClearable && searchValue !== '' && !isDisabled;
209
209
  const handleClickElsewhere = (0, _react.useCallback)(event => {
210
210
  // Handle focus to false if the click is outside of the typeahead container
211
- if (!anchorRef.current?.contains(event.target)) {
211
+ if (!anchorRef.current?.contains(event?.target)) {
212
212
  if (isFocus || isMultiSelect) {
213
213
  inputRef.current?.blur();
214
214
  handleExit();
@@ -251,7 +251,9 @@ function Typeahead({
251
251
  }, [defaultValue]);
252
252
  (0, _react.useEffect)(() => setIsTouched(isTouched), [isTouched]);
253
253
  const PopperWrapper = (0, _react.useMemo)(() => /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdown.PopperDropdownWrapper, {
254
- closeDropdown: closeDropdown,
254
+ closeDropdown: e => {
255
+ handleClickElsewhere(e);
256
+ },
255
257
  anchorRef: anchorRef.current,
256
258
  open: isOpen,
257
259
  contentClassName: (0, _classnames.default)('typeahead-dropdown-content', dropdownContentClass),
@@ -275,7 +277,7 @@ function Typeahead({
275
277
  listId: listId,
276
278
  noItemsText: noItemsText
277
279
  })
278
- }), [isOpen, width, searchValue, options, isShowAll]);
280
+ }), [isOpen, width, searchValue, options, isShowAll, handleClickElsewhere]);
279
281
  const {
280
282
  isShowOptions
281
283
  } = (0, _useVisibleOptions.useVisibleOptions)({
@@ -12,7 +12,7 @@ export type ChildrenWrapperTypes = {
12
12
  export type PopperDropdownWrapperChildren = ((props: ChildrenWrapperTypes) => ReactNode) | ReactNode;
13
13
  export type PopperDropdownWrapperProps = {
14
14
  children: PopperDropdownWrapperChildren;
15
- closeDropdown: () => void;
15
+ closeDropdown: (e?: Event) => void;
16
16
  anchorRef?: AnchorEl;
17
17
  open: boolean;
18
18
  openedWithKeyboard?: boolean;
@@ -139,9 +139,7 @@ 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), 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);
142
+ const decoratedColumns = useColumns(columns, enableCheckBoxes, width - (isVerticalScrollPresent ? COLUMN_SIZE.SCROLL_OFFSET : 0), visibility, columnSizing, isRowExpandEnabled, !!getRowActions, localizationProps?.tableBody);
145
143
  const onChangeSize = fn => {
146
144
  const nextData = typeof fn === 'function' ? fn(columnSizing) : fn;
147
145
  const targetData = typeof fn === 'function' ? fn({}) : fn;
@@ -200,7 +200,7 @@ function Typeahead({
200
200
  const showClearButton = isClearable && searchValue !== '' && !isDisabled;
201
201
  const handleClickElsewhere = useCallback(event => {
202
202
  // Handle focus to false if the click is outside of the typeahead container
203
- if (!anchorRef.current?.contains(event.target)) {
203
+ if (!anchorRef.current?.contains(event?.target)) {
204
204
  if (isFocus || isMultiSelect) {
205
205
  inputRef.current?.blur();
206
206
  handleExit();
@@ -243,7 +243,9 @@ function Typeahead({
243
243
  }, [defaultValue]);
244
244
  useEffect(() => setIsTouched(isTouched), [isTouched]);
245
245
  const PopperWrapper = useMemo(() => /*#__PURE__*/_jsx(PopperDropdownWrapper, {
246
- closeDropdown: closeDropdown,
246
+ closeDropdown: e => {
247
+ handleClickElsewhere(e);
248
+ },
247
249
  anchorRef: anchorRef.current,
248
250
  open: isOpen,
249
251
  contentClassName: classNames('typeahead-dropdown-content', dropdownContentClass),
@@ -267,7 +269,7 @@ function Typeahead({
267
269
  listId: listId,
268
270
  noItemsText: noItemsText
269
271
  })
270
- }), [isOpen, width, searchValue, options, isShowAll]);
272
+ }), [isOpen, width, searchValue, options, isShowAll, handleClickElsewhere]);
271
273
  const {
272
274
  isShowOptions
273
275
  } = useVisibleOptions({
@@ -78004,9 +78004,7 @@ function Table(_ref) {
78004
78004
  }
78005
78005
  // Component width depends on Vertical scroll
78006
78006
  }, [columnSizing, width, isVerticalScrollPresent]);
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);
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), visibility, columnSizing, isRowExpandEnabled, !!getRowActions, localizationProps === null || localizationProps === void 0 ? void 0 : localizationProps.tableBody);
78010
78008
  var onChangeSize = function onChangeSize(fn) {
78011
78009
  var nextData = typeof fn === 'function' ? fn(columnSizing) : fn;
78012
78010
  var targetData = typeof fn === 'function' ? fn({}) : fn;
@@ -86668,7 +86666,7 @@ function Typeahead(_ref) {
86668
86666
  var handleClickElsewhere = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (event) {
86669
86667
  var _anchorRef$current;
86670
86668
  // Handle focus to false if the click is outside of the typeahead container
86671
- if (!((_anchorRef$current = anchorRef.current) !== null && _anchorRef$current !== void 0 && _anchorRef$current.contains(event.target))) {
86669
+ if (!((_anchorRef$current = anchorRef.current) !== null && _anchorRef$current !== void 0 && _anchorRef$current.contains(event === null || event === void 0 ? void 0 : event.target))) {
86672
86670
  if (isFocus || isMultiSelect) {
86673
86671
  var _inputRef$current;
86674
86672
  (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.blur();
@@ -86717,7 +86715,9 @@ function Typeahead(_ref) {
86717
86715
  }, [isTouched]);
86718
86716
  var PopperWrapper = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
86719
86717
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_dropdown__WEBPACK_IMPORTED_MODULE_2__.PopperDropdownWrapper, {
86720
- closeDropdown: closeDropdown,
86718
+ closeDropdown: function closeDropdown(e) {
86719
+ handleClickElsewhere(e);
86720
+ },
86721
86721
  anchorRef: anchorRef.current,
86722
86722
  open: isOpen,
86723
86723
  contentClassName: classnames__WEBPACK_IMPORTED_MODULE_1___default()('typeahead-dropdown-content', dropdownContentClass),
@@ -86743,7 +86743,7 @@ function Typeahead(_ref) {
86743
86743
  listId: listId,
86744
86744
  noItemsText: noItemsText
86745
86745
  }));
86746
- }, [isOpen, width, searchValue, options, isShowAll]);
86746
+ }, [isOpen, width, searchValue, options, isShowAll, handleClickElsewhere]);
86747
86747
  var _useVisibleOptions = (0,_use_visible_options__WEBPACK_IMPORTED_MODULE_9__.useVisibleOptions)({
86748
86748
  formatSearchValue: formatSearchValue,
86749
86749
  searchValue: searchValue,