@valiify/dashboard-ui 0.1.0-alpha.1 → 0.1.0-alpha.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.
@@ -0,0 +1,45 @@
1
+ # Valiify Dashboard UI - PostCSS Starter
2
+
3
+ Minimal example using PostCSS CLI (no bundler).
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Install
9
+ npm install
10
+
11
+ # Build CSS
12
+ npm run build
13
+
14
+ # Watch mode
15
+ npm run watch
16
+
17
+ # Build and serve (requires serve: npm i -g serve)
18
+ npm run serve
19
+ ```
20
+
21
+ ## Key Files
22
+
23
+ - `postcss.config.js` - PostCSS configuration with @tailwindcss/postcss
24
+ - `src/styles.css` - Source stylesheet
25
+ - `dist/styles.css` - Built stylesheet (generated)
26
+ - `index.html` - HTML file linking to built CSS
27
+
28
+ ## Why @tailwindcss/postcss?
29
+
30
+ Tailwind v4 requires an integration package. For PostCSS, that's `@tailwindcss/postcss`.
31
+
32
+ Without it, `@import "tailwindcss"` does nothing and your styles are missing with no error.
33
+
34
+ ## For webpack Users
35
+
36
+ Same setup, but install `@tailwindcss/webpack` instead of `@tailwindcss/postcss` and add it to your webpack config:
37
+
38
+ ```js
39
+ // webpack.config.js
40
+ import tailwindcss from "@tailwindcss/webpack";
41
+
42
+ export default {
43
+ plugins: [tailwindcss()],
44
+ };
45
+ ```
@@ -0,0 +1,54 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Valiify Dashboard UI - PostCSS Starter</title>
7
+ <link rel="stylesheet" href="dist/styles.css" />
8
+ </head>
9
+ <body>
10
+ <div style="max-width: 800px; margin: 0 auto">
11
+ <h1
12
+ style="
13
+ font-size: 32px;
14
+ font-weight: 600;
15
+ margin-bottom: 24px;
16
+ color: var(--color-content-primary);
17
+ "
18
+ >
19
+ PostCSS Setup Working
20
+ </h1>
21
+
22
+ <div style="display: flex; gap: 12px; margin-bottom: 24px">
23
+ <button class="btn btn-primary">Primary Button</button>
24
+ <button class="btn btn-outline">Outline Button</button>
25
+ </div>
26
+
27
+ <div class="alert alert-success" role="alert">
28
+ <div class="alert-body">
29
+ <svg class="alert-icon icon icon-size-18" aria-hidden="true">
30
+ <use href="#check-circle" />
31
+ </svg>
32
+ <div class="alert-content">
33
+ <p class="alert-title">Setup Complete</p>
34
+ <p class="alert-message">
35
+ If you can see this styled alert, your PostCSS + Tailwind setup
36
+ is working correctly.
37
+ </p>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </div>
42
+
43
+ <!-- Load sprite (inline it for production) -->
44
+ <div style="display: none" id="sprite-container"></div>
45
+ <script type="module">
46
+ // In production, you'd inline this or use a bundler
47
+ fetch("../../src/icons/sprite.svg")
48
+ .then((r) => r.text())
49
+ .then((svg) => {
50
+ document.getElementById("sprite-container").innerHTML = svg;
51
+ });
52
+ </script>
53
+ </body>
54
+ </html>
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "valiify-ui-postcss-starter",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "build": "postcss src/styles.css -o dist/styles.css",
7
+ "watch": "postcss src/styles.css -o dist/styles.css --watch",
8
+ "serve": "npm run build && npx serve ."
9
+ },
10
+ "dependencies": {
11
+ "@valiify/dashboard-ui": "file:../.."
12
+ },
13
+ "devDependencies": {
14
+ "@tailwindcss/postcss": "^4.0.0",
15
+ "postcss": "^8.4.0",
16
+ "postcss-cli": "^11.0.0",
17
+ "tailwindcss": "^4.0.0"
18
+ }
19
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ plugins: {
3
+ "@tailwindcss/postcss": {},
4
+ },
5
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * PostCSS + Tailwind v4 setup for Valiify Dashboard UI
3
+ */
4
+
5
+ /* Optional: Load fonts */
6
+ @import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");
7
+
8
+ /* Required */
9
+ @import "tailwindcss";
10
+ @import "@valiify/dashboard-ui/source";
11
+
12
+ /* Custom styles */
13
+ body {
14
+ font-family: Inter, system-ui, sans-serif;
15
+ background: var(--color-surface-frame);
16
+ padding: 2rem;
17
+ }
@@ -0,0 +1,123 @@
1
+ # Valiify Dashboard UI - Vite Starter
2
+
3
+ A minimal working example of `@valiify/dashboard-ui` with Vite.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Install dependencies
9
+ npm install
10
+
11
+ # Start dev server
12
+ npm run dev
13
+
14
+ # Build for production
15
+ npm run build
16
+ ```
17
+
18
+ Open [http://localhost:5173](http://localhost:5173) to see the result.
19
+
20
+ ## What This Example Shows
21
+
22
+ 1. **Correct installation** - How to install the required packages
23
+ 2. **Vite configuration** - The `@tailwindcss/vite` plugin is required
24
+ 3. **CSS imports** - Import the library from CSS, never from JavaScript
25
+ 4. **Icon sprite loading** - How to load and inline the icon sprite
26
+ 5. **Component usage** - Examples of buttons, inputs, alerts, and chips
27
+ 6. **Interactive components** - Minimal JavaScript for dropdown behavior
28
+
29
+ ## Key Files
30
+
31
+ - `vite.config.js` - Vite configuration with Tailwind plugin
32
+ - `src/styles.css` - Stylesheet with correct import order
33
+ - `src/main.js` - JavaScript entry point (imports CSS, loads sprite)
34
+ - `package.json` - Required dependencies
35
+
36
+ ## Important Notes
37
+
38
+ ### Import from CSS, Not JavaScript
39
+
40
+ ❌ **Don't do this:**
41
+ ```js
42
+ // main.js
43
+ import "@valiify/dashboard-ui/source";
44
+ ```
45
+
46
+ ✅ **Do this:**
47
+ ```css
48
+ /* styles.css */
49
+ @import "tailwindcss";
50
+ @import "@valiify/dashboard-ui/source";
51
+ ```
52
+
53
+ ```js
54
+ // main.js
55
+ import "./styles.css";
56
+ ```
57
+
58
+ ### Components That Need JavaScript
59
+
60
+ These components ship no JavaScript and require you to implement behavior:
61
+
62
+ - **DropdownField** - Needs click handler, aria-expanded toggle, outside-click detection
63
+ - **DropdownMenu** - Same as DropdownField
64
+ - **Tabs** - Needs tab switching and aria-selected management
65
+ - **Modal** - Needs open/close handlers (or use native `<dialog>`)
66
+ - **Tooltip** - Needs positioning and show/hide logic
67
+
68
+ See `src/main.js` for a minimal dropdown implementation.
69
+
70
+ ## Adapting for Your Framework
71
+
72
+ ### React
73
+ ```jsx
74
+ // App.jsx
75
+ import "./styles.css";
76
+
77
+ function App() {
78
+ return <button className="btn btn-primary">Click me</button>;
79
+ }
80
+ ```
81
+
82
+ ### Vue
83
+ ```vue
84
+ <script setup>
85
+ import "./styles.css";
86
+ </script>
87
+
88
+ <template>
89
+ <button class="btn btn-primary">Click me</button>
90
+ </template>
91
+ ```
92
+
93
+ ### Svelte
94
+ ```svelte
95
+ <script>
96
+ import "./styles.css";
97
+ </script>
98
+
99
+ <button class="btn btn-primary">Click me</button>
100
+ ```
101
+
102
+ ## Troubleshooting
103
+
104
+ ### Styles don't apply
105
+ - Make sure `@tailwindcss/vite` is installed and registered in `vite.config.js`
106
+ - Verify you're importing from CSS, not JavaScript
107
+ - Check that `@import "tailwindcss"` comes before `@import "@valiify/dashboard-ui/source"`
108
+
109
+ ### Icons don't show
110
+ - Make sure the sprite is loaded and inlined (see `src/main.js`)
111
+ - Check the browser console for fetch errors
112
+ - Verify sprite.svg path is correct for your bundler
113
+
114
+ ### Components look broken
115
+ - Check that you're using the full markup structure (see CLAUDE.md in the repo)
116
+ - Many components need wrapper elements (e.g., `.input-container` > `.input-field` > `.input`)
117
+ - Verify you're using the correct variant/size classes
118
+
119
+ ## Learn More
120
+
121
+ - [Package README](../../README.md) - Installation and configuration
122
+ - [CLAUDE.md](../../CLAUDE.md) - Complete component reference with full markup
123
+ - [Component Docs](../../docs/component-process.md) - How components are built
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Valiify Dashboard UI - Vite Starter</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.js"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "valiify-ui-vite-starter",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "@valiify/dashboard-ui": "file:../.."
13
+ },
14
+ "devDependencies": {
15
+ "@tailwindcss/vite": "^4.0.0",
16
+ "tailwindcss": "^4.0.0",
17
+ "vite": "^6.0.0"
18
+ }
19
+ }
@@ -0,0 +1,188 @@
1
+ // Import your stylesheet (NOT the library directly)
2
+ import "./styles.css";
3
+
4
+ // Load the icon sprite
5
+ import spriteUrl from "@valiify/dashboard-ui/icons/sprite.svg?url";
6
+
7
+ // Inline the sprite into the document
8
+ fetch(spriteUrl)
9
+ .then((r) => r.text())
10
+ .then((svg) => {
11
+ const host = document.createElement("div");
12
+ host.style.display = "none";
13
+ host.innerHTML = svg;
14
+ document.body.prepend(host);
15
+ });
16
+
17
+ // Render a simple example
18
+ const app = document.getElementById("app");
19
+ app.innerHTML = `
20
+ <div style="max-width: 800px; margin: 0 auto;">
21
+ <h1 style="font-size: 32px; font-weight: 600; margin-bottom: 24px; color: var(--color-content-primary);">
22
+ Valiify Dashboard UI - Vite Starter
23
+ </h1>
24
+
25
+ <div style="display: flex; flex-direction: column; gap: 24px;">
26
+ <!-- Buttons -->
27
+ <section>
28
+ <h2 style="font-size: 18px; font-weight: 500; margin-bottom: 12px; color: var(--color-content-primary);">
29
+ Buttons
30
+ </h2>
31
+ <div style="display: flex; gap: 12px; flex-wrap: wrap;">
32
+ <button class="btn btn-primary">Primary</button>
33
+ <button class="btn btn-outline">Outline</button>
34
+ <button class="btn btn-empty">Empty</button>
35
+ <button class="btn btn-primary" disabled>Disabled</button>
36
+ </div>
37
+ </section>
38
+
39
+ <!-- Input -->
40
+ <section>
41
+ <h2 style="font-size: 18px; font-weight: 500; margin-bottom: 12px; color: var(--color-content-primary);">
42
+ Input
43
+ </h2>
44
+ <div class="input-container" style="max-width: 400px;">
45
+ <div class="input-label">
46
+ <span>Email Address</span>
47
+ </div>
48
+ <div class="input-field input-lg">
49
+ <svg class="input-icon-left icon icon-size-14" aria-hidden="true">
50
+ <use href="#mail" />
51
+ </svg>
52
+ <input type="email" class="input" placeholder="you@example.com" />
53
+ </div>
54
+ </div>
55
+ </section>
56
+
57
+ <!-- Alert -->
58
+ <section>
59
+ <h2 style="font-size: 18px; font-weight: 500; margin-bottom: 12px; color: var(--color-content-primary);">
60
+ Alert
61
+ </h2>
62
+ <div class="alert alert-warning" role="alert">
63
+ <div class="alert-body">
64
+ <svg class="alert-icon icon icon-size-18" aria-hidden="true">
65
+ <use href="#info" />
66
+ </svg>
67
+ <div class="alert-content">
68
+ <p class="alert-title">Setup Complete</p>
69
+ <p class="alert-message">
70
+ If you can see this alert with proper styling and icons,
71
+ your installation is working correctly!
72
+ </p>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </section>
77
+
78
+ <!-- Status Chips -->
79
+ <section>
80
+ <h2 style="font-size: 18px; font-weight: 500; margin-bottom: 12px; color: var(--color-content-primary);">
81
+ Status Indicators
82
+ </h2>
83
+ <div style="display: flex; gap: 12px; flex-wrap: wrap;">
84
+ <span class="chip chip-success">
85
+ <span class="chip-dot"></span>
86
+ <span>Approved</span>
87
+ </span>
88
+ <span class="chip chip-warning">
89
+ <span class="chip-dot"></span>
90
+ <span>Pending</span>
91
+ </span>
92
+ <span class="chip chip-critical">
93
+ <span class="chip-dot"></span>
94
+ <span>Rejected</span>
95
+ </span>
96
+ </div>
97
+ </section>
98
+
99
+ <!-- Interactive Dropdown Example -->
100
+ <section>
101
+ <h2 style="font-size: 18px; font-weight: 500; margin-bottom: 12px; color: var(--color-content-primary);">
102
+ Dropdown (Interactive)
103
+ </h2>
104
+ <p style="margin-bottom: 12px; font-size: 14px; color: var(--color-content-secondary);">
105
+ Note: Dropdowns require JavaScript to function. See the code below for a minimal implementation.
106
+ </p>
107
+ <div id="dropdown-example"></div>
108
+ </section>
109
+ </div>
110
+ </div>
111
+ `;
112
+
113
+ // Example of minimal dropdown behavior
114
+ const dropdownExample = document.getElementById("dropdown-example");
115
+ dropdownExample.innerHTML = `
116
+ <div class="dropdown-field-container" style="max-width: 300px;">
117
+ <div class="dropdown-field-label">
118
+ <span>Select an option</span>
119
+ </div>
120
+ <div class="dropdown">
121
+ <button
122
+ id="dropdown-trigger"
123
+ class="dropdown-field"
124
+ aria-haspopup="listbox"
125
+ aria-expanded="false"
126
+ >
127
+ <span class="dropdown-field-placeholder">Choose one...</span>
128
+ <svg class="dropdown-field-chevron icon icon-size-14" aria-hidden="true">
129
+ <use href="#chevron-down" />
130
+ </svg>
131
+ </button>
132
+ <div id="dropdown-panel" class="dropdown-panel" hidden>
133
+ <div class="dropdown-menu" role="listbox">
134
+ <button class="menu-item" role="option" data-value="weekly">
135
+ <span class="menu-item-text">
136
+ <span class="menu-item-title">Weekly</span>
137
+ </span>
138
+ </button>
139
+ <button class="menu-item" role="option" data-value="monthly">
140
+ <span class="menu-item-text">
141
+ <span class="menu-item-title">Monthly</span>
142
+ </span>
143
+ </button>
144
+ <button class="menu-item" role="option" data-value="yearly">
145
+ <span class="menu-item-text">
146
+ <span class="menu-item-title">Yearly</span>
147
+ </span>
148
+ </button>
149
+ </div>
150
+ </div>
151
+ </div>
152
+ </div>
153
+ `;
154
+
155
+ // Minimal dropdown behavior
156
+ const trigger = document.getElementById("dropdown-trigger");
157
+ const panel = document.getElementById("dropdown-panel");
158
+ const options = panel.querySelectorAll('[role="option"]');
159
+ const placeholder = trigger.querySelector(".dropdown-field-placeholder");
160
+
161
+ trigger.addEventListener("click", () => {
162
+ const isOpen = trigger.getAttribute("aria-expanded") === "true";
163
+ trigger.setAttribute("aria-expanded", !isOpen);
164
+ panel.hidden = isOpen;
165
+ });
166
+
167
+ options.forEach((option) => {
168
+ option.addEventListener("click", () => {
169
+ const value = option.getAttribute("data-value");
170
+ const title = option.querySelector(".menu-item-title").textContent;
171
+
172
+ // Update the trigger
173
+ placeholder.textContent = title;
174
+ placeholder.className = "dropdown-field-value";
175
+
176
+ // Close the dropdown
177
+ trigger.setAttribute("aria-expanded", "false");
178
+ panel.hidden = true;
179
+ });
180
+ });
181
+
182
+ // Close on outside click
183
+ document.addEventListener("click", (e) => {
184
+ if (!trigger.contains(e.target) && !panel.contains(e.target)) {
185
+ trigger.setAttribute("aria-expanded", "false");
186
+ panel.hidden = true;
187
+ }
188
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * IMPORTANT: Import from CSS, never from JavaScript
3
+ *
4
+ * Importing @valiify/dashboard-ui from a .js/.ts file breaks silently.
5
+ * Always import it here in your CSS file.
6
+ */
7
+
8
+ /* Optional: Load Google Fonts (or self-host for better performance) */
9
+ @import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");
10
+
11
+ /* Required: Tailwind CSS */
12
+ @import "tailwindcss";
13
+
14
+ /* Required: Valiify Dashboard UI (use /source for token utilities) */
15
+ @import "@valiify/dashboard-ui/source";
16
+
17
+ /* Your custom styles go here */
18
+ body {
19
+ font-family: Inter, system-ui, sans-serif;
20
+ background: var(--color-surface-frame);
21
+ padding: 2rem;
22
+ }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from "vite";
2
+ import tailwindcss from "@tailwindcss/vite";
3
+
4
+ export default defineConfig({
5
+ plugins: [tailwindcss()],
6
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valiify/dashboard-ui",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "Tailwind CSS component library for Valiify Dashboard applications",
5
5
  "style": "dist/index.css",
6
6
  "types": "types/index.d.ts",
@@ -19,8 +19,14 @@
19
19
  "dist",
20
20
  "src",
21
21
  "types",
22
+ "examples",
22
23
  "README.md",
23
- "CHANGELOG.md"
24
+ "GETTING_STARTED.md",
25
+ "COMPONENTS.md",
26
+ "TROUBLESHOOTING.md",
27
+ "QUICK_REFERENCE.md",
28
+ "CHANGELOG.md",
29
+ "CLAUDE.md"
24
30
  ],
25
31
  "scripts": {
26
32
  "build": "npm run build:theme && npm run build:icons && postcss src/index.css -o dist/index.css",