@nuxt/ui 2.21.0 → 2.22.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 (85) hide show
  1. package/README.md +19 -14
  2. package/dist/module.d.mts +6 -1
  3. package/dist/module.json +3 -3
  4. package/dist/module.mjs +6 -12
  5. package/dist/runtime/components/data/Table.vue +19 -24
  6. package/dist/runtime/components/data/Table.vue.d.ts +44 -348
  7. package/dist/runtime/components/elements/Accordion.vue +4 -4
  8. package/dist/runtime/components/elements/Accordion.vue.d.ts +16 -16
  9. package/dist/runtime/components/elements/Alert.vue +7 -7
  10. package/dist/runtime/components/elements/Alert.vue.d.ts +41 -38
  11. package/dist/runtime/components/elements/Avatar.vue.d.ts +2 -2
  12. package/dist/runtime/components/elements/Badge.vue.d.ts +2 -2
  13. package/dist/runtime/components/elements/Button.vue.d.ts +6 -6
  14. package/dist/runtime/components/elements/Carousel.vue +3 -3
  15. package/dist/runtime/components/elements/Carousel.vue.d.ts +22 -22
  16. package/dist/runtime/components/elements/Chip.vue.d.ts +1 -1
  17. package/dist/runtime/components/elements/Dropdown.vue +1 -1
  18. package/dist/runtime/components/elements/Dropdown.vue.d.ts +19 -19
  19. package/dist/runtime/components/elements/Kbd.vue.d.ts +1 -1
  20. package/dist/runtime/components/elements/Link.vue +13 -11
  21. package/dist/runtime/components/elements/Link.vue.d.ts +2 -2
  22. package/dist/runtime/components/elements/Meter.vue +1 -1
  23. package/dist/runtime/components/elements/Meter.vue.d.ts +3 -3
  24. package/dist/runtime/components/elements/Progress.vue +1 -1
  25. package/dist/runtime/components/elements/Progress.vue.d.ts +5 -5
  26. package/dist/runtime/components/forms/Checkbox.vue.d.ts +3 -3
  27. package/dist/runtime/components/forms/Form.vue +8 -30
  28. package/dist/runtime/components/forms/Form.vue.d.ts +7 -8
  29. package/dist/runtime/components/forms/FormGroup.vue.d.ts +2 -2
  30. package/dist/runtime/components/forms/Input.vue +3 -3
  31. package/dist/runtime/components/forms/Input.vue.d.ts +3 -3
  32. package/dist/runtime/components/forms/InputMenu.vue +3 -3
  33. package/dist/runtime/components/forms/InputMenu.vue.d.ts +16 -16
  34. package/dist/runtime/components/forms/Radio.vue.d.ts +3 -3
  35. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +6 -6
  36. package/dist/runtime/components/forms/Range.vue.d.ts +3 -3
  37. package/dist/runtime/components/forms/Select.vue +2 -2
  38. package/dist/runtime/components/forms/Select.vue.d.ts +2 -2
  39. package/dist/runtime/components/forms/SelectMenu.vue +10 -5
  40. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +25 -16
  41. package/dist/runtime/components/forms/Textarea.vue.d.ts +3 -3
  42. package/dist/runtime/components/forms/Toggle.vue.d.ts +2 -2
  43. package/dist/runtime/components/layout/Card.vue.d.ts +1 -1
  44. package/dist/runtime/components/layout/Container.vue.d.ts +1 -1
  45. package/dist/runtime/components/layout/Divider.vue.d.ts +15 -15
  46. package/dist/runtime/components/layout/Skeleton.vue.d.ts +1 -1
  47. package/dist/runtime/components/navigation/Breadcrumb.vue +1 -1
  48. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +3 -3
  49. package/dist/runtime/components/navigation/CommandPalette.vue +1 -1
  50. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +33 -33
  51. package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +30 -30
  52. package/dist/runtime/components/navigation/HorizontalNavigation.vue +5 -5
  53. package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +36 -36
  54. package/dist/runtime/components/navigation/Pagination.vue +5 -5
  55. package/dist/runtime/components/navigation/Pagination.vue.d.ts +34 -34
  56. package/dist/runtime/components/navigation/Tabs.vue.d.ts +1 -1
  57. package/dist/runtime/components/navigation/VerticalNavigation.vue +5 -5
  58. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +58 -58
  59. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +1 -1
  60. package/dist/runtime/components/overlays/Modal.vue +6 -6
  61. package/dist/runtime/components/overlays/Modal.vue.d.ts +3 -3
  62. package/dist/runtime/components/overlays/Modals.client.vue +5 -7
  63. package/dist/runtime/components/overlays/Modals.client.vue.d.ts +2 -0
  64. package/dist/runtime/components/overlays/Notification.vue +6 -6
  65. package/dist/runtime/components/overlays/Notification.vue.d.ts +45 -42
  66. package/dist/runtime/components/overlays/Notifications.vue.d.ts +71 -67
  67. package/dist/runtime/components/overlays/Popover.vue.d.ts +2 -2
  68. package/dist/runtime/components/overlays/Slideover.vue.d.ts +3 -3
  69. package/dist/runtime/components/overlays/Slideovers.client.vue +5 -7
  70. package/dist/runtime/components/overlays/Slideovers.client.vue.d.ts +2 -0
  71. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +5 -5
  72. package/dist/runtime/composables/useFormGroup.d.ts +1 -1
  73. package/dist/runtime/composables/useShortcuts.d.ts +2 -2
  74. package/dist/runtime/composables/useToast.d.ts +4 -4
  75. package/dist/runtime/ui.config/elements/alert.d.ts +1 -0
  76. package/dist/runtime/ui.config/elements/alert.js +1 -0
  77. package/dist/runtime/ui.config/forms/selectMenu.d.ts +1 -1
  78. package/dist/runtime/ui.config/overlays/notification.d.ts +1 -0
  79. package/dist/runtime/ui.config/overlays/notification.js +1 -0
  80. package/dist/runtime/utils/link.js +4 -2
  81. package/dist/types.d.mts +3 -1
  82. package/package.json +64 -38
  83. package/dist/module.cjs +0 -5
  84. package/dist/module.d.ts +0 -36
  85. package/dist/types.d.ts +0 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![nuxt-ui.png](https://volta.s3.fr-par.scw.cloud/nuxt_ui_social_card_531d133fa2.png)](https://ui.nuxt.com)
1
+ [![nuxt-ui.png](https://volta.s3.fr-par.scw.cloud/nuxt_ui_social_card_531d133fa2.png)](https://ui2.nuxt.com)
2
2
 
3
3
  # Nuxt UI
4
4
 
@@ -22,27 +22,32 @@ Its goal is to provide everything related to UI when building a Nuxt app. This i
22
22
  - Fully typed
23
23
  - [Figma Kit](https://www.figma.com/community/file/1436401057300493073)
24
24
 
25
- Read more on [ui.nuxt.com](https://ui.nuxt.com)
25
+ Read more on [ui2.nuxt.com](https://ui2.nuxt.com)
26
26
 
27
27
  ## Installation
28
28
 
29
29
  ```bash
30
- npx nuxi@latest module add ui
30
+ # npm
31
+ npm install @nuxt/ui@2
32
+ # yarn
33
+ yarn add @nuxt/ui@2
34
+ # pnpm
35
+ pnpm add @nuxt/ui@2
36
+ # bun
37
+ bun add @nuxt/ui@2
31
38
  ```
32
39
 
33
- If you want latest updates, please use `@nuxt/ui-edge` in your `package.json`:
40
+ Next, register the `@nuxt/ui` module in your `nuxt.config.ts`:
34
41
 
35
- ```json
36
- {
37
- "devDependencies": {
38
- "@nuxt/ui": "npm:@nuxt/ui-edge@latest"
39
- }
40
- }
42
+ ```ts
43
+ export default defineNuxtConfig({
44
+ modules: ['@nuxt/ui']
45
+ })
41
46
  ```
42
47
 
43
48
  ## Documentation
44
49
 
45
- Visit https://ui.nuxt.com to explore the documentation.
50
+ Visit https://ui2.nuxt.com to explore the documentation.
46
51
 
47
52
  ## Credits
48
53
 
@@ -59,15 +64,15 @@ Visit https://ui.nuxt.com to explore the documentation.
59
64
  Thank you for considering contributing to Nuxt UI. Here are a few ways you can get involved:
60
65
 
61
66
  - Reporting Bugs: If you come across any bugs or issues, please check out the reporting bugs guide to learn how to submit a bug report.
62
- - Suggestions: Have any thoughts to enhance Nuxt UI? We'd love to hear them! Check out the [contribution guide](https://ui.nuxt.com/getting-started/contributing) to share your suggestions.
67
+ - Suggestions: Have any thoughts to enhance Nuxt UI? We'd love to hear them! Check out the [contribution guide](https://ui2.nuxt.com/getting-started/contributing) to share your suggestions.
63
68
 
64
69
  ## Local Development
65
70
 
66
- Follow the docs to [Set up your local development environment](https://ui.nuxt.com/getting-started/contributing#_2-local-development-setup) and contribute.
71
+ Follow the docs to [Set up your local development environment](https://ui2.nuxt.com/getting-started/contributing#_2-local-development-setup) and contribute.
67
72
 
68
73
  ## License
69
74
 
70
- Licensed under the [MIT license](https://github.com/nuxt/ui/blob/dev/LICENSE.md).
75
+ Licensed under the [MIT license](https://github.com/nuxt/ui/blob/v2/LICENSE.md).
71
76
 
72
77
  <!-- Badges -->
73
78
  [npm-version-src]: https://img.shields.io/npm/v/@nuxt/ui/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
package/dist/module.d.mts CHANGED
@@ -25,6 +25,10 @@ interface ModuleOptions {
25
25
  * @default false
26
26
  */
27
27
  global?: boolean;
28
+ /**
29
+ * @default true
30
+ */
31
+ colorMode?: boolean;
28
32
  safelistColors?: string[];
29
33
  /**
30
34
  * Disables the global css styles added by the module.
@@ -33,4 +37,5 @@ interface ModuleOptions {
33
37
  }
34
38
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
35
39
 
36
- export { type ModuleOptions, _default as default };
40
+ export { _default as default };
41
+ export type { ModuleOptions };
package/dist/module.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "2.21.0",
3
+ "version": "2.22.0",
4
4
  "configKey": "ui",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.10.0"
7
7
  },
8
8
  "builder": {
9
- "@nuxt/module-builder": "0.8.4",
10
- "unbuild": "2.0.0"
9
+ "@nuxt/module-builder": "1.0.1",
10
+ "unbuild": "3.5.0"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -1,20 +1,11 @@
1
1
  import { createRequire } from 'node:module';
2
- import { addTemplate, useNuxt, installModule, createResolver, defineNuxtModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
2
+ import { useNuxt, addTemplate, createResolver, installModule, defineNuxtModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
3
3
  import { join } from 'pathe';
4
4
  import { defu } from 'defu';
5
5
  import { setGlobalColors } from '../dist/runtime/utils/colors.js';
6
6
 
7
-
8
-
9
- // -- Unbuild CommonJS Shims --
10
- import __cjs_url__ from 'url';
11
- import __cjs_path__ from 'path';
12
- import __cjs_mod__ from 'module';
13
- const __filename = __cjs_url__.fileURLToPath(import.meta.url);
14
- const __dirname = __cjs_path__.dirname(__filename);
15
- const require = __cjs_mod__.createRequire(import.meta.url);
16
7
  const name = "@nuxt/ui";
17
- const version = "2.21.0";
8
+ const version = "2.22.0";
18
9
 
19
10
  function createTemplates(nuxt = useNuxt()) {
20
11
  const template = addTemplate({
@@ -129,6 +120,7 @@ const module = defineNuxtModule({
129
120
  },
130
121
  defaults: {
131
122
  prefix: "U",
123
+ colorMode: true,
132
124
  safelistColors: ["primary"],
133
125
  disableGlobalStyles: false
134
126
  },
@@ -143,7 +135,9 @@ const module = defineNuxtModule({
143
135
  }
144
136
  createTemplates(nuxt);
145
137
  await installModule("@nuxt/icon");
146
- await installModule("@nuxtjs/color-mode", { classSuffix: "" });
138
+ if (options.colorMode) {
139
+ await installModule("@nuxtjs/color-mode", { classSuffix: "" });
140
+ }
147
141
  await installTailwind(options, nuxt, resolve);
148
142
  addPlugin({
149
143
  src: resolve(runtimeDir, "plugins", "colors")
@@ -31,8 +31,8 @@
31
31
  <slot v-else :name="`${column.key}-header`" :column="column" :sort="sort" :on-sort="onSort">
32
32
  <UButton
33
33
  v-if="column.sortable"
34
- v-bind="{ ...(ui.default.sortButton || {}), ...sortButton }"
35
- :icon="(!sort.column || sort.column !== column.key) ? (sortButton.icon || ui.default.sortButton.icon) : sort.direction === 'asc' ? sortAscIcon : sortDescIcon"
34
+ v-bind="{ ...ui.default.sortButton || {}, ...sortButton }"
35
+ :icon="!sort.column || sort.column !== column.key ? sortButton.icon || ui.default.sortButton.icon : sort.direction === 'asc' ? sortAscIcon : sortDescIcon"
36
36
  :label="column[columnAttribute]"
37
37
  @click="onSort(column)"
38
38
  />
@@ -43,7 +43,7 @@
43
43
 
44
44
  <tr v-if="loading && progress">
45
45
  <td :colspan="0" :class="ui.progress.wrapper">
46
- <UProgress v-bind="{ ...(ui.default.progress || {}), ...progress }" size="2xs" />
46
+ <UProgress v-bind="{ ...ui.default.progress || {}, ...progress }" size="2xs" />
47
47
  </td>
48
48
  </tr>
49
49
  </thead>
@@ -87,24 +87,26 @@
87
87
  <UButton
88
88
  v-else
89
89
  :disabled="row.disabledExpand"
90
- v-bind="{ ...(ui.default.expandButton || {}), ...expandButton }"
90
+ v-bind="{ ...ui.default.expandButton || {}, ...expandButton }"
91
91
  :ui="{ icon: { base: [ui.expand.icon, isExpanded(row) && 'rotate-180'].join(' ') } }"
92
92
  @click.capture.stop="toggleOpened(row)"
93
93
  />
94
94
  </td>
95
95
  <td v-for="(column, subIndex) in columns" :key="subIndex" :class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size, column?.rowClass, row[column.key]?.class, column.key === 'select' && ui.checkbox.padding]">
96
- <slot v-if="modelValue && column.key === 'select' " name="select-data" :checked="isSelected(row)" :change="(ev: boolean) => onChangeCheckbox(ev, row)">
97
- <UCheckbox
98
- :model-value="isSelected(row)"
99
- v-bind="ui.default.checkbox"
100
- aria-label="Select row"
101
- @change="onChangeCheckbox($event, row)"
102
- />
103
- </slot>
104
-
96
+ <!-- This is a workaround: Since the @change event doesn't bubble up naturally, we need to wrap it in another element and use @click.capture.stop to simulate event bubbling behavior -->
97
+ <span v-if="modelValue && column.key === 'select'" @click.capture.stop="() => {
98
+ }">
99
+ <slot name="select-data" :checked="isSelected(row)" :change="(ev) => onChangeCheckbox(ev, row)">
100
+ <UCheckbox
101
+ :model-value="isSelected(row)"
102
+ v-bind="ui.default.checkbox"
103
+ aria-label="Select row"
104
+ @change="onChangeCheckbox($event, row)"
105
+ />
106
+ </slot>
107
+ </span>
105
108
  <slot
106
109
  v-else
107
- :key="retriggerSlot"
108
110
  :name="`${column.key}-data`"
109
111
  :column="column"
110
112
  :row="row"
@@ -132,11 +134,11 @@
132
134
  </template>
133
135
 
134
136
  <script>
135
- import { computed, defineComponent, ref, toRaw, toRef, watch } from "vue";
137
+ import { computed, defineComponent, toRaw, toRef } from "vue";
136
138
  import { upperFirst } from "scule";
137
139
  import { defu } from "defu";
138
140
  import { useVModel } from "@vueuse/core";
139
- import { isEqual } from "ohash";
141
+ import { isEqual } from "ohash/utils";
140
142
  import UIcon from "../elements/Icon.vue";
141
143
  import UButton from "../elements/Button.vue";
142
144
  import UProgress from "../elements/Progress.vue";
@@ -289,7 +291,6 @@ export default defineComponent({
289
291
  row: null
290
292
  })
291
293
  });
292
- const retriggerSlot = ref(null);
293
294
  const savedSort = { column: sort.value.column, direction: null };
294
295
  const rows = computed(() => {
295
296
  if (!sort.value?.column || props.sortMode === "manual") {
@@ -422,11 +423,6 @@ export default defineComponent({
422
423
  }
423
424
  return void 0;
424
425
  }
425
- watch(rows, () => {
426
- retriggerSlot.value = /* @__PURE__ */ new Date();
427
- }, {
428
- deep: true
429
- });
430
426
  return {
431
427
  // eslint-disable-next-line vue/no-dupe-keys
432
428
  ui,
@@ -453,8 +449,7 @@ export default defineComponent({
453
449
  getRowData,
454
450
  toggleOpened,
455
451
  getAriaSort,
456
- isExpanded,
457
- retriggerSlot
452
+ isExpanded
458
453
  };
459
454
  }
460
455
  });