@stenajs-webui/elements 23.21.5 → 23.21.7

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/README.md CHANGED
@@ -8,6 +8,10 @@ These are primarly "dumb" components, with no (or very little) logic.
8
8
 
9
9
  - [ActionMenu](src/components/ui/action-menu/ActionMenu.md)
10
10
  - Badge
11
+ - Banners
12
+ - Banner
13
+ - ResultListBanner
14
+ - ValidationBanner (Banner in an ARIA live region)
11
15
  - Buttons
12
16
  - FlatButton
13
17
  - PrimaryButton
@@ -0,0 +1,51 @@
1
+ import { LivelyPoliteness } from "@stenajs-webui/core";
2
+ import * as React from "react";
3
+ import { BannerProps } from "../banner/Banner";
4
+ export interface ValidationBannerProps extends Omit<BannerProps, "aria-live"> {
5
+ /**
6
+ * Whether the validation result is shown.
7
+ *
8
+ * The live region is rendered either way, so the props of the banner can be
9
+ * static, such as translated texts, while this prop follows the validation
10
+ * result.
11
+ */
12
+ visible: boolean;
13
+ /**
14
+ * How eagerly assistive technology should announce the validation result.
15
+ *
16
+ * - `polite` waits until the user is idle.
17
+ * - `assertive` interrupts the user, and should be used sparingly.
18
+ * - `off` stops announcing results, without removing the region.
19
+ *
20
+ * @default "polite"
21
+ */
22
+ politeness?: LivelyPoliteness;
23
+ }
24
+ /**
25
+ * A Banner inside an ARIA live region, for validation results that come and go.
26
+ *
27
+ * The live region is rendered at all times, also while the validation passes,
28
+ * since screen readers only announce updates to live regions that already
29
+ * exist. Only the banner is added and removed, and the region adds no gap of
30
+ * its own, so keeping it mounted next to a form field does not affect the
31
+ * layout.
32
+ *
33
+ * All Banner props are forwarded, so the banner is styled and structured
34
+ * exactly like a Banner.
35
+ *
36
+ * @example
37
+ * <Column gap={2}>
38
+ * <LabelledTextInput
39
+ * label={"Email"}
40
+ * value={email}
41
+ * onValueChange={setEmail}
42
+ * />
43
+ * <ValidationBanner
44
+ * visible={isInvalid}
45
+ * variant={"error"}
46
+ * headerText={t("validation.email.header")}
47
+ * text={t("validation.email.text")}
48
+ * />
49
+ * </Column>
50
+ */
51
+ export declare const ValidationBanner: React.FC<ValidationBannerProps>;
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./icons/IconSizes";
13
13
  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
+ export * from "./components/ui/banners/validation-banner/ValidationBanner";
16
17
  export * from "./components/ui/result-list/ResultList";
17
18
  export * from "./components/ui/result-list/ResultListRow";
18
19
  export * from "./components/ui/spinner/Spinner";