@bitrix24/b24ui-nuxt 0.1.7 → 0.2.1
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/alert.ts +18 -8
- package/.nuxt/b24ui/badge.ts +1 -1
- package/.nuxt/b24ui/content/description-list.ts +17 -7
- package/.nuxt/b24ui/index.ts +1 -0
- package/.nuxt/b24ui/input-menu.ts +591 -0
- package/.nuxt/b24ui/input.ts +5 -5
- package/.nuxt/b24ui/select-menu.ts +6 -6
- package/.nuxt/b24ui/select.ts +6 -6
- package/.nuxt/b24ui/toast.ts +18 -8
- package/README.md +8 -8
- package/dist/meta.cjs +5409 -331
- package/dist/meta.d.cts +5409 -331
- package/dist/meta.d.mts +5409 -331
- package/dist/meta.d.ts +5409 -331
- package/dist/meta.mjs +5409 -331
- package/dist/module.cjs +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Alert.vue +13 -10
- package/dist/runtime/components/InputMenu.vue +507 -0
- package/dist/runtime/components/Toast.vue +26 -14
- package/dist/runtime/components/Toaster.vue +2 -2
- package/dist/runtime/components/content/DescriptionList.vue +9 -7
- package/dist/runtime/composables/useComponentIcons.d.ts +2 -2
- package/dist/runtime/composables/useToast.d.ts +5 -4
- package/dist/runtime/composables/useToast.js +2 -2
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +5 -0
- package/dist/shared/{b24ui-nuxt.vQRZieQw.mjs → b24ui-nuxt.CrjojW8t.mjs} +292 -31
- package/dist/shared/{b24ui-nuxt.ZUYaG6CJ.cjs → b24ui-nuxt.D5cXbZSx.cjs} +292 -31
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +18 -1
|
@@ -6,6 +6,7 @@ import _appConfig from '#build/app.config'
|
|
|
6
6
|
import theme from '#build/b24ui/toast'
|
|
7
7
|
import { tv } from '../utils/tv'
|
|
8
8
|
import type { AvatarProps, ButtonProps, IconComponent } from '../types'
|
|
9
|
+
import type { StringOrVNode } from '../types/utils'
|
|
9
10
|
|
|
10
11
|
const appConfigToast = _appConfig as AppConfig & { b24ui: { toast: Partial<typeof theme> } }
|
|
11
12
|
|
|
@@ -19,15 +20,16 @@ export interface ToastProps extends Pick<ToastRootProps, 'defaultOpen' | 'open'
|
|
|
19
20
|
* @defaultValue 'li'
|
|
20
21
|
*/
|
|
21
22
|
as?: any
|
|
22
|
-
title?:
|
|
23
|
-
description?:
|
|
23
|
+
title?: StringOrVNode
|
|
24
|
+
description?: StringOrVNode
|
|
24
25
|
icon?: IconComponent
|
|
25
26
|
avatar?: AvatarProps
|
|
26
27
|
color?: ToastVariants['color']
|
|
28
|
+
orientation?: ToastVariants['orientation']
|
|
27
29
|
/**
|
|
28
30
|
* Display a list of actions:
|
|
29
|
-
* - under the title and description
|
|
30
|
-
* - next to the close button
|
|
31
|
+
* - under the title and description when orientation is `vertical`
|
|
32
|
+
* - next to the close button when orientation is `horizontal`
|
|
31
33
|
* `{ size: 'xs' }`{lang="ts-type"}
|
|
32
34
|
*/
|
|
33
35
|
actions?: ButtonProps[]
|
|
@@ -67,7 +69,8 @@ import B24Avatar from './Avatar.vue'
|
|
|
67
69
|
import B24Button from './Button.vue'
|
|
68
70
|
|
|
69
71
|
const props = withDefaults(defineProps<ToastProps>(), {
|
|
70
|
-
close: true
|
|
72
|
+
close: true,
|
|
73
|
+
orientation: 'vertical'
|
|
71
74
|
})
|
|
72
75
|
const emits = defineEmits<ToastEmits>()
|
|
73
76
|
const slots = defineSlots<ToastSlots>()
|
|
@@ -76,10 +79,10 @@ const { t } = useLocale()
|
|
|
76
79
|
|
|
77
80
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen', 'open', 'duration', 'type'), emits)
|
|
78
81
|
|
|
79
|
-
const multiline = computed(() => !!props.title && !!props.description)
|
|
80
|
-
|
|
81
82
|
const b24ui = computed(() => toast({
|
|
82
|
-
color: props.color
|
|
83
|
+
color: props.color,
|
|
84
|
+
orientation: props.orientation,
|
|
85
|
+
title: !!props.title || !!slots.title
|
|
83
86
|
}))
|
|
84
87
|
|
|
85
88
|
const el = ref()
|
|
@@ -105,7 +108,8 @@ defineExpose({
|
|
|
105
108
|
ref="el"
|
|
106
109
|
v-slot="{ remaining, duration }"
|
|
107
110
|
v-bind="rootProps"
|
|
108
|
-
:
|
|
111
|
+
:data-orientation="orientation"
|
|
112
|
+
:class="b24ui.root({ class: [props.class, props.b24ui?.root] })"
|
|
109
113
|
:style="{ '--height': height }"
|
|
110
114
|
>
|
|
111
115
|
<slot name="leading">
|
|
@@ -120,16 +124,24 @@ defineExpose({
|
|
|
120
124
|
<div :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
|
|
121
125
|
<ToastTitle v-if="title || !!slots.title" :class="b24ui.title({ class: props.b24ui?.title })">
|
|
122
126
|
<slot name="title">
|
|
123
|
-
|
|
127
|
+
<component :is="title()" v-if="typeof title === 'function'" />
|
|
128
|
+
<component :is="title" v-else-if="typeof title === 'object'" />
|
|
129
|
+
<template v-else>
|
|
130
|
+
{{ title }}
|
|
131
|
+
</template>
|
|
124
132
|
</slot>
|
|
125
133
|
</ToastTitle>
|
|
126
134
|
<ToastDescription v-if="description || !!slots.description" :class="b24ui.description({ class: props.b24ui?.description })">
|
|
127
135
|
<slot name="description">
|
|
128
|
-
|
|
136
|
+
<component :is="description()" v-if="typeof description === 'function'" />
|
|
137
|
+
<component :is="description" v-else-if="typeof description === 'object'" />
|
|
138
|
+
<template v-else>
|
|
139
|
+
{{ description }}
|
|
140
|
+
</template>
|
|
129
141
|
</slot>
|
|
130
142
|
</ToastDescription>
|
|
131
143
|
|
|
132
|
-
<div v-if="
|
|
144
|
+
<div v-if="orientation === 'vertical' && actions?.length" :class="b24ui.actions({ class: props.b24ui?.actions })">
|
|
133
145
|
<slot name="actions">
|
|
134
146
|
<ToastAction v-for="(action, index) in actions" :key="index" :alt-text="action.label || 'Action'" as-child @click.stop>
|
|
135
147
|
<B24Button size="xs" :color="color" v-bind="action" />
|
|
@@ -138,8 +150,8 @@ defineExpose({
|
|
|
138
150
|
</div>
|
|
139
151
|
</div>
|
|
140
152
|
|
|
141
|
-
<div v-if="(
|
|
142
|
-
<template v-if="
|
|
153
|
+
<div v-if="(orientation === 'horizontal' && actions?.length) || close !== null" :class="b24ui.actions({ class: props.b24ui?.actions, orientation: 'horizontal' })">
|
|
154
|
+
<template v-if="orientation === 'horizontal' && actions?.length">
|
|
143
155
|
<slot name="actions">
|
|
144
156
|
<ToastAction v-for="(action, index) in actions" :key="index" :alt-text="action.label || 'Action'" as-child @click.stop>
|
|
145
157
|
<B24Button size="xs" :color="color" v-bind="action" />
|
|
@@ -118,10 +118,10 @@ function getOffset(index: number) {
|
|
|
118
118
|
'--transform': 'translateY(var(--translate)) scale(var(--scale))'
|
|
119
119
|
}"
|
|
120
120
|
:class="[b24ui.base(), {
|
|
121
|
-
'cursor-pointer': !!toast.
|
|
121
|
+
'cursor-pointer': !!toast.onClick
|
|
122
122
|
}]"
|
|
123
123
|
@update:open="onUpdateOpen($event, toast.id)"
|
|
124
|
-
@click="toast.
|
|
124
|
+
@click="toast.onClick && toast.onClick(toast)"
|
|
125
125
|
/>
|
|
126
126
|
|
|
127
127
|
<ToastPortal :disabled="!portal">
|
|
@@ -19,10 +19,11 @@ export interface DescriptionListItem {
|
|
|
19
19
|
avatar?: AvatarProps
|
|
20
20
|
slot?: string
|
|
21
21
|
description?: string
|
|
22
|
+
orientation?: DescriptionListVariants['orientation']
|
|
22
23
|
/**
|
|
23
24
|
* Display a list of actions:
|
|
24
|
-
* - under the description
|
|
25
|
-
* - next to the description
|
|
25
|
+
* - under the description when orientation is `vertical`
|
|
26
|
+
* - next to the description when orientation is `horizontal`
|
|
26
27
|
* `{ size: 'xs' }`{lang="ts-type"}
|
|
27
28
|
*/
|
|
28
29
|
actions?: ButtonProps[]
|
|
@@ -81,13 +82,13 @@ const b24ui = computed(() => descriptionList({
|
|
|
81
82
|
function normalizeItem(item: any) {
|
|
82
83
|
const label = get(item, props.labelKey as string)
|
|
83
84
|
const description = get(item, props.descriptionKey as string)
|
|
84
|
-
const
|
|
85
|
+
const orientation = item?.orientation || 'vertical'
|
|
85
86
|
|
|
86
87
|
return {
|
|
87
88
|
...item,
|
|
88
89
|
label,
|
|
89
90
|
description,
|
|
90
|
-
|
|
91
|
+
orientation
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
|
|
@@ -166,12 +167,13 @@ const normalizedItems = computed(() => {
|
|
|
166
167
|
</span>
|
|
167
168
|
</dt>
|
|
168
169
|
<dd
|
|
170
|
+
:data-orientation="item.orientation"
|
|
169
171
|
:class="b24ui.descriptionWrapper({
|
|
170
172
|
class: [
|
|
171
173
|
props.b24ui?.descriptionWrapper,
|
|
172
174
|
item?.b24ui?.descriptionWrapper
|
|
173
175
|
],
|
|
174
|
-
|
|
176
|
+
orientation: item.orientation
|
|
175
177
|
})"
|
|
176
178
|
>
|
|
177
179
|
<span
|
|
@@ -181,7 +183,7 @@ const normalizedItems = computed(() => {
|
|
|
181
183
|
props.b24ui?.description,
|
|
182
184
|
item?.b24ui?.description
|
|
183
185
|
],
|
|
184
|
-
|
|
186
|
+
orientation: item.orientation
|
|
185
187
|
})"
|
|
186
188
|
>
|
|
187
189
|
<slot name="description" :item="item" :index="index">
|
|
@@ -195,7 +197,7 @@ const normalizedItems = computed(() => {
|
|
|
195
197
|
props.b24ui?.actions,
|
|
196
198
|
item?.b24ui?.actions
|
|
197
199
|
],
|
|
198
|
-
|
|
200
|
+
orientation: item.orientation
|
|
199
201
|
})"
|
|
200
202
|
>
|
|
201
203
|
<slot name="actions" :item="item" :index="index">
|
|
@@ -15,6 +15,6 @@ export interface UseComponentIconsProps {
|
|
|
15
15
|
export declare function useComponentIcons(componentProps: MaybeRefOrGetter<UseComponentIconsProps>): {
|
|
16
16
|
isLeading: import("vue").ComputedRef<any>;
|
|
17
17
|
isTrailing: import("vue").ComputedRef<boolean>;
|
|
18
|
-
leadingIconName: import("vue").ComputedRef<
|
|
19
|
-
trailingIconName: import("vue").ComputedRef<
|
|
18
|
+
leadingIconName: import("vue").ComputedRef<IconComponent | undefined>;
|
|
19
|
+
trailingIconName: import("vue").ComputedRef<IconComponent | undefined>;
|
|
20
20
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { ToastProps } from '../types';
|
|
2
|
-
|
|
1
|
+
import type { ToastProps, ToastEmits } from '../types';
|
|
2
|
+
import type { EmitsToProps } from '../types/utils';
|
|
3
|
+
export interface Toast extends Omit<ToastProps, 'defaultOpen'>, EmitsToProps<ToastEmits> {
|
|
3
4
|
id: string | number;
|
|
4
|
-
|
|
5
|
+
onClick?: (toast: Toast) => void;
|
|
5
6
|
}
|
|
6
7
|
export declare function useToast(): {
|
|
7
8
|
toasts: import("vue").Ref<Toast[], Toast[]>;
|
|
8
|
-
add: (toast: Partial<Toast>) =>
|
|
9
|
+
add: (toast: Partial<Toast>) => Toast;
|
|
9
10
|
update: (id: string | number, toast: Omit<Partial<Toast>, "id">) => void;
|
|
10
11
|
remove: (id: string | number) => void;
|
|
11
12
|
clear: () => void;
|
|
@@ -18,14 +18,14 @@ export function useToast() {
|
|
|
18
18
|
}
|
|
19
19
|
running.value = false;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
function add(toast) {
|
|
22
22
|
const body = {
|
|
23
23
|
id: generateId(),
|
|
24
24
|
open: true,
|
|
25
25
|
...toast
|
|
26
26
|
};
|
|
27
27
|
queue.push(body);
|
|
28
|
-
|
|
28
|
+
processQueue();
|
|
29
29
|
return body;
|
|
30
30
|
}
|
|
31
31
|
function update(id, toast) {
|
|
@@ -13,6 +13,7 @@ export * from '../components/Countdown.vue';
|
|
|
13
13
|
export * from '../components/Form.vue';
|
|
14
14
|
export * from '../components/FormField.vue';
|
|
15
15
|
export * from '../components/Input.vue';
|
|
16
|
+
export * from '../components/InputMenu.vue';
|
|
16
17
|
export * from '../components/Kbd.vue';
|
|
17
18
|
export * from '../components/Link.vue';
|
|
18
19
|
export * from '../components/Progress.vue';
|
|
@@ -13,6 +13,7 @@ export * from "../components/Countdown.vue";
|
|
|
13
13
|
export * from "../components/Form.vue";
|
|
14
14
|
export * from "../components/FormField.vue";
|
|
15
15
|
export * from "../components/Input.vue";
|
|
16
|
+
export * from "../components/InputMenu.vue";
|
|
16
17
|
export * from "../components/Kbd.vue";
|
|
17
18
|
export * from "../components/Link.vue";
|
|
18
19
|
export * from "../components/Progress.vue";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
1
2
|
export interface TightMap<O = any> {
|
|
2
3
|
[key: string]: TightMap | O;
|
|
3
4
|
}
|
|
@@ -20,3 +21,7 @@ export type SelectItemKey<T> = T extends Record<string, any> ? keyof T : string;
|
|
|
20
21
|
export type SelectModelValueEmits<T, V, M extends boolean = false, DV = T> = {
|
|
21
22
|
'update:modelValue': [payload: SelectModelValue<T, V, M, DV>];
|
|
22
23
|
};
|
|
24
|
+
export type StringOrVNode = string | VNode | (() => VNode);
|
|
25
|
+
export type EmitsToProps<T> = {
|
|
26
|
+
[K in keyof T as `on${Capitalize<string & K>}`]: T[K] extends [...args: infer Args] ? (...args: Args) => void : never;
|
|
27
|
+
};
|