pxd 0.0.21 → 0.0.22
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 -2
- package/dist/components/avatar/index.vue +4 -6
- package/dist/components/badge/index.vue +4 -3
- package/dist/components/button/index.vue +5 -4
- package/dist/components/chip/index.vue +2 -2
- package/dist/components/collapse/index.vue +3 -5
- package/dist/components/collapse-group/index.vue +2 -2
- package/dist/components/gauge/index.vue +2 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/input/index.vue +2 -2
- package/dist/components/loading-dots/index.vue +1 -1
- package/dist/components/modal/index.vue +113 -0
- package/dist/components/modal/index.vue.d.ts +45 -0
- package/dist/components/note/index.vue +5 -4
- package/dist/components/overlay/index.vue +69 -0
- package/dist/components/overlay/index.vue.d.ts +25 -0
- package/dist/components/pin-input/index.vue +3 -3
- package/dist/components/popover/index.vue +37 -40
- package/dist/components/scrollable/index.vue +11 -13
- package/dist/components/slider/index.vue +6 -4
- package/dist/components/snippet/index.vue +12 -13
- package/dist/components/switch-group/index.vue +2 -2
- package/dist/components/teleport/index.vue +49 -36
- package/dist/components/teleport/index.vue.d.ts +2 -2
- package/dist/components/textarea/index.vue +2 -2
- package/dist/components/toggle/index.vue +2 -2
- package/dist/components/tooltip/index.vue +2 -2
- package/dist/composables/index.d.ts +0 -1
- package/dist/composables/index.js +0 -1
- package/dist/composables/useConfigProviderContext.d.ts +5 -1
- package/dist/composables/useConfigProviderContext.js +6 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/dst.css +23 -14
- package/dist/styles/styles.css +2 -2
- package/dist/styles/tw.css +25 -16
- package/dist/utils/value.d.ts +1 -0
- package/dist/utils/value.js +3 -0
- package/package.json +1 -1
- package/dist/composables/useFallbackProps.d.ts +0 -6
- package/dist/composables/useFallbackProps.js +0 -9
package/README.md
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
# PXD
|
|
2
|
-
|
|
2
|
+
Realizing (slightly adjusting) the general component library of Vue2&3 based on Geist Design System.
|
|
3
|
+
|
|
4
|
+
- [Geist Design System](https://vercel.com/geist/introduction)
|
|
5
|
+
- [Figma(Community)](https://www.figma.com/design/1234567890/PXD-UI?node-id=0-1&t=1234567890-0)
|
|
6
|
+
|
|
7
|
+
[Online Preview](https://pxd-ui.netlify.app/)
|
|
3
8
|
|
|
4
9
|
> [!WARNING]
|
|
5
10
|
> The project is under active development and is not ready for production.
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- Vue 3 Composition API
|
|
15
|
+
- 100% compatible with Vue2&3
|
|
16
|
+
- Complete tree-shaking support
|
|
8
17
|
|
|
9
18
|
## Contribution
|
|
10
19
|
|
|
@@ -113,12 +113,6 @@ defineExpose({
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
117
|
-
.pxd-avatar--loading::after {
|
|
118
|
-
animation: var(--animate-spin);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
116
|
@keyframes placeholder {
|
|
123
117
|
0% {
|
|
124
118
|
background-position: 200% 0;
|
|
@@ -133,5 +127,9 @@ defineExpose({
|
|
|
133
127
|
.pxd-avatar::before {
|
|
134
128
|
animation: placeholder 8s ease-in-out infinite;
|
|
135
129
|
}
|
|
130
|
+
|
|
131
|
+
.pxd-avatar--loading::after {
|
|
132
|
+
animation: var(--animate-spin);
|
|
133
|
+
}
|
|
136
134
|
}
|
|
137
135
|
</style>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { twMerge } from "tailwind-merge";
|
|
3
3
|
import { computed } from "vue";
|
|
4
|
-
import {
|
|
4
|
+
import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
|
|
5
|
+
import { getFallbackValue } from "../../utils/value";
|
|
5
6
|
defineOptions({
|
|
6
7
|
name: "PBadge"
|
|
7
8
|
});
|
|
@@ -39,11 +40,11 @@ const VARIANTS = {
|
|
|
39
40
|
"trial": "text-gray-100 dark:text-gray-1000",
|
|
40
41
|
"turborepo": "text-gray-100 dark:text-gray-1000"
|
|
41
42
|
};
|
|
42
|
-
const computedSize =
|
|
43
|
+
const computedSize = useConfigProviderSize(props.size, SIZES);
|
|
43
44
|
const computedClass = computed(
|
|
44
45
|
() => twMerge(
|
|
45
46
|
"pxd-badge inline-flex items-center justify-center px-2.5 font-medium h-6 text-xs rounded-full font-sans gap-1 !no-underline motion-safe:transition-all",
|
|
46
|
-
|
|
47
|
+
getFallbackValue(props.variant, VARIANTS, "gray"),
|
|
47
48
|
computedSize.value,
|
|
48
49
|
props.variant
|
|
49
50
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { twMerge } from "tailwind-merge";
|
|
3
3
|
import { computed } from "vue";
|
|
4
|
-
import {
|
|
4
|
+
import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
|
|
5
|
+
import { getFallbackValue } from "../../utils/value";
|
|
5
6
|
import PSpinner from "../spinner/index.vue";
|
|
6
7
|
defineOptions({
|
|
7
8
|
name: "PButton"
|
|
@@ -45,8 +46,8 @@ const ALIGNMENTS = {
|
|
|
45
46
|
right: "justify-end"
|
|
46
47
|
};
|
|
47
48
|
const DISABLED_CLASS_NAMES = "is-disabled bg-gray-100 hover:bg-gray-100 active:bg-gray-100 cursor-not-allowed text-gray-700 border-gray-300";
|
|
48
|
-
const computedSize =
|
|
49
|
-
const computedFontSize =
|
|
49
|
+
const computedSize = useConfigProviderSize(props.size, SIZES);
|
|
50
|
+
const computedFontSize = useConfigProviderSize(props.size, FONT_SIZES);
|
|
50
51
|
const computedDisabled = computed(() => props.disabled || props.loading);
|
|
51
52
|
const computedClass = computed(() => {
|
|
52
53
|
const classNames = ["pxd-button cursor-pointer select-none items-center motion-safe:transition-all", ALIGNMENTS[props.align]];
|
|
@@ -57,7 +58,7 @@ const computedClass = computed(() => {
|
|
|
57
58
|
}
|
|
58
59
|
if (variant !== "simple") {
|
|
59
60
|
classNames.push("border outline-none self-focus-ring");
|
|
60
|
-
classNames.push(
|
|
61
|
+
classNames.push(getFallbackValue(variant, VARIANTS));
|
|
61
62
|
classNames.push(computedSize.value);
|
|
62
63
|
}
|
|
63
64
|
classNames.push(block ? "flex w-full" : "inline-flex");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
-
import { getFallbackVariant } from "../../composables/useFallbackProps";
|
|
4
3
|
import { getCssUnitValue } from "../../utils/format";
|
|
4
|
+
import { getFallbackValue } from "../../utils/value";
|
|
5
5
|
const props = defineProps({
|
|
6
6
|
size: { type: [Number, String], required: false, default: 10 },
|
|
7
7
|
inset: { type: Boolean, required: false },
|
|
@@ -24,7 +24,7 @@ const computedClass = computed(() => {
|
|
|
24
24
|
if (!inset) {
|
|
25
25
|
basic.push("translate-x-1/2 -translate-y-1/3");
|
|
26
26
|
}
|
|
27
|
-
basic.push(
|
|
27
|
+
basic.push(getFallbackValue(variant, variantPresets, "primary"));
|
|
28
28
|
return basic;
|
|
29
29
|
});
|
|
30
30
|
</script>
|
|
@@ -104,10 +104,8 @@ onMounted(() => {
|
|
|
104
104
|
will-change: height;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
transition: height var(--default-transition-duration) var(--default-transition-timing-function);
|
|
111
|
-
}
|
|
107
|
+
.pxd-transition--collapse-enter-active,
|
|
108
|
+
.pxd-transition--collapse-leave-active {
|
|
109
|
+
transition: height var(--default-transition-duration) var(--default-transition-timing-function);
|
|
112
110
|
}
|
|
113
111
|
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, provide, ref } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
|
|
4
4
|
defineOptions({
|
|
5
5
|
name: "PCollapseGroup"
|
|
6
6
|
});
|
|
@@ -26,7 +26,7 @@ const SIZES = {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
const expandedItems = ref([]);
|
|
29
|
-
const computedSize =
|
|
29
|
+
const computedSize = useConfigProviderSize(props.size, SIZES);
|
|
30
30
|
const computedStyle = computed(() => {
|
|
31
31
|
const { padding, fontSize, fontWeight } = computedSize.value;
|
|
32
32
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import ChartActivityIcon from "@gdsicon/vue/chart-activity";
|
|
3
3
|
import { computed } from "vue";
|
|
4
|
-
import {
|
|
4
|
+
import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
|
|
5
5
|
import { getColorByThreshold } from "../../utils/colors";
|
|
6
6
|
defineOptions({
|
|
7
7
|
name: "PGauge",
|
|
@@ -33,7 +33,7 @@ const defaultColors = {
|
|
|
33
33
|
30: "var(--color-amber-800)",
|
|
34
34
|
60: "var(--color-green-700)"
|
|
35
35
|
};
|
|
36
|
-
const computedSize =
|
|
36
|
+
const computedSize = useConfigProviderSize(props.size, SIZES);
|
|
37
37
|
const progress = computed(() => {
|
|
38
38
|
if (props.indeterminate) {
|
|
39
39
|
return 0;
|
|
@@ -25,8 +25,10 @@ export { default as Material } from './material/index.vue';
|
|
|
25
25
|
export { default as Menu } from './menu/index.vue';
|
|
26
26
|
export { default as MenuItem } from './menu-item/index.vue';
|
|
27
27
|
export { default as MenuList } from './menu-list/index.vue';
|
|
28
|
+
export { default as Modal } from './modal/index.vue';
|
|
28
29
|
export { default as MoreButton } from './more-button/index.vue';
|
|
29
30
|
export { default as Note } from './note/index.vue';
|
|
31
|
+
export { default as Overlay } from './overlay/index.vue';
|
|
30
32
|
export { default as Pagination } from './pagination/index.vue';
|
|
31
33
|
export { default as PinInput } from './pin-input/index.vue';
|
|
32
34
|
export { default as Popover } from './popover/index.vue';
|
package/dist/components/index.js
CHANGED
|
@@ -25,8 +25,10 @@ export { default as Material } from "./material/index.vue";
|
|
|
25
25
|
export { default as Menu } from "./menu/index.vue";
|
|
26
26
|
export { default as MenuItem } from "./menu-item/index.vue";
|
|
27
27
|
export { default as MenuList } from "./menu-list/index.vue";
|
|
28
|
+
export { default as Modal } from "./modal/index.vue";
|
|
28
29
|
export { default as MoreButton } from "./more-button/index.vue";
|
|
29
30
|
export { default as Note } from "./note/index.vue";
|
|
31
|
+
export { default as Overlay } from "./overlay/index.vue";
|
|
30
32
|
export { default as Pagination } from "./pagination/index.vue";
|
|
31
33
|
export { default as PinInput } from "./pin-input/index.vue";
|
|
32
34
|
export { default as Popover } from "./popover/index.vue";
|
|
@@ -4,7 +4,7 @@ import EyeIcon from "@gdsicon/vue/eye";
|
|
|
4
4
|
import EyeOffIcon from "@gdsicon/vue/eye-off";
|
|
5
5
|
import { twMerge } from "tailwind-merge";
|
|
6
6
|
import { computed, shallowRef } from "vue";
|
|
7
|
-
import {
|
|
7
|
+
import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
|
|
8
8
|
import { useModelValue } from "../../composables/useModelValue";
|
|
9
9
|
import { getUniqueId } from "../../utils/uid";
|
|
10
10
|
import PError from "../error/index.vue";
|
|
@@ -42,7 +42,7 @@ const SIZES = {
|
|
|
42
42
|
};
|
|
43
43
|
const modelValue = useModelValue(props, emits);
|
|
44
44
|
const internalInputType = shallowRef(props.password ? "password" : "text");
|
|
45
|
-
const computedSize =
|
|
45
|
+
const computedSize = useConfigProviderSize(props.size, SIZES);
|
|
46
46
|
const computedClass = computed(() => {
|
|
47
47
|
const basic = ["pxd-input--border flex items-center relative h-full overflow-hidden rounded-md bg-background motion-safe:transition-all"];
|
|
48
48
|
basic.push(computedSize.value);
|
|
@@ -28,7 +28,7 @@ defineOptions({
|
|
|
28
28
|
|
|
29
29
|
@media (prefers-reduced-motion: no-preference) {
|
|
30
30
|
.pxd-loading-dots .pxd-loading--dot {
|
|
31
|
-
animation: fade-loading 1.4s infinite
|
|
31
|
+
animation: fade-loading 1.4s infinite var(--default-transition-timing-function);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
</style>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { nextTick, shallowRef, watch } from "vue";
|
|
3
|
+
import { useModelValue } from "../../composables/useModelValue";
|
|
4
|
+
import POverlay from "../overlay/index.vue";
|
|
5
|
+
import PScrollable from "../scrollable/index.vue";
|
|
6
|
+
defineOptions({
|
|
7
|
+
name: "PModal"
|
|
8
|
+
});
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
title: { type: [String, Number, Array, null], required: false },
|
|
11
|
+
subtitle: { type: [String, Number, Array, null], required: false },
|
|
12
|
+
width: { type: [Number, String], required: false },
|
|
13
|
+
modelValue: { type: Boolean, required: false, default: false },
|
|
14
|
+
headerStyle: { type: Boolean, required: false, default: false },
|
|
15
|
+
footerStyle: { type: Boolean, required: false, default: true },
|
|
16
|
+
appendToBody: { type: Boolean, required: false, default: true },
|
|
17
|
+
closeOnClickModal: { type: Boolean, required: false, default: false }
|
|
18
|
+
});
|
|
19
|
+
const emits = defineEmits(["open", "close", "click-outside", "update:modelValue"]);
|
|
20
|
+
const modalRef = shallowRef();
|
|
21
|
+
const isVisible = useModelValue(props, emits);
|
|
22
|
+
function onOverlayClick(ev) {
|
|
23
|
+
emits("click-outside", ev);
|
|
24
|
+
if (!props.closeOnClickModal) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
isVisible.value = false;
|
|
28
|
+
}
|
|
29
|
+
watch(() => isVisible.value, (visible) => {
|
|
30
|
+
nextTick(() => {
|
|
31
|
+
if (visible) {
|
|
32
|
+
emits("open");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
emits("close");
|
|
36
|
+
});
|
|
37
|
+
}, { flush: "post" });
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<POverlay v-model="isVisible" :append-to-body="appendToBody" @click="onOverlayClick">
|
|
42
|
+
<Transition name="pxd-transition--modal" mode="out-in">
|
|
43
|
+
<div
|
|
44
|
+
v-if="isVisible"
|
|
45
|
+
ref="modalRef"
|
|
46
|
+
class="pxd-modal fixed z-10 flex flex-col h-max overflow-hidden shadow-border-modal rounded-tl-lg rounded-tr-lg sm:rounded-xl bg-background dark:bg-background-secondary w-full max-w-full left-0 bottom-0 sm:top-1/2 sm:left-1/2 sm:-translate-x-1/2 sm:-translate-y-1/2 motion-safe:transition-all"
|
|
47
|
+
:style="{ '--width': width }"
|
|
48
|
+
>
|
|
49
|
+
<header
|
|
50
|
+
class="pxd-modal--header relative shrink-0 py-5 px-6 -mb-6"
|
|
51
|
+
:class="{ 'mb-0 border-b bg-background-secondary dark:bg-background': headerStyle }"
|
|
52
|
+
>
|
|
53
|
+
<h3 class="text-2xl font-semibold">
|
|
54
|
+
<slot name="title">
|
|
55
|
+
{{ title }}
|
|
56
|
+
</slot>
|
|
57
|
+
</h3>
|
|
58
|
+
|
|
59
|
+
<div v-if="subtitle" class="mt-4">
|
|
60
|
+
<slot name="subtitle">
|
|
61
|
+
{{ subtitle }}
|
|
62
|
+
</slot>
|
|
63
|
+
</div>
|
|
64
|
+
</header>
|
|
65
|
+
|
|
66
|
+
<PScrollable
|
|
67
|
+
class="pxd-modal--content flex-1"
|
|
68
|
+
content-class="p-6"
|
|
69
|
+
>
|
|
70
|
+
<slot />
|
|
71
|
+
</PScrollable>
|
|
72
|
+
|
|
73
|
+
<footer
|
|
74
|
+
class="pxd-modal--footer relative p-4 shrink-0 flex items-center justify-between"
|
|
75
|
+
:class="{ 'border-t bg-background-secondary dark:bg-background': footerStyle }"
|
|
76
|
+
>
|
|
77
|
+
<slot name="footer" />
|
|
78
|
+
</footer>
|
|
79
|
+
</div>
|
|
80
|
+
</Transition>
|
|
81
|
+
</POverlay>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<style>
|
|
85
|
+
.pxd-transition--modal-enter-active,
|
|
86
|
+
.pxd-transition--modal-leave-active {
|
|
87
|
+
transition-timing-function: cubic-bezier(0.175,0.885,0.32,1.1);
|
|
88
|
+
transition:
|
|
89
|
+
transform var(--default-transition-duration),
|
|
90
|
+
opacity var(--default-transition-duration);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.pxd-transition--modal-enter-from,
|
|
94
|
+
.pxd-transition--modal-leave-to {
|
|
95
|
+
transform: translate(0, 100%);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@media (width >= 40rem) {
|
|
99
|
+
.pxd-transition--modal-enter-from,
|
|
100
|
+
.pxd-transition--modal-leave-to {
|
|
101
|
+
opacity: 0;
|
|
102
|
+
transform: scale(0.98) !important;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.pxd-modal {
|
|
106
|
+
width: calc(var(--width, 540) * 1px);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.pxd-modal {
|
|
111
|
+
max-height: min(800px, 80vh);
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ComponentLabel } from '../../types/components';
|
|
2
|
+
interface Props {
|
|
3
|
+
title?: ComponentLabel;
|
|
4
|
+
subtitle?: ComponentLabel;
|
|
5
|
+
width?: number | string;
|
|
6
|
+
modelValue?: boolean;
|
|
7
|
+
headerStyle?: boolean;
|
|
8
|
+
footerStyle?: boolean;
|
|
9
|
+
appendToBody?: boolean;
|
|
10
|
+
closeOnClickModal?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare var __VLS_13: {}, __VLS_15: {}, __VLS_20: {}, __VLS_22: {};
|
|
13
|
+
type __VLS_Slots = {} & {
|
|
14
|
+
title?: (props: typeof __VLS_13) => any;
|
|
15
|
+
} & {
|
|
16
|
+
subtitle?: (props: typeof __VLS_15) => any;
|
|
17
|
+
} & {
|
|
18
|
+
default?: (props: typeof __VLS_20) => any;
|
|
19
|
+
} & {
|
|
20
|
+
footer?: (props: typeof __VLS_22) => any;
|
|
21
|
+
};
|
|
22
|
+
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
|
+
open: () => any;
|
|
24
|
+
close: () => any;
|
|
25
|
+
"update:modelValue": (args_0: boolean) => any;
|
|
26
|
+
"click-outside": (args_0: MouseEvent) => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
28
|
+
onOpen?: () => any;
|
|
29
|
+
onClose?: () => any;
|
|
30
|
+
"onUpdate:modelValue"?: (args_0: boolean) => any;
|
|
31
|
+
"onClick-outside"?: (args_0: MouseEvent) => any;
|
|
32
|
+
}>, {
|
|
33
|
+
modelValue: boolean;
|
|
34
|
+
appendToBody: boolean;
|
|
35
|
+
headerStyle: boolean;
|
|
36
|
+
footerStyle: boolean;
|
|
37
|
+
closeOnClickModal: boolean;
|
|
38
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
39
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
40
|
+
export default _default;
|
|
41
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -5,7 +5,8 @@ import StopIcon from "@gdsicon/vue/stop";
|
|
|
5
5
|
import WarningIcon from "@gdsicon/vue/warning";
|
|
6
6
|
import { twMerge } from "tailwind-merge";
|
|
7
7
|
import { computed, h } from "vue";
|
|
8
|
-
import {
|
|
8
|
+
import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
|
|
9
|
+
import { getFallbackValue } from "../../utils/value";
|
|
9
10
|
defineOptions({
|
|
10
11
|
name: "PNote"
|
|
11
12
|
});
|
|
@@ -60,18 +61,18 @@ const VARIANTS = {
|
|
|
60
61
|
const computedLabel = computed(() => {
|
|
61
62
|
const { label } = props;
|
|
62
63
|
if (label === true || label === "") {
|
|
63
|
-
return
|
|
64
|
+
return getFallbackValue(props.variant, VARIANTS).icon;
|
|
64
65
|
}
|
|
65
66
|
if (typeof label === "string" && label) {
|
|
66
67
|
return h("span", null, label);
|
|
67
68
|
}
|
|
68
69
|
return false;
|
|
69
70
|
});
|
|
70
|
-
const computedSize =
|
|
71
|
+
const computedSize = useConfigProviderSize(props.size, SIZES);
|
|
71
72
|
const computedClass = computed(() => {
|
|
72
73
|
const basic = ["pxd-note flex flex-col sm:flex-row sm:items-center gap-2 border rounded-md w-max max-w-full"];
|
|
73
74
|
basic.push(computedSize.value);
|
|
74
|
-
const { fill, classes } =
|
|
75
|
+
const { fill, classes } = getFallbackValue(props.variant, VARIANTS);
|
|
75
76
|
basic.push(props.fill ? fill : classes);
|
|
76
77
|
return twMerge(basic);
|
|
77
78
|
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, nextTick, onBeforeUnmount, shallowRef, watch } from "vue";
|
|
3
|
+
import { getScrollContainer } from "../../utils/dom";
|
|
4
|
+
import PTeleport from "../teleport/index.vue";
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: "POverlay"
|
|
7
|
+
});
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
zIndex: { type: Number, required: false },
|
|
10
|
+
modelValue: { type: Boolean, required: false, default: false },
|
|
11
|
+
appendToBody: { type: Boolean, required: false, default: true },
|
|
12
|
+
overlayClass: { type: String, required: false }
|
|
13
|
+
});
|
|
14
|
+
const emits = defineEmits(["click"]);
|
|
15
|
+
const overlayRef = shallowRef();
|
|
16
|
+
const computedStyle = computed(() => {
|
|
17
|
+
return {
|
|
18
|
+
"--z": props.zIndex
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
function onOverlayClick(ev) {
|
|
22
|
+
emits("click", ev);
|
|
23
|
+
}
|
|
24
|
+
let scrollContainer;
|
|
25
|
+
watch(() => props.modelValue, (visible) => {
|
|
26
|
+
if (!visible) {
|
|
27
|
+
if (scrollContainer) {
|
|
28
|
+
scrollContainer.classList.remove("scroll-disabled");
|
|
29
|
+
}
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
nextTick(() => {
|
|
33
|
+
if (!scrollContainer) {
|
|
34
|
+
const container = getScrollContainer(overlayRef.value);
|
|
35
|
+
scrollContainer = container === window ? document.documentElement : container;
|
|
36
|
+
}
|
|
37
|
+
scrollContainer.classList.add("scroll-disabled");
|
|
38
|
+
});
|
|
39
|
+
}, { immediate: true });
|
|
40
|
+
onBeforeUnmount(() => {
|
|
41
|
+
if (scrollContainer) {
|
|
42
|
+
scrollContainer.classList.remove("scroll-disabled");
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<PTeleport :disabled="!appendToBody">
|
|
49
|
+
<Transition name="pxd-transition--fade" mode="out-in">
|
|
50
|
+
<div
|
|
51
|
+
v-if="modelValue"
|
|
52
|
+
ref="overlayRef"
|
|
53
|
+
tabindex="-1"
|
|
54
|
+
class="pxd-overlay fixed inset-0 bg-black/40 sm:bg-background/80 motion-safe:transition-colors"
|
|
55
|
+
:class="overlayClass"
|
|
56
|
+
:style="computedStyle"
|
|
57
|
+
@click="onOverlayClick"
|
|
58
|
+
/>
|
|
59
|
+
</Transition>
|
|
60
|
+
|
|
61
|
+
<slot />
|
|
62
|
+
</PTeleport>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<style>
|
|
66
|
+
.pxd-overlay {
|
|
67
|
+
z-index: var(--z, 10);
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
zIndex?: number;
|
|
3
|
+
modelValue?: boolean;
|
|
4
|
+
appendToBody?: boolean;
|
|
5
|
+
overlayClass?: string;
|
|
6
|
+
}
|
|
7
|
+
declare var __VLS_9: {};
|
|
8
|
+
type __VLS_Slots = {} & {
|
|
9
|
+
default?: (props: typeof __VLS_9) => any;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
click: (args_0: MouseEvent) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
14
|
+
onClick?: (args_0: MouseEvent) => any;
|
|
15
|
+
}>, {
|
|
16
|
+
modelValue: boolean;
|
|
17
|
+
appendToBody: boolean;
|
|
18
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
19
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref, shallowRef } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
|
|
4
4
|
import { useModelValue } from "../../composables/useModelValue";
|
|
5
5
|
import PError from "../error/index.vue";
|
|
6
6
|
defineOptions({
|
|
@@ -32,7 +32,7 @@ const SIZES = {
|
|
|
32
32
|
};
|
|
33
33
|
const inputsRef = shallowRef([]);
|
|
34
34
|
const modelValue = useModelValue(props, emits);
|
|
35
|
-
const computedSize =
|
|
35
|
+
const computedSize = useConfigProviderSize(props.size, SIZES);
|
|
36
36
|
const modelValueLocal = ref(
|
|
37
37
|
(() => {
|
|
38
38
|
if (typeof props.modelValue === "string") {
|
|
@@ -175,7 +175,7 @@ function onInputPastedValue(ev) {
|
|
|
175
175
|
</div>
|
|
176
176
|
|
|
177
177
|
<div
|
|
178
|
-
class="flex items-center gap-
|
|
178
|
+
class="flex items-center gap-1.5"
|
|
179
179
|
@keydown="onContainerKeydown"
|
|
180
180
|
@compositionend="onCompositionEnd"
|
|
181
181
|
>
|
|
@@ -566,50 +566,47 @@ defineExpose({
|
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
transition
|
|
580
|
-
|
|
581
|
-
margin var(--default-transition-duration) var(--default-transition-timing-function);
|
|
582
|
-
}
|
|
569
|
+
.showTransition.pxd-transition--popover-top-enter-active,
|
|
570
|
+
.hideTransition.pxd-transition--popover-top-leave-active,
|
|
571
|
+
.showTransition.pxd-transition--popover-bottom-enter-active,
|
|
572
|
+
.hideTransition.pxd-transition--popover-bottom-leave-active,
|
|
573
|
+
.showTransition.pxd-transition--popover-left-enter-active,
|
|
574
|
+
.hideTransition.pxd-transition--popover-left-leave-active,
|
|
575
|
+
.showTransition.pxd-transition--popover-right-enter-active,
|
|
576
|
+
.hideTransition.pxd-transition--popover-right-leave-active {
|
|
577
|
+
transition:
|
|
578
|
+
opacity var(--default-transition-duration) var(--default-transition-timing-function),
|
|
579
|
+
margin var(--default-transition-duration) var(--default-transition-timing-function);
|
|
580
|
+
}
|
|
583
581
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
582
|
+
.showTransition.pxd-transition--popover-top-enter-from,
|
|
583
|
+
.hideTransition.pxd-transition--popover-top-leave-to,
|
|
584
|
+
.showTransition.pxd-transition--popover-bottom-enter-from,
|
|
585
|
+
.hideTransition.pxd-transition--popover-bottom-leave-to,
|
|
586
|
+
.showTransition.pxd-transition--popover-left-enter-from,
|
|
587
|
+
.hideTransition.pxd-transition--popover-left-leave-to,
|
|
588
|
+
.showTransition.pxd-transition--popover-right-enter-from,
|
|
589
|
+
.hideTransition.pxd-transition--popover-right-leave-to {
|
|
590
|
+
opacity: 0;
|
|
591
|
+
}
|
|
594
592
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
593
|
+
.showTransition.pxd-transition--popover-top-enter-from,
|
|
594
|
+
.hideTransition.pxd-transition--popover-top-leave-to {
|
|
595
|
+
margin-top: calc(1px * var(--translate-offset));
|
|
596
|
+
}
|
|
599
597
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
598
|
+
.showTransition.pxd-transition--popover-bottom-enter-from,
|
|
599
|
+
.hideTransition.pxd-transition--popover-bottom-leave-to {
|
|
600
|
+
margin-top: calc(-1px * var(--translate-offset));
|
|
601
|
+
}
|
|
604
602
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
603
|
+
.showTransition.pxd-transition--popover-left-enter-from,
|
|
604
|
+
.hideTransition.pxd-transition--popover-left-leave-to {
|
|
605
|
+
margin-left: calc(1px * var(--translate-offset));
|
|
606
|
+
}
|
|
609
607
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
}
|
|
608
|
+
.showTransition.pxd-transition--popover-right-enter-from,
|
|
609
|
+
.hideTransition.pxd-transition--popover-right-leave-to {
|
|
610
|
+
margin-left: calc(-1px * var(--translate-offset));
|
|
614
611
|
}
|
|
615
612
|
</style>
|