@nuxt/ui 2.13.0 → 2.14.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 (114) hide show
  1. package/README.md +8 -8
  2. package/dist/module.d.mts +61 -2
  3. package/dist/module.d.ts +61 -2
  4. package/dist/module.json +2 -2
  5. package/dist/module.mjs +131 -144
  6. package/dist/runtime/components/data/Table.vue +16 -4
  7. package/dist/runtime/components/data/Table.vue.d.ts +21 -3
  8. package/dist/runtime/components/elements/Accordion.vue +11 -2
  9. package/dist/runtime/components/elements/Accordion.vue.d.ts +1 -1
  10. package/dist/runtime/components/elements/Alert.vue +2 -2
  11. package/dist/runtime/components/elements/Alert.vue.d.ts +4 -3
  12. package/dist/runtime/components/elements/Avatar.vue.d.ts +1 -1
  13. package/dist/runtime/components/elements/AvatarGroup.d.ts +1 -1
  14. package/dist/runtime/components/elements/Badge.vue.d.ts +2 -2
  15. package/dist/runtime/components/elements/Button.vue.d.ts +63 -37
  16. package/dist/runtime/components/elements/ButtonGroup.d.ts +1 -1
  17. package/dist/runtime/components/elements/Carousel.vue +19 -12
  18. package/dist/runtime/components/elements/Carousel.vue.d.ts +4 -4
  19. package/dist/runtime/components/elements/Chip.vue.d.ts +2 -2
  20. package/dist/runtime/components/elements/Dropdown.vue +3 -1
  21. package/dist/runtime/components/elements/Dropdown.vue.d.ts +3 -3
  22. package/dist/runtime/components/elements/Icon.vue.d.ts +1 -1
  23. package/dist/runtime/components/elements/Kbd.vue.d.ts +1 -1
  24. package/dist/runtime/components/elements/Link.vue +1 -1
  25. package/dist/runtime/components/elements/Link.vue.d.ts +62 -36
  26. package/dist/runtime/components/elements/Meter.vue +4 -0
  27. package/dist/runtime/components/elements/Meter.vue.d.ts +1 -1
  28. package/dist/runtime/components/elements/MeterGroup.d.ts +1 -1
  29. package/dist/runtime/components/elements/Progress.vue +4 -1
  30. package/dist/runtime/components/elements/Progress.vue.d.ts +5 -5
  31. package/dist/runtime/components/forms/Checkbox.vue +1 -6
  32. package/dist/runtime/components/forms/Checkbox.vue.d.ts +6 -15
  33. package/dist/runtime/components/forms/Form.vue +6 -3
  34. package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
  35. package/dist/runtime/components/forms/FormGroup.vue +20 -17
  36. package/dist/runtime/components/forms/FormGroup.vue.d.ts +2 -2
  37. package/dist/runtime/components/forms/Input.vue +1 -0
  38. package/dist/runtime/components/forms/Input.vue.d.ts +6 -6
  39. package/dist/runtime/components/forms/InputMenu.vue +4 -1
  40. package/dist/runtime/components/forms/InputMenu.vue.d.ts +7 -7
  41. package/dist/runtime/components/forms/Radio.vue +5 -11
  42. package/dist/runtime/components/forms/Radio.vue.d.ts +6 -6
  43. package/dist/runtime/components/forms/RadioGroup.vue +1 -0
  44. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +4 -4
  45. package/dist/runtime/components/forms/Range.vue.d.ts +4 -4
  46. package/dist/runtime/components/forms/Select.vue.d.ts +6 -6
  47. package/dist/runtime/components/forms/SelectMenu.vue +4 -1
  48. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +7 -7
  49. package/dist/runtime/components/forms/Textarea.vue +5 -1
  50. package/dist/runtime/components/forms/Textarea.vue.d.ts +15 -6
  51. package/dist/runtime/components/forms/Toggle.vue +3 -1
  52. package/dist/runtime/components/forms/Toggle.vue.d.ts +4 -4
  53. package/dist/runtime/components/layout/Card.vue +1 -1
  54. package/dist/runtime/components/layout/Card.vue.d.ts +1 -1
  55. package/dist/runtime/components/layout/Container.vue.d.ts +1 -1
  56. package/dist/runtime/components/layout/Divider.vue +8 -1
  57. package/dist/runtime/components/layout/Divider.vue.d.ts +15 -4
  58. package/dist/runtime/components/layout/Skeleton.vue.d.ts +1 -1
  59. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +1 -1
  60. package/dist/runtime/components/navigation/CommandPalette.vue +3 -1
  61. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +2 -2
  62. package/dist/runtime/components/navigation/CommandPaletteGroup.vue +3 -1
  63. package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +1 -1
  64. package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +1 -1
  65. package/dist/runtime/components/navigation/Pagination.vue.d.ts +1 -1
  66. package/dist/runtime/components/navigation/Tabs.vue +8 -8
  67. package/dist/runtime/components/navigation/Tabs.vue.d.ts +10 -1
  68. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +1 -1
  69. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +3 -3
  70. package/dist/runtime/components/overlays/Modal.vue +3 -1
  71. package/dist/runtime/components/overlays/Modal.vue.d.ts +5 -5
  72. package/dist/runtime/components/overlays/Modals.client.vue +12 -0
  73. package/dist/runtime/components/overlays/Notification.vue +2 -2
  74. package/dist/runtime/components/overlays/Notification.vue.d.ts +4 -3
  75. package/dist/runtime/components/overlays/Notifications.vue.d.ts +1 -1
  76. package/dist/runtime/components/overlays/Popover.vue +3 -1
  77. package/dist/runtime/components/overlays/Popover.vue.d.ts +3 -3
  78. package/dist/runtime/components/overlays/Slideover.vue +3 -1
  79. package/dist/runtime/components/overlays/Slideover.vue.d.ts +5 -5
  80. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +2 -2
  81. package/dist/runtime/composables/useFormGroup.d.ts +1 -1
  82. package/dist/runtime/composables/useFormGroup.mjs +9 -12
  83. package/dist/runtime/composables/useModal.d.ts +12 -0
  84. package/dist/runtime/composables/useModal.mjs +37 -0
  85. package/dist/runtime/plugins/modals.d.ts +2 -0
  86. package/dist/runtime/plugins/modals.mjs +10 -0
  87. package/dist/runtime/types/component.d.ts +14 -0
  88. package/dist/runtime/types/divider.d.ts +3 -0
  89. package/dist/runtime/types/form.d.ts +2 -1
  90. package/dist/runtime/types/index.d.ts +2 -0
  91. package/dist/runtime/types/modal.d.ts +18 -0
  92. package/dist/runtime/types/progress.d.ts +2 -0
  93. package/dist/runtime/types/range.d.ts +2 -0
  94. package/dist/runtime/types/toggle.d.ts +2 -0
  95. package/dist/runtime/ui.config/data/table.d.ts +7 -0
  96. package/dist/runtime/ui.config/data/table.mjs +10 -3
  97. package/dist/runtime/ui.config/elements/accordion.d.ts +1 -0
  98. package/dist/runtime/ui.config/elements/accordion.mjs +1 -0
  99. package/dist/runtime/ui.config/forms/formGroup.d.ts +1 -0
  100. package/dist/runtime/ui.config/forms/formGroup.mjs +1 -0
  101. package/dist/runtime/ui.config/forms/input.d.ts +11 -0
  102. package/dist/runtime/ui.config/forms/input.mjs +11 -0
  103. package/dist/runtime/ui.config/forms/select.d.ts +11 -0
  104. package/dist/runtime/ui.config/forms/textarea.d.ts +11 -0
  105. package/dist/runtime/ui.config/layout/divider.d.ts +19 -2
  106. package/dist/runtime/ui.config/layout/divider.mjs +20 -3
  107. package/dist/runtime/utils/colors.d.ts +3 -0
  108. package/dist/runtime/utils/colors.mjs +261 -0
  109. package/dist/runtime/utils/index.mjs +9 -0
  110. package/dist/runtime/utils/link.d.ts +24 -11
  111. package/dist/runtime/utils/link.mjs +26 -13
  112. package/package.json +21 -19
  113. package/dist/runtime/utils/uid.d.ts +0 -1
  114. package/dist/runtime/utils/uid.mjs +0 -5
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![nuxt-ui-social-card](https://repository-images.githubusercontent.com/428329515/43fec891-9030-4601-8233-5d45ba5c6013)](https://ui.nuxt.com)
1
+ [![nuxt-ui.png](https://repository-images.githubusercontent.com/428329515/43fec891-9030-4601-8233-5d45ba5c6013)](https://ui.nuxt.com)
2
2
 
3
3
  # Nuxt UI
4
4
 
@@ -7,9 +7,9 @@
7
7
  [![License][license-src]][license-href]
8
8
  [![Nuxt][nuxt-src]][nuxt-href]
9
9
 
10
- Nuxt UI provides everything related to UI when building Nuxt applications: components, icons, colors, dark mode and also keyboard shortcuts.
10
+ Nuxt UI is a module that provides a set of Vue components and composables built with [Tailwind CSS](https://tailwindcss.com/) and [Headless UI](https://headlessui.dev/) to help you build beautiful and accessible user interfaces.
11
11
 
12
- Is has been developed by [NuxtLabs](https://nuxtlabs.com/) for [Volta](https://volta.net), [Nuxt Studio](https://nuxt.studio/) and the Nuxt community.
12
+ Its goal is to provide everything related to UI when building a Nuxt app. This includes components, icons, colors, dark mode but also keyboard shortcuts.
13
13
 
14
14
  ## Features
15
15
 
@@ -27,14 +27,14 @@ Read more on [ui.nuxt.com](https://ui.nuxt.com)
27
27
  ## Installation
28
28
 
29
29
  ```bash
30
- # Using npm
30
+ # npm
31
31
  npm install @nuxt/ui
32
-
33
- # Using yarn
32
+ # yarn
34
33
  yarn add @nuxt/ui
35
-
36
- # Using pnpm
34
+ # pnpm
37
35
  pnpm add @nuxt/ui
36
+ # bun
37
+ bun add @nuxt/ui
38
38
  ```
39
39
 
40
40
  Then, register the module in your `nuxt.config.ts`:
package/dist/module.d.mts CHANGED
@@ -39,6 +39,9 @@ declare const _default$H: {
39
39
  label: string;
40
40
  icon: string;
41
41
  };
42
+ progress: {
43
+ wrapper: string;
44
+ };
42
45
  default: {
43
46
  sortAscIcon: string;
44
47
  sortDescIcon: string;
@@ -50,6 +53,10 @@ declare const _default$H: {
50
53
  variant: "ghost";
51
54
  class: string;
52
55
  };
56
+ progress: {
57
+ color: "primary";
58
+ animation: "carousel";
59
+ };
53
60
  loadingState: {
54
61
  icon: string;
55
62
  label: string;
@@ -439,6 +446,7 @@ declare const _default$A: {
439
446
 
440
447
  declare const _default$z: {
441
448
  wrapper: string;
449
+ container: string;
442
450
  item: {
443
451
  base: string;
444
452
  size: string;
@@ -753,6 +761,17 @@ declare const _default$s: {
753
761
  form: string;
754
762
  rounded: string;
755
763
  placeholder: string;
764
+ file: {
765
+ base: string;
766
+ padding: {
767
+ '2xs': string;
768
+ xs: string;
769
+ sm: string;
770
+ md: string;
771
+ lg: string;
772
+ xl: string;
773
+ };
774
+ };
756
775
  size: {
757
776
  '2xs': string;
758
777
  xs: string;
@@ -920,6 +939,7 @@ declare const _default$r: {
920
939
 
921
940
  declare const _default$q: {
922
941
  wrapper: string;
942
+ inner: string;
923
943
  label: {
924
944
  wrapper: string;
925
945
  base: string;
@@ -954,6 +974,17 @@ declare const _default$p: {
954
974
  base: string;
955
975
  rounded: string;
956
976
  placeholder: string;
977
+ file: {
978
+ base: string;
979
+ padding: {
980
+ '2xs': string;
981
+ xs: string;
982
+ sm: string;
983
+ md: string;
984
+ lg: string;
985
+ xl: string;
986
+ };
987
+ };
957
988
  size: {
958
989
  '2xs': string;
959
990
  xs: string;
@@ -1062,6 +1093,17 @@ declare const _default$o: {
1062
1093
  wrapper: string;
1063
1094
  base: string;
1064
1095
  rounded: string;
1096
+ file: {
1097
+ base: string;
1098
+ padding: {
1099
+ '2xs': string;
1100
+ xs: string;
1101
+ sm: string;
1102
+ md: string;
1103
+ lg: string;
1104
+ xl: string;
1105
+ };
1106
+ };
1065
1107
  size: {
1066
1108
  '2xs': string;
1067
1109
  xs: string;
@@ -1449,8 +1491,22 @@ declare const _default$e: {
1449
1491
  horizontal: string;
1450
1492
  vertical: string;
1451
1493
  size: {
1452
- horizontal: string;
1453
- vertical: string;
1494
+ horizontal: {
1495
+ '2xs': string;
1496
+ xs: string;
1497
+ sm: string;
1498
+ md: string;
1499
+ lg: string;
1500
+ xl: string;
1501
+ };
1502
+ vertical: {
1503
+ '2xs': string;
1504
+ xs: string;
1505
+ sm: string;
1506
+ md: string;
1507
+ lg: string;
1508
+ xl: string;
1509
+ };
1454
1510
  };
1455
1511
  type: {
1456
1512
  solid: string;
@@ -1466,6 +1522,9 @@ declare const _default$e: {
1466
1522
  size: "2xs";
1467
1523
  };
1468
1524
  label: string;
1525
+ default: {
1526
+ size: "2xs";
1527
+ };
1469
1528
  };
1470
1529
 
1471
1530
  declare const _default$d: {
package/dist/module.d.ts CHANGED
@@ -39,6 +39,9 @@ declare const _default$H: {
39
39
  label: string;
40
40
  icon: string;
41
41
  };
42
+ progress: {
43
+ wrapper: string;
44
+ };
42
45
  default: {
43
46
  sortAscIcon: string;
44
47
  sortDescIcon: string;
@@ -50,6 +53,10 @@ declare const _default$H: {
50
53
  variant: "ghost";
51
54
  class: string;
52
55
  };
56
+ progress: {
57
+ color: "primary";
58
+ animation: "carousel";
59
+ };
53
60
  loadingState: {
54
61
  icon: string;
55
62
  label: string;
@@ -439,6 +446,7 @@ declare const _default$A: {
439
446
 
440
447
  declare const _default$z: {
441
448
  wrapper: string;
449
+ container: string;
442
450
  item: {
443
451
  base: string;
444
452
  size: string;
@@ -753,6 +761,17 @@ declare const _default$s: {
753
761
  form: string;
754
762
  rounded: string;
755
763
  placeholder: string;
764
+ file: {
765
+ base: string;
766
+ padding: {
767
+ '2xs': string;
768
+ xs: string;
769
+ sm: string;
770
+ md: string;
771
+ lg: string;
772
+ xl: string;
773
+ };
774
+ };
756
775
  size: {
757
776
  '2xs': string;
758
777
  xs: string;
@@ -920,6 +939,7 @@ declare const _default$r: {
920
939
 
921
940
  declare const _default$q: {
922
941
  wrapper: string;
942
+ inner: string;
923
943
  label: {
924
944
  wrapper: string;
925
945
  base: string;
@@ -954,6 +974,17 @@ declare const _default$p: {
954
974
  base: string;
955
975
  rounded: string;
956
976
  placeholder: string;
977
+ file: {
978
+ base: string;
979
+ padding: {
980
+ '2xs': string;
981
+ xs: string;
982
+ sm: string;
983
+ md: string;
984
+ lg: string;
985
+ xl: string;
986
+ };
987
+ };
957
988
  size: {
958
989
  '2xs': string;
959
990
  xs: string;
@@ -1062,6 +1093,17 @@ declare const _default$o: {
1062
1093
  wrapper: string;
1063
1094
  base: string;
1064
1095
  rounded: string;
1096
+ file: {
1097
+ base: string;
1098
+ padding: {
1099
+ '2xs': string;
1100
+ xs: string;
1101
+ sm: string;
1102
+ md: string;
1103
+ lg: string;
1104
+ xl: string;
1105
+ };
1106
+ };
1065
1107
  size: {
1066
1108
  '2xs': string;
1067
1109
  xs: string;
@@ -1449,8 +1491,22 @@ declare const _default$e: {
1449
1491
  horizontal: string;
1450
1492
  vertical: string;
1451
1493
  size: {
1452
- horizontal: string;
1453
- vertical: string;
1494
+ horizontal: {
1495
+ '2xs': string;
1496
+ xs: string;
1497
+ sm: string;
1498
+ md: string;
1499
+ lg: string;
1500
+ xl: string;
1501
+ };
1502
+ vertical: {
1503
+ '2xs': string;
1504
+ xs: string;
1505
+ sm: string;
1506
+ md: string;
1507
+ lg: string;
1508
+ xl: string;
1509
+ };
1454
1510
  };
1455
1511
  type: {
1456
1512
  solid: string;
@@ -1466,6 +1522,9 @@ declare const _default$e: {
1466
1522
  size: "2xs";
1467
1523
  };
1468
1524
  label: string;
1525
+ default: {
1526
+ size: "2xs";
1527
+ };
1469
1528
  };
1470
1529
 
1471
1530
  declare const _default$d: {
package/dist/module.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "configKey": "ui",
5
5
  "compatibility": {
6
- "nuxt": "^3.0.0-rc.8"
6
+ "nuxt": "^3.10.0"
7
7
  }
8
8
  }
package/dist/module.mjs CHANGED
@@ -1,8 +1,7 @@
1
- import { addTemplate, useNuxt, defineNuxtModule, createResolver, installModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
2
- import defaultColors from 'tailwindcss/colors.js';
3
- import { defaultExtractor as defaultExtractor$1 } from 'tailwindcss/lib/lib/defaultExtractor.js';
4
- import { iconsPlugin, getIconCollections } from '@egoist/tailwindcss-icons';
5
- import { kebabCase, upperFirst, camelCase } from 'scule';
1
+ import { addTemplate, useNuxt, installModule, defineNuxtModule, createResolver, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
2
+ import { createRequire } from 'node:module';
3
+ import { join } from 'pathe';
4
+ import { kebabCase } from 'scule';
6
5
 
7
6
 
8
7
 
@@ -14,7 +13,24 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
14
13
  const __dirname = __cjs_path__.dirname(__filename);
15
14
  const require = __cjs_mod__.createRequire(import.meta.url);
16
15
  const name = "@nuxt/ui";
17
- const version = "2.13.0";
16
+ const version = "2.14.0";
17
+
18
+ function createTemplates(nuxt = useNuxt()) {
19
+ const template = addTemplate({
20
+ filename: "ui.colors.mjs",
21
+ getContents: () => `export default ${JSON.stringify(nuxt.options.appConfig.ui.colors)};`,
22
+ write: true
23
+ });
24
+ const typesTemplate = addTemplate({
25
+ filename: "ui.colors.d.ts",
26
+ getContents: () => `declare module '#ui-colors' { const defaultExport: ${JSON.stringify(nuxt.options.appConfig.ui.colors)}; export default defaultExport; }`,
27
+ write: true
28
+ });
29
+ nuxt.options.alias["#ui-colors"] = template.dst;
30
+ nuxt.hook("prepare:types", (opts) => {
31
+ opts.references.push({ path: typesTemplate.dst });
32
+ });
33
+ }
18
34
 
19
35
  function omit(object, keysToOmit) {
20
36
  const result = { ...object };
@@ -228,13 +244,6 @@ const safelistByComponent = {
228
244
  pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
229
245
  }]
230
246
  };
231
- const safelistComponentAliasesMap = {
232
- "USelect": "UInput",
233
- "USelectMenu": "UInput",
234
- "UTextarea": "UInput",
235
- "URadioGroup": "URadio",
236
- "UMeterGroup": "UMeter"
237
- };
238
247
  const colorsAsRegex = (colors) => colors.join("|");
239
248
  const excludeColors = (colors) => {
240
249
  return Object.entries(omit(colors, colorsToExclude)).filter(([, value]) => typeof value === "object").map(([key]) => kebabCase(key));
@@ -254,66 +263,123 @@ const generateSafelist = (colors, globalColors) => {
254
263
  "dark:text-gray-400"
255
264
  ];
256
265
  };
257
- const customSafelistExtractor = (prefix, content, colors, safelistColors) => {
258
- const classes = [];
259
- const regex = /<([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z][A-Za-z0-9]*)*)\s+(?![^>]*:color\b)[^>]*\bcolor=["']([^"']+)["'][^>]*>/gs;
260
- const matches = content.matchAll(regex);
261
- const components = Object.keys(safelistByComponent).map((component) => `${prefix}${component.charAt(0).toUpperCase() + component.slice(1)}`);
262
- for (const match of matches) {
263
- const [, component, color] = match;
264
- const camelComponent = upperFirst(camelCase(component));
265
- if (!colors.includes(color) || safelistColors.includes(color)) {
266
- continue;
267
- }
268
- let name = safelistComponentAliasesMap[camelComponent] ? safelistComponentAliasesMap[camelComponent] : camelComponent;
269
- if (!components.includes(name)) {
270
- continue;
271
- }
272
- name = name.replace(prefix, "").toLowerCase();
273
- const matchClasses = safelistByComponent[name](color).flatMap((group) => {
274
- return ["", ...group.variants || []].flatMap((variant) => {
275
- const matches2 = group.pattern.source.match(/\(([^)]+)\)/g);
276
- return matches2.map((match2) => {
277
- const colorOptions = match2.substring(1, match2.length - 1).split("|");
278
- return colorOptions.map((color2) => `${variant ? variant + ":" : ""}` + group.pattern.source.replace(match2, color2));
279
- }).flat();
280
- });
281
- });
282
- classes.push(...matchClasses);
283
- }
284
- return classes;
285
- };
286
-
287
- function createTemplates(nuxt = useNuxt()) {
288
- const template = addTemplate({
289
- filename: "ui.colors.mjs",
290
- getContents: () => `export default ${JSON.stringify(nuxt.options.appConfig.ui.colors)};`,
291
- write: true
292
- });
293
- const typesTemplate = addTemplate({
294
- filename: "ui.colors.d.ts",
295
- getContents: () => `declare module '#ui-colors' { const defaultExport: ${JSON.stringify(nuxt.options.appConfig.ui.colors)}; export default defaultExport; }`,
296
- write: true
297
- });
298
- nuxt.options.alias["#ui-colors"] = template.dst;
299
- nuxt.hook("prepare:types", (opts) => {
300
- opts.references.push({ path: typesTemplate.dst });
301
- });
302
- }
303
266
 
304
- const defaultExtractor = defaultExtractor$1({ tailwindConfig: { separator: ":" } });
267
+ const _require = createRequire(import.meta.url);
268
+ const defaultColors = _require("tailwindcss/colors.js");
305
269
  delete defaultColors.lightBlue;
306
270
  delete defaultColors.warmGray;
307
271
  delete defaultColors.trueGray;
308
272
  delete defaultColors.coolGray;
309
273
  delete defaultColors.blueGray;
274
+ async function installTailwind(moduleOptions, nuxt = useNuxt(), { resolve, runtimeDir }) {
275
+ nuxt.hook("tailwindcss:config", function(tailwindConfig) {
276
+ tailwindConfig.theme = tailwindConfig.theme || {};
277
+ tailwindConfig.theme.extend = tailwindConfig.theme.extend || {};
278
+ tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {};
279
+ const globalColors = {
280
+ ...tailwindConfig.theme.colors || defaultColors,
281
+ ...tailwindConfig.theme.extend?.colors
282
+ };
283
+ globalColors.primary = tailwindConfig.theme.extend.colors.primary = {
284
+ 50: "rgb(var(--color-primary-50) / <alpha-value>)",
285
+ 100: "rgb(var(--color-primary-100) / <alpha-value>)",
286
+ 200: "rgb(var(--color-primary-200) / <alpha-value>)",
287
+ 300: "rgb(var(--color-primary-300) / <alpha-value>)",
288
+ 400: "rgb(var(--color-primary-400) / <alpha-value>)",
289
+ 500: "rgb(var(--color-primary-500) / <alpha-value>)",
290
+ 600: "rgb(var(--color-primary-600) / <alpha-value>)",
291
+ 700: "rgb(var(--color-primary-700) / <alpha-value>)",
292
+ 800: "rgb(var(--color-primary-800) / <alpha-value>)",
293
+ 900: "rgb(var(--color-primary-900) / <alpha-value>)",
294
+ 950: "rgb(var(--color-primary-950) / <alpha-value>)",
295
+ DEFAULT: "rgb(var(--color-primary-DEFAULT) / <alpha-value>)"
296
+ };
297
+ if (globalColors.gray) {
298
+ globalColors.cool = tailwindConfig.theme.extend.colors.cool = defaultColors.gray;
299
+ }
300
+ globalColors.gray = tailwindConfig.theme.extend.colors.gray = {
301
+ 50: "rgb(var(--color-gray-50) / <alpha-value>)",
302
+ 100: "rgb(var(--color-gray-100) / <alpha-value>)",
303
+ 200: "rgb(var(--color-gray-200) / <alpha-value>)",
304
+ 300: "rgb(var(--color-gray-300) / <alpha-value>)",
305
+ 400: "rgb(var(--color-gray-400) / <alpha-value>)",
306
+ 500: "rgb(var(--color-gray-500) / <alpha-value>)",
307
+ 600: "rgb(var(--color-gray-600) / <alpha-value>)",
308
+ 700: "rgb(var(--color-gray-700) / <alpha-value>)",
309
+ 800: "rgb(var(--color-gray-800) / <alpha-value>)",
310
+ 900: "rgb(var(--color-gray-900) / <alpha-value>)",
311
+ 950: "rgb(var(--color-gray-950) / <alpha-value>)"
312
+ };
313
+ const colors = excludeColors(globalColors);
314
+ nuxt.options.appConfig.ui = {
315
+ primary: "green",
316
+ gray: "cool",
317
+ colors,
318
+ strategy: "merge"
319
+ };
320
+ tailwindConfig.safelist = tailwindConfig.safelist || [];
321
+ tailwindConfig.safelist.push(
322
+ ...generateSafelist(moduleOptions.safelistColors || [], colors)
323
+ );
324
+ });
325
+ const configTemplate = addTemplate({
326
+ filename: "nuxtui-tailwind.config.cjs",
327
+ write: true,
328
+ getContents: () => `
329
+ const { defaultExtractor: createDefaultExtractor } = require('tailwindcss/lib/lib/defaultExtractor.js')
330
+ const { customSafelistExtractor } = require(${JSON.stringify(resolve(runtimeDir, "utils", "colors"))})
331
+ const { iconsPlugin, getIconCollections } = require('@egoist/tailwindcss-icons')
332
+
333
+ const defaultExtractor = createDefaultExtractor({ tailwindConfig: { separator: ':' } })
334
+
335
+ module.exports = {
336
+ darkMode: 'class',
337
+ plugins: [
338
+ require('@tailwindcss/forms')({ strategy: 'class' }),
339
+ require('@tailwindcss/aspect-ratio'),
340
+ require('@tailwindcss/typography'),
341
+ require('@tailwindcss/container-queries'),
342
+ require('@headlessui/tailwindcss'),
343
+ iconsPlugin(${Array.isArray(moduleOptions.icons) || moduleOptions.icons === "all" ? `{ collections: getIconCollections(${JSON.stringify(moduleOptions.icons)}) }` : typeof moduleOptions.icons === "object" ? JSON.stringify(moduleOptions.icons) : "{}"})
344
+ ],
345
+ content: {
346
+ files: [
347
+ ${JSON.stringify(resolve(runtimeDir, "components/**/*.{vue,mjs,ts}"))},
348
+ ${JSON.stringify(resolve(runtimeDir, "ui.config/**/*.{mjs,js,ts}"))}
349
+ ],
350
+ transform: {
351
+ vue: (content) => {
352
+ return content.replaceAll(/(?:\\r\\n|\\r|\\n)/g, ' ')
353
+ }
354
+ },
355
+ extract: {
356
+ vue: (content) => {
357
+ return [
358
+ ...defaultExtractor(content),
359
+ ...customSafelistExtractor(${JSON.stringify(moduleOptions.prefix)}, content, ${JSON.stringify(nuxt.options.appConfig.ui.colors)}, ${JSON.stringify(moduleOptions.safelistColors)})
360
+ ]
361
+ }
362
+ }
363
+ }
364
+ }
365
+ `
366
+ });
367
+ await installModule("@nuxtjs/tailwindcss", {
368
+ exposeConfig: true,
369
+ configPath: [
370
+ configTemplate.dst,
371
+ join(nuxt.options.rootDir, "tailwind.config")
372
+ ]
373
+ });
374
+ }
375
+
310
376
  const module = defineNuxtModule({
311
377
  meta: {
312
378
  name,
313
379
  version,
314
380
  configKey: "ui",
315
381
  compatibility: {
316
- nuxt: "^3.0.0-rc.8"
382
+ nuxt: "^3.10.0"
317
383
  }
318
384
  },
319
385
  defaults: {
@@ -331,95 +397,16 @@ const module = defineNuxtModule({
331
397
  if (!options.disableGlobalStyles) {
332
398
  nuxt.options.css.push(resolve(runtimeDir, "ui.css"));
333
399
  }
334
- nuxt.hook("tailwindcss:config", function(tailwindConfig) {
335
- tailwindConfig.theme = tailwindConfig.theme || {};
336
- tailwindConfig.theme.extend = tailwindConfig.theme.extend || {};
337
- tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {};
338
- const globalColors = {
339
- ...tailwindConfig.theme.colors || defaultColors,
340
- ...tailwindConfig.theme.extend?.colors
341
- };
342
- globalColors.primary = tailwindConfig.theme.extend.colors.primary = {
343
- 50: "rgb(var(--color-primary-50) / <alpha-value>)",
344
- 100: "rgb(var(--color-primary-100) / <alpha-value>)",
345
- 200: "rgb(var(--color-primary-200) / <alpha-value>)",
346
- 300: "rgb(var(--color-primary-300) / <alpha-value>)",
347
- 400: "rgb(var(--color-primary-400) / <alpha-value>)",
348
- 500: "rgb(var(--color-primary-500) / <alpha-value>)",
349
- 600: "rgb(var(--color-primary-600) / <alpha-value>)",
350
- 700: "rgb(var(--color-primary-700) / <alpha-value>)",
351
- 800: "rgb(var(--color-primary-800) / <alpha-value>)",
352
- 900: "rgb(var(--color-primary-900) / <alpha-value>)",
353
- 950: "rgb(var(--color-primary-950) / <alpha-value>)",
354
- DEFAULT: "rgb(var(--color-primary-DEFAULT) / <alpha-value>)"
355
- };
356
- if (globalColors.gray) {
357
- globalColors.cool = tailwindConfig.theme.extend.colors.cool = defaultColors.gray;
358
- }
359
- globalColors.gray = tailwindConfig.theme.extend.colors.gray = {
360
- 50: "rgb(var(--color-gray-50) / <alpha-value>)",
361
- 100: "rgb(var(--color-gray-100) / <alpha-value>)",
362
- 200: "rgb(var(--color-gray-200) / <alpha-value>)",
363
- 300: "rgb(var(--color-gray-300) / <alpha-value>)",
364
- 400: "rgb(var(--color-gray-400) / <alpha-value>)",
365
- 500: "rgb(var(--color-gray-500) / <alpha-value>)",
366
- 600: "rgb(var(--color-gray-600) / <alpha-value>)",
367
- 700: "rgb(var(--color-gray-700) / <alpha-value>)",
368
- 800: "rgb(var(--color-gray-800) / <alpha-value>)",
369
- 900: "rgb(var(--color-gray-900) / <alpha-value>)",
370
- 950: "rgb(var(--color-gray-950) / <alpha-value>)"
371
- };
372
- const colors = excludeColors(globalColors);
373
- nuxt.options.appConfig.ui = {
374
- primary: "green",
375
- gray: "cool",
376
- colors,
377
- strategy: "merge"
378
- };
379
- tailwindConfig.safelist = tailwindConfig.safelist || [];
380
- tailwindConfig.safelist.push(...generateSafelist(options.safelistColors || [], colors));
381
- tailwindConfig.plugins = tailwindConfig.plugins || [];
382
- tailwindConfig.plugins.push(iconsPlugin(Array.isArray(options.icons) ? { collections: getIconCollections(options.icons) } : typeof options.icons === "object" ? options.icons : {}));
383
- });
384
400
  createTemplates(nuxt);
385
401
  await installModule("nuxt-icon");
386
402
  await installModule("@nuxtjs/color-mode", { classSuffix: "" });
387
- await installModule("@nuxtjs/tailwindcss", {
388
- exposeConfig: true,
389
- config: {
390
- darkMode: "class",
391
- plugins: [
392
- require("@tailwindcss/forms")({ strategy: "class" }),
393
- require("@tailwindcss/aspect-ratio"),
394
- require("@tailwindcss/typography"),
395
- require("@tailwindcss/container-queries"),
396
- require("@headlessui/tailwindcss")
397
- ],
398
- content: {
399
- files: [
400
- resolve(runtimeDir, "components/**/*.{vue,mjs,ts}"),
401
- resolve(runtimeDir, "ui.config/**/*.{mjs,js,ts}")
402
- ],
403
- transform: {
404
- vue: (content) => {
405
- return content.replaceAll(/(?:\r\n|\r|\n)/g, " ");
406
- }
407
- },
408
- extract: {
409
- vue: (content) => {
410
- return [
411
- ...defaultExtractor(content),
412
- // @ts-ignore
413
- ...customSafelistExtractor(options.prefix, content, nuxt.options.appConfig.ui.colors, options.safelistColors)
414
- ];
415
- }
416
- }
417
- }
418
- }
419
- });
403
+ await installTailwind(options, nuxt, { resolve, runtimeDir });
420
404
  addPlugin({
421
405
  src: resolve(runtimeDir, "plugins", "colors")
422
406
  });
407
+ addPlugin({
408
+ src: resolve(runtimeDir, "plugins", "modals")
409
+ });
423
410
  addComponentsDir({
424
411
  path: resolve(runtimeDir, "components", "elements"),
425
412
  prefix: options.prefix,
@@ -4,7 +4,7 @@
4
4
  <thead :class="ui.thead">
5
5
  <tr :class="ui.tr.base">
6
6
  <th v-if="modelValue" scope="col" :class="ui.checkbox.padding">
7
- <UCheckbox :checked="indeterminate || selected.length === rows.length" :indeterminate="indeterminate" aria-label="Select all" @change="onChange" />
7
+ <UCheckbox :model-value="indeterminate || selected.length === rows.length" :indeterminate="indeterminate" aria-label="Select all" @change="onChange" />
8
8
  </th>
9
9
 
10
10
  <th v-for="(column, index) in columns" :key="index" scope="col" :class="[ui.th.base, ui.th.padding, ui.th.color, ui.th.font, ui.th.size, column.class]">
@@ -20,9 +20,15 @@
20
20
  </slot>
21
21
  </th>
22
22
  </tr>
23
+
24
+ <tr v-if="loading && progress">
25
+ <td :colspan="0" :class="ui.progress.wrapper">
26
+ <UProgress v-bind="{ ...(ui.default.progress || {}), ...progress }" size="2xs" />
27
+ </td>
28
+ </tr>
23
29
  </thead>
24
30
  <tbody :class="ui.tbody">
25
- <tr v-if="loadingState && loading">
31
+ <tr v-if="loadingState && loading && !rows.length">
26
32
  <td :colspan="columns.length + (modelValue ? 1 : 0)">
27
33
  <slot name="loading-state">
28
34
  <div :class="ui.loadingState.wrapper">
@@ -71,8 +77,9 @@ import { computed, defineComponent, toRaw, toRef } from "vue";
71
77
  import { upperFirst } from "scule";
72
78
  import { defu } from "defu";
73
79
  import { useVModel } from "@vueuse/core";
74
- import UButton from "../elements/Button.vue";
75
80
  import UIcon from "../elements/Icon.vue";
81
+ import UButton from "../elements/Button.vue";
82
+ import UProgress from "../elements/Progress.vue";
76
83
  import UCheckbox from "../forms/Checkbox.vue";
77
84
  import { useUI } from "../../composables/useUI";
78
85
  import { mergeConfig, get } from "../../utils";
@@ -94,8 +101,9 @@ function defaultSort(a, b, direction) {
94
101
  }
95
102
  export default defineComponent({
96
103
  components: {
97
- UButton,
98
104
  UIcon,
105
+ UButton,
106
+ UProgress,
99
107
  UCheckbox
100
108
  },
101
109
  inheritAttrs: false,
@@ -152,6 +160,10 @@ export default defineComponent({
152
160
  type: Object,
153
161
  default: () => config.default.emptyState
154
162
  },
163
+ progress: {
164
+ type: Object,
165
+ default: () => config.default.progress
166
+ },
155
167
  class: {
156
168
  type: [String, Object, Array],
157
169
  default: () => ""