@taikai/rocket-kit 3.0.8 → 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.
@@ -1,9 +1,3 @@
1
1
  import React from 'react';
2
- export interface HorizontalNavInterface {
3
- className?: string;
4
- customColor?: string;
5
- items: any;
6
- startsOpen?: boolean;
7
- }
8
- declare const HorizontalNav: (props: HorizontalNavInterface) => React.JSX.Element;
9
- export default HorizontalNav;
2
+ import { HorizontalNavInterface } from './types';
3
+ export default function HorizontalNav(props: HorizontalNavInterface): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ export interface ItemInterface {
2
+ icon?: string;
3
+ label: string;
4
+ url: string;
5
+ active?: boolean;
6
+ }
7
+ export interface HorizontalNavInterface {
8
+ id?: string;
9
+ items: ItemInterface[];
10
+ }
@@ -0,0 +1,97 @@
1
+ .styles-module_wrapper__Q2-ac {
2
+ position: relative;
3
+ height: 5rem; /* 80px */
4
+ display: flex;
5
+ align-items: center;
6
+ }
7
+
8
+ .styles-module_wrapper__Q2-ac > div {
9
+ display: flex;
10
+ overflow-x: auto;
11
+ scrollbar-width: none;
12
+ -webkit-overflow-scrolling: touch;
13
+ -ms-overflow-style: -ms-autohiding-scrollbar;
14
+ }
15
+
16
+ .styles-module_wrapper__Q2-ac > div::-webkit-scrollbar {
17
+ display: none;
18
+ }
19
+
20
+ .styles-module_wrapper__Q2-ac ul {
21
+ list-style: none;
22
+ margin: 0;
23
+ padding: 0;
24
+ display: flex;
25
+ }
26
+
27
+ .styles-module_wrapper__Q2-ac ul li:not(:last-child) {
28
+ margin-right: 0.625rem; /* 10px */
29
+ }
30
+
31
+ .styles-module_wrapper__Q2-ac ul li:last-child {
32
+ margin-right: 0.0625rem; /* 1px */
33
+ }
34
+
35
+ .styles-module_wrapper__Q2-ac ul li a {
36
+ display: flex;
37
+ align-items: center;
38
+ padding: 0.625rem; /* 10px */
39
+ color: var(--black);
40
+ text-transform: capitalize;
41
+ text-decoration: none;
42
+ white-space: nowrap;
43
+ transition-duration: var(--transitionDurationDefault);
44
+ }
45
+
46
+ .styles-module_wrapper__Q2-ac ul li a svg {
47
+ margin-right: 0.3125rem; /* 5px */
48
+ width: auto;
49
+ height: 1.5rem; /* 24px */
50
+ min-width: 1.5rem; /* 24px */
51
+ fill: var(--grey200);
52
+ transition-duration: var(--transitionDurationDefault);
53
+ }
54
+
55
+ .styles-module_wrapper__Q2-ac ul li a:hover {
56
+ color: var(--purple500);
57
+ }
58
+
59
+ .styles-module_wrapper__Q2-ac ul li a:hover svg {
60
+ fill: var(--purple500);
61
+ }
62
+
63
+ .styles-module_wrapper__Q2-ac ul li.styles-module_active__0DuQB {
64
+ font-weight: var(--fontWeightSemiBold);
65
+ }
66
+
67
+ .styles-module_wrapper__Q2-ac ul li.styles-module_active__0DuQB a {
68
+ color: var(--purple500);
69
+ pointer-events: none;
70
+ }
71
+
72
+ .styles-module_wrapper__Q2-ac ul li.styles-module_active__0DuQB a svg {
73
+ fill: var(--purple500);
74
+ }
75
+
76
+ .styles-module_wrapper__Q2-ac button {
77
+ position: absolute;
78
+ top: 0;
79
+ border-radius: 0;
80
+ height: 100%;
81
+ border-style: solid;
82
+ border-color: var(--grey150);
83
+ }
84
+
85
+ .styles-module_wrapper__Q2-ac button:hover {
86
+ background-color: var(--white);
87
+ }
88
+
89
+ .styles-module_wrapper__Q2-ac button.styles-module_back__AE3bY {
90
+ left: 0;
91
+ border-right-width: 0.0625rem; /* 1px */
92
+ }
93
+
94
+ .styles-module_wrapper__Q2-ac button.styles-module_forward__sOwh3 {
95
+ right: 0;
96
+ border-left-width: 0.0625rem; /* 1px */
97
+ }
@@ -17,6 +17,7 @@ var ReactPlayer = _interopDefault(require('react-player'));
17
17
  var uuid = require('uuid');
