@activecollab/components 2.0.2 → 2.0.4

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.
Files changed (31) hide show
  1. package/dist/cjs/components/Autocomplete/Autocomplete.js +1 -1
  2. package/dist/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
  3. package/dist/cjs/components/Breadcrumbs/Breadcrumbs.js +3 -3
  4. package/dist/cjs/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  5. package/dist/cjs/components/ComboBox/ComboBox.js +7 -7
  6. package/dist/cjs/components/ComboBox/ComboBox.js.map +1 -1
  7. package/dist/cjs/components/CommandPalette/CommandPalette.js +2 -2
  8. package/dist/cjs/components/CommandPalette/CommandPalette.js.map +1 -1
  9. package/dist/cjs/components/Filter/Submenu.js +1 -1
  10. package/dist/cjs/components/Filter/Submenu.js.map +1 -1
  11. package/dist/cjs/components/Input/Input.js +1 -1
  12. package/dist/cjs/components/Input/Input.js.map +1 -1
  13. package/dist/cjs/components/Menu/Menu.js +4 -4
  14. package/dist/cjs/components/Menu/Menu.js.map +1 -1
  15. package/dist/cjs/components/Select/OptionGroup/OptionGroup.js +1 -1
  16. package/dist/cjs/components/Select/OptionGroup/OptionGroup.js.map +1 -1
  17. package/dist/cjs/components/Select/Select.js +11 -14
  18. package/dist/cjs/components/Select/Select.js.map +1 -1
  19. package/dist/cjs/components/Window/Window.js +1 -1
  20. package/dist/cjs/components/Window/Window.js.map +1 -1
  21. package/dist/cjs/hooks/useInputHours.js +7 -7
  22. package/dist/cjs/hooks/useInputHours.js.map +1 -1
  23. package/dist/esm/components/Select/Select.d.ts +5 -5
  24. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  25. package/dist/esm/components/Select/Select.js +7 -10
  26. package/dist/esm/components/Select/Select.js.map +1 -1
  27. package/dist/index.js +39 -41
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.min.js +1 -1
  30. package/dist/index.min.js.map +1 -1
  31. package/package.json +5 -4
package/dist/index.js CHANGED
@@ -733,7 +733,7 @@
733
733
  }
734
734
  }, [disableCloseOnEsc, onClose, onKeyDown]);
735
735
  var handleClick = React.useCallback(function (event) {
736
- event === null || event === void 0 ? void 0 : event.stopPropagation();
736
+ event === null || event === void 0 || event.stopPropagation();
737
737
  typeof onClick === "function" && onClick(event);
738
738
  }, [onClick]);
