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.
- package/README.md +6 -3
- package/dist/components/active-graph/index.d.vue.ts +0 -2
- package/dist/components/active-graph/index.vue +35 -37
- package/dist/components/avatar/index.d.vue.ts +2 -2
- package/dist/components/avatar/index.vue +17 -16
- package/dist/components/avatar-group/index.d.vue.ts +1 -1
- package/dist/components/avatar-group/index.vue +4 -1
- package/dist/components/badge/cn.d.ts +90 -0
- package/dist/components/badge/cn.js +44 -0
- package/dist/components/badge/index.d.vue.ts +5 -33
- package/dist/components/badge/index.vue +10 -56
- package/dist/components/book/index.vue +90 -17
- package/dist/components/browser/index.vue +21 -6
- package/dist/components/button/cn.d.ts +121 -0
- package/dist/components/button/cn.js +55 -0
- package/dist/components/button/index.d.vue.ts +8 -14
- package/dist/components/button/index.vue +22 -74
- package/dist/components/carousel-group/index.d.vue.ts +1 -1
- package/dist/components/carousel-group/index.vue +32 -28
- package/dist/components/checkbox/cn.d.ts +67 -0
- package/dist/components/checkbox/cn.js +31 -0
- package/dist/components/checkbox/index.vue +9 -19
- package/dist/components/chip/cn.d.ts +49 -0
- package/dist/components/chip/cn.js +26 -0
- package/dist/components/chip/index.vue +13 -21
- package/dist/components/choicebox/index.vue +1 -1
- package/dist/components/choicebox-group/index.vue +6 -3
- package/dist/components/collapse/index.vue +7 -1
- package/dist/components/collapse-group/index.vue +7 -7
- package/dist/components/command-menu/index.vue +9 -8
- package/dist/components/command-menu-group/index.vue +4 -1
- package/dist/components/config-provider/index.d.vue.ts +1 -0
- package/dist/components/config-provider/index.vue +2 -1
- package/dist/components/countdown/index.vue +2 -10
- package/dist/components/dash-line/index.vue +22 -16
- package/dist/components/description/index.vue +4 -2
- package/dist/components/drawer/index.vue +19 -11
- package/dist/components/empty-state/index.vue +3 -1
- package/dist/components/error/cn.d.ts +22 -0
- package/dist/components/error/cn.js +15 -0
- package/dist/components/error/index.vue +13 -14
- package/dist/components/fader/index.vue +30 -14
- package/dist/components/gauge/index.vue +6 -6
- package/dist/components/grid/index.vue +16 -12
- package/dist/components/grid-item/index.vue +4 -4
- package/dist/components/hold-button/index.vue +19 -13
- package/dist/components/input/cn.d.ts +73 -0
- package/dist/components/input/cn.js +36 -0
- package/dist/components/input/index.d.vue.ts +14 -16
- package/dist/components/input/index.vue +74 -101
- package/dist/components/intersection-observer/index.vue +7 -3
- package/dist/components/kbd/index.vue +2 -2
- package/dist/components/link-button/index.d.vue.ts +8 -8
- package/dist/components/link-button/index.vue +17 -25
- package/dist/components/list/index.d.vue.ts +0 -1
- package/dist/components/list/index.vue +58 -57
- package/dist/components/list-item/cn.d.ts +22 -0
- package/dist/components/list-item/cn.js +15 -0
- package/dist/components/list-item/index.d.vue.ts +3 -3
- package/dist/components/list-item/index.vue +14 -25
- package/dist/components/loading-bar/cn.d.ts +70 -0
- package/dist/components/loading-bar/cn.js +32 -0
- package/dist/components/loading-bar/index.d.vue.ts +2 -0
- package/dist/components/loading-bar/index.vue +68 -61
- package/dist/components/loading-dots/index.vue +12 -4
- package/dist/components/menu/index.d.vue.ts +2 -2
- package/dist/components/menu/index.vue +4 -4
- package/dist/components/message/index.vue +82 -48
- package/dist/components/message-item/index.vue +7 -2
- package/dist/components/modal/index.vue +20 -12
- package/dist/components/more-button/index.d.vue.ts +1 -3
- package/dist/components/more-button/index.vue +7 -17
- package/dist/components/note/cn.d.ts +121 -0
- package/dist/components/note/cn.js +66 -0
- package/dist/components/note/index.d.vue.ts +3 -39
- package/dist/components/note/index.vue +18 -37
- package/dist/components/number-input/index.d.vue.ts +19 -10
- package/dist/components/number-input/index.vue +121 -75
- package/dist/components/overlay/index.vue +4 -20
- package/dist/components/pagination/index.vue +25 -8
- package/dist/components/pin-input/cn.d.ts +46 -0
- package/dist/components/pin-input/cn.js +25 -0
- package/dist/components/pin-input/index.vue +11 -20
- package/dist/components/placeholder/index.vue +11 -4
- package/dist/components/popover/index.d.vue.ts +4 -3
- package/dist/components/popover/index.vue +107 -54
- package/dist/components/progress/cn.d.ts +19 -0
- package/dist/components/progress/cn.js +14 -0
- package/dist/components/progress/index.d.vue.ts +1 -1
- package/dist/components/progress/index.vue +21 -14
- package/dist/components/radio/cn.d.ts +46 -0
- package/dist/components/radio/cn.js +42 -0
- package/dist/components/radio/index.vue +11 -18
- package/dist/components/resizable/index.vue +8 -2
- package/dist/components/resizable-handle/index.vue +1 -0
- package/dist/components/resizable-panel/index.vue +12 -11
- package/dist/components/skeleton/cn.d.ts +43 -0
- package/dist/components/skeleton/cn.js +24 -0
- package/dist/components/skeleton/index.d.vue.ts +4 -3
- package/dist/components/skeleton/index.vue +11 -20
- package/dist/components/slider/index.d.vue.ts +1 -1
- package/dist/components/slider/index.vue +14 -12
- package/dist/components/snippet/cn.d.ts +52 -0
- package/dist/components/snippet/cn.js +27 -0
- package/dist/components/snippet/index.vue +21 -29
- package/dist/components/spinner/index.vue +3 -1
- package/dist/components/stack/cn.d.ts +70 -0
- package/dist/components/stack/cn.js +33 -0
- package/dist/components/stack/index.d.vue.ts +2 -2
- package/dist/components/stack/index.vue +16 -31
- package/dist/components/status-dot/index.vue +5 -1
- package/dist/components/switch/cn.d.ts +16 -0
- package/dist/components/switch/cn.js +13 -0
- package/dist/components/switch/index.vue +5 -11
- package/dist/components/switch-group/index.vue +7 -4
- package/dist/components/text/cn.d.ts +67 -0
- package/dist/components/text/cn.js +34 -0
- package/dist/components/text/index.d.vue.ts +1 -1
- package/dist/components/text/index.vue +16 -25
- package/dist/components/textarea/cn.d.ts +58 -0
- package/dist/components/textarea/cn.js +30 -0
- package/dist/components/textarea/index.d.vue.ts +2 -0
- package/dist/components/textarea/index.vue +17 -24
- package/dist/components/theme-switcher/index.vue +6 -3
- package/dist/components/time-picker/index.d.vue.ts +2 -2
- package/dist/components/time-picker/index.vue +45 -25
- package/dist/components/toggle/index.vue +10 -6
- package/dist/components/tooltip/index.vue +3 -3
- package/dist/components/virtual-list/index.vue +1 -7
- package/dist/composables/use-browser-observer.d.ts +1 -1
- package/dist/composables/use-browser-observer.js +19 -15
- package/dist/composables/use-config-provider-context.d.ts +1 -0
- package/dist/composables/use-config-provider-context.js +5 -10
- package/dist/composables/use-countdown.js +1 -3
- package/dist/composables/use-deferred-value.js +1 -5
- package/dist/composables/use-delay-change.js +1 -4
- package/dist/composables/use-delay-destroy.js +1 -5
- package/dist/composables/use-loading-bar.d.ts +6 -14
- package/dist/composables/use-loading-bar.js +3 -14
- package/dist/composables/use-message.d.ts +9 -3
- package/dist/composables/use-message.js +9 -9
- package/dist/composables/use-model-value.d.ts +1 -0
- package/dist/composables/use-model-value.js +4 -2
- package/dist/composables/use-outside-click.js +12 -8
- package/dist/composables/use-pointer-gesture.js +5 -1
- package/dist/composables/use-toggle-value.js +1 -4
- package/dist/composables/use-virtual-list.js +14 -7
- package/dist/contexts/avatar.js +4 -4
- package/dist/contexts/carousel.js +1 -4
- package/dist/contexts/checkbox.js +1 -4
- package/dist/contexts/choicebox.js +2 -8
- package/dist/contexts/collapse.js +1 -4
- package/dist/contexts/list.js +5 -8
- package/dist/contexts/radio.js +4 -4
- package/dist/contexts/resizable.js +1 -4
- package/dist/contexts/switch.js +2 -8
- package/dist/index.d.ts +1 -0
- package/dist/styles/source.css +106 -59
- package/dist/styles/styles.css +1 -1
- package/dist/styles/tw.css +106 -59
- package/dist/types/components/avatar.d.ts +2 -2
- package/dist/types/components/button.d.ts +11 -4
- package/dist/types/components/index.d.ts +12 -0
- package/dist/types/components/input.d.ts +4 -5
- package/dist/types/components/list.d.ts +1 -1
- package/dist/types/components/switch.d.ts +1 -1
- package/dist/types/shared/props.d.ts +6 -4
- package/dist/types/shared/utils.d.ts +3 -1
- package/dist/utils/context.d.ts +2 -8
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.js +1 -5
- package/dist/utils/event.js +6 -18
- package/dist/utils/format.d.ts +1 -1
- package/dist/utils/format.js +1 -1
- package/dist/utils/is.d.ts +0 -1
- package/dist/utils/is.js +3 -2
- package/dist/utils/responsive.js +7 -4
- package/dist/utils/throttle.js +4 -2
- package/package.json +45 -43
- package/dist/components/_internal/fragment-container.vue.d.ts +0 -13
- package/dist/components/active-graph/index.vue.d.ts +0 -51
- package/dist/components/avatar/index.vue.d.ts +0 -34
- package/dist/components/avatar-group/index.vue.d.ts +0 -8
- package/dist/components/backtop/index.vue.d.ts +0 -21
- package/dist/components/badge/index.vue.d.ts +0 -52
- package/dist/components/book/index.vue.d.ts +0 -28
- package/dist/components/browser/index.vue.d.ts +0 -16
- package/dist/components/button/index.vue.d.ts +0 -29
- package/dist/components/carousel/index.vue.d.ts +0 -13
- package/dist/components/carousel-group/index.vue.d.ts +0 -35
- package/dist/components/checkbox/index.vue.d.ts +0 -26
- package/dist/components/checkbox-group/index.vue.d.ts +0 -28
- package/dist/components/chip/index.vue.d.ts +0 -24
- package/dist/components/choicebox/index.vue.d.ts +0 -16
- package/dist/components/choicebox-group/index.vue.d.ts +0 -24
- package/dist/components/collapse/index.vue.d.ts +0 -22
- package/dist/components/collapse-group/index.vue.d.ts +0 -20
- package/dist/components/command-menu/index.vue.d.ts +0 -42
- package/dist/components/command-menu-group/index.vue.d.ts +0 -17
- package/dist/components/command-menu-item/index.vue.d.ts +0 -13
- package/dist/components/config-provider/index.vue.d.ts +0 -22
- package/dist/components/countdown/index.vue.d.ts +0 -51
- package/dist/components/dash-line/index.vue.d.ts +0 -13
- package/dist/components/description/index.vue.d.ts +0 -20
- package/dist/components/drawer/index.vue.d.ts +0 -60
- package/dist/components/empty-state/index.vue.d.ts +0 -23
- package/dist/components/error/index.vue.d.ts +0 -22
- package/dist/components/fader/index.vue.d.ts +0 -12
- package/dist/components/gauge/index.vue.d.ts +0 -14
- package/dist/components/grid/index.vue.d.ts +0 -19
- package/dist/components/grid-item/index.vue.d.ts +0 -18
- package/dist/components/hold-button/index.vue.d.ts +0 -42
- package/dist/components/input/index.vue.d.ts +0 -55
- package/dist/components/intersection-observer/index.vue.d.ts +0 -39
- package/dist/components/kbd/index.vue.d.ts +0 -24
- package/dist/components/label/index.vue.d.ts +0 -13
- package/dist/components/link-button/index.vue.d.ts +0 -33
- package/dist/components/list/index.vue.d.ts +0 -44
- package/dist/components/list-item/index.vue.d.ts +0 -29
- package/dist/components/loading-bar/index.vue.d.ts +0 -15
- package/dist/components/loading-dots/index.vue.d.ts +0 -15
- package/dist/components/material/index.vue.d.ts +0 -18
- package/dist/components/menu/index.vue.d.ts +0 -33
- package/dist/components/message/index.vue.d.ts +0 -176
- package/dist/components/message-item/index.vue.d.ts +0 -15
- package/dist/components/modal/index.vue.d.ts +0 -58
- package/dist/components/more-button/index.vue.d.ts +0 -20
- package/dist/components/noise-background/index.vue.d.ts +0 -19
- package/dist/components/note/index.vue.d.ts +0 -64
- package/dist/components/number-input/index.vue.d.ts +0 -39
- package/dist/components/overlay/index.vue.d.ts +0 -35
- package/dist/components/pagination/index.vue.d.ts +0 -21
- package/dist/components/pin-input/index.vue.d.ts +0 -28
- package/dist/components/placeholder/index.vue.d.ts +0 -18
- package/dist/components/popover/index.vue.d.ts +0 -73
- package/dist/components/progress/index.vue.d.ts +0 -34
- package/dist/components/radio/index.vue.d.ts +0 -20
- package/dist/components/radio-group/index.vue.d.ts +0 -22
- package/dist/components/resizable/index.vue.d.ts +0 -19
- package/dist/components/resizable-handle/index.vue.d.ts +0 -3
- package/dist/components/resizable-panel/index.vue.d.ts +0 -20
- package/dist/components/scrollable/index.vue.d.ts +0 -0
- package/dist/components/skeleton/index.vue.d.ts +0 -26
- package/dist/components/slider/index.vue.d.ts +0 -26
- package/dist/components/snippet/index.vue.d.ts +0 -18
- package/dist/components/spinner/index.vue.d.ts +0 -3
- package/dist/components/stack/index.vue.d.ts +0 -30
- package/dist/components/status-dot/index.vue.d.ts +0 -11
- package/dist/components/switch/index.vue.d.ts +0 -20
- package/dist/components/switch-group/index.vue.d.ts +0 -23
- package/dist/components/teleport/index.vue.d.ts +0 -21
- package/dist/components/text/index.vue.d.ts +0 -26
- package/dist/components/textarea/index.vue.d.ts +0 -28
- package/dist/components/theme-switcher/index.vue.d.ts +0 -8
- package/dist/components/time-picker/index.vue.d.ts +0 -35
- package/dist/components/toggle/index.vue.d.ts +0 -41
- package/dist/components/tooltip/index.vue.d.ts +0 -32
- 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
|
-
|
|
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
|
|
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(
|
|
45
|
-
acc
|
|
46
|
-
|
|
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
|
|
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] =
|
|
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] =
|
|
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 =
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
252
|
+
onPointerLeave();
|
|
261
253
|
});
|
|
262
254
|
</script>
|
|
263
255
|
|
|
264
256
|
<template>
|
|
265
|
-
<div class="pxd-active-graph relative" :class="[graphOnly ? 'py-
|
|
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="
|
|
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="
|
|
284
|
+
@pointerover.capture="onPointerOver"
|
|
293
285
|
>
|
|
294
286
|
<tr v-for="(row, i) of tableBodyList" :key="i" class="h-3">
|
|
295
|
-
<td
|
|
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">{{
|
|
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">{{
|
|
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:
|
|
335
|
+
:style="`transform: translate(${tooltipInfo.left}px, ${tooltipInfo.top}px);`"
|
|
338
336
|
>
|
|
339
|
-
<slot name="tooltip" :data="tooltipInfo"
|
|
340
|
-
{{
|
|
341
|
-
|
|
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(
|
|
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
|
|
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(
|
|
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").
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
12
|
+
size: { type: String, required: false },
|
|
13
|
+
variant: { type: String, required: false, default: "gray" }
|
|
14
14
|
});
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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="
|
|
23
|
+
<Component :is="as" :class="computedClasses" v-bind="$attrs">
|
|
70
24
|
<slot />
|
|
71
25
|
</Component>
|
|
72
26
|
</template>
|