@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.
@@ -30,7 +30,7 @@ function f(f, p) {
30
30
  role: "separator",
31
31
  "aria-orientation": g.value.orientation,
32
32
  class: o({
33
- "m-0 shrink-0 border-0 border-solid": !0,
33
+ "m-0 shrink-0 border-0": !0,
34
34
  [y.value ?? ""]: !0,
35
35
  [b.value ?? ""]: !0,
36
36
  [v.value.root ?? ""]: !0
@@ -1,8 +1,9 @@
1
- import { resolveNamedSlot as e, resolveSlotOrProp as t } from "../../Utils/slotOrProp.js";
2
- import { resolveListItemPrimary as n, useListItem as r } from "./composables/useListItem.js";
3
- import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, defineComponent as l, guardReactiveProps as u, mergeProps as d, normalizeClass as f, normalizeProps as p, openBlock as m, resolveDynamicComponent as h, unref as g, useSlots as _, withCtx as v } from "vue";
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 y = /* @__PURE__ */ l({
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(l) {
35
- let y = _(), b = l, { merged: x, hasEnd: S, endBind: C, rootBind: w, rowClass: T, hasStart: E, startBind: D, hasPrimary: O, contentBind: k, primaryBind: A, hasSecondary: j, secondaryBind: M, interactiveBind: N } = r(b, {
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
- }, y), P = i(() => x.value.as ?? "li"), F = i(() => n(y, b.primary)), I = i(() => t(y, "secondary", b.secondary));
39
- return (t, n) => (m(), a(h(P.value), p(u(g(w))), {
40
- default: v(() => [g(N) ? (m(), s("div", p(d({ key: 0 }, g(N))), [c("div", { class: f(g(T)) }, [
41
- g(E) ? (m(), s("div", p(d({ key: 0 }, g(D))), [(m(), a(h(g(e)(g(y), "start"))))], 16)) : o("", !0),
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", {
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: f(g(T))
48
+ class: m(v(D))
47
49
  }, [
48
- g(E) ? (m(), s("div", p(d({ key: 0 }, g(D))), [(m(), a(h(g(e)(g(y), "start"))))], 16)) : o("", !0),
49
- 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),
50
- g(S) ? (m(), s("div", p(d({ key: 1 }, g(C))), [(m(), a(h(g(e)(g(y), "end"))))], 16)) : o("", !0)
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 { y as default };
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, omit as p } from "es-toolkit/compat";
6
- import { cn as m, mergeBridgeUILayeredClasses as h, splitComponentProps as g } from "@bridge-ui/core";
7
- import { alignProps as _ } from "@bridge-ui/core/Components/ListItem";
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 v = [
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 y(t, n, y) {
24
- let b = d(), x = l(o, null), S = s(() => g({
25
+ function x(t, n, x) {
26
+ let S = d(), C = l(o, null), w = s(() => _({
25
27
  props: {
26
- ...b,
28
+ ...S,
27
29
  ...t
28
30
  },
29
- bridgeKeys: v
30
- })), { merged: C, entry: w } = i({
31
+ bridgeKeys: b
32
+ })), { merged: T, entry: E } = i({
31
33
  libDefaults: n,
32
34
  componentName: "ListItem",
33
- props: () => S.value.componentProps
34
- }), T = s(() => C.value.customProps), E = a({
35
- entry: w,
36
- props: () => S.value.componentProps
37
- }), D = s(() => "dense" in (c()?.vnode.props ?? {}) ? t.dense === !0 : t.dense === !0 ? !0 : x ? u(x).dense : !1), O = s(() => f(h(_, w.value?.customProps?.align), C.value.align)), k = s(() => e(y, "primary") || e(y, "default") || !!C.value.primary), A = s(() => e(y, "secondary") || !!C.value.secondary), j = s(() => e(y, "start")), M = s(() => e(y, "end")), N = s(() => p(S.value.inheritedAttrs, [])), P = s(() => r(T.value?.root, N.value, { class: m({
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": C.value.divider,
40
- [f(E.value, "root") ?? ""]: !0
41
- }) })), F = s(() => C.value.interactive ? r(T.value?.interactive, {}, {
42
- role: C.value.role,
43
- tabindex: C.value.disabled ? -1 : 0,
44
- "aria-disabled": C.value.disabled ? !0 : void 0,
45
- "data-selected": C.value.selected ? !0 : void 0,
46
- class: m({
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": !C.value.disabled,
50
+ "cursor-pointer select-none": !T.value.disabled,
49
51
  "px-4": !0,
50
- "py-2": !D.value,
51
- "py-1.5": D.value,
52
- "hover:bg-black/5 focus-visible:bg-black/5": !C.value.disabled,
53
- "bg-primary-50 text-primary-700": C.value.selected,
54
- "opacity-50 pointer-events-none": C.value.disabled,
55
- [O.value ?? ""]: !0,
56
- [f(E.value, "interactive") ?? ""]: !0
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), I = s(() => m({
60
+ }) : null), z = s(() => h({
59
61
  "flex w-full min-w-0 gap-x-3": !0,
60
- "px-4": !C.value.interactive,
61
- "py-2": !C.value.interactive && !D.value,
62
- "py-1.5": !C.value.interactive && D.value,
63
- [O.value ?? ""]: !C.value.interactive
64
- })), L = s(() => r(T.value?.start, {}, { class: m({
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(E.value, "start") ?? ""]: !0
67
- }) })), R = s(() => r(T.value?.content, {}, { class: m({
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(E.value, "content") ?? ""]: !0
70
- }) })), z = s(() => r(T.value?.primary, {}, { class: m({
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(E.value, "primary") ?? ""]: !0
73
- }) })), B = s(() => r(T.value?.secondary, {}, { class: m({
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(E.value, "secondary") ?? ""]: !0
77
+ [f(O.value, "secondary") ?? ""]: !0
76
78
  }) }));
77
79
  return {
78
- merged: C,
79
- hasEnd: M,
80
- endBind: s(() => r(T.value?.end, {}, { class: m({
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(E.value, "end") ?? ""]: !0
84
+ [f(O.value, "end") ?? ""]: !0
83
85
  }) })),
84
- rootBind: P,
85
- rowClass: I,
86
- hasStart: j,
87
- startBind: L,
88
- hasPrimary: k,
89
- contentBind: R,
90
- primaryBind: z,
91
- hasSecondary: A,
92
- secondaryBind: B,
93
- interactiveBind: F
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 b(r, i) {
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 { b as resolveListItemPrimary, y as useListItem };
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 {
@@ -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",
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.4",
63
+ "@bridge-ui/core": "^0.0.1-beta.5",
64
64
  "@lucide/vue": ">=1.0.0",
65
65
  "vue": "^3.4.0"
66
66
  },