@startlibs/components 1.0.0-alpha-8a → 1.0.0-alpha-8d

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 +339 -51
  2. package/package.json +3 -4
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 router = require('@reach/router');
21
+ var reactRouterDom = require('react-router-dom');
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'));
@@ -30,18 +30,20 @@ var _identity = _interopDefault(require('lodash/fp/identity'));
30
30
  var _isString = _interopDefault(require('lodash/fp/isString'));
31
31
  var _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray'));
32
32
  var _isObject = _interopDefault(require('lodash/fp/isObject'));
33
+ var _without = _interopDefault(require('lodash/fp/without'));
34
+ require('@startlibs/components');
33
35
  var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
34
36
  var _assertThisInitialized = _interopDefault(require('@babel/runtime/helpers/assertThisInitialized'));
35
37
  var _set = _interopDefault(require('lodash/fp/set'));
36
38
  var _pullAt = _interopDefault(require('lodash/fp/pullAt'));
37
39
  var _map = _interopDefault(require('lodash/fp/map'));
38
40
  var ReactDOM = _interopDefault(require('react-dom'));
39
- var reactHotLoader = require('react-hot-loader');
40
41
  var _isFunction = _interopDefault(require('lodash/fp/isFunction'));
41
42
  var reactIs = require('react-is');
42
43
  var mitt = _interopDefault(require('mitt'));
44
+ require('lodash/fp');
43
45
  var _typeof = _interopDefault(require('@babel/runtime/helpers/typeof'));
44
- var _without = _interopDefault(require('lodash/fp/without'));
46
+ var createEmotion = _interopDefault(require('create-emotion'));
45
47
 
46
48
  var IconComponent =
47
49
  /*#__PURE__*/
@@ -116,8 +118,7 @@ var Icon = styled__default(styled.withTheme(IconComponent)).withConfig({
116
118
  return props.clickable && "\n cursor: pointer;\n &:hover {\n opacity: 0.85;\n }\n ";
117
119
  });
118
120
 
119
- // import {Link as RouterLink} from 'react-router-dom'
120
- var Link = router.Link;
121
+ var Link = reactRouterDom.Link;
121
122
 
122
123
  var Loading = styled__default.div.withConfig({
123
124
  displayName: "Loading",
@@ -228,7 +229,7 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
228
229
  })).withConfig({
229
230
  displayName: "Button",
230
231
  componentId: "qe54pl-1"
231
- })(["vertical-align:top;border:0;font-size:12px;border-radius:", ";background:", ";color:white;min-width:8rem;font-weight:500;display:inline-block;line-height:16px;text-align:center;padding:10px 1.25rem;outline:none;cursor:pointer;position:relative;text-decoration:none;user-select:none;flex-shrink:0;:hover{background:", ";}:active{background:", ";}", " ", " + .styled-button{margin-left:1rem;}", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
232
+ })(["vertical-align:top;border:0;font-size:12px;border-radius:", ";background:", ";color:white;min-width:8rem;font-weight:500;display:inline-block;line-height:16px;text-align:center;padding:10px 1.25rem;outline:none;cursor:pointer;position:relative;text-decoration:none;user-select:none;flex-shrink:0;:hover{background:", ";}:active{background:", ";}", " ", " + .styled-button{margin-left:1rem;}", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
232
233
  return props.rounded ? '100px' : '6px';
233
234
  }, utils.getColor, function (props) {
234
235
  return polished.darken(0.05, utils.getColor(props, true));
@@ -256,6 +257,14 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
256
257
  }, function (props) {
257
258
  return polished.darken(0.08, utils.getColor('bluishGray')(props));
258
259
  });
260
+ }, function (props) {
261
+ return props.lightAlert && styled.css(["background:", ";color:", ";:hover{background:", ";}:active{background:", ";}"], function (props) {
262
+ return polished.transparentize(0.88, utils.getColor("alert")(props));
263
+ }, utils.getColor('alert'), function (props) {
264
+ return polished.transparentize(0.85, utils.getColor("alert")(props));
265
+ }, function (props) {
266
+ return polished.transparentize(0.82, utils.getColor("alert")(props));
267
+ });
259
268
  }, function (props) {
260
269
  return (props.outline || props.dashed || props.textOnly) && styled.css(["color:", ";background:none;", ",", "{color:", ";}:before{content:'';border:1px ", " ", ";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:", ";pointer-events:none;}:hover{background-color:rgba(0,0,0,0.05);}:active{background-color:rgba(0,0,0,0.08);}:focus{:before{box-shadow:0 0 0 2px rgba(0,0,0,0.1);", "}:after{content:none;}}"], props.white ? 'white' : props.highlight ? utils.getColor('main') : 'rgba(0,0,0,0.6)', Icon, DropdownIcon, props.white ? 'white' : props.highlight ? utils.getColor('main') : 'rgba(0,0,0,0.5)', props.outline ? 'solid' : props.dashed ? 'dashed' : '', props.white ? 'white' : props.highlight ? utils.getColor('main') : 'rgba(0,0,0,0.35)', props.rounded ? '100px' : '6px', props.textOnly && 'content: none;');
261
270
  }, function (props) {
@@ -290,6 +299,43 @@ Button.Link = function (props) {
290
299
  }));
291
300
  };
292
301
 
