pxd 0.0.38 → 0.0.40
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 +1 -1
- package/dist/components/book/index.vue +1 -1
- package/dist/components/browser/index.vue +1 -1
- package/dist/components/checkbox/index.vue +3 -2
- 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 +133 -0
- package/dist/components/command-menu-group/index.vue +18 -0
- package/dist/components/command-menu-item/index.vue +23 -0
- package/dist/components/drawer/index.vue +25 -25
- package/dist/components/error/index.vue +1 -1
- package/dist/components/fader/index.vue +11 -10
- 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 +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/input/index.vue +1 -1
- package/dist/components/intersection-observer/index.vue +2 -2
- package/dist/components/kbd/index.vue +16 -4
- package/dist/components/list/index.vue +98 -90
- package/dist/components/list-item/index.vue +22 -33
- package/dist/components/loading-bar/index.vue +156 -0
- package/dist/components/material/index.vue +8 -8
- package/dist/components/menu/index.vue +18 -8
- package/dist/components/message/index.vue +20 -10
- package/dist/components/modal/index.vue +26 -28
- package/dist/components/overlay/index.vue +6 -5
- package/dist/components/pagination/index.vue +2 -2
- package/dist/components/pin-input/index.vue +1 -1
- package/dist/components/placeholder/index.vue +13 -6
- package/dist/components/popover/index.vue +32 -24
- package/dist/components/radio/index.vue +3 -2
- package/dist/components/radio-group/index.vue +1 -1
- package/dist/components/scrollable/index.vue +127 -79
- package/dist/components/slider/index.vue +1 -1
- package/dist/components/stack/index.vue +4 -4
- package/dist/components/text/index.vue +1 -1
- package/dist/components/textarea/index.vue +1 -1
- package/dist/components/theme-switcher/index.vue +6 -2
- 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 +2 -2
- 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-delay-destroy.d.ts +2 -2
- package/dist/composables/use-delay-destroy.js +4 -4
- package/dist/composables/use-focus-trap.js +1 -1
- 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.js +2 -2
- package/dist/composables/use-repeat-action.js +1 -1
- 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/command-menu.d.ts +6 -0
- package/dist/contexts/command-menu.js +5 -0
- package/dist/contexts/list.d.ts +4 -6
- package/dist/contexts/list.js +0 -4
- 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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/en-us.d.ts +3 -0
- package/dist/locales/en-us.js +3 -0
- package/dist/locales/zh-cn.d.ts +3 -0
- package/dist/locales/zh-cn.js +3 -0
- package/dist/{components → src/components}/active-graph/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/avatar-group/index.vue.d.ts +1 -1
- package/dist/{components → src/components}/badge/index.vue.d.ts +1 -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 → 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 +10 -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 +17 -12
- 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/{components → src/components}/fader/index.vue.d.ts +3 -2
- 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}/intersection-observer/content.vue.d.ts +1 -1
- package/dist/{components → src/components}/intersection-observer/index.vue.d.ts +3 -3
- package/dist/{components → src/components}/kbd/index.vue.d.ts +2 -1
- 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 +9 -9
- package/dist/{components → src/components}/modal/index.vue.d.ts +17 -12
- 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 +2 -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 +6 -3
- 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/{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 +54 -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/command-menu.d.ts +6 -0
- package/dist/src/contexts/list.d.ts +7 -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 +37 -0
- package/dist/src/plugins/dayjs-millisecond-token.d.ts +3 -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/src/utils/format.d.ts +24 -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 +8 -0
- package/dist/src/utils/regexp.d.ts +4 -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 +4 -1
- package/dist/types/components/list.d.ts +4 -3
- 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 +8 -0
- package/dist/utils/format.d.ts +3 -1
- package/dist/utils/format.js +3 -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/package.json +10 -10
- package/volar.d.ts +4 -0
- 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/dist/{components → src/components}/input/index.vue.d.ts +0 -0
- /package/dist/{utils/events.d.ts → src/utils/event.d.ts} +0 -0
- /package/dist/utils/{events.js → event.js} +0 -0
|
@@ -328,7 +328,7 @@ onBeforeUnmount(() => {
|
|
|
328
328
|
<Transition v-if="tooltip" name="pxd-transition--fade" mode="out-in" appear>
|
|
329
329
|
<div
|
|
330
330
|
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-
|
|
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-13px text-gray-100 duration-50 will-change-transform motion-safe:transition-transform"
|
|
332
332
|
:style="`transform: translate3d(${tooltipInfo.left}px, ${tooltipInfo.top}px, 0);`"
|
|
333
333
|
>
|
|
334
334
|
<slot name="tooltip" :data="tooltipInfo">
|
|
@@ -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
|
});
|
|
@@ -36,7 +36,7 @@ const { isCopied, copyText } = useCopyClick();
|
|
|
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
|
|
@@ -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,133 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, nextTick, shallowRef } from "vue";
|
|
3
|
+
import { useConfigProvider } from "../../composables/use-config-provider-context";
|
|
4
|
+
import { useModelValue } from "../../composables/use-model-value";
|
|
5
|
+
import { provideCommandMenuContext } from "../../contexts/command-menu";
|
|
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 isEmptyResult = shallowRef(false);
|
|
34
|
+
const filterKeyword = shallowRef("");
|
|
35
|
+
const filterKeywordRegex = computed(() => {
|
|
36
|
+
if (!filterKeyword.value) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return new RegExp(filterKeyword.value, "i");
|
|
40
|
+
});
|
|
41
|
+
const onKeywordChange = throttle(async (ev) => {
|
|
42
|
+
const inputValue = ev.target.value.trim();
|
|
43
|
+
filterKeyword.value = inputValue;
|
|
44
|
+
const list = listRef.value;
|
|
45
|
+
if (!list) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
await nextTick();
|
|
49
|
+
list.updateListItem();
|
|
50
|
+
list.setActiveValue();
|
|
51
|
+
isEmptyResult.value = list.isNoVisibleItem();
|
|
52
|
+
}, 300, { edges: ["leading", "trailing"] });
|
|
53
|
+
const closeModal = debounce(() => {
|
|
54
|
+
modelValue.value = false;
|
|
55
|
+
filterKeyword.value = "";
|
|
56
|
+
emits("hide");
|
|
57
|
+
}, 500, { edges: ["leading"] });
|
|
58
|
+
function onShowModal() {
|
|
59
|
+
emits("show");
|
|
60
|
+
}
|
|
61
|
+
function onListItemSelect(ev, item) {
|
|
62
|
+
emits("select", ev, item);
|
|
63
|
+
if (props.closeOnSelectItem) {
|
|
64
|
+
closeModal();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
provideCommandMenuContext({
|
|
68
|
+
filterKeyword,
|
|
69
|
+
filterKeywordRegex
|
|
70
|
+
});
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<PModal
|
|
75
|
+
v-model="modelValue"
|
|
76
|
+
width="640px"
|
|
77
|
+
class="pxd-command-menu"
|
|
78
|
+
content-class="!p-0 overflow-hidden"
|
|
79
|
+
wrapper-class="sm:top-1/6 sm:translate-y-0"
|
|
80
|
+
:close-on-press-escape="closeOnPressEscape"
|
|
81
|
+
:close-on-click-overlay="closeOnClickOverlay"
|
|
82
|
+
@show="onShowModal"
|
|
83
|
+
@hide="closeModal"
|
|
84
|
+
>
|
|
85
|
+
<template #header>
|
|
86
|
+
<label :for="uniqueId" class="py-3 px-4 -mx-6 -my-4 gap-3 flex items-center border-b">
|
|
87
|
+
<input
|
|
88
|
+
:id="uniqueId"
|
|
89
|
+
:value="filterKeyword"
|
|
90
|
+
:placeholder="placeholder"
|
|
91
|
+
aria-autocomplete="list"
|
|
92
|
+
:aria-controls="uniqueId"
|
|
93
|
+
:aria-labelledby="uniqueId"
|
|
94
|
+
aria-expanded="true"
|
|
95
|
+
autocomplete="off"
|
|
96
|
+
autocorrect="off"
|
|
97
|
+
role="combobox"
|
|
98
|
+
spellcheck="false"
|
|
99
|
+
type="text"
|
|
100
|
+
name="command-menu-filter-input"
|
|
101
|
+
class="h-7 flex-1 appearance-none border-none bg-transparent text-foreground outline-none"
|
|
102
|
+
@input="onKeywordChange"
|
|
103
|
+
>
|
|
104
|
+
|
|
105
|
+
<PButton
|
|
106
|
+
v-if="closeOnPressEscape"
|
|
107
|
+
size="xs"
|
|
108
|
+
class="!px-0 text-xs shrink-0"
|
|
109
|
+
@click="closeModal"
|
|
110
|
+
>
|
|
111
|
+
Esc
|
|
112
|
+
</PButton>
|
|
113
|
+
</label>
|
|
114
|
+
</template>
|
|
115
|
+
|
|
116
|
+
<PList
|
|
117
|
+
ref="listRef"
|
|
118
|
+
:loop="false"
|
|
119
|
+
class="sm:h-auto sm:max-h-110 h-[70vh]"
|
|
120
|
+
:item-transition="false"
|
|
121
|
+
:key-listener="modelValue"
|
|
122
|
+
@select="onListItemSelect"
|
|
123
|
+
>
|
|
124
|
+
<slot />
|
|
125
|
+
|
|
126
|
+
<p v-if="isEmptyResult" class="py-8 text-sm text-center text-foreground-secondary">
|
|
127
|
+
{{ config.locale.empty.search }} <span class="text-foreground">"{{ filterKeyword }}"</span>
|
|
128
|
+
</p>
|
|
129
|
+
</PList>
|
|
130
|
+
|
|
131
|
+
<slot name="footer" />
|
|
132
|
+
</PModal>
|
|
133
|
+
</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>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useCommandMenuContext } from "../../contexts/command-menu";
|
|
4
|
+
import PListItem from "../list-item/index.vue";
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: "PCommandMenuItem"
|
|
7
|
+
});
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
as: { type: null, required: false },
|
|
10
|
+
type: { type: null, required: false },
|
|
11
|
+
label: { type: null, required: false },
|
|
12
|
+
disabled: { type: null, required: false },
|
|
13
|
+
description: { type: null, required: false }
|
|
14
|
+
});
|
|
15
|
+
const commandMenuContext = useCommandMenuContext();
|
|
16
|
+
const isVisible = computed(() => {
|
|
17
|
+
return !commandMenuContext?.filterKeyword.value || commandMenuContext?.filterKeywordRegex.value?.test(String(props.label));
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<PListItem v-if="isVisible" v-bind="props" />
|
|
23
|
+
</template>
|
|
@@ -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", "visible-change", "click-outside", "update:modelValue"]);
|
|
31
31
|
const drawerRef = shallowRef();
|
|
32
32
|
const isVisible = useModelValue(props, emits);
|
|
33
33
|
useFocusTrap(drawerRef);
|
|
@@ -48,7 +48,7 @@ const computedStyle = computed(() => {
|
|
|
48
48
|
});
|
|
49
49
|
function onOverlayClick(ev) {
|
|
50
50
|
emits("click-outside", ev);
|
|
51
|
-
if (!props.closeOnClickOverlay || props.loading) {
|
|
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"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, onBeforeUnmount, shallowRef, watch } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import { useResizeObserver } from "../../composables/use-browser-observer";
|
|
4
|
+
import { off, on } from "../../utils/event";
|
|
4
5
|
import { getCssUnitValue } from "../../utils/format";
|
|
5
6
|
import { throttleByRaf } from "../../utils/throttle";
|
|
6
7
|
defineOptions({
|
|
@@ -19,13 +20,13 @@ const fader = shallowRef({
|
|
|
19
20
|
bottom: false
|
|
20
21
|
});
|
|
21
22
|
const computedStyle = computed(() => ({
|
|
22
|
-
"--
|
|
23
|
-
"--
|
|
23
|
+
"--fader-color": props.color,
|
|
24
|
+
"--fader-size": getCssUnitValue(props.size)
|
|
24
25
|
}));
|
|
25
26
|
const DIFF_THRESHOLD = 1;
|
|
26
27
|
const onContainerScroll = throttleByRaf(() => {
|
|
27
|
-
const { size = 16 } = props;
|
|
28
|
-
const { scrollLeft, scrollWidth, clientWidth, scrollTop, clientHeight, scrollHeight } =
|
|
28
|
+
const { size = 16, container } = props;
|
|
29
|
+
const { scrollLeft, scrollWidth, clientWidth, scrollTop, clientHeight, scrollHeight } = container;
|
|
29
30
|
fader.value = {
|
|
30
31
|
left: scrollLeft >= size,
|
|
31
32
|
right: scrollLeft + clientWidth < scrollWidth - DIFF_THRESHOLD,
|
|
@@ -33,6 +34,7 @@ const onContainerScroll = throttleByRaf(() => {
|
|
|
33
34
|
bottom: scrollTop + clientHeight < scrollHeight - DIFF_THRESHOLD
|
|
34
35
|
};
|
|
35
36
|
});
|
|
37
|
+
useResizeObserver(() => props.container, onContainerScroll);
|
|
36
38
|
watch(() => props.container, (container, oldDom) => {
|
|
37
39
|
if (oldDom) {
|
|
38
40
|
off(oldDom, "scroll", onContainerScroll);
|
|
@@ -41,7 +43,6 @@ watch(() => props.container, (container, oldDom) => {
|
|
|
41
43
|
if (!container) {
|
|
42
44
|
return;
|
|
43
45
|
}
|
|
44
|
-
onContainerScroll();
|
|
45
46
|
on(container, "scroll", onContainerScroll);
|
|
46
47
|
});
|
|
47
48
|
onBeforeUnmount(() => {
|
|
@@ -66,8 +67,8 @@ onBeforeUnmount(() => {
|
|
|
66
67
|
content: '';
|
|
67
68
|
position: absolute;
|
|
68
69
|
border-radius: inherit;
|
|
69
|
-
background: linear-gradient(var(--dir), transparent, var(--
|
|
70
|
-
mask-image: linear-gradient(var(--dir-revert), var(--
|
|
70
|
+
background: linear-gradient(var(--dir), transparent, var(--fader-color, var(--color-gray-200)));
|
|
71
|
+
mask-image: linear-gradient(var(--dir-revert), var(--fader-color, var(--color-gray-200)) 50%, transparent);
|
|
71
72
|
transition: opacity var(--default-transition-timing-function) var(--default-transition-duration);
|
|
72
73
|
opacity: 0;
|
|
73
74
|
}
|
|
@@ -83,7 +84,7 @@ onBeforeUnmount(() => {
|
|
|
83
84
|
&::before,
|
|
84
85
|
&::after {
|
|
85
86
|
top: 0;
|
|
86
|
-
width: var(--
|
|
87
|
+
width: var(--fader-size, 16px);
|
|
87
88
|
height: 100%;
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -105,7 +106,7 @@ onBeforeUnmount(() => {
|
|
|
105
106
|
&::after {
|
|
106
107
|
left: 0;
|
|
107
108
|
width: 100%;
|
|
108
|
-
height: var(--
|
|
109
|
+
height: var(--fader-size, 16px);
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
&::before {
|
|
@@ -7,8 +7,8 @@ defineOptions({
|
|
|
7
7
|
});
|
|
8
8
|
const props = defineProps({
|
|
9
9
|
debug: { type: Boolean, required: false },
|
|
10
|
-
rows: { type:
|
|
11
|
-
columns: { type:
|
|
10
|
+
rows: { type: [String, Number, Object], required: false },
|
|
11
|
+
columns: { type: [String, Number, Object], required: false }
|
|
12
12
|
});
|
|
13
13
|
const presetGridRows = {
|
|
14
14
|
"--xs-rows": "grid-rows-(--xs-rows) [--rows-count:var(--xs-rows-count)]",
|
|
@@ -5,8 +5,8 @@ defineOptions({
|
|
|
5
5
|
name: "PGridItem"
|
|
6
6
|
});
|
|
7
7
|
const props = defineProps({
|
|
8
|
-
row: { type:
|
|
9
|
-
column: { type:
|
|
8
|
+
row: { type: [String, Number, Object], required: false },
|
|
9
|
+
column: { type: [String, Number, Object], required: false }
|
|
10
10
|
});
|
|
11
11
|
const presetGridRow = {
|
|
12
12
|
"--xs-row": "row-(--xs-row)",
|
|
@@ -14,6 +14,9 @@ export { default as Choicebox } from './choicebox/index.vue';
|
|
|
14
14
|
export { default as ChoiceboxGroup } from './choicebox-group/index.vue';
|
|
15
15
|
export { default as Collapse } from './collapse/index.vue';
|
|
16
16
|
export { default as CollapseGroup } from './collapse-group/index.vue';
|
|
17
|
+
export { default as CommandMenu } from './command-menu/index.vue';
|
|
18
|
+
export { default as CommandMenuGroup } from './command-menu-group/index.vue';
|
|
19
|
+
export { default as CommandMenuItem } from './command-menu-item/index.vue';
|
|
17
20
|
export { default as ConfigProvider } from './config-provider/index.vue';
|
|
18
21
|
export { default as Countdown } from './countdown/index.vue';
|
|
19
22
|
export { default as Description } from './description/index.vue';
|
|
@@ -31,6 +34,7 @@ export { default as Kbd } from './kbd/index.vue';
|
|
|
31
34
|
export { default as LinkButton } from './link-button/index.vue';
|
|
32
35
|
export { default as List } from './list/index.vue';
|
|
33
36
|
export { default as ListItem } from './list-item/index.vue';
|
|
37
|
+
export { default as LoadingBar } from './loading-bar/index.vue';
|
|
34
38
|
export { default as LoadingDots } from './loading-dots/index.vue';
|
|
35
39
|
export { default as Material } from './material/index.vue';
|
|
36
40
|
export { default as Menu } from './menu/index.vue';
|
package/dist/components/index.js
CHANGED
|
@@ -14,6 +14,9 @@ export { default as Choicebox } from "./choicebox/index.vue";
|
|
|
14
14
|
export { default as ChoiceboxGroup } from "./choicebox-group/index.vue";
|
|
15
15
|
export { default as Collapse } from "./collapse/index.vue";
|
|
16
16
|
export { default as CollapseGroup } from "./collapse-group/index.vue";
|
|
17
|
+
export { default as CommandMenu } from "./command-menu/index.vue";
|
|
18
|
+
export { default as CommandMenuGroup } from "./command-menu-group/index.vue";
|
|
19
|
+
export { default as CommandMenuItem } from "./command-menu-item/index.vue";
|
|
17
20
|
export { default as ConfigProvider } from "./config-provider/index.vue";
|
|
18
21
|
export { default as Countdown } from "./countdown/index.vue";
|
|
19
22
|
export { default as Description } from "./description/index.vue";
|
|
@@ -31,6 +34,7 @@ export { default as Kbd } from "./kbd/index.vue";
|
|
|
31
34
|
export { default as LinkButton } from "./link-button/index.vue";
|
|
32
35
|
export { default as List } from "./list/index.vue";
|
|
33
36
|
export { default as ListItem } from "./list-item/index.vue";
|
|
37
|
+
export { default as LoadingBar } from "./loading-bar/index.vue";
|
|
34
38
|
export { default as LoadingDots } from "./loading-dots/index.vue";
|
|
35
39
|
export { default as Material } from "./material/index.vue";
|
|
36
40
|
export { default as Menu } from "./menu/index.vue";
|
|
@@ -173,7 +173,7 @@ defineExpose({
|
|
|
173
173
|
<input
|
|
174
174
|
:id="uniqueId"
|
|
175
175
|
ref="inputRef"
|
|
176
|
-
class="px-3 size-full rounded-inherit bg-transparent outline-none file:font-medium file:border-0 file:bg-transparent placeholder:text-gray-600 placeholder:select-none disabled:cursor-not-allowed disabled:text-gray-700 disabled:placeholder:text-gray-500"
|
|
176
|
+
class="px-3 size-full appearance-none rounded-inherit border-none bg-transparent outline-none file:font-medium file:border-0 file:bg-transparent placeholder:text-gray-600 placeholder:select-none disabled:cursor-not-allowed disabled:text-gray-700 disabled:placeholder:text-gray-500"
|
|
177
177
|
:class="{ 'pr-9': password || allowClear, [ALIGN[align]]: true }"
|
|
178
178
|
:type="internalInputType"
|
|
179
179
|
:min="min"
|
|
@@ -14,7 +14,7 @@ const props = defineProps({
|
|
|
14
14
|
rootMargin: { type: String, required: false, default: "20%" },
|
|
15
15
|
threshold: { type: [Number, Array], required: false, default: 0 }
|
|
16
16
|
});
|
|
17
|
-
const emits = defineEmits(["
|
|
17
|
+
const emits = defineEmits(["visible-change", "before-show", "before-hide", "show", "hide"]);
|
|
18
18
|
const isVisible = shallowRef(false);
|
|
19
19
|
const containerRef = shallowRef();
|
|
20
20
|
const containerSize = shallowRef({
|
|
@@ -43,7 +43,7 @@ function onVisibleChange(isIntersecting) {
|
|
|
43
43
|
emits("hide");
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
emits("change", isIntersecting);
|
|
46
|
+
emits("visible-change", isIntersecting);
|
|
47
47
|
}
|
|
48
48
|
useIntersectionObserver(containerRef, ([{ isIntersecting }]) => {
|
|
49
49
|
onVisibleChange(isIntersecting);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useConfigProvider } from "pxd";
|
|
3
|
+
import { getFallbackValue } from "pxd/utils/get";
|
|
2
4
|
import { computed } from "vue";
|
|
3
5
|
defineOptions({
|
|
4
|
-
name: "PKbd"
|
|
6
|
+
name: "PKbd",
|
|
7
|
+
inheritAttrs: false
|
|
5
8
|
});
|
|
6
9
|
const props = defineProps({
|
|
7
10
|
meta: { type: Boolean, required: false },
|
|
@@ -9,14 +12,22 @@ const props = defineProps({
|
|
|
9
12
|
alt: { type: Boolean, required: false },
|
|
10
13
|
ctrl: { type: Boolean, required: false },
|
|
11
14
|
small: { type: Boolean, required: false },
|
|
12
|
-
label: { type: String, required: false }
|
|
15
|
+
label: { type: String, required: false },
|
|
16
|
+
size: { type: String, required: false }
|
|
13
17
|
});
|
|
18
|
+
const SIZES = {
|
|
19
|
+
sm: "h-5 text-xs",
|
|
20
|
+
md: "h-6 text-sm",
|
|
21
|
+
lg: "h-7 text-sm"
|
|
22
|
+
};
|
|
14
23
|
const INTERNAL_KEYS = {
|
|
15
24
|
meta: "\u2318",
|
|
16
25
|
shift: "\u21E7",
|
|
17
26
|
alt: "\u2325",
|
|
18
27
|
ctrl: "Ctrl"
|
|
19
28
|
};
|
|
29
|
+
const config = useConfigProvider();
|
|
30
|
+
const computedSize = computed(() => getFallbackValue(props.size, SIZES, config.size));
|
|
20
31
|
const internalKey = computed(() => {
|
|
21
32
|
return Object.entries(INTERNAL_KEYS).filter(([k]) => {
|
|
22
33
|
return props[k];
|
|
@@ -26,8 +37,9 @@ const internalKey = computed(() => {
|
|
|
26
37
|
|
|
27
38
|
<template>
|
|
28
39
|
<kbd
|
|
29
|
-
class="pxd-keyboard px-1.5 font-sans ml-1 inline-flex items-center rounded-md border border-input bg-background-100 text-center text-gray-1000"
|
|
30
|
-
:class="
|
|
40
|
+
class="pxd-keyboard px-1.5 font-sans ml-1 inline-flex items-center rounded-md border border-input bg-background-100 text-center text-nowrap whitespace-nowrap text-gray-1000"
|
|
41
|
+
:class="computedSize"
|
|
42
|
+
v-bind="$attrs"
|
|
31
43
|
>
|
|
32
44
|
{{ internalKey }}
|
|
33
45
|
<slot>{{ label }}</slot>
|