mood-ui 0.7.1 → 0.8.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.
Files changed (56) hide show
  1. package/dist/mood-ui.cjs +3 -3
  2. package/dist/mood-ui.cjs.map +1 -1
  3. package/dist/mood-ui.css +2 -2
  4. package/dist/mood-ui.mjs +6130 -3387
  5. package/dist/mood-ui.mjs.map +1 -1
  6. package/dist/types/components/ModoProvider.vue.d.ts +8 -1
  7. package/dist/types/components/data-display/calendar/AgendaView.vue.d.ts +2 -2
  8. package/dist/types/components/data-display/calendar/DayView.vue.d.ts +2 -2
  9. package/dist/types/components/data-display/calendar/MonthView.vue.d.ts +2 -2
  10. package/dist/types/components/data-display/calendar/Scheduler.vue.d.ts +2 -2
  11. package/dist/types/components/data-display/calendar/WeekView.vue.d.ts +2 -2
  12. package/dist/types/components/feedback/Banner.vue.d.ts +1 -1
  13. package/dist/types/components/feedback/Drawer.vue.d.ts +4 -4
  14. package/dist/types/components/feedback/Modal.vue.d.ts +3 -3
  15. package/dist/types/components/feedback/ToastContainer.vue.d.ts +1 -1
  16. package/dist/types/components/feedback/Tooltip.vue.d.ts +1 -1
  17. package/dist/types/components/forms/AvatarCropper.vue.d.ts +15 -0
  18. package/dist/types/components/forms/AvatarUpload.vue.d.ts +65 -0
  19. package/dist/types/components/forms/ButtonGroup.vue.d.ts +1 -0
  20. package/dist/types/components/forms/ColorModeSwitch.vue.d.ts +2 -2
  21. package/dist/types/components/forms/Combobox.vue.d.ts +2 -2
  22. package/dist/types/components/forms/DateField.vue.d.ts +2 -2
  23. package/dist/types/components/forms/DateRangeField.vue.d.ts +2 -2
  24. package/dist/types/components/forms/DateTimeField.vue.d.ts +2 -2
  25. package/dist/types/components/forms/Input.vue.d.ts +2 -2
  26. package/dist/types/components/forms/MultiSelect.vue.d.ts +2 -2
  27. package/dist/types/components/forms/NumberInput.vue.d.ts +2 -2
  28. package/dist/types/components/forms/OTPInput.vue.d.ts +24 -0
  29. package/dist/types/components/forms/PasswordInput.vue.d.ts +2 -2
  30. package/dist/types/components/forms/PhoneInput.vue.d.ts +31 -0
  31. package/dist/types/components/forms/SearchInput.vue.d.ts +2 -2
  32. package/dist/types/components/forms/Select.vue.d.ts +2 -2
  33. package/dist/types/components/forms/Textarea.vue.d.ts +3 -3
  34. package/dist/types/components/layout/Canvas.vue.d.ts +1 -1
  35. package/dist/types/components/navigation/DropdownMenu.vue.d.ts +2 -2
  36. package/dist/types/composables/useAvatarCrop.d.ts +25 -0
  37. package/dist/types/composables/useAvatarProvider.d.ts +21 -0
  38. package/dist/types/composables/useAvatarUpload.d.ts +26 -0
  39. package/dist/types/composables/useColorMode.d.ts +24 -1
  40. package/dist/types/composables/useConfirm.d.ts +14 -135
  41. package/dist/types/composables/useField.d.ts +7 -1
  42. package/dist/types/composables/useToast.d.ts +14 -139
  43. package/dist/types/config/ModoConfig.d.ts +12 -0
  44. package/dist/types/config/ModoLocale.d.ts +47 -0
  45. package/dist/types/config/createModoUI.d.ts +6 -0
  46. package/dist/types/data/phoneCountries.d.ts +18 -0
  47. package/dist/types/index.d.ts +14 -4
  48. package/dist/types/interfaces/forms/AvatarUpload.interface.d.ts +106 -0
  49. package/dist/types/interfaces/forms/ButtonGroup.interface.d.ts +7 -5
  50. package/dist/types/interfaces/forms/OTPInput.interface.d.ts +65 -0
  51. package/dist/types/interfaces/forms/PhoneInput.interface.d.ts +74 -0
  52. package/dist/types/utils/createAvatarProvider.d.ts +54 -0
  53. package/package.json +7 -9
  54. package/LICENSE +0 -21
  55. package/README.OLD.md +0 -5
  56. package/README.md +0 -173
