@bridge-ui/vue 0.0.1 → 0.0.2

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.
@@ -2,17 +2,18 @@ import { hasNamedSlot as e, resolveNamedSlot as t } from "../../Utils/slotOrProp
2
2
  import n from "../List/List.js";
3
3
  import { useListbox as r } from "./composables/useListbox.js";
4
4
  import { LISTBOX_INJECTION_KEY as i } from "./listboxInjectionKey.js";
5
- import a from "../ListItem/ListItem.js";
6
- import o from "../ListSection/ListSection.js";
7
- import s from "../Menu/Menu.js";
8
- import ee from "../Progress/Progress.js";
9
- import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createSlots as te, createVNode as m, defineComponent as h, guardReactiveProps as g, mergeModels as _, mergeProps as v, normalizeClass as y, normalizeProps as b, openBlock as x, provide as S, ref as C, renderList as ne, renderSlot as w, resolveDynamicComponent as T, toDisplayString as E, unref as D, useModel as O, useSlots as k, watch as A, withCtx as j } from "vue";
10
- import { cn as M, entriesFromListboxOptions as re, flattenListboxOptions as ie, mapListboxEntriesToRows as ae } from "@bridge-ui/core";
5
+ import ee from "../ListItem/ListItem.js";
6
+ import te from "../ListSection/ListSection.js";
7
+ import a from "../Menu/Menu.js";
8
+ import ne from "../Progress/Progress.js";
9
+ import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createSlots as f, createVNode as p, defineComponent as m, guardReactiveProps as h, mergeModels as g, mergeProps as _, normalizeClass as v, normalizeProps as y, openBlock as b, provide as x, ref as S, renderList as C, renderSlot as w, resolveDynamicComponent as T, toDisplayString as E, unref as D, useModel as O, useSlots as k, watch as A, withCtx as j } from "vue";
10
+ import { isNil as M } from "es-toolkit/compat";
11
+ import { cn as N, entriesFromListboxOptions as re, flattenListboxOptions as ie, mapListboxEntriesToRows as ae } from "@bridge-ui/core";
11
12
  import { Check as oe } from "@lucide/vue";
12
13
  //#region src/Components/Listbox/Listbox.vue?vue&type=script&setup=true&lang.ts
