@jskit-ai/http-web 0.2.59 → 0.2.61

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.
@@ -50,6 +50,7 @@ window.releaseOptions = () => {
50
50
  item-value="value"
51
51
  :loading="loading"
52
52
  />
53
+ <SelectField data-testid="unlabeled-field" :items="services" :loading="loading" />
53
54
  <pre data-testid="select-field-models">{{ JSON.stringify({ service, retired, serviceIds }) }}</pre>
54
55
  </v-main>
55
56
  </v-app>
package/locales/en.json CHANGED
@@ -113,6 +113,8 @@
113
113
  "saveFailed": "Unable to save resource."
114
114
  },
115
115
  "selectField": {
116
+ "loading": "Loading options",
117
+ "loadingFor": "Loading options for {label}",
116
118
  "unavailableOption": "Unavailable option"
117
119
  }
118
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/http-web",
3
- "version": "0.2.59",
3
+ "version": "0.2.61",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "jskit test"
@@ -47,20 +47,20 @@
47
47
  "./locales/en.json": "./locales/en.json"
48
48
  },
49
49
  "dependencies": {
50
- "@jskit-ai/resource-crud-core": "0.1.226"
50
+ "@jskit-ai/resource-crud-core": "0.1.228"
51
51
  },
52
52
  "peerDependencies": {
53
- "@jskit-ai/http-runtime": "0.2.34",
54
- "@jskit-ai/kernel": "0.2.33",
55
- "@jskit-ai/realtime": "0.2.53",
56
- "@jskit-ai/shell-web": "0.2.50",
53
+ "@jskit-ai/http-runtime": "0.2.36",
54
+ "@jskit-ai/kernel": "0.2.35",
55
+ "@jskit-ai/realtime": "0.2.55",
56
+ "@jskit-ai/shell-web": "0.2.52",
57
57
  "@tanstack/vue-query": "^5.90.5",
58
58
  "vue": "^3.5.13",
59
59
  "vue-router": "^5.0.4",
60
60
  "vuetify": "^4.3.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@jskit-ai/material-web": "0.1.10"
63
+ "@jskit-ai/material-web": "0.1.11"
64
64
  },
65
65
  "description": "Neutral Vue request, command, resource, and CRUD UI runtime for JSKIT web applications.",
66
66
  "jskit": {
@@ -31,7 +31,7 @@ const screen = useCrudListScreen({
31
31
  empty-body="Add your first book to begin the catalogue."
32
32
  >
33
33
  <template #card-fields="{ record, formatListCardValue }">
34
- <dl class="d-grid ga-2 mb-0">
34
+ <dl class="d-flex flex-column ga-2 mb-0">
35
35
  <div>
36
36
  <dt class="text-body-small on-surface-variant">Author</dt>
37
37
  <dd class="text-body-medium ma-0">{{ formatListCardValue(record.author) }}</dd>
@@ -1,7 +1,9 @@
1
1
  <script setup>
2
- import { computed, ref } from "vue";
2
+ import { computed, ref, useAttrs } from "vue";
3
3
  import { VAutocomplete } from "vuetify/components/VAutocomplete";
4
+ import { VProgressLinear } from "vuetify/components/VProgressLinear";
4
5
  import { VSelect } from "vuetify/components/VSelect";
6
+ import { useJskitText } from "../i18n.js";
5
7
  import { optionTitle, optionValue, selectionFieldState } from "../support/selectFieldSupport.js";
6
8
 
7
9
  // A v-select / v-autocomplete that never shows a stored id as text (see selectFieldSupport.js).
@@ -21,6 +23,8 @@ const props = defineProps({
21
23
  });
22
24
  const emit = defineEmits(["update:modelValue"]);
23
25
 
26
+ const attrs = useAttrs();
27
+ const { t } = useJskitText();
24
28
  const field = ref(null);
25
29
  const seen = new Map();
26
30
  const state = computed(() => selectionFieldState(props, seen));
@@ -33,6 +37,12 @@ function update(value) {
33
37
  emit("update:modelValue", props.multiple && hidden.length ? [...hidden, ...[].concat(value ?? [])] : value);
34
38
  }
35
39
 
40
+ // Vuetify's loading bar has no accessible name (axe aria-progressbar-name), so the field draws the same bar with one,
41
+ // naming its field when it has a label. A loader slot the app passes still replaces it.
42
+ function loaderLabel() {
43
+ return attrs.label ? t("jskit.http.selectField.loadingFor", { label: attrs.label }) : t("jskit.http.selectField.loading");
44
+ }
45
+
36
46
  defineExpose({ focus: () => field.value?.focus() });
37
47
  </script>
38
48
 
@@ -50,6 +60,9 @@ defineExpose({ focus: () => field.value?.focus() });
50
60
  :loading="loading"
51
61
  @update:model-value="update"
52
62
  >
63
+ <template v-if="!$slots.loader" #loader="{ color, isActive }">
64
+ <VProgressLinear :active="isActive" :color="color" height="2" indeterminate :aria-label="loaderLabel()" />
65
+ </template>
53
66
  <template v-for="(_, name) in $slots" #[name]="slotProps">
54
67
  <slot :name="name" v-bind="slotProps || {}" />
55
68
  </template>
@@ -24,7 +24,7 @@ async function assertNoStoredIdShown(page) {
24
24
 
25
25
  const openFixture = sharedBrowserFixture({ fixtureRoot: fileURLToPath(new URL("../fixtures/select-field/", import.meta.url)) });
26
26
 
27
- test("SelectField never shows a stored id while options load and titles unmatched values afterwards", {
27
+ test("SelectField never shows a stored id while options load, names its loading bar, and titles unmatched values afterwards", {
28
28
  skip: process.env.JSKIT_HTTP_WEB_SELECT_FIELD_BROWSER === "1"
29
29
  ? false
30
30
  : "set JSKIT_HTTP_WEB_SELECT_FIELD_BROWSER=1 to run the select field browser regression",
@@ -44,6 +44,12 @@ test("SelectField never shows a stored id while options load and titles unmatche
44
44
  await expect(field(page, label).locator(".v-field--loading")).toHaveCount(1);
45
45
  }
46
46
 
47
+ // Each loading bar has a name for screen readers (axe aria-progressbar-name), with or without a field label.
48
+ for (const label of FIELDS) {
49
+ await expect(field(page, label).getByRole("progressbar")).toHaveAccessibleName(`Loading options for ${label}`);
50
+ }
51
+ await expect(page.getByTestId("unlabeled-field").getByRole("progressbar")).toHaveAccessibleName("Loading options");
52
+
47
53
  // Removing the visible chip keeps the value hidden while its options load.
48
54
  await field(page, "Extras").locator(".v-chip__close").click();
49
55
  assert.deepEqual(await readModels(page), { service: 53, retired: 99, serviceIds: [53] });