bits-ui 2.11.3 → 2.11.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.
|
@@ -304,7 +304,7 @@ export declare class SelectGroupHeadingState {
|
|
|
304
304
|
};
|
|
305
305
|
}
|
|
306
306
|
interface SelectHiddenInputStateOpts extends ReadableBoxedValues<{
|
|
307
|
-
value: string;
|
|
307
|
+
value: string | undefined;
|
|
308
308
|
}> {
|
|
309
309
|
}
|
|
310
310
|
export declare class SelectHiddenInputState {
|
|
@@ -318,7 +318,7 @@ export declare class SelectHiddenInputState {
|
|
|
318
318
|
readonly disabled: true | undefined;
|
|
319
319
|
readonly required: true | undefined;
|
|
320
320
|
readonly name: string;
|
|
321
|
-
readonly value: string;
|
|
321
|
+
readonly value: string | undefined;
|
|
322
322
|
readonly onfocus: (e: BitsFocusEvent) => void;
|
|
323
323
|
};
|
|
324
324
|
}
|
|
@@ -132,8 +132,8 @@ export class SelectSingleRootState extends SelectBaseRootState {
|
|
|
132
132
|
currentLabel = $derived.by(() => {
|
|
133
133
|
if (!this.opts.items.current.length)
|
|
134
134
|
return "";
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
return (this.opts.items.current.find((item) => item.value === this.opts.value.current)?.label ??
|
|
136
|
+
"");
|
|
137
137
|
});
|
|
138
138
|
candidateLabels = $derived.by(() => {
|
|
139
139
|
if (!this.opts.items.current.length)
|
|
@@ -166,8 +166,11 @@ export class SelectSingleRootState extends SelectBaseRootState {
|
|
|
166
166
|
return this.opts.value.current === itemValue;
|
|
167
167
|
}
|
|
168
168
|
toggleItem(itemValue, itemLabel = itemValue) {
|
|
169
|
-
|
|
170
|
-
this.opts.
|
|
169
|
+
const newValue = this.includesItem(itemValue) ? "" : itemValue;
|
|
170
|
+
this.opts.value.current = newValue;
|
|
171
|
+
if (newValue !== "") {
|
|
172
|
+
this.opts.inputValue.current = itemLabel;
|
|
173
|
+
}
|
|
171
174
|
}
|
|
172
175
|
setInitialHighlightedNode() {
|
|
173
176
|
afterTick(() => {
|
|
@@ -836,7 +839,6 @@ export class SelectItemState {
|
|
|
836
839
|
onpointerup(e) {
|
|
837
840
|
if (e.defaultPrevented || !this.opts.ref.current)
|
|
838
841
|
return;
|
|
839
|
-
// prevent any default behavior
|
|
840
842
|
/**
|
|
841
843
|
* For one reason or another, when it's a touch pointer and _not_ on IOS,
|
|
842
844
|
* we need to listen for the immediate click event to handle the selection,
|
|
@@ -1083,6 +1085,19 @@ export class SelectScrollDownButtonState {
|
|
|
1083
1085
|
this.handleScroll(true);
|
|
1084
1086
|
return on(this.content.viewportNode, "scroll", () => this.handleScroll());
|
|
1085
1087
|
});
|
|
1088
|
+
/**
|
|
1089
|
+
* If the input value changes, this means that the filtered items may have changed,
|
|
1090
|
+
* so we need to re-evaluate the scroll-ability of the list.
|
|
1091
|
+
*/
|
|
1092
|
+
watch([
|
|
1093
|
+
() => this.root.opts.inputValue.current,
|
|
1094
|
+
() => this.content.viewportNode,
|
|
1095
|
+
() => this.content.isPositioned,
|
|
1096
|
+
], () => {
|
|
1097
|
+
if (!this.content.viewportNode || !this.content.isPositioned)
|
|
1098
|
+
return;
|
|
1099
|
+
this.handleScroll(true);
|
|
1100
|
+
});
|
|
1086
1101
|
watch(() => this.scrollButtonState.mounted, () => {
|
|
1087
1102
|
if (!this.scrollButtonState.mounted)
|
|
1088
1103
|
return;
|
package/dist/internal/warn.js
CHANGED