18
18
  var reactBeautifulDnd = require('react-beautiful-dnd');
19
19
  var ReactPaginate = _interopDefault(require('react-paginate'));
20
+ var reactIntersectionObserver = require('react-intersection-observer');
20
21
  var throttle = _interopDefault(require('lodash.throttle'));
21
22
  var ReactDOM = _interopDefault(require('react-dom'));
22
23
  var Tabs = _interopDefault(require('react-responsive-tabs'));
@@ -5405,80 +5406,77 @@ const FieldWidthButton = ({
5405
5406
  })));
5406
5407
  };
5407
5408
 
5408
- const Wrapper$f = /*#__PURE__*/_styled__default.div.withConfig({
5409
- displayName: "styles__Wrapper",
5410
- componentId: "sc-znznmm-0"
5411
- })(["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__*/polished.rem('10px'), /*#__PURE__*/polished.rem('10px'), colors.black, misc.transitionDuration, /*#__PURE__*/polished.rem('5px'), /*#__PURE__*/polished.rem('24px'), /*#__PURE__*/polished.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);
5412
- const More = /*#__PURE__*/_styled__default.div.withConfig({
5413
- displayName: "styles__More",
5414
- componentId: "sc-znznmm-1"
5415
- })(["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__*/polished.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__*/polished.rem('15px'));
5416
-
5417
- const HorizontalNav = props => {
5418
- const [showMore, setShowMore] = React.useState(false);
5419
- const moreMenu = React.useRef(null);
5420
- const visibleMenuRef = React.useRef(null);
5409
+ var styles = {"wrapper":"styles-module_wrapper__Q2-ac","active":"styles-module_active__0DuQB","back":"styles-module_back__AE3bY","forward":"styles-module_forward__sOwh3"};
5410
+
5411
+ function scroll(container, direction, speed, distance, step) {
5412
+ let scrollAmount = 0;
5413
+ const slideTimer = setInterval(function () {
5414
+ if (container && direction === 'left') {
5415
+ container.scrollLeft -= step;
5416
+ } else {
5417
+ container ? container.scrollLeft += step : null;
5418
+ }
5419
+ scrollAmount += step;
5420
+ if (scrollAmount >= distance) {
5421
+ window.clearInterval(slideTimer);
5422
+ }
5423
+ }, speed);
5424
+ }
5425
+ function HorizontalNav(props) {
5421
5426
  const {
5422
- className = 'horizontal-nav',
5423
- customColor = '',
5424
- items,
5425
- startsOpen = false
5427
+ id = 'horizontal-nav',
5428
+ items
5426
5429
  } = props;
5427
- const {
5428
- ref,
5429
- isVisible,
5430
- setIsVisible
5431
- } = useVisible(startsOpen);
5432
- React.useEffect(() => {
5433
- if (!ref || !ref.current) return;
5434
- const visible = document.querySelector('ul.menu').getElementsByTagName('li');
5435
- const more = document.querySelector('.more').getElementsByTagName('li');
5436
- const moreVisibility = () => more.length > 0 ? setShowMore(true) : setShowMore(false);
5437
- const removeItem = () => {
5438
- if (visible.length === 1) return;
5439
- let last = visible[visible.length - 1];
5440
- document.querySelector('ul.more').prepend(last);
5441
- };
5442
- const addItem = () => {
5443
- if (more.length === 0) return;
5444
- let first = more[0];
5445
- document.querySelector('ul.menu').append(first);
5446
- };
5447
- const checkOverflow = () => {
5448
- moreVisibility();
5449
- for (let i = 0; i < visible.length + 20; i++) {
5450
- visibleMenuRef.current.scrollWidth + 50 > ref.current.offsetWidth ? removeItem() : addItem();
5451
- }
5452
- };
5453
- checkOverflow();
5454
- if (typeof window !== 'undefined') {
5455
- moreVisibility();
5456
- window.addEventListener('resize', checkOverflow);
5457
- return () => window.removeEventListener('resize', checkOverflow);
5458
- }
5459
- return;
5460
- }, [ref]);
5461
- return /*#__PURE__*/React__default.createElement(Wrapper$f, {
5462
- ref: ref,
5463
- className: className,
5464
- customColor: customColor
5430
+ const [showBackButton, setShowBackButton] = React.useState(false);
5431
+ const [showForwardButton, setShowForwardButton] = React.useState(true);
5432
+ const forward = () => {
5433
+ const container = document.getElementById(id);
5434
+ scroll(container, 'right', 10, 200, 10);
5435
+ };
5436
+ const back = () => {
5437
+ const container = document.getElementById(id);
5438
+ scroll(container, 'left', 10, 200, 10);
5439
+ };
5440
+ return /*#__PURE__*/React__default.createElement("div", {
5441
+ className: styles.wrapper
5442
+ }, showBackButton && /*#__PURE__*/React__default.createElement(Button, {
5443
+ className: styles.back,
5444
+ variant: "solid",
5445
+ color: "white",
5446
+ txtColor: "black",
5447
+ icon: "caret-left",
5448
+ action: back
5449
+ }), /*#__PURE__*/React__default.createElement("div", {
5450
+ id: id
5465
5451
  }, /*#__PURE__*/React__default.createElement("ul", {
5466
- className: "menu",
5467
- ref: visibleMenuRef
5468
- }, items), /*#__PURE__*/React__default.createElement(More, {
5469
- className: showMore ? 'hide' : '',
5470
- ref: moreMenu
5471
- }, /*#__PURE__*/React__default.createElement(Button, {
5472
- variant: "text",
5473
- color: "dark",
5474
- icon: "menuVert",
5475
- action: () => {
5476
- setIsVisible(!isVisible);
5452
+ className: "menu"
5453
+ }, items.map((item, index) =>
5454
+ /*#__PURE__*/
5455
+ // @ts-ignore
5456
+ React__default.createElement(reactIntersectionObserver.InView, {
5457
+ key: index,
5458
+ as: "li",
5459
+ className: item.active ? styles.active : undefined,
5460
+ threshold: 1,
5461
+ onChange: inView => {
5462
+ if (index === 0 && inView) setShowBackButton(false);
5463
+ if (index === 0 && !inView) setShowBackButton(true);
5464
+ if (index === items.length - 1 && inView) setShowForwardButton(false);
5465
+ if (index === items.length - 1 && !inView) setShowForwardButton(true);
5477
5466
  }
5478
- }), /*#__PURE__*/React__default.createElement("ul", {
5479
- className: isVisible ? 'more is-open' : 'more'
5480
- })));
5481
- };
5467
+ }, /*#__PURE__*/React__default.createElement("a", {
5468
+ href: item.url
5469
+ }, item.icon && /*#__PURE__*/React__default.createElement(Icon, {
5470
+ icon: item.icon
5471
+ }), item.label))))), showForwardButton && /*#__PURE__*/React__default.createElement(Button, {
5472
+ className: styles.forward,
5473
+ variant: "solid",
5474
+ color: "white",
5475
+ txtColor: "black",
5476
+ icon: "caret-right",
5477
+ action: forward
5478
+ }));
5479
+ }
5482
5480
 
5483
5481
  const ModalOverlay = /*#__PURE__*/_styled__default.div.withConfig({
5484
5482
  displayName: "styles__ModalOverlay",
@@ -5521,7 +5519,7 @@ const Modal = props => {
5521
5519
  return;
5522
5520
  }
5523
5521
  }, []);
5524
- return isShowing ? /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ModalOverlay, {
5522
+ return isShowing ? ( /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ModalOverlay, {
5525
5523
  zIndex: zIndex
5526
5524
  }), /*#__PURE__*/React__default.createElement(ModalWrapper, {
5527
5525
  "aria-modal": true,
@@ -5543,7 +5541,7 @@ const Modal = props => {
5543
5541
  })), children, footer && /*#__PURE__*/React__default.createElement(ModalFooter, {
5544
5542
  closeAction: hide,
5545
5543
  closeValue: closeValue
5546
- })))), document.body) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
5544
+ })))), document.body)) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
5547
5545
  };
