@taikai/rocket-kit 3.0.7 → 3.0.9

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';
@@ -5268,8 +5269,12 @@ const CheckboxGroup = props => {
5268
5269
  }, /*#__PURE__*/React.createElement(Checkbox, {
5269
5270
  label: value.label,
5270
5271
  value: value.value,
5271
- checked: value.checked,
5272
- onChange: onChange,
5272
+ checked: value.checked ?? undefined,
5273
+ onChange: event => {
5274
+ var _value$onChange;
5275
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
5276
+ (_value$onChange = value.onChange) === null || _value$onChange === void 0 ? void 0 : _value$onChange.call(value, event);
5277
+ },
5273
5278
  error: !!error,
5274
5279
  disabled: disabled
5275
5280
  }))) : null, error ? /*#__PURE__*/React.createElement(ErrorField, {
@@ -5392,80 +5397,106 @@ const FieldWidthButton = ({
5392
5397
  })));
5393
5398
  };
5394
5399
 
5395
- const Wrapper$f = /*#__PURE__*/_styled.div.withConfig({
5396
- displayName: "styles__Wrapper",
5397
- componentId: "sc-znznmm-0"
5398
- })(["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);
5399
- const More = /*#__PURE__*/_styled.div.withConfig({
5400
- displayName: "styles__More",
5401
- componentId: "sc-znznmm-1"
5402
- })(["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'));
5403
-
5404
- const HorizontalNav = props => {
5405
- const [showMore, setShowMore] = useState(false);
5406
- const moreMenu = useRef(null);
5407
- 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) {
5408
5446
  const {
5409
- className = 'horizontal-nav',
5410
- customColor = '',
5411
- items,
5412
- startsOpen = false
5447
+ id = 'horizontal-nav',
5448
+ items
5413
5449
  } = props;
5414
- const {
5415
- ref,
5416
- isVisible,
5417
- setIsVisible
5418
- } = useVisible(startsOpen);
5419
- useEffect(() => {
5420
- if (!ref || !ref.current) return;
5421
- const visible = document.querySelector('ul.menu').getElementsByTagName('li');
5422
- const more = document.querySelector('.more').getElementsByTagName('li');
5423
- const moreVisibility = () => more.length > 0 ? setShowMore(true) : setShowMore(false);
5424
- const removeItem = () => {
5425
- if (visible.length === 1) return;
5426
- let last = visible[visible.length - 1];
5427
- document.querySelector('ul.more').prepend(last);
5428
- };
5429
- const addItem = () => {
5430
- if (more.length === 0) return;
5431
- let first = more[0];
5432
- document.querySelector('ul.menu').append(first);
5433
- };
5434
- const checkOverflow = () => {
5435
- moreVisibility();
5436
- for (let i = 0; i < visible.length + 20; i++) {
5437
- visibleMenuRef.current.scrollWidth + 50 > ref.current.offsetWidth ? removeItem() : addItem();
5438
- }
5439
- };
5440
- checkOverflow();
5441
- if (typeof window !== 'undefined') {
5442
- moreVisibility();
5443
- window.addEventListener('resize', checkOverflow);
5444
- return () => window.removeEventListener('resize', checkOverflow);
5445
- }
5446
- return;
5447
- }, [ref]);
5448
- return /*#__PURE__*/React.createElement(Wrapper$f, {
5449
- ref: ref,
5450
- className: className,
5451
- 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
5452
5471
  }, /*#__PURE__*/React.createElement("ul", {
5453
- className: "menu",
5454
- ref: visibleMenuRef
5455
- }, items), /*#__PURE__*/React.createElement(More, {
5456
- className: showMore ? 'hide' : '',
5457
- ref: moreMenu
5458
- }, /*#__PURE__*/React.createElement(Button, {
5459
- variant: "text",
5460
- color: "dark",
5461
- icon: "menuVert",
5462
- action: () => {
5463
- 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);
5464
5486
  }
5465
- }), /*#__PURE__*/React.createElement("ul", {
5466
- className: isVisible ? 'more is-open' : 'more'
5467
- })));
5468
- };
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
+ }
5469
5500
 
5470
5501
  const ModalOverlay = /*#__PURE__*/_styled.div.withConfig({
5471
5502
  displayName: "styles__ModalOverlay",
@@ -5508,7 +5539,7 @@ const Modal = props => {
5508
5539
  return;
5509
5540
  }
5510
5541
  }, []);
5511
- 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, {
5512
5543
  zIndex: zIndex
5513
5544
  }), /*#__PURE__*/React.createElement(ModalWrapper, {
5514
5545
  "aria-modal": true,
@@ -5530,7 +5561,7 @@ const Modal = props => {
5530
5561
  })), children, footer && /*#__PURE__*/React.createElement(ModalFooter, {
5531
5562
  closeAction: hide,
5532
5563
  closeValue: closeValue
5533
- })))), document.body) : /*#__PURE__*/React.createElement(React.Fragment, null);
5564
+ })))), document.body)) : /*#__PURE__*/React.createElement(React.Fragment, null);
5534
5565
  };
