nuxt-hs-ui 1.0.10 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/dist/module.d.mts +10 -2
- package/dist/module.d.ts +10 -2
- package/dist/module.json +5 -2
- package/dist/module.mjs +90 -51
- package/dist/runtime/assets/flatpickr-dark.css +1 -0
- package/dist/runtime/assets/flatpickr-month-select-style.css +1 -0
- package/dist/runtime/assets/tabulator-custom.css +1 -0
- package/dist/runtime/assets/tabulator.css +1 -0
- package/dist/runtime/assets/vue-select.css +1 -0
- package/dist/runtime/components/{hs-fc/btn/line-loading.vue → form/btn-line-loading.vue} +28 -42
- package/dist/runtime/components/form/btn.vue +488 -0
- package/dist/runtime/components/form/check-box.vue +352 -0
- package/dist/runtime/components/form/check-list.vue +354 -0
- package/dist/runtime/components/form/datepicker copy.vue +770 -0
- package/dist/runtime/components/form/datepicker.vue +897 -0
- package/dist/runtime/components/form/input-frame.vue +272 -0
- package/dist/runtime/components/form/radio.vue +685 -0
- package/dist/runtime/components/form/select-img-icon.vue +53 -0
- package/dist/runtime/components/form/select.vue +438 -0
- package/dist/runtime/components/form/text-box.vue +375 -0
- package/dist/runtime/components/form/textarea.vue +466 -0
- package/dist/runtime/components/form/value-box.vue +681 -0
- package/dist/runtime/components/interactive/alert.vue +113 -0
- package/dist/runtime/components/{hs-ui → interactive}/block-loading.vue +42 -59
- package/dist/runtime/components/{hs-ui/dialog/index.vue → interactive/dialog.vue} +132 -127
- package/dist/runtime/components/interactive/modal-bg.vue +82 -0
- package/dist/runtime/components/interactive/modal.vue +143 -0
- package/dist/runtime/components/{hs-ui/toast/index.vue → interactive/toast.vue} +76 -109
- package/dist/runtime/components/{hs-ui → interactive}/window-loader.vue +12 -9
- package/dist/runtime/components/{hs-ui → layout}/accordion.vue +21 -30
- package/dist/runtime/components/layout/aspect-box.vue +71 -0
- package/dist/runtime/components/layout/card-item.vue +193 -0
- package/dist/runtime/components/layout/card.vue +42 -0
- package/dist/runtime/components/layout/container.vue +40 -0
- package/dist/runtime/components/misc/breadcrumb.vue +96 -0
- package/dist/runtime/components/misc/tabulator.vue +187 -0
- package/dist/runtime/components/misc/view-name-display-target.vue +39 -0
- package/dist/runtime/components/misc/view-name-display.vue +90 -0
- package/dist/runtime/composables/use-hs-dialog.d.ts +40 -0
- package/dist/runtime/composables/{use-hs-ui-dialog.js → use-hs-dialog.js} +15 -10
- package/dist/runtime/composables/{use-hs-form-focus.d.ts → use-hs-focus.d.ts} +1 -1
- package/dist/runtime/composables/{use-hs-form-focus.js → use-hs-focus.js} +2 -4
- package/dist/runtime/composables/use-hs-misc.d.ts +22 -0
- package/dist/runtime/composables/use-hs-misc.js +62 -0
- package/dist/runtime/composables/use-hs-modal.d.ts +31 -0
- package/dist/runtime/{components/hs-ui/modal/use-ui-modal.js → composables/use-hs-modal.js} +18 -16
- package/dist/runtime/composables/use-hs-multi-lang.d.ts +14 -6
- package/dist/runtime/composables/use-hs-multi-lang.js +44 -11
- package/dist/runtime/composables/{use-hs-ui-toast.d.ts → use-hs-toast.d.ts} +3 -3
- package/dist/runtime/composables/{use-hs-ui-toast.js → use-hs-toast.js} +4 -5
- package/dist/runtime/composables/{use-hs-ui-window-loader.d.ts → use-hs-window-loader.d.ts} +1 -1
- package/dist/runtime/composables/{use-hs-ui-window-loader.js → use-hs-window-loader.js} +1 -2
- package/dist/runtime/plugin/v-select.d.ts +2 -0
- package/dist/runtime/plugin/v-select.js +5 -0
- package/dist/runtime/style.css +22 -1
- package/dist/runtime/tailwind.css +78 -0
- package/dist/runtime/types/app.config.d.ts +5 -0
- package/dist/runtime/{components/hs-ui/dialog/index.type.d.ts → types/dialog.d.ts} +3 -3
- package/dist/runtime/{components/hs-ui/toast/index.type.d.ts → types/toast.d.ts} +1 -2
- package/dist/runtime/{components/hs-ui/toast/index.type.js → types/toast.js} +0 -1
- package/dist/runtime/utils/class-style.d.ts +6 -0
- package/dist/runtime/utils/class-style.js +27 -0
- package/dist/runtime/utils/com.d.ts +6 -0
- package/dist/runtime/{lib → utils}/com.js +1 -4
- package/dist/runtime/utils/dayjs.d.ts +53 -0
- package/dist/runtime/utils/dayjs.js +124 -0
- package/dist/runtime/utils/float.d.ts +2 -0
- package/dist/runtime/utils/float.js +35 -0
- package/dist/runtime/utils/multi-lang-object.d.ts +17 -0
- package/dist/runtime/utils/multi-lang-object.js +34 -0
- package/dist/runtime/{lib → utils}/multi-lang.d.ts +1 -1
- package/dist/runtime/{lib → utils}/multi-lang.js +31 -27
- package/dist/runtime/{lib → utils}/number.d.ts +2 -4
- package/dist/runtime/{lib → utils}/number.js +29 -69
- package/dist/runtime/utils/object.d.ts +46 -0
- package/dist/runtime/utils/object.js +107 -0
- package/dist/runtime/utils/select-item.d.ts +31 -0
- package/dist/runtime/utils/select.d.ts +14 -0
- package/dist/runtime/utils/select.js +36 -0
- package/dist/runtime/utils/string.d.ts +39 -0
- package/dist/runtime/utils/string.js +125 -0
- package/dist/runtime/utils/tabulator.d.ts +108 -0
- package/dist/runtime/utils/tabulator.js +296 -0
- package/dist/runtime/utils/theme.d.ts +21 -0
- package/dist/runtime/utils/theme.js +31 -0
- package/dist/runtime/utils/tv.d.ts +101 -0
- package/dist/runtime/utils/tv.js +26 -0
- package/dist/runtime/utils/wareki.d.ts +3 -0
- package/dist/runtime/utils/wareki.js +106 -0
- package/dist/types.d.mts +1 -17
- package/dist/types.d.ts +1 -17
- package/package.json +99 -37
- package/dist/runtime/components/hs-fc/btn/index.vue +0 -510
- package/dist/runtime/components/hs-ui/aspect-box.vue +0 -83
- package/dist/runtime/components/hs-ui/card-item.vue +0 -141
- package/dist/runtime/components/hs-ui/card.vue +0 -54
- package/dist/runtime/components/hs-ui/container.vue +0 -50
- package/dist/runtime/components/hs-ui/modal/bg.vue +0 -94
- package/dist/runtime/components/hs-ui/modal/index.vue +0 -206
- package/dist/runtime/components/hs-ui/modal/use-ui-modal.d.ts +0 -20
- package/dist/runtime/components/v-test.vue +0 -60
- package/dist/runtime/composables/use-hs-ui-dialog.d.ts +0 -22
- package/dist/runtime/lib/class-style.d.ts +0 -8
- package/dist/runtime/lib/class-style.js +0 -59
- package/dist/runtime/lib/com.d.ts +0 -14
- package/dist/runtime/lib/prefix.d.ts +0 -2
- package/dist/runtime/lib/prefix.js +0 -17
- package/dist/runtime/lib/theme.d.ts +0 -2
- package/dist/runtime/lib/theme.js +0 -21
- /package/dist/runtime/{components/hs-ui/dialog/index.type.js → types/dialog.js} +0 -0
- /package/dist/runtime/{components/hs-fc/hoge → utils/select-item.js} +0 -0
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/* ----------------------------------------------------------------------------
|
|
3
|
-
src\runtime\components\hs-ui\aspect-box.vue
|
|
4
|
-
// ----------------------------------------------------------------------------
|
|
5
|
-
HsUiAspectBox
|
|
6
|
-
HsUiAspectBoxHsUiAspectBox
|
|
7
|
-
----------------------------------------------------------------------------- */
|
|
8
|
-
|
|
9
|
-
// [ vue ]
|
|
10
|
-
import { computed } from 'vue';
|
|
11
|
-
// [ NUXT ]
|
|
12
|
-
import { useRuntimeConfig } from '#imports';
|
|
13
|
-
// [ tailwind ]
|
|
14
|
-
import { extendTailwindMerge } from 'tailwind-merge';
|
|
15
|
-
import { type ClassType, ClassTypeToString } from '../../lib/class-style';
|
|
16
|
-
import { GetPrefix, RemovePrefix } from '../../lib/prefix';
|
|
17
|
-
// [ src > runtime > lib > * ]
|
|
18
|
-
import { Int } from '../../lib/number';
|
|
19
|
-
// ----------------------------------------------------------------------------
|
|
20
|
-
const runtimeConfig: any = useRuntimeConfig();
|
|
21
|
-
const prefix = GetPrefix(runtimeConfig);
|
|
22
|
-
// ----------------------------------------------------------------------------
|
|
23
|
-
const twMerge = extendTailwindMerge({
|
|
24
|
-
prefix: prefix,
|
|
25
|
-
});
|
|
26
|
-
// ----------------------------------------------------------------------------
|
|
27
|
-
type Props = {
|
|
28
|
-
class?: ClassType | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Aspect ratio
|
|
31
|
-
* - Example:
|
|
32
|
-
* - 1:1
|
|
33
|
-
* - 3:2 <- Default
|
|
34
|
-
* - 4:3
|
|
35
|
-
* - 16:9
|
|
36
|
-
*/
|
|
37
|
-
rate?: string;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
41
|
-
class: '',
|
|
42
|
-
rate: '3:2',
|
|
43
|
-
});
|
|
44
|
-
const aspectRate = computed(() => {
|
|
45
|
-
const left = Int(props.rate.replace(/^(\d*):(\d*)$/, '$1'));
|
|
46
|
-
const right = Int(props.rate.replace(/^(\d*):(\d*)$/, '$2'));
|
|
47
|
-
if (left === 0 || right === 0) return '100';
|
|
48
|
-
return ((right / left) * 100).toFixed(3);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const baseClass = RemovePrefix(prefix, [
|
|
52
|
-
//
|
|
53
|
-
'relative',
|
|
54
|
-
'tw-relative',
|
|
55
|
-
]);
|
|
56
|
-
const classStyle = computed(() => {
|
|
57
|
-
return twMerge(baseClass, ClassTypeToString(props.class));
|
|
58
|
-
});
|
|
59
|
-
</script>
|
|
60
|
-
<template>
|
|
61
|
-
<div class="HsUiAspectContainer" :class="classStyle" :style="` --aspect-rate: ${aspectRate}%;`">
|
|
62
|
-
<div>
|
|
63
|
-
<slot />
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</template>
|
|
67
|
-
|
|
68
|
-
<style scoped>
|
|
69
|
-
.HsUiAspectContainer {
|
|
70
|
-
display: block;
|
|
71
|
-
--aspect-rate: 66.66%;
|
|
72
|
-
/* 3:2 */
|
|
73
|
-
}
|
|
74
|
-
.HsUiAspectContainer::before {
|
|
75
|
-
content: "";
|
|
76
|
-
display: block;
|
|
77
|
-
padding-top: var(--aspect-rate);
|
|
78
|
-
}
|
|
79
|
-
.HsUiAspectContainer > div {
|
|
80
|
-
position: absolute;
|
|
81
|
-
inset: 0 0 0 0;
|
|
82
|
-
}
|
|
83
|
-
</style>
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/* ----------------------------------------------------------------------------
|
|
3
|
-
src\runtime\components\hs-ui\card-item.vue
|
|
4
|
-
// ----------------------------------------------------------------------------
|
|
5
|
-
HsUiCardItem
|
|
6
|
-
HsUiCardItemHsUiCardItem
|
|
7
|
-
----------------------------------------------------------------------------- */
|
|
8
|
-
|
|
9
|
-
// [ vue ]
|
|
10
|
-
import { computed } from 'vue';
|
|
11
|
-
// [ NUXT ]
|
|
12
|
-
import { useRuntimeConfig } from '#imports';
|
|
13
|
-
// [ tailwind ]
|
|
14
|
-
import { extendTailwindMerge } from 'tailwind-merge';
|
|
15
|
-
import { type ClassType, ClassTypeToArray } from '../../lib/class-style';
|
|
16
|
-
import { GetPrefix, RemovePrefix } from '../../lib/prefix';
|
|
17
|
-
// ----------------------------------------------------------------------------
|
|
18
|
-
const runtimeConfig: any = useRuntimeConfig();
|
|
19
|
-
const prefix = GetPrefix(runtimeConfig);
|
|
20
|
-
// ----------------------------------------------------------------------------
|
|
21
|
-
const twMerge = extendTailwindMerge({
|
|
22
|
-
prefix: prefix,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// ----------------------------------------------------------------------------
|
|
26
|
-
|
|
27
|
-
interface Props {
|
|
28
|
-
class?: ClassType | undefined;
|
|
29
|
-
variant?: 'header' | 'body' | 'footer';
|
|
30
|
-
accordion?: boolean | undefined;
|
|
31
|
-
// hasCloseBtn?: boolean | undefined;
|
|
32
|
-
isOpen?: boolean | undefined;
|
|
33
|
-
}
|
|
34
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
35
|
-
class: '',
|
|
36
|
-
variant: 'body',
|
|
37
|
-
accordion: undefined,
|
|
38
|
-
isOpen: undefined,
|
|
39
|
-
// hasCloseBtn: undefined,
|
|
40
|
-
});
|
|
41
|
-
type Emits = {
|
|
42
|
-
ref: [e: HTMLElement];
|
|
43
|
-
'update:isOpen': [value: boolean];
|
|
44
|
-
'bg-click': [];
|
|
45
|
-
};
|
|
46
|
-
const emit = defineEmits<Emits>();
|
|
47
|
-
|
|
48
|
-
// ----------------------------------------------------------------------------
|
|
49
|
-
|
|
50
|
-
const baseClass = RemovePrefix(prefix, [
|
|
51
|
-
//
|
|
52
|
-
'relative',
|
|
53
|
-
'tw-relative',
|
|
54
|
-
'px-2',
|
|
55
|
-
'tw-px-2',
|
|
56
|
-
'py-1',
|
|
57
|
-
'tw-py-1',
|
|
58
|
-
]);
|
|
59
|
-
|
|
60
|
-
const baseClassHeaderFooter = RemovePrefix(prefix, [
|
|
61
|
-
//,,
|
|
62
|
-
'relative',
|
|
63
|
-
'tw-relative',
|
|
64
|
-
// 'p-1',
|
|
65
|
-
// 'tw-p-1',
|
|
66
|
-
'bg-[#FFFFFF]',
|
|
67
|
-
'tw-bg-[#FFFFFF]',
|
|
68
|
-
'flex',
|
|
69
|
-
'tw-flex',
|
|
70
|
-
'justify-between',
|
|
71
|
-
'tw-justify-between',
|
|
72
|
-
'items-center',
|
|
73
|
-
'tw-items-center',
|
|
74
|
-
'flex-none',
|
|
75
|
-
'tw-flex-none',
|
|
76
|
-
]);
|
|
77
|
-
|
|
78
|
-
const baseClassBody = RemovePrefix(prefix, [
|
|
79
|
-
//
|
|
80
|
-
'relative',
|
|
81
|
-
'tw-relative',
|
|
82
|
-
// 'p-1',
|
|
83
|
-
// 'tw-p-1',
|
|
84
|
-
'bg-[#FFFFFF]',
|
|
85
|
-
'tw-bg-[#FFFFFF]',
|
|
86
|
-
'flex-1',
|
|
87
|
-
'tw-flex-1',
|
|
88
|
-
'overflow-auto',
|
|
89
|
-
'tw-overflow-auto',
|
|
90
|
-
]);
|
|
91
|
-
|
|
92
|
-
const pe1 = RemovePrefix(prefix, [
|
|
93
|
-
//
|
|
94
|
-
'pe-1',
|
|
95
|
-
'tw-pe-1',
|
|
96
|
-
]);
|
|
97
|
-
|
|
98
|
-
const showBtnStyle = RemovePrefix(prefix, [
|
|
99
|
-
//
|
|
100
|
-
'border-[1px]',
|
|
101
|
-
'tw-border-[1px]',
|
|
102
|
-
'!bg-transparent',
|
|
103
|
-
'!tw-bg-transparent',
|
|
104
|
-
]);
|
|
105
|
-
|
|
106
|
-
const c = computed(() => {
|
|
107
|
-
if (props.variant === 'header' || props.variant === 'footer') {
|
|
108
|
-
return baseClassHeaderFooter;
|
|
109
|
-
}
|
|
110
|
-
return baseClassBody;
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const classStyle = computed(() => {
|
|
114
|
-
return twMerge(baseClass, c.value, props.isOpen !== undefined ? pe1 : '', ClassTypeToArray(props.class));
|
|
115
|
-
});
|
|
116
|
-
</script>
|
|
117
|
-
<template>
|
|
118
|
-
<template v-if="props.isOpen !== undefined">
|
|
119
|
-
<div :ref="(e:any)=>emit('ref',e)" class="HsUiCardItem" :class="classStyle" @click.stop="emit('bg-click')">
|
|
120
|
-
<div class=""><slot /></div>
|
|
121
|
-
<div class="">
|
|
122
|
-
<HsFcBtn theme="white" :class="showBtnStyle" @click.stop="emit('update:isOpen', !props.isOpen)">
|
|
123
|
-
<i v-if="props.isOpen" class="fa-solid fa-chevron-up" />
|
|
124
|
-
<i v-else class="fa-solid fa-chevron-down" />
|
|
125
|
-
</HsFcBtn>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
</template>
|
|
129
|
-
<template v-else-if="props.accordion === undefined">
|
|
130
|
-
<div :ref="(e:any)=>emit('ref',e)" class="HsUiCardItem" :class="classStyle">
|
|
131
|
-
<slot />
|
|
132
|
-
</div>
|
|
133
|
-
</template>
|
|
134
|
-
<template v-else>
|
|
135
|
-
<HsUiAccordion :open="props.accordion">
|
|
136
|
-
<div :ref="(e:any)=>emit('ref',e)" class="HsUiCardItem" :class="classStyle">
|
|
137
|
-
<slot />
|
|
138
|
-
</div>
|
|
139
|
-
</HsUiAccordion>
|
|
140
|
-
</template>
|
|
141
|
-
</template>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/* ----------------------------------------------------------------------------
|
|
3
|
-
src\runtime\components\hs-ui\card.vue
|
|
4
|
-
// ----------------------------------------------------------------------------
|
|
5
|
-
HsUiCard
|
|
6
|
-
HsUiCardHsUiCard
|
|
7
|
-
----------------------------------------------------------------------------- */
|
|
8
|
-
|
|
9
|
-
// [ vue ]
|
|
10
|
-
import { computed } from 'vue';
|
|
11
|
-
// [ NUXT ]
|
|
12
|
-
import { useRuntimeConfig } from '#imports';
|
|
13
|
-
// [ tailwind ]
|
|
14
|
-
import { extendTailwindMerge } from 'tailwind-merge';
|
|
15
|
-
import { type ClassType, ClassTypeToString } from '../../lib/class-style';
|
|
16
|
-
import { GetPrefix, RemovePrefix } from '../../lib/prefix';
|
|
17
|
-
// ----------------------------------------------------------------------------
|
|
18
|
-
const runtimeConfig: any = useRuntimeConfig();
|
|
19
|
-
const prefix = GetPrefix(runtimeConfig);
|
|
20
|
-
// ----------------------------------------------------------------------------
|
|
21
|
-
const twMerge = extendTailwindMerge({
|
|
22
|
-
prefix: prefix,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// ----------------------------------------------------------------------------
|
|
26
|
-
interface Props {
|
|
27
|
-
class?: ClassType | undefined;
|
|
28
|
-
}
|
|
29
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
-
class: '',
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const baseClass = RemovePrefix(prefix, [
|
|
34
|
-
//
|
|
35
|
-
'relative',
|
|
36
|
-
'tw-relative',
|
|
37
|
-
'flex',
|
|
38
|
-
'tw-flex',
|
|
39
|
-
'flex-col',
|
|
40
|
-
'tw-flex-col',
|
|
41
|
-
'border-2',
|
|
42
|
-
'tw-border-2',
|
|
43
|
-
'border-white',
|
|
44
|
-
'tw-border-white',
|
|
45
|
-
]);
|
|
46
|
-
const classStyle = computed(() => {
|
|
47
|
-
return twMerge(baseClass, ClassTypeToString(props.class));
|
|
48
|
-
});
|
|
49
|
-
</script>
|
|
50
|
-
<template>
|
|
51
|
-
<div :class="classStyle">
|
|
52
|
-
<slot />
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/* ----------------------------------------------------------------------------
|
|
3
|
-
src\runtime\components\hs-ui\container.vue
|
|
4
|
-
// ----------------------------------------------------------------------------
|
|
5
|
-
HsUiContainer
|
|
6
|
-
HsUiContainerHsUiContainer
|
|
7
|
-
----------------------------------------------------------------------------- */
|
|
8
|
-
|
|
9
|
-
// [ node_modules ]
|
|
10
|
-
// [ vue ]
|
|
11
|
-
import { computed } from 'vue';
|
|
12
|
-
// [ NUXT ]
|
|
13
|
-
import { useRuntimeConfig } from '#imports';
|
|
14
|
-
// [ tailwind ]
|
|
15
|
-
import { extendTailwindMerge } from 'tailwind-merge';
|
|
16
|
-
import { type ClassType, ClassTypeToString } from '../../lib/class-style';
|
|
17
|
-
import { GetPrefix, RemovePrefix } from '../../lib/prefix';
|
|
18
|
-
// ----------------------------------------------------------------------------
|
|
19
|
-
const runtimeConfig: any = useRuntimeConfig();
|
|
20
|
-
const prefix = GetPrefix(runtimeConfig);
|
|
21
|
-
// ----------------------------------------------------------------------------
|
|
22
|
-
const twMerge = extendTailwindMerge({
|
|
23
|
-
prefix: prefix,
|
|
24
|
-
});
|
|
25
|
-
// ----------------------------------------------------------------------------
|
|
26
|
-
interface Props {
|
|
27
|
-
class?: ClassType | undefined;
|
|
28
|
-
}
|
|
29
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
-
class: '',
|
|
31
|
-
});
|
|
32
|
-
const baseClass = RemovePrefix(prefix, [
|
|
33
|
-
//
|
|
34
|
-
'container',
|
|
35
|
-
'tw-container',
|
|
36
|
-
'mx-auto',
|
|
37
|
-
'tw-mx-auto',
|
|
38
|
-
'px-2',
|
|
39
|
-
'tw-px-2',
|
|
40
|
-
]);
|
|
41
|
-
|
|
42
|
-
const classStyle = computed(() => {
|
|
43
|
-
return twMerge(baseClass, ClassTypeToString(props.class));
|
|
44
|
-
});
|
|
45
|
-
</script>
|
|
46
|
-
<template>
|
|
47
|
-
<div :class="classStyle">
|
|
48
|
-
<slot />
|
|
49
|
-
</div>
|
|
50
|
-
</template>
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/* ----------------------------------------------------------------------------
|
|
3
|
-
src\runtime\components\hs-ui\modal\bg.vue
|
|
4
|
-
// ----------------------------------------------------------------------------
|
|
5
|
-
HsUiModalBg
|
|
6
|
-
HsUiModalBgHsUiModalBg
|
|
7
|
-
----------------------------------------------------------------------------- */
|
|
8
|
-
|
|
9
|
-
// [ vue ]
|
|
10
|
-
import { computed } from 'vue';
|
|
11
|
-
// [ NUXT ]
|
|
12
|
-
import { useRuntimeConfig } from '#imports';
|
|
13
|
-
// [ tailwind ]
|
|
14
|
-
import { extendTailwindMerge } from 'tailwind-merge';
|
|
15
|
-
import { type ClassType, ClassTypeToString } from '../../../lib/class-style';
|
|
16
|
-
import { GetPrefix, RemovePrefix } from '../../../lib/prefix';
|
|
17
|
-
// [ components > v-ui > modal > * ]
|
|
18
|
-
import { useStoreModal } from './use-ui-modal';
|
|
19
|
-
// ----------------------------------------------------------------------------
|
|
20
|
-
const runtimeConfig: any = useRuntimeConfig();
|
|
21
|
-
const prefix = GetPrefix(runtimeConfig);
|
|
22
|
-
// ----------------------------------------------------------------------------
|
|
23
|
-
const twMerge = extendTailwindMerge({
|
|
24
|
-
prefix: prefix,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// ----------------------------------------------------------------------------
|
|
28
|
-
|
|
29
|
-
type Props = {
|
|
30
|
-
class?: ClassType | undefined;
|
|
31
|
-
};
|
|
32
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
33
|
-
class: '',
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const vUiModal = useStoreModal();
|
|
37
|
-
|
|
38
|
-
const zIndex = computed(() => {
|
|
39
|
-
if (vUiModal.state.activeList.length === 0) return -1;
|
|
40
|
-
return Math.max(...vUiModal.state.activeList.map((row) => row.zIndex)) - 1;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const isShow = computed(() => {
|
|
44
|
-
if (vUiModal.state.activeList.length === 0) return false;
|
|
45
|
-
return true;
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const baseClass = RemovePrefix(prefix, [
|
|
49
|
-
//
|
|
50
|
-
'transition-opacity',
|
|
51
|
-
'tw-transition-opacity',
|
|
52
|
-
'fixed',
|
|
53
|
-
'tw-fixed',
|
|
54
|
-
'inset-0',
|
|
55
|
-
'tw-inset-0',
|
|
56
|
-
'bg-slate-800/[0.8]',
|
|
57
|
-
'tw-bg-slate-800/[0.8]',
|
|
58
|
-
'transition-opacity',
|
|
59
|
-
'tw-transition-opacity',
|
|
60
|
-
]);
|
|
61
|
-
|
|
62
|
-
const variableStyle = computed(() => {
|
|
63
|
-
if (isShow.value) {
|
|
64
|
-
return RemovePrefix(prefix, [
|
|
65
|
-
//
|
|
66
|
-
'pointer-events-auto',
|
|
67
|
-
'tw-pointer-events-auto',
|
|
68
|
-
'opacity-100',
|
|
69
|
-
'tw-opacity-100',
|
|
70
|
-
]);
|
|
71
|
-
}
|
|
72
|
-
return RemovePrefix(prefix, [
|
|
73
|
-
//
|
|
74
|
-
'pointer-events-none',
|
|
75
|
-
'tw-pointer-events-none',
|
|
76
|
-
'opacity-0',
|
|
77
|
-
'tw-opacity-0',
|
|
78
|
-
]);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const classStyle = computed(() => {
|
|
82
|
-
return twMerge(baseClass, variableStyle.value, ClassTypeToString(props.class));
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const closeAll = () => {
|
|
86
|
-
vUiModal.removeAll();
|
|
87
|
-
};
|
|
88
|
-
</script>
|
|
89
|
-
<template>
|
|
90
|
-
<Teleport to="body">
|
|
91
|
-
<!-- -->
|
|
92
|
-
<div class="VUiModalBg" :class="classStyle" :style="{ zIndex: zIndex }" @click.stop="closeAll()" />
|
|
93
|
-
</Teleport>
|
|
94
|
-
</template>
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/* ----------------------------------------------------------------------------
|
|
3
|
-
src\runtime\components\hs-ui\modal\index.vue
|
|
4
|
-
// ----------------------------------------------------------------------------
|
|
5
|
-
HsUiModal
|
|
6
|
-
HsUiModalHsUiModal
|
|
7
|
-
----------------------------------------------------------------------------- */
|
|
8
|
-
|
|
9
|
-
// [ vue ]
|
|
10
|
-
import { computed, ref, watch, nextTick, onUnmounted } from 'vue';
|
|
11
|
-
// [ NUXT ]
|
|
12
|
-
import { useId, useRuntimeConfig } from '#imports';
|
|
13
|
-
// [ tailwind ]
|
|
14
|
-
import { extendTailwindMerge } from 'tailwind-merge';
|
|
15
|
-
import { type ClassType, ClassTypeToString } from '../../../lib/class-style';
|
|
16
|
-
import { GetPrefix, RemovePrefix } from '../../../lib/prefix';
|
|
17
|
-
|
|
18
|
-
// [ vueuse ]
|
|
19
|
-
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap';
|
|
20
|
-
// [ components > v-ui > modal > * ]
|
|
21
|
-
import { useStoreModal } from './use-ui-modal';
|
|
22
|
-
// ----------------------------------------------------------------------------
|
|
23
|
-
const runtimeConfig: any = useRuntimeConfig();
|
|
24
|
-
const prefix = GetPrefix(runtimeConfig);
|
|
25
|
-
// ----------------------------------------------------------------------------
|
|
26
|
-
const twMerge = extendTailwindMerge({
|
|
27
|
-
prefix: prefix,
|
|
28
|
-
});
|
|
29
|
-
// ----------------------------------------------------------------------------
|
|
30
|
-
|
|
31
|
-
interface Props {
|
|
32
|
-
class?: ClassType | undefined;
|
|
33
|
-
classInner?: ClassType | undefined;
|
|
34
|
-
show: boolean;
|
|
35
|
-
mounted?: boolean;
|
|
36
|
-
zIndex?: number | undefined;
|
|
37
|
-
focusLock?: boolean;
|
|
38
|
-
}
|
|
39
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
40
|
-
class: '',
|
|
41
|
-
classInner: '',
|
|
42
|
-
show: false,
|
|
43
|
-
mounted: true,
|
|
44
|
-
zIndex: undefined,
|
|
45
|
-
focusLock: false,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
type Emits = {
|
|
49
|
-
close: [];
|
|
50
|
-
};
|
|
51
|
-
const emit = defineEmits<Emits>();
|
|
52
|
-
|
|
53
|
-
// ----------------------------------------------------------------------------
|
|
54
|
-
const vUiModal = useStoreModal();
|
|
55
|
-
vUiModal.watch();
|
|
56
|
-
const id = useId();
|
|
57
|
-
const active = computed(() => {
|
|
58
|
-
return vUiModal.activeId === id;
|
|
59
|
-
});
|
|
60
|
-
// ----------------------------------------------------------------------------
|
|
61
|
-
// [ focusTrap ]
|
|
62
|
-
const focusTargetElm = ref<HTMLElement | null>(null);
|
|
63
|
-
const { activate, deactivate } = useFocusTrap(focusTargetElm);
|
|
64
|
-
watch(
|
|
65
|
-
() => [props.show, active.value],
|
|
66
|
-
async () => {
|
|
67
|
-
await nextTick();
|
|
68
|
-
if (!props.focusLock || !active.value || !props.show) {
|
|
69
|
-
deactivate();
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
activate();
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
// ----------------------------------------------------------------------------
|
|
77
|
-
const zOrder = computed(() => {
|
|
78
|
-
if (props.zIndex !== undefined) return props.zIndex;
|
|
79
|
-
return vUiModal.myzIndex(id).value;
|
|
80
|
-
});
|
|
81
|
-
if (props.show) {
|
|
82
|
-
vUiModal.add(id);
|
|
83
|
-
}
|
|
84
|
-
watch(
|
|
85
|
-
() => props.show,
|
|
86
|
-
(v) => {
|
|
87
|
-
if (v) {
|
|
88
|
-
vUiModal.add(id);
|
|
89
|
-
} else {
|
|
90
|
-
vUiModal.remove(id);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
onUnmounted(() => {
|
|
95
|
-
vUiModal.remove(id);
|
|
96
|
-
});
|
|
97
|
-
const mounted = computed(() => {
|
|
98
|
-
if (props.show) return true;
|
|
99
|
-
if (props.mounted) return true;
|
|
100
|
-
return false;
|
|
101
|
-
});
|
|
102
|
-
// 背景色は[VUiModalBg]が担当します
|
|
103
|
-
const baseClass = RemovePrefix(prefix, [
|
|
104
|
-
//
|
|
105
|
-
'p-2',
|
|
106
|
-
'tw-p-2',
|
|
107
|
-
'transition-opacity',
|
|
108
|
-
'tw-transition-opacity',
|
|
109
|
-
'fixed',
|
|
110
|
-
'tw-fixed',
|
|
111
|
-
'inset-0',
|
|
112
|
-
'tw-inset-0',
|
|
113
|
-
'flex',
|
|
114
|
-
'tw-flex',
|
|
115
|
-
'justify-center',
|
|
116
|
-
'tw-justify-center',
|
|
117
|
-
'pointer-events-none',
|
|
118
|
-
'tw-pointer-events-none',
|
|
119
|
-
]);
|
|
120
|
-
|
|
121
|
-
const classStyle = computed(() => {
|
|
122
|
-
return twMerge(baseClass, ClassTypeToString(props.class));
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
const innerClass = RemovePrefix(prefix, [
|
|
126
|
-
//
|
|
127
|
-
'w-full',
|
|
128
|
-
'tw-w-full',
|
|
129
|
-
'h-full',
|
|
130
|
-
'tw-h-full',
|
|
131
|
-
'p-0',
|
|
132
|
-
'tw-p-0',
|
|
133
|
-
'flex',
|
|
134
|
-
'tw-flex',
|
|
135
|
-
'flex-col',
|
|
136
|
-
'tw-flex-col',
|
|
137
|
-
'items-center',
|
|
138
|
-
'tw-items-center',
|
|
139
|
-
'overflow-auto',
|
|
140
|
-
'tw-overflow-auto',
|
|
141
|
-
'transition-opacity',
|
|
142
|
-
'tw-transition-opacity',
|
|
143
|
-
'aaaaaa',
|
|
144
|
-
'tw-aaaaaa',
|
|
145
|
-
'aaaaaa',
|
|
146
|
-
'tw-aaaaaa',
|
|
147
|
-
]);
|
|
148
|
-
const variableStyle = computed(() => {
|
|
149
|
-
if (props.show) {
|
|
150
|
-
return RemovePrefix(prefix, [
|
|
151
|
-
//
|
|
152
|
-
'pointer-events-auto',
|
|
153
|
-
'tw-pointer-events-auto',
|
|
154
|
-
]);
|
|
155
|
-
}
|
|
156
|
-
return RemovePrefix(prefix, [
|
|
157
|
-
//
|
|
158
|
-
'pointer-events-none',
|
|
159
|
-
'tw-pointer-events-none',
|
|
160
|
-
]);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
const classInner = computed(() => {
|
|
164
|
-
return twMerge(innerClass, variableStyle.value, ClassTypeToString(props.classInner));
|
|
165
|
-
});
|
|
166
|
-
const closeOnBackEvent = () => {
|
|
167
|
-
emit('close');
|
|
168
|
-
};
|
|
169
|
-
</script>
|
|
170
|
-
<template>
|
|
171
|
-
<div class="HsUiModal-Parent">
|
|
172
|
-
<ClientOnly>
|
|
173
|
-
<Teleport to="body">
|
|
174
|
-
<div
|
|
175
|
-
v-if="mounted"
|
|
176
|
-
:id="id"
|
|
177
|
-
class="HsUiModal"
|
|
178
|
-
data-show=""
|
|
179
|
-
:class="classStyle"
|
|
180
|
-
:style="{ zIndex: zOrder, opacity: props.show ? 1 : 0 }"
|
|
181
|
-
:aria-hidden="!props.show"
|
|
182
|
-
>
|
|
183
|
-
<div ref="focusTargetElm" :class="classInner" @click="closeOnBackEvent">
|
|
184
|
-
<slot />
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
</Teleport>
|
|
188
|
-
</ClientOnly>
|
|
189
|
-
</div>
|
|
190
|
-
</template>
|
|
191
|
-
|
|
192
|
-
<style>
|
|
193
|
-
.HsUiModal > * {
|
|
194
|
-
pointer-events: none;
|
|
195
|
-
}
|
|
196
|
-
.HsUiModal[aria-hidden=false] > * {
|
|
197
|
-
pointer-events: all;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.HsUiModal-Parent {
|
|
201
|
-
opacity: 0;
|
|
202
|
-
position: absolute;
|
|
203
|
-
width: 0;
|
|
204
|
-
height: 0;
|
|
205
|
-
}
|
|
206
|
-
</style>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface State {
|
|
2
|
-
state: {
|
|
3
|
-
init: boolean;
|
|
4
|
-
baseIndex: number;
|
|
5
|
-
activeList: {
|
|
6
|
-
id: string;
|
|
7
|
-
zIndex: number;
|
|
8
|
-
}[];
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export declare const useStoreModal: import("pinia").StoreDefinition<"HsUiStoreModal", State, {
|
|
12
|
-
activeId: (state: State & import("pinia").PiniaCustomStateProperties<State>) => string | null;
|
|
13
|
-
}, {
|
|
14
|
-
watch(): void;
|
|
15
|
-
myzIndex(id: string): import("vue").ComputedRef<number>;
|
|
16
|
-
add(id: string): number;
|
|
17
|
-
remove(id: string): void;
|
|
18
|
-
removeAll(): void;
|
|
19
|
-
}>;
|
|
20
|
-
export {};
|