pxd 0.0.21 → 0.0.23

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.
Files changed (53) hide show
  1. package/README.md +11 -2
  2. package/dist/components/avatar/index.vue +4 -6
  3. package/dist/components/badge/index.vue +4 -3
  4. package/dist/components/button/index.vue +7 -5
  5. package/dist/components/chip/index.vue +2 -2
  6. package/dist/components/collapse/index.vue +3 -5
  7. package/dist/components/collapse-group/index.vue +2 -2
  8. package/dist/components/gauge/index.vue +2 -2
  9. package/dist/components/index.d.ts +2 -0
  10. package/dist/components/index.js +2 -0
  11. package/dist/components/input/index.vue +2 -2
  12. package/dist/components/loading-dots/index.vue +1 -1
  13. package/dist/components/modal/index.vue +130 -0
  14. package/dist/components/modal/index.vue.d.ts +47 -0
  15. package/dist/components/note/index.vue +5 -4
  16. package/dist/components/overlay/index.vue +70 -0
  17. package/dist/components/overlay/index.vue.d.ts +25 -0
  18. package/dist/components/pin-input/index.vue +3 -3
  19. package/dist/components/popover/index.vue +68 -46
  20. package/dist/components/popover/index.vue.d.ts +6 -0
  21. package/dist/components/scrollable/index.vue +11 -13
  22. package/dist/components/slider/index.vue +8 -6
  23. package/dist/components/snippet/index.vue +12 -13
  24. package/dist/components/switch-group/index.vue +2 -2
  25. package/dist/components/teleport/index.vue +49 -36
  26. package/dist/components/teleport/index.vue.d.ts +2 -2
  27. package/dist/components/textarea/index.vue +2 -2
  28. package/dist/components/theme-switcher/index.vue +11 -11
  29. package/dist/components/theme-switcher/index.vue.d.ts +0 -1
  30. package/dist/components/toggle/index.vue +2 -2
  31. package/dist/components/tooltip/index.vue +2 -2
  32. package/dist/composables/index.d.ts +2 -1
  33. package/dist/composables/index.js +2 -1
  34. package/dist/composables/useConfigProviderContext.d.ts +5 -1
  35. package/dist/composables/useConfigProviderContext.js +6 -1
  36. package/dist/composables/useFocusTrap.d.ts +3 -0
  37. package/dist/composables/useFocusTrap.js +45 -0
  38. package/dist/composables/useMutationObserver.d.ts +7 -0
  39. package/dist/composables/useMutationObserver.js +35 -0
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.js +1 -1
  42. package/dist/styles/dst.css +23 -14
  43. package/dist/styles/styles.css +1 -1
  44. package/dist/styles/tw.css +25 -16
  45. package/dist/utils/dom.d.ts +1 -0
  46. package/dist/utils/dom.js +7 -0
  47. package/dist/utils/format.d.ts +1 -0
  48. package/dist/utils/format.js +3 -0
  49. package/dist/utils/value.d.ts +1 -0
  50. package/dist/utils/value.js +3 -0
  51. package/package.json +1 -1
  52. package/dist/composables/useFallbackProps.d.ts +0 -6
  53. package/dist/composables/useFallbackProps.js +0 -9
package/README.md CHANGED
@@ -1,10 +1,19 @@
1
1
  # PXD
2
- A universal UI component library for Vue2&3
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
- [Online Preview](https://pxd-ui.netlify.app/)
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 { getFallbackVariant, useComputedSize } from "../../composables/useFallbackProps";
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 = useComputedSize(props.size, SIZES);
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
- getFallbackVariant(props.variant, VARIANTS, "gray"),
47
+ getFallbackValue(props.variant, VARIANTS, "gray"),
47
48
  computedSize.value,
48
49
  props.variant
49
50
  )
@@ -1,7 +1,9 @@
1
1
  <script setup>
2
2
  import { twMerge } from "tailwind-merge";
3
3
  import { computed } from "vue";
4
- import { getFallbackVariant, useComputedSize } from "../../composables/useFallbackProps";
4
+ import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
5
+ import { isTruthyProp } from "../../utils/format";
6
+ import { getFallbackValue } from "../../utils/value";
5
7
  import PSpinner from "../spinner/index.vue";
