@neuralytics/alpine-ds 0.1.5 → 0.2.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.
package/README.md CHANGED
@@ -1,153 +1,79 @@
1
- # Alpine
1
+ # @neuralytics/alpine-ds
2
2
 
3
- ## Neuralytics - Design System
3
+ ⚠️ **Work in progress** — this design system is under active development. Expect breaking changes between minor versions until `1.0.0`.
4
4
 
5
- To use it correctly, you have to install some dependencies:
5
+ ## Documentation
6
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
- ```
7
+ Component playground (Histoire): -
11
8
 
12
- ---
9
+ ## Components already available
13
10
 
14
- After that, you have to init your tailwindcss configuration:
11
+ - `AlpineButton`
12
+ - `AlpineIcon`
15
13
 
16
- ```bash
17
- npx tailwindcss init
18
- ```
14
+ ## Integration
19
15
 
20
- And add the following lines to your `tailwind.config.js`:
21
- ***TO DO** : Export tailwind config*
16
+ 1. Install the package: `pnpm add @neuralytics/alpine-ds`
17
+ 2. Install the dependencies: `pnpm add -D tailwindcss @tailwindcss/vite`
18
+ 3. Register the Tailwind Vite plugin in your `vite.config.ts` (required for Tailwind to actually process anything — without it your styles silently stay empty):
22
19
 
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
- },
20
+ ```ts
21
+ import tailwindcss from "@tailwindcss/vite"
22
+ import { defineConfig } from "vite"
23
+
24
+ export default defineConfig({
116
25
  plugins: [
117
- iconsPlugin({
118
- // Collections: https://icones.js.org/
119
- collections: getIconCollections(["mdi"]),
120
- })
26
+ // ... your other plugins ...
27
+ tailwindcss(),
121
28
  ],
122
- }
29
+ })
123
30
  ```
124
31
 
125
- Add those lines to your main css file:
32
+ 4. Import the Tailwind configuration in your main style file. The path in `@config` is relative to this CSS file — adjust it if your `tailwind.config.ts` isn't next to it (e.g. `../tailwind.config.ts` if your CSS lives in `src/` and the config is at your project root):
126
33
 
127
34
  ```css
128
- @tailwind base;
129
- @tailwind components;
130
- @tailwind utilities;
35
+ @import "tailwindcss";
36
+ @config "./tailwind.config.ts";
37
+ ```
38
+
39
+ 5. Configure Tailwind (`tailwind.config.ts`) using the design system's preset, which already handles detection of the package's classes and the icon plugin:
40
+
41
+ ```ts
42
+ import type { Config } from "tailwindcss"
43
+ import alpineDsPreset from "@neuralytics/alpine-ds/tailwind-preset"
44
+
45
+ export default {
46
+ presets: [alpineDsPreset],
47
+ content: [
48
+ // ... your source files ...
49
+ ],
50
+ } as Config
131
51
  ```
132
52
 
133
- and import the `@neuralytics/alpine-ds` style to your main file:
53
+ 6. Set the accent color in your project's `main.ts`:
134
54
 
135
55
  ```js
136
- import "@neuralytics/alpine-ds/css"
56
+ import { setAccentColorTheme } from "@neuralytics/alpine-ds"
57
+
58
+ setAccentColorTheme("#fe4e29")
137
59
  ```
138
60
 
139
- ---
61
+ Note that this function can be called at any time. Calling it in your `main.ts` gives you a default value.
140
62
 
141
- To use @neuralytics/alpine-ds components, follow the examples below:
63
+ 7. (Optional) Set the text color of the primary `AlpineButton` if `white` doesn't fit your accent color:
142
64
 
143
65
  ```js
