@rabbitio/ui-kit 1.0.0-beta.1 → 1.0.0-beta.10

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 (42) hide show
  1. package/README.md +15 -8
  2. package/dist/index.cjs +1901 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.css +8758 -0
  5. package/dist/index.css.map +1 -0
  6. package/dist/index.modern.js +1809 -0
  7. package/dist/index.modern.js.map +1 -0
  8. package/dist/index.module.js +1891 -0
  9. package/dist/index.module.js.map +1 -0
  10. package/dist/index.umd.js +1905 -0
  11. package/dist/index.umd.js.map +1 -0
  12. package/index.js +1 -1
  13. package/package.json +21 -25
  14. package/src/common/amountUtils.js +423 -0
  15. package/src/common/errorUtils.js +27 -0
  16. package/src/common/fiatCurrenciesService.js +161 -0
  17. package/src/components/atoms/AssetIcon/AssetIcon.jsx +55 -0
  18. package/src/components/atoms/AssetIcon/asset-icon.module.scss +42 -0
  19. package/{stories → src/components}/atoms/LoadingDots/LoadingDots.module.scss +1 -1
  20. package/src/components/atoms/SupportChat/SupportChat.jsx +40 -0
  21. package/{stories → src/components}/atoms/buttons/Button/Button.jsx +6 -6
  22. package/{stories → src/components}/atoms/buttons/Button/Button.module.scss +6 -1
  23. package/src/index.js +10 -0
  24. package/styles/index.scss +10 -10
  25. package/dist/node/52a99d58a36f2b7a78b3.ttf +0 -0
  26. package/dist/node/662b866576cfea51dd64.ttf +0 -0
  27. package/dist/node/7f9eed4cca4d0ae6a772.ttf +0 -0
  28. package/dist/node/8268666c3b2ca2ec11c0.ttf +0 -0
  29. package/dist/node/87d9266583abd389ca1f.ttf +0 -0
  30. package/dist/node/index.js +0 -3
  31. package/dist/node/index.js.LICENSE.txt +0 -32
  32. package/dist/node/index.js.map +0 -1
  33. package/dist/web/52a99d58a36f2b7a78b3.ttf +0 -0
  34. package/dist/web/662b866576cfea51dd64.ttf +0 -0
  35. package/dist/web/7f9eed4cca4d0ae6a772.ttf +0 -0
  36. package/dist/web/8268666c3b2ca2ec11c0.ttf +0 -0
  37. package/dist/web/87d9266583abd389ca1f.ttf +0 -0
  38. package/dist/web/index.js +0 -3
  39. package/dist/web/index.js.LICENSE.txt +0 -32
  40. package/dist/web/index.js.map +0 -1
  41. package/stories/index.js +0 -2
  42. /package/{stories → src/components}/atoms/LoadingDots/LoadingDots.jsx +0 -0
@@ -0,0 +1,42 @@
1
+ @import "../../../../styles/index";
2
+
3
+ .asset-icon {
4
+ width: 34px;
5
+ height: 34px;
6
+ position: relative;
7
+
8
+ &.small {
9
+ width: 24px;
10
+ height: 24px;
11
+ }
12
+
13
+ &-primary {
14
+ height: 34px;
15
+ width: 34px;
16
+
17
+ &.small {
18
+ width: 24px;
19
+ height: 24px;
20
+ }
21
+ }
22
+
23
+ &-secondary {
24
+ width: 17px;
25
+ height: 17px;
26
+
27
+ position: absolute;
28
+ right: -3px;
29
+ bottom: -3px;
30
+ box-shadow: -2px -2px 4px 1px rgba(SolidColor("dark"), 0.3);
31
+ border-radius: 100%;
32
+
33
+ &.small {
34
+ width: 12px;
35
+ height: 12px;
36
+
37
+ right: -2px;
38
+ bottom: -2px;
39
+ box-shadow: -1px -1px 8px 1px rgba(SolidColor("dark"), 0.3);
40
+ }
41
+ }
42
+ }
@@ -1,4 +1,4 @@
1
- @import "../../../styles/index";
1
+ @import "../../../../styles/index";
2
2
 
