@neuralytics/alpine-ds 0.1.0
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
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Alpine
|
|
2
|
+
|
|
3
|
+
## Neuralytics - Design System
|
|
4
|
+
|
|
5
|
+
To use it correctly, you have to install some dependencies:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm i -D neuralytics-alpine-ds tailwindcss autoprefixer @egoist/tailwindcss-icons
|
|
9
|
+
pnpm i class-variance-authority @iconify-json/mdi
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
After that, you have to init your tailwindcss configuration:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx tailwindcss init
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
And add the following lines to your `tailwind.config.js`:
|
|
21
|
+
***TO DO** : Export tailwind config*
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
const { iconsPlugin, getIconCollections } = require("@egoist/tailwindcss-icons")
|
|
25
|
+
|
|
26
|
+
/** @type {import('tailwindcss').Config} */
|
|
27
|
+
module.exports = {
|
|
28
|
+
content: ["./index.html", "./src/**/*.{vue,ts,mdx}"],
|
|
29
|
+
theme: {
|
|
30
|
+
fontSize: {
|
|
31
|
+
sm: ["12px", "16px"],
|
|
32
|
+
base: ["14px", "20px"],
|
|
33
|
+
lg: ["16px", "24px"],
|
|
34
|
+
xl: ["18px", "28px"],
|
|
35
|
+
},
|
|
36
|
+
colors: {
|
|
37
|
+
black: "#000000",
|
|
38
|
+
white: "#ffffff",
|
|
39
|
+
transparent: "transparent",
|
|
40
|
+
inherit: "inherit",
|
|
41
|
+
// brand
|
|
42
|
+
brand: {
|
|
43
|
+
100: "color-mix(in srgb, var(--color-brand) 10%, white)",
|
|
44
|
+
200: "color-mix(in srgb, var(--color-brand) 30%, white)",
|
|
45
|
+
300: "color-mix(in srgb, var(--color-brand) 50%, white)",
|
|
46
|
+
400: "color-mix(in srgb, var(--color-brand) 70%, white)",
|
|
47
|
+
500: "var(--color-brand)",
|
|
48
|
+
600: "color-mix(in srgb, var(--color-brand), black 10%)",
|
|
49
|
+
700: "color-mix(in srgb, var(--color-brand), black 30%)",
|
|
50
|
+
800: "color-mix(in srgb, var(--color-brand), black 50%)",
|
|
51
|
+
900: "color-mix(in srgb, var(--color-brand), black 70%)",
|
|
52
|
+
},
|
|
53
|
+
// neutral
|
|
54
|
+
gray: {
|
|
55
|
+
50: "#fafafa",
|
|
56
|
+
100: "#f5f5f5",
|
|
57
|
+
200: "#e5e5e5",
|
|
58
|
+
300: "#d4d4d4",
|
|
59
|
+
400: "#a3a3a3",
|
|
60
|
+
500: "#737373",
|
|
61
|
+
600: "#525252",
|
|
62
|
+
700: "#404040",
|
|
63
|
+
800: "#262626",
|
|
64
|
+
900: "#171717",
|
|
65
|
+
},
|
|
66
|
+
// red
|
|
67
|
+
red: {
|
|
68
|
+
100: "#fee2e2",
|
|
69
|
+
200: "#fecaca",
|
|
70
|
+
300: "#fca5a5",
|
|
71
|
+
400: "#f87171",
|
|
72
|
+
500: "#ef4444",
|
|
73
|
+
600: "#dc2626",
|
|
74
|
+
700: "#b91c1c",
|
|
75
|
+
800: "#991b1b",
|
|
76
|
+
900: "#7f1d1d",
|
|
77
|
+
},// amber
|
|
78
|
+
yellow: {
|
|
79
|
+
100: "#fef3c7",
|
|
80
|
+
200: "#fde68a",
|
|
81
|
+
300: "#fcd34d",
|
|
82
|
+
400: "#fbbf24",
|
|
83
|
+
500: "#f59e0b",
|
|
84
|
+
600: "#d97706",
|
|
85
|
+
700: "#b45309",
|
|
86
|
+
800: "#92400e",
|
|
87
|
+
900: "#78350f",
|
|
88
|
+
},
|
|
89
|
+
// blue
|
|
90
|
+
blue: {
|
|
91
|
+
100: "#dbeafe",
|
|
92
|
+
200: "#bfdbfe",
|
|
93
|
+
300: "#93c5fd",
|
|
94
|
+
400: "#60a5fa",
|
|
95
|
+
500: "#3b82f6",
|
|
96
|
+
600: "#2563eb",
|
|
97
|
+
700: "#1d4ed8",
|
|
98
|
+
800: "#1e40af",
|
|
99
|
+
900: "#1e3a8a",
|
|
100
|
+
},
|
|
101
|
+
// green
|
|
102
|
+
green: {
|
|
103
|
+
100: "#dcfce7",
|
|
104
|
+
200: "#bbf7d0",
|
|
105
|
+
300: "#86efac",
|
|
106
|
+
400: "#4ade80",
|
|
107
|
+
500: "#22c55e",
|
|
108
|
+
600: "#16a34a",
|
|
109
|
+
700: "#15803d",
|
|
110
|
+
800: "#166534",
|
|
111
|
+
900: "#14532d",
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
extend: { boxShadow: { "inner-md": "inset 0px 4px 6px rgba(0, 0, 0, 0.1)", }, }
|
|
115
|
+
},
|
|
116
|
+
plugins: [
|
|
117
|
+
iconsPlugin({
|
|
118
|
+
// Collections: https://icones.js.org/
|
|
119
|
+
collections: getIconCollections(["mdi"]),
|
|
120
|
+
})
|
|
121
|
+
],
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Add those lines to your main css file:
|
|
126
|
+
|
|
127
|
+
```css
|
|
128
|
+
@tailwind base;
|
|
129
|
+
@tailwind components;
|
|
130
|
+
@tailwind utilities;
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
and import the `neuralytics-alpine-ds` style to your main file:
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
import "neuralytics-alpine-ds/css"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
To use neuralytics-alpine-ds components, follow the examples below:
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
import { AlpineButton } from "neuralytics-alpine-ds"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### You want more ?
|
|
148
|
+
|
|
149
|
+
Do not worry, it's a V0 ! We are working on it to provide you more components and features.
|
|
150
|
+
Thank you for your patience and your interest in our design system.
|
|
151
|
+
|
|
152
|
+
Love.
|
|
153
|
+
P-a ❤️
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@neuralytics/alpine-ds",
|
|
3
|
+
"description": "Neuralytics Design System, also called Alpine.",
|
|
4
|
+
"private": false,
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"src/components/"
|
|
10
|
+
],
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"neuralytics",
|
|
14
|
+
"alpine",
|
|
15
|
+
"design-system",
|
|
16
|
+
"vue3",
|
|
17
|
+
"vue",
|
|
18
|
+
"vuejs",
|
|
19
|
+
"tailwindcss"
|
|
20
|
+
],
|
|
21
|
+
"main": "./dist/neuralytics-alpine-ds.umd.cjs",
|
|
22
|
+
"module": "./dist/neuralytics-alpine-ds.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": "./dist/neuralytics-alpine-ds.js",
|
|
27
|
+
"require": "./dist/neuralytics-alpine-ds.umd.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./css": {
|
|
30
|
+
"import": "./dist/style.css",
|
|
31
|
+
"require": "./dist/style.css"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@iconify-json/mdi": "^1.1.64",
|
|
36
|
+
"class-variance-authority": "^0.7.0",
|
|
37
|
+
"vue": "^3.4.21"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@egoist/tailwindcss-icons": "^1.7.4",
|
|
41
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
42
|
+
"autoprefixer": "^10.4.19",
|
|
43
|
+
"path": "^0.12.7",
|
|
44
|
+
"tailwindcss": "^3.4.3",
|
|
45
|
+
"typescript": "^5.2.2",
|
|
46
|
+
"vite": "^5.2.0",
|
|
47
|
+
"vite-plugin-dts": "^3.8.1",
|
|
48
|
+
"vue-tsc": "^2.0.6"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"dev": "vite",
|
|
52
|
+
"build": "vue-tsc && vite build",
|
|
53
|
+
"preview": "vite preview"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
:class="buttonVariants(cva)"
|
|
4
|
+
@click="handleClick">
|
|
5
|
+
<Icon
|
|
6
|
+
v-if="isLoading"
|
|
7
|
+
:icon="'i-mdi-loading'"
|
|
8
|
+
class="animate-spin"
|
|
9
|
+
size="sm" />
|
|
10
|
+
<Icon
|
|
11
|
+
v-else-if="icon && iconPosition === 'left'"
|
|
12
|
+
:icon="icon"
|
|
13
|
+
size="sm" />
|
|
14
|
+
<span
|
|
15
|
+
v-if="label"
|
|
16
|
+
class="leading-none">
|
|
17
|
+
{{ label }}
|
|
18
|
+
</span>
|
|
19
|
+
<Icon
|
|
20
|
+
v-if="!isLoading && (icon && iconPosition === 'right')"
|
|
21
|
+
:icon="icon"
|
|
22
|
+
size="sm" />
|
|
23
|
+
</button>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { buttonVariants, type ButtonVariants } from "."
|
|
28
|
+
import { computed, ComputedRef } from "vue"
|
|
29
|
+
import Icon from "../icon/AlpineIcon.vue"
|
|
30
|
+
|
|
31
|
+
export interface Props {
|
|
32
|
+
variant?: ButtonVariants["variant"],
|
|
33
|
+
label?: string | null,
|
|
34
|
+
icon?: string | null,
|
|
35
|
+
iconPosition?: string,
|
|
36
|
+
isLoading?: boolean,
|
|
37
|
+
isDisabled?: boolean
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
41
|
+
variant: "primary",
|
|
42
|
+
label: null,
|
|
43
|
+
icon: null,
|
|
44
|
+
iconPosition: "left"
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const emit = defineEmits(["clicked"])
|
|
48
|
+
|
|
49
|
+
const currentStatus = computed(() => {
|
|
50
|
+
if (props.isLoading) return "loading"
|
|
51
|
+
if (props.isDisabled) return "disabled"
|
|
52
|
+
return "default"
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const cva: ComputedRef<ButtonVariants> = computed(() => {
|
|
56
|
+
return {
|
|
57
|
+
variant: props.variant,
|
|
58
|
+
status: currentStatus.value
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
function handleClick() {
|
|
63
|
+
if (props.isLoading || props.isDisabled) return
|
|
64
|
+
emit("clicked")
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
2
|
+
import AlpineButton from "./AlpineButton.vue"
|
|
3
|
+
|
|
4
|
+
export const buttonVariants = cva(
|
|
5
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-lg text-base font-medium transition-all ease-out duration-200 active:shadow-inner-md outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-brand-500 focus-visible:outline-offset-2",
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
primary: "text-white bg-brand-500 hover:bg-brand-600 h-9 px-4 gap-2 hover:shadow",
|
|
10
|
+
secondary: "text-gray-900 bg-gray-50 hover:bg-gray-100 border border-gray-300 h-9 px-4 gap-2 hover:shadow",
|
|
11
|
+
invisible: "text-gray-900 hover:bg-gray-200 p-2 gap-2",
|
|
12
|
+
},
|
|
13
|
+
status: {
|
|
14
|
+
default: "",
|
|
15
|
+
loading: "cursor-wait hover:shadow-none active:shadow-none",
|
|
16
|
+
disabled: "cursor-not-allowed hover:shadow-none active:shadow-none",
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
compoundVariants: [
|
|
20
|
+
{
|
|
21
|
+
variant: "primary",
|
|
22
|
+
status: ["loading", "disabled"],
|
|
23
|
+
class: "!bg-gray-200 hover:!bg-gray-200 !text-gray-500"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
variant: "secondary",
|
|
27
|
+
status: ["loading", "disabled"],
|
|
28
|
+
class: "!text-gray-400 hover:!bg-gray-50"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
variant: "invisible",
|
|
32
|
+
status: ["loading", "disabled"],
|
|
33
|
+
class: "!text-gray-400 hover:!bg-gray-100"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
variant: "primary",
|
|
38
|
+
status: "default"
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
)
|
|
42
|
+
export type ButtonVariants = VariantProps<typeof buttonVariants>
|
|
43
|
+
|
|
44
|
+
export default AlpineButton
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
:class="[displayedIcon, iconColor, iconVariants({ size: props.size })]"
|
|
4
|
+
@mouseover="isHoverIcon = true"
|
|
5
|
+
@mouseleave="isHoverIcon = false" />
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { computed, ref } from "vue"
|
|
10
|
+
import { type IconVariants, iconVariants } from "."
|
|
11
|
+
|
|
12
|
+
export interface Props {
|
|
13
|
+
size?: IconVariants["size"],
|
|
14
|
+
icon: string,
|
|
15
|
+
hoverIcon?: string | null,
|
|
16
|
+
color?: string,
|
|
17
|
+
hoverColor?: string | null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
21
|
+
size: "md",
|
|
22
|
+
hoverIcon: null,
|
|
23
|
+
color: "text-neutral-900",
|
|
24
|
+
hoverColor: null
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const isHoverIcon = ref(false)
|
|
28
|
+
const iconColor = computed(() => isHoverIcon.value && props.hoverColor ? props.hoverColor : props.color)
|
|
29
|
+
const displayedIcon = computed(() => isHoverIcon.value && props.hoverIcon ? props.hoverIcon : props.icon)
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
2
|
+
import AlpineIcon from "./AlpineIcon.vue"
|
|
3
|
+
|
|
4
|
+
export const iconVariants = cva(
|
|
5
|
+
"",
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: "text-[20px]",
|
|
10
|
+
md: "text-[24px]",
|
|
11
|
+
lg: "text-[28px]",
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: { size: "md" },
|
|
15
|
+
},
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
export type IconVariants = VariantProps<typeof iconVariants>
|
|
19
|
+
export default AlpineIcon
|