@revojs/ui 0.2.8 → 0.2.9
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/components/button.d.ts +3 -2
- package/dist/components/icon.d.ts +2 -1
- package/dist/components/input.d.ts +3 -2
- package/dist/components/navigate.d.ts +3 -2
- package/dist/module/icons.d.ts +2 -0
- package/dist/module/icons.js +12 -0
- package/dist/module/index.d.ts +1 -1
- package/dist/module/index.js +3 -13
- package/dist/types/index.d.ts +0 -7
- package/dist/vue/components/breadcrumb.vue +2 -4
- package/dist/vue/components/button.vue +18 -18
- package/dist/vue/components/card.vue +3 -9
- package/dist/vue/components/checkbox.vue +5 -11
- package/dist/vue/components/collection.vue +2 -10
- package/dist/vue/components/container.vue +2 -4
- package/dist/vue/components/counter.vue +7 -11
- package/dist/vue/components/dialog.vue +4 -18
- package/dist/vue/components/field.vue +3 -13
- package/dist/vue/components/heading.vue +7 -8
- package/dist/vue/components/icon.vue +3 -41
- package/dist/vue/components/input.vue +9 -19
- package/dist/vue/components/link.vue +8 -9
- package/dist/vue/components/navigate.vue +2 -13
- package/dist/vue/components/popover.vue +3 -11
- package/dist/vue/components/progress.vue +2 -9
- package/dist/vue/components/radio.vue +2 -18
- package/dist/vue/components/range.vue +2 -15
- package/dist/vue/components/rating.vue +4 -15
- package/dist/vue/components/select.vue +10 -17
- package/dist/vue/components/separator.vue +2 -10
- package/dist/vue/components/sheet.vue +4 -15
- package/dist/vue/components/switch.vue +2 -14
- package/dist/vue/components/upload.vue +2 -18
- package/package.json +5 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IconComponent } from "./icon";
|
|
1
2
|
export type ButtonType = "button" | "submit";
|
|
2
3
|
export type ButtonSize = "default" | "icon";
|
|
3
4
|
export type ButtonFont = "normal" | "medium" | "semibold";
|
|
@@ -5,8 +6,8 @@ export type ButtonLayout = "left" | "center" | "right";
|
|
|
5
6
|
export type ButtonText = "sm" | "md";
|
|
6
7
|
export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "destructive";
|
|
7
8
|
export interface ButtonProps {
|
|
8
|
-
iconPrefix?:
|
|
9
|
-
iconSuffix?:
|
|
9
|
+
iconPrefix?: IconComponent;
|
|
10
|
+
iconSuffix?: IconComponent;
|
|
10
11
|
label?: string;
|
|
11
12
|
font?: ButtonFont;
|
|
12
13
|
layout?: ButtonLayout;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { IconComponent } from "./icon";
|
|
1
2
|
export interface InputProps {
|
|
2
3
|
modelValue?: string | number;
|
|
3
4
|
type?: string;
|
|
4
|
-
iconPrefix?:
|
|
5
|
-
iconSuffix?:
|
|
5
|
+
iconPrefix?: IconComponent;
|
|
6
|
+
iconSuffix?: IconComponent;
|
|
6
7
|
placeholder?: string;
|
|
7
8
|
name?: string;
|
|
8
9
|
spellcheck?: boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { addTypes, defineModule } from "revojs/module";
|
|
2
|
+
import icons from "unplugin-icons/vite";
|
|
3
|
+
//#region src/module/icons.ts
|
|
4
|
+
var icons_default = defineModule({
|
|
5
|
+
name: "ui-icons",
|
|
6
|
+
setup(config) {
|
|
7
|
+
addTypes(config, "ui-icons", () => "import \"unplugin-icons/types/vue3\";");
|
|
8
|
+
return { vite: { plugins: [icons({ compiler: "vue3" })] } };
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { icons_default as default };
|
package/dist/module/index.d.ts
CHANGED
|
@@ -31,5 +31,5 @@ export interface UiConfig {
|
|
|
31
31
|
light: UiTheme;
|
|
32
32
|
dark: UiTheme;
|
|
33
33
|
}
|
|
34
|
-
declare const _default: import("revojs/module").Module<"ui", UiConfig, readonly [import("revojs/module").Module<"client", import("@revojs/client/module").ClientConfig, []>]>;
|
|
34
|
+
declare const _default: import("revojs/module").Module<"ui", UiConfig, readonly [import("revojs/module").Module<"client", import("@revojs/client/module").ClientConfig, []>, import("revojs/module").Module<"ui-icons", Record<string, never>, []>]>;
|
|
35
35
|
export default _default;
|
package/dist/module/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import icons_default from "./icons.js";
|
|
2
|
+
import { defineModule } from "revojs/module";
|
|
1
3
|
import client from "@revojs/client/module";
|
|
2
4
|
import tailwindcss from "@tailwindcss/vite";
|
|
3
|
-
import { readFileSync } from "fs";
|
|
4
|
-
import { addTypes, addVirtual, defineModule } from "revojs/module";
|
|
5
5
|
import colors from "tailwindcss/colors";
|
|
6
6
|
//#region src/module/index.ts
|
|
7
7
|
function themeVariables(theme) {
|
|
@@ -26,7 +26,7 @@ var radii = {
|
|
|
26
26
|
};
|
|
27
27
|
var module_default = defineModule({
|
|
28
28
|
name: "ui",
|
|
29
|
-
modules: [client],
|
|
29
|
+
modules: [client, icons_default],
|
|
30
30
|
config: () => ({
|
|
31
31
|
radius: "rounded-md",
|
|
32
32
|
light: {
|
|
@@ -73,16 +73,6 @@ var module_default = defineModule({
|
|
|
73
73
|
}
|
|
74
74
|
}),
|
|
75
75
|
setup(config) {
|
|
76
|
-
const manifest = JSON.parse(readFileSync("package.json", "utf8"));
|
|
77
|
-
const iconPackages = [...new Set(Object.keys({
|
|
78
|
-
...manifest.dependencies,
|
|
79
|
-
...manifest.devDependencies,
|
|
80
|
-
...manifest.optionalDependencies
|
|
81
|
-
}).filter((name) => name.startsWith("@iconify-json/")))].sort();
|
|
82
|
-
addVirtual(config, "ui/icons", () => {
|
|
83
|
-
return `export default {${iconPackages.map((name) => `${JSON.stringify(name.slice(14))}: () => import(${JSON.stringify(`${name}/icons.json`)}).then((module) => module.default)`).join(",")}};`;
|
|
84
|
-
});
|
|
85
|
-
addTypes(config, "ui-icons", () => "declare module \"#ui/icons\" { import type { IconifyJSON } from \"@iconify/types\"; const icons: Record<string, () => Promise<IconifyJSON>>; export default icons; }");
|
|
86
76
|
return {
|
|
87
77
|
client: { html: { head: { children: [{
|
|
88
78
|
tagName: "script",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,13 +5,6 @@ declare module "#config/ui" {
|
|
|
5
5
|
export default config;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
declare module "#ui/icons" {
|
|
9
|
-
import type { IconifyJSON } from "@iconify/types";
|
|
10
|
-
|
|
11
|
-
const icons: Record<string, () => Promise<IconifyJSON>>;
|
|
12
|
-
export default icons;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
8
|
declare module "*.vue" {
|
|
16
9
|
import type { DefineComponent } from "vue";
|
|
17
10
|
|
|
@@ -11,10 +11,8 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script setup lang="ts">
|
|
14
|
-
import type {
|
|
14
|
+
import type { BreadcrumbProps } from "../../components/breadcrumb";
|
|
15
15
|
import Link from "./link.vue";
|
|
16
16
|
|
|
17
|
-
defineProps<
|
|
18
|
-
routes: Array<BreadcrumbRoute>;
|
|
19
|
-
}>();
|
|
17
|
+
defineProps<BreadcrumbProps>();
|
|
20
18
|
</script>
|
|
@@ -6,44 +6,44 @@
|
|
|
6
6
|
:type="attributes.type ?? 'button'"
|
|
7
7
|
:disabled="disabled"
|
|
8
8
|
>
|
|
9
|
-
<Icon v-if="iconPrefix" :
|
|
9
|
+
<Icon v-if="iconPrefix" :is="iconPrefix" />
|
|
10
10
|
|
|
11
11
|
<slot>
|
|
12
12
|
<span v-if="label" class="truncate px-1" :class="labelLayouts[layout]">{{ label }}</span>
|
|
13
13
|
</slot>
|
|
14
14
|
|
|
15
|
-
<Icon v-if="iconSuffix" :
|
|
15
|
+
<Icon v-if="iconSuffix" :is="iconSuffix" />
|
|
16
16
|
</component>
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup lang="ts">
|
|
20
20
|
import { useAttrs, type Component } from "vue";
|
|
21
|
-
import type {
|
|
21
|
+
import type {
|
|
22
|
+
ButtonFont,
|
|
23
|
+
ButtonLayout,
|
|
24
|
+
ButtonProps,
|
|
25
|
+
ButtonSize,
|
|
26
|
+
ButtonText,
|
|
27
|
+
ButtonVariant,
|
|
28
|
+
} from "../../components/button";
|
|
22
29
|
import Icon from "./icon.vue";
|
|
23
30
|
|
|
24
31
|
const {
|
|
25
32
|
is = "button",
|
|
26
|
-
iconPrefix
|
|
27
|
-
iconSuffix
|
|
28
|
-
label
|
|
33
|
+
iconPrefix,
|
|
34
|
+
iconSuffix,
|
|
35
|
+
label,
|
|
29
36
|
font = "medium",
|
|
30
37
|
layout = "center",
|
|
31
38
|
size = "default",
|
|
32
39
|
text = "sm",
|
|
33
40
|
variant = "primary",
|
|
34
41
|
disabled = false,
|
|
35
|
-
} = defineProps<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
font?: ButtonFont;
|
|
41
|
-
layout?: ButtonLayout;
|
|
42
|
-
size?: ButtonSize;
|
|
43
|
-
text?: ButtonText;
|
|
44
|
-
variant?: ButtonVariant;
|
|
45
|
-
disabled?: boolean;
|
|
46
|
-
}>();
|
|
42
|
+
} = defineProps<
|
|
43
|
+
Omit<ButtonProps, "type"> & {
|
|
44
|
+
is?: string | Component;
|
|
45
|
+
}
|
|
46
|
+
>();
|
|
47
47
|
|
|
48
48
|
const attributes = useAttrs();
|
|
49
49
|
|
|
@@ -32,13 +32,7 @@
|
|
|
32
32
|
</template>
|
|
33
33
|
|
|
34
34
|
<script setup lang="ts">
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
description = undefined,
|
|
39
|
-
} = defineProps<{
|
|
40
|
-
label?: string;
|
|
41
|
-
title?: string;
|
|
42
|
-
description?: string;
|
|
43
|
-
}>();
|
|
35
|
+
import type { CardProps } from "../../components/card";
|
|
36
|
+
|
|
37
|
+
const { label, title, description } = defineProps<CardProps>();
|
|
44
38
|
</script>
|
|
@@ -32,23 +32,17 @@
|
|
|
32
32
|
|
|
33
33
|
<script setup lang="ts">
|
|
34
34
|
import { computed } from "vue";
|
|
35
|
+
import type { CheckboxProps } from "../../components/checkbox";
|
|
35
36
|
import type { ControlInteraction } from "../../components/control.ts";
|
|
36
37
|
|
|
37
38
|
const {
|
|
38
39
|
modelValue = false,
|
|
39
|
-
label
|
|
40
|
-
description
|
|
41
|
-
name
|
|
40
|
+
label,
|
|
41
|
+
description,
|
|
42
|
+
name,
|
|
42
43
|
required = false,
|
|
43
44
|
disabled = false,
|
|
44
|
-
} = defineProps<
|
|
45
|
-
modelValue?: boolean;
|
|
46
|
-
label?: string;
|
|
47
|
-
description?: string;
|
|
48
|
-
name?: string;
|
|
49
|
-
required?: boolean;
|
|
50
|
-
disabled?: boolean;
|
|
51
|
-
}>();
|
|
45
|
+
} = defineProps<CheckboxProps>();
|
|
52
46
|
|
|
53
47
|
defineEmits<{
|
|
54
48
|
"update:modelValue": [value: boolean];
|
|
@@ -16,17 +16,9 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script setup generic="T" lang="ts">
|
|
19
|
-
import type { CollectionColumns } from "../../components/collection
|
|
19
|
+
import type { CollectionColumns, CollectionProps } from "../../components/collection";
|
|
20
20
|
|
|
21
|
-
const {
|
|
22
|
-
items = undefined,
|
|
23
|
-
columns = 1,
|
|
24
|
-
emptyLabel = "Nothing found",
|
|
25
|
-
} = defineProps<{
|
|
26
|
-
items?: Array<T>;
|
|
27
|
-
columns?: CollectionColumns;
|
|
28
|
-
emptyLabel?: string;
|
|
29
|
-
}>();
|
|
21
|
+
const { items, columns = 1, emptyLabel = "Nothing found" } = defineProps<CollectionProps<T>>();
|
|
30
22
|
|
|
31
23
|
defineSlots<{
|
|
32
24
|
default: (() => unknown) & ((props: { item: T; index: number }) => unknown);
|
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import type { ContainerSize } from "../../components/container
|
|
8
|
+
import type { ContainerProps, ContainerSize } from "../../components/container";
|
|
9
9
|
|
|
10
|
-
const { size = "5xl" } = defineProps<
|
|
11
|
-
size?: ContainerSize;
|
|
12
|
-
}>();
|
|
10
|
+
const { size = "5xl" } = defineProps<ContainerProps>();
|
|
13
11
|
|
|
14
12
|
const sizes: Record<ContainerSize, string> = {
|
|
15
13
|
"3xl": "max-w-3xl",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
class="text-lg"
|
|
10
10
|
size="icon"
|
|
11
11
|
variant="ghost"
|
|
12
|
-
icon-prefix="
|
|
12
|
+
:icon-prefix="MinusIcon"
|
|
13
13
|
:disabled="disabled || modelValue <= min"
|
|
14
14
|
aria-label="Decrease"
|
|
15
15
|
@click="change(-step)"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
class="text-lg"
|
|
22
22
|
size="icon"
|
|
23
23
|
variant="ghost"
|
|
24
|
-
icon-prefix="
|
|
24
|
+
:icon-prefix="AddIcon"
|
|
25
25
|
:disabled="disabled || modelValue >= max"
|
|
26
26
|
aria-label="Increase"
|
|
27
27
|
@click="change(step)"
|
|
@@ -31,23 +31,19 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script setup lang="ts">
|
|
34
|
+
import AddIcon from "~icons/hugeicons/add-01";
|
|
35
|
+
import MinusIcon from "~icons/hugeicons/minus-sign";
|
|
36
|
+
import type { CounterProps } from "../../components/counter";
|
|
34
37
|
import Button from "./button.vue";
|
|
35
38
|
|
|
36
39
|
const {
|
|
37
40
|
modelValue = 0,
|
|
38
|
-
label
|
|
41
|
+
label,
|
|
39
42
|
min = -Infinity,
|
|
40
43
|
max = Infinity,
|
|
41
44
|
step = 1,
|
|
42
45
|
disabled = false,
|
|
43
|
-
} = defineProps<
|
|
44
|
-
modelValue?: number;
|
|
45
|
-
label?: string;
|
|
46
|
-
min?: number;
|
|
47
|
-
max?: number;
|
|
48
|
-
step?: number;
|
|
49
|
-
disabled?: boolean;
|
|
50
|
-
}>();
|
|
46
|
+
} = defineProps<CounterProps>();
|
|
51
47
|
|
|
52
48
|
const emit = defineEmits<{
|
|
53
49
|
"update:modelValue": [value: number];
|
|
@@ -7,13 +7,7 @@
|
|
|
7
7
|
>
|
|
8
8
|
<Card :title="title" :description="description" class="shadow-2xl">
|
|
9
9
|
<template #actions>
|
|
10
|
-
<Button
|
|
11
|
-
size="icon"
|
|
12
|
-
variant="ghost"
|
|
13
|
-
icon-prefix="multiplication-sign"
|
|
14
|
-
:aria-label="closeLabel"
|
|
15
|
-
@click="close"
|
|
16
|
-
/>
|
|
10
|
+
<Button size="icon" variant="ghost" :icon-prefix="CloseIcon" :aria-label="closeLabel" @click="close" />
|
|
17
11
|
</template>
|
|
18
12
|
<slot :open="open" :close="close" :toggle="toggle" />
|
|
19
13
|
|
|
@@ -25,21 +19,13 @@
|
|
|
25
19
|
</template>
|
|
26
20
|
|
|
27
21
|
<script setup lang="ts">
|
|
22
|
+
import CloseIcon from "~icons/hugeicons/multiplication-sign";
|
|
28
23
|
import { useTemplateRef, watchEffect } from "vue";
|
|
24
|
+
import type { DialogProps } from "../../components/dialog";
|
|
29
25
|
import Button from "./button.vue";
|
|
30
26
|
import Card from "./card.vue";
|
|
31
27
|
|
|
32
|
-
const {
|
|
33
|
-
modelValue = false,
|
|
34
|
-
title = undefined,
|
|
35
|
-
description = undefined,
|
|
36
|
-
closeLabel = "Close",
|
|
37
|
-
} = defineProps<{
|
|
38
|
-
modelValue?: boolean;
|
|
39
|
-
title?: string;
|
|
40
|
-
description?: string;
|
|
41
|
-
closeLabel?: string;
|
|
42
|
-
}>();
|
|
28
|
+
const { modelValue = false, title, description, closeLabel = "Close" } = defineProps<DialogProps>();
|
|
43
29
|
|
|
44
30
|
const emit = defineEmits<{
|
|
45
31
|
"update:modelValue": [value: boolean];
|
|
@@ -16,17 +16,7 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
error = undefined,
|
|
23
|
-
required = false,
|
|
24
|
-
disabled = false,
|
|
25
|
-
} = defineProps<{
|
|
26
|
-
label?: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
error?: string;
|
|
29
|
-
required?: boolean;
|
|
30
|
-
disabled?: boolean;
|
|
31
|
-
}>();
|
|
19
|
+
import type { FieldProps } from "../../components/field";
|
|
20
|
+
|
|
21
|
+
const { label, description, error, required = false, disabled = false } = defineProps<FieldProps>();
|
|
32
22
|
</script>
|
|
@@ -6,19 +6,18 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import type { Component } from "vue";
|
|
9
|
-
import type { HeadingLayout, HeadingText } from "../../components/heading
|
|
9
|
+
import type { HeadingLayout, HeadingProps, HeadingText } from "../../components/heading";
|
|
10
10
|
|
|
11
11
|
const {
|
|
12
12
|
is = "h2",
|
|
13
|
-
label
|
|
13
|
+
label,
|
|
14
14
|
text = "xl",
|
|
15
15
|
layout = "left",
|
|
16
|
-
} = defineProps<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}>();
|
|
16
|
+
} = defineProps<
|
|
17
|
+
HeadingProps & {
|
|
18
|
+
is?: string | Component;
|
|
19
|
+
}
|
|
20
|
+
>();
|
|
22
21
|
|
|
23
22
|
const layouts: Record<HeadingLayout, string> = {
|
|
24
23
|
left: "text-left",
|
|
@@ -1,49 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span aria-hidden="true" class="block size-[1em] shrink-0">
|
|
3
|
-
<component :is="
|
|
3
|
+
<component :is="is" class="block size-full" />
|
|
4
4
|
</span>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import
|
|
9
|
-
import { getIconData, iconToSVG, replaceIDs } from "@iconify/utils";
|
|
10
|
-
import { computed, defineAsyncComponent, h, markRaw } from "vue";
|
|
8
|
+
import type { IconProps } from "../../components/icon";
|
|
11
9
|
|
|
12
|
-
const {
|
|
13
|
-
name: string;
|
|
14
|
-
}>();
|
|
15
|
-
|
|
16
|
-
const icon = computed(() => {
|
|
17
|
-
const separator = name.indexOf(":");
|
|
18
|
-
const prefix = separator === -1 ? undefined : name.slice(0, separator);
|
|
19
|
-
const iconName = separator === -1 ? name : name.slice(separator + 1);
|
|
20
|
-
|
|
21
|
-
return defineAsyncComponent(async () => {
|
|
22
|
-
for (const [key, resolve] of Object.entries(iconSets)) {
|
|
23
|
-
if (prefix && key !== prefix) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const set = await resolve();
|
|
28
|
-
|
|
29
|
-
if (prefix && set.prefix !== prefix) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const data = getIconData(set, iconName);
|
|
34
|
-
|
|
35
|
-
if (data) {
|
|
36
|
-
const svg = iconToSVG(data);
|
|
37
|
-
const body = replaceIDs(svg.body);
|
|
38
|
-
|
|
39
|
-
return markRaw({
|
|
40
|
-
name: `${set.prefix}-${iconName}`,
|
|
41
|
-
render: () => h("svg", { ...svg.attributes, innerHTML: body }),
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return markRaw({ render: () => null });
|
|
47
|
-
});
|
|
48
|
-
});
|
|
10
|
+
const { is } = defineProps<IconProps>();
|
|
49
11
|
</script>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
>
|
|
6
6
|
<slot name="leading" />
|
|
7
7
|
|
|
8
|
-
<Icon v-if="iconPrefix" :
|
|
8
|
+
<Icon v-if="iconPrefix" :is="iconPrefix" />
|
|
9
9
|
|
|
10
10
|
<input
|
|
11
11
|
class="w-full min-w-0 appearance-none bg-transparent py-2 outline-none placeholder:opacity-50"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
@input="input"
|
|
21
21
|
/>
|
|
22
22
|
|
|
23
|
-
<Icon v-if="iconSuffix" :
|
|
23
|
+
<Icon v-if="iconSuffix" :is="iconSuffix" />
|
|
24
24
|
|
|
25
25
|
<slot name="trailing" />
|
|
26
26
|
</span>
|
|
@@ -29,31 +29,21 @@
|
|
|
29
29
|
<script setup lang="ts">
|
|
30
30
|
import { computed } from "vue";
|
|
31
31
|
import type { ControlInteraction } from "../../components/control.ts";
|
|
32
|
+
import type { InputProps } from "../../components/input";
|
|
32
33
|
import Icon from "./icon.vue";
|
|
33
34
|
|
|
34
35
|
const {
|
|
35
|
-
modelValue
|
|
36
|
+
modelValue,
|
|
36
37
|
type = "text",
|
|
37
|
-
iconPrefix
|
|
38
|
-
iconSuffix
|
|
39
|
-
placeholder
|
|
40
|
-
name
|
|
38
|
+
iconPrefix,
|
|
39
|
+
iconSuffix,
|
|
40
|
+
placeholder,
|
|
41
|
+
name,
|
|
41
42
|
spellcheck = undefined,
|
|
42
43
|
required = false,
|
|
43
44
|
readonly = false,
|
|
44
45
|
disabled = false,
|
|
45
|
-
} = defineProps<
|
|
46
|
-
modelValue?: string | number;
|
|
47
|
-
type?: string;
|
|
48
|
-
iconPrefix?: string;
|
|
49
|
-
iconSuffix?: string;
|
|
50
|
-
placeholder?: string;
|
|
51
|
-
name?: string;
|
|
52
|
-
spellcheck?: boolean;
|
|
53
|
-
required?: boolean;
|
|
54
|
-
readonly?: boolean;
|
|
55
|
-
disabled?: boolean;
|
|
56
|
-
}>();
|
|
46
|
+
} = defineProps<InputProps>();
|
|
57
47
|
|
|
58
48
|
const emit = defineEmits<{
|
|
59
49
|
"update:modelValue": [value: string | number];
|
|
@@ -11,19 +11,18 @@
|
|
|
11
11
|
|
|
12
12
|
<script setup lang="ts">
|
|
13
13
|
import type { Component } from "vue";
|
|
14
|
-
import type { LinkVariant } from "../../components/link
|
|
14
|
+
import type { LinkProps, LinkVariant } from "../../components/link";
|
|
15
15
|
|
|
16
16
|
const {
|
|
17
17
|
is = "a",
|
|
18
|
-
href
|
|
19
|
-
label
|
|
18
|
+
href,
|
|
19
|
+
label,
|
|
20
20
|
variant = "primary",
|
|
21
|
-
} = defineProps<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}>();
|
|
21
|
+
} = defineProps<
|
|
22
|
+
LinkProps & {
|
|
23
|
+
is?: string | Component;
|
|
24
|
+
}
|
|
25
|
+
>();
|
|
27
26
|
|
|
28
27
|
const variants: Record<LinkVariant, string> = {
|
|
29
28
|
primary: "text-foreground",
|
|
@@ -12,19 +12,8 @@
|
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script setup lang="ts">
|
|
15
|
+
import type { NavigateProps } from "../../components/navigate";
|
|
15
16
|
import Button from "./button.vue";
|
|
16
17
|
|
|
17
|
-
const {
|
|
18
|
-
href,
|
|
19
|
-
label = undefined,
|
|
20
|
-
iconPrefix = undefined,
|
|
21
|
-
iconSuffix = undefined,
|
|
22
|
-
active = false,
|
|
23
|
-
} = defineProps<{
|
|
24
|
-
href: string;
|
|
25
|
-
label?: string;
|
|
26
|
-
iconPrefix?: string;
|
|
27
|
-
iconSuffix?: string;
|
|
28
|
-
active?: boolean;
|
|
29
|
-
}>();
|
|
18
|
+
const { href, label, iconPrefix, iconSuffix, active = false } = defineProps<NavigateProps>();
|
|
30
19
|
</script>
|
|
@@ -26,26 +26,18 @@
|
|
|
26
26
|
|
|
27
27
|
<script setup lang="ts">
|
|
28
28
|
import { ref, useId, useTemplateRef, watchEffect } from "vue";
|
|
29
|
-
import type {
|
|
29
|
+
import type { PopoverProps } from "../../components/popover";
|
|
30
30
|
import Button from "./button.vue";
|
|
31
31
|
|
|
32
32
|
const {
|
|
33
33
|
modelValue = false,
|
|
34
34
|
triggerLabel = "Open",
|
|
35
|
-
triggerClass
|
|
35
|
+
triggerClass,
|
|
36
36
|
triggerLayout = "center",
|
|
37
37
|
contentClass = "p-4",
|
|
38
38
|
matchTriggerWidth = false,
|
|
39
39
|
disabled = false,
|
|
40
|
-
} = defineProps<
|
|
41
|
-
modelValue?: boolean;
|
|
42
|
-
triggerLabel?: string;
|
|
43
|
-
triggerClass?: string;
|
|
44
|
-
triggerLayout?: ButtonLayout;
|
|
45
|
-
contentClass?: string;
|
|
46
|
-
matchTriggerWidth?: boolean;
|
|
47
|
-
disabled?: boolean;
|
|
48
|
-
}>();
|
|
40
|
+
} = defineProps<PopoverProps>();
|
|
49
41
|
|
|
50
42
|
const emit = defineEmits<{
|
|
51
43
|
"update:modelValue": [value: boolean];
|
|
@@ -23,16 +23,9 @@
|
|
|
23
23
|
|
|
24
24
|
<script setup lang="ts">
|
|
25
25
|
import { computed } from "vue";
|
|
26
|
+
import type { ProgressProps } from "../../components/progress";
|
|
26
27
|
|
|
27
|
-
const {
|
|
28
|
-
value = 0,
|
|
29
|
-
max = 100,
|
|
30
|
-
label = undefined,
|
|
31
|
-
} = defineProps<{
|
|
32
|
-
value?: number;
|
|
33
|
-
max?: number;
|
|
34
|
-
label?: string;
|
|
35
|
-
}>();
|
|
28
|
+
const { value = 0, max = 100, label } = defineProps<ProgressProps>();
|
|
36
29
|
|
|
37
30
|
const percent = computed(() => (max > 0 ? Math.min(100, Math.max(0, (value / max) * 100)) : 0));
|
|
38
31
|
</script>
|
|
@@ -32,25 +32,9 @@
|
|
|
32
32
|
<script setup lang="ts">
|
|
33
33
|
import { computed } from "vue";
|
|
34
34
|
import type { ControlInteraction } from "../../components/control.ts";
|
|
35
|
-
import type { RadioValue } from "../../components/radio
|
|
35
|
+
import type { RadioProps, RadioValue } from "../../components/radio";
|
|
36
36
|
|
|
37
|
-
const {
|
|
38
|
-
modelValue = undefined,
|
|
39
|
-
value,
|
|
40
|
-
label = undefined,
|
|
41
|
-
description = undefined,
|
|
42
|
-
name = undefined,
|
|
43
|
-
required = false,
|
|
44
|
-
disabled = false,
|
|
45
|
-
} = defineProps<{
|
|
46
|
-
modelValue?: RadioValue;
|
|
47
|
-
value: RadioValue;
|
|
48
|
-
label?: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
name?: string;
|
|
51
|
-
required?: boolean;
|
|
52
|
-
disabled?: boolean;
|
|
53
|
-
}>();
|
|
37
|
+
const { modelValue, value, label, description, name, required = false, disabled = false } = defineProps<RadioProps>();
|
|
54
38
|
|
|
55
39
|
defineEmits<{
|
|
56
40
|
"update:modelValue": [value: RadioValue];
|
|
@@ -38,22 +38,9 @@
|
|
|
38
38
|
<script setup lang="ts">
|
|
39
39
|
import { computed, useTemplateRef } from "vue";
|
|
40
40
|
import type { ControlInteraction } from "../../components/control.ts";
|
|
41
|
+
import type { RangeProps } from "../../components/range";
|
|
41
42
|
|
|
42
|
-
const {
|
|
43
|
-
modelValue = 0,
|
|
44
|
-
label = undefined,
|
|
45
|
-
min = 0,
|
|
46
|
-
max = 100,
|
|
47
|
-
step = 1,
|
|
48
|
-
disabled = false,
|
|
49
|
-
} = defineProps<{
|
|
50
|
-
modelValue?: number;
|
|
51
|
-
label?: string;
|
|
52
|
-
min?: number;
|
|
53
|
-
max?: number;
|
|
54
|
-
step?: number;
|
|
55
|
-
disabled?: boolean;
|
|
56
|
-
}>();
|
|
43
|
+
const { modelValue = 0, label, min = 0, max = 100, step = 1, disabled = false } = defineProps<RangeProps>();
|
|
57
44
|
|
|
58
45
|
const emit = defineEmits<{
|
|
59
46
|
"update:modelValue": [value: number];
|
|
@@ -16,30 +16,19 @@
|
|
|
16
16
|
:disabled="readonly || disabled"
|
|
17
17
|
@click="$emit('update:modelValue', value)"
|
|
18
18
|
>
|
|
19
|
-
<Icon
|
|
19
|
+
<Icon :is="StarIcon" />
|
|
20
20
|
</Button>
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script setup lang="ts">
|
|
26
|
+
import StarIcon from "~icons/hugeicons/star";
|
|
26
27
|
import Button from "./button.vue";
|
|
27
28
|
import Icon from "./icon.vue";
|
|
28
|
-
import type { RatingState } from "../../components/rating
|
|
29
|
+
import type { RatingProps, RatingState } from "../../components/rating";
|
|
29
30
|
|
|
30
|
-
const {
|
|
31
|
-
modelValue = 0,
|
|
32
|
-
max = 5,
|
|
33
|
-
label = undefined,
|
|
34
|
-
readonly = false,
|
|
35
|
-
disabled = false,
|
|
36
|
-
} = defineProps<{
|
|
37
|
-
modelValue?: number;
|
|
38
|
-
max?: number;
|
|
39
|
-
label?: string;
|
|
40
|
-
readonly?: boolean;
|
|
41
|
-
disabled?: boolean;
|
|
42
|
-
}>();
|
|
31
|
+
const { modelValue = 0, max = 5, label, readonly = false, disabled = false } = defineProps<RatingProps>();
|
|
43
32
|
|
|
44
33
|
defineEmits<{
|
|
45
34
|
"update:modelValue": [value: number];
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
:disabled="disabled"
|
|
39
39
|
@click.stop="open = !open"
|
|
40
40
|
>
|
|
41
|
-
<Icon
|
|
41
|
+
<Icon :is="ArrowDownIcon" />
|
|
42
42
|
</button>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
{{ option.label }}
|
|
69
69
|
</slot>
|
|
70
70
|
|
|
71
|
-
<Icon v-if="option.value === modelValue"
|
|
71
|
+
<Icon v-if="option.value === modelValue" :is="TickIcon" />
|
|
72
72
|
</span>
|
|
73
73
|
</Button>
|
|
74
74
|
|
|
@@ -81,30 +81,23 @@
|
|
|
81
81
|
</template>
|
|
82
82
|
|
|
83
83
|
<script setup lang="ts">
|
|
84
|
+
import ArrowDownIcon from "~icons/hugeicons/arrow-down-01";
|
|
85
|
+
import TickIcon from "~icons/hugeicons/tick-02";
|
|
84
86
|
import { computed, nextTick, onMounted, onUnmounted, ref, useId, useTemplateRef, watch } from "vue";
|
|
85
|
-
import type { SelectOption, SelectValue } from "../../components/select
|
|
87
|
+
import type { SelectOption, SelectProps, SelectValue } from "../../components/select";
|
|
86
88
|
import Button from "./button.vue";
|
|
87
89
|
import Icon from "./icon.vue";
|
|
88
90
|
|
|
89
91
|
const {
|
|
90
|
-
modelValue
|
|
92
|
+
modelValue,
|
|
91
93
|
options,
|
|
92
|
-
label
|
|
93
|
-
placeholder
|
|
94
|
+
label,
|
|
95
|
+
placeholder,
|
|
94
96
|
emptyLabel = "No results found",
|
|
95
|
-
name
|
|
97
|
+
name,
|
|
96
98
|
required = false,
|
|
97
99
|
disabled = false,
|
|
98
|
-
} = defineProps<
|
|
99
|
-
modelValue?: SelectValue;
|
|
100
|
-
options: Array<SelectOption>;
|
|
101
|
-
label?: string;
|
|
102
|
-
placeholder?: string;
|
|
103
|
-
emptyLabel?: string;
|
|
104
|
-
name?: string;
|
|
105
|
-
required?: boolean;
|
|
106
|
-
disabled?: boolean;
|
|
107
|
-
}>();
|
|
100
|
+
} = defineProps<SelectProps>();
|
|
108
101
|
|
|
109
102
|
const emit = defineEmits<{
|
|
110
103
|
"update:modelValue": [value: SelectValue];
|
|
@@ -9,17 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
<script setup lang="ts">
|
|
11
11
|
import { computed } from "vue";
|
|
12
|
-
import type {
|
|
12
|
+
import type { SeparatorOrientation, SeparatorProps } from "../../components/separator";
|
|
13
13
|
|
|
14
|
-
const {
|
|
15
|
-
orientation = "horizontal",
|
|
16
|
-
variant = undefined,
|
|
17
|
-
decorative = false,
|
|
18
|
-
} = defineProps<{
|
|
19
|
-
orientation?: SeparatorOrientation;
|
|
20
|
-
variant?: DividerVariant;
|
|
21
|
-
decorative?: boolean;
|
|
22
|
-
}>();
|
|
14
|
+
const { orientation = "horizontal", variant, decorative = false } = defineProps<SeparatorProps>();
|
|
23
15
|
|
|
24
16
|
const selected = computed(() => variant ?? orientation);
|
|
25
17
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<Button
|
|
12
12
|
size="icon"
|
|
13
13
|
variant="ghost"
|
|
14
|
-
icon-prefix="
|
|
14
|
+
:icon-prefix="CloseIcon"
|
|
15
15
|
:aria-label="closeLabel"
|
|
16
16
|
@click="sheet?.close()"
|
|
17
17
|
/>
|
|
@@ -29,24 +29,13 @@
|
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script setup lang="ts">
|
|
32
|
+
import CloseIcon from "~icons/hugeicons/multiplication-sign";
|
|
32
33
|
import { useTemplateRef, watchEffect } from "vue";
|
|
33
|
-
import type { SheetSide } from "../../components/sheet
|
|
34
|
+
import type { SheetProps, SheetSide } from "../../components/sheet";
|
|
34
35
|
import Button from "./button.vue";
|
|
35
36
|
import Card from "./card.vue";
|
|
36
37
|
|
|
37
|
-
const {
|
|
38
|
-
modelValue = false,
|
|
39
|
-
side = "right",
|
|
40
|
-
title = undefined,
|
|
41
|
-
description = undefined,
|
|
42
|
-
closeLabel = "Close",
|
|
43
|
-
} = defineProps<{
|
|
44
|
-
modelValue?: boolean;
|
|
45
|
-
side?: SheetSide;
|
|
46
|
-
title?: string;
|
|
47
|
-
description?: string;
|
|
48
|
-
closeLabel?: string;
|
|
49
|
-
}>();
|
|
38
|
+
const { modelValue = false, side = "right", title, description, closeLabel = "Close" } = defineProps<SheetProps>();
|
|
50
39
|
|
|
51
40
|
defineEmits<{
|
|
52
41
|
"update:modelValue": [value: boolean];
|
|
@@ -27,21 +27,9 @@
|
|
|
27
27
|
<script setup lang="ts">
|
|
28
28
|
import { computed } from "vue";
|
|
29
29
|
import type { ControlInteraction } from "../../components/control.ts";
|
|
30
|
-
import type { SwitchState } from "../../components/switch
|
|
30
|
+
import type { SwitchProps, SwitchState } from "../../components/switch";
|
|
31
31
|
|
|
32
|
-
const {
|
|
33
|
-
modelValue = false,
|
|
34
|
-
label = undefined,
|
|
35
|
-
description = undefined,
|
|
36
|
-
name = undefined,
|
|
37
|
-
disabled = false,
|
|
38
|
-
} = defineProps<{
|
|
39
|
-
modelValue?: boolean;
|
|
40
|
-
label?: string;
|
|
41
|
-
description?: string;
|
|
42
|
-
name?: string;
|
|
43
|
-
disabled?: boolean;
|
|
44
|
-
}>();
|
|
32
|
+
const { modelValue = false, label, description, name, disabled = false } = defineProps<SwitchProps>();
|
|
45
33
|
|
|
46
34
|
defineEmits<{
|
|
47
35
|
"update:modelValue": [value: boolean];
|
|
@@ -44,26 +44,10 @@
|
|
|
44
44
|
<script setup lang="ts">
|
|
45
45
|
import { computed, ref, useTemplateRef } from "vue";
|
|
46
46
|
import type { ControlInteraction } from "../../components/control.ts";
|
|
47
|
-
import type { UploadState } from "../../components/upload
|
|
47
|
+
import type { UploadProps, UploadState } from "../../components/upload";
|
|
48
48
|
import Button from "./button.vue";
|
|
49
49
|
|
|
50
|
-
const {
|
|
51
|
-
modelValue = undefined,
|
|
52
|
-
label = undefined,
|
|
53
|
-
description = undefined,
|
|
54
|
-
accept = undefined,
|
|
55
|
-
name = undefined,
|
|
56
|
-
required = false,
|
|
57
|
-
disabled = false,
|
|
58
|
-
} = defineProps<{
|
|
59
|
-
modelValue?: Blob | File;
|
|
60
|
-
label?: string;
|
|
61
|
-
description?: string;
|
|
62
|
-
accept?: string;
|
|
63
|
-
name?: string;
|
|
64
|
-
required?: boolean;
|
|
65
|
-
disabled?: boolean;
|
|
66
|
-
}>();
|
|
50
|
+
const { modelValue, label, description, accept, name, required = false, disabled = false } = defineProps<UploadProps>();
|
|
67
51
|
|
|
68
52
|
const emit = defineEmits<{
|
|
69
53
|
"update:modelValue": [value?: Blob | File];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revojs/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,15 +30,16 @@
|
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "vite build",
|
|
33
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
33
34
|
"watch": "vite build --watch"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@iconify/
|
|
37
|
-
"@iconify/utils": "^3.1.7",
|
|
37
|
+
"@iconify-json/hugeicons": "^1.2.35",
|
|
38
38
|
"@revojs/client": "*",
|
|
39
39
|
"@tailwindcss/vite": "^4.3.3",
|
|
40
40
|
"revojs": "*",
|
|
41
|
-
"tailwindcss": "^4.3.3"
|
|
41
|
+
"tailwindcss": "^4.3.3",
|
|
42
|
+
"unplugin-icons": "^24.0.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@revojs/tsconfig": "*",
|