UNPKG

1.87 kBJavaScriptView Raw
1import { defineComponent } from 'vue';
2import { defaultPropValue, colorVariantClass, sizePropValidator } from '../../mixins/index.mjs';
3/**
4 * Slot for default nav content
5 * @name default
6 * @kind slot
7 */
8const componentName = 'INav';
9export default defineComponent({
10 name: componentName,
11 provide() {
12 return {
13 nav: this
14 };
15 },
16 inject: {
17 navbar: {
18 default: () => ({
19 onItemClick: () => { }
20 })
21 },
22 sidebar: {
23 default: () => ({
24 onItemClick: () => { }
25 })
26 }
27 },
28 props: {
29 /**
30 * The color variant of the nav
31 * @type light | dark
32 * @default light
33 * @name color
34 */
35 color: {
36 type: String,
37 default: defaultPropValue(componentName, 'color')
38 },
39 /**
40 * The size variant of the nav
41 * @type sm | md | lg
42 * @default md
43 * @name size
44 */
45 size: {
46 type: String,
47 default: defaultPropValue(componentName, 'size'),
48 validator: sizePropValidator
49 },
50 /**
51 * Display the nav with vertical orientation
52 * @type Boolean
53 * @default false
54 * @name vertical
55 */
56 vertical: {
57 type: Boolean,
58 default: false
59 }
60 },
61 computed: {
62 classes() {
63 return {
64 ...colorVariantClass(this),
65 [`-${this.size}`]: Boolean(this.size),
66 '-vertical': this.vertical
67 };
68 }
69 },
70 methods: {
71 onItemClick() {
72 [this.navbar, this.sidebar].forEach((parent) => {
73 parent.onItemClick();
74 });
75 }
76 }
77});
78//# sourceMappingURL=script.mjs.map
\No newline at end of file