@startlibs/components 1.0.0-alpha-7y → 1.0.0-alpha-8b

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 (2) hide show
  1. package/lib/index.js +54 -14
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -18,7 +18,7 @@ var _createClass = _interopDefault(require('@babel/runtime/helpers/createClass')
18
18
  var _possibleConstructorReturn = _interopDefault(require('@babel/runtime/helpers/possibleConstructorReturn'));
19
19
  var _getPrototypeOf = _interopDefault(require('@babel/runtime/helpers/getPrototypeOf'));
20
20
  var _inherits = _interopDefault(require('@babel/runtime/helpers/inherits'));
21
- var reactRouterDom = require('react-router-dom');
21
+ var router = require('@reach/router');
22
22
  var _assign = _interopDefault(require('lodash/fp/assign'));
23
23
  var core = require('@startlibs/core');
24
24
  var _slicedToArray = _interopDefault(require('@babel/runtime/helpers/slicedToArray'));
@@ -116,7 +116,8 @@ var Icon = styled__default(styled.withTheme(IconComponent)).withConfig({
116
116
  return props.clickable && "\n cursor: pointer;\n &:hover {\n opacity: 0.85;\n }\n ";
117
117
  });
118
118
 
119
- var Link = reactRouterDom.Link;
119
+ // import {Link as RouterLink} from 'react-router-dom'
120
+ var Link = router.Link;
120
121
 
121
122
  var Loading = styled__default.div.withConfig({
122
123
  displayName: "Loading",
@@ -289,6 +290,43 @@ Button.Link = function (props) {
289
290
  }));
290
291
  };
291
292
 
293
+ var TextButton = styled__default(function (_ref) {
294
+ var className = _ref.className,
295
+ isLoading = _ref.isLoading,
296
+ children = _ref.children,
297
+ _ref$innerAs = _ref.innerAs,
298
+ Wrapper = _ref$innerAs === void 0 ? 'div' : _ref$innerAs,
299
+ props = _objectWithoutProperties(_ref, ["className", "isLoading", "children", "innerAs"]);
300
+
301
+ return React__default.createElement(Wrapper, _extends({
302
+ className: className
303
+ }, props), children, " ", isLoading && React__default.createElement(Loading, {
304
+ size: 14,
305
+ borderWidth: 3
306
+ }));
307
+ }).withConfig({
308
+ displayName: "TextButton",
309
+ componentId: "sc-1eydmhc-0"
310
+ })(["display:inline-block;font-weight:500;font-size:13px;color:", ";cursor:pointer;text-decoration:none;:hover,:active{color:", ";}", "{display:inline-block;margin-left:0.25rem;vertical-align:-3px;}", ""], utils.getColor('main'), function (props) {
311
+ return polished.darken(0.1, utils.getColor("main")(props));
312
+ }, Loading, function (props) {
313
+ return props.nowrap && "\n white-space: nowrap;\n ";
314
+ });
315
+
316
+ TextButton.a = function (props) {
317
+ return React__default.createElement(TextButton, _extends({}, props, {
318
+ className: props.className,
319
+ innerAs: "a"
320
+ }));
321
+ };
322
+
323
+ TextButton.Link = function (props) {
324
+ return React__default.createElement(TextButton, _extends({}, props, {
325
+ className: props.className,
326
+ innerAs: Link
327
+ }));
328
+ };
329
+
292
330
  var ErrorBoundary =
293
331
  /*#__PURE__*/
294
332
  function (_React$Component) {
@@ -2057,7 +2095,7 @@ var MainIcon = styled__default(Icon).withConfig({
2057
2095
  displayName: "WarningDialog__MainIcon",
2058
2096
  componentId: "sc-1jw779e-1"
2059
2097
  })(["color:", ";font-size:46px;display:block;margin-bottom:1.25rem;"], function (props) {
2060
- return props.icon === 'warning' ? utils.getColor('alert') : utils.getColor('main');
2098
+ return props.icon === 'warning' ? utils.getColor('alert') : props.icon === 'success' ? utils.getColor('success') : utils.getColor('main');
2061
2099
  });
2062
2100
  var useWarningDialog = function useWarningDialog() {
2063
2101
  return useDialogWithToggle(function (toggle) {
@@ -2072,8 +2110,12 @@ var _willUseSharedState = core.willUseSharedState(),
2072
2110
  useRenderDefaultWarningDialog = _willUseSharedState2[0],
2073
2111
  _setWarningDialog = _willUseSharedState2[2];
2074
2112
 
2075
- var setWarningDialog = function setWarningDialog(props) {
2076
- return _setWarningDialog(React__default.createElement(WarningDialog, _extends({}, props, {
2113
+ var setWarningDialog = function setWarningDialog(_ref2) {
2114
+ var _ref2$as = _ref2.as,
2115
+ Dialog = _ref2$as === void 0 ? WarningDialog : _ref2$as,
2116
+ props = _objectWithoutProperties(_ref2, ["as"]);
2117
+
2118
+ return _setWarningDialog(React__default.createElement(Dialog, _extends({}, props, {
2077
2119
  closeDialog: function closeDialog() {
2078
2120
  return _setWarningDialog(null);
2079
2121
  }
@@ -2571,7 +2613,10 @@ function (_React$Component) {
2571
2613
  return;
2572
2614
  }
2573
2615
 
2574
- morph(oldItem.domNode, formatAnimation(removeAnimation || animation, timing), function () {
2616
+ new Promise(function (res) {
2617
+ morph(oldItem.domNode, formatAnimation(removeAnimation || animation, timing), res);
2618
+ setTimeout(res, 1500);
2619
+ }).then(function () {
2575
2620
  oldItem.domNode.remove();
2576
2621
  });
2577
2622
  });
@@ -4372,19 +4417,13 @@ var ContextMenuComponent = React.forwardRef(function (_ref2, unesuredRef) {
4372
4417
  e.target.dispatchEvent(new MouseEvent('mousemove', {
4373
4418
  bubbles: true
4374
4419
  }));
4375
- var passedResistance = false;
4376
- return [function (e, nextPos) {
4420
+ return function (e, nextPos) {
4377
4421
  var delta = prevPos.clientY - nextPos.clientY;
4378
4422
 
4379
4423
  if (Math.abs(delta) > 10) {
4380
- passedResistance = true;
4381
4424
  setCursorOnHover(-1);
4382
4425
  }
4383
- }, function (e, finalPos) {
4384
- if (!passedResistance) {
4385
- e.target.click();
4386
- }
4387
- }];
4426
+ };
4388
4427
  });
4389
4428
  return React__default.createElement(ContextListMenu, _extends({
4390
4429
  "data-drag": false,
@@ -5289,6 +5328,7 @@ exports.SimpleLi = SimpleLi;
5289
5328
  exports.SplitColumnsContainer = SplitColumnsContainer;
5290
5329
  exports.StickyContainer = StickyContainer;
5291
5330
  exports.SwitchDiv = SwitchDiv;
5331
+ exports.TextButton = TextButton;
5292
5332
  exports.Tooltip = Tooltip;
5293
5333
  exports.TransitionDiv = TransitionDiv;
5294
5334
  exports.WarningDialog = WarningDialog;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startlibs/components",
3
- "version": "1.0.0-alpha-7y",
3
+ "version": "1.0.0-alpha-8b",
4
4
  "description": "Startlibs Components",
5
5
  "main": "lib/index.js",
6
6
  "sideEffects": false,