144
- import { AlpineButton } from "@neuralytics/alpine-ds"
66
+ import { setButtonTextColor } from "@neuralytics/alpine-ds"
67
+
68
+ setButtonTextColor("#000000")
145
69
  ```
146
70
 
147
- ### You want more ?
71
+ This only affects the primary button's text (not disabled or loading states) and defaults to `white` if never called.
148
72
 
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.
73
+ 8. Import a component in a `.vue` file
74
+
75
+ ```js
76
+ import { AlpineButton } from "@neuralytics/alpine-ds"
77
+ ```
151
78
 
152
- Love.
153
- P-a ❤️
79
+ For monorepo-level docs, see the [repository README](https://github.com/neuralytics/alpine-design-system#readme).
@@ -0,0 +1,4 @@
1
+ export declare const buttonDesigns: readonly ["primary", "secondary", "invisible"];
2
+ export declare const buttonIconPositions: readonly ["left", "right"];
3
+ export type ButtonDesign = typeof buttonDesigns[number];
4
+ export type ButtonIconPosition = typeof buttonIconPositions[number];
@@ -0,0 +1,19 @@
1
+ import { ButtonDesign as ButtonDesignType, ButtonIconPosition as ButtonIconPositionType } from './Button.types';
2
+ export interface ButtonProps {
3
+ label?: string | null;
4
+ icon?: string | null;
5
+ design?: ButtonDesignType;
6
+ isLoading?: boolean;
7
+ isDisabled?: boolean;
8
+ isDanger?: boolean;
9
+ iconPosition?: ButtonIconPositionType;
10
+ }
11
+ declare const _default: import('vue').DefineComponent<ButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ButtonProps> & Readonly<{}>, {
12
+ icon: string | null;
13
+ isLoading: boolean;
14
+ design: ButtonDesignType;
15
+ isDisabled: boolean;
16
+ isDanger: boolean;
17
+ iconPosition: ButtonIconPositionType;
18
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>;
19
+ export default _default;
@@ -1,9 +1,2 @@
1
- import { default as AlpineButton } from './AlpineButton.vue';
2
- import { VariantProps } from 'class-variance-authority';
3
-
4
- export declare const buttonVariants: (props?: ({
5
- variant?: "primary" | "secondary" | "invisible" | null | undefined;
6
- status?: "default" | "loading" | "disabled" | null | undefined;
7
- } & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
8
- export type ButtonVariants = VariantProps<typeof buttonVariants>;
9
- export default AlpineButton;
1
+ export type { ButtonDesign as ButtonDesignType, ButtonIconPosition as ButtonIconPositionType } from './Button.types';
2
+ export { default as AlpineButton, type ButtonProps as AlpineButtonProps, } from './Button.vue';
@@ -0,0 +1,2 @@
1
+ export declare const iconSizes: readonly ["xs", "sm", "md", "lg", "xl", "2xl"];
2
+ export type IconSize = typeof iconSizes[number];
@@ -0,0 +1,12 @@
1
+ import { IconSize as IconSizeType } from './Icon.types';
2
+ export interface IconProps {
3
+ icon: string;
4
+ hoverIcon?: string;
5
+ size?: IconSizeType;
6
+ isLoading?: boolean;
7
+ }
8
+ declare const _default: import('vue').DefineComponent<IconProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<IconProps> & Readonly<{}>, {
9
+ size: IconSizeType;
10
+ isLoading: boolean;
11
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLSpanElement>;
12
+ export default _default;
@@ -1,8 +1,2 @@
1
- import { default as AlpineIcon } from './AlpineIcon.vue';
2
- import { VariantProps } from 'class-variance-authority';
3
-
4
- export declare const iconVariants: (props?: ({
5
- size?: "sm" | "md" | "lg" | null | undefined;
6
- } & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
7
- export type IconVariants = VariantProps<typeof iconVariants>;
8
- export default AlpineIcon;
1
+ export { type IconSize, iconSizes } from './Icon.types';
2
+ export { default as AlpineIcon, type IconProps as AlpineIconProps, } from './Icon.vue';
@@ -0,0 +1,15 @@
1
+ export declare const iconMap: {
2
+ readonly home: "i-mdi-home";
3
+ readonly account: "i-mdi-account";
4
+ readonly bell: "i-mdi-bell";
5
+ readonly cog: "i-mdi-cog";
6
+ readonly email: "i-mdi-email";
7
+ readonly file: "i-mdi-file";
8
+ readonly folder: "i-mdi-folder";
9
+ readonly gear: "i-mdi-gear";
10
+ readonly heart: "i-mdi-heart";
11
+ };
12
+ export declare const iconOptions: {
13
+ label: string;
14
+ value: "i-mdi-home" | "i-mdi-account" | "i-mdi-bell" | "i-mdi-cog" | "i-mdi-email" | "i-mdi-file" | "i-mdi-folder" | "i-mdi-gear" | "i-mdi-heart";
15
+ }[];
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { default as AlpineIcon } from './components/icon/AlpineIcon.vue';
2
- import { default as AlpineButton } from './components/button/AlpineButton.vue';
3
-
4
- export { AlpineButton, AlpineIcon };
1
+ export * from './components/button';
2
+ export * from './components/icon';
3
+ export * from './utils/colors';
package/dist/index.mjs ADDED
@@ -0,0 +1,244 @@
1
+ import { defineComponent as w, ref as B, computed as y, createElementBlock as p, openBlock as l, normalizeClass as L, unref as f, createBlock as k, createCommentVNode as m, toDisplayString as S } from "vue";
2
+ import { tv as D } from "tailwind-variants";
3
+ const H = ["xs", "sm", "md", "lg", "xl", "2xl"], P = /* @__PURE__ */ w({
4
+ __name: "Icon",
5
+ props: {
6
+ icon: {},
7
+ hoverIcon: {},
8
+ size: { default: "md" },
9
+ isLoading: { type: Boolean, default: !1 }
10
+ },
11
+ setup(t) {
12
+ const e = t, o = D({
13
+ variants: {
14
+ size: {
15
+ xs: "size-3",
16
+ sm: "size-4",
17
+ md: "size-5",
18
+ lg: "size-6",
19
+ xl: "size-7",
20
+ "2xl": "size-8"
21
+ }
22
+ }
23
+ }), n = B(!1), s = y(() => e.isLoading ? "i-line-md-loading-twotone-loop" : e.hoverIcon && n.value ? e.hoverIcon : e.icon);
24
+ return (r, a) => (l(), p("span", {
25
+ class: L([s.value, f(o)({ size: t.size })]),
26
+ onMouseover: a[0] || (a[0] = (i) => n.value = !0),
27
+ onMouseleave: a[1] || (a[1] = (i) => n.value = !1)
28
+ }, null, 34));
29
+ }
30
+ }), T = ["primary", "secondary", "invisible"], $ = ["left", "right"], A = ["aria-label", "disabled"], C = {
31
+ key: 1,
32
+ class: "flex-1 text-left truncate"
33
+ }, V = /* @__PURE__ */ w({
34
+ __name: "Button",
35
+ props: {
36
+ label: {},
37
+ icon: { default: null },
38
+ design: { default: T[0] },
39
+ isLoading: { type: Boolean, default: !1 },
40
+ isDisabled: { type: Boolean, default: !1 },
41
+ isDanger: { type: Boolean, default: !1 },
42
+ iconPosition: { default: $[0] }
43
+ },
44
+ setup(t) {
45
+ const e = t, o = D({
46
+ base: "rounded-lg flex items-center gap-2 font-medium transition-all max-w-full border",
47
+ variants: {
48
+ iconPosition: {
49
+ left: "flex-row",
50
+ right: "flex-row-reverse"
51
+ },
52
+ design: {
53
+ primary: "h-9 bg-accent-500 border-transparent shadow-xs hover:shadow hover:brightness-110 active:bg-accent-600 active:shadow-none active:brightness-100 text-button-text-color",
54
+ secondary: "h-9 bg-white border-gray-200 text-gray-900 shadow-xs hover:shadow active:shadow-inner",
55
+ invisible: "h-7 bg-transparent hover:bg-gray-100 active:bg-gray-200 text-gray-900 border-transparent underline"
56
+ },
57
+ isDisabled: {
58
+ true: "cursor-not-allowed hover:brightness-100 shadow-none"
59
+ },
60
+ isLoading: {
61
+ true: "cursor-wait hover:brightness-100 shadow-none"
62
+ },
63
+ isDanger: {
64
+ true: ""
65
+ },
66
+ hasLabel: {
67
+ true: "w-auto",
68
+ false: "px-0 justify-center"
69
+ }
70
+ },
71
+ compoundVariants: [
72
+ // Has Label
73
+ {
74
+ hasLabel: !0,
75
+ design: "primary",
76
+ class: "px-3"
77
+ },
78
+ {
79
+ hasLabel: !0,
80
+ design: "secondary",
81
+ class: "px-3"
82
+ },
83
+ {
84
+ hasLabel: !0,
85
+ design: "invisible",
86
+ class: "px-2"
87
+ },
88
+ {
89
+ hasLabel: !1,
90
+ design: "primary",
91
+ class: "size-9"
92
+ },
93
+ {
94
+ hasLabel: !1,
95
+ design: "secondary",
96
+ class: "size-9"
97
+ },
98
+ {
99
+ hasLabel: !1,
100
+ design: "invisible",
101
+ class: "size-7"
102
+ },
103
+ // Danger
104
+ {
105
+ design: "primary",
106
+ isDanger: !0,
107
+ class: "bg-red-600 text-white active:bg-red-700"
108
+ },
109
+ {
110
+ design: "secondary",
111
+ isDanger: !0,
112
+ class: "bg-white text-red-600"
113
+ },
114
+ {
115
+ design: "invisible",
116
+ isDanger: !0,
117
+ class: "text-red-600 hover:bg-red-100 active:bg-red-200"
118
+ },
119
+ // Disabled
120
+ {
121
+ design: "primary",
122
+ isDisabled: !0,
123
+ class: "bg-gray-200 text-gray-500 hover:bg-gray-200 active:bg-gray-200 hover:shadow-none active:shadow-none"
124
+ },
125
+ {
126
+ design: "secondary",
127
+ isDisabled: !0,
128
+ class: "bg-gray-50 text-gray-500 hover:bg-gray-50 active:bg-gray-50 hover:shadow-none active:shadow-none"
129
+ },
130
+ {
131
+ design: "invisible",
132
+ isDisabled: !0,
133
+ class: "bg-transparent text-gray-500 hover:bg-transparent active:bg-transparent hover:text-gray-500 hover:shadow-none active:shadow-none"
134
+ },
135
+ // Loading
136
+ {
137
+ design: "primary",
138
+ isLoading: !0,
139
+ class: "bg-gray-200 text-gray-500 hover:bg-gray-200 active:bg-gray-200 hover:shadow-none active:shadow-none"
140
+ },
141
+ {
142
+ design: "secondary",
143
+ isLoading: !0,
144
+ class: "bg-gray-50 text-gray-500 hover:bg-gray-50 active:bg-gray-50 hover:shadow-none active:shadow-none"
145
+ },
146
+ {
147
+ design: "invisible",
148
+ isLoading: !0,
149
+ class: "bg-transparent text-gray-500 hover:bg-transparent active:bg-transparent hover:text-gray-500 hover:shadow-none active:shadow-none"
150
+ },
151
+ // Default
152
+ {
153
+ isLoading: !1,
154
+ isDisabled: !1,
155
+ class: "cursor-pointer"
156
+ }
157
+ ]
158
+ }), n = y(() => e.isLoading ? "i-line-md-loading-twotone-loop" : e.icon), s = y(() => !e.icon && !e.label ? "-" : e.label);
159
+ return (r, a) => (l(), p("button", {
160
+ "aria-label": e.label ?? e.icon ?? "Button without label or icon",
161
+ class: L(f(o)({
162
+ design: e.design,
163
+ iconPosition: e.iconPosition,
164
+ isLoading: e.isLoading,
165
+ isDisabled: e.isDisabled,
166
+ isDanger: e.isDanger,
167
+ hasLabel: !!s.value
168
+ })),
169
+ disabled: e.isDisabled || e.isLoading
170
+ }, [
171
+ n.value ? (l(), k(f(P), {
172
+ key: 0,
173
+ "aria-hidden": !0,
174
+ icon: n.value,
175
+ class: "shrink-0"
176
+ }, null, 8, ["icon"])) : m("", !0),
177
+ s.value ? (l(), p("span", C, S(s.value), 1)) : m("", !0)
178
+ ], 10, A));
179
+ }
180
+ });
181
+ function R(t) {
182
+ const e = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
183
+ return e ? {
184
+ r: Number.parseInt(e[1], 16),
185
+ g: Number.parseInt(e[2], 16),
186
+ b: Number.parseInt(e[3], 16)
187
+ } : { r: 0, g: 0, b: 0 };
188
+ }
189
+ function v(t) {
190
+ const e = t / 255;
191
+ return e <= 0.04045 ? e / 12.92 : ((e + 0.055) / 1.055) ** 2.4;
192
+ }
193
+ function O(t) {
194
+ const { r: e, g: o, b: n } = R(t), s = v(e), r = v(o), a = v(n), i = 0.4122214708 * s + 0.5363325363 * r + 0.0514459929 * a, z = 0.2119034982 * s + 0.6806995451 * r + 0.1073969566 * a, I = 0.0883024619 * s + 0.2817188376 * r + 0.6299787005 * a, c = Math.cbrt(i), d = Math.cbrt(z), g = Math.cbrt(I), M = 0.2104542553 * c + 0.793617785 * d - 0.0040720468 * g, u = 1.9779984951 * c - 2.428592205 * d + 0.4505937099 * g, b = 0.0259040371 * c + 0.7827717662 * d - 0.808675766 * g, _ = Math.sqrt(u * u + b * b);
195
+ let h = Math.atan2(b, u) * 180 / Math.PI;
196
+ return h < 0 && (h += 360), { lightness: M, chroma: _, hue: h };
197
+ }
198
+ const x = {
199
+ 50: 1.4208,
200
+ 100: 1.3779,
201
+ 200: 1.314,
202
+ 300: 1.2235,
203
+ 400: 1.1014,
204
+ 500: 1,
205
+ 600: 0.8779,
206
+ 700: 0.754,
207
+ 800: 0.6501,
208
+ 900: 0.5749
209
+ }, N = {
210
+ 50: 0.0549,
211
+ 100: 0.135,
212
+ 200: 0.262,
213
+ 300: 0.481,
214
+ 400: 0.806,
215
+ 500: 1,
216
+ 600: 1.034,
217
+ 700: 0.899,
218
+ 800: 0.747,
219
+ 900: 0.595
220
+ };
221
+ function E(t) {
222
+ const { lightness: e, chroma: o, hue: n } = O(t), s = {};
223
+ for (const r of Object.keys(x)) {
224
+ const a = Math.min(1, Math.max(0, e * x[r])), i = Math.max(0, o * N[r]);
225
+ s[`--color-accent-${r}`] = `oklch(${(a * 100).toFixed(1)}% ${i.toFixed(3)} ${n.toFixed(1)})`;
226
+ }
227
+ return s;
228
+ }
229
+ function q(t) {
230
+ const e = E(t), o = document.documentElement;
231
+ for (const [n, s] of Object.entries(e))
232
+ o.style.setProperty(n, s);
233
+ }
234
+ function G(t) {
235
+ document.documentElement.style.setProperty("--button-text-color", t);
236
+ }
237
+ export {
238
+ V as AlpineButton,
239
+ P as AlpineIcon,
240
+ E as generateAccentScale,
241
+ H as iconSizes,
242
+ q as setAccentColorTheme,
243
+ G as setButtonTextColor
244
+ };
@@ -0,0 +1,89 @@
1
+ declare const _default: {
2
+ content: string[];
3
+ theme: {
4
+ colors: {
5
+ transparent: string;
6
+ current: string;
7
+ black: string;
8
+ white: string;
9
+ gray: {
10
+ 50: string;
11
+ 100: string;
12
+ 200: string;
13
+ 300: string;
14
+ 400: string;
15
+ 500: string;
16
+ 600: string;
17
+ 700: string;
18
+ 800: string;
19
+ 900: string;
20
+ };
21
+ red: {
22
+ 50: string;
23
+ 100: string;
24
+ 200: string;
25
+ 300: string;
26
+ 400: string;
27
+ 500: string;
28
+ 600: string;
29
+ 700: string;
30
+ 800: string;
31
+ 900: string;
32
+ };
33
+ yellow: {
34
+ 50: string;
35
+ 100: string;
36
+ 200: string;
37
+ 300: string;
38
+ 400: string;
39
+ 500: string;
40
+ 600: string;
41
+ 700: string;
42
+ 800: string;
43
+ 900: string;
44
+ };
45
+ green: {
46
+ 50: string;
47
+ 100: string;
48
+ 200: string;
49
+ 300: string;
50
+ 400: string;
51
+ 500: string;
52
+ 600: string;
53
+ 700: string;
54
+ 800: string;
55
+ 900: string;
56
+ };
57
+ blue: {
58
+ 50: string;
59
+ 100: string;
60
+ 200: string;
61
+ 300: string;
62
+ 400: string;
63
+ 500: string;
64
+ 600: string;
65
+ 700: string;
66
+ 800: string;
67
+ 900: string;
68
+ };
69
+ accent: {
70
+ 50: string;
71
+ 100: string;
72
+ 200: string;
73
+ 300: string;
74
+ 400: string;
75
+ 500: string;
76
+ 600: string;
77
+ 700: string;
78
+ 800: string;
79
+ 900: string;
80
+ };
81
+ "button-text-color": string;
82
+ };
83
+ };
84
+ plugins: {
85
+ handler: tailwindcss_types_config.PluginCreator;
86
+ config?: Partial<tailwindcss_types_config.Config>;
87
+ }[];
88
+ };
89
+ export default _default;
@@ -0,0 +1,93 @@
1
+ import { iconsPlugin as c, getIconCollections as o } from "@egoist/tailwindcss-icons";
2
+ const l = new URL(import.meta.url).pathname.replace(/[^/]*$/, ""), h = {
3
+ 50: "oklch(98.5% 0 0)",
4
+ 100: "oklch(97% 0 0)",
5
+ 200: "oklch(92.2% 0 0)",
6
+ 300: "oklch(87% 0 0)",
7
+ 400: "oklch(70.8% 0 0)",
8
+ 500: "oklch(55.6% 0 0)",
9
+ 600: "oklch(43.9% 0 0)",
10
+ 700: "oklch(37.1% 0 0)",
11
+ 800: "oklch(26.9% 0 0)",
12
+ 900: "oklch(20.5% 0 0)"
13
+ }, k = {
14
+ 50: "oklch(97.1% 0.013 17.38)",
15
+ 100: "oklch(93.6% 0.032 17.717)",
16
+ 200: "oklch(88.5% 0.062 18.334)",
17
+ 300: "oklch(80.8% 0.114 19.571)",
18
+ 400: "oklch(70.4% 0.191 22.216)",
19
+ 500: "oklch(63.7% 0.237 25.331)",
20
+ 600: "oklch(57.7% 0.245 27.325)",
21
+ 700: "oklch(50.5% 0.213 27.518)",
22
+ 800: "oklch(44.4% 0.177 26.899)",
23
+ 900: "oklch(39.6% 0.141 25.723)"
24
+ }, t = {
25
+ 50: "oklch(98.7% 0.022 95.277)",
26
+ 100: "oklch(96.2% 0.059 95.617)",
27
+ 200: "oklch(92.4% 0.12 95.746)",
28
+ 300: "oklch(87.9% 0.169 91.605)",
29
+ 400: "oklch(82.8% 0.189 84.429)",
30
+ 500: "oklch(76.9% 0.188 70.08)",
31
+ 600: "oklch(66.6% 0.179 58.318)",
32
+ 700: "oklch(55.5% 0.163 48.998)",
33
+ 800: "oklch(47.3% 0.137 46.201)",
34
+ 900: "oklch(41.4% 0.112 45.904)"
35
+ }, r = {
36
+ 50: "oklch(98.2% 0.018 155.826)",
37
+ 100: "oklch(96.2% 0.044 156.743)",
38
+ 200: "oklch(92.5% 0.084 155.995)",
39
+ 300: "oklch(87.1% 0.15 154.449)",
40
+ 400: "oklch(79.2% 0.209 151.711)",
41
+ 500: "oklch(72.3% 0.219 149.579)",
42
+ 600: "oklch(62.7% 0.194 149.214)",
43
+ 700: "oklch(52.7% 0.154 150.069)",
44
+ 800: "oklch(44.8% 0.119 151.328)",
45
+ 900: "oklch(39.3% 0.095 152.535)"
46
+ }, e = {
47
+ 50: "oklch(97% 0.014 254.604)",
48
+ 100: "oklch(93.2% 0.032 255.585)",
49
+ 200: "oklch(88.2% 0.059 254.128)",
50
+ 300: "oklch(80.9% 0.105 251.813)",
51
+ 400: "oklch(70.7% 0.165 254.624)",
52
+ 500: "oklch(62.3% 0.214 259.815)",
53
+ 600: "oklch(54.6% 0.245 262.881)",
54
+ 700: "oklch(48.8% 0.243 264.376)",
55
+ 800: "oklch(42.4% 0.199 265.638)",
56
+ 900: "oklch(37.9% 0.146 265.522)"
57
+ }, a = {
58
+ content: [`${l}**/*.{js,mjs}`],
59
+ theme: {
60
+ colors: {
61
+ transparent: "transparent",
62
+ current: "currentColor",
63
+ black: "#000000",
64
+ white: "#ffffff",
65
+ gray: h,
66
+ red: k,
67
+ yellow: t,
68
+ green: r,
69
+ blue: e,
70
+ accent: {
71
+ 50: "var(--color-accent-50)",
72
+ 100: "var(--color-accent-100)",
73
+ 200: "var(--color-accent-200)",
74
+ 300: "var(--color-accent-300)",
75
+ 400: "var(--color-accent-400)",
76
+ 500: "var(--color-accent-500)",
77
+ 600: "var(--color-accent-600)",
78
+ 700: "var(--color-accent-700)",
79
+ 800: "var(--color-accent-800)",
80
+ 900: "var(--color-accent-900)"
81
+ },
82
+ "button-text-color": "var(--button-text-color, #ffffff)"
83
+ }
84
+ },
85
+ plugins: [
86
+ c({
87
+ collections: o(["mdi", "line-md"])
88
+ })
89
+ ]
90
+ };
91
+ export {
92
+ a as default
93
+ };
@@ -0,0 +1,3 @@
1
+ export declare function generateAccentScale(hex: string): Record<string, string>;
2
+ export declare function setAccentColorTheme(hex: string): void;
3
+ export declare function setButtonTextColor(hex: string): void;
package/package.json CHANGED
@@ -1,55 +1,56 @@
1
1
  {
2
2
  "name": "@neuralytics/alpine-ds",
3
- "description": "Neuralytics Design System, also called Alpine.",
4
- "private": false,
5
- "version": "0.1.5",
6
3
  "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",
4
+ "version": "0.2.1",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
23
8
  "exports": {
24
9
  ".": {
25
- "import": "./dist/neuralytics-alpine-ds.js",
26
- "require": "./dist/neuralytics-alpine-ds.umd.cjs",
27
- "types": "./dist/index.d.ts"
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs"
28
12
  },
29
- "./css": {
30
- "import": "./dist/style.css",
31
- "require": "./dist/style.css"
13
+ "./tailwind-preset": {
14
+ "types": "./dist/tailwind-preset.d.ts",
15
+ "import": "./dist/tailwind-preset.mjs"
32
16
  }
33
17
  },
18
+ "main": "./dist/index.mjs",
19
+ "types": "dist/index.d.ts",
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "engines": {
24
+ "node": ">=24"
25
+ },
26
+ "scripts": {
27
+ "build": "vite build",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "typecheck": "vue-tsc -p tsconfig.app.json --noEmit"
31
+ },
32
+ "peerDependencies": {
33
+ "tailwindcss": "^4.1.17",
34
+ "vue": "^3.5.25"
35
+ },
34
36
  "dependencies": {
35
- "@iconify-json/mdi": "^1.1.64",
36
- "class-variance-authority": "^0.7.0",
37
- "vue": "^3.4.21"
37
+ "@egoist/tailwindcss-icons": "^1.9.0",
38
+ "@iconify-json/line-md": "^1.2.11",
39
+ "@iconify-json/mdi": "^1.2.3",
40
+ "tailwind-variants": "^3.2.2"
38
41
  },
39
42
  "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"
43
+ "@testing-library/vue": "^8.1.0",
44
+ "@types/node": "^24.10.1",
45
+ "@vitejs/plugin-vue": "^6.0.2",
46
+ "@vue/tsconfig": "^0.8.1",
47
+ "jsdom": "^25.0.1",
48
+ "tailwindcss": "^4.1.17",
49
+ "typescript": "^5.9.3",
50
+ "vite": "^7.2.4",
51
+ "vite-plugin-dts": "^4.5.4",
52
+ "vitest": "^4.0.14",
53
+ "vue": "^3.5.25",
54
+ "vue-tsc": "^3.1.5"
54
55
  }
55
56
  }
@@ -1,48 +0,0 @@
1
- import { ButtonVariants } from '.';
2
-
3
- export interface Props {
4
- variant?: ButtonVariants["variant"];
5
- label?: string | null;
6
- icon?: string | null;
7
- iconPosition?: string;
8
- isLoading?: boolean;
9
- isDisabled?: boolean;
10
- }
11
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
12
- variant: string;
13
- label: null;
14
- icon: null;
15
- iconPosition: string;
16
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
- clicked: (...args: any[]) => void;
18
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
19
- variant: string;
20
- label: null;
21
- icon: null;
22
- iconPosition: string;
23
- }>>> & {
24
- onClicked?: ((...args: any[]) => any) | undefined;
25
- }, {
26
- label: string | null;
27
- variant: "primary" | "secondary" | "invisible" | null;
28
- icon: string | null;
29
- iconPosition: string;
30
- }, {}>;
31
- export default _default;
32
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
33
- type __VLS_TypePropsToRuntimeProps<T> = {
34
- [K in keyof T]-?: {} extends Pick<T, K> ? {
35
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
36
- } : {
37
- type: import('vue').PropType<T[K]>;
38
- required: true;
39
- };
40
- };
41
- type __VLS_WithDefaults<P, D> = {
42
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
43
- default: D[K];
44
- }> : P[K];
45
- };
46
- type __VLS_Prettify<T> = {
47
- [K in keyof T]: T[K];
48
- } & {};
@@ -1,43 +0,0 @@
1
- import { IconVariants } from '.';
2
-
3
- export interface Props {
4
- size?: IconVariants["size"];
5
- icon: string;
6
- hoverIcon?: string | null;
7
- color?: string;
8
- hoverColor?: string | null;
9
- }
10
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
11
- size: string;
12
- hoverIcon: null;
13
- color: string;
14
- hoverColor: null;
15
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
16
- size: string;
17
- hoverIcon: null;
18
- color: string;
19
- hoverColor: null;
20
- }>>>, {
21
- size: "sm" | "md" | "lg" | null;
22
- hoverIcon: string | null;
23
- color: string;
24
- hoverColor: string | null;
25
- }, {}>;
26
- export default _default;
27
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
28
- type __VLS_TypePropsToRuntimeProps<T> = {
29
- [K in keyof T]-?: {} extends Pick<T, K> ? {
30
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
31
- } : {
32
- type: import('vue').PropType<T[K]>;
33
- required: true;
34
- };
35
- };
36
- type __VLS_WithDefaults<P, D> = {
37
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
38
- default: D[K];
39
- }> : P[K];
40
- };
41
- type __VLS_Prettify<T> = {
42
- [K in keyof T]: T[K];
43
- } & {};
package/dist/main.d.ts DELETED
@@ -1 +0,0 @@
1
-
@@ -1,165 +0,0 @@
1
- import { defineComponent as x, ref as j, computed as f, openBlock as c, createElementBlock as h, normalizeClass as V, unref as z, createBlock as g, createCommentVNode as y, toDisplayString as L } from "vue";
2
- function A(t) {
3
- var n, e, a = "";
4
- if (typeof t == "string" || typeof t == "number")
5
- a += t;
6
- else if (typeof t == "object")
7
- if (Array.isArray(t))
8
- for (n = 0; n < t.length; n++)
9
- t[n] && (e = A(t[n])) && (a && (a += " "), a += e);
10
- else
11
- for (n in t)
12
- t[n] && (a && (a += " "), a += n);
13
- return a;
14
- }
15
- function P() {
16
- for (var t, n, e = 0, a = ""; e < arguments.length; )
17
- (t = arguments[e++]) && (n = A(t)) && (a && (a += " "), a += n);
18
- return a;
19
- }
20
- const C = (t) => typeof t == "boolean" ? "".concat(t) : t === 0 ? "0" : t, w = P, B = (t, n) => (e) => {
21
- var a;
22
- if ((n == null ? void 0 : n.variants) == null)
23
- return w(t, e == null ? void 0 : e.class, e == null ? void 0 : e.className);
24
- const { variants: l, defaultVariants: s } = n, r = Object.keys(l).map((i) => {
25
- const u = e == null ? void 0 : e[i], v = s == null ? void 0 : s[i];
26
- if (u === null)
27
- return null;
28
- const d = C(u) || C(v);
29
- return l[i][d];
30
- }), o = e && Object.entries(e).reduce((i, u) => {
31
- let [v, d] = u;
32
- return d === void 0 || (i[v] = d), i;
33
- }, {}), p = n == null || (a = n.compoundVariants) === null || a === void 0 ? void 0 : a.reduce((i, u) => {
34
- let { class: v, className: d, ...I } = u;
35
- return Object.entries(I).every((N) => {
36
- let [k, m] = N;
37
- return Array.isArray(m) ? m.includes({
38
- ...s,
39
- ...o
40
- }[k]) : {
41
- ...s,
42
- ...o
43
- }[k] === m;
44
- }) ? [
45
- ...i,
46
- v,
47
- d
48
- ] : i;
49
- }, []);
50
- return w(t, r, p, e == null ? void 0 : e.class, e == null ? void 0 : e.className);
51
- }, D = B(
52
- "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",
53
- {
54
- variants: {
55
- variant: {
56
- primary: "text-white bg-brand-500 hover:bg-brand-600 h-9 px-4 gap-2 hover:shadow",
57
- secondary: "text-gray-900 bg-gray-50 hover:bg-gray-100 border border-gray-300 h-9 px-4 gap-2 hover:shadow",
58
- invisible: "text-gray-900 hover:bg-gray-200 p-2 gap-2"
59
- },
60
- status: {
61
- default: "",
62
- loading: "cursor-wait hover:shadow-none active:shadow-none",
63
- disabled: "cursor-not-allowed hover:shadow-none active:shadow-none"
64
- }
65
- },
66
- compoundVariants: [
67
- {
68
- variant: "primary",
69
- status: ["loading", "disabled"],
70
- class: "!bg-gray-200 hover:!bg-gray-200 !text-gray-500"
71
- },
72
- {
73
- variant: "secondary",
74
- status: ["loading", "disabled"],
75
- class: "!text-gray-400 hover:!bg-gray-50"
76
- },
77
- {
78
- variant: "invisible",
79
- status: ["loading", "disabled"],
80
- class: "!text-gray-400 hover:!bg-gray-100"
81
- }
82
- ],
83
- defaultVariants: {
84
- variant: "primary",
85
- status: "default"
86
- }
87
- }
88
- ), O = B(
89
- "",
90
- {
91
- variants: {
92
- size: {
93
- sm: "text-[20px]",
94
- md: "text-[24px]",
95
- lg: "text-[28px]"
96
- }
97
- },
98
- defaultVariants: { size: "md" }
99
- }
100
- ), b = /* @__PURE__ */ x({
101
- __name: "AlpineIcon",
102
- props: {
103
- size: { default: "md" },
104
- icon: {},
105
- hoverIcon: { default: null },
106
- color: { default: "text-neutral-900" },
107
- hoverColor: { default: null }
108
- },
109
- setup(t) {
110
- const n = t, e = j(!1), a = f(() => e.value && n.hoverColor ? n.hoverColor : n.color), l = f(() => e.value && n.hoverIcon ? n.hoverIcon : n.icon);
111
- return (s, r) => (c(), h("span", {
112
- class: V([l.value, a.value, z(O)({ size: n.size })]),
113
- onMouseover: r[0] || (r[0] = (o) => e.value = !0),
114
- onMouseleave: r[1] || (r[1] = (o) => e.value = !1)
115
- }, null, 34));
116
- }
117
- }), S = {
118
- key: 2,
119
- class: "leading-none"
120
- }, M = /* @__PURE__ */ x({
121
- __name: "AlpineButton",
122
- props: {
123
- variant: { default: "primary" },
124
- label: { default: null },
125
- icon: { default: null },
126
- iconPosition: { default: "left" },
127
- isLoading: { type: Boolean },
128
- isDisabled: { type: Boolean }
129
- },
130
- emits: ["clicked"],
131
- setup(t, { emit: n }) {
132
- const e = t, a = n, l = f(() => e.isLoading ? "loading" : e.isDisabled ? "disabled" : "default"), s = f(() => ({
133
- variant: e.variant,
134
- status: l.value
135
- }));
136
- function r() {
137
- e.isLoading || e.isDisabled || a("clicked");
138
- }
139
- return (o, p) => (c(), h("button", {
140
- class: V(z(D)(s.value)),
141
- onClick: r
142
- }, [
143
- o.isLoading ? (c(), g(b, {
144
- key: 0,
145
- icon: "i-mdi-loading",
146
- class: "animate-spin",
147
- size: "sm"
148
- })) : o.icon && o.iconPosition === "left" ? (c(), g(b, {
149
- key: 1,
150
- icon: o.icon,
151
- size: "sm"
152
- }, null, 8, ["icon"])) : y("", !0),
153
- o.label ? (c(), h("span", S, L(o.label), 1)) : y("", !0),
154
- !o.isLoading && o.icon && o.iconPosition === "right" ? (c(), g(b, {
155
- key: 3,
156
- icon: o.icon,
157
- size: "sm"
158
- }, null, 8, ["icon"])) : y("", !0)
159
- ], 2));
160
- }
161
- });
162
- export {
163
- M as AlpineButton,
164
- b as AlpineIcon
165
- };
@@ -1 +0,0 @@
1
- (function(r,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.NeuralyticsAlpineDS={},r.Vue))})(this,function(r,n){"use strict";function g(o){var t,e,a="";if(typeof o=="string"||typeof o=="number")a+=o;else if(typeof o=="object")if(Array.isArray(o))for(t=0;t<o.length;t++)o[t]&&(e=g(o[t]))&&(a&&(a+=" "),a+=e);else for(t in o)o[t]&&(a&&(a+=" "),a+=t);return a}function B(){for(var o,t,e=0,a="";e<arguments.length;)(o=arguments[e++])&&(t=g(o))&&(a&&(a+=" "),a+=t);return a}const b=o=>typeof o=="boolean"?"".concat(o):o===0?"0":o,p=B,h=(o,t)=>e=>{var a;if((t==null?void 0:t.variants)==null)return p(o,e==null?void 0:e.class,e==null?void 0:e.className);const{variants:c,defaultVariants:s}=t,d=Object.keys(c).map(l=>{const u=e==null?void 0:e[l],m=s==null?void 0:s[l];if(u===null)return null;const f=b(u)||b(m);return c[l][f]}),i=e&&Object.entries(e).reduce((l,u)=>{let[m,f]=u;return f===void 0||(l[m]=f),l},{}),k=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((l,u)=>{let{class:m,className:f,...N}=u;return Object.entries(N).every(A=>{let[C,y]=A;return Array.isArray(y)?y.includes({...s,...i}[C]):{...s,...i}[C]===y})?[...l,m,f]:l},[]);return p(o,d,k,e==null?void 0:e.class,e==null?void 0:e.className)},V=h("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",{variants:{variant:{primary:"text-white bg-brand-500 hover:bg-brand-600 h-9 px-4 gap-2 hover:shadow",secondary:"text-gray-900 bg-gray-50 hover:bg-gray-100 border border-gray-300 h-9 px-4 gap-2 hover:shadow",invisible:"text-gray-900 hover:bg-gray-200 p-2 gap-2"},status:{default:"",loading:"cursor-wait hover:shadow-none active:shadow-none",disabled:"cursor-not-allowed hover:shadow-none active:shadow-none"}},compoundVariants:[{variant:"primary",status:["loading","disabled"],class:"!bg-gray-200 hover:!bg-gray-200 !text-gray-500"},{variant:"secondary",status:["loading","disabled"],class:"!text-gray-400 hover:!bg-gray-50"},{variant:"invisible",status:["loading","disabled"],class:"!text-gray-400 hover:!bg-gray-100"}],defaultVariants:{variant:"primary",status:"default"}}),w=h("",{variants:{size:{sm:"text-[20px]",md:"text-[24px]",lg:"text-[28px]"}},defaultVariants:{size:"md"}}),v=n.defineComponent({__name:"AlpineIcon",props:{size:{default:"md"},icon:{},hoverIcon:{default:null},color:{default:"text-neutral-900"},hoverColor:{default:null}},setup(o){const t=o,e=n.ref(!1),a=n.computed(()=>e.value&&t.hoverColor?t.hoverColor:t.color),c=n.computed(()=>e.value&&t.hoverIcon?t.hoverIcon:t.icon);return(s,d)=>(n.openBlock(),n.createElementBlock("span",{class:n.normalizeClass([c.value,a.value,n.unref(w)({size:t.size})]),onMouseover:d[0]||(d[0]=i=>e.value=!0),onMouseleave:d[1]||(d[1]=i=>e.value=!1)},null,34))}}),x={key:2,class:"leading-none"},z=n.defineComponent({__name:"AlpineButton",props:{variant:{default:"primary"},label:{default:null},icon:{default:null},iconPosition:{default:"left"},isLoading:{type:Boolean},isDisabled:{type:Boolean}},emits:["clicked"],setup(o,{emit:t}){const e=o,a=t,c=n.computed(()=>e.isLoading?"loading":e.isDisabled?"disabled":"default"),s=n.computed(()=>({variant:e.variant,status:c.value}));function d(){e.isLoading||e.isDisabled||a("clicked")}return(i,k)=>(n.openBlock(),n.createElementBlock("button",{class:n.normalizeClass(n.unref(V)(s.value)),onClick:d},[i.isLoading?(n.openBlock(),n.createBlock(v,{key:0,icon:"i-mdi-loading",class:"animate-spin",size:"sm"})):i.icon&&i.iconPosition==="left"?(n.openBlock(),n.createBlock(v,{key:1,icon:i.icon,size:"sm"},null,8,["icon"])):n.createCommentVNode("",!0),i.label?(n.openBlock(),n.createElementBlock("span",x,n.toDisplayString(i.label),1)):n.createCommentVNode("",!0),!i.isLoading&&i.icon&&i.iconPosition==="right"?(n.openBlock(),n.createBlock(v,{key:3,icon:i.icon,size:"sm"},null,8,["icon"])):n.createCommentVNode("",!0)],2))}});r.AlpineButton=z,r.AlpineIcon=v,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- *,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e5e5}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#a3a3a3}input::placeholder,textarea::placeholder{opacity:1;color:#a3a3a3}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root{--color-brand: #fe4e29}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.i-mdi-loading{display:inline-block;width:1em;height:1em;background-color:currentColor;-webkit-mask-image:var(--svg);mask-image:var(--svg);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;--svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M12 4V2A10 10 0 0 0 2 12h2a8 8 0 0 1 8-8'/%3E%3C/svg%3E")}.invisible{visibility:hidden}.inline-flex{display:inline-flex}.h-9{height:2.25rem}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-wait{cursor:wait}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.whitespace-nowrap{white-space:nowrap}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(212 212 212 / var(--tw-border-opacity))}.\!bg-gray-200{--tw-bg-opacity: 1 !important;background-color:rgb(229 229 229 / var(--tw-bg-opacity))!important}.bg-brand-500{background-color:var(--color-brand)}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity))}.p-2{padding:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.text-\[20px\]{font-size:20px}.text-\[24px\]{font-size:24px}.text-\[28px\]{font-size:28px}.text-base{font-size:14px;line-height:20px}.font-medium{font-weight:500}.leading-none{line-height:1}.\!text-gray-400{--tw-text-opacity: 1 !important;color:rgb(163 163 163 / var(--tw-text-opacity))!important}.\!text-gray-500{--tw-text-opacity: 1 !important;color:rgb(115 115 115 / var(--tw-text-opacity))!important}.text-gray-900{--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.outline-none{outline:2px solid transparent;outline-offset:2px}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}html{font-size:16px}.hover\:\!bg-gray-100:hover{--tw-bg-opacity: 1 !important;background-color:rgb(245 245 245 / var(--tw-bg-opacity))!important}.hover\:\!bg-gray-200:hover{--tw-bg-opacity: 1 !important;background-color:rgb(229 229 229 / var(--tw-bg-opacity))!important}.hover\:\!bg-gray-50:hover{--tw-bg-opacity: 1 !important;background-color:rgb(250 250 250 / var(--tw-bg-opacity))!important}.hover\:bg-brand-600:hover{background-color:color-mix(in srgb,var(--color-brand),black 10%)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 229 229 / var(--tw-bg-opacity))}.hover\:shadow:hover{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-none:hover{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-2:focus-visible{outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-brand-500:focus-visible{outline-color:var(--color-brand)}.active\:shadow-inner-md:active{--tw-shadow: inset 0px 4px 6px rgba(0, 0, 0, .1);--tw-shadow-colored: inset 0px 4px 6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.active\:shadow-none:active{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}
@@ -1,66 +0,0 @@
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>
@@ -1,44 +0,0 @@
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
@@ -1,30 +0,0 @@
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>
@@ -1,19 +0,0 @@
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