pxd 0.0.52 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/components/active-graph/index.d.vue.ts +0 -2
- package/dist/components/active-graph/index.vue +35 -37
- package/dist/components/avatar/index.d.vue.ts +2 -2
- package/dist/components/avatar/index.vue +17 -16
- package/dist/components/avatar-group/index.d.vue.ts +1 -1
- package/dist/components/avatar-group/index.vue +4 -1
- package/dist/components/badge/cn.d.ts +90 -0
- package/dist/components/badge/cn.js +44 -0
- package/dist/components/badge/index.d.vue.ts +5 -33
- package/dist/components/badge/index.vue +10 -56
- package/dist/components/book/index.vue +90 -17
- package/dist/components/browser/index.vue +21 -6
- package/dist/components/button/cn.d.ts +121 -0
- package/dist/components/button/cn.js +55 -0
- package/dist/components/button/index.d.vue.ts +8 -14
- package/dist/components/button/index.vue +22 -74
- package/dist/components/carousel-group/index.d.vue.ts +1 -1
- package/dist/components/carousel-group/index.vue +32 -28
- package/dist/components/checkbox/cn.d.ts +67 -0
- package/dist/components/checkbox/cn.js +31 -0
- package/dist/components/checkbox/index.vue +9 -19
- package/dist/components/chip/cn.d.ts +49 -0
- package/dist/components/chip/cn.js +26 -0
- package/dist/components/chip/index.vue +13 -21
- package/dist/components/choicebox/index.vue +1 -1
- package/dist/components/choicebox-group/index.vue +6 -3
- package/dist/components/collapse/index.vue +7 -1
- package/dist/components/collapse-group/index.vue +7 -7
- package/dist/components/command-menu/index.vue +9 -8
- package/dist/components/command-menu-group/index.vue +4 -1
- package/dist/components/config-provider/index.d.vue.ts +1 -0
- package/dist/components/config-provider/index.vue +2 -1
- package/dist/components/countdown/index.vue +2 -10
- package/dist/components/dash-line/index.vue +22 -16
- package/dist/components/description/index.vue +4 -2
- package/dist/components/drawer/index.vue +19 -11
- package/dist/components/empty-state/index.vue +3 -1
- package/dist/components/error/cn.d.ts +22 -0
- package/dist/components/error/cn.js +15 -0
- package/dist/components/error/index.vue +13 -14
- package/dist/components/fader/index.vue +30 -14
- package/dist/components/gauge/index.vue +6 -6
- package/dist/components/grid/index.vue +16 -12
- package/dist/components/grid-item/index.vue +4 -4
- package/dist/components/hold-button/index.vue +19 -13
- package/dist/components/input/cn.d.ts +73 -0
- package/dist/components/input/cn.js +36 -0
- package/dist/components/input/index.d.vue.ts +14 -16
- package/dist/components/input/index.vue +74 -101
- package/dist/components/intersection-observer/index.vue +7 -3
- package/dist/components/kbd/index.vue +2 -2
- package/dist/components/link-button/index.d.vue.ts +8 -8
- package/dist/components/link-button/index.vue +17 -25
- package/dist/components/list/index.d.vue.ts +0 -1
- package/dist/components/list/index.vue +58 -57
- package/dist/components/list-item/cn.d.ts +22 -0
- package/dist/components/list-item/cn.js +15 -0
- package/dist/components/list-item/index.d.vue.ts +3 -3
- package/dist/components/list-item/index.vue +14 -25
- package/dist/components/loading-bar/cn.d.ts +70 -0
- package/dist/components/loading-bar/cn.js +32 -0
- package/dist/components/loading-bar/index.d.vue.ts +2 -0
- package/dist/components/loading-bar/index.vue +68 -61
- package/dist/components/loading-dots/index.vue +12 -4
- package/dist/components/menu/index.d.vue.ts +2 -2
- package/dist/components/menu/index.vue +4 -4
- package/dist/components/message/index.vue +82 -48
- package/dist/components/message-item/index.vue +7 -2
- package/dist/components/modal/index.vue +20 -12
- package/dist/components/more-button/index.d.vue.ts +1 -3
- package/dist/components/more-button/index.vue +7 -17
- package/dist/components/note/cn.d.ts +121 -0
- package/dist/components/note/cn.js +66 -0
- package/dist/components/note/index.d.vue.ts +3 -39
- package/dist/components/note/index.vue +18 -37
- package/dist/components/number-input/index.d.vue.ts +19 -10
- package/dist/components/number-input/index.vue +121 -75
- package/dist/components/overlay/index.vue +4 -20
- package/dist/components/pagination/index.vue +25 -8
- package/dist/components/pin-input/cn.d.ts +46 -0
- package/dist/components/pin-input/cn.js +25 -0
- package/dist/components/pin-input/index.vue +11 -20
- package/dist/components/placeholder/index.vue +11 -4
- package/dist/components/popover/index.d.vue.ts +4 -3
- package/dist/components/popover/index.vue +107 -54
- package/dist/components/progress/cn.d.ts +19 -0
- package/dist/components/progress/cn.js +14 -0
- package/dist/components/progress/index.d.vue.ts +1 -1
- package/dist/components/progress/index.vue +21 -14
- package/dist/components/radio/cn.d.ts +46 -0
- package/dist/components/radio/cn.js +42 -0
- package/dist/components/radio/index.vue +11 -18
- package/dist/components/resizable/index.vue +8 -2
- package/dist/components/resizable-handle/index.vue +1 -0
- package/dist/components/resizable-panel/index.vue +12 -11
- package/dist/components/skeleton/cn.d.ts +43 -0
- package/dist/components/skeleton/cn.js +24 -0
- package/dist/components/skeleton/index.d.vue.ts +4 -3
- package/dist/components/skeleton/index.vue +11 -20
- package/dist/components/slider/index.d.vue.ts +1 -1
- package/dist/components/slider/index.vue +14 -12
- package/dist/components/snippet/cn.d.ts +52 -0
- package/dist/components/snippet/cn.js +27 -0
- package/dist/components/snippet/index.vue +21 -29
- package/dist/components/spinner/index.vue +3 -1
- package/dist/components/stack/cn.d.ts +70 -0
- package/dist/components/stack/cn.js +33 -0
- package/dist/components/stack/index.d.vue.ts +2 -2
- package/dist/components/stack/index.vue +16 -31
- package/dist/components/status-dot/index.vue +5 -1
- package/dist/components/switch/cn.d.ts +16 -0
- package/dist/components/switch/cn.js +13 -0
- package/dist/components/switch/index.vue +5 -11
- package/dist/components/switch-group/index.vue +7 -4
- package/dist/components/text/cn.d.ts +67 -0
- package/dist/components/text/cn.js +34 -0
- package/dist/components/text/index.d.vue.ts +1 -1
- package/dist/components/text/index.vue +16 -25
- package/dist/components/textarea/cn.d.ts +58 -0
- package/dist/components/textarea/cn.js +30 -0
- package/dist/components/textarea/index.d.vue.ts +2 -0
- package/dist/components/textarea/index.vue +17 -24
- package/dist/components/theme-switcher/index.vue +6 -3
- package/dist/components/time-picker/index.d.vue.ts +2 -2
- package/dist/components/time-picker/index.vue +45 -25
- package/dist/components/toggle/index.vue +10 -6
- package/dist/components/tooltip/index.vue +3 -3
- package/dist/components/virtual-list/index.vue +1 -7
- package/dist/composables/use-browser-observer.d.ts +1 -1
- package/dist/composables/use-browser-observer.js +19 -15
- package/dist/composables/use-config-provider-context.d.ts +1 -0
- package/dist/composables/use-config-provider-context.js +5 -10
- package/dist/composables/use-countdown.js +1 -3
- package/dist/composables/use-deferred-value.js +1 -5
- package/dist/composables/use-delay-change.js +1 -4
- package/dist/composables/use-delay-destroy.js +1 -5
- package/dist/composables/use-loading-bar.d.ts +6 -14
- package/dist/composables/use-loading-bar.js +3 -14
- package/dist/composables/use-message.d.ts +9 -3
- package/dist/composables/use-message.js +9 -9
- package/dist/composables/use-model-value.d.ts +1 -0
- package/dist/composables/use-model-value.js +4 -2
- package/dist/composables/use-outside-click.js +12 -8
- package/dist/composables/use-pointer-gesture.js +5 -1
- package/dist/composables/use-toggle-value.js +1 -4
- package/dist/composables/use-virtual-list.js +14 -7
- package/dist/contexts/avatar.js +4 -4
- package/dist/contexts/carousel.js +1 -4
- package/dist/contexts/checkbox.js +1 -4
- package/dist/contexts/choicebox.js +2 -8
- package/dist/contexts/collapse.js +1 -4
- package/dist/contexts/list.js +5 -8
- package/dist/contexts/radio.js +4 -4
- package/dist/contexts/resizable.js +1 -4
- package/dist/contexts/switch.js +2 -8
- package/dist/index.d.ts +1 -0
- package/dist/styles/source.css +106 -59
- package/dist/styles/styles.css +1 -1
- package/dist/styles/tw.css +106 -59
- package/dist/types/components/avatar.d.ts +2 -2
- package/dist/types/components/button.d.ts +11 -4
- package/dist/types/components/index.d.ts +12 -0
- package/dist/types/components/input.d.ts +4 -5
- package/dist/types/components/list.d.ts +1 -1
- package/dist/types/components/switch.d.ts +1 -1
- package/dist/types/shared/props.d.ts +6 -4
- package/dist/types/shared/utils.d.ts +3 -1
- package/dist/utils/context.d.ts +2 -8
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.js +1 -5
- package/dist/utils/event.js +6 -18
- package/dist/utils/format.d.ts +1 -1
- package/dist/utils/format.js +1 -1
- package/dist/utils/is.d.ts +0 -1
- package/dist/utils/is.js +3 -2
- package/dist/utils/responsive.js +7 -4
- package/dist/utils/throttle.js +4 -2
- package/package.json +45 -43
- package/dist/components/_internal/fragment-container.vue.d.ts +0 -13
- package/dist/components/active-graph/index.vue.d.ts +0 -51
- package/dist/components/avatar/index.vue.d.ts +0 -34
- package/dist/components/avatar-group/index.vue.d.ts +0 -8
- package/dist/components/backtop/index.vue.d.ts +0 -21
- package/dist/components/badge/index.vue.d.ts +0 -52
- package/dist/components/book/index.vue.d.ts +0 -28
- package/dist/components/browser/index.vue.d.ts +0 -16
- package/dist/components/button/index.vue.d.ts +0 -29
- package/dist/components/carousel/index.vue.d.ts +0 -13
- package/dist/components/carousel-group/index.vue.d.ts +0 -35
- package/dist/components/checkbox/index.vue.d.ts +0 -26
- package/dist/components/checkbox-group/index.vue.d.ts +0 -28
- package/dist/components/chip/index.vue.d.ts +0 -24
- package/dist/components/choicebox/index.vue.d.ts +0 -16
- package/dist/components/choicebox-group/index.vue.d.ts +0 -24
- package/dist/components/collapse/index.vue.d.ts +0 -22
- package/dist/components/collapse-group/index.vue.d.ts +0 -20
- package/dist/components/command-menu/index.vue.d.ts +0 -42
- package/dist/components/command-menu-group/index.vue.d.ts +0 -17
- package/dist/components/command-menu-item/index.vue.d.ts +0 -13
- package/dist/components/config-provider/index.vue.d.ts +0 -22
- package/dist/components/countdown/index.vue.d.ts +0 -51
- package/dist/components/dash-line/index.vue.d.ts +0 -13
- package/dist/components/description/index.vue.d.ts +0 -20
- package/dist/components/drawer/index.vue.d.ts +0 -60
- package/dist/components/empty-state/index.vue.d.ts +0 -23
- package/dist/components/error/index.vue.d.ts +0 -22
- package/dist/components/fader/index.vue.d.ts +0 -12
- package/dist/components/gauge/index.vue.d.ts +0 -14
- package/dist/components/grid/index.vue.d.ts +0 -19
- package/dist/components/grid-item/index.vue.d.ts +0 -18
- package/dist/components/hold-button/index.vue.d.ts +0 -42
- package/dist/components/input/index.vue.d.ts +0 -55
- package/dist/components/intersection-observer/index.vue.d.ts +0 -39
- package/dist/components/kbd/index.vue.d.ts +0 -24
- package/dist/components/label/index.vue.d.ts +0 -13
- package/dist/components/link-button/index.vue.d.ts +0 -33
- package/dist/components/list/index.vue.d.ts +0 -44
- package/dist/components/list-item/index.vue.d.ts +0 -29
- package/dist/components/loading-bar/index.vue.d.ts +0 -15
- package/dist/components/loading-dots/index.vue.d.ts +0 -15
- package/dist/components/material/index.vue.d.ts +0 -18
- package/dist/components/menu/index.vue.d.ts +0 -33
- package/dist/components/message/index.vue.d.ts +0 -176
- package/dist/components/message-item/index.vue.d.ts +0 -15
- package/dist/components/modal/index.vue.d.ts +0 -58
- package/dist/components/more-button/index.vue.d.ts +0 -20
- package/dist/components/noise-background/index.vue.d.ts +0 -19
- package/dist/components/note/index.vue.d.ts +0 -64
- package/dist/components/number-input/index.vue.d.ts +0 -39
- package/dist/components/overlay/index.vue.d.ts +0 -35
- package/dist/components/pagination/index.vue.d.ts +0 -21
- package/dist/components/pin-input/index.vue.d.ts +0 -28
- package/dist/components/placeholder/index.vue.d.ts +0 -18
- package/dist/components/popover/index.vue.d.ts +0 -73
- package/dist/components/progress/index.vue.d.ts +0 -34
- package/dist/components/radio/index.vue.d.ts +0 -20
- package/dist/components/radio-group/index.vue.d.ts +0 -22
- package/dist/components/resizable/index.vue.d.ts +0 -19
- package/dist/components/resizable-handle/index.vue.d.ts +0 -3
- package/dist/components/resizable-panel/index.vue.d.ts +0 -20
- package/dist/components/scrollable/index.vue.d.ts +0 -0
- package/dist/components/skeleton/index.vue.d.ts +0 -26
- package/dist/components/slider/index.vue.d.ts +0 -26
- package/dist/components/snippet/index.vue.d.ts +0 -18
- package/dist/components/spinner/index.vue.d.ts +0 -3
- package/dist/components/stack/index.vue.d.ts +0 -30
- package/dist/components/status-dot/index.vue.d.ts +0 -11
- package/dist/components/switch/index.vue.d.ts +0 -20
- package/dist/components/switch-group/index.vue.d.ts +0 -23
- package/dist/components/teleport/index.vue.d.ts +0 -21
- package/dist/components/text/index.vue.d.ts +0 -26
- package/dist/components/textarea/index.vue.d.ts +0 -28
- package/dist/components/theme-switcher/index.vue.d.ts +0 -8
- package/dist/components/time-picker/index.vue.d.ts +0 -35
- package/dist/components/toggle/index.vue.d.ts +0 -41
- package/dist/components/tooltip/index.vue.d.ts +0 -32
- package/dist/components/virtual-list/index.vue.d.ts +0 -24
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
3
3
|
import { useDocumentHidden } from "../../composables/use-document-hidden";
|
|
4
|
-
import {
|
|
5
|
-
CLEAR_MESSAGES_EVENT_NAME,
|
|
6
|
-
CREATE_MESSAGE_EVENT_NAME,
|
|
7
|
-
REMOVE_MESSAGE_EVENT_NAME
|
|
8
|
-
} from "../../composables/use-message";
|
|
4
|
+
import { UPDATE_MESSAGE_EVENT_NAME } from "../../composables/use-message";
|
|
9
5
|
import { cachedOff, cachedOn } from "../../utils/event";
|
|
10
6
|
import { getCssUnitValue } from "../../utils/format";
|
|
11
7
|
import { isServer } from "../../utils/is";
|
|
@@ -186,7 +182,7 @@ function handlePromiseMessage(message) {
|
|
|
186
182
|
}
|
|
187
183
|
});
|
|
188
184
|
}
|
|
189
|
-
function
|
|
185
|
+
function handleCreateMessage(data) {
|
|
190
186
|
if (!data || data.group !== props.group) {
|
|
191
187
|
return;
|
|
192
188
|
}
|
|
@@ -199,17 +195,34 @@ function onCreateMessage({ detail: data }) {
|
|
|
199
195
|
setAutoCloseTimer(message);
|
|
200
196
|
}
|
|
201
197
|
}
|
|
202
|
-
function
|
|
203
|
-
if (!data || !data.id
|
|
198
|
+
function handleRemoveMessage(data) {
|
|
199
|
+
if (!data || !data.id) {
|
|
204
200
|
return;
|
|
205
201
|
}
|
|
206
202
|
closeMessageById(data.id);
|
|
207
203
|
}
|
|
208
|
-
function
|
|
209
|
-
|
|
204
|
+
function handleClearMessages() {
|
|
205
|
+
clearMessage();
|
|
206
|
+
}
|
|
207
|
+
function onUpdateMessage({ detail }) {
|
|
208
|
+
if (detail.group !== props.group) {
|
|
210
209
|
return;
|
|
211
210
|
}
|
|
212
|
-
|
|
211
|
+
switch (detail.type) {
|
|
212
|
+
case "create":
|
|
213
|
+
if (detail.data) {
|
|
214
|
+
handleCreateMessage(detail.data);
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
case "remove":
|
|
218
|
+
if (detail.data) {
|
|
219
|
+
handleRemoveMessage(detail.data);
|
|
220
|
+
}
|
|
221
|
+
break;
|
|
222
|
+
case "clear":
|
|
223
|
+
handleClearMessages();
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
213
226
|
}
|
|
214
227
|
function pauseAllMessages() {
|
|
215
228
|
groupMessages.value.forEach(pauseMessage);
|
|
@@ -217,16 +230,38 @@ function pauseAllMessages() {
|
|
|
217
230
|
function resumeAllMessages() {
|
|
218
231
|
groupMessages.value.forEach(resumeMessage);
|
|
219
232
|
}
|
|
233
|
+
const TRANSITION_LOCK_MS = 250;
|
|
234
|
+
const LEAVE_DEBOUNCE_MS = 200;
|
|
235
|
+
let leaveTimeoutId;
|
|
236
|
+
let isTransitioning = false;
|
|
220
237
|
function onPointerEnter() {
|
|
238
|
+
clearTimeout(leaveTimeoutId);
|
|
239
|
+
if (groupExpand.value || isTransitioning) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
isTransitioning = true;
|
|
221
243
|
groupExpand.value = true;
|
|
222
244
|
pauseAllMessages();
|
|
245
|
+
setTimeout(() => {
|
|
246
|
+
isTransitioning = false;
|
|
247
|
+
}, TRANSITION_LOCK_MS);
|
|
223
248
|
}
|
|
224
249
|
function onPointerLeave() {
|
|
225
|
-
|
|
226
|
-
if (
|
|
250
|
+
clearTimeout(leaveTimeoutId);
|
|
251
|
+
if (isTransitioning) {
|
|
227
252
|
return;
|
|
228
253
|
}
|
|
229
|
-
|
|
254
|
+
leaveTimeoutId = setTimeout(() => {
|
|
255
|
+
resumeAllMessages();
|
|
256
|
+
if (props.expand) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
isTransitioning = true;
|
|
260
|
+
groupExpand.value = false;
|
|
261
|
+
setTimeout(() => {
|
|
262
|
+
isTransitioning = false;
|
|
263
|
+
}, TRANSITION_LOCK_MS);
|
|
264
|
+
}, LEAVE_DEBOUNCE_MS);
|
|
230
265
|
}
|
|
231
266
|
watch(
|
|
232
267
|
() => props.expand,
|
|
@@ -239,15 +274,11 @@ onMounted(() => {
|
|
|
239
274
|
if (isServer()) {
|
|
240
275
|
return;
|
|
241
276
|
}
|
|
242
|
-
cachedOn(window,
|
|
243
|
-
cachedOn(window, CREATE_MESSAGE_EVENT_NAME, onCreateMessage);
|
|
244
|
-
cachedOn(window, REMOVE_MESSAGE_EVENT_NAME, onRemoveMessage);
|
|
277
|
+
cachedOn(window, UPDATE_MESSAGE_EVENT_NAME, onUpdateMessage);
|
|
245
278
|
});
|
|
246
279
|
onBeforeUnmount(() => {
|
|
247
280
|
clearMessage();
|
|
248
|
-
cachedOff(window,
|
|
249
|
-
cachedOff(window, CREATE_MESSAGE_EVENT_NAME, onCreateMessage);
|
|
250
|
-
cachedOff(window, REMOVE_MESSAGE_EVENT_NAME, onRemoveMessage);
|
|
281
|
+
cachedOff(window, UPDATE_MESSAGE_EVENT_NAME, onUpdateMessage);
|
|
251
282
|
});
|
|
252
283
|
defineExpose({
|
|
253
284
|
messages: groupMessages,
|
|
@@ -273,7 +304,7 @@ defineExpose({
|
|
|
273
304
|
appear
|
|
274
305
|
tag="ol"
|
|
275
306
|
name="pxd-transition-message"
|
|
276
|
-
class="pxd-message--group min-w-16 flex h-auto w-full"
|
|
307
|
+
class="pxd-message--group min-w-16 p-0 m-0 flex h-auto w-full"
|
|
277
308
|
:class="{ 'gap-3': groupExpand }"
|
|
278
309
|
@pointerenter="onPointerEnter"
|
|
279
310
|
@pointerleave="onPointerLeave"
|
|
@@ -300,24 +331,15 @@ defineExpose({
|
|
|
300
331
|
max-width: 100vw;
|
|
301
332
|
align-items: center;
|
|
302
333
|
flex-direction: column;
|
|
303
|
-
|
|
304
|
-
&:not(:empty)::after {
|
|
305
|
-
content: '';
|
|
306
|
-
position: absolute;
|
|
307
|
-
left: -10px;
|
|
308
|
-
z-index: 0;
|
|
309
|
-
width: calc(100% + 20px);
|
|
310
|
-
height: var(--message-placeholder-height);
|
|
311
|
-
}
|
|
312
334
|
}
|
|
313
335
|
|
|
314
|
-
&[data-position^=
|
|
336
|
+
&[data-position^='top'] {
|
|
315
337
|
--item-offset: 10px;
|
|
316
338
|
--starting-offset: -100%;
|
|
317
339
|
top: 1rem;
|
|
318
340
|
}
|
|
319
341
|
|
|
320
|
-
&[data-position^=
|
|
342
|
+
&[data-position^='bottom'] {
|
|
321
343
|
--item-offset: -10px;
|
|
322
344
|
--starting-offset: 100%;
|
|
323
345
|
bottom: 1rem;
|
|
@@ -327,15 +349,15 @@ defineExpose({
|
|
|
327
349
|
}
|
|
328
350
|
}
|
|
329
351
|
|
|
330
|
-
&[data-position=
|
|
331
|
-
&[data-position=
|
|
352
|
+
&[data-position='top'],
|
|
353
|
+
&[data-position='bottom'] {
|
|
332
354
|
left: 50%;
|
|
333
355
|
justify-content: center;
|
|
334
356
|
transform: translateX(-50%);
|
|
335
357
|
}
|
|
336
358
|
|
|
337
|
-
&[data-position=
|
|
338
|
-
&[data-position=
|
|
359
|
+
&[data-position='top-start'],
|
|
360
|
+
&[data-position='bottom-start'] {
|
|
339
361
|
left: 1rem;
|
|
340
362
|
justify-content: flex-start;
|
|
341
363
|
|
|
@@ -344,8 +366,8 @@ defineExpose({
|
|
|
344
366
|
}
|
|
345
367
|
}
|
|
346
368
|
|
|
347
|
-
&[data-position=
|
|
348
|
-
&[data-position=
|
|
369
|
+
&[data-position='top-end'],
|
|
370
|
+
&[data-position='bottom-end'] {
|
|
349
371
|
right: 1rem;
|
|
350
372
|
justify-content: flex-end;
|
|
351
373
|
|
|
@@ -357,9 +379,19 @@ defineExpose({
|
|
|
357
379
|
.pxd-message--item {
|
|
358
380
|
--message-item-scale: var(--message-item-index) * 0.05 + 1;
|
|
359
381
|
--message-item-transition: transform, opacity, height;
|
|
382
|
+
|
|
383
|
+
&::after {
|
|
384
|
+
content: '';
|
|
385
|
+
position: absolute;
|
|
386
|
+
right: 0;
|
|
387
|
+
left: 0;
|
|
388
|
+
top: -18px;
|
|
389
|
+
height: 24px;
|
|
390
|
+
z-index: -1;
|
|
391
|
+
}
|
|
360
392
|
}
|
|
361
393
|
|
|
362
|
-
&[data-expand=
|
|
394
|
+
&[data-expand='true'] {
|
|
363
395
|
.pxd-message--group {
|
|
364
396
|
--message-placeholder-height: calc(var(--message-front-height) * (var(--message-items) + 1));
|
|
365
397
|
}
|
|
@@ -371,20 +403,22 @@ defineExpose({
|
|
|
371
403
|
}
|
|
372
404
|
}
|
|
373
405
|
|
|
374
|
-
&[data-expand=
|
|
406
|
+
&[data-expand='false'] {
|
|
375
407
|
.pxd-message--group {
|
|
376
408
|
--message-placeholder-height: calc(var(--message-front-height) + var(--message-items) * 12px);
|
|
377
409
|
}
|
|
378
410
|
|
|
379
411
|
.pxd-message--item {
|
|
380
|
-
--message-item-transform: translateZ(0)
|
|
412
|
+
--message-item-transform: translateZ(0)
|
|
413
|
+
translateY(calc(var(--item-offset) * var(--message-item-index)))
|
|
414
|
+
scale(calc(-1 * var(--message-item-scale)));
|
|
381
415
|
position: absolute;
|
|
382
416
|
|
|
383
|
-
&[data-front=
|
|
417
|
+
&[data-front='false'] {
|
|
384
418
|
height: var(--message-front-height);
|
|
385
419
|
|
|
386
420
|
& > * {
|
|
387
|
-
transition: opacity
|
|
421
|
+
transition: opacity 0.1s ease-out;
|
|
388
422
|
opacity: 0;
|
|
389
423
|
}
|
|
390
424
|
}
|
|
@@ -411,20 +445,20 @@ defineExpose({
|
|
|
411
445
|
|
|
412
446
|
.pxd-message--icon {
|
|
413
447
|
&.info {
|
|
414
|
-
color: var(--color-gray-600)
|
|
448
|
+
color: var(--color-gray-600);
|
|
415
449
|
}
|
|
416
450
|
&.error {
|
|
417
|
-
color: var(--color-red-700)
|
|
451
|
+
color: var(--color-red-700);
|
|
418
452
|
}
|
|
419
453
|
&.loading {
|
|
420
454
|
animation: spin 1s linear infinite;
|
|
421
|
-
color: var(--color-blue-700)
|
|
455
|
+
color: var(--color-blue-700);
|
|
422
456
|
}
|
|
423
457
|
&.warning {
|
|
424
|
-
color: var(--color-amber-700)
|
|
458
|
+
color: var(--color-amber-700);
|
|
425
459
|
}
|
|
426
460
|
&.success {
|
|
427
|
-
color: var(--color-green-700)
|
|
461
|
+
color: var(--color-green-700);
|
|
428
462
|
}
|
|
429
463
|
}
|
|
430
464
|
}
|
|
@@ -31,7 +31,7 @@ const computedStyle = computed(() => {
|
|
|
31
31
|
return {
|
|
32
32
|
"--message-item-index": index,
|
|
33
33
|
"z-index": max - index,
|
|
34
|
-
|
|
34
|
+
opacity: isVisible ? 1 : 0,
|
|
35
35
|
"pointer-events": isVisible ? "auto" : "none"
|
|
36
36
|
};
|
|
37
37
|
});
|
|
@@ -67,7 +67,12 @@ onMounted(() => {
|
|
|
67
67
|
class="pxd-message--item px-3 py-2 text-sm flex w-full max-w-full shrink-0 transform-(--message-item-transform) rounded-lg bg-background-100 break-all whitespace-pre-wrap shadow-border-modal outline-none motion-safe:transition-(--message-item-transition)"
|
|
68
68
|
:class="[itemData.class, { 'pr-9': itemData.closeable }]"
|
|
69
69
|
>
|
|
70
|
-
<Component
|
|
70
|
+
<Component
|
|
71
|
+
:is="TYPE_ICONS[itemData.type]"
|
|
72
|
+
v-if="itemData.type"
|
|
73
|
+
class="pxd-message--icon mr-2 size-4 h-lh shrink-0"
|
|
74
|
+
:class="itemData.type"
|
|
75
|
+
/>
|
|
71
76
|
|
|
72
77
|
<span v-if="typeof itemData.message === 'string'" v-html="itemData.message" />
|
|
73
78
|
<Component :is="itemData.message" v-else :key="itemData.id" />
|
|
@@ -51,14 +51,17 @@ function onOverlayClick(ev) {
|
|
|
51
51
|
}
|
|
52
52
|
closeOverlayIfNeed();
|
|
53
53
|
}
|
|
54
|
-
watch(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
emits("
|
|
58
|
-
|
|
54
|
+
watch(
|
|
55
|
+
() => isVisible.value,
|
|
56
|
+
(visible) => {
|
|
57
|
+
emits("visible-change", visible);
|
|
58
|
+
if (visible) {
|
|
59
|
+
emits("show");
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
emits("hide");
|
|
59
63
|
}
|
|
60
|
-
|
|
61
|
-
});
|
|
64
|
+
);
|
|
62
65
|
</script>
|
|
63
66
|
|
|
64
67
|
<template>
|
|
@@ -76,17 +79,22 @@ watch(() => isVisible.value, (visible) => {
|
|
|
76
79
|
aria-modal="true"
|
|
77
80
|
role="dialog"
|
|
78
81
|
tabindex="-1"
|
|
79
|
-
class="pxd-modal group/modal left-0 translate-z-0 sm:top-1/2 sm:left-1/2 sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-xl sm:[--o:0] sm:[--t:scale(0.98)] sm:w-[var(--modal-width,540px)] pointer-events-auto fixed z-10 flex w-full max-w-full flex-col overflow-hidden rounded-t-lg bg-background-100 shadow-border-modal outline-none
|
|
82
|
+
class="pxd-modal group/modal left-0 translate-z-0 sm:top-1/2 sm:left-1/2 sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-xl sm:[--o:0] sm:[--t:scale(0.98)] sm:w-[var(--modal-width,540px)] max-sm:bottom-0 pointer-events-auto fixed z-10 flex w-full max-w-full flex-col overflow-hidden rounded-t-lg bg-background-100 shadow-border-modal outline-none motion-safe:transition-all dark:bg-background-200"
|
|
80
83
|
:class="wrapperClass"
|
|
81
84
|
:style="computedStyle"
|
|
82
85
|
v-bind="$attrs"
|
|
83
86
|
>
|
|
84
87
|
<header
|
|
85
|
-
class="pxd-modal--header px-6 pt-4 sm:pt-6 relative shrink-0
|
|
86
|
-
:class="{
|
|
88
|
+
class="pxd-modal--header px-6 pt-4 sm:pt-6 empty:py-3 relative shrink-0"
|
|
89
|
+
:class="{
|
|
90
|
+
'pb-4 sm:pb-6 border-b bg-background-200 dark:bg-background-100': headerStylize
|
|
91
|
+
}"
|
|
87
92
|
>
|
|
88
93
|
<slot name="header">
|
|
89
|
-
<h3
|
|
94
|
+
<h3
|
|
95
|
+
v-if="$slots.title || title"
|
|
96
|
+
class="text-lg sm:text-xl font-semibold tracking-tight m-0"
|
|
97
|
+
>
|
|
90
98
|
<slot name="title">
|
|
91
99
|
{{ title }}
|
|
92
100
|
</slot>
|
|
@@ -101,7 +109,7 @@ watch(() => isVisible.value, (visible) => {
|
|
|
101
109
|
</header>
|
|
102
110
|
|
|
103
111
|
<div
|
|
104
|
-
class="pxd-modal--content px-6 py-4 sm:py-6 h-full flex-1 overflow-auto
|
|
112
|
+
class="pxd-modal--content px-6 py-4 sm:py-6 empty:py-3 h-full flex-1 overflow-auto"
|
|
105
113
|
:class="contentClass"
|
|
106
114
|
>
|
|
107
115
|
<slot />
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
interface Props extends ButtonProps {
|
|
1
|
+
interface Props {
|
|
3
2
|
moreText?: string;
|
|
4
3
|
lessText?: string;
|
|
5
4
|
modelValue?: boolean;
|
|
@@ -11,7 +10,6 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
11
10
|
onChange?: ((args_0: NonNullable<boolean | undefined>) => any) | undefined;
|
|
12
11
|
"onUpdate:modelValue"?: ((args_0: NonNullable<boolean | undefined>) => any) | undefined;
|
|
13
12
|
}>, {
|
|
14
|
-
shape: "square" | "rounded";
|
|
15
13
|
modelValue: boolean;
|
|
16
14
|
moreText: string;
|
|
17
15
|
lessText: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import ChevronDownIcon from "@gdsicon/vue/chevron-down";
|
|
3
|
-
import { computed } from "vue";
|
|
4
3
|
import { useModelValue } from "../../composables/use-model-value";
|
|
5
4
|
import PButton from "../button/index.vue";
|
|
6
5
|
defineOptions({
|
|
7
6
|
name: "PMoreButton",
|
|
7
|
+
inheritAttrs: false,
|
|
8
8
|
model: {
|
|
9
9
|
prop: "modelValue",
|
|
10
10
|
event: "update:modelValue"
|
|
@@ -13,23 +13,10 @@ defineOptions({
|
|
|
13
13
|
const props = defineProps({
|
|
14
14
|
moreText: { type: String, required: false, default: "Show More" },
|
|
15
15
|
lessText: { type: String, required: false, default: "Show Less" },
|
|
16
|
-
modelValue: { type: Boolean, required: false, default: false }
|
|
17
|
-
as: { type: null, required: false },
|
|
18
|
-
variant: { type: String, required: false },
|
|
19
|
-
size: { type: String, required: false },
|
|
20
|
-
shape: { type: String, required: false, default: "rounded" },
|
|
21
|
-
align: { type: String, required: false },
|
|
22
|
-
icon: { type: Boolean, required: false },
|
|
23
|
-
block: { type: Boolean, required: false },
|
|
24
|
-
loading: { type: Boolean, required: false },
|
|
25
|
-
disabled: { type: Boolean, required: false }
|
|
16
|
+
modelValue: { type: Boolean, required: false, default: false }
|
|
26
17
|
});
|
|
27
18
|
const emits = defineEmits(["change", "update:modelValue"]);
|
|
28
19
|
const isExpanded = useModelValue(props, emits);
|
|
29
|
-
const buttonProps = computed(() => {
|
|
30
|
-
const { moreText, lessText, modelValue, ...rest } = props;
|
|
31
|
-
return rest;
|
|
32
|
-
});
|
|
33
20
|
function onToggleExpand() {
|
|
34
21
|
isExpanded.value = !isExpanded.value;
|
|
35
22
|
}
|
|
@@ -37,11 +24,14 @@ function onToggleExpand() {
|
|
|
37
24
|
|
|
38
25
|
<template>
|
|
39
26
|
<div class="pxd-more-button px-4 mt-4 flex w-full items-center">
|
|
40
|
-
<PButton class="relative z-1" v-bind="
|
|
27
|
+
<PButton class="relative z-1" shape="rounded" v-bind="$attrs" @click="onToggleExpand">
|
|
41
28
|
{{ isExpanded ? lessText : moreText }}
|
|
42
29
|
|
|
43
30
|
<template #suffix>
|
|
44
|
-
<ChevronDownIcon
|
|
31
|
+
<ChevronDownIcon
|
|
32
|
+
class="-ml-0.5 motion-safe:transition-transform motion-safe:duration-200"
|
|
33
|
+
:class="{ 'rotate-180': isExpanded }"
|
|
34
|
+
/>
|
|
45
35
|
</template>
|
|
46
36
|
</PButton>
|
|
47
37
|
</div>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export declare const noteVariant: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
size: {
|
|
3
|
+
sm: string;
|
|
4
|
+
md: string;
|
|
5
|
+
lg: string;
|
|
6
|
+
};
|
|
7
|
+
variant: {
|
|
8
|
+
success: {
|
|
9
|
+
base: string;
|
|
10
|
+
fill: string;
|
|
11
|
+
};
|
|
12
|
+
error: {
|
|
13
|
+
base: string;
|
|
14
|
+
fill: string;
|
|
15
|
+
};
|
|
16
|
+
warning: {
|
|
17
|
+
base: string;
|
|
18
|
+
fill: string;
|
|
19
|
+
};
|
|
20
|
+
default: {
|
|
21
|
+
base: string;
|
|
22
|
+
fill: string;
|
|
23
|
+
};
|
|
24
|
+
primary: {
|
|
25
|
+
base: string;
|
|
26
|
+
fill: string;
|
|
27
|
+
};
|
|
28
|
+
violet: {
|
|
29
|
+
base: string;
|
|
30
|
+
fill: string;
|
|
31
|
+
};
|
|
32
|
+
cyan: {
|
|
33
|
+
base: string;
|
|
34
|
+
fill: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
fill: {
|
|
38
|
+
true: {};
|
|
39
|
+
false: {};
|
|
40
|
+
};
|
|
41
|
+
}, undefined, "pxd-note gap-2 sm:flex-row sm:items-center flex max-w-full flex-col rounded-md border", {
|
|
42
|
+
size: {
|
|
43
|
+
sm: string;
|
|
44
|
+
md: string;
|
|
45
|
+
lg: string;
|
|
46
|
+
};
|
|
47
|
+
variant: {
|
|
48
|
+
success: {
|
|
49
|
+
base: string;
|
|
50
|
+
fill: string;
|
|
51
|
+
};
|
|
52
|
+
error: {
|
|
53
|
+
base: string;
|
|
54
|
+
fill: string;
|
|
55
|
+
};
|
|
56
|
+
warning: {
|
|
57
|
+
base: string;
|
|
58
|
+
fill: string;
|
|
59
|
+
};
|
|
60
|
+
default: {
|
|
61
|
+
base: string;
|
|
62
|
+
fill: string;
|
|
63
|
+
};
|
|
64
|
+
primary: {
|
|
65
|
+
base: string;
|
|
66
|
+
fill: string;
|
|
67
|
+
};
|
|
68
|
+
violet: {
|
|
69
|
+
base: string;
|
|
70
|
+
fill: string;
|
|
71
|
+
};
|
|
72
|
+
cyan: {
|
|
73
|
+
base: string;
|
|
74
|
+
fill: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
fill: {
|
|
78
|
+
true: {};
|
|
79
|
+
false: {};
|
|
80
|
+
};
|
|
81
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
82
|
+
size: {
|
|
83
|
+
sm: string;
|
|
84
|
+
md: string;
|
|
85
|
+
lg: string;
|
|
86
|
+
};
|
|
87
|
+
variant: {
|
|
88
|
+
success: {
|
|
89
|
+
base: string;
|
|
90
|
+
fill: string;
|
|
91
|
+
};
|
|
92
|
+
error: {
|
|
93
|
+
base: string;
|
|
94
|
+
fill: string;
|
|
95
|
+
};
|
|
96
|
+
warning: {
|
|
97
|
+
base: string;
|
|
98
|
+
fill: string;
|
|
99
|
+
};
|
|
100
|
+
default: {
|
|
101
|
+
base: string;
|
|
102
|
+
fill: string;
|
|
103
|
+
};
|
|
104
|
+
primary: {
|
|
105
|
+
base: string;
|
|
106
|
+
fill: string;
|
|
107
|
+
};
|
|
108
|
+
violet: {
|
|
109
|
+
base: string;
|
|
110
|
+
fill: string;
|
|
111
|
+
};
|
|
112
|
+
cyan: {
|
|
113
|
+
base: string;
|
|
114
|
+
fill: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
fill: {
|
|
118
|
+
true: {};
|
|
119
|
+
false: {};
|
|
120
|
+
};
|
|
121
|
+
}, undefined, "pxd-note gap-2 sm:flex-row sm:items-center flex max-w-full flex-col rounded-md border", unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
export const noteVariant = tv({
|
|
3
|
+
base: "pxd-note gap-2 sm:flex-row sm:items-center flex max-w-full flex-col rounded-md border",
|
|
4
|
+
variants: {
|
|
5
|
+
size: {
|
|
6
|
+
sm: "px-2 py-1.5 text-xs",
|
|
7
|
+
md: "px-3 py-2 text-sm",
|
|
8
|
+
lg: "px-4 py-2.5 text-base"
|
|
9
|
+
},
|
|
10
|
+
variant: {
|
|
11
|
+
success: {
|
|
12
|
+
base: "border-blue-500 text-blue-900",
|
|
13
|
+
fill: "border-blue-100 bg-blue-200 text-blue-900"
|
|
14
|
+
},
|
|
15
|
+
error: {
|
|
16
|
+
base: "border-red-500 text-red-900",
|
|
17
|
+
fill: "border-red-100 bg-red-200 text-red-900"
|
|
18
|
+
},
|
|
19
|
+
warning: {
|
|
20
|
+
base: "border-amber-500 text-amber-900",
|
|
21
|
+
fill: "border-amber-100 bg-amber-200 text-amber-900"
|
|
22
|
+
},
|
|
23
|
+
default: {
|
|
24
|
+
base: "border-input text-gray-900",
|
|
25
|
+
fill: "border-gray-100 bg-gray-200 text-gray-900"
|
|
26
|
+
},
|
|
27
|
+
primary: {
|
|
28
|
+
base: "border-gray-alpha-400 text-primary",
|
|
29
|
+
fill: "border-gray-100 bg-primary text-gray-100"
|
|
30
|
+
},
|
|
31
|
+
violet: {
|
|
32
|
+
base: "text-violet-900 border-violet-400",
|
|
33
|
+
fill: "text-violet-900 bg-violet-200 border-violet-100"
|
|
34
|
+
},
|
|
35
|
+
cyan: {
|
|
36
|
+
base: "border-teal-400 text-teal-900",
|
|
37
|
+
fill: "border-teal-100 bg-teal-200 text-teal-900"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
fill: {
|
|
41
|
+
true: {},
|
|
42
|
+
false: {}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
compoundVariants: [
|
|
46
|
+
{ variant: "success", fill: true, class: "border-blue-100 bg-blue-200 text-blue-900" },
|
|
47
|
+
{ variant: "success", fill: false, class: "border-blue-500 text-blue-900" },
|
|
48
|
+
{ variant: "error", fill: true, class: "border-red-100 bg-red-200 text-red-900" },
|
|
49
|
+
{ variant: "error", fill: false, class: "border-red-500 text-red-900" },
|
|
50
|
+
{ variant: "warning", fill: true, class: "border-amber-100 bg-amber-200 text-amber-900" },
|
|
51
|
+
{ variant: "warning", fill: false, class: "border-amber-500 text-amber-900" },
|
|
52
|
+
{ variant: "default", fill: true, class: "border-gray-100 bg-gray-200 text-gray-900" },
|
|
53
|
+
{ variant: "default", fill: false, class: "border-input text-gray-900" },
|
|
54
|
+
{ variant: "primary", fill: true, class: "border-gray-100 bg-primary text-gray-100" },
|
|
55
|
+
{ variant: "primary", fill: false, class: "border-gray-alpha-400 text-primary" },
|
|
56
|
+
{ variant: "violet", fill: true, class: "text-violet-900 bg-violet-200 border-violet-100" },
|
|
57
|
+
{ variant: "violet", fill: false, class: "text-violet-900 border-violet-400" },
|
|
58
|
+
{ variant: "cyan", fill: true, class: "border-teal-100 bg-teal-200 text-teal-900" },
|
|
59
|
+
{ variant: "cyan", fill: false, class: "border-teal-400 text-teal-900" }
|
|
60
|
+
],
|
|
61
|
+
defaultVariants: {
|
|
62
|
+
size: "md",
|
|
63
|
+
variant: "default",
|
|
64
|
+
fill: false
|
|
65
|
+
}
|
|
66
|
+
});
|
|
@@ -1,47 +1,11 @@
|
|
|
1
1
|
import type { ComponentLabel, ComponentSize } from '../../types/shared';
|
|
2
|
+
import { noteVariant } from './cn';
|
|
2
3
|
interface Props {
|
|
3
|
-
variant?: keyof typeof
|
|
4
|
+
variant?: keyof typeof noteVariant.variants.variant;
|
|
4
5
|
size?: ComponentSize;
|
|
5
6
|
fill?: boolean;
|
|
6
7
|
label?: boolean | ComponentLabel;
|
|
7
8
|
}
|
|
8
|
-
declare const VARIANTS: {
|
|
9
|
-
success: {
|
|
10
|
-
icon: any;
|
|
11
|
-
fill: string;
|
|
12
|
-
basic: string;
|
|
13
|
-
};
|
|
14
|
-
error: {
|
|
15
|
-
icon: any;
|
|
16
|
-
fill: string;
|
|
17
|
-
basic: string;
|
|
18
|
-
};
|
|
19
|
-
warning: {
|
|
20
|
-
icon: any;
|
|
21
|
-
fill: string;
|
|
22
|
-
basic: string;
|
|
23
|
-
};
|
|
24
|
-
default: {
|
|
25
|
-
icon: any;
|
|
26
|
-
fill: string;
|
|
27
|
-
basic: string;
|
|
28
|
-
};
|
|
29
|
-
primary: {
|
|
30
|
-
icon: any;
|
|
31
|
-
fill: string;
|
|
32
|
-
basic: string;
|
|
33
|
-
};
|
|
34
|
-
violet: {
|
|
35
|
-
icon: any;
|
|
36
|
-
fill: string;
|
|
37
|
-
basic: string;
|
|
38
|
-
};
|
|
39
|
-
cyan: {
|
|
40
|
-
icon: any;
|
|
41
|
-
fill: string;
|
|
42
|
-
basic: string;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
9
|
declare var __VLS_1: {}, __VLS_8: {}, __VLS_10: {};
|
|
46
10
|
type __VLS_Slots = {} & {
|
|
47
11
|
label?: (props: typeof __VLS_1) => any;
|
|
@@ -52,7 +16,7 @@ type __VLS_Slots = {} & {
|
|
|
52
16
|
};
|
|
53
17
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
54
18
|
label: boolean | ComponentLabel;
|
|
55
|
-
variant: keyof typeof
|
|
19
|
+
variant: keyof typeof noteVariant.variants.variant;
|
|
56
20
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
57
21
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
58
22
|
declare const _default: typeof __VLS_export;
|