pxd 0.0.23 → 0.0.26

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 (179) hide show
  1. package/dist/components/active-graph/index.vue +3 -3
  2. package/dist/components/active-graph/index.vue.d.ts +4 -5
  3. package/dist/components/avatar/index.vue +4 -3
  4. package/dist/components/avatar-group/index.vue +8 -3
  5. package/dist/components/avatar-group/index.vue.d.ts +3 -12
  6. package/dist/components/badge/index.vue +10 -10
  7. package/dist/components/badge/index.vue.d.ts +3 -3
  8. package/dist/components/book/index.vue +8 -14
  9. package/dist/components/book/index.vue.d.ts +1 -1
  10. package/dist/components/browser/index.vue +54 -0
  11. package/dist/components/browser/index.vue.d.ts +15 -0
  12. package/dist/components/button/index.vue +30 -23
  13. package/dist/components/button/index.vue.d.ts +7 -7
  14. package/dist/components/carousel/index.vue +43 -0
  15. package/dist/components/carousel/index.vue.d.ts +12 -0
  16. package/dist/components/carousel-group/index.vue +277 -0
  17. package/dist/components/carousel-group/index.vue.d.ts +30 -0
  18. package/dist/components/checkbox/index.vue +11 -14
  19. package/dist/components/checkbox/index.vue.d.ts +9 -17
  20. package/dist/components/checkbox-group/index.vue +7 -3
  21. package/dist/components/checkbox-group/index.vue.d.ts +11 -17
  22. package/dist/components/chip/index.vue +5 -5
  23. package/dist/components/chip/index.vue.d.ts +1 -1
  24. package/dist/components/choicebox/index.vue +6 -5
  25. package/dist/components/choicebox/index.vue.d.ts +5 -12
  26. package/dist/components/choicebox-group/index.vue +7 -6
  27. package/dist/components/choicebox-group/index.vue.d.ts +8 -21
  28. package/dist/components/collapse/index.vue +4 -3
  29. package/dist/components/collapse/index.vue.d.ts +2 -2
  30. package/dist/components/collapse-group/index.vue +7 -5
  31. package/dist/components/collapse-group/index.vue.d.ts +1 -1
  32. package/dist/components/config-provider/index.vue.d.ts +4 -4
  33. package/dist/components/description/index.vue +3 -3
  34. package/dist/components/description/index.vue.d.ts +2 -2
  35. package/dist/components/drawer/index.vue +177 -0
  36. package/dist/components/drawer/index.vue.d.ts +50 -0
  37. package/dist/components/error/index.vue +15 -9
  38. package/dist/components/error/index.vue.d.ts +7 -4
  39. package/dist/components/gauge/index.vue +5 -5
  40. package/dist/components/gauge/index.vue.d.ts +1 -1
  41. package/dist/components/hold-button/index.vue +17 -0
  42. package/dist/components/hold-button/index.vue.d.ts +8 -6
  43. package/dist/components/index.d.ts +5 -0
  44. package/dist/components/index.js +5 -0
  45. package/dist/components/input/index.vue +9 -9
  46. package/dist/components/input/index.vue.d.ts +3 -3
  47. package/dist/components/intersection-observer/content.vue +9 -0
  48. package/dist/components/intersection-observer/content.vue.d.ts +12 -0
  49. package/dist/components/intersection-observer/index.vue +79 -0
  50. package/dist/components/intersection-observer/index.vue.d.ts +38 -0
  51. package/dist/components/link-button/index.vue +3 -3
  52. package/dist/components/link-button/index.vue.d.ts +4 -4
  53. package/dist/components/material/index.vue.d.ts +2 -2
  54. package/dist/components/menu/index.vue +7 -6
  55. package/dist/components/menu/index.vue.d.ts +8 -7
  56. package/dist/components/menu-item/index.vue +25 -8
  57. package/dist/components/menu-item/index.vue.d.ts +8 -4
  58. package/dist/components/menu-list/index.vue +47 -51
  59. package/dist/components/menu-list/index.vue.d.ts +7 -5
  60. package/dist/components/modal/index.vue +29 -42
  61. package/dist/components/modal/index.vue.d.ts +6 -6
  62. package/dist/components/more-button/index.vue +11 -5
  63. package/dist/components/more-button/index.vue.d.ts +3 -4
  64. package/dist/components/note/index.vue +16 -16
  65. package/dist/components/note/index.vue.d.ts +11 -11
  66. package/dist/components/overlay/index.vue +33 -16
  67. package/dist/components/overlay/index.vue.d.ts +9 -3
  68. package/dist/components/pagination/index.vue +4 -4
  69. package/dist/components/pagination/index.vue.d.ts +2 -2
  70. package/dist/components/pin-input/index.vue +30 -9
  71. package/dist/components/pin-input/index.vue.d.ts +1 -1
  72. package/dist/components/popover/index.vue +27 -13
  73. package/dist/components/popover/index.vue.d.ts +8 -5
  74. package/dist/components/progress/index.vue +8 -2
  75. package/dist/components/progress/index.vue.d.ts +1 -1
  76. package/dist/components/radio/index.vue +11 -14
  77. package/dist/components/radio/index.vue.d.ts +5 -12
  78. package/dist/components/radio-group/index.vue +4 -4
  79. package/dist/components/radio-group/index.vue.d.ts +10 -16
  80. package/dist/components/resizable/index.vue +18 -27
  81. package/dist/components/resizable/index.vue.d.ts +2 -2
  82. package/dist/components/resizable-handle/index.vue +11 -13
  83. package/dist/components/resizable-panel/index.vue +25 -27
  84. package/dist/components/scrollable/index.vue +18 -32
  85. package/dist/components/scrollable/index.vue.d.ts +2 -1
  86. package/dist/components/skeleton/index.vue +8 -11
  87. package/dist/components/slider/index.vue +4 -3
  88. package/dist/components/slider/index.vue.d.ts +1 -1
  89. package/dist/components/snippet/index.vue +14 -33
  90. package/dist/components/snippet/index.vue.d.ts +1 -1
  91. package/dist/components/stack/index.vue +24 -22
  92. package/dist/components/stack/index.vue.d.ts +4 -4
  93. package/dist/components/switch/index.vue +13 -16
  94. package/dist/components/switch/index.vue.d.ts +1 -1
  95. package/dist/components/switch-group/index.vue +10 -7
  96. package/dist/components/switch-group/index.vue.d.ts +4 -12
  97. package/dist/components/teleport/index.vue.d.ts +3 -3
  98. package/dist/components/text/index.vue +8 -8
  99. package/dist/components/text/index.vue.d.ts +3 -3
  100. package/dist/components/textarea/index.vue +9 -9
  101. package/dist/components/textarea/index.vue.d.ts +1 -1
  102. package/dist/components/toggle/index.vue +6 -4
  103. package/dist/components/toggle/index.vue.d.ts +1 -1
  104. package/dist/components/tooltip/index.vue +4 -5
  105. package/dist/components/tooltip/index.vue.d.ts +7 -7
  106. package/dist/components/virtual-list/index.vue +1 -1
  107. package/dist/components/virtual-list/index.vue.d.ts +1 -1
  108. package/dist/composables/index.d.ts +3 -4
  109. package/dist/composables/index.js +3 -4
  110. package/dist/composables/useBrowserObserver.d.ts +11 -0
  111. package/dist/composables/useBrowserObserver.js +64 -0
  112. package/dist/composables/useConfigProviderContext.d.ts +3 -8
  113. package/dist/composables/useConfigProviderContext.js +10 -15
  114. package/dist/composables/useCopyClick.d.ts +5 -0
  115. package/dist/composables/useCopyClick.js +35 -0
  116. package/dist/composables/useFocusTrap.d.ts +4 -2
  117. package/dist/composables/useFocusTrap.js +6 -5
  118. package/dist/composables/useUniqueIdContext.d.ts +2 -0
  119. package/dist/composables/useUniqueIdContext.js +11 -0
  120. package/dist/contexts/avatar.d.ts +2 -0
  121. package/dist/contexts/avatar.js +5 -0
  122. package/dist/contexts/carousel.d.ts +13 -0
  123. package/dist/contexts/carousel.js +5 -0
  124. package/dist/contexts/checkbox.d.ts +2 -0
  125. package/dist/contexts/checkbox.js +5 -0
  126. package/dist/contexts/choicebox.d.ts +4 -0
  127. package/dist/contexts/choicebox.js +11 -0
  128. package/dist/contexts/collapse.d.ts +8 -0
  129. package/dist/contexts/collapse.js +5 -0
  130. package/dist/contexts/menu.d.ts +8 -0
  131. package/dist/contexts/menu.js +5 -0
  132. package/dist/contexts/radio.d.ts +2 -0
  133. package/dist/contexts/radio.js +5 -0
  134. package/dist/contexts/resizable.d.ts +33 -0
  135. package/dist/contexts/resizable.js +5 -0
  136. package/dist/contexts/switch.d.ts +4 -0
  137. package/dist/contexts/switch.js +9 -0
  138. package/dist/index.d.ts +1 -1
  139. package/dist/index.js +1 -1
  140. package/dist/locales/en-US.js +1 -1
  141. package/dist/styles/styles.css +1 -1
  142. package/dist/styles/tw.css +30 -17
  143. package/dist/types/components/avatar.d.ts +11 -0
  144. package/dist/types/components/button.d.ts +1 -1
  145. package/dist/types/components/carousel.d.ts +16 -0
  146. package/dist/types/components/checkbox.d.ts +17 -0
  147. package/dist/types/components/choicebox.d.ts +22 -0
  148. package/dist/types/components/menu.d.ts +2 -2
  149. package/dist/types/components/radio.d.ts +16 -0
  150. package/dist/types/components/switch.d.ts +10 -0
  151. package/dist/types/shared/index.d.ts +1 -0
  152. package/dist/types/shared/props.d.ts +30 -0
  153. package/dist/utils/context.d.ts +17 -0
  154. package/dist/utils/context.js +19 -0
  155. package/dist/utils/fn.d.ts +2 -4
  156. package/dist/utils/fn.js +9 -54
  157. package/dist/utils/format.d.ts +3 -2
  158. package/dist/utils/format.js +7 -4
  159. package/dist/utils/unref.js +2 -2
  160. package/package.json +16 -11
  161. package/dist/composables/useIntersectionObserver.d.ts +0 -7
  162. package/dist/composables/useIntersectionObserver.js +0 -43
  163. package/dist/composables/useMutationObserver.d.ts +0 -7
  164. package/dist/composables/useMutationObserver.js +0 -35
  165. package/dist/composables/useRandomValueContext.d.ts +0 -2
  166. package/dist/composables/useRandomValueContext.js +0 -11
  167. package/dist/composables/useResizeObserver.d.ts +0 -7
  168. package/dist/composables/useResizeObserver.js +0 -44
  169. package/dist/styles/dst.css +0 -350
  170. package/dist/types/components/index.d.ts +0 -6
  171. package/dist/types/components/resizable.d.ts +0 -19
  172. package/dist/types/components/shared.d.ts +0 -18
  173. package/dist/types/components/shared.js +0 -0
  174. package/dist/types/index.d.ts +0 -2
  175. package/dist/types/index.js +0 -2
  176. package/dist/utils/raf.d.ts +0 -2
  177. package/dist/utils/raf.js +0 -3
  178. package/dist/utils/random.d.ts +0 -2
  179. package/dist/utils/random.js +0 -6
