pxd 0.0.39 → 0.0.41
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 +9 -3
- package/dist/components/active-graph/index.vue +10 -5
- package/dist/components/backtop/index.vue +75 -0
- package/dist/components/badge/index.vue +9 -7
- package/dist/components/book/index.vue +3 -3
- package/dist/components/browser/index.vue +2 -2
- package/dist/components/checkbox/index.vue +4 -3
- package/dist/components/checkbox-group/index.vue +1 -1
- package/dist/components/choicebox-group/index.vue +1 -1
- package/dist/components/command-menu/index.vue +124 -0
- package/dist/components/command-menu-group/index.vue +18 -0
- package/dist/components/command-menu-item/index.vue +13 -0
- package/dist/components/countdown/index.vue +2 -1
- package/dist/components/drawer/index.vue +26 -26
- package/dist/components/error/index.vue +2 -2
- package/dist/components/fader/index.vue +31 -17
- package/dist/components/grid/index.vue +2 -2
- package/dist/components/grid-item/index.vue +2 -2
- package/dist/components/hold-button/index.vue +1 -1
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.js +7 -0
- package/dist/components/input/index.vue +18 -10
- package/dist/components/intersection-observer/index.vue +5 -5
- package/dist/components/kbd/index.vue +21 -8
- package/dist/components/{intersection-observer/content.vue → keep-alive-container/index.vue} +3 -1
- package/dist/components/list/index.vue +100 -92
- package/dist/components/list-item/index.vue +35 -33
- package/dist/components/loading-bar/index.vue +149 -0
- package/dist/components/material/index.vue +8 -8
- package/dist/components/menu/index.vue +26 -16
- package/dist/components/message/index.vue +28 -18
- package/dist/components/modal/index.vue +32 -36
- package/dist/components/note/index.vue +1 -1
- package/dist/components/overlay/index.vue +77 -24
- package/dist/components/pagination/index.vue +2 -2
- package/dist/components/placeholder/index.vue +13 -6
- package/dist/components/popover/index.vue +97 -87
- package/dist/components/progress/index.vue +1 -1
- package/dist/components/radio/index.vue +4 -3
- package/dist/components/radio-group/index.vue +1 -1
- package/dist/components/scrollable/index.vue +161 -94
- package/dist/components/slider/index.vue +7 -7
- package/dist/components/stack/index.vue +4 -4
- package/dist/components/switch/index.vue +1 -1
- package/dist/components/text/index.vue +1 -1
- package/dist/components/theme-switcher/index.vue +6 -2
- package/dist/components/time-picker/index.vue +281 -0
- package/dist/components/tooltip/index.vue +7 -7
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-browser-observer.d.ts +5 -5
- package/dist/composables/use-color-scheme.d.ts +5 -1
- package/dist/composables/use-color-scheme.js +20 -1
- package/dist/composables/use-config-provider-context.d.ts +1 -1
- package/dist/composables/use-countdown.d.ts +6 -0
- package/dist/composables/use-countdown.js +21 -7
- package/dist/composables/use-delay-destroy.d.ts +4 -4
- package/dist/composables/use-delay-destroy.js +15 -11
- package/dist/composables/use-focus-trap.d.ts +2 -2
- package/dist/composables/use-focus-trap.js +6 -6
- package/dist/composables/use-loading-bar.d.ts +25 -0
- package/dist/composables/use-loading-bar.js +27 -0
- package/dist/composables/use-media-query.js +1 -1
- package/dist/composables/use-message.d.ts +4 -1
- package/dist/composables/use-message.js +18 -0
- package/dist/composables/use-pointer-gesture.d.ts +2 -2
- package/dist/composables/use-pointer-gesture.js +3 -3
- package/dist/composables/use-repeat-action.d.ts +2 -2
- package/dist/composables/use-repeat-action.js +5 -5
- package/dist/composables/use-virtual-list.d.ts +1 -1
- package/dist/contexts/avatar.d.ts +1 -1
- package/dist/contexts/carousel.d.ts +1 -1
- package/dist/contexts/checkbox.d.ts +1 -1
- package/dist/contexts/choicebox.d.ts +2 -2
- package/dist/contexts/collapse.d.ts +1 -1
- package/dist/contexts/list.d.ts +5 -6
- package/dist/contexts/list.js +3 -3
- package/dist/contexts/radio.d.ts +1 -1
- package/dist/contexts/resizable.d.ts +1 -1
- package/dist/contexts/switch.d.ts +2 -2
- package/dist/{components/carousel → dist/components/keep-alive-container}/index.vue.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/en-us.d.ts +15 -7
- package/dist/locales/en-us.js +17 -9
- package/dist/locales/zh-cn.d.ts +15 -7
- package/dist/locales/zh-cn.js +17 -9
- package/dist/{components → src/components}/active-graph/index.vue.d.ts +7 -5
- package/dist/{components → src/components}/avatar-group/index.vue.d.ts +1 -1
- package/dist/src/components/backtop/index.vue.d.ts +20 -0
- package/dist/{components → src/components}/badge/index.vue.d.ts +2 -1
- package/dist/{components → src/components}/book/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/browser/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/button/index.vue.d.ts +1 -1
- package/dist/{components/intersection-observer/content.vue.d.ts → src/components/carousel/index.vue.d.ts} +1 -1
- package/dist/{components → src/components}/carousel-group/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/chip/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/choicebox/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/choicebox-group/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/collapse/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/collapse-group/index.vue.d.ts +1 -1
- package/dist/src/components/command-menu/index.vue.d.ts +39 -0
- package/dist/src/components/command-menu-group/index.vue.d.ts +16 -0
- package/dist/src/components/command-menu-item/index.vue.d.ts +12 -0
- package/dist/{components → src/components}/config-provider/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/description/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/drawer/index.vue.d.ts +19 -14
- package/dist/{components → src/components}/empty-state/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/error/index.vue.d.ts +1 -1
- package/dist/src/components/fader/index.vue.d.ts +11 -0
- package/dist/{components → src/components}/gauge/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/grid/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/grid-item/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/hold-button/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/input/index.vue.d.ts +9 -4
- package/dist/{components → src/components}/intersection-observer/index.vue.d.ts +3 -3
- package/dist/{components → src/components}/kbd/index.vue.d.ts +8 -5
- package/dist/src/components/keep-alive-container/index.vue.d.ts +12 -0
- package/dist/{components → src/components}/link-button/index.vue.d.ts +1 -1
- package/dist/src/components/list/index.vue.d.ts +40 -0
- package/dist/{components → src/components}/list-item/index.vue.d.ts +4 -4
- package/dist/src/components/loading-bar/index.vue.d.ts +14 -0
- package/dist/{components → src/components}/loading-dots/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/material/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/menu/index.vue.d.ts +11 -7
- package/dist/{components → src/components}/message/index.vue.d.ts +13 -13
- package/dist/{components → src/components}/modal/index.vue.d.ts +19 -14
- package/dist/{components → src/components}/more-button/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/note/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/number-input/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/overlay/index.vue.d.ts +3 -4
- package/dist/{components → src/components}/pagination/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/pin-input/index.vue.d.ts +1 -1
- package/dist/src/components/placeholder/index.vue.d.ts +9 -0
- package/dist/{components → src/components}/popover/index.vue.d.ts +10 -8
- package/dist/{components → src/components}/progress/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/radio/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/radio-group/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/resizable/index.vue.d.ts +1 -1
- package/dist/src/components/resizable-handle/index.vue.d.ts +2 -0
- package/dist/{components → src/components}/resizable-panel/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/skeleton/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/slider/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/snippet/index.vue.d.ts +1 -1
- package/dist/src/components/spinner/index.vue.d.ts +2 -0
- package/dist/{components → src/components}/stack/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/status-dot/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/switch/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/switch-group/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/teleport/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/text/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/textarea/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/theme-switcher/index.vue.d.ts +1 -1
- package/dist/src/components/time-picker/index.vue.d.ts +25 -0
- package/dist/{components → src/components}/toggle/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/tooltip/index.vue.d.ts +3 -5
- package/dist/{components → src/components}/virtual-list/index.vue.d.ts +1 -1
- package/dist/src/composables/use-browser-observer.d.ts +12 -0
- package/dist/src/composables/use-color-scheme.d.ts +11 -0
- package/dist/src/composables/use-config-provider-context.d.ts +7 -0
- package/dist/src/composables/use-copy-click.d.ts +4 -0
- package/dist/src/composables/use-countdown.d.ts +60 -0
- package/dist/src/composables/use-delay-change.d.ts +7 -0
- package/dist/src/composables/use-delay-destroy.d.ts +13 -0
- package/dist/src/composables/use-focus-trap.d.ts +4 -0
- package/dist/src/composables/use-loading-bar.d.ts +25 -0
- package/dist/src/composables/use-media-query.d.ts +15 -0
- package/dist/src/composables/use-message.d.ts +33 -0
- package/dist/src/composables/use-model-value.d.ts +11 -0
- package/dist/src/composables/use-pointer-gesture.d.ts +180 -0
- package/dist/src/composables/use-repeat-action.d.ts +16 -0
- package/dist/src/composables/use-unique-id-context.d.ts +2 -0
- package/dist/src/composables/use-virtual-list.d.ts +16 -0
- package/dist/src/contexts/avatar.d.ts +2 -0
- package/dist/src/contexts/carousel.d.ts +13 -0
- package/dist/src/contexts/checkbox.d.ts +2 -0
- package/dist/src/contexts/choicebox.d.ts +4 -0
- package/dist/src/contexts/collapse.d.ts +8 -0
- package/dist/src/contexts/list.d.ts +8 -0
- package/dist/src/contexts/radio.d.ts +2 -0
- package/dist/src/contexts/resizable.d.ts +35 -0
- package/dist/src/contexts/switch.d.ts +4 -0
- package/dist/src/locales/en-us.d.ts +42 -0
- package/dist/src/plugins/dayjs-millisecond-token.d.ts +3 -0
- package/dist/src/types/components/time-picker.d.ts +4 -0
- package/dist/src/utils/context.d.ts +17 -0
- package/dist/src/utils/date.d.ts +26 -0
- package/dist/src/utils/debounce/index.d.ts +73 -0
- package/dist/src/utils/debounce.d.ts +1 -0
- package/dist/src/utils/dom.d.ts +40 -0
- package/dist/{utils/events.d.ts → src/utils/event.d.ts} +1 -0
- package/dist/src/utils/format.d.ts +25 -0
- package/dist/src/utils/get.d.ts +11 -0
- package/dist/src/utils/is.d.ts +4 -0
- package/dist/src/utils/ref.d.ts +5 -0
- package/dist/src/utils/regexp.d.ts +8 -0
- package/dist/src/utils/responsive.d.ts +3 -0
- package/dist/src/utils/throttle/index.d.ts +53 -0
- package/dist/src/utils/throttle.d.ts +1 -0
- package/dist/src/utils/uid.d.ts +1 -0
- package/dist/styles/styles.css +2 -2
- package/dist/styles/tw.css +18 -1
- package/dist/types/components/list.d.ts +4 -3
- package/dist/types/components/time-picker.d.ts +4 -0
- package/dist/types/components/time-picker.js +0 -0
- package/dist/types/shared/utils.d.ts +5 -2
- package/dist/utils/date.d.ts +3 -3
- package/dist/utils/debounce/compat.d.ts +143 -0
- package/dist/utils/debounce/compat.js +47 -0
- package/dist/utils/debounce/index.d.ts +73 -0
- package/dist/utils/debounce/index.js +60 -0
- package/dist/utils/debounce.d.ts +1 -73
- package/dist/utils/debounce.js +1 -60
- package/dist/utils/event.d.ts +9 -0
- package/dist/utils/{events.js → event.js} +3 -0
- package/dist/utils/format.d.ts +4 -1
- package/dist/utils/format.js +6 -0
- package/dist/utils/ref.d.ts +2 -5
- package/dist/utils/regexp.d.ts +4 -0
- package/dist/utils/regexp.js +4 -0
- package/dist/utils/responsive.d.ts +2 -1
- package/dist/utils/responsive.js +4 -1
- package/dist/utils/throttle/compat.d.ts +79 -0
- package/dist/utils/throttle/compat.js +9 -0
- package/dist/utils/throttle/index.d.ts +53 -0
- package/dist/utils/throttle/index.js +34 -0
- package/dist/utils/throttle.d.ts +1 -53
- package/dist/utils/throttle.js +1 -34
- package/dist/utils/uid.js +1 -1
- package/package.json +11 -11
- package/volar.d.ts +7 -0
- package/dist/components/fader/index.vue.d.ts +0 -11
- package/dist/components/list/index.vue.d.ts +0 -29
- package/dist/components/placeholder/index.vue.d.ts +0 -8
- package/dist/components/resizable-handle/index.vue.d.ts +0 -2
- package/dist/components/spinner/index.vue.d.ts +0 -2
- /package/dist/{components → src/components}/avatar/index.vue.d.ts +0 -0
- /package/dist/{components → src/components}/checkbox/index.vue.d.ts +0 -0
- /package/dist/{components → src/components}/checkbox-group/index.vue.d.ts +0 -0
- /package/dist/{components → src/components}/countdown/index.vue.d.ts +0 -0
package/README.md
CHANGED
|
@@ -27,14 +27,20 @@ pnpm dev
|
|
|
27
27
|
|
|
28
28
|
### Build
|
|
29
29
|
|
|
30
|
-
#### Core
|
|
30
|
+
#### Core only
|
|
31
31
|
|
|
32
32
|
```shell
|
|
33
|
-
pnpm build
|
|
33
|
+
pnpm build:lib
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
#### Docs
|
|
36
|
+
#### Docs only
|
|
37
37
|
|
|
38
38
|
```shell
|
|
39
39
|
pnpm build:docs
|
|
40
40
|
```
|
|
41
|
+
|
|
42
|
+
#### Deploy
|
|
43
|
+
|
|
44
|
+
```shell
|
|
45
|
+
pnpm build
|
|
46
|
+
```
|
|
@@ -3,6 +3,7 @@ import { computed, onBeforeUnmount, shallowRef } from "vue";
|
|
|
3
3
|
import { useConfigProvider } from "../../composables/use-config-provider-context";
|
|
4
4
|
import { useDelayChange } from "../../composables/use-delay-change";
|
|
5
5
|
import { getAllDatesBetween } from "../../utils/date";
|
|
6
|
+
import { getCssUnitValue } from "../../utils/format";
|
|
6
7
|
import { getColorByThreshold } from "../../utils/get";
|
|
7
8
|
defineOptions({
|
|
8
9
|
name: "PActiveGraph"
|
|
@@ -29,7 +30,9 @@ const props = defineProps({
|
|
|
29
30
|
graphOnly: { type: Boolean, required: false, default: false },
|
|
30
31
|
transpose: { type: Boolean, required: false },
|
|
31
32
|
tooltip: { type: Boolean, required: false, default: true },
|
|
32
|
-
tooltipText: { type: String, required: false, default: "{COUNT} on {DATE}" }
|
|
33
|
+
tooltipText: { type: String, required: false, default: "{COUNT} on {DATE}" },
|
|
34
|
+
fieldNames: { type: Object, required: false },
|
|
35
|
+
itemRadius: { type: [String, Number], required: false }
|
|
33
36
|
});
|
|
34
37
|
const emits = defineEmits(["cell-click"]);
|
|
35
38
|
const config = useConfigProvider();
|
|
@@ -37,8 +40,9 @@ const CELL_GAP = 3;
|
|
|
37
40
|
const CELL_SIZE = 12;
|
|
38
41
|
const rangedDates = computed(() => getAllDatesBetween(props.startDate, props.endDate));
|
|
39
42
|
const dateCountMap = computed(() => {
|
|
43
|
+
const { date, count } = props.fieldNames || { date: "date", count: "count" };
|
|
40
44
|
return props.data.reduce((acc, cur) => {
|
|
41
|
-
acc[cur
|
|
45
|
+
acc[cur[date]] = (acc[cur[date]] || 0) + cur[count];
|
|
42
46
|
return acc;
|
|
43
47
|
}, {});
|
|
44
48
|
});
|
|
@@ -283,6 +287,7 @@ onBeforeUnmount(() => {
|
|
|
283
287
|
<tbody
|
|
284
288
|
ref="tbodyRef"
|
|
285
289
|
class="text-xs"
|
|
290
|
+
:style="{ '--item-radius': getCssUnitValue(itemRadius, '2px') }"
|
|
286
291
|
@click="onCellClick"
|
|
287
292
|
@pointerover.capture="onMouseOver"
|
|
288
293
|
>
|
|
@@ -296,7 +301,7 @@ onBeforeUnmount(() => {
|
|
|
296
301
|
<td
|
|
297
302
|
v-for="col of row"
|
|
298
303
|
:key="col.date"
|
|
299
|
-
class="pxd-active-graph--item
|
|
304
|
+
class="pxd-active-graph--item w-3 min-w-3 rounded-(--item-radius) bg-gray-alpha-200 motion-safe:transition-colors"
|
|
300
305
|
:data-date="col.date"
|
|
301
306
|
:class="{ 'pointer-events-none opacity-0': col.hidden }"
|
|
302
307
|
:style="`background: ${col.color}`"
|
|
@@ -313,7 +318,7 @@ onBeforeUnmount(() => {
|
|
|
313
318
|
<td
|
|
314
319
|
v-for="color in props.colors"
|
|
315
320
|
:key="color"
|
|
316
|
-
class="w-3 h-3 rounded-
|
|
321
|
+
class="w-3 h-3 rounded-(--item-radius) bg-gray-alpha-200 motion-safe:transition-colors"
|
|
317
322
|
:style="`background-color: ${color}`"
|
|
318
323
|
/>
|
|
319
324
|
|
|
@@ -328,7 +333,7 @@ onBeforeUnmount(() => {
|
|
|
328
333
|
<Transition v-if="tooltip" name="pxd-transition--fade" mode="out-in" appear>
|
|
329
334
|
<div
|
|
330
335
|
v-if="showTooltip"
|
|
331
|
-
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-
|
|
336
|
+
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"
|
|
332
337
|
:style="`transform: translate3d(${tooltipInfo.left}px, ${tooltipInfo.top}px, 0);`"
|
|
333
338
|
>
|
|
334
339
|
<slot name="tooltip" :data="tooltipInfo">
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ArrowIcon from "@gdsicon/vue/arrow-up";
|
|
3
|
+
import { computed, onBeforeUnmount, onMounted, shallowRef } from "vue";
|
|
4
|
+
import { getScrollContainer, getScrollElByContainer } from "../../utils/dom";
|
|
5
|
+
import { optimizedOff, optimizedOn } from "../../utils/event";
|
|
6
|
+
import { getCssUnitValue } from "../../utils/format";
|
|
7
|
+
import PButton from "../button/index.vue";
|
|
8
|
+
defineOptions({
|
|
9
|
+
name: "PBacktop",
|
|
10
|
+
inheritAttrs: false
|
|
11
|
+
});
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
right: { type: [String, Number], required: false },
|
|
14
|
+
bottom: { type: [String, Number], required: false },
|
|
15
|
+
zIndex: { type: [String, Number], required: false },
|
|
16
|
+
visibleThreshold: { type: Number, required: false, default: 30 }
|
|
17
|
+
});
|
|
18
|
+
let scrollContainer;
|
|
19
|
+
let scrollContainerEl;
|
|
20
|
+
const scrollTop = shallowRef(0);
|
|
21
|
+
const wrapperRef = shallowRef();
|
|
22
|
+
const computedStyle = computed(() => {
|
|
23
|
+
return {
|
|
24
|
+
zIndex: props.zIndex,
|
|
25
|
+
right: getCssUnitValue(props.right),
|
|
26
|
+
bottom: getCssUnitValue(props.bottom)
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
function updateScrollTop() {
|
|
30
|
+
if (!scrollContainerEl) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
scrollTop.value = scrollContainerEl.scrollTop;
|
|
34
|
+
}
|
|
35
|
+
function onBacktopClick() {
|
|
36
|
+
if (!scrollContainer) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
scrollContainer.scrollTo({
|
|
40
|
+
top: 0,
|
|
41
|
+
left: 0,
|
|
42
|
+
behavior: "smooth"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
scrollContainer = getScrollContainer(wrapperRef.value);
|
|
47
|
+
scrollContainerEl = getScrollElByContainer(scrollContainer);
|
|
48
|
+
updateScrollTop();
|
|
49
|
+
optimizedOn(scrollContainer, "scroll", updateScrollTop, { passive: true });
|
|
50
|
+
});
|
|
51
|
+
onBeforeUnmount(() => {
|
|
52
|
+
optimizedOff(scrollContainer, "scroll", updateScrollTop, { passive: true });
|
|
53
|
+
scrollContainer = null;
|
|
54
|
+
scrollContainerEl = null;
|
|
55
|
+
});
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<template>
|
|
59
|
+
<Transition name="pxd-transition--fade-scale" appear>
|
|
60
|
+
<div
|
|
61
|
+
v-show="scrollTop >= visibleThreshold"
|
|
62
|
+
ref="wrapperRef"
|
|
63
|
+
class="right-6 bottom-6 fixed z-1"
|
|
64
|
+
:style="computedStyle"
|
|
65
|
+
v-bind="$attrs"
|
|
66
|
+
@click="onBacktopClick"
|
|
67
|
+
>
|
|
68
|
+
<slot>
|
|
69
|
+
<PButton class="shadow-sm" shape="rounded" icon>
|
|
70
|
+
<ArrowIcon />
|
|
71
|
+
</PButton>
|
|
72
|
+
</slot>
|
|
73
|
+
</div>
|
|
74
|
+
</Transition>
|
|
75
|
+
</template>
|
|
@@ -9,10 +9,11 @@ const props = defineProps({
|
|
|
9
9
|
as: { type: null, required: false, default: "span" },
|
|
10
10
|
variant: { type: null, required: false, default: "gray" },
|
|
11
11
|
size: { type: null, required: false },
|
|
12
|
-
href: { type: String, required: false }
|
|
12
|
+
href: { type: String, required: false },
|
|
13
|
+
to: { type: String, required: false }
|
|
13
14
|
});
|
|
14
15
|
const SIZES = {
|
|
15
|
-
sm: "px-
|
|
16
|
+
sm: "px-2 h-5 text-xs",
|
|
16
17
|
md: "px-2.5 h-6 text-xs",
|
|
17
18
|
lg: "px-3 h-7.5 text-sm"
|
|
18
19
|
};
|
|
@@ -42,7 +43,7 @@ const VARIANTS = {
|
|
|
42
43
|
const config = useConfigProvider();
|
|
43
44
|
const computedClass = computed(() => {
|
|
44
45
|
const classes = [
|
|
45
|
-
"pxd-badge
|
|
46
|
+
"pxd-badge font-medium font-sans gap-1 inline-flex items-center justify-center rounded-full text-nowrap whitespace-nowrap !no-underline motion-safe:transition-all",
|
|
46
47
|
getFallbackValue(props.variant, VARIANTS, "gray"),
|
|
47
48
|
getFallbackValue(props.size, SIZES, config.size),
|
|
48
49
|
props.variant
|
|
@@ -50,13 +51,14 @@ const computedClass = computed(() => {
|
|
|
50
51
|
return classes.join(" ");
|
|
51
52
|
});
|
|
52
53
|
const badgeAttrs = computed(() => {
|
|
53
|
-
|
|
54
|
+
const { as, href, to } = props;
|
|
55
|
+
if (as === "router-link" || as === "RouterLink") {
|
|
54
56
|
return {
|
|
55
|
-
to:
|
|
57
|
+
to: href || to
|
|
56
58
|
};
|
|
57
|
-
} else if (
|
|
59
|
+
} else if (as === "a") {
|
|
58
60
|
return {
|
|
59
|
-
href:
|
|
61
|
+
href: href || to
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
64
|
return {};
|
|
@@ -7,7 +7,7 @@ defineOptions({
|
|
|
7
7
|
const props = defineProps({
|
|
8
8
|
color: { type: String, required: false },
|
|
9
9
|
title: { type: [String, Number, Array, null], required: false },
|
|
10
|
-
width: { type:
|
|
10
|
+
width: { type: [String, Number, Object], required: false },
|
|
11
11
|
variant: { type: String, required: false, default: "stripe" },
|
|
12
12
|
textured: { type: Boolean, required: false, default: false }
|
|
13
13
|
});
|
|
@@ -48,7 +48,7 @@ const computedClass = computed(() => {
|
|
|
48
48
|
<div class="pxd-book--content translate-z-0 absolute flex size-full min-w-full flex-col overflow-hidden bg-background-200">
|
|
49
49
|
<div
|
|
50
50
|
v-if="variant === 'stripe'"
|
|
51
|
-
class="translate-z-0 relative flex w-full flex-1 overflow-hidden"
|
|
51
|
+
class="translate-z-0 relative flex w-full flex-1 shrink-0 overflow-hidden"
|
|
52
52
|
style="background-color: var(--bc, var(--color-amber-600))"
|
|
53
53
|
>
|
|
54
54
|
<div class="absolute flex w-full flex-col object-cover">
|
|
@@ -60,7 +60,7 @@ const computedClass = computed(() => {
|
|
|
60
60
|
|
|
61
61
|
<div
|
|
62
62
|
:class="{ 'pxd-book--cover-simple': variant === 'simple' }"
|
|
63
|
-
class="translate-z-0 relative flex w-full flex-1 overflow-hidden"
|
|
63
|
+
class="translate-z-0 relative flex w-full flex-1 shrink-0 overflow-hidden"
|
|
64
64
|
>
|
|
65
65
|
<div aria-hidden="true" class="pxd-book--spine h-full opacity-20" />
|
|
66
66
|
|
|
@@ -32,11 +32,11 @@ const { isCopied, copyText } = useCopyClick();
|
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
|
-
<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">
|
|
35
|
+
<div class="gap-4 min-w-0 md:first:max-w-[140px] md:last:max-w-[140px] flex flex-1 shrink-0 items-center justify-center max-md:first:flex-none first:justify-start last:justify-end">
|
|
36
36
|
<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">
|
|
37
37
|
<LockClosedIcon class="text-sm text-foreground-secondary" />
|
|
38
38
|
|
|
39
|
-
<div class="pl-1.5 min-w-0 flex-1 truncate text-center text-
|
|
39
|
+
<div class="pl-1.5 min-w-0 flex-1 truncate text-center text-13px text-gray-1000">
|
|
40
40
|
{{ address }}
|
|
41
41
|
</div>
|
|
42
42
|
|
|
@@ -77,8 +77,9 @@ defineExpose({
|
|
|
77
77
|
<label
|
|
78
78
|
role="checkbox"
|
|
79
79
|
:aria-checked="isChecked"
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
:data-disabled="computedDisabled"
|
|
81
|
+
class="pxd-checkbox group/checkbox gap-2 inline-flex max-w-full cursor-pointer touch-manipulation items-center data-[disabled=true]:cursor-not-allowed"
|
|
82
|
+
:class="{ 'is-disabled text-gray-500': computedDisabled }"
|
|
82
83
|
:for="uniqueId"
|
|
83
84
|
>
|
|
84
85
|
<input
|
|
@@ -98,7 +99,7 @@ defineExpose({
|
|
|
98
99
|
<span v-else class="size-3" />
|
|
99
100
|
</span>
|
|
100
101
|
|
|
101
|
-
<span class="text-sm flex-1 empty:hidden">
|
|
102
|
+
<span class="text-sm flex-1 shrink-0 empty:hidden">
|
|
102
103
|
<slot>
|
|
103
104
|
{{ label }}
|
|
104
105
|
</slot>
|
|
@@ -37,7 +37,7 @@ defineExpose({
|
|
|
37
37
|
</script>
|
|
38
38
|
|
|
39
39
|
<template>
|
|
40
|
-
<PStack class="pxd-checkbox-group
|
|
40
|
+
<PStack class="pxd-checkbox-group" role="group" aria-label="Checkbox Group" v-bind="$attrs">
|
|
41
41
|
<slot>
|
|
42
42
|
<PCheckbox
|
|
43
43
|
v-for="option in options"
|
|
@@ -45,7 +45,7 @@ provideChoiceboxGroupModelValue(modelValue);
|
|
|
45
45
|
</script>
|
|
46
46
|
|
|
47
47
|
<template>
|
|
48
|
-
<div class="pxd-choicebox-group w-full">
|
|
48
|
+
<div class="pxd-choicebox-group w-full max-w-full">
|
|
49
49
|
<div v-if="label || $slots.label" class="pxd-form--label">
|
|
50
50
|
<slot name="label">
|
|
51
51
|
{{ label }}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { nextTick, shallowRef } from "vue";
|
|
3
|
+
import { useConfigProvider } from "../../composables/use-config-provider-context";
|
|
4
|
+
import { useModelValue } from "../../composables/use-model-value";
|
|
5
|
+
import { provideListFilterValue } from "../../contexts/list";
|
|
6
|
+
import { debounce } from "../../utils/debounce";
|
|
7
|
+
import { throttle } from "../../utils/throttle";
|
|
8
|
+
import { getUniqueId } from "../../utils/uid";
|
|
9
|
+
import PButton from "../button/index.vue";
|
|
10
|
+
import PList from "../list/index.vue";
|
|
11
|
+
import PModal from "../modal/index.vue";
|
|
12
|
+
defineOptions({
|
|
13
|
+
name: "PCommandMenu",
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
model: {
|
|
16
|
+
prop: "modelValue",
|
|
17
|
+
event: "update:modelValue"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
width: { type: [String, Number], required: false },
|
|
22
|
+
modelValue: { type: Boolean, required: false, default: false },
|
|
23
|
+
placeholder: { type: String, required: false, default: "" },
|
|
24
|
+
closeOnSelectItem: { type: Boolean, required: false, default: true },
|
|
25
|
+
closeOnPressEscape: { type: Boolean, required: false, default: true },
|
|
26
|
+
closeOnClickOverlay: { type: Boolean, required: false, default: true }
|
|
27
|
+
});
|
|
28
|
+
const emits = defineEmits(["update:modelValue", "select", "show", "hide"]);
|
|
29
|
+
const uniqueId = getUniqueId();
|
|
30
|
+
const config = useConfigProvider();
|
|
31
|
+
const modelValue = useModelValue(props, emits);
|
|
32
|
+
const listRef = shallowRef();
|
|
33
|
+
const filterKeyword = shallowRef("");
|
|
34
|
+
const isEmptyResult = shallowRef(false);
|
|
35
|
+
const onKeywordChange = throttle(async (ev) => {
|
|
36
|
+
const inputValue = ev.target.value.trim();
|
|
37
|
+
filterKeyword.value = inputValue;
|
|
38
|
+
const list = listRef.value;
|
|
39
|
+
if (!list) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
await nextTick();
|
|
43
|
+
list.updateListItem();
|
|
44
|
+
list.setActiveValueToFirst();
|
|
45
|
+
isEmptyResult.value = list.isNoVisibleItem();
|
|
46
|
+
}, 200, { edges: ["leading", "trailing"] });
|
|
47
|
+
const hideModal = debounce(() => {
|
|
48
|
+
modelValue.value = false;
|
|
49
|
+
filterKeyword.value = "";
|
|
50
|
+
emits("hide");
|
|
51
|
+
}, 500, { edges: ["leading"] });
|
|
52
|
+
function showModal() {
|
|
53
|
+
emits("show");
|
|
54
|
+
}
|
|
55
|
+
function onListItemSelect(ev, item) {
|
|
56
|
+
emits("select", ev, item);
|
|
57
|
+
if (props.closeOnSelectItem) {
|
|
58
|
+
hideModal();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
provideListFilterValue(filterKeyword);
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<PModal
|
|
66
|
+
v-model="modelValue"
|
|
67
|
+
width="640px"
|
|
68
|
+
class="pxd-command-menu"
|
|
69
|
+
content-class="!p-0 overflow-hidden"
|
|
70
|
+
wrapper-class="sm:top-1/6 sm:translate-y-0"
|
|
71
|
+
:close-on-press-escape="closeOnPressEscape"
|
|
72
|
+
:close-on-click-overlay="closeOnClickOverlay"
|
|
73
|
+
@show="showModal"
|
|
74
|
+
@hide="hideModal"
|
|
75
|
+
>
|
|
76
|
+
<template #header>
|
|
77
|
+
<label :for="uniqueId" class="py-3 px-4 -mx-6 -my-4 gap-3 flex items-center border-b bg-background-100">
|
|
78
|
+
<input
|
|
79
|
+
:id="uniqueId"
|
|
80
|
+
:value="filterKeyword"
|
|
81
|
+
:placeholder="placeholder"
|
|
82
|
+
aria-autocomplete="list"
|
|
83
|
+
:aria-controls="uniqueId"
|
|
84
|
+
:aria-labelledby="uniqueId"
|
|
85
|
+
aria-expanded="true"
|
|
86
|
+
autocomplete="off"
|
|
87
|
+
autocorrect="off"
|
|
88
|
+
role="combobox"
|
|
89
|
+
spellcheck="false"
|
|
90
|
+
type="text"
|
|
91
|
+
name="command-menu-filter-input"
|
|
92
|
+
class="h-7 flex-1 shrink-0 appearance-none border-none bg-transparent text-foreground outline-none"
|
|
93
|
+
@input="onKeywordChange"
|
|
94
|
+
>
|
|
95
|
+
|
|
96
|
+
<PButton
|
|
97
|
+
v-if="closeOnPressEscape"
|
|
98
|
+
size="xs"
|
|
99
|
+
class="!px-0 text-xs shrink-0"
|
|
100
|
+
@click="hideModal"
|
|
101
|
+
>
|
|
102
|
+
Esc
|
|
103
|
+
</PButton>
|
|
104
|
+
</label>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<PList
|
|
108
|
+
ref="listRef"
|
|
109
|
+
:loop="false"
|
|
110
|
+
class="sm:h-auto sm:max-h-110 h-[70vh]"
|
|
111
|
+
:item-transition="false"
|
|
112
|
+
:key-listener="modelValue"
|
|
113
|
+
@select="onListItemSelect"
|
|
114
|
+
>
|
|
115
|
+
<slot />
|
|
116
|
+
|
|
117
|
+
<p v-if="isEmptyResult" class="py-7.5 text-sm text-center text-foreground-secondary">
|
|
118
|
+
{{ config.locale.empty.search }} <span class="text-foreground">"{{ filterKeyword }}"</span>
|
|
119
|
+
</p>
|
|
120
|
+
</PList>
|
|
121
|
+
|
|
122
|
+
<slot name="footer" />
|
|
123
|
+
</PModal>
|
|
124
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineOptions({
|
|
3
|
+
name: "PCommandMenuGroup"
|
|
4
|
+
});
|
|
5
|
+
defineProps({
|
|
6
|
+
label: { type: [String, Number, Array, null], required: false }
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div class="pxd-command-menu-group" role="presentation">
|
|
12
|
+
<div aria-hidden="true" class="h-10 px-2 flex items-center text-13px text-foreground-secondary only:hidden empty:hidden">
|
|
13
|
+
{{ label }}
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<slot />
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
@@ -18,7 +18,8 @@ const props = defineProps({
|
|
|
18
18
|
autoReset: { type: Boolean, required: false, default: true },
|
|
19
19
|
durations: { type: Number, required: false, default: 0 },
|
|
20
20
|
precision: { type: Number, required: false, default: 0 },
|
|
21
|
-
millisecond: { type: Boolean, required: false, default: true }
|
|
21
|
+
millisecond: { type: Boolean, required: false, default: true },
|
|
22
|
+
intuitive: { type: Boolean, required: false }
|
|
22
23
|
});
|
|
23
24
|
const emits = defineEmits(["change", "reset", "finish"]);
|
|
24
25
|
dayjs.extend(dayjsDurationPlugin);
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
import { computed, shallowRef, watch } from "vue";
|
|
3
3
|
import { useFocusTrap } from "../../composables/use-focus-trap";
|
|
4
4
|
import { useModelValue } from "../../composables/use-model-value";
|
|
5
|
-
import { getCssUnitValue } from "../../utils/format";
|
|
5
|
+
import { getCssUnitValue, isTruthyProp } from "../../utils/format";
|
|
6
6
|
import POverlay from "../overlay/index.vue";
|
|
7
|
-
import PScrollable from "../scrollable/index.vue";
|
|
8
7
|
defineOptions({
|
|
9
8
|
name: "PDrawer",
|
|
10
9
|
inheritAttrs: false,
|
|
@@ -23,11 +22,12 @@ const props = defineProps({
|
|
|
23
22
|
appendToBody: { type: Boolean, required: false, default: true },
|
|
24
23
|
headerStylize: { type: Boolean, required: false, default: false },
|
|
25
24
|
footerStylize: { type: Boolean, required: false, default: true },
|
|
26
|
-
|
|
25
|
+
wrapperClass: { type: [String, Array, Object], required: false },
|
|
26
|
+
contentClass: { type: [String, Array, Object], required: false },
|
|
27
27
|
closeOnPressEscape: { type: Boolean, required: false, default: true },
|
|
28
28
|
closeOnClickOverlay: { type: Boolean, required: false, default: true }
|
|
29
29
|
});
|
|
30
|
-
const emits = defineEmits(["
|
|
30
|
+
const emits = defineEmits(["show", "hide", "outside-click", "visible-change", "update:modelValue"]);
|
|
31
31
|
const drawerRef = shallowRef();
|
|
32
32
|
const isVisible = useModelValue(props, emits);
|
|
33
33
|
useFocusTrap(drawerRef);
|
|
@@ -47,8 +47,8 @@ const computedStyle = computed(() => {
|
|
|
47
47
|
return styles;
|
|
48
48
|
});
|
|
49
49
|
function onOverlayClick(ev) {
|
|
50
|
-
emits("click
|
|
51
|
-
if (!props.closeOnClickOverlay || props.loading) {
|
|
50
|
+
emits("outside-click", ev);
|
|
51
|
+
if (!isTruthyProp(props.closeOnClickOverlay) || isTruthyProp(props.loading)) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
isVisible.value = false;
|
|
@@ -60,11 +60,12 @@ function onUpdateModelValue(visible) {
|
|
|
60
60
|
isVisible.value = visible;
|
|
61
61
|
}
|
|
62
62
|
watch(() => isVisible.value, (visible) => {
|
|
63
|
+
emits("visible-change", visible);
|
|
63
64
|
if (visible) {
|
|
64
|
-
emits("
|
|
65
|
+
emits("show");
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
|
-
emits("
|
|
68
|
+
emits("hide");
|
|
68
69
|
});
|
|
69
70
|
</script>
|
|
70
71
|
|
|
@@ -84,7 +85,7 @@ watch(() => isVisible.value, (visible) => {
|
|
|
84
85
|
role="dialog"
|
|
85
86
|
tabindex="-1"
|
|
86
87
|
class="pxd-drawer translate-z-0 sm:[--w:30vw] sm:[--h:30vw] fixed z-10 flex max-h-full max-w-full flex-col bg-background-100 shadow-border-modal outline-none"
|
|
87
|
-
:class="
|
|
88
|
+
:class="wrapperClass"
|
|
88
89
|
:style="computedStyle"
|
|
89
90
|
:data-position="ensurePosition"
|
|
90
91
|
>
|
|
@@ -92,28 +93,27 @@ watch(() => isVisible.value, (visible) => {
|
|
|
92
93
|
class="pxd-drawer--header px-6 py-4 relative shrink-0 empty:py-3"
|
|
93
94
|
:class="{ 'sm:pt-4 border-b bg-background-200 dark:bg-background-100': headerStylize }"
|
|
94
95
|
>
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
<slot name="header">
|
|
97
|
+
<h3 v-if="$slots.title || title" class="text-lg sm:text-xl font-semibold tracking-tight m-0">
|
|
98
|
+
<slot name="title">
|
|
99
|
+
{{ title }}
|
|
100
|
+
</slot>
|
|
101
|
+
</h3>
|
|
100
102
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
<div v-if="$slots.subtitle || subtitle" class="mt-3 text-sm text-muted-foreground">
|
|
104
|
+
<slot name="subtitle">
|
|
105
|
+
{{ subtitle }}
|
|
106
|
+
</slot>
|
|
107
|
+
</div>
|
|
108
|
+
</slot>
|
|
106
109
|
</header>
|
|
107
110
|
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
:
|
|
111
|
-
class="pxd-drawer--content group flex-1"
|
|
112
|
-
content-class="group-data-[header=true]:pt-5 px-6 pb-5"
|
|
111
|
+
<div
|
|
112
|
+
class="pxd-drawer--content group px-6 pb-5 flex-1 overflow-auto"
|
|
113
|
+
:class="[{ 'pt-5': headerStylize }, contentClass]"
|
|
113
114
|
>
|
|
114
115
|
<slot />
|
|
115
|
-
</
|
|
116
|
-
<div v-else class="flex-1" />
|
|
116
|
+
</div>
|
|
117
117
|
|
|
118
118
|
<footer
|
|
119
119
|
v-if="$slots.footer"
|
|
@@ -15,7 +15,7 @@ const props = defineProps({
|
|
|
15
15
|
});
|
|
16
16
|
const SIZES = {
|
|
17
17
|
xs: "text-xs [--mt:2px]",
|
|
18
|
-
sm: "text-
|
|
18
|
+
sm: "text-13px [--mt:2px]",
|
|
19
19
|
md: "text-sm [--mt:2px]",
|
|
20
20
|
lg: "text-base [--mt:4px]"
|
|
21
21
|
};
|
|
@@ -30,7 +30,7 @@ const computedClass = computed(() => {
|
|
|
30
30
|
<div :class="computedClass">
|
|
31
31
|
<StopIcon class="size-4 mr-2 mt-(--mt) shrink-0" />
|
|
32
32
|
|
|
33
|
-
<div class="flex-1">
|
|
33
|
+
<div class="flex-1 shrink-0">
|
|
34
34
|
<b v-if="label || error?.label" class="font-medium whitespace-nowrap">{{ label || error?.label }}:</b>
|
|
35
35
|
|
|
36
36
|
<slot>
|