@aerogel/core 0.0.0-next.b656a964404fbde17d9cce7668722596098e47fd → 0.0.0-next.b9379d15fd4f40346d655134b49c9015ead9c536
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/aerogel-core.css +1 -0
- package/dist/aerogel-core.d.ts +649 -560
- package/dist/aerogel-core.js +1878 -1455
- package/dist/aerogel-core.js.map +1 -1
- package/package.json +6 -4
- package/src/components/AppLayout.vue +1 -3
- package/src/components/AppOverlays.vue +0 -27
- package/src/components/contracts/AlertModal.ts +15 -0
- package/src/components/contracts/ConfirmModal.ts +12 -5
- package/src/components/contracts/DropdownMenu.ts +17 -3
- package/src/components/contracts/ErrorReportModal.ts +8 -4
- package/src/components/contracts/Input.ts +7 -7
- package/src/components/contracts/LoadingModal.ts +12 -4
- package/src/components/contracts/Modal.ts +12 -4
- package/src/components/contracts/PromptModal.ts +8 -2
- package/src/components/contracts/Select.ts +21 -12
- package/src/components/contracts/Toast.ts +4 -2
- package/src/components/contracts/index.ts +3 -1
- package/src/components/headless/HeadlessButton.vue +2 -1
- package/src/components/headless/HeadlessInput.vue +3 -3
- package/src/components/headless/HeadlessInputInput.vue +5 -5
- package/src/components/headless/HeadlessInputTextArea.vue +3 -3
- package/src/components/headless/HeadlessModal.vue +22 -51
- package/src/components/headless/HeadlessModalContent.vue +11 -5
- package/src/components/headless/HeadlessModalDescription.vue +12 -0
- package/src/components/headless/HeadlessSelect.vue +34 -18
- package/src/components/headless/HeadlessSelectOption.vue +1 -1
- package/src/components/headless/HeadlessSelectOptions.vue +16 -4
- package/src/components/headless/HeadlessSelectValue.vue +4 -1
- package/src/components/headless/HeadlessSwitch.vue +96 -0
- package/src/components/headless/index.ts +2 -0
- package/src/components/ui/AdvancedOptions.vue +1 -1
- package/src/components/ui/AlertModal.vue +7 -3
- package/src/components/ui/Button.vue +17 -15
- package/src/components/ui/Checkbox.vue +4 -4
- package/src/components/ui/ConfirmModal.vue +12 -4
- package/src/components/ui/DropdownMenu.vue +18 -19
- package/src/components/ui/DropdownMenuOption.vue +22 -0
- package/src/components/ui/DropdownMenuOptions.vue +44 -0
- package/src/components/ui/EditableContent.vue +3 -3
- package/src/components/ui/ErrorLogs.vue +19 -0
- package/src/components/ui/ErrorLogsModal.vue +48 -0
- package/src/components/ui/ErrorReportModal.vue +18 -7
- package/src/components/ui/Input.vue +3 -3
- package/src/components/ui/LoadingModal.vue +6 -4
- package/src/components/ui/Markdown.vue +29 -1
- package/src/components/ui/Modal.vue +74 -21
- package/src/components/ui/ModalContext.vue +2 -1
- package/src/components/ui/ProgressBar.vue +8 -7
- package/src/components/ui/PromptModal.vue +8 -5
- package/src/components/ui/Select.vue +10 -4
- package/src/components/ui/SelectLabel.vue +13 -2
- package/src/components/ui/SelectOption.vue +29 -0
- package/src/components/ui/SelectOptions.vue +24 -20
- package/src/components/ui/SelectTrigger.vue +2 -2
- package/src/components/ui/Switch.vue +11 -0
- package/src/components/ui/Toast.vue +19 -15
- package/src/components/ui/index.ts +6 -0
- package/src/directives/measure.ts +11 -5
- package/src/errors/Errors.ts +18 -15
- package/src/errors/index.ts +6 -2
- package/src/errors/settings/Debug.vue +39 -0
- package/src/errors/settings/index.ts +10 -0
- package/src/forms/FormController.test.ts +32 -9
- package/src/forms/FormController.ts +23 -22
- package/src/forms/index.ts +0 -1
- package/src/forms/utils.ts +34 -34
- package/src/index.css +34 -7
- package/src/lang/index.ts +3 -2
- package/src/lang/settings/Language.vue +2 -2
- package/src/services/App.ts +6 -1
- package/src/services/Events.test.ts +8 -8
- package/src/services/Events.ts +2 -8
- package/src/services/index.ts +3 -3
- package/src/ui/UI.state.ts +3 -13
- package/src/ui/UI.ts +87 -79
- package/src/ui/index.ts +16 -17
- package/src/utils/classes.ts +9 -17
- package/src/utils/composition/events.ts +2 -4
- package/src/utils/composition/forms.ts +7 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/markdown.ts +35 -1
- package/src/utils/types.ts +3 -0
- package/src/utils/vue.ts +6 -1
- package/src/components/contracts/shared.ts +0 -9
- package/src/forms/composition.ts +0 -6
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Button
|
|
3
|
+
v-if="$errors.logs.length > 0"
|
|
4
|
+
size="icon"
|
|
5
|
+
variant="ghost"
|
|
6
|
+
:title="$td('errors.viewLogs', 'View error logs')"
|
|
7
|
+
:aria-label="$td('errors.viewLogs', 'View error logs')"
|
|
8
|
+
@click="$ui.modal(ErrorLogsModal)"
|
|
9
|
+
>
|
|
10
|
+
<IconWarning class="size-6 text-red-500" />
|
|
11
|
+
</Button>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import IconWarning from '~icons/ion/warning';
|
|
16
|
+
|
|
17
|
+
import Button from '@aerogel/core/components/ui/Button.vue';
|
|
18
|
+
import ErrorLogsModal from '@aerogel/core/components/ui/ErrorLogsModal.vue';
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal :title="$td('errors.report', 'Errors ({count})', { count: $errors.logs.length })">
|
|
3
|
+
<ol>
|
|
4
|
+
<li
|
|
5
|
+
v-for="(log, index) of $errors.logs"
|
|
6
|
+
:key="index"
|
|
7
|
+
class="mb-2 flex max-w-prose min-w-56 justify-between py-2 last:mb-0"
|
|
8
|
+
>
|
|
9
|
+
<div>
|
|
10
|
+
<h3 class="font-medium">
|
|
11
|
+
{{ log.report.title }}
|
|
12
|
+
</h3>
|
|
13
|
+
<time :datetime="log.date.toISOString()" class="text-xs text-gray-700">
|
|
14
|
+
{{ log.date.toLocaleTimeString() }}
|
|
15
|
+
</time>
|
|
16
|
+
<Markdown
|
|
17
|
+
class="text-sm text-gray-500"
|
|
18
|
+
:text="log.report.description ?? getErrorMessage(log.report)"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
<Button
|
|
22
|
+
size="icon"
|
|
23
|
+
variant="ghost"
|
|
24
|
+
:aria-label="$td('errors.viewDetails', 'View details')"
|
|
25
|
+
:title="$td('errors.viewDetails', 'View details')"
|
|
26
|
+
class="self-center"
|
|
27
|
+
@click="
|
|
28
|
+
$errors.inspect(
|
|
29
|
+
log.report,
|
|
30
|
+
$errors.logs.map(({ report }) => report)
|
|
31
|
+
)
|
|
32
|
+
"
|
|
33
|
+
>
|
|
34
|
+
<IconViewShow class="size-4" aria-hidden="true" />
|
|
35
|
+
</Button>
|
|
36
|
+
</li>
|
|
37
|
+
</ol>
|
|
38
|
+
</Modal>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import IconViewShow from '~icons/zondicons/view-show';
|
|
43
|
+
|
|
44
|
+
import Button from '@aerogel/core/components/ui/Button.vue';
|
|
45
|
+
import Modal from '@aerogel/core/components/ui/Modal.vue';
|
|
46
|
+
import Markdown from '@aerogel/core/components/ui/Markdown.vue';
|
|
47
|
+
import { getErrorMessage } from '@aerogel/core/errors';
|
|
48
|
+
</script>
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Modal
|
|
2
|
+
<Modal
|
|
3
|
+
:title="$td('errors.report', 'Error report')"
|
|
4
|
+
title-hidden
|
|
5
|
+
close-hidden
|
|
6
|
+
class="p-0"
|
|
7
|
+
wrapper-class="sm:w-auto sm:min-w-lg sm:max-w-[80vw]"
|
|
8
|
+
>
|
|
3
9
|
<div class="px-4 pt-5 pb-4">
|
|
4
10
|
<h2 class="flex justify-between gap-4">
|
|
5
11
|
<div class="flex items-center gap-2">
|
|
6
12
|
<IconExclamationSolid class="size-5 text-red-600" />
|
|
7
13
|
<ErrorReportModalTitle
|
|
8
14
|
class="text-lg leading-6 font-semibold text-gray-900"
|
|
9
|
-
:report="
|
|
15
|
+
:report="activeReport"
|
|
10
16
|
:current-report="activeReportIndex + 1"
|
|
11
17
|
:total-reports="reports.length"
|
|
12
18
|
/>
|
|
@@ -33,11 +39,11 @@
|
|
|
33
39
|
</Button>
|
|
34
40
|
</span>
|
|
35
41
|
</div>
|
|
36
|
-
<ErrorReportModalButtons :report class="gap-0.5" />
|
|
42
|
+
<ErrorReportModalButtons :report="activeReport" class="gap-0.5" />
|
|
37
43
|
</h2>
|
|
38
|
-
<Markdown v-if="
|
|
44
|
+
<Markdown v-if="activeReport.description" :text="activeReport.description" class="text-gray-600" />
|
|
39
45
|
</div>
|
|
40
|
-
<div class="-mt-2 max-h-[
|
|
46
|
+
<div class="-mt-2 max-h-[75vh] overflow-auto bg-red-800/10">
|
|
41
47
|
<pre class="p-4 text-xs text-red-800" v-text="details" />
|
|
42
48
|
</div>
|
|
43
49
|
</Modal>
|
|
@@ -54,9 +60,14 @@ import ErrorReportModalButtons from '@aerogel/core/components/ui/ErrorReportModa
|
|
|
54
60
|
import ErrorReportModalTitle from '@aerogel/core/components/ui/ErrorReportModalTitle.vue';
|
|
55
61
|
import Modal from '@aerogel/core/components/ui/Modal.vue';
|
|
56
62
|
import { useErrorReportModal } from '@aerogel/core/components/contracts/ErrorReportModal';
|
|
57
|
-
import type {
|
|
63
|
+
import type {
|
|
64
|
+
ErrorReportModalExpose,
|
|
65
|
+
ErrorReportModalProps,
|
|
66
|
+
} from '@aerogel/core/components/contracts/ErrorReportModal';
|
|
58
67
|
|
|
59
68
|
const props = defineProps<ErrorReportModalProps>();
|
|
60
69
|
|
|
61
|
-
const { activeReportIndex, details, nextReportText, previousReportText,
|
|
70
|
+
const { activeReportIndex, details, nextReportText, previousReportText, activeReport } = useErrorReportModal(props);
|
|
71
|
+
|
|
72
|
+
defineExpose<ErrorReportModalExpose>();
|
|
62
73
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<HeadlessInput
|
|
3
|
-
ref="$
|
|
3
|
+
ref="$inputRef"
|
|
4
4
|
:label="label"
|
|
5
5
|
:class="rootClasses"
|
|
6
6
|
v-bind="props"
|
|
@@ -38,7 +38,7 @@ defineEmits<InputEmits>();
|
|
|
38
38
|
const { label, inputClass, wrapperClass, ...props } = defineProps<
|
|
39
39
|
InputProps & { inputClass?: HTMLAttributes['class']; wrapperClass?: HTMLAttributes['class'] }
|
|
40
40
|
>();
|
|
41
|
-
const $input = useTemplateRef('$
|
|
41
|
+
const $input = useTemplateRef('$inputRef');
|
|
42
42
|
const [inputAttrs, rootClasses] = useInputAttrs();
|
|
43
43
|
const renderedWrapperClasses = computed(() =>
|
|
44
44
|
classes('relative rounded-md shadow-2xs', { 'mt-1': label }, wrapperClass));
|
|
@@ -47,8 +47,8 @@ const renderedInputClasses = computed(() =>
|
|
|
47
47
|
// eslint-disable-next-line vue/max-len
|
|
48
48
|
'block w-full rounded-md border-0 py-1.5 ring-1 ring-inset focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6',
|
|
49
49
|
{
|
|
50
|
+
'focus:ring-primary-600': !$input.value?.errors,
|
|
50
51
|
'text-gray-900 shadow-2xs ring-gray-300 placeholder:text-gray-400': !$input.value?.errors,
|
|
51
|
-
'hover:ring-1 hover:ring-primary/80 hover:ring-inset focus:ring-primary': !$input.value?.errors,
|
|
52
52
|
'pr-10 text-red-900 ring-red-300 placeholder:text-red-300 focus:ring-red-500': $input.value?.errors,
|
|
53
53
|
},
|
|
54
54
|
inputClass,
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
persistent
|
|
4
4
|
class="flex"
|
|
5
5
|
wrapper-class="w-auto"
|
|
6
|
-
:title
|
|
6
|
+
:title="renderedTitle"
|
|
7
|
+
:title-hidden
|
|
7
8
|
:class="{ 'flex-col-reverse': showProgress, 'items-center justify-center gap-2': !showProgress }"
|
|
8
9
|
>
|
|
9
10
|
<ProgressBar
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
:job
|
|
13
14
|
class="min-w-[min(400px,80vw)]"
|
|
14
15
|
/>
|
|
15
|
-
<IconSpinner v-else class="text-primary mr-1 size-6" />
|
|
16
|
+
<IconSpinner v-else class="text-primary-600 mr-1 size-6" />
|
|
16
17
|
<Markdown :text="renderedMessage" />
|
|
17
18
|
</Modal>
|
|
18
19
|
</template>
|
|
@@ -24,9 +25,10 @@ import Markdown from '@aerogel/core/components/ui/Markdown.vue';
|
|
|
24
25
|
import Modal from '@aerogel/core/components/ui/Modal.vue';
|
|
25
26
|
import ProgressBar from '@aerogel/core/components/ui/ProgressBar.vue';
|
|
26
27
|
import { useLoadingModal } from '@aerogel/core/components/contracts/LoadingModal';
|
|
27
|
-
import type { LoadingModalProps } from '@aerogel/core/components/contracts/LoadingModal';
|
|
28
|
+
import type { LoadingModalExpose, LoadingModalProps } from '@aerogel/core/components/contracts/LoadingModal';
|
|
28
29
|
|
|
29
30
|
const props = defineProps<LoadingModalProps>();
|
|
31
|
+
const { renderedTitle, renderedMessage, titleHidden, showProgress } = useLoadingModal(props);
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
defineExpose<LoadingModalExpose>();
|
|
32
34
|
</script>
|
|
@@ -7,7 +7,7 @@ import { computed, h, useAttrs } from 'vue';
|
|
|
7
7
|
import { isInstanceOf } from '@noeldemartin/utils';
|
|
8
8
|
import type { VNode } from 'vue';
|
|
9
9
|
|
|
10
|
-
import { renderMarkdown } from '@aerogel/core/utils/markdown';
|
|
10
|
+
import { getMarkdownRouter, renderMarkdown } from '@aerogel/core/utils/markdown';
|
|
11
11
|
import { translate, translateWithDefault } from '@aerogel/core/lang';
|
|
12
12
|
import { renderVNode } from '@aerogel/core/utils/vue';
|
|
13
13
|
|
|
@@ -65,5 +65,33 @@ async function onClick(event: Event) {
|
|
|
65
65
|
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
if (isInstanceOf(target, HTMLAnchorElement) && target.dataset.markdownRoute) {
|
|
70
|
+
const router = getMarkdownRouter();
|
|
71
|
+
|
|
72
|
+
if (router) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
|
|
75
|
+
router.visit(target.dataset.markdownRoute);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
68
80
|
}
|
|
69
81
|
</script>
|
|
82
|
+
|
|
83
|
+
<style scoped>
|
|
84
|
+
/* @apply .text-links .font-normal .no-underline .hover:underline; */
|
|
85
|
+
* :deep(a) {
|
|
86
|
+
--tw-font-weight: var(--font-weight-normal);
|
|
87
|
+
text-decoration-line: none;
|
|
88
|
+
color: var(--color-links);
|
|
89
|
+
font-weight: var(--font-weight-normal);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@media (hover: hover) {
|
|
93
|
+
* :deep(a:hover) {
|
|
94
|
+
text-decoration-line: underline;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -1,24 +1,42 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<!-- @vue-generic {T} -->
|
|
2
3
|
<HeadlessModal
|
|
3
4
|
v-slot="{ close }"
|
|
4
5
|
v-bind="props"
|
|
5
|
-
ref="$modal"
|
|
6
|
+
:ref="($modal) => forwardRef($modal as HeadlessModalInstance)"
|
|
6
7
|
:persistent
|
|
7
8
|
>
|
|
8
|
-
<HeadlessModalOverlay
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<HeadlessModalOverlay
|
|
10
|
+
class="fixed inset-0 animate-[fade-in_var(--tw-duration)_ease-in-out] transition-opacity duration-300 will-change-[opacity]"
|
|
11
|
+
:class="{
|
|
12
|
+
'bg-black/30': context.childIndex === 1,
|
|
13
|
+
'opacity-0': context.childIndex === 1 && context.modal.closing,
|
|
14
|
+
}"
|
|
15
|
+
/>
|
|
16
|
+
<HeadlessModalContent v-bind="contentProps" :class="renderedWrapperClass">
|
|
17
|
+
<div v-if="!persistent && !closeHidden" class="absolute top-0 right-0 hidden pt-3.5 pr-2.5 sm:block">
|
|
18
|
+
<button
|
|
19
|
+
type="button"
|
|
20
|
+
class="clickable z-10 rounded-full p-2.5 text-gray-400 hover:text-gray-500"
|
|
21
|
+
@click="close()"
|
|
22
|
+
>
|
|
13
23
|
<span class="sr-only">{{ $td('ui.close', 'Close') }}</span>
|
|
14
|
-
<IconClose class="size-
|
|
15
|
-
</
|
|
24
|
+
<IconClose class="size-4" />
|
|
25
|
+
</button>
|
|
16
26
|
</div>
|
|
17
27
|
|
|
18
|
-
<HeadlessModalTitle
|
|
28
|
+
<HeadlessModalTitle
|
|
29
|
+
v-if="title"
|
|
30
|
+
class="px-4 pt-5 pb-2 text-base font-semibold text-gray-900"
|
|
31
|
+
:class="{ 'sr-only': titleHidden }"
|
|
32
|
+
>
|
|
19
33
|
<Markdown :text="title" inline />
|
|
20
34
|
</HeadlessModalTitle>
|
|
21
35
|
|
|
36
|
+
<HeadlessModalDescription v-if="description" :class="{ 'sr-only': descriptionHidden }">
|
|
37
|
+
<Markdown :text="description" class="mt-1 text-sm leading-6 text-gray-500" />
|
|
38
|
+
</HeadlessModalDescription>
|
|
39
|
+
|
|
22
40
|
<div :class="renderedContentClass">
|
|
23
41
|
<slot :close />
|
|
24
42
|
</div>
|
|
@@ -26,45 +44,80 @@
|
|
|
26
44
|
</HeadlessModal>
|
|
27
45
|
</template>
|
|
28
46
|
|
|
29
|
-
<script setup lang="ts">
|
|
47
|
+
<script setup lang="ts" generic="T = void">
|
|
30
48
|
import IconClose from '~icons/zondicons/close';
|
|
31
49
|
|
|
32
|
-
import {
|
|
33
|
-
import
|
|
50
|
+
import { after } from '@noeldemartin/utils';
|
|
51
|
+
import { computed } from 'vue';
|
|
52
|
+
import { useForwardExpose } from 'reka-ui';
|
|
53
|
+
import type { ComponentPublicInstance, HTMLAttributes, Ref } from 'vue';
|
|
54
|
+
import type { Nullable } from '@noeldemartin/utils';
|
|
34
55
|
|
|
35
56
|
import Markdown from '@aerogel/core/components/ui/Markdown.vue';
|
|
36
|
-
import Button from '@aerogel/core/components/ui/Button.vue';
|
|
37
57
|
import HeadlessModal from '@aerogel/core/components/headless/HeadlessModal.vue';
|
|
38
58
|
import HeadlessModalContent from '@aerogel/core/components/headless/HeadlessModalContent.vue';
|
|
59
|
+
import HeadlessModalDescription from '@aerogel/core/components/headless/HeadlessModalDescription.vue';
|
|
39
60
|
import HeadlessModalOverlay from '@aerogel/core/components/headless/HeadlessModalOverlay.vue';
|
|
40
61
|
import HeadlessModalTitle from '@aerogel/core/components/headless/HeadlessModalTitle.vue';
|
|
62
|
+
import UI from '@aerogel/core/ui/UI';
|
|
41
63
|
import { classes } from '@aerogel/core/utils/classes';
|
|
64
|
+
import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
|
|
65
|
+
import { useEvent } from '@aerogel/core/utils/composition/events';
|
|
66
|
+
import type { AcceptRefs } from '@aerogel/core/utils/vue';
|
|
42
67
|
import type { ModalExpose, ModalProps, ModalSlots } from '@aerogel/core/components/contracts/Modal';
|
|
68
|
+
import type { UIModalContext } from '@aerogel/core/ui/UI';
|
|
69
|
+
|
|
70
|
+
type HeadlessModalInstance = ComponentPublicInstance & ModalExpose<T>;
|
|
43
71
|
|
|
44
72
|
const {
|
|
45
73
|
class: contentClass = '',
|
|
46
|
-
dismissable = true,
|
|
47
74
|
wrapperClass = '',
|
|
48
75
|
title,
|
|
76
|
+
titleHidden,
|
|
77
|
+
description,
|
|
49
78
|
persistent,
|
|
79
|
+
closeHidden,
|
|
50
80
|
...props
|
|
51
81
|
} = defineProps<
|
|
52
82
|
ModalProps & {
|
|
53
|
-
dismissable?: boolean;
|
|
54
83
|
wrapperClass?: HTMLAttributes['class'];
|
|
55
84
|
class?: HTMLAttributes['class'];
|
|
85
|
+
closeHidden?: boolean;
|
|
56
86
|
}
|
|
57
87
|
>();
|
|
58
88
|
|
|
59
|
-
|
|
60
|
-
|
|
89
|
+
defineSlots<ModalSlots<T>>();
|
|
90
|
+
defineExpose<AcceptRefs<ModalExpose<T>>>({
|
|
91
|
+
close: async (result) => $modal.value?.close(result),
|
|
92
|
+
$content: computed(() => $modal.value?.$content),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const { forwardRef, currentRef } = useForwardExpose<HeadlessModalInstance>();
|
|
96
|
+
const $modal = currentRef as Ref<Nullable<HeadlessModalInstance>>;
|
|
97
|
+
const context = injectReactiveOrFail<UIModalContext>('modal');
|
|
98
|
+
const inForeground = computed(() => !context.modal.closing && context.childIndex === UI.openModals.length);
|
|
99
|
+
const contentProps = computed(() => (description ? {} : { 'aria-describedby': undefined }));
|
|
100
|
+
const renderedContentClass = computed(() =>
|
|
101
|
+
classes('max-h-[90vh] overflow-auto px-4 pb-4', { 'pt-4': !title || titleHidden }, contentClass));
|
|
61
102
|
const renderedWrapperClass = computed(() =>
|
|
62
103
|
classes(
|
|
63
|
-
|
|
64
|
-
'
|
|
104
|
+
'isolate fixed top-1/2 left-1/2 z-50 w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2',
|
|
105
|
+
'overflow-hidden rounded-lg bg-white text-left shadow-xl sm:max-w-lg',
|
|
106
|
+
'animate-[fade-in_var(--tw-duration)_ease-in-out,grow_var(--tw-duration)_ease-in-out]',
|
|
107
|
+
'transition-[scale,opacity] will-change-[scale,opacity] duration-300',
|
|
108
|
+
{
|
|
109
|
+
'scale-50 opacity-0': !inForeground.value,
|
|
110
|
+
'scale-100 opacity-100': inForeground.value,
|
|
111
|
+
},
|
|
65
112
|
wrapperClass,
|
|
66
113
|
));
|
|
67
114
|
|
|
68
|
-
|
|
69
|
-
|
|
115
|
+
useEvent('modal-will-close', async ({ modal: { id } }) => {
|
|
116
|
+
if (id !== context.modal.id) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Wait for transitions to finish
|
|
121
|
+
await after({ ms: 300 });
|
|
122
|
+
});
|
|
70
123
|
</script>
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
<script setup lang="ts">
|
|
6
6
|
import { computed, provide, toRef, unref } from 'vue';
|
|
7
7
|
|
|
8
|
-
import type { UIModal
|
|
8
|
+
import type { UIModal } from '@aerogel/core/ui/UI.state';
|
|
9
|
+
import type { UIModalContext } from '@aerogel/core/ui/UI';
|
|
9
10
|
import type { AcceptRefs } from '@aerogel/core/utils/vue';
|
|
10
11
|
|
|
11
12
|
const props = defineProps<{
|
|
@@ -16,17 +16,18 @@ import { computed, onUnmounted, ref, watch } from 'vue';
|
|
|
16
16
|
|
|
17
17
|
import { classes } from '@aerogel/core/utils/classes';
|
|
18
18
|
import type Job from '@aerogel/core/jobs/Job';
|
|
19
|
+
import type { Falsifiable } from '@aerogel/core/utils';
|
|
19
20
|
|
|
20
21
|
const { filledClass, progress, job } = defineProps<{
|
|
21
22
|
filledClass?: string;
|
|
22
23
|
progress?: number;
|
|
23
|
-
job?: Job
|
|
24
|
+
job?: Falsifiable<Job>;
|
|
24
25
|
}>();
|
|
25
26
|
|
|
26
|
-
let cleanup: Function
|
|
27
|
+
let cleanup: Falsifiable<Function>;
|
|
27
28
|
const jobProgress = ref(0);
|
|
28
29
|
const filledClasses = computed(() =>
|
|
29
|
-
classes('size-full transition-transform duration-500 rounded-r-full ease-linear bg-primary', filledClass));
|
|
30
|
+
classes('size-full transition-transform duration-500 rounded-r-full ease-linear bg-primary-600', filledClass));
|
|
30
31
|
const renderedProgress = computed(() => {
|
|
31
32
|
if (typeof progress === 'number') {
|
|
32
33
|
return progress;
|
|
@@ -38,13 +39,13 @@ const renderedProgress = computed(() => {
|
|
|
38
39
|
watch(
|
|
39
40
|
() => job,
|
|
40
41
|
() => {
|
|
41
|
-
cleanup
|
|
42
|
+
cleanup && cleanup();
|
|
42
43
|
|
|
43
|
-
jobProgress.value = job
|
|
44
|
-
cleanup = job
|
|
44
|
+
jobProgress.value = job ? job.progress : 0;
|
|
45
|
+
cleanup = job && job.listeners.add({ onUpdated: (value) => (jobProgress.value = value) });
|
|
45
46
|
},
|
|
46
47
|
{ immediate: true },
|
|
47
48
|
);
|
|
48
49
|
|
|
49
|
-
onUnmounted(() => cleanup
|
|
50
|
+
onUnmounted(() => cleanup && cleanup());
|
|
50
51
|
</script>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
2
|
+
<!-- @vue-generic {import('@aerogel/core/ui/UI').ModalExposeResult<PromptModalExpose>} -->
|
|
3
|
+
<Modal v-slot="{ close }" :title="renderedTitle" persistent>
|
|
3
4
|
<Form :form @submit="close(form.draft)">
|
|
4
|
-
<Markdown :text="
|
|
5
|
+
<Markdown v-if="renderedMessage" :text="renderedMessage" />
|
|
5
6
|
<Input
|
|
6
7
|
name="draft"
|
|
7
8
|
class="mt-2"
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
<Button :variant="acceptVariant" submit>
|
|
14
15
|
{{ renderedAcceptText }}
|
|
15
16
|
</Button>
|
|
16
|
-
<Button :variant="cancelVariant" @click="close(
|
|
17
|
+
<Button :variant="cancelVariant" @click="close()">
|
|
17
18
|
{{ renderedCancelText }}
|
|
18
19
|
</Button>
|
|
19
20
|
</div>
|
|
@@ -28,8 +29,10 @@ import Form from '@aerogel/core/components/ui/Form.vue';
|
|
|
28
29
|
import Input from '@aerogel/core/components/ui/Input.vue';
|
|
29
30
|
import Modal from '@aerogel/core/components/ui/Modal.vue';
|
|
30
31
|
import { usePromptModal } from '@aerogel/core/components/contracts/PromptModal';
|
|
31
|
-
import type { PromptModalProps } from '@aerogel/core/components/contracts/PromptModal';
|
|
32
|
+
import type { PromptModalExpose, PromptModalProps } from '@aerogel/core/components/contracts/PromptModal';
|
|
32
33
|
|
|
33
34
|
const { cancelVariant = 'secondary', ...props } = defineProps<PromptModalProps>();
|
|
34
|
-
const { form, renderedAcceptText, renderedCancelText } = usePromptModal(props);
|
|
35
|
+
const { form, renderedTitle, renderedMessage, renderedAcceptText, renderedCancelText } = usePromptModal(props);
|
|
36
|
+
|
|
37
|
+
defineExpose<PromptModalExpose>();
|
|
35
38
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<HeadlessSelect v-bind="$props" @update:model-value="$emit('update:modelValue', $event)">
|
|
2
|
+
<HeadlessSelect :ref="forwardRef" v-bind="$props" @update:model-value="$emit('update:modelValue', $event)">
|
|
3
3
|
<SelectLabel />
|
|
4
4
|
<slot>
|
|
5
5
|
<SelectTrigger />
|
|
@@ -8,14 +8,20 @@
|
|
|
8
8
|
</HeadlessSelect>
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
|
-
<script setup lang="ts">
|
|
11
|
+
<script setup lang="ts" generic="T extends Nullable<FormFieldValue>">
|
|
12
|
+
import { useForwardExpose } from 'reka-ui';
|
|
13
|
+
import type { Nullable } from '@noeldemartin/utils';
|
|
14
|
+
|
|
12
15
|
import HeadlessSelect from '@aerogel/core/components/headless/HeadlessSelect.vue';
|
|
13
16
|
import type { SelectEmits, SelectProps } from '@aerogel/core/components/contracts/Select';
|
|
17
|
+
import type { FormFieldValue } from '@aerogel/core/forms';
|
|
14
18
|
|
|
15
19
|
import SelectLabel from './SelectLabel.vue';
|
|
16
20
|
import SelectOptions from './SelectOptions.vue';
|
|
17
21
|
import SelectTrigger from './SelectTrigger.vue';
|
|
18
22
|
|
|
19
|
-
defineProps<SelectProps
|
|
20
|
-
defineEmits<SelectEmits
|
|
23
|
+
defineProps<SelectProps<T>>();
|
|
24
|
+
defineEmits<SelectEmits<T>>();
|
|
25
|
+
|
|
26
|
+
const { forwardRef } = useForwardExpose();
|
|
21
27
|
</script>
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<HeadlessSelectLabel v-if="$slots.default" class="
|
|
2
|
+
<HeadlessSelectLabel v-if="$slots.default" :class="renderedClasses">
|
|
3
3
|
<slot />
|
|
4
4
|
</HeadlessSelectLabel>
|
|
5
|
-
<HeadlessSelectLabel v-else class="
|
|
5
|
+
<HeadlessSelectLabel v-else :class="renderedClasses" />
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
|
+
import { computed } from 'vue';
|
|
10
|
+
import type { HTMLAttributes } from 'vue';
|
|
11
|
+
|
|
9
12
|
import HeadlessSelectLabel from '@aerogel/core/components/headless/HeadlessSelectLabel.vue';
|
|
13
|
+
import { classes, injectReactiveOrFail } from '@aerogel/core/utils';
|
|
14
|
+
import type { SelectExpose } from '@aerogel/core/components/contracts/Select';
|
|
15
|
+
|
|
16
|
+
const { class: rootClasses } = defineProps<{ class?: HTMLAttributes['class'] }>();
|
|
17
|
+
|
|
18
|
+
const select = injectReactiveOrFail<SelectExpose>('select', '<SelectLabel> must be a child of a <Select>');
|
|
19
|
+
const renderedClasses = computed(() =>
|
|
20
|
+
classes('block text-sm leading-6 font-medium text-gray-900', select.labelClass, rootClasses));
|
|
10
21
|
</script>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HeadlessSelectOption :class="renderedOuterClasses" :value>
|
|
3
|
+
<div :class="renderedInnerClasses">
|
|
4
|
+
<slot />
|
|
5
|
+
</div>
|
|
6
|
+
</HeadlessSelectOption>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { computed } from 'vue';
|
|
11
|
+
import type { AcceptableValue } from 'reka-ui';
|
|
12
|
+
import type { HTMLAttributes } from 'vue';
|
|
13
|
+
|
|
14
|
+
import HeadlessSelectOption from '@aerogel/core/components/headless/HeadlessSelectOption.vue';
|
|
15
|
+
import { classes } from '@aerogel/core/utils';
|
|
16
|
+
|
|
17
|
+
const { class: outerClass, innerClass } = defineProps<{
|
|
18
|
+
value: AcceptableValue;
|
|
19
|
+
class?: HTMLAttributes['class'];
|
|
20
|
+
innerClass?: HTMLAttributes['class'];
|
|
21
|
+
}>();
|
|
22
|
+
const renderedOuterClasses = computed(() => classes('group p-1 outline-none', outerClass));
|
|
23
|
+
const renderedInnerClasses = computed(() =>
|
|
24
|
+
classes(
|
|
25
|
+
// eslint-disable-next-line vue/max-len
|
|
26
|
+
'relative flex max-w-[calc(100vw-2rem)] cursor-pointer items-center truncate rounded-md gap-2 px-2 py-1 text-sm select-none *:truncate group-data-[highlighted]:bg-gray-100 group-data-[state=checked]:font-semibold group-data-[state=unchecked]:opacity-50',
|
|
27
|
+
innerClass,
|
|
28
|
+
));
|
|
29
|
+
</script>
|
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<HeadlessSelectOptions
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
>
|
|
12
|
-
<div
|
|
13
|
-
class="relative flex max-w-[calc(100vw-2rem)] cursor-pointer items-center truncate rounded-md px-2 py-1 select-none *:truncate group-data-[highlighted]:bg-gray-100 group-data-[state=checked]:font-semibold group-data-[state=unchecked]:opacity-50"
|
|
14
|
-
>
|
|
15
|
-
<span class="text-sm">
|
|
16
|
-
{{ option.label }}
|
|
17
|
-
</span>
|
|
18
|
-
</div>
|
|
19
|
-
</HeadlessSelectOption>
|
|
2
|
+
<HeadlessSelectOptions :class="renderedClasses">
|
|
3
|
+
<slot v-if="select.options?.length">
|
|
4
|
+
<SelectOption v-for="option of select?.options ?? []" :key="option.key" :value="option.value">
|
|
5
|
+
{{ option.label }}
|
|
6
|
+
</SelectOption>
|
|
7
|
+
</slot>
|
|
8
|
+
<slot v-else>
|
|
9
|
+
<SelectOption disabled :value="null">
|
|
10
|
+
{{ $td('ui.selectEmpty', 'No options available') }}
|
|
11
|
+
</SelectOption>
|
|
20
12
|
</slot>
|
|
21
13
|
</HeadlessSelectOptions>
|
|
22
14
|
</template>
|
|
23
15
|
|
|
24
16
|
<script setup lang="ts">
|
|
25
|
-
import
|
|
17
|
+
import { computed } from 'vue';
|
|
18
|
+
import type { HTMLAttributes } from 'vue';
|
|
19
|
+
|
|
26
20
|
import HeadlessSelectOptions from '@aerogel/core/components/headless/HeadlessSelectOptions.vue';
|
|
27
|
-
import { injectReactiveOrFail } from '@aerogel/core/utils';
|
|
21
|
+
import { classes, injectReactiveOrFail } from '@aerogel/core/utils';
|
|
28
22
|
import type { SelectExpose } from '@aerogel/core/components/contracts/Select';
|
|
29
23
|
|
|
24
|
+
import SelectOption from './SelectOption.vue';
|
|
25
|
+
|
|
26
|
+
const { class: rootClasses } = defineProps<{ class?: HTMLAttributes['class'] }>();
|
|
27
|
+
|
|
30
28
|
const select = injectReactiveOrFail<SelectExpose>('select', '<SelectOptions> must be a child of a <Select>');
|
|
29
|
+
const renderedClasses = computed(() =>
|
|
30
|
+
classes(
|
|
31
|
+
'z-50 overflow-auto rounded-lg bg-white text-base shadow-lg ring-1 ring-black/5 focus:outline-hidden',
|
|
32
|
+
select.optionsClass,
|
|
33
|
+
rootClasses,
|
|
34
|
+
));
|
|
31
35
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<HeadlessSelectTrigger :class="renderedClasses">
|
|
3
|
-
<HeadlessSelectValue class="col-start-1 row-start-1 truncate pr-
|
|
3
|
+
<HeadlessSelectValue class="col-start-1 row-start-1 truncate pr-6" />
|
|
4
4
|
<IconCheveronDown class="col-start-1 row-start-1 size-5 self-center justify-self-end text-gray-500 sm:size-4" />
|
|
5
5
|
</HeadlessSelectTrigger>
|
|
6
6
|
</template>
|
|
@@ -22,7 +22,7 @@ const select = injectReactiveOrFail<SelectExpose>('select', '<SelectTrigger> mus
|
|
|
22
22
|
const renderedClasses = computed(() =>
|
|
23
23
|
classes(
|
|
24
24
|
// eslint-disable-next-line vue/max-len
|
|
25
|
-
'focus:outline-primary grid w-full cursor-default grid-cols-1 rounded-md bg-white py-1.5 pr-2 pl-3 text-left text-gray-900 outline
|
|
25
|
+
'focus:outline-primary-600 data-[state=open]:outline-primary-600 grid w-full cursor-default grid-cols-1 rounded-md bg-white py-1.5 pr-2 pl-3 text-left text-gray-900 outline-1 -outline-offset-1 outline-gray-300 focus:outline-2 focus:-outline-offset-2 sm:text-sm/6',
|
|
26
26
|
{ 'mt-1': select.label },
|
|
27
27
|
rootClasses,
|
|
28
28
|
));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HeadlessSwitch
|
|
3
|
+
class="flex flex-row items-center gap-1"
|
|
4
|
+
input-class="disabled:opacity-50 disabled:cursor-not-allowed data-[state=checked]:bg-primary-600 data-[state=unchecked]:bg-gray-200 relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focusdisabled:opacity-50 disabled:cursor-not-allowed :ring-2 focus:ring-primary-600 focus:ring-offset-2 focus:outline-hidden"
|
|
5
|
+
thumb-class="data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 pointer-events-none inline-block size-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import HeadlessSwitch from '@aerogel/core/components/headless/HeadlessSwitch.vue';
|
|
11
|
+
</script>
|