@bitrix24/b24ui-nuxt 0.6.7 → 0.7.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/.nuxt/b24ui/accordion.ts +20 -0
- package/.nuxt/b24ui/advice.ts +2 -10
- package/.nuxt/b24ui/alert.ts +2 -15
- package/.nuxt/b24ui/avatar-group.ts +2 -10
- package/.nuxt/b24ui/avatar.ts +3 -11
- package/.nuxt/b24ui/badge.ts +48 -13
- package/.nuxt/b24ui/button-group.ts +2 -22
- package/.nuxt/b24ui/button.ts +4 -17
- package/.nuxt/b24ui/calendar.ts +3 -11
- package/.nuxt/b24ui/checkbox.ts +75 -11
- package/.nuxt/b24ui/chip.ts +2 -10
- package/.nuxt/b24ui/collapsible.ts +2 -10
- package/.nuxt/b24ui/container.ts +2 -10
- package/.nuxt/b24ui/countdown.ts +2 -10
- package/.nuxt/b24ui/description-list.ts +2 -15
- package/.nuxt/b24ui/dropdown-menu.ts +4 -11
- package/.nuxt/b24ui/form-field.ts +3 -10
- package/.nuxt/b24ui/form.ts +2 -10
- package/.nuxt/b24ui/index.ts +1 -0
- package/.nuxt/b24ui/input-menu.ts +6 -30
- package/.nuxt/b24ui/input-number.ts +15 -10
- package/.nuxt/b24ui/input.ts +4 -17
- package/.nuxt/b24ui/kbd.ts +2 -10
- package/.nuxt/b24ui/link.ts +11 -17
- package/.nuxt/b24ui/modal.ts +3 -11
- package/.nuxt/b24ui/navbar-divider.ts +2 -10
- package/.nuxt/b24ui/navbar-section.ts +2 -10
- package/.nuxt/b24ui/navbar-spacer.ts +2 -10
- package/.nuxt/b24ui/navbar.ts +2 -10
- package/.nuxt/b24ui/navigation-menu.ts +69 -60
- package/.nuxt/b24ui/popover.ts +2 -10
- package/.nuxt/b24ui/progress.ts +2 -10
- package/.nuxt/b24ui/radio-group.ts +3 -11
- package/.nuxt/b24ui/range.ts +2 -10
- package/.nuxt/b24ui/select-menu.ts +10 -40
- package/.nuxt/b24ui/select.ts +10 -40
- package/.nuxt/b24ui/separator.ts +2 -10
- package/.nuxt/b24ui/sidebar-body.ts +2 -10
- package/.nuxt/b24ui/sidebar-footer.ts +2 -10
- package/.nuxt/b24ui/sidebar-header.ts +2 -10
- package/.nuxt/b24ui/sidebar-heading.ts +2 -10
- package/.nuxt/b24ui/sidebar-layout.ts +2 -10
- package/.nuxt/b24ui/sidebar-section.ts +2 -10
- package/.nuxt/b24ui/sidebar-spacer.ts +2 -10
- package/.nuxt/b24ui/sidebar.ts +2 -10
- package/.nuxt/b24ui/skeleton.ts +2 -10
- package/.nuxt/b24ui/slideover.ts +2 -10
- package/.nuxt/b24ui/stacked-layout.ts +2 -10
- package/.nuxt/b24ui/switch.ts +2 -10
- package/.nuxt/b24ui/tabs.ts +6 -13
- package/.nuxt/b24ui/textarea.ts +4 -17
- package/.nuxt/b24ui/toast.ts +2 -15
- package/.nuxt/b24ui/toaster.ts +3 -11
- package/.nuxt/b24ui/tooltip.ts +3 -11
- package/.nuxt/b24ui.css +1 -1
- package/cli/templates.mjs +2 -2
- package/dist/meta.d.mts +38368 -18666
- package/dist/meta.mjs +38368 -18666
- package/dist/module.json +1 -1
- package/dist/module.mjs +11 -3
- package/dist/runtime/components/Accordion.vue +96 -0
- package/dist/runtime/components/Accordion.vue.d.ts +78 -0
- package/dist/runtime/components/Advice.vue +1 -1
- package/dist/runtime/components/Alert.vue +1 -1
- package/dist/runtime/components/Avatar.vue +11 -3
- package/dist/runtime/components/Avatar.vue.d.ts +2 -1
- package/dist/runtime/components/AvatarGroup.vue +1 -1
- package/dist/runtime/components/Badge.vue +5 -3
- package/dist/runtime/components/Badge.vue.d.ts +2 -0
- package/dist/runtime/components/Button.vue +2 -3
- package/dist/runtime/components/Button.vue.d.ts +1 -1
- package/dist/runtime/components/Calendar.vue +6 -2
- package/dist/runtime/components/Checkbox.vue +14 -5
- package/dist/runtime/components/Checkbox.vue.d.ts +9 -0
- package/dist/runtime/components/Chip.vue +1 -1
- package/dist/runtime/components/Collapsible.vue +1 -1
- package/dist/runtime/components/Countdown.vue +1 -1
- package/dist/runtime/components/Countdown.vue.d.ts +2 -2
- package/dist/runtime/components/DescriptionList.vue +3 -2
- package/dist/runtime/components/DescriptionList.vue.d.ts +1 -1
- package/dist/runtime/components/DropdownMenu.vue +1 -1
- package/dist/runtime/components/DropdownMenu.vue.d.ts +2 -0
- package/dist/runtime/components/DropdownMenuContent.vue +74 -72
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +4 -20
- package/dist/runtime/components/Form.vue +6 -6
- package/dist/runtime/components/Form.vue.d.ts +12 -11
- package/dist/runtime/components/FormField.vue +4 -4
- package/dist/runtime/components/Input.vue +12 -8
- package/dist/runtime/components/Input.vue.d.ts +31 -30
- package/dist/runtime/components/InputMenu.vue +23 -20
- package/dist/runtime/components/InputMenu.vue.d.ts +214 -4
- package/dist/runtime/components/InputNumber.vue +17 -10
- package/dist/runtime/components/InputNumber.vue.d.ts +80 -3
- package/dist/runtime/components/Link.vue +5 -13
- package/dist/runtime/components/Modal.vue +22 -14
- package/dist/runtime/components/Modal.vue.d.ts +18 -5
- package/dist/runtime/components/Navbar.vue +1 -1
- package/dist/runtime/components/NavbarDivider.vue +1 -1
- package/dist/runtime/components/NavbarSection.vue +1 -1
- package/dist/runtime/components/NavbarSpacer.vue +1 -1
- package/dist/runtime/components/NavigationMenu.vue +186 -44
- package/dist/runtime/components/NavigationMenu.vue.d.ts +39 -8
- package/dist/runtime/components/OverlayProvider.vue +2 -2
- package/dist/runtime/components/Popover.vue +4 -0
- package/dist/runtime/components/Popover.vue.d.ts +2 -1
- package/dist/runtime/components/Progress.vue +3 -2
- package/dist/runtime/components/Progress.vue.d.ts +2 -2
- package/dist/runtime/components/RadioGroup.vue +26 -10
- package/dist/runtime/components/RadioGroup.vue.d.ts +3 -1
- package/dist/runtime/components/Range.vue +2 -2
- package/dist/runtime/components/Range.vue.d.ts +19 -20
- package/dist/runtime/components/Select.vue +57 -31
- package/dist/runtime/components/Select.vue.d.ts +110 -2
- package/dist/runtime/components/SelectMenu.vue +77 -23
- package/dist/runtime/components/SelectMenu.vue.d.ts +111 -5
- package/dist/runtime/components/Separator.vue +3 -3
- package/dist/runtime/components/Sidebar.vue +1 -1
- package/dist/runtime/components/SidebarBody.vue +1 -1
- package/dist/runtime/components/SidebarFooter.vue +1 -1
- package/dist/runtime/components/SidebarHeader.vue +1 -1
- package/dist/runtime/components/SidebarHeading.vue +1 -1
- package/dist/runtime/components/SidebarLayout.vue +1 -1
- package/dist/runtime/components/SidebarSection.vue +1 -1
- package/dist/runtime/components/SidebarSpacer.vue +1 -1
- package/dist/runtime/components/Slideover.vue +23 -15
- package/dist/runtime/components/Slideover.vue.d.ts +18 -5
- package/dist/runtime/components/StackedLayout.vue +1 -1
- package/dist/runtime/components/Switch.vue +1 -1
- package/dist/runtime/components/Tabs.vue +28 -7
- package/dist/runtime/components/Tabs.vue.d.ts +6 -1
- package/dist/runtime/components/Textarea.vue +13 -9
- package/dist/runtime/components/Textarea.vue.d.ts +31 -30
- package/dist/runtime/components/Toast.vue +7 -6
- package/dist/runtime/components/Toast.vue.d.ts +6 -0
- package/dist/runtime/components/Toaster.vue +4 -4
- package/dist/runtime/components/Toaster.vue.d.ts +6 -0
- package/dist/runtime/components/Tooltip.vue +9 -2
- package/dist/runtime/components/Tooltip.vue.d.ts +2 -1
- package/dist/runtime/components/content/TableWrapper.vue +1 -1
- package/dist/runtime/composables/defineLocale.d.ts +2 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.js +8 -2
- package/dist/runtime/composables/useFormField.d.ts +1 -1
- package/dist/runtime/composables/useFormField.js +2 -1
- package/dist/runtime/composables/useKbd.d.ts +1 -0
- package/dist/runtime/composables/useKbd.js +4 -3
- package/dist/runtime/composables/useOverlay.d.ts +11 -11
- package/dist/runtime/composables/useOverlay.js +17 -11
- package/dist/runtime/inertia/components/Link.vue +45 -60
- package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
- package/dist/runtime/inertia/components/LinkBase.vue +68 -0
- package/dist/runtime/inertia/components/LinkBase.vue.d.ts +25 -0
- package/dist/runtime/inertia/stubs.d.ts +1 -1
- package/dist/runtime/inertia/stubs.js +1 -1
- package/dist/runtime/prose/A.vue +1 -1
- package/dist/runtime/prose/Blockquote.vue +1 -1
- package/dist/runtime/prose/Code.vue +1 -1
- package/dist/runtime/prose/Em.vue +1 -1
- package/dist/runtime/prose/H1.vue +1 -1
- package/dist/runtime/prose/H2.vue +1 -1
- package/dist/runtime/prose/H3.vue +1 -1
- package/dist/runtime/prose/H4.vue +1 -1
- package/dist/runtime/prose/H5.vue +1 -1
- package/dist/runtime/prose/H6.vue +1 -1
- package/dist/runtime/prose/Hr.vue +1 -1
- package/dist/runtime/prose/Img.vue +1 -1
- package/dist/runtime/prose/Li.vue +1 -1
- package/dist/runtime/prose/Ol.vue +1 -1
- package/dist/runtime/prose/P.vue +1 -1
- package/dist/runtime/prose/Pre.vue +1 -1
- package/dist/runtime/prose/Strong.vue +1 -1
- package/dist/runtime/prose/Table.vue +1 -1
- package/dist/runtime/prose/Tbody.vue +1 -1
- package/dist/runtime/prose/Td.vue +1 -1
- package/dist/runtime/prose/Th.vue +1 -1
- package/dist/runtime/prose/Thead.vue +1 -1
- package/dist/runtime/prose/Tr.vue +1 -1
- package/dist/runtime/prose/Ul.vue +1 -1
- package/dist/runtime/types/form.d.ts +11 -10
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/locale.d.ts +1 -0
- package/dist/runtime/types/tv.d.ts +53 -0
- package/dist/runtime/types/tv.js +0 -0
- package/dist/runtime/types/utils.d.ts +4 -51
- package/dist/runtime/types/utils.js +1 -0
- package/dist/runtime/utils/link.d.ts +1 -0
- package/dist/runtime/utils/link.js +12 -0
- package/dist/runtime/vue/components/Link.vue +26 -40
- package/dist/runtime/vue/composables/useAppConfig.js +3 -1
- package/dist/runtime/vue/stubs.d.ts +1 -1
- package/dist/runtime/vue/stubs.js +1 -1
- package/dist/shared/{b24ui-nuxt.jU270f-Q.mjs → b24ui-nuxt.C-kZb5Ac.mjs} +267 -121
- package/dist/unplugin.d.mts +2 -2
- package/dist/unplugin.mjs +6 -3
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +41 -40
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ref, computed, toValue } from "vue";
|
|
2
2
|
import { useEventListener, useActiveElement, useDebounceFn } from "@vueuse/core";
|
|
3
|
+
import { useKbd } from "./useKbd.js";
|
|
3
4
|
const chainedShortcutRegex = /^[^-]+.*-.*[^-]+$/;
|
|
4
5
|
const combinedShortcutRegex = /^[^_]+.*_.*[^_]+$/;
|
|
5
6
|
export function extractShortcuts(items) {
|
|
@@ -27,6 +28,7 @@ export function defineShortcuts(config, options = {}) {
|
|
|
27
28
|
chainedInputs.value.splice(0, chainedInputs.value.length);
|
|
28
29
|
};
|
|
29
30
|
const debouncedClearChainedInput = useDebounceFn(clearChainedInput, options.chainDelay ?? 800);
|
|
31
|
+
const { macOS } = useKbd();
|
|
30
32
|
const activeElement = useActiveElement();
|
|
31
33
|
const onKeyDown = (e) => {
|
|
32
34
|
if (!e.key) {
|
|
@@ -86,13 +88,13 @@ export function defineShortcuts(config, options = {}) {
|
|
|
86
88
|
return null;
|
|
87
89
|
}
|
|
88
90
|
let shortcut;
|
|
89
|
-
if (key.includes("-") && key !== "-" && !key.match(chainedShortcutRegex)?.length) {
|
|
91
|
+
if (key.includes("-") && key !== "-" && !key.includes("_") && !key.match(chainedShortcutRegex)?.length) {
|
|
90
92
|
console.trace(`[Shortcut] Invalid key: "${key}"`);
|
|
91
93
|
}
|
|
92
94
|
if (key.includes("_") && key !== "_" && !key.match(combinedShortcutRegex)?.length) {
|
|
93
95
|
console.trace(`[Shortcut] Invalid key: "${key}"`);
|
|
94
96
|
}
|
|
95
|
-
const chained = key.includes("-") && key !== "-";
|
|
97
|
+
const chained = key.includes("-") && key !== "-" && !key.includes("_");
|
|
96
98
|
if (chained) {
|
|
97
99
|
shortcut = {
|
|
98
100
|
key: key.toLowerCase(),
|
|
@@ -112,6 +114,10 @@ export function defineShortcuts(config, options = {}) {
|
|
|
112
114
|
};
|
|
113
115
|
}
|
|
114
116
|
shortcut.chained = chained;
|
|
117
|
+
if (!macOS.value && shortcut.metaKey && !shortcut.ctrlKey) {
|
|
118
|
+
shortcut.metaKey = false;
|
|
119
|
+
shortcut.ctrlKey = true;
|
|
120
|
+
}
|
|
115
121
|
if (typeof shortcutConfig === "function") {
|
|
116
122
|
shortcut.handler = shortcutConfig;
|
|
117
123
|
} else if (typeof shortcutConfig === "object") {
|
|
@@ -13,7 +13,7 @@ type Props<T> = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare const formOptionsInjectionKey: InjectionKey<ComputedRef<FormInjectedOptions>>;
|
|
15
15
|
export declare const formBusInjectionKey: InjectionKey<UseEventBusReturn<FormEvent<any>, string>>;
|
|
16
|
-
export declare const formFieldInjectionKey: InjectionKey<ComputedRef<FormFieldInjectedOptions<FormFieldProps
|
|
16
|
+
export declare const formFieldInjectionKey: InjectionKey<ComputedRef<FormFieldInjectedOptions<FormFieldProps>> | undefined>;
|
|
17
17
|
export declare const inputIdInjectionKey: InjectionKey<Ref<string | undefined>>;
|
|
18
18
|
export declare const formInputsInjectionKey: InjectionKey<Ref<Record<string, {
|
|
19
19
|
id?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject, computed } from "vue";
|
|
1
|
+
import { inject, computed, provide } from "vue";
|
|
2
2
|
import { useDebounceFn } from "@vueuse/core";
|
|
3
3
|
export const formOptionsInjectionKey = Symbol("bitrix24-ui.form-options");
|
|
4
4
|
export const formBusInjectionKey = Symbol("bitrix24-ui.form-events");
|
|
@@ -12,6 +12,7 @@ export function useFormField(props, opts) {
|
|
|
12
12
|
const formField = inject(formFieldInjectionKey, void 0);
|
|
13
13
|
const formInputs = inject(formInputsInjectionKey, void 0);
|
|
14
14
|
const inputId = inject(inputIdInjectionKey, void 0);
|
|
15
|
+
provide(formFieldInjectionKey, void 0);
|
|
15
16
|
if (formField && inputId) {
|
|
16
17
|
if (opts?.bind === false) {
|
|
17
18
|
inputId.value = void 0;
|
|
@@ -7,6 +7,7 @@ export const kbdKeysMap = {
|
|
|
7
7
|
win: "\u229E",
|
|
8
8
|
command: "\u2318",
|
|
9
9
|
shift: "\u21E7",
|
|
10
|
+
control: "\u2303",
|
|
10
11
|
option: "\u2325",
|
|
11
12
|
enter: "\u21B5",
|
|
12
13
|
delete: "\u2326",
|
|
@@ -31,9 +32,9 @@ const _useKbd = () => {
|
|
|
31
32
|
ctrl: " "
|
|
32
33
|
});
|
|
33
34
|
onMounted(() => {
|
|
34
|
-
kbdKeysSpecificMap.meta = macOS.value ? kbdKeysMap.command :
|
|
35
|
-
kbdKeysSpecificMap.
|
|
36
|
-
kbdKeysSpecificMap.
|
|
35
|
+
kbdKeysSpecificMap.meta = macOS.value ? kbdKeysMap.command : "Ctrl";
|
|
36
|
+
kbdKeysSpecificMap.ctrl = macOS.value ? kbdKeysMap.control : "Ctrl";
|
|
37
|
+
kbdKeysSpecificMap.alt = macOS.value ? kbdKeysMap.option : "Alt";
|
|
37
38
|
});
|
|
38
39
|
function getKbdKey(value) {
|
|
39
40
|
if (!value) {
|
|
@@ -11,28 +11,28 @@ interface ManagedOverlayOptionsPrivate<T extends Component> {
|
|
|
11
11
|
id: symbol;
|
|
12
12
|
isMounted: boolean;
|
|
13
13
|
isOpen: boolean;
|
|
14
|
+
originalProps?: ComponentProps<T>;
|
|
14
15
|
resolvePromise?: (value: any) => void;
|
|
15
16
|
}
|
|
16
17
|
export type Overlay = OverlayOptions<Component> & ManagedOverlayOptionsPrivate<Component>;
|
|
17
|
-
|
|
18
|
+
type OverlayInstance<T extends Component> = Omit<ManagedOverlayOptionsPrivate<T>, 'component'> & {
|
|
18
19
|
id: symbol;
|
|
19
|
-
|
|
20
|
-
open: (props?: ComponentProps<T>) => Omit<OverlayInstance<T>, 'open' | 'close' | 'patch' | 'modelValue' | 'resolvePromise'>;
|
|
20
|
+
open: (props?: ComponentProps<T>) => OpenedOverlay<T>;
|
|
21
21
|
close: (value?: any) => void;
|
|
22
22
|
patch: (props: Partial<ComponentProps<T>>) => void;
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
|
+
type OpenedOverlay<T extends Component> = Omit<OverlayInstance<T>, 'open' | 'close' | 'patch' | 'modelValue' | 'resolvePromise'> & {
|
|
25
|
+
result: Promise<CloseEventArgType<ComponentEmit<T>>>;
|
|
26
|
+
};
|
|
24
27
|
declare function _useOverlay(): {
|
|
25
28
|
overlays: import("vue").ShallowReactive<Overlay[]>;
|
|
26
|
-
open: <T extends Component>(id: symbol, props?: ComponentProps<T>) =>
|
|
27
|
-
id: symbol;
|
|
28
|
-
isMounted: boolean;
|
|
29
|
-
isOpen: boolean;
|
|
30
|
-
result: Promise<any>;
|
|
31
|
-
};
|
|
29
|
+
open: <T extends Component>(id: symbol, props?: ComponentProps<T>) => OpenedOverlay<T>;
|
|
32
30
|
close: (id: symbol, value?: any) => void;
|
|
31
|
+
closeAll: () => void;
|
|
33
32
|
create: <T extends Component>(component: T, _options?: OverlayOptions<ComponentProps<T>>) => OverlayInstance<T>;
|
|
34
33
|
patch: <T extends Component>(id: symbol, props: Partial<ComponentProps<T>>) => void;
|
|
35
|
-
|
|
34
|
+
unmount: (id: symbol) => void;
|
|
35
|
+
isOpen: (id: symbol) => boolean;
|
|
36
36
|
};
|
|
37
37
|
export declare const useOverlay: typeof _useOverlay;
|
|
38
38
|
export {};
|
|
@@ -10,13 +10,12 @@ function _useOverlay() {
|
|
|
10
10
|
component: markRaw(component),
|
|
11
11
|
isMounted: !!defaultOpen,
|
|
12
12
|
destroyOnClose: !!destroyOnClose,
|
|
13
|
-
|
|
13
|
+
originalProps: props || {},
|
|
14
|
+
props: { ...props || {} }
|
|
14
15
|
});
|
|
15
16
|
overlays.push(options);
|
|
16
17
|
return {
|
|
17
18
|
...options,
|
|
18
|
-
result: new Promise(() => {
|
|
19
|
-
}),
|
|
20
19
|
open: (props2) => open(options.id, props2),
|
|
21
20
|
close: (value) => close(options.id, value),
|
|
22
21
|
patch: (props2) => patch(options.id, props2)
|
|
@@ -26,6 +25,8 @@ function _useOverlay() {
|
|
|
26
25
|
const overlay = getOverlay(id);
|
|
27
26
|
if (props) {
|
|
28
27
|
patch(overlay.id, props);
|
|
28
|
+
} else {
|
|
29
|
+
patch(overlay.id, overlay.originalProps);
|
|
29
30
|
}
|
|
30
31
|
overlay.isOpen = true;
|
|
31
32
|
overlay.isMounted = true;
|
|
@@ -33,9 +34,7 @@ function _useOverlay() {
|
|
|
33
34
|
id,
|
|
34
35
|
isMounted: overlay.isMounted,
|
|
35
36
|
isOpen: overlay.isOpen,
|
|
36
|
-
result: new Promise((resolve) =>
|
|
37
|
-
overlay.resolvePromise = resolve;
|
|
38
|
-
})
|
|
37
|
+
result: new Promise((resolve) => overlay.resolvePromise = resolve)
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
40
|
const close = (id, value) => {
|
|
@@ -46,7 +45,10 @@ function _useOverlay() {
|
|
|
46
45
|
overlay.resolvePromise = void 0;
|
|
47
46
|
}
|
|
48
47
|
};
|
|
49
|
-
const
|
|
48
|
+
const closeAll = () => {
|
|
49
|
+
overlays.forEach((overlay) => close(overlay.id));
|
|
50
|
+
};
|
|
51
|
+
const unmount = (id) => {
|
|
50
52
|
const overlay = getOverlay(id);
|
|
51
53
|
overlay.isMounted = false;
|
|
52
54
|
if (overlay.destroyOnClose) {
|
|
@@ -56,9 +58,7 @@ function _useOverlay() {
|
|
|
56
58
|
};
|
|
57
59
|
const patch = (id, props) => {
|
|
58
60
|
const overlay = getOverlay(id);
|
|
59
|
-
|
|
60
|
-
overlay.props[key] = value;
|
|
61
|
-
});
|
|
61
|
+
overlay.props = { ...props };
|
|
62
62
|
};
|
|
63
63
|
const getOverlay = (id) => {
|
|
64
64
|
const overlay = overlays.find((overlay2) => overlay2.id === id);
|
|
@@ -67,13 +67,19 @@ function _useOverlay() {
|
|
|
67
67
|
}
|
|
68
68
|
return overlay;
|
|
69
69
|
};
|
|
70
|
+
const isOpen = (id) => {
|
|
71
|
+
const overlay = getOverlay(id);
|
|
72
|
+
return overlay.isOpen;
|
|
73
|
+
};
|
|
70
74
|
return {
|
|
71
75
|
overlays,
|
|
72
76
|
open,
|
|
73
77
|
close,
|
|
78
|
+
closeAll,
|
|
74
79
|
create,
|
|
75
80
|
patch,
|
|
76
|
-
|
|
81
|
+
unmount,
|
|
82
|
+
isOpen
|
|
77
83
|
};
|
|
78
84
|
}
|
|
79
85
|
export const useOverlay = /* @__PURE__ */ createSharedComposable(_useOverlay);
|
|
@@ -7,7 +7,7 @@ import { computed } from "vue";
|
|
|
7
7
|
import { defu } from "defu";
|
|
8
8
|
import { useForwardProps } from "reka-ui";
|
|
9
9
|
import { reactiveOmit } from "@vueuse/core";
|
|
10
|
-
import { usePage
|
|
10
|
+
import { usePage } from "@inertiajs/vue3";
|
|
11
11
|
import { hasProtocol } from "ufo";
|
|
12
12
|
import { useAppConfig } from "#imports";
|
|
13
13
|
import { tv } from "../../utils/tv";
|
|
@@ -33,7 +33,6 @@ const props = defineProps({
|
|
|
33
33
|
data: { type: Object, required: false },
|
|
34
34
|
method: { type: String, required: false },
|
|
35
35
|
headers: { type: Object, required: false },
|
|
36
|
-
onClick: { type: Function, required: false },
|
|
37
36
|
preserveScroll: { type: [Boolean, String, Function], required: false },
|
|
38
37
|
preserveState: { type: [Boolean, String, Function], required: false },
|
|
39
38
|
replace: { type: Boolean, required: false },
|
|
@@ -53,8 +52,9 @@ const props = defineProps({
|
|
|
53
52
|
cacheFor: { type: [Number, String, Array], required: false }
|
|
54
53
|
});
|
|
55
54
|
defineSlots();
|
|
55
|
+
const page = usePage();
|
|
56
56
|
const appConfig = useAppConfig();
|
|
57
|
-
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "activeClass", "inactiveClass", "to", "raw", "class"));
|
|
57
|
+
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
|
|
58
58
|
const b24ui = computed(() => tv({
|
|
59
59
|
extend: tv(theme),
|
|
60
60
|
...defu({
|
|
@@ -66,12 +66,33 @@ const b24ui = computed(() => tv({
|
|
|
66
66
|
}
|
|
67
67
|
}, appConfig.b24ui?.link || {})
|
|
68
68
|
}));
|
|
69
|
+
const href = computed(() => props.to ?? props.href);
|
|
69
70
|
const isExternal = computed(() => {
|
|
70
|
-
if (
|
|
71
|
-
|
|
71
|
+
if (props.external) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
if (!href.value) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return typeof href.value === "string" && hasProtocol(href.value, { acceptRelative: true });
|
|
78
|
+
});
|
|
79
|
+
const isLinkActive = computed(() => {
|
|
80
|
+
if (props.active !== void 0) {
|
|
81
|
+
return props.active;
|
|
82
|
+
}
|
|
83
|
+
if (!href.value) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (props.exact && page.url === href.value) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
if (!props.exact && page.url.startsWith(href.value)) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
72
93
|
});
|
|
73
94
|
const linkClass = computed(() => {
|
|
74
|
-
const active =
|
|
95
|
+
const active = isLinkActive.value;
|
|
75
96
|
if (props.raw) {
|
|
76
97
|
return [props.class, active ? props.activeClass : props.inactiveClass];
|
|
77
98
|
}
|
|
@@ -82,72 +103,36 @@ const linkClass = computed(() => {
|
|
|
82
103
|
isAction: Boolean(props.isAction)
|
|
83
104
|
});
|
|
84
105
|
});
|
|
85
|
-
const page = usePage();
|
|
86
|
-
const url = computed(() => props.to ?? props.href ?? "#");
|
|
87
|
-
const isActive = computed(() => props.active || (props.exact ? url.value === props.href : page?.url.startsWith(url.value)));
|
|
88
106
|
</script>
|
|
89
107
|
|
|
90
108
|
<template>
|
|
91
|
-
<template v-if="
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
<slot
|
|
95
|
-
v-bind="{
|
|
96
|
-
...$attrs,
|
|
97
|
-
as,
|
|
98
|
-
type,
|
|
99
|
-
disabled,
|
|
100
|
-
href: url,
|
|
101
|
-
active: isActive
|
|
102
|
-
}"
|
|
103
|
-
/>
|
|
104
|
-
</template>
|
|
105
|
-
<B24LinkBase
|
|
106
|
-
v-else
|
|
107
|
-
v-bind="{
|
|
109
|
+
<template v-if="custom">
|
|
110
|
+
<slot
|
|
111
|
+
v-bind="{
|
|
108
112
|
...$attrs,
|
|
113
|
+
...routerLinkProps,
|
|
109
114
|
as,
|
|
110
115
|
type,
|
|
111
116
|
disabled,
|
|
112
|
-
href
|
|
113
|
-
active:
|
|
117
|
+
href,
|
|
118
|
+
active: isLinkActive,
|
|
119
|
+
isExternal
|
|
114
120
|
}"
|
|
115
|
-
|
|
116
|
-
>
|
|
117
|
-
<slot :active="isActive" />
|
|
118
|
-
</B24LinkBase>
|
|
119
|
-
</InertiaLink>
|
|
121
|
+
/>
|
|
120
122
|
</template>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<slot
|
|
125
|
-
v-bind="{
|
|
123
|
+
<B24LinkBase
|
|
124
|
+
v-else
|
|
125
|
+
v-bind="{
|
|
126
126
|
...$attrs,
|
|
127
|
+
...routerLinkProps,
|
|
127
128
|
as,
|
|
128
129
|
type,
|
|
129
130
|
disabled,
|
|
130
|
-
href
|
|
131
|
-
|
|
132
|
-
active: isActive
|
|
131
|
+
href,
|
|
132
|
+
isExternal
|
|
133
133
|
}"
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
v-bind="{
|
|
139
|
-
...$attrs,
|
|
140
|
-
as,
|
|
141
|
-
type,
|
|
142
|
-
disabled,
|
|
143
|
-
href: url,
|
|
144
|
-
target: isExternal ? '_blank' : void 0,
|
|
145
|
-
active: isActive
|
|
146
|
-
}"
|
|
147
|
-
:is-external="isExternal"
|
|
148
|
-
:class="linkClass"
|
|
149
|
-
>
|
|
150
|
-
<slot :active="isActive" />
|
|
151
|
-
</B24LinkBase>
|
|
152
|
-
</template>
|
|
134
|
+
:class="linkClass"
|
|
135
|
+
>
|
|
136
|
+
<slot :active="isLinkActive" />
|
|
137
|
+
</B24LinkBase>
|
|
153
138
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes } from 'vue';
|
|
2
2
|
import type { InertiaLinkProps } from '@inertiajs/vue3';
|
|
3
|
-
interface NuxtLinkProps extends Omit<InertiaLinkProps, 'href'> {
|
|
3
|
+
interface NuxtLinkProps extends Omit<InertiaLinkProps, 'href' | 'onClick'> {
|
|
4
4
|
activeClass?: string;
|
|
5
5
|
/**
|
|
6
6
|
* Route Location the link should navigate to when clicked on.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { Primitive } from "reka-ui";
|
|
7
|
+
import { Link as InertiaLink } from "@inertiajs/vue3";
|
|
8
|
+
defineOptions({ inheritAttrs: false });
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
as: { type: String, required: false, default: "button" },
|
|
11
|
+
type: { type: String, required: false, default: "button" },
|
|
12
|
+
disabled: { type: Boolean, required: false },
|
|
13
|
+
onClick: { type: [Function, Array], required: false },
|
|
14
|
+
href: { type: String, required: false },
|
|
15
|
+
target: { type: [String, Object, null], required: false },
|
|
16
|
+
active: { type: Boolean, required: false },
|
|
17
|
+
isExternal: { type: Boolean, required: false }
|
|
18
|
+
});
|
|
19
|
+
function onClickWrapper(e) {
|
|
20
|
+
if (props.disabled) {
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (props.onClick) {
|
|
26
|
+
for (const onClick of Array.isArray(props.onClick) ? props.onClick : [props.onClick]) {
|
|
27
|
+
onClick(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<InertiaLink
|
|
35
|
+
v-if="!!href && !isExternal && !disabled"
|
|
36
|
+
:href="href"
|
|
37
|
+
v-bind="{
|
|
38
|
+
target: target || (isExternal ? '_blank' : void 0),
|
|
39
|
+
...$attrs
|
|
40
|
+
}"
|
|
41
|
+
@click="onClickWrapper"
|
|
42
|
+
>
|
|
43
|
+
<slot />
|
|
44
|
+
</InertiaLink>
|
|
45
|
+
<Primitive
|
|
46
|
+
v-else
|
|
47
|
+
v-bind="href ? {
|
|
48
|
+
'as': 'a',
|
|
49
|
+
'href': disabled ? void 0 : href,
|
|
50
|
+
'aria-disabled': disabled ? 'true' : void 0,
|
|
51
|
+
'role': disabled ? 'link' : void 0,
|
|
52
|
+
'tabindex': disabled ? -1 : void 0,
|
|
53
|
+
'target': target || (isExternal ? '_blank' : void 0),
|
|
54
|
+
...$attrs
|
|
55
|
+
} : as === 'button' ? {
|
|
56
|
+
as,
|
|
57
|
+
type,
|
|
58
|
+
disabled,
|
|
59
|
+
...$attrs
|
|
60
|
+
} : {
|
|
61
|
+
as,
|
|
62
|
+
...$attrs
|
|
63
|
+
}"
|
|
64
|
+
@click="onClickWrapper"
|
|
65
|
+
>
|
|
66
|
+
<slot />
|
|
67
|
+
</Primitive>
|
|
68
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LinkProps } from '../../types';
|
|
2
|
+
export interface LinkBaseProps {
|
|
3
|
+
as?: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onClick?: ((e: MouseEvent) => void | Promise<void>) | Array<((e: MouseEvent) => void | Promise<void>)>;
|
|
7
|
+
href?: string;
|
|
8
|
+
target?: LinkProps['target'];
|
|
9
|
+
active?: boolean;
|
|
10
|
+
isExternal?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<LinkBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinkBaseProps> & Readonly<{}>, {
|
|
13
|
+
as: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
16
|
+
default?: (props: {}) => any;
|
|
17
|
+
} & {
|
|
18
|
+
default?: (props: {}) => any;
|
|
19
|
+
}>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
2
|
import type { NuxtApp } from '#app';
|
|
3
3
|
export { useHead } from '@unhead/vue';
|
|
4
|
+
export { useAppConfig } from '../vue/composables/useAppConfig';
|
|
4
5
|
export { defineShortcuts } from '../composables/defineShortcuts';
|
|
5
6
|
export { defineLocale } from '../composables/defineLocale';
|
|
6
7
|
export { useLocale } from '../composables/useLocale';
|
|
@@ -19,7 +20,6 @@ export declare const useColorMode: () => {
|
|
|
19
20
|
readonly value: import("@vueuse/core").BasicColorMode;
|
|
20
21
|
forced: boolean;
|
|
21
22
|
};
|
|
22
|
-
export declare const useAppConfig: () => any;
|
|
23
23
|
export declare const useCookie: <T = string>(_name: string, _options?: Record<string, any>) => {
|
|
24
24
|
value: Ref<T, T>;
|
|
25
25
|
get: () => T;
|
|
@@ -4,6 +4,7 @@ import appConfig from "#build/app.config";
|
|
|
4
4
|
import { useColorMode as useColorModeVueUse } from "@vueuse/core";
|
|
5
5
|
import { usePage } from "@inertiajs/vue3";
|
|
6
6
|
export { useHead } from "@unhead/vue";
|
|
7
|
+
export { useAppConfig } from "../vue/composables/useAppConfig.js";
|
|
7
8
|
export { defineShortcuts } from "../composables/defineShortcuts.js";
|
|
8
9
|
export { defineLocale } from "../composables/defineLocale.js";
|
|
9
10
|
export { useLocale } from "../composables/useLocale.js";
|
|
@@ -37,7 +38,6 @@ export const useColorMode = () => {
|
|
|
37
38
|
forced: false
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
|
-
export const useAppConfig = () => appConfig;
|
|
41
41
|
export const useCookie = (_name, _options = {}) => {
|
|
42
42
|
const value = ref(null);
|
|
43
43
|
return {
|
package/dist/runtime/prose/A.vue
CHANGED
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<a :class="b24ui.base({ class: [props.
|
|
19
|
+
<a :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</a>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<blockquote :class="b24ui.base({ class: [props.
|
|
19
|
+
<blockquote :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</blockquote>
|
|
22
22
|
</template>
|
|
@@ -20,6 +20,6 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
20
20
|
|
|
21
21
|
<template>
|
|
22
22
|
<code
|
|
23
|
-
:class="b24ui.base({ class: [props.
|
|
23
|
+
:class="b24ui.base({ class: [props.b24ui?.base, props.class] })"
|
|
24
24
|
><slot /></code>
|
|
25
25
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<em :class="b24ui.base({ class: [props.
|
|
19
|
+
<em :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</em>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<h1 :class="b24ui.base({ class: [props.
|
|
19
|
+
<h1 :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</h1>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<h2 :class="b24ui.base({ class: [props.
|
|
19
|
+
<h2 :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</h2>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<h3 :class="b24ui.base({ class: [props.
|
|
19
|
+
<h3 :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</h3>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<h4 :class="b24ui.base({ class: [props.
|
|
19
|
+
<h4 :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</h4>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<h5 :class="b24ui.base({ class: [props.
|
|
19
|
+
<h5 :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</h5>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<h6 :class="b24ui.base({ class: [props.
|
|
19
|
+
<h6 :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</h6>
|
|
22
22
|
</template>
|
|
@@ -15,5 +15,5 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<template>
|
|
18
|
-
<hr :class="b24ui.base({ class: [props.
|
|
18
|
+
<hr :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
19
19
|
</template>
|
|
@@ -15,5 +15,5 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<template>
|
|
18
|
-
<img :class="b24ui.base({ class: [props.
|
|
18
|
+
<img :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
19
19
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<li :class="b24ui.base({ class: [props.
|
|
19
|
+
<li :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</li>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<ol :class="b24ui.base({ class: [props.
|
|
19
|
+
<ol :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</ol>
|
|
22
22
|
</template>
|
package/dist/runtime/prose/P.vue
CHANGED
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<p :class="b24ui.base({ class: [props.
|
|
19
|
+
<p :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</p>
|
|
22
22
|
</template>
|