@onepercentio/one-ui 0.20.5 → 0.21.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.
Files changed (58) hide show
  1. package/dist/assets/styles/variables.scss +1 -0
  2. package/dist/components/AdaptiveContainer/AdaptiveContainer.js +4 -2
  3. package/dist/components/AdaptiveContainer/AdaptiveContainer.module.scss +3 -1
  4. package/dist/components/AdaptiveSidebar/AdaptiveSidebar.d.ts +3 -3
  5. package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +3 -2
  6. package/dist/components/AnchoredTooltip/AnchoredTooltip.d.ts +2 -2
  7. package/dist/components/AnchoredTooltip/AnchoredTooltip.js +3 -2
  8. package/dist/components/AnimatedEntrance/AnimatedEntrance.d.ts +1 -1
  9. package/dist/components/AnimatedEntrance/AnimatedEntrance.js +8 -6
  10. package/dist/components/Button/Button.d.ts +2 -2
  11. package/dist/components/Button/Button.js +2 -1
  12. package/dist/components/Collapsable/Collapsable.d.ts +4 -4
  13. package/dist/components/Collapsable/Collapsable.js +3 -2
  14. package/dist/components/EmailInput/EmailInput.d.ts +3 -3
  15. package/dist/components/EmailInput/EmailInput.js +3 -2
  16. package/dist/components/FadeIn/FadeIn.d.ts +4 -4
  17. package/dist/components/FadeIn/FadeIn.js +3 -2
  18. package/dist/components/FileInput/View/Compact/Compact.js +2 -2
  19. package/dist/components/Form/Form.d.ts +3 -4
  20. package/dist/components/Form/Form.js +3 -2
  21. package/dist/components/InfinityScroll/InfinityScroll.d.ts +3 -3
  22. package/dist/components/InfinityScroll/InfinityScroll.js +3 -2
  23. package/dist/components/Input/Input.d.ts +2 -2
  24. package/dist/components/Input/Input.js +3 -2
  25. package/dist/components/InstantCounter/InstantCounter.d.ts +2 -2
  26. package/dist/components/InstantCounter/InstantCounter.js +3 -2
  27. package/dist/components/MainGrid/MainGrid.d.ts +3 -3
  28. package/dist/components/MainGrid/MainGrid.js +3 -2
  29. package/dist/components/PaginationIndicator/PaginationIndicator.d.ts +4 -4
  30. package/dist/components/PaginationIndicator/PaginationIndicator.js +2 -1
  31. package/dist/components/Parallax/Parallax.d.ts +2 -2
  32. package/dist/components/Parallax/Parallax.js +3 -2
  33. package/dist/components/PasswordInput/PasswordInput.d.ts +3 -3
  34. package/dist/components/PasswordInput/PasswordInput.js +3 -2
  35. package/dist/components/ProgressBar/ProgressBar.d.ts +4 -4
  36. package/dist/components/ProgressBar/ProgressBar.js +6 -6
  37. package/dist/components/SectionContainer/SectionContainer.d.ts +3 -3
  38. package/dist/components/SectionContainer/SectionContainer.js +3 -2
  39. package/dist/components/Select/Select.module.scss +8 -5
  40. package/dist/components/StaticScroller/StaticScroller.d.ts +2 -2
  41. package/dist/components/StaticScroller/StaticScroller.js +3 -2
  42. package/dist/components/Tabs/Tabs.d.ts +6 -1
  43. package/dist/components/Tabs/Tabs.js +25 -6
  44. package/dist/components/Tabs/Tabs.module.scss +21 -2
  45. package/dist/components/Text/Text.d.ts +2 -2
  46. package/dist/components/Text/Text.js +2 -1
  47. package/dist/components/Transition/Transition.d.ts +8 -23
  48. package/dist/components/Transition/Transition.js +3 -2
  49. package/dist/components/UncontrolledTransition/UncontrolledTransition.d.ts +5 -5
  50. package/dist/components/UncontrolledTransition/UncontrolledTransition.js +3 -2
  51. package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.d.ts +2 -2
  52. package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js +3 -2
  53. package/dist/hooks/useHero.d.ts +1 -0
  54. package/dist/hooks/useHero.js +52 -3
  55. package/dist/hooks/useHero.module.scss +7 -0
  56. package/dist/types.d.ts +11 -4
  57. package/package.json +2 -1
  58. package/src/types.ts +155 -41