3
3
  .loading-dots {
4
4
  display: flex;
@@ -0,0 +1,40 @@
1
+ import { useEffect } from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ export const SupportChat = ({ url, websiteToken, welcomeMessage = "" }) => {
5
+ useEffect(() => {
6
+ window.chatwootSettings = {
7
+ position: "right",
8
+ type: "standard",
9
+ launcherTitle: welcomeMessage,
10
+ };
11
+ (function (d, t) {
12
+ var BASE_URL = url;
13
+ var g = d.createElement(t),
14
+ s = d.getElementsByTagName(t)[0];
15
+ g.src = BASE_URL + "/packs/js/sdk.js";
16
+ g.defer = true;
17
+ g.async = true;
18
+ s.parentNode.insertBefore(g, s);
19
+ g.onload = function () {
20
+ window.chatwootSDK.run({
21
+ websiteToken: websiteToken,
22
+ baseUrl: BASE_URL,
23
+ });
24
+ };
25
+ })(document, "script");
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps
27
+ }, []);
28
+
29
+ return null;
30
+ };
31
+
32
+ SupportChat.propTypes = {
33
+ url: PropTypes.string.isRequired,
34
+ websiteToken: PropTypes.string.isRequired,
35
+ welcomeMessage: PropTypes.string,
36
+ };
37
+
38
+ SupportChat.defaultProps = {
39
+ welcomeMessage: "",
40
+ };
@@ -1,5 +1,4 @@
1
1
  import React, { useEffect, useRef, useState } from "react";
2
- import { Link } from "react-router-dom";
3
2
  import PropTypes from "prop-types";
4
3
 
5
4
  import styles from "./Button.module.scss";
@@ -9,7 +8,7 @@ import { LoadingDots } from "../../LoadingDots/LoadingDots.jsx";
9
8
  /**
10
9
  * Button component - A versatile and customizable button for React applications.
11
10
  * It supports various sizes, styles, and functionalities, including loaders, icons, and handling of click events.
12
- * This component can also be used as a link when integrated with `react-router-dom`.
11
+ * This component can also be used as a link if "to" is provided.
13
12
  *
14
13
  * @component
15
14
  * @param {Object} props
@@ -108,11 +107,11 @@ export const Button = ({
108
107
  <>
109
108
  {isFormSubmittingButton ? <input type="submit" hidden /> : null}
110
109
  {to ? (
111
- <Link
110
+ <a
112
111
  className={classNames}
113
112
  onClick={(e) => handleError(buttonClick, e)}
114
- to={to}
115
- innerRef={buttonRef}
113
+ href={to}
114
+ ref={buttonRef}
116
115
  >
117
116
  {icon ? (
118
117
  <div
@@ -129,7 +128,7 @@ export const Button = ({
129
128
  ) : (
130
129
  content
131
130
  )}
132
- </Link>
131
+ </a>
133
132
  ) : (
134
133
  <div
135
134
  className={classNames}
@@ -188,6 +187,7 @@ Button.propTypes = {
188
187
  mode: PropTypes.oneOf([
189
188
  "transparent",
190
189
  "white",
190
+ "white-flat",
191
191
  "primary",
192
192
  "primary-bordered",
193
193
  "primary-transparent",
@@ -1,4 +1,4 @@
1
- @import "../../../../styles/index";
1
+ @import "../../../../../styles/index";
2
2
 
3
3
  .button {
4
4
  @extend %text-very-bold;
@@ -122,6 +122,11 @@
122
122
  box-shadow: 0 20px 20px rgba(15, 24, 75, 0.2);
123
123
  }
124
124
 
125
+ &.white-flat {
126
+ background: $white;
127
+ color: SolidColor("dark");
128
+ }
129
+
125
130
  &-primary-dots-wrapper {
126
131
  position: absolute;
127
132
  top: 50%;
package/src/index.js ADDED
@@ -0,0 +1,10 @@
1
+ // UI-KIT components
2
+ export { Button } from "./components/atoms/buttons/Button/Button.jsx";
3
+ export { LoadingDots } from "./components/atoms/LoadingDots/LoadingDots.jsx";
4
+ export { SupportChat } from "./components/atoms/SupportChat/SupportChat.jsx";
5
+ export { AssetIcon } from "./components/atoms/AssetIcon/AssetIcon.jsx";
6
+
7
+ // Common code
8
+ export { improveAndRethrow } from "./common/errorUtils.js";
9
+ export { FiatCurrenciesService } from "./common/fiatCurrenciesService.js";
10
+ export { AmountUtils } from "./common/amountUtils.js";
package/styles/index.scss CHANGED
@@ -3,31 +3,31 @@
3
3
  @import "placeholder";
4
4
 
5
5
  @font-face {
6
- src: url("fonts/NunitoSans-ExtraBold.ttf");
7
- font-family: "NunitoSans";
6
+ //src: url("fonts/NunitoSans-ExtraBold.ttf");
7
+ //font-family: "NunitoSans";
8
8
  font-weight: $extra-bold;
9
9
  }
10
10
 
11
11
  @font-face {
12
- src: url("fonts/NunitoSans-Bold.ttf");
13
- font-family: "NunitoSans";
12
+ //src: url("fonts/NunitoSans-Bold.ttf");
13
+ //font-family: "NunitoSans";
14
14
  font-weight: $bold;
15
15
  }
16
16
 
17
17
  @font-face {
18
- src: url("fonts/NunitoSans-SemiBold.ttf");
19
- font-family: "NunitoSans";
18
+ //src: url("fonts/NunitoSans-SemiBold.ttf");
19
+ //font-family: "NunitoSans";
20
20
  font-weight: 600;
21
21
  }
22
22
 
23
23
  @font-face {
24
- src: url("fonts/NunitoSans-Regular.ttf");
25
- font-family: "NunitoSans";
24
+ //src: url("fonts/NunitoSans-Regular.ttf");
25
+ //font-family: "NunitoSans";
26
26
  font-weight: 400;
27
27
  }
28
28
 
29
29
  @font-face {
30
- src: url("fonts/NunitoSans-Light.ttf");
31
- font-family: "NunitoSans";
30
+ //src: url("fonts/NunitoSans-Light.ttf");
31
+ //font-family: "NunitoSans";
32
32
  font-weight: 300;
33
33
  }
Binary file
Binary file
Binary file
Binary file
Binary file