maz-ui 5.1.1 → 5.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/rules.md CHANGED
@@ -7,42 +7,57 @@ description: "How to use maz-ui and its ecosystem in this project: look-up workf
7
7
 
8
8
  > These rules and the docs in `node_modules/maz-ui/docs` match the installed version of maz-ui (`node_modules/maz-ui/package.json`).
9
9
 
10
- This project is built with **maz-ui** and its ecosystem (`@maz-ui/themes`, `@maz-ui/icons`, `@maz-ui/utils`, `@maz-ui/translations`, `@maz-ui/nuxt`). Reuse what it provides instead of re-implementing it: most UI elements, helpers, icons and styles you need already exist.
10
+ This project is built with **maz-ui** and its ecosystem. Reuse what it provides instead of re-implementing it: most UI elements, helpers, icons and styles you need already exist.
11
11
 
12
12
  ### Look it up before you write it
13
13
 
14
- Before creating a component, composable, helper, icon or style, check what maz-ui offers:
14
+ - **MCP server `maz-ui`** (when available): `search_docs` (describe the need: "confirm before delete"), `get_component_api`, `find_icons`, `get_theme_tokens`, `get_doc`, `review_code`.
15
+ - **Version-matched docs** in `node_modules/maz-ui/docs/` (start with `README.md`; in a monorepo, the `maz-ui` of the app).
15
16
 
16
- - **MCP server `maz-ui`** (when available): `search_docs` (describe the need: "confirm before delete", "phone input"), `get_component_api` (exact props, events, slots), `find_icons`, `get_theme_tokens` (Tailwind classes of the project and of maz-ui), `get_doc`, `review_code`.
17
- - **Version-matched docs** in `node_modules/maz-ui/docs/` (start with `README.md`; in a monorepo, resolve `maz-ui` from the app package). Read the relevant page before using an API.
17
+ Never guess an API: only use documented props, events, slots and imports.
18
18
 
19
- Never guess an API: only use props, events, slots and imports that are documented.
19
+ ### Which package for what
20
+
21
+ `maz-ui` (components, composables, directives, plugins), `@maz-ui/themes` (brand colors, fonts, dark mode), `@maz-ui/icons` (icons, logos, flags), `@maz-ui/utils` (helpers), `@maz-ui/translations` (texts of the components), `@maz-ui/nuxt` (Nuxt module).
20
22
 
21
23
  ### Components
22
24
 
23
- - Use `Maz*` components instead of native elements or hand-made widgets: `MazBtn` (not `<button>`), `MazInput`, `MazSelect`, `MazCheckbox`, `MazSwitch`, `MazTextarea`, `MazDialog`, `MazDialogConfirm`, `MazDrawer`, `MazBottomSheet`, `MazPopover`, `MazDropdown`, `MazTabs`, `MazTable`, `MazCard`, `MazAvatar`, `MazBadge`, `MazAlert`, `MazSkeleton`, `MazSpinner`, `MazDatePicker`, `MazInputPhoneNumber`, `MazDropzone`, `MazStepper`, `MazSidebar`, `MazPagination`...
25
+ - Use `Maz*` components instead of native elements or hand-made widgets: `MazBtn` (not `<button>`), `MazLink`, `MazInput`, `MazSelect`, `MazCheckbox`, `MazDialog`, `MazDrawer`, `MazPopover`, `MazDropdown`, `MazTabs`, `MazTable`, `MazCard`, `MazAvatar`, `MazBadge`, `MazAlert`, `MazDatePicker`, `MazInputPhoneNumber`, `MazDropzone`, `MazPagination`...
24
26
  - Prop values are typed: colors are `primary | secondary | accent | info | success | warning | destructive | contrast | transparent` (plus `surface` on some components), sizes `mini | xs | sm | md | lg | xl`.
25
- - Feedback and overlays: `useToast()` for notifications, `useDialog()` or `MazDialogConfirm` for confirmations, `useWait()` for loading states.
27
+ - A button with only an icon needs an `aria-label`.
28
+
29
+ ### Feedback, overlays and forms
30
+
31
+ - `useToast()` for notifications, `useDialog()` or `MazDialogConfirm` for confirmations, `useWait()` for loading states, `MazSkeleton` / `MazSpinner` while data loads.
32
+ - These composables need their plugin. Vue: `app.use(ToastPlugin)` from `maz-ui/plugins/toast` (`DialogPlugin`, `WaitPlugin`, `AosPlugin` likewise). Nuxt: `mazUi: { plugins: { toast: true } }`, off by default like the directives (`mazUi.directives.vTooltip`, or import the directive).
26
33
  - Forms: `useFormValidator` / `useFormField` with your Standard Schema library (Zod, Valibot, ArkType).
27
34
 
28
35
  ### Icons
29
36
 