302
+ var TextButton = styled__default(function (_ref) {
303
+ var className = _ref.className,
304
+ isLoading = _ref.isLoading,
305
+ children = _ref.children,
306
+ _ref$innerAs = _ref.innerAs,
307
+ Wrapper = _ref$innerAs === void 0 ? 'div' : _ref$innerAs,
308
+ props = _objectWithoutProperties(_ref, ["className", "isLoading", "children", "innerAs"]);
309
+
310
+ return React__default.createElement(Wrapper, _extends({
311
+ className: className
312
+ }, props), children, " ", isLoading && React__default.createElement(Loading, {
313
+ size: 14,
314
+ borderWidth: 3
315
+ }));
316
+ }).withConfig({
317
+ displayName: "TextButton",
318
+ componentId: "sc-1eydmhc-0"
319
+ })(["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) {
320
+ return polished.darken(0.1, utils.getColor("main")(props));
321
+ }, Loading, function (props) {
322
+ return props.nowrap && "\n white-space: nowrap;\n ";
323
+ });
324
+
325
+ TextButton.a = function (props) {
326
+ return React__default.createElement(TextButton, _extends({}, props, {
327
+ className: props.className,
328
+ innerAs: "a"
329
+ }));
330
+ };
331
+
332
+ TextButton.Link = function (props) {
333
+ return React__default.createElement(TextButton, _extends({}, props, {
334
+ className: props.className,
335
+ innerAs: Link
336
+ }));
337
+ };
338
+
293
339
  var ErrorBoundary =
294
340
  /*#__PURE__*/