@@ -0,0 +1,106 @@
1
+ import { ModoRadius } from '../../config/ModoConfig';
2
+ export type AvatarVariant = 'default' | 'realistic' | 'illustration' | 'watercolor' | 'oilpainting' | 'anime' | 'cartoon' | 'chibi' | 'minimal' | 'cyberpunk' | 'sketch' | 'pixel' | '3d' | 'retro' | 'fantasy' | 'gaming' | 'nft';
3
+ /**
4
+ * Provider function implemented by the developer. Mood UI never provides AI
5
+ * directly — the developer connects their own model/API/backend.
6
+ *
7
+ * @param options - prompt text, source image for img2img, and style variant
8
+ * @param signal - AbortSignal for cancellation support
9
+ * @returns URL or base64 string of the generated image
10
+ */
11
+ export type AvatarProvider = (options: {
12
+ prompt?: string;
13
+ image?: File;
14
+ variant?: string;
15
+ }, signal?: AbortSignal) => Promise<string>;
16
+ /** Payload emitted with the `save` event so the developer can upload to their backend. */
17
+ export interface AvatarSavePayload {
18
+ /**
19
+ * Processed blob ready to upload.
20
+ * `null` when the AI provider returned a remote URL that could not be
21
+ * fetched due to CORS — in that case use `remoteUrl` and have your
22
+ * backend download the image server-side.
23
+ */
24
+ blob: Blob | null;
25
+ /** Display URL — may be a local blob URL or the original remote URL. */
26
+ url: string;
27
+ /**
28
+ * Original URL returned by the AI provider.
29
+ * Only present when `blob` is `null` (CORS prevented browser download).
30
+ * Your backend should fetch this URL to obtain the image data.
31
+ */
32
+ remoteUrl?: string;
33
+ /** How the image was produced. */
34
+ source: 'upload' | 'generated' | 'transformed';
35
+ mimeType: string;
36
+ /** File size in bytes. 0 when blob is null. */
37
+ size: number;
38
+ }
39
+ export interface AvatarUpload {
40
+ /** Current avatar URL or base64 (v-model). */
41
+ modelValue?: string;
42
+ /** Enable AI generation features (prompt input, variant selector, regenerate). */
43
+ ai?: boolean;
44
+ /**
45
+ * AI generation function. If omitted, falls back to the global
46
+ * `ModoProvider` `ai.avatarProvider` config. Without a provider the
47
+ * component operates in upload-only mode regardless of `ai` prop.
48
+ */
49
+ provider?: AvatarProvider;
50
+ /** Visual style passed to the provider. Default: 'default'. */
51
+ variant?: AvatarVariant;
52
+ /**
53
+ * User's display name — used to derive initials for the fallback avatar.
54
+ * Example: "Eduardo Aranda" → "AP".
55
+ */
56
+ name?: string;
57
+ size?: 'small' | 'medium' | 'large';
58
+ radius?: ModoRadius;
59
+ disabled?: boolean;
60
+ readonly?: boolean;
61
+ /** Show interactive crop after upload. Default: true. */
62
+ crop?: boolean;
63
+ /** Max upload size in bytes. Default: 5_242_880 (5 MB). */
64
+ maxSize?: number;
65
+ /** Accepted MIME types. Default: ['image/png', 'image/jpeg', 'image/webp']. */
66
+ accept?: string[];
67
+ /** Fallback image URL shown when no avatar is set and there are no initials. */
68
+ fallback?: string;
69
+ /**
70
+ * Show a regenerate button after a successful generation.
71
+ * Defaults to `true` when `ai=true` and a provider is available.
72
+ */
73
+ regenerate?: boolean;
74
+ /** Show circular preview. Default: true. */
75
+ preview?: boolean;
76
+ /**
77
+ * When `true`, clicking the avatar preview opens a full-size view in a modal.
78
+ * Works in both edit and read-only modes.
79
+ */
80
+ lightbox?: boolean;
81
+ /** Placeholder text for the AI prompt input. */
82
+ promptPlaceholder?: string;
83
+ /**
84
+ * Quick-pick prompt suggestions shown as clickable chips above the text input.
85
+ * Clicking a chip sets (or clears, if already active) the prompt field.
86
+ * The user can still edit freely after selecting one.
87
+ *
88
+ * @example
89
+ * :prompt-suggestions="['LinkedIn professional', 'Cartoon', 'Anime', 'Pixel art']"
90
+ */
91
+ promptSuggestions?: string[];
92
+ /**
93
+ * Controls when `onSave` is invoked:
94
+ * - `'manual'` — (default when `onSave` provided) show "Save" button; user triggers upload.
95
+ * - `'auto'` — call `onSave` immediately after image is ready.
96
+ * - `'none'` — (default without `onSave`) emit `update:modelValue` with the local blob URL.
97
+ */
98
+ saveMode?: 'auto' | 'manual' | 'none';
99
+ /**
100
+ * Optional async upload function. Receives the ready-to-upload payload and
101
+ * must return the final persistent URL (CDN, backend, etc.).
102
+ * When provided and `saveMode !== 'none'`, the component shows a save
103
+ * loading state and emits `saved` with the returned URL.
104
+ */
105
+ onSave?: (payload: AvatarSavePayload) => Promise<string>;
106
+ }
@@ -1,9 +1,11 @@
1
1
  export interface ButtonGroup {
2
- orientation?: 'horizontal' | 'vertical';
3
- variant?: 'normal' | 'outline' | 'ghost' | 'text';
4
- color?: 'default' | 'primary' | 'danger' | 'success' | 'warning';
5
- size?: 'small' | 'medium' | 'large';
6
- radius?: 'none' | 'small' | 'medium' | 'large' | 'full';
2
+ orientation?: "horizontal" | "vertical";
3
+ variant?: "normal" | "outline" | "ghost" | "text";
4
+ color?: "default" | "primary" | "danger" | "success" | "warning";
5
+ size?: "small" | "medium" | "large";
6
+ radius?: "none" | "small" | "medium" | "large" | "full";
7
7
  disabled?: boolean;
8
8
  gradient?: boolean;
9
+ /** Expand all buttons to fill the available width. */
10
+ fullWidth?: boolean;
9
11
  }