30
- Use `@maz-ui/icons` (860+ icons: `MazTrash`, `MazXMark`, `MazMagnifyingGlass`, `MazFlagFR`, `MazLogoVue`...). Never inline SVG or add another icon library. Pass icon components to icon props: `<MazBtn :start-icon="MazTrash">`.
37
+ Use `@maz-ui/icons`, never inline SVG nor another icon library. Pick the format by usage:
38
+
39
+ - **Icon props** (`<MazBtn :start-icon>`, `<MazIcon :icon>`...): the raw SVG string, the lightest, `@maz-ui/icons/raw/MazTrash`.
40
+ - **Directly in a template**: the component, `@maz-ui/icons/static/MazTrash`, then `<MazTrash class="size-5 text-muted" />` (size and color from the text: `1em`, `currentColor`).
41
+ - **Not visible at first render** (`v-if`, menus, dialogs, tabs): the lazy component, `@maz-ui/icons/lazy/MazTrash`. Never for icons visible on load: each one is an extra request.
42
+ - `<img>` or CSS only for multicolor icons (flags, logos): `@maz-ui/icons/svg/<name>.svg`, the text color does not apply there.
31
43
 
32
- ### Helpers and composables
44
+ ### Helpers
33
45
 
34
- Use `@maz-ui/utils` and maz-ui composables instead of lodash, VueUse or hand-written code: `debounce`, `throttle`, `sleep`, `isEqual`, `capitalize`, `formatCurrency`, `formatDate`, `formatNumber`, `formatPhoneNumber`, `getCookie`/`setCookie`, `useBreakpoints`, `useWindowSize`, `useTimer`, `useIdleTimeout`, `useSwipe`, `vClickOutside`, `vTooltip`, `vLazyImg`...
46
+ Use `@maz-ui/utils/helpers/<name>` and the maz-ui composables instead of lodash, VueUse or hand-written code: `debounce`, `throttle`, `sleep`, `isEqual`, `formatCurrency`, `formatDate`, `formatNumber`, `formatPhoneNumber`, `capitalize`, `normalizeString`, `getCookie` / `setCookie`, `useBreakpoints`, `useWindowSize`, `useTimer`, `useIdleTimeout`, `useSwipe`, `vClickOutside`, `vTooltip`, `vLazyImg`...
47
+
48
+ ### Texts and languages
49
+
50
+ The texts built in the components come from `@maz-ui/translations`: change the language with `useTranslations().setLocale('fr')` and customize the texts in its options, not in every component.
35
51
 
36
52
  ### Styling with Tailwind
37
53
 
38
54
  The maz-ui theme is exposed to Tailwind (`@import 'maz-ui/tailwindcss/theme.css'`) and the project usually extends it. Only use theme tokens:
39
55
 
40
- - **Project tokens first**: the Tailwind entry of the project (the CSS file that imports `maz-ui/tailwindcss/theme.css`) adds its own `@theme` tokens (fonts, animations, colors...), `@custom-variant` and `@utility`, and the `definePreset` file sets the brand values of the maz-ui tokens. `get_theme_tokens` lists both; without the MCP server, read these files. When a value is missing, add a token to the project `@theme` and use its class instead of an arbitrary value.
41
-
42
- - Colors: `primary`, `secondary`, `accent`, `info`, `success`, `warning`, `destructive`, `contrast` (each with `-foreground` and `-50` to `-950`), `surface`, `foreground`, `muted`, `divider`, `overlay`, plus `bg-container` and `bg-input`. Example: `bg-surface text-foreground border-divider`, `bg-primary text-primary-foreground`, `text-muted`.
43
- - Never use the default Tailwind palette (`bg-blue-500`, `text-gray-600`, `bg-white`, `text-black`) nor hard-coded colors (`#fff`, `rgb()`, `bg-[#...]`). Theme colors already adapt to dark mode: do not add `dark:` color overrides.
56
+ - **Project tokens first**: the Tailwind entry of the project adds its own `@theme` tokens, variants and utilities, and the `definePreset` file sets the brand values. `get_theme_tokens` lists both (or read these files). When a value is missing, add a token to the project `@theme` instead of an arbitrary value.
57
+ - Colors: `primary`, `secondary`, `accent`, `info`, `success`, `warning`, `destructive`, `contrast` (each with `-foreground` and `-50` to `-950`), `surface`, `foreground`, `muted`, `divider`, `overlay`, `bg-container`, `bg-input`. Example: `bg-surface text-foreground border-divider`.
58
+ - Never the default Tailwind palette (`bg-blue-500`, `text-gray-600`, `bg-white`, `text-black`) nor hard-coded colors (`#fff`, `rgb()`, `bg-[#...]`). Theme colors already adapt to dark mode: no `dark:` color overrides.
44
59
  - Radius `rounded-*`, shadows `shadow-sm` to `shadow-xl` and `shadow-elevation`, spacing scale (`p-4`, `gap-2`), breakpoints `mob-*`, `tab-*`, `lap-*` (plus `sm` to `2xl`), utilities `flex-center`, `padded-container`.
45
- - **No `maz:` prefix** in this project: it is internal to the maz-ui library and its documentation.
60
+ - **No `maz:` prefix** in this project: it is internal to the maz-ui library.
46
61
  - In custom CSS, use the variables: `var(--maz-primary)`, `var(--maz-rounded-md)`, `calc(var(--maz-space) * 4)`.
47
62
 
48
63
  ### Theme
