@una-ui/nuxt 0.1.0-beta.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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/dist/module.cjs +5 -0
  4. package/dist/module.d.ts +31 -0
  5. package/dist/module.json +8 -0
  6. package/dist/module.mjs +93 -0
  7. package/dist/runtime/components/elements/Accordion.vue +201 -0
  8. package/dist/runtime/components/elements/Alert.vue +138 -0
  9. package/dist/runtime/components/elements/Avatar.vue +80 -0
  10. package/dist/runtime/components/elements/AvatarGroup.vue +27 -0
  11. package/dist/runtime/components/elements/Badge.vue +50 -0
  12. package/dist/runtime/components/elements/Button.vue +94 -0
  13. package/dist/runtime/components/elements/Icon.vue +9 -0
  14. package/dist/runtime/components/elements/Indicator.vue +60 -0
  15. package/dist/runtime/components/forms/FormGroup.vue +141 -0
  16. package/dist/runtime/components/forms/Input.vue +151 -0
  17. package/dist/runtime/components/forms/Switch.vue +117 -0
  18. package/dist/runtime/components/misc/ThemeSwitcher.vue +111 -0
  19. package/dist/runtime/components/slots/AvatarGroupDefault.d.ts +22 -0
  20. package/dist/runtime/components/slots/AvatarGroupDefault.mjs +44 -0
  21. package/dist/runtime/components/slots/FormGroupDefault.d.ts +25 -0
  22. package/dist/runtime/components/slots/FormGroupDefault.mjs +23 -0
  23. package/dist/runtime/composables/themes.d.ts +7 -0
  24. package/dist/runtime/composables/themes.mjs +119 -0
  25. package/dist/runtime/plugins/theme.client.d.ts +5 -0
  26. package/dist/runtime/plugins/theme.client.mjs +28 -0
  27. package/dist/runtime/plugins/theme.server.d.ts +2 -0
  28. package/dist/runtime/plugins/theme.server.mjs +24 -0
  29. package/dist/runtime/types/accordion.d.ts +112 -0
  30. package/dist/runtime/types/accordion.mjs +0 -0
  31. package/dist/runtime/types/alert.d.ts +55 -0
  32. package/dist/runtime/types/alert.mjs +0 -0
  33. package/dist/runtime/types/avatar-group.d.ts +26 -0
  34. package/dist/runtime/types/avatar-group.mjs +0 -0
  35. package/dist/runtime/types/avatar.d.ts +71 -0
  36. package/dist/runtime/types/avatar.mjs +0 -0
  37. package/dist/runtime/types/badge.d.ts +41 -0
  38. package/dist/runtime/types/badge.mjs +0 -0
  39. package/dist/runtime/types/button.d.ts +95 -0
  40. package/dist/runtime/types/button.mjs +0 -0
  41. package/dist/runtime/types/form-group.d.ts +83 -0
  42. package/dist/runtime/types/form-group.mjs +0 -0
  43. package/dist/runtime/types/icon.d.ts +9 -0
  44. package/dist/runtime/types/icon.mjs +0 -0
  45. package/dist/runtime/types/index.d.ts +11 -0
  46. package/dist/runtime/types/index.mjs +11 -0
  47. package/dist/runtime/types/indicator.d.ts +45 -0
  48. package/dist/runtime/types/indicator.mjs +0 -0
  49. package/dist/runtime/types/input.d.ts +91 -0
  50. package/dist/runtime/types/input.mjs +0 -0
  51. package/dist/runtime/types/switch.d.ts +69 -0
  52. package/dist/runtime/types/switch.mjs +0 -0
  53. package/dist/runtime/utils/index.d.ts +19 -0
  54. package/dist/runtime/utils/index.mjs +36 -0
  55. package/dist/types.d.ts +15 -0
  56. package/package.json +58 -0
