@nuxt/ui 2.9.0 → 2.11.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 +11 -0
- package/dist/module.d.mts +449 -72
- package/dist/module.d.ts +449 -72
- package/dist/module.json +1 -1
- package/dist/module.mjs +32 -6
- package/dist/runtime/components/data/Table.vue +8 -6
- package/dist/runtime/components/data/Table.vue.d.ts +2 -1
- package/dist/runtime/components/elements/Accordion.vue +15 -13
- package/dist/runtime/components/elements/Accordion.vue.d.ts +5 -2
- package/dist/runtime/components/elements/Alert.vue +7 -6
- package/dist/runtime/components/elements/Alert.vue.d.ts +6 -5
- package/dist/runtime/components/elements/Avatar.vue.d.ts +5 -4
- package/dist/runtime/components/elements/AvatarGroup.d.ts +4 -3
- package/dist/runtime/components/elements/Badge.vue +4 -2
- package/dist/runtime/components/elements/Badge.vue.d.ts +5 -5
- package/dist/runtime/components/elements/Button.vue +8 -6
- package/dist/runtime/components/elements/Button.vue.d.ts +7 -7
- package/dist/runtime/components/elements/ButtonGroup.d.ts +5 -4
- package/dist/runtime/components/elements/ButtonGroup.mjs +19 -32
- package/dist/runtime/components/elements/Chip.vue +85 -0
- package/dist/runtime/components/elements/Chip.vue.d.ts +90 -0
- package/dist/runtime/components/elements/Dropdown.vue +45 -25
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +8 -0
- package/dist/runtime/components/elements/Icon.vue +16 -2
- package/dist/runtime/components/elements/Icon.vue.d.ts +14 -2
- package/dist/runtime/components/elements/Kbd.vue.d.ts +5 -4
- package/dist/runtime/components/elements/Link.vue +2 -5
- package/dist/runtime/components/elements/Meter.vue +166 -0
- package/dist/runtime/components/elements/Meter.vue.d.ts +123 -0
- package/dist/runtime/components/elements/MeterGroup.d.ts +78 -0
- package/dist/runtime/components/elements/MeterGroup.mjs +172 -0
- package/dist/runtime/components/elements/Progress.vue +284 -0
- package/dist/runtime/components/elements/Progress.vue.d.ts +2 -0
- package/dist/runtime/components/forms/Checkbox.vue +2 -4
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +6 -6
- package/dist/runtime/components/forms/Form.vue +32 -7
- package/dist/runtime/components/forms/Form.vue.d.ts +2 -1
- package/dist/runtime/components/forms/FormGroup.vue +7 -3
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +15 -5
- package/dist/runtime/components/forms/Input.vue +41 -6
- package/dist/runtime/components/forms/Input.vue.d.ts +42 -10
- package/dist/runtime/components/forms/Radio.vue +16 -9
- package/dist/runtime/components/forms/Radio.vue.d.ts +8 -7
- package/dist/runtime/components/forms/RadioGroup.vue +136 -0
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +118 -0
- package/dist/runtime/components/forms/Range.vue.d.ts +8 -7
- package/dist/runtime/components/forms/Select.vue +5 -2
- package/dist/runtime/components/forms/Select.vue.d.ts +10 -9
- package/dist/runtime/components/forms/SelectMenu.vue +80 -58
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +23 -13
- package/dist/runtime/components/forms/Textarea.vue +38 -4
- package/dist/runtime/components/forms/Textarea.vue.d.ts +41 -9
- package/dist/runtime/components/forms/Toggle.vue +19 -1
- package/dist/runtime/components/forms/Toggle.vue.d.ts +16 -3
- package/dist/runtime/components/layout/Divider.vue +107 -0
- package/dist/runtime/components/layout/Divider.vue.d.ts +82 -0
- package/dist/runtime/components/navigation/Breadcrumb.vue +78 -0
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +50 -0
- package/dist/runtime/components/navigation/CommandPalette.vue +18 -7
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +2 -2
- package/dist/runtime/components/navigation/Pagination.vue +65 -9
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +45 -7
- package/dist/runtime/components/navigation/Tabs.vue +1 -1
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/ContextMenu.vue +7 -2
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +2 -1
- package/dist/runtime/components/overlays/Modal.vue +1 -1
- package/dist/runtime/components/overlays/Modal.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Notification.vue +32 -27
- package/dist/runtime/components/overlays/Notification.vue.d.ts +4 -3
- package/dist/runtime/components/overlays/Notifications.vue +16 -14
- package/dist/runtime/components/overlays/Popover.vue +31 -7
- package/dist/runtime/components/overlays/Popover.vue.d.ts +27 -2
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Tooltip.vue +16 -10
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +1 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.mjs +8 -4
- package/dist/runtime/composables/useButtonGroup.d.ts +20 -0
- package/dist/runtime/composables/useButtonGroup.mjs +52 -0
- package/dist/runtime/composables/useFormGroup.d.ts +6 -4
- package/dist/runtime/composables/useFormGroup.mjs +19 -7
- package/dist/runtime/composables/usePopper.d.ts +3 -3
- package/dist/runtime/composables/usePopper.mjs +7 -1
- package/dist/runtime/composables/useShortcuts.d.ts +2 -2
- package/dist/runtime/composables/useUI.d.ts +2 -2
- package/dist/runtime/composables/useUI.mjs +2 -2
- package/dist/runtime/types/alert.d.ts +7 -0
- package/dist/runtime/types/avatar.d.ts +3 -1
- package/dist/runtime/types/badge.d.ts +5 -4
- package/dist/runtime/types/breadcrumb.d.ts +7 -0
- package/dist/runtime/types/button.d.ts +5 -4
- package/dist/runtime/types/chip.d.ts +11 -0
- package/dist/runtime/types/command-palette.d.ts +1 -0
- package/dist/runtime/types/dropdown.d.ts +2 -2
- package/dist/runtime/types/form-group.d.ts +5 -0
- package/dist/runtime/types/form.d.ts +14 -6
- package/dist/runtime/types/index.d.ts +12 -0
- package/dist/runtime/types/input.d.ts +8 -0
- package/dist/runtime/types/kbd.d.ts +5 -0
- package/dist/runtime/types/meter.d.ts +5 -0
- package/dist/runtime/types/popper.d.ts +1 -0
- package/dist/runtime/types/progress.d.ts +4 -0
- package/dist/runtime/types/range.d.ts +5 -0
- package/dist/runtime/types/select.d.ts +8 -0
- package/dist/runtime/types/textarea.d.ts +8 -0
- package/dist/runtime/types/toggle.d.ts +5 -0
- package/dist/runtime/types/utils.d.ts +22 -5
- package/dist/runtime/ui.config/_popperArrow.d.ts +9 -0
- package/dist/runtime/ui.config/_popperArrow.mjs +8 -0
- package/dist/runtime/ui.config/data/table.d.ts +60 -0
- package/dist/runtime/ui.config/data/table.mjs +59 -0
- package/dist/runtime/ui.config/elements/accordion.d.ts +21 -0
- package/dist/runtime/ui.config/elements/accordion.mjs +20 -0
- package/dist/runtime/ui.config/elements/alert.d.ts +40 -0
- package/dist/runtime/ui.config/elements/alert.mjs +39 -0
- package/dist/runtime/ui.config/elements/avatar.d.ts +60 -0
- package/dist/runtime/ui.config/elements/avatar.mjs +59 -0
- package/dist/runtime/ui.config/elements/avatarGroup.d.ts +6 -0
- package/dist/runtime/ui.config/elements/avatarGroup.mjs +5 -0
- package/dist/runtime/ui.config/elements/badge.d.ts +34 -0
- package/dist/runtime/ui.config/elements/badge.mjs +33 -0
- package/dist/runtime/ui.config/elements/button.d.ts +77 -0
- package/dist/runtime/ui.config/elements/button.mjs +76 -0
- package/dist/runtime/ui.config/elements/buttonGroup.d.ts +9 -0
- package/dist/runtime/ui.config/elements/buttonGroup.mjs +8 -0
- package/dist/runtime/ui.config/elements/chip.d.ts +35 -0
- package/dist/runtime/ui.config/elements/chip.mjs +34 -0
- package/dist/runtime/ui.config/elements/dropdown.d.ts +53 -0
- package/dist/runtime/ui.config/elements/dropdown.mjs +51 -0
- package/dist/runtime/ui.config/elements/kbd.d.ts +17 -0
- package/dist/runtime/ui.config/elements/kbd.mjs +16 -0
- package/dist/runtime/ui.config/elements/meter.d.ts +77 -0
- package/dist/runtime/ui.config/elements/meter.mjs +76 -0
- package/dist/runtime/ui.config/elements/meterGroup.d.ts +12 -0
- package/dist/runtime/ui.config/elements/meterGroup.mjs +11 -0
- package/dist/runtime/ui.config/elements/progress.d.ts +75 -0
- package/dist/runtime/ui.config/elements/progress.mjs +74 -0
- package/dist/runtime/ui.config/forms/checkbox.d.ts +16 -0
- package/dist/runtime/ui.config/forms/checkbox.mjs +15 -0
- package/dist/runtime/ui.config/forms/formGroup.d.ts +25 -0
- package/dist/runtime/ui.config/forms/formGroup.mjs +25 -0
- package/dist/runtime/ui.config/forms/input.d.ts +105 -0
- package/dist/runtime/ui.config/forms/input.mjs +104 -0
- package/dist/runtime/ui.config/forms/radio.d.ts +15 -0
- package/dist/runtime/ui.config/forms/radio.mjs +14 -0
- package/dist/runtime/ui.config/forms/radioGroup.d.ts +8 -0
- package/dist/runtime/ui.config/forms/radioGroup.mjs +7 -0
- package/dist/runtime/ui.config/forms/range.d.ts +64 -0
- package/dist/runtime/ui.config/forms/range.mjs +63 -0
- package/dist/runtime/ui.config/forms/select.d.ts +106 -0
- package/dist/runtime/ui.config/forms/select.mjs +12 -0
- package/dist/runtime/ui.config/forms/selectMenu.d.ts +63 -0
- package/dist/runtime/ui.config/forms/selectMenu.mjs +61 -0
- package/dist/runtime/ui.config/forms/textarea.d.ts +104 -0
- package/dist/runtime/ui.config/forms/textarea.mjs +9 -0
- package/dist/runtime/ui.config/forms/toggle.d.ts +61 -0
- package/dist/runtime/ui.config/forms/toggle.mjs +60 -0
- package/dist/runtime/ui.config/index.d.ts +40 -0
- package/dist/runtime/ui.config/index.mjs +40 -0
- package/dist/runtime/ui.config/layout/card.d.ts +24 -0
- package/dist/runtime/ui.config/layout/card.mjs +23 -0
- package/dist/runtime/ui.config/layout/container.d.ts +6 -0
- package/dist/runtime/ui.config/layout/container.mjs +5 -0
- package/dist/runtime/ui.config/layout/divider.d.ts +30 -0
- package/dist/runtime/ui.config/layout/divider.mjs +29 -0
- package/dist/runtime/ui.config/layout/skeleton.d.ts +6 -0
- package/dist/runtime/ui.config/layout/skeleton.mjs +5 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +20 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.mjs +19 -0
- package/dist/runtime/ui.config/navigation/commandPalette.d.ts +68 -0
- package/dist/runtime/ui.config/navigation/commandPalette.mjs +67 -0
- package/dist/runtime/ui.config/navigation/pagination.d.ts +35 -0
- package/dist/runtime/ui.config/navigation/pagination.mjs +34 -0
- package/dist/runtime/ui.config/navigation/tabs.d.ts +34 -0
- package/dist/runtime/ui.config/navigation/tabs.mjs +33 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +28 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +27 -0
- package/dist/runtime/ui.config/overlays/contextMenu.d.ts +31 -0
- package/dist/runtime/ui.config/overlays/contextMenu.mjs +25 -0
- package/dist/runtime/ui.config/overlays/modal.d.ts +35 -0
- package/dist/runtime/ui.config/overlays/modal.mjs +36 -0
- package/dist/runtime/ui.config/overlays/notification.d.ts +49 -0
- package/dist/runtime/ui.config/overlays/notification.mjs +49 -0
- package/dist/runtime/ui.config/overlays/notifications.d.ts +7 -0
- package/dist/runtime/ui.config/overlays/notifications.mjs +6 -0
- package/dist/runtime/ui.config/overlays/popover.d.ts +42 -0
- package/dist/runtime/ui.config/overlays/popover.mjs +36 -0
- package/dist/runtime/ui.config/overlays/slideover.d.ts +27 -0
- package/dist/runtime/ui.config/overlays/slideover.mjs +28 -0
- package/dist/runtime/ui.config/overlays/tooltip.d.ts +32 -0
- package/dist/runtime/ui.config/overlays/tooltip.mjs +26 -0
- package/dist/runtime/utils/index.d.ts +5 -0
- package/dist/runtime/utils/index.mjs +6 -2
- package/dist/types.d.mts +3 -2
- package/dist/types.d.ts +3 -2
- package/package.json +41 -28
- package/dist/runtime/ui.config.d.ts +0 -1207
- package/dist/runtime/ui.config.mjs +0 -1029
- package/dist/runtime/utils/StateEmitter.d.ts +0 -17
- package/dist/runtime/utils/StateEmitter.mjs +0 -21
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { h,
|
|
1
|
+
import { h, computed, toRef, defineComponent } from "vue";
|
|
2
2
|
import { twMerge, twJoin } from "tailwind-merge";
|
|
3
3
|
import { useUI } from "../../composables/useUI.mjs";
|
|
4
4
|
import { mergeConfig, getSlotsChildren } from "../../utils/index.mjs";
|
|
5
|
+
import { useProvideButtonGroup } from "../../composables/useButtonGroup.mjs";
|
|
5
6
|
import appConfig from "#build/app.config";
|
|
6
7
|
import { button, buttonGroup } from "#ui/ui.config";
|
|
7
8
|
const buttonConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.button, button);
|
|
8
9
|
const buttonGroupConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.buttonGroup, buttonGroup);
|
|
9
10
|
export default defineComponent({
|
|
11
|
+
name: "ButtonGroup",
|
|
10
12
|
inheritAttrs: false,
|
|
11
13
|
props: {
|
|
12
14
|
size: {
|
|
@@ -35,36 +37,6 @@ export default defineComponent({
|
|
|
35
37
|
setup(props, { slots }) {
|
|
36
38
|
const { ui, attrs } = useUI("buttonGroup", toRef(props, "ui"), buttonGroupConfig);
|
|
37
39
|
const children = computed(() => getSlotsChildren(slots));
|
|
38
|
-
const rounded = computed(() => {
|
|
39
|
-
const roundedMap = {
|
|
40
|
-
"rounded-none": { horizontal: { left: "rounded-s-none", right: "rounded-e-none" }, vertical: { top: "rounded-t-none", bottom: "rounded-b-none" } },
|
|
41
|
-
"rounded-sm": { horizontal: { left: "rounded-s-sm", right: "rounded-e-sm" }, vertical: { top: "rounded-t-sm", bottom: "rounded-b-sm" } },
|
|
42
|
-
rounded: { horizontal: { left: "rounded-s", right: "rounded-e" }, vertical: { top: "rounded-t", bottom: "rounded-b" } },
|
|
43
|
-
"rounded-md": { horizontal: { left: "rounded-s-md", right: "rounded-e-md" }, vertical: { top: "rounded-t-md", bottom: "rounded-b-md" } },
|
|
44
|
-
"rounded-lg": { horizontal: { left: "rounded-s-lg", right: "rounded-e-lg" }, vertical: { top: "rounded-t-lg", bottom: "rounded-b-lg" } },
|
|
45
|
-
"rounded-xl": { horizontal: { left: "rounded-s-xl", right: "rounded-e-xl" }, vertical: { top: "rounded-t-xl", bottom: "rounded-b-xl" } },
|
|
46
|
-
"rounded-2xl": { horizontal: { left: "rounded-s-2xl", right: "rounded-e-2xl" }, vertical: { top: "rounded-t-2xl", bottom: "rounded-b-2xl" } },
|
|
47
|
-
"rounded-3xl": { horizontal: { left: "rounded-s-3xl", right: "rounded-e-3xl" }, vertical: { top: "rounded-t-3xl", bottom: "rounded-b-3xl" } },
|
|
48
|
-
"rounded-full": { horizontal: { left: "rounded-s-full", right: "rounded-e-full" }, vertical: { top: "rounded-t-full", bottom: "rounded-b-full" } }
|
|
49
|
-
};
|
|
50
|
-
return roundedMap[ui.value.rounded][props.orientation];
|
|
51
|
-
});
|
|
52
|
-
const clones = computed(() => children.value.map((node, index) => {
|
|
53
|
-
const vProps = {};
|
|
54
|
-
if (props.size) {
|
|
55
|
-
vProps.size = props.size;
|
|
56
|
-
}
|
|
57
|
-
vProps.ui = node.props?.ui || {};
|
|
58
|
-
vProps.ui.rounded = "rounded-none";
|
|
59
|
-
vProps.ui.base = "!shadow-none";
|
|
60
|
-
if (index === 0) {
|
|
61
|
-
vProps.ui.rounded += ` ${rounded.value.left || rounded.value.top}`;
|
|
62
|
-
}
|
|
63
|
-
if (index === children.value.length - 1) {
|
|
64
|
-
vProps.ui.rounded += ` ${rounded.value.right || rounded.value.bottom}`;
|
|
65
|
-
}
|
|
66
|
-
return cloneVNode(node, vProps);
|
|
67
|
-
}));
|
|
68
40
|
const wrapperClass = computed(() => {
|
|
69
41
|
return twMerge(twJoin(
|
|
70
42
|
ui.value.wrapper[props.orientation],
|
|
@@ -72,6 +44,21 @@ export default defineComponent({
|
|
|
72
44
|
ui.value.shadow
|
|
73
45
|
), props.class);
|
|
74
46
|
});
|
|
75
|
-
|
|
47
|
+
const rounded = computed(() => {
|
|
48
|
+
const roundedMap = {
|
|
49
|
+
"rounded-none": { horizontal: { start: "rounded-s-none", end: "rounded-e-none" }, vertical: { start: "rounded-t-none", end: "rounded-b-none" } },
|
|
50
|
+
"rounded-sm": { horizontal: { start: "rounded-s-sm", end: "rounded-e-sm" }, vertical: { start: "rounded-t-sm", end: "rounded-b-sm" } },
|
|
51
|
+
rounded: { horizontal: { start: "rounded-s", end: "rounded-e" }, vertical: { start: "rounded-t", end: "rounded-b" } },
|
|
52
|
+
"rounded-md": { horizontal: { start: "rounded-s-md", end: "rounded-e-md" }, vertical: { start: "rounded-t-md", end: "rounded-b-md" } },
|
|
53
|
+
"rounded-lg": { horizontal: { start: "rounded-s-lg", end: "rounded-e-lg" }, vertical: { start: "rounded-t-lg", end: "rounded-b-lg" } },
|
|
54
|
+
"rounded-xl": { horizontal: { start: "rounded-s-xl", end: "rounded-e-xl" }, vertical: { start: "rounded-t-xl", end: "rounded-b-xl" } },
|
|
55
|
+
"rounded-2xl": { horizontal: { start: "rounded-s-2xl", end: "rounded-e-2xl" }, vertical: { start: "rounded-t-2xl", end: "rounded-b-2xl" } },
|
|
56
|
+
"rounded-3xl": { horizontal: { start: "rounded-s-3xl", end: "rounded-e-3xl" }, vertical: { start: "rounded-t-3xl", end: "rounded-b-3xl" } },
|
|
57
|
+
"rounded-full": { horizontal: { start: "rounded-s-full", end: "rounded-e-full" }, vertical: { start: "rounded-t-full", end: "rounded-b-full" } }
|
|
58
|
+
};
|
|
59
|
+
return roundedMap[ui.value.rounded][props.orientation];
|
|
60
|
+
});
|
|
61
|
+
useProvideButtonGroup({ orientation: toRef(props, "orientation"), size: toRef(props, "size"), ui, rounded });
|
|
62
|
+
return () => h("div", { class: wrapperClass.value, ...attrs.value }, children.value);
|
|
76
63
|
}
|
|
77
64
|
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="ui.wrapper" v-bind="attrs">
|
|
3
|
+
<slot />
|
|
4
|
+
|
|
5
|
+
<span v-if="show" :class="chipClass">
|
|
6
|
+
<slot name="content">
|
|
7
|
+
{{ text }}
|
|
8
|
+
</slot>
|
|
9
|
+
</span>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import { defineComponent, computed, toRef } from "vue";
|
|
15
|
+
import { twJoin } from "tailwind-merge";
|
|
16
|
+
import { useUI } from "../../composables/useUI";
|
|
17
|
+
import { mergeConfig } from "../../utils";
|
|
18
|
+
import appConfig from "#build/app.config";
|
|
19
|
+
import { chip } from "#ui/ui.config";
|
|
20
|
+
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.chip, chip);
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
inheritAttrs: false,
|
|
23
|
+
props: {
|
|
24
|
+
size: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: () => config.default.size,
|
|
27
|
+
validator(value) {
|
|
28
|
+
return Object.keys(config.size).includes(value);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
color: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: () => config.default.color,
|
|
34
|
+
validator(value) {
|
|
35
|
+
return ["gray", ...appConfig.ui.colors].includes(value);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
position: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: () => config.default.position,
|
|
41
|
+
validator(value) {
|
|
42
|
+
return Object.keys(config.position).includes(value);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
text: {
|
|
46
|
+
type: [String, Number],
|
|
47
|
+
default: null
|
|
48
|
+
},
|
|
49
|
+
inset: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: () => config.default.inset
|
|
52
|
+
},
|
|
53
|
+
show: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: true
|
|
56
|
+
},
|
|
57
|
+
class: {
|
|
58
|
+
type: [String, Object, Array],
|
|
59
|
+
default: void 0
|
|
60
|
+
},
|
|
61
|
+
ui: {
|
|
62
|
+
type: Object,
|
|
63
|
+
default: void 0
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
setup(props) {
|
|
67
|
+
const { ui, attrs } = useUI("chip", toRef(props, "ui"), config, toRef(props, "class"));
|
|
68
|
+
const chipClass = computed(() => {
|
|
69
|
+
return twJoin(
|
|
70
|
+
ui.value.base,
|
|
71
|
+
ui.value.size[props.size],
|
|
72
|
+
ui.value.position[props.position],
|
|
73
|
+
props.inset ? null : ui.value.translate[props.position],
|
|
74
|
+
ui.value.background.replaceAll("{color}", props.color)
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
79
|
+
ui,
|
|
80
|
+
attrs,
|
|
81
|
+
chipClass
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
</script>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
size: {
|
|
4
|
+
type: PropType<"sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl">;
|
|
5
|
+
default: () => any;
|
|
6
|
+
validator(value: string): boolean;
|
|
7
|
+
};
|
|
8
|
+
color: {
|
|
9
|
+
type: PropType<any>;
|
|
10
|
+
default: () => any;
|
|
11
|
+
validator(value: string): boolean;
|
|
12
|
+
};
|
|
13
|
+
position: {
|
|
14
|
+
type: PropType<"top-right" | "bottom-right" | "top-left" | "bottom-left">;
|
|
15
|
+
default: () => any;
|
|
16
|
+
validator(value: string): boolean;
|
|
17
|
+
};
|
|
18
|
+
text: {
|
|
19
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
20
|
+
default: null;
|
|
21
|
+
};
|
|
22
|
+
inset: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: () => any;
|
|
25
|
+
};
|
|
26
|
+
show: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
class: {
|
|
31
|
+
type: PropType<any>;
|
|
32
|
+
default: undefined;
|
|
33
|
+
};
|
|
34
|
+
ui: {
|
|
35
|
+
type: PropType<Partial<any>>;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
}, {
|
|
39
|
+
ui: import("vue").ComputedRef<any>;
|
|
40
|
+
attrs: import("vue").ComputedRef<Pick<{
|
|
41
|
+
[x: string]: unknown;
|
|
42
|
+
}, string>>;
|
|
43
|
+
chipClass: import("vue").ComputedRef<string>;
|
|
44
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
|
+
size: {
|
|
46
|
+
type: PropType<"sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl">;
|
|
47
|
+
default: () => any;
|
|
48
|
+
validator(value: string): boolean;
|
|
49
|
+
};
|
|
50
|
+
color: {
|
|
51
|
+
type: PropType<any>;
|
|
52
|
+
default: () => any;
|
|
53
|
+
validator(value: string): boolean;
|
|
54
|
+
};
|
|
55
|
+
position: {
|
|
56
|
+
type: PropType<"top-right" | "bottom-right" | "top-left" | "bottom-left">;
|
|
57
|
+
default: () => any;
|
|
58
|
+
validator(value: string): boolean;
|
|
59
|
+
};
|
|
60
|
+
text: {
|
|
61
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
62
|
+
default: null;
|
|
63
|
+
};
|
|
64
|
+
inset: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: () => any;
|
|
67
|
+
};
|
|
68
|
+
show: {
|
|
69
|
+
type: BooleanConstructor;
|
|
70
|
+
default: boolean;
|
|
71
|
+
};
|
|
72
|
+
class: {
|
|
73
|
+
type: PropType<any>;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
ui: {
|
|
77
|
+
type: PropType<Partial<any>>;
|
|
78
|
+
default: undefined;
|
|
79
|
+
};
|
|
80
|
+
}>>, {
|
|
81
|
+
size: "sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl";
|
|
82
|
+
ui: Partial<any>;
|
|
83
|
+
color: any;
|
|
84
|
+
class: any;
|
|
85
|
+
text: string | number;
|
|
86
|
+
position: "top-right" | "bottom-right" | "top-left" | "bottom-left";
|
|
87
|
+
inset: boolean;
|
|
88
|
+
show: boolean;
|
|
89
|
+
}, {}>;
|
|
90
|
+
export default _default;
|
|
@@ -17,41 +17,48 @@
|
|
|
17
17
|
|
|
18
18
|
<div v-if="open && items.length" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
|
|
19
19
|
<Transition appear v-bind="ui.transition">
|
|
20
|
-
<
|
|
21
|
-
<div v-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
<div>
|
|
21
|
+
<div v-if="popper.arrow" data-popper-arrow :class="['invisible before:visible before:block before:rotate-45 before:z-[-1]', Object.values(ui.arrow)]" />
|
|
22
|
+
<HMenuItems :class="[ui.base, ui.divide, ui.ring, ui.rounded, ui.shadow, ui.background, ui.height]" static>
|
|
23
|
+
<div v-for="(subItems, index) of items" :key="index" :class="ui.padding">
|
|
24
|
+
<NuxtLink v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ href, target, rel, navigate, isExternal }" v-bind="omit(item, ['label', 'slot', 'icon', 'iconClass', 'avatar', 'shortcuts', 'disabled', 'click'])" custom>
|
|
25
|
+
<HMenuItem v-slot="{ active, disabled: itemDisabled, close }" :disabled="item.disabled">
|
|
26
|
+
<component
|
|
27
|
+
:is="!!href ? 'a' : 'button'"
|
|
28
|
+
:href="!itemDisabled ? href : undefined"
|
|
29
|
+
:rel="rel"
|
|
30
|
+
:target="target"
|
|
31
|
+
:class="[ui.item.base, ui.item.padding, ui.item.size, ui.item.rounded, active ? ui.item.active : ui.item.inactive, itemDisabled && ui.item.disabled]"
|
|
32
|
+
@click="onClick($event, item, { href, navigate, close, isExternal })"
|
|
33
|
+
>
|
|
34
|
+
<slot :name="item.slot || 'item'" :item="item">
|
|
35
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="[ui.item.icon.base, active ? ui.item.icon.active : ui.item.icon.inactive, item.iconClass]" />
|
|
36
|
+
<UAvatar v-else-if="item.avatar" v-bind="{ size: ui.item.avatar.size, ...item.avatar }" :class="ui.item.avatar.base" />
|
|
31
37
|
|
|
32
|
-
|
|
38
|
+
<span class="truncate">{{ item.label }}</span>
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
<span v-if="item.shortcuts?.length" :class="ui.item.shortcuts">
|
|
41
|
+
<UKbd v-for="shortcut of item.shortcuts" :key="shortcut">{{ shortcut }}</UKbd>
|
|
42
|
+
</span>
|
|
43
|
+
</slot>
|
|
44
|
+
</component>
|
|
45
|
+
</HMenuItem>
|
|
46
|
+
</NuxtLink>
|
|
47
|
+
</div>
|
|
48
|
+
</HMenuItems>
|
|
49
|
+
</div>
|
|
42
50
|
</Transition>
|
|
43
51
|
</div>
|
|
44
52
|
</HMenu>
|
|
45
53
|
</template>
|
|
46
54
|
|
|
47
55
|
<script>
|
|
48
|
-
import { defineComponent, ref, computed, toRef, onMounted } from "vue";
|
|
56
|
+
import { defineComponent, ref, computed, toRef, onMounted, resolveComponent } from "vue";
|
|
49
57
|
import { Menu as HMenu, MenuButton as HMenuButton, MenuItems as HMenuItems, MenuItem as HMenuItem } from "@headlessui/vue";
|
|
50
58
|
import { defu } from "defu";
|
|
51
59
|
import UIcon from "../elements/Icon.vue";
|
|
52
60
|
import UAvatar from "../elements/Avatar.vue";
|
|
53
61
|
import UKbd from "../elements/Kbd.vue";
|
|
54
|
-
import ULink from "../elements/Link.vue";
|
|
55
62
|
import { useUI } from "../../composables/useUI";
|
|
56
63
|
import { usePopper } from "../../composables/usePopper";
|
|
57
64
|
import { mergeConfig, omit } from "../../utils";
|
|
@@ -66,8 +73,7 @@ export default defineComponent({
|
|
|
66
73
|
HMenuItem,
|
|
67
74
|
UIcon,
|
|
68
75
|
UAvatar,
|
|
69
|
-
UKbd
|
|
70
|
-
ULink
|
|
76
|
+
UKbd
|
|
71
77
|
},
|
|
72
78
|
inheritAttrs: false,
|
|
73
79
|
props: {
|
|
@@ -158,16 +164,30 @@ export default defineComponent({
|
|
|
158
164
|
closeTimeout = null;
|
|
159
165
|
}, props.closeDelay);
|
|
160
166
|
}
|
|
167
|
+
function onClick(e, item, { href, navigate, close, isExternal }) {
|
|
168
|
+
if (item.click) {
|
|
169
|
+
item.click(e);
|
|
170
|
+
}
|
|
171
|
+
if (href && !isExternal) {
|
|
172
|
+
navigate(e);
|
|
173
|
+
close();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const NuxtLink = resolveComponent("NuxtLink");
|
|
161
177
|
return {
|
|
162
178
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
163
179
|
ui,
|
|
164
180
|
attrs,
|
|
181
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
182
|
+
popper,
|
|
165
183
|
trigger,
|
|
166
184
|
container,
|
|
167
185
|
containerStyle,
|
|
168
186
|
onMouseOver,
|
|
169
187
|
onMouseLeave,
|
|
170
|
-
|
|
188
|
+
onClick,
|
|
189
|
+
omit,
|
|
190
|
+
NuxtLink
|
|
171
191
|
};
|
|
172
192
|
}
|
|
173
193
|
});
|
|
@@ -40,6 +40,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
40
40
|
attrs: import("vue").ComputedRef<Pick<{
|
|
41
41
|
[x: string]: unknown;
|
|
42
42
|
}, string>>;
|
|
43
|
+
popper: import("vue").ComputedRef<PopperOptions>;
|
|
43
44
|
trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
44
45
|
container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
45
46
|
containerStyle: import("vue").ComputedRef<{
|
|
@@ -51,7 +52,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
51
52
|
}>;
|
|
52
53
|
onMouseOver: () => void;
|
|
53
54
|
onMouseLeave: () => void;
|
|
55
|
+
onClick: (e: any, item: any, { href, navigate, close, isExternal }: {
|
|
56
|
+
href: any;
|
|
57
|
+
navigate: any;
|
|
58
|
+
close: any;
|
|
59
|
+
isExternal: any;
|
|
60
|
+
}) => void;
|
|
54
61
|
omit: typeof omit;
|
|
62
|
+
NuxtLink: string | import("vue").ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
55
63
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
56
64
|
items: {
|
|
57
65
|
type: PropType<DropdownItem[][]>;
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<Icon v-if="dynamic" :name="name" />
|
|
3
|
+
<span v-else :class="name" />
|
|
3
4
|
</template>
|
|
4
5
|
|
|
5
6
|
<script>
|
|
6
|
-
import { defineComponent } from "vue";
|
|
7
|
+
import { defineComponent, computed } from "vue";
|
|
8
|
+
import { useAppConfig } from "#imports";
|
|
7
9
|
export default defineComponent({
|
|
8
10
|
props: {
|
|
9
11
|
name: {
|
|
10
12
|
type: String,
|
|
11
13
|
required: true
|
|
14
|
+
},
|
|
15
|
+
dynamic: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
12
18
|
}
|
|
19
|
+
},
|
|
20
|
+
setup(props) {
|
|
21
|
+
const appConfig = useAppConfig();
|
|
22
|
+
const dynamic = computed(() => props.dynamic || appConfig.ui?.icons?.dynamic);
|
|
23
|
+
return {
|
|
24
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
25
|
+
dynamic
|
|
26
|
+
};
|
|
13
27
|
}
|
|
14
28
|
});
|
|
15
29
|
</script>
|
|
@@ -3,10 +3,22 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3
3
|
type: StringConstructor;
|
|
4
4
|
required: true;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
dynamic: {
|
|
7
|
+
type: BooleanConstructor;
|
|
8
|
+
default: boolean;
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
dynamic: import("vue").ComputedRef<any>;
|
|
12
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
13
|
name: {
|
|
8
14
|
type: StringConstructor;
|
|
9
15
|
required: true;
|
|
10
16
|
};
|
|
11
|
-
|
|
17
|
+
dynamic: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
21
|
+
}>>, {
|
|
22
|
+
dynamic: boolean;
|
|
23
|
+
}, {}>;
|
|
12
24
|
export default _default;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
+
import type { KbdSize } from '../../types';
|
|
2
3
|
declare const _default: import("vue").DefineComponent<{
|
|
3
4
|
value: {
|
|
4
5
|
type: StringConstructor;
|
|
5
6
|
default: null;
|
|
6
7
|
};
|
|
7
8
|
size: {
|
|
8
|
-
type: PropType<
|
|
9
|
+
type: PropType<KbdSize>;
|
|
9
10
|
default: () => any;
|
|
10
11
|
validator(value: string): boolean;
|
|
11
12
|
};
|
|
@@ -29,7 +30,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
29
30
|
default: null;
|
|
30
31
|
};
|
|
31
32
|
size: {
|
|
32
|
-
type: PropType<
|
|
33
|
+
type: PropType<KbdSize>;
|
|
33
34
|
default: () => any;
|
|
34
35
|
validator(value: string): boolean;
|
|
35
36
|
};
|
|
@@ -42,9 +43,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
42
43
|
default: undefined;
|
|
43
44
|
};
|
|
44
45
|
}>>, {
|
|
46
|
+
size: KbdSize;
|
|
45
47
|
ui: Partial<any>;
|
|
46
|
-
class: any;
|
|
47
48
|
value: string;
|
|
48
|
-
|
|
49
|
+
class: any;
|
|
49
50
|
}, {}>;
|
|
50
51
|
export default _default;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
v-if="!to"
|
|
5
5
|
:disabled="disabled"
|
|
6
6
|
v-bind="$attrs"
|
|
7
|
-
:class="inactiveClass"
|
|
7
|
+
:class="active ? activeClass : inactiveClass"
|
|
8
8
|
>
|
|
9
9
|
<slot />
|
|
10
10
|
</component>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
:role="disabled ? 'link' : undefined"
|
|
22
22
|
:rel="rel"
|
|
23
23
|
:target="target"
|
|
24
|
-
:class="resolveLinkClass(route, $route, { isActive, isExactActive })"
|
|
24
|
+
:class="active ? activeClass : resolveLinkClass(route, $route, { isActive, isExactActive })"
|
|
25
25
|
@click="(e) => !isExternal && navigate(e)"
|
|
26
26
|
>
|
|
27
27
|
<slot v-bind="{ isActive: exact ? isExactActive : isActive }" />
|
|
@@ -68,9 +68,6 @@ export default defineComponent({
|
|
|
68
68
|
},
|
|
69
69
|
setup(props) {
|
|
70
70
|
function resolveLinkClass(route, $route, { isActive, isExactActive }) {
|
|
71
|
-
if (props.active) {
|
|
72
|
-
return props.activeClass;
|
|
73
|
-
}
|
|
74
71
|
if (props.exactQuery && !isEqual(route.query, $route.query)) {
|
|
75
72
|
return props.inactiveClass;
|
|
76
73
|
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="ui.wrapper" v-bind="attrs">
|
|
3
|
+
<template v-if="indicator || $slots.indicator">
|
|
4
|
+
<slot name="indicator" v-bind="{ percent, value }">
|
|
5
|
+
<div :class="indicatorContainerClass" :style="{ width: `${percent}%` }">
|
|
6
|
+
<div :class="indicatorClass">
|
|
7
|
+
{{ Math.round(percent) }}%
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</slot>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<meter
|
|
14
|
+
:value="value"
|
|
15
|
+
:min="normalizedMin"
|
|
16
|
+
:max="normalizedMax"
|
|
17
|
+
:class="[meterClass, meterAppearanceClass, meterBarClass]"
|
|
18
|
+
/>
|
|
19
|
+
|
|
20
|
+
<template v-if="label || $slots.label">
|
|
21
|
+
<slot name="label" v-bind="{ percent, value }">
|
|
22
|
+
<div :class="labelClass">
|
|
23
|
+
<UIcon v-if="icon" :name="icon" /> {{ label }}
|
|
24
|
+
</div>
|
|
25
|
+
</slot>
|
|
26
|
+
</template>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
import { computed, defineComponent, toRef } from "vue";
|
|
32
|
+
import { twJoin } from "tailwind-merge";
|
|
33
|
+
import { useUI } from "../../composables/useUI";
|
|
34
|
+
import { mergeConfig } from "../../utils";
|
|
35
|
+
import appConfig from "#build/app.config";
|
|
36
|
+
import { meter } from "#ui/ui.config";
|
|
37
|
+
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.meter, meter);
|
|
38
|
+
export default defineComponent({
|
|
39
|
+
inheritAttrs: false,
|
|
40
|
+
slots: Object,
|
|
41
|
+
props: {
|
|
42
|
+
value: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 0
|
|
45
|
+
},
|
|
46
|
+
min: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 0
|
|
49
|
+
},
|
|
50
|
+
max: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: 100
|
|
53
|
+
},
|
|
54
|
+
indicator: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
label: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: null
|
|
61
|
+
},
|
|
62
|
+
size: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: () => config.default.size,
|
|
65
|
+
validator(value) {
|
|
66
|
+
return Object.keys(config.meter.size).includes(value);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
color: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: () => config.default.color,
|
|
72
|
+
validator(value) {
|
|
73
|
+
return [...appConfig.ui.colors, ...Object.keys(config.color)].includes(value);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
icon: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: null
|
|
79
|
+
},
|
|
80
|
+
class: {
|
|
81
|
+
type: [String, Object, Array],
|
|
82
|
+
default: void 0
|
|
83
|
+
},
|
|
84
|
+
ui: {
|
|
85
|
+
type: Object,
|
|
86
|
+
default: void 0
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
setup(props) {
|
|
90
|
+
const { ui, attrs } = useUI("meter", toRef(props, "ui"), config, toRef(props, "class"));
|
|
91
|
+
function clampPercent(value, min, max) {
|
|
92
|
+
if (min == max) {
|
|
93
|
+
return value < min ? 0 : 100;
|
|
94
|
+
}
|
|
95
|
+
if (min > max) {
|
|
96
|
+
max = [min, min = max][0];
|
|
97
|
+
}
|
|
98
|
+
const percent2 = (value - min) / (max - min) * 100;
|
|
99
|
+
return Math.max(0, Math.min(100, percent2));
|
|
100
|
+
}
|
|
101
|
+
const indicatorContainerClass = computed(() => {
|
|
102
|
+
return twJoin(
|
|
103
|
+
ui.value.indicator.container
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
const indicatorClass = computed(() => {
|
|
107
|
+
return twJoin(
|
|
108
|
+
ui.value.indicator.text,
|
|
109
|
+
ui.value.indicator.size[props.size]
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
const meterClass = computed(() => {
|
|
113
|
+
return twJoin(
|
|
114
|
+
ui.value.meter.base,
|
|
115
|
+
ui.value.meter.background,
|
|
116
|
+
ui.value.meter.ring,
|
|
117
|
+
ui.value.meter.rounded,
|
|
118
|
+
ui.value.meter.shadow,
|
|
119
|
+
ui.value.color[props.color] ?? ui.value.meter.color.replaceAll("{color}", props.color),
|
|
120
|
+
ui.value.meter.size[props.size]
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
const meterAppearanceClass = computed(() => {
|
|
124
|
+
return twJoin(
|
|
125
|
+
ui.value.meter.appearance.inner,
|
|
126
|
+
ui.value.meter.appearance.meter,
|
|
127
|
+
ui.value.meter.appearance.bar,
|
|
128
|
+
ui.value.meter.appearance.value
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
const meterBarClass = computed(() => {
|
|
132
|
+
return twJoin(
|
|
133
|
+
ui.value.meter.bar.transition,
|
|
134
|
+
ui.value.meter.bar.ring,
|
|
135
|
+
ui.value.meter.bar.rounded,
|
|
136
|
+
ui.value.meter.bar.size[props.size]
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
const labelClass = computed(() => {
|
|
140
|
+
return twJoin(
|
|
141
|
+
ui.value.label.base,
|
|
142
|
+
ui.value.label.text,
|
|
143
|
+
ui.value.color[props.color] ?? ui.value.label.color.replaceAll("{color}", props.color),
|
|
144
|
+
ui.value.label.size[props.size]
|
|
145
|
+
);
|
|
146
|
+
});
|
|
147
|
+
const normalizedMin = computed(() => props.min > props.max ? props.max : props.min);
|
|
148
|
+
const normalizedMax = computed(() => props.max < props.min ? props.min : props.max);
|
|
149
|
+
const percent = computed(() => clampPercent(Number(props.value), normalizedMin.value, normalizedMax.value));
|
|
150
|
+
return {
|
|
151
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
152
|
+
ui,
|
|
153
|
+
attrs,
|
|
154
|
+
indicatorContainerClass,
|
|
155
|
+
indicatorClass,
|
|
156
|
+
meterClass,
|
|
157
|
+
meterAppearanceClass,
|
|
158
|
+
meterBarClass,
|
|
159
|
+
labelClass,
|
|
160
|
+
normalizedMin,
|
|
161
|
+
normalizedMax,
|
|
162
|
+
percent
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
</script>
|