@activecollab/components 2.0.163 → 2.0.165

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/dist/index.js CHANGED
@@ -363,11 +363,11 @@
363
363
  componentId: "sc-dv1w0m-1"
364
364
  })(["", " ", " display:flex;flex-direction:row;align-items:center;cursor:pointer;padding:0 1rem;margin:0.25rem 0;font-size:0.875rem;user-select:none;color:var(--color-theme-900);line-height:28px;> svg:first-child{margin-right:8px;}&:hover,&:focus-visible{background-color:var(--color-theme-200);outline:none;}"], BoxSizingStyle, FontStyle);
365
365
  StyledListItem.displayName = "StyledListItem";
366
- var StyledListSeparator = styled__default["default"].div.withConfig({
366
+ var StyledListSeparator$1 = styled__default["default"].div.withConfig({
367
367
  displayName: "Styles__StyledListSeparator",
368
368
  componentId: "sc-dv1w0m-2"
369
369
  })(["border-top:1px solid var(--border-primary);margin:12px 16px;height:1px;"]);
370
- StyledListSeparator.displayName = "StyledListSeparator";
370
+ StyledListSeparator$1.displayName = "StyledListSeparator";
371
371
 
372
372
  var _excluded$1u = ["children", "className"];
373
373
  var ListItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
@@ -386,7 +386,7 @@
386
386
  var ListSeparator = function ListSeparator(_ref) {
387
387
  var className = _ref.className,
388
388
  props = _objectWithoutProperties(_ref, _excluded$1t);
389
- return /*#__PURE__*/React__default["default"].createElement(StyledListSeparator, _extends({
389
+ return /*#__PURE__*/React__default["default"].createElement(StyledListSeparator$1, _extends({
390
390
  className: classNames__default["default"]("c-list-separator", className)
391
391
  }, props));
392
392
  };
@@ -16477,8 +16477,8 @@
16477
16477
  componentId: "sc-1lmb5y-0"
16478
16478
  })(["flex-shrink:0"]);
16479
16479
 
16480
- var _excluded$B = ["size", "disabled", "value", "onChange"];
16481
- var options = [{
16480
+ var _excluded$B = ["size", "disabled", "value", "onChange", "scheme"];
16481
+ var defaultOptions = [{
16482
16482
  id: "https://",
16483
16483
  name: "https://"
16484
16484
  }, {
@@ -16492,9 +16492,28 @@
16492
16492
  _ref$value = _ref.value,
16493
16493
  defaultValue = _ref$value === void 0 ? "" : _ref$value,
16494
16494
  onChange = _ref.onChange,
16495
+ scheme = _ref.scheme,
16495
16496
  rest = _objectWithoutProperties(_ref, _excluded$B);
16496
16497
  var inputRef = React.useRef(null);
16497
16498
  var handleRef = useForkRef(ref, inputRef);
16499
+ var options = React.useMemo(function () {
16500
+ if (scheme && scheme.length > 0) {
16501
+ if (Array.isArray(scheme)) {
16502
+ return scheme.map(function (i) {
16503
+ return {
16504
+ id: i,
16505
+ name: i
16506
+ };
16507
+ });
16508
+ } else {
16509
+ return [{
16510
+ id: scheme,
16511
+ name: scheme
16512
+ }];
16513
+ }
16514
+ }
16515
+ return defaultOptions;
16516
+ }, [scheme]);
16498
16517
  var _useState = React.useState(options[0].id),
16499
16518
  _useState2 = _slicedToArray(_useState, 2),
16500
16519
  prefix = _useState2[0],
@@ -16543,14 +16562,14 @@
16543
16562
  },
16544
16563
  // eslint-disable-next-line
16545
16564
  [onChange, prefix]);
16546
- var handleSelectChange = function handleSelectChange(val) {
16565
+ var handleSelectChange = React.useCallback(function (val) {
16547
16566
  setPrefix(val);
16548
16567
  setTimeout(function () {
16549
16568
  var _inputRef$current;
16550
16569
  (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
16551
16570
  }, 200);
16552
16571
  typeof onChange === "function" && onChange(val + value);
16553
- };
16572
+ }, [onChange, value]);
16554
16573
  var handlePaste = function handlePaste(e) {
16555
16574
  e.preventDefault();
16556
16575
  var paste = e.clipboardData.getData("text");
@@ -16565,6 +16584,29 @@
16565
16584
  onChange(newPrefix + newValue);
16566
16585
  }
16567
16586
  };
16587
+ var startAdornmentComponent = React.useMemo(function () {
16588
+ if (options.length > 1) {
16589
+ return /*#__PURE__*/React__default["default"].createElement(InputSelect, {
16590
+ key: prefix,
16591
+ size: size,
16592
+ onChange: handleSelectChange,
16593
+ options: options,
16594
+ selected: prefix,
16595
+ disabled: disabled
16596
+ });
16597
+ } else {
16598
+ return /*#__PURE__*/React__default["default"].createElement(StyledInputSelectTrigger, {
16599
+ key: prefix,
16600
+ $disabled: disabled,
16601
+ $size: size
16602
+ }, prefix);
16603
+ }
16604
+ }, [disabled, handleSelectChange, options, prefix, size]);
16605
+ React.useEffect(function () {
16606
+ if (options.length > 0) {
16607
+ setPrefix(options[0].id);
16608
+ }
16609
+ }, [options]);
16568
16610
  return /*#__PURE__*/React__default["default"].createElement(Input, _extends({}, rest, {
16569
16611
  ref: handleRef,
16570
16612
  size: size,
@@ -16574,13 +16616,7 @@
16574
16616
  onPaste: handlePaste,
16575
16617
  onChange: handleChange,
16576
16618
  "data-testid": "InputUrl",
16577
- startAdornment: /*#__PURE__*/React__default["default"].createElement(InputSelect, {
16578
- size: size,
16579
- onChange: handleSelectChange,
16580
- options: options,
16581
- selected: prefix,
16582
- disabled: disabled
16583
- })
16619
+ startAdornment: startAdornmentComponent
16584
16620
  }));
16585
16621
  });
16586
16622
  InputUrl.displayName = "InputUrl";
@@ -16868,13 +16904,15 @@
16868
16904
  var StyledSheetIcons = styled__default["default"].div.withConfig({
16869
16905
  displayName: "Styles__StyledSheetIcons",
16870
16906
  componentId: "sc-144eyxd-0"
16871
- })(["display:flex;height:0;position:relative;span{position:relative;background-color:var(--page-paper-main);box-shadow:var(--shadow-secondary);cursor:pointer;border-radius:100%;width:40px;height:40px;display:flex;justify-content:center;align-items:center;& > *{height:40px;width:40px;padding:8px;fill:var(--color-theme-600);}}"]);
16907
+ })(["display:flex;height:0;position:relative;span{position:relative;background-color:var(--page-paper-main);box-shadow:var(--shadow-secondary);cursor:pointer;border-radius:100%;width:40px;height:40px;display:flex;justify-content:center;align-items:center;& > *{height:40px;width:40px;padding:8px;fill:var(--color-theme-600);}}@media (max-width:768px){display:none;}"]);
16872
16908
  StyledSheetIcons.displayName = "StyledSheetIcons";
16873
16909
  var StyledSheetWrapper = styled__default["default"].div.withConfig({
16874
16910
  displayName: "Styles__StyledSheetWrapper",
16875
16911
  componentId: "sc-144eyxd-1"
16876
- })(["", " ", " position:relative;max-width:95vw;display:flex;flex-direction:row;", " ", " ", " ", " ", " ", ""], BoxSizingStyle, FontStyle, function (props) {
16912
+ })(["", " ", " position:relative;max-width:95vw;display:flex;flex-direction:row;", " ", " ", " ", " ", " ", " ", ""], BoxSizingStyle, FontStyle, function (props) {
16877
16913
  return props.$mode === "stretch" ? styled.css(["margin-top:8px;height:calc(100vh - 16px);width:calc(100vw - 100px);max-width:1000px;", "{flex-direction:column;width:0;height:calc(100vh - 32px);& > *{margin-bottom:8px;animation-fill-mode:both;}span{top:8px;}}"], StyledSheetIcons) : styled.css(["max-height:calc(100vh - 156px);margin-top:126px;margin-bottom:30px;width:540px;flex-direction:column;", "{flex-direction:row-reverse;& > *{margin-left:8px;animation-fill-mode:both;}span{top:-48px;right:8px;}}"], StyledSheetIcons);
16914
+ }, function (props) {
16915
+ return props.$mode === "stretch" && styled.css(["@media (max-width:768px){width:100%;height:100%;}"]);
16878
16916
  }, function (props) {
16879
16917
  return props.$position === "center" && styled.css(["", ""], {
16880
16918
  "marginLeft": "auto",
@@ -16914,10 +16952,12 @@
16914
16952
  var StyledAnimatedSpan = styled__default["default"].span.withConfig({
16915
16953
  displayName: "Styles__StyledAnimatedSpan",
16916
16954
  componentId: "sc-144eyxd-3"
16917
- })(["background:red;", " ", " ", " ", ""], function (props) {
16955
+ })(["background:red;", " ", " ", " ", " ", ""], function (props) {
16918
16956
  return props.$state === "entering" && styled.css(["opacity:1;", ""], props.$mode === "stretch" ? styled.css(["animation-name:", ";animation-duration:", ";animation-delay:", ";"], StyledSheetControlsTop, "".concat(props.$durationIn, "s"), "".concat(props.$durationIn, "s")) : styled.css(["animation-name:", ";animation-duration:", ";animation-delay:0s;"], StyledSheetControlsCenterIn, "".concat(props.$maxDurationIn, "s")));
16919
16957
  }, function (props) {
16920
16958
  return props.$state === "entered" && styled.css(["opacity:1;"]);
16959
+ }, function (props) {
16960
+ return props.$disabled && styled.css(["pointer-events:none;svg{opacity:0.5;}"]);
16921
16961
  }, function (props) {
16922
16962
  return props.$state === "exiting" && styled.css(["opacity:0;", ""], props.$mode === "stretch" ? styled.css(["animation-name:", ";animation-duration:", ";animation-delay:", ";"], StyledSheetControlsBottom, "".concat(props.$durationOut, "s"), "".concat(props.$durationOut, "s")) : styled.css(["animation-name:", ";animation-duration:", ";animation-delay:0;"], StyledSheetControlsCenterOut, "".concat(props.$maxDurationOut, "s")));
16923
16963
  }, function (props) {
@@ -16937,6 +16977,21 @@
16937
16977
  return props.$direction === "right" && styled.css(["&.c-sheet__animation-enter{opacity:0;transform:translateX(100%);}&.c-sheet__animation-enter-active{opacity:1;transform:translateX(0);transition:opacity 400ms,transform 400ms;}&.c-sheet__animation-appear{opacity:0;transform:translateX(100%);}&.c-sheet__animation-appear-active{opacity:1;transform:translateX(0);transition:opacity 400ms,transform 400ms;}&.c-sheet__animation-exit{opacity:1;}&.c-sheet__animation-exit-active{opacity:0;transform:translateX(100%);transition:opacity 200ms,transform 200ms;}"]);
16938
16978
  });
16939
16979
  StyledCssTransition.displayName = "StyledCssTransition";
16980
+ var StyledListSeparator = styled__default["default"](ListSeparator).withConfig({
16981
+ displayName: "Styles__StyledListSeparator",
16982
+ componentId: "sc-144eyxd-5"
16983
+ })(["margin:0;"]);
16984
+ StyledListSeparator.displayName = "StyledListSeparator";
16985
+ var StyledIconsWrapperSmall = styled__default["default"].div.withConfig({
16986
+ displayName: "Styles__StyledIconsWrapperSmall",
16987
+ componentId: "sc-144eyxd-6"
16988
+ })(["height:40px;display:flex;gap:8px;padding-left:16px;padding-right:16px;align-items:center;place-content:end;flex-direction:row-reverse;"]);
16989
+ StyledIconsWrapperSmall.displayName = "StyledIconsWrapperSmall";
16990
+ var StyledHeader$1 = styled__default["default"].div.withConfig({
16991
+ displayName: "Styles__StyledHeader",
16992
+ componentId: "sc-144eyxd-7"
16993
+ })(["@media (min-width:768px){display:none;}"]);
16994
+ StyledHeader$1.displayName = "StyledHeader";
16940
16995
 
16941
16996
  var _excluded$x = ["children", "onClose", "controls", "open", "animation", "position", "mode", "disableFocusLock", "disableScrollLock", "disableBackgroundColor", "bodyStyle", "bodyClassName", "disableBackgroundClick"];
16942
16997
  var Sheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
@@ -16979,7 +17034,7 @@
16979
17034
  }, []);
16980
17035
  var handleExited = React.useCallback(function () {
16981
17036
  setExited(true);
16982
- typeof onClose === "function" && onClose();
17037
+ onClose === null || onClose === void 0 || onClose();
16983
17038
  }, [onClose]);
16984
17039
  var handleClose = React.useCallback(function () {
16985
17040
  setOpen(false);
@@ -17002,36 +17057,47 @@
17002
17057
  onClose: handleClose,
17003
17058
  disableFocusLock: disableFocusLock,
17004
17059
  disableScrollLock: disableScrollLock
17005
- }), open ? /*#__PURE__*/React__default["default"].createElement(Overlay, {
17060
+ }), open && /*#__PURE__*/React__default["default"].createElement(Overlay, {
17006
17061
  onClick: handleBackgroundClick,
17007
17062
  disableBackgroundColor: disableBackgroundColor
17008
- }) : null, /*#__PURE__*/React__default["default"].createElement(StyledSheetWrapper, {
17063
+ }), /*#__PURE__*/React__default["default"].createElement(StyledSheetWrapper, {
17009
17064
  className: classNames__default["default"]("c-sheet__wrapper", bodyClassName),
17010
17065
  style: bodyStyle,
17011
17066
  $position: position,
17012
17067
  $mode: mode
17013
- }, controls.length ? /*#__PURE__*/React__default["default"].createElement(StyledSheetIcons, null, controls.map(function (item, index) {
17014
- var maxDurationIn = 4; // max duration 4 for 400ms, shorten .4s
17015
- var maxDurationOut = 2; // max duration 2 for 200ms, shorten .2s
17068
+ }, controls.length > 0 && /*#__PURE__*/React__default["default"].createElement(StyledSheetIcons, null, controls.map(function (_ref2, index) {
17069
+ var IconComponent = _ref2.icon,
17070
+ tooltip = _ref2.tooltip,
17071
+ onClick = _ref2.onClick,
17072
+ disabled = _ref2.disabled,
17073
+ className = _ref2.className;
17074
+ var maxDurationIn = 4;
17075
+ var maxDurationOut = 2;
17016
17076
  var control = index + 1;
17017
- var durationOut = controls.length > maxDurationOut ? maxDurationOut : maxDurationOut - control;
17018
- var durationIn = control >= maxDurationIn ? 1 : control;
17077
+ var durationOut = Math.max(0, maxDurationOut - control);
17078
+ var durationIn = Math.min(control, maxDurationIn);
17019
17079
  return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, {
17020
17080
  appear: true,
17021
17081
  in: open,
17022
17082
  timeout: maxDurationIn * 100,
17023
17083
  key: "c-sheet-control-".concat(index)
17024
17084
  }, function (state) {
17025
- return /*#__PURE__*/React__default["default"].createElement(StyledAnimatedSpan, {
17026
- $state: state,
17085
+ return /*#__PURE__*/React__default["default"].createElement(Tooltip, {
17086
+ title: tooltip,
17087
+ disable: !tooltip || disabled
17088
+ }, /*#__PURE__*/React__default["default"].createElement(StyledAnimatedSpan, {
17089
+ onClick: onClick,
17090
+ $disabled: disabled,
17027
17091
  $mode: mode,
17092
+ $state: state,
17093
+ className: className,
17028
17094
  $maxDurationIn: maxDurationIn / 10,
17029
17095
  $maxDurationOut: maxDurationOut / 10,
17030
17096
  $durationOut: durationOut / 10,
17031
17097
  $durationIn: durationIn / 10
17032
- }, item);
17098
+ }, IconComponent));
17033
17099
  });
17034
- })) : null, /*#__PURE__*/React__default["default"].createElement(StyledCssTransition, {
17100
+ })), /*#__PURE__*/React__default["default"].createElement(StyledCssTransition, {
17035
17101
  appear: true,
17036
17102
  in: open,
17037
17103
  timeout: 400,
@@ -17041,7 +17107,23 @@
17041
17107
  onExited: handleExited
17042
17108
  }, /*#__PURE__*/React__default["default"].createElement(StyledSheetWrapperPaper, {
17043
17109
  paperClass: "c-sheet__wrapper__paper"
17044
- }, children))));
17110
+ }, controls.length > 0 && /*#__PURE__*/React__default["default"].createElement(StyledHeader$1, null, /*#__PURE__*/React__default["default"].createElement(StyledIconsWrapperSmall, null, controls.map(function (_ref3, index) {
17111
+ var IconComponent = _ref3.icon,
17112
+ tooltip = _ref3.tooltip,
17113
+ onClick = _ref3.onClick,
17114
+ disabled = _ref3.disabled,
17115
+ className = _ref3.className;
17116
+ return /*#__PURE__*/React__default["default"].createElement(Tooltip, {
17117
+ title: tooltip,
17118
+ disable: !tooltip || disabled,
17119
+ key: index
17120
+ }, /*#__PURE__*/React__default["default"].createElement(IconButton, {
17121
+ onClick: onClick,
17122
+ disabled: disabled,
17123
+ className: className,
17124
+ variant: "text gray"
17125
+ }, IconComponent));
17126
+ })), /*#__PURE__*/React__default["default"].createElement(StyledListSeparator, null)), children))));
17045
17127
  });
17046
17128
  Sheet.displayName = "Sheet";
17047
17129