5548
5546
 
5549
5547
  const slideInLeft = _styled.keyframes`
@@ -5611,7 +5609,7 @@ const ModalDrawer = props => {
5611
5609
  }
5612
5610
  return;
5613
5611
  }, []);
5614
- return isShowing ? /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ModalOverlay$1, {
5612
+ return isShowing ? ( /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ModalOverlay$1, {
5615
5613
  zIndex: zIndex
5616
5614
  }), /*#__PURE__*/React__default.createElement(ModalWrapper$1, {
5617
5615
  "aria-modal": true,
@@ -5624,10 +5622,10 @@ const ModalDrawer = props => {
5624
5622
  }, /*#__PURE__*/React__default.createElement(ModalHeader$1, null, title && /*#__PURE__*/React__default.createElement("h2", null, title)), /*#__PURE__*/React__default.createElement(ModalContent, null, children), !footerHidden && (footer ? footer : /*#__PURE__*/React__default.createElement(ModalFooter, {
5625
5623
  closeAction: hide,
5626
5624
  closeValue: closeValue
5627
- }))))), document.body) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
5625
+ }))))), document.body)) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
5628
5626
  };
5629
5627
 
5630
- const Wrapper$g = _styled__default.div`
5628
+ const Wrapper$f = _styled__default.div`
5631
5629
  div {
5632
5630
  width: 100%;
5633
5631
  height: 100%;
@@ -5790,12 +5788,12 @@ const LoadingState = props => {
5790
5788
  className: "subtitle"
5791
5789
  }), paragraphs));
5792
5790
  }
5793
- return /*#__PURE__*/React__default.createElement(Wrapper$g, {
5791
+ return /*#__PURE__*/React__default.createElement(Wrapper$f, {
5794
5792
  type: type
5795
5793
  }, loadingType);
5796
5794
  };
5797
5795
 
5798
- const Wrapper$h = _styled__default.div`
5796
+ const Wrapper$g = _styled__default.div`
5799
5797
  .tab {
5800
5798
  border-color: ${field.borderColor};
5801
5799
 
@@ -5973,7 +5971,7 @@ const TabsPanel = props => {
5973
5971
  getContent: () => tab.renderer
5974
5972
  }));
5975
5973
  };
5976
- return /*#__PURE__*/React__default.createElement(Wrapper$h, null, /*#__PURE__*/React__default.createElement(Tabs, {
5974
+ return /*#__PURE__*/React__default.createElement(Wrapper$g, null, /*#__PURE__*/React__default.createElement(Tabs, {
5977
5975
  transform: false,
5978
5976
  unmountOnExit: unmountOnExit,
5979
5977
  selectedTabKey: selectedTabKey,
@@ -5983,7 +5981,7 @@ const TabsPanel = props => {
5983
5981
  }));
5984
5982
  };
5985
5983
 
5986
- const Wrapper$i = _styled__default.div`
5984
+ const Wrapper$h = _styled__default.div`
5987
5985
  display: flex;
5988
5986
  flex-direction: column;
5989
5987
  `;
@@ -6003,7 +6001,7 @@ const TabsPanel$1 = props => {
6003
6001
  className = 'grid-container',
6004
6002
  children
6005
6003
  } = props;
6006
- return /*#__PURE__*/React__default.createElement(Wrapper$i, {
6004
+ return /*#__PURE__*/React__default.createElement(Wrapper$h, {
6007
6005
  className: className
6008
6006
  }, children);
6009
6007
  };