@bitrix24/b24ui-nuxt 2.0.9 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/meta.d.mts +77776 -42923
- package/dist/meta.mjs +77776 -42923
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -3
- package/dist/runtime/components/Advice.d.vue.ts +1 -1
- package/dist/runtime/components/Advice.vue +1 -3
- package/dist/runtime/components/Advice.vue.d.ts +1 -1
- package/dist/runtime/components/App.d.vue.ts +1 -1
- package/dist/runtime/components/App.vue +2 -1
- package/dist/runtime/components/App.vue.d.ts +1 -1
- package/dist/runtime/components/Avatar.d.vue.ts +2 -1
- package/dist/runtime/components/Avatar.vue.d.ts +2 -1
- package/dist/runtime/components/Button.vue +1 -0
- package/dist/runtime/components/ChatPrompt.d.vue.ts +2 -2
- package/dist/runtime/components/ChatPrompt.vue +5 -5
- package/dist/runtime/components/ChatPrompt.vue.d.ts +2 -2
- package/dist/runtime/components/ChatPromptSubmit.d.vue.ts +5 -5
- package/dist/runtime/components/ChatPromptSubmit.vue +53 -4
- package/dist/runtime/components/ChatPromptSubmit.vue.d.ts +5 -5
- package/dist/runtime/components/Checkbox.d.vue.ts +2 -1
- package/dist/runtime/components/Checkbox.vue.d.ts +2 -1
- package/dist/runtime/components/CommandPalette.vue +5 -4
- package/dist/runtime/components/DashboardSearch.d.vue.ts +3 -6
- package/dist/runtime/components/DashboardSearch.vue +2 -3
- package/dist/runtime/components/DashboardSearch.vue.d.ts +3 -6
- package/dist/runtime/components/DashboardSearchButton.d.vue.ts +2 -3
- package/dist/runtime/components/DashboardSearchButton.vue +44 -6
- package/dist/runtime/components/DashboardSearchButton.vue.d.ts +2 -3
- package/dist/runtime/components/Error.d.vue.ts +1 -1
- package/dist/runtime/components/Error.vue.d.ts +1 -1
- package/dist/runtime/components/FileUpload.d.vue.ts +3 -2
- package/dist/runtime/components/FileUpload.vue +9 -9
- package/dist/runtime/components/FileUpload.vue.d.ts +3 -2
- package/dist/runtime/components/Form.d.vue.ts +2 -1
- package/dist/runtime/components/Form.vue.d.ts +2 -1
- package/dist/runtime/components/Input.d.vue.ts +7 -7
- package/dist/runtime/components/Input.vue +2 -2
- package/dist/runtime/components/Input.vue.d.ts +7 -7
- package/dist/runtime/components/InputDate.d.vue.ts +115 -0
- package/dist/runtime/components/InputDate.vue +198 -0
- package/dist/runtime/components/InputDate.vue.d.ts +115 -0
- package/dist/runtime/components/InputMenu.d.vue.ts +7 -128
- package/dist/runtime/components/InputMenu.vue +3 -3
- package/dist/runtime/components/InputMenu.vue.d.ts +7 -128
- package/dist/runtime/components/InputNumber.d.vue.ts +25 -124
- package/dist/runtime/components/InputNumber.vue +3 -3
- package/dist/runtime/components/InputNumber.vue.d.ts +25 -124
- package/dist/runtime/components/InputTags.d.vue.ts +6 -109
- package/dist/runtime/components/InputTags.vue +8 -8
- package/dist/runtime/components/InputTags.vue.d.ts +6 -109
- package/dist/runtime/components/InputTime.d.vue.ts +99 -0
- package/dist/runtime/components/InputTime.vue +170 -0
- package/dist/runtime/components/InputTime.vue.d.ts +99 -0
- package/dist/runtime/components/Link.d.vue.ts +4 -49
- package/dist/runtime/components/Link.vue +1 -0
- package/dist/runtime/components/Link.vue.d.ts +4 -49
- package/dist/runtime/components/Modal.d.vue.ts +1 -1
- package/dist/runtime/components/Modal.vue.d.ts +1 -1
- package/dist/runtime/components/Pagination.d.vue.ts +2 -2
- package/dist/runtime/components/Pagination.vue.d.ts +2 -2
- package/dist/runtime/components/PinInput.d.vue.ts +3 -3
- package/dist/runtime/components/PinInput.vue.d.ts +3 -3
- package/dist/runtime/components/Progress.d.vue.ts +1 -1
- package/dist/runtime/components/Progress.vue.d.ts +1 -1
- package/dist/runtime/components/Select.d.vue.ts +6 -107
- package/dist/runtime/components/Select.vue +3 -3
- package/dist/runtime/components/Select.vue.d.ts +6 -107
- package/dist/runtime/components/SelectMenu.d.vue.ts +7 -106
- package/dist/runtime/components/SelectMenu.vue +3 -3
- package/dist/runtime/components/SelectMenu.vue.d.ts +7 -106
- package/dist/runtime/components/Slideover.d.vue.ts +1 -1
- package/dist/runtime/components/Slideover.vue.d.ts +1 -1
- package/dist/runtime/components/Switch.d.vue.ts +2 -1
- package/dist/runtime/components/Switch.vue.d.ts +2 -1
- package/dist/runtime/components/Table.d.vue.ts +5 -4
- package/dist/runtime/components/Table.vue +4 -3
- package/dist/runtime/components/Table.vue.d.ts +5 -4
- package/dist/runtime/components/Textarea.d.vue.ts +7 -6
- package/dist/runtime/components/Textarea.vue +2 -2
- package/dist/runtime/components/Textarea.vue.d.ts +7 -6
- package/dist/runtime/components/Toast.vue +5 -5
- package/dist/runtime/components/Toaster.d.vue.ts +1 -1
- package/dist/runtime/components/Toaster.vue.d.ts +1 -1
- package/dist/runtime/components/color-mode/ColorModeAvatar.d.vue.ts +3 -3
- package/dist/runtime/components/color-mode/ColorModeAvatar.vue +16 -4
- package/dist/runtime/components/color-mode/ColorModeAvatar.vue.d.ts +3 -3
- package/dist/runtime/components/color-mode/ColorModeButton.d.vue.ts +3 -3
- package/dist/runtime/components/color-mode/ColorModeButton.vue +54 -6
- package/dist/runtime/components/color-mode/ColorModeButton.vue.d.ts +3 -3
- package/dist/runtime/components/color-mode/ColorModeImage.d.vue.ts +4 -3
- package/dist/runtime/components/color-mode/ColorModeImage.vue +4 -0
- package/dist/runtime/components/color-mode/ColorModeImage.vue.d.ts +4 -3
- package/dist/runtime/components/color-mode/ColorModeSelect.d.vue.ts +5 -3
- package/dist/runtime/components/color-mode/ColorModeSelect.vue +47 -5
- package/dist/runtime/components/color-mode/ColorModeSelect.vue.d.ts +5 -3
- package/dist/runtime/components/color-mode/ColorModeSwitch.d.vue.ts +2 -2
- package/dist/runtime/components/color-mode/ColorModeSwitch.vue +29 -5
- package/dist/runtime/components/color-mode/ColorModeSwitch.vue.d.ts +2 -2
- package/dist/runtime/components/content/ContentSearch.d.vue.ts +3 -6
- package/dist/runtime/components/content/ContentSearch.vue +2 -3
- package/dist/runtime/components/content/ContentSearch.vue.d.ts +3 -6
- package/dist/runtime/components/content/ContentSearchButton.d.vue.ts +2 -3
- package/dist/runtime/components/content/ContentSearchButton.vue +43 -5
- package/dist/runtime/components/content/ContentSearchButton.vue.d.ts +2 -3
- package/dist/runtime/components/content/ContentSurround.vue +7 -1
- package/dist/runtime/components/locale/LocaleSelect.d.vue.ts +11 -7
- package/dist/runtime/components/locale/LocaleSelect.vue +50 -6
- package/dist/runtime/components/locale/LocaleSelect.vue.d.ts +11 -7
- package/dist/runtime/components/prose/Callout.vue +4 -0
- package/dist/runtime/composables/index.d.ts +8 -0
- package/dist/runtime/composables/index.js +8 -0
- package/dist/runtime/composables/useFileUpload.d.ts +2 -1
- package/dist/runtime/composables/useFileUpload.js +13 -4
- package/dist/runtime/inertia/components/Link.d.vue.ts +17 -10
- package/dist/runtime/inertia/components/Link.vue +8 -6
- package/dist/runtime/inertia/components/Link.vue.d.ts +17 -10
- package/dist/runtime/inertia/stubs.d.ts +1 -1
- package/dist/runtime/types/html.d.ts +8 -0
- package/dist/runtime/types/html.js +0 -0
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/input.d.ts +5 -5
- package/dist/runtime/types/utils.d.ts +2 -0
- package/dist/runtime/utils/content.d.ts +2 -2
- package/dist/runtime/utils/dashboard.d.ts +1 -1
- package/dist/runtime/utils/link.d.ts +1 -0
- package/dist/runtime/utils/link.js +40 -24
- package/dist/runtime/vue/components/Link.d.vue.ts +8 -37
- package/dist/runtime/vue/components/Link.vue +6 -11
- package/dist/runtime/vue/components/Link.vue.d.ts +8 -37
- package/dist/runtime/vue/components/color-mode/ColorModeButton.d.vue.ts +2 -2
- package/dist/runtime/vue/components/color-mode/ColorModeButton.vue +55 -5
- package/dist/runtime/vue/components/color-mode/ColorModeButton.vue.d.ts +2 -2
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.d.vue.ts +5 -3
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +46 -3
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue.d.ts +5 -3
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.d.vue.ts +1 -1
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue +24 -3
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue.d.ts +1 -1
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/runtime/vue/stubs.js +1 -1
- package/dist/shared/{b24ui-nuxt.4XNR9Ysu.mjs → b24ui-nuxt.CXLCGBie.mjs} +135 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +24 -14
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WatchOptions } from 'vue';
|
|
2
2
|
import type { AppConfig } from '@nuxt/schema';
|
|
3
3
|
import type { Cell, Header, RowData, TableMeta } from '@tanstack/table-core';
|
|
4
4
|
import type { CellContext, ColumnDef, ColumnFiltersOptions, ColumnFiltersState, ColumnOrderState, ColumnPinningOptions, ColumnPinningState, ColumnSizingInfoState, ColumnSizingOptions, ColumnSizingState, CoreOptions, ExpandedOptions, ExpandedState, FacetedOptions, GlobalFilterOptions, GroupingOptions, GroupingState, HeaderContext, PaginationOptions, PaginationState, Row, RowPinningOptions, RowPinningState, RowSelectionOptions, RowSelectionState, SortingOptions, SortingState, VisibilityOptions, VisibilityState } from '@tanstack/vue-table';
|
|
5
5
|
import type { VirtualizerOptions } from '@tanstack/vue-virtual';
|
|
6
6
|
import theme from '#build/b24ui/table';
|
|
7
|
+
import type { TableHTMLAttributes } from '../types/html';
|
|
7
8
|
import type { ComponentConfig } from '../types/tv';
|
|
8
9
|
declare module '@tanstack/table-core' {
|
|
9
10
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
@@ -40,7 +41,7 @@ export interface TableOptions<T extends TableData = TableData> extends Omit<Core
|
|
|
40
41
|
onStateChange?: CoreOptions<T>['onStateChange'];
|
|
41
42
|
renderFallbackValue?: CoreOptions<T>['renderFallbackValue'];
|
|
42
43
|
}
|
|
43
|
-
export interface TableProps<T extends TableData = TableData> extends TableOptions<T
|
|
44
|
+
export interface TableProps<T extends TableData = TableData> extends TableOptions<T>, /** @vue-ignore */ TableHTMLAttributes {
|
|
44
45
|
/**
|
|
45
46
|
* The element or component this component should render as.
|
|
46
47
|
* @defaultValue 'div'
|
|
@@ -205,8 +206,8 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
|
|
|
205
206
|
"onUpdate:pagination"?: ((value: PaginationState) => any) | undefined;
|
|
206
207
|
}> & import("vue").PublicProps;
|
|
207
208
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
208
|
-
readonly $el:
|
|
209
|
-
tableRef:
|
|
209
|
+
readonly $el: HTMLElement;
|
|
210
|
+
tableRef: Readonly<import("vue").ShallowRef<HTMLTableElement | null>>;
|
|
210
211
|
tableApi: import("@tanstack/table-core").Table<T>;
|
|
211
212
|
}>) => void;
|
|
212
213
|
attrs: any;
|
|
@@ -2,11 +2,12 @@ import type { AppConfig } from '@nuxt/schema';
|
|
|
2
2
|
import theme from '#build/b24ui/textarea';
|
|
3
3
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
4
4
|
import type { BadgeProps } from '../types';
|
|
5
|
+
import type { TextareaHTMLAttributes } from '../types/html';
|
|
5
6
|
import type { ModelModifiers } from '../types/input';
|
|
6
7
|
import type { ComponentConfig } from '../types/tv';
|
|
7
8
|
type Textarea = ComponentConfig<typeof theme, AppConfig, 'textarea'>;
|
|
8
9
|
type TextareaValue = string | number | null;
|
|
9
|
-
export interface TextareaProps<T extends TextareaValue = TextareaValue> extends UseComponentIconsProps {
|
|
10
|
+
export interface TextareaProps<T extends TextareaValue = TextareaValue> extends UseComponentIconsProps, /** @vue-ignore */ Omit<TextareaHTMLAttributes, 'name' | 'placeholder' | 'required' | 'autofocus' | 'disabled' | 'rows'> {
|
|
10
11
|
/**
|
|
11
12
|
* The element or component this component should render as.
|
|
12
13
|
* @defaultValue 'div'
|
|
@@ -36,7 +37,7 @@ export interface TextareaProps<T extends TextareaValue = TextareaValue> extends
|
|
|
36
37
|
*/
|
|
37
38
|
underline?: boolean;
|
|
38
39
|
/**
|
|
39
|
-
* Rounds the corners of the
|
|
40
|
+
* Rounds the corners of the textarea
|
|
40
41
|
* @defaultValue false
|
|
41
42
|
*/
|
|
42
43
|
rounded?: boolean;
|
|
@@ -60,7 +61,7 @@ export interface TextareaProps<T extends TextareaValue = TextareaValue> extends
|
|
|
60
61
|
highlight?: boolean;
|
|
61
62
|
modelValue?: T;
|
|
62
63
|
defaultValue?: T;
|
|
63
|
-
modelModifiers?: ModelModifiers
|
|
64
|
+
modelModifiers?: ModelModifiers<T>;
|
|
64
65
|
class?: any;
|
|
65
66
|
b24ui?: Textarea['slots'];
|
|
66
67
|
}
|
|
@@ -82,16 +83,16 @@ export interface TextareaSlots {
|
|
|
82
83
|
}
|
|
83
84
|
declare const __VLS_export: <T extends TextareaValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
84
85
|
props: __VLS_PrettifyLocal<TextareaProps<T> & {
|
|
85
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
86
86
|
onChange?: ((event: Event) => any) | undefined;
|
|
87
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
87
88
|
"onUpdate:modelValue"?: ((value: T) => any) | undefined;
|
|
88
89
|
}> & import("vue").PublicProps;
|
|
89
90
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
90
|
-
textareaRef: import("vue").
|
|
91
|
+
textareaRef: Readonly<import("vue").ShallowRef<HTMLTextAreaElement | null>>;
|
|
91
92
|
}>) => void;
|
|
92
93
|
attrs: any;
|
|
93
94
|
slots: TextareaSlots;
|
|
94
|
-
emit: ((evt: "
|
|
95
|
+
emit: ((evt: "change", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "update:modelValue", value: T) => void);
|
|
95
96
|
}>) => import("vue").VNode & {
|
|
96
97
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
97
98
|
};
|
|
@@ -3,7 +3,7 @@ import theme from "#build/b24ui/textarea";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import {
|
|
6
|
+
import { useTemplateRef, computed, onMounted, nextTick, watch } from "vue";
|
|
7
7
|
import { Primitive } from "reka-ui";
|
|
8
8
|
import { useVModel } from "@vueuse/core";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
@@ -68,7 +68,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.textare
|
|
|
68
68
|
leading: Boolean(isLeading.value || !!props.avatar || !!slots.leading),
|
|
69
69
|
trailing: Boolean(isTrailing.value || !!slots.trailing)
|
|
70
70
|
}));
|
|
71
|
-
const textareaRef =
|
|
71
|
+
const textareaRef = useTemplateRef("textareaRef");
|
|
72
72
|
function updateInput(value) {
|
|
73
73
|
if (props.modelModifiers?.trim) {
|
|
74
74
|
value = value?.trim() ?? null;
|
|
@@ -2,11 +2,12 @@ import type { AppConfig } from '@nuxt/schema';
|
|
|
2
2
|
import theme from '#build/b24ui/textarea';
|
|
3
3
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
4
4
|
import type { BadgeProps } from '../types';
|
|
5
|
+
import type { TextareaHTMLAttributes } from '../types/html';
|
|
5
6
|
import type { ModelModifiers } from '../types/input';
|
|
6
7
|
import type { ComponentConfig } from '../types/tv';
|
|
7
8
|
type Textarea = ComponentConfig<typeof theme, AppConfig, 'textarea'>;
|
|
8
9
|
type TextareaValue = string | number | null;
|
|
9
|
-
export interface TextareaProps<T extends TextareaValue = TextareaValue> extends UseComponentIconsProps {
|
|
10
|
+
export interface TextareaProps<T extends TextareaValue = TextareaValue> extends UseComponentIconsProps, /** @vue-ignore */ Omit<TextareaHTMLAttributes, 'name' | 'placeholder' | 'required' | 'autofocus' | 'disabled' | 'rows'> {
|
|
10
11
|
/**
|
|
11
12
|
* The element or component this component should render as.
|
|
12
13
|
* @defaultValue 'div'
|
|
@@ -36,7 +37,7 @@ export interface TextareaProps<T extends TextareaValue = TextareaValue> extends
|
|
|
36
37
|
*/
|
|
37
38
|
underline?: boolean;
|
|
38
39
|
/**
|
|
39
|
-
* Rounds the corners of the
|
|
40
|
+
* Rounds the corners of the textarea
|
|
40
41
|
* @defaultValue false
|
|
41
42
|
*/
|
|
42
43
|
rounded?: boolean;
|
|
@@ -60,7 +61,7 @@ export interface TextareaProps<T extends TextareaValue = TextareaValue> extends
|
|
|
60
61
|
highlight?: boolean;
|
|
61
62
|
modelValue?: T;
|
|
62
63
|
defaultValue?: T;
|
|
63
|
-
modelModifiers?: ModelModifiers
|
|
64
|
+
modelModifiers?: ModelModifiers<T>;
|
|
64
65
|
class?: any;
|
|
65
66
|
b24ui?: Textarea['slots'];
|
|
66
67
|
}
|
|
@@ -82,16 +83,16 @@ export interface TextareaSlots {
|
|
|
82
83
|
}
|
|
83
84
|
declare const __VLS_export: <T extends TextareaValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
84
85
|
props: __VLS_PrettifyLocal<TextareaProps<T> & {
|
|
85
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
86
86
|
onChange?: ((event: Event) => any) | undefined;
|
|
87
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
87
88
|
"onUpdate:modelValue"?: ((value: T) => any) | undefined;
|
|
88
89
|
}> & import("vue").PublicProps;
|
|
89
90
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
90
|
-
textareaRef: import("vue").
|
|
91
|
+
textareaRef: Readonly<import("vue").ShallowRef<HTMLTextAreaElement | null>>;
|
|
91
92
|
}>) => void;
|
|
92
93
|
attrs: any;
|
|
93
94
|
slots: TextareaSlots;
|
|
94
|
-
emit: ((evt: "
|
|
95
|
+
emit: ((evt: "change", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "update:modelValue", value: T) => void);
|
|
95
96
|
}>) => import("vue").VNode & {
|
|
96
97
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
97
98
|
};
|
|
@@ -3,7 +3,7 @@ import theme from "#build/b24ui/toast";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { ref, computed, onMounted, nextTick } from "vue";
|
|
6
|
+
import { ref, computed, onMounted, nextTick, useTemplateRef } from "vue";
|
|
7
7
|
import { ToastRoot, ToastTitle, ToastDescription, ToastAction, ToastClose, useForwardPropsEmits } from "reka-ui";
|
|
8
8
|
import { reactivePick } from "@vueuse/core";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
@@ -42,14 +42,14 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.toast |
|
|
|
42
42
|
orientation: props.orientation,
|
|
43
43
|
title: !!props.title || !!slots.title
|
|
44
44
|
}));
|
|
45
|
-
const
|
|
45
|
+
const rootRef = useTemplateRef("rootRef");
|
|
46
46
|
const height = ref(0);
|
|
47
47
|
onMounted(() => {
|
|
48
|
-
if (!
|
|
48
|
+
if (!rootRef.value) {
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
nextTick(() => {
|
|
52
|
-
height.value =
|
|
52
|
+
height.value = rootRef.value?.$el?.getBoundingClientRect()?.height;
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
55
|
defineExpose({
|
|
@@ -59,7 +59,7 @@ defineExpose({
|
|
|
59
59
|
|
|
60
60
|
<template>
|
|
61
61
|
<ToastRoot
|
|
62
|
-
ref="
|
|
62
|
+
ref="rootRef"
|
|
63
63
|
v-slot="{ remaining, duration, open }"
|
|
64
64
|
v-bind="rootProps"
|
|
65
65
|
:data-orientation="orientation"
|
|
@@ -43,8 +43,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Toaste
|
|
|
43
43
|
progress: boolean;
|
|
44
44
|
duration: number;
|
|
45
45
|
position: Toaster["variants"]["position"];
|
|
46
|
-
expand: boolean;
|
|
47
46
|
max: number;
|
|
47
|
+
expand: boolean;
|
|
48
48
|
portal: boolean | string | HTMLElement;
|
|
49
49
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ToasterSlots>;
|
|
50
50
|
declare const _default: typeof __VLS_export;
|
|
@@ -43,8 +43,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Toaste
|
|
|
43
43
|
progress: boolean;
|
|
44
44
|
duration: number;
|
|
45
45
|
position: Toaster["variants"]["position"];
|
|
46
|
-
expand: boolean;
|
|
47
46
|
max: number;
|
|
47
|
+
expand: boolean;
|
|
48
48
|
portal: boolean | string | HTMLElement;
|
|
49
49
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ToasterSlots>;
|
|
50
50
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AvatarProps } from '
|
|
2
|
-
export interface ColorModeAvatarProps extends
|
|
1
|
+
import type { AvatarProps } from '../../types';
|
|
2
|
+
export interface ColorModeAvatarProps extends Omit<AvatarProps, 'src'> {
|
|
3
3
|
light: string;
|
|
4
4
|
dark: string;
|
|
5
5
|
}
|
|
6
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<ColorModeAvatarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeAvatarProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -3,15 +3,27 @@
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
+
import { useForwardProps } from "reka-ui";
|
|
7
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
6
8
|
import B24Avatar from "../Avatar.vue";
|
|
7
9
|
defineOptions({ inheritAttrs: false });
|
|
8
|
-
defineProps({
|
|
10
|
+
const props = defineProps({
|
|
9
11
|
light: { type: String, required: true },
|
|
10
|
-
dark: { type: String, required: true }
|
|
12
|
+
dark: { type: String, required: true },
|
|
13
|
+
as: { type: null, required: false },
|
|
14
|
+
alt: { type: String, required: false },
|
|
15
|
+
icon: { type: [Function, Object], required: false },
|
|
16
|
+
text: { type: String, required: false },
|
|
17
|
+
size: { type: null, required: false },
|
|
18
|
+
chip: { type: [Boolean, Object], required: false },
|
|
19
|
+
class: { type: null, required: false },
|
|
20
|
+
style: { type: null, required: false },
|
|
21
|
+
b24ui: { type: null, required: false }
|
|
11
22
|
});
|
|
23
|
+
const avatarProps = useForwardProps(reactiveOmit(props, "light", "dark"));
|
|
12
24
|
</script>
|
|
13
25
|
|
|
14
26
|
<template>
|
|
15
|
-
<B24Avatar :src="light" class="dark:hidden"
|
|
16
|
-
<B24Avatar :src="dark" class="hidden dark:block"
|
|
27
|
+
<B24Avatar v-bind="{ ...avatarProps, ...$attrs }" :src="light" class="dark:hidden" />
|
|
28
|
+
<B24Avatar v-bind="{ ...avatarProps, ...$attrs }" :src="dark" class="hidden dark:block" />
|
|
17
29
|
</template>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AvatarProps } from '
|
|
2
|
-
export interface ColorModeAvatarProps extends
|
|
1
|
+
import type { AvatarProps } from '../../types';
|
|
2
|
+
export interface ColorModeAvatarProps extends Omit<AvatarProps, 'src'> {
|
|
3
3
|
light: string;
|
|
4
4
|
dark: string;
|
|
5
5
|
}
|
|
6
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<ColorModeAvatarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeAvatarProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ButtonProps } from '
|
|
2
|
-
export interface ColorModeButtonProps extends
|
|
1
|
+
import type { ButtonProps } from '../../types';
|
|
2
|
+
export interface ColorModeButtonProps extends Omit<ButtonProps, 'color'> {
|
|
3
3
|
/**
|
|
4
4
|
* @defaultValue 'air-tertiary-no-accent'
|
|
5
5
|
*/
|
|
6
6
|
color?: ButtonProps['color'];
|
|
7
7
|
}
|
|
8
8
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorModeButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeButtonProps> & Readonly<{}>, {
|
|
9
|
-
color:
|
|
9
|
+
color: "default" | "link" | "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "air-secondary" | "air-secondary-accent" | "air-secondary-accent-1" | "air-tertiary" | "danger" | "success" | "warning" | "primary" | "secondary" | "collab" | "ai" | "air-secondary-alert" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost";
|
|
10
10
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
11
11
|
fallback(props?: {}): any;
|
|
12
12
|
}>;
|
|
@@ -4,17 +4,63 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed } from "vue";
|
|
7
|
+
import { useForwardProps } from "reka-ui";
|
|
8
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
7
9
|
import { useColorMode } from "#imports";
|
|
8
10
|
import { useLocale } from "../../composables/useLocale";
|
|
9
11
|
import icons from "../../dictionary/icons";
|
|
10
12
|
import B24Button from "../Button.vue";
|
|
11
13
|
defineOptions({ inheritAttrs: false });
|
|
12
|
-
defineProps({
|
|
13
|
-
color: { type: null, required: false, default: "air-tertiary-no-accent" }
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
color: { type: null, required: false, default: "air-tertiary-no-accent" },
|
|
16
|
+
label: { type: String, required: false },
|
|
17
|
+
activeColor: { type: null, required: false },
|
|
18
|
+
depth: { type: null, required: false },
|
|
19
|
+
activeDepth: { type: null, required: false },
|
|
20
|
+
size: { type: null, required: false },
|
|
21
|
+
rounded: { type: Boolean, required: false },
|
|
22
|
+
block: { type: Boolean, required: false },
|
|
23
|
+
loadingAuto: { type: Boolean, required: false },
|
|
24
|
+
normalCase: { type: Boolean, required: false },
|
|
25
|
+
useWait: { type: Boolean, required: false },
|
|
26
|
+
useClock: { type: Boolean, required: false },
|
|
27
|
+
useDropdown: { type: Boolean, required: false },
|
|
28
|
+
onClick: { type: [Function, Array], required: false },
|
|
29
|
+
class: { type: null, required: false },
|
|
30
|
+
activeClass: { type: String, required: false },
|
|
31
|
+
inactiveClass: { type: String, required: false },
|
|
32
|
+
b24ui: { type: null, required: false },
|
|
33
|
+
icon: { type: [Function, Object], required: false },
|
|
34
|
+
avatar: { type: Object, required: false },
|
|
35
|
+
loading: { type: Boolean, required: false },
|
|
36
|
+
as: { type: null, required: false },
|
|
37
|
+
type: { type: null, required: false },
|
|
38
|
+
disabled: { type: Boolean, required: false },
|
|
39
|
+
active: { type: Boolean, required: false },
|
|
40
|
+
exact: { type: Boolean, required: false },
|
|
41
|
+
exactQuery: { type: [Boolean, String], required: false },
|
|
42
|
+
exactHash: { type: Boolean, required: false },
|
|
43
|
+
isAction: { type: Boolean, required: false },
|
|
44
|
+
to: { type: null, required: false },
|
|
45
|
+
href: { type: null, required: false },
|
|
46
|
+
external: { type: Boolean, required: false },
|
|
47
|
+
target: { type: [String, Object, null], required: false },
|
|
48
|
+
rel: { type: [String, Object, null], required: false },
|
|
49
|
+
noRel: { type: Boolean, required: false },
|
|
50
|
+
prefetchedClass: { type: String, required: false },
|
|
51
|
+
prefetch: { type: Boolean, required: false },
|
|
52
|
+
prefetchOn: { type: [String, Object], required: false },
|
|
53
|
+
noPrefetch: { type: Boolean, required: false },
|
|
54
|
+
trailingSlash: { type: String, required: false },
|
|
55
|
+
exactActiveClass: { type: String, required: false },
|
|
56
|
+
ariaCurrentValue: { type: String, required: false },
|
|
57
|
+
viewTransition: { type: Boolean, required: false },
|
|
58
|
+
replace: { type: Boolean, required: false }
|
|
14
59
|
});
|
|
15
60
|
defineSlots();
|
|
16
61
|
const { t } = useLocale();
|
|
17
62
|
const colorMode = useColorMode();
|
|
63
|
+
const buttonProps = useForwardProps(reactiveOmit(props, "icon"));
|
|
18
64
|
const isDark = computed({
|
|
19
65
|
get() {
|
|
20
66
|
return colorMode.value === "dark";
|
|
@@ -28,10 +74,12 @@ const isDark = computed({
|
|
|
28
74
|
<template>
|
|
29
75
|
<ClientOnly v-if="!colorMode?.forced">
|
|
30
76
|
<B24Button
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
77
|
+
v-bind="{
|
|
78
|
+
...buttonProps,
|
|
79
|
+
'icon': props.icon || (isDark ? icons.dark : icons.light),
|
|
80
|
+
'aria-label': isDark ? t('colorMode.switchToLight') : t('colorMode.switchToDark'),
|
|
81
|
+
...$attrs
|
|
82
|
+
}"
|
|
35
83
|
@click="isDark = !isDark"
|
|
36
84
|
/>
|
|
37
85
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ButtonProps } from '
|
|
2
|
-
export interface ColorModeButtonProps extends
|
|
1
|
+
import type { ButtonProps } from '../../types';
|
|
2
|
+
export interface ColorModeButtonProps extends Omit<ButtonProps, 'color'> {
|
|
3
3
|
/**
|
|
4
4
|
* @defaultValue 'air-tertiary-no-accent'
|
|
5
5
|
*/
|
|
6
6
|
color?: ButtonProps['color'];
|
|
7
7
|
}
|
|
8
8
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorModeButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeButtonProps> & Readonly<{}>, {
|
|
9
|
-
color:
|
|
9
|
+
color: "default" | "link" | "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "air-secondary" | "air-secondary-accent" | "air-secondary-accent-1" | "air-tertiary" | "danger" | "success" | "warning" | "primary" | "secondary" | "collab" | "ai" | "air-secondary-alert" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost";
|
|
10
10
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
11
11
|
fallback(props?: {}): any;
|
|
12
12
|
}>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
type
|
|
1
|
+
import type { ImgHTMLAttributes } from '../../types/html';
|
|
2
|
+
export interface ColorModeImageProps extends /** @vue-ignore */ Omit<ImgHTMLAttributes, 'src'> {
|
|
2
3
|
dark: string;
|
|
3
4
|
light: string;
|
|
4
|
-
}
|
|
5
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
5
|
+
}
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<ColorModeImageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeImageProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
7
|
declare const _default: typeof __VLS_export;
|
|
7
8
|
export default _default;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
type
|
|
1
|
+
import type { ImgHTMLAttributes } from '../../types/html';
|
|
2
|
+
export interface ColorModeImageProps extends /** @vue-ignore */ Omit<ImgHTMLAttributes, 'src'> {
|
|
2
3
|
dark: string;
|
|
3
4
|
light: string;
|
|
4
|
-
}
|
|
5
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
5
|
+
}
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<ColorModeImageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeImageProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
7
|
declare const _default: typeof __VLS_export;
|
|
7
8
|
export default _default;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { SelectMenuProps } from '
|
|
2
|
-
export interface ColorModeSelectProps extends
|
|
1
|
+
import type { SelectMenuProps, SelectMenuItem } from '../../types';
|
|
2
|
+
export interface ColorModeSelectProps extends Omit<SelectMenuProps<SelectMenuItem[]>, 'icon' | 'items' | 'modelValue'> {
|
|
3
3
|
}
|
|
4
|
-
declare const __VLS_export: import("vue").DefineComponent<ColorModeSelectProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeSelectProps> & Readonly<{}>, {
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<ColorModeSelectProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeSelectProps> & Readonly<{}>, {
|
|
5
|
+
searchInput: boolean | import("../Input.vue").InputProps;
|
|
6
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
7
|
declare const _default: typeof __VLS_export;
|
|
6
8
|
export default _default;
|
|
@@ -4,14 +4,58 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed } from "vue";
|
|
7
|
+
import { useForwardProps } from "reka-ui";
|
|
7
8
|
import { useColorMode } from "#imports";
|
|
8
9
|
import { useLocale } from "../../composables/useLocale";
|
|
9
10
|
import icons from "../../dictionary/icons";
|
|
10
11
|
import B24SelectMenu from "../SelectMenu.vue";
|
|
11
12
|
defineOptions({ inheritAttrs: false });
|
|
12
|
-
defineProps({
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
id: { type: String, required: false },
|
|
15
|
+
placeholder: { type: String, required: false },
|
|
16
|
+
searchInput: { type: [Boolean, Object], required: false, default: false },
|
|
17
|
+
color: { type: null, required: false },
|
|
18
|
+
size: { type: null, required: false },
|
|
19
|
+
noPadding: { type: Boolean, required: false },
|
|
20
|
+
noBorder: { type: Boolean, required: false },
|
|
21
|
+
underline: { type: Boolean, required: false },
|
|
22
|
+
rounded: { type: Boolean, required: false },
|
|
23
|
+
tag: { type: String, required: false },
|
|
24
|
+
tagColor: { type: null, required: false },
|
|
25
|
+
required: { type: Boolean, required: false },
|
|
26
|
+
trailingIcon: { type: [Function, Object], required: false },
|
|
27
|
+
selectedIcon: { type: [Function, Object], required: false },
|
|
28
|
+
content: { type: Object, required: false },
|
|
29
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
30
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true },
|
|
31
|
+
virtualize: { type: [Boolean, Object], required: false },
|
|
32
|
+
valueKey: { type: null, required: false },
|
|
33
|
+
labelKey: { type: null, required: false },
|
|
34
|
+
descriptionKey: { type: null, required: false },
|
|
35
|
+
defaultValue: { type: null, required: false },
|
|
36
|
+
multiple: { type: Boolean, required: false },
|
|
37
|
+
highlight: { type: Boolean, required: false },
|
|
38
|
+
createItem: { type: [Boolean, String, Object], required: false },
|
|
39
|
+
filterFields: { type: Array, required: false },
|
|
40
|
+
ignoreFilter: { type: Boolean, required: false },
|
|
41
|
+
autofocus: { type: Boolean, required: false },
|
|
42
|
+
autofocusDelay: { type: Number, required: false },
|
|
43
|
+
class: { type: null, required: false },
|
|
44
|
+
b24ui: { type: null, required: false },
|
|
45
|
+
open: { type: Boolean, required: false },
|
|
46
|
+
defaultOpen: { type: Boolean, required: false },
|
|
47
|
+
disabled: { type: Boolean, required: false },
|
|
48
|
+
name: { type: String, required: false },
|
|
49
|
+
resetSearchTermOnBlur: { type: Boolean, required: false },
|
|
50
|
+
resetSearchTermOnSelect: { type: Boolean, required: false },
|
|
51
|
+
highlightOnHover: { type: Boolean, required: false },
|
|
52
|
+
avatar: { type: Object, required: false },
|
|
53
|
+
loading: { type: Boolean, required: false },
|
|
54
|
+
trailing: { type: Boolean, required: false }
|
|
55
|
+
});
|
|
13
56
|
const { t } = useLocale();
|
|
14
57
|
const colorMode = useColorMode();
|
|
58
|
+
const selectMenuProps = useForwardProps(props);
|
|
15
59
|
const items = computed(() => [
|
|
16
60
|
{ label: t("colorMode.system"), value: "system", icon: icons.system },
|
|
17
61
|
{ label: t("colorMode.light"), value: "light", icon: icons.light },
|
|
@@ -31,18 +75,16 @@ const preference = computed({
|
|
|
31
75
|
<ClientOnly v-if="!colorMode?.forced">
|
|
32
76
|
<B24SelectMenu
|
|
33
77
|
v-model="preference"
|
|
34
|
-
:search-input="false"
|
|
35
78
|
:icon="preference?.icon"
|
|
36
|
-
v-bind="
|
|
79
|
+
v-bind="{ ...selectMenuProps, ...$attrs }"
|
|
37
80
|
:items="items"
|
|
38
81
|
/>
|
|
39
82
|
|
|
40
83
|
<template #fallback>
|
|
41
84
|
<B24SelectMenu
|
|
42
|
-
:search-input="false"
|
|
43
85
|
:icon="items[0]?.icon"
|
|
44
|
-
v-bind="$attrs"
|
|
45
86
|
:model-value="items[0]"
|
|
87
|
+
v-bind="{ ...selectMenuProps, ...$attrs }"
|
|
46
88
|
:items="items"
|
|
47
89
|
disabled
|
|
48
90
|
/>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { SelectMenuProps } from '
|
|
2
|
-
export interface ColorModeSelectProps extends
|
|
1
|
+
import type { SelectMenuProps, SelectMenuItem } from '../../types';
|
|
2
|
+
export interface ColorModeSelectProps extends Omit<SelectMenuProps<SelectMenuItem[]>, 'icon' | 'items' | 'modelValue'> {
|
|
3
3
|
}
|
|
4
|
-
declare const __VLS_export: import("vue").DefineComponent<ColorModeSelectProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeSelectProps> & Readonly<{}>, {
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<ColorModeSelectProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeSelectProps> & Readonly<{}>, {
|
|
5
|
+
searchInput: boolean | import("../Input.vue").InputProps;
|
|
6
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
7
|
declare const _default: typeof __VLS_export;
|
|
6
8
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SwitchProps } from '
|
|
2
|
-
export interface ColorModeSwitchProps extends
|
|
1
|
+
import type { SwitchProps } from '../../types';
|
|
2
|
+
export interface ColorModeSwitchProps extends Omit<SwitchProps, 'checkedIcon' | 'uncheckedIcon' | 'modelValue'> {
|
|
3
3
|
}
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<ColorModeSwitchProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeSwitchProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
5
|
declare const _default: typeof __VLS_export;
|
|
@@ -4,14 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed } from "vue";
|
|
7
|
+
import { useForwardProps } from "reka-ui";
|
|
7
8
|
import { useColorMode } from "#imports";
|
|
8
9
|
import { useLocale } from "../../composables/useLocale";
|
|
9
10
|
import icons from "../../dictionary/icons";
|
|
10
11
|
import B24Switch from "../Switch.vue";
|
|
11
12
|
defineOptions({ inheritAttrs: false });
|
|
12
|
-
defineProps({
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
as: { type: null, required: false },
|
|
15
|
+
color: { type: null, required: false },
|
|
16
|
+
size: { type: null, required: false },
|
|
17
|
+
loading: { type: Boolean, required: false },
|
|
18
|
+
loadingIcon: { type: [Function, Object], required: false },
|
|
19
|
+
label: { type: String, required: false },
|
|
20
|
+
description: { type: String, required: false },
|
|
21
|
+
class: { type: null, required: false },
|
|
22
|
+
b24ui: { type: null, required: false },
|
|
23
|
+
disabled: { type: Boolean, required: false },
|
|
24
|
+
id: { type: String, required: false },
|
|
25
|
+
name: { type: String, required: false },
|
|
26
|
+
required: { type: Boolean, required: false },
|
|
27
|
+
value: { type: String, required: false },
|
|
28
|
+
defaultValue: { type: Boolean, required: false }
|
|
29
|
+
});
|
|
13
30
|
const { t } = useLocale();
|
|
14
31
|
const colorMode = useColorMode();
|
|
32
|
+
const switchProps = useForwardProps(props);
|
|
15
33
|
const isDark = computed({
|
|
16
34
|
get() {
|
|
17
35
|
return colorMode.value === "dark";
|
|
@@ -28,16 +46,22 @@ const isDark = computed({
|
|
|
28
46
|
v-model="isDark"
|
|
29
47
|
:checked-icon="icons.dark"
|
|
30
48
|
:unchecked-icon="icons.light"
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
v-bind="{
|
|
50
|
+
...switchProps,
|
|
51
|
+
'aria-label': isDark ? t('colorMode.switchToLight') : t('colorMode.switchToDark'),
|
|
52
|
+
...$attrs
|
|
53
|
+
}"
|
|
33
54
|
/>
|
|
34
55
|
|
|
35
56
|
<template #fallback>
|
|
36
57
|
<B24Switch
|
|
37
58
|
:checked-icon="icons.dark"
|
|
38
59
|
:unchecked-icon="icons.light"
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
v-bind="{
|
|
61
|
+
...switchProps,
|
|
62
|
+
'aria-label': isDark ? t('colorMode.switchToLight') : t('colorMode.switchToDark'),
|
|
63
|
+
...$attrs
|
|
64
|
+
}"
|
|
41
65
|
disabled
|
|
42
66
|
/>
|
|
43
67
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SwitchProps } from '
|
|
2
|
-
export interface ColorModeSwitchProps extends
|
|
1
|
+
import type { SwitchProps } from '../../types';
|
|
2
|
+
export interface ColorModeSwitchProps extends Omit<SwitchProps, 'checkedIcon' | 'uncheckedIcon' | 'modelValue'> {
|
|
3
3
|
}
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<ColorModeSwitchProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeSwitchProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
5
|
declare const _default: typeof __VLS_export;
|