@@ -17,10 +17,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
17
17
  function ProgressBar(_ref) {
18
18
  let size = _ref.size,
19
19
  progress = _ref.progress,
20
- _ref$style = _ref.style,
21
- style = _ref$style === void 0 ? "guide" : _ref$style;
20
+ _ref$mode = _ref.mode,
21
+ mode = _ref$mode === void 0 ? "guide" : _ref$mode;
22
22
  return /*#__PURE__*/_react.default.createElement("div", {
23
- className: "".concat(_ProgressBarModule.default.container, " ").concat(_ProgressBarModule.default[style], " ").concat(progress === 100 ? _ProgressBarModule.default.completed : ""),
23
+ className: "".concat(_ProgressBarModule.default.container, " ").concat(_ProgressBarModule.default[mode], " ").concat(progress === 100 ? _ProgressBarModule.default.completed : ""),
24
24
  style: {
25
25
  fontSize: size
26
26
  }
@@ -28,7 +28,7 @@ function ProgressBar(_ref) {
28
28
  style: {
29
29
  width: "".concat(progress, "%")
30
30
  }
31
- }), style === "guide" && /*#__PURE__*/_react.default.createElement("span", {
31
+ }), mode === "guide" && /*#__PURE__*/_react.default.createElement("span", {
32
32
  style: {
33
33
  left: "".concat(progress, "%")
34
34
  }
@@ -39,7 +39,7 @@ function BalancedProgressBar(_ref2) {
39
39
  max = _ref2.max,
40
40
  current = _ref2.current,
41
41
  size = _ref2.size,
42
- style = _ref2.style;
42
+ mode = _ref2.mode;
43
43
  const progress = (0, _react.useMemo)(function () {
44
44
  const progressVal = current - min;
45
45
  const maxVal = max - min;
@@ -49,6 +49,6 @@ function BalancedProgressBar(_ref2) {
49
49
  return /*#__PURE__*/_react.default.createElement(ProgressBar, {
50
50
  size: size,
51
51
  progress: progress,
52
- style: style
52
+ mode: mode
53
53
  });
54
54
  }
@@ -1,11 +1,11 @@
1
1
  import React from "react";
2
2
  export declare function createId(...args: string[]): string;
3
- declare const _default: React.ForwardRefExoticComponent<{
3
+ declare const SectionContainer: React.ForwardRefExoticComponent<{
4
4
  decoration?: "dark" | "light" | undefined;
5
5
  section?: string | undefined;
6
6
  className?: string | undefined;
7
- onClick?: React.MouseEventHandler<HTMLDivElement> | undefined;
7
+ onClick?: JSX.IntrinsicElements["div"]["onClick"];
8
8
  } & {
9
9
  children?: React.ReactNode;
10
10
  } & React.RefAttributes<HTMLDivElement>>;
11
- export default _default;
11
+ export default SectionContainer;
@@ -20,7 +20,7 @@ function createId() {
20
20
  /**
21
21
  * This component wraps a section and limits it's content as well as defining an id to reference this section
22
22
  **/
23
- function SectionContainer(_ref, ref) {
23
+ function _SectionContainer(_ref, ref) {
24
24
  let children = _ref.children,
25
25
  section = _ref.section,
26
26
  _ref$className = _ref.className,
@@ -38,5 +38,6 @@ function SectionContainer(_ref, ref) {
38
38
  className: "".concat(_SectionContainerModule.default.decoration, " ").concat(_SectionContainerModule.default[decoration])
39
39
  })));
40
40
  }
41
- var _default = /*#__PURE__*/(0, _react.forwardRef)(SectionContainer);
41
+ const SectionContainer = /*#__PURE__*/(0, _react.forwardRef)(_SectionContainer);
42
+ var _default = SectionContainer;
42
43
  exports.default = _default;
@@ -19,12 +19,15 @@
19
19
  .empty {
20
20
  opacity: 0.3;
21
21
  }
22
- .input input {
23
- transition: opacity $fast;
22
+ .input {
24
23
  cursor: pointer;
25
- padding-right: 30px;
26
- overflow: hidden;
27
- text-overflow: ellipsis;
24
+ input {
25
+ transition: opacity $fast;
26
+ padding-right: 30px;
27
+ overflow: hidden;
28
+ text-overflow: ellipsis;
29
+ pointer-events: none;
30
+ }
28
31
  }
29
32
  .indicator {
30
33
  display: flex;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- declare const _default: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, "ref"> & React.RefAttributes<HTMLDivElement>>;
3
- export default _default;
2
+ declare const StaticScroller: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, "ref"> & React.RefAttributes<HTMLDivElement>>;
3
+ export default StaticScroller;
@@ -18,7 +18,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
18
18
  /**
19
19
  * Mantains a static content at the start of the container and when scrolled animates it's concealment
20
20
  **/
21
- function StaticScroller(_ref, ref) {
21
+ function _StaticScroller(_ref, ref) {
22
22
  let children = _ref.children,
23
23
  props = _objectWithoutProperties(_ref, _excluded);
24
24
  const rootRef = (0, _react.useMemo)(function () {
@@ -64,5 +64,6 @@ function StaticScroller(_ref, ref) {
64
64
  ref: rootRef
65
65
  }), children);
66
66
  }
67
- var _default = /*#__PURE__*/(0, _react.forwardRef)(StaticScroller);
67
+ const StaticScroller = /*#__PURE__*/(0, _react.forwardRef)(_StaticScroller);
68
+ var _default = StaticScroller;
68
69
  exports.default = _default;
@@ -1,8 +1,12 @@
1
1
  import { ReactElement } from "react";
2
+ export declare enum TabType {
3
+ FULL = 0,
4
+ UNDERLINE = 1
5
+ }
2
6
  /**
3
7
  * Show tabs for toggling between options
4
8
  **/
5
- export default function Tabs<O extends string>({ options, selected, onSelect, itemClassName, className, }: {
9
+ export default function Tabs<O extends string | number>({ options, selected, onSelect, itemClassName, className, type, }: {
6
10
  options: Readonly<{
7
11
  id: O;
8
12
  label: string | ReactElement;
@@ -11,4 +15,5 @@ export default function Tabs<O extends string>({ options, selected, onSelect, it
11
15
  onSelect: (option: O) => void;
12
16
  itemClassName?: string;
13
17
  className?: string;
18
+ type?: TabType;
14
19
  }): JSX.Element;
@@ -4,15 +4,22 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ exports.TabType = void 0;
7
8
  exports.default = Tabs;
8
9
  var _react = _interopRequireWildcard(require("react"));
9
10
  var _TabsModule = _interopRequireDefault(require("./Tabs.module.scss"));
10
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ let TabType = /*#__PURE__*/function (TabType) {
15
+ TabType[TabType["FULL"] = 0] = "FULL";
16
+ TabType[TabType["UNDERLINE"] = 1] = "UNDERLINE";
17
+ return TabType;
18
+ }({});
13
19
  /**
14
20
  * Show tabs for toggling between options
15
21
  **/
22
+ exports.TabType = TabType;
16
23
  function Tabs(_ref) {
17
24
  let options = _ref.options,
18
25
  selected = _ref.selected,
@@ -20,17 +27,29 @@ function Tabs(_ref) {
20
27
  _ref$itemClassName = _ref.itemClassName,
21
28
  itemClassName = _ref$itemClassName === void 0 ? "" : _ref$itemClassName,
22
29
  _ref$className = _ref.className,
23
- className = _ref$className === void 0 ? "" : _ref$className;
30
+ className = _ref$className === void 0 ? "" : _ref$className,
31
+ _ref$type = _ref.type,
32
+ type = _ref$type === void 0 ? TabType.UNDERLINE : _ref$type;
24
33
  const selectedRef = (0, _react.useRef)(null);
25
34
  const guideRef = (0, _react.useRef)(null);
26
35
  (0, _react.useEffect)(function () {
27
- guideRef.current.style["opacity"] = selectedRef.current ? "1" : guideRef.current.style["opacity"];
28
- guideRef.current.style["width"] = selectedRef.current ? selectedRef.current.clientWidth + "px" : "0px";
29
- guideRef.current.style["left"] = selectedRef.current ? selectedRef.current.offsetLeft + "px" : guideRef.current.style["left"] || "initial";
30
- guideRef.current.style["top"] = selectedRef.current ? selectedRef.current.offsetTop + selectedRef.current.clientHeight + "px" : guideRef.current.style["top"] || "initial";
36
+ const guideStyle = guideRef.current.style;
37
+ const currEl = selectedRef.current;
38
+ guideStyle["opacity"] = currEl ? "1" : guideStyle["opacity"];
39
+ guideStyle["width"] = currEl ? currEl.clientWidth + "px" : "0px";
40
+ guideStyle["left"] = currEl ? currEl.offsetLeft + "px" : guideStyle["left"] || "initial";
41
+ if (type === TabType.FULL) {
42
+ guideStyle["height"] = currEl ? currEl.clientHeight + "px" : "";
43
+ guideStyle["top"] = currEl ? currEl.offsetTop + "px" : guideStyle["top"] || "initial";
44
+ } else {
45
+ guideStyle["top"] = currEl ? currEl.offsetTop + currEl.clientHeight + "px" : guideStyle["top"] || "initial";
46
+ }
31
47
  }, [selected]);
48
+ (0, _react.useEffect)(function () {
49
+ guideRef.current.classList.add(_TabsModule.default.enableTransition);
50
+ }, []);
32
51
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
33
- className: "".concat(_TabsModule.default.container, " ").concat(className)
52
+ className: "".concat(_TabsModule.default.container, " ").concat(className, " ").concat(_TabsModule.default[TabType[type]])
34
53
  }, options.map(function (o) {
35
54
  return /*#__PURE__*/_react.default.createElement("p", {
36
55
  ref: selected === o.id ? selectedRef : undefined,
@@ -11,11 +11,30 @@
11
11
  font-weight: bold;
12
12
  }
13
13
  }
14
+ &.FULL {
15
+ overflow: visible;
16
+ p {
17
+ transition: color 250ms linear;
18
+ padding: 0.4em 1em;
19
+ z-index: 1;
20
+ margin: 0px;
21
+
22
+ &.selected {
23
+ color: var(--tab-selected-color);
24
+ }
25
+ }
26
+ .guide {
27
+ box-shadow: $elevation;
28
+ border-radius: 1em / 50%;
29
+ }
30
+ }
14
31
  }
15
32
 
16
33
  .guide {
17
34
  height: 0.1em;
18
- background-color: $digitalBlue;
35
+ background-color: var(--tab-guide-color, $digitalBlue);
19
36
  position: absolute;
20
- transition: left $fast, width $fast, top $fast;
37
+ &.enableTransition {
38
+ transition: left $fast, width $fast, top $fast, height $fast;
39
+ }
21
40
  }
@@ -6,10 +6,10 @@ export declare function _Text({ type, children, className, ...otherProps }: Reac
6
6
  className?: string;
7
7
  type: OnepercentUtility.UIElements.TextVariants;
8
8
  } & React.HTMLAttributes<HTMLParagraphElement>>, _ref?: ForwardedRef<HTMLParagraphElement>): JSX.Element;
9
- declare const _default: React.ForwardRefExoticComponent<{
9
+ declare const Text: React.ForwardRefExoticComponent<{
10
10
  className?: string | undefined;
11
11
  type: OnepercentUtility.UIElements.TextVariants;
12
12
  } & React.HTMLAttributes<HTMLParagraphElement> & {
13
13
  children?: React.ReactNode;
14
14
  } & React.RefAttributes<HTMLParagraphElement>>;
15
- export default _default;
15
+ export default Text;
@@ -33,5 +33,6 @@ function _Text(_ref2, _ref) {
33
33
  className: "".concat(_TextModule.default.text, " ").concat(classNameType[type] || _TextModule.default[type], " ").concat(className, " ").concat(otherProps.onClick ? _TextModule.default.iteractible : "")
34
34
  }, otherProps), children);
35
35
  }
36
- var _default = /*#__PURE__*/(0, _react.forwardRef)(_Text);
36
+ const Text = /*#__PURE__*/(0, _react.forwardRef)(_Text);
37
+ var _default = Text;
37
38
  exports.default = _default;
@@ -1,4 +1,4 @@
1
- import React, { DetailedHTMLProps } from "react";
1
+ import React, { DetailedHTMLProps, Key, ReactElement } from "react";
2
2
  export declare type TransitionTypeDefinitions = {
3
3
  transitionType?: TransitionAnimationTypes.SLIDE | TransitionAnimationTypes.POP_FROM_CLICK_ORIGIN | TransitionAnimationTypes.FADE | TransitionAnimationTypes.COIN_FLIP;
4
4
  } | {
@@ -49,12 +49,12 @@ export declare enum TransitionAnimationTypes {
49
49
  MASK = 5,
50
50
  CUSTOM = 6
51
51
  }
52
- declare const _default: React.ForwardRefExoticComponent<(Omit<{
52
+ declare const Transition: React.ForwardRefExoticComponent<(Omit<{
53
53
  step: number;
54
54
  className?: string | undefined;
55
55
  contentStyle?: React.CSSProperties | undefined;
56
56
  contentClassName?: string | undefined;
57
- children: (React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined)[];
57
+ children: (React.ReactElement | undefined)[];
58
58
  onDiscardStep?: ((discardedKey: React.Key) => void) | undefined;
59
59
  lockTransitionWidth?: boolean | undefined;
60
60
  lockTransitionHeight?: boolean | undefined;
@@ -65,7 +65,7 @@ declare const _default: React.ForwardRefExoticComponent<(Omit<{
65
65
  className?: string | undefined;
66
66
  contentStyle?: React.CSSProperties | undefined;
67
67
  contentClassName?: string | undefined;
68
- children: (React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined)[];
68
+ children: (React.ReactElement | undefined)[];
69
69
  onDiscardStep?: ((discardedKey: React.Key) => void) | undefined;
70
70
  lockTransitionWidth?: boolean | undefined;
71
71
  lockTransitionHeight?: boolean | undefined;
@@ -77,7 +77,7 @@ declare const _default: React.ForwardRefExoticComponent<(Omit<{
77
77
  className?: string | undefined;
78
78
  contentStyle?: React.CSSProperties | undefined;
79
79
  contentClassName?: string | undefined;
80
- children: (React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined)[];
80
+ children: (React.ReactElement | undefined)[];
81
81
  onDiscardStep?: ((discardedKey: React.Key) => void) | undefined;
82
82
  lockTransitionWidth?: boolean | undefined;
83
83
  lockTransitionHeight?: boolean | undefined;
@@ -92,27 +92,12 @@ declare const _default: React.ForwardRefExoticComponent<(Omit<{
92
92
  className?: string | undefined;
93
93
  contentStyle?: React.CSSProperties | undefined;
94
94
  contentClassName?: string | undefined;
95
- children: (React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined)[];
95
+ children: (React.ReactElement | undefined)[];
96
96
  onDiscardStep?: ((discardedKey: React.Key) => void) | undefined;
97
97
  lockTransitionWidth?: boolean | undefined;
98
98
  lockTransitionHeight?: boolean | undefined;
99
99
  } & {
100
100
  transitionType?: TransitionAnimationTypes.CUSTOM | undefined;
101
- config: {
102
- /**
103
- * Applied to the element that was not visible and is now entering the screen
104
- */
105
- backward: {
106
- elementEntering: string;
107
- elementExiting: string;
108
- };
109
- /**
110
- * Applied to the element that was visible and now is exiting the screen
111
- */
112
- forward: {
113
- elementEntering: string;
114
- elementExiting: string;
115
- };
116
- };
101
+ config: ReturnType<typeof TransitionClasses>;
117
102
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, any>, "className" | "children">, "ref">) & React.RefAttributes<HTMLDivElement | null>>;
118
- export default _default;
103
+ export default Transition;
@@ -100,7 +100,7 @@ function ChildrenWrapperFactory(func, key, externalPropsContainer, toRemoveKeys)
100
100
  /**
101
101
  * Handles the transition between multiple children and recycling of elements
102
102
  **/
103
- function Transition(_ref, _containerRef) {
103
+ function _Transition(_ref, _containerRef) {
104
104
  let step = _ref.step,
105
105
  contentStyle = _ref.contentStyle,
106
106
  _ref$contentClassName = _ref.contentClassName,
@@ -329,5 +329,6 @@ let TransitionAnimationTypes = /*#__PURE__*/function (TransitionAnimationTypes)
329
329
  return TransitionAnimationTypes;
330
330
  }({});
331
331
  exports.TransitionAnimationTypes = TransitionAnimationTypes;
332
- var _default = /*#__PURE__*/(0, _react.forwardRef)(Transition);
332
+ const Transition = /*#__PURE__*/(0, _react.forwardRef)(_Transition);
333
+ var _default = Transition;
333
334
  exports.default = _default;
@@ -1,14 +1,14 @@
1
- import React from "react";
1
+ import React, { Key, RefObject } from "react";
2
2
  import { TransitionProps, TransitionTypeDefinitions } from "../Transition/Transition";
3
- declare const _default: React.ForwardRefExoticComponent<({
3
+ declare const UncontrolledTransition: React.ForwardRefExoticComponent<({
4
4
  className?: string | undefined;
5
5
  contentClassName?: string | undefined;
6
6
  children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
7
7
  lockTransitionWidth?: boolean | undefined;
8
8
  lockTransitionHeight?: boolean | undefined;
9
- onDiscardStep?: ((key: React.Key) => void) | undefined;
9
+ onDiscardStep?: ((key: Key) => void) | undefined;
10
10
  } & Pick<TransitionProps, "contentStyle"> & TransitionTypeDefinitions & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, any>, "className" | "children" | "ref">) & React.RefAttributes<{
11
11
  setOrientation: (orientation: "forward" | "backward") => void;
12
- sectionRef: React.RefObject<HTMLDivElement>;
12
+ sectionRef: RefObject<HTMLDivElement>;
13
13
  }>>;
14
- export default _default;
14
+ export default UncontrolledTransition;
@@ -32,7 +32,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
32
32
  /**
33
33
  * This component handles when a child changes and transition this child change, allowing the finest experiences
34
34
  **/
35
- function UncontrolledTransition(_ref, ref) {
35
+ function _UncontrolledTransition(_ref, ref) {
36
36
  let _ref$className = _ref.className,
37
37
  className = _ref$className === void 0 ? "" : _ref$className,
38
38
  contentClassName = _ref.contentClassName,
@@ -114,5 +114,6 @@ function UncontrolledTransition(_ref, ref) {
114
114
  contentClassName: contentClassName
115
115
  }, props), childStack) : null);
116
116
  }
117
- var _default = /*#__PURE__*/(0, _react.forwardRef)(UncontrolledTransition);
117
+ const UncontrolledTransition = /*#__PURE__*/(0, _react.forwardRef)(_UncontrolledTransition);
118
+ var _default = UncontrolledTransition;
118
119
  exports.default = _default;
@@ -37,13 +37,13 @@ declare type Props = {
37
37
  */
38
38
  Content: (props: WalletConnectionProps) => ReactElement;
39
39
  };
40
- declare const _default: React.ForwardRefExoticComponent<Props & {
40
+ declare const WalletConnectionWrapper: React.ForwardRefExoticComponent<Props & {
41
41
  children?: React.ReactNode;
42
42
  } & React.RefAttributes<{
43
43
  connect: () => Promise<void>;
44
44
  disconnect: () => void;
45
45
  }>>;
46
- export default _default;
46
+ export default WalletConnectionWrapper;
47
47
  export declare const BaseWalletConnectionWrapper: React.ForwardRefExoticComponent<Props & {
48
48
  children?: any;
49
49
  } & React.RefAttributes<{
@@ -23,7 +23,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
23
23
  /**
24
24
  * This component handles a lot of cenarios when dealing with the wallet connection to different providers (ex: Metamask)
25
25
  **/
26
- function WalletConnectionWrapper(props, ref) {
26
+ function _WalletConnectionWrapper(props, ref) {
27
27
  return /*#__PURE__*/_react.default.createElement(_useWallet.UseWalletProvider, null, /*#__PURE__*/_react.default.createElement(Content, _extends({
28
28
  compRef: ref || /*#__PURE__*/(0, _react.createRef)()
29
29
  }, props)));
@@ -126,7 +126,8 @@ function Content(_ref) {
126
126
  wallet: wallet.account
127
127
  }), children));
128
128
  }
129
- var _default = /*#__PURE__*/(0, _react.forwardRef)(WalletConnectionWrapper);
129
+ const WalletConnectionWrapper = /*#__PURE__*/(0, _react.forwardRef)(_WalletConnectionWrapper);
130
+ var _default = WalletConnectionWrapper;
130
131
  exports.default = _default;
131
132
  const BaseWalletConnectionWrapper = /*#__PURE__*/(0, _react.forwardRef)(_BaseWalletConnectionWrapper);
132
133
  exports.BaseWalletConnectionWrapper = BaseWalletConnectionWrapper;
@@ -56,6 +56,7 @@ export default function useHero(id: string, options?: Partial<{
56
56
  heroRef: React.RefObject<HTMLDivElement>;
57
57
  getHerosOnScreen: () => HTMLDivElement[];
58
58
  trigger: () => void;
59
+ heroComponentRef: (componentId: string) => (elRef: HTMLDivElement | null) => void;
59
60
  };
60
61
  declare type EVENTS_INTERFACE = Parameters<typeof useHero>[2];
61
62
  declare type TRANSITION_TYPES = "ACCELERATION";
@@ -29,6 +29,42 @@ const ID = function ID(id) {
29
29
  return "".concat(id, "-hero");
30
30
  };
31
31
  const viewport = window.visualViewport;
32
+ const DATA_TAG_HERO_COMPONENT = "data-hero-component";
33
+ function triggerDynamicComponents(clone, componentsThatWillAppear) {
34
+ const idsThatWillAppear = componentsThatWillAppear.map(function (a) {
35
+ return a.getAttribute(DATA_TAG_HERO_COMPONENT);
36
+ });
37
+ const preexistingComponents = Array.from(clone.querySelectorAll("[".concat(DATA_TAG_HERO_COMPONENT, "]")));
38
+ const removedElements = preexistingComponents.filter(function (el) {
39
+ return !idsThatWillAppear.includes(el.getAttribute(DATA_TAG_HERO_COMPONENT));
40
+ });
41
+ for (let elementThatIsBeingRemoved of removedElements) {
42
+ elementThatIsBeingRemoved.style.height = "".concat(elementThatIsBeingRemoved.clientHeight, "px");
43
+ }
44
+ setTimeout(function () {
45
+ for (let elementThatIsBeingRemoved of removedElements) {
46
+ elementThatIsBeingRemoved.style.height = "0px";
47
+ elementThatIsBeingRemoved.style.opacity = "0";
48
+ }
49
+ }, 0);
50
+ for (let componentThatWillAppear of componentsThatWillAppear) {
51
+ const alreadyInjectedElement = !!clone.querySelector("[".concat(DATA_TAG_HERO_COMPONENT, "=\"").concat(componentThatWillAppear.getAttribute(DATA_TAG_HERO_COMPONENT), "\"]"));
52
+ if (!alreadyInjectedElement) {
53
+ const targetElementClone = componentThatWillAppear.cloneNode(true);
54
+ targetElementClone.style.height = "0px";
55
+ const shouldBeInsrtedAtIndex = Array.from(componentThatWillAppear.parentElement.children).indexOf(componentThatWillAppear);
56
+ const remainingIndexes = Array.from(clone.children).map(function (el, i) {
57
+ return removedElements.includes(el) ? undefined : i;
58
+ }).filter(function (e) {
59
+ return e !== undefined;
60
+ });
61
+ if (shouldBeInsrtedAtIndex === remainingIndexes.length) clone.append(targetElementClone);else clone.insertBefore(targetElementClone, clone.childNodes.item(remainingIndexes[shouldBeInsrtedAtIndex]));
62
+ setTimeout(function () {
63
+ targetElementClone.style.height = "".concat(componentThatWillAppear.clientHeight, "px");
64
+ }, 0);
65
+ }
66
+ }
67
+ }
32
68
 
33
69
  /**
34
70
  * This hook implements the logic for a hero animation between 2 elements
@@ -132,13 +168,18 @@ function useHero(id) {
132
168
  const el = heroRef.current;
133
169
  const cleanup = function cleanup() {
134
170
  if (events.onHeroEnd) events.onHeroEnd();
135
- clone.remove();
136
171
  if (el) {
137
172
  if (repeatable) el.setAttribute(dataProperty, id);
138
173
  el.style.visibility = "";
139
174
  }
175
+ setTimeout(function () {
176
+ clone.remove();
177
+ }, 0);
140
178
  };
141
- if (events.onHeroStart) events.onHeroStart(clone, otherElement, heroRef.current);
179
+ if (events.onHeroStart) {
180
+ events.onHeroStart(clone, otherElement, heroRef.current);
181
+ }
182
+ triggerDynamicComponents(clone, Array.from(heroRef.current.querySelectorAll("[".concat(DATA_TAG_HERO_COMPONENT, "]"))));
142
183
  if (!el) {
143
184
  cleanup();
144
185
  return;
@@ -180,7 +221,15 @@ function useHero(id) {
180
221
  return {
181
222
  heroRef: heroRef,
182
223
  getHerosOnScreen: getHerosOnScreen,
183
- trigger: triggerHeroAnimation
224
+ trigger: triggerHeroAnimation,
225
+ heroComponentRef: function heroComponentRef(componentId) {
226
+ return function (elRef) {
227
+ if (elRef) {
228
+ elRef.setAttribute(DATA_TAG_HERO_COMPONENT, componentId);
229
+ elRef.classList.add(_useHeroModule.default.component);
230
+ }
231
+ };
232
+ }
184
233
  };
185
234
  }
186
235
  function isElementOutsideViewport(coordinates) {
@@ -1,3 +1,5 @@
1
+ @import "../assets/styles/index.scss";
2
+
1
3
  $timing: cubic-bezier(0.5, -0.45, 0.44, 1.37);
2
4
  // $timing: cubic-bezier(0.73, -0.49, 0.16, 1.4);
3
5
 
@@ -31,3 +33,8 @@ $timing: cubic-bezier(0.5, -0.45, 0.44, 1.37);
31
33
  transform: rotateY(0deg);
32
34
  }
33
35
  }
36
+
37
+ .component {
38
+ transition: height $fast linear, opacity $fast linear;
39
+ overflow: hidden;
40
+ }
package/dist/types.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- declare type PrependNextNum<A extends Array<unknown>> = A['length'] extends infer T ? ((t: T, ...a: A) => void) extends ((...x: infer X) => void) ? X : never : never;
1
+ declare type PrependNextNum<A extends Array<unknown>> = A["length"] extends infer T ? ((t: T, ...a: A) => void) extends (...x: infer X) => void ? X : never : never;
2
2
  declare type EnumerateInternal<A extends Array<unknown>, N extends number> = {
3
3
  0: A;
4
4
  1: EnumerateInternal<PrependNextNum<A>, N>;
5
- }[N extends A['length'] ? 0 : 1];
6
- export declare type Enumerate<N extends number> = EnumerateInternal<[], N> extends (infer E)[] ? E : never;
5
+ }[N extends A["length"] ? 0 : 1];
6
+ export declare type Enumerate<N extends number> = EnumerateInternal<[
7
+ ], N> extends (infer E)[] ? E : never;
7
8
  export declare type Range<FROM extends number, TO extends number> = Exclude<Enumerate<TO>, Enumerate<FROM>>;
8
9
  export declare type CommonErrorCodes = "UNEXPECTED_ERROR";
9
10
  export declare type BasicContext<T extends object> = {
@@ -46,7 +47,7 @@ export declare type DeepMap<T, TValue> = {
46
47
  [K in keyof T]?: IsAny<T[K]> extends true ? any : NonNullable<T[K]> extends NestedValue | Date | FileList | File ? TValue : NonUndefined<T[K]> extends object | null ? DeepMap<T[K], TValue> : NonUndefined<T[K]> extends Array<infer U> ? IsAny<U> extends true ? Array<any> : U extends NestedValue | Date | FileList ? Array<TValue> : U extends object ? Array<DeepMap<U, TValue>> : Array<TValue> : TValue;
47
48
  };
48
49
  export declare type IsFlatObject<T extends object> = Extract<Exclude<T[keyof T], NestedValue | Date | FileList>, any[] | object> extends never ? true : false;
49
- declare type IsTuple<T extends ReadonlyArray<any>> = number extends T['length'] ? false : true;
50
+ declare type IsTuple<T extends ReadonlyArray<any>> = number extends T["length"] ? false : true;
50
51
  declare type TupleKey<T extends ReadonlyArray<any>> = Exclude<keyof T, keyof any[]>;
51
52
  declare type ArrayKey = number;
52
53
  declare type PathImpl<K extends string | number, V> = V extends Primitive ? `${K}` : `${K}.${Path<V>}`;
@@ -69,4 +70,10 @@ export declare type FieldArrayPathValue<TFieldValues extends FieldValues, TField
69
70
  export declare type FieldPathValues<TFieldValues extends FieldValues, TPath extends FieldPath<TFieldValues>[] | readonly FieldPath<TFieldValues>[]> = {} & {
70
71
  [K in keyof TPath]: FieldPathValue<TFieldValues, TPath[K] & FieldPath<TFieldValues>>;
71
72
  };
73
+ export declare type ToFirebaseType<B> = {
74
+ [k in keyof B]: B[k] extends Date ? import("firebase/firestore").Timestamp : B[k] extends Object ? ToFirebaseType<B[k]> : B[k];
75
+ };
76
+ export declare type FromFirebaseType<B> = {
77
+ [k in keyof B]: B[k] extends import("firebase/firestore").Timestamp ? Date : B[k] extends Object ? FromFirebaseType<B[k]> : B[k];
78
+ };
72
79
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onepercentio/one-ui",
3
- "version": "0.20.5",
3
+ "version": "0.21.1",
4
4
  "description": "A set of reusable components created through the development of Onepercent projects",
5
5
  "repository": "git@github.com:onepercentio/one-ui.git",
6
6
  "author": "Murilo Oliveira de Araujo <murilo.araujo@onepercent.io>",
@@ -40,6 +40,7 @@
40
40
  "babel-plugin-remove-unused-vars": "2.2.0",
41
41
  "buffer": "^6.0.3",
42
42
  "chroma-js": "^2.4.2",
43
+ "color-seed": "^1.1.3",
43
44
  "cpy-cli": "^3.1.1",
44
45
  "crypto-browserify": "^3.12.0",
45
46
  "css-loader": "^5",