@@ -0,0 +1,95 @@
1
+ export interface NButtonProps {
2
+ /**
3
+ * Change the button type.
4
+ *
5
+ * @default 'button'
6
+ */
7
+ type?: 'button' | 'submit' | 'reset';
8
+ /**
9
+ * Change the loading placement of the button.
10
+ *
11
+ * @default 'leading'
12
+ */
13
+ loadingPlacement?: 'leading' | 'trailing' | 'label';
14
+ /**
15
+ * Convert `label` prop to icon component.
16
+ *
17
+ * @default false
18
+ * @example
19
+ * icon
20
+ * label="i-heroicons-information-circle"
21
+ */
22
+ icon?: boolean;
23
+ /**
24
+ * Disable the button.
25
+ *
26
+ * @default false
27
+ */
28
+ disabled?: boolean;
29
+ /**
30
+ * Swap the position of the leading and trailing icons.
31
+ *
32
+ * @default false
33
+ */
34
+ reverse?: boolean;
35
+ /**
36
+ * Show loading state on button
37
+ * @default false
38
+ */
39
+ loading?: boolean;
40
+ /**
41
+ * Change the button tag to `NuxtLink` component,
42
+ * This allows you to use `NuxtLink` available props.
43
+ *
44
+ * @see https://nuxt.com/docs/api/components/nuxt-link#props
45
+ * @example
46
+ * to="/"
47
+ */
48
+ to?: string;
49
+ /**
50
+ * Add a label to the button.
51
+ *
52
+ * @example
53
+ * label="Click me"
54
+ */
55
+ label?: string;
56
+ /**
57
+ * Allows you to add `UnaUI` button preset properties,
58
+ * Think of it as a shortcut for adding options or variants to the preset if available.
59
+ *
60
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/button.ts
61
+ * @example
62
+ * btn="solid-green block square"
63
+ */
64
+ btn?: string;
65
+ /**
66
+ * Add leading icon the button,
67
+ * This also allows you to add utility classes to the icon.
68
+ *
69
+ * @example
70
+ * leading="i-heroicons-information-circle text-green-500 dark:text-green-400 text-2xl"
71
+ */
72
+ leading?: string;
73
+ /**
74
+ * Add trailing icon the button.
75
+ * This also allows you to add utility classes to the icon.
76
+ *
77
+ * @example
78
+ * trailing="i-heroicons-information-circle text-green-500 dark:text-green-400 text-2xl"
79
+ */
80
+ trailing?: string;
81
+ /**
82
+ * `UnaUI` preset configuration
83
+ *
84
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/button.ts
85
+ */
86
+ una?: {
87
+ btn?: string;
88
+ btnLabel?: string;
89
+ btnIconLabel?: string;
90
+ btnLoading?: string;
91
+ btnTrailing?: string;
92
+ btnLeading?: string;
93
+ btnLoadingIcon?: string;
94
+ };
95
+ }
File without changes
@@ -0,0 +1,83 @@
1
+ export interface NFormGroupProps {
2
+ /**
3
+ * Update the form group status.
4
+ *
5
+ * @default null
6
+ */
7
+ status?: 'info' | 'success' | 'warning' | 'error';
8
+ /**
9
+ * Add a required indicator to the form group.
10
+ *
11
+ * @default false
12
+ */
13
+ required?: boolean;
14
+ /**
15
+ * Manually set the name attribute for the form group label.
16
+ * Slot children will inherit the name attribute as both `id` and `name` for accessibility.
17
+ *
18
+ * By default, the name attribute is generated randomly.
19
+ *
20
+ * @default randomId
21
+ * @example
22
+ * name="email"
23
+ */
24
+ name?: string;
25
+ /**
26
+ * Label for the form group.
27
+ *
28
+ * @example
29
+ * label="Email"
30
+ */
31
+ label?: string;
32
+ /**
33
+ * Display `hint` message for the form group.
34
+ *
35
+ * @example
36
+ * hint="Enter your email address"
37
+ */
38
+ hint?: string;
39
+ /**
40
+ * Display `Description` message for the form group.
41
+ *
42
+ * @example
43
+ * description="We will never share your email with anyone else."
44
+ */
45
+ description?: string;
46
+ /**
47
+ * Display `Message` for the form group.
48
+ * Useful for displaying validation errors.
49
+ *
50
+ * @example
51
+ * message="Email is required"
52
+ */
53
+ message?: string;
54
+ /**
55
+ * Display `counter` for the form group.
56
+ * Useful for displaying character count.
57
+ *
58
+ * @example
59
+ * counter="{ value: 0, max: 100 }"
60
+ */
61
+ counter?: {
62
+ value: number;
63
+ max?: number;
64
+ };
65
+ /**
66
+ * `UnaUI` preset configuration
67
+ *
68
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/form-group.ts
69
+ */
70
+ una?: {
71
+ formGroupTopWrapper?: string;
72
+ formGroupTopWrapperInner?: string;
73
+ formGroupBottomWrapper?: string;
74
+ formGroupCounterWrapper?: string;
75
+ formGroupMessageWrapper?: string;
76
+ formGroupLabelWrapper?: string;
77
+ formGroupLabel?: string;
78
+ formGroupDescription?: string;
79
+ formGroupHint?: string;
80
+ formGroupMessage?: string;
81
+ formGroupLabelRequired?: string;
82
+ };
83
+ }
File without changes
@@ -0,0 +1,9 @@
1
+ export interface NIconProps {
2
+ /**
3
+ * Icon name
4
+ *
5
+ * @example
6
+ * 'heroicons-chevron-up'
7
+ */
8
+ name: string;
9
+ }
File without changes
@@ -0,0 +1,11 @@
1
+ export * from './input';
2
+ export * from './button';
3
+ export * from './form-group';
4
+ export * from './icon';
5
+ export * from './accordion';
6
+ export * from './switch';
7
+ export * from './alert';
8
+ export * from './badge';
9
+ export * from './avatar';
10
+ export * from './avatar-group';
11
+ export * from './indicator';
@@ -0,0 +1,11 @@
1
+ export * from "./input.mjs";
2
+ export * from "./button.mjs";
3
+ export * from "./form-group.mjs";
4
+ export * from "./icon.mjs";
5
+ export * from "./accordion.mjs";
6
+ export * from "./switch.mjs";
7
+ export * from "./alert.mjs";
8
+ export * from "./badge.mjs";
9
+ export * from "./avatar.mjs";
10
+ export * from "./avatar-group.mjs";
11
+ export * from "./indicator.mjs";
@@ -0,0 +1,45 @@
1
+ export interface NIndicatorProps {
2
+ /**
3
+ * Set the size of the indicator.
4
+ *
5
+ * @default 'md'
6
+ */
7
+ size?: string;
8
+ /**
9
+ * Allows you to add `UnaUI` button preset properties,
10
+ * Think of it as a shortcut for adding options or variants to the preset if available.
11
+ *
12
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/indicator.ts
13
+ * @example
14
+ * indicator="solid-green top-right"
15
+ */
16
+ indicator?: string;
17
+ /**
18
+ * Add a label to the indicator.
19
+ *
20
+ * @example
21
+ * label="new"
22
+ */
23
+ label?: string;
24
+ /**
25
+ * Add ping animation to the indicator.
26
+ *
27
+ * @default false
28
+ */
29
+ ping?: boolean;
30
+ /**
31
+ * Set visibility of the indicator.
32
+ *
33
+ * @default true
34
+ */
35
+ visible?: boolean;
36
+ /**
37
+ * `UnaUI` preset configuration
38
+ *
39
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/indicator.ts
40
+ */
41
+ una?: {
42
+ indicator?: string;
43
+ indicatorWrapper?: string;
44
+ };
45
+ }
File without changes
@@ -0,0 +1,91 @@
1
+ export interface NInputProps {
2
+ /**
3
+ *
4
+ * @default null
5
+ */
6
+ type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url';
7
+ /**
8
+ * Update the input status.
9
+ * Useful for validations.
10
+ *
11
+ * @default null
12
+ */
13
+ status?: 'info' | 'success' | 'warning' | 'error';
14
+ /**
15
+ * Add loading state to the input.
16
+ *
17
+ * @default false
18
+ */
19
+ loading?: boolean;
20
+ /**
21
+ * Swap the position of the leading and trailing icons.
22
+ *
23
+ * @default false
24
+ */
25
+ reverse?: boolean;
26
+ /**
27
+ * Value of the input.
28
+ *
29
+ * @default null
30
+ */
31
+ modelValue?: string | number;
32
+ /**
33
+ * Display leading icon.
34
+ *
35
+ * @default null
36
+ */
37
+ leading?: string;
38
+ /**
39
+ * Display trailing icon.
40
+ *
41
+ * @default null
42
+ */
43
+ trailing?: string;
44
+ /**
45
+ * Allows you to add `UnaUI` input preset properties,
46
+ * Think of it as a shortcut for adding options or variants to the preset if available.
47
+ *
48
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/input.ts
49
+ * @example
50
+ * input="solid-green"
51
+ */
52
+ input?: string;
53
+ /**
54
+ * Allows you to change the size of the input.
55
+ *
56
+ * @default size="sm"
57
+ *
58
+ * @example
59
+ * size="sm" | size="2cm" | size="2rem" | size="2px"
60
+ */
61
+ size?: string;
62
+ /**
63
+ * Manually set the id attribute.
64
+ *
65
+ * By default, the id attribute is generated randomly for accessibility reasons.
66
+ *
67
+ * @default randomId
68
+ * @example
69
+ * id="email"
70
+ */
71
+ id?: string;
72
+ /**
73
+ * `UnaUI` preset configuration
74
+ *
75
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/input.ts
76
+ */
77
+ una?: {
78
+ input?: string;
79
+ inputLoading?: string;
80
+ inputTrailing?: string;
81
+ inputLeading?: string;
82
+ inputWrapper?: string;
83
+ inputLeadingWrapper?: string;
84
+ inputTrailingWrapper?: string;
85
+ inputWarningIcon?: string;
86
+ inputErrorIcon?: string;
87
+ inputSuccessIcon?: string;
88
+ inputInfoIcon?: string;
89
+ inputLoadingIcon?: string;
90
+ };
91
+ }
File without changes
@@ -0,0 +1,69 @@
1
+ export interface NSwitchProps {
2
+ /**
3
+ * Value of the switch.
4
+ *
5
+ * @default null
6
+ */
7
+ modelValue?: boolean;
8
+ /**
9
+ * Disable the switch from being clicked.
10
+ *
11
+ * @default false
12
+ */
13
+ disabled?: boolean;
14
+ /**
15
+ * Add a loading indicator to the switch.
16
+ * This will also disable the switch.
17
+ *
18
+ * @default false
19
+ */
20
+ loading?: boolean;
21
+ /**
22
+ * Display the slider thumb outside of the track.
23
+ *
24
+ * @default false
25
+ */
26
+ outset?: boolean;
27
+ /**
28
+ * Allows you to add `UnaUI` switch preset properties,
29
+ * Think of it as a shortcut for adding options or variants to the preset if available.
30
+ *
31
+ * @example
32
+ * switch="xl green focus"
33
+ */
34
+ switch?: string;
35
+ /**
36
+ * Allows you to display an icon when the switch is on.
37
+ * Accepts icon name and utility classes
38
+ *
39
+ * @example
40
+ * icon="i-heroicons-check-20-solid text-white"
41
+ */
42
+ onIcon?: string;
43
+ /**
44
+ * Allows you to display an icon when the switch is off.
45
+ * Accepts icon name and utility classes
46
+ *
47
+ * @example
48
+ * icon="i-heroicons-x-mark-20-solid text-white"
49
+ */
50
+ offIcon?: string;
51
+ /**
52
+ * `UnaUI` preset configuration
53
+ *
54
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/switch.ts
55
+ */
56
+ una?: {
57
+ switchThumb?: string;
58
+ switchThumbOn?: string;
59
+ switchThumbOff?: string;
60
+ switchTrack?: string;
61
+ switchTrackOn?: string;
62
+ switchTrackOff?: string;
63
+ switchIconBase?: string;
64
+ switchIconOn?: string;
65
+ switchIconOff?: string;
66
+ switchLoading?: string;
67
+ switchloadingicon?: string;
68
+ };
69
+ }
File without changes
@@ -0,0 +1,19 @@
1
+ export declare function rgbToHex(r: number, g: number, b: number): string;
2
+ export declare function hexToRgb(hex: string): [number, number, number];
3
+ export declare function randomId(prefix: string): string;
4
+ export declare function omitProps<T extends Record<string, any>>(obj: T, propsToOmit: Array<keyof T>): Partial<T>;
5
+ export declare function pickProps<T extends Record<string, any>>(obj: T, propsToPick: Array<keyof T>): Partial<T>;
6
+ /**
7
+ * We want to get the first non-undefined value,
8
+ * useful for arguments with multiple sources (local, global, default),
9
+ * this is basically an alternative for `local ?? global ?? default`.
10
+ * I prefer this approach because it's more readable and easier to extend for more sources.
11
+ *
12
+ * @param args - values to check
13
+ * @example
14
+ * ```ts
15
+ * const value = getPriority(specificValue, globalValue, defaultValue)
16
+ * ```
17
+ * @returns first non-undefined value
18
+ */
19
+ export declare function getPriority<T>(...args: (T | undefined)[]): T | undefined;
@@ -0,0 +1,36 @@
1
+ export function rgbToHex(r, g, b) {
2
+ return `#${[r, g, b].map((x) => {
3
+ const hex = x.toString(16);
4
+ return hex.length === 1 ? `0${hex}` : hex;
5
+ }).join("")}`;
6
+ }
7
+ export function hexToRgb(hex) {
8
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
9
+ if (!result)
10
+ throw new Error(`Invalid hex color: ${hex}`);
11
+ return [
12
+ Number.parseInt(result[1], 16),
13
+ Number.parseInt(result[2], 16),
14
+ Number.parseInt(result[3], 16)
15
+ ];
16
+ }
17
+ export function randomId(prefix) {
18
+ return `una-${prefix}-${Math.random().toString(36).slice(2)}`;
19
+ }
20
+ export function omitProps(obj, propsToOmit) {
21
+ const newObj = { ...obj };
22
+ propsToOmit.forEach((prop) => delete newObj[prop]);
23
+ return newObj;
24
+ }
25
+ export function pickProps(obj, propsToPick) {
26
+ const newObj = {};
27
+ propsToPick.forEach((prop) => newObj[prop] = obj[prop]);
28
+ return newObj;
29
+ }
30
+ export function getPriority(...args) {
31
+ for (const arg of args) {
32
+ if (arg !== void 0)
33
+ return arg;
34
+ }
35
+ return void 0;
36
+ }
@@ -0,0 +1,15 @@
1
+
2
+ import { ModuleOptions } from './module'
3
+
4
+ declare module '@nuxt/schema' {
5
+ interface NuxtConfig { ['una']?: Partial<ModuleOptions> }
6
+ interface NuxtOptions { ['una']?: ModuleOptions }
7
+ }
8
+
9
+ declare module 'nuxt/schema' {
10
+ interface NuxtConfig { ['una']?: Partial<ModuleOptions> }
11
+ interface NuxtOptions { ['una']?: ModuleOptions }
12
+ }
13
+
14
+
15
+ export { ModuleOptions, default } from './module'
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@una-ui/nuxt",
3
+ "type": "module",
4
+ "version": "0.1.0-beta.1",
5
+ "description": "Nuxt module for @una-ui",
6
+ "author": "Phojie Rengel <phojrengel@gmail.com>",
7
+ "license": "MIT",
8
+ "funding": "https://github.com/sponsors/phojie",
9
+ "homepage": "https://github.com/una-ui/una-ui/tree/main/packages/nuxt#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/una-ui/una-ui.git"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/module.mjs",
17
+ "require": "./dist/module.cjs"
18
+ }
19
+ },
20
+ "main": "./dist/module.cjs",
21
+ "types": "./dist/types.d.ts",
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "dependencies": {
26
+ "@headlessui/vue": "^1.7.16",
27
+ "@iconify-json/carbon": "^1.1.19",
28
+ "@iconify-json/heroicons": "^1.1.12",
29
+ "@iconify-json/tabler": "^1.1.87",
30
+ "@nuxt/kit": "^3.6.5",
31
+ "@nuxtjs/color-mode": "^3.3.0",
32
+ "@unocss/core": "^0.55.1",
33
+ "@unocss/nuxt": "^0.55.1",
34
+ "@unocss/preset-attributify": "^0.55.1",
35
+ "@unocss/preset-icons": "^0.55.1",
36
+ "@unocss/reset": "^0.55.1",
37
+ "@vueuse/core": "^10.3.0",
38
+ "@vueuse/integrations": "^10.3.0",
39
+ "@vueuse/nuxt": "^10.3.0",
40
+ "unocss": "^0.55.1",
41
+ "@una-ui/preset": "^0.1.0-beta.1"
42
+ },
43
+ "devDependencies": {
44
+ "@nuxt/module-builder": "^0.4.0",
45
+ "@nuxt/schema": "^3.6.5",
46
+ "nuxt": "^3.6.5"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "scripts": {
52
+ "build": "nuxt-build-module",
53
+ "stub": "nuxt-build-module --stub",
54
+ "dev": "nuxi dev playground",
55
+ "playground:build": "nuxi generate playground",
56
+ "playground:preview": "nuxi preview playground"
57
+ }
58
+ }