@toife/vue 3.2.5 → 3.2.7
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/package.json +20 -21
- package/src/components/action/action.composable.ts +32 -0
- package/src/components/action/action.html +25 -0
- package/src/components/action/action.vue +69 -0
- package/src/components/action/index.ts +2 -0
- package/src/components/app/app.html +24 -0
- package/src/components/app/app.vue +45 -0
- package/src/components/app/index.ts +1 -0
- package/src/components/avatar/avatar.html +3 -0
- package/src/components/avatar/avatar.vue +35 -0
- package/src/components/avatar/index.ts +1 -0
- package/src/components/button/button.html +6 -0
- package/src/components/button/button.vue +54 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/cable/cable.html +3 -0
- package/src/components/cable/cable.vue +33 -0
- package/src/components/cable/index.ts +1 -0
- package/src/components/card/card/card.html +3 -0
- package/src/components/card/card/card.vue +52 -0
- package/src/components/card/card/index.ts +1 -0
- package/src/components/card/card-body/card-body.html +3 -0
- package/src/components/card/card-body/card-body.vue +6 -0
- package/src/components/card/card-body/index.ts +1 -0
- package/src/components/card/card-footer/card-footer.html +3 -0
- package/src/components/card/card-footer/card-footer.vue +18 -0
- package/src/components/card/card-footer/index.ts +1 -0
- package/src/components/card/card-header/card-header.html +3 -0
- package/src/components/card/card-header/card-header.vue +18 -0
- package/src/components/card/card-header/index.ts +1 -0
- package/src/components/card/index.ts +4 -0
- package/src/components/checkbox/checkbox.html +12 -0
- package/src/components/checkbox/checkbox.vue +74 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/collapse/collapse.html +16 -0
- package/src/components/collapse/collapse.vue +126 -0
- package/src/components/collapse/index.ts +1 -0
- package/src/components/container/container.html +1 -0
- package/src/components/container/container.vue +7 -0
- package/src/components/container/index.ts +1 -0
- package/src/components/decision-modal/decision-modal.composable.ts +33 -0
- package/src/components/decision-modal/decision-modal.html +29 -0
- package/src/components/decision-modal/decision-modal.vue +76 -0
- package/src/components/decision-modal/index.ts +2 -0
- package/src/components/divider/divider.html +1 -0
- package/src/components/divider/divider.vue +26 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/dropdown/dropdown.html +6 -0
- package/src/components/dropdown/dropdown.vue +101 -0
- package/src/components/dropdown/index.ts +1 -0
- package/src/components/field/field.html +30 -0
- package/src/components/field/field.vue +121 -0
- package/src/components/field/index.ts +1 -0
- package/src/components/form-group/form-group.html +3 -0
- package/src/components/form-group/form-group.vue +15 -0
- package/src/components/form-group/index.ts +1 -0
- package/src/components/gesture-indicator/gesture-indicator.html +1 -0
- package/src/components/gesture-indicator/gesture-indicator.vue +32 -0
- package/src/components/gesture-indicator/index.ts +1 -0
- package/src/components/image/image.html +1 -0
- package/src/components/image/image.vue +32 -0
- package/src/components/image/index.ts +1 -0
- package/src/components/index.ts +32 -0
- package/src/components/layout/flex/flex.html +1 -0
- package/src/components/layout/flex/flex.vue +15 -0
- package/src/components/layout/flex/index.ts +1 -0
- package/src/components/layout/flex-item/flex-item.html +1 -0
- package/src/components/layout/flex-item/flex-item.vue +11 -0
- package/src/components/layout/flex-item/index.ts +1 -0
- package/src/components/layout/grid/grid.html +1 -0
- package/src/components/layout/grid/grid.vue +15 -0
- package/src/components/layout/grid/index.ts +1 -0
- package/src/components/layout/grid-item/grid-item.html +1 -0
- package/src/components/layout/grid-item/grid-item.vue +11 -0
- package/src/components/layout/grid-item/index.ts +1 -0
- package/src/components/layout/index.ts +4 -0
- package/src/components/modal/index.ts +1 -0
- package/src/components/modal/modal.html +20 -0
- package/src/components/modal/modal.vue +248 -0
- package/src/components/page/index.ts +1 -0
- package/src/components/page/page.html +3 -0
- package/src/components/page/page.vue +7 -0
- package/src/components/present/index.ts +2 -0
- package/src/components/present/present.composable.ts +22 -0
- package/src/components/present/present.html +11 -0
- package/src/components/present/present.vue +234 -0
- package/src/components/radio/index.ts +2 -0
- package/src/components/radio/radio/index.ts +1 -0
- package/src/components/radio/radio/radio.html +11 -0
- package/src/components/radio/radio/radio.vue +84 -0
- package/src/components/radio/radio-group/index.ts +1 -0
- package/src/components/radio/radio-group/radio-group.html +3 -0
- package/src/components/radio/radio-group/radio-group.vue +59 -0
- package/src/components/refresher/index.ts +1 -0
- package/src/components/refresher/refresher.html +3 -0
- package/src/components/refresher/refresher.vue +100 -0
- package/src/components/route/index.ts +5 -0
- package/src/components/route/route-navigator/index.ts +1 -0
- package/src/components/route/route-navigator/route-navigator.html +19 -0
- package/src/components/route/route-navigator/route-navigator.vue +254 -0
- package/src/components/route/route-outlet/index.ts +1 -0
- package/src/components/route/route-outlet/route-outlet.html +1 -0
- package/src/components/route/route-outlet/route-outlet.vue +39 -0
- package/src/components/route/route-provider/index.ts +1 -0
- package/src/components/route/route-provider/route-provider.html +1 -0
- package/src/components/route/route-provider/route-provider.vue +24 -0
- package/src/components/route/route-wrapper/index.ts +2 -0
- package/src/components/route/route-wrapper/route-wrapper.composable.ts +49 -0
- package/src/components/route/route-wrapper/route-wrapper.html +3 -0
- package/src/components/route/route-wrapper/route-wrapper.vue +44 -0
- package/src/components/route/route.util.ts +9 -0
- package/src/components/segmented-field/index.ts +1 -0
- package/src/components/segmented-field/segmented-field.html +16 -0
- package/src/components/segmented-field/segmented-field.vue +243 -0
- package/src/components/select/index.ts +1 -0
- package/src/components/select/select.html +28 -0
- package/src/components/select/select.vue +101 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.html +1 -0
- package/src/components/skeleton/skeleton.vue +33 -0
- package/src/components/slide-range/index.ts +1 -0
- package/src/components/slide-range/slide-range.html +20 -0
- package/src/components/slide-range/slide-range.vue +269 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/switch/switch.html +14 -0
- package/src/components/switch/switch.vue +86 -0
- package/src/components/tabs/index.ts +2 -0
- package/src/components/tabs/tab/index.ts +1 -0
- package/src/components/tabs/tab/tab.html +5 -0
- package/src/components/tabs/tab/tab.vue +34 -0
- package/src/components/tabs/tabs/index.ts +1 -0
- package/src/components/tabs/tabs/tabs.html +3 -0
- package/src/components/tabs/tabs/tabs.vue +151 -0
- package/src/components/tag/index.ts +1 -0
- package/src/components/tag/tag.html +1 -0
- package/src/components/tag/tag.vue +33 -0
- package/src/components/toast/index.ts +3 -0
- package/src/components/toast/toast/index.ts +1 -0
- package/src/components/toast/toast/toast.html +9 -0
- package/src/components/toast/toast/toast.vue +28 -0
- package/src/components/toast/toast-content/index.ts +1 -0
- package/src/components/toast/toast-content/toast-content.html +1 -0
- package/src/components/toast/toast-content/toast-content.vue +51 -0
- package/src/components/toast/toast.composable.ts +22 -0
- package/src/components/toolbar/index.ts +1 -0
- package/src/components/toolbar/toolbar.html +3 -0
- package/src/components/toolbar/toolbar.vue +39 -0
- package/src/env.d.ts +7 -0
- package/src/factory.ts +162 -0
- package/src/index.ts +4 -0
- package/src/shared/provider-state.ts +8 -0
- package/src/types.ts +4 -0
- package/dist/components/action/action.composable.d.ts +0 -44
- package/dist/components/action/action.vue.d.ts +0 -16
- package/dist/components/action/index.d.ts +0 -2
- package/dist/components/app/app.vue.d.ts +0 -11
- package/dist/components/app/index.d.ts +0 -1
- package/dist/components/avatar/avatar.vue.d.ts +0 -8
- package/dist/components/avatar/index.d.ts +0 -1
- package/dist/components/button/button.vue.d.ts +0 -9
- package/dist/components/button/index.d.ts +0 -1
- package/dist/components/cable/cable.vue.d.ts +0 -6
- package/dist/components/cable/index.d.ts +0 -1
- package/dist/components/card/card/card.vue.d.ts +0 -7
- package/dist/components/card/card/index.d.ts +0 -1
- package/dist/components/card/card-body/card-body.vue.d.ts +0 -2
- package/dist/components/card/card-body/index.d.ts +0 -1
- package/dist/components/card/card-footer/card-footer.vue.d.ts +0 -2
- package/dist/components/card/card-footer/index.d.ts +0 -1
- package/dist/components/card/card-header/card-header.vue.d.ts +0 -2
- package/dist/components/card/card-header/index.d.ts +0 -1
- package/dist/components/card/index.d.ts +0 -4
- package/dist/components/checkbox/checkbox.vue.d.ts +0 -18
- package/dist/components/checkbox/index.d.ts +0 -1
- package/dist/components/collapse/collapse.vue.d.ts +0 -12
- package/dist/components/collapse/index.d.ts +0 -1
- package/dist/components/container/container.vue.d.ts +0 -2
- package/dist/components/container/index.d.ts +0 -1
- package/dist/components/decision-modal/decision-modal.composable.d.ts +0 -46
- package/dist/components/decision-modal/decision-modal.vue.d.ts +0 -16
- package/dist/components/decision-modal/index.d.ts +0 -2
- package/dist/components/divider/divider.vue.d.ts +0 -5
- package/dist/components/divider/index.d.ts +0 -1
- package/dist/components/dropdown/dropdown.vue.d.ts +0 -20
- package/dist/components/dropdown/index.d.ts +0 -1
- package/dist/components/field/field.vue.d.ts +0 -30
- package/dist/components/field/index.d.ts +0 -1
- package/dist/components/form-group/form-group.vue.d.ts +0 -5
- package/dist/components/form-group/index.d.ts +0 -1
- package/dist/components/gesture-indicator/gesture-indicator.vue.d.ts +0 -6
- package/dist/components/gesture-indicator/index.d.ts +0 -1
- package/dist/components/image/image.vue.d.ts +0 -3
- package/dist/components/image/index.d.ts +0 -1
- package/dist/components/index.d.ts +0 -32
- package/dist/components/layout/flex/flex.vue.d.ts +0 -5
- package/dist/components/layout/flex/index.d.ts +0 -1
- package/dist/components/layout/flex-item/flex-item.vue.d.ts +0 -5
- package/dist/components/layout/flex-item/index.d.ts +0 -1
- package/dist/components/layout/grid/grid.vue.d.ts +0 -5
- package/dist/components/layout/grid/index.d.ts +0 -1
- package/dist/components/layout/grid-item/grid-item.vue.d.ts +0 -5
- package/dist/components/layout/grid-item/index.d.ts +0 -1
- package/dist/components/layout/index.d.ts +0 -4
- package/dist/components/modal/index.d.ts +0 -1
- package/dist/components/modal/modal.vue.d.ts +0 -17
- package/dist/components/page/index.d.ts +0 -1
- package/dist/components/page/page.vue.d.ts +0 -2
- package/dist/components/present/index.d.ts +0 -2
- package/dist/components/present/present.composable.d.ts +0 -5
- package/dist/components/present/present.vue.d.ts +0 -18
- package/dist/components/radio/index.d.ts +0 -2
- package/dist/components/radio/radio/index.d.ts +0 -1
- package/dist/components/radio/radio/radio.vue.d.ts +0 -7
- package/dist/components/radio/radio-group/index.d.ts +0 -1
- package/dist/components/radio/radio-group/radio-group.vue.d.ts +0 -13
- package/dist/components/refresher/index.d.ts +0 -1
- package/dist/components/refresher/refresher.vue.d.ts +0 -12
- package/dist/components/route/index.d.ts +0 -5
- package/dist/components/route/route-navigator/index.d.ts +0 -1
- package/dist/components/route/route-navigator/route-navigator.vue.d.ts +0 -11
- package/dist/components/route/route-outlet/index.d.ts +0 -1
- package/dist/components/route/route-outlet/route-outlet.vue.d.ts +0 -5
- package/dist/components/route/route-provider/index.d.ts +0 -1
- package/dist/components/route/route-provider/route-provider.vue.d.ts +0 -3
- package/dist/components/route/route-wrapper/index.d.ts +0 -2
- package/dist/components/route/route-wrapper/route-wrapper.composable.d.ts +0 -6
- package/dist/components/route/route-wrapper/route-wrapper.vue.d.ts +0 -5
- package/dist/components/route/route.util.d.ts +0 -3
- package/dist/components/segmented-field/index.d.ts +0 -1
- package/dist/components/segmented-field/segmented-field.vue.d.ts +0 -28
- package/dist/components/select/index.d.ts +0 -1
- package/dist/components/select/select.vue.d.ts +0 -19
- package/dist/components/skeleton/index.d.ts +0 -1
- package/dist/components/skeleton/skeleton.vue.d.ts +0 -6
- package/dist/components/slide-range/index.d.ts +0 -1
- package/dist/components/slide-range/slide-range.vue.d.ts +0 -18
- package/dist/components/switch/index.d.ts +0 -1
- package/dist/components/switch/switch.vue.d.ts +0 -13
- package/dist/components/tabs/index.d.ts +0 -2
- package/dist/components/tabs/tab/index.d.ts +0 -1
- package/dist/components/tabs/tab/tab.vue.d.ts +0 -5
- package/dist/components/tabs/tabs/index.d.ts +0 -1
- package/dist/components/tabs/tabs/tabs.vue.d.ts +0 -14
- package/dist/components/tag/index.d.ts +0 -1
- package/dist/components/tag/tag.vue.d.ts +0 -6
- package/dist/components/toast/index.d.ts +0 -3
- package/dist/components/toast/toast/index.d.ts +0 -1
- package/dist/components/toast/toast/toast.vue.d.ts +0 -5
- package/dist/components/toast/toast-content/index.d.ts +0 -1
- package/dist/components/toast/toast-content/toast-content.vue.d.ts +0 -11
- package/dist/components/toast/toast.composable.d.ts +0 -22
- package/dist/components/toolbar/index.d.ts +0 -1
- package/dist/components/toolbar/toolbar.vue.d.ts +0 -7
- package/dist/factory.d.ts +0 -38
- package/dist/index.d.ts +0 -3
- package/dist/index.es.js +0 -3522
- package/dist/index.umd.js +0 -1
- package/dist/shared/provider-state.d.ts +0 -5
- package/dist/styles/action.css +0 -1
- package/dist/styles/app.css +0 -1
- package/dist/styles/avatar.css +0 -1
- package/dist/styles/button.css +0 -1
- package/dist/styles/cable.css +0 -1
- package/dist/styles/card-body.css +0 -1
- package/dist/styles/card-footer.css +0 -1
- package/dist/styles/card-header.css +0 -1
- package/dist/styles/card.css +0 -1
- package/dist/styles/checkbox.css +0 -1
- package/dist/styles/collapse.css +0 -1
- package/dist/styles/container.css +0 -1
- package/dist/styles/decision-modal.css +0 -1
- package/dist/styles/divider.css +0 -1
- package/dist/styles/dropdown.css +0 -1
- package/dist/styles/field.css +0 -1
- package/dist/styles/flex-item.css +0 -1
- package/dist/styles/flex.css +0 -1
- package/dist/styles/form-group.css +0 -1
- package/dist/styles/gesture-indicator.css +0 -1
- package/dist/styles/grid-item.css +0 -1
- package/dist/styles/grid.css +0 -1
- package/dist/styles/index.css +0 -40
- package/dist/styles/modal.css +0 -1
- package/dist/styles/page.css +0 -1
- package/dist/styles/present.css +0 -1
- package/dist/styles/radio-group.css +0 -1
- package/dist/styles/radio.css +0 -1
- package/dist/styles/refresher.css +0 -1
- package/dist/styles/route-navigator.css +0 -1
- package/dist/styles/segmented-field.css +0 -1
- package/dist/styles/select.css +0 -1
- package/dist/styles/skeleton.css +0 -1
- package/dist/styles/slide-range.css +0 -1
- package/dist/styles/switch.css +0 -1
- package/dist/styles/tab.css +0 -1
- package/dist/styles/tabs.css +0 -1
- package/dist/styles/tag.css +0 -1
- package/dist/styles/toast-content.css +0 -1
- package/dist/styles/toast.css +0 -1
- package/dist/styles/toolbar.css +0 -1
- package/dist/types.d.ts +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from "./checkbox.vue";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<div v-bind="wrapperAttrs">
|
|
2
|
+
<div
|
|
3
|
+
v-bind="triggerAttrs"
|
|
4
|
+
role="button"
|
|
5
|
+
tabindex="0"
|
|
6
|
+
@pointerup="toggle"
|
|
7
|
+
@keydown.enter.space.prevent="toggle"
|
|
8
|
+
>
|
|
9
|
+
<slot name="trigger" />
|
|
10
|
+
</div>
|
|
11
|
+
<div v-bind="contentAttrs" @transitionend="onTransitionEnd">
|
|
12
|
+
<div ref="contentRef" :class="contentInnerClass">
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/collapse/collapse.scss" scoped></style>
|
|
2
|
+
<template src="./collapse.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { unref, computed, inject, nextTick, onMounted, ref, watch } from "vue";
|
|
5
|
+
import {
|
|
6
|
+
COLLAPSE_DEFAULT_PROPS,
|
|
7
|
+
APP_PROVIDER_STATE_KEY,
|
|
8
|
+
getCollapseAttrs,
|
|
9
|
+
getCollapseContentAttrs,
|
|
10
|
+
getCollapseContentInnerClass,
|
|
11
|
+
getCollapseTriggerAttrs,
|
|
12
|
+
type AppProviderState,
|
|
13
|
+
type CollapseEvent,
|
|
14
|
+
type CollapseProps,
|
|
15
|
+
} from "@toife/core";
|
|
16
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
17
|
+
|
|
18
|
+
// Component setup (props, emits, injects)
|
|
19
|
+
// ----------------------------------------------------------------------------
|
|
20
|
+
const props = withDefaults(defineProps<CollapseProps>(), {
|
|
21
|
+
...COLLAPSE_DEFAULT_PROPS,
|
|
22
|
+
});
|
|
23
|
+
const emit = defineEmits<CollapseEvent>();
|
|
24
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
25
|
+
|
|
26
|
+
// Reactive state
|
|
27
|
+
// ----------------------------------------------------------------------------
|
|
28
|
+
const contentRef = ref<HTMLElement | null>(null);
|
|
29
|
+
const contentHeight = ref(0);
|
|
30
|
+
const isOpen = ref(false);
|
|
31
|
+
const isFirstOpen = ref(true);
|
|
32
|
+
|
|
33
|
+
// Computed properties
|
|
34
|
+
// ----------------------------------------------------------------------------
|
|
35
|
+
const role = computed(() => {
|
|
36
|
+
return props.role ?? unref(appState?.role) ?? "";
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const durationCss = computed(() =>
|
|
40
|
+
props.duration !== undefined ? `${props.duration / 1000}s` : undefined
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const wrapperAttrs = computed(() =>
|
|
44
|
+
getCollapseAttrs({
|
|
45
|
+
role: role.value,
|
|
46
|
+
open: isOpen.value,
|
|
47
|
+
disabled: props.disabled,
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const triggerAttrs = computed(() =>
|
|
52
|
+
getCollapseTriggerAttrs({
|
|
53
|
+
open: isOpen.value,
|
|
54
|
+
disabled: props.disabled,
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const contentAttrs = computed(() =>
|
|
59
|
+
getCollapseContentAttrs({
|
|
60
|
+
transition: !isFirstOpen.value,
|
|
61
|
+
duration: durationCss.value,
|
|
62
|
+
height: isOpen.value ? `${contentHeight.value}px` : "0px",
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const contentInnerClass = computed(() => getCollapseContentInnerClass());
|
|
67
|
+
|
|
68
|
+
// Methods
|
|
69
|
+
// ----------------------------------------------------------------------------
|
|
70
|
+
const measureContent = () => {
|
|
71
|
+
if (contentRef.value) {
|
|
72
|
+
contentHeight.value = contentRef.value.scrollHeight;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const toggle = () => {
|
|
77
|
+
if (props.disabled) return;
|
|
78
|
+
isOpen.value = !isOpen.value;
|
|
79
|
+
emit("update:modelValue", isOpen.value);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const onTransitionEnd = () => {
|
|
83
|
+
// Optional: hook for transition end (e.g. a11y)
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Lifecycle
|
|
87
|
+
// ----------------------------------------------------------------------------
|
|
88
|
+
watch(
|
|
89
|
+
() => props.modelValue,
|
|
90
|
+
async (open) => {
|
|
91
|
+
isOpen.value = open;
|
|
92
|
+
if (open) {
|
|
93
|
+
await nextTick();
|
|
94
|
+
measureContent();
|
|
95
|
+
isFirstOpen.value = false;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{ immediate: true }
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
watch(
|
|
102
|
+
() => contentRef.value,
|
|
103
|
+
(el) => {
|
|
104
|
+
if (el && isOpen.value) {
|
|
105
|
+
measureContent();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
watch(
|
|
111
|
+
() => [contentRef.value?.innerHTML, isOpen.value],
|
|
112
|
+
async () => {
|
|
113
|
+
if (isOpen.value) {
|
|
114
|
+
await nextTick();
|
|
115
|
+
measureContent();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
onMounted(async () => {
|
|
121
|
+
await nextTick();
|
|
122
|
+
if (isOpen.value) {
|
|
123
|
+
measureContent();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Collapse } from "./collapse.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div v-bind="containerAttrs"><slot /></div>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/container/container.scss" scoped></style>
|
|
2
|
+
<template src="./container.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { getContainerAttrs } from "@toife/core";
|
|
5
|
+
// Static layout wrapper classes
|
|
6
|
+
const containerAttrs = getContainerAttrs();
|
|
7
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Container } from "./container.vue";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { type DecisionModalButton, type DecisionModalComposableProps } from "@toife/core";
|
|
3
|
+
|
|
4
|
+
const data = ref<DecisionModalComposableProps | null>(null);
|
|
5
|
+
const visible = ref(false);
|
|
6
|
+
|
|
7
|
+
export const useDecisionModal = () => {
|
|
8
|
+
const open = (props: DecisionModalComposableProps) => {
|
|
9
|
+
data.value = props;
|
|
10
|
+
// Defer visibility so the modal mounts with props before entering the open transition
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
visible.value = true;
|
|
13
|
+
}, 50);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const close = (type?: string) => {
|
|
17
|
+
data.value?.onClose?.();
|
|
18
|
+
visible.value = false;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const choose = (btn: DecisionModalButton) => {
|
|
22
|
+
data.value?.onChoose?.(btn);
|
|
23
|
+
visible.value = false;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
open,
|
|
28
|
+
close,
|
|
29
|
+
choose,
|
|
30
|
+
visible,
|
|
31
|
+
data,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<Present
|
|
2
|
+
:placement="placement"
|
|
3
|
+
backdrop="display"
|
|
4
|
+
:keepalive="keepalive"
|
|
5
|
+
:visible="visible"
|
|
6
|
+
@close="onClose"
|
|
7
|
+
>
|
|
8
|
+
<div v-bind="decisionModalAttrs">
|
|
9
|
+
<slot name="header">
|
|
10
|
+
<div v-bind="decisionModalHeaderAttrs" v-if="title">{{ title }}</div>
|
|
11
|
+
</slot>
|
|
12
|
+
<slot name="body">
|
|
13
|
+
<div v-bind="decisionModalBodyAttrs">{{ message }}</div>
|
|
14
|
+
</slot>
|
|
15
|
+
<slot name="footer">
|
|
16
|
+
<div v-bind="decisionModalFooterAttrs">
|
|
17
|
+
<CustomButton
|
|
18
|
+
v-for="(btn, btnIndex) in actions"
|
|
19
|
+
:key="`${btnIndex}`"
|
|
20
|
+
:role="btn.role"
|
|
21
|
+
:variant="btn.variant"
|
|
22
|
+
@click="onChoose(btn)"
|
|
23
|
+
:shape="shape"
|
|
24
|
+
>{{ btn.text }}</CustomButton
|
|
25
|
+
>
|
|
26
|
+
</div>
|
|
27
|
+
</slot>
|
|
28
|
+
</div>
|
|
29
|
+
</Present>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/decision-modal/decision-modal.scss" scoped></style>
|
|
2
|
+
<template src="./decision-modal.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { unref, computed, inject, ref } from "vue";
|
|
5
|
+
import { Present } from "../present";
|
|
6
|
+
import { Button as CustomButton } from "../button";
|
|
7
|
+
import {
|
|
8
|
+
DECISION_MODAL_DEFAULT_PROPS,
|
|
9
|
+
APP_PROVIDER_STATE_KEY,
|
|
10
|
+
getDecisionModalAttrs,
|
|
11
|
+
getDecisionModalBodyAttrs,
|
|
12
|
+
getDecisionModalFooterAttrs,
|
|
13
|
+
getDecisionModalHeaderAttrs,
|
|
14
|
+
type DecisionModalButton,
|
|
15
|
+
type AppProviderState,
|
|
16
|
+
type DecisionModalEvent,
|
|
17
|
+
type DecisionModalProps,
|
|
18
|
+
} from "@toife/core";
|
|
19
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
20
|
+
|
|
21
|
+
// Component setup (props, emits, injects)
|
|
22
|
+
// ----------------------------------------------------------------------------
|
|
23
|
+
const props = withDefaults(defineProps<DecisionModalProps>(), {
|
|
24
|
+
...DECISION_MODAL_DEFAULT_PROPS,
|
|
25
|
+
});
|
|
26
|
+
const emit = defineEmits<DecisionModalEvent>();
|
|
27
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
28
|
+
|
|
29
|
+
// Reactive state
|
|
30
|
+
// ----------------------------------------------------------------------------
|
|
31
|
+
const pop = ref(false);
|
|
32
|
+
|
|
33
|
+
// Computed properties
|
|
34
|
+
// ----------------------------------------------------------------------------
|
|
35
|
+
const shape = computed(() => {
|
|
36
|
+
return props.shape || unref(appState?.shape) || "";
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const divider = computed(() => {
|
|
40
|
+
return (props.divider !== undefined ? props.divider : unref(appState?.divider)) ?? false;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const decisionModalAttrs = computed(() => {
|
|
44
|
+
const role = props.role || unref(appState?.role) || "";
|
|
45
|
+
|
|
46
|
+
return getDecisionModalAttrs({
|
|
47
|
+
role,
|
|
48
|
+
shape: shape.value,
|
|
49
|
+
pop: pop.value,
|
|
50
|
+
divider: divider.value,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const decisionModalHeaderAttrs = computed(() => getDecisionModalHeaderAttrs());
|
|
55
|
+
const decisionModalBodyAttrs = computed(() => getDecisionModalBodyAttrs());
|
|
56
|
+
const decisionModalFooterAttrs = computed(() => getDecisionModalFooterAttrs({ flow: props.flow }));
|
|
57
|
+
|
|
58
|
+
// Methods
|
|
59
|
+
// ----------------------------------------------------------------------------
|
|
60
|
+
const onClose = (val: string) => {
|
|
61
|
+
if (props.dismiss && props.dismiss.includes(val)) {
|
|
62
|
+
emit("close", val);
|
|
63
|
+
} else if (val === "backdrop") {
|
|
64
|
+
pop.value = true;
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
pop.value = false;
|
|
67
|
+
}, 300);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const onChoose = (btn: DecisionModalButton) => {
|
|
72
|
+
emit("close");
|
|
73
|
+
btn.handler?.();
|
|
74
|
+
emit("choose", btn);
|
|
75
|
+
};
|
|
76
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div v-bind="dividerAttrs"></div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/divider/divider.scss" scoped></style>
|
|
2
|
+
<template src="./divider.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { unref, computed, inject } from "vue";
|
|
5
|
+
import {
|
|
6
|
+
DIVIDER_DEFAULT_PROPS,
|
|
7
|
+
APP_PROVIDER_STATE_KEY,
|
|
8
|
+
getDividerAttrs,
|
|
9
|
+
type AppProviderState,
|
|
10
|
+
type DividerProps,
|
|
11
|
+
} from "@toife/core";
|
|
12
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
13
|
+
// Component setup (props, emits, injects)
|
|
14
|
+
// ----------------------------------------------------------------------------
|
|
15
|
+
const props = withDefaults(defineProps<DividerProps>(), {
|
|
16
|
+
...DIVIDER_DEFAULT_PROPS,
|
|
17
|
+
});
|
|
18
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
19
|
+
|
|
20
|
+
// Computed properties
|
|
21
|
+
// ----------------------------------------------------------------------------
|
|
22
|
+
const dividerAttrs = computed(() => {
|
|
23
|
+
const role = props.role || unref(appState?.role) || "";
|
|
24
|
+
return getDividerAttrs({ role, direction: props.direction });
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Divider } from "./divider.vue";
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/dropdown/dropdown.scss" scoped></style>
|
|
2
|
+
<template src="./dropdown.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { unref, computed, inject, onMounted, onUnmounted, ref, watch } from "vue";
|
|
5
|
+
import {
|
|
6
|
+
DROPDOWN_DEFAULT_PROPS,
|
|
7
|
+
APP_PROVIDER_STATE_KEY,
|
|
8
|
+
getDropdownAttrs,
|
|
9
|
+
getDropdownPanelAttrs,
|
|
10
|
+
type AppProviderState,
|
|
11
|
+
type DropdownEvent,
|
|
12
|
+
type DropdownProps,
|
|
13
|
+
} from "@toife/core";
|
|
14
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
15
|
+
|
|
16
|
+
// Component setup (props, emits, injects)
|
|
17
|
+
// ----------------------------------------------------------------------------
|
|
18
|
+
const props = withDefaults(defineProps<DropdownProps>(), {
|
|
19
|
+
...DROPDOWN_DEFAULT_PROPS,
|
|
20
|
+
});
|
|
21
|
+
const emit = defineEmits<DropdownEvent>();
|
|
22
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
23
|
+
|
|
24
|
+
// Reactive state
|
|
25
|
+
// ----------------------------------------------------------------------------
|
|
26
|
+
const rootRef = ref<HTMLElement | null>(null);
|
|
27
|
+
const isOpen = ref(false);
|
|
28
|
+
|
|
29
|
+
// Computed properties
|
|
30
|
+
// ----------------------------------------------------------------------------
|
|
31
|
+
const wrapperAttrs = computed(() => {
|
|
32
|
+
const role = props.role ?? unref(appState?.role) ?? "";
|
|
33
|
+
const shadow = props.shadow ?? unref(appState?.shadow) ?? false;
|
|
34
|
+
const shape = props.shape ?? unref(appState?.shape) ?? "";
|
|
35
|
+
|
|
36
|
+
return getDropdownAttrs({
|
|
37
|
+
role,
|
|
38
|
+
shape,
|
|
39
|
+
size: props.size,
|
|
40
|
+
open: isOpen.value,
|
|
41
|
+
disabled: props.disabled,
|
|
42
|
+
shadow,
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const panelAttrs = computed(() => getDropdownPanelAttrs({ placement: props.placement }));
|
|
47
|
+
|
|
48
|
+
// Methods
|
|
49
|
+
// ----------------------------------------------------------------------------
|
|
50
|
+
const toggle = () => {
|
|
51
|
+
if (props.disabled) return;
|
|
52
|
+
isOpen.value = !isOpen.value;
|
|
53
|
+
emit("update:modelValue", isOpen.value);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const close = () => {
|
|
57
|
+
if (!isOpen.value) return;
|
|
58
|
+
isOpen.value = false;
|
|
59
|
+
emit("update:modelValue", false);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const onDocPointerDown = (e: PointerEvent) => {
|
|
63
|
+
if (!isOpen.value) return;
|
|
64
|
+
const root = rootRef.value;
|
|
65
|
+
if (root && !root.contains(e.target as Node)) {
|
|
66
|
+
close();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const onDocKeydown = (e: KeyboardEvent) => {
|
|
71
|
+
if (e.key === "Escape" && isOpen.value) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
close();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Lifecycle
|
|
78
|
+
// ----------------------------------------------------------------------------
|
|
79
|
+
watch(
|
|
80
|
+
() => props.modelValue,
|
|
81
|
+
(open) => {
|
|
82
|
+
isOpen.value = open;
|
|
83
|
+
},
|
|
84
|
+
{ immediate: true }
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
watch(isOpen, (next, prev) => {
|
|
88
|
+
if (next && !prev) emit("open");
|
|
89
|
+
if (!next && prev) emit("close");
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
onMounted(() => {
|
|
93
|
+
document.addEventListener("pointerdown", onDocPointerDown, true);
|
|
94
|
+
document.addEventListener("keydown", onDocKeydown, true);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
onUnmounted(() => {
|
|
98
|
+
document.removeEventListener("pointerdown", onDocPointerDown, true);
|
|
99
|
+
document.removeEventListener("keydown", onDocKeydown, true);
|
|
100
|
+
});
|
|
101
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Dropdown } from "./dropdown.vue";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<div v-bind="fieldAttrs">
|
|
2
|
+
<div v-bind="fieldContentAttrs">
|
|
3
|
+
<slot name="start-input"></slot>
|
|
4
|
+
<slot name="input">
|
|
5
|
+
<textarea
|
|
6
|
+
v-bind="fieldInputAttrs"
|
|
7
|
+
@input="onInput"
|
|
8
|
+
@focus="onFocus"
|
|
9
|
+
@blur="onBlur"
|
|
10
|
+
@beforeinput="onBeforeinput"
|
|
11
|
+
v-model="content"
|
|
12
|
+
:rows="line"
|
|
13
|
+
v-if="type === 'paragraph'"
|
|
14
|
+
/>
|
|
15
|
+
<input
|
|
16
|
+
v-bind="fieldInputAttrs"
|
|
17
|
+
@input="onInput"
|
|
18
|
+
@focus="onFocus"
|
|
19
|
+
@blur="onBlur"
|
|
20
|
+
@beforeinput="onBeforeinput"
|
|
21
|
+
v-model="content"
|
|
22
|
+
:type="type"
|
|
23
|
+
v-else
|
|
24
|
+
/>
|
|
25
|
+
</slot>
|
|
26
|
+
<slot name="end-input"></slot>
|
|
27
|
+
</div>
|
|
28
|
+
<div v-bind="fieldMessageAttrs" v-if="message">{{ message }}</div>
|
|
29
|
+
<slot></slot>
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/field/field.scss" scoped></style>
|
|
2
|
+
<template src="./field.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { unref, computed, inject, nextTick, onMounted, ref, watch } from "vue";
|
|
5
|
+
import {
|
|
6
|
+
FIELD_DEFAULT_PROPS,
|
|
7
|
+
APP_PROVIDER_STATE_KEY,
|
|
8
|
+
getFieldAttrs,
|
|
9
|
+
getFieldContentAttrs,
|
|
10
|
+
getFieldInputAttrs,
|
|
11
|
+
getFieldMessageAttrs,
|
|
12
|
+
type AppProviderState,
|
|
13
|
+
type FieldEvent,
|
|
14
|
+
type FieldProps,
|
|
15
|
+
} from "@toife/core";
|
|
16
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
17
|
+
|
|
18
|
+
// Component setup (props, emits, injects)
|
|
19
|
+
// ----------------------------------------------------------------------------
|
|
20
|
+
const props = withDefaults(defineProps<FieldProps>(), {
|
|
21
|
+
...FIELD_DEFAULT_PROPS,
|
|
22
|
+
});
|
|
23
|
+
const emit = defineEmits<FieldEvent>();
|
|
24
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
25
|
+
|
|
26
|
+
// Reactive state
|
|
27
|
+
// ----------------------------------------------------------------------------
|
|
28
|
+
const isFocus = ref(false);
|
|
29
|
+
const caret = ref(0);
|
|
30
|
+
const content = ref("");
|
|
31
|
+
|
|
32
|
+
// Computed properties
|
|
33
|
+
// ----------------------------------------------------------------------------
|
|
34
|
+
const fieldAttrs = computed(() => {
|
|
35
|
+
const role = props.role || unref(appState?.role) || "";
|
|
36
|
+
const shape = props.shape || unref(appState?.shape) || "";
|
|
37
|
+
const shadow = (props?.shadow !== undefined ? props.shadow : unref(appState?.shadow)) ?? false;
|
|
38
|
+
const direction = props.direction || unref(appState?.direction) || "left";
|
|
39
|
+
|
|
40
|
+
return getFieldAttrs({
|
|
41
|
+
role,
|
|
42
|
+
shape,
|
|
43
|
+
size: props.size,
|
|
44
|
+
direction,
|
|
45
|
+
variant: props.variant,
|
|
46
|
+
type: props.type,
|
|
47
|
+
disabled: props.disabled,
|
|
48
|
+
focus: isFocus.value,
|
|
49
|
+
shadow,
|
|
50
|
+
readonly: props.readonly,
|
|
51
|
+
line: Number(props.line),
|
|
52
|
+
maxLine: props.maxLine !== undefined ? Number(props.maxLine) : undefined,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const rawContent = computed(() => {
|
|
57
|
+
const model = props.modelValue;
|
|
58
|
+
if (model !== null && model !== undefined && model !== "") {
|
|
59
|
+
return String(model);
|
|
60
|
+
}
|
|
61
|
+
const value = props.value;
|
|
62
|
+
if (value !== null && value !== undefined && value !== "") {
|
|
63
|
+
return String(value);
|
|
64
|
+
}
|
|
65
|
+
return "";
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const fieldContentAttrs = computed(() => getFieldContentAttrs());
|
|
69
|
+
|
|
70
|
+
const fieldInputAttrs = computed(() => ({
|
|
71
|
+
...getFieldInputAttrs(),
|
|
72
|
+
name: props.name,
|
|
73
|
+
id: props.id,
|
|
74
|
+
placeholder: props.placeholder,
|
|
75
|
+
autocomplete: props.autocomplete,
|
|
76
|
+
type: props.type,
|
|
77
|
+
readonly: props.readonly,
|
|
78
|
+
disabled: props.disabled,
|
|
79
|
+
maxlength: props.maxLength,
|
|
80
|
+
tabindex: props.tabindex,
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
const fieldMessageAttrs = computed(() => getFieldMessageAttrs());
|
|
84
|
+
|
|
85
|
+
// Methods
|
|
86
|
+
// ----------------------------------------------------------------------------
|
|
87
|
+
const onFocus = (ev: FocusEvent) => {
|
|
88
|
+
if (props.disabled) return;
|
|
89
|
+
isFocus.value = true;
|
|
90
|
+
emit("focus", ev);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const onBlur = (ev: FocusEvent) => {
|
|
94
|
+
if (props.disabled) return;
|
|
95
|
+
isFocus.value = false;
|
|
96
|
+
emit("blur", ev);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const onInput = (ev: Event) => {
|
|
100
|
+
emit("input", ev);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const onBeforeinput = (ev: Event) => {
|
|
104
|
+
emit("beforeinput", ev);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
watch(
|
|
108
|
+
() => rawContent.value,
|
|
109
|
+
(value) => {
|
|
110
|
+
content.value = value.toString();
|
|
111
|
+
},
|
|
112
|
+
{ immediate: true }
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
watch(
|
|
116
|
+
() => content.value,
|
|
117
|
+
(value) => {
|
|
118
|
+
emit("update:modelValue", value.toString());
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Field } from "./field.vue";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/form-group/form-group.scss" scoped></style>
|
|
2
|
+
<template src="./form-group.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import { FORM_GROUP_DEFAULT_PROPS, getFormGroupAttrs, type FormGroupProps } from "@toife/core";
|
|
6
|
+
// Component setup (props, emits, injects)
|
|
7
|
+
// ----------------------------------------------------------------------------
|
|
8
|
+
const props = withDefaults(defineProps<FormGroupProps>(), {
|
|
9
|
+
...FORM_GROUP_DEFAULT_PROPS,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// Computed properties
|
|
13
|
+
// ----------------------------------------------------------------------------
|
|
14
|
+
const formGroupAttrs = computed(() => getFormGroupAttrs({ direction: props.direction }));
|
|
15
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FormGroup } from "./form-group.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div v-bind="gestureIndicatorAttrs"></div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<style
|
|
2
|
+
lang="scss"
|
|
3
|
+
src="@toife/core/features/gesture-indicator/gesture-indicator.scss"
|
|
4
|
+
scoped
|
|
5
|
+
></style>
|
|
6
|
+
<template src="./gesture-indicator.html"></template>
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { unref, computed, inject } from "vue";
|
|
9
|
+
import {
|
|
10
|
+
GESTURE_INDICATOR_DEFAULT_PROPS,
|
|
11
|
+
APP_PROVIDER_STATE_KEY,
|
|
12
|
+
getGestureIndicatorAttrs,
|
|
13
|
+
type AppProviderState,
|
|
14
|
+
type GestureIndicatorProps,
|
|
15
|
+
} from "@toife/core";
|
|
16
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
17
|
+
|
|
18
|
+
// Component setup (props, emits, injects)
|
|
19
|
+
// ----------------------------------------------------------------------------
|
|
20
|
+
const props = withDefaults(defineProps<GestureIndicatorProps>(), {
|
|
21
|
+
...GESTURE_INDICATOR_DEFAULT_PROPS,
|
|
22
|
+
});
|
|
23
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
24
|
+
|
|
25
|
+
// Computed properties
|
|
26
|
+
// ----------------------------------------------------------------------------
|
|
27
|
+
const gestureIndicatorAttrs = computed(() => {
|
|
28
|
+
const role = props.role || unref(appState?.role) || "";
|
|
29
|
+
|
|
30
|
+
return getGestureIndicatorAttrs({ role, placement: props.placement });
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as GestureIndicator } from "./gesture-indicator.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<img @error="handleError" :src="dataSrc" />
|