@valiify/dashboard-ui 0.1.0-alpha.1 → 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.
@@ -0,0 +1,155 @@
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 - Basic Example</title>
7
+
8
+ <!--
9
+ Loads only the built library. dist/index.css is self-contained: it carries
10
+ the design tokens and every component class.
11
+
12
+ Two things this example deliberately does NOT do:
13
+ * No Tailwind CDN. The CDN ships v3, this library is built with v4, and
14
+ mixing them produces conflicting output.
15
+ * No Tailwind utility classes for layout. dist/index.css intentionally
16
+ ships no utilities (see CLAUDE.md), so layout below uses plain inline
17
+ styles. A real app generates utilities from its own Tailwind build.
18
+
19
+ Run `npm run build` first, or this page will be unstyled.
20
+ -->
21
+ <!-- Fonts are not bundled into dist/index.css; load them yourself. -->
22
+ <link
23
+ rel="stylesheet"
24
+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap"
25
+ />
26
+ <link rel="stylesheet" href="../../dist/index.css" />
27
+
28
+ <style>
29
+ body {
30
+ min-height: 100vh;
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ padding: 2rem;
35
+ }
36
+ </style>
37
+ </head>
38
+ <body>
39
+ <!-- Example: Sign-in Form Card -->
40
+ <div class="card" style="max-width: 400px; width: 100%">
41
+ <h1 class="card-title" style="font-size: 24px; margin-bottom: 8px">
42
+ Welcome Back
43
+ </h1>
44
+ <p class="card-body" style="margin-bottom: 24px">
45
+ Sign in to your Valiify Dashboard account.
46
+ </p>
47
+
48
+ <div style="display: flex; flex-direction: column; gap: 16px">
49
+ <!-- Email Input -->
50
+ <div>
51
+ <label
52
+ style="
53
+ display: block;
54
+ margin-bottom: 4px;
55
+ font-size: 14px;
56
+ font-weight: 500;
57
+ color: var(--color-content-primary);
58
+ "
59
+ >
60
+ Email
61
+ </label>
62
+ <input
63
+ type="email"
64
+ class="input"
65
+ placeholder="Enter your email"
66
+ value="user@valiify.com"
67
+ />
68
+ </div>
69
+
70
+ <!-- Password Input -->
71
+ <div>
72
+ <label
73
+ style="
74
+ display: block;
75
+ margin-bottom: 4px;
76
+ font-size: 14px;
77
+ font-weight: 500;
78
+ color: var(--color-content-primary);
79
+ "
80
+ >
81
+ Password
82
+ </label>
83
+ <input
84
+ type="password"
85
+ class="input"
86
+ placeholder="Enter your password"
87
+ />
88
+ </div>
89
+
90
+ <!-- Remember Me Checkbox (using HTML checkbox with custom label) -->
91
+ <div style="display: flex; align-items: center; gap: 8px">
92
+ <input
93
+ type="checkbox"
94
+ id="remember"
95
+ style="width: 16px; height: 16px"
96
+ />
97
+ <label
98
+ for="remember"
99
+ style="
100
+ font-size: 14px;
101
+ color: var(--color-content-secondary);
102
+ cursor: pointer;
103
+ "
104
+ >
105
+ Remember me
106
+ </label>
107
+ </div>
108
+
109
+ <!-- Action Buttons -->
110
+ <div style="display: flex; gap: 8px; margin-top: 8px">
111
+ <button
112
+ class="btn btn-primary"
113
+ style="flex: 1"
114
+ onclick="alert('Sign in clicked')"
115
+ >
116
+ Sign In
117
+ </button>
118
+ <button class="btn btn-outline" onclick="alert('Cancel clicked')">
119
+ Cancel
120
+ </button>
121
+ </div>
122
+
123
+ <!-- Forgot Password Link -->
124
+ <div style="text-align: center; margin-top: 8px">
125
+ <a
126
+ href="#"
127
+ style="
128
+ font-size: 14px;
129
+ color: var(--color-primary);
130
+ text-decoration: none;
131
+ "
132
+ >
133
+ Forgot password?
134
+ </a>
135
+ </div>
136
+ </div>
137
+ </div>
138
+
139
+ <!-- Demo Controls -->
140
+ <div
141
+ style="
142
+ position: fixed;
143
+ bottom: 20px;
144
+ right: 20px;
145
+ display: flex;
146
+ flex-direction: column;
147
+ gap: 8px;
148
+ "
149
+ >
150
+ <button class="btn btn-sm btn-outline" onclick="alert('This is a demo!')">
151
+ View Demo Info
152
+ </button>
153
+ </div>
154
+ </body>
155
+ </html>
@@ -0,0 +1,47 @@
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
+ > **Note:** If you copied this example from the GitHub repo, the `package.json` may reference `"file:../.."`. When installing from npm, this is automatically fixed to use the published version. If you see installation errors, check that the dependency is set to a version number like `"^0.1.0-alpha.2"`.
22
+
23
+ ## Key Files
24
+
25
+ - `postcss.config.js` - PostCSS configuration with @tailwindcss/postcss
26
+ - `src/styles.css` - Source stylesheet
27
+ - `dist/styles.css` - Built stylesheet (generated)
28
+ - `index.html` - HTML file linking to built CSS
29
+
30
+ ## Why @tailwindcss/postcss?
31
+
32
+ Tailwind v4 requires an integration package. For PostCSS, that's `@tailwindcss/postcss`.
33
+
34
+ Without it, `@import "tailwindcss"` does nothing and your styles are missing with no error.
35
+
36
+ ## For webpack Users
37
+
38
+ Same setup, but install `@tailwindcss/webpack` instead of `@tailwindcss/postcss` and add it to your webpack config:
39
+
40
+ ```js
41
+ // webpack.config.js
42
+ import tailwindcss from "@tailwindcss/webpack";
43
+
44
+ export default {
45
+ plugins: [tailwindcss()],
46
+ };
47
+ ```
@@ -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": "^0.1.0"
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,125 @@
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
+ > **Note:** If you copied this example from the GitHub repo, the `package.json` may reference `"file:../.."`. When installing from npm, this is automatically fixed to use the published version. If you see installation errors, check that the dependency is set to a version number like `"^0.1.0-alpha.2"`.
21
+
22
+ ## What This Example Shows
23
+
24
+ 1. **Correct installation** - How to install the required packages
25
+ 2. **Vite configuration** - The `@tailwindcss/vite` plugin is required
26
+ 3. **CSS imports** - Import the library from CSS, never from JavaScript
27
+ 4. **Icon sprite loading** - How to load and inline the icon sprite
28
+ 5. **Component usage** - Examples of buttons, inputs, alerts, and chips
29
+ 6. **Interactive components** - Minimal JavaScript for dropdown behavior
30
+
31
+ ## Key Files
32
+
33
+ - `vite.config.js` - Vite configuration with Tailwind plugin
34
+ - `src/styles.css` - Stylesheet with correct import order
35
+ - `src/main.js` - JavaScript entry point (imports CSS, loads sprite)
36
+ - `package.json` - Required dependencies
37
+
38
+ ## Important Notes
39
+
40
+ ### Import from CSS, Not JavaScript
41
+
42
+ ❌ **Don't do this:**
43
+ ```js
44
+ // main.js
45
+ import "@valiify/dashboard-ui/source";
46
+ ```
47
+
48
+ ✅ **Do this:**
49
+ ```css
50
+ /* styles.css */
51
+ @import "tailwindcss";
52
+ @import "@valiify/dashboard-ui/source";
53
+ ```
54
+
55
+ ```js
56
+ // main.js
57
+ import "./styles.css";
58
+ ```
59
+
60
+ ### Components That Need JavaScript
61
+
62
+ These components ship no JavaScript and require you to implement behavior:
63
+
64
+ - **DropdownField** - Needs click handler, aria-expanded toggle, outside-click detection
65
+ - **DropdownMenu** - Same as DropdownField
66
+ - **Tabs** - Needs tab switching and aria-selected management
67
+ - **Modal** - Needs open/close handlers (or use native `<dialog>`)
68
+ - **Tooltip** - Needs positioning and show/hide logic
69
+
70
+ See `src/main.js` for a minimal dropdown implementation.
71
+
72
+ ## Adapting for Your Framework
73
+
74
+ ### React
75
+ ```jsx
76
+ // App.jsx
77
+ import "./styles.css";
78
+
79
+ function App() {
80
+ return <button className="btn btn-primary">Click me</button>;
81
+ }
82
+ ```
83
+
84
+ ### Vue
85
+ ```vue
86
+ <script setup>
87
+ import "./styles.css";
88
+ </script>
89
+
90
+ <template>
91
+ <button class="btn btn-primary">Click me</button>
92
+ </template>
93
+ ```
94
+
95
+ ### Svelte
96
+ ```svelte
97
+ <script>
98
+ import "./styles.css";
99
+ </script>
100
+
101
+ <button class="btn btn-primary">Click me</button>
102
+ ```
103
+
104
+ ## Troubleshooting
105
+
106
+ ### Styles don't apply
107
+ - Make sure `@tailwindcss/vite` is installed and registered in `vite.config.js`
108
+ - Verify you're importing from CSS, not JavaScript
109
+ - Check that `@import "tailwindcss"` comes before `@import "@valiify/dashboard-ui/source"`
110
+
111
+ ### Icons don't show
112
+ - Make sure the sprite is loaded and inlined (see `src/main.js`)
113
+ - Check the browser console for fetch errors
114
+ - Verify sprite.svg path is correct for your bundler
115
+
116
+ ### Components look broken
117
+ - Check that you're using the full markup structure (see CLAUDE.md in the repo)
118
+ - Many components need wrapper elements (e.g., `.input-container` > `.input-field` > `.input`)
119
+ - Verify you're using the correct variant/size classes
120
+
121
+ ## Learn More
122
+
123
+ - [Package README](../../README.md) - Installation and configuration
124
+ - [CLAUDE.md](../../CLAUDE.md) - Complete component reference with full markup
125
+ - [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": "^0.1.0"
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
+ });