@bridge-ui/vue 0.0.1-beta.7 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions/BridgeUIHosts.vue.d.ts +3 -2
- package/dist/Actions/BridgeUIHosts.vue_vue_type_script_setup_true_lang.js +15 -10
- package/dist/Actions/Drawer/BridgeDrawerHost.js +5 -0
- package/dist/Actions/Drawer/BridgeDrawerHost.vue.d.ts +14 -0
- package/dist/Actions/Drawer/BridgeDrawerHost.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/Actions/Drawer/bridgeDrawer.types.d.ts +44 -0
- package/dist/Actions/Drawer/bridgeDrawerInjectionKey.d.ts +3 -0
- package/dist/Actions/Drawer/bridgeDrawerInjectionKey.js +4 -0
- package/dist/Actions/Drawer/createBridgeDrawerApi.d.ts +2 -0
- package/dist/Actions/Drawer/createBridgeDrawerApi.js +49 -0
- package/dist/Actions/Drawer/index.d.ts +3 -0
- package/dist/Actions/Drawer/index.js +3 -0
- package/dist/Actions/Drawer/useDrawerAction.d.ts +5 -0
- package/dist/Actions/Drawer/useDrawerAction.js +26 -0
- package/dist/Actions/bridgeUIHosts.types.d.ts +5 -0
- package/dist/Actions/index.d.ts +2 -0
- package/dist/Actions/index.js +8 -6
- package/dist/Components/Badge/badge.types.d.ts +1 -1
- package/dist/Components/Chip/chip.types.d.ts +1 -1
- package/dist/Components/Drawer/Drawer.js +5 -0
- package/dist/Components/Drawer/Drawer.vue.d.ts +39 -0
- package/dist/Components/Drawer/Drawer.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/Components/Drawer/composables/useDrawer.d.ts +63 -0
- package/dist/Components/Drawer/composables/useDrawer.js +208 -0
- package/dist/Components/Drawer/drawer.types.d.ts +188 -0
- package/dist/Components/Drawer/index.d.ts +4 -0
- package/dist/Components/Drawer/index.js +3 -0
- package/dist/Components/FormControl/formControl.types.d.ts +6 -6
- package/dist/Components/FormField/formField.types.d.ts +7 -7
- package/dist/Components/Label/label.types.d.ts +1 -1
- package/dist/Components/Link/link.types.d.ts +3 -3
- package/dist/Components/List/list.types.d.ts +1 -1
- package/dist/Components/ListItem/listItem.types.d.ts +1 -1
- package/dist/Components/ListSection/listSection.types.d.ts +1 -1
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +72 -70
- package/dist/Components/Listbox/listbox.types.d.ts +15 -6
- package/dist/Components/Menu/menu.types.d.ts +3 -3
- package/dist/Components/Modal/composables/useModal.js +0 -1
- package/dist/Components/Modal/modal.types.d.ts +3 -2
- package/dist/Components/Select/Select.vue.d.ts +2 -2
- package/dist/Components/Select/composables/useSelect.d.ts +2 -1
- package/dist/Components/Select/composables/useSelect.js +3 -2
- package/dist/Components/Select/select.types.d.ts +5 -5
- package/dist/Components/Snackbar/composables/useSnackbar.js +1 -1
- package/dist/Components/Snackbar/snackbar.types.d.ts +7 -7
- package/dist/Components/Spinner/composables/useSpinner.js +16 -16
- package/dist/Components/Tab/Tab.js +5 -0
- package/dist/Components/Tab/Tab.vue.d.ts +11 -0
- package/dist/Components/Tab/Tab.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/Components/Tab/composables/useTab.d.ts +23 -0
- package/dist/Components/Tab/composables/useTab.js +88 -0
- package/dist/Components/Tab/index.d.ts +3 -0
- package/dist/Components/Tab/index.js +3 -0
- package/dist/Components/Tab/tab.types.d.ts +94 -0
- package/dist/Components/TabItem/TabItem.js +5 -0
- package/dist/Components/TabItem/TabItem.vue.d.ts +11 -0
- package/dist/Components/TabItem/TabItem.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/Components/TabItem/composables/useTabItem.d.ts +3 -0
- package/dist/Components/TabItem/composables/useTabItem.js +39 -0
- package/dist/Components/TabItem/index.d.ts +3 -0
- package/dist/Components/TabItem/index.js +3 -0
- package/dist/Components/TabItem/tabItem.types.d.ts +72 -0
- package/dist/Components/TabList/TabList.js +5 -0
- package/dist/Components/TabList/TabList.vue.d.ts +11 -0
- package/dist/Components/TabList/TabList.vue_vue_type_script_setup_true_lang.js +18 -0
- package/dist/Components/TabList/composables/useTabList.d.ts +10 -0
- package/dist/Components/TabList/composables/useTabList.js +65 -0
- package/dist/Components/TabList/index.d.ts +3 -0
- package/dist/Components/TabList/index.js +3 -0
- package/dist/Components/TabList/tabList.types.d.ts +38 -0
- package/dist/Components/TabPanel/TabPanel.js +5 -0
- package/dist/Components/TabPanel/TabPanel.vue.d.ts +11 -0
- package/dist/Components/TabPanel/TabPanel.vue_vue_type_script_setup_true_lang.js +20 -0
- package/dist/Components/TabPanel/composables/useTabPanel.d.ts +14 -0
- package/dist/Components/TabPanel/composables/useTabPanel.js +51 -0
- package/dist/Components/TabPanel/index.d.ts +3 -0
- package/dist/Components/TabPanel/index.js +3 -0
- package/dist/Components/TabPanel/tabPanel.types.d.ts +48 -0
- package/dist/Components/Tabs/Tabs.js +5 -0
- package/dist/Components/Tabs/Tabs.vue.d.ts +24 -0
- package/dist/Components/Tabs/Tabs.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/Components/Tabs/composables/useTabs.d.ts +39 -0
- package/dist/Components/Tabs/composables/useTabs.js +99 -0
- package/dist/Components/Tabs/index.d.ts +4 -0
- package/dist/Components/Tabs/index.js +4 -0
- package/dist/Components/Tabs/tabs.types.d.ts +93 -0
- package/dist/Components/Tabs/tabsInjectionKey.d.ts +121 -0
- package/dist/Components/Tabs/tabsInjectionKey.js +4 -0
- package/dist/Utils/index.d.ts +2 -0
- package/dist/Utils/index.js +20 -19
- package/dist/Utils/useBreakpoint.d.ts +19 -0
- package/dist/Utils/useBreakpoint.js +35 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +76 -62
- package/dist/theme.css +9 -0
- package/package.json +2 -2
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
+
import { TABS_INJECTION_KEY as r } from "../../Tabs/tabsInjectionKey.js";
|
|
3
|
+
import { computed as i, inject as a, onBeforeUnmount as o, onMounted as s, useAttrs as c, watch as l } from "vue";
|
|
4
|
+
import { get as u } from "es-toolkit/compat";
|
|
5
|
+
import { cn as d, getTabId as f, getTabPanelId as p, splitComponentProps as m } from "@bridge-ui/core";
|
|
6
|
+
//#region src/Components/Tab/composables/useTab.ts
|
|
7
|
+
var h = [
|
|
8
|
+
"value",
|
|
9
|
+
"classes",
|
|
10
|
+
"endIcon",
|
|
11
|
+
"disabled",
|
|
12
|
+
"startIcon",
|
|
13
|
+
"customProps"
|
|
14
|
+
];
|
|
15
|
+
function g(g) {
|
|
16
|
+
let _ = c(), v = a(r, null);
|
|
17
|
+
if (!v) throw Error("Tab must be used within a Tabs provider");
|
|
18
|
+
let y = v, b = i(() => m({
|
|
19
|
+
bridgeKeys: h,
|
|
20
|
+
props: {
|
|
21
|
+
..._,
|
|
22
|
+
...g
|
|
23
|
+
}
|
|
24
|
+
})), { merged: x, entry: S } = t({
|
|
25
|
+
componentName: "Tab",
|
|
26
|
+
props: () => b.value.componentProps
|
|
27
|
+
}), C = i(() => x.value.value), w = i(() => x.value.disabled === !0), T = i(() => y.value.selected === C.value), E = null;
|
|
28
|
+
function D() {
|
|
29
|
+
E?.(), E = y.value.registerTab(C.value, w.value);
|
|
30
|
+
}
|
|
31
|
+
s(D), l([C, w], D), o(() => {
|
|
32
|
+
E?.(), E = null;
|
|
33
|
+
});
|
|
34
|
+
let O = n({
|
|
35
|
+
entry: S,
|
|
36
|
+
props: () => b.value.componentProps
|
|
37
|
+
});
|
|
38
|
+
function k(e) {
|
|
39
|
+
w.value || (y.value.setSelected(C.value), b.value.inheritedAttrs.onClick?.(e));
|
|
40
|
+
}
|
|
41
|
+
function A(e) {
|
|
42
|
+
let t = y.value;
|
|
43
|
+
t.activation === "manual" && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), w.value || t.setSelected(C.value)), b.value.inheritedAttrs.onKeydown?.(e);
|
|
44
|
+
}
|
|
45
|
+
let j = i(() => x.value.customProps);
|
|
46
|
+
return {
|
|
47
|
+
merged: x,
|
|
48
|
+
iconSize: i(() => y.value.tokenClasses.iconSize ?? "md"),
|
|
49
|
+
rootBind: i(() => {
|
|
50
|
+
let t = y.value;
|
|
51
|
+
return e(j.value?.root, b.value.inheritedAttrs, {
|
|
52
|
+
role: "tab",
|
|
53
|
+
type: "button",
|
|
54
|
+
onClick: k,
|
|
55
|
+
disabled: w.value,
|
|
56
|
+
onKeydown: A,
|
|
57
|
+
"aria-selected": T.value,
|
|
58
|
+
tabindex: T.value ? 0 : -1,
|
|
59
|
+
id: f(t.id, C.value),
|
|
60
|
+
"aria-controls": p(t.id, C.value),
|
|
61
|
+
class: d({
|
|
62
|
+
"inline-flex cursor-pointer items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 disabled:pointer-events-none disabled:opacity-50": !0,
|
|
63
|
+
[t.tokenClasses.iconGap ?? ""]: !0,
|
|
64
|
+
[t.tokenClasses.tabSize ?? ""]: !0,
|
|
65
|
+
[t.tokenClasses.tabVariant ?? ""]: !0,
|
|
66
|
+
[t.tokenClasses.tabOrientation ?? ""]: !0,
|
|
67
|
+
[t.tokenClasses.tabVariantSelected ?? ""]: T.value,
|
|
68
|
+
[t.tokenClasses.colorSelected ?? ""]: T.value,
|
|
69
|
+
[t.tokenClasses.colorSelectedSoft ?? ""]: T.value && t.tokenClasses.softFill === !0,
|
|
70
|
+
[u(O.value, "root") ?? ""]: !0
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}),
|
|
74
|
+
selected: T,
|
|
75
|
+
endIconBind: i(() => e(j.value?.endIcon, {}, d({
|
|
76
|
+
"shrink-0": !0,
|
|
77
|
+
[u(O.value, "endIcon") ?? ""]: !0
|
|
78
|
+
}))),
|
|
79
|
+
endSlotBind: i(() => e(j.value?.end, {}, "inline-flex shrink-0 items-center")),
|
|
80
|
+
startIconBind: i(() => e(j.value?.startIcon, {}, d({
|
|
81
|
+
"shrink-0": !0,
|
|
82
|
+
[u(O.value, "startIcon") ?? ""]: !0
|
|
83
|
+
}))),
|
|
84
|
+
startSlotBind: i(() => e(j.value?.start, {}, "inline-flex shrink-0 items-center"))
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { g as useTab };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { LucideIcon } from '@lucide/vue';
|
|
2
|
+
import { ButtonHTMLAttributes, HTMLAttributes, Slot } from 'vue';
|
|
3
|
+
import { MergeHtmlProps } from '@bridge-ui/core';
|
|
4
|
+
import { IconProps } from '../Icon';
|
|
5
|
+
export interface TabClasses {
|
|
6
|
+
/**
|
|
7
|
+
* Classes merged onto the end icon.
|
|
8
|
+
*/
|
|
9
|
+
endIcon?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Classes merged onto the tab button.
|
|
12
|
+
*/
|
|
13
|
+
root?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Classes merged onto the start icon.
|
|
16
|
+
*/
|
|
17
|
+
startIcon?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface TabCustomProps {
|
|
20
|
+
/**
|
|
21
|
+
* Props forwarded to the inline-end slot wrapper.
|
|
22
|
+
*/
|
|
23
|
+
end?: HTMLAttributes;
|
|
24
|
+
/**
|
|
25
|
+
* Props forwarded to the end `Icon`.
|
|
26
|
+
*/
|
|
27
|
+
endIcon?: Partial<Omit<IconProps, "icon">>;
|
|
28
|
+
/**
|
|
29
|
+
* Props forwarded to the tab button.
|
|
30
|
+
*/
|
|
31
|
+
root?: ButtonHTMLAttributes;
|
|
32
|
+
/**
|
|
33
|
+
* Props forwarded to the inline-start slot wrapper.
|
|
34
|
+
*/
|
|
35
|
+
start?: HTMLAttributes;
|
|
36
|
+
/**
|
|
37
|
+
* Props forwarded to the start `Icon`.
|
|
38
|
+
*/
|
|
39
|
+
startIcon?: Partial<Omit<IconProps, "icon">>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Tab trigger (`role="tab"`). Must be used inside `Tabs` / `TabList`.
|
|
43
|
+
*/
|
|
44
|
+
export interface TabOwnProps {
|
|
45
|
+
/**
|
|
46
|
+
* Classes for tab parts.
|
|
47
|
+
*
|
|
48
|
+
* @default undefined
|
|
49
|
+
*/
|
|
50
|
+
classes?: TabClasses;
|
|
51
|
+
/**
|
|
52
|
+
* Props forwarded to each tab part.
|
|
53
|
+
*
|
|
54
|
+
* @default undefined
|
|
55
|
+
*/
|
|
56
|
+
customProps?: TabCustomProps;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the tab is disabled.
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Icon at the **inline end** (physical right in `ltr`, physical left in `rtl`).
|
|
65
|
+
*
|
|
66
|
+
* @default undefined
|
|
67
|
+
*/
|
|
68
|
+
endIcon?: LucideIcon;
|
|
69
|
+
/**
|
|
70
|
+
* Icon at the **inline start** (physical left in `ltr`, physical right in `rtl`). Prefer over the `#start` slot.
|
|
71
|
+
*
|
|
72
|
+
* @default undefined
|
|
73
|
+
*/
|
|
74
|
+
startIcon?: LucideIcon;
|
|
75
|
+
/**
|
|
76
|
+
* Stable value matching a `TabPanel`.
|
|
77
|
+
*/
|
|
78
|
+
value: string;
|
|
79
|
+
}
|
|
80
|
+
export interface TabSlots {
|
|
81
|
+
/**
|
|
82
|
+
* The label content.
|
|
83
|
+
*/
|
|
84
|
+
default?: Slot<undefined>;
|
|
85
|
+
/**
|
|
86
|
+
* Slot at the inline end (ignored when `endIcon` is set).
|
|
87
|
+
*/
|
|
88
|
+
end?: Slot<undefined>;
|
|
89
|
+
/**
|
|
90
|
+
* Slot at the inline start (ignored when `startIcon` is set).
|
|
91
|
+
*/
|
|
92
|
+
start?: Slot<undefined>;
|
|
93
|
+
}
|
|
94
|
+
export type TabProps = MergeHtmlProps<TabOwnProps, ButtonHTMLAttributes>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TabItemOwnProps, TabItemSlots } from './tabItem.types';
|
|
2
|
+
type __VLS_Slots = TabItemSlots;
|
|
3
|
+
declare const __VLS_base: import('vue').DefineComponent<TabItemOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<TabItemOwnProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
4
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
7
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
8
|
+
new (): {
|
|
9
|
+
$slots: S;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useTabItem as e } from "./composables/useTabItem.js";
|
|
2
|
+
import { createElementBlock as t, defineComponent as n, openBlock as r, useSlots as i } from "vue";
|
|
3
|
+
//#region src/Components/TabItem/TabItem.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var a = {
|
|
5
|
+
hidden: "",
|
|
6
|
+
"aria-hidden": "true"
|
|
7
|
+
}, o = /* @__PURE__ */ n({
|
|
8
|
+
name: "TabItem",
|
|
9
|
+
inheritAttrs: !1,
|
|
10
|
+
__name: "TabItem",
|
|
11
|
+
props: {
|
|
12
|
+
classes: {},
|
|
13
|
+
disabled: { type: Boolean },
|
|
14
|
+
endIcon: { type: [Function, Object] },
|
|
15
|
+
keepMounted: { type: Boolean },
|
|
16
|
+
label: {},
|
|
17
|
+
startIcon: { type: [Function, Object] },
|
|
18
|
+
value: {}
|
|
19
|
+
},
|
|
20
|
+
setup(n) {
|
|
21
|
+
return e(n, i()), (e, n) => (r(), t("span", a));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
25
|
+
export { o as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TABS_INJECTION_KEY as e } from "../../Tabs/tabsInjectionKey.js";
|
|
2
|
+
import { inject as t, onBeforeUnmount as n, onMounted as r, watch as i } from "vue";
|
|
3
|
+
//#region src/Components/TabItem/composables/useTabItem.ts
|
|
4
|
+
function a(a, o) {
|
|
5
|
+
let s = t(e, null);
|
|
6
|
+
if (!s) throw Error("TabItem must be used within a Tabs provider");
|
|
7
|
+
let c = s, l;
|
|
8
|
+
function u() {
|
|
9
|
+
l?.(), l = c.value.registerTabItem({
|
|
10
|
+
value: a.value,
|
|
11
|
+
endIcon: a.endIcon,
|
|
12
|
+
disabled: a.disabled,
|
|
13
|
+
startIcon: a.startIcon,
|
|
14
|
+
keepMounted: a.keepMounted,
|
|
15
|
+
panel: () => o.default?.(),
|
|
16
|
+
label: a.label ?? (() => o.label?.()),
|
|
17
|
+
slots: o.start || o.end ? {
|
|
18
|
+
end: o.end ? () => o.end?.() : void 0,
|
|
19
|
+
start: o.start ? () => o.start?.() : void 0
|
|
20
|
+
} : void 0
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
r(u), i(() => [
|
|
24
|
+
a.label,
|
|
25
|
+
a.value,
|
|
26
|
+
a.endIcon,
|
|
27
|
+
a.disabled,
|
|
28
|
+
a.startIcon,
|
|
29
|
+
a.keepMounted,
|
|
30
|
+
!!o.end,
|
|
31
|
+
!!o.label,
|
|
32
|
+
!!o.start,
|
|
33
|
+
!!o.default
|
|
34
|
+
], u), n(() => {
|
|
35
|
+
l?.();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { a as useTabItem };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { LucideIcon } from '@lucide/vue';
|
|
2
|
+
import { Slot } from 'vue';
|
|
3
|
+
export interface TabItemClasses {
|
|
4
|
+
/**
|
|
5
|
+
* Unused on the registration-only root; reserved for overrides.
|
|
6
|
+
*/
|
|
7
|
+
root?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Ergonomic shortcut: registers a `Tab` label + `TabPanel` content with `Tabs`.
|
|
11
|
+
*/
|
|
12
|
+
export interface TabItemOwnProps {
|
|
13
|
+
/**
|
|
14
|
+
* Classes reserved for registry overrides.
|
|
15
|
+
*
|
|
16
|
+
* @default undefined
|
|
17
|
+
*/
|
|
18
|
+
classes?: TabItemClasses;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the tab is disabled.
|
|
21
|
+
*
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Icon at the **inline end** on the tab trigger.
|
|
27
|
+
*
|
|
28
|
+
* @default undefined
|
|
29
|
+
*/
|
|
30
|
+
endIcon?: LucideIcon;
|
|
31
|
+
/**
|
|
32
|
+
* When set, overrides `Tabs` `keepMounted` for this panel.
|
|
33
|
+
*
|
|
34
|
+
* @default undefined
|
|
35
|
+
*/
|
|
36
|
+
keepMounted?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Label shown on the tab trigger (or use the `label` slot).
|
|
39
|
+
*
|
|
40
|
+
* @default undefined
|
|
41
|
+
*/
|
|
42
|
+
label?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Icon at the **inline start** on the tab trigger.
|
|
45
|
+
*
|
|
46
|
+
* @default undefined
|
|
47
|
+
*/
|
|
48
|
+
startIcon?: LucideIcon;
|
|
49
|
+
/**
|
|
50
|
+
* Stable value for the tab / panel pair.
|
|
51
|
+
*/
|
|
52
|
+
value: string;
|
|
53
|
+
}
|
|
54
|
+
export interface TabItemSlots {
|
|
55
|
+
/**
|
|
56
|
+
* Panel content for this tab.
|
|
57
|
+
*/
|
|
58
|
+
default?: Slot<undefined>;
|
|
59
|
+
/**
|
|
60
|
+
* Trailing custom content on the tab trigger (ignored when `endIcon` is set).
|
|
61
|
+
*/
|
|
62
|
+
end?: Slot<undefined>;
|
|
63
|
+
/**
|
|
64
|
+
* Label content when not using the `label` prop.
|
|
65
|
+
*/
|
|
66
|
+
label?: Slot<undefined>;
|
|
67
|
+
/**
|
|
68
|
+
* Leading custom content on the tab trigger (ignored when `startIcon` is set).
|
|
69
|
+
*/
|
|
70
|
+
start?: Slot<undefined>;
|
|
71
|
+
}
|
|
72
|
+
export type TabItemProps = TabItemOwnProps;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TabListOwnProps, TabListSlots } from './tabList.types';
|
|
2
|
+
type __VLS_Slots = TabListSlots;
|
|
3
|
+
declare const __VLS_base: import('vue').DefineComponent<TabListOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<TabListOwnProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
4
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
7
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
8
|
+
new (): {
|
|
9
|
+
$slots: S;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolveNamedSlot as e } from "../../Utils/slotOrProp.js";
|
|
2
|
+
import { useTabList as t } from "./composables/useTabList.js";
|
|
3
|
+
import { createBlock as n, createElementBlock as r, defineComponent as i, guardReactiveProps as a, normalizeProps as o, openBlock as s, resolveDynamicComponent as c, unref as l, useSlots as u } from "vue";
|
|
4
|
+
//#region src/Components/TabList/TabList.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var d = /* @__PURE__ */ i({
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "TabList",
|
|
8
|
+
props: {
|
|
9
|
+
classes: {},
|
|
10
|
+
customProps: {}
|
|
11
|
+
},
|
|
12
|
+
setup(i) {
|
|
13
|
+
let d = u(), { rootBind: f } = t(i);
|
|
14
|
+
return (t, i) => (s(), r("div", o(a(l(f))), [(s(), n(c(l(e)(l(d), "default"))))], 16));
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { d as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TabListOwnProps, TabListProps } from '../tabList.types';
|
|
2
|
+
export declare function useTabList(props: TabListOwnProps): {
|
|
3
|
+
merged: import('vue').ComputedRef<TabListOwnProps>;
|
|
4
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
5
|
+
role: string;
|
|
6
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
7
|
+
"aria-orientation": "horizontal" | "vertical";
|
|
8
|
+
class: string;
|
|
9
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<TabListProps, "classes" | "customProps">>>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
+
import { TABS_INJECTION_KEY as r } from "../../Tabs/tabsInjectionKey.js";
|
|
3
|
+
import { computed as i, inject as a, useAttrs as o } from "vue";
|
|
4
|
+
import { get as s } from "es-toolkit/compat";
|
|
5
|
+
import { cn as c, getAdjacentTabValue as l, getTabId as u, splitComponentProps as d } from "@bridge-ui/core";
|
|
6
|
+
//#region src/Components/TabList/composables/useTabList.ts
|
|
7
|
+
var f = ["classes", "customProps"];
|
|
8
|
+
function p(p) {
|
|
9
|
+
let m = o(), h = a(r, null);
|
|
10
|
+
if (!h) throw Error("TabList must be used within a Tabs provider");
|
|
11
|
+
let g = h, _ = i(() => d({
|
|
12
|
+
bridgeKeys: f,
|
|
13
|
+
props: {
|
|
14
|
+
...m,
|
|
15
|
+
...p
|
|
16
|
+
}
|
|
17
|
+
})), { merged: v, entry: y } = t({
|
|
18
|
+
componentName: "TabList",
|
|
19
|
+
props: () => _.value.componentProps
|
|
20
|
+
}), b = n({
|
|
21
|
+
entry: y,
|
|
22
|
+
props: () => _.value.componentProps
|
|
23
|
+
});
|
|
24
|
+
function x(e) {
|
|
25
|
+
let t = g.value, n = t.orientation === "horizontal", r = n ? "ArrowRight" : "ArrowDown", i = n ? "ArrowLeft" : "ArrowUp", a = typeof document < "u" ? document.activeElement?.id : void 0, o = t.tabValues.find((e) => u(t.id, e) === a) ?? t.selected;
|
|
26
|
+
if (e.key === r || e.key === i) {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
let n = e.key === r ? 1 : -1, i = l(t.tabValues, o, n, new Set(t.disabledValues));
|
|
29
|
+
t.focusTab(i), t.activation === "automatic" && t.setSelected(i);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (e.key === "Home") {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
let n = t.tabValues.find((e) => !t.disabledValues.includes(e)) ?? t.selected;
|
|
35
|
+
t.focusTab(n), t.activation === "automatic" && t.setSelected(n);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (e.key === "End") {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
let n = [...t.tabValues].reverse().find((e) => !t.disabledValues.includes(e)) ?? t.selected;
|
|
41
|
+
t.focusTab(n), t.activation === "automatic" && t.setSelected(n);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
let S = i(() => v.value.customProps);
|
|
45
|
+
return {
|
|
46
|
+
merged: v,
|
|
47
|
+
rootBind: i(() => {
|
|
48
|
+
let t = g.value;
|
|
49
|
+
return e(S.value?.root, _.value.inheritedAttrs, {
|
|
50
|
+
role: "tablist",
|
|
51
|
+
onKeydown: x,
|
|
52
|
+
"aria-orientation": t.orientation,
|
|
53
|
+
class: c({
|
|
54
|
+
flex: !0,
|
|
55
|
+
[t.tokenClasses.listOrientation ?? ""]: !0,
|
|
56
|
+
[t.tokenClasses.listSize ?? ""]: !0,
|
|
57
|
+
[t.tokenClasses.listVariant ?? ""]: !0,
|
|
58
|
+
[s(b.value, "root") ?? ""]: !0
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { p as useTabList };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { HTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { MergeHtmlProps } from '@bridge-ui/core';
|
|
3
|
+
export interface TabListClasses {
|
|
4
|
+
/**
|
|
5
|
+
* Classes merged onto the tab list root.
|
|
6
|
+
*/
|
|
7
|
+
root?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TabListCustomProps {
|
|
10
|
+
/**
|
|
11
|
+
* Props forwarded to the tab list root.
|
|
12
|
+
*/
|
|
13
|
+
root?: HTMLAttributes;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Container for `Tab` triggers (`role="tablist"`). Must be used inside `Tabs`.
|
|
17
|
+
*/
|
|
18
|
+
export interface TabListOwnProps {
|
|
19
|
+
/**
|
|
20
|
+
* Classes for tab list parts.
|
|
21
|
+
*
|
|
22
|
+
* @default undefined
|
|
23
|
+
*/
|
|
24
|
+
classes?: TabListClasses;
|
|
25
|
+
/**
|
|
26
|
+
* Props forwarded to each tab list part.
|
|
27
|
+
*
|
|
28
|
+
* @default undefined
|
|
29
|
+
*/
|
|
30
|
+
customProps?: TabListCustomProps;
|
|
31
|
+
}
|
|
32
|
+
export interface TabListSlots {
|
|
33
|
+
/**
|
|
34
|
+
* The tab triggers to render.
|
|
35
|
+
*/
|
|
36
|
+
default?: Slot<undefined>;
|
|
37
|
+
}
|
|
38
|
+
export type TabListProps = MergeHtmlProps<TabListOwnProps, HTMLAttributes>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TabPanelOwnProps, TabPanelSlots } from './tabPanel.types';
|
|
2
|
+
type __VLS_Slots = TabPanelSlots;
|
|
3
|
+
declare const __VLS_base: import('vue').DefineComponent<TabPanelOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<TabPanelOwnProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
4
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
7
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
8
|
+
new (): {
|
|
9
|
+
$slots: S;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { resolveNamedSlot as e } from "../../Utils/slotOrProp.js";
|
|
2
|
+
import { useTabPanel as t } from "./composables/useTabPanel.js";
|
|
3
|
+
import { createBlock as n, createCommentVNode as r, createElementBlock as i, defineComponent as a, mergeProps as o, normalizeProps as s, openBlock as c, resolveDynamicComponent as l, unref as u, useSlots as d } from "vue";
|
|
4
|
+
//#region src/Components/TabPanel/TabPanel.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var f = /* @__PURE__ */ a({
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "TabPanel",
|
|
8
|
+
props: {
|
|
9
|
+
classes: {},
|
|
10
|
+
customProps: {},
|
|
11
|
+
keepMounted: { type: Boolean },
|
|
12
|
+
value: {}
|
|
13
|
+
},
|
|
14
|
+
setup(a) {
|
|
15
|
+
let f = d(), { rootBind: p, selected: m, keepMounted: h } = t(a);
|
|
16
|
+
return (t, a) => u(m) || u(h) ? (c(), i("div", s(o({ key: 0 }, u(p))), [(c(), n(l(u(e)(u(f), "default"))))], 16)) : r("", !0);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
export { f as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TabPanelOwnProps, TabPanelProps } from '../tabPanel.types';
|
|
2
|
+
export declare function useTabPanel(props: TabPanelOwnProps): {
|
|
3
|
+
merged: import('vue').ComputedRef<TabPanelOwnProps>;
|
|
4
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
5
|
+
role: string;
|
|
6
|
+
hidden: boolean;
|
|
7
|
+
tabindex: number;
|
|
8
|
+
id: string;
|
|
9
|
+
"aria-labelledby": string;
|
|
10
|
+
class: string;
|
|
11
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<TabPanelProps, "value" | "classes" | "customProps" | "keepMounted">>>;
|
|
12
|
+
selected: import('vue').ComputedRef<boolean>;
|
|
13
|
+
keepMounted: import('vue').ComputedRef<boolean>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
+
import { TABS_INJECTION_KEY as r } from "../../Tabs/tabsInjectionKey.js";
|
|
3
|
+
import { computed as i, getCurrentInstance as a, inject as o, useAttrs as s } from "vue";
|
|
4
|
+
import { get as c } from "es-toolkit/compat";
|
|
5
|
+
import { cn as l, getTabId as u, getTabPanelId as d, splitComponentProps as f } from "@bridge-ui/core";
|
|
6
|
+
//#region src/Components/TabPanel/composables/useTabPanel.ts
|
|
7
|
+
var p = [
|
|
8
|
+
"value",
|
|
9
|
+
"classes",
|
|
10
|
+
"customProps",
|
|
11
|
+
"keepMounted"
|
|
12
|
+
];
|
|
13
|
+
function m(m) {
|
|
14
|
+
let h = s(), g = o(r, null);
|
|
15
|
+
if (!g) throw Error("TabPanel must be used within a Tabs provider");
|
|
16
|
+
let _ = g, v = i(() => f({
|
|
17
|
+
props: {
|
|
18
|
+
...h,
|
|
19
|
+
...m
|
|
20
|
+
},
|
|
21
|
+
bridgeKeys: p
|
|
22
|
+
})), { merged: y, entry: b } = t({
|
|
23
|
+
componentName: "TabPanel",
|
|
24
|
+
props: () => v.value.componentProps
|
|
25
|
+
}), x = i(() => y.value.value), S = i(() => _.value.selected === x.value), C = i(() => "keepMounted" in (a()?.vnode.props ?? {}) ? y.value.keepMounted === !0 : _.value.keepMounted), w = n({
|
|
26
|
+
entry: b,
|
|
27
|
+
props: () => v.value.componentProps
|
|
28
|
+
}), T = i(() => y.value.customProps);
|
|
29
|
+
return {
|
|
30
|
+
merged: y,
|
|
31
|
+
rootBind: i(() => {
|
|
32
|
+
let t = _.value;
|
|
33
|
+
return e(T.value?.root, v.value.inheritedAttrs, {
|
|
34
|
+
role: "tabpanel",
|
|
35
|
+
hidden: !S.value,
|
|
36
|
+
tabindex: S.value ? 0 : -1,
|
|
37
|
+
id: d(t.id, x.value),
|
|
38
|
+
"aria-labelledby": u(t.id, x.value),
|
|
39
|
+
class: l({
|
|
40
|
+
[t.tokenClasses.panelSize ?? ""]: !0,
|
|
41
|
+
[t.tokenClasses.panelOrientation ?? ""]: !0,
|
|
42
|
+
[c(w.value, "root") ?? ""]: !0
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}),
|
|
46
|
+
selected: S,
|
|
47
|
+
keepMounted: C
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { m as useTabPanel };
|