@bridge-ui/vue 0.4.0 → 0.5.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/ai/skills/bridge-ui-components/SKILL.md +3 -1
- package/dist/Components/Accordion/accordionInjectionKey.d.ts +1 -0
- package/dist/Components/Accordion/composables/useAccordion.js +3 -2
- package/dist/Components/AccordionItem/composables/useAccordionItem.js +1 -0
- package/dist/Components/DataTable/DataTable.vue.d.ts +1 -1
- package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +96 -92
- package/dist/Components/DataTable/composables/useDataTable.d.ts +1 -1
- package/dist/Components/DataTable/composables/useDataTable.js +1 -1
- package/dist/Components/EmptyState/EmptyState.js +5 -0
- package/dist/Components/EmptyState/EmptyState.vue.d.ts +16 -0
- package/dist/Components/EmptyState/EmptyState.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/Components/EmptyState/composables/useEmptyState.d.ts +24 -0
- package/dist/Components/EmptyState/composables/useEmptyState.js +76 -0
- package/dist/Components/EmptyState/emptyState.types.d.ts +140 -0
- package/dist/Components/EmptyState/index.d.ts +3 -0
- package/dist/Components/EmptyState/index.js +3 -0
- package/dist/Components/List/composables/useList.d.ts +3 -1
- package/dist/Components/List/composables/useList.js +2 -2
- package/dist/Components/ListItem/ListItem.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/Components/ListSection/ListSection.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/Components/ListSection/composables/useListSection.d.ts +1 -0
- package/dist/Components/ListSection/composables/useListSection.js +30 -28
- package/dist/Components/ListSection/listSectionInjectionKey.d.ts +5 -0
- package/dist/Components/ListSection/listSectionInjectionKey.js +4 -0
- package/dist/Components/Sidebar/Sidebar.js +5 -0
- package/dist/Components/Sidebar/Sidebar.vue.d.ts +16 -0
- package/dist/Components/Sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/Components/Sidebar/SidebarInset.js +5 -0
- package/dist/Components/Sidebar/SidebarInset.vue.d.ts +11 -0
- package/dist/Components/Sidebar/SidebarInset.vue_vue_type_script_setup_true_lang.js +18 -0
- package/dist/Components/Sidebar/SidebarList.js +5 -0
- package/dist/Components/Sidebar/SidebarList.vue.d.ts +16 -0
- package/dist/Components/Sidebar/SidebarList.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/Components/Sidebar/SidebarListItem.js +5 -0
- package/dist/Components/Sidebar/SidebarListItem.vue.d.ts +13 -0
- package/dist/Components/Sidebar/SidebarListItem.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/Components/Sidebar/SidebarProvider.js +5 -0
- package/dist/Components/Sidebar/SidebarProvider.vue.d.ts +24 -0
- package/dist/Components/Sidebar/SidebarProvider.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/Components/Sidebar/SidebarTrigger.js +5 -0
- package/dist/Components/Sidebar/SidebarTrigger.vue.d.ts +11 -0
- package/dist/Components/Sidebar/SidebarTrigger.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/Components/Sidebar/composables/useSidebar.d.ts +6 -0
- package/dist/Components/Sidebar/composables/useSidebar.js +10 -0
- package/dist/Components/Sidebar/composables/useSidebarInset.d.ts +7 -0
- package/dist/Components/Sidebar/composables/useSidebarInset.js +32 -0
- package/dist/Components/Sidebar/composables/useSidebarList.d.ts +8 -0
- package/dist/Components/Sidebar/composables/useSidebarList.js +27 -0
- package/dist/Components/Sidebar/composables/useSidebarListItem.d.ts +15 -0
- package/dist/Components/Sidebar/composables/useSidebarListItem.js +44 -0
- package/dist/Components/Sidebar/composables/useSidebarProvider.d.ts +18 -0
- package/dist/Components/Sidebar/composables/useSidebarProvider.js +88 -0
- package/dist/Components/Sidebar/composables/useSidebarShell.d.ts +41 -0
- package/dist/Components/Sidebar/composables/useSidebarShell.js +116 -0
- package/dist/Components/Sidebar/composables/useSidebarTrigger.d.ts +10 -0
- package/dist/Components/Sidebar/composables/useSidebarTrigger.js +25 -0
- package/dist/Components/Sidebar/index.d.ts +15 -0
- package/dist/Components/Sidebar/index.js +15 -0
- package/dist/Components/Sidebar/sidebar.types.d.ts +244 -0
- package/dist/Components/Sidebar/sidebarInjectionKey.d.ts +80 -0
- package/dist/Components/Sidebar/sidebarInjectionKey.js +4 -0
- package/dist/Components/Sidebar/sidebarListInjectionKey.d.ts +5 -0
- package/dist/Components/Sidebar/sidebarListInjectionKey.js +4 -0
- package/dist/Components/Slider/Slider.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/augments.d.ts +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +79 -64
- package/docs/README.md +2 -0
- package/docs/ScrollUtilities.md +1 -1
- package/docs/components/DataTable.md +1 -1
- package/docs/components/Drawer.md +1 -1
- package/docs/components/EmptyState.md +125 -0
- package/docs/components/List.md +1 -1
- package/docs/components/Sidebar.md +281 -0
- package/docs/examples/icon-fontawesome.ts +1 -0
- package/docs/examples/icon-heroicons.ts +2 -0
- package/docs/examples/icon-lucide.ts +2 -0
- package/docs/examples/icon-phosphor.ts +2 -0
- package/docs/examples/icon-tabler.ts +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SidebarProviderOwnProps, SidebarProviderSlots } from './sidebar.types';
|
|
2
|
+
type __VLS_Slots = SidebarProviderSlots;
|
|
3
|
+
type __VLS_Props = SidebarProviderOwnProps;
|
|
4
|
+
type __VLS_ModelProps = {
|
|
5
|
+
modelValue?: boolean | undefined;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
8
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (...args: unknown[]) => any;
|
|
10
|
+
openChange: (open: boolean) => any;
|
|
11
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
+
"onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined;
|
|
13
|
+
onOpenChange?: ((open: boolean) => any) | undefined;
|
|
14
|
+
}>, {
|
|
15
|
+
defaultOpen: boolean;
|
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useSidebarProvider as e } from "./composables/useSidebarProvider.js";
|
|
2
|
+
import { createElementBlock as t, defineComponent as n, guardReactiveProps as r, mergeModels as i, normalizeProps as a, openBlock as o, renderSlot as s, unref as c, useModel as l } from "vue";
|
|
3
|
+
//#region src/Components/Sidebar/SidebarProvider.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var u = /*@__PURE__*/ n({
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
name: "SidebarProvider",
|
|
7
|
+
__name: "SidebarProvider",
|
|
8
|
+
props: /*@__PURE__*/ i({
|
|
9
|
+
classes: {},
|
|
10
|
+
customProps: {},
|
|
11
|
+
defaultOpen: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: !0
|
|
14
|
+
}
|
|
15
|
+
}, {
|
|
16
|
+
modelValue: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: void 0
|
|
19
|
+
},
|
|
20
|
+
modelModifiers: {}
|
|
21
|
+
}),
|
|
22
|
+
emits: /*@__PURE__*/ i(["openChange", "update:modelValue"], ["update:modelValue"]),
|
|
23
|
+
setup(n, { emit: i }) {
|
|
24
|
+
let u = i, d = n, f = l(n, "modelValue"), { rootBind: p } = e(d, { defaultOpen: !0 }, f, u);
|
|
25
|
+
return (e, n) => (o(), t("div", a(r(c(p))), [s(e.$slots, "default")], 16));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { u as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SidebarTriggerOwnProps, SidebarTriggerSlots } from './sidebar.types';
|
|
2
|
+
type __VLS_Slots = SidebarTriggerSlots;
|
|
3
|
+
declare const __VLS_base: import('vue').DefineComponent<SidebarTriggerOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SidebarTriggerOwnProps> & 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,35 @@
|
|
|
1
|
+
import e from "../Button/Button.js";
|
|
2
|
+
import { useSidebarTrigger as t } from "./composables/useSidebarTrigger.js";
|
|
3
|
+
import { createBlock as n, createCommentVNode as r, defineComponent as i, mergeProps as a, openBlock as o, renderSlot as s, unref as c, useSlots as l, withCtx as u } from "vue";
|
|
4
|
+
//#region src/Components/Sidebar/SidebarTrigger.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var d = /*@__PURE__*/ i({
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "SidebarTrigger",
|
|
8
|
+
setup(i) {
|
|
9
|
+
let d = l(), { attrs: f, panelId: p, expanded: m, iconClass: h, ariaLabel: g, handleClick: _, hasDefaultSlot: v } = t(d);
|
|
10
|
+
return (t, i) => (o(), n(c(e), a(c(f), {
|
|
11
|
+
color: "dark",
|
|
12
|
+
type: "button",
|
|
13
|
+
density: "mini",
|
|
14
|
+
variant: "light",
|
|
15
|
+
"aria-label": c(g),
|
|
16
|
+
onClick: c(_),
|
|
17
|
+
"aria-expanded": c(m),
|
|
18
|
+
classes: { icon: c(h) },
|
|
19
|
+
"aria-controls": c(p) || void 0,
|
|
20
|
+
icon: c(v) ? void 0 : "panelLeft"
|
|
21
|
+
}), {
|
|
22
|
+
default: u(() => [c(v) ? s(t.$slots, "default", {}, void 0, void 0, 0) : r("", !0)]),
|
|
23
|
+
_: 3
|
|
24
|
+
}, 16, [
|
|
25
|
+
"aria-label",
|
|
26
|
+
"onClick",
|
|
27
|
+
"aria-expanded",
|
|
28
|
+
"classes",
|
|
29
|
+
"aria-controls",
|
|
30
|
+
"icon"
|
|
31
|
+
]));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { d as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SidebarContextValue } from '../sidebarInjectionKey';
|
|
2
|
+
/**
|
|
3
|
+
* Reads the nearest `SidebarProvider` context. Throws when used outside it.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useSidebar(): import('vue').ComputedRef<SidebarContextValue>;
|
|
6
|
+
export type { SidebarContextValue };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SIDEBAR_INJECTION_KEY as e } from "../sidebarInjectionKey.js";
|
|
2
|
+
import { inject as t } from "vue";
|
|
3
|
+
//#region src/Components/Sidebar/composables/useSidebar.ts
|
|
4
|
+
function n() {
|
|
5
|
+
let n = t(e);
|
|
6
|
+
if (!n) throw Error("useSidebar must be used within a SidebarProvider");
|
|
7
|
+
return n;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as useSidebar };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SidebarInsetOwnProps, SidebarInsetProps } from '../sidebar.types';
|
|
2
|
+
export declare function useSidebarInset(props: SidebarInsetOwnProps): {
|
|
3
|
+
merged: import('vue').ComputedRef<SidebarInsetOwnProps>;
|
|
4
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
5
|
+
class: string;
|
|
6
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<SidebarInsetProps, "classes" | "customProps">, never>>>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { mergePartBind as e, useBridgeUIComponent as t } from "../../../Utils/index.js";
|
|
2
|
+
import { useSidebar as n } from "./useSidebar.js";
|
|
3
|
+
import { computed as r, useAttrs as i } from "vue";
|
|
4
|
+
import { get as a, omit as o } from "es-toolkit/compat";
|
|
5
|
+
import { sidebarVariantProps as s } from "@bridge-ui/core/Tokens";
|
|
6
|
+
import { cn as c, mergeBridgeUILayeredClasses as l, splitComponentProps as u } from "@bridge-ui/core/Utils";
|
|
7
|
+
//#region src/Components/Sidebar/composables/useSidebarInset.ts
|
|
8
|
+
var d = ["classes", "customProps"];
|
|
9
|
+
function f(f) {
|
|
10
|
+
let p = n(), m = i(), h = r(() => u({
|
|
11
|
+
props: {
|
|
12
|
+
...m,
|
|
13
|
+
...f
|
|
14
|
+
},
|
|
15
|
+
bridgeKeys: d
|
|
16
|
+
})), { merged: g, entry: _ } = t({
|
|
17
|
+
componentName: "Sidebar",
|
|
18
|
+
props: () => h.value.componentProps
|
|
19
|
+
}), v = r(() => g.value.customProps), y = r(() => {
|
|
20
|
+
let e = l(s, _.value?.tokens?.variant);
|
|
21
|
+
return a(e, p.value.variant);
|
|
22
|
+
}), b = r(() => o(h.value.inheritedAttrs, []));
|
|
23
|
+
return {
|
|
24
|
+
merged: g,
|
|
25
|
+
rootBind: r(() => e(v.value?.root, b.value, { class: c({
|
|
26
|
+
[a(y.value, "inset") ?? ""]: !0,
|
|
27
|
+
[a(g.value.classes, "root") ?? ""]: !0
|
|
28
|
+
}) }))
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { f as useSidebarInset };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SidebarListProps } from '../sidebar.types';
|
|
2
|
+
/**
|
|
3
|
+
* Binds icon-rail mode and applies nav chrome.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useSidebarList(props: Pick<SidebarListProps, "nested" | "iconOnly">): {
|
|
6
|
+
iconOnly: import('vue').ComputedRef<boolean>;
|
|
7
|
+
rootClassName: import('vue').ComputedRef<string>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useSidebar as e } from "./useSidebar.js";
|
|
2
|
+
import { SIDEBAR_LIST_INJECTION_KEY as t } from "../sidebarListInjectionKey.js";
|
|
3
|
+
import { computed as n, getCurrentInstance as r, inject as i, provide as a } from "vue";
|
|
4
|
+
import { isSidebarIconOnly as o } from "@bridge-ui/core/Domain";
|
|
5
|
+
import { cn as s } from "@bridge-ui/core/Utils";
|
|
6
|
+
//#region src/Components/Sidebar/composables/useSidebarList.ts
|
|
7
|
+
function c(c) {
|
|
8
|
+
let l = e(), u = r(), d = i(t, null), f = n(() => {
|
|
9
|
+
let e = u?.vnode.props ?? {};
|
|
10
|
+
return "iconOnly" in e || "icon-only" in e ? c.iconOnly === !0 : d ? d.value.iconOnly : o({
|
|
11
|
+
state: l.value.state,
|
|
12
|
+
isMobile: l.value.isMobile,
|
|
13
|
+
collapsible: l.value.collapsible
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
return a(t, n(() => ({ iconOnly: f.value }))), {
|
|
17
|
+
iconOnly: f,
|
|
18
|
+
rootClassName: n(() => s({
|
|
19
|
+
"flex flex-col gap-1": !0,
|
|
20
|
+
"px-2": c.nested !== !0,
|
|
21
|
+
"ml-3.5 translate-x-px border-l border-dark-200 py-0.5 pl-2.5 dark:border-dark-700": c.nested === !0,
|
|
22
|
+
hidden: c.nested === !0 && f.value
|
|
23
|
+
}))
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { c as useSidebarList };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SidebarListItemProps } from '../sidebar.types';
|
|
2
|
+
/**
|
|
3
|
+
* Tooltip and nav chrome for a rail item.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useSidebarListItem(props: Pick<SidebarListItemProps, "primary" | "tooltip" | "secondary" | "tooltipPlacement">): {
|
|
6
|
+
tooltip: import('vue').ComputedRef<string | undefined>;
|
|
7
|
+
itemClasses: import('vue').ComputedRef<{
|
|
8
|
+
end: string;
|
|
9
|
+
content: string;
|
|
10
|
+
start: string;
|
|
11
|
+
interactive: string;
|
|
12
|
+
}>;
|
|
13
|
+
accessibleName: import('vue').ComputedRef<string | undefined>;
|
|
14
|
+
tooltipPlacement: import('vue').ComputedRef<import('@floating-ui/utils').Placement>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { isPropPresent as e } from "../../../Utils/slotOrProp.js";
|
|
2
|
+
import { useSidebar as t } from "./useSidebar.js";
|
|
3
|
+
import { SIDEBAR_LIST_INJECTION_KEY as n } from "../sidebarListInjectionKey.js";
|
|
4
|
+
import { computed as r, inject as i } from "vue";
|
|
5
|
+
import { isSidebarIconOnly as a, resolveSidebarListTooltipPlacement as o } from "@bridge-ui/core/Domain";
|
|
6
|
+
import { cn as s } from "@bridge-ui/core/Utils";
|
|
7
|
+
//#region src/Components/Sidebar/composables/useSidebarListItem.ts
|
|
8
|
+
function c(c) {
|
|
9
|
+
let l = t(), u = i(n, null), d = r(() => u ? u.value.iconOnly : a({
|
|
10
|
+
state: l.value.state,
|
|
11
|
+
isMobile: l.value.isMobile,
|
|
12
|
+
collapsible: l.value.collapsible
|
|
13
|
+
})), f = r(() => {
|
|
14
|
+
if (d.value) {
|
|
15
|
+
if (c.tooltip !== void 0) return c.tooltip || void 0;
|
|
16
|
+
if (typeof c.primary == "string") return c.primary;
|
|
17
|
+
}
|
|
18
|
+
}), p = r(() => c.tooltipPlacement === void 0 ? o(l.value.side) : c.tooltipPlacement), m = r(() => {
|
|
19
|
+
if (!(!d.value || typeof c.primary != "string")) return c.primary;
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
tooltip: f,
|
|
23
|
+
itemClasses: r(() => {
|
|
24
|
+
let t = e(c.secondary);
|
|
25
|
+
return {
|
|
26
|
+
end: s({ hidden: d.value }),
|
|
27
|
+
content: s({ hidden: d.value }),
|
|
28
|
+
start: s({ "items-center justify-center": !0 }),
|
|
29
|
+
interactive: s({
|
|
30
|
+
"gap-x-2 overflow-hidden rounded-lg px-2 transition-[width,height,padding] duration-200 ease-linear": !d.value,
|
|
31
|
+
"min-h-12 py-2": !d.value && t,
|
|
32
|
+
"min-h-8 py-0": !d.value && !t,
|
|
33
|
+
"gap-0 overflow-hidden rounded-lg p-0": d.value,
|
|
34
|
+
"size-8 justify-center": d.value && t,
|
|
35
|
+
"h-8 w-full px-2": d.value && !t
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
}),
|
|
39
|
+
accessibleName: m,
|
|
40
|
+
tooltipPlacement: p
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { c as useSidebarListItem };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Ref, SetupContext } from 'vue';
|
|
2
|
+
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
|
|
3
|
+
import { SidebarProviderEmits, SidebarProviderOwnProps, SidebarProviderProps } from '../sidebar.types';
|
|
4
|
+
type SidebarProviderLibDefaults = LibDefaultsShape<SidebarProviderOwnProps, "defaultOpen">;
|
|
5
|
+
type SidebarProviderMerged = MergeLibDefaults<SidebarProviderOwnProps, SidebarProviderLibDefaults>;
|
|
6
|
+
export declare function useSidebarProvider(props: SidebarProviderOwnProps, libDefaults: SidebarProviderLibDefaults, openModel: Ref<boolean | undefined>, emit: SetupContext<SidebarProviderEmits>["emit"]): {
|
|
7
|
+
merged: import('vue').ComputedRef<SidebarProviderMerged>;
|
|
8
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
9
|
+
"data-side": keyof import('@bridge-ui/core/Tokens').SidebarSide;
|
|
10
|
+
class: string;
|
|
11
|
+
style: {
|
|
12
|
+
"--bridge-sidebar-width": string;
|
|
13
|
+
"--bridge-sidebar-width-icon": string;
|
|
14
|
+
"--bridge-sidebar-width-mobile": string;
|
|
15
|
+
};
|
|
16
|
+
}, "class", import('vue').HTMLAttributes | undefined, Partial<Omit<SidebarProviderProps, "classes" | "customProps" | "defaultOpen">>>>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useBreakpoint as e } from "../../../Utils/useBreakpoint.js";
|
|
2
|
+
import { mergePartBind as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../../../Utils/index.js";
|
|
3
|
+
import { SIDEBAR_INJECTION_KEY as i } from "../sidebarInjectionKey.js";
|
|
4
|
+
import { computed as a, provide as o, ref as s, useAttrs as c } from "vue";
|
|
5
|
+
import { get as l, omit as u } from "es-toolkit/compat";
|
|
6
|
+
import { SIDEBAR_DESKTOP_BREAKPOINT as d, SIDEBAR_WIDTH_ICON_VAR as f, SIDEBAR_WIDTH_MOBILE_VAR as p, SIDEBAR_WIDTH_VAR as m, resolveSidebarState as h, shouldToggleDesktopSidebar as g, toggleSidebarOpen as _ } from "@bridge-ui/core/Domain";
|
|
7
|
+
import { sidebarWidthProps as v } from "@bridge-ui/core/Tokens";
|
|
8
|
+
import { cn as y, splitComponentProps as b } from "@bridge-ui/core/Utils";
|
|
9
|
+
import { toMerged as x } from "es-toolkit/object";
|
|
10
|
+
//#region src/Components/Sidebar/composables/useSidebarProvider.ts
|
|
11
|
+
var S = [
|
|
12
|
+
"classes",
|
|
13
|
+
"customProps",
|
|
14
|
+
"defaultOpen"
|
|
15
|
+
], C = {
|
|
16
|
+
panelId: "",
|
|
17
|
+
side: "left",
|
|
18
|
+
variant: "sidebar",
|
|
19
|
+
collapsible: "offcanvas"
|
|
20
|
+
};
|
|
21
|
+
function w(w, T, E, D) {
|
|
22
|
+
let O = c(), k = e(), A = a(() => b({
|
|
23
|
+
props: {
|
|
24
|
+
...O,
|
|
25
|
+
...w
|
|
26
|
+
},
|
|
27
|
+
bridgeKeys: S
|
|
28
|
+
})), { merged: j, entry: M } = n({
|
|
29
|
+
libDefaults: T,
|
|
30
|
+
componentName: "Sidebar",
|
|
31
|
+
props: () => A.value.componentProps
|
|
32
|
+
}), N = a(() => j.value.customProps), P = r({
|
|
33
|
+
entry: M,
|
|
34
|
+
props: () => A.value.componentProps
|
|
35
|
+
}), F = a(() => k.lessThan(d)), I = s(j.value.defaultOpen), L = s(!1), R = s({ ...C }), z = a(() => E.value ?? I.value), B = (e) => {
|
|
36
|
+
E.value === void 0 && (I.value = e), E.value = e, D("openChange", e);
|
|
37
|
+
}, V = (e) => {
|
|
38
|
+
L.value = e;
|
|
39
|
+
}, H = (e) => {
|
|
40
|
+
let t = {
|
|
41
|
+
...R.value,
|
|
42
|
+
...e
|
|
43
|
+
};
|
|
44
|
+
(R.value.side !== t.side || R.value.panelId !== t.panelId || R.value.variant !== t.variant || R.value.collapsible !== t.collapsible) && (R.value = t);
|
|
45
|
+
}, U = () => {
|
|
46
|
+
if (F.value) {
|
|
47
|
+
V(_(L.value));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
g(R.value.collapsible) && B(_(z.value));
|
|
51
|
+
}, W = a(() => h(z.value, R.value.collapsible)), G = a(() => x(v, M.value?.tokens?.width ?? {})), K = a(() => ({
|
|
52
|
+
setOpen: B,
|
|
53
|
+
setLayout: H,
|
|
54
|
+
toggleSidebar: U,
|
|
55
|
+
setOpenMobile: V,
|
|
56
|
+
open: z.value,
|
|
57
|
+
state: W.value,
|
|
58
|
+
side: R.value.side,
|
|
59
|
+
isMobile: F.value,
|
|
60
|
+
openMobile: L.value,
|
|
61
|
+
panelId: R.value.panelId,
|
|
62
|
+
variant: R.value.variant,
|
|
63
|
+
collapsible: R.value.collapsible
|
|
64
|
+
}));
|
|
65
|
+
o(i, K);
|
|
66
|
+
let q = a(() => u(A.value.inheritedAttrs, ["modelValue", "onUpdate:modelValue"]));
|
|
67
|
+
return {
|
|
68
|
+
merged: j,
|
|
69
|
+
rootBind: a(() => {
|
|
70
|
+
let e = q.value.style;
|
|
71
|
+
return t(N.value?.root, q.value, {
|
|
72
|
+
"data-side": R.value.side,
|
|
73
|
+
class: y({
|
|
74
|
+
"flex min-h-svh w-full data-[side=right]:flex-row-reverse": !0,
|
|
75
|
+
[l(P.value, "root") ?? ""]: !0
|
|
76
|
+
}),
|
|
77
|
+
style: {
|
|
78
|
+
...e,
|
|
79
|
+
[m]: G.value.default,
|
|
80
|
+
[f]: G.value.icon,
|
|
81
|
+
[p]: G.value.mobile
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { w as useSidebarProvider };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
|
|
2
|
+
import { SidebarOwnProps, SidebarProps } from '../sidebar.types';
|
|
3
|
+
type SidebarLibDefaults = LibDefaultsShape<SidebarOwnProps, "side" | "variant" | "ariaLabel" | "collapsible">;
|
|
4
|
+
type SidebarMerged = MergeLibDefaults<SidebarOwnProps, SidebarLibDefaults>;
|
|
5
|
+
export declare function useSidebarShell(props: SidebarOwnProps, libDefaults: SidebarLibDefaults): {
|
|
6
|
+
slots: Readonly<{
|
|
7
|
+
[name: string]: import('vue').Slot<any> | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
merged: import('vue').ComputedRef<SidebarMerged>;
|
|
10
|
+
panelId: string;
|
|
11
|
+
gapBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
12
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
13
|
+
"data-side": NonNullable<keyof import('@bridge-ui/core/Tokens').SidebarSide | undefined>;
|
|
14
|
+
"data-state": import('@bridge-ui/core/Domain').SidebarState;
|
|
15
|
+
"data-variant": NonNullable<keyof import('@bridge-ui/core/Tokens').SidebarVariant | undefined>;
|
|
16
|
+
"data-collapsible": "" | import('@bridge-ui/core/Domain').SidebarCollapsibleMode;
|
|
17
|
+
"data-mobile": string;
|
|
18
|
+
class: string;
|
|
19
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<SidebarProps, "classes" | "customProps" | "variant" | "ariaLabel" | "collapsible" | "side">, never>>>;
|
|
20
|
+
asideBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
21
|
+
"data-side": NonNullable<keyof import('@bridge-ui/core/Tokens').SidebarSide | undefined>;
|
|
22
|
+
"aria-label": string;
|
|
23
|
+
inert: boolean | undefined;
|
|
24
|
+
id: string | undefined;
|
|
25
|
+
class: string;
|
|
26
|
+
}, "class", {}, {}>>;
|
|
27
|
+
panelBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
28
|
+
headerBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
29
|
+
footerBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
30
|
+
contentBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
31
|
+
mobileWidth: import('vue').ComputedRef<string>;
|
|
32
|
+
showAsDrawer: import('vue').ComputedRef<boolean>;
|
|
33
|
+
drawerPanelStyle: import('vue').ComputedRef<{
|
|
34
|
+
width: string;
|
|
35
|
+
maxWidth: string;
|
|
36
|
+
}>;
|
|
37
|
+
isMobile: import('vue').ComputedRef<boolean>;
|
|
38
|
+
openMobile: import('vue').ComputedRef<boolean>;
|
|
39
|
+
setOpenMobile: (next: boolean) => void;
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
+
import { useSidebar as r } from "./useSidebar.js";
|
|
3
|
+
import { computed as i, useAttrs as a, useId as o, useSlots as s, watch as c } from "vue";
|
|
4
|
+
import { get as l, omit as u } from "es-toolkit/compat";
|
|
5
|
+
import { getSidebarPanelId as d, resolveSidebarCollapsibleData as f, shouldRenderSidebarAsDrawer as p } from "@bridge-ui/core/Domain";
|
|
6
|
+
import { sidebarCollapsibleProps as m, sidebarSideProps as h, sidebarVariantProps as g, sidebarWidthProps as _ } from "@bridge-ui/core/Tokens";
|
|
7
|
+
import { cn as v, mergeBridgeUILayeredClasses as y, splitComponentProps as b } from "@bridge-ui/core/Utils";
|
|
8
|
+
import { toMerged as x } from "es-toolkit/object";
|
|
9
|
+
//#region src/Components/Sidebar/composables/useSidebarShell.ts
|
|
10
|
+
var S = [
|
|
11
|
+
"side",
|
|
12
|
+
"classes",
|
|
13
|
+
"variant",
|
|
14
|
+
"ariaLabel",
|
|
15
|
+
"collapsible",
|
|
16
|
+
"customProps"
|
|
17
|
+
];
|
|
18
|
+
function C(C, w) {
|
|
19
|
+
let T = o(), E = d(`bridge-sidebar${T}`), D = a(), O = s(), k = r(), A = i(() => b({
|
|
20
|
+
props: {
|
|
21
|
+
...D,
|
|
22
|
+
...C
|
|
23
|
+
},
|
|
24
|
+
bridgeKeys: S
|
|
25
|
+
})), { merged: j, entry: M } = t({
|
|
26
|
+
libDefaults: w,
|
|
27
|
+
componentName: "Sidebar",
|
|
28
|
+
props: () => A.value.componentProps
|
|
29
|
+
}), N = i(() => j.value.customProps), P = n({
|
|
30
|
+
entry: M,
|
|
31
|
+
props: () => A.value.componentProps
|
|
32
|
+
});
|
|
33
|
+
c(() => ({
|
|
34
|
+
panelId: E,
|
|
35
|
+
side: j.value.side,
|
|
36
|
+
variant: j.value.variant,
|
|
37
|
+
collapsible: j.value.collapsible
|
|
38
|
+
}), (e) => {
|
|
39
|
+
k.value.setLayout(e);
|
|
40
|
+
}, { immediate: !0 });
|
|
41
|
+
let F = i(() => {
|
|
42
|
+
let e = y(g, M.value?.tokens?.variant);
|
|
43
|
+
return l(e, j.value.variant);
|
|
44
|
+
}), I = i(() => {
|
|
45
|
+
let e = y(m, M.value?.tokens?.collapsible);
|
|
46
|
+
return l(e, j.value.collapsible);
|
|
47
|
+
}), L = i(() => {
|
|
48
|
+
let e = y(h, M.value?.tokens?.side);
|
|
49
|
+
return l(e, j.value.side);
|
|
50
|
+
}), R = i(() => f(k.value.state, j.value.collapsible)), z = i(() => p(k.value.isMobile) && k.value.openMobile), B = i(() => u(A.value.inheritedAttrs, [])), V = i(() => e(N.value?.root, B.value, {
|
|
51
|
+
"data-side": j.value.side,
|
|
52
|
+
"data-state": k.value.state,
|
|
53
|
+
"data-variant": j.value.variant,
|
|
54
|
+
"data-collapsible": R.value,
|
|
55
|
+
"data-mobile": k.value.isMobile ? "true" : "false",
|
|
56
|
+
class: v({
|
|
57
|
+
"group peer hidden text-dark-900 md:block dark:text-dark-100": !0,
|
|
58
|
+
[l(P.value, "root") ?? ""]: !0
|
|
59
|
+
})
|
|
60
|
+
})), H = i(() => e(N.value?.gap, {}, v({
|
|
61
|
+
[l(F.value, "gap") ?? ""]: !0,
|
|
62
|
+
[l(I.value, "gap") ?? ""]: !0,
|
|
63
|
+
[l(P.value, "gap") ?? ""]: !0
|
|
64
|
+
}))), U = i(() => {
|
|
65
|
+
let t = R.value === "offcanvas";
|
|
66
|
+
return e({}, {}, {
|
|
67
|
+
"data-side": j.value.side,
|
|
68
|
+
"aria-label": j.value.ariaLabel,
|
|
69
|
+
inert: t ? !0 : void 0,
|
|
70
|
+
id: z.value ? void 0 : E,
|
|
71
|
+
class: v({
|
|
72
|
+
"fixed inset-y-0 z-10 hidden h-full w-[var(--bridge-sidebar-width)] overflow-hidden transition-[left,right,width] duration-200 ease-linear md:flex": !0,
|
|
73
|
+
[L.value ?? ""]: !0,
|
|
74
|
+
[l(I.value, "panel") ?? ""]: !0
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}), W = i(() => e(N.value?.panel, {}, v({
|
|
78
|
+
"flex h-full w-full flex-col overflow-hidden": !0,
|
|
79
|
+
[l(F.value, "panel") ?? ""]: !0,
|
|
80
|
+
[l(P.value, "panel") ?? ""]: !0
|
|
81
|
+
}))), G = i(() => e(N.value?.header, {}, v({
|
|
82
|
+
"flex shrink-0 flex-col gap-2 px-2 py-2.5": !0,
|
|
83
|
+
[l(P.value, "header") ?? ""]: !0
|
|
84
|
+
}))), K = i(() => e(N.value?.content, {}, v({
|
|
85
|
+
"bridge-scroll-fade-y flex min-h-0 flex-1 flex-col overflow-y-auto": !0,
|
|
86
|
+
[l(P.value, "content") ?? ""]: !0
|
|
87
|
+
}))), q = i(() => e(N.value?.footer, {}, v({
|
|
88
|
+
"flex shrink-0 flex-col gap-2 px-2 py-2.5": !0,
|
|
89
|
+
[l(P.value, "footer") ?? ""]: !0
|
|
90
|
+
}))), J = i(() => x(_, M.value?.tokens?.width ?? {}).mobile);
|
|
91
|
+
return {
|
|
92
|
+
slots: O,
|
|
93
|
+
merged: j,
|
|
94
|
+
panelId: E,
|
|
95
|
+
gapBind: H,
|
|
96
|
+
rootBind: V,
|
|
97
|
+
asideBind: U,
|
|
98
|
+
panelBind: W,
|
|
99
|
+
headerBind: G,
|
|
100
|
+
footerBind: q,
|
|
101
|
+
contentBind: K,
|
|
102
|
+
mobileWidth: J,
|
|
103
|
+
showAsDrawer: z,
|
|
104
|
+
drawerPanelStyle: i(() => ({
|
|
105
|
+
width: J.value,
|
|
106
|
+
maxWidth: `min(${J.value}, 88vw)`
|
|
107
|
+
})),
|
|
108
|
+
isMobile: i(() => k.value.isMobile),
|
|
109
|
+
openMobile: i(() => k.value.openMobile),
|
|
110
|
+
setOpenMobile: (e) => {
|
|
111
|
+
k.value.setOpenMobile(e);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { C as useSidebarShell };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSlots } from 'vue';
|
|
2
|
+
export declare function useSidebarTrigger(slots: ReturnType<typeof useSlots>): {
|
|
3
|
+
expanded: import('vue').ComputedRef<boolean>;
|
|
4
|
+
iconClass: import('vue').ComputedRef<"rotate-180 rtl:rotate-0" | "rtl:rotate-180">;
|
|
5
|
+
ariaLabel: import('vue').ComputedRef<string>;
|
|
6
|
+
handleClick: (event: MouseEvent) => void;
|
|
7
|
+
hasDefaultSlot: import('vue').ComputedRef<boolean>;
|
|
8
|
+
attrs: import('vue').ComputedRef<Omit<import('vue').Attrs, "onClick" | "aria-label">>;
|
|
9
|
+
panelId: import('vue').ComputedRef<string>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { hasNamedSlot as e } from "../../../Utils/slotOrProp.js";
|
|
2
|
+
import { useSidebar as t } from "./useSidebar.js";
|
|
3
|
+
import { computed as n, useAttrs as r } from "vue";
|
|
4
|
+
import { omit as i } from "es-toolkit/compat";
|
|
5
|
+
//#region src/Components/Sidebar/composables/useSidebarTrigger.ts
|
|
6
|
+
function a(a) {
|
|
7
|
+
let o = t(), s = r(), c = n(() => e(a, "default"));
|
|
8
|
+
return {
|
|
9
|
+
expanded: n(() => o.value.isMobile ? o.value.openMobile : o.value.open),
|
|
10
|
+
iconClass: n(() => o.value.side === "right" ? "rotate-180 rtl:rotate-0" : "rtl:rotate-180"),
|
|
11
|
+
ariaLabel: n(() => {
|
|
12
|
+
let e = s["aria-label"];
|
|
13
|
+
return typeof e == "string" ? e : "Toggle sidebar";
|
|
14
|
+
}),
|
|
15
|
+
handleClick: (e) => {
|
|
16
|
+
let t = s.onClick;
|
|
17
|
+
typeof t == "function" && t(e), !e.defaultPrevented && o.value.toggleSidebar();
|
|
18
|
+
},
|
|
19
|
+
hasDefaultSlot: c,
|
|
20
|
+
attrs: n(() => i(s, ["onClick", "aria-label"])),
|
|
21
|
+
panelId: n(() => o.value.panelId)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as useSidebarTrigger };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { useSidebar } from './composables/useSidebar';
|
|
2
|
+
export { useSidebarInset } from './composables/useSidebarInset';
|
|
3
|
+
export { useSidebarList } from './composables/useSidebarList';
|
|
4
|
+
export { useSidebarListItem } from './composables/useSidebarListItem';
|
|
5
|
+
export { useSidebarProvider } from './composables/useSidebarProvider';
|
|
6
|
+
export { useSidebarShell } from './composables/useSidebarShell';
|
|
7
|
+
export { useSidebarTrigger } from './composables/useSidebarTrigger';
|
|
8
|
+
export type { SidebarClasses, SidebarCollapsibleOverrides, SidebarCustomProps, SidebarInsetClasses, SidebarInsetCustomProps, SidebarInsetOwnProps, SidebarInsetProps, SidebarInsetSlots, SidebarListItemOwnProps, SidebarListItemProps, SidebarListOwnProps, SidebarListProps, SidebarOwnProps, SidebarProps, SidebarProviderClasses, SidebarProviderCustomProps, SidebarProviderEmits, SidebarProviderOwnProps, SidebarProviderProps, SidebarProviderSlots, SidebarSideOverrides, SidebarSlots, SidebarTriggerOwnProps, SidebarTriggerProps, SidebarTriggerSlots, SidebarVariantOverrides, } from './sidebar.types';
|
|
9
|
+
export { default as Sidebar } from './Sidebar.vue';
|
|
10
|
+
export { SIDEBAR_INJECTION_KEY, type SidebarContextValue, type SidebarLayout, } from './sidebarInjectionKey';
|
|
11
|
+
export { default as SidebarInset } from './SidebarInset.vue';
|
|
12
|
+
export { default as SidebarList } from './SidebarList.vue';
|
|
13
|
+
export { default as SidebarListItem } from './SidebarListItem.vue';
|
|
14
|
+
export { default as SidebarProvider } from './SidebarProvider.vue';
|
|
15
|
+
export { default as SidebarTrigger } from './SidebarTrigger.vue';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SIDEBAR_INJECTION_KEY as e } from "./sidebarInjectionKey.js";
|
|
2
|
+
import { useSidebar as t } from "./composables/useSidebar.js";
|
|
3
|
+
import { useSidebarInset as n } from "./composables/useSidebarInset.js";
|
|
4
|
+
import { useSidebarList as r } from "./composables/useSidebarList.js";
|
|
5
|
+
import { useSidebarListItem as i } from "./composables/useSidebarListItem.js";
|
|
6
|
+
import { useSidebarProvider as a } from "./composables/useSidebarProvider.js";
|
|
7
|
+
import { useSidebarShell as o } from "./composables/useSidebarShell.js";
|
|
8
|
+
import { useSidebarTrigger as s } from "./composables/useSidebarTrigger.js";
|
|
9
|
+
import c from "./Sidebar.js";
|
|
10
|
+
import l from "./SidebarInset.js";
|
|
11
|
+
import u from "./SidebarList.js";
|
|
12
|
+
import d from "./SidebarListItem.js";
|
|
13
|
+
import f from "./SidebarProvider.js";
|
|
14
|
+
import p from "./SidebarTrigger.js";
|
|
15
|
+
export { e as SIDEBAR_INJECTION_KEY, c as Sidebar, l as SidebarInset, u as SidebarList, d as SidebarListItem, f as SidebarProvider, p as SidebarTrigger, t as useSidebar, n as useSidebarInset, r as useSidebarList, i as useSidebarListItem, a as useSidebarProvider, o as useSidebarShell, s as useSidebarTrigger };
|