@code-coaching/vuetiful 0.22.0 → 0.23.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 +1 -1
- package/dist/style.css +2 -2
- package/dist/types/components/VBootstrap.vue.d.ts +15 -0
- package/dist/types/components/atoms/VAvatar.vue.d.ts +37 -10
- package/dist/types/components/atoms/VBadge.vue.d.ts +22 -1
- package/dist/types/components/atoms/VButton.vue.d.ts +27 -0
- package/dist/types/components/atoms/VChip.vue.d.ts +22 -1
- package/dist/types/components/atoms/VRadio/VRadioGroup.vue.d.ts +10 -1
- package/dist/types/components/atoms/VRadio/VRadioItem.vue.d.ts +2 -2
- package/dist/types/components/atoms/VSwitch/VSwitch.vue.d.ts +24 -15
- package/dist/types/components/atoms/index.d.ts +1 -2
- package/dist/types/components/molecules/VAccordion/VAccordion.vue.d.ts +15 -6
- package/dist/types/components/molecules/VAccordion/VAccordionItem.vue.d.ts +11 -1
- package/dist/types/components/molecules/VAlert.vue.d.ts +39 -3
- package/dist/types/components/molecules/VCard/VCard.vue.d.ts +5 -5
- package/dist/types/components/molecules/VCard/VCardBody.vue.d.ts +13 -1
- package/dist/types/components/molecules/VCard/VCardFooter.vue.d.ts +22 -1
- package/dist/types/components/molecules/VCard/VCardHeader.vue.d.ts +22 -1
- package/dist/types/components/{atoms → molecules}/VCodeBlock.vue.d.ts +36 -9
- package/dist/types/components/molecules/VListbox/VListbox.vue.d.ts +51 -14
- package/dist/types/components/molecules/VListbox/VListboxItem.vue.d.ts +13 -3
- package/dist/types/components/molecules/VListbox/VListboxItems.vue.d.ts +9 -0
- package/dist/types/components/molecules/VTabs/VTab.vue.d.ts +9 -0
- package/dist/types/components/molecules/VTabs/VTabs.vue.d.ts +18 -0
- package/dist/types/components/molecules/index.d.ts +4 -3
- package/dist/types/props/index.d.ts +1 -0
- package/dist/types/props/props.d.ts +14 -0
- package/dist/types/services/index.d.ts +5 -3
- package/dist/types/services/settings.service.d.ts +132 -0
- package/dist/types/services/settings.service.test.d.ts +1 -0
- package/dist/types/types/index.d.ts +53 -0
- package/dist/vuetiful.es.mjs +920 -557
- package/dist/vuetiful.umd.js +23 -10
- package/package.json +1 -1
- package/src/components/VBootstrap.vue +62 -0
- package/src/components/atoms/VAvatar.test.ts +98 -28
- package/src/components/atoms/VAvatar.vue +46 -13
- package/src/components/atoms/VBadge.test.ts +10 -0
- package/src/components/atoms/VBadge.vue +13 -1
- package/src/components/atoms/VButton.test.ts +58 -0
- package/src/components/atoms/VButton.vue +31 -2
- package/src/components/atoms/VChip.test.ts +26 -11
- package/src/components/atoms/VChip.vue +13 -1
- package/src/components/atoms/VRadio/VRadioDescription.vue +1 -1
- package/src/components/atoms/VRadio/VRadioGroup.test.ts +7 -7
- package/src/components/atoms/VRadio/VRadioGroup.vue +16 -5
- package/src/components/atoms/VRadio/VRadioItem.vue +12 -8
- package/src/components/atoms/VRadio/VRadioLabel.vue +1 -1
- package/src/components/atoms/VSwitch/VSwitch.test.ts +20 -18
- package/src/components/atoms/VSwitch/VSwitch.vue +29 -17
- package/src/components/atoms/VSwitch/VSwitchDescription.vue +1 -1
- package/src/components/atoms/VSwitch/VSwitchGroup.vue +2 -2
- package/src/components/atoms/VSwitch/VSwitchLabel.vue +1 -1
- package/src/components/atoms/index.ts +0 -2
- package/src/components/molecules/VAccordion/VAccordion.test.ts +11 -0
- package/src/components/molecules/VAccordion/VAccordion.vue +16 -7
- package/src/components/molecules/VAccordion/VAccordionItem.test.ts +65 -16
- package/src/components/molecules/VAccordion/VAccordionItem.vue +53 -32
- package/src/components/molecules/VAlert.test.ts +11 -1
- package/src/components/molecules/VAlert.vue +33 -7
- package/src/components/molecules/VCard/VCard.test.ts +1 -1
- package/src/components/molecules/VCard/VCard.vue +12 -7
- package/src/components/molecules/VCard/VCardBody.test.ts +18 -0
- package/src/components/molecules/VCard/VCardBody.vue +16 -1
- package/src/components/molecules/VCard/VCardFooter.test.ts +18 -0
- package/src/components/molecules/VCard/VCardFooter.vue +21 -3
- package/src/components/molecules/VCard/VCardHeader.test.ts +18 -0
- package/src/components/molecules/VCard/VCardHeader.vue +26 -5
- package/src/components/molecules/VCodeBlock.test.ts +133 -0
- package/src/components/molecules/VCodeBlock.vue +120 -0
- package/src/components/molecules/VListbox/VListbox.test.ts +42 -15
- package/src/components/molecules/VListbox/VListbox.vue +44 -15
- package/src/components/molecules/VListbox/VListboxButton.test.ts +15 -6
- package/src/components/molecules/VListbox/VListboxButton.vue +10 -1
- package/src/components/molecules/VListbox/VListboxItem.test.ts +2 -2
- package/src/components/molecules/VListbox/VListboxItem.vue +18 -7
- package/src/components/molecules/VListbox/VListboxItems.test.ts +2 -2
- package/src/components/molecules/VListbox/VListboxItems.vue +18 -5
- package/src/components/molecules/VListbox/VListboxLabel.test.ts +1 -2
- package/src/components/molecules/VListbox/VListboxLabel.vue +1 -1
- package/src/components/molecules/VPreview.vue +9 -5
- package/src/components/molecules/{VRail.test.ts → VRail/VRail.test.ts} +1 -1
- package/src/components/molecules/{VRail.vue → VRail/VRail.vue} +6 -6
- package/src/components/molecules/VRail/VRailTile.test.ts +99 -0
- package/src/components/molecules/{VRailTile.vue → VRail/VRailTile.vue} +4 -6
- package/src/components/molecules/VTabs/VTab.test.ts +7 -3
- package/src/components/molecules/VTabs/VTab.vue +20 -5
- package/src/components/molecules/VTabs/VTabPanel.vue +2 -2
- package/src/components/molecules/VTabs/VTabs.test.ts +4 -2
- package/src/components/molecules/VTabs/VTabs.vue +32 -8
- package/src/components/molecules/index.ts +5 -2
- package/src/props/index.ts +1 -0
- package/src/props/props.ts +62 -0
- package/src/services/index.ts +5 -3
- package/src/services/settings.service.test.ts +17 -0
- package/src/services/settings.service.ts +136 -0
- package/src/types/index.ts +58 -0
- package/src/components/atoms/VCodeBlock.test.ts +0 -14
- package/src/components/atoms/VCodeBlock.vue +0 -92
- package/src/components/molecules/VRailTile.test.ts +0 -14
- /package/dist/types/components/{atoms → molecules}/VCodeBlock.test.d.ts +0 -0
- /package/dist/types/components/molecules/{VRail.test.d.ts → VRail/VRail.test.d.ts} +0 -0
- /package/dist/types/components/molecules/{VRail.vue.d.ts → VRail/VRail.vue.d.ts} +0 -0
- /package/dist/types/components/molecules/{VRailTile.test.d.ts → VRail/VRailTile.test.d.ts} +0 -0
- /package/dist/types/components/molecules/{VRailTile.vue.d.ts → VRail/VRailTile.vue.d.ts} +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { unstyledProp } from "@/props";
|
|
3
|
+
import { useSettings } from "@/services";
|
|
2
4
|
import { Tab } from "@headlessui/vue";
|
|
3
5
|
import { computed, inject } from "vue";
|
|
4
6
|
|
|
5
|
-
defineProps({
|
|
7
|
+
const props = defineProps({
|
|
6
8
|
disabled: {
|
|
7
9
|
type: Boolean,
|
|
8
10
|
default: false,
|
|
9
11
|
},
|
|
12
|
+
unstyled: unstyledProp,
|
|
10
13
|
});
|
|
11
14
|
|
|
12
15
|
const activeClass = inject("active") as string;
|
|
@@ -14,26 +17,38 @@ const hoverClass = inject("hover") as string;
|
|
|
14
17
|
const vertical = inject("vertical") as boolean;
|
|
15
18
|
const classTab = inject("classTab") as string;
|
|
16
19
|
const hideSeparator = inject("hideSeparator") as boolean;
|
|
20
|
+
const classTabSeparator = inject("classTabSeparator") as string;
|
|
17
21
|
|
|
18
22
|
const tabClass = computed(() => {
|
|
19
23
|
return classTab ? classTab : "w-full px-4 py-2";
|
|
20
24
|
});
|
|
25
|
+
|
|
26
|
+
const { settings } = useSettings();
|
|
27
|
+
const isUnstyled = settings.global.unstyled || settings.components.tab.unstyled || props.unstyled;
|
|
21
28
|
</script>
|
|
22
29
|
|
|
23
30
|
<template>
|
|
24
31
|
<Tab
|
|
25
32
|
:disabled="disabled"
|
|
26
33
|
v-slot="{ selected }"
|
|
34
|
+
class="vuetiful-tab"
|
|
27
35
|
:class="`flex ${vertical ? 'flex-row justify-between' : 'flex-col'}`"
|
|
28
36
|
>
|
|
29
|
-
<div
|
|
37
|
+
<div
|
|
38
|
+
data-test="slot-container"
|
|
39
|
+
class="vuetiful-tab-content"
|
|
40
|
+
:class="`text-base ${isUnstyled ? '' : 'rounded-token'} ${
|
|
41
|
+
selected ? activeClass : hoverClass
|
|
42
|
+
} ${tabClass}`"
|
|
43
|
+
>
|
|
30
44
|
<slot />
|
|
31
45
|
</div>
|
|
32
46
|
<div
|
|
33
47
|
v-show="selected && !hideSeparator"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
class="vuetiful-tab-separator"
|
|
49
|
+
:class="`z-10 ${
|
|
50
|
+
vertical ? 'mr-[-2px] h-full border-r-2' : 'mb-[-2px] w-full border-b-2'
|
|
51
|
+
} ${classTabSeparator}`"
|
|
37
52
|
></div>
|
|
38
53
|
</Tab>
|
|
39
54
|
</template>
|
|
@@ -21,7 +21,7 @@ describe("VTabs", () => {
|
|
|
21
21
|
const wrapper = mount({
|
|
22
22
|
template: /*html*/ `
|
|
23
23
|
<v-tabs>
|
|
24
|
-
<template v-slot
|
|
24
|
+
<template v-slot:tabs>
|
|
25
25
|
<v-tab>John Duck</v-tab>
|
|
26
26
|
</template>
|
|
27
27
|
<v-tab-panel>John Duck Panel</v-tab-panel>
|
|
@@ -47,6 +47,7 @@ describe("VTabs", () => {
|
|
|
47
47
|
const tabPanels = wrapper.find("[data-test='vuetiful-tab-panels']");
|
|
48
48
|
expect(tabPanels.classes()).toEqual([
|
|
49
49
|
"vuetiful-tab-panels",
|
|
50
|
+
"p-4",
|
|
50
51
|
"!rounded-tl-none",
|
|
51
52
|
"!rounded-tr-none",
|
|
52
53
|
"rounded-container-token",
|
|
@@ -57,7 +58,7 @@ describe("VTabs", () => {
|
|
|
57
58
|
const wrapper = mount({
|
|
58
59
|
template: /*html*/ `
|
|
59
60
|
<v-tabs vertical>
|
|
60
|
-
<template v-slot
|
|
61
|
+
<template v-slot:tabs>
|
|
61
62
|
<v-tab>Tab 1</v-tab>
|
|
62
63
|
</template>
|
|
63
64
|
<v-tab-panel>Panel 1</v-tab-panel>
|
|
@@ -82,6 +83,7 @@ describe("VTabs", () => {
|
|
|
82
83
|
const tabPanels = wrapper.find("[data-test='vuetiful-tab-panels']");
|
|
83
84
|
expect(tabPanels.classes()).toEqual([
|
|
84
85
|
"vuetiful-tab-panels",
|
|
86
|
+
"p-4",
|
|
85
87
|
"!rounded-bl-none",
|
|
86
88
|
"!rounded-tl-none",
|
|
87
89
|
"rounded-container-token",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { unstyledProp } from "@/props";
|
|
3
|
+
import { useSettings } from "@/services";
|
|
2
4
|
import { TabGroup, TabList, TabPanels } from "@headlessui/vue";
|
|
3
5
|
import { provide } from "vue";
|
|
4
6
|
|
|
@@ -36,13 +38,19 @@ const props = defineProps({
|
|
|
36
38
|
},
|
|
37
39
|
classSeparator: {
|
|
38
40
|
type: String,
|
|
39
|
-
default: "border
|
|
41
|
+
default: "border-surface-400-500-token",
|
|
42
|
+
},
|
|
43
|
+
classTabSeparator: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "border-surface-900-50-token",
|
|
40
46
|
},
|
|
41
47
|
|
|
42
48
|
defaultIndex: {
|
|
43
49
|
type: Number,
|
|
44
50
|
default: 0,
|
|
45
51
|
},
|
|
52
|
+
|
|
53
|
+
unstyled: unstyledProp,
|
|
46
54
|
});
|
|
47
55
|
|
|
48
56
|
provide("active", props.active);
|
|
@@ -50,6 +58,10 @@ provide("hover", props.hover);
|
|
|
50
58
|
provide("vertical", props.vertical);
|
|
51
59
|
provide("classTab", props.classTab);
|
|
52
60
|
provide("hideSeparator", props.hideSeparator);
|
|
61
|
+
provide("classTabSeparator", props.classTabSeparator);
|
|
62
|
+
|
|
63
|
+
const { settings } = useSettings();
|
|
64
|
+
const isUnstyled = settings.global.unstyled || settings.components.tabs.unstyled || props.unstyled;
|
|
53
65
|
</script>
|
|
54
66
|
|
|
55
67
|
<template>
|
|
@@ -57,26 +69,38 @@ provide("hideSeparator", props.hideSeparator);
|
|
|
57
69
|
as="div"
|
|
58
70
|
:vertical="vertical"
|
|
59
71
|
:defaultIndex="defaultIndex"
|
|
72
|
+
class="vuetiful-tab-group"
|
|
60
73
|
:class="`${vertical ? 'flex' : ''}`"
|
|
61
74
|
>
|
|
62
75
|
<TabList
|
|
63
76
|
data-test="vuetiful-tab-list"
|
|
64
|
-
:class="`vuetiful-tab-list flex ${vertical ? 'flex-col' : ''}
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
:class="`vuetiful-tab-list flex ${vertical ? 'flex-col' : ''}
|
|
78
|
+
${
|
|
79
|
+
isUnstyled
|
|
80
|
+
? ''
|
|
81
|
+
: `${
|
|
82
|
+
vertical ? '!rounded-br-none !rounded-tr-none' : '!rounded-bl-none !rounded-br-none'
|
|
83
|
+
} rounded-container-token `
|
|
84
|
+
}
|
|
85
|
+
${classTabs}`"
|
|
67
86
|
>
|
|
68
87
|
<slot name="tabs" />
|
|
69
88
|
</TabList>
|
|
70
89
|
<div
|
|
71
90
|
data-test="vuetiful-tab-separator"
|
|
72
91
|
v-if="!hideSeparator"
|
|
73
|
-
:class="
|
|
92
|
+
:class="`border ${classSeparator}`"
|
|
74
93
|
></div>
|
|
75
94
|
<TabPanels
|
|
76
95
|
data-test="vuetiful-tab-panels"
|
|
77
|
-
:class="`vuetiful-tab-panels
|
|
78
|
-
|
|
79
|
-
|
|
96
|
+
:class="`vuetiful-tab-panels
|
|
97
|
+
${
|
|
98
|
+
isUnstyled
|
|
99
|
+
? ''
|
|
100
|
+
: `p-4 ${
|
|
101
|
+
vertical ? '!rounded-bl-none !rounded-tl-none' : '!rounded-tl-none !rounded-tr-none'
|
|
102
|
+
} rounded-container-token`
|
|
103
|
+
} ${classPanels}`"
|
|
80
104
|
>
|
|
81
105
|
<slot />
|
|
82
106
|
</TabPanels>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import VDrawer from "./VDrawer.vue";
|
|
2
2
|
import VPreview from "./VPreview.vue";
|
|
3
|
-
import VRail from "./VRail.vue";
|
|
4
|
-
import VRailTile from "./VRailTile.vue";
|
|
3
|
+
import VRail from "./VRail/VRail.vue";
|
|
4
|
+
import VRailTile from "./VRail/VRailTile.vue";
|
|
5
5
|
import VShell from "./VShell.vue";
|
|
6
6
|
|
|
7
7
|
import VListbox from "./VListbox/VListbox.vue";
|
|
@@ -24,6 +24,8 @@ import VCardBody from "./VCard/VCardBody.vue";
|
|
|
24
24
|
import VCardFooter from "./VCard/VCardFooter.vue";
|
|
25
25
|
import VCardHeader from "./VCard/VCardHeader.vue";
|
|
26
26
|
|
|
27
|
+
import VCodeBlock from "./VCodeBlock.vue";
|
|
28
|
+
|
|
27
29
|
export {
|
|
28
30
|
VAccordion,
|
|
29
31
|
VAccordionItem,
|
|
@@ -32,6 +34,7 @@ export {
|
|
|
32
34
|
VCardBody,
|
|
33
35
|
VCardFooter,
|
|
34
36
|
VCardHeader,
|
|
37
|
+
VCodeBlock,
|
|
35
38
|
VDrawer,
|
|
36
39
|
VListbox,
|
|
37
40
|
VListboxButton,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './props';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Size, Variant } from "@/types";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
|
|
4
|
+
const sizeProp = {
|
|
5
|
+
type: String as PropType<"xs" | "sm" | "md" | "lg" | "xl">,
|
|
6
|
+
default: Size.MD,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const unstyledProp = {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: false,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const variantProp = {
|
|
15
|
+
// explicit string union because TypeScript type won't throw error if invalid value is passed
|
|
16
|
+
type: String as PropType<
|
|
17
|
+
| ""
|
|
18
|
+
| "filled"
|
|
19
|
+
| "filled-primary"
|
|
20
|
+
| "filled-secondary"
|
|
21
|
+
| "filled-tertiary"
|
|
22
|
+
| "filled-success"
|
|
23
|
+
| "filled-warning"
|
|
24
|
+
| "filled-error"
|
|
25
|
+
| "filled-surface"
|
|
26
|
+
| "ringed"
|
|
27
|
+
| "ringed-primary"
|
|
28
|
+
| "ringed-secondary"
|
|
29
|
+
| "ringed-tertiary"
|
|
30
|
+
| "ringed-success"
|
|
31
|
+
| "ringed-warning"
|
|
32
|
+
| "ringed-error"
|
|
33
|
+
| "ringed-surface"
|
|
34
|
+
| "ghost"
|
|
35
|
+
| "ghost-primary"
|
|
36
|
+
| "ghost-secondary"
|
|
37
|
+
| "ghost-tertiary"
|
|
38
|
+
| "ghost-success"
|
|
39
|
+
| "ghost-warning"
|
|
40
|
+
| "ghost-error"
|
|
41
|
+
| "ghost-surface"
|
|
42
|
+
| "soft"
|
|
43
|
+
| "soft-primary"
|
|
44
|
+
| "soft-secondary"
|
|
45
|
+
| "soft-tertiary"
|
|
46
|
+
| "soft-success"
|
|
47
|
+
| "soft-warning"
|
|
48
|
+
| "soft-error"
|
|
49
|
+
| "soft-surface"
|
|
50
|
+
| "glass"
|
|
51
|
+
| "glass-primary"
|
|
52
|
+
| "glass-secondary"
|
|
53
|
+
| "glass-tertiary"
|
|
54
|
+
| "glass-success"
|
|
55
|
+
| "glass-warning"
|
|
56
|
+
| "glass-error"
|
|
57
|
+
| "glass-surface"
|
|
58
|
+
>,
|
|
59
|
+
default: Variant.Filled,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { sizeProp, unstyledProp, variantProp };
|
package/src/services/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDarkMode } from "./dark-mode.service";
|
|
2
2
|
import { useDrawer } from "./drawer.service";
|
|
3
3
|
import { useHighlight } from "./highlight.service";
|
|
4
|
-
import {
|
|
4
|
+
import { useRail } from "./rail.service";
|
|
5
|
+
import { useSettings, VuetifulSettings } from "./settings.service";
|
|
5
6
|
|
|
6
|
-
export {
|
|
7
|
+
export { useDarkMode, useDrawer, useHighlight, useRail, useSettings };
|
|
8
|
+
export type { VuetifulSettings };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test, vi } from "vitest";
|
|
2
|
+
|
|
3
|
+
describe("useSettings", () => {
|
|
4
|
+
afterEach(() => {
|
|
5
|
+
vi.resetModules();
|
|
6
|
+
});
|
|
7
|
+
describe("updateSettings", () => {
|
|
8
|
+
test("should update settings", async () => {
|
|
9
|
+
const { useSettings } = await import("./settings.service");
|
|
10
|
+
const { updateSettings, settings } = useSettings();
|
|
11
|
+
|
|
12
|
+
expect(settings.global.unstyled).toBe(false);
|
|
13
|
+
updateSettings({ global: { unstyled: true } });
|
|
14
|
+
expect(settings.global.unstyled).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
|
|
3
|
+
interface UnstyledSettings {
|
|
4
|
+
unstyled: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface GlobalSettings extends UnstyledSettings {}
|
|
8
|
+
interface RadioGroupSettings extends UnstyledSettings {}
|
|
9
|
+
interface RadioItemSettings extends UnstyledSettings {}
|
|
10
|
+
interface AccordionSettings extends UnstyledSettings {}
|
|
11
|
+
interface AccordionItemSettings extends UnstyledSettings {}
|
|
12
|
+
interface AlertSettings extends UnstyledSettings {}
|
|
13
|
+
interface AvatarSettings extends UnstyledSettings {}
|
|
14
|
+
interface BadgeSettings extends UnstyledSettings {}
|
|
15
|
+
interface ButtonSettings extends UnstyledSettings {}
|
|
16
|
+
interface ListboxSettings extends UnstyledSettings {}
|
|
17
|
+
interface ListboxItemSettings extends UnstyledSettings {}
|
|
18
|
+
interface CodeBlockSettings extends UnstyledSettings {}
|
|
19
|
+
interface SwitchSettings extends UnstyledSettings {}
|
|
20
|
+
interface CardSettings extends UnstyledSettings {}
|
|
21
|
+
interface CardHeaderSettings extends UnstyledSettings {}
|
|
22
|
+
interface CardBodySettings extends UnstyledSettings {}
|
|
23
|
+
interface CardFooterSettings extends UnstyledSettings {}
|
|
24
|
+
interface TabsSettings extends UnstyledSettings {}
|
|
25
|
+
interface TabSettings extends UnstyledSettings {}
|
|
26
|
+
|
|
27
|
+
export interface VuetifulSettings {
|
|
28
|
+
global: GlobalSettings;
|
|
29
|
+
components: Partial<{
|
|
30
|
+
avatar: AvatarSettings;
|
|
31
|
+
alert: AlertSettings;
|
|
32
|
+
badge: BadgeSettings;
|
|
33
|
+
button: ButtonSettings;
|
|
34
|
+
codeBlock: CodeBlockSettings;
|
|
35
|
+
switch: SwitchSettings;
|
|
36
|
+
|
|
37
|
+
accordion: AccordionSettings;
|
|
38
|
+
accordionItem: AccordionItemSettings;
|
|
39
|
+
|
|
40
|
+
listbox: ListboxSettings;
|
|
41
|
+
listboxItem: ListboxItemSettings;
|
|
42
|
+
|
|
43
|
+
radioGroup: RadioGroupSettings;
|
|
44
|
+
radioItem: RadioItemSettings;
|
|
45
|
+
|
|
46
|
+
card: CardSettings;
|
|
47
|
+
cardHeader: CardHeaderSettings;
|
|
48
|
+
cardBody: CardBodySettings;
|
|
49
|
+
cardFooter: CardFooterSettings;
|
|
50
|
+
|
|
51
|
+
tabs: TabsSettings;
|
|
52
|
+
tab: TabSettings;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const settings = reactive({
|
|
57
|
+
global: {
|
|
58
|
+
unstyled: false,
|
|
59
|
+
},
|
|
60
|
+
components: {
|
|
61
|
+
radioGroup: {
|
|
62
|
+
unstyled: false,
|
|
63
|
+
},
|
|
64
|
+
radioItem: {
|
|
65
|
+
unstyled: false,
|
|
66
|
+
},
|
|
67
|
+
switch: {
|
|
68
|
+
unstyled: false,
|
|
69
|
+
},
|
|
70
|
+
avatar: {
|
|
71
|
+
unstyled: false,
|
|
72
|
+
},
|
|
73
|
+
badge: {
|
|
74
|
+
unstyled: false,
|
|
75
|
+
},
|
|
76
|
+
button: {
|
|
77
|
+
unstyled: false,
|
|
78
|
+
},
|
|
79
|
+
chip: {
|
|
80
|
+
unstyled: false,
|
|
81
|
+
},
|
|
82
|
+
codeBlock: {
|
|
83
|
+
unstyled: false,
|
|
84
|
+
},
|
|
85
|
+
listbox: {
|
|
86
|
+
unstyled: false,
|
|
87
|
+
},
|
|
88
|
+
listboxItem: {
|
|
89
|
+
unstyled: false,
|
|
90
|
+
},
|
|
91
|
+
accordion: {
|
|
92
|
+
unstyled: false,
|
|
93
|
+
},
|
|
94
|
+
accordionItem: {
|
|
95
|
+
unstyled: false,
|
|
96
|
+
},
|
|
97
|
+
alert: {
|
|
98
|
+
unstyled: false,
|
|
99
|
+
},
|
|
100
|
+
card: {
|
|
101
|
+
unstyled: false,
|
|
102
|
+
},
|
|
103
|
+
cardHeader: {
|
|
104
|
+
unstyled: false,
|
|
105
|
+
},
|
|
106
|
+
cardBody: {
|
|
107
|
+
unstyled: false,
|
|
108
|
+
},
|
|
109
|
+
cardFooter: {
|
|
110
|
+
unstyled: false,
|
|
111
|
+
},
|
|
112
|
+
tabs: {
|
|
113
|
+
unstyled: false,
|
|
114
|
+
},
|
|
115
|
+
tab: {
|
|
116
|
+
unstyled: false,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const useSettings = () => {
|
|
122
|
+
const updateSettings = (partialSettings: Partial<VuetifulSettings>) => {
|
|
123
|
+
for (const key in partialSettings) {
|
|
124
|
+
if (key in settings) {
|
|
125
|
+
Object.assign((settings as any)[key], (partialSettings as any)[key]);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
updateSettings,
|
|
132
|
+
settings,
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export { useSettings };
|
package/src/types/index.ts
CHANGED
|
@@ -1 +1,59 @@
|
|
|
1
1
|
export * from "./tailwind";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The commented string unions are to use in PropType<> for Vue components,
|
|
5
|
+
* TypeScript types or enums do not give errors when using a string that is not in the union.
|
|
6
|
+
**/
|
|
7
|
+
|
|
8
|
+
export const Variant = {
|
|
9
|
+
Filled: "filled",
|
|
10
|
+
FilledPrimary: "filled-primary",
|
|
11
|
+
FilledSecondary: "filled-secondary",
|
|
12
|
+
FilledTertiary: "filled-tertiary",
|
|
13
|
+
FilledSuccess: "filled-success",
|
|
14
|
+
FilledWarning: "filled-warning",
|
|
15
|
+
FilledError: "filled-error",
|
|
16
|
+
FilledSurface: "filled-surface",
|
|
17
|
+
Ringed: "ringed",
|
|
18
|
+
RingedPrimary: "ringed-primary",
|
|
19
|
+
RingedSecondary: "ringed-secondary",
|
|
20
|
+
RingedTertiary: "ringed-tertiary",
|
|
21
|
+
RingedSuccess: "ringed-success",
|
|
22
|
+
RingedWarning: "ringed-warning",
|
|
23
|
+
RingedError: "ringed-error",
|
|
24
|
+
RingedSurface: "ringed-surface",
|
|
25
|
+
Ghost: "ghost",
|
|
26
|
+
GhostPrimary: "ghost-primary",
|
|
27
|
+
GhostSecondary: "ghost-secondary",
|
|
28
|
+
GhostTertiary: "ghost-tertiary",
|
|
29
|
+
GhostSuccess: "ghost-success",
|
|
30
|
+
GhostWarning: "ghost-warning",
|
|
31
|
+
GhostError: "ghost-error",
|
|
32
|
+
GhostSurface: "ghost-surface",
|
|
33
|
+
Soft: "soft",
|
|
34
|
+
SoftPrimary: "soft-primary",
|
|
35
|
+
SoftSecondary: "soft-secondary",
|
|
36
|
+
SoftTertiary: "soft-tertiary",
|
|
37
|
+
SoftSuccess: "soft-success",
|
|
38
|
+
SoftWarning: "soft-warning",
|
|
39
|
+
SoftError: "soft-error",
|
|
40
|
+
SoftSurface: "soft-surface",
|
|
41
|
+
Glass: "glass",
|
|
42
|
+
GlassPrimary: "glass-primary",
|
|
43
|
+
GlassSecondary: "glass-secondary",
|
|
44
|
+
GlassTertiary: "glass-tertiary",
|
|
45
|
+
GlassSuccess: "glass-success",
|
|
46
|
+
GlassWarning: "glass-warning",
|
|
47
|
+
GlassError: "glass-error",
|
|
48
|
+
GlassSurface: "glass-surface",
|
|
49
|
+
};
|
|
50
|
+
// "filled" | "filled-primary" | "filled-secondary" | "filled-tertiary" | "filled-success" | "filled-warning" | "filled-error" | "filled-surface" | "ringed" | "ringed-primary" | "ringed-secondary" | "ringed-tertiary" | "ringed-success" | "ringed-warning" | "ringed-error" | "ringed-surface" | "ghost" | "ghost-primary" | "ghost-secondary" | "ghost-tertiary" | "ghost-success" | "ghost-warning" | "ghost-error" | "ghost-surface" | "soft" | "soft-primary" | "soft-secondary" | "soft-tertiary" | "soft-success" | "soft-warning" | "soft-error" | "soft-surface" | "glass" | "glass-primary" | "glass-secondary" | "glass-tertiary" | "glass-success" | "glass-warning" | "glass-error" | "glass-surface" |
|
|
51
|
+
|
|
52
|
+
export const Size = {
|
|
53
|
+
XS: "xs",
|
|
54
|
+
SM: "sm",
|
|
55
|
+
MD: "md",
|
|
56
|
+
LG: "lg",
|
|
57
|
+
XL: "xl",
|
|
58
|
+
};
|
|
59
|
+
// "xs" | "sm" | "md" | "lg" | "xl"
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { expect, test } from "vitest";
|
|
3
|
-
import { VCodeBlock } from ".";
|
|
4
|
-
|
|
5
|
-
test("VCodeBlock", () => {
|
|
6
|
-
expect(VCodeBlock).toBeTruthy();
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// TODO: add tests
|
|
10
|
-
test("VCodeBlock using slot", () => {
|
|
11
|
-
const wrapper = mount(VCodeBlock);
|
|
12
|
-
|
|
13
|
-
expect(wrapper).toBeTruthy();
|
|
14
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { CssClasses, VButton, vClipboard } from "@/index";
|
|
3
|
-
import { useHighlight } from "@/services/highlight.service";
|
|
4
|
-
import "highlight.js/styles/github-dark.css";
|
|
5
|
-
import { ref } from "vue";
|
|
6
|
-
|
|
7
|
-
const { highlight } = useHighlight();
|
|
8
|
-
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
language: {
|
|
11
|
-
type: String,
|
|
12
|
-
default: "plaintext",
|
|
13
|
-
},
|
|
14
|
-
code: {
|
|
15
|
-
type: String,
|
|
16
|
-
default: "",
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
preventOverflow: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default: false,
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
headerClass: {
|
|
25
|
-
type: String as () => CssClasses,
|
|
26
|
-
default: "",
|
|
27
|
-
},
|
|
28
|
-
preClass: {
|
|
29
|
-
type: String as () => CssClasses,
|
|
30
|
-
default: "",
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
buttonClass: {
|
|
34
|
-
type: String as () => CssClasses,
|
|
35
|
-
default: "btn-sm",
|
|
36
|
-
},
|
|
37
|
-
buttonText: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: "Copy",
|
|
40
|
-
},
|
|
41
|
-
buttonCopiedText: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: "👍",
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const emit = defineEmits<{
|
|
48
|
-
(event: "copy"): void;
|
|
49
|
-
}>();
|
|
50
|
-
|
|
51
|
-
const copyState = ref(false);
|
|
52
|
-
|
|
53
|
-
// Allow shorthand alias, but show full text in UI
|
|
54
|
-
function languageFormatter(lang: string): string {
|
|
55
|
-
if (lang === "js") return "javascript";
|
|
56
|
-
if (lang === "ts") return "typescript";
|
|
57
|
-
if (["sh", "bash", "zsh", "shell"].includes(lang)) return "console";
|
|
58
|
-
return lang;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function onCopyClick() {
|
|
62
|
-
copyState.value = true;
|
|
63
|
-
setTimeout(() => {
|
|
64
|
-
copyState.value = false;
|
|
65
|
-
}, 2000);
|
|
66
|
-
emit("copy");
|
|
67
|
-
}
|
|
68
|
-
</script>
|
|
69
|
-
|
|
70
|
-
<template v-if="language && code">
|
|
71
|
-
<div
|
|
72
|
-
class="code-block max-w-full bg-neutral-900/90 text-sm text-white shadow rounded-container-token"
|
|
73
|
-
>
|
|
74
|
-
<header
|
|
75
|
-
:class="`code-block-header flex items-center justify-between p-2 pb-0 pl-4 text-xs uppercase text-white/50 ${headerClass}`"
|
|
76
|
-
>
|
|
77
|
-
<span :class="`code-block-language`">{{ languageFormatter(language) }}</span>
|
|
78
|
-
<v-button
|
|
79
|
-
:class="`code-block-btn ${buttonClass}`"
|
|
80
|
-
@click="onCopyClick()"
|
|
81
|
-
v-clipboard="props.code"
|
|
82
|
-
>
|
|
83
|
-
{{ !copyState ? buttonText : buttonCopiedText }}
|
|
84
|
-
</v-button>
|
|
85
|
-
</header>
|
|
86
|
-
<pre
|
|
87
|
-
:class="`code-block-pre ${
|
|
88
|
-
preventOverflow ? 'whitespace-pre-wrap break-all' : 'overflow-auto'
|
|
89
|
-
} p-4 pt-1 ${preClass}`"
|
|
90
|
-
><code :class="`code-block-code language-${language}`" v-html="highlight(props.code, props.language)"></code></pre>
|
|
91
|
-
</div>
|
|
92
|
-
</template>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { expect, test } from "vitest";
|
|
3
|
-
import { VRailTile } from ".";
|
|
4
|
-
|
|
5
|
-
test("VRailTile", () => {
|
|
6
|
-
expect(VRailTile).toBeTruthy();
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// TODO: add tests
|
|
10
|
-
test("VRailTile using slot", () => {
|
|
11
|
-
const wrapper = mount(VRailTile);
|
|
12
|
-
|
|
13
|
-
expect(wrapper).toBeTruthy();
|
|
14
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|