@@ -0,0 +1,65 @@
1
+ export interface OTPInput {
2
+ /** The full OTP string value (v-model). */
3
+ modelValue?: string;
4
+ /**
5
+ * Number of input slots.
6
+ * @default 6
7
+ */
8
+ length?: number;
9
+ /**
10
+ * Mask slot values (render as `•` using `type="password"`).
11
+ * @default false
12
+ */
13
+ mask?: boolean;
14
+ /**
15
+ * Restrict input to digits only. Set to `false` for alphanumeric OTPs.
16
+ * @default true
17
+ */
18
+ numeric?: boolean;
19
+ /**
20
+ * Slot index after which a separator dash `—` is rendered.
21
+ * E.g. `separator=3` on a 6-slot OTP renders `XXX — XXX`.
22
+ */
23
+ separator?: number;
24
+ /** Visible label above the slots. */
25
+ label?: string;
26
+ /** Helper text (hidden when errorText is present). */
27
+ helperText?: string;
28
+ /** Error message. Marks the field as invalid when set. */
29
+ errorText?: string;
30
+ /** Semantic color applied to focus ring and accent states. */
31
+ color?: "default" | "primary" | "danger" | "success" | "warning";
32
+ /** Slot size. */
33
+ size?: "small" | "medium" | "large";
34
+ /** Corner radius for each slot. Inherits from ModoProvider when omitted. */
35
+ radius?: "none" | "small" | "medium" | "large" | "full";
36
+ /**
37
+ * Persistent halo (ring) style.
38
+ * - `'tinted'` (default): tinted to the active color on hover/focus.
39
+ * - `'neutral'`: always grey.
40
+ * - `'off'`: no persistent ring, only focus-visible ring.
41
+ */
42
+ halo?: "tinted" | "neutral" | "off";
43
+ /** Applies `w-full` to the root element. */
44
+ fullWidth?: boolean;
45
+ /** Disables all slots. */
46
+ disabled?: boolean;
47
+ /** Read-only mode: shows values but prevents editing. */
48
+ readonly?: boolean;
49
+ /** Marks the group as required. */
50
+ required?: boolean;
51
+ /** Auto-focus the first slot on mount. */
52
+ autofocus?: boolean;
53
+ /** Shows a loading spinner (implies disabled). */
54
+ loading?: boolean;
55
+ /** HTML `name` attribute for the hidden native input (form submission). */
56
+ name?: string;
57
+ /** id prefix. Auto-generated if omitted. */
58
+ id?: string;
59
+ /** Accessible name for the slot group when no visible `label` is provided. */
60
+ ariaLabel?: string;
61
+ /** Forces the invalid state without rendering `errorText`. Useful inside `FormField`. */
62
+ invalid?: boolean;
63
+ /** Extra IDs to concatenate into `aria-describedby`. */
64
+ ariaDescribedBy?: string;
65
+ }
@@ -0,0 +1,74 @@
1
+ export interface PhoneInput {
2
+ /**
3
+ * v-model — the phone number value.
4
+ * - `format='national'` (default): the raw digits/characters the user typed.
5
+ * - `format='international'`: full E.164-style string, e.g. `'+15551234567'`.
6
+ * - `format='e164'`: digits-only E.164, e.g. `'+15551234567'` (same as international but always digit-clean).
7
+ */
8
+ modelValue?: string;
9
+ /**
10
+ * ISO 3166-1 alpha-2 country code (e.g. `'US'`, `'ES'`, `'GB'`).
11
+ * Bind with `v-model:country` for controlled mode.
12
+ */
13
+ country?: string;
14
+ /**
15
+ * Default country shown on first render (uncontrolled).
16
+ * Ignored when `country` is bound.
17
+ * @default 'US'
18
+ */
19
+ defaultCountry?: string;
20
+ /**
21
+ * Output format emitted via `update:modelValue`.
22
+ * - `'national'` (default): just what the user typed.
23
+ * - `'international'`: `+{dialCode}{local}`.
24
+ * - `'e164'`: `+{dialCode}` followed by digits-only local part.
25
+ */
26
+ format?: 'national' | 'international' | 'e164';
27
+ /** Visible label above the field. */
28
+ label?: string;
29
+ /** Placeholder for the number input. */
30
+ placeholder?: string;
31
+ /** Helper text (hidden when errorText is present). */
32
+ helperText?: string;
33
+ /** Error message. Marks the field as invalid when set. */
34
+ errorText?: string;
35
+ /** Visual style. */
36
+ variant?: 'outline' | 'filled' | 'ghost';
37
+ /** Semantic color applied to focus and accent states. */
38
+ color?: 'default' | 'primary' | 'danger' | 'success' | 'warning';
39
+ /** Field size. */
40
+ size?: 'small' | 'medium' | 'large';
41
+ /** Corner radius. Inherits from ModoProvider when omitted. */
42
+ radius?: 'none' | 'small' | 'medium' | 'large' | 'full';
43
+ /**
44
+ * Persistent halo (ring) style.
45
+ * - `'tinted'`: tinted to the active color (default).
46
+ * - `'neutral'`: always grey.
47
+ * - `'off'`: no persistent ring, only focus-visible ring.
48
+ */
49
+ halo?: 'tinted' | 'neutral' | 'off';
50
+ /** Applies `w-full` to the root element. */
51
+ fullWidth?: boolean;
52
+ /** Disables the entire field. */
53
+ disabled?: boolean;
54
+ /** Read-only: maintains normal styling but prevents editing. */
55
+ readonly?: boolean;
56
+ /** Marks the field as required (visual indicator + attribute). */
57
+ required?: boolean;
58
+ /** Shows a spinner and disables the field during async operations. */
59
+ loading?: boolean;
60
+ /** HTML `name` attribute for form submission. */
61
+ name?: string;
62
+ /** Input id. Auto-generated if omitted. */
63
+ id?: string;
64
+ /** HTML `autocomplete` attribute. */
65
+ autocomplete?: string;
66
+ /** Auto-focus on mount. */
67
+ autofocus?: boolean;
68
+ /** Accessible name when no visible `label` is provided. */
69
+ ariaLabel?: string;
70
+ /** Forces the invalid state without rendering `errorText`. Useful inside `FormField`. */
71
+ invalid?: boolean;
72
+ /** Extra IDs to concatenate into `aria-describedby` (e.g. provided by `FormField`). */
73
+ ariaDescribedBy?: string;
74
+ }
@@ -0,0 +1,54 @@
1
+ import { AvatarProvider } from '../interfaces/forms/AvatarUpload.interface';
2
+ export interface CreateAvatarProviderOptions {
3
+ /** URL of your backend endpoint (or AI API directly, for testing only). */
4
+ url: string;
5
+ /** Extra headers — e.g. Authorization for direct API calls during development. */
6
+ headers?: Record<string, string>;
7
+ /**
8
+ * Override the JSON body for text-to-image requests (no source image).
9
+ * By default sends `{ prompt, variant }`.
10
+ */
11
+ body?: (opts: {
12
+ prompt?: string;
13
+ variant?: string;
14
+ }) => Record<string, unknown>;
15
+ /**
16
+ * Override the FormData for image-to-image requests (when a source image is present).
17
+ * By default appends `image`, `prompt`, and `variant` fields.
18
+ */
19
+ imageBody?: (opts: {
20
+ prompt?: string;
21
+ variant?: string;
22
+ image: File;
23
+ }, form: FormData) => void;
24
+ /**
25
+ * Extract the image URL from the JSON response.
26
+ * If omitted, common shapes are detected automatically:
27
+ * { url }, { imageUrl }, { image }, { data[0].url } (OpenAI), { output[0] } (Replicate)
28
+ */
29
+ extractUrl?: (data: unknown) => string;
30
+ }
31
+ /**
32
+ * Factory that turns a URL + optional config into an AvatarProvider function.
33
+ *
34
+ * - When called **without** a source image: sends `application/json` with `{ prompt, variant }`.
35
+ * - When called **with** a source image: sends `multipart/form-data` with `image`, `prompt`, and
36
+ * `variant` fields so the backend can pass it to an img2img model.
37
+ *
38
+ * For production, point it at your own backend endpoint — never expose API keys in the browser.
39
+ * For local testing you can point it directly at an AI API (see examples in the showroom).
40
+ *
41
+ * @example
42
+ * // Backend endpoint (recommended)
43
+ * const provider = createAvatarProvider({ url: '/api/generate-avatar' });
44
+ *
45
+ * @example
46
+ * // OpenAI direct (dev/testing only — keeps key out of production builds)
47
+ * const provider = createAvatarProvider({
48
+ * url: 'https://api.openai.com/v1/images/generations',
49
+ * headers: { Authorization: `Bearer ${import.meta.env.VITE_OPENAI_KEY}` },
50
+ * body: ({ prompt }) => ({ model: 'dall-e-3', prompt: prompt ?? 'professional avatar', n: 1, size: '1024x1024' }),
51
+ * extractUrl: (d: any) => d.data[0].url,
52
+ * });
53
+ */
54
+ export declare function createAvatarProvider(options: CreateAvatarProviderOptions): AvatarProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mood-ui",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Vue 3 component library with full theming, dark mode, palettes, calendar, scheduler, table and AppShell.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -56,16 +56,18 @@
56
56
  "README.md",