6
8
  defineOptions({
7
9
  name: "PButton"
@@ -45,8 +47,8 @@ const ALIGNMENTS = {
45
47
  right: "justify-end"
46
48
  };
47
49
  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 = useComputedSize(props.size, SIZES);
49
- const computedFontSize = useComputedSize(props.size, FONT_SIZES);
50
+ const computedSize = useConfigProviderSize(props.size, SIZES);
51
+ const computedFontSize = useConfigProviderSize(props.size, FONT_SIZES);
50
52
  const computedDisabled = computed(() => props.disabled || props.loading);
51
53
  const computedClass = computed(() => {
52
54
  const classNames = ["pxd-button cursor-pointer select-none items-center motion-safe:transition-all", ALIGNMENTS[props.align]];
@@ -57,10 +59,10 @@ const computedClass = computed(() => {
57
59
  }
58
60
  if (variant !== "simple") {
59
61
  classNames.push("border outline-none self-focus-ring");
60
- classNames.push(getFallbackVariant(variant, VARIANTS));
62
+ classNames.push(getFallbackValue(variant, VARIANTS));
61
63
  classNames.push(computedSize.value);
62
64
  }
63
- classNames.push(block ? "flex w-full" : "inline-flex");
65
+ classNames.push(isTruthyProp(block) ? "flex w-full" : "inline-flex");
64
66
  if (computedDisabled.value) {
65
67
  classNames.push(DISABLED_CLASS_NAMES);
66
68
  }
@@ -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(getFallbackVariant(variant, variantPresets, "primary"));
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
- @media (prefers-reduced-motion: no-preference) {
108
- .pxd-transition--collapse-enter-active,
109
- .pxd-transition--collapse-leave-active {
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 { useComputedSize } from "../../composables/useFallbackProps";
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 = useComputedSize(props.size, SIZES);
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 { useComputedSize } from "../../composables/useFallbackProps";
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 = useComputedSize(props.size, SIZES);
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';
@@ -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 { useComputedSize } from "../../composables/useFallbackProps";
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 = useComputedSize(props.size, SIZES);
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 ease-in-out;
31
+ animation: fade-loading 1.4s infinite var(--default-transition-timing-function);
32
32
  }
33
33
  }
34
34
  </style>
@@ -0,0 +1,130 @@
1
+ <script setup>
2
+ import { nextTick, watch } from "vue";
3
+ import { useFocusTrap } from "../../composables/useFocusTrap";
4
+ import { useModelValue } from "../../composables/useModelValue";
5
+ import POverlay from "../overlay/index.vue";
6
+ import PScrollable from "../scrollable/index.vue";
7
+ defineOptions({
8
+ name: "PModal",
9
+ model: {
10
+ prop: "modelValue",
11
+ event: "update:modelValue"
12
+ }
13
+ });
14
+ const props = defineProps({
15
+ title: { type: [String, Number, Array, null], required: false },
16
+ subtitle: { type: [String, Number, Array, null], required: false },
17
+ width: { type: [Number, String], required: false },
18
+ modelValue: { type: Boolean, required: false, default: false },
19
+ headerStyle: { type: Boolean, required: false, default: false },
20
+ footerStyle: { type: Boolean, required: false, default: true },
21
+ appendToBody: { type: Boolean, required: false, default: true },
22
+ closeOnPressEscape: { type: Boolean, required: false, default: false },
23
+ closeOnClickOverlay: { type: Boolean, required: false, default: false }
24
+ });
25
+ const emits = defineEmits(["open", "close", "click-outside", "update:modelValue"]);
26
+ const isVisible = useModelValue(props, emits);
27
+ const { containerRef: modalRef } = useFocusTrap();
28
+ function onOverlayClick(ev) {
29
+ emits("click-outside", ev);
30
+ if (!props.closeOnClickOverlay) {
31
+ return;
32
+ }
33
+ isVisible.value = false;
34
+ }
35
+ function onModalKeydown() {
36
+ if (!props.closeOnPressEscape) {
37
+ return;
38
+ }
39
+ isVisible.value = false;
40
+ }
41
+ watch(() => isVisible.value, (visible) => {
42
+ nextTick(() => {
43
+ if (visible) {
44
+ emits("open");
45
+ return;
46
+ }
47
+ emits("close");
48
+ });
49
+ }, { flush: "post" });
50
+ </script>
51
+
52
+ <template>
53
+ <POverlay v-model="isVisible" :append-to-body="appendToBody" @click="onOverlayClick">
54
+ <Transition name="pxd-transition--modal" mode="out-in">
55
+ <div
56
+ v-if="isVisible"
57
+ ref="modalRef"
58
+ role="dialog"
59
+ tabindex="-1"
60
+ aria-modal="true"
61
+ 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 outline-none sm:top-1/2 sm:left-1/2 sm:-translate-x-1/2 sm:-translate-y-1/2 motion-safe:transition-all"
62
+ :style="{ '--width': width }"
63
+ @keydown.esc="onModalKeydown"
64
+ >
65
+ <header
66
+ class="pxd-modal--header relative shrink-0 py-5 px-6 -mb-6"
67
+ :class="{ 'mb-0 border-b bg-background-secondary dark:bg-background': headerStyle }"
68
+ >
69
+ <h3 class="text-2xl font-semibold tracking-tight">
70
+ <slot name="title">
71
+ {{ title }}
72
+ </slot>
73
+ </h3>
74
+
75
+ <div v-if="subtitle" class="mt-4">
76
+ <slot name="subtitle">
77
+ {{ subtitle }}
78
+ </slot>
79
+ </div>
80
+ </header>
81
+
82
+ <PScrollable
83
+ class="pxd-modal--content flex-1"
84
+ content-class="p-6"
85
+ >
86
+ <slot />
87
+ </PScrollable>
88
+
89
+ <footer
90
+ class="pxd-modal--footer relative p-4 shrink-0 flex items-center justify-between"
91
+ :class="{ 'border-t bg-background-secondary dark:bg-background': footerStyle }"
92
+ >
93
+ <slot name="footer" />
94
+ </footer>
95
+ </div>
96
+ </Transition>
97
+ </POverlay>
98
+ </template>
99
+
100
+ <style>
101
+ .pxd-transition--modal-enter-active,
102
+ .pxd-transition--modal-leave-active {
103
+ /* transition-timing-function: cubic-bezier(0.175,0.885,0.32,1.1); */
104
+ transition-timing-function: var(--default-transition-timing-function);
105
+ transition:
106
+ transform var(--default-transition-duration),
107
+ opacity var(--default-transition-duration);
108
+ }
109
+
110
+ .pxd-transition--modal-enter-from,
111
+ .pxd-transition--modal-leave-to {
112
+ transform: translate(0, 100%);
113
+ }
114
+
115
+ @media (width >= 40rem) {
116
+ .pxd-transition--modal-enter-from,
117
+ .pxd-transition--modal-leave-to {
118
+ opacity: 0;
119
+ transform: scale(0.98) !important;
120
+ }
121
+
122
+ .pxd-modal {
123
+ width: calc(var(--width, 540) * 1px);
124
+ }
125
+ }
126
+
127
+ .pxd-modal {
128
+ max-height: min(800px, 80vh);
129
+ }
130
+ </style>
@@ -0,0 +1,47 @@
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
+ closeOnPressEscape?: boolean;
11
+ closeOnClickOverlay?: boolean;
12
+ }
13
+ declare var __VLS_13: {}, __VLS_15: {}, __VLS_20: {}, __VLS_22: {};
14
+ type __VLS_Slots = {} & {
15
+ title?: (props: typeof __VLS_13) => any;
16
+ } & {
17
+ subtitle?: (props: typeof __VLS_15) => any;
18
+ } & {
19
+ default?: (props: typeof __VLS_20) => any;
20
+ } & {
21
+ footer?: (props: typeof __VLS_22) => any;
22
+ };
23
+ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ open: () => any;
25
+ close: () => any;
26
+ "update:modelValue": (args_0: boolean) => any;
27
+ "click-outside": (args_0: MouseEvent) => any;
28
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
29
+ onOpen?: () => any;
30
+ onClose?: () => any;
31
+ "onUpdate:modelValue"?: (args_0: boolean) => any;
32
+ "onClick-outside"?: (args_0: MouseEvent) => any;
33
+ }>, {
34
+ modelValue: boolean;
35
+ closeOnPressEscape: boolean;
36
+ appendToBody: boolean;
37
+ headerStyle: boolean;
38
+ footerStyle: boolean;
39
+ closeOnClickOverlay: boolean;
40
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
41
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
42
+ export default _default;
43
+ type __VLS_WithSlots<T, S> = T & {
44
+ new (): {
45
+ $slots: S;
46
+ };
47
+ };
@@ -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 { getFallbackVariant, useComputedSize } from "../../composables/useFallbackProps";
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 getFallbackVariant(props.variant, VARIANTS).icon;
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 = useComputedSize(props.size, SIZES);
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 } = getFallbackVariant(props.variant, VARIANTS);
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,70 @@
1
+ <script setup>
2
+ import { computed, nextTick, onBeforeUnmount, shallowRef, watch } from "vue";
3
+ import { getScrollContainer, getScrollElByContainer } 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
+ scrollContainer = getScrollElByContainer(getScrollContainer(overlayRef.value));
35
+ }
36
+ scrollContainer.classList.add("scroll-disabled");
37
+ });
38
+ }, { immediate: true });
39
+ onBeforeUnmount(() => {
40
+ if (!scrollContainer) {
41
+ return;
42
+ }
43
+ scrollContainer.classList.remove("scroll-disabled");
44
+ scrollContainer = null;
45
+ });
46
+ </script>
47
+
48
+ <template>
49
+ <PTeleport :disabled="!appendToBody">
50
+ <Transition name="pxd-transition--fade" mode="out-in">
51
+ <div
52
+ v-if="modelValue"
53
+ ref="overlayRef"
54
+ tabindex="-1"
55
+ class="pxd-overlay fixed inset-0 bg-black/40 sm:bg-background/80 motion-safe:transition-colors"
56
+ :class="overlayClass"
57
+ :style="computedStyle"
58
+ @click="onOverlayClick"
59
+ />
60
+ </Transition>
61
+
62
+ <slot />
63
+ </PTeleport>
64
+ </template>
65
+
66
+ <style>
67
+ .pxd-overlay {
68
+ z-index: var(--z, 10);
69
+ }
70
+ </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 { useComputedSize } from "../../composables/useFallbackProps";
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 = useComputedSize(props.size, SIZES);
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-2"
178
+ class="flex items-center gap-1.5"
179
179
  @keydown="onContainerKeydown"
180
180
  @compositionend="onCompositionEnd"
181
181
  >