@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.
- package/dist/module.d.mts +3 -1988
- package/dist/module.d.ts +3 -1988
- package/dist/module.json +6 -2
- package/dist/module.mjs +6 -71
- package/dist/runtime/components/data/Table.vue +53 -15
- package/dist/runtime/components/data/Table.vue.d.ts +249 -50
- package/dist/runtime/components/elements/Accordion.vue.d.ts +140 -14
- package/dist/runtime/components/elements/Alert.vue +1 -1
- package/dist/runtime/components/elements/Alert.vue.d.ts +106 -23
- package/dist/runtime/components/elements/Avatar.vue.d.ts +146 -25
- package/dist/runtime/components/elements/AvatarGroup.d.ts +20 -11
- package/dist/runtime/components/elements/{AvatarGroup.mjs → AvatarGroup.js} +2 -2
- package/dist/runtime/components/elements/Badge.vue.d.ts +53 -16
- package/dist/runtime/components/elements/Button.vue.d.ts +259 -96
- package/dist/runtime/components/elements/ButtonGroup.d.ts +113 -9
- package/dist/runtime/components/elements/{ButtonGroup.mjs → ButtonGroup.js} +3 -3
- package/dist/runtime/components/elements/Carousel.vue.d.ts +75 -20
- package/dist/runtime/components/elements/Chip.vue.d.ts +95 -23
- package/dist/runtime/components/elements/Dropdown.vue +3 -6
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +135 -16
- package/dist/runtime/components/elements/Icon.vue +16 -15
- package/dist/runtime/components/elements/Icon.vue.d.ts +33 -10
- package/dist/runtime/components/elements/Kbd.vue.d.ts +45 -10
- package/dist/runtime/components/elements/Link.vue.d.ts +72 -72
- package/dist/runtime/components/elements/Meter.vue +1 -1
- package/dist/runtime/components/elements/Meter.vue.d.ts +179 -23
- package/dist/runtime/components/elements/MeterGroup.d.ts +72 -15
- package/dist/runtime/components/elements/{MeterGroup.mjs → MeterGroup.js} +3 -3
- package/dist/runtime/components/elements/Progress.vue +7 -2
- package/dist/runtime/components/elements/Progress.vue.d.ts +188 -32
- package/dist/runtime/components/forms/Checkbox.vue +5 -3
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +73 -32
- package/dist/runtime/components/forms/Form.vue +1 -2
- package/dist/runtime/components/forms/Form.vue.d.ts +11 -10
- package/dist/runtime/components/forms/FormGroup.vue +1 -1
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +78 -25
- package/dist/runtime/components/forms/Input.vue +1 -1
- package/dist/runtime/components/forms/Input.vue.d.ts +272 -55
- package/dist/runtime/components/forms/InputMenu.vue +11 -8
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +431 -81
- package/dist/runtime/components/forms/Radio.vue +5 -3
- package/dist/runtime/components/forms/Radio.vue.d.ts +71 -32
- package/dist/runtime/components/forms/RadioGroup.vue +11 -3
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +83 -25
- package/dist/runtime/components/forms/Range.vue.d.ts +153 -24
- package/dist/runtime/components/forms/Select.vue +1 -1
- package/dist/runtime/components/forms/Select.vue.d.ts +272 -49
- package/dist/runtime/components/forms/SelectMenu.vue +49 -23
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +449 -84
- package/dist/runtime/components/forms/Textarea.vue.d.ts +258 -43
- package/dist/runtime/components/forms/Toggle.vue.d.ts +152 -25
- package/dist/runtime/components/layout/Card.vue.d.ts +54 -4
- package/dist/runtime/components/layout/Container.vue.d.ts +18 -4
- package/dist/runtime/components/layout/Divider.vue.d.ts +121 -16
- package/dist/runtime/components/layout/Skeleton.vue +5 -1
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +27 -4
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +52 -9
- package/dist/runtime/components/navigation/CommandPalette.vue +7 -4
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +193 -35
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +5 -7
- package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +64 -9
- package/dist/runtime/components/navigation/Pagination.vue +2 -4
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +83 -11
- package/dist/runtime/components/navigation/Tabs.vue +10 -0
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +85 -14
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +78 -9
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +71 -8
- package/dist/runtime/components/overlays/Modal.vue.d.ts +85 -11
- package/dist/runtime/components/overlays/Notification.vue +1 -1
- package/dist/runtime/components/overlays/Notification.vue.d.ts +127 -26
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +31 -16
- package/dist/runtime/components/overlays/Popover.vue +3 -6
- package/dist/runtime/components/overlays/Popover.vue.d.ts +110 -15
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +86 -14
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +90 -15
- package/dist/runtime/composables/{defineShortcuts.mjs → defineShortcuts.js} +1 -1
- package/dist/runtime/composables/{useButtonGroup.mjs → useButtonGroup.js} +8 -9
- package/dist/runtime/composables/useCopyToClipboard.d.ts +1 -1
- package/dist/runtime/composables/{useCopyToClipboard.mjs → useCopyToClipboard.js} +1 -1
- package/dist/runtime/composables/useFormGroup.d.ts +5 -5
- package/dist/runtime/composables/useFormGroup.js +49 -0
- package/dist/runtime/composables/useModal.d.ts +3 -3
- package/dist/runtime/composables/{useModal.mjs → useModal.js} +2 -4
- package/dist/runtime/composables/usePopper.d.ts +90 -54
- package/dist/runtime/composables/useShortcuts.d.ts +4 -4
- package/dist/runtime/composables/useSlideover.d.ts +3 -3
- package/dist/runtime/composables/{useSlideover.mjs → useSlideover.js} +2 -4
- package/dist/runtime/composables/useTimer.d.ts +1 -1
- package/dist/runtime/composables/useToast.d.ts +11 -11
- package/dist/runtime/composables/useUI.d.ts +1 -1
- package/dist/runtime/composables/{useUI.mjs → useUI.js} +1 -1
- package/dist/runtime/plugins/colors.d.ts +1 -1
- package/dist/runtime/plugins/{colors.mjs → colors.js} +1 -1
- package/dist/runtime/plugins/modals.d.ts +1 -1
- package/dist/runtime/plugins/{modals.mjs → modals.js} +1 -1
- package/dist/runtime/plugins/slideovers.d.ts +1 -1
- package/dist/runtime/plugins/{slideovers.mjs → slideovers.js} +1 -1
- package/dist/runtime/types/accordion.d.ts +6 -7
- package/dist/runtime/types/accordion.js +0 -0
- package/dist/runtime/types/alert.d.ts +8 -10
- package/dist/runtime/types/alert.js +0 -0
- package/dist/runtime/types/avatar.d.ts +13 -15
- package/dist/runtime/types/avatar.js +0 -0
- package/dist/runtime/types/badge.d.ts +11 -13
- package/dist/runtime/types/badge.js +0 -0
- package/dist/runtime/types/breadcrumb.d.ts +6 -8
- package/dist/runtime/types/breadcrumb.js +0 -0
- package/dist/runtime/types/button.d.ts +27 -29
- package/dist/runtime/types/button.js +0 -0
- package/dist/runtime/types/chip.d.ts +11 -13
- package/dist/runtime/types/chip.js +0 -0
- package/dist/runtime/types/clipboard.d.ts +7 -1
- package/dist/runtime/types/clipboard.js +0 -0
- package/dist/runtime/types/command-palette.d.ts +23 -24
- package/dist/runtime/types/command-palette.js +0 -0
- package/dist/runtime/types/component.d.ts +17 -14
- package/dist/runtime/types/component.js +0 -0
- package/dist/runtime/types/divider.d.ts +2 -3
- package/dist/runtime/types/divider.js +0 -0
- package/dist/runtime/types/dropdown.d.ts +12 -13
- package/dist/runtime/types/dropdown.js +0 -0
- package/dist/runtime/types/form-group.d.ts +4 -5
- package/dist/runtime/types/form-group.js +0 -0
- package/dist/runtime/types/form.d.ts +29 -28
- package/dist/runtime/types/form.js +0 -0
- package/dist/runtime/types/horizontal-navigation.d.ts +10 -11
- package/dist/runtime/types/horizontal-navigation.js +0 -0
- package/dist/runtime/types/index.d.ts +31 -31
- package/dist/runtime/types/index.js +31 -0
- package/dist/runtime/types/input.d.ts +7 -8
- package/dist/runtime/types/input.js +0 -0
- package/dist/runtime/types/kbd.d.ts +4 -5
- package/dist/runtime/types/kbd.js +0 -0
- package/dist/runtime/types/link.d.ts +9 -10
- package/dist/runtime/types/link.js +0 -0
- package/dist/runtime/types/meter.d.ts +4 -5
- package/dist/runtime/types/meter.js +0 -0
- package/dist/runtime/types/modal.d.ts +13 -15
- package/dist/runtime/types/modal.js +0 -0
- package/dist/runtime/types/notification.d.ts +17 -20
- package/dist/runtime/types/notification.js +0 -0
- package/dist/runtime/types/popper.d.ts +13 -15
- package/dist/runtime/types/popper.js +0 -0
- package/dist/runtime/types/progress.d.ts +5 -6
- package/dist/runtime/types/progress.js +0 -0
- package/dist/runtime/types/range.d.ts +6 -7
- package/dist/runtime/types/range.js +0 -0
- package/dist/runtime/types/select.d.ts +7 -8
- package/dist/runtime/types/select.js +0 -0
- package/dist/runtime/types/slideover.d.ts +10 -12
- package/dist/runtime/types/slideover.js +0 -0
- package/dist/runtime/types/tabs.d.ts +6 -5
- package/dist/runtime/types/tabs.js +0 -0
- package/dist/runtime/types/textarea.d.ts +7 -8
- package/dist/runtime/types/textarea.js +0 -0
- package/dist/runtime/types/toggle.d.ts +6 -7
- package/dist/runtime/types/toggle.js +0 -0
- package/dist/runtime/types/tooltip.d.ts +5 -5
- package/dist/runtime/types/tooltip.js +0 -0
- package/dist/runtime/types/utils.d.ts +15 -27
- package/dist/runtime/types/utils.js +0 -0
- package/dist/runtime/types/vertical-navigation.d.ts +10 -11
- package/dist/runtime/types/vertical-navigation.js +0 -0
- package/dist/runtime/ui.config/data/table.d.ts +10 -0
- package/dist/runtime/ui.config/data/{table.mjs → table.js} +10 -0
- package/dist/runtime/ui.config/elements/accordion.d.ts +1 -0
- package/dist/runtime/ui.config/elements/{accordion.mjs → accordion.js} +3 -2
- package/dist/runtime/ui.config/elements/alert.d.ts +2 -2
- package/dist/runtime/ui.config/elements/avatar.d.ts +2 -2
- package/dist/runtime/ui.config/elements/{carousel.mjs → carousel.js} +1 -1
- package/dist/runtime/ui.config/elements/{dropdown.mjs → dropdown.js} +1 -1
- package/dist/runtime/ui.config/forms/{inputMenu.mjs → inputMenu.js} +1 -1
- package/dist/runtime/ui.config/forms/{select.mjs → select.js} +1 -1
- package/dist/runtime/ui.config/forms/{selectMenu.mjs → selectMenu.js} +2 -2
- package/dist/runtime/ui.config/forms/{textarea.mjs → textarea.js} +1 -1
- package/dist/runtime/ui.config/forms/toggle.d.ts +2 -2
- package/dist/runtime/ui.config/index.d.ts +43 -43
- package/dist/runtime/ui.config/index.js +43 -0
- package/dist/runtime/ui.config/navigation/{breadcrumb.mjs → breadcrumb.js} +2 -2
- package/dist/runtime/ui.config/navigation/commandPalette.d.ts +1 -1
- package/dist/runtime/ui.config/navigation/tabs.d.ts +1 -0
- package/dist/runtime/ui.config/navigation/{tabs.mjs → tabs.js} +2 -1
- package/dist/runtime/ui.config/overlays/{contextMenu.mjs → contextMenu.js} +1 -1
- package/dist/runtime/ui.config/overlays/{modal.mjs → modal.js} +2 -2
- package/dist/runtime/ui.config/overlays/notification.d.ts +1 -1
- package/dist/runtime/ui.config/overlays/{popover.mjs → popover.js} +1 -1
- package/dist/runtime/ui.config/overlays/{slideover.mjs → slideover.js} +2 -2
- package/dist/runtime/ui.config/overlays/{tooltip.mjs → tooltip.js} +1 -1
- package/dist/runtime/utils/colors.d.ts +2 -2
- package/dist/runtime/utils/{colors.mjs → colors.js} +1 -1
- package/dist/runtime/utils/index.d.ts +4 -4
- package/dist/runtime/utils/{index.mjs → index.js} +2 -2
- package/dist/runtime/utils/link.d.ts +26 -24
- package/dist/runtime/utils/{link.mjs → link.js} +1 -1
- package/dist/types.d.mts +1 -16
- package/dist/types.d.ts +1 -16
- package/package.json +19 -21
- package/dist/runtime/composables/useFormGroup.mjs +0 -45
- package/dist/runtime/ui.config/index.mjs +0 -43
- /package/dist/runtime/composables/{useCarouselScroll.mjs → useCarouselScroll.js} +0 -0
- /package/dist/runtime/composables/{usePopper.mjs → usePopper.js} +0 -0
- /package/dist/runtime/composables/{useShortcuts.mjs → useShortcuts.js} +0 -0
- /package/dist/runtime/composables/{useTimer.mjs → useTimer.js} +0 -0
- /package/dist/runtime/composables/{useToast.mjs → useToast.js} +0 -0
- /package/dist/runtime/ui.config/elements/{alert.mjs → alert.js} +0 -0
- /package/dist/runtime/ui.config/elements/{avatar.mjs → avatar.js} +0 -0
- /package/dist/runtime/ui.config/elements/{avatarGroup.mjs → avatarGroup.js} +0 -0
- /package/dist/runtime/ui.config/elements/{badge.mjs → badge.js} +0 -0
- /package/dist/runtime/ui.config/elements/{button.mjs → button.js} +0 -0
- /package/dist/runtime/ui.config/elements/{buttonGroup.mjs → buttonGroup.js} +0 -0
- /package/dist/runtime/ui.config/elements/{chip.mjs → chip.js} +0 -0
- /package/dist/runtime/ui.config/elements/{kbd.mjs → kbd.js} +0 -0
- /package/dist/runtime/ui.config/elements/{meter.mjs → meter.js} +0 -0
- /package/dist/runtime/ui.config/elements/{meterGroup.mjs → meterGroup.js} +0 -0
- /package/dist/runtime/ui.config/elements/{progress.mjs → progress.js} +0 -0
- /package/dist/runtime/ui.config/forms/{checkbox.mjs → checkbox.js} +0 -0
- /package/dist/runtime/ui.config/forms/{formGroup.mjs → formGroup.js} +0 -0
- /package/dist/runtime/ui.config/forms/{input.mjs → input.js} +0 -0
- /package/dist/runtime/ui.config/forms/{radio.mjs → radio.js} +0 -0
- /package/dist/runtime/ui.config/forms/{radioGroup.mjs → radioGroup.js} +0 -0
- /package/dist/runtime/ui.config/forms/{range.mjs → range.js} +0 -0
- /package/dist/runtime/ui.config/forms/{toggle.mjs → toggle.js} +0 -0
- /package/dist/runtime/ui.config/layout/{card.mjs → card.js} +0 -0
- /package/dist/runtime/ui.config/layout/{container.mjs → container.js} +0 -0
- /package/dist/runtime/ui.config/layout/{divider.mjs → divider.js} +0 -0
- /package/dist/runtime/ui.config/layout/{skeleton.mjs → skeleton.js} +0 -0
- /package/dist/runtime/ui.config/navigation/{commandPalette.mjs → commandPalette.js} +0 -0
- /package/dist/runtime/ui.config/navigation/{horizontalNavigation.mjs → horizontalNavigation.js} +0 -0
- /package/dist/runtime/ui.config/navigation/{pagination.mjs → pagination.js} +0 -0
- /package/dist/runtime/ui.config/navigation/{verticalNavigation.mjs → verticalNavigation.js} +0 -0
- /package/dist/runtime/ui.config/overlays/{notification.mjs → notification.js} +0 -0
- /package/dist/runtime/ui.config/overlays/{notifications.mjs → notifications.js} +0 -0
- /package/dist/runtime/ui.config/{popper.mjs → popper.js} +0 -0
- /package/dist/runtime/utils/{lodash.mjs → lodash.js} +0 -0
package/dist/module.json
CHANGED
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 {
|
|
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
|
+
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: "
|
|
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
|
|
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
|
-
<
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
}
|