@revojs/ui 0.2.7 → 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 +4 -3
- 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 +37 -47
- package/dist/types/index.d.ts +0 -7
- package/dist/vue/components/breadcrumb.vue +2 -4
- package/dist/vue/components/button.vue +26 -26
- package/dist/vue/components/card.vue +7 -10
- package/dist/vue/components/checkbox.vue +17 -12
- 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 +3 -14
- package/dist/vue/components/popover.vue +3 -11
- package/dist/vue/components/progress.vue +3 -10
- package/dist/vue/components/radio.vue +12 -20
- package/dist/vue/components/range.vue +99 -29
- package/dist/vue/components/rating.vue +6 -17
- package/dist/vue/components/select.vue +84 -61
- package/dist/vue/components/separator.vue +2 -10
- package/dist/vue/components/sheet.vue +17 -21
- package/dist/vue/components/switch.vue +6 -21
- package/dist/vue/components/upload.vue +2 -18
- package/package.json +5 -4
|
@@ -1,12 +1,13 @@
|
|
|
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";
|
|
4
5
|
export type ButtonLayout = "left" | "center" | "right";
|
|
5
6
|
export type ButtonText = "sm" | "md";
|
|
6
|
-
export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "destructive"
|
|
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,63 +26,53 @@ 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: {
|
|
33
33
|
background: "white",
|
|
34
|
-
foreground: "
|
|
34
|
+
foreground: "zinc-950",
|
|
35
35
|
card: "white",
|
|
36
|
-
cardForeground: "
|
|
36
|
+
cardForeground: "zinc-950",
|
|
37
37
|
popover: "white",
|
|
38
|
-
popoverForeground: "
|
|
39
|
-
primary: "
|
|
40
|
-
primaryForeground: "
|
|
41
|
-
secondary: "
|
|
42
|
-
secondaryForeground: "
|
|
43
|
-
muted: "
|
|
44
|
-
mutedForeground: "
|
|
45
|
-
accent: "
|
|
46
|
-
accentForeground: "
|
|
38
|
+
popoverForeground: "zinc-950",
|
|
39
|
+
primary: "green-600",
|
|
40
|
+
primaryForeground: "zinc-50",
|
|
41
|
+
secondary: "zinc-100",
|
|
42
|
+
secondaryForeground: "zinc-900",
|
|
43
|
+
muted: "zinc-100",
|
|
44
|
+
mutedForeground: "zinc-500",
|
|
45
|
+
accent: "zinc-100",
|
|
46
|
+
accentForeground: "zinc-900",
|
|
47
47
|
destructive: "red-600",
|
|
48
|
-
destructiveForeground: "
|
|
49
|
-
border: "
|
|
50
|
-
input: "
|
|
51
|
-
ring: "
|
|
48
|
+
destructiveForeground: "zinc-50",
|
|
49
|
+
border: "zinc-200",
|
|
50
|
+
input: "zinc-200",
|
|
51
|
+
ring: "zinc-400"
|
|
52
52
|
},
|
|
53
53
|
dark: {
|
|
54
|
-
background: "
|
|
55
|
-
foreground: "
|
|
56
|
-
card: "
|
|
57
|
-
cardForeground: "
|
|
58
|
-
popover: "
|
|
59
|
-
popoverForeground: "
|
|
60
|
-
primary: "
|
|
61
|
-
primaryForeground: "
|
|
62
|
-
secondary: "
|
|
63
|
-
secondaryForeground: "
|
|
64
|
-
muted: "
|
|
65
|
-
mutedForeground: "
|
|
66
|
-
accent: "
|
|
67
|
-
accentForeground: "
|
|
68
|
-
destructive: "red-
|
|
69
|
-
destructiveForeground: "
|
|
70
|
-
border: "
|
|
71
|
-
input: "
|
|
72
|
-
ring: "
|
|
54
|
+
background: "zinc-950",
|
|
55
|
+
foreground: "zinc-50",
|
|
56
|
+
card: "zinc-900",
|
|
57
|
+
cardForeground: "zinc-50",
|
|
58
|
+
popover: "zinc-900",
|
|
59
|
+
popoverForeground: "zinc-50",
|
|
60
|
+
primary: "green-500",
|
|
61
|
+
primaryForeground: "zinc-950",
|
|
62
|
+
secondary: "zinc-900",
|
|
63
|
+
secondaryForeground: "zinc-50",
|
|
64
|
+
muted: "zinc-800",
|
|
65
|
+
mutedForeground: "zinc-400",
|
|
66
|
+
accent: "zinc-900",
|
|
67
|
+
accentForeground: "zinc-50",
|
|
68
|
+
destructive: "red-600",
|
|
69
|
+
destructiveForeground: "zinc-50",
|
|
70
|
+
border: "zinc-700",
|
|
71
|
+
input: "zinc-700",
|
|
72
|
+
ring: "zinc-500"
|
|
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>
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
3
|
:is="is"
|
|
4
|
-
class="inline-flex cursor-pointer items-center justify-center gap-2 rounded-ui border
|
|
4
|
+
class="inline-flex cursor-pointer items-center justify-center gap-2 rounded-ui border font-[inherit] font-medium leading-normal no-underline outline-ring transition-[background-color,border-color,color,opacity] duration-150 focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50"
|
|
5
5
|
:class="[fonts[font], layouts[layout], sizes[size], texts[text], variants[variant]]"
|
|
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
|
|
|
@@ -76,12 +76,12 @@ const texts: Record<ButtonText, string> = {
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
const variants: Record<ButtonVariant, string> = {
|
|
79
|
-
primary: "bg-primary text-primary-foreground",
|
|
80
|
-
secondary: "bg-secondary text-secondary-foreground",
|
|
81
|
-
outline:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
primary: "border-transparent bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80",
|
|
80
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 active:bg-secondary/80",
|
|
81
|
+
outline:
|
|
82
|
+
"border-transparent bg-secondary text-secondary-foreground ring-1 ring-border ring-inset hover:bg-secondary/90 active:bg-secondary/80",
|
|
83
|
+
ghost: "border-transparent bg-transparent text-foreground hover:bg-accent active:bg-accent/80",
|
|
84
|
+
destructive:
|
|
85
|
+
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/90 active:bg-destructive/80",
|
|
86
86
|
};
|
|
87
87
|
</script>
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
>
|
|
9
9
|
<slot name="header">
|
|
10
10
|
<div class="flex flex-col gap-1.5">
|
|
11
|
-
<
|
|
11
|
+
<p v-if="label" class="text-xs font-semibold uppercase tracking-widest opacity-50">{{ label }}</p>
|
|
12
|
+
|
|
13
|
+
<h3 v-if="title" class="text-lg font-semibold leading-none">{{ title }}</h3>
|
|
14
|
+
|
|
12
15
|
<p v-if="description" class="text-sm opacity-70">{{ description }}</p>
|
|
13
16
|
</div>
|
|
14
17
|
</slot>
|
|
@@ -29,13 +32,7 @@
|
|
|
29
32
|
</template>
|
|
30
33
|
|
|
31
34
|
<script setup lang="ts">
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
description = undefined,
|
|
36
|
-
} = defineProps<{
|
|
37
|
-
label?: string;
|
|
38
|
-
title?: string;
|
|
39
|
-
description?: string;
|
|
40
|
-
}>();
|
|
35
|
+
import type { CardProps } from "../../components/card";
|
|
36
|
+
|
|
37
|
+
const { label, title, description } = defineProps<CardProps>();
|
|
41
38
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<label class="inline-flex items-start gap-3" :class="interactionVariants[interaction]">
|
|
3
3
|
<input
|
|
4
|
-
class="
|
|
4
|
+
class="peer sr-only"
|
|
5
5
|
type="checkbox"
|
|
6
6
|
:checked="modelValue"
|
|
7
7
|
:name="name"
|
|
@@ -10,6 +10,17 @@
|
|
|
10
10
|
@change="$emit('update:modelValue', ($event.currentTarget as HTMLInputElement).checked)"
|
|
11
11
|
/>
|
|
12
12
|
|
|
13
|
+
<span
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
class="mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border transition-colors peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-ring"
|
|
16
|
+
:class="modelValue ? 'border-transparent bg-primary' : 'border-input bg-background'"
|
|
17
|
+
>
|
|
18
|
+
<span
|
|
19
|
+
v-if="modelValue"
|
|
20
|
+
class="mb-px h-2.5 w-1.5 rotate-45 border-b-2 border-r-2 border-primary-foreground"
|
|
21
|
+
/>
|
|
22
|
+
</span>
|
|
23
|
+
|
|
13
24
|
<span v-if="label || description || $slots.default" class="flex flex-col gap-0.5">
|
|
14
25
|
<span class="text-sm font-medium"
|
|
15
26
|
><slot>{{ label }}</slot></span
|
|
@@ -21,23 +32,17 @@
|
|
|
21
32
|
|
|
22
33
|
<script setup lang="ts">
|
|
23
34
|
import { computed } from "vue";
|
|
35
|
+
import type { CheckboxProps } from "../../components/checkbox";
|
|
24
36
|
import type { ControlInteraction } from "../../components/control.ts";
|
|
25
37
|
|
|
26
38
|
const {
|
|
27
39
|
modelValue = false,
|
|
28
|
-
label
|
|
29
|
-
description
|
|
30
|
-
name
|
|
40
|
+
label,
|
|
41
|
+
description,
|
|
42
|
+
name,
|
|
31
43
|
required = false,
|
|
32
44
|
disabled = false,
|
|
33
|
-
} = defineProps<
|
|
34
|
-
modelValue?: boolean;
|
|
35
|
-
label?: string;
|
|
36
|
-
description?: string;
|
|
37
|
-
name?: string;
|
|
38
|
-
required?: boolean;
|
|
39
|
-
disabled?: boolean;
|
|
40
|
-
}>();
|
|
45
|
+
} = defineProps<CheckboxProps>();
|
|
41
46
|
|
|
42
47
|
defineEmits<{
|
|
43
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>
|