pxd 0.0.52 → 0.0.53

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 (258) hide show
  1. package/README.md +6 -3
  2. package/dist/components/active-graph/index.d.vue.ts +0 -2
  3. package/dist/components/active-graph/index.vue +35 -37
  4. package/dist/components/avatar/index.d.vue.ts +2 -2
  5. package/dist/components/avatar/index.vue +17 -16
  6. package/dist/components/avatar-group/index.d.vue.ts +1 -1
  7. package/dist/components/avatar-group/index.vue +4 -1
  8. package/dist/components/badge/cn.d.ts +90 -0
  9. package/dist/components/badge/cn.js +44 -0
  10. package/dist/components/badge/index.d.vue.ts +5 -33
  11. package/dist/components/badge/index.vue +10 -56
  12. package/dist/components/book/index.vue +90 -17
  13. package/dist/components/browser/index.vue +21 -6
  14. package/dist/components/button/cn.d.ts +121 -0
  15. package/dist/components/button/cn.js +55 -0
  16. package/dist/components/button/index.d.vue.ts +8 -14
  17. package/dist/components/button/index.vue +22 -74
  18. package/dist/components/carousel-group/index.d.vue.ts +1 -1
  19. package/dist/components/carousel-group/index.vue +32 -28
  20. package/dist/components/checkbox/cn.d.ts +67 -0
  21. package/dist/components/checkbox/cn.js +31 -0
  22. package/dist/components/checkbox/index.vue +9 -19
  23. package/dist/components/chip/cn.d.ts +49 -0
  24. package/dist/components/chip/cn.js +26 -0
  25. package/dist/components/chip/index.vue +13 -21
  26. package/dist/components/choicebox/index.vue +1 -1
  27. package/dist/components/choicebox-group/index.vue +6 -3
  28. package/dist/components/collapse/index.vue +7 -1
  29. package/dist/components/collapse-group/index.vue +7 -7
  30. package/dist/components/command-menu/index.vue +9 -8
  31. package/dist/components/command-menu-group/index.vue +4 -1
  32. package/dist/components/config-provider/index.d.vue.ts +1 -0
  33. package/dist/components/config-provider/index.vue +2 -1
  34. package/dist/components/countdown/index.vue +2 -10
  35. package/dist/components/dash-line/index.vue +22 -16
  36. package/dist/components/description/index.vue +4 -2
  37. package/dist/components/drawer/index.vue +19 -11
  38. package/dist/components/empty-state/index.vue +3 -1
  39. package/dist/components/error/cn.d.ts +22 -0
  40. package/dist/components/error/cn.js +15 -0
  41. package/dist/components/error/index.vue +13 -14
  42. package/dist/components/fader/index.vue +30 -14
  43. package/dist/components/gauge/index.vue +6 -6
  44. package/dist/components/grid/index.vue +16 -12
  45. package/dist/components/grid-item/index.vue +4 -4
  46. package/dist/components/hold-button/index.vue +19 -13
  47. package/dist/components/input/cn.d.ts +73 -0
  48. package/dist/components/input/cn.js +36 -0
  49. package/dist/components/input/index.d.vue.ts +14 -16
  50. package/dist/components/input/index.vue +74 -101
  51. package/dist/components/intersection-observer/index.vue +7 -3
  52. package/dist/components/kbd/index.vue +2 -2
  53. package/dist/components/link-button/index.d.vue.ts +8 -8
  54. package/dist/components/link-button/index.vue +17 -25
  55. package/dist/components/list/index.d.vue.ts +0 -1
  56. package/dist/components/list/index.vue +58 -57
  57. package/dist/components/list-item/cn.d.ts +22 -0
  58. package/dist/components/list-item/cn.js +15 -0
  59. package/dist/components/list-item/index.d.vue.ts +3 -3
  60. package/dist/components/list-item/index.vue +14 -25
  61. package/dist/components/loading-bar/cn.d.ts +70 -0
  62. package/dist/components/loading-bar/cn.js +32 -0
  63. package/dist/components/loading-bar/index.d.vue.ts +2 -0
  64. package/dist/components/loading-bar/index.vue +68 -61
  65. package/dist/components/loading-dots/index.vue +12 -4
  66. package/dist/components/menu/index.d.vue.ts +2 -2
  67. package/dist/components/menu/index.vue +4 -4
  68. package/dist/components/message/index.vue +82 -48
  69. package/dist/components/message-item/index.vue +7 -2
  70. package/dist/components/modal/index.vue +20 -12
  71. package/dist/components/more-button/index.d.vue.ts +1 -3
  72. package/dist/components/more-button/index.vue +7 -17
  73. package/dist/components/note/cn.d.ts +121 -0
  74. package/dist/components/note/cn.js +66 -0
  75. package/dist/components/note/index.d.vue.ts +3 -39
  76. package/dist/components/note/index.vue +18 -37
  77. package/dist/components/number-input/index.d.vue.ts +19 -10
  78. package/dist/components/number-input/index.vue +121 -75
  79. package/dist/components/overlay/index.vue +4 -20
  80. package/dist/components/pagination/index.vue +25 -8
  81. package/dist/components/pin-input/cn.d.ts +46 -0
  82. package/dist/components/pin-input/cn.js +25 -0
  83. package/dist/components/pin-input/index.vue +11 -20
  84. package/dist/components/placeholder/index.vue +11 -4
  85. package/dist/components/popover/index.d.vue.ts +4 -3
  86. package/dist/components/popover/index.vue +107 -54
  87. package/dist/components/progress/cn.d.ts +19 -0
  88. package/dist/components/progress/cn.js +14 -0
  89. package/dist/components/progress/index.d.vue.ts +1 -1
  90. package/dist/components/progress/index.vue +21 -14
  91. package/dist/components/radio/cn.d.ts +46 -0
  92. package/dist/components/radio/cn.js +42 -0
  93. package/dist/components/radio/index.vue +11 -18
  94. package/dist/components/resizable/index.vue +8 -2
  95. package/dist/components/resizable-handle/index.vue +1 -0
  96. package/dist/components/resizable-panel/index.vue +12 -11
  97. package/dist/components/skeleton/cn.d.ts +43 -0
  98. package/dist/components/skeleton/cn.js +24 -0
  99. package/dist/components/skeleton/index.d.vue.ts +4 -3
  100. package/dist/components/skeleton/index.vue +11 -20
  101. package/dist/components/slider/index.d.vue.ts +1 -1
  102. package/dist/components/slider/index.vue +14 -12
  103. package/dist/components/snippet/cn.d.ts +52 -0
  104. package/dist/components/snippet/cn.js +27 -0
  105. package/dist/components/snippet/index.vue +21 -29
  106. package/dist/components/spinner/index.vue +3 -1
  107. package/dist/components/stack/cn.d.ts +70 -0
  108. package/dist/components/stack/cn.js +33 -0
  109. package/dist/components/stack/index.d.vue.ts +2 -2
  110. package/dist/components/stack/index.vue +16 -31
  111. package/dist/components/status-dot/index.vue +5 -1
  112. package/dist/components/switch/cn.d.ts +16 -0
  113. package/dist/components/switch/cn.js +13 -0
  114. package/dist/components/switch/index.vue +5 -11
  115. package/dist/components/switch-group/index.vue +7 -4
  116. package/dist/components/text/cn.d.ts +67 -0
  117. package/dist/components/text/cn.js +34 -0
  118. package/dist/components/text/index.d.vue.ts +1 -1
  119. package/dist/components/text/index.vue +16 -25
  120. package/dist/components/textarea/cn.d.ts +58 -0
  121. package/dist/components/textarea/cn.js +30 -0
  122. package/dist/components/textarea/index.d.vue.ts +2 -0
  123. package/dist/components/textarea/index.vue +17 -24
  124. package/dist/components/theme-switcher/index.vue +6 -3
  125. package/dist/components/time-picker/index.d.vue.ts +2 -2
  126. package/dist/components/time-picker/index.vue +45 -25
  127. package/dist/components/toggle/index.vue +10 -6
  128. package/dist/components/tooltip/index.vue +3 -3
  129. package/dist/components/virtual-list/index.vue +1 -7
  130. package/dist/composables/use-browser-observer.d.ts +1 -1
  131. package/dist/composables/use-browser-observer.js +19 -15
  132. package/dist/composables/use-config-provider-context.d.ts +1 -0
  133. package/dist/composables/use-config-provider-context.js +5 -10
  134. package/dist/composables/use-countdown.js +1 -3
  135. package/dist/composables/use-deferred-value.js +1 -5
  136. package/dist/composables/use-delay-change.js +1 -4
  137. package/dist/composables/use-delay-destroy.js +1 -5
  138. package/dist/composables/use-loading-bar.d.ts +6 -14
  139. package/dist/composables/use-loading-bar.js +3 -14
  140. package/dist/composables/use-message.d.ts +9 -3
  141. package/dist/composables/use-message.js +9 -9
  142. package/dist/composables/use-model-value.d.ts +1 -0
  143. package/dist/composables/use-model-value.js +4 -2
  144. package/dist/composables/use-outside-click.js +12 -8
  145. package/dist/composables/use-pointer-gesture.js +5 -1
  146. package/dist/composables/use-toggle-value.js +1 -4
  147. package/dist/composables/use-virtual-list.js +14 -7
  148. package/dist/contexts/avatar.js +4 -4
  149. package/dist/contexts/carousel.js +1 -4
  150. package/dist/contexts/checkbox.js +1 -4
  151. package/dist/contexts/choicebox.js +2 -8
  152. package/dist/contexts/collapse.js +1 -4
  153. package/dist/contexts/list.js +5 -8
  154. package/dist/contexts/radio.js +4 -4
  155. package/dist/contexts/resizable.js +1 -4
  156. package/dist/contexts/switch.js +2 -8
  157. package/dist/index.d.ts +1 -0
  158. package/dist/styles/source.css +106 -59
  159. package/dist/styles/styles.css +1 -1
  160. package/dist/styles/tw.css +106 -59
  161. package/dist/types/components/avatar.d.ts +2 -2
  162. package/dist/types/components/button.d.ts +11 -4
  163. package/dist/types/components/index.d.ts +12 -0
  164. package/dist/types/components/input.d.ts +4 -5
  165. package/dist/types/components/list.d.ts +1 -1
  166. package/dist/types/components/switch.d.ts +1 -1
  167. package/dist/types/shared/props.d.ts +6 -4
  168. package/dist/types/shared/utils.d.ts +3 -1
  169. package/dist/utils/context.d.ts +2 -8
  170. package/dist/utils/date.d.ts +1 -1
  171. package/dist/utils/date.js +1 -5
  172. package/dist/utils/event.js +6 -18
  173. package/dist/utils/format.d.ts +1 -1
  174. package/dist/utils/format.js +1 -1
  175. package/dist/utils/is.d.ts +0 -1
  176. package/dist/utils/is.js +3 -2
  177. package/dist/utils/responsive.js +7 -4
  178. package/dist/utils/throttle.js +4 -2
  179. package/package.json +45 -43
  180. package/dist/components/_internal/fragment-container.vue.d.ts +0 -13
  181. package/dist/components/active-graph/index.vue.d.ts +0 -51
  182. package/dist/components/avatar/index.vue.d.ts +0 -34
  183. package/dist/components/avatar-group/index.vue.d.ts +0 -8
  184. package/dist/components/backtop/index.vue.d.ts +0 -21
  185. package/dist/components/badge/index.vue.d.ts +0 -52
  186. package/dist/components/book/index.vue.d.ts +0 -28
  187. package/dist/components/browser/index.vue.d.ts +0 -16
  188. package/dist/components/button/index.vue.d.ts +0 -29
  189. package/dist/components/carousel/index.vue.d.ts +0 -13
  190. package/dist/components/carousel-group/index.vue.d.ts +0 -35
  191. package/dist/components/checkbox/index.vue.d.ts +0 -26
  192. package/dist/components/checkbox-group/index.vue.d.ts +0 -28
  193. package/dist/components/chip/index.vue.d.ts +0 -24
  194. package/dist/components/choicebox/index.vue.d.ts +0 -16
  195. package/dist/components/choicebox-group/index.vue.d.ts +0 -24
  196. package/dist/components/collapse/index.vue.d.ts +0 -22
  197. package/dist/components/collapse-group/index.vue.d.ts +0 -20
  198. package/dist/components/command-menu/index.vue.d.ts +0 -42
  199. package/dist/components/command-menu-group/index.vue.d.ts +0 -17
  200. package/dist/components/command-menu-item/index.vue.d.ts +0 -13
  201. package/dist/components/config-provider/index.vue.d.ts +0 -22
  202. package/dist/components/countdown/index.vue.d.ts +0 -51
  203. package/dist/components/dash-line/index.vue.d.ts +0 -13
  204. package/dist/components/description/index.vue.d.ts +0 -20
  205. package/dist/components/drawer/index.vue.d.ts +0 -60
  206. package/dist/components/empty-state/index.vue.d.ts +0 -23
  207. package/dist/components/error/index.vue.d.ts +0 -22
  208. package/dist/components/fader/index.vue.d.ts +0 -12
  209. package/dist/components/gauge/index.vue.d.ts +0 -14
  210. package/dist/components/grid/index.vue.d.ts +0 -19
  211. package/dist/components/grid-item/index.vue.d.ts +0 -18
  212. package/dist/components/hold-button/index.vue.d.ts +0 -42
  213. package/dist/components/input/index.vue.d.ts +0 -55
  214. package/dist/components/intersection-observer/index.vue.d.ts +0 -39
  215. package/dist/components/kbd/index.vue.d.ts +0 -24
  216. package/dist/components/label/index.vue.d.ts +0 -13
  217. package/dist/components/link-button/index.vue.d.ts +0 -33
  218. package/dist/components/list/index.vue.d.ts +0 -44
  219. package/dist/components/list-item/index.vue.d.ts +0 -29
  220. package/dist/components/loading-bar/index.vue.d.ts +0 -15
  221. package/dist/components/loading-dots/index.vue.d.ts +0 -15
  222. package/dist/components/material/index.vue.d.ts +0 -18
  223. package/dist/components/menu/index.vue.d.ts +0 -33
  224. package/dist/components/message/index.vue.d.ts +0 -176
  225. package/dist/components/message-item/index.vue.d.ts +0 -15
  226. package/dist/components/modal/index.vue.d.ts +0 -58
  227. package/dist/components/more-button/index.vue.d.ts +0 -20
  228. package/dist/components/noise-background/index.vue.d.ts +0 -19
  229. package/dist/components/note/index.vue.d.ts +0 -64
  230. package/dist/components/number-input/index.vue.d.ts +0 -39
  231. package/dist/components/overlay/index.vue.d.ts +0 -35
  232. package/dist/components/pagination/index.vue.d.ts +0 -21
  233. package/dist/components/pin-input/index.vue.d.ts +0 -28
  234. package/dist/components/placeholder/index.vue.d.ts +0 -18
  235. package/dist/components/popover/index.vue.d.ts +0 -73
  236. package/dist/components/progress/index.vue.d.ts +0 -34
  237. package/dist/components/radio/index.vue.d.ts +0 -20
  238. package/dist/components/radio-group/index.vue.d.ts +0 -22
  239. package/dist/components/resizable/index.vue.d.ts +0 -19
  240. package/dist/components/resizable-handle/index.vue.d.ts +0 -3
  241. package/dist/components/resizable-panel/index.vue.d.ts +0 -20
  242. package/dist/components/scrollable/index.vue.d.ts +0 -0
  243. package/dist/components/skeleton/index.vue.d.ts +0 -26
  244. package/dist/components/slider/index.vue.d.ts +0 -26
  245. package/dist/components/snippet/index.vue.d.ts +0 -18
  246. package/dist/components/spinner/index.vue.d.ts +0 -3
  247. package/dist/components/stack/index.vue.d.ts +0 -30
  248. package/dist/components/status-dot/index.vue.d.ts +0 -11
  249. package/dist/components/switch/index.vue.d.ts +0 -20
  250. package/dist/components/switch-group/index.vue.d.ts +0 -23
  251. package/dist/components/teleport/index.vue.d.ts +0 -21
  252. package/dist/components/text/index.vue.d.ts +0 -26
  253. package/dist/components/textarea/index.vue.d.ts +0 -28
  254. package/dist/components/theme-switcher/index.vue.d.ts +0 -8
  255. package/dist/components/time-picker/index.vue.d.ts +0 -35
  256. package/dist/components/toggle/index.vue.d.ts +0 -41
  257. package/dist/components/tooltip/index.vue.d.ts +0 -32
  258. package/dist/components/virtual-list/index.vue.d.ts +0 -24
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # PXD
2
- A universal UI component library for Vue@2.7+ & Vue@3.2+
3
2
 
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)
3
+ A universal UI component library for Vue@2.7+ & Vue@3.2+
6
4
 