@@ -51,8 +66,8 @@ Brand colors, fonts, radius and spacing come from a `@maz-ui/themes` preset (`de
51
66
 
52
67
  ### Imports
53
68
 
54
- - Deep imports: `maz-ui/components/MazBtn`, `maz-ui/composables/useToast`, `maz-ui/directives/vTooltip`, `@maz-ui/utils/helpers/debounce`, `@maz-ui/icons/static/MazTrash`. The `maz-ui` root entry only exports types. Never import from `maz-ui/src` or `maz-ui/dist`.
55
- - With `@maz-ui/nuxt`, components and composables are auto-imported: do not import them.
69
+ - Deep imports: `maz-ui/components/MazBtn`, `maz-ui/composables/useToast`, `maz-ui/directives/vTooltip`, `maz-ui/plugins/toast`, `@maz-ui/utils/helpers/debounce`, `@maz-ui/icons/raw/MazTrash`. The `maz-ui` root entry only exports types. Never import from `maz-ui/src` or `maz-ui/dist`.
70
+ - With `@maz-ui/nuxt`, components and composables are auto-imported: do not import them. Icons are not: import them. The theme and the translations are set in the `mazUi` options of `nuxt.config`, not with the `MazUi` Vue plugin.
56
71
 
57
72
  ### Before you finish
58
73
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "maz-ui",
3
3
  "type": "module",
4
- "version": "5.1.1",
4
+ "version": "5.2.0-beta.0",
5
5
  "description": "A standalone components library for Vue.Js 3 & Nuxt.Js 3",
6
6
  "author": "Louis Mazel <me@loicmazuel.com>",
7
7
  "license": "MIT",
@@ -201,10 +201,10 @@
201
201
  },
202
202
  "dependencies": {
203
203
  "@floating-ui/vue": "^2.0.1",
204
- "@maz-ui/icons": "5.0.0",
205
- "@maz-ui/themes": "5.0.0",
206
- "@maz-ui/translations": "5.0.0",
207
- "@maz-ui/utils": "5.0.0",
204
+ "@maz-ui/icons": "^5.2.0-beta.0",
205
+ "@maz-ui/themes": "^5.2.0-beta.0",
206
+ "@maz-ui/translations": "^5.2.0-beta.0",
207
+ "@maz-ui/utils": "^5.2.0-beta.0",
208
208
  "@tanstack/vue-virtual": "^3.13.47",
209
209
  "chart.js": "^4.5.1",
210
210
  "dayjs": "^1.11.23",
@@ -213,27 +213,45 @@
213
213
  "marked": "^18.1.1"
214
214
  },
215
215
  "devDependencies": {
216
- "@maz-ui/eslint-config": "5.0.0",
217
- "@maz-ui/node": "5.1.0",
218
- "@maz-ui/stylelint-config": "5.0.0",
219
- "@maz-ui/vite-config": "0.0.0",
216
+ "@codecov/vite-plugin": "^2.0.1",
217
+ "@maz-ui/eslint-config": "^5.0.0",
218
+ "@maz-ui/node": "^5.2.0-beta.0",
219
+ "@maz-ui/stylelint-config": "^5.2.0-beta.0",
220
+ "@maz-ui/vite-config": "^0.0.0",
220
221
  "@tailwindcss/cli": "^4.3.3",
221
222
  "@tailwindcss/postcss": "^4.3.3",
222
223
  "@tailwindcss/vite": "^4.3.3",
224
+ "@types/node": "^22.20.5",
225
+ "@vitejs/plugin-vue": "^6.0.10",
226
+ "@vitest/coverage-v8": "^5.0.5",
223
227
  "@vue/test-utils": "^2.5.1",
224
228
  "autoprefixer": "^10.6.1",
229
+ "cross-env": "^10.1.0",
230
+ "eslint": "^10.13.0",
231
+ "glob": "^13.0.6",
225
232
  "jsdom": "^30.1.3",
226
233
  "lightningcss": "^1.33.0",
227
234
  "nuxt": "^4.6.2",
235
+ "postcss": "^8.5.31",
228
236
  "postcss-nested": "^9.0.0",
229
237
  "sass": "^1.105.2",
230
238
  "shiki": "^4.5.0",
239
+ "stylelint": "^17.16.0",
231
240
  "tailwindcss": "^4.3.3",
241
+ "tsx": "^4.23.15",
242
+ "typescript": "^6.0.3",
232
243
  "unplugin-auto-import": "^21.1.0",
233
244
  "unplugin-vue-components": "^32.1.0",
234
245
  "valibot": "^1.5.0",
246
+ "vite": "^8.3.4",
247
+ "vite-plugin-dts": "^5.1.2",
248
+ "vite-plugin-lib-inject-css": "^2.2.2",
249
+ "vite-svg-loader": "^5.1.3",
250
+ "vitest": "5.0.5",
235
251
  "vitest-axe": "^0.1.0",
252
+ "vue": "^3.5.44",
236
253
  "vue-router": "^5.4.0",
254
+ "vue-tsc": "3.3.13",
237
255
  "zod": "^4.6.7"
238
256
  },
239
257
  "lint-staged": {