@privyid/persona 0.18.0 → 0.19.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/dist/components/avatar/utils/create-image.mjs +1 -1
- package/dist/components/breadcrumbs/Breadcrumb.vue +5 -1
- package/dist/components/breadcrumbs/Breadcrumb.vue.d.ts +1 -1
- package/dist/components/breadcrumbs/BreadcrumbItem.vue +16 -8
- package/dist/components/breadcrumbs/BreadcrumbItem.vue.d.ts +3 -0
- package/dist/components/breadcrumbs/BreadcrumbItemDropdown.vue +14 -6
- package/dist/components/breadcrumbs/BreadcrumbItemDropdown.vue.d.ts +3 -0
- package/dist/components/button/Button.vue +4 -11
- package/dist/components/button/Button.vue.d.ts +6 -6
- package/dist/components/collapse/Collapse.vue +13 -31
- package/dist/components/dropdown/Dropdown.vue.d.ts +3 -3
- package/dist/components/input-file/InputFile.vue.d.ts +1 -1
- package/dist/components/label/Label.vue.d.ts +1 -1
- package/dist/components/nav/Nav.vue +27 -9
- package/dist/components/nav/NavCollapse.vue +78 -0
- package/dist/components/nav/NavCollapse.vue.d.ts +26 -0
- package/dist/components/nav/NavItem.vue +11 -18
- package/dist/components/nav/NavItem.vue.d.ts +9 -2
- package/dist/components/nav/NavItemDropdown.vue.d.ts +1 -1
- package/dist/components/nav/NavSubItem.vue +35 -19
- package/dist/components/nav/NavSubItem.vue.d.ts +2 -1
- package/dist/components/select/Select.vue +17 -3
- package/dist/components/select/Select.vue.d.ts +11 -1
- package/dist/components/sidebar/SidebarNav.vue +33 -27
- package/dist/components/sidebar/SidebarNav.vue.d.ts +2 -1
- package/dist/components/sidebar-menu/SidebarMenu.vue +14 -23
- package/dist/components/sidebar-menu/SidebarMenu.vue.d.ts +2 -5
- package/dist/components/sidebar-menu/index.d.ts +20 -2
- package/dist/components/signature-draw/SignatureDraw.vue +44 -15
- package/dist/components/signature-draw/SignatureDraw.vue.d.ts +3 -0
- package/dist/components/spinner/Spinner.vue +0 -1
- package/dist/components/spinner/SpinnerRing.vue +0 -1
- package/dist/module.json +1 -1
- package/package.json +11 -9
|
@@ -4,7 +4,7 @@ export function createText(text, size, bgColor, textColor) {
|
|
|
4
4
|
return `data:image/svg+xml,<svg height="${size}" width="${size}" xmlns="http://www.w3.org/2000/svg"><rect fill="${encodeURIComponent(bgColor)}" x="0" y="0" height="${size}" width="${size}"></rect><text fill="${encodeURIComponent(textColor)}" dominant-baseline="central" text-anchor="middle" x="50%" y="50%" font-family="sans-serif" font-weight="600">${encodeURIComponent(text)}</text></svg>`;
|
|
5
5
|
}
|
|
6
6
|
export function createSpinner(width = 50, height = width) {
|
|
7
|
-
return `data:image/svg+xml,<svg
|
|
7
|
+
return `data:image/svg+xml,<svg class="spinner spinner-basic" width="${width}" height="${height}" viewBox="0 0 19 19" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><g transform="translate(4.75 4.75) scale(.5)"><rect class="spinner-basic__bar" x="8.125" width="2.5" height="6.25" rx="1.25" fill="currentColor" fill-opacity="60%"><animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0" repeatCount="indefinite" /></rect><rect class="spinner-basic__bar" x="15.1202" y="1.86199" width="2.5" height="6.25" rx="1.25" transform="rotate(45 15.1202 1.86199)" fill="currentColor" fill-opacity="60%"><animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0.125s" repeatCount="indefinite" /></rect><rect class="spinner-basic__bar" x="18.75" y="8.125" width="2.5" height="6.25" rx="1.25" transform="rotate(90 18.75 8.125)" fill="currentColor" fill-opacity="60%"><animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0.250s" repeatCount="indefinite" /></rect><rect class="spinner-basic__bar" x="16.888" y="15.1202" width="2.5" height="6.25" rx="1.25" transform="rotate(135 16.888 15.1202)" fill="currentColor" fill-opacity="60%"><animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0.375s" repeatCount="indefinite" /></rect><rect class="spinner-basic__bar" x="8.125" y="12.5" width="2.5" height="6.25" rx="1.25" fill="currentColor" fill-opacity="60%"><animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0.500s" repeatCount="indefinite" /></rect><rect class="spinner-basic__bar" x="6.2814" y="10.7008" width="2.5" height="6.25" rx="1.25" transform="rotate(45 6.2814 10.7008)" fill="currentColor" fill-opacity="60%"><animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0.625s" repeatCount="indefinite" /></rect><rect class="spinner-basic__bar" x="6.25" y="8.125" width="2.5" height="6.25" rx="1.25" transform="rotate(90 6.25 8.125)" fill="currentColor" fill-opacity="60%"><animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0.750s" repeatCount="indefinite" /></rect><rect class="spinner-basic__bar" x="8.04917" y="6.2814" width="2.5" height="6.25" rx="1.25" transform="rotate(135 8.04917 6.2814)" fill="currentColor" fill-opacity="60%"><animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0.875s" repeatCount="indefinite" /></rect></g></svg>`;
|
|
8
8
|
}
|
|
9
9
|
export function getAlias(name) {
|
|
10
10
|
return name.split(" ").slice(0, 2).map((c) => c.at(0)).join("").toUpperCase();
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
</template>
|
|
34
34
|
|
|
35
35
|
<script>
|
|
36
|
-
import { defineComponent } from "vue-demi";
|
|
36
|
+
import { defineComponent, provide } from "vue-demi";
|
|
37
37
|
import BreadcrumbItem from "./BreadcrumbItem.vue";
|
|
38
38
|
import BreadcrumbItemDropdown from "./BreadcrumbItemDropdown.vue";
|
|
39
39
|
import DropdownItem from "../dropdown/DropdownItem.vue";
|
|
@@ -49,6 +49,10 @@ export default defineComponent({
|
|
|
49
49
|
default: () => {
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
},
|
|
53
|
+
setup(_, { slots }) {
|
|
54
|
+
if (slots.divider)
|
|
55
|
+
provide("divider", slots.divider);
|
|
52
56
|
}
|
|
53
57
|
});
|
|
54
58
|
</script>
|
|
@@ -17,7 +17,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
17
17
|
};
|
|
18
18
|
default: () => void;
|
|
19
19
|
};
|
|
20
|
-
},
|
|
20
|
+
}, void, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
21
21
|
items: {
|
|
22
22
|
type: {
|
|
23
23
|
(arrayLength: number): BreadcrumbItems[];
|
|
@@ -8,18 +8,24 @@
|
|
|
8
8
|
:href="permalink">
|
|
9
9
|
<slot />
|
|
10
10
|
</component>
|
|
11
|
-
<
|
|
11
|
+
<div
|
|
12
12
|
v-if="!active"
|
|
13
|
-
data-testid="breadcrumbs-
|
|
14
|
-
class="
|
|
13
|
+
data-testid="breadcrumbs-divider"
|
|
14
|
+
class="breadcrumbs__item__divider">
|
|
15
|
+
<component :is="divider" />
|
|
16
|
+
</div>
|
|
15
17
|
</li>
|
|
16
18
|
</template>
|
|
17
19
|
|
|
18
20
|
<script>
|
|
19
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
defineComponent,
|
|
23
|
+
computed,
|
|
24
|
+
inject,
|
|
25
|
+
h
|
|
26
|
+
} from "vue-demi";
|
|
20
27
|
import IconChevron from "@privyid/persona-icon/vue/chevron-right/20.vue";
|
|
21
28
|
export default defineComponent({
|
|
22
|
-
components: { IconChevron },
|
|
23
29
|
props: {
|
|
24
30
|
href: {
|
|
25
31
|
type: String,
|
|
@@ -48,10 +54,12 @@ export default defineComponent({
|
|
|
48
54
|
return;
|
|
49
55
|
return props.href;
|
|
50
56
|
});
|
|
57
|
+
const divider = inject("divider", () => h(IconChevron));
|
|
51
58
|
return {
|
|
52
59
|
classNames,
|
|
53
60
|
tagName,
|
|
54
|
-
permalink
|
|
61
|
+
permalink,
|
|
62
|
+
divider
|
|
55
63
|
};
|
|
56
64
|
}
|
|
57
65
|
});
|
|
@@ -63,13 +71,13 @@ export default defineComponent({
|
|
|
63
71
|
@apply inline-flex text-sm items-center capitalize;
|
|
64
72
|
|
|
65
73
|
&:last-child {
|
|
66
|
-
& > .
|
|
74
|
+
& > .breadcrumbs__item__divider {
|
|
67
75
|
@apply hidden;
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
&:not(:last-child) {
|
|
72
|
-
& > .
|
|
80
|
+
& > .breadcrumbs__item__divider {
|
|
73
81
|
@apply inline-flex ml-3;
|
|
74
82
|
}
|
|
75
83
|
}
|
|
@@ -12,6 +12,9 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
12
12
|
classNames: import("vue-demi").ComputedRef<string[]>;
|
|
13
13
|
tagName: import("vue-demi").ComputedRef<TagVariant>;
|
|
14
14
|
permalink: import("vue-demi").ComputedRef<string | undefined>;
|
|
15
|
+
divider: () => import("vue-demi").VNode<import("vue-demi").RendererNode, import("vue-demi").RendererElement, {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}>;
|
|
15
18
|
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
16
19
|
href: {
|
|
17
20
|
type: StringConstructor;
|
|
@@ -9,19 +9,26 @@
|
|
|
9
9
|
size="xs">
|
|
10
10
|
<slot />
|
|
11
11
|
</Dropdown>
|
|
12
|
-
<
|
|
12
|
+
<div
|
|
13
13
|
v-if="!active"
|
|
14
|
-
data-testid="breadcrumbs-
|
|
15
|
-
class="
|
|
14
|
+
data-testid="breadcrumbs-divider"
|
|
15
|
+
class="breadcrumbs__item__divider">
|
|
16
|
+
<component :is="divider" />
|
|
17
|
+
</div>
|
|
16
18
|
</li>
|
|
17
19
|
</template>
|
|
18
20
|
|
|
19
21
|
<script>
|
|
20
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
defineComponent,
|
|
24
|
+
computed,
|
|
25
|
+
inject,
|
|
26
|
+
h
|
|
27
|
+
} from "vue-demi";
|
|
21
28
|
import Dropdown from "../dropdown/Dropdown.vue";
|
|
22
29
|
import IconChevron from "@privyid/persona-icon/vue/chevron-right/20.vue";
|
|
23
30
|
export default defineComponent({
|
|
24
|
-
components: { Dropdown
|
|
31
|
+
components: { Dropdown },
|
|
25
32
|
props: {
|
|
26
33
|
text: {
|
|
27
34
|
type: String,
|
|
@@ -39,7 +46,8 @@ export default defineComponent({
|
|
|
39
46
|
result.push("breadcrumbs__item--active");
|
|
40
47
|
return result;
|
|
41
48
|
});
|
|
42
|
-
|
|
49
|
+
const divider = inject("divider", () => h(IconChevron));
|
|
50
|
+
return { classNames, divider };
|
|
43
51
|
}
|
|
44
52
|
});
|
|
45
53
|
</script>
|
|
@@ -9,6 +9,9 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
9
9
|
};
|
|
10
10
|
}, {
|
|
11
11
|
classNames: import("vue-demi").ComputedRef<string[]>;
|
|
12
|
+
divider: () => import("vue-demi").VNode<import("vue-demi").RendererNode, import("vue-demi").RendererElement, {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}>;
|
|
12
15
|
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
13
16
|
text: {
|
|
14
17
|
type: StringConstructor;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
3
|
:is="tagName"
|
|
4
|
-
:href="
|
|
5
|
-
:
|
|
6
|
-
:type="tagName === 'a' ? undefined : type"
|
|
4
|
+
:href="href"
|
|
5
|
+
:type="type"
|
|
7
6
|
data-testid="btn"
|
|
8
7
|
:class="classNames">
|
|
9
8
|
<slot />
|
|
@@ -14,8 +13,7 @@
|
|
|
14
13
|
import {
|
|
15
14
|
computed,
|
|
16
15
|
defineComponent,
|
|
17
|
-
inject
|
|
18
|
-
resolveComponent
|
|
16
|
+
inject
|
|
19
17
|
} from "vue-demi";
|
|
20
18
|
import { BUTTONGROUP_SETTING } from "../button-group";
|
|
21
19
|
import { INPUTGROUP_SETTING } from "../input-group";
|
|
@@ -72,12 +70,7 @@ export default defineComponent({
|
|
|
72
70
|
return result;
|
|
73
71
|
});
|
|
74
72
|
const tagName = computed(() => {
|
|
75
|
-
|
|
76
|
-
if (typeof props.href === "string" && (props.href.startsWith("http") || props.href.startsWith("#")))
|
|
77
|
-
return "a";
|
|
78
|
-
return resolveComponent("router-link");
|
|
79
|
-
}
|
|
80
|
-
return "button";
|
|
73
|
+
return props.href ? "nuxt-link" : "button";
|
|
81
74
|
});
|
|
82
75
|
return { classNames, tagName };
|
|
83
76
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PropType
|
|
1
|
+
import { PropType } from 'vue-demi';
|
|
2
2
|
import type { RouteLocationRaw } from 'vue-router';
|
|
3
|
-
import { ColorVariant, SizeVariant, StyleVariant,
|
|
4
|
-
declare const _default: DefineComponent<{
|
|
3
|
+
import { ColorVariant, SizeVariant, StyleVariant, TypeVariant } from '.';
|
|
4
|
+
declare const _default: import("vue-demi").DefineComponent<{
|
|
5
5
|
variant: {
|
|
6
6
|
type: PropType<StyleVariant>;
|
|
7
7
|
default: string;
|
|
@@ -32,7 +32,7 @@ declare const _default: DefineComponent<{
|
|
|
32
32
|
};
|
|
33
33
|
}, {
|
|
34
34
|
classNames: import("vue-demi").ComputedRef<string[]>;
|
|
35
|
-
tagName: import("vue-demi").ComputedRef<
|
|
35
|
+
tagName: import("vue-demi").ComputedRef<"button" | "nuxt-link">;
|
|
36
36
|
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
37
37
|
variant: {
|
|
38
38
|
type: PropType<StyleVariant>;
|
|
@@ -66,9 +66,9 @@ declare const _default: DefineComponent<{
|
|
|
66
66
|
variant: StyleVariant;
|
|
67
67
|
size: SizeVariant;
|
|
68
68
|
type: TypeVariant;
|
|
69
|
-
icon: boolean;
|
|
70
69
|
color: ColorVariant;
|
|
71
|
-
|
|
70
|
+
icon: boolean;
|
|
72
71
|
href: RouteLocationRaw;
|
|
72
|
+
pill: boolean;
|
|
73
73
|
}, {}>;
|
|
74
74
|
export default _default;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
:class="classNames">
|
|
10
|
-
<slot />
|
|
11
|
-
</div>
|
|
12
|
-
</transition>
|
|
2
|
+
<v-collapse
|
|
3
|
+
data-testid="collapse"
|
|
4
|
+
class="collapses"
|
|
5
|
+
:class="classNames"
|
|
6
|
+
:when="model || isToggleable">
|
|
7
|
+
<slot />
|
|
8
|
+
</v-collapse>
|
|
13
9
|
</template>
|
|
14
10
|
|
|
15
11
|
<script>
|
|
@@ -21,7 +17,9 @@ import {
|
|
|
21
17
|
import { useVModel } from "../input";
|
|
22
18
|
import { NAVBAR_SETTINGS } from "../navbar";
|
|
23
19
|
import { useMediaQuery } from "@vueuse/core";
|
|
20
|
+
import { Collapse } from "vue-collapsed";
|
|
24
21
|
export default defineComponent({
|
|
22
|
+
components: { vCollapse: Collapse },
|
|
25
23
|
props: {
|
|
26
24
|
modelValue: {
|
|
27
25
|
type: Boolean,
|
|
@@ -56,6 +54,8 @@ export default defineComponent({
|
|
|
56
54
|
const result = [""];
|
|
57
55
|
if (model.value)
|
|
58
56
|
result.push("collapse--show");
|
|
57
|
+
else
|
|
58
|
+
result.push("collapse--hide");
|
|
59
59
|
if (props.isNav)
|
|
60
60
|
result.push("navbar--collapse");
|
|
61
61
|
return result;
|
|
@@ -70,25 +70,7 @@ export default defineComponent({
|
|
|
70
70
|
</script>
|
|
71
71
|
|
|
72
72
|
<style lang="postcss">
|
|
73
|
-
.
|
|
74
|
-
|
|
75
|
-
@apply block visible text-default;
|
|
76
|
-
@apply dark:text-dark-default;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
&:not(&--show) {
|
|
80
|
-
@apply hidden;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&-enter-active,
|
|
84
|
-
&-leave-active {
|
|
85
|
-
@apply transition-[transform,opacity] origin-top duration-150 ease-in-out;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
&-enter,
|
|
89
|
-
&-enter-from,
|
|
90
|
-
&-leave-to {
|
|
91
|
-
@apply scale-y-0 opacity-0;
|
|
92
|
-
}
|
|
73
|
+
.collapses {
|
|
74
|
+
@apply transition-[height] duration-300 ease-out block;
|
|
93
75
|
}
|
|
94
76
|
</style>
|
|
@@ -131,15 +131,15 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
131
131
|
}, {
|
|
132
132
|
variant: StyleVariant;
|
|
133
133
|
size: SizeVariant;
|
|
134
|
-
icon: boolean;
|
|
135
134
|
color: ColorVariant;
|
|
136
|
-
|
|
135
|
+
icon: boolean;
|
|
136
|
+
divider: boolean;
|
|
137
137
|
text: string;
|
|
138
|
+
pill: boolean;
|
|
138
139
|
modelValue: boolean;
|
|
139
140
|
disabled: boolean;
|
|
140
141
|
placement: Placement;
|
|
141
142
|
noCaret: boolean;
|
|
142
|
-
divider: boolean;
|
|
143
143
|
menuClass: string | Record<string, any> | unknown[];
|
|
144
144
|
buttonClass: string | Record<string, any> | unknown[];
|
|
145
145
|
menuSize: MenuSizeVariant;
|
|
@@ -124,8 +124,8 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
124
124
|
disabled: boolean;
|
|
125
125
|
readonly: boolean;
|
|
126
126
|
modelModifiers: ModelModifier;
|
|
127
|
-
placeholder: string;
|
|
128
127
|
multiple: boolean | MultipleType;
|
|
128
|
+
placeholder: string;
|
|
129
129
|
maxlength: string | number;
|
|
130
130
|
accept: string;
|
|
131
131
|
clearOnCancel: boolean;
|
|
@@ -119,7 +119,9 @@ export default defineComponent({
|
|
|
119
119
|
@apply dark:text-dark-subtle;
|
|
120
120
|
|
|
121
121
|
&:hover,
|
|
122
|
-
&--active
|
|
122
|
+
&--active,
|
|
123
|
+
&.router-link-active:not(.nav__link--exact),
|
|
124
|
+
&.router-link-exact-active.nav__link--exact {
|
|
123
125
|
@apply text-default;
|
|
124
126
|
@apply dark:text-dark-default;
|
|
125
127
|
}
|
|
@@ -148,7 +150,9 @@ export default defineComponent({
|
|
|
148
150
|
* with border-bottom
|
|
149
151
|
*/
|
|
150
152
|
.nav__link {
|
|
151
|
-
&--active
|
|
153
|
+
&--active,
|
|
154
|
+
&.router-link-active:not(.nav__link--exact),
|
|
155
|
+
&.router-link-exact-active.nav__link--exact {
|
|
152
156
|
&:not(.nav__link--disabled) {
|
|
153
157
|
@apply border-b-inverse;
|
|
154
158
|
@apply dark:border-b-dark-inverse;
|
|
@@ -164,7 +168,9 @@ export default defineComponent({
|
|
|
164
168
|
.nav__link {
|
|
165
169
|
@apply border-y-0;
|
|
166
170
|
|
|
167
|
-
&--active
|
|
171
|
+
&--active,
|
|
172
|
+
&.router-link-active:not(.nav__link--exact),
|
|
173
|
+
&.router-link-exact-active.nav__link--exact {
|
|
168
174
|
&:not(.nav__link--disabled) {
|
|
169
175
|
@apply border-r border-r-inverse rounded-tr-none;
|
|
170
176
|
@apply dark:border-r-dark-inverse;
|
|
@@ -176,7 +182,9 @@ export default defineComponent({
|
|
|
176
182
|
.nav__link {
|
|
177
183
|
@apply border-r-0;
|
|
178
184
|
|
|
179
|
-
&--active
|
|
185
|
+
&--active,
|
|
186
|
+
&.router-link-active:not(.nav__link--exact),
|
|
187
|
+
&.router-link-exact-active.nav__link--exact {
|
|
180
188
|
&:not(.nav__link--disabled) {
|
|
181
189
|
@apply border-l border-l-inverse rounded-tl-none;
|
|
182
190
|
@apply dark:border-l-dark-inverse;
|
|
@@ -198,7 +206,9 @@ export default defineComponent({
|
|
|
198
206
|
* except in bottom-side
|
|
199
207
|
*/
|
|
200
208
|
.nav__link {
|
|
201
|
-
&--active
|
|
209
|
+
&--active,
|
|
210
|
+
&.router-link-active:not(.nav__link--exact),
|
|
211
|
+
&.router-link-exact-active.nav__link--exact {
|
|
202
212
|
&:not(.nav__link--disabled) {
|
|
203
213
|
@apply border-t-default border-x-default bg-base;
|
|
204
214
|
@apply dark:border-t-dark-default dark:border-x-dark-default dark:bg-dark-base;
|
|
@@ -212,7 +222,9 @@ export default defineComponent({
|
|
|
212
222
|
*/
|
|
213
223
|
&.nav--vertical {
|
|
214
224
|
.nav__link {
|
|
215
|
-
&--active
|
|
225
|
+
&--active,
|
|
226
|
+
&.router-link-active:not(.nav__link--exact),
|
|
227
|
+
&.router-link-exact-active.nav__link--exact {
|
|
216
228
|
&:not(.nav__link--disabled) {
|
|
217
229
|
@apply border-l-default border-y-default border-r-transparent bg-base rounded-l rounded-r-none;
|
|
218
230
|
@apply dark:border-l-dark-default dark:border-y-dark-default dark:border-r-transparent dark:bg-dark-base;
|
|
@@ -222,7 +234,9 @@ export default defineComponent({
|
|
|
222
234
|
|
|
223
235
|
&.nav--align-right {
|
|
224
236
|
.nav__link {
|
|
225
|
-
&--active
|
|
237
|
+
&--active,
|
|
238
|
+
&.router-link-active:not(.nav__link--exact),
|
|
239
|
+
&.router-link-exact-active.nav__link--exact {
|
|
226
240
|
&:not(.nav__link--disabled) {
|
|
227
241
|
@apply border-r-default border-y-default border-l-transparent rounded-r rounded-l-none;
|
|
228
242
|
@apply dark:border-r-dark-default dark:border-y-dark-default dark:border-l-transparent;
|
|
@@ -245,7 +259,9 @@ export default defineComponent({
|
|
|
245
259
|
* with background
|
|
246
260
|
*/
|
|
247
261
|
.nav__link {
|
|
248
|
-
&--active
|
|
262
|
+
&--active,
|
|
263
|
+
&.router-link-active:not(.nav__link--exact),
|
|
264
|
+
&.router-link-exact-active.nav__link--exact {
|
|
249
265
|
&:not(.nav__link--disabled) {
|
|
250
266
|
@apply bg-base rounded-b;
|
|
251
267
|
@apply dark:bg-dark-base;
|
|
@@ -260,7 +276,9 @@ export default defineComponent({
|
|
|
260
276
|
*/
|
|
261
277
|
&.nav--condensed {
|
|
262
278
|
.nav__link {
|
|
263
|
-
&--active
|
|
279
|
+
&--active,
|
|
280
|
+
&.router-link-active:not(.nav__link--exact),
|
|
281
|
+
&.router-link-exact-active.nav__link--exact {
|
|
264
282
|
@apply bg-transparent;
|
|
265
283
|
@apply dark:bg-transparent;
|
|
266
284
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<NavItem
|
|
3
|
+
ref="root"
|
|
4
|
+
class="nav__collapse"
|
|
5
|
+
:class="{ 'nav__collapse--expand': isExpand }"
|
|
6
|
+
data-testid="nav-collapse"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
@click.prevent="toggleExpand">
|
|
9
|
+
<template #icon>
|
|
10
|
+
<IconMore class="nav__collapse__icon" />
|
|
11
|
+
</template>
|
|
12
|
+
{{ isExpand ? showLessText : showMoreText }}
|
|
13
|
+
</NavItem>
|
|
14
|
+
<Collapse :model-value="isExpand">
|
|
15
|
+
<slot />
|
|
16
|
+
</Collapse>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import Collapse from "../collapse/Collapse.vue";
|
|
21
|
+
import NavItem from "../nav/NavItem.vue";
|
|
22
|
+
import IconMore from "@privyid/persona-icon/vue/chevron-down/20.vue";
|
|
23
|
+
import {
|
|
24
|
+
defineComponent,
|
|
25
|
+
onMounted,
|
|
26
|
+
ref
|
|
27
|
+
} from "vue-demi";
|
|
28
|
+
import { templateRef } from "@vueuse/core";
|
|
29
|
+
export default defineComponent({
|
|
30
|
+
components: {
|
|
31
|
+
Collapse,
|
|
32
|
+
NavItem,
|
|
33
|
+
IconMore
|
|
34
|
+
},
|
|
35
|
+
props: {
|
|
36
|
+
showMoreText: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "More"
|
|
39
|
+
},
|
|
40
|
+
showLessText: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "Less"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
setup() {
|
|
46
|
+
const nav = templateRef("root");
|
|
47
|
+
const isExpand = ref(false);
|
|
48
|
+
function toggleExpand() {
|
|
49
|
+
isExpand.value = !isExpand.value;
|
|
50
|
+
}
|
|
51
|
+
onMounted(() => {
|
|
52
|
+
if (nav.value.$el) {
|
|
53
|
+
isExpand.value = nav.value.$el.querySelectorAll(".router-link-active:not(.nav__link--exact),.router-link-exact-active.nav__link--exact").length > 0;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
isExpand,
|
|
58
|
+
toggleExpand
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style lang="postcss">
|
|
65
|
+
.nav__collapse {
|
|
66
|
+
@apply select-none;
|
|
67
|
+
|
|
68
|
+
&__icon {
|
|
69
|
+
@apply transition-transform duration-150 ease-in-out;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&--expand {
|
|
73
|
+
.nav__collapse__icon {
|
|
74
|
+
@apply rotate-180;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const _default: import("vue-demi").DefineComponent<{
|
|
2
|
+
showMoreText: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
showLessText: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
isExpand: import("vue-demi").Ref<boolean>;
|
|
12
|
+
toggleExpand: () => void;
|
|
13
|
+
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
14
|
+
showMoreText: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
showLessText: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
}>>, {
|
|
23
|
+
showMoreText: string;
|
|
24
|
+
showLessText: string;
|
|
25
|
+
}, {}>;
|
|
26
|
+
export default _default;
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
data-testid="nav-item"
|
|
4
4
|
class="nav__item"
|
|
5
5
|
:class="navItemClass">
|
|
6
|
-
<
|
|
7
|
-
:is="tagName"
|
|
6
|
+
<nuxt-link
|
|
8
7
|
data-testid="nav-link"
|
|
9
|
-
:href="
|
|
10
|
-
:to="isExternalLink ? undefined : href"
|
|
8
|
+
:href="link"
|
|
11
9
|
:target="target"
|
|
12
10
|
:class="[classNames, linkClass]">
|
|
13
11
|
<span
|
|
@@ -22,15 +20,14 @@
|
|
|
22
20
|
class="nav__link__label">
|
|
23
21
|
<slot />
|
|
24
22
|
</span>
|
|
25
|
-
</
|
|
23
|
+
</nuxt-link>
|
|
26
24
|
</li>
|
|
27
25
|
</template>
|
|
28
26
|
|
|
29
27
|
<script>
|
|
30
28
|
import {
|
|
31
29
|
computed,
|
|
32
|
-
defineComponent
|
|
33
|
-
resolveComponent
|
|
30
|
+
defineComponent
|
|
34
31
|
} from "vue-demi";
|
|
35
32
|
export default defineComponent({
|
|
36
33
|
props: {
|
|
@@ -57,6 +54,10 @@ export default defineComponent({
|
|
|
57
54
|
Object
|
|
58
55
|
],
|
|
59
56
|
default: void 0
|
|
57
|
+
},
|
|
58
|
+
exact: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
63
|
setup(props, { slots }) {
|
|
@@ -68,6 +69,8 @@ export default defineComponent({
|
|
|
68
69
|
result.push("nav__link--disabled");
|
|
69
70
|
if (slots.icon)
|
|
70
71
|
result.push("nav__link--icon");
|
|
72
|
+
if (props.exact)
|
|
73
|
+
result.push("nav__link--exact");
|
|
71
74
|
return result;
|
|
72
75
|
});
|
|
73
76
|
const navItemClass = computed(() => {
|
|
@@ -84,20 +87,10 @@ export default defineComponent({
|
|
|
84
87
|
permalink = props.href;
|
|
85
88
|
return permalink;
|
|
86
89
|
});
|
|
87
|
-
const isExternalLink = computed(() => {
|
|
88
|
-
return !props.href || typeof props.href === "string" && (props.href.startsWith("http") || props.href.startsWith("#"));
|
|
89
|
-
});
|
|
90
|
-
const tagName = computed(() => {
|
|
91
|
-
if (isExternalLink.value)
|
|
92
|
-
return "a";
|
|
93
|
-
return resolveComponent("router-link");
|
|
94
|
-
});
|
|
95
90
|
return {
|
|
96
91
|
classNames,
|
|
97
92
|
navItemClass,
|
|
98
|
-
link
|
|
99
|
-
isExternalLink,
|
|
100
|
-
tagName
|
|
93
|
+
link
|
|
101
94
|
};
|
|
102
95
|
}
|
|
103
96
|
});
|
|
@@ -21,12 +21,14 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
21
21
|
type: (StringConstructor | ArrayConstructor | ObjectConstructor)[];
|
|
22
22
|
default: undefined;
|
|
23
23
|
};
|
|
24
|
+
exact: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
24
28
|
}, {
|
|
25
29
|
classNames: import("vue-demi").ComputedRef<string[]>;
|
|
26
30
|
navItemClass: import("vue-demi").ComputedRef<string[]>;
|
|
27
31
|
link: import("vue-demi").ComputedRef<string | undefined>;
|
|
28
|
-
isExternalLink: import("vue-demi").ComputedRef<boolean>;
|
|
29
|
-
tagName: import("vue-demi").ComputedRef<string | import("vue-demi").ConcreteComponent<{}, any, any, import("vue-demi").ComputedOptions, import("vue-demi").MethodOptions>>;
|
|
30
32
|
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
31
33
|
active: {
|
|
32
34
|
type: BooleanConstructor;
|
|
@@ -48,11 +50,16 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
48
50
|
type: (StringConstructor | ArrayConstructor | ObjectConstructor)[];
|
|
49
51
|
default: undefined;
|
|
50
52
|
};
|
|
53
|
+
exact: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
51
57
|
}>>, {
|
|
52
58
|
href: RouteLocationRaw;
|
|
53
59
|
active: boolean;
|
|
54
60
|
disabled: boolean;
|
|
55
61
|
target: string | undefined;
|
|
62
|
+
exact: boolean;
|
|
56
63
|
linkClass: string | Record<string, any> | unknown[];
|
|
57
64
|
}, {}>;
|
|
58
65
|
export default _default;
|