57
57
  "LICENSE"
58
58
  ],
59
+ "engines": {
60
+ "node": ">=20.9.0"
61
+ },
59
62
  "scripts": {
60
63
  "dev": "vite",
61
- "build": "BUILD_TARGET=lib vue-tsc -p tsconfig.lib.json --noEmit && BUILD_TARGET=lib vite build",
62
- "build:showroom": "vue-tsc -b && vite build",
64
+ "build": "vue-tsc -p tsconfig.lib.json --noEmit && vite build",
63
65
  "preview": "vite preview",
64
66
  "test": "vitest run",
65
67
  "test:watch": "vitest",
66
68
  "test:ui": "vitest --ui",
67
69
  "test:coverage": "vitest run --coverage",
68
- "prepublishOnly": "npm run build"
70
+ "prepublishOnly": "pnpm run build"
69
71
  },
70
72
  "peerDependencies": {
71
73
  "@heroicons/vue": "^2.0.0",
@@ -86,12 +88,11 @@
86
88
  "@types/node": "^24.12.2",
87
89
  "@vitejs/plugin-vue": "^6.0.6",
88
90
  "@vitest/ui": "^4.1.5",
91
+ "@vue/shared": "^3.5.34",
89
92
  "@vue/test-utils": "^2.4.10",
90
93
  "@vue/tsconfig": "^0.9.1",
91
94
  "gsap": "^3.15.0",
92
95
  "jsdom": "^29.1.1",
93
- "playwright": "^1.59.1",
94
- "shiki": "^1.29.2",
95
96
  "tailwindcss": "^4.2.4",
96
97
  "typescript": "~6.0.2",
97
98
  "vite": "^8.0.10",
@@ -100,8 +101,5 @@
100
101
  "vue": "^3.5.32",
101
102
  "vue-i18n": "^11.4.2",
102
103
  "vue-tsc": "^3.2.7"
103
- },
104
- "dependencies": {
105
- "@vercel/analytics": "^2.0.1"
106
104
  }
