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
@@ -30,7 +30,7 @@ const props = defineProps({
30
30
  transpose: { type: Boolean, required: false },
31
31
  tooltipText: { type: String, required: false, default: "{COUNT} on {DATE}" }
32
32
  });
33
- const emits = defineEmits(["cellClick"]);
33
+ const emits = defineEmits(["cell-click"]);
34
34
  const config = useConfigProvider();
35
35
  const CELL_GAP = 3;
36
36
  const CELL_SIZE = 12;
@@ -200,7 +200,7 @@ function onCellClick(event) {
200
200
  if (!date) {
201
201
  return;
202
202
  }
203
- emits("cellClick", event, date);
203
+ emits("cell-click", event, date);
204
204
  }
205
205
  let tbodyRect;
206
206
  const tbodyRef = shallowRef();
@@ -325,7 +325,7 @@ onBeforeUnmount(() => {
325
325
  <Transition name="pxd-transition--fade">
326
326
  <div
327
327
  v-if="showTooltip"
328
- class="pxd-active-graph--tooltip left-0 top-0 bg-gray-1000 pointer-events-none text-gray-100 absolute z-10 px-2 py-1 text-[13px] rounded-sm w-max"
328
+ class="pxd-active-graph--tooltip left-0 top-0 bg-gray-1000 pointer-events-none text-gray-100 absolute z-10 px-2 py-1 text-[13px] rounded-sm w-max duration-50 will-change-transform motion-safe:transition-transform"
329
329
  :style="`transform: translate(${tooltipInfo.left}px, ${tooltipInfo.top}px);`"
330
330
  >
331
331
  <slot name="tooltip" :data="tooltipInfo">
@@ -12,23 +12,22 @@ interface Props {
12
12
  transpose?: boolean;
13
13
  tooltipText?: string;
14
14
  }
15
- /** 提示框信息 */
16
15
  interface TooltipInfo {
17
16
  date: string;
18
17
  count: number;
19
18
  left: number;
20
19
  top: number;
21
20
  }
22
- declare var __VLS_5: {
21
+ declare var __VLS_6: {
23
22
  data: TooltipInfo;
24
23
  };
25
24
  type __VLS_Slots = {} & {
26
- tooltip?: (props: typeof __VLS_5) => any;
25
+ tooltip?: (props: typeof __VLS_6) => any;
27
26
  };
28
27
  declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
29
- cellClick: (args_0: MouseEvent, args_1: string) => any;
28
+ "cell-click": (args_0: MouseEvent, args_1: string) => any;
30
29
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
31
- onCellClick?: (args_0: MouseEvent, args_1: string) => any;
30
+ "onCell-click"?: (args_0: MouseEvent, args_1: string) => any;
32
31
  }>, {
33
32
  data: DataItem[];
34
33
  legend: boolean;
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
- import { computed, inject, shallowRef } from "vue";
2
+ import { computed, shallowRef } from "vue";
3
+ import { useAvatarGroupContext } from "../../contexts/avatar";
3
4
  import { getCssUnitValue } from "../../utils/format";
4
5
  defineOptions({
5
6
  name: "PAvatar"
@@ -13,8 +14,8 @@ const props = defineProps({
13
14
  });
14
15
  const emits = defineEmits(["load", "error", "loadstart"]);
15
16
  const loadingStatus = shallowRef("idle");
16
- const groupSize = inject("groupSize", 32);
17
- const computedSize = computed(() => getCssUnitValue(props.size || groupSize));
17
+ const avatarGroupContext = useAvatarGroupContext();
18
+ const computedSize = computed(() => getCssUnitValue(props.size || avatarGroupContext?.size, "32px"));
18
19
  const hideAvatar = computed(() => !props.src || props.placeholder || loadingStatus.value === "error");
19
20
  function onLoadError(event) {
20
21
  loadingStatus.value = "error";
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
- import { computed, provide } from "vue";
2
+ import { computed } from "vue";
3
+ import { provideAvatarGroupContext } from "../../contexts/avatar";
3
4
  import PAvatar from "../avatar/index.vue";
4
5
  defineOptions({
5
6
  name: "PAvatarGroup"
@@ -9,8 +10,12 @@ const props = defineProps({
9
10
  size: { type: [Number, String], required: false, default: 32 },
10
11
  options: { type: Array, required: false, default: () => [] }
11
12
  });
12
- const slicedOptions = computed(() => props.options?.slice(0, props.max));
13
- provide("groupSize", props.size);
13
+ const slicedOptions = computed(() => {
14
+ const { max, options = [] } = props;
15
+ const maxCount = Math.max(Math.min(max, options.length), 1);
16
+ return options.slice(0, maxCount);
17
+ });
18
+ provideAvatarGroupContext(props);
14
19
  </script>
15
20
 
16
21
  <template>
@@ -1,16 +1,7 @@
1
- interface AvatarGroupOptions {
2
- src?: string;
3
- alt?: string;
4
- loading?: boolean;
5
- }
6
- interface Props {
7
- max?: number;
8
- size?: number | string;
9
- options?: AvatarGroupOptions[];
10
- }
11
- declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
1
+ import type { AvatarGroupProps } from '../../types/components/avatar';
2
+ declare const _default: import("vue").DefineComponent<AvatarGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AvatarGroupProps> & Readonly<{}>, {
12
3
  max: number;
13
- options: AvatarGroupOptions[];
4
+ options: import("../../types/components/avatar").Options[];
14
5
  size: number | string;
15
6
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
16
7
  export default _default;
@@ -1,7 +1,6 @@
1
1
  <script setup>
2
- import { twMerge } from "tailwind-merge";
3
2
  import { computed } from "vue";
4
- import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
3
+ import { useConfigProvider } from "../../composables/useConfigProviderContext";
5
4
  import { getFallbackValue } from "../../utils/value";
6
5
  defineOptions({
7
6
  name: "PBadge"
@@ -18,7 +17,7 @@ const SIZES = {
18
17
  lg: "px-3 h-7.5 text-sm"
19
18
  };
20
19
  const VARIANTS = {
21
- "pill": "bg-background shadow-[0_0_0_1px_var(--color-gray-300)]",
20
+ "pill": "bg-background",
22
21
  "gray": "bg-gray-600 text-white",
23
22
  "blue": "bg-blue-700 text-gray-100 dark:text-gray-1000",
24
23
  "purple": "bg-purple-700 text-gray-100 dark:text-gray-1000",
@@ -40,15 +39,16 @@ const VARIANTS = {
40
39
  "trial": "text-gray-100 dark:text-gray-1000",
41
40
  "turborepo": "text-gray-100 dark:text-gray-1000"
42
41
  };
43
- const computedSize = useConfigProviderSize(props.size, SIZES);
44
- const computedClass = computed(
45
- () => twMerge(
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",
42
+ const config = useConfigProvider();
43
+ const computedClass = computed(() => {
44
+ const classes = [
45
+ "pxd-badge inline-flex items-center justify-center px-2.5 font-medium h-6 rounded-full font-sans gap-1 !no-underline motion-safe:transition-all",
47
46
  getFallbackValue(props.variant, VARIANTS, "gray"),
48
- computedSize.value,
47
+ getFallbackValue(props.size, SIZES, config.size),
49
48
  props.variant
50
- )
51
- );
49
+ ];
50
+ return classes.join(" ");
51
+ });
52
52
  const badgeAttrs = computed(() => {
53
53
  if (props.as === "router-link" || props.as === "RouterLink") {
54
54
  return {
@@ -1,4 +1,4 @@
1
- import type { ComponentAs } from '../../types/components';
1
+ import type { ComponentAs } from '../../types/shared';
2
2
  interface Props {
3
3
  as?: ComponentAs;
4
4
  variant?: keyof typeof VARIANTS;
@@ -33,9 +33,9 @@ declare const VARIANTS: {
33
33
  trial: string;
34
34
  turborepo: string;
35
35
  };
36
- declare var __VLS_6: {};
36
+ declare var __VLS_7: {};
37
37
  type __VLS_Slots = {} & {
38
- default?: (props: typeof __VLS_6) => any;
38
+ default?: (props: typeof __VLS_7) => any;
39
39
  };
40
40
  declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
41
41
  variant: keyof typeof VARIANTS;
@@ -38,21 +38,18 @@ const computedStyle = computed(() => {
38
38
  };
39
39
  });
40
40
  const computedClass = computed(() => {
41
- const basic = ["pxd-book--container w-fit relative transform-3d duration-300 motion-safe:transition-transform"];
42
- basic.push(
41
+ const classes = ["pxd-book--container w-fit relative transform-3d duration-300 motion-safe:transition-transform"];
42
+ classes.push(
43
43
  ...Object.keys(formattedWidth.value).map((bp) => presetWidthClasses[bp])
44
44
  );
45
- return basic;
45
+ return classes.join(" ");
46
46
  });
47
47
  </script>
48
48
 
49
49
  <template>
50
50
  <div class="pxd-book inline-flex w-fit">
51
- <div
52
- :class="computedClass"
53
- :style="computedStyle"
54
- >
55
- <div class="pxd-book--content flex flex-col h-full overflow-hidden translate-z-0 relative bg-background-secondary">
51
+ <div :class="computedClass" :style="computedStyle">
52
+ <div class="pxd-book--content absolute w-full min-w-full flex flex-col h-full overflow-hidden translate-z-0 bg-background-secondary">
56
53
  <div
57
54
  v-if="variant === 'stripe'"
58
55
  class="flex w-full relative flex-1 overflow-hidden translate-z-0"
@@ -72,7 +69,7 @@ const computedClass = computed(() => {
72
69
  <div aria-hidden="true" class="pxd-book--spine h-full opacity-20" />
73
70
 
74
71
  <div class="pxd-book--content-inner flex flex-col w-full">
75
- <span class="pxd-book--title font-semibold text-balance pr-2">
72
+ <span class="pxd-book--title font-semibold text-balance break-all pr-2">
76
73
  <slot name="title">
77
74
  {{ title }}
78
75
  </slot>
@@ -90,7 +87,7 @@ const computedClass = computed(() => {
90
87
  </div>
91
88
 
92
89
  <div aria-hidden="true" class="pxd-book--pages absolute" />
93
- <div aria-hidden="true" class="pxd-book--back absolute left-0 h-full bg-gray-200" />
90
+ <div aria-hidden="true" class="pxd-book--back absolute left-0 w-full h-full bg-gray-200" />
94
91
  </div>
95
92
  </div>
96
93
  </template>
@@ -117,9 +114,6 @@ const computedClass = computed(() => {
117
114
  }
118
115
 
119
116
  .pxd-book--content {
120
- position: absolute;
121
- width: 100%;
122
- min-width: 100%;
123
117
  border-radius: var(--book-border-radius);
124
118
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .02), 0 4px 8px -4px rgba(0, 0, 0, .1), 0 16px 24px -8px rgba(0, 0, 0, .03);
125
119
 
@@ -180,12 +174,12 @@ const computedClass = computed(() => {
180
174
  }
181
175
 
182
176
  .pxd-book--back {
183
- width: 100%;
184
177
  border-radius: var(--book-border-radius);
185
178
  transform: translateZ(calc(-1 * var(--book-depth)));
186
179
  }
187
180
 
188
181
  .pxd-book:hover .pxd-book--container {
182
+ will-change: transform;
189
183
  transform: rotateY(var(--hover-rotate)) scale(var(--hover-scale)) translateX(var(--hover-translate-x));
190
184
  }
191
185
  </style>
@@ -1,4 +1,4 @@
1
- import type { ComponentLabel, ResponsiveValue } from '../../types/components';
1
+ import type { ComponentLabel, ResponsiveValue } from '../../types/shared';
2
2
  interface Props {
3
3
  color?: string;
4
4
  title?: ComponentLabel;
@@ -0,0 +1,54 @@
1
+ <script setup>
2
+ import ArrowLeftIcon from "@gdsicon/vue/arrow-left";
3
+ import LockClosedIcon from "@gdsicon/vue/lock-closed";
4
+ import RefreshClockwiseIcon from "@gdsicon/vue/refresh-clockwise";
5
+ import { useCopyClick } from "../../composables/useCopyClick";
6
+ import PButton from "../button/index.vue";
7
+ defineOptions({
8
+ name: "PBrowser"
9
+ });
10
+ defineProps({
11
+ address: { type: String, required: false }
12
+ });
13
+ const { renderAs, onCopyClick } = useCopyClick();
14
+ </script>
15
+
16
+ <template>
17
+ <div class="pxd-browser shadow-border-small rounded-md overflow-hidden bg-background-secondary">
18
+ <div class="bg-background py-2.5 px-5 flex justify-between gap-4 md:gap-6">
19
+ <div class="flex items-center flex-1 justify-center gap-4 min-w-0 first:justify-start md:first:max-w-[140px] max-md:first:flex-none last:justify-end md:last:max-w-[140px]">
20
+ <div class="flex items-center gap-2">
21
+ <div class="w-3 h-3 rounded-full bg-[#FE5F57]" />
22
+ <div class="w-3 h-3 rounded-full bg-[#FEBB2E]" />
23
+ <div class="w-3 h-3 rounded-full bg-[#26C941]" />
24
+ </div>
25
+
26
+ <div class="flex items-center gap-4 max-md:hidden text-sm text-gray-900">
27
+ <ArrowLeftIcon />
28
+ <ArrowLeftIcon class="rotate-180" />
29
+ <RefreshClockwiseIcon />
30
+ </div>
31
+ </div>
32
+
33
+ <div class="flex items-center flex-1 justify-center gap-4 min-w-0 first:justify-start md:first:max-w-[140px] max-md:first:flex-none last:justify-end md:last:max-w-[140px]">
34
+ <div class="lg:max-w-xs bg-background-secondary border border-gray-400 w-full rounded-full pl-2.5 pr-1 py-1 flex items-center justify-between">
35
+ <LockClosedIcon class="text-gray-900 text-sm" />
36
+
37
+ <div class="pl-1.5 text-[13px] text-gray-1000 truncate flex-1 min-w-0 text-center truncate">
38
+ {{ address }}
39
+ </div>
40
+
41
+ <PButton variant="ghost" size="xs" shape="rounded" class="size-6" icon @click="onCopyClick(address)">
42
+ <Transition name="pxd-transition--fade-scale" mode="out-in">
43
+ <component :is="renderAs" class="text-sm" />
44
+ </Transition>
45
+ </PButton>
46
+ </div>
47
+ </div>
48
+
49
+ <div class="flex items-center flex-1 justify-center gap-4 min-w-0 first:justify-start md:first:max-w-[140px] max-md:first:flex-none last:justify-end md:last:max-w-[140px] max-lg:hidden" />
50
+ </div>
51
+
52
+ <slot />
53
+ </div>
54
+ </template>
@@ -0,0 +1,15 @@
1
+ interface Props {
2
+ address?: string;
3
+ }
4
+ declare var __VLS_38: {};
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_38) => any;
7
+ };
8
+ 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>;
9
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
10
+ export default _default;
11
+ type __VLS_WithSlots<T, S> = T & {
12
+ new (): {
13
+ $slots: S;
14
+ };
15
+ };
@@ -1,7 +1,6 @@
1
1
  <script setup>
2
- import { twMerge } from "tailwind-merge";
3
2
  import { computed } from "vue";
4
- import { useConfigProviderSize } from "../../composables/useConfigProviderContext";
3
+ import { useConfigProvider } from "../../composables/useConfigProviderContext";
5
4
  import { isTruthyProp } from "../../utils/format";
6
5
  import { getFallbackValue } from "../../utils/value";
7
6
  import PSpinner from "../spinner/index.vue";
@@ -21,10 +20,19 @@ const props = defineProps({
21
20
  });
22
21
  const emits = defineEmits(["click", "dblclick"]);
23
22
  const SIZES = {
24
- xs: "h-6 px-1 rounded-md",
25
- sm: "h-7.5 px-1.5 rounded-md",
26
- md: "h-9 px-2.5 rounded-md",
27
- lg: "h-10 px-3.5 rounded-lg"
23
+ xs: "h-6 px-1",
24
+ sm: "h-7.5 px-1.5",
25
+ md: "h-9 px-2.5",
26
+ lg: "h-10 px-3.5"
27
+ };
28
+ const ROUNDED = {
29
+ xs: "rounded-md",
30
+ sm: "rounded-md",
31
+ md: "rounded-md",
32
+ lg: "rounded-lg",
33
+ xl: "rounded-xl",
34
+ square: "rounded-none",
35
+ rounded: "rounded-full"
28
36
  };
29
37
  const FONT_SIZES = {
30
38
  xs: "text-sm",
@@ -47,31 +55,30 @@ const ALIGNMENTS = {
47
55
  right: "justify-end"
48
56
  };
49
57
  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";
50
- const computedSize = useConfigProviderSize(props.size, SIZES);
51
- const computedFontSize = useConfigProviderSize(props.size, FONT_SIZES);
58
+ const config = useConfigProvider();
52
59
  const computedDisabled = computed(() => props.disabled || props.loading);
53
60
  const computedClass = computed(() => {
54
- const classNames = ["pxd-button cursor-pointer select-none items-center motion-safe:transition-all", ALIGNMENTS[props.align]];
61
+ const classes = ["pxd-button cursor-pointer select-none shrink-0 items-center motion-safe:transition-all", ALIGNMENTS[props.align]];
55
62
  const { variant, block, shape, icon } = props;
56
- classNames.push(computedFontSize.value);
63
+ classes.push(
64
+ isTruthyProp(block) ? "flex w-full" : "inline-flex",
65
+ getFallbackValue(props.size, FONT_SIZES, config.size),
66
+ shape ? ROUNDED[shape] : getFallbackValue(props.size, ROUNDED, config.size)
67
+ );
57
68
  if (icon) {
58
- classNames.push("aspect-square !p-0");
69
+ classes.push("aspect-square !p-0");
59
70
  }
60
71
  if (variant !== "simple") {
61
- classNames.push("border outline-none self-focus-ring");
62
- classNames.push(getFallbackValue(variant, VARIANTS));
63
- classNames.push(computedSize.value);
72
+ classes.push(
73
+ "border outline-none self-focus-ring",
74
+ getFallbackValue(variant, VARIANTS),
75
+ getFallbackValue(props.size, SIZES, config.size)
76
+ );
64
77
  }
65
- classNames.push(isTruthyProp(block) ? "flex w-full" : "inline-flex");
66
78
  if (computedDisabled.value) {
67
- classNames.push(DISABLED_CLASS_NAMES);
68
- }
69
- if (shape) {
70
- classNames.push(
71
- shape === "square" ? "rounded-none" : "rounded-full"
72
- );
79
+ classes.push(DISABLED_CLASS_NAMES);
73
80
  }
74
- return twMerge(classNames);
81
+ return classes.join(" ");
75
82
  });
76
83
  function onButtonClick(event) {
77
84
  emits("click", event);
@@ -94,7 +101,7 @@ function onButtonDblClick(event) {
94
101
 
95
102
  <slot name="prefix" />
96
103
 
97
- <span class="px-1.5 inline-flex truncate">
104
+ <span class="inline-flex items-center truncate" :class="{ 'px-1.5': !icon }">
98
105
  <slot />
99
106
  </span>
100
107
 
@@ -1,11 +1,11 @@
1
- import type { ButtonProps } from '../../types/components';
2
- declare var __VLS_14: {}, __VLS_16: {}, __VLS_18: {};
1
+ import type { ButtonProps } from '../../types/components/button';
2
+ declare var __VLS_15: {}, __VLS_17: {}, __VLS_19: {};
3
3
  type __VLS_Slots = {} & {
4
- prefix?: (props: typeof __VLS_14) => any;
4
+ prefix?: (props: typeof __VLS_15) => any;
5
5
  } & {
6
- default?: (props: typeof __VLS_16) => any;
6
+ default?: (props: typeof __VLS_17) => any;
7
7
  } & {
8
- suffix?: (props: typeof __VLS_18) => any;
8
+ suffix?: (props: typeof __VLS_19) => any;
9
9
  };
10
10
  declare const __VLS_component: import("vue").DefineComponent<ButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
11
  click: (args_0: MouseEvent) => any;
@@ -14,9 +14,9 @@ declare const __VLS_component: import("vue").DefineComponent<ButtonProps, {}, {}
14
14
  onClick?: (args_0: MouseEvent) => any;
15
15
  onDblclick?: (args_0: MouseEvent) => any;
16
16
  }>, {
17
- variant: import("../../types").ComponentVariantWithDefault | "ghost" | "simple" | "icon";
17
+ variant: import("../../types/shared").ComponentVariantWithDefault | "ghost" | "simple" | "icon";
18
18
  icon: boolean;
19
- as: import("../../types").ComponentAs;
19
+ as: import("../../types/shared").ComponentAs;
20
20
  align: "left" | "center" | "right";
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
22
22
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
@@ -0,0 +1,43 @@
1
+ <script setup>
2
+ import { onBeforeUnmount, onMounted, shallowRef } from "vue";
3
+ import { useCarouselGroupContext } from "../../contexts/carousel";
4
+ import { getUniqueId } from "../../utils/uid";
5
+ defineOptions({
6
+ name: "PCarousel"
7
+ });
8
+ const carouselGroupContext = useCarouselGroupContext();
9
+ const uniqueId = getUniqueId();
10
+ const transformStyle = shallowRef("");
11
+ function resetPosition() {
12
+ transformStyle.value = "";
13
+ }
14
+ function getTranslateStyle(translate) {
15
+ return carouselGroupContext.props.direction === "horizontal" ? `translateX(${translate}%)` : `translateY(${translate}%)`;
16
+ }
17
+ function translateItem(index, activeIndex) {
18
+ const maxLength = carouselGroupContext.carousels.value.length;
19
+ const lastIndex = maxLength - 1;
20
+ if (index === 0 && activeIndex === maxLength) {
21
+ transformStyle.value = getTranslateStyle(maxLength * 100);
22
+ } else if (index === lastIndex && activeIndex <= 0) {
23
+ transformStyle.value = getTranslateStyle(-maxLength * 100);
24
+ } else {
25
+ resetPosition();
26
+ }
27
+ }
28
+ onMounted(() => {
29
+ carouselGroupContext?.registerCarousel({
30
+ uid: uniqueId,
31
+ translateItem
32
+ });
33
+ });
34
+ onBeforeUnmount(() => {
35
+ carouselGroupContext?.unregisterCarousel(uniqueId);
36
+ });
37
+ </script>
38
+
39
+ <template>
40
+ <div class="pxd-carousel w-full h-full shrink-0" :style="{ transform: transformStyle }">
41
+ <slot />
42
+ </div>
43
+ </template>
@@ -0,0 +1,12 @@
1
+ declare var __VLS_1: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_1) => any;
4
+ };
5
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
7
+ export default _default;
8
+ type __VLS_WithSlots<T, S> = T & {
9
+ new (): {
10
+ $slots: S;
11
+ };
12
+ };