1
1
import { Previous } from "runed" ;
2
2
import { untrack } from "svelte" ;
3
+ import { styleToString } from "svelte-toolbelt" ;
3
4
import type { InteractOutsideEvent } from "../utilities/dismissable-layer/types.js" ;
4
5
import { afterTick } from "$lib/internal/afterTick.js" ;
5
6
import { backward , forward , next , prev } from "$lib/internal/arrays.js" ;
@@ -19,6 +20,7 @@ import { useRefById } from "$lib/internal/useRefById.svelte.js";
19
20
import { noop } from "$lib/internal/callbacks.js" ;
20
21
import { addEventListener } from "$lib/internal/events.js" ;
21
22
import { type Typeahead , useTypeahead } from "$lib/internal/useTypeahead.svelte.js" ;
23
+ import { srOnlyStyles } from "$lib/internal/style.js" ;
22
24
23
25
// prettier-ignore
24
26
export const INTERACTION_KEYS = [ kbd . ARROW_LEFT , kbd . ESCAPE , kbd . ARROW_RIGHT , kbd . SHIFT , kbd . CAPS_LOCK , kbd . CONTROL , kbd . ALT , kbd . META , kbd . ENTER , kbd . F1 , kbd . F2 , kbd . F3 , kbd . F4 , kbd . F5 , kbd . F6 , kbd . F7 , kbd . F8 , kbd . F9 , kbd . F10 , kbd . F11 , kbd . F12 ] ;
@@ -676,16 +678,16 @@ class ListboxContentState {
676
678
"--bits-combobox-content-transform-origin" : "var(--bits-floating-transform-origin)" ,
677
679
"--bits-combobox-content-available-width" : "var(--bits-floating-available-width)" ,
678
680
"--bits-combobox-content-available-height" : "var(--bits-floating-available-height)" ,
679
- "--bits-combobox-trigger -width" : "var(--bits-floating-anchor-width)" ,
680
- "--bits-combobox-trigger -height" : "var(--bits-floating-anchor-height)" ,
681
+ "--bits-combobox-anchor -width" : "var(--bits-floating-anchor-width)" ,
682
+ "--bits-combobox-anchor -height" : "var(--bits-floating-anchor-height)" ,
681
683
} ;
682
684
} else {
683
685
return {
684
686
"--bits-listbox-content-transform-origin" : "var(--bits-floating-transform-origin)" ,
685
687
"--bits-listbox-content-available-width" : "var(--bits-floating-available-width)" ,
686
688
"--bits-listbox-content-available-height" : "var(--bits-floating-available-height)" ,
687
- "--bits-listbox-trigger -width" : "var(--bits-floating-anchor-width)" ,
688
- "--bits-listbox-trigger -height" : "var(--bits-floating-anchor-height)" ,
689
+ "--bits-listbox-anchor -width" : "var(--bits-floating-anchor-width)" ,
690
+ "--bits-listbox-anchor -height" : "var(--bits-floating-anchor-height)" ,
689
691
} ;
690
692
}
691
693
} ) ;
@@ -856,19 +858,19 @@ class ListboxGroupState {
856
858
} ) as const
857
859
) ;
858
860
859
- createGroupLabel ( props : ListboxGroupLabelStateProps ) {
860
- return new ListboxGroupLabelState ( props , this ) ;
861
+ createGroupHeading ( props : ListboxGroupHeadingStateProps ) {
862
+ return new ListboxGroupHeadingState ( props , this ) ;
861
863
}
862
864
}
863
865
864
- type ListboxGroupLabelStateProps = WithRefProps ;
866
+ type ListboxGroupHeadingStateProps = WithRefProps ;
865
867
866
- class ListboxGroupLabelState {
867
- #id: ListboxGroupLabelStateProps [ "id" ] ;
868
- #ref: ListboxGroupLabelStateProps [ "ref" ] ;
868
+ class ListboxGroupHeadingState {
869
+ #id: ListboxGroupHeadingStateProps [ "id" ] ;
870
+ #ref: ListboxGroupHeadingStateProps [ "ref" ] ;
869
871
group : ListboxGroupState ;
870
872
871
- constructor ( props : ListboxGroupLabelStateProps , group : ListboxGroupState ) {
873
+ constructor ( props : ListboxGroupHeadingStateProps , group : ListboxGroupState ) {
872
874
this . #id = props . id ;
873
875
this . #ref = props . ref ;
874
876
this . group = group ;
@@ -913,6 +915,7 @@ class ListboxHiddenInputState {
913
915
name : this . root . name . current ,
914
916
value : this . #value. current ,
915
917
"aria-hidden" : getAriaHidden ( true ) ,
918
+ style : styleToString ( srOnlyStyles ) ,
916
919
} ) as const
917
920
) ;
918
921
}
@@ -1218,8 +1221,8 @@ export function useListboxGroup(props: ListboxGroupStateProps) {
1218
1221
return setListboxGroupContext ( getListboxRootContext ( ) . createGroup ( props ) ) ;
1219
1222
}
1220
1223
1221
- export function useListboxGroupLabel ( props : ListboxGroupLabelStateProps ) {
1222
- return getListboxGroupContext ( ) . createGroupLabel ( props ) ;
1224
+ export function useListboxGroupHeading ( props : ListboxGroupHeadingStateProps ) {
1225
+ return getListboxGroupContext ( ) . createGroupHeading ( props ) ;
1223
1226
}
1224
1227
1225
1228
export function useListboxHiddenInput ( props : ListboxHiddenInputStateProps ) {
0 commit comments