739
739
  return /*#__PURE__*/React__default["default"].createElement(Portal, null, /*#__PURE__*/React__default["default"].createElement(FocusLock__default["default"], {
@@ -881,11 +881,11 @@
881
881
  var handleRef = useForkRef(handleRefRef, elementRef);
882
882
  var handleOpen = React.useCallback(function (event) {
883
883
  var _target$props;
884
- event === null || event === void 0 ? void 0 : event.preventDefault();
885
- event === null || event === void 0 ? void 0 : event.stopPropagation();
884
+ event === null || event === void 0 || event.preventDefault();
885
+ event === null || event === void 0 || event.stopPropagation();
886
886
  setOpen(true);
887
887
  typeof onOpen === "function" && onOpen();
888
- typeof (target === null || target === void 0 ? void 0 : (_target$props = target.props) === null || _target$props === void 0 ? void 0 : _target$props.onClick) === "function" && target.props.onClick(event);
888
+ typeof (target === null || target === void 0 || (_target$props = target.props) === null || _target$props === void 0 ? void 0 : _target$props.onClick) === "function" && target.props.onClick(event);
889
889
  }, [onOpen, target === null || target === void 0 ? void 0 : target.props]);
890
890
  var handleClose = React.useCallback(function () {
891
891
  if (typeof onBeforeClose === "function" && !onBeforeClose()) {
@@ -907,7 +907,7 @@
907
907
  isOpenAtLeastOnce.current = true;
908
908
  } else if (!open && isOpenAtLeastOnce.current) {
909
909
  var _elementRef$current;
910
- (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.focus();
910
+ (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 || _elementRef$current.focus();
911
911
  isOpenAtLeastOnce.current = false;
912
912
  }
913
913
  }, [open]);
@@ -7930,9 +7930,9 @@
7930
7930
  React.useEffect(function () {
7931
7931
  var diffWidth = childWidth - parentWidth;
7932
7932
  if (diffWidth > 0) {
7933
- var _offsetWidth, _olRef$current, _olRef$current$queryS, _olRef$current$queryS2, _olRef$current2, _breadcrumbItems$leng;
7934
- var separatorWidth = (_offsetWidth = (_olRef$current = olRef.current) === null || _olRef$current === void 0 ? void 0 : (_olRef$current$queryS = _olRef$current.querySelectorAll(`[data-role="separator"]`)[0]) === null || _olRef$current$queryS === void 0 ? void 0 : _olRef$current$queryS.offsetWidth) !== null && _offsetWidth !== void 0 ? _offsetWidth : 0;
7935
- var breadcrumbItems = (_olRef$current$queryS2 = (_olRef$current2 = olRef.current) === null || _olRef$current2 === void 0 ? void 0 : _olRef$current2.querySelectorAll(`[data-role="item"]`)) !== null && _olRef$current$queryS2 !== void 0 ? _olRef$current$queryS2 : [];
7933
+ var _offsetWidth, _olRef$current, _olRef$current$queryS, _olRef$current2, _breadcrumbItems$leng;
7934
+ var separatorWidth = (_offsetWidth = (_olRef$current = olRef.current) === null || _olRef$current === void 0 || (_olRef$current = _olRef$current.querySelectorAll(`[data-role="separator"]`)[0]) === null || _olRef$current === void 0 ? void 0 : _olRef$current.offsetWidth) !== null && _offsetWidth !== void 0 ? _offsetWidth : 0;
7935
+ var breadcrumbItems = (_olRef$current$queryS = (_olRef$current2 = olRef.current) === null || _olRef$current2 === void 0 ? void 0 : _olRef$current2.querySelectorAll(`[data-role="item"]`)) !== null && _olRef$current$queryS !== void 0 ? _olRef$current$queryS : [];
7936
7936
  var childWidthCollection = [];
7937
7937
  var maxIndex = ((_breadcrumbItems$leng = breadcrumbItems === null || breadcrumbItems === void 0 ? void 0 : breadcrumbItems.length) !== null && _breadcrumbItems$leng !== void 0 ? _breadcrumbItems$leng : 1) - 1;
7938
7938
  var currentIndex = 0;
@@ -10839,7 +10839,7 @@
10839
10839
  React.useEffect(function () {
10840
10840
  if (hover === id && type !== "single") {
10841
10841
  var _document$getElementB;
10842
- (_document$getElementB = document.getElementById(`${id}`)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.focus();
10842
+ (_document$getElementB = document.getElementById(`${id}`)) === null || _document$getElementB === void 0 || _document$getElementB.focus();
10843
10843
  }
10844
10844
  }, [hover, type, id]);
10845
10845
  var isAllOptionsChecked = React.useMemo(function () {
@@ -11401,7 +11401,7 @@
11401
11401
  }
11402
11402
  if (handleEmptyAction) {
11403
11403
  var _inputEl$current;
11404
- inputEl === null || inputEl === void 0 ? void 0 : (_inputEl$current = inputEl.current) === null || _inputEl$current === void 0 ? void 0 : _inputEl$current.focus();
11404
+ inputEl === null || inputEl === void 0 || (_inputEl$current = inputEl.current) === null || _inputEl$current === void 0 || _inputEl$current.focus();
11405
11405
  setFilter("");
11406
11406
  handleEmptyAction(filter);
11407
11407
  }
@@ -11756,7 +11756,7 @@
11756
11756
  var handleRef = useForkRef(ref, intInputRef);
11757
11757
  var handleWrapperClick = React.useCallback(function () {
11758
11758
  var _intInputRef$current;
11759
- (_intInputRef$current = intInputRef.current) === null || _intInputRef$current === void 0 ? void 0 : _intInputRef$current.focus();
11759
+ (_intInputRef$current = intInputRef.current) === null || _intInputRef$current === void 0 || _intInputRef$current.focus();
11760
11760
  wrapperClick && wrapperClick();
11761
11761
  }, [wrapperClick]);
11762
11762
  return /*#__PURE__*/React__default["default"].createElement(StyledInputWrapper, {
@@ -12020,7 +12020,7 @@
12020
12020
  };
12021
12021
  OptionContent.displayName = "OptionContent";
12022
12022
 
12023
- var _excluded$M = ["type", "mode", "target", "options", "selected", "position", "onChange", "actionIcon", "actionLabel", "placeholder", "emptyAction", "disableSearch", "forceCloseMenu", "selectClassName", "keepSameOptionsOrder", "onSelectOpen", "onSelectClose", "renderOption", "handleDefaultOptionChange", "preselectDefaultValue"];
12023
+ var _excluded$M = ["type", "mode", "target", "options", "selected", "position", "onChange", "placeholder", "emptyAction", "disableSearch", "forceCloseMenu", "selectClassName", "keepSameOptionsOrder", "onSelectOpen", "onSelectClose", "renderOption", "handleDefaultOptionChange", "preselectDefaultValue", "startAdornment", "endAdornment"];
12024
12024
  var Select = function Select(_ref) {
12025
12025
  var _ref$type = _ref.type,
12026
12026
  type = _ref$type === void 0 ? "single" : _ref$type,
@@ -12035,8 +12035,6 @@
12035
12035
  onChange = _ref$onChange === void 0 ? function () {
12036
12036
  return null;
12037
12037
  } : _ref$onChange,
12038
- actionIcon = _ref.actionIcon,
12039
- actionLabel = _ref.actionLabel,
12040
12038
  placeholder = _ref.placeholder,
12041
12039
  _ref$emptyAction = _ref.emptyAction,
12042
12040
  emptyAction = _ref$emptyAction === void 0 ? function () {
@@ -12054,7 +12052,12 @@
12054
12052
  handleDefaultOptionChange = _ref.handleDefaultOptionChange,
12055
12053
  _ref$preselectDefault = _ref.preselectDefaultValue,
12056
12054
  preselectDefaultValue = _ref$preselectDefault === void 0 ? type === "single" : _ref$preselectDefault,
12055
+ startAdornment = _ref.startAdornment,
12056
+ endAdornment = _ref.endAdornment,
12057
12057
  prop = _objectWithoutProperties(_ref, _excluded$M);
12058
+ if (disableSearch && (startAdornment || endAdornment)) {
12059
+ console.warn("Adornments are not visible when search bar is hidden");
12060
+ }
12058
12061
  var childNode = React.useRef();
12059
12062
  var elementRef = React.useRef(null);
12060
12063
  var handleRef = useForkRef(childNode, elementRef);
@@ -12096,7 +12099,7 @@
12096
12099
  }, [allOptionValues, selectedOptions]);
12097
12100
  React.useEffect(function () {
12098
12101
  var _childNode$current;
12099
- open && (childNode === null || childNode === void 0 ? void 0 : (_childNode$current = childNode.current) === null || _childNode$current === void 0 ? void 0 : _childNode$current.focus());
12102
+ open && (childNode === null || childNode === void 0 || (_childNode$current = childNode.current) === null || _childNode$current === void 0 ? void 0 : _childNode$current.focus());
12100
12103
  }, [childNode, open]);
12101
12104
  var handleChange = React.useCallback(function (selectedValue) {
12102
12105
  if (forceCloseMenu) {
@@ -12131,7 +12134,7 @@
12131
12134
  position,
12132
12135
  onPopperOpen: function onPopperOpen() {
12133
12136
  var _elementRef$current;
12134
- return elementRef === null || elementRef === void 0 ? void 0 : (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.focus();
12137
+ return elementRef === null || elementRef === void 0 || (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.focus();
12135
12138
  }
12136
12139
  };
12137
12140
  }
@@ -12145,7 +12148,7 @@
12145
12148
  if (forceCloseMenu) {
12146
12149
  setOpen(false);
12147
12150
  }
12148
- (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.reset();
12151
+ (_formRef$current = formRef.current) === null || _formRef$current === void 0 || _formRef$current.reset();
12149
12152
  }, [emptyAction, forceCloseMenu]);
12150
12153
  var handleDefaultOptionChangeCallback = React.useCallback(function () {
12151
12154
  if (type === "multiple") {
@@ -12192,15 +12195,10 @@
12192
12195
  }, [isAllOptionsChecked, renderOption, selectedOptions, type, someOptionsChecked]);
12193
12196
  return /*#__PURE__*/React__default["default"].createElement(Tag, props, /*#__PURE__*/React__default["default"].createElement("div", null, !disableSearch ? /*#__PURE__*/React__default["default"].createElement(StyledSelectForm, {
12194
12197
  ref: formRef
12195
- }, /*#__PURE__*/React__default["default"].createElement(StyledSelectInput, {
12198
+ }, startAdornment, /*#__PURE__*/React__default["default"].createElement(StyledSelectInput, {
12196
12199
  ref: handleRef,
12197
12200
  placeholder: placeholder
12198
- }), actionIcon && actionLabel && /*#__PURE__*/React__default["default"].createElement(Tooltip, {
12199
- popperTooltipStyle: {
12200
- zIndex: 1301
12201
- },
12202
- title: actionLabel
12203
- }, /*#__PURE__*/React__default["default"].createElement("div", null, actionIcon)), actionIcon && !actionLabel && actionIcon) : null, /*#__PURE__*/React__default["default"].createElement(Autocomplete, _extends({}, prop, {
12201
+ }), endAdornment) : null, /*#__PURE__*/React__default["default"].createElement(Autocomplete, _extends({}, prop, {
12204
12202
  clearInputOnSelect: true,
12205
12203
  inputEl: childNode,
12206
12204
  handleEmptyAction: handleEmptyAction,
@@ -12773,7 +12771,7 @@
12773
12771
  var isHoursSelected = selectionStart < newDotsIndex;
12774
12772
  var newSelectionStart = isHoursSelected ? 0 : newDotsIndex + 1;
12775
12773
  var selectionEnd = isHoursSelected ? newDotsIndex : newValue.length;
12776
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.setSelectionRange(newSelectionStart, selectionEnd);
12774
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.setSelectionRange(newSelectionStart, selectionEnd);
12777
12775
  });
12778
12776
  }
12779
12777
  }
@@ -12801,7 +12799,7 @@
12801
12799
  }
12802
12800
  if ((e.metaKey || e.ctrlKey) && e.key === "a") {
12803
12801
  var _inputRef$current2;
12804
- (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.select();
12802
+ (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.select();
12805
12803
  return;
12806
12804
  }
12807
12805
  var input = e.target;
@@ -12816,7 +12814,7 @@
12816
12814
  if (isMinutesSelected) {
12817
12815
  var _inputRef$current3;
12818
12816
  e.preventDefault();
12819
- (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setSelectionRange(0, newDotsIndex);
12817
+ (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || _inputRef$current3.setSelectionRange(0, newDotsIndex);
12820
12818
  }
12821
12819
  } else {
12822
12820
  var _newDotsIndex = currentValue.indexOf(":");
@@ -12824,7 +12822,7 @@
12824
12822
  if (isHoursSelected) {
12825
12823
  var _inputRef$current4;
12826
12824
  e.preventDefault();
12827
- (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setSelectionRange(_newDotsIndex + 1, currentValue.length);
12825
+ (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 || _inputRef$current4.setSelectionRange(_newDotsIndex + 1, currentValue.length);
12828
12826
  }
12829
12827
  }
12830
12828
  }
@@ -12863,10 +12861,10 @@
12863
12861
  var dotsIndex = currentValue.indexOf(":");
12864
12862
  if (selectionStart < dotsIndex) {
12865
12863
  var _inputRef$current6;
12866
- (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.setSelectionRange(0, dotsIndex);
12864
+ (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 || _inputRef$current6.setSelectionRange(0, dotsIndex);
12867
12865
  } else if (selectionStart >= dotsIndex) {
12868
12866
  var _inputRef$current7;
12869
- (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : _inputRef$current7.setSelectionRange(dotsIndex + 1, currentValue.length);
12867
+ (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 || _inputRef$current7.setSelectionRange(dotsIndex + 1, currentValue.length);
12870
12868
  }
12871
12869
  }
12872
12870
  if (typeof onClick === "function") {
@@ -12876,7 +12874,7 @@
12876
12874
  var handleDoubleClick = React.useCallback(function () {
12877
12875
  if (inputRef.current) {
12878
12876
  var _inputRef$current8;
12879
- (_inputRef$current8 = inputRef.current) === null || _inputRef$current8 === void 0 ? void 0 : _inputRef$current8.select();
12877
+ (_inputRef$current8 = inputRef.current) === null || _inputRef$current8 === void 0 || _inputRef$current8.select();
12880
12878
  }
12881
12879
  }, [inputRef]);
12882
12880
  var inputProps = React.useMemo(function () {
@@ -15537,8 +15535,8 @@
15537
15535
  }, [focused, open, selectedName, type]);
15538
15536
  React.useEffect(function () {
15539
15537
  var _childNode$current, _childNode$current2;
15540
- open && (childNode === null || childNode === void 0 ? void 0 : (_childNode$current = childNode.current) === null || _childNode$current === void 0 ? void 0 : _childNode$current.focus());
15541
- !open && (childNode === null || childNode === void 0 ? void 0 : (_childNode$current2 = childNode.current) === null || _childNode$current2 === void 0 ? void 0 : _childNode$current2.blur());
15538
+ open && (childNode === null || childNode === void 0 || (_childNode$current = childNode.current) === null || _childNode$current === void 0 ? void 0 : _childNode$current.focus());
15539
+ !open && (childNode === null || childNode === void 0 || (_childNode$current2 = childNode.current) === null || _childNode$current2 === void 0 ? void 0 : _childNode$current2.blur());
15542
15540
  }, [childNode, open]);
15543
15541
  React.useEffect(function () {
15544
15542
  setValue(selectedName);
@@ -15551,7 +15549,7 @@
15551
15549
  }
15552
15550
  }, [focused, isFirstRender, onClose, open]);
15553
15551
  var emptyAction = React.useCallback(function (v) {
15554
- handleEmptyAction === null || handleEmptyAction === void 0 ? void 0 : handleEmptyAction(v);
15552
+ handleEmptyAction === null || handleEmptyAction === void 0 || handleEmptyAction(v);
15555
15553
  setOpen(false);
15556
15554
  }, [handleEmptyAction]);
15557
15555
  var handleChange = React.useCallback(function (selectedValue) {
@@ -15591,11 +15589,11 @@
15591
15589
  if (typeof onDeselect === "function") {
15592
15590
  onDeselect();
15593
15591
  } else if (type === "multiple") {
15594
- onChange === null || onChange === void 0 ? void 0 : onChange([]);
15592
+ onChange === null || onChange === void 0 || onChange([]);
15595
15593
  } else {
15596
- onChange === null || onChange === void 0 ? void 0 : onChange("");
15594
+ onChange === null || onChange === void 0 || onChange("");
15597
15595
  }
15598
- onClear === null || onClear === void 0 ? void 0 : onClear();
15596
+ onClear === null || onClear === void 0 || onClear();
15599
15597
  setOpen(false);
15600
15598
  }, [type, onChange, onClear, onDeselect]);
15601
15599
  var handleMouseDown = React.useCallback(function (e) {
@@ -15736,7 +15734,7 @@
15736
15734
  className: classNames__default["default"]("c-combo-box-input-wrapper", inputWrapperClassName),
15737
15735
  onClick: function onClick() {
15738
15736
  var _elementRef$current;
15739
- (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.click();
15737
+ (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 || _elementRef$current.click();
15740
15738
  },
15741
15739
  $_css3: autoSize === "auto" ? "auto" : undefined,
15742
15740
  $_css4: autoSize === "auto" && scrollWrapper ? "scroll" : undefined,
@@ -17073,7 +17071,7 @@
17073
17071
  var height = dimensions === null || dimensions === void 0 ? void 0 : dimensions.height;
17074
17072
  React.useEffect(function () {
17075
17073
  if (height && height > 0 && !indexPage) {
17076
- onHeightChange === null || onHeightChange === void 0 ? void 0 : onHeightChange(height);
17074
+ onHeightChange === null || onHeightChange === void 0 || onHeightChange(height);
17077
17075
  }
17078
17076
  }, [height, onHeightChange, indexPage]);
17079
17077
  return /*#__PURE__*/React__default["default"].createElement("div", {
@@ -17943,14 +17941,14 @@
17943
17941
  var listWrapperRef = React.useRef(null);
17944
17942
  var scrollToTop = function scrollToTop() {
17945
17943
  var _listWrapperRef$curre;
17946
- (_listWrapperRef$curre = listWrapperRef.current) === null || _listWrapperRef$curre === void 0 ? void 0 : _listWrapperRef$curre.scrollTo({
17944
+ (_listWrapperRef$curre = listWrapperRef.current) === null || _listWrapperRef$curre === void 0 || _listWrapperRef$curre.scrollTo({
17947
17945
  top: 0,
17948
17946
  behavior: "smooth"
17949
17947
  });
17950
17948
  };
17951
17949
  var scrollToBottom = function scrollToBottom() {
17952
17950
  var _listWrapperRef$curre2;
17953
- (_listWrapperRef$curre2 = listWrapperRef.current) === null || _listWrapperRef$curre2 === void 0 ? void 0 : _listWrapperRef$curre2.scrollTo({
17951
+ (_listWrapperRef$curre2 = listWrapperRef.current) === null || _listWrapperRef$curre2 === void 0 || _listWrapperRef$curre2.scrollTo({
17954
17952
  top: listWrapperRef.current.scrollHeight,
17955
17953
  behavior: "smooth"
17956
17954
  });