7
5
  [Online Preview](https://pxd-ui.netlify.app/)
8
6
 
@@ -44,3 +42,8 @@ pnpm build:docs
44
42
  ```shell
45
43
  pnpm build
46
44
  ```
45
+
46
+ ## Reference
47
+
48
+ - [Geist Design System](https://vercel.com/geist/introduction)
49
+ - [Figma(Community)](https://www.figma.com/design/1234567890/PXD-UI?node-id=0-1&t=1234567890-0)
@@ -11,7 +11,6 @@ interface Props {
11
11
  graphOnly?: boolean;
12
12
  transpose?: boolean;
13
13
  tooltip?: boolean;
14
- tooltipText?: string;
15
14
  fieldNames?: FieldNames;
16
15
  itemRadius?: string | number;
17
16
  }
@@ -39,7 +38,6 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
39
38
  colors: Record<string, string>;
40
39
  graphOnly: boolean;
41
40
  tooltip: boolean;
42
- tooltipText: string;
43
41
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
44
42
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
45
43
  declare const _default: typeof __VLS_export;
@@ -30,24 +30,26 @@ const props = defineProps({
30
30
  graphOnly: { type: Boolean, required: false, default: false },
31
31
  transpose: { type: Boolean, required: false },
32
32
  tooltip: { type: Boolean, required: false, default: true },
33
- tooltipText: { type: String, required: false, default: "{COUNT} on {DATE}" },
34
33
  fieldNames: { type: Object, required: false },
35
34
  itemRadius: { type: [String, Number], required: false }
36
35
  });
37
36
  const emits = defineEmits(["cell-click"]);
38
- const config = useConfigProvider();
37
+ const configProvider = useConfigProvider();
39
38
  const CELL_GAP = 3;
40
39
  const CELL_SIZE = 12;
41
40
  const rangedDates = computed(() => getAllDatesBetween(props.startDate, props.endDate));
42
41
  const dateCountMap = computed(() => {
43
42
  const { date, count } = props.fieldNames || { date: "date", count: "count" };
44
- return props.data.reduce((acc, cur) => {
45
- acc[cur[date]] = (acc[cur[date]] || 0) + cur[count];
46
- return acc;
47
- }, {});
43
+ return props.data.reduce(
44
+ (acc, cur) => {
45
+ acc[cur[date]] = (acc[cur[date]] || 0) + cur[count];
46
+ return acc;
47
+ },
48
+ {}
49
+ );
48
50
  });
49
51
  function getLocalizedDay(dayIndex) {
50
- return config.locale.date.day[dayIndex];
52
+ return configProvider.locale.date.day[dayIndex];
51
53
  }
52
54
  const tableHeadList = computed(() => {
53
55
  if (props.transpose) {
@@ -75,14 +77,14 @@ function createMonthHeaders() {
75
77
  const dayOfMonth = currentDate.getDate();
76
78
  if (shouldMarkAsMonthHeader(trackedMonth, currentMonth, dayOfMonth)) {
77
79
  trackedMonth = currentMonth;
78
- monthHeaders[col] = config.locale.date.month[currentMonth];
80
+ monthHeaders[col] = configProvider.locale.date.month[currentMonth];
79
81
  }
80
82
  }
81
83
  }
82
84
  }
83
85
  const isFirstTwoColumnsEmpty = monthHeaders[0] === "" && monthHeaders[1] === "";
84
86
  if (isFirstTwoColumnsEmpty) {
85
- monthHeaders[0] = config.locale.date.month[firstDate.getMonth()];
87
+ monthHeaders[0] = configProvider.locale.date.month[firstDate.getMonth()];
86
88
  }
87
89
  return monthHeaders;
88
90
  }
@@ -192,7 +194,7 @@ function markMonthRows(rows) {
192
194
  if (!monthMap[key] || day === 1) {
193
195
  monthMap[key] = true;
194
196
  row.isMonthFirstRow = true;
195
- row.monthName = config.locale.date.month[month];
197
+ row.monthName = configProvider.locale.date.month[month];
196
198
  row.headerText = row.monthName;
197
199
  }
198
200
  }
@@ -210,23 +212,13 @@ function onCellClick(event) {
210
212
  let tbodyRect;
211
213
  const tbodyRef = shallowRef();
212
214
  const tooltipInfo = shallowRef({});
213
- const {
214
- value: showTooltip,
215
- setValue: setShowTooltip
216
- } = useDelayChange(false, { delay: 500 });
217
- const formatTooltipText = computed(() => {
218
- if (props.tooltipText) {
219
- const { date = "", count = 0 } = tooltipInfo.value;
220
- return props.tooltipText.replace(/\{DATE\}/g, date).replace(/\{COUNT\}/g, String(count));
221
- }
222
- return "";
223
- });
224
- function onMouseLeave() {
215
+ const { value: showTooltip, setValue: setShowTooltip } = useDelayChange(false, { delay: 500 });
216
+ function onPointerLeave() {
225
217
  setShowTooltip(false, true);
226
218
  tooltipInfo.value = {};
227
219
  tbodyRect = null;
228
220
  }
229
- async function onMouseOver(ev) {
221
+ async function onPointerOver(ev) {
230
222
  if (!props.tooltip) {
231
223
  return;
232
224
  }
@@ -257,22 +249,22 @@ async function onMouseOver(ev) {
257
249
  };
258
250
  }
259
251
  onBeforeUnmount(() => {
260
- onMouseLeave();
252
+ onPointerLeave();
261
253
  });
262
254
  </script>
263
255
 
264
256
  <template>
265
- <div class="pxd-active-graph relative" :class="[graphOnly ? 'py-[3px] pr-[3px]' : 'pr-5']">
257
+ <div class="pxd-active-graph relative" :class="[graphOnly ? 'py-0.75 pr-0.75' : 'pr-5']">
266
258
  <table
267
259
  role="grid"
268
260
  aria-readonly="true"
269
- class="border-separate"
270
- style="border-spacing: 3px;"
271
- @pointerleave="onMouseLeave"
261
+ class="table-auto border-separate"
262
+ style="border-spacing: 3px"
263
+ @pointerleave="onPointerLeave"
272
264
  >
273
265
  <thead v-if="!graphOnly" class="text-xs">
274
266
  <tr class="h-3">
275
- <th class="pxd-active-graph--label" style="width: 30px;min-width: 30px;" />
267
+ <th class="pxd-active-graph--label" style="width: 30px; min-width: 30px" />
276
268
 
277
269
  <th
278
270
  v-for="(col, i) in tableHeadList"
@@ -289,10 +281,12 @@ onBeforeUnmount(() => {
289
281
  class="text-xs"
290
282
  :style="{ '--item-radius': getCssUnitValue(itemRadius, '2px') }"
291
283
  @click="onCellClick"
292
- @pointerover.capture="onMouseOver"
284
+ @pointerover.capture="onPointerOver"
293
285
  >
294
286
  <tr v-for="(row, i) of tableBodyList" :key="i" class="h-3">
295
- <td class="pxd-active-graph--label relative overflow-hidden leading-none text-foreground-secondary">
287
+ <td
288
+ class="pxd-active-graph--label relative overflow-hidden leading-none text-foreground-secondary"
289
+ >
296
290
  <span class="top-0 right-1 absolute">
297
291
  {{ row.headerText }}
298
292
  </span>
@@ -312,7 +306,9 @@ onBeforeUnmount(() => {
312
306
  <tr class="pxd-active-graph--placeholder h-0.5 pointer-events-none" />
313
307
  <tr class="pxd-active-graph--legend pointer-events-none">
314
308
  <td class="h-3 relative text-foreground-secondary">
315
- <span class="right-1 absolute top-1/2 -translate-y-1/2">{{ config.locale.compare.less }}</span>
309
+ <span class="right-1 absolute top-1/2 -translate-y-1/2">{{
310
+ configProvider.locale.compare.less
311
+ }}</span>
316
312
  </td>
317
313
 
318
314
  <td
@@ -323,7 +319,9 @@ onBeforeUnmount(() => {
323
319
  />
324
320
 
325
321
  <td class="h-3 w-3 relative text-foreground-secondary">
326
- <span class="absolute top-1/2 left-px -translate-y-1/2">{{ config.locale.compare.more }}</span>
322
+ <span class="absolute top-1/2 left-px -translate-y-1/2">{{
323
+ configProvider.locale.compare.more
324
+ }}</span>
327
325
  </td>
328
326
  </tr>
329
327
  </template>
@@ -334,11 +332,11 @@ onBeforeUnmount(() => {
334
332
  <div
335
333
  v-if="showTooltip"
336
334
  class="pxd-active-graph--tooltip left-0 top-0 px-2 py-1 pointer-events-none absolute z-1 w-max rounded-sm bg-gray-1000 text-13px text-gray-100 duration-50 will-change-transform motion-safe:transition-transform"
337
- :style="`transform: translate3d(${tooltipInfo.left}px, ${tooltipInfo.top}px, 0);`"
335
+ :style="`transform: translate(${tooltipInfo.left}px, ${tooltipInfo.top}px);`"
338
336
  >
339
- <slot name="tooltip" :data="tooltipInfo">
340
- {{ formatTooltipText }}
341
- </slot>
337
+ <slot name="tooltip" :data="tooltipInfo"
338
+ >{{ tooltipInfo.count }} - {{ tooltipInfo.date }}</slot
339
+ >
342
340
  </div>
343
341
  </Transition>
344
342
  </div>
@@ -16,12 +16,12 @@ type __VLS_Slots = {} & {
16
16
  declare const __VLS_base: import("vue").DefineComponent<Props, {
17
17
  getLoadingStatus: typeof getLoadingStatus;
18
18
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
- error: (args_0: Event) => any;
20
19
  load: (args_0: Event) => any;
20
+ error: (args_0: Event) => any;
21
21
  loadstart: (args_0: Event) => any;
22
22
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
23
- onError?: ((args_0: Event) => any) | undefined;
24
23
  onLoad?: ((args_0: Event) => any) | undefined;
24
+ onError?: ((args_0: Event) => any) | undefined;
25
25
  onLoadstart?: ((args_0: Event) => any) | undefined;
26
26
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
27
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -16,7 +16,9 @@ const emits = defineEmits(["load", "error", "loadstart"]);
16
16
  const loadingStatus = shallowRef("idle");
17
17
  const avatarGroupContext = useAvatarGroupContext();
18
18
  const computedSize = computed(() => getCssUnitValue(props.size || avatarGroupContext?.size, "32px"));
19
- const hideAvatar = computed(() => !props.src || props.placeholder || loadingStatus.value === "error");
19
+ const hideAvatar = computed(
20
+ () => !props.src || props.placeholder || loadingStatus.value === "error"
21
+ );
20
22
  function onLoadError(event) {
21
23
  loadingStatus.value = "error";
22
24
  emits("error", event);
@@ -39,7 +41,7 @@ defineExpose({
39
41
 
40
42
  <template>
41
43
  <div
42
- class="pxd-avatar relative inline-flex size-(--avatar-size) items-center justify-center rounded-full border border-background-100 select-none"
44
+ class="pxd-avatar relative inline-flex size-(--avatar-size) items-center justify-center rounded-full border border-background-100 select-none before:default-animation-timing-function! motion-safe:before:animate-[placeholder_8s_infinite]"
43
45
  :style="{ '--avatar-size': computedSize }"
44
46
  >
45
47
  <slot>
@@ -57,10 +59,13 @@ defineExpose({
57
59
  @loadstart="onLoadStart"
58
60
  @abort="onLoadError"
59
61
  @error="onLoadError"
60
- >
62
+ />
61
63
  </slot>
62
64
 
63
- <div v-if="loading" class="pxd-avatar--loading inset-0 backdrop-blur-xs absolute z-1 rounded-inherit" />
65
+ <div
66
+ v-if="loading"
67
+ class="pxd-avatar--loading inset-0 backdrop-blur-xs motion-safe:after:animate-spin absolute z-1 rounded-inherit"
68
+ />
64
69
 
65
70
  <div
66
71
  v-if="$slots.icon"
@@ -84,12 +89,18 @@ defineExpose({
84
89
  }
85
90
 
86
91
  &::before {
87
- background-image: linear-gradient(270deg, var(--color-gray-alpha-100), var(--color-gray-alpha-300), var(--color-gray-alpha-300), var(--color-gray-alpha-100));
92
+ background-image: linear-gradient(
93
+ 270deg,
94
+ var(--color-gray-alpha-100),
95
+ var(--color-gray-alpha-300),
96
+ var(--color-gray-alpha-300),
97
+ var(--color-gray-alpha-100)
98
+ );
88
99
  background-size: 400% 100%;
89
100
  }
90
101
 
91
102
  &::after {
92
- border: 1px solid var(--color-gray-alpha-400)
103
+ border: 1px solid var(--color-gray-alpha-400);
93
104
  }
94
105
  }
95
106
 
@@ -112,14 +123,4 @@ defineExpose({
112
123
  background-position: -200% 0;
113
124
  }
114
125
  }
115
-
116
- @media (prefers-reduced-motion: no-preference) {
117
- .pxd-avatar::before {
118
- animation: placeholder 8s var(--default-transition-timing-function) infinite;
119
- }
120
-
121
- .pxd-avatar--loading::after {
122
- animation: var(--animate-spin);
123
- }
124
- }
125
126
  </style>
@@ -2,7 +2,7 @@ import type { AvatarGroupProps } from '../../types/components/avatar';
2
2
  declare const __VLS_export: import("vue").DefineComponent<AvatarGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AvatarGroupProps> & Readonly<{}>, {
3
3
  size: number | string;
4
4
  max: number;
5
- options: import("../../types/components/avatar").Options[];
5
+ options: import("../../types/components/avatar").AvatarOptions[];
6
6
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
7
  declare const _default: typeof __VLS_export;
8
8
  export default _default;
@@ -30,7 +30,10 @@ provideAvatarGroupContext(props);
30
30
  class="[&:nth-child(n+2)]:-ml-2.5 hover:z-1"
31
31
  />
32
32
 
33
- <PAvatar v-if="slicedOptions.length < options.length" class="text-xs -ml-3 bg-gray-1000 text-gray-100">
33
+ <PAvatar
34
+ v-if="slicedOptions.length < options.length"
35
+ class="text-xs -ml-3 bg-gray-1000 text-gray-100"
36
+ >
34
37
  +{{ options.length - slicedOptions.length }}
35
38
  </PAvatar>
36
39
  </div>
@@ -0,0 +1,90 @@
1
+ export type BadgeVariant = 'pill' | 'gray' | 'blue' | 'purple' | 'amber' | 'red' | 'pink' | 'green' | 'teal' | 'gray-subtle' | 'blue-subtle' | 'purple-subtle' | 'amber-subtle' | 'red-subtle' | 'pink-subtle' | 'green-subtle' | 'teal-subtle' | 'inverted' | 'vue' | 'trial' | 'turborepo';
2
+ export type BadgeSize = 'sm' | 'md' | 'lg';
3
+ export declare const badgeVariant: import("tailwind-variants").TVReturnType<{
4
+ variant: {
5
+ pill: string;
6
+ gray: string;
7
+ blue: string;
8
+ purple: string;
9
+ amber: string;
10
+ red: string;
11
+ pink: string;
12
+ green: string;
13
+ teal: string;
14
+ 'gray-subtle': string;
15
+ 'blue-subtle': string;
16
+ 'purple-subtle': string;
17
+ 'amber-subtle': string;
18
+ 'red-subtle': string;
19
+ 'pink-subtle': string;
20
+ 'green-subtle': string;
21
+ 'teal-subtle': string;
22
+ inverted: string;
23
+ vue: string;
24
+ trial: string;
25
+ turborepo: string;
26
+ };
27
+ size: {
28
+ sm: string;
29
+ md: string;
30
+ lg: string;
31
+ };
32
+ }, undefined, "pxd-badge font-medium gap-1 inline-flex items-center justify-center rounded-full font-sans text-nowrap whitespace-nowrap no-underline! motion-safe:transition-all", {
33
+ variant: {
34
+ pill: string;
35
+ gray: string;
36
+ blue: string;
37
+ purple: string;
38
+ amber: string;
39
+ red: string;
40
+ pink: string;
41
+ green: string;
42
+ teal: string;
43
+ 'gray-subtle': string;
44
+ 'blue-subtle': string;
45
+ 'purple-subtle': string;
46
+ 'amber-subtle': string;
47
+ 'red-subtle': string;
48
+ 'pink-subtle': string;
49
+ 'green-subtle': string;
50
+ 'teal-subtle': string;
51
+ inverted: string;
52
+ vue: string;
53
+ trial: string;
54
+ turborepo: string;
55
+ };
56
+ size: {
57
+ sm: string;
58
+ md: string;
59
+ lg: string;
60
+ };
61
+ }, undefined, import("tailwind-variants").TVReturnType<{
62
+ variant: {
63
+ pill: string;
64
+ gray: string;
65
+ blue: string;
66
+ purple: string;
67
+ amber: string;
68
+ red: string;
69
+ pink: string;
70
+ green: string;
71
+ teal: string;
72
+ 'gray-subtle': string;
73
+ 'blue-subtle': string;
74
+ 'purple-subtle': string;
75
+ 'amber-subtle': string;
76
+ 'red-subtle': string;
77
+ 'pink-subtle': string;
78
+ 'green-subtle': string;
79
+ 'teal-subtle': string;
80
+ inverted: string;
81
+ vue: string;
82
+ trial: string;
83
+ turborepo: string;
84
+ };
85
+ size: {
86
+ sm: string;
87
+ md: string;
88
+ lg: string;
89
+ };
90
+ }, undefined, "pxd-badge font-medium gap-1 inline-flex items-center justify-center rounded-full font-sans text-nowrap whitespace-nowrap no-underline! motion-safe:transition-all", unknown, unknown, undefined>>;
@@ -0,0 +1,44 @@
1
+ import { tv } from "tailwind-variants";
2
+ export const badgeVariant = tv({
3
+ base: "pxd-badge font-medium gap-1 inline-flex items-center justify-center rounded-full font-sans text-nowrap whitespace-nowrap no-underline! motion-safe:transition-all",
4
+ variants: {
5
+ variant: {
6
+ pill: "bg-background-100",
7
+ gray: "text-white bg-gray-600",
8
+ blue: "bg-blue-700 text-gray-100 dark:text-gray-1000",
9
+ purple: "bg-purple-700 text-gray-100 dark:text-gray-1000",
10
+ amber: "bg-amber-700 text-gray-1000 dark:text-gray-100",
11
+ red: "bg-red-700 text-gray-100 dark:text-gray-1000",
12
+ pink: "bg-pink-700 text-gray-100 dark:text-gray-1000",
13
+ green: "bg-green-700 text-gray-100 dark:text-gray-1000",
14
+ teal: "bg-teal-700 text-gray-100 dark:text-gray-1000",
15
+ "gray-subtle": "bg-gray-200 text-gray-1000",
16
+ "blue-subtle": "bg-blue-200 text-blue-900",
17
+ "purple-subtle": "bg-purple-200 text-purple-900",
18
+ "amber-subtle": "bg-amber-200 text-amber-900",
19
+ "red-subtle": "bg-red-200 text-red-900",
20
+ "pink-subtle": "bg-pink-200 text-pink-900",
21
+ "green-subtle": "bg-green-200 text-green-900",
22
+ "teal-subtle": "bg-teal-200 text-teal-900",
23
+ inverted: "bg-gray-1000 text-gray-100",
24
+ vue: "text-gray-100 dark:text-gray-1000",
25
+ trial: "text-gray-100 dark:text-gray-1000",
26
+ turborepo: "text-gray-100 dark:text-gray-1000"
27
+ },
28
+ size: {
29
+ sm: "px-2 h-5 text-xs",
30
+ md: "px-2.5 h-6 text-xs",
31
+ lg: "px-3 h-7.5 text-sm"
32
+ }
33
+ },
34
+ compoundVariants: [
35
+ { variant: "pill", class: "pill" },
36
+ { variant: "vue", class: "vue" },
37
+ { variant: "trial", class: "trial" },
38
+ { variant: "turborepo", class: "turborepo" }
39
+ ],
40
+ defaultVariants: {
41
+ variant: "gray",
42
+ size: "md"
43
+ }
44
+ });
@@ -1,46 +1,18 @@
1
- import type { ComponentAs } from '../../types/shared';
1
+ import type { ComponentAs, ComponentSize } from '../../types/shared';
2
+ import type { BadgeVariant } from './cn';
2
3
  interface Props {
3
4
  as?: ComponentAs;
4
- variant?: keyof typeof VARIANTS;
5
- size?: keyof typeof SIZES;
6
5
  href?: string;
7
- to?: string;
6
+ size?: ComponentSize;
7
+ variant?: BadgeVariant;
8
8
  }
9
- declare const SIZES: {
10
- sm: string;
11
- md: string;
12
- lg: string;
13
- };
14
- declare const VARIANTS: {
15
- pill: string;
16
- gray: string;
17
- blue: string;
18
- purple: string;
19
- amber: string;
20
- red: string;
21
- pink: string;
22
- green: string;
23
- teal: string;
24
- 'gray-subtle': string;
25
- 'blue-subtle': string;
26
- 'purple-subtle': string;
27
- 'amber-subtle': string;
28
- 'red-subtle': string;
29
- 'pink-subtle': string;
30
- 'green-subtle': string;
31
- 'teal-subtle': string;
32
- inverted: string;
33
- vue: string;
34
- trial: string;
35
- turborepo: string;
36
- };
37
9
  declare var __VLS_8: {};
38
10
  type __VLS_Slots = {} & {
39
11
  default?: (props: typeof __VLS_8) => any;
40
12
  };
41
13
  declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
14
+ variant: BadgeVariant;
42
15
  as: ComponentAs;
43
- variant: keyof typeof VARIANTS;
44
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
45
17
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
46
18
  declare const _default: typeof __VLS_export;
@@ -1,72 +1,26 @@
1
1
  <script setup>
2
2
  import { computed } from "vue";
3
3
  import { useConfigProvider } from "../../composables/use-config-provider-context";
4
- import { getFallbackValue } from "../../utils/get";
4
+ import { badgeVariant } from "./cn";
5
5
  defineOptions({
6
- name: "PBadge"
6
+ name: "PBadge",
7
+ inheritAttrs: false
7
8
  });
8
9
  const props = defineProps({
9
10
  as: { type: null, required: false, default: "span" },
10
- variant: { type: null, required: false, default: "gray" },
11
- size: { type: null, required: false },
12
11
  href: { type: String, required: false },
13
- to: { type: String, required: false }
12
+ size: { type: String, required: false },
13
+ variant: { type: String, required: false, default: "gray" }
14
14
  });
15
- const SIZES = {
16
- sm: "px-2 h-5 text-xs",
17
- md: "px-2.5 h-6 text-xs",
18
- lg: "px-3 h-7.5 text-sm"
19
- };
20
- const VARIANTS = {
21
- "pill": "bg-background-100",
22
- "gray": "bg-gray-600 text-white",
23
- "blue": "bg-blue-700 text-gray-100 dark:text-gray-1000",
24
- "purple": "bg-purple-700 text-gray-100 dark:text-gray-1000",
25
- "amber": "bg-amber-700 text-gray-1000 dark:text-gray-100",
26
- "red": "bg-red-700 text-gray-100 dark:text-gray-1000",
27
- "pink": "bg-pink-700 text-gray-100 dark:text-gray-1000",
28
- "green": "bg-green-700 text-gray-100 dark:text-gray-1000",
29
- "teal": "bg-teal-700 text-gray-100 dark:text-gray-1000",
30
- "gray-subtle": "bg-gray-200 text-gray-1000",
31
- "blue-subtle": "bg-blue-200 text-blue-900",
32
- "purple-subtle": "bg-purple-200 text-purple-900",
33
- "amber-subtle": "bg-amber-200 text-amber-900",
34
- "red-subtle": "bg-red-200 text-red-900",
35
- "pink-subtle": "bg-pink-200 text-pink-900",
36
- "green-subtle": "bg-green-200 text-green-900",
37
- "teal-subtle": "bg-teal-200 text-teal-900",
38
- "inverted": "bg-gray-1000 text-gray-100",
39
- "vue": "text-gray-100 dark:text-gray-1000",
40
- "trial": "text-gray-100 dark:text-gray-1000",
41
- "turborepo": "text-gray-100 dark:text-gray-1000"
42
- };
43
- const config = useConfigProvider();
44
- const computedClass = computed(() => {
45
- const classes = [
46
- "pxd-badge font-medium gap-1 inline-flex items-center justify-center rounded-full font-sans text-nowrap whitespace-nowrap no-underline! motion-safe:transition-all",
47
- getFallbackValue(props.variant, VARIANTS, "gray"),
48
- getFallbackValue(props.size, SIZES, config.size),
49
- props.variant
50
- ];
51
- return classes.join(" ");
52
- });
53
- const badgeAttrs = computed(() => {
54
- const { as, href, to } = props;
55
- if (as === "router-link" || as === "RouterLink") {
56
- return {
57
- to: href || to
58
- };
59
- } else if (as === "a") {
60
- return {
61
- href: href || to
62
- };
63
- }
64
- return {};
15
+ const configProvider = useConfigProvider();
16
+ const computedClasses = computed(() => {
17
+ const { variant, size = configProvider.size } = props;
18
+ return badgeVariant({ variant, size });
65
19
  });
66
20
  </script>
67
21
 
68
22
  <template>
69
- <Component :is="as" :class="computedClass" v-bind="badgeAttrs">
23
+ <Component :is="as" :class="computedClasses" v-bind="$attrs">
70
24
  <slot />
71
25
  </Component>
72
26
  </template>