@rabbitio/ui-kit 1.0.0-beta.3 → 1.0.0-beta.5

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.
package/README.md CHANGED
@@ -4,21 +4,28 @@ npm install --save @rabbitio/ui-kit
4
4
  ~~~
5
5
 
6
6
  # Using library
7
- 1. To use components for web import the following way:
7
+ 1. To use components for web:
8
+ * import the following way
8
9
  ~~~
9
- import { Button } from "@rabbitio/ui-kit/web";
10
+ import { Button } from "@rabbitio/ui-kit";
10
11
  ~~~
11
- 2. To use components for node import the following way:
12
+ * add top-level styles import
12
13
  ~~~
13
- import { Button } from "@rabbitio/ui-kit/node";
14
+ import "@rabbitio/ui-kit/index.css";
14
15
  ~~~
15
- 3. To use components for next.js import the following way and add "@rabbitio/ui-kit" to transpilePackages inside your next.config.js:
16
+ 2. To use components for next.js import the following way and add "@rabbitio/ui-kit" to transpilePackages inside your next.config.js:
17
+
18
+ * Import the following way
16
19
  ~~~
17
- import { Button } from "@rabbitio/ui-kit";
20
+ import { Button } from "@rabbitio/ui-kit/next";
21
+ ~~~
22
+ * add "@rabbitio/ui-kit" to transpilePackages in next.config.js
23
+ ~~~
24
+ transpilePackages: ["@rabbitio/ui-kit"],
18
25
  ~~~
19
- 4. [In progress] Also, you can import base styles into your scss index file:
26
+ * Import styles inside pages/_app.js
20
27
  ~~~
21
- @import "@rabbitio/ui-kit/styles/index";
28
+ import "@rabbitio/ui-kit/index.css";
22
29
  ~~~
23
30
 
24
31
  # Adding new component
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabbitio/ui-kit",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "Rabbit.io react.js components kit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -11,13 +11,12 @@
11
11
  "require": "./dist/index.cjs",
12
12
  "default": "./dist/index.modern.js"
13
13
  },
14
- "./next": "./index.js"
14
+ "./next": "./index.js",
15
+ "./index.css": "./dist/index.css"
15
16
  },
16
17
  "scripts": {
17
18
  "build": "rm -rf dist && microbundle --no-compress --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react --globals react/jsx-runtime=jsx --visualize",
18
- "build-dev": "rm -rf dist && NODE_ENV=production webpack --mode development",
19
- "build-prod": "rm -rf dist && NODE_ENV=production webpack --mode production",
20
- "prepublish": "npm run build-prod",
19
+ "prepublish": "npm run build",
21
20
  "storybook": "storybook dev -p 6006",
22
21
  "build-storybook": "storybook build"
23
22
  },
@@ -35,19 +34,14 @@
35
34
  "author": "admin@rabbit.io",
36
35
  "license": "MIT",
37
36
  "peerDependencies": {
38
- "react": ">=16.0.0",
39
- "react-dom": ">=16.0.0",
40
- "react-router-dom": ">=6.21.1"
37
+ "react": ">=18.2.0",
38
+ "react-dom": ">=18.2.0"
41
39
  },
42
40
  "dependencies": {
43
- "react": ">=16.0.0",
44
- "react-dom": ">=16.0.0",
45
- "react-router-dom": ">=6.21.1"
41
+ "react": ">=18.2.0",
42
+ "react-dom": ">=18.2.0"
46
43
  },
47
44
  "devDependencies": {
48
- "@babel/core": "^7.23.7",
49
- "@babel/preset-env": "^7.23.7",
50
- "@babel/preset-react": "^7.23.3",
51
45
  "@storybook/addon-actions": "^7.6.6",
52
46
  "@storybook/addon-backgrounds": "^7.6.6",
53
47
  "@storybook/addon-essentials": "^7.6.6",
@@ -60,19 +54,14 @@
60
54
  "@storybook/react": "^7.6.6",
61
55
  "@storybook/react-webpack5": "^7.6.6",
62
56
  "@storybook/test": "^7.6.6",
63
- "babel-loader": "^9.1.3",
64
- "css-loader": "^6.8.1",
65
57
  "microbundle": "^0.15.1",
66
- "node-sass": "^7.0.3",
67
58
  "prettier": "^3.1.1",
68
59
  "prop-types": "^15.8.1",
69
60
  "resolve-url-loader": "^5.0.0",
70
- "sass": "^1.69.5",
71
- "sass-loader": "^13.3.3",
61
+ "sass": "^1.70.0",
62
+ "sass-loader": "^14.1.0",
72
63
  "storybook": "^7.6.6",
73
- "style-loader": "^3.3.3",
74
- "webpack": "^5.89.0",
75
- "webpack-cli": "^5.1.4"
64
+ "style-loader": "^3.3.3"
76
65
  },
77
66
  "prettier": {
78
67
  "trailingComma": "es5",
@@ -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}