@stenajs-webui/elements 23.21.9 → 23.21.11

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.
@@ -0,0 +1,51 @@
1
+ import { LivelyPoliteness } from "@stenajs-webui/core";
2
+ import * as React from "react";
3
+ import { ResultListBannerProps, ResultListBannerState } from "../result-list-banner/ResultListBanner";
4
+ export interface ValidationResultListBannerProps extends Omit<ResultListBannerProps, "bannerState" | "aria-live"> {
5
+ /**
6
+ * The result to show, or undefined when there is no result to show.
7
+ *
8
+ * Unlike ValidationBanner, there is no separate visible prop, since the
9
+ * whole content of the banner is this one prop. It is the same value that
10
+ * useResultListBannerState holds, and it is undefined exactly when the
11
+ * banner should be hidden.
12
+ */
13
+ bannerState: ResultListBannerState | undefined;
14
+ /**
15
+ * How eagerly assistive technology should announce the validation result.
16
+ *
17
+ * - `polite` waits until the user is idle.
18
+ * - `assertive` interrupts the user, and should be used sparingly.
19
+ * - `off` stops announcing results, without removing the region.
20
+ *
21
+ * @default "polite"
22
+ */
23
+ politeness?: LivelyPoliteness;
24
+ }
25
+ /**
26
+ * A ResultListBanner inside an ARIA live region, for validation results that
27
+ * come and go.
28
+ *
29
+ * The live region is rendered at all times, also while there is no result,
30
+ * since screen readers only announce updates to live regions that already
31
+ * exist. Only the banner is added and removed, and the region adds no gap of
32
+ * its own, so keeping it mounted next to a form does not affect the layout.
33
+ *
34
+ * All ResultListBanner props are forwarded, so the banner is styled and
35
+ * structured exactly like a ResultListBanner.
36
+ *
37
+ * @example
38
+ * const { bannerState, setBannerResultWithErrors, clearBannerResult } =
39
+ * useResultListBannerState();
40
+ *
41
+ * return (
42
+ * <Column gap={2}>
43
+ * <ValidationResultListBanner
44
+ * bannerState={bannerState}
45
+ * variant={"error"}
46
+ * />
47
+ * <PrimaryButton label={t("save")} onClick={onSave} />
48
+ * </Column>
49
+ * );
50
+ */
51
+ export declare const ValidationResultListBanner: React.FC<ValidationResultListBannerProps>;
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./components/ui/banners/banner/Banner";
14
14
  export * from "./components/ui/banners/result-list-banner/ResultListBanner";
15
15
  export * from "./components/ui/banners/result-list-banner/hooks/UseResultListBannerState";
16
16
  export * from "./components/ui/banners/validation-banner/ValidationBanner";
17
+ export * from "./components/ui/banners/validation-result-list-banner/ValidationResultListBanner";
17
18
  export * from "./components/ui/result-list/ResultList";
18
19
  export * from "./components/ui/result-list/ResultListRow";
19
20
  export * from "./components/ui/spinner/Spinner";