@@ -1,4 +1,4 @@
1
- import type { ComponentLabel } from '../../types/components';
1
+ import type { ComponentLabel } from '../../types/shared';
2
2
  interface Props {
3
3
  title?: ComponentLabel;
4
4
  subtitle?: ComponentLabel;
@@ -10,15 +10,15 @@ interface Props {
10
10
  closeOnPressEscape?: boolean;
11
11
  closeOnClickOverlay?: boolean;
12
12
  }
13
- declare var __VLS_13: {}, __VLS_15: {}, __VLS_20: {}, __VLS_22: {};
13
+ declare var __VLS_14: {}, __VLS_16: {}, __VLS_22: {}, __VLS_24: {};
14
14
  type __VLS_Slots = {} & {
15
- title?: (props: typeof __VLS_13) => any;
15
+ title?: (props: typeof __VLS_14) => any;
16
16
  } & {
17
- subtitle?: (props: typeof __VLS_15) => any;
17
+ subtitle?: (props: typeof __VLS_16) => any;
18
18
  } & {
19
- default?: (props: typeof __VLS_20) => any;
19
+ default?: (props: typeof __VLS_22) => any;
20
20
  } & {
21
- footer?: (props: typeof __VLS_22) => any;
21
+ footer?: (props: typeof __VLS_24) => any;
22
22
  };
23
23
  declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
24
  open: () => any;
@@ -14,15 +14,21 @@ const props = defineProps({
14
14
  moreText: { type: String, required: false, default: "Show More" },
15
15
  lessText: { type: String, required: false, default: "Show Less" },
16
16
  modelValue: { type: Boolean, required: false, default: false },
17
- buttonProps: { type: null, required: false, default: () => ({}) }
17
+ as: { type: null, required: false },
18
+ variant: { type: String, required: false },
19
+ size: { type: String, required: false },
20
+ shape: { type: String, required: false, default: "rounded" },
21
+ align: { type: String, required: false },
22
+ icon: { type: Boolean, required: false },
23
+ block: { type: Boolean, required: false },
24
+ loading: { type: Boolean, required: false },
25
+ disabled: { type: Boolean, required: false }
18
26
  });
19
27
  const emits = defineEmits(["update:modelValue"]);
20
28
  const isExpanded = useModelValue(props, emits);
21
29
  const buttonProps = computed(() => {
22
- return {
23
- shape: "rounded",
24
- ...props.buttonProps
25
- };
30
+ const { moreText, lessText, modelValue, ...rest } = props;
31
+ return rest;
26
32
  });
27
33
  function onToggleExpand() {
28
34
  isExpanded.value = !isExpanded.value;
@@ -1,18 +1,17 @@
1
- import PButton from '../button/index.vue';
2
- interface Props {
1
+ import type { ButtonProps } from '../../types/components/button';
2
+ interface Props extends ButtonProps {
3
3
  moreText?: string;
4
4
  lessText?: string;
5
5
  modelValue?: boolean;
6
- buttonProps?: InstanceType<typeof PButton>['$props'];
7
6
  }
8
7
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
8
  "update:modelValue": (args_0: boolean) => any;
10
9
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
11
10
  "onUpdate:modelValue"?: (args_0: boolean) => any;
12
11
  }>, {
12
+ shape: "square" | "rounded";
13
13
  modelValue: boolean;
14
14
  moreText: string;
15
15
  lessText: string;
16
- buttonProps: InstanceType<typeof PButton>["$props"];
17
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
18
17
  export default _default;
@@ -3,9 +3,9 @@ import CheckCircleIcon from "@gdsicon/vue/check-circle";
3
3
  import InformationIcon from "@gdsicon/vue/information";
4
4
  import StopIcon from "@gdsicon/vue/stop";
5
5
  import WarningIcon from "@gdsicon/vue/warning";
6
- import { twMerge } from "tailwind-merge";
7
6
  import { computed, h } from "vue";
8
- import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
7
+ import { useConfigProvider } from "../../composables/useConfigProviderContext";
8
+ import { isTruthyProp } from "../../utils/format";
9
9
  import { getFallbackValue } from "../../utils/value";
10
10
  defineOptions({
11
11
  name: "PNote"
@@ -25,42 +25,43 @@ const VARIANTS = {
25
25
  success: {
26
26
  icon: CheckCircleIcon,
27
27
  fill: "text-blue-900 bg-blue-200 border-blue-100",
28
- classes: "text-blue-900 border-blue-500"
28
+ basic: "text-blue-900 border-blue-500"
29
29
  },
30
30
  error: {
31
31
  icon: StopIcon,
32
32
  fill: "text-red-900 bg-red-200 border-red-100",
33
- classes: "text-red-900 border-red-500"
33
+ basic: "text-red-900 border-red-500"
34
34
  },
35
35
  warning: {
36
36
  icon: WarningIcon,
37
37
  fill: "text-amber-900 bg-amber-200 border-amber-100",
38
- classes: "text-amber-900 border-amber-500"
38
+ basic: "text-amber-900 border-amber-500"
39
39
  },
40
40
  default: {
41
41
  icon: InformationIcon,
42
42
  fill: "text-foreground-secondary bg-gray-200 border-gray-100",
43
- classes: "text-foreground-secondary border-input"
43
+ basic: "text-foreground-secondary border-input"
44
44
  },
45
45
  primary: {
46
46
  icon: InformationIcon,
47
47
  fill: "text-gray-100 bg-primary border-gray-100",
48
- classes: "text-primary border-gray-alpha-400"
48
+ basic: "text-primary border-gray-alpha-400"
49
49
  },
50
50
  violet: {
51
51
  icon: InformationIcon,
52
52
  fill: "text-violet-900 bg-violet-200 border-violet-100",
53
- classes: "text-violet-900 border-violet-400"
53
+ basic: "text-violet-900 border-violet-400"
54
54
  },
55
55
  cyan: {
56
56
  icon: InformationIcon,
57
57
  fill: "text-teal-900 bg-teal-200 border-teal-100",
58
- classes: "text-teal-900 border-teal-400"
58
+ basic: "text-teal-900 border-teal-400"
59
59
  }
60
60
  };
61
+ const config = useConfigProvider();
61
62
  const computedLabel = computed(() => {
62
63
  const { label } = props;
63
- if (label === true || label === "") {
64
+ if (isTruthyProp(label)) {
64
65
  return getFallbackValue(props.variant, VARIANTS).icon;
65
66
  }
66
67
  if (typeof label === "string" && label) {
@@ -68,13 +69,12 @@ const computedLabel = computed(() => {
68
69
  }
69
70
  return false;
70
71
  });
71
- const computedSize = useConfigProviderSize(props.size, SIZES);
72
72
  const computedClass = computed(() => {
73
- const basic = ["pxd-note flex flex-col sm:flex-row sm:items-center gap-2 border rounded-md w-max max-w-full"];
74
- basic.push(computedSize.value);
75
- const { fill, classes } = getFallbackValue(props.variant, VARIANTS);
76
- basic.push(props.fill ? fill : classes);
77
- return twMerge(basic);
73
+ const classes = ["pxd-note flex flex-col sm:flex-row sm:items-center gap-2 border rounded-md w-max max-w-full"];
74
+ classes.push(getFallbackValue(props.size, SIZES, config.size));
75
+ const { fill, basic } = getFallbackValue(props.variant, VARIANTS);
76
+ classes.push(props.fill ? fill : basic);
77
+ return classes.join(" ");
78
78
  });
79
79
  </script>
80
80
 
@@ -1,4 +1,4 @@
1
- import type { ComponentSize } from '../../types/components';
1
+ import type { ComponentSize } from '../../types/shared';
2
2
  interface Props {
3
3
  variant?: keyof typeof VARIANTS;
4
4
  size?: ComponentSize;
@@ -13,7 +13,7 @@ declare const VARIANTS: {
13
13
  fill?: string;
14
14
  }>;
15
15
  fill: string;
16
- classes: string;
16
+ basic: string;
17
17
  };
18
18
  error: {
19
19
  icon: DefineComponent<{
@@ -22,7 +22,7 @@ declare const VARIANTS: {
22
22
  fill?: string;
23
23
  }>;
24
24
  fill: string;
25
- classes: string;
25
+ basic: string;
26
26
  };
27
27
  warning: {
28
28
  icon: DefineComponent<{
@@ -31,7 +31,7 @@ declare const VARIANTS: {
31
31
  fill?: string;
32
32
  }>;
33
33
  fill: string;
34
- classes: string;
34
+ basic: string;
35
35
  };
36
36
  default: {
37
37
  icon: DefineComponent<{
@@ -40,7 +40,7 @@ declare const VARIANTS: {
40
40
  fill?: string;
41
41
  }>;
42
42
  fill: string;
43
- classes: string;
43
+ basic: string;
44
44
  };
45
45
  primary: {
46
46
  icon: DefineComponent<{
@@ -49,7 +49,7 @@ declare const VARIANTS: {
49
49
  fill?: string;
50
50
  }>;
51
51
  fill: string;
52
- classes: string;
52
+ basic: string;
53
53
  };
54
54
  violet: {
55
55
  icon: DefineComponent<{
@@ -58,7 +58,7 @@ declare const VARIANTS: {
58
58
  fill?: string;
59
59
  }>;
60
60
  fill: string;
61
- classes: string;
61
+ basic: string;
62
62
  };
63
63
  cyan: {
64
64
  icon: DefineComponent<{
@@ -67,16 +67,16 @@ declare const VARIANTS: {
67
67
  fill?: string;
68
68
  }>;
69
69
  fill: string;
70
- classes: string;
70
+ basic: string;
71
71
  };
72
72
  };
73
- declare var __VLS_1: {}, __VLS_7: {}, __VLS_9: {};
73
+ declare var __VLS_1: {}, __VLS_8: {}, __VLS_10: {};
74
74
  type __VLS_Slots = {} & {
75
75
  label?: (props: typeof __VLS_1) => any;
76
76
  } & {
77
- default?: (props: typeof __VLS_7) => any;
77
+ default?: (props: typeof __VLS_8) => any;
78
78
  } & {
79
- action?: (props: typeof __VLS_9) => any;
79
+ action?: (props: typeof __VLS_10) => any;
80
80
  };
81
81
  declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
82
82
  variant: keyof typeof VARIANTS;
@@ -1,38 +1,61 @@
1
1
  <script setup>
2
2
  import { computed, nextTick, onBeforeUnmount, shallowRef, watch } from "vue";
3
3
  import { getScrollContainer, getScrollElByContainer } from "../../utils/dom";
4
+ import { off, on } from "../../utils/events";
5
+ import { isServer } from "../../utils/is";
4
6
  import PTeleport from "../teleport/index.vue";
5
7
  defineOptions({
6
- name: "POverlay"
8
+ name: "POverlay",
9
+ model: {
10
+ prop: "modelValue",
11
+ event: "update:modelValue"
12
+ }
7
13
  });
8
14
  const props = defineProps({
15
+ blur: { type: Boolean, required: false },
9
16
  zIndex: { type: Number, required: false },
10
17
  modelValue: { type: Boolean, required: false, default: false },
11
18
  appendToBody: { type: Boolean, required: false, default: true },
12
- overlayClass: { type: String, required: false }
19
+ overlayClass: { type: [String, Array, Object], required: false },
20
+ closeOnPressEscape: { type: Boolean, required: false, default: true }
13
21
  });
14
- const emits = defineEmits(["click"]);
22
+ const emits = defineEmits(["click", "update:modelValue"]);
15
23
  const overlayRef = shallowRef();
16
- const computedStyle = computed(() => {
17
- return {
18
- "--z": props.zIndex
19
- };
20
- });
24
+ const computedStyle = computed(() => ({
25
+ "--z": props.zIndex
26
+ }));
21
27
  function onOverlayClick(ev) {
22
28
  emits("click", ev);
23
29
  }
30
+ function onOverlayKeydown(ev) {
31
+ if (!props.closeOnPressEscape) {
32
+ return;
33
+ }
34
+ if (ev.key !== "Escape") {
35
+ return;
36
+ }
37
+ if (ev.ctrlKey || ev.metaKey || ev.altKey || ev.shiftKey) {
38
+ return;
39
+ }
40
+ emits("update:modelValue", false);
41
+ }
24
42
  let scrollContainer;
25
43
  watch(() => props.modelValue, (visible) => {
44
+ if (isServer) {
45
+ return;
46
+ }
26
47
  if (!visible) {
27
48
  if (scrollContainer) {
28
49
  scrollContainer.classList.remove("scroll-disabled");
29
50
  }
51
+ off(document, "keydown", onOverlayKeydown);
30
52
  return;
31
53
  }
32
54
  nextTick(() => {
33
55
  if (!scrollContainer) {
34
56
  scrollContainer = getScrollElByContainer(getScrollContainer(overlayRef.value));
35
57
  }
58
+ on(document, "keydown", onOverlayKeydown);
36
59
  scrollContainer.classList.add("scroll-disabled");
37
60
  });
38
61
  }, { immediate: true });
@@ -51,8 +74,8 @@ onBeforeUnmount(() => {
51
74
  <div
52
75
  v-if="modelValue"
53
76
  ref="overlayRef"
54
- tabindex="-1"
55
- class="pxd-overlay fixed inset-0 bg-black/40 sm:bg-background/80 motion-safe:transition-colors"
77
+ :data-blur="blur"
78
+ class="pxd-overlay fixed inset-0 bg-black/40 z-[var(--z,10)] sm:bg-background/80 data-[blur=true]:backdrop-blur-xs motion-safe:transition-colors"
56
79
  :class="overlayClass"
57
80
  :style="computedStyle"
58
81
  @click="onOverlayClick"
@@ -62,9 +85,3 @@ onBeforeUnmount(() => {
62
85
  <slot />
63
86
  </PTeleport>
64
87
  </template>
65
-
66
- <style>
67
- .pxd-overlay {
68
- z-index: var(--z, 10);
69
- }
70
- </style>
@@ -1,19 +1,25 @@
1
+ import type { ComponentClass } from '../../types/shared';
1
2
  interface Props {
3
+ blur?: boolean;
2
4
  zIndex?: number;
3
5
  modelValue?: boolean;
4
6
  appendToBody?: boolean;
5
- overlayClass?: string;
7
+ overlayClass?: ComponentClass;
8
+ closeOnPressEscape?: boolean;
6
9
  }
7
- declare var __VLS_9: {};
10
+ declare var __VLS_11: {};
8
11
  type __VLS_Slots = {} & {
9
- default?: (props: typeof __VLS_9) => any;
12
+ default?: (props: typeof __VLS_11) => any;
10
13
  };
11
14
  declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
15
  click: (args_0: MouseEvent) => any;
16
+ "update:modelValue": (args_0: boolean) => any;
13
17
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
14
18
  onClick?: (args_0: MouseEvent) => any;
19
+ "onUpdate:modelValue"?: (args_0: boolean) => any;
15
20
  }>, {
16
21
  modelValue: boolean;
22
+ closeOnPressEscape: boolean;
17
23
  appendToBody: boolean;
18
24
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
19
25
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
@@ -14,13 +14,13 @@ const config = useConfigProvider();
14
14
 
15
15
  <template>
16
16
  <nav aria-label="pagination" class="pxd-pagination flex flex-wrap w-full relative justify-between items-start">
17
- <RouterLink v-if="prev" :to="prev.href" class="pxd-pagination--prev group pl-6 !no-underline">
17
+ <RouterLink v-if="prev" :to="prev.href" class="pxd-pagination--prev min-h-13 group py-1 pl-2 pl-6 !no-underline">
18
18
  <PText secondary class="text-[13px] group-hover:text-foreground">
19
19
  {{ config.locale.compare.prev }}
20
20
  </PText>
21
21
 
22
22
  <div class="pxd-pagination--label prev text-foreground relative flex items-center">
23
- <span class="text-foreground">{{ prev.label }}</span>
23
+ <span class="text-foreground font-medium">{{ prev.label }}</span>
24
24
  <ChevronRightIcon class="absolute text-foreground-secondary -left-5 rotate-180" />
25
25
  </div>
26
26
  </RouterLink>
@@ -29,13 +29,13 @@ const config = useConfigProvider();
29
29
  <slot />
30
30
  </div>
31
31
 
32
- <RouterLink v-if="next" :to="next.href" class="pxd-pagination--next group pr-6 !no-underline">
32
+ <RouterLink v-if="next" :to="next.href" class="pxd-pagination--next min-h-13 group py-1 pl-2 pr-6 !no-underline">
33
33
  <PText secondary class="text-[13px] group-hover:text-foreground">
34
34
  {{ config.locale.compare.next }}
35
35
  </PText>
36
36
 
37
37
  <div class="pxd-pagination--label next text-foreground relative flex items-center">
38
- <span class="text-foreground">{{ next.label }}</span>
38
+ <span class="text-foreground font-medium">{{ next.label }}</span>
39
39
  <ChevronRightIcon class="absolute text-foreground-secondary -right-5" />
40
40
  </div>
41
41
  </RouterLink>
@@ -6,9 +6,9 @@ interface Props {
6
6
  prev?: Page;
7
7
  next?: Page;
8
8
  }
9
- declare var __VLS_12: {};
9
+ declare var __VLS_15: {};
10
10
  type __VLS_Slots = {} & {
11
- default?: (props: typeof __VLS_12) => any;
11
+ default?: (props: typeof __VLS_15) => any;
12
12
  };
13
13
  declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
14
14
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
@@ -1,7 +1,8 @@
1
1
  <script setup>
2
2
  import { computed, ref, shallowRef } from "vue";
3
- import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
3
+ import { useConfigProvider } from "../../composables/useConfigProviderContext";
4
4
  import { useModelValue } from "../../composables/useModelValue";
5
+ import { getFallbackValue } from "../../utils/value";
5
6
  import PError from "../error/index.vue";
6
7
  defineOptions({
7
8
  name: "PPinInput",
@@ -30,9 +31,9 @@ const SIZES = {
30
31
  md: "w-9 text-sm",
31
32
  lg: "w-10 text-base"
32
33
  };
34
+ const config = useConfigProvider();
33
35
  const inputsRef = shallowRef([]);
34
36
  const modelValue = useModelValue(props, emits);
35
- const computedSize = useConfigProviderSize(props.size, SIZES);
36
37
  const modelValueLocal = ref(
37
38
  (() => {
38
39
  if (typeof props.modelValue === "string") {
@@ -56,15 +57,15 @@ const computedInputMode = computed(() => {
56
57
  return props.type.includes("numeric") ? "numeric" : "text";
57
58
  });
58
59
  const computedClass = computed(() => {
59
- const basic = ["pxd-input--border rounded-md motion-safe:transition-all"];
60
+ const classes = ["pxd-input--border rounded-md motion-safe:transition-all"];
60
61
  if (props.error) {
61
- basic.push("is-error");
62
+ classes.push("is-error");
62
63
  }
63
64
  if (props.disabled) {
64
- basic.push("is-disabled");
65
+ classes.push("is-disabled");
65
66
  }
66
- basic.push(computedSize.value);
67
- return basic;
67
+ classes.push(getFallbackValue(props.size, SIZES, config.size));
68
+ return classes.join(" ");
68
69
  });
69
70
  function setInputValue(value, index) {
70
71
  if (index !== void 0) {
@@ -91,6 +92,25 @@ function focusInputField(dir, index) {
91
92
  }
92
93
  inputsRef.value[correctIndex].select();
93
94
  }
95
+ function getFirstEmptyIndex() {
96
+ const length = modelValueLocal.value.length;
97
+ if (length === props.length) {
98
+ return modelValueLocal.value.findIndex((value) => !value);
99
+ }
100
+ return length;
101
+ }
102
+ function onContainerClick(ev) {
103
+ const input = ev.target;
104
+ if (input.tagName !== "INPUT") {
105
+ return;
106
+ }
107
+ const index = Number(input.dataset.index);
108
+ const firstEmptyIndex = getFirstEmptyIndex();
109
+ if (index === firstEmptyIndex || firstEmptyIndex >= props.length) {
110
+ return;
111
+ }
112
+ inputsRef.value[firstEmptyIndex]?.select();
113
+ }
94
114
  function onCompositionEnd(ev) {
95
115
  const input = ev.target;
96
116
  const index = Number(input.dataset.index);
@@ -169,15 +189,16 @@ function onInputPastedValue(ev) {
169
189
  </script>
170
190
 
171
191
  <template>
172
- <label class="pxd-pin-input">
192
+ <label class="pxd-pin-input flex flex-col w-max">
173
193
  <div v-if="label || $slots.label" class="pxd-form--label">
174
194
  <slot name="label">{{ label }}</slot>
175
195
  </div>
176
196
 
177
197
  <div
178
- class="flex items-center gap-1.5"
198
+ class="w-max flex items-center gap-1.5"
179
199
  @keydown="onContainerKeydown"
180
200
  @compositionend="onCompositionEnd"
201
+ @click="onContainerClick"
181
202
  >
182
203
  <div v-for="(n, i) of length" :key="n" :class="computedClass">
183
204
  <input
@@ -1,5 +1,5 @@
1
1
  import type { HTMLAttributes } from 'vue';
2
- import type { ComponentLabel, ComponentSizeWithXs } from '../../types/components';
2
+ import type { ComponentLabel, ComponentSizeWithXs } from '../../types/shared';
3
3
  interface Props {
4
4
  size?: ComponentSizeWithXs;
5
5
  error?: string;
@@ -29,8 +29,8 @@ const props = defineProps({
29
29
  enterable: { type: Boolean, required: false },
30
30
  showArrow: { type: Boolean, required: false, default: true },
31
31
  arrowColor: { type: String, required: false, default: "var(--color-gray-1000)" },
32
- triggerClass: { type: String, required: false },
33
- popoverClass: { type: String, required: false },
32
+ triggerClass: { type: [String, Array, Object], required: false },
33
+ popoverClass: { type: [String, Array, Object], required: false },
34
34
  destroyDelay: { type: Number, required: false, default: 2e3 },
35
35
  scrollHidden: { type: Boolean, required: false, default: false },
36
36
  popoverStyle: { type: [Object, String], required: false },
@@ -39,10 +39,10 @@ const props = defineProps({
39
39
  hideTransition: { type: Boolean, required: false, default: true },
40
40
  translateOffset: { type: [String, Number], required: false, default: 0 },
41
41
  closeOnPressEscape: { type: Boolean, required: false, default: false },
42
- scrollHiddenThreshold: { type: Number, required: false, default: 60 },
43
- dynamicPositionThreshold: { type: Number, required: false, default: 8 }
42
+ scrollHiddenThreshold: { type: Number, required: false, default: 100 },
43
+ dynamicPositionThreshold: { type: Number, required: false, default: 5 }
44
44
  });
45
- const emits = defineEmits(["show", "hide"]);
45
+ const emits = defineEmits(["show", "hide", "trigger-keydown"]);
46
46
  let triggerRect = null;
47
47
  let viewportRect = null;
48
48
  let scrollContainer;
@@ -212,12 +212,12 @@ async function onTriggerClick() {
212
212
  return;
213
213
  }
214
214
  if (isVisible.value) {
215
- await handlePopoverHide();
216
215
  off(document, "click", onClickOutsideToHide);
216
+ await handlePopoverHide();
217
217
  return;
218
218
  }
219
- await handlePopoverShow();
220
219
  on(document, "click", onClickOutsideToHide);
220
+ await handlePopoverShow();
221
221
  }
222
222
  function onTriggerPointerEnter() {
223
223
  if (props.disabled) {
@@ -423,10 +423,18 @@ function updateTriggerEvents(methods, dom, handler) {
423
423
  }
424
424
  }
425
425
  }
426
- function onTriggerKeydown() {
426
+ function onTriggerKeydown(ev) {
427
+ if (!isVisible.value) {
428
+ return;
429
+ }
430
+ emits("trigger-keydown", ev);
427
431
  if (!props.closeOnPressEscape) {
428
432
  return;
429
433
  }
434
+ if (ev.key !== "Escape") {
435
+ return;
436
+ }
437
+ ev.stopPropagation();
430
438
  handlePopoverHide();
431
439
  }
432
440
  watch(
@@ -469,9 +477,10 @@ defineExpose({
469
477
  <div class="pxd-popover relative inline-flex w-max">
470
478
  <div
471
479
  ref="triggerRef"
472
- class="pxd-popover__trigger"
480
+ class="pxd-popover__trigger active:select-none"
473
481
  :class="triggerClass"
474
- @keydown.esc.stop="onTriggerKeydown"
482
+ @contextmenu.prevent
483
+ @keydown="onTriggerKeydown"
475
484
  >
476
485
  <slot />
477
486
  </div>
@@ -482,10 +491,15 @@ defineExpose({
482
491
  :style="{ '--translate-offset': translateOffset, zIndex }"
483
492
  >
484
493
  <div
485
- v-if="isRender" v-show="isVisible" ref="containerRef" :style="containerStyle"
486
- :data-position="localPosition" class="pxd-popover__container isolate absolute w-max"
494
+ v-if="isRender"
495
+ v-show="isVisible"
496
+ ref="containerRef"
497
+ :style="containerStyle"
498
+ :data-position="localPosition"
499
+ class="pxd-popover__container isolate absolute w-max"
487
500
  :class="[{ 'pointer-events-none': !enterable, 'show-arrow': showArrow }]"
488
- @pointerenter="onContentPointerEnter" @pointerleave="onContentPointerLeave"
501
+ @pointerenter="onContentPointerEnter"
502
+ @pointerleave="onContentPointerLeave"
489
503
  >
490
504
  <div class="pxd-popover__content" :class="popoverClass" :style="popoverStyle">
491
505
  <slot name="content">
@@ -1,5 +1,6 @@
1
1
  import type { CSSProperties } from 'vue';
2
- import type { ComponentPosition, PopoverTrigger } from '../../types/components';
2
+ import type { PopoverTrigger } from '../../types/components/popover';
3
+ import type { ComponentClass, ComponentPosition } from '../../types/shared';
3
4
  interface Props {
4
5
  zIndex?: number;
5
6
  offset?: number;
@@ -14,8 +15,8 @@ interface Props {
14
15
  enterable?: boolean;
15
16
  showArrow?: boolean;
16
17
  arrowColor?: string;
17
- triggerClass?: string;
18
- popoverClass?: string;
18
+ triggerClass?: ComponentClass;
19
+ popoverClass?: ComponentClass;
19
20
  destroyDelay?: number;
20
21
  scrollHidden?: boolean;
21
22
  popoverStyle?: CSSProperties | string;
@@ -29,11 +30,11 @@ interface Props {
29
30
  }
30
31
  declare function handlePopoverShow(immediate?: boolean): Promise<void>;
31
32
  declare function handlePopoverHide(immediate?: boolean): Promise<void>;
32
- declare var __VLS_1: {}, __VLS_10: {};
33
+ declare var __VLS_1: {}, __VLS_12: {};
33
34
  type __VLS_Slots = {} & {
34
35
  default?: (props: typeof __VLS_1) => any;
35
36
  } & {
36
- content?: (props: typeof __VLS_10) => any;
37
+ content?: (props: typeof __VLS_12) => any;
37
38
  };
38
39
  declare const __VLS_component: import("vue").DefineComponent<Props, {
39
40
  show: typeof handlePopoverShow;
@@ -41,9 +42,11 @@ declare const __VLS_component: import("vue").DefineComponent<Props, {
41
42
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
42
43
  hide: () => any;
43
44
  show: () => any;
45
+ "trigger-keydown": (args_0: KeyboardEvent) => any;
44
46
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
45
47
  onHide?: () => any;
46
48
  onShow?: () => any;
49
+ "onTrigger-keydown"?: (args_0: KeyboardEvent) => any;
47
50
  }>, {
48
51
  offset: number;
49
52
  maxWidth: number;