@nuxt/ui 2.17.0 → 2.18.1

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 (234) hide show
  1. package/dist/module.d.mts +3 -1988
  2. package/dist/module.d.ts +3 -1988
  3. package/dist/module.json +6 -2
  4. package/dist/module.mjs +6 -71
  5. package/dist/runtime/components/data/Table.vue +53 -15
  6. package/dist/runtime/components/data/Table.vue.d.ts +249 -50
  7. package/dist/runtime/components/elements/Accordion.vue.d.ts +140 -14
  8. package/dist/runtime/components/elements/Alert.vue +1 -1
  9. package/dist/runtime/components/elements/Alert.vue.d.ts +106 -23
  10. package/dist/runtime/components/elements/Avatar.vue.d.ts +146 -25
  11. package/dist/runtime/components/elements/AvatarGroup.d.ts +20 -11
  12. package/dist/runtime/components/elements/{AvatarGroup.mjs → AvatarGroup.js} +2 -2
  13. package/dist/runtime/components/elements/Badge.vue.d.ts +53 -16
  14. package/dist/runtime/components/elements/Button.vue.d.ts +259 -96
  15. package/dist/runtime/components/elements/ButtonGroup.d.ts +113 -9
  16. package/dist/runtime/components/elements/{ButtonGroup.mjs → ButtonGroup.js} +3 -3
  17. package/dist/runtime/components/elements/Carousel.vue.d.ts +75 -20
  18. package/dist/runtime/components/elements/Chip.vue.d.ts +95 -23
  19. package/dist/runtime/components/elements/Dropdown.vue +3 -6
  20. package/dist/runtime/components/elements/Dropdown.vue.d.ts +135 -16
  21. package/dist/runtime/components/elements/Icon.vue +16 -15
  22. package/dist/runtime/components/elements/Icon.vue.d.ts +33 -10
  23. package/dist/runtime/components/elements/Kbd.vue.d.ts +45 -10
  24. package/dist/runtime/components/elements/Link.vue.d.ts +72 -72
  25. package/dist/runtime/components/elements/Meter.vue +1 -1
  26. package/dist/runtime/components/elements/Meter.vue.d.ts +179 -23
  27. package/dist/runtime/components/elements/MeterGroup.d.ts +72 -15
  28. package/dist/runtime/components/elements/{MeterGroup.mjs → MeterGroup.js} +3 -3
  29. package/dist/runtime/components/elements/Progress.vue +7 -2
  30. package/dist/runtime/components/elements/Progress.vue.d.ts +188 -32
  31. package/dist/runtime/components/forms/Checkbox.vue +5 -3
  32. package/dist/runtime/components/forms/Checkbox.vue.d.ts +73 -32
  33. package/dist/runtime/components/forms/Form.vue +1 -2
  34. package/dist/runtime/components/forms/Form.vue.d.ts +11 -10
  35. package/dist/runtime/components/forms/FormGroup.vue +1 -1
  36. package/dist/runtime/components/forms/FormGroup.vue.d.ts +78 -25
  37. package/dist/runtime/components/forms/Input.vue +1 -1
  38. package/dist/runtime/components/forms/Input.vue.d.ts +272 -55
  39. package/dist/runtime/components/forms/InputMenu.vue +11 -8
  40. package/dist/runtime/components/forms/InputMenu.vue.d.ts +431 -81
  41. package/dist/runtime/components/forms/Radio.vue +5 -3
  42. package/dist/runtime/components/forms/Radio.vue.d.ts +71 -32
  43. package/dist/runtime/components/forms/RadioGroup.vue +11 -3
  44. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +83 -25
  45. package/dist/runtime/components/forms/Range.vue.d.ts +153 -24
  46. package/dist/runtime/components/forms/Select.vue +1 -1
  47. package/dist/runtime/components/forms/Select.vue.d.ts +272 -49
  48. package/dist/runtime/components/forms/SelectMenu.vue +49 -23
  49. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +449 -84
  50. package/dist/runtime/components/forms/Textarea.vue.d.ts +258 -43
  51. package/dist/runtime/components/forms/Toggle.vue.d.ts +152 -25
  52. package/dist/runtime/components/layout/Card.vue.d.ts +54 -4
  53. package/dist/runtime/components/layout/Container.vue.d.ts +18 -4
  54. package/dist/runtime/components/layout/Divider.vue.d.ts +121 -16
  55. package/dist/runtime/components/layout/Skeleton.vue +5 -1
  56. package/dist/runtime/components/layout/Skeleton.vue.d.ts +27 -4
  57. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +52 -9
  58. package/dist/runtime/components/navigation/CommandPalette.vue +7 -4
  59. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +193 -35
  60. package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +5 -7
  61. package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +64 -9
  62. package/dist/runtime/components/navigation/Pagination.vue +2 -4
  63. package/dist/runtime/components/navigation/Pagination.vue.d.ts +83 -11
  64. package/dist/runtime/components/navigation/Tabs.vue +10 -0
  65. package/dist/runtime/components/navigation/Tabs.vue.d.ts +85 -14
  66. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +78 -9
  67. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +71 -8
  68. package/dist/runtime/components/overlays/Modal.vue.d.ts +85 -11
  69. package/dist/runtime/components/overlays/Notification.vue +1 -1
  70. package/dist/runtime/components/overlays/Notification.vue.d.ts +127 -26
  71. package/dist/runtime/components/overlays/Notifications.vue.d.ts +31 -16
  72. package/dist/runtime/components/overlays/Popover.vue +3 -6
  73. package/dist/runtime/components/overlays/Popover.vue.d.ts +110 -15
  74. package/dist/runtime/components/overlays/Slideover.vue.d.ts +86 -14
  75. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +90 -15
  76. package/dist/runtime/composables/{defineShortcuts.mjs → defineShortcuts.js} +1 -1
  77. package/dist/runtime/composables/{useButtonGroup.mjs → useButtonGroup.js} +8 -9
  78. package/dist/runtime/composables/useCopyToClipboard.d.ts +1 -1
  79. package/dist/runtime/composables/{useCopyToClipboard.mjs → useCopyToClipboard.js} +1 -1
  80. package/dist/runtime/composables/useFormGroup.d.ts +5 -5
  81. package/dist/runtime/composables/useFormGroup.js +49 -0
  82. package/dist/runtime/composables/useModal.d.ts +3 -3
  83. package/dist/runtime/composables/{useModal.mjs → useModal.js} +2 -4
  84. package/dist/runtime/composables/usePopper.d.ts +90 -54
  85. package/dist/runtime/composables/useShortcuts.d.ts +4 -4
  86. package/dist/runtime/composables/useSlideover.d.ts +3 -3
  87. package/dist/runtime/composables/{useSlideover.mjs → useSlideover.js} +2 -4
  88. package/dist/runtime/composables/useTimer.d.ts +1 -1
  89. package/dist/runtime/composables/useToast.d.ts +11 -11
  90. package/dist/runtime/composables/useUI.d.ts +1 -1
  91. package/dist/runtime/composables/{useUI.mjs → useUI.js} +1 -1
  92. package/dist/runtime/plugins/colors.d.ts +1 -1
  93. package/dist/runtime/plugins/{colors.mjs → colors.js} +1 -1
  94. package/dist/runtime/plugins/modals.d.ts +1 -1
  95. package/dist/runtime/plugins/{modals.mjs → modals.js} +1 -1
  96. package/dist/runtime/plugins/slideovers.d.ts +1 -1
  97. package/dist/runtime/plugins/{slideovers.mjs → slideovers.js} +1 -1
  98. package/dist/runtime/types/accordion.d.ts +6 -7
  99. package/dist/runtime/types/accordion.js +0 -0
  100. package/dist/runtime/types/alert.d.ts +8 -10
  101. package/dist/runtime/types/alert.js +0 -0
  102. package/dist/runtime/types/avatar.d.ts +13 -15
  103. package/dist/runtime/types/avatar.js +0 -0
  104. package/dist/runtime/types/badge.d.ts +11 -13
  105. package/dist/runtime/types/badge.js +0 -0
  106. package/dist/runtime/types/breadcrumb.d.ts +6 -8
  107. package/dist/runtime/types/breadcrumb.js +0 -0
  108. package/dist/runtime/types/button.d.ts +27 -29
  109. package/dist/runtime/types/button.js +0 -0
  110. package/dist/runtime/types/chip.d.ts +11 -13
  111. package/dist/runtime/types/chip.js +0 -0
  112. package/dist/runtime/types/clipboard.d.ts +7 -1
  113. package/dist/runtime/types/clipboard.js +0 -0
  114. package/dist/runtime/types/command-palette.d.ts +23 -24
  115. package/dist/runtime/types/command-palette.js +0 -0
  116. package/dist/runtime/types/component.d.ts +17 -14
  117. package/dist/runtime/types/component.js +0 -0
  118. package/dist/runtime/types/divider.d.ts +2 -3
  119. package/dist/runtime/types/divider.js +0 -0
  120. package/dist/runtime/types/dropdown.d.ts +12 -13
  121. package/dist/runtime/types/dropdown.js +0 -0
  122. package/dist/runtime/types/form-group.d.ts +4 -5
  123. package/dist/runtime/types/form-group.js +0 -0
  124. package/dist/runtime/types/form.d.ts +29 -28
  125. package/dist/runtime/types/form.js +0 -0
  126. package/dist/runtime/types/horizontal-navigation.d.ts +10 -11
  127. package/dist/runtime/types/horizontal-navigation.js +0 -0
  128. package/dist/runtime/types/index.d.ts +31 -31
  129. package/dist/runtime/types/index.js +31 -0
  130. package/dist/runtime/types/input.d.ts +7 -8
  131. package/dist/runtime/types/input.js +0 -0
  132. package/dist/runtime/types/kbd.d.ts +4 -5
  133. package/dist/runtime/types/kbd.js +0 -0
  134. package/dist/runtime/types/link.d.ts +9 -10
  135. package/dist/runtime/types/link.js +0 -0
  136. package/dist/runtime/types/meter.d.ts +4 -5
  137. package/dist/runtime/types/meter.js +0 -0
  138. package/dist/runtime/types/modal.d.ts +13 -15
  139. package/dist/runtime/types/modal.js +0 -0
  140. package/dist/runtime/types/notification.d.ts +17 -20
  141. package/dist/runtime/types/notification.js +0 -0
  142. package/dist/runtime/types/popper.d.ts +13 -15
  143. package/dist/runtime/types/popper.js +0 -0
  144. package/dist/runtime/types/progress.d.ts +5 -6
  145. package/dist/runtime/types/progress.js +0 -0
  146. package/dist/runtime/types/range.d.ts +6 -7
  147. package/dist/runtime/types/range.js +0 -0
  148. package/dist/runtime/types/select.d.ts +7 -8
  149. package/dist/runtime/types/select.js +0 -0
  150. package/dist/runtime/types/slideover.d.ts +10 -12
  151. package/dist/runtime/types/slideover.js +0 -0
  152. package/dist/runtime/types/tabs.d.ts +6 -5
  153. package/dist/runtime/types/tabs.js +0 -0
  154. package/dist/runtime/types/textarea.d.ts +7 -8
  155. package/dist/runtime/types/textarea.js +0 -0
  156. package/dist/runtime/types/toggle.d.ts +6 -7
  157. package/dist/runtime/types/toggle.js +0 -0
  158. package/dist/runtime/types/tooltip.d.ts +5 -5
  159. package/dist/runtime/types/tooltip.js +0 -0
  160. package/dist/runtime/types/utils.d.ts +15 -27
  161. package/dist/runtime/types/utils.js +0 -0
  162. package/dist/runtime/types/vertical-navigation.d.ts +10 -11
  163. package/dist/runtime/types/vertical-navigation.js +0 -0
  164. package/dist/runtime/ui.config/data/table.d.ts +10 -0
  165. package/dist/runtime/ui.config/data/{table.mjs → table.js} +10 -0
  166. package/dist/runtime/ui.config/elements/accordion.d.ts +1 -0
  167. package/dist/runtime/ui.config/elements/{accordion.mjs → accordion.js} +3 -2
  168. package/dist/runtime/ui.config/elements/alert.d.ts +2 -2
  169. package/dist/runtime/ui.config/elements/avatar.d.ts +2 -2
  170. package/dist/runtime/ui.config/elements/{carousel.mjs → carousel.js} +1 -1
  171. package/dist/runtime/ui.config/elements/{dropdown.mjs → dropdown.js} +1 -1
  172. package/dist/runtime/ui.config/forms/{inputMenu.mjs → inputMenu.js} +1 -1
  173. package/dist/runtime/ui.config/forms/{select.mjs → select.js} +1 -1
  174. package/dist/runtime/ui.config/forms/{selectMenu.mjs → selectMenu.js} +2 -2
  175. package/dist/runtime/ui.config/forms/{textarea.mjs → textarea.js} +1 -1
  176. package/dist/runtime/ui.config/forms/toggle.d.ts +2 -2
  177. package/dist/runtime/ui.config/index.d.ts +43 -43
  178. package/dist/runtime/ui.config/index.js +43 -0
  179. package/dist/runtime/ui.config/navigation/{breadcrumb.mjs → breadcrumb.js} +2 -2
  180. package/dist/runtime/ui.config/navigation/commandPalette.d.ts +1 -1
  181. package/dist/runtime/ui.config/navigation/tabs.d.ts +1 -0
  182. package/dist/runtime/ui.config/navigation/{tabs.mjs → tabs.js} +2 -1
  183. package/dist/runtime/ui.config/overlays/{contextMenu.mjs → contextMenu.js} +1 -1
  184. package/dist/runtime/ui.config/overlays/{modal.mjs → modal.js} +2 -2
  185. package/dist/runtime/ui.config/overlays/notification.d.ts +1 -1
  186. package/dist/runtime/ui.config/overlays/{popover.mjs → popover.js} +1 -1
  187. package/dist/runtime/ui.config/overlays/{slideover.mjs → slideover.js} +2 -2
  188. package/dist/runtime/ui.config/overlays/{tooltip.mjs → tooltip.js} +1 -1
  189. package/dist/runtime/utils/colors.d.ts +2 -2
  190. package/dist/runtime/utils/{colors.mjs → colors.js} +1 -1
  191. package/dist/runtime/utils/index.d.ts +4 -4
  192. package/dist/runtime/utils/{index.mjs → index.js} +2 -2
  193. package/dist/runtime/utils/link.d.ts +26 -24
  194. package/dist/runtime/utils/{link.mjs → link.js} +1 -1
  195. package/dist/types.d.mts +1 -16
  196. package/dist/types.d.ts +1 -16
  197. package/package.json +19 -21
  198. package/dist/runtime/composables/useFormGroup.mjs +0 -45
  199. package/dist/runtime/ui.config/index.mjs +0 -43
  200. /package/dist/runtime/composables/{useCarouselScroll.mjs → useCarouselScroll.js} +0 -0
  201. /package/dist/runtime/composables/{usePopper.mjs → usePopper.js} +0 -0
  202. /package/dist/runtime/composables/{useShortcuts.mjs → useShortcuts.js} +0 -0
  203. /package/dist/runtime/composables/{useTimer.mjs → useTimer.js} +0 -0
  204. /package/dist/runtime/composables/{useToast.mjs → useToast.js} +0 -0
  205. /package/dist/runtime/ui.config/elements/{alert.mjs → alert.js} +0 -0
  206. /package/dist/runtime/ui.config/elements/{avatar.mjs → avatar.js} +0 -0
  207. /package/dist/runtime/ui.config/elements/{avatarGroup.mjs → avatarGroup.js} +0 -0
  208. /package/dist/runtime/ui.config/elements/{badge.mjs → badge.js} +0 -0
  209. /package/dist/runtime/ui.config/elements/{button.mjs → button.js} +0 -0
  210. /package/dist/runtime/ui.config/elements/{buttonGroup.mjs → buttonGroup.js} +0 -0
  211. /package/dist/runtime/ui.config/elements/{chip.mjs → chip.js} +0 -0
  212. /package/dist/runtime/ui.config/elements/{kbd.mjs → kbd.js} +0 -0
  213. /package/dist/runtime/ui.config/elements/{meter.mjs → meter.js} +0 -0
  214. /package/dist/runtime/ui.config/elements/{meterGroup.mjs → meterGroup.js} +0 -0
  215. /package/dist/runtime/ui.config/elements/{progress.mjs → progress.js} +0 -0
  216. /package/dist/runtime/ui.config/forms/{checkbox.mjs → checkbox.js} +0 -0
  217. /package/dist/runtime/ui.config/forms/{formGroup.mjs → formGroup.js} +0 -0
  218. /package/dist/runtime/ui.config/forms/{input.mjs → input.js} +0 -0
  219. /package/dist/runtime/ui.config/forms/{radio.mjs → radio.js} +0 -0
  220. /package/dist/runtime/ui.config/forms/{radioGroup.mjs → radioGroup.js} +0 -0
  221. /package/dist/runtime/ui.config/forms/{range.mjs → range.js} +0 -0
  222. /package/dist/runtime/ui.config/forms/{toggle.mjs → toggle.js} +0 -0
  223. /package/dist/runtime/ui.config/layout/{card.mjs → card.js} +0 -0
  224. /package/dist/runtime/ui.config/layout/{container.mjs → container.js} +0 -0
  225. /package/dist/runtime/ui.config/layout/{divider.mjs → divider.js} +0 -0
  226. /package/dist/runtime/ui.config/layout/{skeleton.mjs → skeleton.js} +0 -0
  227. /package/dist/runtime/ui.config/navigation/{commandPalette.mjs → commandPalette.js} +0 -0
  228. /package/dist/runtime/ui.config/navigation/{horizontalNavigation.mjs → horizontalNavigation.js} +0 -0
  229. /package/dist/runtime/ui.config/navigation/{pagination.mjs → pagination.js} +0 -0
  230. /package/dist/runtime/ui.config/navigation/{verticalNavigation.mjs → verticalNavigation.js} +0 -0
  231. /package/dist/runtime/ui.config/overlays/{notification.mjs → notification.js} +0 -0
  232. /package/dist/runtime/ui.config/overlays/{notifications.mjs → notifications.js} +0 -0
  233. /package/dist/runtime/ui.config/{popper.mjs → popper.js} +0 -0
  234. /package/dist/runtime/utils/{lodash.mjs → lodash.js} +0 -0