5535
5566
 
5536
5567
  const slideInLeft = keyframes`
@@ -5598,7 +5629,7 @@ const ModalDrawer = props => {
5598
5629
  }
5599
5630
  return;
5600
5631
  }, []);
5601
- 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, {
5602
5633
  zIndex: zIndex
5603
5634
  }), /*#__PURE__*/React.createElement(ModalWrapper$1, {
5604
5635
  "aria-modal": true,
@@ -5611,10 +5642,10 @@ const ModalDrawer = props => {
5611
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, {
5612
5643
  closeAction: hide,
5613
5644
  closeValue: closeValue
5614
- }))))), document.body) : /*#__PURE__*/React.createElement(React.Fragment, null);
5645
+ }))))), document.body)) : /*#__PURE__*/React.createElement(React.Fragment, null);
5615
5646
  };
5616
5647
 
5617
- const Wrapper$g = _styled.div`
5648
+ const Wrapper$f = _styled.div`
5618
5649
  div {
5619
5650
  width: 100%;
5620
5651
  height: 100%;
@@ -5777,12 +5808,12 @@ const LoadingState = props => {
5777
5808
  className: "subtitle"
5778
5809
  }), paragraphs));
5779
5810
  }
5780
- return /*#__PURE__*/React.createElement(Wrapper$g, {
5811
+ return /*#__PURE__*/React.createElement(Wrapper$f, {
5781
5812
  type: type
5782
5813
  }, loadingType);
5783
5814
  };
5784
5815
 
5785
- const Wrapper$h = _styled.div`
5816
+ const Wrapper$g = _styled.div`
5786
5817
  .tab {
5787
5818
  border-color: ${field.borderColor};
5788
5819
 
@@ -5960,7 +5991,7 @@ const TabsPanel = props => {
5960
5991
  getContent: () => tab.renderer
5961
5992
  }));
5962
5993
  };
5963
- return /*#__PURE__*/React.createElement(Wrapper$h, null, /*#__PURE__*/React.createElement(Tabs, {
5994
+ return /*#__PURE__*/React.createElement(Wrapper$g, null, /*#__PURE__*/React.createElement(Tabs, {
5964
5995
  transform: false,
5965
5996
  unmountOnExit: unmountOnExit,
5966
5997
  selectedTabKey: selectedTabKey,
@@ -5970,7 +6001,7 @@ const TabsPanel = props => {
5970
6001
  }));
5971
6002
  };
5972
6003
 
5973
- const Wrapper$i = _styled.div`
6004
+ const Wrapper$h = _styled.div`
5974
6005
  display: flex;
5975
6006
  flex-direction: column;
5976
6007
  `;
@@ -5990,7 +6021,7 @@ const TabsPanel$1 = props => {
5990
6021
  className = 'grid-container',
5991
6022
  children
5992
6023
  } = props;
5993
- return /*#__PURE__*/React.createElement(Wrapper$i, {
6024
+ return /*#__PURE__*/React.createElement(Wrapper$h, {
5994
6025
  className: className
5995
6026
  }, children);
5996
6027
  };