@bitrix24/b24ui-nuxt 0.3.3 → 0.3.5
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/.nuxt/b24ui/container.ts +1 -1
- package/.nuxt/b24ui/index.ts +1 -0
- package/.nuxt/b24ui/slideover.ts +101 -0
- package/.nuxt/b24ui/toaster.ts +1 -1
- package/dist/meta.cjs +696 -233
- package/dist/meta.d.cts +696 -233
- package/dist/meta.d.mts +696 -233
- package/dist/meta.d.ts +696 -233
- package/dist/meta.mjs +696 -233
- package/dist/module.cjs +1 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -2
- package/dist/runtime/components/App.vue +3 -4
- package/dist/runtime/components/Modal.vue +4 -2
- package/dist/runtime/components/OverlayProvider.vue +29 -0
- package/dist/runtime/components/Slideover.vue +193 -0
- package/dist/runtime/composables/useOverlay.d.ts +30 -0
- package/dist/runtime/composables/useOverlay.js +71 -0
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
- package/dist/runtime/vue/composables/useAppConfig.js +2 -0
- package/dist/runtime/vue/stubs.d.ts +10 -0
- package/dist/runtime/vue/stubs.js +22 -0
- package/dist/shared/{b24ui-nuxt.BTln9cW-.mjs → b24ui-nuxt.CeQRWQD-.mjs} +121 -2
- package/dist/shared/{b24ui-nuxt.ngV6AJEg.cjs → b24ui-nuxt.M7bz91Io.cjs} +121 -2
- package/dist/unplugin.cjs +3 -3
- package/dist/unplugin.mjs +3 -3
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +1 -1
- package/dist/runtime/components/ModalProvider.vue +0 -12
- package/dist/runtime/composables/useModal.d.ts +0 -17
- package/dist/runtime/composables/useModal.js +0 -46
- package/dist/runtime/plugins/modal.d.ts +0 -2
- package/dist/runtime/plugins/modal.js +0 -10
package/dist/module.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const defu = require('defu');
|
|
4
4
|
const kit = require('@nuxt/kit');
|
|
5
|
-
const templates = require('./shared/b24ui-nuxt.
|
|
5
|
+
const templates = require('./shared/b24ui-nuxt.M7bz91Io.cjs');
|
|
6
6
|
require('node:url');
|
|
7
7
|
require('scule');
|
|
8
8
|
|
|
@@ -41,7 +41,6 @@ const module$1 = kit.defineNuxtModule({
|
|
|
41
41
|
await registerModule("@nuxtjs/color-mode", "colorMode", { classSuffix: "", disableTransition: true });
|
|
42
42
|
}
|
|
43
43
|
kit.addPlugin({ src: resolve("./runtime/plugins/colors") });
|
|
44
|
-
kit.addPlugin({ src: resolve("./runtime/plugins/modal") });
|
|
45
44
|
kit.addComponentsDir({
|
|
46
45
|
path: resolve("./runtime/components"),
|
|
47
46
|
prefix: "B24",
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defu } from 'defu';
|
|
2
2
|
import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponentsDir, addImportsDir, hasNuxtModule, installModule } from '@nuxt/kit';
|
|
3
|
-
import { d as defaultOptions, a as getDefaultUiConfig, b as addTemplates } from './shared/b24ui-nuxt.
|
|
3
|
+
import { d as defaultOptions, a as getDefaultUiConfig, b as addTemplates } from './shared/b24ui-nuxt.CeQRWQD-.mjs';
|
|
4
4
|
import 'node:url';
|
|
5
5
|
import 'scule';
|
|
6
6
|
|
|
@@ -38,7 +38,6 @@ const module = defineNuxtModule({
|
|
|
38
38
|
await registerModule("@nuxtjs/color-mode", "colorMode", { classSuffix: "", disableTransition: true });
|
|
39
39
|
}
|
|
40
40
|
addPlugin({ src: resolve("./runtime/plugins/colors") });
|
|
41
|
-
addPlugin({ src: resolve("./runtime/plugins/modal") });
|
|
42
41
|
addComponentsDir({
|
|
43
42
|
path: resolve("./runtime/components"),
|
|
44
43
|
prefix: "B24",
|
|
@@ -23,8 +23,7 @@ import { toRef, useId, provide } from 'vue'
|
|
|
23
23
|
import { ConfigProvider, TooltipProvider, useForwardProps } from 'reka-ui'
|
|
24
24
|
import { reactivePick } from '@vueuse/core'
|
|
25
25
|
import B24Toaster from './Toaster.vue'
|
|
26
|
-
import
|
|
27
|
-
// import B24SlideoverProvider from './SlideoverProvider.vue'
|
|
26
|
+
import B24OverlayProvider from './OverlayProvider.vue'
|
|
28
27
|
|
|
29
28
|
const props = defineProps<AppProps>()
|
|
30
29
|
defineSlots<AppSlots>()
|
|
@@ -44,8 +43,8 @@ provide(localeContextInjectionKey, locale)
|
|
|
44
43
|
<slot />
|
|
45
44
|
</B24Toaster>
|
|
46
45
|
<slot v-else />
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
|
|
47
|
+
<B24OverlayProvider />
|
|
49
48
|
</TooltipProvider>
|
|
50
49
|
</ConfigProvider>
|
|
51
50
|
</template>
|
|
@@ -56,7 +56,9 @@ export interface ModalProps extends DialogRootProps {
|
|
|
56
56
|
b24ui?: Partial<typeof modal.slots>
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export interface ModalEmits extends DialogRootEmits {
|
|
59
|
+
export interface ModalEmits extends DialogRootEmits {
|
|
60
|
+
'after:leave': []
|
|
61
|
+
}
|
|
60
62
|
|
|
61
63
|
export interface ModalSlots {
|
|
62
64
|
default(props: { open: boolean }): any
|
|
@@ -124,7 +126,7 @@ const b24ui = computed(() => modal({
|
|
|
124
126
|
<DialogPortal :disabled="!portal">
|
|
125
127
|
<DialogOverlay v-if="overlay" :class="b24ui.overlay({ class: props.b24ui?.overlay })" />
|
|
126
128
|
|
|
127
|
-
<DialogContent :class="b24ui.content({ class: [!slots.default && props.class, props.b24ui?.content] })" v-bind="contentProps" v-on="contentEvents">
|
|
129
|
+
<DialogContent :class="b24ui.content({ class: [!slots.default && props.class, props.b24ui?.content] })" v-bind="contentProps" @after-leave="emits('after:leave')" v-on="contentEvents">
|
|
128
130
|
<VisuallyHidden v-if="!!slots.content && ((title || !!slots.title) || (description || !!slots.description))">
|
|
129
131
|
<DialogTitle v-if="title || !!slots.title">
|
|
130
132
|
<slot name="title">
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { useOverlay } from '../composables/useOverlay'
|
|
4
|
+
|
|
5
|
+
const { overlays, unMount, close } = useOverlay()
|
|
6
|
+
|
|
7
|
+
const mountedOverlays = computed(() => overlays.filter(overlay => overlay.isMounted))
|
|
8
|
+
|
|
9
|
+
const onAfterLeave = (id: symbol) => {
|
|
10
|
+
close(id)
|
|
11
|
+
unMount(id)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const onClose = (id: symbol, value: any) => {
|
|
15
|
+
close(id, value)
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<component
|
|
21
|
+
:is="overlay.component"
|
|
22
|
+
v-for="overlay in mountedOverlays"
|
|
23
|
+
:key="overlay.id"
|
|
24
|
+
v-bind="overlay.props"
|
|
25
|
+
v-model:open="overlay.modelValue"
|
|
26
|
+
@close="(value:any) => onClose(overlay.id, value)"
|
|
27
|
+
@after:leave="onAfterLeave(overlay.id)"
|
|
28
|
+
/>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { DialogRootProps, DialogRootEmits, DialogContentProps } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/b24ui/slideover'
|
|
7
|
+
import { tv } from '../utils/tv'
|
|
8
|
+
import type { ButtonProps, IconComponent } from '../types'
|
|
9
|
+
|
|
10
|
+
const appConfigSlideover = _appConfig as AppConfig & { b24ui: { slideover: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const slideover = tv({ extend: tv(theme), ...(appConfigSlideover.b24ui?.slideover || {}) })
|
|
13
|
+
|
|
14
|
+
type SlideoverVariants = VariantProps<typeof slideover>
|
|
15
|
+
|
|
16
|
+
export interface SlideoverProps extends DialogRootProps {
|
|
17
|
+
title?: string
|
|
18
|
+
description?: string
|
|
19
|
+
/** The content of the slideover. */
|
|
20
|
+
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
21
|
+
/**
|
|
22
|
+
* Render an overlay behind the slideover.
|
|
23
|
+
* @defaultValue true
|
|
24
|
+
*/
|
|
25
|
+
overlay?: boolean
|
|
26
|
+
/**
|
|
27
|
+
* Animate the slideover when opening or closing.
|
|
28
|
+
* @defaultValue true
|
|
29
|
+
*/
|
|
30
|
+
transition?: boolean
|
|
31
|
+
side?: SlideoverVariants['side']
|
|
32
|
+
/**
|
|
33
|
+
* Render the slideover in a portal.
|
|
34
|
+
* @defaultValue true
|
|
35
|
+
*/
|
|
36
|
+
portal?: boolean
|
|
37
|
+
/**
|
|
38
|
+
* Display a close button to dismiss the slideover.
|
|
39
|
+
* `{ color: 'primary' }`{lang="ts"} for `left`, `right`
|
|
40
|
+
* `{ color: 'link' }`{lang="ts"} for `top`, `bottom`
|
|
41
|
+
* @defaultValue true
|
|
42
|
+
*/
|
|
43
|
+
close?: boolean | Partial<ButtonProps>
|
|
44
|
+
/**
|
|
45
|
+
* The icon displayed in the close button.
|
|
46
|
+
* @defaultValue icons.close
|
|
47
|
+
*/
|
|
48
|
+
closeIcon?: IconComponent
|
|
49
|
+
/**
|
|
50
|
+
* When `false`, the slideover will not close when clicking outside or pressing escape.
|
|
51
|
+
* @defaultValue true
|
|
52
|
+
*/
|
|
53
|
+
dismissible?: boolean
|
|
54
|
+
scrollbarThin?: boolean
|
|
55
|
+
class?: any
|
|
56
|
+
b24ui?: Partial<typeof slideover.slots>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface SlideoverEmits extends DialogRootEmits {
|
|
60
|
+
'after:leave': []
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface SlideoverSlots {
|
|
64
|
+
default(props: { open: boolean }): any
|
|
65
|
+
content(props?: {}): any
|
|
66
|
+
header(props?: {}): any
|
|
67
|
+
title(props?: {}): any
|
|
68
|
+
description(props?: {}): any
|
|
69
|
+
close(props: { b24ui: any }): any
|
|
70
|
+
body(props?: {}): any
|
|
71
|
+
footer(props?: {}): any
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<script setup lang="ts">
|
|
76
|
+
import { computed, toRef } from 'vue'
|
|
77
|
+
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, VisuallyHidden, useForwardPropsEmits } from 'reka-ui'
|
|
78
|
+
import { reactivePick } from '@vueuse/core'
|
|
79
|
+
import { useLocale } from '../composables/useLocale'
|
|
80
|
+
import icons from '../dictionary/icons'
|
|
81
|
+
import B24Button from './Button.vue'
|
|
82
|
+
|
|
83
|
+
const props = withDefaults(defineProps<SlideoverProps>(), {
|
|
84
|
+
close: true,
|
|
85
|
+
portal: true,
|
|
86
|
+
overlay: true,
|
|
87
|
+
transition: true,
|
|
88
|
+
modal: true,
|
|
89
|
+
dismissible: true,
|
|
90
|
+
side: 'right',
|
|
91
|
+
scrollbarThin: true
|
|
92
|
+
})
|
|
93
|
+
const emits = defineEmits<SlideoverEmits>()
|
|
94
|
+
const slots = defineSlots<SlideoverSlots>()
|
|
95
|
+
|
|
96
|
+
const { t } = useLocale()
|
|
97
|
+
|
|
98
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emits)
|
|
99
|
+
const contentProps = toRef(() => props.content)
|
|
100
|
+
const contentEvents = computed(() => {
|
|
101
|
+
if (!props.dismissible) {
|
|
102
|
+
return {
|
|
103
|
+
pointerDownOutside: (e: Event) => e.preventDefault(),
|
|
104
|
+
interactOutside: (e: Event) => e.preventDefault(),
|
|
105
|
+
escapeKeyDown: (e: Event) => e.preventDefault(),
|
|
106
|
+
closeAutoFocus: (e: Event) => e.preventDefault()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
closeAutoFocus: (e: Event) => e.preventDefault()
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
const b24ui = computed(() => slideover({
|
|
116
|
+
transition: props.transition,
|
|
117
|
+
side: props.side
|
|
118
|
+
}))
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<template>
|
|
122
|
+
<DialogRoot v-slot="{ open }" v-bind="rootProps">
|
|
123
|
+
<DialogTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
124
|
+
<slot :open="open" />
|
|
125
|
+
</DialogTrigger>
|
|
126
|
+
|
|
127
|
+
<DialogPortal :disabled="!portal">
|
|
128
|
+
<DialogOverlay v-if="overlay" :class="b24ui.overlay({ class: props.b24ui?.overlay })" />
|
|
129
|
+
|
|
130
|
+
<DialogContent :data-side="side" :class="b24ui.content({ class: [!slots.default && props.class, props.b24ui?.content] })" v-bind="contentProps" @after-leave="emits('after:leave')" v-on="contentEvents">
|
|
131
|
+
<VisuallyHidden v-if="!!slots.content && ((title || !!slots.title) || (description || !!slots.description))">
|
|
132
|
+
<DialogTitle v-if="title || !!slots.title">
|
|
133
|
+
<slot name="title">
|
|
134
|
+
{{ title }}
|
|
135
|
+
</slot>
|
|
136
|
+
</DialogTitle>
|
|
137
|
+
|
|
138
|
+
<DialogDescription v-if="description || !!slots.description">
|
|
139
|
+
<slot name="description">
|
|
140
|
+
{{ description }}
|
|
141
|
+
</slot>
|
|
142
|
+
</DialogDescription>
|
|
143
|
+
</VisuallyHidden>
|
|
144
|
+
|
|
145
|
+
<slot name="content">
|
|
146
|
+
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (close || !!slots.close)" :class="b24ui.header({ class: props.b24ui?.header })">
|
|
147
|
+
<slot name="header">
|
|
148
|
+
<div :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
|
|
149
|
+
<DialogTitle v-if="title || !!slots.title" :class="b24ui.title({ class: props.b24ui?.title })">
|
|
150
|
+
<slot name="title">
|
|
151
|
+
{{ title }}
|
|
152
|
+
</slot>
|
|
153
|
+
</DialogTitle>
|
|
154
|
+
|
|
155
|
+
<DialogDescription v-if="description || !!slots.description" :class="b24ui.description({ class: props.b24ui?.description })">
|
|
156
|
+
<slot name="description">
|
|
157
|
+
{{ description }}
|
|
158
|
+
</slot>
|
|
159
|
+
</DialogDescription>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<DialogClose as-child>
|
|
163
|
+
<slot name="close" :b24ui="b24ui">
|
|
164
|
+
<B24Button
|
|
165
|
+
v-if="close"
|
|
166
|
+
:icon="closeIcon || icons.close"
|
|
167
|
+
size="md"
|
|
168
|
+
class="group"
|
|
169
|
+
:color="['left', 'right'].includes(props?.side) ? 'primary' : 'link'"
|
|
170
|
+
:aria-label="t('slideover.close')"
|
|
171
|
+
:b24ui="{
|
|
172
|
+
leadingIcon: ['left', 'right'].includes(props?.side) ? 'group-hover:rounded-full group-hover:border-1 group-hover:border-current' : ''
|
|
173
|
+
}"
|
|
174
|
+
v-bind="(typeof close === 'object' ? close as Partial<ButtonProps> : {})"
|
|
175
|
+
:class="b24ui.close({ class: props.b24ui?.close })"
|
|
176
|
+
/>
|
|
177
|
+
</slot>
|
|
178
|
+
</DialogClose>
|
|
179
|
+
</slot>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<div :class="b24ui.body({ class: props.b24ui?.body, scrollbarThin: Boolean(props.scrollbarThin) })">
|
|
183
|
+
<slot name="body" />
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<div v-if="!!slots.footer" :class="b24ui.footer({ class: props.b24ui?.footer })">
|
|
187
|
+
<slot name="footer" />
|
|
188
|
+
</div>
|
|
189
|
+
</slot>
|
|
190
|
+
</DialogContent>
|
|
191
|
+
</DialogPortal>
|
|
192
|
+
</DialogRoot>
|
|
193
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import type { ComponentProps } from 'vue-component-type-helpers';
|
|
3
|
+
export type OverlayOptions<OverlayAttrs = Record<string, any>> = {
|
|
4
|
+
defaultOpen?: boolean;
|
|
5
|
+
props?: OverlayAttrs;
|
|
6
|
+
destroyOnClose?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type ManagedOverlayOptionsPrivate<T extends Component> = {
|
|
9
|
+
component?: T;
|
|
10
|
+
id: symbol;
|
|
11
|
+
isMounted: boolean;
|
|
12
|
+
modelValue: boolean;
|
|
13
|
+
resolvePromise?: (value: unknown) => void;
|
|
14
|
+
};
|
|
15
|
+
export type Overlay = OverlayOptions<Component> & ManagedOverlayOptionsPrivate<Component>;
|
|
16
|
+
interface OverlayInstance<T> {
|
|
17
|
+
open: (props?: ComponentProps<T>) => Promise<any>;
|
|
18
|
+
close: (value?: any) => void;
|
|
19
|
+
patch: (props: Partial<ComponentProps<T>>) => void;
|
|
20
|
+
}
|
|
21
|
+
declare function _useOverlay(): {
|
|
22
|
+
overlays: import("vue").ShallowReactive<Overlay[]>;
|
|
23
|
+
open: <T extends Component>(id: symbol, props?: ComponentProps<T>) => Promise<any>;
|
|
24
|
+
close: (id: symbol, value?: any) => void;
|
|
25
|
+
create: <T extends Component>(component: T, _options?: OverlayOptions<ComponentProps<T>>) => OverlayInstance<T>;
|
|
26
|
+
patch: <T extends Component>(id: symbol, props: Partial<ComponentProps<T>>) => void;
|
|
27
|
+
unMount: (id: symbol) => void;
|
|
28
|
+
};
|
|
29
|
+
export declare const useOverlay: typeof _useOverlay;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { shallowReactive, reactive, markRaw } from "vue";
|
|
2
|
+
import { createSharedComposable } from "@vueuse/core";
|
|
3
|
+
function _useOverlay() {
|
|
4
|
+
const overlays = shallowReactive([]);
|
|
5
|
+
const create = (component, _options) => {
|
|
6
|
+
const { props, defaultOpen, destroyOnClose } = _options || {};
|
|
7
|
+
const options = reactive({
|
|
8
|
+
id: Symbol(import.meta.dev ? "useOverlay" : ""),
|
|
9
|
+
modelValue: !!defaultOpen,
|
|
10
|
+
component: markRaw(component),
|
|
11
|
+
isMounted: !!defaultOpen,
|
|
12
|
+
destroyOnClose: !!destroyOnClose,
|
|
13
|
+
props: props || {}
|
|
14
|
+
});
|
|
15
|
+
overlays.push(options);
|
|
16
|
+
return {
|
|
17
|
+
open: (props2) => open(options.id, props2),
|
|
18
|
+
close: (value) => close(options.id, value),
|
|
19
|
+
patch: (props2) => patch(options.id, props2)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const open = (id, props) => {
|
|
23
|
+
const overlay = getOverlay(id);
|
|
24
|
+
if (props) {
|
|
25
|
+
patch(overlay.id, props);
|
|
26
|
+
}
|
|
27
|
+
overlay.modelValue = true;
|
|
28
|
+
overlay.isMounted = true;
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
overlay.resolvePromise = resolve;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const close = (id, value) => {
|
|
34
|
+
const overlay = getOverlay(id);
|
|
35
|
+
overlay.modelValue = false;
|
|
36
|
+
if (overlay.resolvePromise) {
|
|
37
|
+
overlay.resolvePromise(value);
|
|
38
|
+
overlay.resolvePromise = void 0;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const unMount = (id) => {
|
|
42
|
+
const overlay = getOverlay(id);
|
|
43
|
+
overlay.isMounted = false;
|
|
44
|
+
if (overlay.destroyOnClose) {
|
|
45
|
+
const index = overlays.findIndex((overlay2) => overlay2.id === id);
|
|
46
|
+
overlays.splice(index, 1);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const patch = (id, props) => {
|
|
50
|
+
const overlay = getOverlay(id);
|
|
51
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
52
|
+
overlay.props[key] = value;
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const getOverlay = (id) => {
|
|
56
|
+
const overlay = overlays.find((overlay2) => overlay2.id === id);
|
|
57
|
+
if (!overlay) {
|
|
58
|
+
throw new Error("Overlay not found");
|
|
59
|
+
}
|
|
60
|
+
return overlay;
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
overlays,
|
|
64
|
+
open,
|
|
65
|
+
close,
|
|
66
|
+
create,
|
|
67
|
+
patch,
|
|
68
|
+
unMount
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export const useOverlay = createSharedComposable(_useOverlay);
|
|
@@ -27,6 +27,7 @@ export * from '../components/Select.vue';
|
|
|
27
27
|
export * from '../components/SelectMenu.vue';
|
|
28
28
|
export * from '../components/Separator.vue';
|
|
29
29
|
export * from '../components/Skeleton.vue';
|
|
30
|
+
export * from '../components/Slideover.vue';
|
|
30
31
|
export * from '../components/Switch.vue';
|
|
31
32
|
export * from '../components/Tabs.vue';
|
|
32
33
|
export * from '../components/Textarea.vue';
|
|
@@ -27,6 +27,7 @@ export * from "../components/Select.vue";
|
|
|
27
27
|
export * from "../components/SelectMenu.vue";
|
|
28
28
|
export * from "../components/Separator.vue";
|
|
29
29
|
export * from "../components/Skeleton.vue";
|
|
30
|
+
export * from "../components/Slideover.vue";
|
|
30
31
|
export * from "../components/Switch.vue";
|
|
31
32
|
export * from "../components/Tabs.vue";
|
|
32
33
|
export * from "../components/Textarea.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useAppConfig: () => any;
|
|
@@ -5,6 +5,16 @@ export { useRoute, useRouter } from 'vue-router';
|
|
|
5
5
|
export { defineShortcuts } from '../composables/defineShortcuts';
|
|
6
6
|
export { useLocale } from '../composables/useLocale';
|
|
7
7
|
export { useConfetti } from '../composables/useConfetti';
|
|
8
|
+
export { useOverlay } from '../composables/useOverlay';
|
|
9
|
+
export declare const useColorMode: () => {
|
|
10
|
+
forced: boolean;
|
|
11
|
+
preference?: undefined;
|
|
12
|
+
readonly value?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
preference: "light" | "dark" | "system";
|
|
15
|
+
readonly value: import("@vueuse/core").BasicColorMode;
|
|
16
|
+
forced: boolean;
|
|
17
|
+
};
|
|
8
18
|
export declare const useAppConfig: () => any;
|
|
9
19
|
export declare const useCookie: <T = string>(_name: string, _options?: Record<string, any>) => {
|
|
10
20
|
value: Ref<T, T>;
|
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
import { ref } from "vue";
|
|
2
2
|
import appConfig from "#build/app.config";
|
|
3
|
+
import { useColorMode as useColorModeVueUse } from "@vueuse/core";
|
|
3
4
|
export { useHead } from "@unhead/vue";
|
|
4
5
|
export { useRoute, useRouter } from "vue-router";
|
|
5
6
|
export { defineShortcuts } from "../composables/defineShortcuts.js";
|
|
6
7
|
export { useLocale } from "../composables/useLocale.js";
|
|
7
8
|
export { useConfetti } from "../composables/useConfetti.js";
|
|
9
|
+
export { useOverlay } from "../composables/useOverlay.js";
|
|
10
|
+
export const useColorMode = () => {
|
|
11
|
+
if (!appConfig.colorMode) {
|
|
12
|
+
return {
|
|
13
|
+
forced: true
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const { store, system } = useColorModeVueUse();
|
|
17
|
+
return {
|
|
18
|
+
get preference() {
|
|
19
|
+
return store.value === "auto" ? "system" : store.value;
|
|
20
|
+
},
|
|
21
|
+
set preference(value) {
|
|
22
|
+
store.value = value === "system" ? "auto" : value;
|
|
23
|
+
},
|
|
24
|
+
get value() {
|
|
25
|
+
return store.value === "auto" ? system.value : store.value;
|
|
26
|
+
},
|
|
27
|
+
forced: false
|
|
28
|
+
};
|
|
29
|
+
};
|
|
8
30
|
export const useAppConfig = () => appConfig;
|
|
9
31
|
export const useCookie = (_name, _options = {}) => {
|
|
10
32
|
const value = ref(null);
|
|
@@ -1508,7 +1508,7 @@ const chip = {
|
|
|
1508
1508
|
};
|
|
1509
1509
|
|
|
1510
1510
|
const container = {
|
|
1511
|
-
base: "max-w-[80rem] mx-auto px-
|
|
1511
|
+
base: "max-w-[80rem] mx-auto px-5"
|
|
1512
1512
|
// max-w-7xl w-full
|
|
1513
1513
|
};
|
|
1514
1514
|
|
|
@@ -4087,6 +4087,124 @@ const skeleton = {
|
|
|
4087
4087
|
base: "animate-pulse rounded-md bg-gray-200 dark:bg-gray-800"
|
|
4088
4088
|
};
|
|
4089
4089
|
|
|
4090
|
+
const slideover = {
|
|
4091
|
+
slots: {
|
|
4092
|
+
overlay: "fixed inset-0 bg-base-950/20 dark:bg-base-950/30",
|
|
4093
|
+
content: [
|
|
4094
|
+
"fixed",
|
|
4095
|
+
"bg-base-50 dark:bg-base-950",
|
|
4096
|
+
// 'divide-y divide-(--ui-border)',
|
|
4097
|
+
"sm:shadow-lg",
|
|
4098
|
+
"flex flex-col focus:outline-none"
|
|
4099
|
+
].join(" "),
|
|
4100
|
+
header: [
|
|
4101
|
+
"mt-4 px-5",
|
|
4102
|
+
"flex items-center gap-1.5"
|
|
4103
|
+
].join(" "),
|
|
4104
|
+
wrapper: "min-h-2xl",
|
|
4105
|
+
body: [
|
|
4106
|
+
"mx-0 mt-2",
|
|
4107
|
+
"flex-1 overflow-y-auto"
|
|
4108
|
+
].join(" "),
|
|
4109
|
+
footer: "bg-white dark:bg-base-950 flex items-center justify-center gap-3 py-4 border-t border-t-1 border-t-base-900/10 dark:border-t-white/20 shadow-top-md p-2 pr-(--scrollbar-width)",
|
|
4110
|
+
title: "font-b24-system font-light text-4.5xl leading-none text-base-900 dark:text-base-150",
|
|
4111
|
+
description: "mt-2 mb-1 text-base-500 dark:text-base-400 text-sm",
|
|
4112
|
+
close: "absolute"
|
|
4113
|
+
},
|
|
4114
|
+
variants: {
|
|
4115
|
+
side: {
|
|
4116
|
+
top: {
|
|
4117
|
+
content: "inset-x-0 top-0 max-h-full"
|
|
4118
|
+
},
|
|
4119
|
+
right: {
|
|
4120
|
+
content: "right-0 inset-y-0 w-full max-w-[28rem]"
|
|
4121
|
+
},
|
|
4122
|
+
bottom: {
|
|
4123
|
+
content: "inset-x-0 bottom-0 max-h-full"
|
|
4124
|
+
},
|
|
4125
|
+
left: {
|
|
4126
|
+
content: "left-0 inset-y-0 w-full max-w-[28rem]"
|
|
4127
|
+
}
|
|
4128
|
+
},
|
|
4129
|
+
transition: {
|
|
4130
|
+
true: {
|
|
4131
|
+
overlay: "data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]"
|
|
4132
|
+
}
|
|
4133
|
+
},
|
|
4134
|
+
scrollbarThin: {
|
|
4135
|
+
true: {
|
|
4136
|
+
body: "scrollbar-thin"
|
|
4137
|
+
}
|
|
4138
|
+
}
|
|
4139
|
+
},
|
|
4140
|
+
compoundVariants: [
|
|
4141
|
+
// region close ////
|
|
4142
|
+
// close: 'absolute ' ////
|
|
4143
|
+
{
|
|
4144
|
+
side: "right",
|
|
4145
|
+
class: {
|
|
4146
|
+
close: [
|
|
4147
|
+
"pl-1.5 pr-2.5",
|
|
4148
|
+
"top-3 -translate-x-full left-0",
|
|
4149
|
+
"rounded-l-full"
|
|
4150
|
+
].join(" ")
|
|
4151
|
+
}
|
|
4152
|
+
},
|
|
4153
|
+
{
|
|
4154
|
+
side: "left",
|
|
4155
|
+
class: {
|
|
4156
|
+
close: [
|
|
4157
|
+
"pr-1.5 pl-2.5",
|
|
4158
|
+
"top-3 translate-x-full right-0",
|
|
4159
|
+
"rounded-r-full"
|
|
4160
|
+
].join(" ")
|
|
4161
|
+
}
|
|
4162
|
+
},
|
|
4163
|
+
{
|
|
4164
|
+
side: ["top", "bottom"],
|
|
4165
|
+
class: {
|
|
4166
|
+
close: [
|
|
4167
|
+
"top-4 end-4"
|
|
4168
|
+
].join(" ")
|
|
4169
|
+
}
|
|
4170
|
+
},
|
|
4171
|
+
// endregion ////
|
|
4172
|
+
// region transition ////
|
|
4173
|
+
{
|
|
4174
|
+
transition: true,
|
|
4175
|
+
side: "top",
|
|
4176
|
+
class: {
|
|
4177
|
+
content: "data-[state=open]:animate-[slide-in-from-top_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-top_200ms_ease-in-out]"
|
|
4178
|
+
}
|
|
4179
|
+
},
|
|
4180
|
+
{
|
|
4181
|
+
transition: true,
|
|
4182
|
+
side: "right",
|
|
4183
|
+
class: {
|
|
4184
|
+
content: "data-[state=open]:animate-[slide-in-from-right_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-right_200ms_ease-in-out]"
|
|
4185
|
+
}
|
|
4186
|
+
},
|
|
4187
|
+
{
|
|
4188
|
+
transition: true,
|
|
4189
|
+
side: "bottom",
|
|
4190
|
+
class: {
|
|
4191
|
+
content: "data-[state=open]:animate-[slide-in-from-bottom_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-bottom_200ms_ease-in-out]"
|
|
4192
|
+
}
|
|
4193
|
+
},
|
|
4194
|
+
{
|
|
4195
|
+
transition: true,
|
|
4196
|
+
side: "left",
|
|
4197
|
+
class: {
|
|
4198
|
+
content: "data-[state=open]:animate-[slide-in-from-left_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-left_200ms_ease-in-out]"
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
],
|
|
4202
|
+
defaultVariants: {
|
|
4203
|
+
side: "right",
|
|
4204
|
+
scrollbarThin: true
|
|
4205
|
+
}
|
|
4206
|
+
};
|
|
4207
|
+
|
|
4090
4208
|
const _switch = {
|
|
4091
4209
|
slots: {
|
|
4092
4210
|
root: "relative flex items-start",
|
|
@@ -4945,7 +5063,7 @@ const toast = {
|
|
|
4945
5063
|
|
|
4946
5064
|
const toaster = {
|
|
4947
5065
|
slots: {
|
|
4948
|
-
viewport: "fixed flex flex-col w-[calc(100%-2rem)] sm:w-96 z-[100] data-[expanded=true]:h-(--height) focus:outline-none",
|
|
5066
|
+
viewport: "fixed flex flex-col w-[calc(100%-2rem)] sm:w-96 z-[100] data-[expanded=true]:h-(--height) focus:outline-none mr-(--scrollbar-width)",
|
|
4949
5067
|
base: "pointer-events-auto absolute inset-x-0 z-(--index) transform-(--transform) data-[expanded=false]:data-[front=false]:h-(--front-height) data-[expanded=false]:data-[front=false]:*:invisible data-[state=closed]:animate-[toast-closed_200ms_ease-in-out] data-[state=closed]:data-[expanded=false]:data-[front=false]:animate-[toast-collapsed-closed_200ms_ease-in-out] data-[swipe=move]:transition-none transition-[transform,translate,height] duration-200 ease-out"
|
|
4950
5068
|
},
|
|
4951
5069
|
variants: {
|
|
@@ -5066,6 +5184,7 @@ const theme = {
|
|
|
5066
5184
|
selectMenu: selectMenu,
|
|
5067
5185
|
separator: separator,
|
|
5068
5186
|
skeleton: skeleton,
|
|
5187
|
+
slideover: slideover,
|
|
5069
5188
|
switch: _switch,
|
|
5070
5189
|
tabs: tabs,
|
|
5071
5190
|
textarea: textarea,
|