107
105
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 alansinbailarin
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.OLD.md DELETED
@@ -1,5 +0,0 @@
1
- # Vue 3 + TypeScript + Vite
2
-
3
- This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
-
5
- Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
package/README.md DELETED
@@ -1,173 +0,0 @@
1
- <div align="center">
2
-
3
- # mood-ui
4
-
5
- **The Vue 3 component library with the best vibes.**
6
-
7
- [![npm version](https://img.shields.io/npm/v/mood-ui?color=%236366f1&label=npm)](https://www.npmjs.com/package/mood-ui)
8
- [![npm downloads](https://img.shields.io/npm/dw/mood-ui?color=%2322c55e&label=downloads)](https://www.npmjs.com/package/mood-ui)
9
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
10
- [![Vue 3](https://img.shields.io/badge/Vue-3.x-%2342b883)](https://vuejs.org)
11
- [![Tailwind v4](https://img.shields.io/badge/Tailwind-v4-%2306b6d4)](https://tailwindcss.com)
12
-
13
- **81+ accessible components** · reactive theming · dark mode · i18n (ES + EN) · built with Vue 3, TypeScript & Tailwind v4.
14
-
15
- [**→ Live docs & playground**](https://mood-ui.com) · [npm](https://www.npmjs.com/package/mood-ui) · [Changelog](https://github.com/alansinbailarin/mood-ui/releases)
16
-
17
- </div>
18
-
19
- ---
20
-
21
- ## Why mood-ui?
22
-
23
- - **Reactive theming** — change color, radius, size, halo and dark/light mode at runtime. Every component reacts instantly.
24
- - **Dark mode + surfaces** — 6 dark surface presets (navy, zinc, charcoal…) or tune all 14 semantic tokens yourself.
25
- - **i18n built-in** — Spanish & English included. Switch globally with `useLocale().set('es')`.
26
- - **Accessibility first** — WAI-ARIA roles, focus rings, keyboard nav and screen readers covered out of the box.
27
- - **Tree-shakeable · TypeScript** — import only what you use. Full types, IntelliSense autocomplete, ESM + CJS.
28
- - **Tailwind v4 native** — CSS vars, design tokens and `@theme inline`. Override from your own config, no hacks needed.
29
-
30
- ---
31
-
32
- ## Install
33
-
34
- ```bash
35
- npm install mood-ui
36
-
37
- # Required peer dependencies:
38
- npm install vue@^3.4
39
-
40
- # Optional peers (only needed for specific components):
41
- npm install @heroicons/vue@^2 # icons in Sidebar / Topbar / DropdownMenu
42
- npm install gsap@^3 # animations in Toast / Drawer
43
- ```
44
-
45
- ## Setup
46
-
47
- Import the stylesheet once at your app entry:
48
-
49
- ```ts
50
- // main.ts
51
- import { createApp } from "vue";
52
- import App from "./App.vue";
53
- import "mood-ui/style.css";
54
-
55
- createApp(App).mount("#app");
56
- ```
57
-
58
- Wrap your app in `<ModoProvider>` to expose all design tokens to every component:
59
-
60
- ```vue
61
- <script setup lang="ts">
62
- import { ref } from "vue";
63
- import { ModoProvider, Button, paletteFromHex } from "mood-ui";
64
-
65
- const primary = ref("#6366f1");
66
- </script>
67
-
68
- <template>
69
- <ModoProvider
70
- color="primary"
71
- radius="medium"
72
- size="medium"
73
- :palettes="{ primary: paletteFromHex(primary) }"
74
- >
75
- <Button color="primary">Hello mood-ui</Button>
76
- </ModoProvider>
77
- </template>
78
- ```
79
-
80
- ---
81
-
82
- ## Powerhouse components — free, no license required
83
-
84
- Most UI libraries charge for these. mood-ui ships them out of the box.
85
-
86
- ### `<Table>` — AG Grid-level features, zero cost
87
-
88
- ```vue
89
- <Table
90
- :data="rows"
91
- :columns="cols"
92
- virtual <!-- renders 100k rows at constant speed -->
93
- tree <!-- hierarchical rows with lazy loading -->
94
- server-side <!-- delegate sort/filter/page to your API -->
95
- resizable <!-- drag column edges to resize -->
96
- reorderable <!-- drag headers to reorder -->
97
- :multi-sort="true" <!-- shift+click for multi-column sort -->
98
- v-model:state="savedState" <!-- persist everything to localStorage/URL in one line -->
99
- />
100
- ```
101
-
102
- Full feature list: sorting · multi-sort · single/multi selection · per-column filters · row expansion · client & server-side pagination · column resize & reorder · virtualization (constant render time for 100k+ rows) · tree rows with lazy `loadChildren` · row grouping · state snapshot (`v-model:state`).
103
-
104
- ---
105
-
106
- ### `<Scheduler>` — FullCalendar-level, zero cost
107
-
108
- ```vue
109
- <Scheduler
110
- :resources="rooms"
111
- :events="bookings"
112
- :draggable-events="true" <!-- drag events between time slots -->
113
- :resizable-events="true" <!-- resize event duration -->
114
- :allow-cross-resource-drag="true"
115
- :business-hours="officeHours"
116
- :prevent-overlap="true"
117
- format="12h"
118
- />
119
- ```
120
-
121
- Full feature list: resource rows · drag & drop events · resize events · cross-resource drag · range selection · business hours · disabled time ranges · all-day row · current time indicator · keyboard navigation · 12h/24h · readonly mode.
122
-
123
- ---
124
-
125
- ### Calendar suite — 5 views included
126
-
127
- `Calendar` · `MonthView` · `WeekView` · `DayView` · `AgendaView` — all with locale support, min/max dates, disabled dates/weekdays, and full theming via `ModoProvider`.
128
-
129
- ---
130
-
131
- ## All components
132
-
133
- | Category | Components |
134
- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
135
- | **Forms** | `Button` `ButtonGroup` `FormField` `Input` `Textarea` `PasswordInput` `NumberInput` `SearchInput` `Select` `MultiSelect` `Combobox` `Checkbox` `Radio` `RadioGroup` `Switch` `Slider` `RangeSlider` `FileInput` `DateField` `DateRangeField` `DateTimeField` |
136
- | **Feedback** | `Badge` `Banner` `Chip` `Drawer` `Loader` `Modal` `Skeleton` `Tooltip` `Toast` `ToastContainer` `ConfirmDialog` `EmptyState` `ProgressBar` |
137
- | **Layout** | `AppShell` `Canvas` `Container` `Divider` `Stack` `HStack` `VStack` `PageHeader` `PopoverPanel` `Sidebar` `SidebarRow` `Topbar` |
138
- | **Navigation** | `Tabs` `Breadcrumbs` `DropdownMenu` `Pagination` |
139
- | **Data display** | `Card` `Typography` `Avatar` `AvatarGroup` `Table` `TableColumn` `TablePagination` `Calendar` `MonthView` `WeekView` `DayView` `AgendaView` `Scheduler` `DateRangePicker` `DateTimePicker` |
140
-
141
- ## Composables
142
-
143
- `useModoConfig` · `useResolvedColor` · `useResolvedRadius` · `useResolvedSize` · `useResolvedTheme` · `useResolvedHalo` · `useColorMode` · `useToast` · `useConfirm` · `useModoLocale` · `useLocaleString`
144
-
145
- ---
146
-
147
- ## Contributing
148
-
149
- mood-ui is **open source and open to contributions**. Whether it's fixing a bug, proposing a new component, improving docs or just giving feedback — every bit helps.
150
-
151
- ```bash
152
- # 1. Fork & clone
153
- git clone https://github.com/alansinbailarin/mood-ui.git
154
- cd mood-ui
155
-
156
- # 2. Install dependencies
157
- npm install
158
-
159
- # 3. Start the development showroom
160
- npm run dev
161
- ```
162
-
163
- - Check [open issues](https://github.com/alansinbailarin/mood-ui/issues) or open a new one to discuss your idea first.
164
- - Submit changes as a Pull Request against `main`.
165
- - Follow the existing patterns: Vue 3 + TypeScript + Tailwind v4, one component per file.
166
-
167
- If mood-ui saves you time, a ⭐ on [GitHub](https://github.com/alansinbailarin/mood-ui) goes a long way — it helps other developers discover the library.
168
-
169
- ---
170
-
171
- ## License
172
-
173
- MIT © [alansinbailarin](https://github.com/alansinbailarin)