package/dist/module.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "2.17.0",
3
+ "version": "2.18.1",
4
4
  "configKey": "ui",
5
5
  "compatibility": {
6
- "nuxt": "^3.10.0"
6
+ "nuxt": ">=3.10.0"
7
+ },
8
+ "builder": {
9
+ "@nuxt/module-builder": "0.8.1",
10
+ "unbuild": "2.0.0"
7
11
  }
8
12
  }
package/dist/module.mjs CHANGED
@@ -2,8 +2,7 @@ import { createRequire } from 'node:module';
2
2
  import { addTemplate, useNuxt, installModule, createResolver, defineNuxtModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
3
3
  import { join } from 'pathe';
4
4
  import { defu } from 'defu';
5
- import { kebabCase } from 'scule';
6
- import defaultColors$1 from 'tailwindcss/colors.js';
5
+ import { setGlobalColors } from '../dist/runtime/utils/colors.js';
7
6
 
8
7
 
9
8
 
@@ -15,7 +14,7 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
15
14
  const __dirname = __cjs_path__.dirname(__filename);
16
15
  const require = __cjs_mod__.createRequire(import.meta.url);
17
16
  const name = "@nuxt/ui";
18
- const version = "2.17.0";
17
+ const version = "2.18.1";
19
18
 
20
19
  function createTemplates(nuxt = useNuxt()) {
21
20
  const template = addTemplate({
@@ -34,68 +33,6 @@ function createTemplates(nuxt = useNuxt()) {
34
33
  });
35
34
  }
36
35
 
37
- function omit(object, keysToOmit) {
38
- const result = { ...object };
39
- for (const key of keysToOmit) {
40
- delete result[key];
41
- }
42
- return result;
43
- }
44
-
45
- const colorsToExclude = [
46
- "inherit",
47
- "transparent",
48
- "current",
49
- "white",
50
- "black",
51
- "slate",
52
- "gray",
53
- "zinc",
54
- "neutral",
55
- "stone",
56
- "cool"
57
- ];
58
- const excludeColors = (colors) => {
59
- return Object.entries(omit(colors, colorsToExclude)).filter(([, value]) => typeof value === "object").map(([key]) => kebabCase(key));
60
- };
61
- const setGlobalColors = (theme) => {
62
- const globalColors = {
63
- ...theme.colors || defaultColors$1,
64
- ...theme.extend?.colors
65
- };
66
- globalColors.primary = theme.extend.colors.primary = {
67
- 50: "rgb(var(--color-primary-50) / <alpha-value>)",
68
- 100: "rgb(var(--color-primary-100) / <alpha-value>)",
69
- 200: "rgb(var(--color-primary-200) / <alpha-value>)",
70
- 300: "rgb(var(--color-primary-300) / <alpha-value>)",
71
- 400: "rgb(var(--color-primary-400) / <alpha-value>)",
72
- 500: "rgb(var(--color-primary-500) / <alpha-value>)",
73
- 600: "rgb(var(--color-primary-600) / <alpha-value>)",
74
- 700: "rgb(var(--color-primary-700) / <alpha-value>)",
75
- 800: "rgb(var(--color-primary-800) / <alpha-value>)",
76
- 900: "rgb(var(--color-primary-900) / <alpha-value>)",
77
- 950: "rgb(var(--color-primary-950) / <alpha-value>)",
78
- DEFAULT: "rgb(var(--color-primary-DEFAULT) / <alpha-value>)"
79
- };
80
- if (globalColors.gray) {
81
- globalColors.cool = theme.extend.colors.cool = defaultColors$1.gray;
82
- }
83
- globalColors.gray = theme.extend.colors.gray = {
84
- 50: "rgb(var(--color-gray-50) / <alpha-value>)",
85
- 100: "rgb(var(--color-gray-100) / <alpha-value>)",
86
- 200: "rgb(var(--color-gray-200) / <alpha-value>)",
87
- 300: "rgb(var(--color-gray-300) / <alpha-value>)",
88
- 400: "rgb(var(--color-gray-400) / <alpha-value>)",
89
- 500: "rgb(var(--color-gray-500) / <alpha-value>)",
90
- 600: "rgb(var(--color-gray-600) / <alpha-value>)",
91
- 700: "rgb(var(--color-gray-700) / <alpha-value>)",
92
- 800: "rgb(var(--color-gray-800) / <alpha-value>)",
93
- 900: "rgb(var(--color-gray-900) / <alpha-value>)",
94
- 950: "rgb(var(--color-gray-950) / <alpha-value>)"
95
- };
96
- return excludeColors(globalColors);
97
- };
98
-
99
36
  async function installTailwind(moduleOptions, nuxt = useNuxt(), resolve = createResolver(import.meta.url).resolve) {
100
37
  const runtimeDir = resolve("./runtime");
101
38
  nuxt.hook("tailwindcss:config", function(tailwindConfig) {
@@ -116,7 +53,6 @@ async function installTailwind(moduleOptions, nuxt = useNuxt(), resolve = create
116
53
  getContents: ({ nuxt: nuxt2 }) => `
117
54
  const { defaultExtractor: createDefaultExtractor } = require('tailwindcss/lib/lib/defaultExtractor.js')
118
55
  const { customSafelistExtractor, generateSafelist } = require(${JSON.stringify(resolve(runtimeDir, "utils", "colors"))})
119
- const { iconsPlugin, getIconCollections } = require('@egoist/tailwindcss-icons')
120
56
 
121
57
  const defaultExtractor = createDefaultExtractor({ tailwindConfig: { separator: ':' } })
122
58
 
@@ -126,8 +62,7 @@ async function installTailwind(moduleOptions, nuxt = useNuxt(), resolve = create
126
62
  require('@tailwindcss/aspect-ratio'),
127
63
  require('@tailwindcss/typography'),
128
64
  require('@tailwindcss/container-queries'),
129
- require('@headlessui/tailwindcss'),
130
- iconsPlugin(${Array.isArray(moduleOptions.icons) || moduleOptions.icons === "all" ? `{ collections: getIconCollections(${JSON.stringify(moduleOptions.icons)}) }` : typeof moduleOptions.icons === "object" ? JSON.stringify(moduleOptions.icons) : {}})
65
+ require('@headlessui/tailwindcss')
131
66
  ],
132
67
  content: {
133
68
  files: [
@@ -159,6 +94,7 @@ async function installTailwind(moduleOptions, nuxt = useNuxt(), resolve = create
159
94
  configTemplate.dst,
160
95
  join(nuxt.options.rootDir, "tailwind.config")
161
96
  ]
97
+ // @ts-expect-error - `@nuxtjs/tailwindcss` not installed yet
162
98
  }, nuxt.options.tailwindcss));
163
99
  }
164
100
 
@@ -175,12 +111,11 @@ const module = defineNuxtModule({
175
111
  version,
176
112
  configKey: "ui",
177
113
  compatibility: {
178
- nuxt: "^3.10.0"
114
+ nuxt: ">=3.10.0"
179
115
  }
180
116
  },
181
117
  defaults: {
182
118
  prefix: "U",
183
- icons: ["heroicons"],
184
119
  safelistColors: ["primary"],
185
120
  disableGlobalStyles: false
186
121
  },
@@ -194,7 +129,7 @@ const module = defineNuxtModule({
194
129
  nuxt.options.css.push(resolve(runtimeDir, "ui.css"));
195
130
  }
196
131
  createTemplates(nuxt);
197
- await installModule("nuxt-icon");
132
+ await installModule("@nuxt/icon");
198
133
  await installModule("@nuxtjs/color-mode", { classSuffix: "" });
199
134
  await installTailwind(options, nuxt, resolve);
200
135
  addPlugin({
@@ -12,6 +12,10 @@
12
12
  <UCheckbox :model-value="indeterminate || selected.length === rows.length" :indeterminate="indeterminate" v-bind="ui.default.checkbox" aria-label="Select all" @change="onChange" />
13
13
  </th>
14
14
 
15
+ <th v-if="$slots.expand" scope="col" :class="ui.tr.base">
16
+ <span class="sr-only">Expand</span>
17
+ </th>
18
+
15
19
  <th
16
20
  v-for="(column, index) in columns"
17
21
  :key="index"
@@ -66,17 +70,39 @@
66
70
  </tr>
67
71
 
68
72
  <template v-else>
69
- <tr v-for="(row, index) in rows" :key="index" :class="[ui.tr.base, isSelected(row) && ui.tr.selected, $attrs.onSelect && ui.tr.active, row?.class]" @click="() => onSelect(row)">
70
- <td v-if="modelValue" :class="ui.checkbox.padding">
71
- <UCheckbox v-model="selected" :value="row" v-bind="ui.default.checkbox" aria-label="Select row" @click.stop />
72
- </td>
73
+ <template v-for="(row, index) in rows" :key="index">
74
+ <tr :class="[ui.tr.base, isSelected(row) && ui.tr.selected, $attrs.onSelect && ui.tr.active, row?.class]" @click="() => onSelect(row)">
75
+ <td v-if="modelValue" :class="ui.checkbox.padding">
76
+ <UCheckbox v-model="selected" :value="row" v-bind="ui.default.checkbox" aria-label="Select row" @click.stop />
77
+ </td>
73
78
 
74
- <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, row[column.key]?.class]">
75
- <slot :name="`${column.key}-data`" :column="column" :row="row" :index="index" :get-row-data="(defaultValue) => getRowData(row, column.key, defaultValue)">
76
- {{ getRowData(row, column.key) }}
77
- </slot>
78
- </td>
79
- </tr>
79
+ <td
80
+ v-if="$slots.expand"
81
+ :class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size]"
82
+ >
83
+ <UButton
84
+ v-bind="{ ...(ui.default.expandButton || {}), ...expandButton }"
85
+ :ui="{ icon: { base: [ui.expand.icon, openedRows.includes(index) && 'rotate-180'] } }"
86
+ @click="toggleOpened(index)"
87
+ />
88
+ </td>
89
+
90
+ <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]">
91
+ <slot :name="`${column.key}-data`" :column="column" :row="row" :index="index" :get-row-data="(defaultValue) => getRowData(row, column.key, defaultValue)">
92
+ {{ getRowData(row, column.key) }}
93
+ </slot>
94
+ </td>
95
+ </tr>
96
+ <tr v-if="openedRows.includes(index)">
97
+ <td colspan="100%">
98
+ <slot
99
+ name="expand"
100
+ :row="row"
101
+ :index="index"
102
+ />
103
+ </td>
104
+ </tr>
105
+ </template>
80
106
  </template>
81
107
  </tbody>
82
108
  </table>
@@ -84,7 +110,7 @@
84
110
  </template>
85
111
 
86
112
  <script>
87
- import { computed, defineComponent, toRaw, toRef } from "vue";
113
+ import { ref, computed, defineComponent, toRaw, toRef } from "vue";
88
114
  import { upperFirst } from "scule";
89
115
  import { defu } from "defu";
90
116
  import { useVModel } from "@vueuse/core";
@@ -159,6 +185,10 @@ export default defineComponent({
159
185
  type: String,
160
186
  default: () => config.default.sortDescIcon
161
187
  },
188
+ expandButton: {
189
+ type: Object,
190
+ default: () => config.default.expandButton
191
+ },
162
192
  loading: {
163
193
  type: Boolean,
164
194
  default: false
@@ -193,6 +223,7 @@ export default defineComponent({
193
223
  const { ui, attrs } = useUI("table", toRef(props, "ui"), config, toRef(props, "class"));
194
224
  const columns = computed(() => props.columns ?? Object.keys(props.rows[0] ?? {}).map((key) => ({ key, label: upperFirst(key), sortable: false, class: void 0, sort: defaultSort })));
195
225
  const sort = useVModel(props, "sort", emit, { passive: true, defaultValue: defu({}, props.sort, { column: null, direction: "asc" }) });
226
+ const openedRows = ref([]);
196
227
  const savedSort = { column: sort.value.column, direction: null };
197
228
  const rows = computed(() => {
198
229
  if (!sort.value?.column || props.sortMode === "manual") {
@@ -216,13 +247,11 @@ export default defineComponent({
216
247
  });
217
248
  const indeterminate = computed(() => selected.value && selected.value.length > 0 && selected.value.length < props.rows.length);
218
249
  const emptyState = computed(() => {
219
- if (props.emptyState === null)
220
- return null;
250
+ if (props.emptyState === null) return null;
221
251
  return { ...ui.value.default.emptyState, ...props.emptyState };
222
252
  });
223
253
  const loadingState = computed(() => {
224
- if (props.loadingState === null)
225
- return null;
254
+ if (props.loadingState === null) return null;
226
255
  return { ...ui.value.default.loadingState, ...props.loadingState };
227
256
  });
228
257
  function compare(a, z) {
@@ -274,6 +303,13 @@ export default defineComponent({
274
303
  function getRowData(row, rowKey, defaultValue = "") {
275
304
  return get(row, rowKey, defaultValue);
276
305
  }
306
+ function toggleOpened(index) {
307
+ if (openedRows.value.includes(index)) {
308
+ openedRows.value = openedRows.value.filter((i) => i !== index);
309
+ } else {
310
+ openedRows.value.push(index);
311
+ }
312
+ }
277
313
  function getAriaSort(column) {
278
314
  if (!column.sortable) {
279
315
  return void 0;
@@ -305,11 +341,13 @@ export default defineComponent({
305
341
  emptyState,
306
342
  // eslint-disable-next-line vue/no-dupe-keys
307
343
  loadingState,
344
+ openedRows,
308
345
  isSelected,
309
346
  onSort,
310
347
  onSelect,
311
348
  onChange,
312
349
  getRowData,
350
+ toggleOpened,
313
351
  getAriaSort
314
352
  };
315
353
  }