13
- var se = { key: 1 }, N = /* @__PURE__ */ h({
14
+ var se = { key: 1 }, P = /* @__PURE__ */ m({
14
15
  __name: "Listbox",
15
- props: /* @__PURE__ */ _({
16
+ props: /* @__PURE__ */ g({
16
17
  anchorEl: {},
17
18
  classes: {},
18
19
  color: { default: "primary" },
@@ -45,6 +46,7 @@ var se = { key: 1 }, N = /* @__PURE__ */ h({
45
46
  },
46
47
  options: {},
47
48
  placement: { default: "bottom-start" },
49
+ rounded: {},
48
50
  showCheckmark: {
49
51
  type: Boolean,
50
52
  default: !0
@@ -57,107 +59,107 @@ var se = { key: 1 }, N = /* @__PURE__ */ h({
57
59
  },
58
60
  modelModifiers: {}
59
61
  }),
60
- emits: /* @__PURE__ */ _([
62
+ emits: /* @__PURE__ */ g([
61
63
  "registered-options-change",
62
64
  "select",
63
65
  "show-change"
64
66
  ], ["update:modelValue"]),
65
- setup(h, { emit: _ }) {
66
- let N = k(), P = _, F = O(h, "modelValue");
67
- A(F, (e) => {
68
- P("show-change", e);
67
+ setup(m, { emit: g }) {
68
+ let P = k(), F = g, I = O(m, "modelValue");
69
+ A(I, (e) => {
70
+ F("show-change", e);
69
71
  });
70
- let I = h, { merged: L, checkClass: R, scrollBind: z, messageBind: B, sizeClasses: V, mergedClasses: H, optionSelectedClass: U, optionHighlightedClass: W } = r(I, {
72
+ let L = m, { merged: R, checkClass: z, scrollBind: B, messageBind: V, sizeClasses: H, mergedClasses: U, optionSelectedClass: W, optionHighlightedClass: G } = r(L, {
71
73
  size: "md",
72
74
  color: "primary"
73
- }), G = l(() => I.options ?? []), K = l(() => I.entries ? I.entries : re(G.value)), q = l(() => ie(K.value)), J = l(() => e(N, "default")), Y = l(() => !I.loading && !J.value && q.value.length === 0 && I.hideEmptyMessage !== !0), X = l(() => M(R.value, H.value.check)), Z = C([]);
75
+ }), ce = s(() => L.options ?? []), K = s(() => L.entries ? L.entries : re(ce.value)), q = s(() => ie(K.value)), J = s(() => e(P, "default")), Y = s(() => !L.loading && !J.value && q.value.length === 0 && L.hideEmptyMessage !== !0), X = s(() => N(z.value, U.value.check)), Z = S([]);
74
76
  function Q(e) {
75
- return I.isSelected?.(e) ?? !1;
76
- }
77
- function ce(e) {
78
- return I.highlightedIndex === e;
77
+ return L.isSelected?.(e) ?? !1;
79
78
  }
80
79
  function le(e) {
80
+ return L.highlightedIndex === e;
81
+ }
82
+ function ue(e) {
81
83
  e.preventDefault();
82
84
  }
83
- function ue(e, t) {
85
+ function de(e, t) {
84
86
  let n = {
85
87
  tabindex: -1,
86
- onMousedown: le,
87
- class: M(V.value?.option)
88
+ onMousedown: ue,
89
+ class: N(H.value?.option)
88
90
  };
89
- return Q(e.value) ? n.class = M(n.class, U.value, H.value.optionSelected) : ce(t) && (n.class = M(n.class, W.value, H.value.optionHighlighted)), {
91
+ return Q(e.value) ? n.class = N(n.class, W.value, U.value.optionSelected) : le(t) && (n.class = N(n.class, G.value, U.value.optionHighlighted)), {
90
92
  interactive: n,
91
- primary: { class: V.value?.primary },
92
- secondary: { class: V.value?.secondary }
93
+ primary: { class: H.value?.primary },
94
+ secondary: { class: H.value?.secondary }
93
95
  };
94
96
  }
95
97
  function $(e) {
96
- e.disabled || P("select", e);
98
+ e.disabled || F("select", e);
97
99
  }
98
- function de(e) {
100
+ function fe(e) {
99
101
  return Z.value.some((t) => String(t.value) === String(e.value)) || (Z.value = [...Z.value, e]), () => {
100
102
  Z.value = Z.value.filter((t) => String(t.value) !== String(e.value));
101
103
  };
102
104
  }
103
- function fe(e) {
105
+ function pe(e) {
104
106
  return (J.value ? Z.value : q.value).findIndex((t) => String(t.value) === String(e));
105
107
  }
106
108
  A(Z, (e) => {
107
- J.value && P("registered-options-change", e);
108
- }, { deep: !0 }), S(i, l(() => ({
109
- getOptionIndex: fe,
110
- registerOption: de,
109
+ J.value && F("registered-options-change", e);
110
+ }, { deep: !0 }), x(i, s(() => ({
111
+ getOptionIndex: pe,
112
+ registerOption: fe,
111
113
  onSelect: $,
112
- listboxId: I.listboxId,
114
+ listboxId: L.listboxId,
113
115
  isSelected: Q,
114
- sizeClasses: V.value,
115
- showCheckmark: I.showCheckmark,
116
+ sizeClasses: H.value,
117
+ showCheckmark: L.showCheckmark,
116
118
  checkClass: X.value,
117
- highlightedIndex: I.highlightedIndex,
118
- optionSelectedClass: U.value,
119
- optionHighlightedClass: W.value,
119
+ highlightedIndex: L.highlightedIndex,
120
+ optionSelectedClass: W.value,
121
+ optionHighlightedClass: G.value,
120
122
  mergedClasses: {
121
- optionSelected: H.value.optionSelected,
122
- optionHighlighted: H.value.optionHighlighted
123
+ optionSelected: U.value.optionSelected,
124
+ optionHighlighted: U.value.optionHighlighted
123
125
  }
124
126
  })));
125
- let pe = l(() => ae(K.value, Q));
126
- return (r, i) => (x(), u(D(s), {
127
- modelValue: F.value,
128
- "onUpdate:modelValue": i[0] ||= (e) => F.value = e,
129
- "anchor-el": h.anchorEl,
130
- placement: h.placement,
127
+ let me = s(() => ae(K.value, Q));
128
+ return (r, i) => (b(), c(D(a), _({
129
+ modelValue: I.value,
130
+ "onUpdate:modelValue": i[0] ||= (e) => I.value = e,
131
+ "anchor-el": m.anchorEl,
132
+ placement: m.placement,
131
133
  "close-on-click-away": !0,
132
- "disable-auto-focus": h.disableAutoFocus,
133
- "custom-props": { content: D(L).customProps?.content }
134
- }, {
134
+ "disable-auto-focus": m.disableAutoFocus,
135
+ "custom-props": { content: D(R).customProps?.content }
136
+ }, D(M)(m.rounded) ? {} : { rounded: m.rounded }), {
135
137
  default: j(() => [
136
- D(e)(D(N), "beforeOptions") ? (x(), u(T(D(t)(D(N), "beforeOptions")), { key: 0 })) : d("", !0),
137
- h.loading ? (x(), f(c, { key: 1 }, [m(D(ee), {
138
+ D(e)(D(P), "beforeOptions") ? (b(), c(T(D(t)(D(P), "beforeOptions")), { key: 0 })) : l("", !0),
139
+ m.loading ? (b(), u(o, { key: 1 }, [p(D(ne), {
138
140
  size: "xs",
139
141
  "aria-hidden": "",
140
142
  class: "shrink-0",
141
- color: D(L).color,
142
- classes: { bar: D(H).loading },
143
- "custom-props": { bar: D(L).customProps?.loading }
143
+ color: D(R).color,
144
+ classes: { bar: D(U).loading },
145
+ "custom-props": { bar: D(R).customProps?.loading }
144
146
  }, null, 8, [
145
147
  "color",
146
148
  "classes",
147
149
  "custom-props"
148
- ]), p("div", b(g(D(B))), [D(e)(D(N), "loading") ? (x(), u(T(D(t)(D(N), "loading")), { key: 0 })) : (x(), f("span", se, E(h.loadingMessage), 1))], 16)], 64)) : (x(), f("div", b(v({ key: 2 }, D(z))), [m(D(n), {
150
+ ]), d("div", y(h(D(V))), [D(e)(D(P), "loading") ? (b(), c(T(D(t)(D(P), "loading")), { key: 0 })) : (b(), u("span", se, E(m.loadingMessage), 1))], 16)], 64)) : (b(), u("div", y(_({ key: 2 }, D(B))), [p(D(n), {
149
151
  dense: "",
150
152
  class: "p-0",
151
153
  role: "listbox",
152
- id: h.listboxId,
153
- "aria-labelledby": h.labelledBy,
154
- "aria-multiselectable": h.multiple || void 0
154
+ id: m.listboxId,
155
+ "aria-labelledby": m.labelledBy,
156
+ "aria-multiselectable": m.multiple || void 0
155
157
  }, {
156
- default: j(() => [J.value ? w(r.$slots, "default", { key: 0 }) : (x(!0), f(c, { key: 1 }, ne(pe.value, (t) => (x(), f(c, { key: t.key }, [t.kind === "section" ? (x(), u(D(o), {
158
+ default: j(() => [J.value ? w(r.$slots, "default", { key: 0 }) : (b(!0), u(o, { key: 1 }, C(me.value, (t) => (b(), u(o, { key: t.key }, [t.kind === "section" ? (b(), c(D(te), {
157
159
  key: 0,
158
160
  title: t.title,
159
161
  sticky: t.sticky
160
- }, null, 8, ["title", "sticky"])) : (x(), u(D(a), {
162
+ }, null, 8, ["title", "sticky"])) : (b(), c(D(ee), {
161
163
  key: 1,
162
164
  interactive: "",
163
165
  role: "option",
@@ -166,19 +168,19 @@ var se = { key: 1 }, N = /* @__PURE__ */ h({
166
168
  disabled: t.option.disabled,
167
169
  secondary: t.option.description,
168
170
  onClick: (e) => $(t.option),
169
- id: `${h.listboxId}-option-${t.index}`,
170
- "custom-props": ue(t.option, t.index),
171
- primary: D(e)(D(N), "option") ? void 0 : t.option.label
172
- }, te({ _: 2 }, [D(e)(D(N), "option") ? {
171
+ id: `${m.listboxId}-option-${t.index}`,
172
+ "custom-props": de(t.option, t.index),
173
+ primary: D(e)(D(P), "option") ? void 0 : t.option.label
174
+ }, f({ _: 2 }, [D(e)(D(P), "option") ? {
173
175
  name: "default",
174
176
  fn: j(() => [w(r.$slots, "option", {
175
177
  option: t.option,
176
178
  selected: t.selected
177
179
  })]),
178
180
  key: "0"
179
- } : void 0, h.showCheckmark && t.selected ? {
181
+ } : void 0, m.showCheckmark && t.selected ? {
180
182
  name: "end",
181
- fn: j(() => [m(D(oe), { class: y(X.value) }, null, 8, ["class"])]),
183
+ fn: j(() => [p(D(oe), { class: v(X.value) }, null, 8, ["class"])]),
182
184
  key: "1"
183
185
  } : void 0]), 1032, [
184
186
  "aria-selected",
@@ -195,11 +197,11 @@ var se = { key: 1 }, N = /* @__PURE__ */ h({
195
197
  "aria-labelledby",
196
198
  "aria-multiselectable"
197
199
  ])], 16)),
198
- Y.value && !D(e)(D(N), "empty") ? (x(), f("div", b(v({ key: 3 }, D(B))), E(h.emptyMessage), 17)) : Y.value && D(e)(D(N), "empty") ? (x(), u(T(D(t)(D(N), "empty")), { key: 4 })) : d("", !0),
199
- D(e)(D(N), "afterOptions") ? (x(), u(T(D(t)(D(N), "afterOptions")), { key: 5 })) : d("", !0)
200
+ Y.value && !D(e)(D(P), "empty") ? (b(), u("div", y(_({ key: 3 }, D(V))), E(m.emptyMessage), 17)) : Y.value && D(e)(D(P), "empty") ? (b(), c(T(D(t)(D(P), "empty")), { key: 4 })) : l("", !0),
201
+ D(e)(D(P), "afterOptions") ? (b(), c(T(D(t)(D(P), "afterOptions")), { key: 5 })) : l("", !0)
200
202
  ]),
201
203
  _: 3
202
- }, 8, [
204
+ }, 16, [
203
205
  "modelValue",
204
206
  "anchor-el",
205
207
  "placement",
@@ -209,4 +211,4 @@ var se = { key: 1 }, N = /* @__PURE__ */ h({
209
211
  }
210
212
  });
211
213
  //#endregion
212
- export { N as default };
214
+ export { P as default };
@@ -1,7 +1,8 @@
1
1
  import { HTMLAttributes, Slot } from 'vue';
2
- import { ListboxColor, ListboxEntry, ListboxOption, ListboxSize, ListboxValue, MergeHtmlProps, MergeProps, PositionPlacement } from '@bridge-ui/core';
2
+ import { ListboxColor, ListboxEntry, ListboxOption, ListboxSize, ListboxValue, MenuRounded, MergeHtmlProps, MergeProps, PositionPlacement } from '@bridge-ui/core';
3
3
  export interface ListboxSizeOverrides {}
4
4
  export interface ListboxColorOverrides {}
5
+ export interface ListboxRoundedOverrides {}
5
6
  export interface ListboxClasses {
6
7
  /**
7
8
  * Classes merged onto the check icon.
@@ -165,6 +166,14 @@ export interface ListboxOwnProps {
165
166
  * @default "bottom-start"
166
167
  */
167
168
  placement?: PositionPlacement;
169
+ /**
170
+ * Roundedness of the floating panel (`Menu`). When omitted, `Menu` defaults
171
+ * apply (including `Menu.defaultProps.rounded`).
172
+ *
173
+ * `Select` always forwards its own `rounded` here so the dropdown matches the
174
+ * field, independent of `Menu.defaultProps`.
175
+ */
176
+ rounded?: MergeProps<MenuRounded, ListboxRoundedOverrides>;
168
177
  /**
169
178
  * Shows a check icon on selected options.
170
179
  *
@@ -732,8 +732,9 @@ export declare function useSelect(props: SelectOwnProps, model: Ref<null | undef
732
732
  entries: ListboxEntry[];
733
733
  options: import('@bridge-ui/core').ListboxOption[];
734
734
  labelledBy: string;
735
- highlightedIndex: number;
735
+ rounded: NonNullable<keyof import('@bridge-ui/core').FormFieldRounded | undefined>;
736
736
  invalidated: boolean;
737
+ highlightedIndex: number;
737
738
  color: "dark" | "error" | "info" | "primary" | "secondary" | "success" | "warning";
738
739
  size: "2xl" | "2xs" | "lg" | "md" | "sm" | "xl" | "xs";
739
740
  classes?: import('../../Listbox').ListboxClasses;
@@ -319,8 +319,9 @@ function m(m, h, g, _, we) {
319
319
  entries: Pe.value,
320
320
  options: W.value,
321
321
  labelledBy: K.controlId.value,
322
- highlightedIndex: S.value,
323
- invalidated: K.invalidated.value
322
+ rounded: K.merged.value.rounded,
323
+ invalidated: K.invalidated.value,
324
+ highlightedIndex: S.value
324
325
  }));
325
326
  function tt(e) {
326
327
  let t = I.value;
@@ -43,7 +43,7 @@ export interface TabsOwnProps {
43
43
  */
44
44
  classes?: TabsClasses;
45
45
  /**
46
- * Accent color for the selected tab (`primary` or `dark`).
46
+ * Accent color for the selected tab.
47
47
  *
48
48
  * @default "primary"
49
49
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "license": "MIT",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
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",
63
+ "@bridge-ui/core": "^0.0.2",
64
64
  "@lucide/vue": ">=1.0.0",
65
65
  "vue": "^3.4.0"
66
66
  },