@taikai/rocket-kit 3.0.8 → 3.0.10-beta.1

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.
@@ -8,6 +8,7 @@ import ReactPlayer from 'react-player';
8
8
  import { v4 } from 'uuid';
9
9
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
10
10
  import ReactPaginate from 'react-paginate';
11
+ import { InView } from 'react-intersection-observer';
11
12
  import throttle from 'lodash.throttle';
12
13
  import ReactDOM from 'react-dom';
13
14
  import Tabs from 'react-responsive-tabs';
@@ -5396,80 +5397,106 @@ const FieldWidthButton = ({
5396
5397
  })));
5397
5398
  };
5398
5399
 
5399
- const Wrapper$f = /*#__PURE__*/_styled.div.withConfig({
5400
- displayName: "styles__Wrapper",
5401
- componentId: "sc-znznmm-0"
5402
- })(["display:flex;align-items:center;ul.menu{width:0;animation:showAnimation 1s forwards;animation-delay:0.5s;overflow:hidden;}@keyframes showAnimation{0%{width:0%;}100%{width:100%;}}ul{margin:0;max-width:max-content;padding:0;&.menu{display:flex;li:not(:last-child){margin-right:", ";}}li{position:relative;list-style:none;a{display:flex;align-items:center;padding:", ";color:", ";text-transform:capitalize;text-decoration:none;white-space:nowrap;transition-duration:", ";svg{margin-right:", ";width:auto;height:", ";min-width:", ";fill:", ";transition-duration:", ";}&:hover{color:", ";svg{fill:", ";}}}&.active{font-weight:", ";a{color:", ";pointer-events:none;svg{fill:", ";}}}}}"], /*#__PURE__*/rem('10px'), /*#__PURE__*/rem('10px'), colors.black, misc.transitionDuration, /*#__PURE__*/rem('5px'), /*#__PURE__*/rem('24px'), /*#__PURE__*/rem('24px'), colors.grey200, misc.transitionDuration, props => props.customColor ? props.customColor : colors.purple500, props => props.customColor ? props.customColor : colors.purple500, typography.medium, props => props.customColor ? props.customColor : colors.purple500, props => props.customColor ? props.customColor : colors.purple500);
5403
- const More = /*#__PURE__*/_styled.div.withConfig({
5404
- displayName: "styles__More",
5405
- componentId: "sc-znznmm-1"
5406
- })(["position:relative;display:none;&.hide{display:initial;}ul{position:absolute;right:0;border:", " solid ", ";border-radius:", ";background-color:", ";margin-top:", ";padding:0;-moz-box-shadow:", ";-webkit-box-shadow:", ";box-shadow:", ";z-index:1;overflow-x:hidden;overflow-y:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;&.more{display:none;}&.is-open{display:inherit;}li{list-style:none;transition-duration:", ";&:hover{background-color:", ";cursor:pointer;a{color:", ";svg{fill:", ";}}}&:first-child{border-radius:", " ", " 0 0;}&:last-child{border-radius:0 0 ", " ", ";}a{width:100%;height:100%;padding:", ";}}}"], field.borderWidth, field.borderColor, field.borderRadius, field.backgroundColor, /*#__PURE__*/rem('5px'), field.boxShadow, field.boxShadow, field.boxShadow, misc.transitionDuration, field.borderColor, colors.black, colors.black, field.borderRadius, field.borderRadius, field.borderRadius, field.borderRadius, /*#__PURE__*/rem('15px'));
5407
-
5408
- const HorizontalNav = props => {
5409
- const [showMore, setShowMore] = useState(false);
5410
- const moreMenu = useRef(null);
5411
- const visibleMenuRef = useRef(null);
5400
+ function styleInject(css, ref) {
5401
+ if ( ref === void 0 ) ref = {};
5402
+ var insertAt = ref.insertAt;
5403
+
5404
+ if (!css || typeof document === 'undefined') { return; }
5405
+
5406
+ var head = document.head || document.getElementsByTagName('head')[0];
5407
+ var style = document.createElement('style');
5408
+ style.type = 'text/css';
5409
+
5410
+ if (insertAt === 'top') {
5411
+ if (head.firstChild) {
5412
+ head.insertBefore(style, head.firstChild);
5413
+ } else {
5414
+ head.appendChild(style);
5415
+ }
5416
+ } else {
5417
+ head.appendChild(style);
5418
+ }
5419
+
5420
+ if (style.styleSheet) {
5421
+ style.styleSheet.cssText = css;
5422
+ } else {
5423
+ style.appendChild(document.createTextNode(css));
5424
+ }
5425
+ }
5426
+
5427
+ var css_248z = ".styles-module_wrapper__Q2-ac {\n position: relative;\n height: 5rem; /* 80px */\n display: flex;\n align-items: center;\n}\n\n.styles-module_wrapper__Q2-ac > div {\n display: flex;\n overflow-x: auto;\n scrollbar-width: none;\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n}\n\n.styles-module_wrapper__Q2-ac > div::-webkit-scrollbar {\n display: none;\n}\n\n.styles-module_wrapper__Q2-ac ul {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n}\n\n.styles-module_wrapper__Q2-ac ul li:not(:last-child) {\n margin-right: 0.625rem; /* 10px */\n}\n\n.styles-module_wrapper__Q2-ac ul li:last-child {\n margin-right: 0.0625rem; /* 1px */\n}\n\n.styles-module_wrapper__Q2-ac ul li a {\n display: flex;\n align-items: center;\n padding: 0.625rem; /* 10px */\n color: var(--black);\n text-transform: capitalize;\n text-decoration: none;\n white-space: nowrap;\n transition-duration: var(--transitionDurationDefault);\n}\n\n.styles-module_wrapper__Q2-ac ul li a svg {\n margin-right: 0.3125rem; /* 5px */\n width: auto;\n height: 1.5rem; /* 24px */\n min-width: 1.5rem; /* 24px */\n fill: var(--grey200);\n transition-duration: var(--transitionDurationDefault);\n}\n\n.styles-module_wrapper__Q2-ac ul li a:hover {\n color: var(--purple500);\n}\n\n.styles-module_wrapper__Q2-ac ul li a:hover svg {\n fill: var(--purple500);\n}\n\n.styles-module_wrapper__Q2-ac ul li.styles-module_active__0DuQB {\n font-weight: var(--fontWeightSemiBold);\n}\n\n.styles-module_wrapper__Q2-ac ul li.styles-module_active__0DuQB a {\n color: var(--purple500);\n pointer-events: none;\n}\n\n.styles-module_wrapper__Q2-ac ul li.styles-module_active__0DuQB a svg {\n fill: var(--purple500);\n}\n\n.styles-module_wrapper__Q2-ac button {\n position: absolute;\n top: 0;\n border-radius: 0;\n height: 100%;\n border-style: solid;\n border-color: var(--grey150);\n}\n\n.styles-module_wrapper__Q2-ac button:hover {\n background-color: var(--white);\n}\n\n.styles-module_wrapper__Q2-ac button.styles-module_back__AE3bY {\n left: 0;\n border-right-width: 0.0625rem; /* 1px */\n}\n\n.styles-module_wrapper__Q2-ac button.styles-module_forward__sOwh3 {\n right: 0;\n border-left-width: 0.0625rem; /* 1px */\n}\n";
5428
+ var styles = {"wrapper":"styles-module_wrapper__Q2-ac","active":"styles-module_active__0DuQB","back":"styles-module_back__AE3bY","forward":"styles-module_forward__sOwh3"};
5429
+ styleInject(css_248z);
5430
+
5431
+ function scroll(container, direction, speed, distance, step) {
5432
+ let scrollAmount = 0;
5433
+ const slideTimer = setInterval(function () {
5434
+ if (container && direction === 'left') {
5435
+ container.scrollLeft -= step;
5436
+ } else {
5437
+ container ? container.scrollLeft += step : null;
5438
+ }
5439
+ scrollAmount += step;
5440
+ if (scrollAmount >= distance) {
5441
+ window.clearInterval(slideTimer);
5442
+ }
5443
+ }, speed);
5444
+ }
5445
+ function HorizontalNav(props) {
5412
5446
  const {
5413
- className = 'horizontal-nav',
5414
- customColor = '',
5415
- items,
5416
- startsOpen = false
5447
+ id = 'horizontal-nav',
5448
+ items
5417
5449
  } = props;
5418
- const {
5419
- ref,
5420
- isVisible,
5421
- setIsVisible
5422
- } = useVisible(startsOpen);
5423
- useEffect(() => {
5424
- if (!ref || !ref.current) return;
5425
- const visible = document.querySelector('ul.menu').getElementsByTagName('li');
5426
- const more = document.querySelector('.more').getElementsByTagName('li');
5427
- const moreVisibility = () => more.length > 0 ? setShowMore(true) : setShowMore(false);
5428
- const removeItem = () => {
5429
- if (visible.length === 1) return;
5430
- let last = visible[visible.length - 1];
5431
- document.querySelector('ul.more').prepend(last);
5432
- };
5433
- const addItem = () => {
5434
- if (more.length === 0) return;
5435
- let first = more[0];
5436
- document.querySelector('ul.menu').append(first);
5437
- };
5438
- const checkOverflow = () => {
5439
- moreVisibility();
5440
- for (let i = 0; i < visible.length + 20; i++) {
5441
- visibleMenuRef.current.scrollWidth + 50 > ref.current.offsetWidth ? removeItem() : addItem();
5442
- }
5443
- };
5444
- checkOverflow();
5445
- if (typeof window !== 'undefined') {
5446
- moreVisibility();
5447
- window.addEventListener('resize', checkOverflow);
5448
- return () => window.removeEventListener('resize', checkOverflow);
5449
- }
5450
- return;
5451
- }, [ref]);
5452
- return /*#__PURE__*/React.createElement(Wrapper$f, {
5453
- ref: ref,
5454
- className: className,
5455
- customColor: customColor
5450
+ const [showBackButton, setShowBackButton] = useState(false);
5451
+ const [showForwardButton, setShowForwardButton] = useState(true);
5452
+ const forward = () => {
5453
+ const container = document.getElementById(id);
5454
+ scroll(container, 'right', 10, 200, 10);
5455
+ };
5456
+ const back = () => {
5457
+ const container = document.getElementById(id);
5458
+ scroll(container, 'left', 10, 200, 10);
5459
+ };
5460
+ return /*#__PURE__*/React.createElement("div", {
5461
+ className: styles.wrapper
5462
+ }, showBackButton && /*#__PURE__*/React.createElement(Button, {
5463
+ className: styles.back,
5464
+ variant: "solid",
5465
+ color: "white",
5466
+ txtColor: "black",
5467
+ icon: "caret-left",
5468
+ action: back
5469
+ }), /*#__PURE__*/React.createElement("div", {
5470
+ id: id
5456
5471
  }, /*#__PURE__*/React.createElement("ul", {
5457
- className: "menu",
5458
- ref: visibleMenuRef
5459
- }, items), /*#__PURE__*/React.createElement(More, {
5460
- className: showMore ? 'hide' : '',
5461
- ref: moreMenu
5462
- }, /*#__PURE__*/React.createElement(Button, {
5463
- variant: "text",
5464
- color: "dark",
5465
- icon: "menuVert",
5466
- action: () => {
5467
- setIsVisible(!isVisible);
5472
+ className: "menu"
5473
+ }, items.map((item, index) =>
5474
+ /*#__PURE__*/
5475
+ // @ts-ignore
5476
+ React.createElement(InView, {
5477
+ key: index,
5478
+ as: "li",
5479
+ className: item.active ? styles.active : undefined,
5480
+ threshold: 1,
5481
+ onChange: inView => {
5482
+ if (index === 0 && inView) setShowBackButton(false);
5483
+ if (index === 0 && !inView) setShowBackButton(true);
5484
+ if (index === items.length - 1 && inView) setShowForwardButton(false);
5485
+ if (index === items.length - 1 && !inView) setShowForwardButton(true);
5468
5486
  }
5469
- }), /*#__PURE__*/React.createElement("ul", {
5470
- className: isVisible ? 'more is-open' : 'more'
5471
- })));
5472
- };
5487
+ }, /*#__PURE__*/React.createElement("a", {
5488
+ href: item.url
5489
+ }, item.icon && /*#__PURE__*/React.createElement(Icon, {
5490
+ icon: item.icon
5491
+ }), item.label))))), showForwardButton && /*#__PURE__*/React.createElement(Button, {
5492
+ className: styles.forward,
5493
+ variant: "solid",
5494
+ color: "white",
5495
+ txtColor: "black",
5496
+ icon: "caret-right",
5497
+ action: forward
5498
+ }));
5499
+ }
5473
5500
 
