@imfusion/web-ui 0.8.1-dev.6.g254fcc45 → 0.8.1-dev.9.gda40b9aa

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/CHANGELOG.md CHANGED
@@ -15,6 +15,13 @@
15
15
  - Agent skills — Nikolaus Brunner <brunner@imfusion.com>
16
16
  - `imf-web-ui-conventions` declares named functions, local component helpers included, with `function`, and keeps
17
17
  inline callbacks as arrows.
18
+ - `imf-web-ui-conventions` loads route data with `queryClient.query({ ...options, staleTime: "static" })` in place of the
19
+ deprecated `ensureQueryData`.
20
+
21
+ ### Fixed
22
+
23
+ - Components — Nikolaus Brunner <brunner@imfusion.com>
24
+ - Screen readers announce `Field.Error` when its message appears; it has `role="alert"` by default.
18
25
 
19
26
  ---
20
27
 
@@ -29,8 +29,11 @@ export declare function Control(props: React.ComponentProps<typeof FieldPrimitiv
29
29
  export declare namespace Control {
30
30
  var displayName: string;
31
31
  }
32
- /** Field.Error — an inline validation message shown when its match condition fails. */
33
- export declare function Error(props: React.ComponentProps<typeof FieldPrimitive.Error>): import("react/jsx-runtime").JSX.Element;
32
+ /**
33
+ * Field.Error — an inline validation message shown when its match condition fails.
34
+ * It announces itself with `role="alert"`; pass another `role` to quiet it.
35
+ */
36
+ export declare function Error({ role, ...props }: React.ComponentProps<typeof FieldPrimitive.Error>): import("react/jsx-runtime").JSX.Element;
34
37
  export declare namespace Error {
35
38
  var displayName: string;
36
39
  }
package/dist/index.js CHANGED
@@ -343,11 +343,12 @@ function pt(e) {
343
343
  });
344
344
  }
345
345
  pt.displayName = "Field.Control";
346
- function mt(e) {
346
+ function mt({ role: e = "alert", ...n }) {
347
347
  return /* @__PURE__ */ h(_.Error, {
348
- ...e,
348
+ ...n,
349
+ role: e,
349
350
  "data-imf-ui-component": "Field.Error",
350
- className: (n) => ct({ className: t(e.className, n) })
351
+ className: (e) => ct({ className: t(n.className, e) })
351
352
  });
352
353
  }
353
354
  mt.displayName = "Field.Error";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imfusion/web-ui",
3
- "version": "0.8.1-dev.6.g254fcc45",
3
+ "version": "0.8.1-dev.9.gda40b9aa",
4
4
  "description": "The official Web UI component library for ImFusion web apps",
5
5
  "author": "ImFusion GmbH",
6
6
  "homepage": "https://imfusion.com",
@@ -1963,7 +1963,7 @@
1963
1963
  },
1964
1964
  {
1965
1965
  "name": "Field.Error",
1966
- "description": "Field.Error — an inline validation message shown when its match condition fails.",
1966
+ "description": "Field.Error — an inline validation message shown when its match condition fails.\nIt announces itself with `role=\"alert\"`; pass another `role` to quiet it.",
1967
1967
  "props": [
1968
1968
  {
1969
1969
  "name": "className",
@@ -19,7 +19,8 @@ Use one server-backed current-user query as the identity source:
19
19
 
20
20
  - Put it in `api/auth/queries.ts` and define its key and schema with the [data.md](data.md) pattern.
21
21
  - Expose query options as `context.api.auth.getUser()`.
22
- - Call `ensureQueryData` in a loader or a query hook in a component.
22
+ - Call `queryClient.query({ ...options, staleTime: "static" })` in a loader (see [data.md](data.md)) or a query hook in a
23
+ component.
23
24
  - Keep credentials and access tokens out of React state.
24
25
  - Do not infer authentication from local storage, decoded tokens, route flags, or permission-gated UI.
25
26
 
@@ -85,9 +85,11 @@ export function getDetails(options?: QueryOptions<User>) {
85
85
  }
86
86
  ```
87
87
 
88
- Callers choose `ensureQueryData`, `useSuspenseQuery`, or another Query API. Mutation factories likewise return
89
- `mutationOptions`, own their mutation key and parsing, and are passed to `useMutation`; do not inline those options at the
90
- call site.
88
+ Callers choose `queryClient.query`, `useSuspenseQuery`, or another Query API. A router loader reads the cache with
89
+ `queryClient.query({ ...options, staleTime: "static" })`, not the deprecated `ensureQueryData` or `fetchQuery`. Keep
90
+ `"static"`: without it the factory's `staleTime` applies (default 0), so every loader run waits on the network and the page's
91
+ `useQuery` refetches on mount. Mutation factories likewise return `mutationOptions`, own their mutation key and parsing, and
92
+ are passed to `useMutation`; do not inline those options at the call site.
91
93
 
92
94
  ## Router context access
93
95