@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.
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +72 -70
- package/dist/Components/Listbox/listbox.types.d.ts +10 -1
- package/dist/Components/Select/composables/useSelect.d.ts +2 -1
- package/dist/Components/Select/composables/useSelect.js +3 -2
- package/dist/Components/Tabs/tabs.types.d.ts +1 -1
- package/package.json +2 -2
|
@@ -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
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import {
|
|
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 },
|
|
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(
|
|
66
|
-
let
|
|
67
|
-
A(
|
|
68
|
-
|
|
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
|
|
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
|
-
}),
|
|
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
|
|
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
|
|
85
|
+
function de(e, t) {
|
|
84
86
|
let n = {
|
|
85
87
|
tabindex: -1,
|
|
86
|
-
onMousedown:
|
|
87
|
-
class:
|
|
88
|
+
onMousedown: ue,
|
|
89
|
+
class: N(H.value?.option)
|
|
88
90
|
};
|
|
89
|
-
return Q(e.value) ? n.class =
|
|
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:
|
|
92
|
-
secondary: { class:
|
|
93
|
+
primary: { class: H.value?.primary },
|
|
94
|
+
secondary: { class: H.value?.secondary }
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
97
|
function $(e) {
|
|
96
|
-
e.disabled ||
|
|
98
|
+
e.disabled || F("select", e);
|
|
97
99
|
}
|
|
98
|
-
function
|
|
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
|
|
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 &&
|
|
108
|
-
}, { deep: !0 }),
|
|
109
|
-
getOptionIndex:
|
|
110
|
-
registerOption:
|
|
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:
|
|
114
|
+
listboxId: L.listboxId,
|
|
113
115
|
isSelected: Q,
|
|
114
|
-
sizeClasses:
|
|
115
|
-
showCheckmark:
|
|
116
|
+
sizeClasses: H.value,
|
|
117
|
+
showCheckmark: L.showCheckmark,
|
|
116
118
|
checkClass: X.value,
|
|
117
|
-
highlightedIndex:
|
|
118
|
-
optionSelectedClass:
|
|
119
|
-
optionHighlightedClass:
|
|
119
|
+
highlightedIndex: L.highlightedIndex,
|
|
120
|
+
optionSelectedClass: W.value,
|
|
121
|
+
optionHighlightedClass: G.value,
|
|
120
122
|
mergedClasses: {
|
|
121
|
-
optionSelected:
|
|
122
|
-
optionHighlighted:
|
|
123
|
+
optionSelected: U.value.optionSelected,
|
|
124
|
+
optionHighlighted: U.value.optionHighlighted
|
|
123
125
|
}
|
|
124
126
|
})));
|
|
125
|
-
let
|
|
126
|
-
return (r, i) => (
|
|
127
|
-
modelValue:
|
|
128
|
-
"onUpdate:modelValue": i[0] ||= (e) =>
|
|
129
|
-
"anchor-el":
|
|
130
|
-
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":
|
|
133
|
-
"custom-props": { content: D(
|
|
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(
|
|
137
|
-
|
|
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(
|
|
142
|
-
classes: { bar: D(
|
|
143
|
-
"custom-props": { bar: D(
|
|
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
|
-
]),
|
|
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:
|
|
153
|
-
"aria-labelledby":
|
|
154
|
-
"aria-multiselectable":
|
|
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 }) : (
|
|
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"])) : (
|
|
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: `${
|
|
170
|
-
"custom-props":
|
|
171
|
-
primary: D(e)(D(
|
|
172
|
-
},
|
|
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,
|
|
181
|
+
} : void 0, m.showCheckmark && t.selected ? {
|
|
180
182
|
name: "end",
|
|
181
|
-
fn: j(() => [
|
|
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(
|
|
199
|
-
D(e)(D(
|
|
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
|
-
},
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.0.
|
|
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.
|
|
63
|
+
"@bridge-ui/core": "^0.0.2",
|
|
64
64
|
"@lucide/vue": ">=1.0.0",
|
|
65
65
|
"vue": "^3.4.0"
|
|
66
66
|
},
|