@sit-onyx/headless 1.0.0-beta.2 → 1.0.0-beta.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sit-onyx/headless",
3
3
  "description": "Headless composables for Vue",
4
- "version": "1.0.0-beta.2",
4
+ "version": "1.0.0-beta.3",
5
5
  "type": "module",
6
6
  "author": "Schwarz IT KG",
7
7
  "license": "Apache-2.0",
@@ -26,7 +26,6 @@ const onToggle = () => (isExpanded.value = !isExpanded.value);
26
26
  const onTypeAhead = () => {};
27
27
 
28
28
  const comboBox = createComboBox({
29
- inputValue: selectedOption,
30
29
  autocomplete: "none",
31
30
  label: "some label",
32
31
  listLabel: "List",
@@ -51,7 +50,12 @@ defineExpose({ comboBox });
51
50
 
52
51
  <template>
53
52
  <div ref="comboboxRef">
54
- <input v-bind="input" readonly @keydown.arrow-down="isExpanded = true" />
53
+ <input
54
+ v-bind="input"
55
+ v-model="selectedOption"
56
+ readonly
57
+ @keydown.arrow-down="isExpanded = true"
58
+ />
55
59
 
56
60
  <button v-bind="button">
57
61
  <template v-if="isExpanded">⬆️</template>
@@ -30,7 +30,6 @@ const onAutocomplete = (input: string) => (searchTerm.value = input);
30
30
  const onToggle = () => (isExpanded.value = !isExpanded.value);
31
31
 
32
32
  const comboBox = createComboBox({
33
- inputValue: searchTerm,
34
33
  autocomplete: "list",
35
34
  label: "some label",
36
35
  listLabel: "List",
@@ -55,7 +54,7 @@ defineExpose({ comboBox });
55
54
 
56
55
  <template>
57
56
  <div ref="comboboxRef">
58
- <input v-bind="input" @keydown.arrow-down="isExpanded = true" />
57
+ <input v-bind="input" v-model="searchTerm" @keydown.arrow-down="isExpanded = true" />
59
58
 
60
59
  <button v-bind="button">
61
60
  <template v-if="isExpanded">⬆️</template>
@@ -41,10 +41,6 @@ export type CreateComboboxOptions<
41
41
  * Labels the listbox which displays the available options. E.g. the list label could be "Countries" for a combobox which is labelled "Country".
42
42
  */
43
43
  listLabel: MaybeRef<string>;
44
- /**
45
- * The current value of the combobox. Is updated when an option from the controlled listbox is selected or by typing into it.
46
- */
47
- inputValue: Ref<string | undefined>;
48
44
  /**
49
45
  * Controls the opened/visible state of the associated pop-up. When expanded the activeOption can be controlled via the keyboard.
50
46
  */
@@ -105,7 +101,6 @@ export const createComboBox = createBuilder(
105
101
  TAutoComplete extends ComboboxAutoComplete,
106
102
  TMultiple extends boolean = false,
107
103
  >({
108
- inputValue,
109
104
  autocomplete: autocompleteRef,
110
105
  onAutocomplete,
111
106
  onTypeAhead,
@@ -250,7 +245,6 @@ export const createComboBox = createBuilder(
250
245
  * The input MAY be either a single-line text field that supports editing and typing or an element that only displays the current value of the combobox.
251
246
  */
252
247
  input: computed(() => ({
253
- value: inputValue.value,
254
248
  role: "combobox",
255
249
  "aria-expanded": isExpanded.value,
256
250
  "aria-controls": controlsId,
@@ -22,22 +22,11 @@ export const navigationTesting = async ({ nav, buttons }: NavigationMenuTestingO
22
22
  */
23
23
  await expect(nav).toHaveRole("navigation");
24
24
  await expect(nav).toHaveAttribute("aria-label");
25
- /**
26
- * Disclosure buttons should have aria attributes
27
- */
28
- for (const button of await buttons.all()) {
29
- await expect(button, "button must have arial-controls attribute").toHaveAttribute(
30
- "aria-controls",
31
- );
32
- await expect(button, "button must have aria-expanded attribute").toHaveAttribute(
33
- "aria-expanded",
34
- );
35
- }
25
+
36
26
  /**
37
27
  * Focus first button
38
28
  */
39
- await nav.press("Tab");
40
- await expect(buttons.nth(0)).toBeFocused();
29
+ await buttons.first().focus();
41
30
  /**
42
31
  * Move keyboard focus among top-level buttons using arrow keys
43
32
  */
package/src/playwright.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./composables/comboBox/createComboBox.testing";
2
2
  export * from "./composables/listbox/createListbox.testing";
3
3
  export * from "./composables/menuButton/createMenuButton.testing";
4
+ export * from "./composables/navigationMenu/createMenu.testing";