pxd 0.1.4 → 0.1.6
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/_internal/dismiss-container.d.vue.ts +2 -2
- package/dist/components/_internal/dismiss-container.vue +1 -1
- package/dist/components/_internal/mention-editor.d.vue.ts +3 -4
- package/dist/components/_internal/mention-editor.vue +7 -5
- package/dist/components/_internal/tree-node.d.vue.ts +10 -1
- package/dist/components/_internal/tree-node.vue +32 -12
- package/dist/components/active-graph/index.d.vue.ts +1 -1
- package/dist/components/active-graph/index.vue +4 -18
- package/dist/components/active-graph/types.d.ts +1 -1
- package/dist/components/approval-card/index.d.vue.ts +2 -2
- package/dist/components/approval-card/index.vue +8 -4
- package/dist/components/approval-card/types.d.ts +1 -1
- package/dist/components/avatar/index.d.vue.ts +2 -2
- package/dist/components/avatar/index.vue +1 -1
- package/dist/components/badge/index.vue +4 -2
- package/dist/components/badge/types.d.ts +7 -2
- package/dist/components/browser/index.vue +1 -1
- package/dist/components/bubble/index.vue +35 -14
- package/dist/components/bubble/types.d.ts +2 -1
- package/dist/components/bubble-group/index.vue +21 -8
- package/dist/components/bubble-group/types.d.ts +4 -4
- package/dist/components/button/index.d.vue.ts +1 -1
- package/dist/components/button/index.vue +4 -4
- package/dist/components/calendar/index.d.vue.ts +2 -2
- package/dist/components/calendar/index.vue +3 -3
- package/dist/components/calendar/types.d.ts +1 -1
- package/dist/components/checkbox/index.d.vue.ts +2 -2
- package/dist/components/checkbox/index.vue +3 -3
- package/dist/components/checkbox/types.d.ts +1 -1
- package/dist/components/checkbox-group/index.d.vue.ts +2 -2
- package/dist/components/checkbox-group/index.vue +2 -2
- package/dist/components/checkbox-group/types.d.ts +1 -1
- package/dist/components/checkerboard/index.d.vue.ts +3 -1
- package/dist/components/checkerboard/index.vue +13 -2
- package/dist/components/checkerboard/types.d.ts +1 -0
- package/dist/components/choicebox/index.d.vue.ts +2 -2
- package/dist/components/choicebox/index.vue +2 -2
- package/dist/components/choicebox/types.d.ts +1 -1
- package/dist/components/choicebox-item/index.vue +1 -1
- package/dist/components/code-block/index.d.vue.ts +7 -3
- package/dist/components/code-block/index.vue +268 -72
- package/dist/components/code-block/types.d.ts +33 -14
- package/dist/components/collapse/index.d.vue.ts +3 -1
- package/dist/components/collapse/index.vue +34 -38
- package/dist/components/collapse/types.d.ts +3 -1
- package/dist/components/collapse-group/index.vue +3 -3
- package/dist/components/color-selector/index.d.vue.ts +2 -2
- package/dist/components/color-selector/index.vue +2 -2
- package/dist/components/color-selector/types.d.ts +1 -1
- package/dist/components/command-menu/index.d.vue.ts +3 -3
- package/dist/components/command-menu/index.vue +2 -2
- package/dist/components/command-menu/types.d.ts +1 -1
- package/dist/components/confirm-popover/index.d.vue.ts +2 -2
- package/dist/components/confirm-popover/index.vue +10 -15
- package/dist/components/confirm-popover/types.d.ts +6 -7
- package/dist/components/context-usage/index.d.vue.ts +6 -0
- package/dist/components/context-usage/index.vue +120 -0
- package/dist/components/context-usage/types.d.ts +13 -0
- package/dist/components/copy-button/index.vue +17 -9
- package/dist/components/copy-button/types.d.ts +3 -1
- package/dist/components/countdown/index.vue +1 -1
- package/dist/components/date-picker/index.d.vue.ts +2 -2
- package/dist/components/date-picker/index.vue +2 -2
- package/dist/components/date-picker/types.d.ts +1 -1
- package/dist/components/description/index.vue +1 -1
- package/dist/components/description/types.d.ts +3 -1
- package/dist/components/drawer/index.d.vue.ts +5 -5
- package/dist/components/drawer/index.vue +13 -13
- package/dist/components/drawer/types.d.ts +2 -2
- package/dist/components/effort-slider/index.d.vue.ts +2 -2
- package/dist/components/effort-slider/index.vue +63 -17
- package/dist/components/effort-slider/types.d.ts +3 -1
- package/dist/components/ellipsis-text/index.d.vue.ts +3 -3
- package/dist/components/ellipsis-text/index.vue +5 -5
- package/dist/components/ellipsis-text/types.d.ts +4 -2
- package/dist/components/empty-state/index.vue +1 -1
- package/dist/components/empty-state/types.d.ts +3 -1
- package/dist/components/feedback-bar/index.d.vue.ts +4 -4
- package/dist/components/feedback-bar/index.vue +4 -4
- package/dist/components/feedback-bar/types.d.ts +2 -2
- package/dist/components/gauge/index.vue +75 -79
- package/dist/components/gauge/types.d.ts +2 -0
- package/dist/components/hint/index.vue +2 -3
- package/dist/components/hold-button/index.d.vue.ts +4 -4
- package/dist/components/hold-button/index.vue +86 -75
- package/dist/components/hue-text/index.vue +2 -2
- package/dist/components/hue-text/types.d.ts +3 -1
- package/dist/components/image-preview/index.d.vue.ts +2 -0
- package/dist/components/image-preview/index.vue +156 -131
- package/dist/components/image-preview/types.d.ts +18 -18
- package/dist/components/index.d.ts +132 -0
- package/dist/components/index.js +3 -0
- package/dist/components/input/index.d.vue.ts +2 -2
- package/dist/components/input/index.vue +2 -2
- package/dist/components/input/types.d.ts +1 -1
- package/dist/components/kbd/index.vue +1 -1
- package/dist/components/link-button/index.vue +1 -1
- package/dist/components/link-button/types.d.ts +1 -1
- package/dist/components/list/index.d.vue.ts +2 -2
- package/dist/components/list/index.vue +4 -4
- package/dist/components/list/types.d.ts +1 -1
- package/dist/components/list-group/index.vue +1 -1
- package/dist/components/{_internal/loading-mask.d.vue.ts → loading-mask/index.d.vue.ts} +2 -4
- package/dist/components/{_internal/loading-mask.vue → loading-mask/index.vue} +1 -1
- package/dist/components/loading-mask/types.d.ts +3 -0
- package/dist/components/marquee/index.d.vue.ts +1 -1
- package/dist/components/marquee/index.vue +1 -1
- package/dist/components/marquee/types.d.ts +2 -2
- package/dist/components/mention/index.d.vue.ts +3 -3
- package/dist/components/mention/index.vue +2 -2
- package/dist/components/mention/types.d.ts +1 -1
- package/dist/components/menu/index.d.vue.ts +2 -2
- package/dist/components/menu/index.vue +2 -2
- package/dist/components/menu/types.d.ts +1 -1
- package/dist/components/modal/index.d.vue.ts +4 -4
- package/dist/components/modal/index.vue +13 -13
- package/dist/components/modal/types.d.ts +2 -2
- package/dist/components/more-button/index.d.vue.ts +4 -4
- package/dist/components/more-button/index.vue +4 -4
- package/dist/components/more-button/types.d.ts +3 -3
- package/dist/components/note/index.vue +1 -1
- package/dist/components/note/types.d.ts +1 -1
- package/dist/components/number-input/index.d.vue.ts +2 -2
- package/dist/components/number-input/index.vue +2 -2
- package/dist/components/number-input/types.d.ts +1 -1
- package/dist/components/overlay/index.d.vue.ts +2 -2
- package/dist/components/overlay/index.vue +4 -4
- package/dist/components/overlay/types.d.ts +1 -1
- package/dist/components/page-number/index.d.vue.ts +3 -3
- package/dist/components/page-number/index.vue +3 -3
- package/dist/components/page-number/types.d.ts +1 -1
- package/dist/components/pagination/index.vue +2 -2
- package/dist/components/pin-input/index.d.vue.ts +3 -3
- package/dist/components/pin-input/index.vue +3 -3
- package/dist/components/pin-input/types.d.ts +1 -1
- package/dist/components/placeholder/index.vue +3 -3
- package/dist/components/placeholder/types.d.ts +1 -1
- package/dist/components/popover/index.vue +73 -36
- package/dist/components/popover/types.d.ts +1 -2
- package/dist/components/questionnaire/index.d.vue.ts +1 -0
- package/dist/components/questionnaire/index.vue +82 -84
- package/dist/components/questionnaire/types.d.ts +1 -3
- package/dist/components/radio/index.d.vue.ts +2 -2
- package/dist/components/radio/index.vue +3 -3
- package/dist/components/radio/types.d.ts +1 -1
- package/dist/components/radio-group/index.d.vue.ts +2 -2
- package/dist/components/radio-group/index.vue +2 -2
- package/dist/components/radio-group/types.d.ts +1 -1
- package/dist/components/rating/index.d.vue.ts +2 -2
- package/dist/components/rating/index.vue +2 -2
- package/dist/components/rating/types.d.ts +1 -1
- package/dist/components/reactions/index.d.vue.ts +34 -0
- package/dist/components/reactions/index.vue +143 -0
- package/dist/components/reactions/types.d.ts +23 -0
- package/dist/components/reasoning/index.d.vue.ts +2 -0
- package/dist/components/reasoning/index.vue +49 -30
- package/dist/components/reasoning/types.d.ts +9 -0
- package/dist/components/resizable/index.d.vue.ts +2 -2
- package/dist/components/resizable/index.vue +3 -3
- package/dist/components/resizable/types.d.ts +1 -1
- package/dist/components/rolling-number/index.vue +1 -1
- package/dist/components/scroll-text/index.d.vue.ts +1 -1
- package/dist/components/scroll-text/index.vue +2 -2
- package/dist/components/scroll-text/types.d.ts +2 -2
- package/dist/components/scrollable/index.d.vue.ts +3 -2
- package/dist/components/scrollable/types.d.ts +0 -15
- package/dist/components/search-input/index.d.vue.ts +5 -5
- package/dist/components/search-input/index.vue +1 -1
- package/dist/components/select/index.d.vue.ts +2 -2
- package/dist/components/select/index.vue +6 -6
- package/dist/components/select/types.d.ts +1 -1
- package/dist/components/shimmer-text/index.vue +1 -1
- package/dist/components/shimmer-text/types.d.ts +1 -1
- package/dist/components/skeleton/index.d.vue.ts +1 -1
- package/dist/components/slider/index.d.vue.ts +2 -3
- package/dist/components/slider/index.vue +17 -6
- package/dist/components/slider/types.d.ts +2 -1
- package/dist/components/snippet/index.vue +1 -5
- package/dist/components/snippet/types.d.ts +6 -2
- package/dist/components/spinner-dots/types.d.ts +1 -1
- package/dist/components/split-button/index.d.vue.ts +2 -2
- package/dist/components/split-button/index.vue +2 -2
- package/dist/components/split-button/types.d.ts +1 -1
- package/dist/components/steps/index.d.vue.ts +2 -2
- package/dist/components/steps/index.vue +2 -2
- package/dist/components/steps/types.d.ts +1 -1
- package/dist/components/stick-to-bottom/index.vue +3 -6
- package/dist/components/swipe-cell/index.d.vue.ts +2 -2
- package/dist/components/swipe-cell/index.vue +3 -3
- package/dist/components/swipe-cell/types.d.ts +1 -1
- package/dist/components/switch/index.d.vue.ts +2 -2
- package/dist/components/switch/index.vue +2 -2
- package/dist/components/switch/types.d.ts +1 -1
- package/dist/components/switch-item/index.vue +2 -2
- package/dist/components/tabs/index.d.vue.ts +2 -2
- package/dist/components/tabs/index.vue +3 -3
- package/dist/components/tabs/types.d.ts +1 -1
- package/dist/components/text/index.vue +1 -1
- package/dist/components/text/types.d.ts +1 -1
- package/dist/components/textarea/index.d.vue.ts +2 -2
- package/dist/components/textarea/index.vue +2 -2
- package/dist/components/textarea/types.d.ts +1 -1
- package/dist/components/theme-switcher/index.d.vue.ts +2 -3
- package/dist/components/theme-switcher/index.vue +7 -7
- package/dist/components/time-picker/index.d.vue.ts +2 -2
- package/dist/components/time-picker/index.vue +6 -6
- package/dist/components/time-picker/types.d.ts +1 -1
- package/dist/components/timeline-item/index.d.vue.ts +0 -1
- package/dist/components/timeline-item/index.vue +20 -4
- package/dist/components/timeline-item/types.d.ts +2 -2
- package/dist/components/todo-list/index.d.vue.ts +4 -13
- package/dist/components/todo-list/index.vue +122 -133
- package/dist/components/todo-list/types.d.ts +5 -4
- package/dist/components/toggle/index.d.vue.ts +4 -4
- package/dist/components/toggle/index.vue +4 -4
- package/dist/components/toggle/types.d.ts +6 -6
- package/dist/components/toggle-button/index.d.vue.ts +2 -2
- package/dist/components/toggle-button/index.vue +2 -2
- package/dist/components/toggle-button/types.d.ts +1 -1
- package/dist/components/toggle-button-group/index.d.vue.ts +2 -2
- package/dist/components/toggle-button-group/index.vue +2 -2
- package/dist/components/toggle-button-group/types.d.ts +1 -1
- package/dist/components/tool-call/index.d.vue.ts +2 -0
- package/dist/components/tool-call/index.vue +139 -133
- package/dist/components/tool-call/types.d.ts +6 -1
- package/dist/components/tooltip/index.d.vue.ts +1 -1
- package/dist/components/tooltip/index.vue +1 -0
- package/dist/components/tour/index.d.vue.ts +2 -2
- package/dist/components/tour/index.vue +4 -4
- package/dist/components/tour/types.d.ts +5 -5
- package/dist/components/tree/index.d.vue.ts +26 -17
- package/dist/components/tree/index.vue +95 -27
- package/dist/components/tree/types.d.ts +18 -17
- package/dist/components/virtual-list/index.d.vue.ts +4 -4
- package/dist/components/virtual-list/index.vue +3 -3
- package/dist/components/virtual-list/types.d.ts +10 -8
- package/dist/composables/_internal/use-code-highlight.js +3 -1
- package/dist/composables/_internal/use-details-collapse.d.ts +7 -0
- package/dist/composables/_internal/use-details-collapse.js +68 -0
- package/dist/composables/_internal/use-list-selection.d.ts +1 -1
- package/dist/composables/_internal/use-list-selection.js +2 -2
- package/dist/composables/_internal/use-model-value.d.ts +1 -1
- package/dist/composables/_internal/use-model-value.js +1 -1
- package/dist/composables/_internal/use-tailwind-variant.js +1 -1
- package/dist/composables/_internal/use-tree.d.ts +32 -6
- package/dist/composables/_internal/use-tree.js +89 -54
- package/dist/composables/use-color-scheme.d.ts +1 -1
- package/dist/composables/use-color-scheme.js +7 -3
- package/dist/composables/use-countdown.d.ts +1 -1
- package/dist/composables/use-countdown.js +9 -9
- package/dist/composables/use-loading-bar.js +4 -0
- package/dist/composables/use-stick-to-bottom.d.ts +5 -0
- package/dist/composables/use-stick-to-bottom.js +45 -31
- package/dist/composables/use-virtual-list.d.ts +1 -1
- package/dist/constants/tooltip-variants.d.ts +2 -2
- package/dist/constants/tooltip-variants.js +3 -3
- package/dist/contexts/collapse.d.ts +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/styles/tw.css +12 -7
- package/package.json +10 -11
- package/volar.d.ts +3 -0
- package/dist/components/bubble-group/types.js +0 -0
- package/dist/components/virtual-list/types.js +0 -0
- package/dist/composables/_internal/use-collapse-motion.d.ts +0 -6
- package/dist/composables/_internal/use-collapse-motion.js +0 -85
- package/dist/utils/_internal/cn-tables.d.ts +0 -27
- package/dist/utils/_internal/cn-tables.js +0 -131
- package/dist/utils/cn.d.ts +0 -1
- package/dist/utils/cn.js +0 -3
|
@@ -3,8 +3,7 @@ import ChevronDownIcon from "@gdsicon/vue/chevron-down";
|
|
|
3
3
|
import CrossIcon from "@gdsicon/vue/cross";
|
|
4
4
|
import QuestionIcon from "@gdsicon/vue/question";
|
|
5
5
|
import { computed, shallowReactive, shallowRef, watch } from "vue";
|
|
6
|
-
import {
|
|
7
|
-
import { useToggleValue } from "../../composables/use-toggle-value.js";
|
|
6
|
+
import { useDetailsCollapse } from "../../composables/_internal/use-details-collapse.js";
|
|
8
7
|
import { useConfigProvider } from "../../contexts/config-provider.js";
|
|
9
8
|
import { toArray } from "../../utils/format.js";
|
|
10
9
|
import PButton from "../button/index.vue";
|
|
@@ -14,11 +13,18 @@ defineOptions({
|
|
|
14
13
|
name: "PQuestionnaire",
|
|
15
14
|
inheritAttrs: false
|
|
16
15
|
});
|
|
17
|
-
const props = defineProps({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
questions: {
|
|
18
|
+
type: Array,
|
|
19
|
+
required: false,
|
|
20
|
+
default: () => []
|
|
21
|
+
},
|
|
22
|
+
expand: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
required: false,
|
|
25
|
+
default: true
|
|
26
|
+
}
|
|
27
|
+
});
|
|
22
28
|
const emits = defineEmits(["submit"]);
|
|
23
29
|
const contentRef = shallowRef();
|
|
24
30
|
const totalAnswers = shallowReactive({});
|
|
@@ -44,19 +50,7 @@ const showSubmitButton = computed(() => {
|
|
|
44
50
|
return currentIndex.value === questionsCount - 1 && question.allowFreeformInput;
|
|
45
51
|
});
|
|
46
52
|
const configProvider = useConfigProvider();
|
|
47
|
-
const {
|
|
48
|
-
const { detailsOpen, isLeaving, skipEnterMotion } = useCollapseMotion(contentRef, isExpanded);
|
|
49
|
-
function onToggleClick() {
|
|
50
|
-
toggleExpand();
|
|
51
|
-
}
|
|
52
|
-
function onDetailsToggle(ev) {
|
|
53
|
-
const details = ev.currentTarget;
|
|
54
|
-
// Find-in-page / fragment navigation opens <details> natively.
|
|
55
|
-
if (details.open && !isExpanded.value) {
|
|
56
|
-
skipEnterMotion();
|
|
57
|
-
isExpanded.value = true;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
53
|
+
const { isOpen, detailsOpen, onToggleClick, onDetailsToggle } = useDetailsCollapse(contentRef, () => props.expand);
|
|
60
54
|
function createInitialAnswers(questions) {
|
|
61
55
|
return questions.reduce((answers, question) => {
|
|
62
56
|
answers[question.header] = {
|
|
@@ -226,7 +220,7 @@ watch(() => props.questions, () => {
|
|
|
226
220
|
:class="{ 'border-b': detailsOpen }"
|
|
227
221
|
@click.prevent="onToggleClick"
|
|
228
222
|
>
|
|
229
|
-
<QuestionIcon class="size-
|
|
223
|
+
<QuestionIcon class="size-3 font-medium shrink-0" />
|
|
230
224
|
|
|
231
225
|
<span class="pxd-questionnaire--question min-w-0 font-medium flex-1 truncate">
|
|
232
226
|
{{ currentQuestion.question }}
|
|
@@ -248,76 +242,80 @@ watch(() => props.questions, () => {
|
|
|
248
242
|
|
|
249
243
|
<div
|
|
250
244
|
ref="contentRef"
|
|
251
|
-
class="
|
|
252
|
-
:class="
|
|
245
|
+
class="grid-template-cols-1fr grid overflow-hidden motion-safe:transition-[grid-template-rows]"
|
|
246
|
+
:class="isOpen ? 'grid-template-rows-1fr' : 'grid-template-rows-0fr'"
|
|
253
247
|
>
|
|
254
|
-
<
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
<
|
|
263
|
-
<
|
|
264
|
-
|
|
265
|
-
|
|
248
|
+
<div class="pxd-questionnaire--content border-t">
|
|
249
|
+
<PList
|
|
250
|
+
:model-value="currentAnswer.selected"
|
|
251
|
+
:multiple="currentQuestion.multiSelect"
|
|
252
|
+
:options="currentQuestion.options"
|
|
253
|
+
@update:model-value="onListModelUpdate"
|
|
254
|
+
@change="onAnswerItemSelect"
|
|
255
|
+
>
|
|
256
|
+
<template #item="{ item }">
|
|
257
|
+
<div v-if="item.label" class="flex flex-col">
|
|
258
|
+
<span>{{ item.label }}</span>
|
|
259
|
+
<span class="text-foreground-secondary">{{ item.description }}</span>
|
|
260
|
+
</div>
|
|
266
261
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
262
|
+
<PInput
|
|
263
|
+
v-else
|
|
264
|
+
:model-value="currentAnswer.freeText"
|
|
265
|
+
:placeholder="item.description"
|
|
266
|
+
class="-me-6 my-0.5 w-[calc(100%+1.5rem)] max-w-none"
|
|
267
|
+
@update:model-value="onFreeformInput"
|
|
268
|
+
@change="onFreeformInputChange"
|
|
269
|
+
@click.stop
|
|
270
|
+
/>
|
|
271
|
+
</template>
|
|
272
|
+
</PList>
|
|
278
273
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
274
|
+
<div
|
|
275
|
+
v-if="questions.length > 1 || showSubmitButton"
|
|
276
|
+
class="p-2 flex items-center justify-between border-t"
|
|
277
|
+
>
|
|
278
|
+
<div v-if="questions.length > 1" class="gap-1 flex items-center">
|
|
279
|
+
<PButton
|
|
280
|
+
variant="ghost"
|
|
281
|
+
:class="{ 'pointer-events-none opacity-50': !currentIndex }"
|
|
282
|
+
icon
|
|
283
|
+
:title="configProvider.locale.questionnaire.prev"
|
|
284
|
+
:aria-label="configProvider.locale.questionnaire.prev"
|
|
285
|
+
:aria-disabled="!currentIndex"
|
|
286
|
+
@click="toggleCurrentIndex(-1)"
|
|
287
|
+
>
|
|
288
|
+
<ChevronDownIcon class="rotate-90" aria-hidden="true" />
|
|
289
|
+
</PButton>
|
|
295
290
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
291
|
+
<PButton
|
|
292
|
+
variant="ghost"
|
|
293
|
+
:class="{
|
|
294
|
+
'pointer-events-none opacity-50': currentIndex >= questions.length - 1
|
|
295
|
+
}"
|
|
296
|
+
icon
|
|
297
|
+
:title="configProvider.locale.questionnaire.next"
|
|
298
|
+
:aria-label="configProvider.locale.questionnaire.next"
|
|
299
|
+
:aria-disabled="currentIndex >= questions.length - 1"
|
|
300
|
+
@click="toggleCurrentIndex(1)"
|
|
301
|
+
>
|
|
302
|
+
<ChevronDownIcon class="-rotate-90" aria-hidden="true" />
|
|
303
|
+
</PButton>
|
|
307
304
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
305
|
+
<span class="text-sm ms-2 text-foreground-secondary tabular-nums select-none">
|
|
306
|
+
{{ currentIndex + 1 }}/{{ questions.length }}
|
|
307
|
+
</span>
|
|
308
|
+
</div>
|
|
312
309
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
310
|
+
<div class="gap-2 ms-auto flex items-center">
|
|
311
|
+
<PButton variant="ghost" @click="skipCurrentQuestion">
|
|
312
|
+
{{ configProvider.locale.interaction.skip }}
|
|
313
|
+
</PButton>
|
|
317
314
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
315
|
+
<PButton v-show="showSubmitButton" variant="primary" @click="onSubmitAnswers">
|
|
316
|
+
{{ configProvider.locale.interaction.submit }}
|
|
317
|
+
</PButton>
|
|
318
|
+
</div>
|
|
321
319
|
</div>
|
|
322
320
|
</div>
|
|
323
321
|
</div>
|
|
@@ -11,9 +11,6 @@ export interface QuestionnaireQuestion {
|
|
|
11
11
|
export interface QuestionnaireAnswer {
|
|
12
12
|
selected: string[]
|
|
13
13
|
freeText: string | null
|
|
14
|
-
/**
|
|
15
|
-
* True if no freeText is selected or used
|
|
16
|
-
*/
|
|
17
14
|
skipped: boolean
|
|
18
15
|
}
|
|
19
16
|
|
|
@@ -23,6 +20,7 @@ export interface QuestionnaireAnswers {
|
|
|
23
20
|
|
|
24
21
|
export interface QuestionnaireProps {
|
|
25
22
|
questions?: QuestionnaireQuestion[]
|
|
23
|
+
expand?: boolean
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
export interface QuestionnaireEmits {
|
|
@@ -5,10 +5,10 @@ type __VLS_Slots = {} & {
|
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_base: import("vue").DefineComponent<RadioProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
7
|
change: (args_0: NonNullable<import("../../types/shared/props.js").ComponentValue | undefined>) => any;
|
|
8
|
-
"update:
|
|
8
|
+
"update:model-value": (args_0: NonNullable<import("../../types/shared/props.js").ComponentValue | undefined>) => any;
|
|
9
9
|
}, string, import("vue").PublicProps, Readonly<RadioProps> & Readonly<{
|
|
10
10
|
onChange?: ((args_0: NonNullable<import("../../types/shared/props.js").ComponentValue | undefined>) => any) | undefined;
|
|
11
|
-
"onUpdate:
|
|
11
|
+
"onUpdate:model-value"?: ((args_0: NonNullable<import("../../types/shared/props.js").ComponentValue | undefined>) => any) | undefined;
|
|
12
12
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
14
14
|
declare const _default: typeof __VLS_export;
|
|
@@ -9,7 +9,7 @@ defineOptions({
|
|
|
9
9
|
inheritAttrs: false,
|
|
10
10
|
model: {
|
|
11
11
|
prop: "modelValue",
|
|
12
|
-
event: "update:
|
|
12
|
+
event: "update:model-value"
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
const props = defineProps({
|
|
@@ -30,7 +30,7 @@ const props = defineProps({
|
|
|
30
30
|
required: false
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
const emits = defineEmits(["change", "update:
|
|
33
|
+
const emits = defineEmits(["change", "update:model-value"]);
|
|
34
34
|
const uniqueId = getUniqueId();
|
|
35
35
|
const radioGroupContext = useRadioGroupContext();
|
|
36
36
|
const radioGroupName = radioGroupContext?.name ?? getUniqueId();
|
|
@@ -70,7 +70,7 @@ function onInputChange() {
|
|
|
70
70
|
role="radio"
|
|
71
71
|
:aria-selected="isSelected"
|
|
72
72
|
:data-disabled="isDisabled"
|
|
73
|
-
class="pxd-radio group/radio gap-2 inline-flex max-w-full cursor-pointer touch-manipulation items-center data-[disabled=true]:cursor-not-allowed data-[disabled=true]:text-gray-500"
|
|
73
|
+
class="pxd-radio group/radio relative gap-2 inline-flex max-w-full cursor-pointer touch-manipulation items-center data-[disabled=true]:cursor-not-allowed data-[disabled=true]:text-gray-500"
|
|
74
74
|
:for="uniqueId"
|
|
75
75
|
v-bind="$attrs"
|
|
76
76
|
>
|
|
@@ -5,10 +5,10 @@ type __VLS_Slots = {} & {
|
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_base: import("vue").DefineComponent<RadioGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
7
|
change: (args_0: NonNullable<import("../../types/shared/props.js").ComponentValue | undefined>) => any;
|
|
8
|
-
"update:
|
|
8
|
+
"update:model-value": (args_0: NonNullable<import("../../types/shared/props.js").ComponentValue | undefined>) => any;
|
|
9
9
|
}, string, import("vue").PublicProps, Readonly<RadioGroupProps> & Readonly<{
|
|
10
10
|
onChange?: ((args_0: NonNullable<import("../../types/shared/props.js").ComponentValue | undefined>) => any) | undefined;
|
|
11
|
-
"onUpdate:
|
|
11
|
+
"onUpdate:model-value"?: ((args_0: NonNullable<import("../../types/shared/props.js").ComponentValue | undefined>) => any) | undefined;
|
|
12
12
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
14
14
|
declare const _default: typeof __VLS_export;
|
|
@@ -8,7 +8,7 @@ defineOptions({
|
|
|
8
8
|
inheritAttrs: false,
|
|
9
9
|
model: {
|
|
10
10
|
prop: "modelValue",
|
|
11
|
-
event: "update:
|
|
11
|
+
event: "update:model-value"
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
const props = defineProps({
|
|
@@ -25,7 +25,7 @@ const props = defineProps({
|
|
|
25
25
|
required: false
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
const emits = defineEmits(["change", "update:
|
|
28
|
+
const emits = defineEmits(["change", "update:model-value"]);
|
|
29
29
|
provideRadioGroupContext({
|
|
30
30
|
props,
|
|
31
31
|
emits,
|
|
@@ -8,5 +8,5 @@ export interface RadioGroupProps {
|
|
|
8
8
|
|
|
9
9
|
export interface RadioGroupEmits {
|
|
10
10
|
change: [NonNullable<RadioGroupProps['modelValue']>]
|
|
11
|
-
'update:
|
|
11
|
+
'update:model-value': [NonNullable<RadioGroupProps['modelValue']>]
|
|
12
12
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RatingProps } from './types';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<RatingProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
3
|
change: (args_0: number) => any;
|
|
4
|
-
"update:
|
|
4
|
+
"update:model-value": (args_0: number) => any;
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<RatingProps> & Readonly<{
|
|
6
6
|
onChange?: ((args_0: number) => any) | undefined;
|
|
7
|
-
"onUpdate:
|
|
7
|
+
"onUpdate:model-value"?: ((args_0: number) => any) | undefined;
|
|
8
8
|
}>, {
|
|
9
9
|
count: number;
|
|
10
10
|
disabled: boolean;
|
|
@@ -11,7 +11,7 @@ defineOptions({
|
|
|
11
11
|
inheritAttrs: false,
|
|
12
12
|
model: {
|
|
13
13
|
prop: "modelValue",
|
|
14
|
-
event: "update:
|
|
14
|
+
event: "update:model-value"
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
const props = defineProps({
|
|
@@ -58,7 +58,7 @@ const props = defineProps({
|
|
|
58
58
|
default: false
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
-
const emits = defineEmits(["change", "update:
|
|
61
|
+
const emits = defineEmits(["change", "update:model-value"]);
|
|
62
62
|
let activePointerId = null;
|
|
63
63
|
let ratingRect = null;
|
|
64
64
|
let lastClientX = null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Reaction, ReactionsProps } from './types';
|
|
2
|
+
declare function pick(emoji: string): void;
|
|
3
|
+
declare function toggle(emoji: string): void;
|
|
4
|
+
declare var __VLS_7: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_7) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<ReactionsProps, {
|
|
9
|
+
pick: typeof pick;
|
|
10
|
+
toggle: typeof toggle;
|
|
11
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
change: (reactions: Reaction[]) => any;
|
|
13
|
+
"update:model-value": (reactions: Reaction[]) => any;
|
|
14
|
+
add: (emoji: string) => any;
|
|
15
|
+
remove: (emoji: string) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<ReactionsProps> & Readonly<{
|
|
17
|
+
onChange?: ((reactions: Reaction[]) => any) | undefined;
|
|
18
|
+
"onUpdate:model-value"?: ((reactions: Reaction[]) => any) | undefined;
|
|
19
|
+
onAdd?: ((emoji: string) => any) | undefined;
|
|
20
|
+
onRemove?: ((emoji: string) => any) | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
modelValue: Reaction[];
|
|
23
|
+
position: import("../../types/shared/props.js").ComponentPosition;
|
|
24
|
+
trigger: import("../popover/types.js").PopoverTrigger | import("../popover/types.js").PopoverTrigger[];
|
|
25
|
+
emojis: string[];
|
|
26
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, shallowRef } from "vue";
|
|
3
|
+
import { getUniqueId } from "../../utils/helper.js";
|
|
4
|
+
import PPopover from "../popover/index.vue";
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: "PReactions",
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
model: {
|
|
9
|
+
prop: "modelValue",
|
|
10
|
+
event: "update:model-value"
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: Array,
|
|
16
|
+
required: false,
|
|
17
|
+
default: () => []
|
|
18
|
+
},
|
|
19
|
+
emojis: {
|
|
20
|
+
type: Array,
|
|
21
|
+
required: false,
|
|
22
|
+
default: () => [
|
|
23
|
+
"👍",
|
|
24
|
+
"❤️",
|
|
25
|
+
"😂",
|
|
26
|
+
"😮",
|
|
27
|
+
"😢",
|
|
28
|
+
"🙏"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
trigger: {
|
|
32
|
+
type: [String, Array],
|
|
33
|
+
required: false,
|
|
34
|
+
default: "click"
|
|
35
|
+
},
|
|
36
|
+
position: {
|
|
37
|
+
type: null,
|
|
38
|
+
required: false,
|
|
39
|
+
default: "top-start"
|
|
40
|
+
},
|
|
41
|
+
disabled: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
required: false
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const emits = defineEmits([
|
|
47
|
+
"add",
|
|
48
|
+
"remove",
|
|
49
|
+
"change",
|
|
50
|
+
"update:model-value"
|
|
51
|
+
]);
|
|
52
|
+
const labelId = getUniqueId("pxd-reactions-label");
|
|
53
|
+
const visible = shallowRef(false);
|
|
54
|
+
const reactions = computed(() => props.modelValue ?? []);
|
|
55
|
+
function commit(next, event, emoji) {
|
|
56
|
+
if (event === "add") {
|
|
57
|
+
emits("add", emoji);
|
|
58
|
+
} else {
|
|
59
|
+
emits("remove", emoji);
|
|
60
|
+
}
|
|
61
|
+
emits("change", next);
|
|
62
|
+
emits("update:model-value", next);
|
|
63
|
+
}
|
|
64
|
+
function pick(emoji) {
|
|
65
|
+
if (props.disabled) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const current = reactions.value;
|
|
69
|
+
const existing = current.find((item) => item.emoji === emoji);
|
|
70
|
+
visible.value = false;
|
|
71
|
+
if (existing?.mine) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
commit(existing ? current.map((item) => item.emoji === emoji ? {
|
|
75
|
+
...item,
|
|
76
|
+
count: item.count + 1,
|
|
77
|
+
mine: true
|
|
78
|
+
} : item) : [...current, {
|
|
79
|
+
emoji,
|
|
80
|
+
count: 1,
|
|
81
|
+
mine: true
|
|
82
|
+
}], "add", emoji);
|
|
83
|
+
}
|
|
84
|
+
function toggle(emoji) {
|
|
85
|
+
if (props.disabled) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const current = reactions.value;
|
|
89
|
+
const existing = current.find((item) => item.emoji === emoji);
|
|
90
|
+
if (!existing) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (!existing.mine) {
|
|
94
|
+
commit(current.map((item) => item.emoji === emoji ? {
|
|
95
|
+
...item,
|
|
96
|
+
count: item.count + 1,
|
|
97
|
+
mine: true
|
|
98
|
+
} : item), "add", emoji);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
commit(existing.count > 1 ? current.map((item) => item.emoji === emoji ? {
|
|
102
|
+
...item,
|
|
103
|
+
count: item.count - 1,
|
|
104
|
+
mine: false
|
|
105
|
+
} : item) : current.filter((item) => item.emoji !== emoji), "remove", emoji);
|
|
106
|
+
}
|
|
107
|
+
defineExpose({
|
|
108
|
+
pick,
|
|
109
|
+
toggle
|
|
110
|
+
});
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<template>
|
|
114
|
+
<PPopover
|
|
115
|
+
data-reactions
|
|
116
|
+
v-model="visible"
|
|
117
|
+
class="pxd-reactions"
|
|
118
|
+
:trigger="trigger"
|
|
119
|
+
:position="position"
|
|
120
|
+
:disabled="disabled"
|
|
121
|
+
:aria-labelledby="labelId"
|
|
122
|
+
content-class="pxd-reactions--picker p-1 gap-0.5 shadow-lg flex items-center rounded-lg border border-gray-alpha-300 bg-background-100"
|
|
123
|
+
:fill-trigger-width="false"
|
|
124
|
+
v-bind="$attrs"
|
|
125
|
+
>
|
|
126
|
+
<slot />
|
|
127
|
+
|
|
128
|
+
<template #content>
|
|
129
|
+
<span :id="labelId" class="visually-hidden">Add a reaction</span>
|
|
130
|
+
|
|
131
|
+
<button
|
|
132
|
+
v-for="emoji in emojis"
|
|
133
|
+
:key="emoji"
|
|
134
|
+
type="button"
|
|
135
|
+
:aria-label="emoji"
|
|
136
|
+
class="size-8 p-0 text-base inline-flex cursor-pointer appearance-none items-center justify-center rounded-md border-0 bg-transparent font-inherit leading-none self-focus-ring outline-none hover:bg-background-hover motion-safe:transition-colors"
|
|
137
|
+
@click="pick(emoji)"
|
|
138
|
+
>
|
|
139
|
+
{{ emoji }}
|
|
140
|
+
</button>
|
|
141
|
+
</template>
|
|
142
|
+
</PPopover>
|
|
143
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComponentPosition } from '../../types/shared/props'
|
|
2
|
+
import type { PopoverTrigger } from '../popover/types'
|
|
3
|
+
|
|
4
|
+
export interface Reaction {
|
|
5
|
+
emoji: string
|
|
6
|
+
count: number
|
|
7
|
+
mine?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ReactionsProps {
|
|
11
|
+
modelValue?: Reaction[]
|
|
12
|
+
emojis?: string[]
|
|
13
|
+
trigger?: PopoverTrigger | PopoverTrigger[]
|
|
14
|
+
position?: ComponentPosition
|
|
15
|
+
disabled?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ReactionsEmits {
|
|
19
|
+
add: [emoji: string]
|
|
20
|
+
remove: [emoji: string]
|
|
21
|
+
change: [reactions: Reaction[]]
|
|
22
|
+
'update:model-value': [reactions: Reaction[]]
|
|
23
|
+
}
|
|
@@ -4,6 +4,8 @@ type __VLS_Slots = {} & {
|
|
|
4
4
|
default?: (props: typeof __VLS_17) => any;
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_base: import("vue").DefineComponent<ReasoningProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ReasoningProps> & Readonly<{}>, {
|
|
7
|
+
variant: import("./types").ReasoningVariant;
|
|
8
|
+
expand: boolean;
|
|
7
9
|
streaming: boolean;
|
|
8
10
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
11
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|