pxd 0.0.34 → 0.0.35
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 +7 -7
- package/dist/components/badge/index.vue +1 -1
- package/dist/components/browser/index.vue +1 -1
- package/dist/components/button/index.vue +1 -1
- package/dist/components/choicebox/index.vue +1 -1
- package/dist/components/choicebox-group/index.vue +1 -1
- package/dist/components/config-provider/index.vue +1 -1
- package/dist/components/drawer/index.vue +29 -24
- package/dist/components/drawer/index.vue.d.ts +2 -1
- package/dist/components/list/index.vue +18 -20
- package/dist/components/list-item/index.vue +28 -47
- package/dist/components/list-item/index.vue.d.ts +11 -9
- package/dist/components/material/index.vue +1 -1
- package/dist/components/message/index.vue +132 -26
- package/dist/components/message/index.vue.d.ts +62 -1
- package/dist/components/modal/index.vue +6 -4
- package/dist/components/modal/index.vue.d.ts +4 -3
- package/dist/components/note/index.vue +1 -1
- package/dist/components/overlay/index.vue +32 -13
- package/dist/components/overlay/index.vue.d.ts +1 -0
- package/dist/components/popover/index.vue +47 -61
- package/dist/components/popover/index.vue.d.ts +2 -0
- package/dist/components/snippet/index.vue +1 -1
- package/dist/components/stack/index.vue +1 -1
- package/dist/components/status-dot/index.vue +5 -5
- package/dist/components/teleport/index.vue +27 -30
- package/dist/components/text/index.vue +1 -1
- package/dist/components/theme-switcher/index.vue +1 -1
- package/dist/components/tooltip/index.vue +1 -1
- package/dist/composables/use-delay-change.d.ts +2 -2
- package/dist/composables/use-delay-change.js +5 -5
- package/dist/composables/use-message.d.ts +4 -37
- package/dist/composables/use-message.js +5 -140
- package/dist/composables/use-pointer-gesture.d.ts +6 -0
- package/dist/composables/use-pointer-gesture.js +3 -0
- package/dist/contexts/list.d.ts +1 -0
- package/dist/contexts/list.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/styles/tw.css +7 -2
- package/dist/types/components/list.d.ts +2 -1
- package/dist/utils/format.js +1 -1
- package/package.json +1 -1
|
@@ -206,8 +206,8 @@ let tbodyRect;
|
|
|
206
206
|
const tbodyRef = shallowRef();
|
|
207
207
|
const {
|
|
208
208
|
value: showTooltip,
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
setValue: setShowTooltip,
|
|
210
|
+
setValueDelay: setShowTooltipDelay
|
|
211
211
|
} = useDelayChange(false, 500);
|
|
212
212
|
const tooltipInfo = shallowRef({});
|
|
213
213
|
const formatTooltipText = computed(() => {
|
|
@@ -218,25 +218,25 @@ const formatTooltipText = computed(() => {
|
|
|
218
218
|
return "";
|
|
219
219
|
});
|
|
220
220
|
function onMouseLeave() {
|
|
221
|
-
|
|
221
|
+
setShowTooltip(false);
|
|
222
222
|
tooltipInfo.value = {};
|
|
223
223
|
tbodyRect = null;
|
|
224
224
|
}
|
|
225
225
|
async function onMouseOver(ev) {
|
|
226
226
|
const targetEl = ev.target;
|
|
227
227
|
if (targetEl.tagName !== "TD") {
|
|
228
|
-
|
|
228
|
+
setShowTooltipDelay(false);
|
|
229
229
|
return;
|
|
230
230
|
}
|
|
231
231
|
const date = targetEl.dataset.date;
|
|
232
232
|
if (!date) {
|
|
233
|
-
|
|
233
|
+
setShowTooltip(false);
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
236
|
if (!tbodyRect) {
|
|
237
237
|
tbodyRect = tbodyRef.value.getBoundingClientRect();
|
|
238
238
|
}
|
|
239
|
-
|
|
239
|
+
setShowTooltip(true);
|
|
240
240
|
const rect = targetEl.getBoundingClientRect();
|
|
241
241
|
let top = rect.top - tbodyRect.top - CELL_SIZE;
|
|
242
242
|
if (props.graphOnly) {
|
|
@@ -322,7 +322,7 @@ onBeforeUnmount(() => {
|
|
|
322
322
|
</tbody>
|
|
323
323
|
</table>
|
|
324
324
|
|
|
325
|
-
<Transition name="pxd-transition--fade">
|
|
325
|
+
<Transition name="pxd-transition--fade" mode="out-in" appear>
|
|
326
326
|
<div
|
|
327
327
|
v-if="showTooltip"
|
|
328
328
|
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"
|
|
@@ -42,7 +42,7 @@ const { isCopied, copyText } = useCopyClick();
|
|
|
42
42
|
|
|
43
43
|
<PButton variant="ghost" size="xs" shape="rounded" class="size-6" icon @click="copyText(address)">
|
|
44
44
|
<Transition name="pxd-transition--fade-scale" mode="out-in">
|
|
45
|
-
<
|
|
45
|
+
<Component :is="isCopied ? CheckIcon : CopyIcon" class="text-sm text-foreground-secondary" />
|
|
46
46
|
</Transition>
|
|
47
47
|
</PButton>
|
|
48
48
|
</div>
|
|
@@ -28,7 +28,7 @@ const computedAttrs = computed(() => {
|
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
30
|
<template>
|
|
31
|
-
<
|
|
31
|
+
<Component :is="renderComponent" v-model="choiceboxModelValue" v-bind="computedAttrs">
|
|
32
32
|
<div class="gap-1 flex flex-col">
|
|
33
33
|
<span class="pxd-choicebox--label font-medium">
|
|
34
34
|
<slot name="label">
|
|
@@ -17,6 +17,7 @@ const props = defineProps({
|
|
|
17
17
|
title: { type: [String, Number, Array, null], required: false },
|
|
18
18
|
subtitle: { type: [String, Number, Array, null], required: false },
|
|
19
19
|
size: { type: [Number, String], required: false },
|
|
20
|
+
pending: { type: Boolean, required: false },
|
|
20
21
|
position: { type: String, required: false, default: "right" },
|
|
21
22
|
modelValue: { type: Boolean, required: false, default: false },
|
|
22
23
|
appendToBody: { type: Boolean, required: false, default: true },
|
|
@@ -37,7 +38,7 @@ const ensurePosition = computed(() => {
|
|
|
37
38
|
}
|
|
38
39
|
return "right";
|
|
39
40
|
});
|
|
40
|
-
const transitionName = computed(() => `pxd-transition--drawer
|
|
41
|
+
const transitionName = computed(() => `pxd-transition--drawer-${ensurePosition.value}`);
|
|
41
42
|
const computedStyle = computed(() => {
|
|
42
43
|
const styles = {};
|
|
43
44
|
if (props.size) {
|
|
@@ -47,14 +48,16 @@ const computedStyle = computed(() => {
|
|
|
47
48
|
});
|
|
48
49
|
function onOverlayClick(ev) {
|
|
49
50
|
emits("click-outside", ev);
|
|
50
|
-
if (!props.closeOnClickOverlay) {
|
|
51
|
+
if (!props.closeOnClickOverlay || props.pending) {
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
|
-
closeDrawer();
|
|
54
|
-
}
|
|
55
|
-
function closeDrawer() {
|
|
56
54
|
isVisible.value = false;
|
|
57
|
-
|
|
55
|
+
}
|
|
56
|
+
function onUpdateModelValue(visible) {
|
|
57
|
+
if (!visible && props.pending) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
isVisible.value = visible;
|
|
58
61
|
}
|
|
59
62
|
watch(() => isVisible.value, (visible) => {
|
|
60
63
|
if (visible) {
|
|
@@ -67,12 +70,13 @@ watch(() => isVisible.value, (visible) => {
|
|
|
67
70
|
|
|
68
71
|
<template>
|
|
69
72
|
<POverlay
|
|
70
|
-
|
|
73
|
+
:model-value="isVisible"
|
|
71
74
|
:append-to-body="appendToBody"
|
|
72
75
|
:close-on-press-escape="closeOnPressEscape"
|
|
76
|
+
:update:model-value="onUpdateModelValue"
|
|
73
77
|
@click="onOverlayClick"
|
|
74
78
|
>
|
|
75
|
-
<Transition :name="transitionName" mode="out-in">
|
|
79
|
+
<Transition :name="transitionName" mode="out-in" appear>
|
|
76
80
|
<div
|
|
77
81
|
v-if="isVisible"
|
|
78
82
|
ref="drawerRef"
|
|
@@ -109,6 +113,7 @@ watch(() => isVisible.value, (visible) => {
|
|
|
109
113
|
>
|
|
110
114
|
<slot />
|
|
111
115
|
</PScrollable>
|
|
116
|
+
<div v-else class="flex-1" />
|
|
112
117
|
|
|
113
118
|
<footer
|
|
114
119
|
v-if="$slots.footer"
|
|
@@ -159,34 +164,34 @@ watch(() => isVisible.value, (visible) => {
|
|
|
159
164
|
height: var(--size, var(--h, 80vw));
|
|
160
165
|
}
|
|
161
166
|
|
|
162
|
-
.pxd-transition--drawer-
|
|
163
|
-
.pxd-transition--drawer-
|
|
164
|
-
.pxd-transition--drawer-
|
|
165
|
-
.pxd-transition--drawer-
|
|
166
|
-
.pxd-transition--drawer-
|
|
167
|
-
.pxd-transition--drawer-
|
|
168
|
-
.pxd-transition--drawer-
|
|
169
|
-
.pxd-transition--drawer-
|
|
167
|
+
.pxd-transition--drawer-right-enter-active,
|
|
168
|
+
.pxd-transition--drawer-right-leave-active,
|
|
169
|
+
.pxd-transition--drawer-left-enter-active,
|
|
170
|
+
.pxd-transition--drawer-left-leave-active,
|
|
171
|
+
.pxd-transition--drawer-top-enter-active,
|
|
172
|
+
.pxd-transition--drawer-top-leave-active,
|
|
173
|
+
.pxd-transition--drawer-bottom-enter-active,
|
|
174
|
+
.pxd-transition--drawer-bottom-leave-active {
|
|
170
175
|
transition: transform var(--default-transition-duration, 0.3s) var(--default-transition-timing-function);
|
|
171
176
|
}
|
|
172
177
|
|
|
173
|
-
.pxd-transition--drawer-
|
|
174
|
-
.pxd-transition--drawer-
|
|
178
|
+
.pxd-transition--drawer-right-leave-to,
|
|
179
|
+
.pxd-transition--drawer-right-enter-from {
|
|
175
180
|
transform: translateX(100%);
|
|
176
181
|
}
|
|
177
182
|
|
|
178
|
-
.pxd-transition--drawer-
|
|
179
|
-
.pxd-transition--drawer-
|
|
183
|
+
.pxd-transition--drawer-left-leave-to,
|
|
184
|
+
.pxd-transition--drawer-left-enter-from {
|
|
180
185
|
transform: translateX(-100%);
|
|
181
186
|
}
|
|
182
187
|
|
|
183
|
-
.pxd-transition--drawer-
|
|
184
|
-
.pxd-transition--drawer-
|
|
188
|
+
.pxd-transition--drawer-top-leave-to,
|
|
189
|
+
.pxd-transition--drawer-top-enter-from {
|
|
185
190
|
transform: translateY(-100%);
|
|
186
191
|
}
|
|
187
192
|
|
|
188
|
-
.pxd-transition--drawer-
|
|
189
|
-
.pxd-transition--drawer-
|
|
193
|
+
.pxd-transition--drawer-bottom-leave-to,
|
|
194
|
+
.pxd-transition--drawer-bottom-enter-from {
|
|
190
195
|
transform: translateY(100%);
|
|
191
196
|
}
|
|
192
197
|
</style>
|
|
@@ -3,6 +3,7 @@ interface Props {
|
|
|
3
3
|
title?: ComponentLabel;
|
|
4
4
|
subtitle?: ComponentLabel;
|
|
5
5
|
size?: number | string;
|
|
6
|
+
pending?: boolean;
|
|
6
7
|
position?: BasePosition;
|
|
7
8
|
modelValue?: boolean;
|
|
8
9
|
appendToBody?: boolean;
|
|
@@ -37,9 +38,9 @@ declare const __VLS_component: import("vue").DefineComponent<Props, void, {}, {}
|
|
|
37
38
|
modelValue: boolean;
|
|
38
39
|
closeOnPressEscape: boolean;
|
|
39
40
|
appendToBody: boolean;
|
|
41
|
+
closeOnClickOverlay: boolean;
|
|
40
42
|
headerStylize: boolean;
|
|
41
43
|
footerStylize: boolean;
|
|
42
|
-
closeOnClickOverlay: boolean;
|
|
43
44
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
44
45
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
45
46
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, onBeforeUnmount, onMounted, shallowRef } from "vue";
|
|
3
|
-
import { provideListContext } from "../../contexts/list";
|
|
3
|
+
import { provideListContext, provideListItemIndexContext } from "../../contexts/list";
|
|
4
4
|
import { off, on } from "../../utils/events";
|
|
5
5
|
import { getCssUnitValue } from "../../utils/format";
|
|
6
6
|
import { isServer } from "../../utils/is";
|
|
@@ -18,29 +18,24 @@ const props = defineProps({
|
|
|
18
18
|
const emits = defineEmits(["close", "toggle", "selected"]);
|
|
19
19
|
const ITEM_CLASS = "pxd-list-item";
|
|
20
20
|
const ITEM_SELECTOR = `.${ITEM_CLASS}`;
|
|
21
|
-
const
|
|
21
|
+
const initialIndex = Number.NaN;
|
|
22
|
+
const activeIndex = shallowRef(initialIndex);
|
|
23
|
+
const increaseIndex = shallowRef(0);
|
|
22
24
|
const allItems = shallowRef([]);
|
|
23
25
|
const computedStyle = computed(() => {
|
|
24
26
|
return {
|
|
25
27
|
width: getCssUnitValue(props.width)
|
|
26
28
|
};
|
|
27
29
|
});
|
|
28
|
-
function updateAllItemsIndex() {
|
|
29
|
-
allItems.value.forEach((item, index) => {
|
|
30
|
-
item.dataset.index = String(index);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
30
|
function registerListItem(el) {
|
|
34
31
|
if (!allItems.value.includes(el)) {
|
|
35
32
|
allItems.value.push(el);
|
|
36
|
-
updateAllItemsIndex();
|
|
37
33
|
}
|
|
38
34
|
}
|
|
39
35
|
function unregisterListItem(el) {
|
|
40
36
|
const index = allItems.value.indexOf(el);
|
|
41
|
-
if (index
|
|
37
|
+
if (index >= 0) {
|
|
42
38
|
allItems.value.splice(index, 1);
|
|
43
|
-
updateAllItemsIndex();
|
|
44
39
|
}
|
|
45
40
|
}
|
|
46
41
|
function getItemData(index) {
|
|
@@ -48,9 +43,10 @@ function getItemData(index) {
|
|
|
48
43
|
if (!element) {
|
|
49
44
|
return null;
|
|
50
45
|
}
|
|
46
|
+
const { disabled, type = "default" } = element.dataset;
|
|
51
47
|
return {
|
|
52
|
-
disabled:
|
|
53
|
-
type
|
|
48
|
+
disabled: disabled === "true",
|
|
49
|
+
type
|
|
54
50
|
};
|
|
55
51
|
}
|
|
56
52
|
function getCorrectIndex(dir, index) {
|
|
@@ -70,6 +66,8 @@ function getCorrectIndex(dir, index) {
|
|
|
70
66
|
}
|
|
71
67
|
const PREV_KEYS = ["ArrowUp", "ArrowLeft"];
|
|
72
68
|
const NEXT_KEYS = ["ArrowDown", "ArrowRight"];
|
|
69
|
+
const FUNCTION_KEYS = ["Enter", "Escape", "Tab"];
|
|
70
|
+
const PREVENT_DEFAULT_KEYS = [...FUNCTION_KEYS, ...PREV_KEYS, ...NEXT_KEYS];
|
|
73
71
|
const THROTTLE_INTERVALS = 255;
|
|
74
72
|
const containerKeydownThrottled = throttle((ev) => {
|
|
75
73
|
const count = allItems.value.length;
|
|
@@ -89,10 +87,10 @@ const containerKeydownThrottled = throttle((ev) => {
|
|
|
89
87
|
return;
|
|
90
88
|
}
|
|
91
89
|
if (PREV_KEYS.includes(key)) {
|
|
92
|
-
activeIndex.value = activeIndex.value
|
|
90
|
+
activeIndex.value = Object.is(activeIndex.value, initialIndex) ? count - 1 : getCorrectIndex("prev", activeIndex.value);
|
|
93
91
|
emits("toggle", activeIndex.value);
|
|
94
92
|
} else if (NEXT_KEYS.includes(key)) {
|
|
95
|
-
activeIndex.value = activeIndex.value
|
|
93
|
+
activeIndex.value = Object.is(activeIndex.value, initialIndex) ? 0 : getCorrectIndex("next", activeIndex.value);
|
|
96
94
|
emits("toggle", activeIndex.value);
|
|
97
95
|
}
|
|
98
96
|
if (allItems.value.length <= 0 || activeIndex.value < 0) {
|
|
@@ -103,7 +101,10 @@ const containerKeydownThrottled = throttle((ev) => {
|
|
|
103
101
|
});
|
|
104
102
|
}, THROTTLE_INTERVALS, { edges: ["leading"] });
|
|
105
103
|
function onContainerKeydown(ev) {
|
|
106
|
-
ev.
|
|
104
|
+
if (PREVENT_DEFAULT_KEYS.includes(ev.key)) {
|
|
105
|
+
ev.preventDefault();
|
|
106
|
+
}
|
|
107
|
+
ev.stopPropagation();
|
|
107
108
|
containerKeydownThrottled(ev);
|
|
108
109
|
}
|
|
109
110
|
function onPointerOver(ev) {
|
|
@@ -119,6 +120,7 @@ function onOptionClick(ev, index) {
|
|
|
119
120
|
emits("selected", ev, index);
|
|
120
121
|
emits("close");
|
|
121
122
|
}
|
|
123
|
+
provideListItemIndexContext(increaseIndex);
|
|
122
124
|
provideListContext({
|
|
123
125
|
activeIndex,
|
|
124
126
|
onOptionClick,
|
|
@@ -132,9 +134,6 @@ onMounted(() => {
|
|
|
132
134
|
on(document, "keydown", onContainerKeydown);
|
|
133
135
|
});
|
|
134
136
|
onBeforeUnmount(() => {
|
|
135
|
-
if (isServer) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
137
|
off(document, "keydown", onContainerKeydown);
|
|
139
138
|
allItems.value = [];
|
|
140
139
|
});
|
|
@@ -144,10 +143,9 @@ onBeforeUnmount(() => {
|
|
|
144
143
|
<ul
|
|
145
144
|
role="list"
|
|
146
145
|
tabindex="-1"
|
|
147
|
-
class="pxd-list"
|
|
146
|
+
class="pxd-list max-w-full"
|
|
148
147
|
:style="computedStyle"
|
|
149
148
|
@pointerover="onPointerOver"
|
|
150
|
-
@keydown="onContainerKeydown"
|
|
151
149
|
>
|
|
152
150
|
<PScrollable class="max-h-68" content-class="pr-2">
|
|
153
151
|
<slot>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, onMounted, onUnmounted, shallowRef } from "vue";
|
|
3
|
-
import { useListContext } from "../../contexts/list";
|
|
2
|
+
import { computed, onMounted, onUnmounted, shallowRef, useAttrs } from "vue";
|
|
3
|
+
import { useListContext, useListItemIndexContext } from "../../contexts/list";
|
|
4
4
|
defineOptions({
|
|
5
5
|
name: "PListItem"
|
|
6
6
|
});
|
|
7
7
|
const props = defineProps({
|
|
8
8
|
as: { type: null, required: false, default: "li" },
|
|
9
|
-
type: { type:
|
|
10
|
-
label: { type:
|
|
11
|
-
disabled: { type:
|
|
9
|
+
type: { type: null, required: false, default: "default" },
|
|
10
|
+
label: { type: null, required: false },
|
|
11
|
+
disabled: { type: null, required: false, default: false },
|
|
12
|
+
description: { type: null, required: false }
|
|
12
13
|
});
|
|
13
14
|
const emits = defineEmits(["click"]);
|
|
14
15
|
const {
|
|
@@ -17,76 +18,56 @@ const {
|
|
|
17
18
|
registerListItem,
|
|
18
19
|
unregisterListItem
|
|
19
20
|
} = useListContext();
|
|
21
|
+
const listItemIndex = useListItemIndexContext();
|
|
22
|
+
const attrs = useAttrs();
|
|
20
23
|
const itemRef = shallowRef();
|
|
21
|
-
const currentIndex = shallowRef(
|
|
24
|
+
const currentIndex = shallowRef(listItemIndex.value++);
|
|
25
|
+
const itemTypeMap = {
|
|
26
|
+
error: "text-red-900 data-[selected=true]:bg-red-100",
|
|
27
|
+
warning: "text-amber-900 data-[selected=true]:bg-amber-100",
|
|
28
|
+
default: "text-foreground data-[selected=true]:bg-gray-alpha-100"
|
|
29
|
+
};
|
|
30
|
+
const isSelected = computed(() => activeIndex.value === currentIndex.value);
|
|
22
31
|
const computedClass = computed(() => {
|
|
23
|
-
const classes = [];
|
|
24
|
-
if (props.type
|
|
25
|
-
classes.push(
|
|
26
|
-
}
|
|
27
|
-
if (props.disabled) {
|
|
28
|
-
classes.push("pointer-events-none text-gray-700");
|
|
29
|
-
} else {
|
|
30
|
-
classes.push("cursor-pointer");
|
|
32
|
+
const classes = ["cursor-pointer data-[disabled=true]:pointer-events-none data-[disabled=true]:text-gray-700", attrs.class];
|
|
33
|
+
if (props.type) {
|
|
34
|
+
classes.push(itemTypeMap[props.type]);
|
|
31
35
|
}
|
|
32
36
|
return classes.join(" ");
|
|
33
37
|
});
|
|
34
|
-
function setRef(el) {
|
|
35
|
-
if (!el) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
itemRef.value = el instanceof HTMLElement ? el : el.$el;
|
|
39
|
-
if (registerListItem) {
|
|
40
|
-
registerListItem(itemRef.value);
|
|
41
|
-
}
|
|
42
|
-
updateCurrentIndex();
|
|
43
|
-
}
|
|
44
|
-
function updateCurrentIndex() {
|
|
45
|
-
if (itemRef.value && itemRef.value.dataset.index) {
|
|
46
|
-
currentIndex.value = Number(itemRef.value.dataset.index);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
38
|
function onItemClick(ev) {
|
|
50
39
|
emits("click", ev, currentIndex.value);
|
|
51
40
|
onOptionClick?.(ev, currentIndex.value);
|
|
52
41
|
}
|
|
53
42
|
onMounted(() => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
updateCurrentIndex();
|
|
57
|
-
});
|
|
58
|
-
if (itemRef.value) {
|
|
59
|
-
observer.observe(itemRef.value, {
|
|
60
|
-
attributes: true,
|
|
61
|
-
attributeFilter: ["data-index"]
|
|
62
|
-
});
|
|
43
|
+
if (registerListItem) {
|
|
44
|
+
registerListItem(itemRef.value);
|
|
63
45
|
}
|
|
64
|
-
onUnmounted(() => {
|
|
65
|
-
observer.disconnect();
|
|
66
|
-
});
|
|
67
46
|
});
|
|
68
47
|
onUnmounted(() => {
|
|
69
|
-
if (
|
|
48
|
+
if (unregisterListItem) {
|
|
70
49
|
unregisterListItem(itemRef.value);
|
|
71
50
|
}
|
|
72
51
|
});
|
|
73
52
|
</script>
|
|
74
53
|
|
|
75
54
|
<template>
|
|
76
|
-
<
|
|
55
|
+
<Component
|
|
77
56
|
:is="as"
|
|
78
|
-
|
|
57
|
+
ref="itemRef"
|
|
79
58
|
tabindex="-1"
|
|
80
59
|
role="listitem"
|
|
60
|
+
:data-type="type"
|
|
81
61
|
:data-index="currentIndex"
|
|
82
62
|
:data-disabled="disabled"
|
|
83
|
-
:data-selected="
|
|
84
|
-
class="pxd-list-item h-10 px-2 text-sm flex w-full items-center rounded-md outline-none
|
|
63
|
+
:data-selected="isSelected"
|
|
64
|
+
class="pxd-list-item h-10 gap-1 px-2 text-sm flex w-full items-center rounded-md outline-none motion-safe:transition-colors"
|
|
85
65
|
:class="computedClass"
|
|
86
66
|
@click="onItemClick"
|
|
87
67
|
>
|
|
88
68
|
<slot>
|
|
89
|
-
{{ label }}
|
|
69
|
+
<span class="gap-2 flex items-center">{{ label }}</span>
|
|
70
|
+
<span v-if="description" class="text-sm text-foreground-secondary">{{ description }}</span>
|
|
90
71
|
</slot>
|
|
91
72
|
</component>
|
|
92
73
|
</template>
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ListOption } from '../../types/components/list';
|
|
2
2
|
interface Props {
|
|
3
|
-
as?:
|
|
4
|
-
type?: '
|
|
5
|
-
label?:
|
|
6
|
-
disabled?:
|
|
3
|
+
as?: ListOption['as'];
|
|
4
|
+
type?: ListOption['type'];
|
|
5
|
+
label?: ListOption['label'];
|
|
6
|
+
disabled?: ListOption['disabled'];
|
|
7
|
+
description?: ListOption['description'];
|
|
7
8
|
}
|
|
8
|
-
declare var
|
|
9
|
+
declare var __VLS_11: {};
|
|
9
10
|
type __VLS_Slots = {} & {
|
|
10
|
-
default?: (props: typeof
|
|
11
|
+
default?: (props: typeof __VLS_11) => any;
|
|
11
12
|
};
|
|
12
13
|
declare const __VLS_component: import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
14
|
click: (ev: MouseEvent, index: number) => any;
|
|
14
15
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
15
16
|
onClick?: (ev: MouseEvent, index: number) => any;
|
|
16
17
|
}>, {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
type: ListOption["type"];
|
|
19
|
+
disabled: ListOption["disabled"];
|
|
20
|
+
as: ListOption["as"];
|
|
19
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
20
22
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
21
23
|
export default _default;
|