@peerbots/core 0.2.1 → 0.2.2
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/.storybook/preview.ts +1 -1
- package/CHANGELOG.md +6 -0
- package/README.md +37 -1
- package/dist/styles/theme.css +1 -0
- package/dist/styles/theme.d.mts +2 -0
- package/dist/styles/theme.d.ts +2 -0
- package/dist/theme.css +1 -0
- package/dist/theme.d.mts +2 -0
- package/dist/theme.d.ts +2 -0
- package/package.json +14 -2
- package/src/index.ts +1 -1
- package/src/styles/index.css +40 -0
- package/src/styles/theme.css +0 -40
package/.storybook/preview.ts
CHANGED
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -6,4 +6,40 @@ This package contains the core components for the Peerbots UI and theming. It pr
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @peerbots/core
|
|
9
|
-
```
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### 1. Components
|
|
14
|
+
Import components and helpers directly from the package root:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Button, Dialog, SEO } from "@peerbots/core";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2. Styles
|
|
21
|
+
You can import Peerbots styles either in your JavaScript/TypeScript entry point or directly in your CSS files.
|
|
22
|
+
|
|
23
|
+
#### **In JavaScript/TypeScript**
|
|
24
|
+
```tsx
|
|
25
|
+
// Complete styles (Components + Theme)
|
|
26
|
+
import "@peerbots/core/styles";
|
|
27
|
+
|
|
28
|
+
// OR Theme variables only (Colors + Fonts)
|
|
29
|
+
import "@peerbots/core/theme";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### **In CSS**
|
|
33
|
+
If your bundler (like Vite or Webpack) supports resolving `node_modules`:
|
|
34
|
+
|
|
35
|
+
```css
|
|
36
|
+
/* Complete styles (Components + Theme) */
|
|
37
|
+
@import "@peerbots/core/styles";
|
|
38
|
+
|
|
39
|
+
/* OR Theme variables only (Colors + Fonts) */
|
|
40
|
+
@import "@peerbots/core/theme";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> [!TIP]
|
|
44
|
+
> **Which one should I use?**
|
|
45
|
+
> Use `@peerbots/core/styles` if you want the Peerbots UI components to look correct out of the box. Use `@peerbots/core/theme` if you only want to use the Peerbots color palette and typography in your own custom Tailwind project without the bundled component styles.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@theme{ --color-primary: #46d9d9; --color-dark-primary: var(--color-teal-700); --color-secondary: #e86e8a; --color-accent: #d9e021; --color-accent-hc: #c4cc24; --color-accent-two: #4273ff; --color-accent-two-hc: #516eb5; --color-accent-three: #3f8588; --color-danger: #e86e8a; --color-light-bg: #d8e7eb; --sidebar-bg: #f9ffff; --background-image-gradient-radial: radial-gradient(var(--tw-gradient-stops)); --background-image-gradient-conic: conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops)); --font-sans: "Avenir", "Nunito", sans-serif; }
|
package/dist/theme.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@theme{ --color-primary: #46d9d9; --color-dark-primary: var(--color-teal-700); --color-secondary: #e86e8a; --color-accent: #d9e021; --color-accent-hc: #c4cc24; --color-accent-two: #4273ff; --color-accent-two-hc: #516eb5; --color-accent-three: #3f8588; --color-danger: #e86e8a; --color-light-bg: #d8e7eb; --sidebar-bg: #f9ffff; --background-image-gradient-radial: radial-gradient(var(--tw-gradient-stops)); --background-image-gradient-conic: conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops)); --font-sans: "Avenir", "Nunito", sans-serif; }
|
package/dist/theme.d.mts
ADDED
package/dist/theme.d.ts
ADDED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.2",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"style": "./dist/index.css",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -14,7 +14,19 @@
|
|
|
14
14
|
"import": "./dist/index.mjs",
|
|
15
15
|
"require": "./dist/index.js"
|
|
16
16
|
},
|
|
17
|
+
"./theme": {
|
|
18
|
+
"style": "./dist/styles/theme.css",
|
|
19
|
+
"default": "./dist/styles/theme.css"
|
|
20
|
+
},
|
|
21
|
+
"./styles": {
|
|
22
|
+
"style": "./dist/index.css",
|
|
23
|
+
"default": "./dist/index.css"
|
|
24
|
+
},
|
|
17
25
|
"./theme.css": {
|
|
26
|
+
"style": "./dist/styles/theme.css",
|
|
27
|
+
"default": "./dist/styles/theme.css"
|
|
28
|
+
},
|
|
29
|
+
"./dist/index.css": {
|
|
18
30
|
"style": "./dist/index.css",
|
|
19
31
|
"default": "./dist/index.css"
|
|
20
32
|
}
|
|
@@ -26,7 +38,7 @@
|
|
|
26
38
|
"url": "git+https://github.com/peerbots/peerbots-core.git"
|
|
27
39
|
},
|
|
28
40
|
"scripts": {
|
|
29
|
-
"build": "tsup src/index.ts --format cjs,esm --dts --minify",
|
|
41
|
+
"build": "tsup src/index.ts src/styles/theme.css --format cjs,esm --dts --minify",
|
|
30
42
|
"changeset": "changeset",
|
|
31
43
|
"release": "changeset publish",
|
|
32
44
|
"storybook": "storybook dev -p 6006",
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@import "tailwindcss" prefix(pb);
|
|
2
|
+
@import "./theme.css";
|
|
3
|
+
|
|
4
|
+
@utility input-base {
|
|
5
|
+
@apply pb:bg-primary/10 pb:border pb:border-b-2 pb:border-gray-300 pb:focus:border-gray-600 pb:py-2 pb:px-2;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@utility btn-primary {
|
|
9
|
+
@apply pb:bg-primary pb:hover:bg-dark-primary pb:text-gray-900 pb:font-bold pb:py-1 pb:px-2 pb:my-1 pb:mx-2 pb:rounded-md pb:disabled:bg-gray-400 pb:disabled:hover:bg-gray-300 pb:disabled:cursor-not-allowed pb:cursor-pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@utility btn-secondary {
|
|
13
|
+
@apply pb:bg-gray-100 pb:hover:bg-gray-200 pb:text-gray-800 pb:font-normal pb:py-1 pb:px-2 pb:my-1 pb:mx-2 pb:rounded-md pb:disabled:bg-gray-400 pb:disabled:hover:bg-gray-300 pb:disabled:cursor-not-allowed pb:cursor-pointer;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@utility btn-danger {
|
|
17
|
+
@apply pb:bg-danger pb:hover:opacity-80 pb:text-gray-900 pb:font-bold pb:py-1 pb:px-2 pb:my-1 pb:mx-2 pb:rounded-md pb:disabled:bg-gray-400 pb:disabled:hover:bg-gray-300 pb:disabled:cursor-not-allowed pb:cursor-pointer;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@utility range-primary {
|
|
21
|
+
@apply pb:accent-primary pb:bg-gray-100 pb:rounded-md pb:cursor-pointer;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.range-vertical {
|
|
25
|
+
writing-mode: vertical-lr;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pb-tooltip,
|
|
29
|
+
.pb-tooltip-slow {
|
|
30
|
+
@apply pb:absolute pb:invisible pb:opacity-0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Using siblings so that hovering over the invisible tooltip doesn't trigger the tooltip */
|
|
34
|
+
.pb-has-tooltip:hover+.pb-tooltip {
|
|
35
|
+
@apply pb:visible pb:opacity-100 pb:z-50 pb:transition-opacity pb:delay-300 pb:ease-in-out;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.pb-has-tooltip:hover+.pb-tooltip-slow {
|
|
39
|
+
@apply pb:visible pb:opacity-100 pb:z-50 pb:transition-opacity pb:delay-1000 pb:ease-in-out;
|
|
40
|
+
}
|
package/src/styles/theme.css
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@import "tailwindcss" prefix(pb);
|
|
2
|
-
|
|
3
1
|
@theme {
|
|
4
2
|
--color-primary: #46d9d9;
|
|
5
3
|
/* --color-old-dark-primary: #5fc7cc; */
|
|
@@ -19,42 +17,4 @@
|
|
|
19
17
|
var(--tw-gradient-stops));
|
|
20
18
|
|
|
21
19
|
--font-sans: "Avenir", "Nunito", sans-serif;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@utility input-base {
|
|
25
|
-
@apply pb:bg-primary/10 pb:border pb:border-b-2 pb:border-gray-300 pb:focus:border-gray-600 pb:py-2 pb:px-2;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@utility btn-primary {
|
|
29
|
-
@apply pb:bg-primary pb:hover:bg-dark-primary pb:text-gray-900 pb:font-bold pb:py-1 pb:px-2 pb:my-1 pb:mx-2 pb:rounded-md pb:disabled:bg-gray-400 pb:disabled:hover:bg-gray-300 pb:disabled:cursor-not-allowed pb:cursor-pointer;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@utility btn-secondary {
|
|
33
|
-
@apply pb:bg-gray-100 pb:hover:bg-gray-200 pb:text-gray-800 pb:font-normal pb:py-1 pb:px-2 pb:my-1 pb:mx-2 pb:rounded-md pb:disabled:bg-gray-400 pb:disabled:hover:bg-gray-300 pb:disabled:cursor-not-allowed pb:cursor-pointer;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@utility btn-danger {
|
|
37
|
-
@apply pb:bg-danger pb:hover:opacity-80 pb:text-gray-900 pb:font-bold pb:py-1 pb:px-2 pb:my-1 pb:mx-2 pb:rounded-md pb:disabled:bg-gray-400 pb:disabled:hover:bg-gray-300 pb:disabled:cursor-not-allowed pb:cursor-pointer;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@utility range-primary {
|
|
41
|
-
@apply pb:accent-primary pb:bg-gray-100 pb:rounded-md pb:cursor-pointer;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.range-vertical {
|
|
45
|
-
writing-mode: vertical-lr;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.pb-tooltip,
|
|
49
|
-
.pb-tooltip-slow {
|
|
50
|
-
@apply pb:absolute pb:invisible pb:opacity-0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/* Using siblings so that hovering over the invisible tooltip doesn't trigger the tooltip */
|
|
54
|
-
.pb-has-tooltip:hover+.pb-tooltip {
|
|
55
|
-
@apply pb:visible pb:opacity-100 pb:z-50 pb:transition-opacity pb:delay-300 pb:ease-in-out;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.pb-has-tooltip:hover+.pb-tooltip-slow {
|
|
59
|
-
@apply pb:visible pb:opacity-100 pb:z-50 pb:transition-opacity pb:delay-1000 pb:ease-in-out;
|
|
60
20
|
}
|