@bridge-ui/vue 0.0.1-beta.4 → 0.0.1-beta.5
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/ListItem/ListItem.vue_vue_type_script_setup_true_lang.js +21 -19
- package/dist/Components/ListItem/composables/useListItem.d.ts +7 -1
- package/dist/Components/ListItem/composables/useListItem.js +70 -60
- package/dist/Components/ListItem/listItem.types.d.ts +17 -0
- package/dist/augments.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,9 @@
|
|
|
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: {
|
|
@@ -29,29 +30,30 @@ var y = /* @__PURE__ */ l({
|
|
|
29
30
|
selected: {
|
|
30
31
|
type: Boolean,
|
|
31
32
|
default: !1
|
|
32
|
-
}
|
|
33
|
+
},
|
|
34
|
+
selectedIcon: {}
|
|
33
35
|
},
|
|
34
|
-
setup(
|
|
35
|
-
let
|
|
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, {
|
|
36
38
|
role: "button",
|
|
37
39
|
align: "center"
|
|
38
|
-
},
|
|
39
|
-
return (
|
|
40
|
-
default:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
], 2)], 16)) : (
|
|
40
|
+
}, 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"));
|
|
41
|
+
return (e, n) => (g(), s(_(R.value), h(f(v(E))), {
|
|
42
|
+
default: b(() => [v(F) ? (g(), l("div", h(p({ key: 0 }, v(F))), [u("div", { class: m(v(D)) }, [
|
|
43
|
+
v(O) ? (g(), l("div", h(p({ key: 0 }, v(k))), [(g(), s(_(v(t)(v(x), "start"))))], 16)) : c("", !0),
|
|
44
|
+
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),
|
|
45
|
+
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)
|
|
46
|
+
], 2)], 16)) : (g(), l("div", {
|
|
45
47
|
key: 1,
|
|
46
|
-
class:
|
|
48
|
+
class: m(v(D))
|
|
47
49
|
}, [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
v(O) ? (g(), l("div", h(p({ key: 0 }, v(k))), [(g(), s(_(v(t)(v(x), "start"))))], 16)) : c("", !0),
|
|
51
|
+
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),
|
|
52
|
+
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
53
|
], 2))]),
|
|
52
54
|
_: 1
|
|
53
55
|
}, 16));
|
|
54
56
|
}
|
|
55
57
|
});
|
|
56
58
|
//#endregion
|
|
57
|
-
export {
|
|
59
|
+
export { x as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
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';
|
|
@@ -11,7 +12,7 @@ export declare function useListItem(props: ListItemOwnProps, libDefaults: ListIt
|
|
|
11
12
|
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
12
13
|
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
13
14
|
class: string;
|
|
14
|
-
}, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<ListItemProps, "role" | "classes" | "customProps" | "primary" | "secondary" | "as" | "disabled" | "dense" | "align" | "divider" | "interactive" | "selected">, never>>>;
|
|
15
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<ListItemProps, "role" | "classes" | "customProps" | "primary" | "secondary" | "as" | "disabled" | "dense" | "align" | "divider" | "interactive" | "selected" | "selectedIcon">, never>>>;
|
|
15
16
|
rowClass: import('vue').ComputedRef<string>;
|
|
16
17
|
hasStart: import('vue').ComputedRef<boolean>;
|
|
17
18
|
startBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
@@ -35,6 +36,11 @@ export declare function useListItem(props: ListItemOwnProps, libDefaults: ListIt
|
|
|
35
36
|
"data-selected": boolean | undefined;
|
|
36
37
|
class: string;
|
|
37
38
|
} & object & Record<"class", string>) | null>;
|
|
39
|
+
selectedIconBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
40
|
+
size: "sm";
|
|
41
|
+
class: string;
|
|
42
|
+
}, "class", Partial<Omit<import('../../Icon').IconProps, "icon">> | undefined, {}>>;
|
|
43
|
+
resolvedSelectedIcon: import('vue').ComputedRef<LucideIcon | null>;
|
|
38
44
|
};
|
|
39
45
|
export declare function resolveListItemPrimary(slots: ReturnType<typeof useSlots>, primary?: string): Slot | (() => null | string);
|
|
40
46
|
export {};
|
|
@@ -2,11 +2,12 @@ import { hasNamedSlot as e, isPropPresent as t, resolveNamedSlot as n } from "..
|
|
|
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
4
|
import { computed as s, getCurrentInstance as c, inject as l, toValue as u, useAttrs as d } from "vue";
|
|
5
|
-
import { get as f,
|
|
6
|
-
import { cn as
|
|
7
|
-
import {
|
|
5
|
+
import { get as f, isNull as p, omit as m } from "es-toolkit/compat";
|
|
6
|
+
import { cn as h, mergeBridgeUILayeredClasses as g, splitComponentProps as _ } from "@bridge-ui/core";
|
|
7
|
+
import { Check as v } from "@lucide/vue";
|
|
8
|
+
import { alignProps as y } from "@bridge-ui/core/Components/ListItem";
|
|
8
9
|
//#region src/Components/ListItem/composables/useListItem.ts
|
|
9
|
-
var
|
|
10
|
+
var b = [
|
|
10
11
|
"as",
|
|
11
12
|
"role",
|
|
12
13
|
"align",
|
|
@@ -18,82 +19,91 @@ var v = [
|
|
|
18
19
|
"selected",
|
|
19
20
|
"secondary",
|
|
20
21
|
"customProps",
|
|
21
|
-
"interactive"
|
|
22
|
+
"interactive",
|
|
23
|
+
"selectedIcon"
|
|
22
24
|
];
|
|
23
|
-
function
|
|
24
|
-
let
|
|
25
|
+
function x(t, n, x) {
|
|
26
|
+
let S = d(), C = l(o, null), w = s(() => _({
|
|
25
27
|
props: {
|
|
26
|
-
...
|
|
28
|
+
...S,
|
|
27
29
|
...t
|
|
28
30
|
},
|
|
29
|
-
bridgeKeys:
|
|
30
|
-
})), { merged:
|
|
31
|
+
bridgeKeys: b
|
|
32
|
+
})), { merged: T, entry: E } = i({
|
|
31
33
|
libDefaults: n,
|
|
32
34
|
componentName: "ListItem",
|
|
33
|
-
props: () =>
|
|
34
|
-
}),
|
|
35
|
-
entry:
|
|
36
|
-
props: () =>
|
|
37
|
-
}),
|
|
35
|
+
props: () => w.value.componentProps
|
|
36
|
+
}), D = s(() => T.value.customProps), O = a({
|
|
37
|
+
entry: E,
|
|
38
|
+
props: () => w.value.componentProps
|
|
39
|
+
}), k = s(() => "dense" in (c()?.vnode.props ?? {}) ? t.dense === !0 : t.dense === !0 ? !0 : C ? u(C).dense : !1), A = s(() => f(g(y, E.value?.customProps?.align), T.value.align)), j = s(() => e(x, "primary") || e(x, "default") || !!T.value.primary), M = s(() => e(x, "secondary") || !!T.value.secondary), N = s(() => e(x, "start")), P = s(() => !T.value.selected || p(T.value.selectedIcon) ? null : T.value.selectedIcon ?? v), F = s(() => e(x, "end") || P.value != null), I = s(() => m(w.value.inheritedAttrs, [])), L = s(() => r(D.value?.root, I.value, { class: h({
|
|
38
40
|
"list-none": !0,
|
|
39
|
-
"border-b border-black/10 last:border-b-0":
|
|
40
|
-
[f(
|
|
41
|
-
}) })),
|
|
42
|
-
role:
|
|
43
|
-
tabindex:
|
|
44
|
-
"aria-disabled":
|
|
45
|
-
"data-selected":
|
|
46
|
-
class:
|
|
41
|
+
"border-b border-black/10 last:border-b-0": T.value.divider,
|
|
42
|
+
[f(O.value, "root") ?? ""]: !0
|
|
43
|
+
}) })), R = s(() => T.value.interactive ? r(D.value?.interactive, {}, {
|
|
44
|
+
role: T.value.role,
|
|
45
|
+
tabindex: T.value.disabled ? -1 : 0,
|
|
46
|
+
"aria-disabled": T.value.disabled ? !0 : void 0,
|
|
47
|
+
"data-selected": T.value.selected ? !0 : void 0,
|
|
48
|
+
class: h({
|
|
47
49
|
"flex w-full min-w-0 gap-x-3 text-left outline-hidden transition-colors": !0,
|
|
48
|
-
"cursor-pointer select-none": !
|
|
50
|
+
"cursor-pointer select-none": !T.value.disabled,
|
|
49
51
|
"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
|
-
"opacity-50 pointer-events-none":
|
|
55
|
-
[
|
|
56
|
-
[f(
|
|
52
|
+
"py-2": !k.value,
|
|
53
|
+
"py-1.5": k.value,
|
|
54
|
+
"hover:bg-black/5 focus-visible:bg-black/5": !T.value.disabled,
|
|
55
|
+
"bg-primary-50 text-primary-700": T.value.selected,
|
|
56
|
+
"opacity-50 pointer-events-none": T.value.disabled,
|
|
57
|
+
[A.value ?? ""]: !0,
|
|
58
|
+
[f(O.value, "interactive") ?? ""]: !0
|
|
57
59
|
})
|
|
58
|
-
}) : null),
|
|
60
|
+
}) : null), z = s(() => h({
|
|
59
61
|
"flex w-full min-w-0 gap-x-3": !0,
|
|
60
|
-
"px-4": !
|
|
61
|
-
"py-2": !
|
|
62
|
-
"py-1.5": !
|
|
63
|
-
[
|
|
64
|
-
})),
|
|
62
|
+
"px-4": !T.value.interactive,
|
|
63
|
+
"py-2": !T.value.interactive && !k.value,
|
|
64
|
+
"py-1.5": !T.value.interactive && k.value,
|
|
65
|
+
[A.value ?? ""]: !T.value.interactive
|
|
66
|
+
})), B = s(() => r(D.value?.start, {}, { class: h({
|
|
65
67
|
"flex shrink-0": !0,
|
|
66
|
-
[f(
|
|
67
|
-
}) })),
|
|
68
|
+
[f(O.value, "start") ?? ""]: !0
|
|
69
|
+
}) })), V = s(() => r(D.value?.content, {}, { class: h({
|
|
68
70
|
"min-w-0 flex-1": !0,
|
|
69
|
-
[f(
|
|
70
|
-
}) })),
|
|
71
|
+
[f(O.value, "content") ?? ""]: !0
|
|
72
|
+
}) })), H = s(() => r(D.value?.primary, {}, { class: h({
|
|
71
73
|
"block truncate text-sm font-medium": !0,
|
|
72
|
-
[f(
|
|
73
|
-
}) })),
|
|
74
|
+
[f(O.value, "primary") ?? ""]: !0
|
|
75
|
+
}) })), U = s(() => r(D.value?.secondary, {}, { class: h({
|
|
74
76
|
"mt-0.5 block truncate text-xs text-dark-500": !0,
|
|
75
|
-
[f(
|
|
77
|
+
[f(O.value, "secondary") ?? ""]: !0
|
|
76
78
|
}) }));
|
|
77
79
|
return {
|
|
78
|
-
merged:
|
|
79
|
-
hasEnd:
|
|
80
|
-
endBind: s(() => r(
|
|
80
|
+
merged: T,
|
|
81
|
+
hasEnd: F,
|
|
82
|
+
endBind: s(() => r(D.value?.end, {}, { class: h({
|
|
81
83
|
"ml-auto flex shrink-0 items-center": !0,
|
|
82
|
-
[f(
|
|
84
|
+
[f(O.value, "end") ?? ""]: !0
|
|
83
85
|
}) })),
|
|
84
|
-
rootBind:
|
|
85
|
-
rowClass:
|
|
86
|
-
hasStart:
|
|
87
|
-
startBind:
|
|
88
|
-
hasPrimary:
|
|
89
|
-
contentBind:
|
|
90
|
-
primaryBind:
|
|
91
|
-
hasSecondary:
|
|
92
|
-
secondaryBind:
|
|
93
|
-
interactiveBind:
|
|
86
|
+
rootBind: L,
|
|
87
|
+
rowClass: z,
|
|
88
|
+
hasStart: N,
|
|
89
|
+
startBind: B,
|
|
90
|
+
hasPrimary: j,
|
|
91
|
+
contentBind: V,
|
|
92
|
+
primaryBind: H,
|
|
93
|
+
hasSecondary: M,
|
|
94
|
+
secondaryBind: U,
|
|
95
|
+
interactiveBind: R,
|
|
96
|
+
selectedIconBind: s(() => r(D.value?.selectedIcon, {}, {
|
|
97
|
+
size: "sm",
|
|
98
|
+
class: h({
|
|
99
|
+
"shrink-0": !0,
|
|
100
|
+
[f(O.value, "selectedIcon") ?? ""]: !0
|
|
101
|
+
})
|
|
102
|
+
})),
|
|
103
|
+
resolvedSelectedIcon: P
|
|
94
104
|
};
|
|
95
105
|
}
|
|
96
|
-
function
|
|
106
|
+
function S(r, i) {
|
|
97
107
|
if (e(r, "primary")) return n(r, "primary");
|
|
98
108
|
if (e(r, "default")) return n(r, "default");
|
|
99
109
|
if (!t(i)) return () => null;
|
|
@@ -101,4 +111,4 @@ function b(r, i) {
|
|
|
101
111
|
return () => a;
|
|
102
112
|
}
|
|
103
113
|
//#endregion
|
|
104
|
-
export {
|
|
114
|
+
export { S as resolveListItemPrimary, x as useListItem };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { LucideIcon } from '@lucide/vue';
|
|
1
2
|
import { HTMLAttributes, Slot, VNode } from 'vue';
|
|
2
3
|
import { ListItemAlign, MergeHtmlProps, MergeProps } from '@bridge-ui/core';
|
|
4
|
+
import { IconProps } from '../Icon';
|
|
3
5
|
export interface ListItemAlignOverrides {}
|
|
4
6
|
export interface ListItemClasses {
|
|
5
7
|
/**
|
|
@@ -26,6 +28,10 @@ export interface ListItemClasses {
|
|
|
26
28
|
* The classes to apply to the secondary text.
|
|
27
29
|
*/
|
|
28
30
|
secondary?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The classes to apply to the selected icon.
|
|
33
|
+
*/
|
|
34
|
+
selectedIcon?: string;
|
|
29
35
|
/**
|
|
30
36
|
* The classes to apply to the leading slot.
|
|
31
37
|
*/
|
|
@@ -56,6 +62,10 @@ export interface ListItemCustomProps {
|
|
|
56
62
|
* Props forwarded to the secondary text.
|
|
57
63
|
*/
|
|
58
64
|
secondary?: HTMLAttributes;
|
|
65
|
+
/**
|
|
66
|
+
* Props forwarded to the default selected `Icon` (`icon` is set by the item).
|
|
67
|
+
*/
|
|
68
|
+
selectedIcon?: Partial<Omit<IconProps, "icon">>;
|
|
59
69
|
/**
|
|
60
70
|
* Props forwarded to the leading slot wrapper.
|
|
61
71
|
*/
|
|
@@ -137,6 +147,13 @@ export interface ListItemOwnProps {
|
|
|
137
147
|
* @default false
|
|
138
148
|
*/
|
|
139
149
|
selected?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* The icon shown when `selected` is true. Use `null` to hide it.
|
|
152
|
+
* The `end` slot replaces this icon when provided.
|
|
153
|
+
*
|
|
154
|
+
* @default Check
|
|
155
|
+
*/
|
|
156
|
+
selectedIcon?: null | LucideIcon;
|
|
140
157
|
}
|
|
141
158
|
export type ListItemPrimaryContent = VNode | string | VNode[] | undefined;
|
|
142
159
|
export interface ListItemSlots {
|
package/dist/augments.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ declare module "@bridge-ui/core" {
|
|
|
82
82
|
}
|
|
83
83
|
interface ListItemConfigOverrides {
|
|
84
84
|
classes: ListItemClasses;
|
|
85
|
-
defaultProps: Partial<Pick<ListItemProps, "role" | "align">>;
|
|
85
|
+
defaultProps: Partial<Pick<ListItemProps, "role" | "align" | "selectedIcon">>;
|
|
86
86
|
}
|
|
87
87
|
interface ListSectionConfigOverrides {
|
|
88
88
|
classes: ListSectionClasses;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.5",
|
|
5
5
|
"author": "BridgeUI",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"name": "@bridge-ui/vue",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dist"
|
|
61
61
|
],
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@bridge-ui/core": "^0.0.1-beta.
|
|
63
|
+
"@bridge-ui/core": "^0.0.1-beta.5",
|
|
64
64
|
"@lucide/vue": ">=1.0.0",
|
|
65
65
|
"vue": "^3.4.0"
|
|
66
66
|
},
|