@nuxt/ui 2.12.3 → 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.
- package/README.md +8 -8
- package/dist/module.d.mts +170 -40
- package/dist/module.d.ts +170 -40
- package/dist/module.json +2 -2
- package/dist/module.mjs +136 -146
- package/dist/runtime/components/data/Table.vue +16 -4
- package/dist/runtime/components/data/Table.vue.d.ts +21 -3
- package/dist/runtime/components/elements/Accordion.vue +11 -2
- package/dist/runtime/components/elements/Accordion.vue.d.ts +1 -1
- package/dist/runtime/components/elements/Alert.vue +2 -2
- package/dist/runtime/components/elements/Alert.vue.d.ts +4 -3
- package/dist/runtime/components/elements/Avatar.vue.d.ts +1 -1
- package/dist/runtime/components/elements/AvatarGroup.d.ts +1 -1
- package/dist/runtime/components/elements/Badge.vue.d.ts +2 -2
- package/dist/runtime/components/elements/Button.vue.d.ts +63 -37
- package/dist/runtime/components/elements/ButtonGroup.d.ts +1 -1
- package/dist/runtime/components/elements/Carousel.vue +156 -0
- package/dist/runtime/components/elements/Carousel.vue.d.ts +104 -0
- package/dist/runtime/components/elements/Chip.vue.d.ts +5 -5
- package/dist/runtime/components/elements/Dropdown.vue +5 -3
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +7 -7
- package/dist/runtime/components/elements/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/elements/Kbd.vue.d.ts +1 -1
- package/dist/runtime/components/elements/Link.vue +3 -3
- package/dist/runtime/components/elements/Link.vue.d.ts +62 -36
- package/dist/runtime/components/elements/Meter.vue +4 -0
- package/dist/runtime/components/elements/Meter.vue.d.ts +4 -4
- package/dist/runtime/components/elements/MeterGroup.d.ts +4 -4
- package/dist/runtime/components/elements/Progress.vue +4 -1
- package/dist/runtime/components/elements/Progress.vue.d.ts +8 -8
- package/dist/runtime/components/forms/Checkbox.vue +1 -6
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +6 -15
- package/dist/runtime/components/forms/Form.vue +13 -6
- package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
- package/dist/runtime/components/forms/FormGroup.vue +20 -17
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +2 -2
- package/dist/runtime/components/forms/Input.vue +1 -0
- package/dist/runtime/components/forms/Input.vue.d.ts +6 -6
- package/dist/runtime/components/forms/InputMenu.vue +12 -1
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +16 -7
- package/dist/runtime/components/forms/Radio.vue +5 -11
- package/dist/runtime/components/forms/Radio.vue.d.ts +6 -6
- package/dist/runtime/components/forms/RadioGroup.vue +1 -0
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +4 -4
- package/dist/runtime/components/forms/Range.vue.d.ts +4 -4
- package/dist/runtime/components/forms/Select.vue +5 -1
- package/dist/runtime/components/forms/Select.vue.d.ts +6 -6
- package/dist/runtime/components/forms/SelectMenu.vue +5 -2
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +7 -7
- package/dist/runtime/components/forms/Textarea.vue +5 -1
- package/dist/runtime/components/forms/Textarea.vue.d.ts +15 -6
- package/dist/runtime/components/forms/Toggle.vue +4 -2
- package/dist/runtime/components/forms/Toggle.vue.d.ts +6 -6
- package/dist/runtime/components/layout/Card.vue +1 -1
- package/dist/runtime/components/layout/Card.vue.d.ts +1 -1
- package/dist/runtime/components/layout/Container.vue.d.ts +1 -1
- package/dist/runtime/components/layout/Divider.vue +8 -1
- package/dist/runtime/components/layout/Divider.vue.d.ts +15 -4
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/CommandPalette.vue +3 -1
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +2 -2
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +3 -1
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/HorizontalNavigation.vue +102 -0
- package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +44 -0
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +3 -3
- package/dist/runtime/components/navigation/Tabs.vue +8 -8
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +10 -1
- package/dist/runtime/components/navigation/VerticalNavigation.vue +12 -3
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +3 -3
- package/dist/runtime/components/overlays/Modal.vue +9 -3
- package/dist/runtime/components/overlays/Modal.vue.d.ts +6 -5
- package/dist/runtime/components/overlays/Modals.client.vue +12 -0
- package/dist/runtime/components/overlays/Notification.vue +2 -2
- package/dist/runtime/components/overlays/Notification.vue.d.ts +4 -3
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Popover.vue +5 -3
- package/dist/runtime/components/overlays/Popover.vue.d.ts +7 -7
- package/dist/runtime/components/overlays/Slideover.vue +9 -3
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +6 -5
- package/dist/runtime/components/overlays/Tooltip.vue +2 -2
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +6 -6
- package/dist/runtime/composables/useCarouselScroll.d.ts +2 -0
- package/dist/runtime/composables/useCarouselScroll.mjs +35 -0
- package/dist/runtime/composables/useFormGroup.d.ts +1 -1
- package/dist/runtime/composables/useFormGroup.mjs +9 -12
- package/dist/runtime/composables/useModal.d.ts +12 -0
- package/dist/runtime/composables/useModal.mjs +37 -0
- package/dist/runtime/composables/usePopper.d.ts +3 -3
- package/dist/runtime/plugins/modals.d.ts +2 -0
- package/dist/runtime/plugins/modals.mjs +10 -0
- package/dist/runtime/types/component.d.ts +14 -0
- package/dist/runtime/types/divider.d.ts +3 -0
- package/dist/runtime/types/form.d.ts +2 -1
- package/dist/runtime/types/horizontal-navigation.d.ts +13 -0
- package/dist/runtime/types/index.d.ts +3 -0
- package/dist/runtime/types/modal.d.ts +18 -0
- package/dist/runtime/types/progress.d.ts +2 -0
- package/dist/runtime/types/range.d.ts +2 -0
- package/dist/runtime/types/toggle.d.ts +2 -0
- package/dist/runtime/types/vertical-navigation.d.ts +2 -1
- package/dist/runtime/ui.config/data/table.d.ts +7 -0
- package/dist/runtime/ui.config/data/table.mjs +10 -3
- package/dist/runtime/ui.config/elements/accordion.d.ts +1 -0
- package/dist/runtime/ui.config/elements/accordion.mjs +1 -0
- package/dist/runtime/ui.config/elements/carousel.d.ts +27 -0
- package/dist/runtime/ui.config/elements/carousel.mjs +26 -0
- package/dist/runtime/ui.config/elements/dropdown.d.ts +5 -1
- package/dist/runtime/ui.config/elements/dropdown.mjs +8 -4
- package/dist/runtime/ui.config/forms/formGroup.d.ts +1 -0
- package/dist/runtime/ui.config/forms/formGroup.mjs +1 -0
- package/dist/runtime/ui.config/forms/input.d.ts +11 -0
- package/dist/runtime/ui.config/forms/input.mjs +11 -0
- package/dist/runtime/ui.config/forms/inputMenu.d.ts +1 -1
- package/dist/runtime/ui.config/forms/inputMenu.mjs +5 -5
- package/dist/runtime/ui.config/forms/select.d.ts +11 -0
- package/dist/runtime/ui.config/forms/select.mjs +1 -1
- package/dist/runtime/ui.config/forms/selectMenu.d.ts +1 -1
- package/dist/runtime/ui.config/forms/textarea.d.ts +11 -0
- package/dist/runtime/ui.config/index.d.ts +2 -0
- package/dist/runtime/ui.config/index.mjs +2 -0
- package/dist/runtime/ui.config/layout/divider.d.ts +19 -2
- package/dist/runtime/ui.config/layout/divider.mjs +20 -3
- package/dist/runtime/ui.config/navigation/breadcrumb.mjs +4 -4
- package/dist/runtime/ui.config/navigation/commandPalette.d.ts +1 -1
- package/dist/runtime/ui.config/navigation/commandPalette.mjs +8 -8
- package/dist/runtime/ui.config/navigation/horizontalNavigation.d.ts +27 -0
- package/dist/runtime/ui.config/navigation/horizontalNavigation.mjs +26 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +4 -3
- package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +8 -7
- package/dist/runtime/ui.config/overlays/popover.d.ts +4 -0
- package/dist/runtime/ui.config/overlays/popover.mjs +4 -0
- package/dist/runtime/ui.config/overlays/slideover.mjs +2 -2
- package/dist/runtime/ui.config/overlays/tooltip.d.ts +4 -0
- package/dist/runtime/ui.config/overlays/tooltip.mjs +4 -0
- package/dist/runtime/ui.css +1 -1
- package/dist/runtime/utils/colors.d.ts +3 -0
- package/dist/runtime/utils/colors.mjs +261 -0
- package/dist/runtime/utils/index.mjs +9 -0
- package/dist/runtime/utils/link.d.ts +24 -11
- package/dist/runtime/utils/link.mjs +26 -13
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +24 -22
- package/dist/runtime/utils/uid.d.ts +0 -1
- package/dist/runtime/utils/uid.mjs +0 -5
package/dist/module.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { addTemplate, useNuxt, defineNuxtModule, createResolver,
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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.
|
|
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,72 +263,130 @@ 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
|
|
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.
|
|
382
|
+
nuxt: "^3.10.0"
|
|
317
383
|
}
|
|
318
384
|
},
|
|
319
385
|
defaults: {
|
|
320
386
|
prefix: "U",
|
|
321
387
|
icons: ["heroicons"],
|
|
322
|
-
safelistColors: ["primary"]
|
|
388
|
+
safelistColors: ["primary"],
|
|
389
|
+
disableGlobalStyles: false
|
|
323
390
|
},
|
|
324
391
|
async setup(options, nuxt) {
|
|
325
392
|
const { resolve } = createResolver(import.meta.url);
|
|
@@ -327,96 +394,19 @@ const module = defineNuxtModule({
|
|
|
327
394
|
nuxt.options.build.transpile.push(runtimeDir);
|
|
328
395
|
nuxt.options.build.transpile.push("@popperjs/core", "@headlessui/vue");
|
|
329
396
|
nuxt.options.alias["#ui"] = runtimeDir;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
tailwindConfig.theme.extend = tailwindConfig.theme.extend || {};
|
|
334
|
-
tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {};
|
|
335
|
-
const globalColors = {
|
|
336
|
-
...tailwindConfig.theme.colors || defaultColors,
|
|
337
|
-
...tailwindConfig.theme.extend?.colors
|
|
338
|
-
};
|
|
339
|
-
globalColors.primary = tailwindConfig.theme.extend.colors.primary = {
|
|
340
|
-
50: "rgb(var(--color-primary-50) / <alpha-value>)",
|
|
341
|
-
100: "rgb(var(--color-primary-100) / <alpha-value>)",
|
|
342
|
-
200: "rgb(var(--color-primary-200) / <alpha-value>)",
|
|
343
|
-
300: "rgb(var(--color-primary-300) / <alpha-value>)",
|
|
344
|
-
400: "rgb(var(--color-primary-400) / <alpha-value>)",
|
|
345
|
-
500: "rgb(var(--color-primary-500) / <alpha-value>)",
|
|
346
|
-
600: "rgb(var(--color-primary-600) / <alpha-value>)",
|
|
347
|
-
700: "rgb(var(--color-primary-700) / <alpha-value>)",
|
|
348
|
-
800: "rgb(var(--color-primary-800) / <alpha-value>)",
|
|
349
|
-
900: "rgb(var(--color-primary-900) / <alpha-value>)",
|
|
350
|
-
950: "rgb(var(--color-primary-950) / <alpha-value>)",
|
|
351
|
-
DEFAULT: "rgb(var(--color-primary-DEFAULT) / <alpha-value>)"
|
|
352
|
-
};
|
|
353
|
-
if (globalColors.gray) {
|
|
354
|
-
globalColors.cool = tailwindConfig.theme.extend.colors.cool = defaultColors.gray;
|
|
355
|
-
}
|
|
356
|
-
globalColors.gray = tailwindConfig.theme.extend.colors.gray = {
|
|
357
|
-
50: "rgb(var(--color-gray-50) / <alpha-value>)",
|
|
358
|
-
100: "rgb(var(--color-gray-100) / <alpha-value>)",
|
|
359
|
-
200: "rgb(var(--color-gray-200) / <alpha-value>)",
|
|
360
|
-
300: "rgb(var(--color-gray-300) / <alpha-value>)",
|
|
361
|
-
400: "rgb(var(--color-gray-400) / <alpha-value>)",
|
|
362
|
-
500: "rgb(var(--color-gray-500) / <alpha-value>)",
|
|
363
|
-
600: "rgb(var(--color-gray-600) / <alpha-value>)",
|
|
364
|
-
700: "rgb(var(--color-gray-700) / <alpha-value>)",
|
|
365
|
-
800: "rgb(var(--color-gray-800) / <alpha-value>)",
|
|
366
|
-
900: "rgb(var(--color-gray-900) / <alpha-value>)",
|
|
367
|
-
950: "rgb(var(--color-gray-950) / <alpha-value>)"
|
|
368
|
-
};
|
|
369
|
-
const colors = excludeColors(globalColors);
|
|
370
|
-
nuxt.options.appConfig.ui = {
|
|
371
|
-
primary: "green",
|
|
372
|
-
gray: "cool",
|
|
373
|
-
colors,
|
|
374
|
-
strategy: "merge"
|
|
375
|
-
};
|
|
376
|
-
tailwindConfig.safelist = tailwindConfig.safelist || [];
|
|
377
|
-
tailwindConfig.safelist.push(...generateSafelist(options.safelistColors || [], colors));
|
|
378
|
-
tailwindConfig.plugins = tailwindConfig.plugins || [];
|
|
379
|
-
tailwindConfig.plugins.push(iconsPlugin(Array.isArray(options.icons) ? { collections: getIconCollections(options.icons) } : typeof options.icons === "object" ? options.icons : {}));
|
|
380
|
-
});
|
|
397
|
+
if (!options.disableGlobalStyles) {
|
|
398
|
+
nuxt.options.css.push(resolve(runtimeDir, "ui.css"));
|
|
399
|
+
}
|
|
381
400
|
createTemplates(nuxt);
|
|
382
401
|
await installModule("nuxt-icon");
|
|
383
402
|
await installModule("@nuxtjs/color-mode", { classSuffix: "" });
|
|
384
|
-
await
|
|
385
|
-
exposeConfig: true,
|
|
386
|
-
config: {
|
|
387
|
-
darkMode: "class",
|
|
388
|
-
plugins: [
|
|
389
|
-
require("@tailwindcss/forms")({ strategy: "class" }),
|
|
390
|
-
require("@tailwindcss/aspect-ratio"),
|
|
391
|
-
require("@tailwindcss/typography"),
|
|
392
|
-
require("@tailwindcss/container-queries"),
|
|
393
|
-
require("@headlessui/tailwindcss")
|
|
394
|
-
],
|
|
395
|
-
content: {
|
|
396
|
-
files: [
|
|
397
|
-
resolve(runtimeDir, "components/**/*.{vue,mjs,ts}"),
|
|
398
|
-
resolve(runtimeDir, "ui.config/**/*.{mjs,js,ts}")
|
|
399
|
-
],
|
|
400
|
-
transform: {
|
|
401
|
-
vue: (content) => {
|
|
402
|
-
return content.replaceAll(/(?:\r\n|\r|\n)/g, " ");
|
|
403
|
-
}
|
|
404
|
-
},
|
|
405
|
-
extract: {
|
|
406
|
-
vue: (content) => {
|
|
407
|
-
return [
|
|
408
|
-
...defaultExtractor(content),
|
|
409
|
-
// @ts-ignore
|
|
410
|
-
...customSafelistExtractor(options.prefix, content, nuxt.options.appConfig.ui.colors, options.safelistColors)
|
|
411
|
-
];
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
});
|
|
403
|
+
await installTailwind(options, nuxt, { resolve, runtimeDir });
|
|
417
404
|
addPlugin({
|
|
418
405
|
src: resolve(runtimeDir, "plugins", "colors")
|
|
419
406
|
});
|
|
407
|
+
addPlugin({
|
|
408
|
+
src: resolve(runtimeDir, "plugins", "modals")
|
|
409
|
+
});
|
|
420
410
|
addComponentsDir({
|
|
421
411
|
path: resolve(runtimeDir, "components", "elements"),
|
|
422
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 :
|
|
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: () => ""
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
import type { Button } from '../../types';
|
|
2
|
+
import type { Button, ProgressAnimation } from '../../types';
|
|
3
3
|
declare function defaultComparator<T>(a: T, z: T): boolean;
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
5
5
|
modelValue: {
|
|
@@ -72,6 +72,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
72
72
|
}>;
|
|
73
73
|
default: () => any;
|
|
74
74
|
};
|
|
75
|
+
progress: {
|
|
76
|
+
type: PropType<{
|
|
77
|
+
color: any;
|
|
78
|
+
animation: ProgressAnimation;
|
|
79
|
+
}>;
|
|
80
|
+
default: () => any;
|
|
81
|
+
};
|
|
75
82
|
class: {
|
|
76
83
|
type: PropType<any>;
|
|
77
84
|
default: () => string;
|
|
@@ -112,7 +119,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
112
119
|
onSelect: (row: any) => void;
|
|
113
120
|
onChange: (event: any) => void;
|
|
114
121
|
getRowData: (row: Object, rowKey: string | string[], defaultValue?: any) => any;
|
|
115
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:sort")[], "update:modelValue" | "update:sort", import("vue").
|
|
122
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:sort")[], "update:modelValue" | "update:sort", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
116
123
|
modelValue: {
|
|
117
124
|
type: ArrayConstructor;
|
|
118
125
|
default: null;
|
|
@@ -183,6 +190,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
183
190
|
}>;
|
|
184
191
|
default: () => any;
|
|
185
192
|
};
|
|
193
|
+
progress: {
|
|
194
|
+
type: PropType<{
|
|
195
|
+
color: any;
|
|
196
|
+
animation: ProgressAnimation;
|
|
197
|
+
}>;
|
|
198
|
+
default: () => any;
|
|
199
|
+
};
|
|
186
200
|
class: {
|
|
187
201
|
type: PropType<any>;
|
|
188
202
|
default: () => string;
|
|
@@ -199,7 +213,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
199
213
|
column: string;
|
|
200
214
|
direction: 'asc' | 'desc';
|
|
201
215
|
};
|
|
216
|
+
progress: {
|
|
217
|
+
color: any;
|
|
218
|
+
animation: ProgressAnimation;
|
|
219
|
+
};
|
|
202
220
|
ui: any;
|
|
221
|
+
class: any;
|
|
203
222
|
columns: {
|
|
204
223
|
[key: string]: any;
|
|
205
224
|
key: string;
|
|
@@ -208,7 +227,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
208
227
|
direction?: "asc" | "desc" | undefined;
|
|
209
228
|
class?: string | undefined;
|
|
210
229
|
}[];
|
|
211
|
-
class: any;
|
|
212
230
|
modelValue: unknown[];
|
|
213
231
|
by: string | Function;
|
|
214
232
|
rows: {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="ui.wrapper">
|
|
3
|
-
<HDisclosure
|
|
3
|
+
<HDisclosure
|
|
4
|
+
v-for="(item, index) in items"
|
|
5
|
+
v-slot="{ open, close }"
|
|
6
|
+
:key="index"
|
|
7
|
+
as="div"
|
|
8
|
+
:class="ui.container"
|
|
9
|
+
:default-open="defaultOpen || item.defaultOpen"
|
|
10
|
+
>
|
|
4
11
|
<HDisclosureButton
|
|
5
12
|
:ref="() => buttonRefs[index] = { open, close }"
|
|
6
13
|
as="template"
|
|
@@ -46,13 +53,14 @@
|
|
|
46
53
|
|
|
47
54
|
<script>
|
|
48
55
|
import { ref, computed, toRef, defineComponent } from "vue";
|
|
49
|
-
import { Disclosure as HDisclosure, DisclosureButton as HDisclosureButton, DisclosurePanel as HDisclosurePanel } from "@headlessui/vue";
|
|
56
|
+
import { Disclosure as HDisclosure, DisclosureButton as HDisclosureButton, DisclosurePanel as HDisclosurePanel, provideUseId } from "@headlessui/vue";
|
|
50
57
|
import UIcon from "../elements/Icon.vue";
|
|
51
58
|
import UButton from "../elements/Button.vue";
|
|
52
59
|
import { useUI } from "../../composables/useUI";
|
|
53
60
|
import { mergeConfig, omit } from "../../utils";
|
|
54
61
|
import appConfig from "#build/app.config";
|
|
55
62
|
import { accordion, button } from "#ui/ui.config";
|
|
63
|
+
import { useId } from "#imports";
|
|
56
64
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.accordion, accordion);
|
|
57
65
|
const configButton = mergeConfig(appConfig.ui.strategy, appConfig.ui.button, button);
|
|
58
66
|
export default defineComponent({
|
|
@@ -129,6 +137,7 @@ export default defineComponent({
|
|
|
129
137
|
el.style.height = "0";
|
|
130
138
|
el.addEventListener("transitionend", done, { once: true });
|
|
131
139
|
}
|
|
140
|
+
provideUseId(() => useId());
|
|
132
141
|
return {
|
|
133
142
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
134
143
|
ui,
|
|
@@ -46,7 +46,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
46
46
|
onBeforeLeave: (_el: Element) => void;
|
|
47
47
|
onAfterEnter: (_el: Element) => void;
|
|
48
48
|
onLeave: (_el: Element, done: () => void) => void;
|
|
49
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
49
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
50
50
|
items: {
|
|
51
51
|
type: PropType<AccordionItem[]>;
|
|
52
52
|
default: () => never[];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<UAvatar v-if="avatar" v-bind="{ size: ui.avatar.size, ...avatar }" :class="ui.avatar.base" />
|
|
6
6
|
|
|
7
7
|
<div :class="ui.inner">
|
|
8
|
-
<p :class="ui.title">
|
|
8
|
+
<p v-if="(title || $slots.title)" :class="ui.title">
|
|
9
9
|
<slot name="title" :title="title">
|
|
10
10
|
{{ title }}
|
|
11
11
|
</slot>
|
|
@@ -52,7 +52,7 @@ export default defineComponent({
|
|
|
52
52
|
props: {
|
|
53
53
|
title: {
|
|
54
54
|
type: String,
|
|
55
|
-
|
|
55
|
+
default: null
|
|
56
56
|
},
|
|
57
57
|
description: {
|
|
58
58
|
type: String,
|
|
@@ -3,7 +3,7 @@ import type { Avatar, Button, AlertVariant, AlertAction } from '../../types';
|
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
title: {
|
|
5
5
|
type: StringConstructor;
|
|
6
|
-
|
|
6
|
+
default: null;
|
|
7
7
|
};
|
|
8
8
|
description: {
|
|
9
9
|
type: StringConstructor;
|
|
@@ -51,10 +51,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
51
51
|
alertClass: import("vue").ComputedRef<string>;
|
|
52
52
|
onAction: (action: AlertAction) => void;
|
|
53
53
|
twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
|
|
54
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").
|
|
54
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
55
55
|
title: {
|
|
56
56
|
type: StringConstructor;
|
|
57
|
-
|
|
57
|
+
default: null;
|
|
58
58
|
};
|
|
59
59
|
description: {
|
|
60
60
|
type: StringConstructor;
|
|
@@ -98,6 +98,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
98
98
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
99
99
|
}, {
|
|
100
100
|
ui: any;
|
|
101
|
+
title: string;
|
|
101
102
|
description: string;
|
|
102
103
|
icon: string;
|
|
103
104
|
avatar: Avatar;
|
|
@@ -61,7 +61,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
61
61
|
placeholder: import("vue").ComputedRef<string>;
|
|
62
62
|
error: import("vue").Ref<boolean>;
|
|
63
63
|
onError: () => void;
|
|
64
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
64
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
65
65
|
src: {
|
|
66
66
|
type: (BooleanConstructor | StringConstructor)[];
|
|
67
67
|
default: null;
|
|
@@ -20,7 +20,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
20
20
|
};
|
|
21
21
|
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
22
22
|
[key: string]: any;
|
|
23
|
-
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
23
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
24
|
size: {
|
|
25
25
|
type: PropType<AvatarSize>;
|
|
26
26
|
default: null;
|
|
@@ -33,7 +33,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
33
33
|
[x: string]: unknown;
|
|
34
34
|
}, string>>;
|
|
35
35
|
badgeClass: import("vue").ComputedRef<string>;
|
|
36
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
36
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
37
37
|
size: {
|
|
38
38
|
type: PropType<BadgeSize>;
|
|
39
39
|
default: () => any;
|
|
@@ -66,7 +66,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
66
66
|
ui: any;
|
|
67
67
|
color: any;
|
|
68
68
|
class: any;
|
|
69
|
-
label: string | number;
|
|
70
69
|
variant: BadgeVariant;
|
|
70
|
+
label: string | number;
|
|
71
71
|
}, {}>;
|
|
72
72
|
export default _default;
|