@privyid/persona 0.21.0 → 0.22.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/accordion/Accordion.vue +1 -1
- package/dist/components/accordion/AccordionItem.vue +6 -6
- package/dist/components/badge/Badge.vue +21 -3
- package/dist/components/banner/Banner.vue +5 -0
- package/dist/components/banner/Banner.vue.d.ts +9 -0
- package/dist/components/button/Button.vue +18 -18
- package/dist/components/calendar/adapter/adapter.d.ts +1 -8
- package/dist/components/calendar/adapter/adapter.mjs +0 -10
- package/dist/components/calendar/adapter/date.mjs +2 -2
- package/dist/components/calendar/adapter/month.mjs +2 -2
- package/dist/components/card/CardSection.vue +1 -0
- package/dist/components/carousel/Carousel.vue.d.ts +6 -6
- package/dist/components/chart/ChartSet.vue.d.ts +2 -2
- package/dist/components/chart/ChartVal.vue.d.ts +4 -4
- package/dist/components/checkbox/Checkbox.vue +98 -112
- package/dist/components/checkbox/icon/IconCheckbox.vue +13 -0
- package/dist/components/checkbox/icon/IconInderteminate.vue +12 -0
- package/dist/components/contextual-bar/ContextualBar.vue +67 -19
- package/dist/components/contextual-bar/ContextualBar.vue.d.ts +3 -3
- package/dist/components/contextual-bar/index.d.ts +1 -1
- package/dist/components/cropper/Cropper.vue.d.ts +8 -8
- package/dist/components/datepicker/Datepicker.vue +2 -0
- package/dist/components/datepicker/Datepicker.vue.d.ts +1 -1
- package/dist/components/dialog/Dialog.vue +2 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/divider/Divider.vue +1 -1
- package/dist/components/dropdown/Dropdown.vue +303 -222
- package/dist/components/dropzone/Dropzone.vue.d.ts +3 -3
- package/dist/components/filterbar/pinned/PinnedDate.vue +2 -0
- package/dist/components/filterbar/pinned/PinnedDate.vue.d.ts +1 -1
- package/dist/components/filterbar/pinned/PinnedMultiselect.vue +10 -6
- package/dist/components/filterbar/pinned/PinnedSelect.vue +11 -7
- package/dist/components/filterbar/pinned/PinnedSelect.vue.d.ts +3 -3
- package/dist/components/filterbar/pinned/PinnedToggle.vue.d.ts +7 -7
- package/dist/components/global/store.d.ts +2 -1
- package/dist/components/heading/Heading.vue.d.ts +1 -1
- package/dist/components/input/Input.vue +16 -5
- package/dist/components/input/Input.vue.d.ts +4 -3
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/input-file/InputFile.vue.d.ts +3 -3
- package/dist/components/input-pin/InputPin.vue.d.ts +2 -2
- package/dist/components/input-range/InputRange.vue.d.ts +6 -6
- package/dist/components/label/Label.vue +9 -8
- package/dist/components/label/Label.vue.d.ts +1 -1
- package/dist/components/main/Main.vue +4 -2
- package/dist/components/markdown/index.d.ts +6 -1
- package/dist/components/markdown/index.mjs +8 -2
- package/dist/components/meta.json +135 -0
- package/dist/components/modal/Modal.vue +215 -12
- package/dist/components/modal/Modal.vue.d.ts +55 -1
- package/dist/components/modal/index.d.ts +1 -1
- package/dist/components/nav/Nav.vue +5 -1
- package/dist/components/nav/NavItemDropdown.vue.d.ts +1 -1
- package/dist/components/nav/NavSubItem.vue +6 -6
- package/dist/components/navbar/Navbar.vue.d.ts +1 -1
- package/dist/components/navbar/NavbarBrand.vue +1 -1
- package/dist/components/pdf-helipad/PdfHelipad.vue +101 -85
- package/dist/components/pdf-helipad/utils/use-drag.d.ts +2 -7
- package/dist/components/pdf-helipad/utils/use-drag.mjs +1 -1
- package/dist/components/pdf-object/utils/use-drag.d.ts +1 -0
- package/dist/components/pdf-object/utils/use-drag.mjs +1 -1
- package/dist/components/pdf-viewer/PdfViewer.vue.d.ts +4 -4
- package/dist/components/progress-indicator/ProgressIndicator.vue.d.ts +2 -2
- package/dist/components/progressbar/Progressbar.vue.d.ts +7 -7
- package/dist/components/radio/Radio.vue.d.ts +4 -4
- package/dist/components/ringbar/Ringbar.vue.d.ts +6 -6
- package/dist/components/select/Select.vue +396 -214
- package/dist/components/select/SelectInput.vue +102 -0
- package/dist/components/select/SelectTags.vue +57 -0
- package/dist/components/select/adapter/adapter.d.ts +1 -0
- package/dist/components/select/adapter/async-adapter.d.ts +13 -1
- package/dist/components/select/adapter/async-adapter.mjs +8 -15
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.mjs +4 -1
- package/dist/components/sheet/Sheet.vue +2 -3
- package/dist/components/sidebar/Sidebar.vue +101 -116
- package/dist/components/sidebar/SidebarBrand.vue +1 -1
- package/dist/components/sidebar/SidebarContent.vue +27 -0
- package/dist/components/sidebar/SidebarNav.vue +60 -84
- package/dist/components/sidebar-menu/SidebarMenu.vue +57 -204
- package/dist/components/sidebar-menu/SidebarMenuItem.vue +70 -0
- package/dist/components/signature-text/SignatureText.vue.d.ts +4 -4
- package/dist/components/steps/StepSlider.vue +2 -2
- package/dist/components/strengthbar/Strengthbar.vue.d.ts +8 -8
- package/dist/components/table-flex/TableFlex.vue +3 -5
- package/dist/components/table-static/TableStatic.vue +118 -111
- package/dist/components/table-static/TableStaticRoot.vue +42 -0
- package/dist/components/tabs/Tab.vue +13 -15
- package/dist/components/tabs/TabContent.vue +64 -23
- package/dist/components/tabs/Tabs.vue +93 -75
- package/dist/components/text/Text.vue +15 -7
- package/dist/components/text/Text.vue.d.ts +11 -2
- package/dist/components/text/index.d.ts +1 -0
- package/dist/components/textarea/Textarea.vue.d.ts +5 -5
- package/dist/components/toggle/Toggle.vue +12 -1
- package/dist/components/toggle/Toggle.vue.d.ts +16 -7
- package/dist/components/tooltip/index.mjs +1 -1
- package/dist/components/tooltip/utils/create-handler.mjs +1 -1
- package/dist/components/tour/TourDialog.vue +6 -0
- package/dist/components/truncate/Truncate.vue +1 -1
- package/dist/components/truncate/Truncate.vue.d.ts +2 -2
- package/dist/components/utils/date.d.ts +21 -0
- package/dist/components/utils/date.mjs +15 -0
- package/dist/components/utils/vnode.mjs +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.mjs +4 -0
- package/dist/module.json +1 -1
- package/package.json +17 -17
- package/dist/components/checkbox/Checkbox.vue.d.ts +0 -84
- package/dist/components/dropdown/Dropdown.vue.d.ts +0 -147
- package/dist/components/pdf-helipad/PdfHelipad.vue.d.ts +0 -45
- package/dist/components/select/Select.vue.d.ts +0 -157
- package/dist/components/sidebar/Sidebar.vue.d.ts +0 -80
- package/dist/components/sidebar/SidebarNav.vue.d.ts +0 -66
- package/dist/components/sidebar-menu/SidebarMenu.vue.d.ts +0 -91
- package/dist/components/tabs/Tab.vue.d.ts +0 -23
- package/dist/components/tabs/TabContent.vue.d.ts +0 -14
- package/dist/components/tabs/Tabs.vue.d.ts +0 -80
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="input"
|
|
4
|
+
:class="containerClass"
|
|
5
|
+
data-testid="input-container">
|
|
6
|
+
<span
|
|
7
|
+
v-if="$slots.prepend"
|
|
8
|
+
class="input__prepend">
|
|
9
|
+
<slot name="prepend" />
|
|
10
|
+
</span>
|
|
11
|
+
<div
|
|
12
|
+
class="input__form"
|
|
13
|
+
data-testid="input"
|
|
14
|
+
:disabled="disabled"
|
|
15
|
+
:readonly="readonly"
|
|
16
|
+
:class="classNames"
|
|
17
|
+
:tabindex="1"
|
|
18
|
+
v-bind="$attrs">
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
21
|
+
<span
|
|
22
|
+
v-if="$slots.append"
|
|
23
|
+
class="input__append">
|
|
24
|
+
<slot name="append" />
|
|
25
|
+
</span>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts" setup>
|
|
30
|
+
import {
|
|
31
|
+
computed,
|
|
32
|
+
inject,
|
|
33
|
+
PropType,
|
|
34
|
+
VNode,
|
|
35
|
+
} from 'vue-demi'
|
|
36
|
+
import { SizeVariant } from '../button'
|
|
37
|
+
import { INPUTGROUP_SETTING } from '../input-group'
|
|
38
|
+
|
|
39
|
+
defineOptions({ inheritAttrs: false })
|
|
40
|
+
|
|
41
|
+
const props = defineProps({
|
|
42
|
+
size: {
|
|
43
|
+
type : String as PropType<SizeVariant>,
|
|
44
|
+
default: 'md',
|
|
45
|
+
},
|
|
46
|
+
disabled: {
|
|
47
|
+
type : Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
readonly: {
|
|
51
|
+
type : Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
error: {
|
|
55
|
+
type : Boolean,
|
|
56
|
+
default: false,
|
|
57
|
+
},
|
|
58
|
+
containerClass: {
|
|
59
|
+
type: [
|
|
60
|
+
String,
|
|
61
|
+
Array,
|
|
62
|
+
Object,
|
|
63
|
+
],
|
|
64
|
+
default: undefined,
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const slots = defineSlots<{
|
|
69
|
+
prepend(): VNode[],
|
|
70
|
+
append(): VNode[],
|
|
71
|
+
}>()
|
|
72
|
+
|
|
73
|
+
const setting = inject(INPUTGROUP_SETTING, undefined, false)
|
|
74
|
+
|
|
75
|
+
const classNames = computed(() => {
|
|
76
|
+
const result: string[] = []
|
|
77
|
+
|
|
78
|
+
// eslint-disable-next-line unicorn/explicit-length-check
|
|
79
|
+
if (setting?.size.value)
|
|
80
|
+
result.push(`input--${setting?.size.value}`)
|
|
81
|
+
// eslint-disable-next-line unicorn/explicit-length-check
|
|
82
|
+
else if (props.size)
|
|
83
|
+
result.push(`input--${props.size}`)
|
|
84
|
+
|
|
85
|
+
if (props.disabled)
|
|
86
|
+
result.push('input--disabled')
|
|
87
|
+
|
|
88
|
+
if (props.readonly)
|
|
89
|
+
result.push('input--readonly')
|
|
90
|
+
|
|
91
|
+
if (props.error)
|
|
92
|
+
result.push('input--error', 'state--error')
|
|
93
|
+
|
|
94
|
+
if (slots.prepend)
|
|
95
|
+
result.push('input--has-prepend')
|
|
96
|
+
|
|
97
|
+
if (slots.append)
|
|
98
|
+
result.push('input--has-append')
|
|
99
|
+
|
|
100
|
+
return result
|
|
101
|
+
})
|
|
102
|
+
</script>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="select__tags">
|
|
3
|
+
<template
|
|
4
|
+
v-for="(item, i) in shownItems"
|
|
5
|
+
:key="i">
|
|
6
|
+
<p-label
|
|
7
|
+
data-testid="select-tag"
|
|
8
|
+
variant="light"
|
|
9
|
+
size="xs">
|
|
10
|
+
{{ item.text }}
|
|
11
|
+
</p-label>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-if="items.length > displayLimit">
|
|
14
|
+
<p-label
|
|
15
|
+
data-testid="select-tag-others"
|
|
16
|
+
variant="light"
|
|
17
|
+
size="xs">
|
|
18
|
+
{{ otherText }}
|
|
19
|
+
</p-label>
|
|
20
|
+
</template>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import { PropType, computed } from 'vue-demi'
|
|
26
|
+
import { SelectItem } from '.'
|
|
27
|
+
import pLabel from '../label/Label.vue'
|
|
28
|
+
|
|
29
|
+
const props = defineProps({
|
|
30
|
+
items: {
|
|
31
|
+
type : Array as PropType<SelectItem[]>,
|
|
32
|
+
default: () => ([]),
|
|
33
|
+
},
|
|
34
|
+
displayLimit: {
|
|
35
|
+
type : Number,
|
|
36
|
+
default: 2,
|
|
37
|
+
},
|
|
38
|
+
limitText: {
|
|
39
|
+
type : String,
|
|
40
|
+
default: '+{n} Other(s)',
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const shownItems = computed(() => {
|
|
45
|
+
return props.items.slice(0, props.displayLimit)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const otherText = computed(() => {
|
|
49
|
+
return props.limitText.replaceAll('{n}', String(props.items.length - props.displayLimit))
|
|
50
|
+
})
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style lang="postcss">
|
|
54
|
+
.select__tags {
|
|
55
|
+
@apply flex space-x-1 items-center min-h-6;
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
@@ -2,4 +2,16 @@ import { SelectItem } from '..';
|
|
|
2
2
|
import { watch } from 'vue-demi';
|
|
3
3
|
export type LoadFn = (keyword: string, page: number, perPage: number) => Promise<SelectItem[]>;
|
|
4
4
|
export type WatchDeps = Parameters<typeof watch>[0];
|
|
5
|
-
export
|
|
5
|
+
export interface AsyncAdapterOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Default perPage
|
|
8
|
+
* @default 20
|
|
9
|
+
*/
|
|
10
|
+
perPage: number;
|
|
11
|
+
/**
|
|
12
|
+
* Typing debounce time
|
|
13
|
+
* @default 500
|
|
14
|
+
*/
|
|
15
|
+
debounceTime: number;
|
|
16
|
+
}
|
|
17
|
+
export default function defineAsyncAdapter(loadFn: LoadFn, deps?: WatchDeps, opts?: Partial<AsyncAdapterOptions>): import("./adapter").Adapter;
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { tryOnMounted } from "@vueuse/shared";
|
|
2
2
|
import { defineAdapter } from "./adapter.mjs";
|
|
3
3
|
import { onFinishTyping, onStartTyping } from "../utils/use-on-typing.mjs";
|
|
4
|
-
import {
|
|
5
|
-
getCurrentInstance,
|
|
6
|
-
ref,
|
|
7
|
-
watch
|
|
8
|
-
} from "vue-demi";
|
|
4
|
+
import { ref, watch } from "vue-demi";
|
|
9
5
|
import { onScrollBottom } from "../utils/use-on-scroll.mjs";
|
|
10
|
-
|
|
6
|
+
import defu from "defu";
|
|
7
|
+
export default function defineAsyncAdapter(loadFn, deps, opts) {
|
|
8
|
+
const config = defu(opts, { perPage: 20, debounceTime: 500 });
|
|
11
9
|
return defineAdapter({
|
|
12
|
-
setup({ isLoading, keyword }) {
|
|
10
|
+
setup({ isLoading, keyword, menuEl }) {
|
|
13
11
|
const options = ref([]);
|
|
14
12
|
const page = ref(1);
|
|
15
13
|
const isFinish = ref(false);
|
|
16
14
|
const isTyping = ref(false);
|
|
17
|
-
const vm = getCurrentInstance();
|
|
18
|
-
const menuDiv = ref();
|
|
19
15
|
function load() {
|
|
20
16
|
isLoading.value = true;
|
|
21
|
-
loadFn(keyword.value, page.value,
|
|
17
|
+
loadFn(keyword.value, page.value, config.perPage).then((result) => {
|
|
22
18
|
if (Array.isArray(result) && result.length > 0) {
|
|
23
19
|
options.value.push(...result);
|
|
24
20
|
page.value++;
|
|
@@ -41,9 +37,6 @@ export default function defineAsyncAdapter(loadFn, deps) {
|
|
|
41
37
|
});
|
|
42
38
|
}
|
|
43
39
|
tryOnMounted(() => {
|
|
44
|
-
if (vm?.proxy?.$el) {
|
|
45
|
-
menuDiv.value = vm.proxy.$el.querySelector(".dropdown__menu");
|
|
46
|
-
}
|
|
47
40
|
load();
|
|
48
41
|
});
|
|
49
42
|
onStartTyping(keyword, () => {
|
|
@@ -53,11 +46,11 @@ export default function defineAsyncAdapter(loadFn, deps) {
|
|
|
53
46
|
onFinishTyping(keyword, () => {
|
|
54
47
|
isTyping.value = false;
|
|
55
48
|
load();
|
|
56
|
-
});
|
|
49
|
+
}, config.debounceTime);
|
|
57
50
|
watch(isTyping, (value) => {
|
|
58
51
|
isLoading.value = value;
|
|
59
52
|
});
|
|
60
|
-
onScrollBottom(
|
|
53
|
+
onScrollBottom(menuEl, () => {
|
|
61
54
|
if (!isLoading.value && !isFinish.value)
|
|
62
55
|
load();
|
|
63
56
|
});
|
|
@@ -2,6 +2,7 @@ export interface SelectItem {
|
|
|
2
2
|
text: string;
|
|
3
3
|
value: unknown;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
+
[key: string]: unknown;
|
|
5
6
|
}
|
|
6
7
|
export interface SelectProps {
|
|
7
8
|
modelValue: unknown;
|
|
@@ -10,3 +11,4 @@ export interface SelectProps {
|
|
|
10
11
|
}
|
|
11
12
|
export declare function defineOptions(options: SelectItem[]): SelectItem[];
|
|
12
13
|
export declare function findSelected(items: SelectItem[], value: unknown): SelectItem;
|
|
14
|
+
export declare function filterSelected(items: SelectItem[], value: unknown[]): SelectItem[];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { isEqual } from "../utils/value.mjs";
|
|
1
|
+
import { isEqual, valueIn } from "../utils/value.mjs";
|
|
2
2
|
export function defineOptions(options) {
|
|
3
3
|
return options;
|
|
4
4
|
}
|
|
5
5
|
export function findSelected(items, value) {
|
|
6
6
|
return items.find((item) => isEqual(item.value, value)) ?? { text: "", value: void 0 };
|
|
7
7
|
}
|
|
8
|
+
export function filterSelected(items, value) {
|
|
9
|
+
return Array.isArray(value) ? items.filter((item) => valueIn(value, item.value)) : [];
|
|
10
|
+
}
|
|
@@ -62,10 +62,9 @@ const props = defineProps({
|
|
|
62
62
|
},
|
|
63
63
|
})
|
|
64
64
|
|
|
65
|
-
// eslint-disable-next-line func-call-spacing
|
|
66
65
|
const emit = defineEmits<{
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
'update:modelValue': [boolean],
|
|
67
|
+
'close': [Event],
|
|
69
68
|
}>()
|
|
70
69
|
|
|
71
70
|
const target = ref<HTMLDivElement>()
|
|
@@ -10,124 +10,113 @@
|
|
|
10
10
|
<div
|
|
11
11
|
ref="sidebarMenus"
|
|
12
12
|
data-testid="sidebar-menus"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<slot
|
|
24
|
-
</
|
|
13
|
+
class="sidebar__menus">
|
|
14
|
+
<SidebarContent>
|
|
15
|
+
<slot />
|
|
16
|
+
</SidebarContent>
|
|
17
|
+
</div>
|
|
18
|
+
<div
|
|
19
|
+
ref="bottom"
|
|
20
|
+
data-testid="sidebar-bottom"
|
|
21
|
+
class="sidebar__bottom">
|
|
22
|
+
<SidebarContent bottom>
|
|
23
|
+
<slot />
|
|
24
|
+
</SidebarContent>
|
|
25
|
+
<slot name="bottom" />
|
|
25
26
|
</div>
|
|
26
27
|
</aside>
|
|
27
28
|
</template>
|
|
28
29
|
|
|
29
|
-
<script>
|
|
30
|
-
import { templateRef, useElementSize } from "@vueuse/core";
|
|
30
|
+
<script lang="ts" setup>
|
|
31
31
|
import {
|
|
32
|
-
|
|
32
|
+
PropType,
|
|
33
33
|
computed,
|
|
34
|
-
ref,
|
|
35
34
|
provide,
|
|
36
|
-
|
|
37
|
-
} from
|
|
38
|
-
import { SIDEBAR_SETTINGS } from
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: false
|
|
58
|
-
},
|
|
59
|
-
sticky: {
|
|
60
|
-
type: Boolean,
|
|
61
|
-
default: false
|
|
62
|
-
},
|
|
63
|
-
toggleable: {
|
|
64
|
-
type: String,
|
|
65
|
-
default: void 0
|
|
66
|
-
},
|
|
67
|
-
modelValue: {
|
|
68
|
-
type: Boolean,
|
|
69
|
-
default: true
|
|
70
|
-
}
|
|
35
|
+
ref,
|
|
36
|
+
} from 'vue-demi'
|
|
37
|
+
import { SIDEBAR_SETTINGS, TypeVariant } from '.'
|
|
38
|
+
import { useVModel } from '../input'
|
|
39
|
+
import { StyleVariant, AlignVariant } from '../nav'
|
|
40
|
+
import { ToggleableVariant } from '../navbar'
|
|
41
|
+
import SidebarContent from './SidebarContent.vue'
|
|
42
|
+
|
|
43
|
+
const props = defineProps({
|
|
44
|
+
variant: {
|
|
45
|
+
type : String as PropType<StyleVariant>,
|
|
46
|
+
default: 'pills',
|
|
47
|
+
},
|
|
48
|
+
align: {
|
|
49
|
+
type : String as PropType<AlignVariant>,
|
|
50
|
+
default: 'left',
|
|
51
|
+
},
|
|
52
|
+
type: {
|
|
53
|
+
type : String as PropType<TypeVariant>,
|
|
54
|
+
default: 'wide',
|
|
71
55
|
},
|
|
56
|
+
fixed: {
|
|
57
|
+
type : Boolean,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
sticky: {
|
|
61
|
+
type : Boolean,
|
|
62
|
+
default: false,
|
|
63
|
+
},
|
|
64
|
+
toggleable: {
|
|
65
|
+
type : String as PropType<ToggleableVariant>,
|
|
66
|
+
default: undefined,
|
|
67
|
+
},
|
|
68
|
+
modelValue: {
|
|
69
|
+
type : Boolean,
|
|
70
|
+
default: true,
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
defineOptions({
|
|
72
75
|
models: {
|
|
73
|
-
prop:
|
|
74
|
-
event:
|
|
76
|
+
prop : 'modelValue',
|
|
77
|
+
event: 'update:modelValue',
|
|
75
78
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
onMounted(() => {
|
|
118
|
-
titleHeight.value = document.querySelectorAll(".sidebar .nav--has-title").length * 0.25 * 20;
|
|
119
|
-
isBottomMenu.value = document.querySelectorAll(".sidebar .sidebar__nav--bottom").length > 0;
|
|
120
|
-
isDefault.value = document.querySelectorAll(".sidebar .sidebar__nav:not(.sidebar__nav--bottom)").length > 0;
|
|
121
|
-
});
|
|
122
|
-
return {
|
|
123
|
-
classNames,
|
|
124
|
-
bottomHeight,
|
|
125
|
-
brandHeight,
|
|
126
|
-
isBottomMenu,
|
|
127
|
-
isDefault
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
});
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
defineEmits<{
|
|
82
|
+
'update:modelValue': [boolean],
|
|
83
|
+
}>()
|
|
84
|
+
|
|
85
|
+
const model = useVModel(props)
|
|
86
|
+
const bottom = ref<HTMLDivElement>()
|
|
87
|
+
|
|
88
|
+
const classNames = computed(() => {
|
|
89
|
+
const result: string[] = ['']
|
|
90
|
+
|
|
91
|
+
if (props.type)
|
|
92
|
+
result.push(`sidebar--${props.type}`)
|
|
93
|
+
|
|
94
|
+
if (props.align)
|
|
95
|
+
result.push(`sidebar--${props.align}`)
|
|
96
|
+
|
|
97
|
+
if (props.variant)
|
|
98
|
+
result.push(`sidebar--${props.variant}`)
|
|
99
|
+
|
|
100
|
+
if (props.fixed)
|
|
101
|
+
result.push('sidebar--fixed')
|
|
102
|
+
|
|
103
|
+
if (props.sticky)
|
|
104
|
+
result.push('sidebar--sticky')
|
|
105
|
+
|
|
106
|
+
if (props.toggleable)
|
|
107
|
+
result.push(`sidebar--toggleable sidebar--toggleable-${props.toggleable}`)
|
|
108
|
+
|
|
109
|
+
if (props.toggleable && props.fixed && model.value)
|
|
110
|
+
result.push('sidebar--show')
|
|
111
|
+
|
|
112
|
+
return result
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
provide(SIDEBAR_SETTINGS, {
|
|
116
|
+
variant: props.variant,
|
|
117
|
+
align : props.align,
|
|
118
|
+
type : props.type,
|
|
119
|
+
})
|
|
131
120
|
</script>
|
|
132
121
|
|
|
133
122
|
<style lang="postcss">
|
|
@@ -141,7 +130,7 @@ export default defineComponent({
|
|
|
141
130
|
--p-sidebar-padding-x: theme(spacing.2);
|
|
142
131
|
--p-sidebar-padding-y: theme(spacing.4);
|
|
143
132
|
|
|
144
|
-
@apply bg-[color:var(--p-sidebar-bg)] px-[var(--p-sidebar-padding-x)] py-[var(--p-sidebar-padding-y)];
|
|
133
|
+
@apply bg-[color:var(--p-sidebar-bg)] px-[var(--p-sidebar-padding-x)] py-[var(--p-sidebar-padding-y)] flex flex-col items-stretch;
|
|
145
134
|
@apply dark:bg-[color:var(--p-sidebar-bg-dark)];
|
|
146
135
|
|
|
147
136
|
/**
|
|
@@ -165,10 +154,10 @@ export default defineComponent({
|
|
|
165
154
|
* Fixed sidebar
|
|
166
155
|
*/
|
|
167
156
|
&&--fixed {
|
|
168
|
-
@apply fixed z-[var(--p-sidebar-z-index)] top-0 h-full shadow-lg
|
|
157
|
+
@apply fixed z-[var(--p-sidebar-z-index)] top-0 h-full shadow-lg;
|
|
169
158
|
|
|
170
159
|
.sidebar__menus {
|
|
171
|
-
@apply
|
|
160
|
+
@apply flex-grow h-full overflow-y-auto py-2;
|
|
172
161
|
}
|
|
173
162
|
|
|
174
163
|
&:not(.sidebar--right) {
|
|
@@ -176,12 +165,8 @@ export default defineComponent({
|
|
|
176
165
|
}
|
|
177
166
|
|
|
178
167
|
.sidebar__bottom {
|
|
179
|
-
@apply
|
|
168
|
+
@apply w-full bg-[color:var(--p-sidebar-bg)] flex-shrink-0 pt-2;
|
|
180
169
|
@apply dark:bg-[color:var(--p-sidebar-bg-dark)];
|
|
181
|
-
|
|
182
|
-
.sidebar__nav {
|
|
183
|
-
@apply px-2;
|
|
184
|
-
}
|
|
185
170
|
}
|
|
186
171
|
|
|
187
172
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<render />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" setup>
|
|
6
|
+
import { VNode, h } from 'vue-demi'
|
|
7
|
+
import { findAllChildren, toBoolean } from '../utils/vnode'
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
bottom: {
|
|
11
|
+
type : Boolean,
|
|
12
|
+
default: false,
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const slots = defineSlots<{
|
|
17
|
+
default:() => VNode[],
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const render = () => {
|
|
21
|
+
const navs = props.bottom
|
|
22
|
+
? findAllChildren(slots.default(), 'SidebarNav').filter((vnode) => toBoolean(vnode.props?.bottom))
|
|
23
|
+
: findAllChildren(slots.default(), '*').filter((vnode) => toBoolean(vnode.props?.bottom) !== true)
|
|
24
|
+
|
|
25
|
+
return navs.map((nav) => h(nav))
|
|
26
|
+
}
|
|
27
|
+
</script>
|