@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.
Files changed (35) hide show
  1. package/dist/Components/Divider/composables/useDivider.js +1 -1
  2. package/dist/Components/List/List.vue.d.ts +0 -1
  3. package/dist/Components/List/List.vue_vue_type_script_setup_true_lang.js +2 -3
  4. package/dist/Components/List/composables/useList.d.ts +3 -9
  5. package/dist/Components/List/composables/useList.js +21 -25
  6. package/dist/Components/List/index.d.ts +1 -1
  7. package/dist/Components/List/list.types.d.ts +1 -8
  8. package/dist/Components/ListItem/ListItem.vue.d.ts +0 -1
  9. package/dist/Components/ListItem/ListItem.vue_vue_type_script_setup_true_lang.js +21 -22
  10. package/dist/Components/ListItem/composables/useListItem.d.ts +18 -18
  11. package/dist/Components/ListItem/composables/useListItem.js +100 -68
  12. package/dist/Components/ListItem/index.d.ts +1 -1
  13. package/dist/Components/ListItem/listItem.types.d.ts +24 -8
  14. package/dist/Components/ListSection/composables/useListSection.d.ts +1 -3
  15. package/dist/Components/ListSection/composables/useListSection.js +6 -5
  16. package/dist/Components/Listbox/Listbox.vue.d.ts +5 -2
  17. package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +101 -62
  18. package/dist/Components/Listbox/index.d.ts +2 -1
  19. package/dist/Components/Listbox/index.js +3 -2
  20. package/dist/Components/Listbox/listbox.types.d.ts +21 -4
  21. package/dist/Components/Listbox/listboxInjectionKey.d.ts +23 -0
  22. package/dist/Components/Listbox/listboxInjectionKey.js +4 -0
  23. package/dist/Components/Menu/Menu.vue.d.ts +2 -2
  24. package/dist/Components/Menu/composables/useMenu.d.ts +1 -3
  25. package/dist/Components/Menu/composables/useMenu.js +2 -2
  26. package/dist/Components/Modal/composables/useModal.d.ts +1 -1
  27. package/dist/Components/Select/Select.vue_vue_type_script_setup_true_lang.js +68 -57
  28. package/dist/Components/Select/SelectOption.vue_vue_type_script_setup_true_lang.js +2 -0
  29. package/dist/Components/Select/composables/useSelect.d.ts +5 -1
  30. package/dist/Components/Select/composables/useSelect.js +187 -154
  31. package/dist/Components/Select/select.types.d.ts +12 -5
  32. package/dist/augments.d.ts +2 -3
  33. package/dist/index.d.ts +2 -2
  34. package/dist/index.js +5 -5
  35. package/package.json +2 -2
@@ -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,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, { padding: "normal" }), h = n(() => p.value.as ?? "ul");
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
- type ListLibDefaults = LibDefaultsShape<ListOwnProps, "padding">;
4
- type ListMerged = MergeLibDefaults<ListOwnProps, ListLibDefaults>;
5
- export declare function useList(props: ListOwnProps, libDefaults: ListLibDefaults): {
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, mergeBridgeUILayeredClasses as u, splitComponentProps as d } from "@bridge-ui/core";
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 p = [
7
+ var d = [
9
8
  "as",
10
9
  "dense",
11
10
  "nested",
12
11
  "classes",
13
- "padding",
14
12
  "customProps"
15
13
  ];
16
- function m(m, h) {
17
- let g = o(), _ = i(() => d({
18
- bridgeKeys: p,
14
+ function f(f) {
15
+ let p = o(), m = i(() => u({
16
+ bridgeKeys: d,
19
17
  props: {
20
- ...g,
21
- ...m
18
+ ...p,
19
+ ...f
22
20
  }
23
- })), { merged: v, entry: y } = t({
24
- libDefaults: h,
21
+ })), { merged: h, entry: g } = t({
25
22
  componentName: "List",
26
- props: () => _.value.componentProps
27
- }), b = i(() => v.value.customProps), x = n({
28
- entry: y,
29
- props: () => _.value.componentProps
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: v.value.dense === !0 })));
32
- let S = i(() => s(u(f, y.value?.customProps?.padding), v.value.padding)), C = i(() => c(_.value.inheritedAttrs, []));
28
+ a(r, i(() => ({ dense: h.value.dense === !0 })));
29
+ let y = i(() => c(m.value.inheritedAttrs, []));
33
30
  return {
34
- merged: v,
35
- rootBind: i(() => e(b.value?.root, C.value, { class: l({
36
- "m-0 list-none": !0,
37
- [S.value ?? ""]: !0,
38
- "pl-4": v.value.nested,
39
- [s(x.value, "root") ?? ""]: !0
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 { m as useList };
40
+ export { f as useList };
@@ -1,5 +1,5 @@
1
1
  export { useList } from './composables/useList';
2
- export type { ListClasses, ListCustomProps, ListOwnProps, ListPaddingOverrides, ListProps, } from './list.types';
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 { ListPadding, MergeHtmlProps, MergeProps } from '@bridge-ui/core';
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 { 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: {
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(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
- role: "button",
37
- 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", {
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: f(g(T))
45
+ class: m(v(D))
47
46
  }, [
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)
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 { y as default };
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" | "align">;
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
- }, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<ListItemProps, "role" | "classes" | "customProps" | "primary" | "secondary" | "as" | "disabled" | "dense" | "align" | "divider" | "interactive" | "selected">, never>>>;
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
- class: string;
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 { 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";
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 v = [
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 y(t, n, y) {
24
- let b = d(), x = l(o, null), S = s(() => g({
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
- ...b,
29
+ ...w,
27
30
  ...t
28
31
  },
29
- bridgeKeys: v
30
- })), { merged: C, entry: w } = i({
32
+ bridgeKeys: S
33
+ })), { merged: k, entry: A } = i({
31
34
  libDefaults: n,
32
35
  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({
38
- "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({
47
- "flex w-full min-w-0 gap-x-3 text-left outline-hidden transition-colors": !0,
48
- "cursor-pointer select-none": !C.value.disabled,
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": !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
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), I = s(() => m({
91
+ }) : null), Y = l(() => y({
59
92
  "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({
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
- [f(E.value, "start") ?? ""]: !0
67
- }) })), R = s(() => r(T.value?.content, {}, { class: m({
99
+ [g(z.value, "start") ?? ""]: !0
100
+ }))), Z = l(() => r(R.value?.content, {}, y({
68
101
  "min-w-0 flex-1": !0,
69
- [f(E.value, "content") ?? ""]: !0
70
- }) })), z = s(() => r(T.value?.primary, {}, { class: m({
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: C,
79
- hasEnd: M,
80
- endBind: s(() => r(T.value?.end, {}, { class: m({
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
- [f(E.value, "end") ?? ""]: !0
83
- }) })),
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
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 b(r, i) {
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 { b as resolveListItemPrimary, y as useListItem };
136
+ export { w as resolveListItemPrimary, C as useListItem };
@@ -1,3 +1,3 @@
1
1
  export { useListItem } from './composables/useListItem';
2
- export type { ListItemAlignOverrides, ListItemClasses, ListItemCustomProps, ListItemOwnProps, ListItemProps, ListItemSlots, } from './listItem.types';
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 { ListItemAlign, MergeHtmlProps, MergeProps } from '@bridge-ui/core';
3
- export interface ListItemAlignOverrides {}
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, { class: d({
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,