295
341
  function (_React$Component) {
@@ -650,7 +696,8 @@ var hasClientRectChanged = function hasClientRectChanged(oldSnap, newSnap) {
650
696
 
651
697
  var getClientRectAnimation = function getClientRectAnimation(oldSnap, newSnap) {
652
698
  var _ref5 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
653
- skipTransform = _ref5.skipTransform;
699
+ skipTransform = _ref5.skipTransform,
700
+ smallJumpFix = _ref5.smallJumpFix;
654
701
 
655
702
  if (hasClientRectChanged(oldSnap, newSnap)) {
656
703
  var _oldSnap$parentStyle, _newSnap$parentStyle, _oldSnap$parentStyle2, _newSnap$parentStyle2;
@@ -675,17 +722,17 @@ var getClientRectAnimation = function getClientRectAnimation(oldSnap, newSnap) {
675
722
  paddingBottom = _window$getComputedSt4.paddingBottom;
676
723
 
677
724
  finalPadding = 'padding-bottom:' + paddingBottom + ';';
678
- heightFix = "padding-bottom: ".concat(sumWithPx(deltaHeight, paddingBottom));
725
+ heightFix = "padding-bottom: ".concat(sumWithPx(deltaHeight, paddingBottom) + (smallJumpFix || 0), ";");
679
726
  }
680
727
 
681
- var overflowFix = scrollHeight > clientHeight || scrollWidth > clientWidth ? "overflow: hidden" : "";
728
+ var overflowFix = scrollHeight > clientHeight || scrollWidth > clientWidth ? "overflow: hidden;" : "";
682
729
  var transform = (left !== 0 || top !== 0) && !skipTransform ? "transform: translate(".concat(left, "px,").concat(top, "px);") : '';
683
730
  var parentPaddingTopDelta = (parseInt((_oldSnap$parentStyle = oldSnap.parentStyle) === null || _oldSnap$parentStyle === void 0 ? void 0 : _oldSnap$parentStyle.paddingTop) || 0) - (parseInt((_newSnap$parentStyle = newSnap.parentStyle) === null || _newSnap$parentStyle === void 0 ? void 0 : _newSnap$parentStyle.paddingTop) || 0);
684
731
  var parentPaddingBottomDelta = (parseInt((_oldSnap$parentStyle2 = oldSnap.parentStyle) === null || _oldSnap$parentStyle2 === void 0 ? void 0 : _oldSnap$parentStyle2.paddingBottom) || 0) - (parseInt((_newSnap$parentStyle2 = newSnap.parentStyle) === null || _newSnap$parentStyle2 === void 0 ? void 0 : _newSnap$parentStyle2.paddingBottom) || 0);
685
732
  var oldMarginTop = (parseInt(oldSnap.marginTop) || 0) + parentPaddingTopDelta;
686
733
  var oldMarginBottom = (parseInt(oldSnap.marginBottom) || 0) + parentPaddingBottomDelta;
687
734
  var oldTransform = node.style.transform;
688
- return [utils.oneWayAnimation("\n ".concat(transform, "\n ").concat(heightFix, "\n ").concat(overflowFix, "\n margin-top: ").concat(oldMarginTop, "px;\n margin-bottom: ").concat(oldMarginBottom, "px;\n width: ").concat(oldSnap.width, "px;\n height: ").concat(oldSnap.height, "px;\n "), "\n ".concat(finalPadding, "\n ").concat(oldTransform ? "transform:".concat(oldTransform) : '', "\n ").concat(overflowFix, "\n margin-top:").concat(newSnap.marginTop || 0, "px;\n margin-bottom:").concat(newSnap.marginBottom || 0, "px;\n width: ").concat(newSnap.width, "px;\n height: ").concat(newSnap.height, "px;\n "))];
735
+ return [utils.oneWayAnimation("\n ".concat(transform, "\n ").concat(heightFix, "\n ").concat(overflowFix, "\n margin-top: ").concat(oldMarginTop, "px;\n margin-bottom: ").concat(oldMarginBottom, "px;\n width: ").concat(oldSnap.width, "px;\n height: ").concat(Math.max(0, oldSnap.height + (smallJumpFix || 0)), "px;\n "), "\n ".concat(finalPadding, "\n ").concat(oldTransform ? "transform:".concat(oldTransform, ";") : '', "\n ").concat(overflowFix, "\n margin-top:").concat(parseInt(newSnap.marginTop) || 0, "px;\n margin-bottom:").concat(parseInt(newSnap.marginBottom) || 0, "px;\n width: ").concat(newSnap.width, "px;\n height: ").concat(Math.max(0, newSnap.height + (smallJumpFix || 0)), "px;\n "))];
689
736
  } else {
690
737
  return [];
691
738
  }
@@ -1874,15 +1921,17 @@ var DialogContent = styled__default(function (props) {
1874
1921
  }).withConfig({
1875
1922
  displayName: "Dialog__DialogContent",
1876
1923
  componentId: "gai4ey-3"
1877
- })(["outline:none;width:100%;position:relative;min-height:5rem;", " ", " p{font-size:13px;}.expired-date{font-size:12px;color:", ";}"], function (props) {
1924
+ })(["outline:none;width:100%;position:relative;min-height:5rem;", " ", " p{font-size:14px;}"], function (props) {
1878
1925
  return props.icon && styled.css(["padding-right:8rem;min-height:6rem;"]);
1879
1926
  }, function (props) {
1880
1927
  return props.illustration && styled.css(["padding-right:15rem;", ""], utils.media.mobile(_templateObject3$1()));
1881
- }, utils.getColor('alert'));
1928
+ });
1882
1929
  var DialogTitle = styled__default.h2.withConfig({
1883
1930
  displayName: "Dialog__DialogTitle",
1884
1931
  componentId: "gai4ey-4"
1885
- })(["margin-bottom:1rem;padding-bottom:1rem;", ""], utils.media.mobile(_templateObject4()));
1932
+ })(["margin-bottom:1rem;padding-bottom:1rem;", " ", ""], function (props) {
1933
+ return props.fixTitleMargin && "\n padding-bottom: 0;\n ";
1934
+ }, utils.media.mobile(_templateObject4()));
1886
1935
  var DialogFooter = styled__default.div.withConfig({
1887
1936
  displayName: "Dialog__DialogFooter",
1888
1937
  componentId: "gai4ey-5"
@@ -1904,6 +1953,7 @@ var DialogAlwaysVisibleDiv = styled__default.div.withConfig({
1904
1953
  var Dialog = styled__default(React__default.forwardRef(function (_ref, outerRef) {
1905
1954
  var className = _ref.className,
1906
1955
  skipWrap = _ref.skipWrap,
1956
+ fixTitleMargin = _ref.fixTitleMargin,
1907
1957
  skipCloseIcon = _ref.skipCloseIcon,
1908
1958
  isLoading = _ref.isLoading,
1909
1959
  footer = _ref.footer,
@@ -1915,7 +1965,7 @@ var Dialog = styled__default(React__default.forwardRef(function (_ref, outerRef)
1915
1965
  auxiliarActions = _ref.auxiliarActions,
1916
1966
  _ref$container = _ref.container,
1917
1967
  container = _ref$container === void 0 ? true : _ref$container,
1918
- props = _objectWithoutProperties(_ref, ["className", "skipWrap", "skipCloseIcon", "isLoading", "footer", "Content", "children", "title", "illustration", "icon", "auxiliarActions", "container"]);
1968
+ props = _objectWithoutProperties(_ref, ["className", "skipWrap", "fixTitleMargin", "skipCloseIcon", "isLoading", "footer", "Content", "children", "title", "illustration", "icon", "auxiliarActions", "container"]);
1919
1969
 
1920
1970
  var ref = core.useEnsureRef(outerRef);
1921
1971
 
@@ -1923,7 +1973,9 @@ var Dialog = styled__default(React__default.forwardRef(function (_ref, outerRef)
1923
1973
  return React__default.createElement(React__default.Fragment, null, props.closeDialog && !skipCloseIcon && React__default.createElement(CloseIcon, {
1924
1974
  className: "JS-dialog-close",
1925
1975
  onClick: confirmCloseDialog
1926
- }), title && React__default.createElement(DialogTitle, null, utils.callIfFunction(title)));
1976
+ }), title && React__default.createElement(DialogTitle, {
1977
+ fixTitleMargin: true
1978
+ }, utils.callIfFunction(title)));
1927
1979
  };
1928
1980
 
1929
1981
  var content = React__default.createElement(React__default.Fragment, null, Content && React__default.createElement(DialogContent, {
@@ -1996,7 +2048,7 @@ var DialogErrorContent = function DialogErrorContent(_ref4) {
1996
2048
  return React__default.createElement(Dialog, {
1997
2049
  as: "div"
1998
2050
  }, closeDialog && React__default.createElement(CloseIcon, {
1999
- onClick: confirmCloseDialog
2051
+ onClick: closeDialog
2000
2052
  }), title && React__default.createElement(DialogTitle, null, title), React__default.createElement(DialogContent, {
2001
2053
  icon: "warning"
2002
2054
  }, content), React__default.createElement(DialogFooter, null, React__default.createElement(Button, {
@@ -2037,6 +2089,10 @@ var useDialogWithToggle = function useDialogWithToggle(dialog) {
2037
2089
  var WarningDialog = styled__default(function (_ref) {
2038
2090
  var content = _ref.content,
2039
2091
  closeDialog = _ref.closeDialog,
2092
+ leftButton = _ref.leftButton,
2093
+ additionalContent = _ref.additionalContent,
2094
+ title = _ref.title,
2095
+ rightButton = _ref.rightButton,
2040
2096
  className = _ref.className,
2041
2097
  _ref$icon = _ref.icon,
2042
2098
  icon = _ref$icon === void 0 ? "warning" : _ref$icon,
@@ -2046,19 +2102,35 @@ var WarningDialog = styled__default(function (_ref) {
2046
2102
  className: className
2047
2103
  }, React__default.createElement(MainIcon, {
2048
2104
  icon: icon
2049
- }), React__default.createElement("p", null, content), React__default.createElement(Button, {
2105
+ }), title && React__default.createElement(Title, {
2106
+ color: icon
2107
+ }, title), content && React__default.createElement(Content, {
2108
+ noTitle: !title
2109
+ }, content), additionalContent, utils.callIfFunction(leftButton, closeDialog), confirmLabel !== false && React__default.createElement(Button, {
2050
2110
  highlight: true,
2051
2111
  onClick: closeDialog
2052
- }, confirmLabel));
2112
+ }, confirmLabel), utils.callIfFunction(rightButton, closeDialog));
2053
2113
  }).withConfig({
2054
2114
  displayName: "WarningDialog",
2055
2115
  componentId: "sc-1jw779e-0"
2056
- })(["text-align:center;max-width:36rem;padding:2.5rem;p{font-size:16px;font-weight:500;max-width:27rem;margin:0 auto 2rem;}"]);
2116
+ })(["text-align:center;max-width:36rem;padding:2.5rem;", "{margin:0.5rem !important;}"], Button);
2117
+ var Title = styled__default.h3.withConfig({
2118
+ displayName: "WarningDialog__Title",
2119
+ componentId: "sc-1jw779e-1"
2120
+ })(["color:", ";font-weight:500;font-size:20px;"], function (props) {
2121
+ return props.color === 'warning' ? utils.getColor('alert') : props.color === 'success' ? utils.getColor('success') : utils.getColor('main');
2122
+ });
2123
+ var Content = styled__default.div.withConfig({
2124
+ displayName: "WarningDialog__Content",
2125
+ componentId: "sc-1jw779e-2"
2126
+ })(["font-size:15px;max-width:27rem;margin:0 auto 1.5rem;line-height:130%;", ""], function (props) {
2127
+ return props.noTitle && "\n font-weight: 500;\n font-size: 16px;\n ";
2128
+ });
2057
2129
  var MainIcon = styled__default(Icon).withConfig({
2058
2130
  displayName: "WarningDialog__MainIcon",
2059
- componentId: "sc-1jw779e-1"
2131
+ componentId: "sc-1jw779e-3"
2060
2132
  })(["color:", ";font-size:46px;display:block;margin-bottom:1.25rem;"], function (props) {
2061
- return props.icon === 'warning' ? utils.getColor('alert') : utils.getColor('main');
2133
+ return props.icon === 'warning' ? utils.getColor('alert') : props.icon === 'success' ? utils.getColor('success') : utils.getColor('main');
2062
2134
  });
2063
2135
  var useWarningDialog = function useWarningDialog() {
2064
2136
  return useDialogWithToggle(function (toggle) {
@@ -2073,8 +2145,12 @@ var _willUseSharedState = core.willUseSharedState(),
2073
2145
  useRenderDefaultWarningDialog = _willUseSharedState2[0],
2074
2146
  _setWarningDialog = _willUseSharedState2[2];
2075
2147
 
2076
- var setWarningDialog = function setWarningDialog(props) {
2077
- return _setWarningDialog(React__default.createElement(WarningDialog, _extends({}, props, {
2148
+ var setWarningDialog = function setWarningDialog(_ref2) {
2149
+ var _ref2$as = _ref2.as,
2150
+ Dialog = _ref2$as === void 0 ? WarningDialog : _ref2$as,
2151
+ props = _objectWithoutProperties(_ref2, ["as"]);
2152
+
2153
+ return _setWarningDialog(React__default.createElement(Dialog, _extends({}, props, {
2078
2154
  closeDialog: function closeDialog() {
2079
2155
  return _setWarningDialog(null);
2080
2156
  }
@@ -2162,6 +2238,81 @@ var FlipNotification = function FlipNotification(props) {
2162
2238
  }, props)));
2163
2239
  };
2164
2240
 
2241
+ var _willUseSharedState$2 = core.willUseSharedState([]),
2242
+ _willUseSharedState2$2 = _slicedToArray(_willUseSharedState$2, 3),
2243
+ useNotifications = _willUseSharedState2$2[0],
2244
+ setNotifications = _willUseSharedState2$2[2];
2245
+
2246
+ var openPersistentNotification = function openPersistentNotification(notification) {
2247
+ var newNotification = _objectSpread({
2248
+ priority: 0,
2249
+ type: "success"
2250
+ }, _isObject(notification) ? notification : {
2251
+ content: notification
2252
+ });
2253
+
2254
+ setNotifications(function (list) {
2255
+ var nextIndex = list.findIndex(function (n) {
2256
+ return n.priority < newNotification.priority;
2257
+ });
2258
+ return nextIndex < 0 ? _toConsumableArray(list).concat([newNotification]) : _toConsumableArray(list.slice(0, nextIndex)).concat([newNotification], _toConsumableArray(list.slice(nextIndex)));
2259
+ });
2260
+ return function () {
2261
+ return setNotifications(_without([newNotification]));
2262
+ };
2263
+ };
2264
+ var animation$1 = utils.oneWayAnimation('opacity:0; transform:translateY(-20px)', 'opacity:1;transform:translate(0)');
2265
+ var NotificationContainer$1 = styled__default.div.withConfig({
2266
+ displayName: "PersistentNotifications__NotificationContainer",
2267
+ componentId: "sc-1t7i0dh-0"
2268
+ })(["position:fixed;top:0;height:0;right:0;z-index:20;"]);
2269
+ var Notification$1 = styled__default.div.withConfig({
2270
+ displayName: "PersistentNotifications__Notification",
2271
+ componentId: "sc-1t7i0dh-1"
2272
+ })(["background:", ";position:relative;border-radius:7px;"], function (props) {
2273
+ return polished.transparentize(0.9, utils.getColor(props.type)(props));
2274
+ });
2275
+ var NotificationWrapper = styled__default.div.withConfig({
2276
+ displayName: "PersistentNotifications__NotificationWrapper",
2277
+ componentId: "sc-1t7i0dh-2"
2278
+ })(["background:white;margin-top:4rem;margin-right:0.75rem;margin-left:0.75rem;padding:5px;border-radius:10px;box-shadow:0 0 10px 0 rgba(0,0,0,0.1),0 1px 2px 1px rgba(0,0,0,0.15);max-width:360px;"]);
2279
+ var PersistentNotifications = function PersistentNotifications() {
2280
+ var _useNotifications = useNotifications(),
2281
+ _useNotifications2 = _slicedToArray(_useNotifications, 2),
2282
+ notifications = _useNotifications2[0],
2283
+ setNotifications = _useNotifications2[1];
2284
+
2285
+ if (!notifications.length) {
2286
+ return null;
2287
+ }
2288
+
2289
+ var closeMessage = function closeMessage() {
2290
+ return setNotifications(function (list) {
2291
+ return list.slice(1);
2292
+ });
2293
+ };
2294
+
2295
+ var _notifications$ = notifications[0],
2296
+ content = _notifications$.content,
2297
+ type = _notifications$.type;
2298
+ return React__default.createElement(core.Fill, {
2299
+ name: "PersistentNotifications"
2300
+ }, React__default.createElement(FlipNotification$1, {
2301
+ type: type
2302
+ }, utils.callIfFunction(content, closeMessage)));
2303
+ };
2304
+
2305
+ var FlipNotification$1 = function FlipNotification(props) {
2306
+ var ref = React.useRef();
2307
+ useFlipAnimation(ref, animation$1);
2308
+ return React__default.createElement(NotificationContainer$1, {
2309
+ className: "JS-fix-dialog-scroll",
2310
+ ref: ref
2311
+ }, React__default.createElement(NotificationWrapper, null, React__default.createElement(Notification$1, _extends({
2312
+ id: "js-share-notification"
2313
+ }, props))));
2314
+ };
2315
+
2165
2316
  var Placeholder = styled__default.span.withConfig({
2166
2317
  displayName: "usePositioning__Placeholder",
2167
2318
  componentId: "sc-1m4912o-0"
@@ -2572,14 +2723,18 @@ function (_React$Component) {
2572
2723
  return;
2573
2724
  }
2574
2725
 
2575
- morph(oldItem.domNode, formatAnimation(removeAnimation || animation, timing), function () {
2726
+ new Promise(function (res) {
2727
+ morph(oldItem.domNode, formatAnimation(removeAnimation || animation, timing), res);
2728
+ setTimeout(res, 1500);
2729
+ }).then(function () {
2576
2730
  oldItem.domNode.remove();
2577
2731
  });
2578
2732
  });
2579
2733
  }
2580
2734
 
2581
2735
  var rectAnimation = getClientRectAnimation(oldSnap.parent, newSnap.parent, {
2582
- skipTransform: true
2736
+ skipTransform: true,
2737
+ smallJumpFix: _this.props.smallJumpFix
2583
2738
  });
2584
2739
  var endEffect = utils.callIfFunction(effect, newSnap.parent.domNode, {
2585
2740
  newSnap: newSnap,
@@ -2872,7 +3027,7 @@ function (_React$Component2) {
2872
3027
 
2873
3028
  _this2.addProps = function (children, eventHandlers, activeIndex, extraProps) {
2874
3029
  return children.map(function (c, index) {
2875
- return reactHotLoader.areComponentsEqual(c.type, DraggableItem) ? React__default.cloneElement(c, {
3030
+ return c.type === DraggableItem ? React__default.cloneElement(c, {
2876
3031
  isDragging: activeIndex === index,
2877
3032
  dragIndex: index,
2878
3033
  droppable: _assertThisInitialized(_assertThisInitialized(_this2)),
@@ -4248,9 +4403,9 @@ var _willUseLayers$1 = core.willUseLayers(),
4248
4403
 
4249
4404
  var contextMenuLayersQuantity = contextMenuLayersSize;
4250
4405
 
4251
- var _willUseSharedState$2 = core.willUseSharedState(),
4252
- _willUseSharedState2$2 = _slicedToArray(_willUseSharedState$2, 1),
4253
- useContextMenuSharedState = _willUseSharedState2$2[0];
4406
+ var _willUseSharedState$3 = core.willUseSharedState(),
4407
+ _willUseSharedState2$3 = _slicedToArray(_willUseSharedState$3, 1),
4408
+ useContextMenuSharedState = _willUseSharedState2$3[0];
4254
4409
 
4255
4410
  var ContextMenuComponent = React.forwardRef(function (_ref2, unesuredRef) {
4256
4411
  var children = _ref2.children,
@@ -4339,7 +4494,7 @@ var ContextMenuComponent = React.forwardRef(function (_ref2, unesuredRef) {
4339
4494
  var getTotalKeyboardItems = function getTotalKeyboardItems(children) {
4340
4495
  var max = 0;
4341
4496
  React__default.Children.forEach(children, function (e) {
4342
- return max += e && (!styled.isStyledComponent(e.type) && reactHotLoader.areComponentsEqual(e.type, Li) || e.type.isKeyboardNavigable || (reactHotLoader.areComponentsEqual(e.type, StickyContainer) ? getTotalKeyboardItems(e.props.children) : 0));
4497
+ return max += e && (!styled.isStyledComponent(e.type) && e.type === Li || e.type.isKeyboardNavigable || (areComponentsEqual(e.type, StickyContainer) ? getTotalKeyboardItems(e.props.children) : 0));
4343
4498
  });
4344
4499
  return max;
4345
4500
  };
@@ -4354,14 +4509,14 @@ var ContextMenuComponent = React.forwardRef(function (_ref2, unesuredRef) {
4354
4509
  var indexOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
4355
4510
  var i = 0;
4356
4511
  return React__default.Children.map(children, function (child, j) {
4357
- return child ? !styled.isStyledComponent(child.type) && !reactIs.isMemo(child.type) && reactHotLoader.areComponentsEqual(child.type, Li) || child.type.isKeyboardNavigable ? React__default.cloneElement(child, {
4512
+ return child ? !styled.isStyledComponent(child.type) && !reactIs.isMemo(child.type) && areComponentsEqual(child.type, Li) || child.type.isKeyboardNavigable ? React__default.cloneElement(child, {
4358
4513
  hover: hoverCursor === i + indexOffset && layerIndex === layerCursor,
4359
4514
  hoverCursor: hoverCursor,
4360
4515
  index: indexOffset + i++,
4361
4516
  setCursorOnHover: setCursorOnHover,
4362
4517
  emitter: itemsEmitter,
4363
4518
  layerIndex: layerIndex
4364
- }) : reactHotLoader.areComponentsEqual(child.type, StickyContainer) ? React__default.cloneElement(child, _objectSpread({}, child.props, {
4519
+ }) : areComponentsEqual(child.type, StickyContainer) ? React__default.cloneElement(child, _objectSpread({}, child.props, {
4365
4520
  children: formatChildren(child.props.children, i + indexOffset)
4366
4521
  })) : child : child;
4367
4522
  });
@@ -4373,19 +4528,13 @@ var ContextMenuComponent = React.forwardRef(function (_ref2, unesuredRef) {
4373
4528
  e.target.dispatchEvent(new MouseEvent('mousemove', {
4374
4529
  bubbles: true
4375
4530
  }));
4376
- var passedResistance = false;
4377
- return [function (e, nextPos) {
4531
+ return function (e, nextPos) {
4378
4532
  var delta = prevPos.clientY - nextPos.clientY;
4379
4533
 
4380
4534
  if (Math.abs(delta) > 10) {
4381
- passedResistance = true;
4382
4535
  setCursorOnHover(-1);
4383
4536
  }
4384
- }, function (e, finalPos) {
4385
- if (!passedResistance) {
4386
- e.target.click();
4387
- }
4388
- }];
4537
+ };
4389
4538
  });
4390
4539
  return React__default.createElement(ContextListMenu, _extends({
4391
4540
  "data-drag": false,
@@ -4442,10 +4591,126 @@ var ContextMenu = React.forwardRef(function (_ref3, ref) {
4442
4591
  });
4443
4592
  ContextMenu.ListItem = ListItem;
4444
4593
 
4594
+ var scrollWidth = function () {
4595
+ if (!window.document) return 0;
4596
+ var html = document.documentElement;
4597
+ var oldOverflow = html.style.overflowY;
4598
+ html.style.overflowY = 'scroll';
4599
+ var width = window.innerWidth - html.clientWidth;
4600
+ html.style.overflowY = oldOverflow;
4601
+ return width;
4602
+ }();
4603
+
4604
+ var callIfFunction = function callIfFunction(prop) {
4605
+ for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
4606
+ args[_key6 - 1] = arguments[_key6];
4607
+ }
4608
+
4609
+ return typeof prop === "function" ? prop.apply(void 0, args) : prop;
4610
+ };
4611
+
4612
+ function _templateObject$6() {
4613
+ var data = _taggedTemplateLiteral(["\n ", ""]);
4614
+
4615
+ _templateObject$6 = function _templateObject() {
4616
+ return data;
4617
+ };
4618
+
4619
+ return data;
4620
+ }
4621
+
4622
+ var checkCustomScreenWidth = function checkCustomScreenWidth(sizeParis, customWidth) {
4623
+ var currentWidth = callIfFunction(customWidth);
4624
+ return !sizeParis.find(function (_ref4) {
4625
+ var _ref5 = _slicedToArray(_ref4, 2),
4626
+ size = _ref5[0],
4627
+ type = _ref5[1];
4628
+
4629
+ if (type === "min-width") {
4630
+ return currentWidth < size;
4631
+ }
4632
+
4633
+ if (type === "max-width") {
4634
+ return currentWidth > size;
4635
+ }
4636
+ });
4637
+ };
4638
+
4639
+ var media = function media() {
4640
+ for (var _len3 = arguments.length, sizePairs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
4641
+ sizePairs[_key3] = arguments[_key3];
4642
+ }
4643
+
4644
+ return function () {
4645
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
4646
+ args[_key4] = arguments[_key4];
4647
+ }
4648
+
4649
+ return styled.css(["", ""], function (props) {
4650
+ var _props$theme, _props$theme2;
4651
+
4652
+ return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.overrideMediaWidth) ? checkCustomScreenWidth(sizePairs, (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.overrideMediaWidth) ? styled.css.apply(void 0, args) : "" : styled.css(["@media ", "{", "}"], sizePairs.map(function (_ref6) {
4653
+ var _ref7 = _slicedToArray(_ref6, 2),
4654
+ size = _ref7[0],
4655
+ type = _ref7[1];
4656
+
4657
+ return "(".concat(type, ": ").concat(size + scrollWidth, "px)");
4658
+ }).join(' and '), styled.css.apply(void 0, args));
4659
+ });
4660
+ };
4661
+ };
4662
+ media.mobile = media([600, 'max-width']);
4663
+
4664
+ media.between = function (min, max) {
4665
+ return media([min, 'min-width'], [max, 'max-width']);
4666
+ };
4667
+
4668
+ media.max = function (n) {
4669
+ return media([n, 'max-width']);
4670
+ };
4671
+
4672
+ media.min = function (n) {
4673
+ return media([n, 'min-width']);
4674
+ };
4675
+
4676
+ media.desktop = media([601, 'min-width']);
4677
+
4678
+ var getFrameOffset = function getFrameOffset(i, total) {
4679
+ return Math.round(i * 100 / (total - 1));
4680
+ };
4681
+
4682
+ var emotion = createEmotion({
4683
+ nonce: __webpack_nonce__
4684
+ });
4685
+ var oneWayAnimation = function oneWayAnimation() {
4686
+ for (var _len5 = arguments.length, frames = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
4687
+ frames[_key5] = arguments[_key5];
4688
+ }
4689
+
4690
+ return emotion.keyframes(_templateObject$6(), frames.map(function (frame, i) {
4691
+ return !frame ? '' : "".concat(getFrameOffset(i, frames.length), "% {\n ").concat(frame, "\n }");
4692
+ }));
4693
+ };
4694
+ var animationTiming = function animationTiming(props) {
4695
+ return function () {
4696
+ for (var _len7 = arguments.length, animations = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
4697
+ animations[_key7] = arguments[_key7];
4698
+ }
4699
+
4700
+ return animations.filter(function (_) {
4701
+ return _;
4702
+ }).map(function (_) {
4703
+ return _ + ' ' + props;
4704
+ }).join(',');
4705
+ };
4706
+ };
4707
+ var identityTranslateFrames = oneWayAnimation('transform: translateY(0);', 'transform: translateY(0);');
4708
+ var identityOpacityFrames = oneWayAnimation('opacity: 1;', 'opacity:1;');
4709
+
4445
4710
  var LoadingBar = styled__default.div.withConfig({
4446
4711
  displayName: "PageLoader__LoadingBar",
4447
4712
  componentId: "sc-96jeob-0"
4448
- })(["width:0%;height:3px;position:fixed;background:#84D359;top:0;left:0;z-index:99999;box-shadow:0 0 6px 0 rgba(0,0,0,0.5);", " ", " "], function (props) {
4713
+ })(["width:0%;height:3px;position:fixed;background:#84D359;top:0;left:0;z-index:99999;box-shadow:0 0 6px 0 rgba(0,0,0,0.5);", " ", ""], function (props) {
4449
4714
  return props.loading && "\n width: 70%;\n transition: 1.5s width linear;\n ";
4450
4715
  }, function (props) {
4451
4716
  return props.closing && "\n width: 100%;\n transition: 0.3s ease-in;\n ";
@@ -4465,6 +4730,18 @@ var PageLoader = function PageLoader(_ref) {
4465
4730
  closing: loader.closing
4466
4731
  });
4467
4732
  };
4733
+ var animation$2 = utils.oneWayAnimation('width: 70%;', 'width: 100%');
4734
+ var SuspenseLoadingBar = function SuspenseLoadingBar() {
4735
+ var ref = React__default.useRef();
4736
+ useFlipLeave(ref, animation$2, {
4737
+ reverse: false,
4738
+ timing: animationTiming('0.3s ease-in')
4739
+ });
4740
+ return React__default.createElement(LoadingBar, {
4741
+ ref: ref,
4742
+ loading: true
4743
+ });
4744
+ };
4468
4745
 
4469
4746
  var isNodeJunction = function isNodeJunction(nextNode) {
4470
4747
  return nextNode && !nextNode.hasChangedLine && nextNode.words[0] !== '';
@@ -4767,14 +5044,17 @@ var DEFAULT_ANIMATION = utils.oneWayAnimation("opacity: 1;", "opacity: 0;");
4767
5044
  var BlockContainer$1 = styled__default.div.withConfig({
4768
5045
  displayName: "TransitionDiv__BlockContainer",
4769
5046
  componentId: "sc-1sh2xah-0"
4770
- })(["position:relative;"]);
5047
+ })(["", " position:relative;"], function (props) {
5048
+ return props.inline ? 'display: inline-block; ' : '';
5049
+ });
4771
5050
  var TransitionDiv = function TransitionDiv(_ref) {
4772
5051
  var children = _ref.children,
4773
5052
  animation = _ref.animation,
4774
5053
  skipChromeFix = _ref.skipChromeFix,
4775
5054
  className = _ref.className,
4776
5055
  block = _ref.block,
4777
- rest = _objectWithoutProperties(_ref, ["children", "animation", "skipChromeFix", "className", "block"]);
5056
+ inline = _ref.inline,
5057
+ rest = _objectWithoutProperties(_ref, ["children", "animation", "skipChromeFix", "className", "block", "inline"]);
4778
5058
 
4779
5059
  var blockRef = React.useRef();
4780
5060
 
@@ -4789,18 +5069,21 @@ var TransitionDiv = function TransitionDiv(_ref) {
4789
5069
  };
4790
5070
 
4791
5071
  var content = children ? React__default.createElement(FlipList, _extends({
5072
+ smallJumpFix: inline && -3,
4792
5073
  effect: overflowEffect,
4793
5074
  skipChromeFix: skipChromeFix,
4794
5075
  animation: animation || DEFAULT_ANIMATION
4795
5076
  }, rest), [React__default.createElement("div", {
4796
- className: block ? "" : className,
5077
+ className: block || inline ? "" : className,
4797
5078
  key: "first"
4798
5079
  }, children)]) : React__default.createElement(FlipList, _extends({
5080
+ smallJumpFix: inline && -3,
4799
5081
  effect: overflowEffect,
4800
5082
  skipChromeFix: skipChromeFix,
4801
5083
  animation: animation || DEFAULT_ANIMATION
4802
5084
  }, rest), []);
4803
- return block ? React__default.createElement(BlockContainer$1, {
5085
+ return block || inline ? React__default.createElement(BlockContainer$1, {
5086
+ inline: inline,
4804
5087
  ref: blockRef,
4805
5088
  className: className
4806
5089
  }, content) : content;
@@ -5067,10 +5350,10 @@ var Image = React.forwardRef(function (_ref, ref) {
5067
5350
  }));
5068
5351
  });
5069
5352
 
5070
- function _templateObject$6() {
5353
+ function _templateObject$7() {
5071
5354
  var data = _taggedTemplateLiteral(["\n @supports (position: sticky) {\n top: 0;\n margin-right: -0.75rem;\n }\n "]);
5072
5355
 
5073
- _templateObject$6 = function _templateObject() {
5356
+ _templateObject$7 = function _templateObject() {
5074
5357
  return data;
5075
5358
  };
5076
5359
 
@@ -5079,7 +5362,7 @@ function _templateObject$6() {
5079
5362
  var DialogWithImageHeader = styled__default(Dialog).withConfig({
5080
5363
  displayName: "DialogWithImageHeader",
5081
5364
  componentId: "sc-1f1ry4g-0"
5082
- })(["max-width:51rem;", "{background:", ";text-shadow:none;color:rgba(120,120,120,1);font-size:20px;box-shadow:rgba(0,0,0,0.2) 0px 1px 3px 0px,rgba(0,0,0,0.05) 0px 0px 0px 1px;width:36px;height:36px;line-height:36px;transition:0.1s ease-out;:hover{background-color:rgb(230,230,230);}:active{background-color:rgb(220,220,220);transition:0s ease-out;}@supports (position:sticky){position:sticky;top:-2.5rem;right:0rem;float:right;margin-right:-1.25rem;margin-top:0.75rem;}", "}"], CloseIcon, utils.getColor('gray240'), utils.media.mobile(_templateObject$6()));
5365
+ })(["max-width:51rem;", "{background:", ";text-shadow:none;color:rgba(120,120,120,1);font-size:20px;box-shadow:rgba(0,0,0,0.2) 0px 1px 3px 0px,rgba(0,0,0,0.05) 0px 0px 0px 1px;width:36px;height:36px;line-height:36px;transition:0.1s ease-out;:hover{background-color:rgb(230,230,230);}:active{background-color:rgb(220,220,220);transition:0s ease-out;}@supports (position:sticky){position:sticky;top:-2.5rem;right:0rem;float:right;margin-right:-1.25rem;margin-top:0.75rem;}", "}"], CloseIcon, utils.getColor('gray240'), utils.media.mobile(_templateObject$7()));
5083
5366
 
5084
5367
  function _templateObject2$5() {
5085
5368
  var data = _taggedTemplateLiteral(["\n min-height: 100%;\n overflow: hidden;\n "]);
@@ -5091,10 +5374,10 @@ function _templateObject2$5() {
5091
5374
  return data;
5092
5375
  }
5093
5376
 
5094
- function _templateObject$7() {
5377
+ function _templateObject$8() {
5095
5378
  var data = _taggedTemplateLiteral(["\n display:block;\n position:fixed;\n top:0;\n left:0;\n bottom:0;\n z-index:1000;\n transition: 0.25s transform ease-out;\n background-color: ", ";\n box-shadow: -5px 0 20px 5px rgba(0,0,0,0.4);\n border-radius: 0;\n ", "\n "]);
5096
5379
 
5097
- _templateObject$7 = function _templateObject() {
5380
+ _templateObject$8 = function _templateObject() {
5098
5381
  return data;
5099
5382
  };
5100
5383
 
@@ -5105,7 +5388,7 @@ var SideMenu = styled__default.div.withConfig({
5105
5388
  componentId: "suvg9r-0"
5106
5389
  })(["background-color:", ";border-top-left-radius:10px;border-bottom-left-radius:10px;width:19rem;flex-shrink:0;padding:1.25rem 0;", " ", ""], utils.getColor('gray240'), function (props) {
5107
5390
  return !props.visibleOnDesktop && 'display:none;';
5108
- }, utils.media.mobile(_templateObject$7(), utils.getColor('gray240'), function (props) {
5391
+ }, utils.media.mobile(_templateObject$8(), utils.getColor('gray240'), function (props) {
5109
5392
  return !props.isOpen && "\n transform: translateX(-100%);\n box-shadow: none;\n ";
5110
5393
  }));
5111
5394
  var DialogTabMenu = styled__default.ul.withConfig({
@@ -5276,6 +5559,7 @@ exports.ListItem = ListItem;
5276
5559
  exports.ListMenu = ListMenu;
5277
5560
  exports.ListSeparator = ListSeparator;
5278
5561
  exports.Loading = Loading;
5562
+ exports.LoadingBar = LoadingBar;
5279
5563
  exports.LoadingDiv = LoadingDiv;
5280
5564
  exports.MENU_TAB = MENU_TAB;
5281
5565
  exports.MobileBubbleDialog = MobileBubbleDialog;
@@ -5283,13 +5567,16 @@ exports.Modal = Modal;
5283
5567
  exports.ModalContainer = ModalContainer;
5284
5568
  exports.Notifications = Notifications;
5285
5569
  exports.PageLoader = PageLoader;
5570
+ exports.PersistentNotifications = PersistentNotifications;
5286
5571
  exports.Popup = Popup;
5287
5572
  exports.Reposition = Reposition;
5288
5573
  exports.SideMenu = SideMenu;
5289
5574
  exports.SimpleLi = SimpleLi;
5290
5575
  exports.SplitColumnsContainer = SplitColumnsContainer;
5291
5576
  exports.StickyContainer = StickyContainer;
5577
+ exports.SuspenseLoadingBar = SuspenseLoadingBar;
5292
5578
  exports.SwitchDiv = SwitchDiv;
5579
+ exports.TextButton = TextButton;
5293
5580
  exports.Tooltip = Tooltip;
5294
5581
  exports.TransitionDiv = TransitionDiv;
5295
5582
  exports.WarningDialog = WarningDialog;
@@ -5304,6 +5591,7 @@ exports.formatAnimation = formatAnimation;
5304
5591
  exports.getClientRectAnimation = getClientRectAnimation;
5305
5592
  exports.getDialogLayersSize = getDialogLayersSize;
5306
5593
  exports.morph = morph;
5594
+ exports.openPersistentNotification = openPersistentNotification;
5307
5595
  exports.preventDialogPop = preventDialogPop;
5308
5596
  exports.removeWindowScroll = removeWindowScroll;
5309
5597
  exports.setNotification = setNotification;
package/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "@startlibs/components",
3
- "version": "1.0.0-alpha-8a",
3
+ "version": "1.0.0-alpha-8d",
4
4
  "description": "Startlibs Components",
5
5
  "main": "lib/index.js",
6
6
  "sideEffects": false,
7
7
  "source": true,
8
8
  "peerDependencies": {
9
9
  "lodash": "^4.17.11",
10
- "react": "^16.8",
11
- "react-dom": "^16.8",
12
- "react-hot-loader": "^4.3.5",
10
+ "react": "^18.0",
11
+ "react-dom": "^18.0",
13
12
  "styled-components": "^5.2.0"
14
13
  },
15
14
  "devDependencies": {