@abgov/web-components 1.37.1-alpha.2 → 1.37.1-alpha.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.
@@ -0,0 +1,2 @@
1
+ export declare const MOBILE_BP = 624;
2
+ export declare const TABLET_BP = 1024;
@@ -0,0 +1,10 @@
1
+ export interface Message {
2
+ [key: string]: unknown;
3
+ type: string;
4
+ }
5
+ export interface ContextStore {
6
+ subscribe: (cb: (msg: Message) => void) => void;
7
+ notify: (msg: Message) => void;
8
+ }
9
+ export declare function getContext(name: string): ContextStore;
10
+ export declare function deleteContext(name: string): void;
@@ -0,0 +1,8 @@
1
+ type NoScrollOptions = {
2
+ enable: boolean;
3
+ };
4
+ export default function (_node: HTMLElement, opts: NoScrollOptions): {
5
+ update(options: NoScrollOptions): void;
6
+ destroy(): void;
7
+ };
8
+ export {};
@@ -0,0 +1,18 @@
1
+ type NumericSpacing = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10";
2
+ type TShirtSpacing = "none" | "3xs" | "2xs" | "xs" | "s" | "m" | "l" | "xl" | "2xl" | "3xl" | "4xl";
3
+ export type Spacing = NumericSpacing | TShirtSpacing | null;
4
+ /**
5
+ * import type { Spacing } from "../../common/types";
6
+ * import { calculateMargin } from "../../common/types";
7
+ *
8
+ * export let mt: Spacing = null;
9
+ * export let mr: Spacing = null;
10
+ * export let mb: Spacing = null;
11
+ * export let ml: Spacing = null;
12
+ *
13
+ * // add the following style attribute to the root element
14
+ * style={calculateMargin(mt, mr, mb, ml)}
15
+ */
16
+ export declare function calculateMargin(mt: Spacing, mr: Spacing, mb: Spacing, ml: Spacing): string;
17
+ export declare function injectCss(el: HTMLElement, rootSelector: string, css: Record<string, string | number>, media?: string): void;
18
+ export {};
@@ -0,0 +1,3 @@
1
+ export type DrawerPosition = "bottom" | "left" | "right" | undefined;
2
+ export type DrawerSizeUnit = "px" | "rem" | "ch" | "vh" | "vw";
3
+ export type DrawerSize = `${number}${DrawerSizeUnit}` | undefined;
@@ -0,0 +1,2 @@
1
+ export declare function isUrlMatch(windowUrl: URL | Location, testUrl: string): number;
2
+ export declare function getMatchedLink(links: Element[], windowUrl: URL | Location): Element | null;
@@ -0,0 +1,38 @@
1
+ export declare function styles(...css: (string | boolean)[]): string;
2
+ export declare function style(name: string, value: string | number): string;
3
+ export declare const msg: {
4
+ receive: typeof receive;
5
+ relay: typeof relay;
6
+ };
7
+ export declare function receive(el: HTMLElement | Element | null | undefined, handler: (action: string, data: unknown, event: Event) => void): () => void;
8
+ export declare function relay<T>(el: HTMLElement | Element | null | undefined, eventName: string, data?: T, opts?: {
9
+ bubbles?: boolean;
10
+ cancelable?: boolean;
11
+ timeout?: number;
12
+ }): void;
13
+ export declare function dispatch<T>(el: HTMLElement | Element | null | undefined, eventName: string, detail?: T, opts?: {
14
+ bubbles?: boolean;
15
+ cancelable?: boolean;
16
+ timeout?: number;
17
+ }): void;
18
+ export declare function getSlottedChildren(rootEl?: HTMLElement, parentTestSelector?: string): Element[];
19
+ export declare function toBoolean(value: string): boolean;
20
+ export declare function fromBoolean(value: boolean): string;
21
+ export declare function isValidDate(d: Date): boolean;
22
+ export declare function validateRequired(componentName: string, props: Record<string, unknown>): void;
23
+ export declare function typeValidator(message: string, values: string[], required?: boolean): [string[], (value: string | null) => void];
24
+ export declare function getTimestamp(val?: Date): string;
25
+ export declare function pluralize(word: string, count: number): string;
26
+ export declare function clamp(value: number, min: number, max: number): number;
27
+ export declare function generateRandomId(): string;
28
+ export declare function padLeft(value: string | number, len: number, padWith: string | number): string;
29
+ export declare function performOnce(timeoutId: any, action: () => void, delay?: number): any;
30
+ export declare function ensureSlotExists(el: HTMLElement): void;
31
+ export declare function getQueryParams(url: string | URL): Record<string, string>;
32
+ export declare function getQueryParam(url: string | URL, key: string): string | undefined;
33
+ /**
34
+ * Creates a temporary screen reader announcement using aria-live
35
+ * @param text The text to announce to screen readers
36
+ * @param duration How long to keep the announcer element in the DOM (in milliseconds)
37
+ */
38
+ export declare function announceToScreenReader(text: string, duration?: number): void;
@@ -0,0 +1 @@
1
+ export declare function isValidDimension(value: string): boolean;