5474
5501
  const ModalOverlay = /*#__PURE__*/_styled.div.withConfig({
5475
5502
  displayName: "styles__ModalOverlay",
@@ -5512,7 +5539,7 @@ const Modal = props => {
5512
5539
  return;
5513
5540
  }
5514
5541
  }, []);
5515
- return isShowing ? /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalOverlay, {
5542
+ return isShowing ? ( /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalOverlay, {
5516
5543
  zIndex: zIndex
5517
5544
  }), /*#__PURE__*/React.createElement(ModalWrapper, {
5518
5545
  "aria-modal": true,
@@ -5534,7 +5561,7 @@ const Modal = props => {
5534
5561
  })), children, footer && /*#__PURE__*/React.createElement(ModalFooter, {
5535
5562
  closeAction: hide,
5536
5563
  closeValue: closeValue
5537
- })))), document.body) : /*#__PURE__*/React.createElement(React.Fragment, null);
5564
+ })))), document.body)) : /*#__PURE__*/React.createElement(React.Fragment, null);
5538
5565
  };
5539
5566
 
5540
5567
  const slideInLeft = keyframes`
@@ -5557,7 +5584,7 @@ const ModalWrapper$1 = /*#__PURE__*/_styled.div.withConfig({
5557
5584
  const ModalContainer$1 = /*#__PURE__*/_styled.div.withConfig({
5558
5585
  displayName: "styles__ModalContainer",
5559
5586
  componentId: "sc-46huls-2"
5560
- })(["position:fixed;right:0;background:", ";width:100%;height:100vh;height:calc(var(--vh,1vh) * 100);display:flex;flex-direction:column;padding:", ";word-wrap:break-word;animation-timing-function:", ";animation-duration:1s;animation-fill-mode:forwards;transform:translateX(100%);animation-name:", ";overflow-y:auto;@media ", "{max-width:", ";padding:", ";}"], colors.white, /*#__PURE__*/rem('15px'), /*#__PURE__*/timingFunctions('easeOutQuint'), slideInLeft, device.s, /*#__PURE__*/rem('400px'), /*#__PURE__*/rem('30px'));
5587
+ })(["margin-left:auto;background:", ";width:100%;min-height:100vh;display:flex;flex-direction:column;padding:", ";word-wrap:break-word;animation-timing-function:", ";animation-duration:1s;animation-fill-mode:forwards;transform:translateX(100%);animation-name:", ";@media ", "{max-width:", ";padding:", ";}"], colors.white, /*#__PURE__*/rem('15px'), /*#__PURE__*/timingFunctions('easeOutQuint'), slideInLeft, device.s, /*#__PURE__*/rem('400px'), /*#__PURE__*/rem('30px'));
5561
5588
  const ModalHeader$1 = /*#__PURE__*/_styled.div.withConfig({
5562
5589
  displayName: "styles__ModalHeader",
5563
5590
  componentId: "sc-46huls-3"
@@ -5602,7 +5629,7 @@ const ModalDrawer = props => {
5602
5629
  }
5603
5630
  return;
5604
5631
  }, []);
5605
- return isShowing ? /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalOverlay$1, {
5632
+ return isShowing ? ( /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalOverlay$1, {
5606
5633
  zIndex: zIndex
5607
5634
  }), /*#__PURE__*/React.createElement(ModalWrapper$1, {
5608
5635
  "aria-modal": true,
@@ -5615,10 +5642,10 @@ const ModalDrawer = props => {
5615
5642
  }, /*#__PURE__*/React.createElement(ModalHeader$1, null, title && /*#__PURE__*/React.createElement("h2", null, title)), /*#__PURE__*/React.createElement(ModalContent, null, children), !footerHidden && (footer ? footer : /*#__PURE__*/React.createElement(ModalFooter, {
5616
5643
  closeAction: hide,
5617
5644
  closeValue: closeValue
5618
- }))))), document.body) : /*#__PURE__*/React.createElement(React.Fragment, null);
5645
+ }))))), document.body)) : /*#__PURE__*/React.createElement(React.Fragment, null);
5619
5646
  };
5620
5647
 
5621
- const Wrapper$g = _styled.div`
5648
+ const Wrapper$f = _styled.div`
5622
5649
  div {
5623
5650
  width: 100%;
5624
5651
  height: 100%;
@@ -5781,12 +5808,12 @@ const LoadingState = props => {
5781
5808
  className: "subtitle"
5782
5809
  }), paragraphs));
5783
5810
  }
5784
- return /*#__PURE__*/React.createElement(Wrapper$g, {
5811
+ return /*#__PURE__*/React.createElement(Wrapper$f, {
5785
5812
  type: type
5786
5813
  }, loadingType);
5787
5814
  };
5788
5815
 
5789
- const Wrapper$h = _styled.div`
5816
+ const Wrapper$g = _styled.div`
5790
5817
  .tab {
5791
5818
  border-color: ${field.borderColor};
5792
5819
 
@@ -5964,7 +5991,7 @@ const TabsPanel = props => {
5964
5991
  getContent: () => tab.renderer
5965
5992
  }));
5966
5993
  };
5967
- return /*#__PURE__*/React.createElement(Wrapper$h, null, /*#__PURE__*/React.createElement(Tabs, {
5994
+ return /*#__PURE__*/React.createElement(Wrapper$g, null, /*#__PURE__*/React.createElement(Tabs, {
5968
5995
  transform: false,
5969
5996
  unmountOnExit: unmountOnExit,
5970
5997
  selectedTabKey: selectedTabKey,
@@ -5974,7 +6001,7 @@ const TabsPanel = props => {
5974
6001
  }));
5975
6002
  };
5976
6003
 
5977
- const Wrapper$i = _styled.div`
6004
+ const Wrapper$h = _styled.div`
5978
6005
  display: flex;
5979
6006
  flex-direction: column;
5980
6007
  `;
@@ -5994,7 +6021,7 @@ const TabsPanel$1 = props => {
5994
6021
  className = 'grid-container',
5995
6022
  children
5996
6023
  } = props;
5997
- return /*#__PURE__*/React.createElement(Wrapper$i, {
6024
+ return /*#__PURE__*/React.createElement(Wrapper$h, {
5998
6025
  className: className
5999
6026
  }, children);
6000
6027
  };