@bridge-ui/vue 0.0.1-beta.4 → 0.0.1-beta.6
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/Components/Divider/composables/useDivider.js +1 -1
- package/dist/Components/List/List.vue.d.ts +0 -1
- package/dist/Components/List/List.vue_vue_type_script_setup_true_lang.js +2 -3
- package/dist/Components/List/composables/useList.d.ts +3 -9
- package/dist/Components/List/composables/useList.js +21 -25
- package/dist/Components/List/index.d.ts +1 -1
- package/dist/Components/List/list.types.d.ts +1 -8
- package/dist/Components/ListItem/ListItem.vue.d.ts +0 -1
- package/dist/Components/ListItem/ListItem.vue_vue_type_script_setup_true_lang.js +21 -22
- package/dist/Components/ListItem/composables/useListItem.d.ts +18 -18
- package/dist/Components/ListItem/composables/useListItem.js +100 -68
- package/dist/Components/ListItem/index.d.ts +1 -1
- package/dist/Components/ListItem/listItem.types.d.ts +24 -8
- package/dist/Components/ListSection/composables/useListSection.d.ts +1 -3
- package/dist/Components/ListSection/composables/useListSection.js +6 -5
- package/dist/Components/Listbox/Listbox.vue.d.ts +5 -2
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +101 -62
- package/dist/Components/Listbox/index.d.ts +2 -1
- package/dist/Components/Listbox/index.js +3 -2
- package/dist/Components/Listbox/listbox.types.d.ts +21 -4
- package/dist/Components/Listbox/listboxInjectionKey.d.ts +23 -0
- package/dist/Components/Listbox/listboxInjectionKey.js +4 -0
- package/dist/Components/Menu/Menu.vue.d.ts +2 -2
- package/dist/Components/Menu/composables/useMenu.d.ts +1 -3
- package/dist/Components/Menu/composables/useMenu.js +2 -2
- package/dist/Components/Modal/composables/useModal.d.ts +1 -1
- package/dist/Components/Select/Select.vue_vue_type_script_setup_true_lang.js +68 -57
- package/dist/Components/Select/SelectOption.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Components/Select/composables/useSelect.d.ts +5 -1
- package/dist/Components/Select/composables/useSelect.js +187 -154
- package/dist/Components/Select/select.types.d.ts +12 -5
- package/dist/augments.d.ts +2 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/package.json +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ListOwnProps } from './list.types';
|
|
2
2
|
declare const __VLS_export: import('vue').DefineComponent<ListOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ListOwnProps> & Readonly<{}>, {
|
|
3
|
-
padding: import('@bridge-ui/core').MergeProps<import('@bridge-ui/core').ListPadding, import('./list.types').ListPaddingOverrides>;
|
|
4
3
|
as: "ol" | "ul" | "nav";
|
|
5
4
|
dense: boolean;
|
|
6
5
|
nested: boolean;
|
|
@@ -16,11 +16,10 @@ var f = /* @__PURE__ */ i({
|
|
|
16
16
|
nested: {
|
|
17
17
|
type: Boolean,
|
|
18
18
|
default: !1
|
|
19
|
-
}
|
|
20
|
-
padding: { default: "normal" }
|
|
19
|
+
}
|
|
21
20
|
},
|
|
22
21
|
setup(i) {
|
|
23
|
-
let f = u(), { merged: p, rootBind: m } = t(i
|
|
22
|
+
let f = u(), { merged: p, rootBind: m } = t(i), h = n(() => p.value.as ?? "ul");
|
|
24
23
|
return (t, n) => (s(), r(c(h.value), o(a(l(m))), {
|
|
25
24
|
default: d(() => [(s(), r(c(l(e)(l(f), "default"))))]),
|
|
26
25
|
_: 1
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core';
|
|
2
1
|
import { ListOwnProps, ListProps } from '../list.types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
merged: import('vue').ComputedRef<ListMerged>;
|
|
7
|
-
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
8
|
-
class: string;
|
|
9
|
-
}, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<ListProps, "classes" | "customProps" | "padding" | "as" | "dense" | "nested">, never>>>;
|
|
2
|
+
export declare function useList(props: ListOwnProps): {
|
|
3
|
+
merged: import('vue').ComputedRef<ListOwnProps>;
|
|
4
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<ListProps, "classes" | "customProps" | "as" | "dense" | "nested">, never>>>;
|
|
10
5
|
};
|
|
11
|
-
export {};
|
|
@@ -2,43 +2,39 @@ import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistr
|
|
|
2
2
|
import { LIST_INJECTION_KEY as r } from "../listInjectionKey.js";
|
|
3
3
|
import { computed as i, provide as a, useAttrs as o } from "vue";
|
|
4
4
|
import { get as s, omit as c } from "es-toolkit/compat";
|
|
5
|
-
import { cn as l,
|
|
6
|
-
import { paddingProps as f } from "@bridge-ui/core/Components/List";
|
|
5
|
+
import { cn as l, splitComponentProps as u } from "@bridge-ui/core";
|
|
7
6
|
//#region src/Components/List/composables/useList.ts
|
|
8
|
-
var
|
|
7
|
+
var d = [
|
|
9
8
|
"as",
|
|
10
9
|
"dense",
|
|
11
10
|
"nested",
|
|
12
11
|
"classes",
|
|
13
|
-
"padding",
|
|
14
12
|
"customProps"
|
|
15
13
|
];
|
|
16
|
-
function
|
|
17
|
-
let
|
|
18
|
-
bridgeKeys:
|
|
14
|
+
function f(f) {
|
|
15
|
+
let p = o(), m = i(() => u({
|
|
16
|
+
bridgeKeys: d,
|
|
19
17
|
props: {
|
|
20
|
-
...
|
|
21
|
-
...
|
|
18
|
+
...p,
|
|
19
|
+
...f
|
|
22
20
|
}
|
|
23
|
-
})), { merged:
|
|
24
|
-
libDefaults: h,
|
|
21
|
+
})), { merged: h, entry: g } = t({
|
|
25
22
|
componentName: "List",
|
|
26
|
-
props: () =>
|
|
27
|
-
}),
|
|
28
|
-
entry:
|
|
29
|
-
props: () =>
|
|
23
|
+
props: () => m.value.componentProps
|
|
24
|
+
}), _ = i(() => h.value.customProps), v = n({
|
|
25
|
+
entry: g,
|
|
26
|
+
props: () => m.value.componentProps
|
|
30
27
|
});
|
|
31
|
-
a(r, i(() => ({ dense:
|
|
32
|
-
let
|
|
28
|
+
a(r, i(() => ({ dense: h.value.dense === !0 })));
|
|
29
|
+
let y = i(() => c(m.value.inheritedAttrs, []));
|
|
33
30
|
return {
|
|
34
|
-
merged:
|
|
35
|
-
rootBind: i(() => e(
|
|
36
|
-
"m-0 list-none": !0,
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
}) }))
|
|
31
|
+
merged: h,
|
|
32
|
+
rootBind: i(() => e(_.value?.root, y.value, l({
|
|
33
|
+
"m-0 list-none py-2": !0,
|
|
34
|
+
"pl-4": h.value.nested,
|
|
35
|
+
[s(v.value, "root") ?? ""]: !0
|
|
36
|
+
})))
|
|
41
37
|
};
|
|
42
38
|
}
|
|
43
39
|
//#endregion
|
|
44
|
-
export {
|
|
40
|
+
export { f as useList };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useList } from './composables/useList';
|
|
2
|
-
export type { ListClasses, ListCustomProps, ListOwnProps,
|
|
2
|
+
export type { ListClasses, ListCustomProps, ListOwnProps, ListProps, } from './list.types';
|
|
3
3
|
export { default as List } from './List.vue';
|
|
4
4
|
export { LIST_INJECTION_KEY } from './listInjectionKey';
|
|
5
5
|
export type { ListContextValue } from './listInjectionKey';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
export interface ListPaddingOverrides {}
|
|
2
|
+
import { MergeHtmlProps } from '@bridge-ui/core';
|
|
4
3
|
export interface ListClasses {
|
|
5
4
|
/**
|
|
6
5
|
* The classes to apply to the root.
|
|
@@ -47,11 +46,5 @@ export interface ListOwnProps {
|
|
|
47
46
|
* @default false
|
|
48
47
|
*/
|
|
49
48
|
nested?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Root padding preset. Use `"none"` inside menus/cards (MUI `disablePadding`).
|
|
52
|
-
*
|
|
53
|
-
* @default "normal"
|
|
54
|
-
*/
|
|
55
|
-
padding?: MergeProps<ListPadding, ListPaddingOverrides>;
|
|
56
49
|
}
|
|
57
50
|
export type ListProps = MergeHtmlProps<ListOwnProps, HTMLAttributes>;
|
|
@@ -4,7 +4,6 @@ declare const __VLS_base: import('vue').DefineComponent<ListItemOwnProps, {}, {}
|
|
|
4
4
|
role: "button" | "option" | "menuitem";
|
|
5
5
|
as: "li" | "div";
|
|
6
6
|
disabled: boolean;
|
|
7
|
-
align: import('@bridge-ui/core').MergeProps<import('@bridge-ui/core').ListItemAlign, import('./listItem.types').ListItemAlignOverrides>;
|
|
8
7
|
divider: boolean;
|
|
9
8
|
interactive: boolean;
|
|
10
9
|
selected: boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { hasNamedSlot as e, resolveNamedSlot as t, resolveSlotOrProp as n } from "../../Utils/slotOrProp.js";
|
|
2
|
+
import r from "../Icon/Icon.js";
|
|
3
|
+
import { resolveListItemPrimary as i, useListItem as a } from "./composables/useListItem.js";
|
|
4
|
+
import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, defineComponent as d, guardReactiveProps as f, mergeProps as p, normalizeClass as m, normalizeProps as h, openBlock as g, resolveDynamicComponent as _, unref as v, useSlots as y, withCtx as b } from "vue";
|
|
4
5
|
//#region src/Components/ListItem/ListItem.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
6
|
+
var x = /* @__PURE__ */ d({
|
|
6
7
|
inheritAttrs: !1,
|
|
7
8
|
__name: "ListItem",
|
|
8
9
|
props: {
|
|
9
|
-
align: { default: "center" },
|
|
10
10
|
as: { default: "li" },
|
|
11
11
|
classes: {},
|
|
12
12
|
customProps: {},
|
|
@@ -29,29 +29,28 @@ var y = /* @__PURE__ */ l({
|
|
|
29
29
|
selected: {
|
|
30
30
|
type: Boolean,
|
|
31
31
|
default: !1
|
|
32
|
-
}
|
|
32
|
+
},
|
|
33
|
+
selectedIcon: {},
|
|
34
|
+
value: {}
|
|
33
35
|
},
|
|
34
|
-
setup(
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
c("div", p(u(g(k))), [g(O) ? (m(), s("span", p(d({ key: 0 }, g(A))), [(m(), a(h(F.value)))], 16)) : o("", !0), g(j) ? (m(), s("span", p(d({ key: 1 }, g(M))), [(m(), a(h(I.value)))], 16)) : o("", !0)], 16),
|
|
43
|
-
g(S) ? (m(), s("div", p(d({ key: 1 }, g(C))), [(m(), a(h(g(e)(g(y), "end"))))], 16)) : o("", !0)
|
|
44
|
-
], 2)], 16)) : (m(), s("div", {
|
|
36
|
+
setup(d) {
|
|
37
|
+
let x = y(), S = d, { merged: C, hasEnd: w, endBind: T, rootBind: E, rowClass: D, hasStart: O, startBind: k, hasPrimary: A, contentBind: j, primaryBind: M, hasSecondary: N, secondaryBind: P, interactiveBind: F, selectedIconBind: I, resolvedSelectedIcon: L } = a(S, { role: "button" }, x), R = o(() => C.value.as ?? "li"), z = o(() => i(x, S.primary)), B = o(() => n(x, "secondary", S.secondary)), V = o(() => e(x, "end"));
|
|
38
|
+
return (e, n) => (g(), s(_(R.value), h(f(v(E))), {
|
|
39
|
+
default: b(() => [v(F) ? (g(), l("div", h(p({ key: 0 }, v(F))), [u("div", { class: m(v(D)) }, [
|
|
40
|
+
v(O) ? (g(), l("div", h(p({ key: 0 }, v(k))), [(g(), s(_(v(t)(v(x), "start"))))], 16)) : c("", !0),
|
|
41
|
+
u("div", h(f(v(j))), [v(A) ? (g(), l("span", h(p({ key: 0 }, v(M))), [(g(), s(_(z.value)))], 16)) : c("", !0), v(N) ? (g(), l("span", h(p({ key: 1 }, v(P))), [(g(), s(_(B.value)))], 16)) : c("", !0)], 16),
|
|
42
|
+
v(w) ? (g(), l("div", h(p({ key: 1 }, v(T))), [V.value ? (g(), s(_(v(t)(v(x), "end")), { key: 0 })) : v(L) ? (g(), s(r, p({ key: 1 }, v(I), { icon: v(L) }), null, 16, ["icon"])) : c("", !0)], 16)) : c("", !0)
|
|
43
|
+
], 2)], 16)) : (g(), l("div", {
|
|
45
44
|
key: 1,
|
|
46
|
-
class:
|
|
45
|
+
class: m(v(D))
|
|
47
46
|
}, [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
v(O) ? (g(), l("div", h(p({ key: 0 }, v(k))), [(g(), s(_(v(t)(v(x), "start"))))], 16)) : c("", !0),
|
|
48
|
+
u("div", h(f(v(j))), [v(A) ? (g(), l("span", h(p({ key: 0 }, v(M))), [(g(), s(_(z.value)))], 16)) : c("", !0), v(N) ? (g(), l("span", h(p({ key: 1 }, v(P))), [(g(), s(_(B.value)))], 16)) : c("", !0)], 16),
|
|
49
|
+
v(w) ? (g(), l("div", h(p({ key: 1 }, v(T))), [V.value ? (g(), s(_(v(t)(v(x), "end")), { key: 0 })) : v(L) ? (g(), s(r, p({ key: 1 }, v(I), { icon: v(L) }), null, 16, ["icon"])) : c("", !0)], 16)) : c("", !0)
|
|
51
50
|
], 2))]),
|
|
52
51
|
_: 1
|
|
53
52
|
}, 16));
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
55
|
//#endregion
|
|
57
|
-
export {
|
|
56
|
+
export { x as default };
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
+
import { LucideIcon } from '@lucide/vue';
|
|
1
2
|
import { useSlots, Slot } from 'vue';
|
|
2
3
|
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core';
|
|
3
4
|
import { ListItemOwnProps, ListItemProps } from '../listItem.types';
|
|
4
|
-
type ListItemLibDefaults = LibDefaultsShape<ListItemOwnProps, "role"
|
|
5
|
+
type ListItemLibDefaults = LibDefaultsShape<ListItemOwnProps, "role">;
|
|
5
6
|
type ListItemMerged = MergeLibDefaults<ListItemOwnProps, ListItemLibDefaults>;
|
|
6
7
|
export declare function useListItem(props: ListItemOwnProps, libDefaults: ListItemLibDefaults, slots: ReturnType<typeof useSlots>): {
|
|
7
8
|
merged: import('vue').ComputedRef<ListItemMerged>;
|
|
8
9
|
hasEnd: import('vue').ComputedRef<boolean>;
|
|
9
|
-
endBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
10
|
-
class: string;
|
|
11
|
-
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
10
|
+
endBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
12
11
|
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
13
12
|
class: string;
|
|
14
|
-
|
|
13
|
+
id: string | undefined;
|
|
14
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<ListItemProps, "role" | "value" | "classes" | "customProps" | "primary" | "secondary" | "as" | "disabled" | "dense" | "divider" | "interactive" | "selected" | "selectedIcon">, never>>>;
|
|
15
15
|
rowClass: import('vue').ComputedRef<string>;
|
|
16
16
|
hasStart: import('vue').ComputedRef<boolean>;
|
|
17
|
-
startBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
18
|
-
class: string;
|
|
19
|
-
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
17
|
+
startBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
20
18
|
hasPrimary: import('vue').ComputedRef<boolean>;
|
|
21
|
-
contentBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
22
|
-
|
|
23
|
-
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
24
|
-
primaryBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
25
|
-
class: string;
|
|
26
|
-
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
19
|
+
contentBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
20
|
+
primaryBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
27
21
|
hasSecondary: import('vue').ComputedRef<boolean>;
|
|
28
|
-
secondaryBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
29
|
-
class: string;
|
|
30
|
-
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
22
|
+
secondaryBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
31
23
|
interactiveBind: import('vue').ComputedRef<({
|
|
24
|
+
"aria-disabled": boolean | undefined;
|
|
32
25
|
role: NonNullable<"button" | "option" | "menuitem" | undefined>;
|
|
33
26
|
tabindex: number;
|
|
34
|
-
"aria-disabled": boolean | undefined;
|
|
35
27
|
"data-selected": boolean | undefined;
|
|
28
|
+
"aria-selected": boolean | undefined;
|
|
29
|
+
onMousedown: ((event: MouseEvent) => void) | undefined;
|
|
30
|
+
onClick: (() => void) | undefined;
|
|
36
31
|
class: string;
|
|
37
32
|
} & object & Record<"class", string>) | null>;
|
|
33
|
+
selectedIconBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
34
|
+
size: "sm";
|
|
35
|
+
class: string;
|
|
36
|
+
}, "class", Partial<Omit<import('../../Icon').IconProps, "icon">> | undefined, {}>>;
|
|
37
|
+
resolvedSelectedIcon: import('vue').ComputedRef<LucideIcon | null>;
|
|
38
38
|
};
|
|
39
39
|
export declare function resolveListItemPrimary(slots: ReturnType<typeof useSlots>, primary?: string): Slot | (() => null | string);
|
|
40
40
|
export {};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { hasNamedSlot as e, isPropPresent as t, resolveNamedSlot as n } from "../../../Utils/slotOrProp.js";
|
|
2
2
|
import { mergePartBind as r, useBridgeUIComponent as i, useBridgeUIMergedRegistryClasses as a } from "../../../Utils/index.js";
|
|
3
3
|
import { LIST_INJECTION_KEY as o } from "../../List/listInjectionKey.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { getListboxOptionId as s } from "../../Listbox/composables/useListboxNavigation.js";
|
|
5
|
+
import { LISTBOX_INJECTION_KEY as c } from "../../Listbox/listboxInjectionKey.js";
|
|
6
|
+
import { computed as l, getCurrentInstance as u, inject as d, onBeforeUnmount as f, toValue as p, useAttrs as m, watch as h } from "vue";
|
|
7
|
+
import { get as g, isNull as _, omit as v } from "es-toolkit/compat";
|
|
8
|
+
import { cn as y, splitComponentProps as b } from "@bridge-ui/core";
|
|
9
|
+
import { Check as x } from "@lucide/vue";
|
|
8
10
|
//#region src/Components/ListItem/composables/useListItem.ts
|
|
9
|
-
var
|
|
11
|
+
var S = [
|
|
10
12
|
"as",
|
|
11
13
|
"role",
|
|
12
|
-
"align",
|
|
13
14
|
"dense",
|
|
15
|
+
"value",
|
|
14
16
|
"classes",
|
|
15
17
|
"divider",
|
|
16
18
|
"primary",
|
|
@@ -18,82 +20,112 @@ var v = [
|
|
|
18
20
|
"selected",
|
|
19
21
|
"secondary",
|
|
20
22
|
"customProps",
|
|
21
|
-
"interactive"
|
|
23
|
+
"interactive",
|
|
24
|
+
"selectedIcon"
|
|
22
25
|
];
|
|
23
|
-
function
|
|
24
|
-
let
|
|
26
|
+
function C(t, n, C) {
|
|
27
|
+
let w = m(), T = d(o, null), E = d(c, null), D = E != null, O = l(() => b({
|
|
25
28
|
props: {
|
|
26
|
-
...
|
|
29
|
+
...w,
|
|
27
30
|
...t
|
|
28
31
|
},
|
|
29
|
-
bridgeKeys:
|
|
30
|
-
})), { merged:
|
|
32
|
+
bridgeKeys: S
|
|
33
|
+
})), { merged: k, entry: A } = i({
|
|
31
34
|
libDefaults: n,
|
|
32
35
|
componentName: "ListItem",
|
|
33
|
-
props: () =>
|
|
34
|
-
}),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
props: () => O.value.componentProps
|
|
37
|
+
}), j = l(() => E ? p(E) : null), M = l(() => k.value.value == null || !D ? null : {
|
|
38
|
+
value: k.value.value,
|
|
39
|
+
description: k.value.secondary,
|
|
40
|
+
disabled: !!k.value.disabled,
|
|
41
|
+
label: k.value.primary ?? String(k.value.value)
|
|
42
|
+
}), N;
|
|
43
|
+
h(() => {
|
|
44
|
+
let e = M.value;
|
|
45
|
+
return e ? `${String(e.value)}:${e.label}:${e.disabled}:${e.description ?? ""}` : null;
|
|
46
|
+
}, () => {
|
|
47
|
+
N?.(), N = void 0;
|
|
48
|
+
let e = M.value;
|
|
49
|
+
!e || !E || (N = p(E).registerOption(e));
|
|
50
|
+
}, { immediate: !0 }), f(() => {
|
|
51
|
+
N?.();
|
|
52
|
+
});
|
|
53
|
+
let P = l(() => M.value != null), F = l(() => !M.value || !j.value ? !1 : j.value.isSelected(M.value.value)), I = l(() => !M.value || !j.value ? -1 : j.value.getOptionIndex(M.value.value)), L = l(() => !j.value || I.value < 0 ? !1 : j.value.highlightedIndex === I.value), R = l(() => k.value.customProps), z = a({
|
|
54
|
+
entry: A,
|
|
55
|
+
props: () => O.value.componentProps
|
|
56
|
+
}), B = l(() => "dense" in (u()?.vnode.props ?? {}) ? t.dense === !0 : t.dense === !0 ? !0 : T ? p(T).dense : !1), V = l(() => e(C, "primary") || e(C, "default") || !!k.value.primary), H = l(() => e(C, "secondary") || !!k.value.secondary), U = l(() => e(C, "start")), W = l(() => P.value ? !F.value || !j.value?.showCheckmark ? null : x : !k.value.selected || _(k.value.selectedIcon) ? null : k.value.selectedIcon ?? x), G = l(() => e(C, "end") || W.value != null), K = l(() => v(O.value.inheritedAttrs, [])), q = l(() => r(R.value?.root, K.value, {
|
|
57
|
+
class: y({
|
|
58
|
+
"list-none": !0,
|
|
59
|
+
"border-b border-black/10 last:border-b-0": k.value.divider,
|
|
60
|
+
[g(z.value, "root") ?? ""]: !0
|
|
61
|
+
}),
|
|
62
|
+
id: P.value && j.value?.listboxId && I.value >= 0 ? s(j.value.listboxId, I.value) : void 0
|
|
63
|
+
})), J = l(() => k.value.interactive || P.value ? r(R.value?.interactive, {}, {
|
|
64
|
+
"aria-disabled": k.value.disabled ? !0 : void 0,
|
|
65
|
+
role: P.value ? "option" : k.value.role,
|
|
66
|
+
tabindex: k.value.disabled || P.value ? -1 : 0,
|
|
67
|
+
"data-selected": k.value.selected || F.value ? !0 : void 0,
|
|
68
|
+
"aria-selected": P.value ? F.value : void 0,
|
|
69
|
+
onMousedown: P.value ? (e) => {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
} : void 0,
|
|
72
|
+
onClick: P.value ? () => {
|
|
73
|
+
M.value && j.value?.onSelect(M.value);
|
|
74
|
+
} : void 0,
|
|
75
|
+
class: y({
|
|
76
|
+
"flex w-full min-w-0 items-center gap-x-3 text-left outline-hidden transition-colors": !0,
|
|
77
|
+
"cursor-pointer select-none": !k.value.disabled,
|
|
49
78
|
"px-4": !0,
|
|
50
|
-
"py-2": !
|
|
51
|
-
"py-1.5":
|
|
52
|
-
"hover:bg-black/5 focus-visible:bg-black/5": !
|
|
53
|
-
"bg-primary-50 text-primary-700":
|
|
54
|
-
|
|
55
|
-
[
|
|
56
|
-
[
|
|
79
|
+
"py-2": !B.value,
|
|
80
|
+
"py-1.5": B.value,
|
|
81
|
+
"hover:bg-black/5 focus-visible:bg-black/5": !k.value.disabled && !P.value,
|
|
82
|
+
"bg-primary-50 text-primary-700": k.value.selected && !P.value,
|
|
83
|
+
[j.value?.optionSelectedClass ?? ""]: P.value && F.value,
|
|
84
|
+
[j.value?.mergedClasses.optionSelected ?? ""]: P.value && F.value,
|
|
85
|
+
[j.value?.optionHighlightedClass ?? ""]: P.value && L.value && !F.value,
|
|
86
|
+
[j.value?.mergedClasses.optionHighlighted ?? ""]: P.value && L.value && !F.value,
|
|
87
|
+
"opacity-50 pointer-events-none": k.value.disabled,
|
|
88
|
+
[g(z.value, "interactive") ?? ""]: !0,
|
|
89
|
+
[j.value?.sizeClasses?.option ?? ""]: !0
|
|
57
90
|
})
|
|
58
|
-
}) : null),
|
|
91
|
+
}) : null), Y = l(() => y({
|
|
59
92
|
"flex w-full min-w-0 gap-x-3": !0,
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"py-
|
|
63
|
-
|
|
64
|
-
})),
|
|
93
|
+
"items-center": !k.value.interactive,
|
|
94
|
+
"px-4": !k.value.interactive,
|
|
95
|
+
"py-2": !k.value.interactive && !B.value,
|
|
96
|
+
"py-1.5": !k.value.interactive && B.value
|
|
97
|
+
})), X = l(() => r(R.value?.start, {}, y({
|
|
65
98
|
"flex shrink-0": !0,
|
|
66
|
-
[
|
|
67
|
-
})
|
|
99
|
+
[g(z.value, "start") ?? ""]: !0
|
|
100
|
+
}))), Z = l(() => r(R.value?.content, {}, y({
|
|
68
101
|
"min-w-0 flex-1": !0,
|
|
69
|
-
[
|
|
70
|
-
})
|
|
71
|
-
"block truncate text-sm font-medium": !0,
|
|
72
|
-
[f(E.value, "primary") ?? ""]: !0
|
|
73
|
-
}) })), B = s(() => r(T.value?.secondary, {}, { class: m({
|
|
74
|
-
"mt-0.5 block truncate text-xs text-dark-500": !0,
|
|
75
|
-
[f(E.value, "secondary") ?? ""]: !0
|
|
76
|
-
}) }));
|
|
102
|
+
[g(z.value, "content") ?? ""]: !0
|
|
103
|
+
}))), Q = l(() => r(R.value?.primary, {}, y("block truncate text-sm font-medium", j.value?.sizeClasses?.primary, g(z.value, "primary")))), $ = l(() => r(R.value?.secondary, {}, y("mt-0.5 block truncate text-xs text-dark-500", j.value?.sizeClasses?.secondary, g(z.value, "secondary"))));
|
|
77
104
|
return {
|
|
78
|
-
merged:
|
|
79
|
-
hasEnd:
|
|
80
|
-
endBind:
|
|
105
|
+
merged: k,
|
|
106
|
+
hasEnd: G,
|
|
107
|
+
endBind: l(() => r(R.value?.end, {}, y({
|
|
81
108
|
"ml-auto flex shrink-0 items-center": !0,
|
|
82
|
-
[
|
|
83
|
-
})
|
|
84
|
-
rootBind:
|
|
85
|
-
rowClass:
|
|
86
|
-
hasStart:
|
|
87
|
-
startBind:
|
|
88
|
-
hasPrimary:
|
|
89
|
-
contentBind:
|
|
90
|
-
primaryBind:
|
|
91
|
-
hasSecondary:
|
|
92
|
-
secondaryBind:
|
|
93
|
-
interactiveBind:
|
|
109
|
+
[g(z.value, "end") ?? ""]: !0
|
|
110
|
+
}))),
|
|
111
|
+
rootBind: q,
|
|
112
|
+
rowClass: Y,
|
|
113
|
+
hasStart: U,
|
|
114
|
+
startBind: X,
|
|
115
|
+
hasPrimary: V,
|
|
116
|
+
contentBind: Z,
|
|
117
|
+
primaryBind: Q,
|
|
118
|
+
hasSecondary: H,
|
|
119
|
+
secondaryBind: $,
|
|
120
|
+
interactiveBind: J,
|
|
121
|
+
selectedIconBind: l(() => r(R.value?.selectedIcon, {}, {
|
|
122
|
+
size: "sm",
|
|
123
|
+
class: y("shrink-0", j.value?.checkClass, g(z.value, "selectedIcon"))
|
|
124
|
+
})),
|
|
125
|
+
resolvedSelectedIcon: W
|
|
94
126
|
};
|
|
95
127
|
}
|
|
96
|
-
function
|
|
128
|
+
function w(r, i) {
|
|
97
129
|
if (e(r, "primary")) return n(r, "primary");
|
|
98
130
|
if (e(r, "default")) return n(r, "default");
|
|
99
131
|
if (!t(i)) return () => null;
|
|
@@ -101,4 +133,4 @@ function b(r, i) {
|
|
|
101
133
|
return () => a;
|
|
102
134
|
}
|
|
103
135
|
//#endregion
|
|
104
|
-
export {
|
|
136
|
+
export { w as resolveListItemPrimary, C as useListItem };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { useListItem } from './composables/useListItem';
|
|
2
|
-
export type {
|
|
2
|
+
export type { ListItemClasses, ListItemCustomProps, ListItemOwnProps, ListItemProps, ListItemSlots, } from './listItem.types';
|
|
3
3
|
export { default as ListItem } from './ListItem.vue';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { LucideIcon } from '@lucide/vue';
|
|
1
2
|
import { HTMLAttributes, Slot, VNode } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
|
|
3
|
+
import { ListboxValue, MergeHtmlProps } from '@bridge-ui/core';
|
|
4
|
+
import { IconProps } from '../Icon';
|
|
4
5
|
export interface ListItemClasses {
|
|
5
6
|
/**
|
|
6
7
|
* The classes to apply to the main content column.
|
|
@@ -26,6 +27,10 @@ export interface ListItemClasses {
|
|
|
26
27
|
* The classes to apply to the secondary text.
|
|
27
28
|
*/
|
|
28
29
|
secondary?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The classes to apply to the selected icon.
|
|
32
|
+
*/
|
|
33
|
+
selectedIcon?: string;
|
|
29
34
|
/**
|
|
30
35
|
* The classes to apply to the leading slot.
|
|
31
36
|
*/
|
|
@@ -56,6 +61,10 @@ export interface ListItemCustomProps {
|
|
|
56
61
|
* Props forwarded to the secondary text.
|
|
57
62
|
*/
|
|
58
63
|
secondary?: HTMLAttributes;
|
|
64
|
+
/**
|
|
65
|
+
* Props forwarded to the default selected `Icon` (`icon` is set by the item).
|
|
66
|
+
*/
|
|
67
|
+
selectedIcon?: Partial<Omit<IconProps, "icon">>;
|
|
59
68
|
/**
|
|
60
69
|
* Props forwarded to the leading slot wrapper.
|
|
61
70
|
*/
|
|
@@ -65,12 +74,6 @@ export interface ListItemCustomProps {
|
|
|
65
74
|
* List row (MUI `ListItem` / `ListItemButton`-like).
|
|
66
75
|
*/
|
|
67
76
|
export interface ListItemOwnProps {
|
|
68
|
-
/**
|
|
69
|
-
* Vertical alignment of start/content/end slots.
|
|
70
|
-
*
|
|
71
|
-
* @default "center"
|
|
72
|
-
*/
|
|
73
|
-
align?: MergeProps<ListItemAlign, ListItemAlignOverrides>;
|
|
74
77
|
/**
|
|
75
78
|
* The element to render as.
|
|
76
79
|
*
|
|
@@ -137,6 +140,19 @@ export interface ListItemOwnProps {
|
|
|
137
140
|
* @default false
|
|
138
141
|
*/
|
|
139
142
|
selected?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* The icon shown when `selected` is true. Use `null` to hide it.
|
|
145
|
+
* The `end` slot replaces this icon when provided.
|
|
146
|
+
*
|
|
147
|
+
* @default Check
|
|
148
|
+
*/
|
|
149
|
+
selectedIcon?: null | LucideIcon;
|
|
150
|
+
/**
|
|
151
|
+
* When set inside a `Listbox`, registers this row as a selectable option.
|
|
152
|
+
*
|
|
153
|
+
* @default undefined
|
|
154
|
+
*/
|
|
155
|
+
value?: ListboxValue;
|
|
140
156
|
}
|
|
141
157
|
export type ListItemPrimaryContent = VNode | string | VNode[] | undefined;
|
|
142
158
|
export interface ListItemSlots {
|
|
@@ -3,9 +3,7 @@ import { ListSectionOwnProps, ListSectionProps } from '../listSection.types';
|
|
|
3
3
|
export declare function useListSection(props: ListSectionOwnProps, slots: ReturnType<typeof useSlots>): {
|
|
4
4
|
label: import('vue').ComputedRef<import('vue').Slot | (() => null | import('vue').VNodeChild)>;
|
|
5
5
|
merged: import('vue').ComputedRef<ListSectionOwnProps>;
|
|
6
|
-
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<
|
|
7
|
-
class: string;
|
|
8
|
-
}, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<ListSectionProps, "classes" | "customProps" | "title" | "as" | "inset" | "sticky">, never>>>;
|
|
6
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<ListSectionProps, "classes" | "customProps" | "title" | "as" | "inset" | "sticky">, never>>>;
|
|
9
7
|
titleBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
10
8
|
role: string;
|
|
11
9
|
class: string;
|
|
@@ -26,19 +26,20 @@ function m(m, h) {
|
|
|
26
26
|
}), x = a(() => y.value.customProps), S = r({
|
|
27
27
|
entry: b,
|
|
28
28
|
props: () => v.value.componentProps
|
|
29
|
-
}), C = a(() => _ ? s(_).dense : !1), w = a(() => e(h, "default", y.value.title)), T = a(() => u(v.value.inheritedAttrs, []));
|
|
29
|
+
}), C = a(() => _ ? s(_).dense : !1), w = a(() => e(h, "default", y.value.title)), T = a(() => u(v.value.inheritedAttrs, [])), E = a(() => y.value.as === "div");
|
|
30
30
|
return {
|
|
31
31
|
label: w,
|
|
32
32
|
merged: y,
|
|
33
|
-
rootBind: a(() => t(x.value?.root, T.value,
|
|
33
|
+
rootBind: a(() => t(x.value?.root, T.value, d({
|
|
34
34
|
"list-none": !0,
|
|
35
|
+
"sticky top-0 z-10 bg-white dark:bg-dark-950": y.value.sticky && !E.value,
|
|
35
36
|
[l(S.value, "root") ?? ""]: !0
|
|
36
|
-
})
|
|
37
|
+
}))),
|
|
37
38
|
titleBind: a(() => t(x.value?.title, {}, {
|
|
38
39
|
role: "presentation",
|
|
39
40
|
class: d({
|
|
40
|
-
"bg-white px-4 text-xs font-semibold tracking-wide text-dark-500 uppercase": !0,
|
|
41
|
-
"sticky top-0 z-10": y.value.sticky,
|
|
41
|
+
"bg-white px-4 text-xs font-semibold tracking-wide text-dark-500 uppercase dark:bg-dark-950 dark:text-dark-400": !0,
|
|
42
|
+
"sticky top-0 z-10": y.value.sticky && E.value,
|
|
42
43
|
"py-2": !C.value,
|
|
43
44
|
"py-1.5": C.value,
|
|
44
45
|
"pl-14": y.value.inset,
|