pxd 0.0.26 → 0.0.28
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/dist/components/active-graph/index.vue +9 -9
- package/dist/components/avatar/index.vue +4 -4
- package/dist/components/avatar-group/index.vue +2 -2
- package/dist/components/badge/index.vue +2 -2
- package/dist/components/book/index.vue +10 -10
- package/dist/components/book/index.vue.d.ts +1 -1
- package/dist/components/browser/index.vue +10 -10
- package/dist/components/button/index.vue +4 -4
- package/dist/components/carousel/index.vue +1 -1
- package/dist/components/carousel-group/index.vue +26 -20
- package/dist/components/checkbox/index.vue +7 -6
- package/dist/components/checkbox-group/index.vue +1 -1
- package/dist/components/chip/index.vue +6 -6
- package/dist/components/choicebox/index.vue +2 -2
- package/dist/components/collapse/index.vue +2 -2
- package/dist/components/config-provider/index.vue +1 -1
- package/dist/components/countdown/index.vue +39 -0
- package/dist/components/countdown/index.vue.d.ts +49 -0
- package/dist/components/description/index.vue +2 -2
- package/dist/components/drawer/index.vue +5 -5
- package/dist/components/empty-state/index.vue +6 -6
- package/dist/components/error/index.vue +1 -1
- package/dist/components/gauge/index.vue +4 -4
- package/dist/components/hold-button/index.vue +3 -3
- package/dist/components/hold-button/index.vue.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/input/index.vue +7 -7
- package/dist/components/kbd/index.vue +1 -1
- package/dist/components/link-button/index.vue +1 -1
- package/dist/components/loading-dots/index.vue +3 -3
- package/dist/components/material/index.vue +1 -1
- package/dist/components/menu/index.vue +1 -2
- package/dist/components/menu-item/index.vue +1 -1
- package/dist/components/menu-list/index.vue +3 -2
- package/dist/components/modal/index.vue +5 -5
- package/dist/components/more-button/index.vue +1 -1
- package/dist/components/note/index.vue +2 -2
- package/dist/components/overlay/index.vue +8 -8
- package/dist/components/pagination/index.vue +9 -9
- package/dist/components/pin-input/index.vue +3 -3
- package/dist/components/popover/index.vue +175 -176
- package/dist/components/popover/index.vue.d.ts +3 -4
- package/dist/components/progress/index.vue +3 -3
- package/dist/components/radio/index.vue +8 -7
- package/dist/components/radio-group/index.vue +1 -1
- package/dist/components/resizable/index.vue +3 -2
- package/dist/components/resizable-handle/index.vue +10 -6
- package/dist/components/resizable-panel/index.vue +4 -4
- package/dist/components/resizable-panel/index.vue.d.ts +2 -2
- package/dist/components/scrollable/index.vue +8 -8
- package/dist/components/skeleton/index.vue +1 -1
- package/dist/components/slider/index.vue +4 -4
- package/dist/components/snippet/index.vue +3 -3
- package/dist/components/spinner/index.vue +2 -2
- package/dist/components/stack/index.vue +5 -4
- package/dist/components/stack/index.vue.d.ts +2 -2
- package/dist/components/status-dot/index.vue +1 -1
- package/dist/components/switch/index.vue +3 -3
- package/dist/components/switch-group/index.vue +1 -1
- package/dist/components/text/index.vue.d.ts +1 -1
- package/dist/components/textarea/index.vue +2 -2
- package/dist/components/theme-switcher/index.vue +9 -80
- package/dist/components/theme-switcher/index.vue.d.ts +5 -6
- package/dist/components/toggle/index.vue +32 -25
- package/dist/components/toggle/index.vue.d.ts +7 -4
- package/dist/components/tooltip/index.vue +12 -13
- package/dist/components/tooltip/index.vue.d.ts +6 -1
- package/dist/components/virtual-list/index.vue +2 -2
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.js +2 -0
- package/dist/composables/useColorScheme.d.ts +7 -0
- package/dist/composables/useColorScheme.js +70 -0
- package/dist/composables/useConfigProviderContext.js +1 -1
- package/dist/composables/useCountdown.d.ts +48 -0
- package/dist/composables/useCountdown.js +136 -0
- package/dist/composables/useFocusTrap.js +21 -2
- package/dist/composables/useMediaQuery.d.ts +9 -8
- package/dist/composables/useMediaQuery.js +45 -19
- package/dist/contexts/resizable.d.ts +4 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/index.d.ts +2 -2
- package/dist/locales/index.js +2 -2
- package/dist/styles/styles.css +1 -1
- package/dist/styles/tw.css +15 -5
- package/dist/types/shared/props.d.ts +2 -2
- package/dist/utils/debounce.d.ts +73 -0
- package/dist/utils/debounce.js +60 -0
- package/dist/utils/dom.js +2 -2
- package/dist/utils/events.d.ts +6 -3
- package/dist/utils/events.js +34 -0
- package/dist/utils/fn.d.ts +1 -2
- package/dist/utils/fn.js +0 -2
- package/dist/utils/is.d.ts +0 -1
- package/dist/utils/is.js +0 -1
- package/dist/utils/throttle.d.ts +47 -0
- package/dist/utils/throttle.js +19 -0
- package/package.json +13 -20
- /package/dist/locales/{en-US.d.ts → en-us.d.ts} +0 -0
- /package/dist/locales/{en-US.js → en-us.js} +0 -0
- /package/dist/locales/{zh-CN.d.ts → zh-cn.d.ts} +0 -0
- /package/dist/locales/{zh-CN.js → zh-cn.js} +0 -0
|
@@ -270,9 +270,9 @@ onBeforeUnmount(() => {
|
|
|
270
270
|
<th
|
|
271
271
|
v-for="(col, i) in tableHeadList"
|
|
272
272
|
:key="col + i"
|
|
273
|
-
class="
|
|
273
|
+
class="font-normal relative text-foreground-secondary"
|
|
274
274
|
>
|
|
275
|
-
<span class="
|
|
275
|
+
<span class="-top-1 left-0 absolute whitespace-nowrap">{{ col }}</span>
|
|
276
276
|
</th>
|
|
277
277
|
</tr>
|
|
278
278
|
</thead>
|
|
@@ -284,8 +284,8 @@ onBeforeUnmount(() => {
|
|
|
284
284
|
@pointerover.capture="onMouseOver"
|
|
285
285
|
>
|
|
286
286
|
<tr v-for="(row, i) of tableBodyList" :key="i" class="h-3">
|
|
287
|
-
<td class="pxd-active-graph--label relative leading-none text-foreground-secondary
|
|
288
|
-
<span class="
|
|
287
|
+
<td class="pxd-active-graph--label relative overflow-hidden leading-none text-foreground-secondary">
|
|
288
|
+
<span class="top-0 right-1 absolute">
|
|
289
289
|
{{ row.headerText }}
|
|
290
290
|
</span>
|
|
291
291
|
</td>
|
|
@@ -301,10 +301,10 @@ onBeforeUnmount(() => {
|
|
|
301
301
|
</tr>
|
|
302
302
|
|
|
303
303
|
<template v-if="props.legend">
|
|
304
|
-
<tr class="pxd-active-graph--placeholder pointer-events-none
|
|
304
|
+
<tr class="pxd-active-graph--placeholder h-0.5 pointer-events-none" />
|
|
305
305
|
<tr class="pxd-active-graph--legend pointer-events-none">
|
|
306
|
-
<td class="
|
|
307
|
-
<span class="absolute top-1/2
|
|
306
|
+
<td class="h-3 relative text-foreground-secondary">
|
|
307
|
+
<span class="right-1 absolute top-1/2 -translate-y-1/2">{{ config.locale.compare.less }}</span>
|
|
308
308
|
</td>
|
|
309
309
|
|
|
310
310
|
<td
|
|
@@ -314,7 +314,7 @@ onBeforeUnmount(() => {
|
|
|
314
314
|
:style="`background-color: ${color}`"
|
|
315
315
|
/>
|
|
316
316
|
|
|
317
|
-
<td class="
|
|
317
|
+
<td class="h-3 w-3 relative text-foreground-secondary">
|
|
318
318
|
<span class="absolute top-1/2 left-px -translate-y-1/2">{{ config.locale.compare.more }}</span>
|
|
319
319
|
</td>
|
|
320
320
|
</tr>
|
|
@@ -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
|
|
328
|
+
class="pxd-active-graph--tooltip left-0 top-0 px-2 py-1 pointer-events-none absolute z-10 w-max rounded-sm bg-gray-1000 text-[13px] text-gray-100 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">
|
|
@@ -39,7 +39,7 @@ defineExpose({
|
|
|
39
39
|
|
|
40
40
|
<template>
|
|
41
41
|
<div
|
|
42
|
-
class="pxd-avatar inline-flex items-center justify-center
|
|
42
|
+
class="pxd-avatar relative inline-flex items-center justify-center rounded-full border border-background-100 select-none"
|
|
43
43
|
:style="{ '--size': computedSize }"
|
|
44
44
|
>
|
|
45
45
|
<slot>
|
|
@@ -52,7 +52,7 @@ defineExpose({
|
|
|
52
52
|
aria-hidden="true"
|
|
53
53
|
fetchpriority="low"
|
|
54
54
|
crossorigin="anonymous"
|
|
55
|
-
class="relative block
|
|
55
|
+
class="relative block size-full overflow-hidden rounded-inherit"
|
|
56
56
|
@load="onLoadSuccess"
|
|
57
57
|
@loadstart="onLoadStart"
|
|
58
58
|
@abort="onLoadError"
|
|
@@ -64,7 +64,7 @@ defineExpose({
|
|
|
64
64
|
|
|
65
65
|
<div
|
|
66
66
|
v-if="$slots.icon"
|
|
67
|
-
class="
|
|
67
|
+
class="-bottom-1 -left-1 absolute z-10 flex size-1/2 items-center overflow-hidden rounded-full border border-background-100 bg-background-100"
|
|
68
68
|
>
|
|
69
69
|
<slot name="icon" />
|
|
70
70
|
</div>
|
|
@@ -126,7 +126,7 @@ defineExpose({
|
|
|
126
126
|
|
|
127
127
|
@media (prefers-reduced-motion: no-preference) {
|
|
128
128
|
.pxd-avatar::before {
|
|
129
|
-
animation: placeholder 8s
|
|
129
|
+
animation: placeholder 8s var(--default-transition-timing-function) infinite;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
.pxd-avatar--loading::after {
|
|
@@ -27,10 +27,10 @@ provideAvatarGroupContext(props);
|
|
|
27
27
|
:src="option.src"
|
|
28
28
|
:alt="option.alt"
|
|
29
29
|
:loading="option.loading"
|
|
30
|
-
class="[&:nth-child(n+2)]:-ml-3"
|
|
30
|
+
class="[&:nth-child(n+2)]:-ml-3 hover:z-10"
|
|
31
31
|
/>
|
|
32
32
|
|
|
33
|
-
<PAvatar v-if="slicedOptions.length < options.length" class="text-xs bg-gray-1000 text-gray-100
|
|
33
|
+
<PAvatar v-if="slicedOptions.length < options.length" class="text-xs -ml-3 bg-gray-1000 text-gray-100">
|
|
34
34
|
+{{ options.length - slicedOptions.length }}
|
|
35
35
|
</PAvatar>
|
|
36
36
|
</div>
|
|
@@ -17,7 +17,7 @@ const SIZES = {
|
|
|
17
17
|
lg: "px-3 h-7.5 text-sm"
|
|
18
18
|
};
|
|
19
19
|
const VARIANTS = {
|
|
20
|
-
"pill": "bg-background",
|
|
20
|
+
"pill": "bg-background-100",
|
|
21
21
|
"gray": "bg-gray-600 text-white",
|
|
22
22
|
"blue": "bg-blue-700 text-gray-100 dark:text-gray-1000",
|
|
23
23
|
"purple": "bg-purple-700 text-gray-100 dark:text-gray-1000",
|
|
@@ -42,7 +42,7 @@ const VARIANTS = {
|
|
|
42
42
|
const config = useConfigProvider();
|
|
43
43
|
const computedClass = computed(() => {
|
|
44
44
|
const classes = [
|
|
45
|
-
"pxd-badge
|
|
45
|
+
"pxd-badge px-2.5 font-medium h-6 font-sans gap-1 inline-flex items-center justify-center rounded-full no-underline! motion-safe:transition-all",
|
|
46
46
|
getFallbackValue(props.variant, VARIANTS, "gray"),
|
|
47
47
|
getFallbackValue(props.size, SIZES, config.size),
|
|
48
48
|
props.variant
|
|
@@ -38,7 +38,7 @@ const computedStyle = computed(() => {
|
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
40
|
const computedClass = computed(() => {
|
|
41
|
-
const classes = ["pxd-book--container w-fit
|
|
41
|
+
const classes = ["pxd-book--container relative w-fit duration-300 transform-3d motion-safe:transition-transform"];
|
|
42
42
|
classes.push(
|
|
43
43
|
...Object.keys(formattedWidth.value).map((bp) => presetWidthClasses[bp])
|
|
44
44
|
);
|
|
@@ -49,27 +49,27 @@ const computedClass = computed(() => {
|
|
|
49
49
|
<template>
|
|
50
50
|
<div class="pxd-book inline-flex w-fit">
|
|
51
51
|
<div :class="computedClass" :style="computedStyle">
|
|
52
|
-
<div class="pxd-book--content absolute
|
|
52
|
+
<div class="pxd-book--content translate-z-0 absolute flex size-full min-w-full flex-col overflow-hidden bg-background-200">
|
|
53
53
|
<div
|
|
54
54
|
v-if="variant === 'stripe'"
|
|
55
|
-
class="flex w-full
|
|
55
|
+
class="translate-z-0 relative flex w-full flex-1 overflow-hidden"
|
|
56
56
|
style="background-color: var(--book-color, var(--color-amber-600))"
|
|
57
57
|
>
|
|
58
|
-
<div class="absolute flex flex-col
|
|
58
|
+
<div class="absolute flex w-full flex-col object-cover">
|
|
59
59
|
<slot name="icon" />
|
|
60
60
|
</div>
|
|
61
61
|
|
|
62
|
-
<div aria-hidden="true" class="pxd-book--spine
|
|
62
|
+
<div aria-hidden="true" class="pxd-book--spine left-0 absolute h-full mix-blend-overlay" />
|
|
63
63
|
</div>
|
|
64
64
|
|
|
65
65
|
<div
|
|
66
66
|
:class="{ 'pxd-book--cover-simple': variant === 'simple' }"
|
|
67
|
-
class="flex w-full
|
|
67
|
+
class="translate-z-0 relative flex w-full flex-1 overflow-hidden"
|
|
68
68
|
>
|
|
69
69
|
<div aria-hidden="true" class="pxd-book--spine h-full opacity-20" />
|
|
70
70
|
|
|
71
|
-
<div class="pxd-book--content-inner flex flex-col
|
|
72
|
-
<span class="pxd-book--title font-semibold text-balance break-all
|
|
71
|
+
<div class="pxd-book--content-inner flex w-full flex-col">
|
|
72
|
+
<span class="pxd-book--title font-semibold pr-2 text-balance break-all">
|
|
73
73
|
<slot name="title">
|
|
74
74
|
{{ title }}
|
|
75
75
|
</slot>
|
|
@@ -83,11 +83,11 @@ const computedClass = computed(() => {
|
|
|
83
83
|
</div>
|
|
84
84
|
</div>
|
|
85
85
|
|
|
86
|
-
<div v-if="textured" class="pxd-book--textured
|
|
86
|
+
<div v-if="textured" class="pxd-book--textured inset-0 pointer-events-none absolute bg-cover opacity-50" />
|
|
87
87
|
</div>
|
|
88
88
|
|
|
89
89
|
<div aria-hidden="true" class="pxd-book--pages absolute" />
|
|
90
|
-
<div aria-hidden="true" class="pxd-book--back
|
|
90
|
+
<div aria-hidden="true" class="pxd-book--back left-0 absolute size-full bg-gray-200" />
|
|
91
91
|
</div>
|
|
92
92
|
</div>
|
|
93
93
|
</template>
|
|
@@ -2,7 +2,7 @@ import type { ComponentLabel, ResponsiveValue } from '../../types/shared';
|
|
|
2
2
|
interface Props {
|
|
3
3
|
color?: string;
|
|
4
4
|
title?: ComponentLabel;
|
|
5
|
-
width?: number | string
|
|
5
|
+
width?: ResponsiveValue<number | string>;
|
|
6
6
|
variant?: 'simple' | 'stripe';
|
|
7
7
|
textured?: boolean;
|
|
8
8
|
}
|
|
@@ -14,27 +14,27 @@ const { renderAs, onCopyClick } = useCopyClick();
|
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<template>
|
|
17
|
-
<div class="pxd-browser
|
|
18
|
-
<div class="
|
|
19
|
-
<div class="
|
|
20
|
-
<div class="flex items-center
|
|
17
|
+
<div class="pxd-browser overflow-hidden rounded-md bg-background-200 shadow-border-small">
|
|
18
|
+
<div class="py-2.5 px-5 gap-4 md:gap-6 flex justify-between bg-background-100">
|
|
19
|
+
<div class="gap-4 min-w-0 md:first:max-w-[140px] md:last:max-w-[140px] flex flex-1 items-center justify-center max-md:first:flex-none first:justify-start last:justify-end">
|
|
20
|
+
<div class="gap-2 flex items-center">
|
|
21
21
|
<div class="w-3 h-3 rounded-full bg-[#FE5F57]" />
|
|
22
22
|
<div class="w-3 h-3 rounded-full bg-[#FEBB2E]" />
|
|
23
23
|
<div class="w-3 h-3 rounded-full bg-[#26C941]" />
|
|
24
24
|
</div>
|
|
25
25
|
|
|
26
|
-
<div class="flex items-center
|
|
26
|
+
<div class="gap-4 text-sm flex items-center text-gray-900 max-md:hidden">
|
|
27
27
|
<ArrowLeftIcon />
|
|
28
28
|
<ArrowLeftIcon class="rotate-180" />
|
|
29
29
|
<RefreshClockwiseIcon />
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
|
32
32
|
|
|
33
|
-
<div class="
|
|
34
|
-
<div class="lg:max-w-xs
|
|
35
|
-
<LockClosedIcon class="text-gray-900
|
|
33
|
+
<div class="gap-4 min-w-0 md:first:max-w-[140px] md:last:max-w-[140px] flex flex-1 items-center justify-center max-md:first:flex-none first:justify-start last:justify-end">
|
|
34
|
+
<div class="lg:max-w-xs pl-2.5 pr-1 py-1 flex w-full items-center justify-between rounded-full border border-gray-400 bg-background-200">
|
|
35
|
+
<LockClosedIcon class="text-sm text-gray-900" />
|
|
36
36
|
|
|
37
|
-
<div class="pl-1.5
|
|
37
|
+
<div class="pl-1.5 min-w-0 flex-1 truncate text-center text-[13px] text-gray-1000">
|
|
38
38
|
{{ address }}
|
|
39
39
|
</div>
|
|
40
40
|
|
|
@@ -46,7 +46,7 @@ const { renderAs, onCopyClick } = useCopyClick();
|
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
48
48
|
|
|
49
|
-
<div class="
|
|
49
|
+
<div class="gap-4 min-w-0 md:first:max-w-[140px] md:last:max-w-[140px] flex flex-1 items-center justify-center max-md:first:flex-none max-lg:hidden first:justify-start last:justify-end" />
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
<slot />
|
|
@@ -42,7 +42,7 @@ const FONT_SIZES = {
|
|
|
42
42
|
};
|
|
43
43
|
const VARIANTS = {
|
|
44
44
|
simple: "",
|
|
45
|
-
default: "bg-background text-foreground hover:bg-background-hover active:bg-background-active border-input",
|
|
45
|
+
default: "bg-background-100 text-foreground hover:bg-background-hover active:bg-background-active border-input",
|
|
46
46
|
ghost: "bg-transparent text-foreground hover:bg-gray-alpha-200 active:bg-gray-alpha-300 border-transparent",
|
|
47
47
|
primary: "bg-primary text-gray-100 hover:bg-primary/80 active:bg-gray-900 border-transparent",
|
|
48
48
|
error: "bg-red-800 text-white hover:bg-red-700 active:bg-red-900 border-transparent",
|
|
@@ -56,16 +56,16 @@ const ALIGNMENTS = {
|
|
|
56
56
|
};
|
|
57
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";
|
|
58
58
|
const config = useConfigProvider();
|
|
59
|
-
const computedDisabled = computed(() => props.disabled || props.loading);
|
|
59
|
+
const computedDisabled = computed(() => isTruthyProp(props.disabled) || isTruthyProp(props.loading));
|
|
60
60
|
const computedClass = computed(() => {
|
|
61
|
-
const classes = ["pxd-button cursor-pointer select-none
|
|
61
|
+
const classes = ["pxd-button shrink-0 cursor-pointer items-center select-none motion-safe:transition-all", ALIGNMENTS[props.align]];
|
|
62
62
|
const { variant, block, shape, icon } = props;
|
|
63
63
|
classes.push(
|
|
64
64
|
isTruthyProp(block) ? "flex w-full" : "inline-flex",
|
|
65
65
|
getFallbackValue(props.size, FONT_SIZES, config.size),
|
|
66
66
|
shape ? ROUNDED[shape] : getFallbackValue(props.size, ROUNDED, config.size)
|
|
67
67
|
);
|
|
68
|
-
if (icon) {
|
|
68
|
+
if (isTruthyProp(icon)) {
|
|
69
69
|
classes.push("aspect-square !p-0");
|
|
70
70
|
}
|
|
71
71
|
if (variant !== "simple") {
|
|
@@ -37,7 +37,7 @@ onBeforeUnmount(() => {
|
|
|
37
37
|
</script>
|
|
38
38
|
|
|
39
39
|
<template>
|
|
40
|
-
<div class="pxd-carousel
|
|
40
|
+
<div class="pxd-carousel size-full shrink-0" :style="{ transform: transformStyle }">
|
|
41
41
|
<slot />
|
|
42
42
|
</div>
|
|
43
43
|
</template>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import ChevronRightIcon from "@gdsicon/vue/chevron-right";
|
|
3
|
-
import { computed, onBeforeUnmount, onMounted, ref, shallowRef } from "vue";
|
|
3
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, ref, shallowRef } from "vue";
|
|
4
4
|
import { provideCarouselGroupContext } from "../../contexts/carousel";
|
|
5
|
-
import { throttle } from "../../utils/fn";
|
|
6
5
|
import { getCssUnitValue } from "../../utils/format";
|
|
6
|
+
import { throttle } from "../../utils/throttle";
|
|
7
7
|
defineOptions({
|
|
8
8
|
name: "PCarouselGroup"
|
|
9
9
|
});
|
|
@@ -25,7 +25,7 @@ const emits = defineEmits(["change"]);
|
|
|
25
25
|
const THROTTLE_INTERVALS = 550;
|
|
26
26
|
const TRANSITION_CLASSES = ["transition-transform", "duration-500"];
|
|
27
27
|
let autoPlayTimer;
|
|
28
|
-
const
|
|
28
|
+
const sliderRef = shallowRef();
|
|
29
29
|
const carousels = ref([]);
|
|
30
30
|
const virtualIndex = shallowRef(props.index);
|
|
31
31
|
const correctIndex = computed(() => {
|
|
@@ -55,14 +55,16 @@ const onToggleClick = throttle((delta) => {
|
|
|
55
55
|
if (length === 0) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
+
onPointerEnter();
|
|
58
59
|
if (props.loop) {
|
|
59
60
|
virtualIndex.value += delta;
|
|
60
61
|
translateItems();
|
|
61
62
|
} else {
|
|
62
63
|
virtualIndex.value = Math.max(0, Math.min(virtualIndex.value + delta, length - 1));
|
|
63
64
|
}
|
|
65
|
+
nextTick(onPointerLeave);
|
|
64
66
|
emits("change", correctIndex.value);
|
|
65
|
-
}, THROTTLE_INTERVALS, {
|
|
67
|
+
}, THROTTLE_INTERVALS, { edges: ["leading"] });
|
|
66
68
|
function onWheelToggle(ev) {
|
|
67
69
|
if (!props.toggleOnWheel) {
|
|
68
70
|
return;
|
|
@@ -75,7 +77,7 @@ function onWheelToggle(ev) {
|
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
function resetContainerPosition(resetIndex) {
|
|
78
|
-
const containerClassList =
|
|
80
|
+
const containerClassList = sliderRef.value.classList;
|
|
79
81
|
containerClassList.remove(...TRANSITION_CLASSES);
|
|
80
82
|
virtualIndex.value = resetIndex;
|
|
81
83
|
translateItems();
|
|
@@ -117,9 +119,11 @@ function onPointerLeave() {
|
|
|
117
119
|
setAutoPlayTimer();
|
|
118
120
|
}
|
|
119
121
|
function onIndicatorClick(ev) {
|
|
122
|
+
onPointerEnter();
|
|
120
123
|
const target = ev.target;
|
|
121
124
|
const targetIndex = Number(target.dataset.index);
|
|
122
125
|
virtualIndex.value = targetIndex;
|
|
126
|
+
nextTick(onPointerLeave);
|
|
123
127
|
}
|
|
124
128
|
function registerCarousel(state) {
|
|
125
129
|
carousels.value.push(state);
|
|
@@ -147,41 +151,43 @@ onBeforeUnmount(() => {
|
|
|
147
151
|
:data-direction="direction"
|
|
148
152
|
:data-indicator-type="indicatorType"
|
|
149
153
|
:data-indicator-position="indicatorPosition"
|
|
150
|
-
class="pxd-carousel-group group w-full
|
|
154
|
+
class="pxd-carousel-group group relative w-full touch-manipulation overflow-hidden"
|
|
151
155
|
:style="{ height: getCssUnitValue(height) }"
|
|
152
156
|
@pointerenter="onPointerEnter"
|
|
153
157
|
@pointerleave="onPointerLeave"
|
|
154
158
|
@wheel="onWheelToggle"
|
|
155
159
|
>
|
|
156
|
-
<div
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
<div class="pxd-carousel-group--container size-full">
|
|
161
|
+
<div
|
|
162
|
+
ref="sliderRef"
|
|
163
|
+
class="pxd-carousel-group--slider translate-z-0 size-full group-hover:will-change-transform group-data-[direction=horizontal]:flex"
|
|
164
|
+
:style="computedStyle"
|
|
165
|
+
:class="TRANSITION_CLASSES"
|
|
166
|
+
@transitionend="onTransitionsEnd"
|
|
167
|
+
>
|
|
168
|
+
<slot />
|
|
169
|
+
</div>
|
|
164
170
|
</div>
|
|
165
171
|
|
|
166
172
|
<div
|
|
167
173
|
v-if="indicator"
|
|
168
|
-
class="pxd-carousel-group--indicator absolute w-max
|
|
174
|
+
class="pxd-carousel-group--indicator gap-2 absolute flex w-max items-center group-data-[indicator-position=left]:flex-col group-data-[indicator-position=right]:flex-col"
|
|
169
175
|
@click="onIndicatorClick"
|
|
170
176
|
>
|
|
171
177
|
<button
|
|
172
178
|
v-for="(_, i) in carousels.length"
|
|
173
179
|
:key="i"
|
|
174
180
|
:data-index="i"
|
|
175
|
-
class="pxd-carousel-group--indicator-item
|
|
176
|
-
:class="{ '
|
|
181
|
+
class="pxd-carousel-group--indicator-item relative h-(--h) w-(--w) cursor-pointer appearance-none rounded-full bg-gray-alpha-200 self-focus-ring outline-none hover:bg-gray-alpha-400 motion-safe:transition-colors"
|
|
182
|
+
:class="{ 'bg-primary!': i === correctIndex }"
|
|
177
183
|
/>
|
|
178
184
|
</div>
|
|
179
185
|
|
|
180
|
-
<div v-if="arrow" class="pxd-carousel-group--toggle-buttons
|
|
186
|
+
<div v-if="arrow" class="pxd-carousel-group--toggle-buttons gap-2 absolute flex group-data-[indicator-position=left]:flex-col group-data-[indicator-position=right]:flex-col">
|
|
181
187
|
<button
|
|
182
188
|
type="button"
|
|
183
189
|
aria-label="Carousel arrow left"
|
|
184
|
-
class="pxd-carousel-group--prev-button
|
|
190
|
+
class="pxd-carousel-group--prev-button p-1.5 cursor-pointer appearance-none rounded-md bg-gray-alpha-100 self-focus-ring outline-none group-data-[direction=vertical]:rotate-90 hover:bg-gray-alpha-200 active:bg-gray-alpha-300 disabled:pointer-events-none motion-safe:transition-colors"
|
|
185
191
|
@click="onToggleClick(-1)"
|
|
186
192
|
>
|
|
187
193
|
<ChevronRightIcon class="rotate-180" />
|
|
@@ -190,7 +196,7 @@ onBeforeUnmount(() => {
|
|
|
190
196
|
<button
|
|
191
197
|
type="button"
|
|
192
198
|
aria-label="Carousel arrow right"
|
|
193
|
-
class="pxd-carousel-group--next-button
|
|
199
|
+
class="pxd-carousel-group--next-button p-1.5 cursor-pointer appearance-none rounded-md bg-gray-alpha-100 self-focus-ring outline-none group-data-[direction=vertical]:rotate-90 hover:bg-gray-alpha-200 active:bg-gray-alpha-300 disabled:pointer-events-none motion-safe:transition-colors"
|
|
194
200
|
@click="onToggleClick(1)"
|
|
195
201
|
>
|
|
196
202
|
<ChevronRightIcon />
|
|
@@ -37,8 +37,8 @@ const computedDisabled = computed(() => props.disabled || checkboxGroupContext?.
|
|
|
37
37
|
const computedRequired = computed(() => props.required || checkboxGroupContext?.required);
|
|
38
38
|
const computedClass = computed(() => {
|
|
39
39
|
const classes = [
|
|
40
|
-
"pxd-checkbox--inner size-4 shrink-0
|
|
41
|
-
"
|
|
40
|
+
"pxd-checkbox--inner size-4 inline-flex shrink-0 items-center justify-center peer-focus-ring",
|
|
41
|
+
"transform-gpu overflow-hidden rounded-sm border motion-safe:transition-colors"
|
|
42
42
|
];
|
|
43
43
|
if (isChecked.value) {
|
|
44
44
|
classes.push(
|
|
@@ -46,7 +46,7 @@ const computedClass = computed(() => {
|
|
|
46
46
|
);
|
|
47
47
|
} else {
|
|
48
48
|
classes.push(
|
|
49
|
-
computedDisabled.value ? "bg-gray-100 border-gray-500" : "bg-background border-gray-alpha-400 group-hover/checkbox:bg-gray-200"
|
|
49
|
+
computedDisabled.value ? "bg-gray-100 border-gray-500" : "bg-background-100 border-gray-alpha-400 group-hover/checkbox:bg-gray-200"
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
return classes.join(" ");
|
|
@@ -75,8 +75,9 @@ defineExpose({
|
|
|
75
75
|
|
|
76
76
|
<template>
|
|
77
77
|
<label
|
|
78
|
+
role="checkbox"
|
|
78
79
|
:aria-checked="isChecked"
|
|
79
|
-
class="pxd-checkbox inline-flex items-center
|
|
80
|
+
class="pxd-checkbox group/checkbox gap-2 inline-flex items-center"
|
|
80
81
|
:class="{ 'is-disabled cursor-not-allowed text-gray-500': computedDisabled }"
|
|
81
82
|
:for="uniqueId"
|
|
82
83
|
>
|
|
@@ -84,7 +85,7 @@ defineExpose({
|
|
|
84
85
|
:id="uniqueId"
|
|
85
86
|
:value="value"
|
|
86
87
|
type="checkbox"
|
|
87
|
-
class="smallest
|
|
88
|
+
class="peer smallest"
|
|
88
89
|
:checked="isChecked"
|
|
89
90
|
:required="computedRequired"
|
|
90
91
|
:disabled="computedDisabled"
|
|
@@ -97,7 +98,7 @@ defineExpose({
|
|
|
97
98
|
<span v-else class="size-3" />
|
|
98
99
|
</span>
|
|
99
100
|
|
|
100
|
-
<span class="flex-1
|
|
101
|
+
<span class="text-sm flex-1 empty:hidden">
|
|
101
102
|
<slot>
|
|
102
103
|
{{ label }}
|
|
103
104
|
</slot>
|
|
@@ -9,14 +9,14 @@ const props = defineProps({
|
|
|
9
9
|
variant: { type: String, required: false, default: "primary" }
|
|
10
10
|
});
|
|
11
11
|
const variantPresets = {
|
|
12
|
-
primary: "bg-primary text-background",
|
|
13
|
-
error: "bg-red-700 text-background dark:text-gray-1000",
|
|
12
|
+
primary: "bg-primary text-background-100",
|
|
13
|
+
error: "bg-red-700 text-background-100 dark:text-gray-1000",
|
|
14
14
|
warning: "bg-amber-700 text-gray-1000 dark:text-gray-100",
|
|
15
|
-
success: "bg-green-700 text-background dark:text-gray-1000",
|
|
16
|
-
secondary: "bg-gray-700 text-background dark:text-gray-1000"
|
|
15
|
+
success: "bg-green-700 text-background-100 dark:text-gray-1000",
|
|
16
|
+
secondary: "bg-gray-700 text-background-100 dark:text-gray-1000"
|
|
17
17
|
};
|
|
18
18
|
const computedClass = computed(() => {
|
|
19
|
-
const classes = ["pxd-chip--label
|
|
19
|
+
const classes = ["pxd-chip--label text-xs top-0 right-0 absolute rounded-full border border-background-100 motion-safe:transition-all"];
|
|
20
20
|
const { variant, inset, label } = props;
|
|
21
21
|
if (!label) {
|
|
22
22
|
classes.push("size-(--size)");
|
|
@@ -30,7 +30,7 @@ const computedClass = computed(() => {
|
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
32
|
<template>
|
|
33
|
-
<div class="pxd-chip inline-flex
|
|
33
|
+
<div class="pxd-chip relative inline-flex shrink-0">
|
|
34
34
|
<slot />
|
|
35
35
|
|
|
36
36
|
<span :data-label="label" :class="computedClass" :style="{ '--size': getCssUnitValue(size) }" />
|
|
@@ -29,7 +29,7 @@ const computedAttrs = computed(() => {
|
|
|
29
29
|
|
|
30
30
|
<template>
|
|
31
31
|
<component :is="renderComponent" v-model="choiceboxModelValue" v-bind="computedAttrs">
|
|
32
|
-
<div class="flex flex-col
|
|
32
|
+
<div class="gap-1 flex flex-col">
|
|
33
33
|
<span class="pxd-choicebox--label font-medium">
|
|
34
34
|
<slot name="label">
|
|
35
35
|
{{ label }}
|
|
@@ -56,7 +56,7 @@ const computedAttrs = computed(() => {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.pxd-choicebox.is-disabled {
|
|
59
|
-
background-color: var(--color-background);
|
|
59
|
+
background-color: var(--color-background-100);
|
|
60
60
|
border-color: var(--color-border);
|
|
61
61
|
|
|
62
62
|
.pxd-choicebox--label,
|
|
@@ -67,7 +67,7 @@ onMounted(() => {
|
|
|
67
67
|
<div class="pxd-collapse border-b will-change-contents">
|
|
68
68
|
<h3 class="pxd-collapse--title">
|
|
69
69
|
<button
|
|
70
|
-
class="pxd-collapse--trigger
|
|
70
|
+
class="pxd-collapse--trigger pr-1 group/collapse flex w-full cursor-pointer appearance-none items-center justify-between border-none bg-transparent self-focus-ring outline-none"
|
|
71
71
|
:data-state="isExpanded ? 'open' : 'closed'"
|
|
72
72
|
@click="onTriggerClick"
|
|
73
73
|
>
|
|
@@ -75,7 +75,7 @@ onMounted(() => {
|
|
|
75
75
|
{{ title }}
|
|
76
76
|
</slot>
|
|
77
77
|
|
|
78
|
-
<ChevronDownIcon class="shrink-0
|
|
78
|
+
<ChevronDownIcon class="size-4 shrink-0 group-data-[state=open]/collapse:-rotate-180 motion-safe:transition-transform" />
|
|
79
79
|
</button>
|
|
80
80
|
</h3>
|
|
81
81
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useCountdown } from "../../composables/useCountdown";
|
|
4
|
+
defineOptions({
|
|
5
|
+
name: "PCountDown"
|
|
6
|
+
});
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
format: { type: String, required: false, default: "hh:mm:ss.ms" },
|
|
9
|
+
active: { type: Boolean, required: false, default: false },
|
|
10
|
+
endTime: { type: Number, required: false, default: 0 },
|
|
11
|
+
autoReset: { type: Boolean, required: false, default: true },
|
|
12
|
+
durations: { type: Number, required: false, default: 0 },
|
|
13
|
+
precision: { type: Number, required: false, default: 0 },
|
|
14
|
+
millisecond: { type: Boolean, required: false, default: true }
|
|
15
|
+
});
|
|
16
|
+
const emits = defineEmits(["change", "reset", "finish"]);
|
|
17
|
+
const {
|
|
18
|
+
reset,
|
|
19
|
+
times
|
|
20
|
+
} = useCountdown(props, emits);
|
|
21
|
+
const displayTimes = computed(() => {
|
|
22
|
+
const { format, precision } = props;
|
|
23
|
+
let result = format;
|
|
24
|
+
result = result.replace(/\.ms/, precision ? `.${times.value.ms}` : "");
|
|
25
|
+
return result.replace(/dd/, times.value.dd).replace(/hh/, times.value.hh).replace(/mm/, times.value.mm).replace(/ss/, times.value.ss);
|
|
26
|
+
});
|
|
27
|
+
defineExpose({
|
|
28
|
+
reset,
|
|
29
|
+
times
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div class="pxd-countdown flex items-center justify-center leading-none tabular-nums">
|
|
35
|
+
<slot :times="times">
|
|
36
|
+
{{ displayTimes }}
|
|
37
|
+
</slot>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Options } from '../../composables/useCountdown';
|
|
2
|
+
interface Props extends Options {
|
|
3
|
+
format?: string;
|
|
4
|
+
}
|
|
5
|
+
declare var __VLS_1: {
|
|
6
|
+
times: {
|
|
7
|
+
dd: string;
|
|
8
|
+
hh: string;
|
|
9
|
+
mm: string;
|
|
10
|
+
ss: string;
|
|
11
|
+
ms: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
default?: (props: typeof __VLS_1) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_component: import("vue").DefineComponent<Props, {
|
|
18
|
+
reset: () => void;
|
|
19
|
+
times: import("vue").ComputedRef<{
|
|
20
|
+
dd: string;
|
|
21
|
+
hh: string;
|
|
22
|
+
mm: string;
|
|
23
|
+
ss: string;
|
|
24
|
+
ms: string;
|
|
25
|
+
}>;
|
|
26
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
|
+
finish: () => any;
|
|
28
|
+
change: (active: boolean) => any;
|
|
29
|
+
reset: () => any;
|
|
30
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
31
|
+
onFinish?: () => any;
|
|
32
|
+
onChange?: (active: boolean) => any;
|
|
33
|
+
onReset?: () => any;
|
|
34
|
+
}>, {
|
|
35
|
+
endTime: number;
|
|
36
|
+
active: boolean;
|
|
37
|
+
format: string;
|
|
38
|
+
millisecond: boolean;
|
|
39
|
+
durations: number;
|
|
40
|
+
autoReset: boolean;
|
|
41
|
+
precision: number;
|
|
42
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
43
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|