@openwarelabs/ui 0.14.1 → 0.16.0
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 +5 -5
- package/dist/components/ActivityHeatmap/ActivityHeatmap.d.cts +8 -0
- package/dist/components/ActivityHeatmap/ActivityHeatmap.d.ts +8 -0
- package/dist/components/ActivityHeatmap/ActivityHeatmap.types.d.cts +73 -0
- package/dist/components/ActivityHeatmap/ActivityHeatmap.types.d.ts +73 -0
- package/dist/components/DiffViewer/DiffViewer.d.cts +8 -0
- package/dist/components/DiffViewer/DiffViewer.d.ts +8 -0
- package/dist/components/DiffViewer/DiffViewer.types.d.cts +131 -0
- package/dist/components/DiffViewer/DiffViewer.types.d.ts +131 -0
- package/dist/components/DiffViewer/diff.d.cts +10 -0
- package/dist/components/DiffViewer/diff.d.ts +10 -0
- package/dist/components/InlineEdit/InlineEdit.d.cts +8 -0
- package/dist/components/InlineEdit/InlineEdit.d.ts +8 -0
- package/dist/components/InlineEdit/InlineEdit.types.d.cts +74 -0
- package/dist/components/InlineEdit/InlineEdit.types.d.ts +74 -0
- package/dist/components/Markdown/Markdown.d.cts +8 -0
- package/dist/components/Markdown/Markdown.d.ts +8 -0
- package/dist/components/Markdown/Markdown.types.d.cts +59 -0
- package/dist/components/Markdown/Markdown.types.d.ts +59 -0
- package/dist/components/MediaPlayer/MediaPlayer.d.cts +8 -0
- package/dist/components/MediaPlayer/MediaPlayer.d.ts +8 -0
- package/dist/components/MediaPlayer/MediaPlayer.types.d.cts +109 -0
- package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +109 -0
- package/dist/components/MentionInput/MentionInput.d.cts +9 -0
- package/dist/components/MentionInput/MentionInput.d.ts +9 -0
- package/dist/components/MentionInput/MentionInput.types.d.cts +125 -0
- package/dist/components/MentionInput/MentionInput.types.d.ts +125 -0
- package/dist/components/MentionInput/useMentions.d.cts +8 -0
- package/dist/components/MentionInput/useMentions.d.ts +8 -0
- package/dist/components/NavigationMenu/NavigationMenu.d.cts +14 -0
- package/dist/components/NavigationMenu/NavigationMenu.d.ts +14 -0
- package/dist/components/NavigationMenu/NavigationMenu.types.d.cts +84 -0
- package/dist/components/NavigationMenu/NavigationMenu.types.d.ts +84 -0
- package/dist/components/NotificationCenter/NotificationCenter.d.cts +12 -0
- package/dist/components/NotificationCenter/NotificationCenter.d.ts +12 -0
- package/dist/components/NotificationCenter/NotificationCenter.types.d.cts +129 -0
- package/dist/components/NotificationCenter/NotificationCenter.types.d.ts +129 -0
- package/dist/components/QRCode/QRCode.d.cts +18 -0
- package/dist/components/QRCode/QRCode.d.ts +18 -0
- package/dist/components/QRCode/QRCode.types.d.cts +53 -0
- package/dist/components/QRCode/QRCode.types.d.ts +53 -0
- package/dist/components/QRCode/qr.d.cts +8 -0
- package/dist/components/QRCode/qr.d.ts +8 -0
- package/dist/components/SignaturePad/SignaturePad.d.cts +8 -0
- package/dist/components/SignaturePad/SignaturePad.d.ts +8 -0
- package/dist/components/SignaturePad/SignaturePad.types.d.cts +102 -0
- package/dist/components/SignaturePad/SignaturePad.types.d.ts +102 -0
- package/dist/components/SortableList/SortableList.d.cts +7 -0
- package/dist/components/SortableList/SortableList.d.ts +7 -0
- package/dist/components/SortableList/SortableList.types.d.cts +82 -0
- package/dist/components/SortableList/SortableList.types.d.ts +82 -0
- package/dist/components/TransferList/TransferList.d.cts +7 -0
- package/dist/components/TransferList/TransferList.d.ts +7 -0
- package/dist/components/TransferList/TransferList.types.d.cts +75 -0
- package/dist/components/TransferList/TransferList.types.d.ts +75 -0
- package/dist/components/TreeView/TreeView.d.cts +8 -0
- package/dist/components/TreeView/TreeView.d.ts +8 -0
- package/dist/components/TreeView/TreeView.types.d.cts +88 -0
- package/dist/components/TreeView/TreeView.types.d.ts +88 -0
- package/dist/components/UploadList/UploadList.d.cts +9 -0
- package/dist/components/UploadList/UploadList.d.ts +9 -0
- package/dist/components/UploadList/UploadList.types.d.cts +113 -0
- package/dist/components/UploadList/UploadList.types.d.ts +113 -0
- package/dist/components/UploadList/useUploadQueue.d.cts +8 -0
- package/dist/components/UploadList/useUploadQueue.d.ts +8 -0
- package/dist/components/VirtualList/VirtualList.d.cts +9 -0
- package/dist/components/VirtualList/VirtualList.d.ts +9 -0
- package/dist/components/VirtualList/VirtualList.types.d.cts +80 -0
- package/dist/components/VirtualList/VirtualList.types.d.ts +80 -0
- package/dist/components/VirtualList/useVirtualizer.d.cts +60 -0
- package/dist/components/VirtualList/useVirtualizer.d.ts +60 -0
- package/dist/components.css +1840 -113
- package/dist/index.cjs +6770 -2144
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +6790 -2124
- package/dist/index.js.map +4 -4
- package/dist/openware-ui.iife.js +24 -8
- package/dist/styles.css +1840 -113
- package/package.json +1 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { KeyboardEvent, ReactNode, RefCallback } from "react";
|
|
2
|
+
export interface MentionOption {
|
|
3
|
+
/** Identifies what was picked, in `mentions`: a user id, a command name. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The text shown in the list, matched as people type, and put in the text after the trigger: "@Ada Lovelace". */
|
|
6
|
+
label: string;
|
|
7
|
+
/** A muted line under the label in the list; matched too when it's a string. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** A small icon or avatar before the label. */
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface MentionTrigger {
|
|
14
|
+
/** What opens the list when it's typed at the start of a word: "@", "/", "#". */
|
|
15
|
+
char: string;
|
|
16
|
+
/**
|
|
17
|
+
* What to suggest. A list is filtered by what's typed after the trigger. A function gets that text and returns
|
|
18
|
+
* the options to show, itself or in a promise (to search a server); the list shows a spinner while it waits.
|
|
19
|
+
*/
|
|
20
|
+
options: MentionOption[] | ((query: string) => MentionOption[] | Promise<MentionOption[]>);
|
|
21
|
+
/** Called after an option is put in the text. */
|
|
22
|
+
onSelect?(option: MentionOption): void;
|
|
23
|
+
/** Draws an option's row in the list in place of its icon, label and description. */
|
|
24
|
+
render?(option: MentionOption): ReactNode;
|
|
25
|
+
/** Names the list for screen readers while this trigger has it open, such as "People".
|
|
26
|
+
* @default labels.suggestions */
|
|
27
|
+
label?: string;
|
|
28
|
+
}
|
|
29
|
+
/** A mention in the text, found from the options picked (and every option of a trigger with a list). */
|
|
30
|
+
export interface Mention {
|
|
31
|
+
/** The option's id. */
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
/** The trigger it was typed with: "@". */
|
|
35
|
+
trigger: string;
|
|
36
|
+
/** Where it starts in the text, at the trigger. */
|
|
37
|
+
start: number;
|
|
38
|
+
/** Where it ends, after the label. */
|
|
39
|
+
end: number;
|
|
40
|
+
}
|
|
41
|
+
/** The words it uses, for other languages. */
|
|
42
|
+
export interface MentionLabels {
|
|
43
|
+
/** Names the list when its trigger has no `label`. @default "Suggestions" */
|
|
44
|
+
suggestions?: string;
|
|
45
|
+
/** Shown and read out while options load. @default "Loading…" */
|
|
46
|
+
loading?: string;
|
|
47
|
+
/** Shown and read out when nothing matches. @default "No matches" */
|
|
48
|
+
empty?: string;
|
|
49
|
+
/** Read out with the number of options. @default (count) => `${count} results` */
|
|
50
|
+
results?(count: number): string;
|
|
51
|
+
}
|
|
52
|
+
export interface UseMentionsOptions {
|
|
53
|
+
triggers: MentionTrigger[];
|
|
54
|
+
/** The text, when you control it, so `mentions` follows changes made from outside (clearing it after a send).
|
|
55
|
+
* Without it, the hook reads the text box as people type. */
|
|
56
|
+
value?: string;
|
|
57
|
+
/** Called with the mentions in the text when they change. */
|
|
58
|
+
onMentionsChange?(mentions: Mention[]): void;
|
|
59
|
+
/** Turns the suggestions off.
|
|
60
|
+
* @default false */
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
/** The list's rows: md 36px, sm 32px.
|
|
63
|
+
* @default "md" */
|
|
64
|
+
size?: "sm" | "md";
|
|
65
|
+
labels?: MentionLabels;
|
|
66
|
+
}
|
|
67
|
+
export interface UseMentionsResult {
|
|
68
|
+
/** Put on the text box: a <textarea> or <input>, a Textarea, an Input, or PromptInput (its ref is the textarea). */
|
|
69
|
+
ref: RefCallback<HTMLTextAreaElement | HTMLInputElement>;
|
|
70
|
+
/** Render it anywhere, such as right after the text box: the floating list and its live region. */
|
|
71
|
+
list: ReactNode;
|
|
72
|
+
/** The mentions in the text, in order. */
|
|
73
|
+
mentions: Mention[];
|
|
74
|
+
/** Whether the list is open. */
|
|
75
|
+
isOpen: boolean;
|
|
76
|
+
}
|
|
77
|
+
export interface MentionInputProps {
|
|
78
|
+
/** The characters that open suggestions, with their options. */
|
|
79
|
+
triggers: MentionTrigger[];
|
|
80
|
+
/** The text, when you control it. */
|
|
81
|
+
value?: string;
|
|
82
|
+
/** The text at first, when it controls it itself.
|
|
83
|
+
* @default "" */
|
|
84
|
+
defaultValue?: string;
|
|
85
|
+
/** Called with the text on every change. */
|
|
86
|
+
onChange?(value: string): void;
|
|
87
|
+
/** Called with the mentions in the text when they change: each one's id, label, trigger and place. */
|
|
88
|
+
onMentionsChange?(mentions: Mention[]): void;
|
|
89
|
+
/** A Textarea that grows with its text, in place of a one-line Input.
|
|
90
|
+
* @default false */
|
|
91
|
+
multiline?: boolean;
|
|
92
|
+
/** The rows a multiline box shows when it's empty.
|
|
93
|
+
* @default 3 */
|
|
94
|
+
rows?: number;
|
|
95
|
+
/** The tallest a multiline box grows before it scrolls. A number is pixels.
|
|
96
|
+
* @default 180 */
|
|
97
|
+
maxHeight?: number | string;
|
|
98
|
+
placeholder?: string;
|
|
99
|
+
/** The text box and the list: sm 32px for toolbars, md 40px in forms. A multiline box keeps its own size.
|
|
100
|
+
* @default "md" */
|
|
101
|
+
size?: "sm" | "md";
|
|
102
|
+
/** Shows the field as wrong. Field sets it when there's an error.
|
|
103
|
+
* @default false */
|
|
104
|
+
isInvalid?: boolean;
|
|
105
|
+
/** @default false */
|
|
106
|
+
disabled?: boolean;
|
|
107
|
+
/** Submits the text under this name, so a Form or a plain form sends it. */
|
|
108
|
+
name?: string;
|
|
109
|
+
/** The text box's id, which a Field's label points at. */
|
|
110
|
+
id?: string;
|
|
111
|
+
autoFocus?: boolean;
|
|
112
|
+
/** Called for each key the open list doesn't take, such as Enter to send while it's closed. */
|
|
113
|
+
onKeyDown?(event: KeyboardEvent<HTMLTextAreaElement | HTMLInputElement>): void;
|
|
114
|
+
"aria-label"?: string;
|
|
115
|
+
"aria-labelledby"?: string;
|
|
116
|
+
"aria-describedby"?: string;
|
|
117
|
+
labels?: MentionLabels;
|
|
118
|
+
className?: string;
|
|
119
|
+
}
|
|
120
|
+
/** The trigger being typed: which one, where it starts, and the text after it. Internal. */
|
|
121
|
+
export interface MentionMatch {
|
|
122
|
+
trigger: MentionTrigger;
|
|
123
|
+
start: number;
|
|
124
|
+
query: string;
|
|
125
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UseMentionsOptions, UseMentionsResult } from "./MentionInput.types.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* `@` mentions and `/` commands for any text box. Put `ref` on a textarea or input (a Textarea, an Input, or
|
|
4
|
+
* PromptInput) and render `list`: typing a trigger at the start of a word opens suggestions at the caret, and picking
|
|
5
|
+
* one puts "@Label " in the text. The box becomes a combobox; the hook listens to it directly, so the component that
|
|
6
|
+
* owns it needs no changes.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMentions({ triggers, value, onMentionsChange, disabled, size, labels }: UseMentionsOptions): UseMentionsResult;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UseMentionsOptions, UseMentionsResult } from "./MentionInput.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* `@` mentions and `/` commands for any text box. Put `ref` on a textarea or input (a Textarea, an Input, or
|
|
4
|
+
* PromptInput) and render `list`: typing a trigger at the start of a word opens suggestions at the caret, and picking
|
|
5
|
+
* one puts "@Label " in the text. The box becomes a combobox; the hook listens to it directly, so the component that
|
|
6
|
+
* owns it needs no changes.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMentions({ triggers, value, onMentionsChange, disabled, size, labels }: UseMentionsOptions): UseMentionsResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NavigationMenuGroupProps, NavigationMenuItemProps, NavigationMenuLinkProps, NavigationMenuProps } from "./NavigationMenu.types.cjs";
|
|
2
|
+
export type { NavigationMenuGroupProps, NavigationMenuItemProps, NavigationMenuLinkProps, NavigationMenuProps } from "./NavigationMenu.types.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* A site's top navigation: buttons that open panels of links (with icons, descriptions and columns, up to full-width
|
|
5
|
+
* mega-menus), and plain links. It's the disclosure pattern, not a menu: each trigger is a button with aria-expanded,
|
|
6
|
+
* and its panel follows it in the Tab order.
|
|
7
|
+
*/
|
|
8
|
+
export declare function NavigationMenu({ label, landmark, value, defaultValue, onValueChange, panelWidth, openDelay, closeDelay, children, className, }: NavigationMenuProps): import("react").JSX.Element;
|
|
9
|
+
/** A top-level item: a button that opens a panel of links, or a plain link when given an `href`. */
|
|
10
|
+
export declare function NavigationMenuItem({ trigger, value, href, active, columns, width, children, className }: NavigationMenuItemProps): import("react").JSX.Element;
|
|
11
|
+
/** A link in a panel, with an optional icon and a line of description. */
|
|
12
|
+
export declare function NavigationMenuLink({ title, description, icon, active, featured, className, ...props }: NavigationMenuLinkProps): import("react").JSX.Element;
|
|
13
|
+
/** A titled column of links in a panel. */
|
|
14
|
+
export declare function NavigationMenuGroup({ title, children, className }: NavigationMenuGroupProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NavigationMenuGroupProps, NavigationMenuItemProps, NavigationMenuLinkProps, NavigationMenuProps } from "./NavigationMenu.types.js";
|
|
2
|
+
export type { NavigationMenuGroupProps, NavigationMenuItemProps, NavigationMenuLinkProps, NavigationMenuProps } from "./NavigationMenu.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A site's top navigation: buttons that open panels of links (with icons, descriptions and columns, up to full-width
|
|
5
|
+
* mega-menus), and plain links. It's the disclosure pattern, not a menu: each trigger is a button with aria-expanded,
|
|
6
|
+
* and its panel follows it in the Tab order.
|
|
7
|
+
*/
|
|
8
|
+
export declare function NavigationMenu({ label, landmark, value, defaultValue, onValueChange, panelWidth, openDelay, closeDelay, children, className, }: NavigationMenuProps): import("react").JSX.Element;
|
|
9
|
+
/** A top-level item: a button that opens a panel of links, or a plain link when given an `href`. */
|
|
10
|
+
export declare function NavigationMenuItem({ trigger, value, href, active, columns, width, children, className }: NavigationMenuItemProps): import("react").JSX.Element;
|
|
11
|
+
/** A link in a panel, with an optional icon and a line of description. */
|
|
12
|
+
export declare function NavigationMenuLink({ title, description, icon, active, featured, className, ...props }: NavigationMenuLinkProps): import("react").JSX.Element;
|
|
13
|
+
/** A titled column of links in a panel. */
|
|
14
|
+
export declare function NavigationMenuGroup({ title, children, className }: NavigationMenuGroupProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, MutableRefObject, ReactNode, RefObject } from "react";
|
|
2
|
+
export interface NavigationMenuProps {
|
|
3
|
+
/** Names the navigation for screen readers, such as "Main". */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Renders a `<nav>` landmark. Turn it off when it already sits in one, like SiteHeader's `nav` slot, so screen
|
|
6
|
+
* readers don't hear two.
|
|
7
|
+
* @default true */
|
|
8
|
+
landmark?: boolean;
|
|
9
|
+
/** The open item's `value`, or null when every panel is closed, when you control it. */
|
|
10
|
+
value?: string | null;
|
|
11
|
+
/** The item open at first, when it controls itself.
|
|
12
|
+
* @default null */
|
|
13
|
+
defaultValue?: string | null;
|
|
14
|
+
/** Called with the item that opens, or null when its panel closes. */
|
|
15
|
+
onValueChange?(value: string | null): void;
|
|
16
|
+
/** How wide panels are: as wide as their content (`"auto"`), or as wide as the header the menu sits in (or the
|
|
17
|
+
* menu itself, outside a header) for mega-menus (`"full"`). An item's own `width` wins.
|
|
18
|
+
* @default "auto" */
|
|
19
|
+
panelWidth?: "auto" | "full";
|
|
20
|
+
/** How long the pointer rests on a trigger before its panel opens, in milliseconds.
|
|
21
|
+
* @default 150 */
|
|
22
|
+
openDelay?: number;
|
|
23
|
+
/** How long a panel opened by hovering stays after the pointer leaves, so it can cross the gap into it.
|
|
24
|
+
* @default 300 */
|
|
25
|
+
closeDelay?: number;
|
|
26
|
+
/** The NavigationMenuItems. */
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface NavigationMenuItemProps {
|
|
31
|
+
/** The words on the top-level button, or on the link when there's an `href`. */
|
|
32
|
+
trigger: ReactNode;
|
|
33
|
+
/** Names the item for `value` and `onValueChange`. Defaults to a generated id. */
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Makes it a plain top-level link instead of a button with a panel. */
|
|
36
|
+
href?: string;
|
|
37
|
+
/** Marks a plain link (or a trigger whose panel holds the current page) as where the person is. */
|
|
38
|
+
active?: boolean;
|
|
39
|
+
/** The panel's columns, side by side; they stack on narrow screens.
|
|
40
|
+
* @default 1 */
|
|
41
|
+
columns?: number;
|
|
42
|
+
/** This panel's width: pixels, any CSS width, or `"full"` to match the header. Defaults to the menu's `panelWidth`. */
|
|
43
|
+
width?: number | string;
|
|
44
|
+
/** The panel's content: NavigationMenuLinks, NavigationMenuGroups, or anything else. */
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface NavigationMenuLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "title"> {
|
|
49
|
+
href: string;
|
|
50
|
+
/** The link's name. */
|
|
51
|
+
title: ReactNode;
|
|
52
|
+
/** A line under the title on what's there. */
|
|
53
|
+
description?: ReactNode;
|
|
54
|
+
/** An icon before the title, such as a lucide-react icon at size 18. */
|
|
55
|
+
icon?: ReactNode;
|
|
56
|
+
/** The page the person is on: sets aria-current="page". */
|
|
57
|
+
active?: boolean;
|
|
58
|
+
/** Shows it as a tinted card that fills its column, to feature one page in a mega-menu. */
|
|
59
|
+
featured?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface NavigationMenuGroupProps {
|
|
62
|
+
/** A few words over the column, such as "Resources". */
|
|
63
|
+
title: ReactNode;
|
|
64
|
+
/** Its NavigationMenuLinks. */
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
className?: string;
|
|
67
|
+
}
|
|
68
|
+
/** What a NavigationMenu shares with its items. Internal. */
|
|
69
|
+
export interface NavigationMenuContextValue {
|
|
70
|
+
value: string | null;
|
|
71
|
+
/** Opens an item (or closes with null); `hover` marks a panel that closes again when the pointer leaves. */
|
|
72
|
+
open(value: string | null, hover?: boolean): void;
|
|
73
|
+
/** Opens an item after the open delay, or closes after the close delay with null. */
|
|
74
|
+
soon(value: string | null): void;
|
|
75
|
+
/** Cancels a pending open or close. */
|
|
76
|
+
cancel(): void;
|
|
77
|
+
/** A click on a trigger: opens its panel, or closes it, but keeps a panel the pointer just opened by hovering. */
|
|
78
|
+
toggle(value: string): void;
|
|
79
|
+
rootRef: RefObject<HTMLElement | null>;
|
|
80
|
+
triggers: MutableRefObject<Map<string, HTMLElement>>;
|
|
81
|
+
/** The item whose panel should take focus once it opens (Down on its trigger). */
|
|
82
|
+
focusInto: MutableRefObject<string | null>;
|
|
83
|
+
panelWidth: "auto" | "full";
|
|
84
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, MutableRefObject, ReactNode, RefObject } from "react";
|
|
2
|
+
export interface NavigationMenuProps {
|
|
3
|
+
/** Names the navigation for screen readers, such as "Main". */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Renders a `<nav>` landmark. Turn it off when it already sits in one, like SiteHeader's `nav` slot, so screen
|
|
6
|
+
* readers don't hear two.
|
|
7
|
+
* @default true */
|
|
8
|
+
landmark?: boolean;
|
|
9
|
+
/** The open item's `value`, or null when every panel is closed, when you control it. */
|
|
10
|
+
value?: string | null;
|
|
11
|
+
/** The item open at first, when it controls itself.
|
|
12
|
+
* @default null */
|
|
13
|
+
defaultValue?: string | null;
|
|
14
|
+
/** Called with the item that opens, or null when its panel closes. */
|
|
15
|
+
onValueChange?(value: string | null): void;
|
|
16
|
+
/** How wide panels are: as wide as their content (`"auto"`), or as wide as the header the menu sits in (or the
|
|
17
|
+
* menu itself, outside a header) for mega-menus (`"full"`). An item's own `width` wins.
|
|
18
|
+
* @default "auto" */
|
|
19
|
+
panelWidth?: "auto" | "full";
|
|
20
|
+
/** How long the pointer rests on a trigger before its panel opens, in milliseconds.
|
|
21
|
+
* @default 150 */
|
|
22
|
+
openDelay?: number;
|
|
23
|
+
/** How long a panel opened by hovering stays after the pointer leaves, so it can cross the gap into it.
|
|
24
|
+
* @default 300 */
|
|
25
|
+
closeDelay?: number;
|
|
26
|
+
/** The NavigationMenuItems. */
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface NavigationMenuItemProps {
|
|
31
|
+
/** The words on the top-level button, or on the link when there's an `href`. */
|
|
32
|
+
trigger: ReactNode;
|
|
33
|
+
/** Names the item for `value` and `onValueChange`. Defaults to a generated id. */
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Makes it a plain top-level link instead of a button with a panel. */
|
|
36
|
+
href?: string;
|
|
37
|
+
/** Marks a plain link (or a trigger whose panel holds the current page) as where the person is. */
|
|
38
|
+
active?: boolean;
|
|
39
|
+
/** The panel's columns, side by side; they stack on narrow screens.
|
|
40
|
+
* @default 1 */
|
|
41
|
+
columns?: number;
|
|
42
|
+
/** This panel's width: pixels, any CSS width, or `"full"` to match the header. Defaults to the menu's `panelWidth`. */
|
|
43
|
+
width?: number | string;
|
|
44
|
+
/** The panel's content: NavigationMenuLinks, NavigationMenuGroups, or anything else. */
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface NavigationMenuLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "title"> {
|
|
49
|
+
href: string;
|
|
50
|
+
/** The link's name. */
|
|
51
|
+
title: ReactNode;
|
|
52
|
+
/** A line under the title on what's there. */
|
|
53
|
+
description?: ReactNode;
|
|
54
|
+
/** An icon before the title, such as a lucide-react icon at size 18. */
|
|
55
|
+
icon?: ReactNode;
|
|
56
|
+
/** The page the person is on: sets aria-current="page". */
|
|
57
|
+
active?: boolean;
|
|
58
|
+
/** Shows it as a tinted card that fills its column, to feature one page in a mega-menu. */
|
|
59
|
+
featured?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface NavigationMenuGroupProps {
|
|
62
|
+
/** A few words over the column, such as "Resources". */
|
|
63
|
+
title: ReactNode;
|
|
64
|
+
/** Its NavigationMenuLinks. */
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
className?: string;
|
|
67
|
+
}
|
|
68
|
+
/** What a NavigationMenu shares with its items. Internal. */
|
|
69
|
+
export interface NavigationMenuContextValue {
|
|
70
|
+
value: string | null;
|
|
71
|
+
/** Opens an item (or closes with null); `hover` marks a panel that closes again when the pointer leaves. */
|
|
72
|
+
open(value: string | null, hover?: boolean): void;
|
|
73
|
+
/** Opens an item after the open delay, or closes after the close delay with null. */
|
|
74
|
+
soon(value: string | null): void;
|
|
75
|
+
/** Cancels a pending open or close. */
|
|
76
|
+
cancel(): void;
|
|
77
|
+
/** A click on a trigger: opens its panel, or closes it, but keeps a panel the pointer just opened by hovering. */
|
|
78
|
+
toggle(value: string): void;
|
|
79
|
+
rootRef: RefObject<HTMLElement | null>;
|
|
80
|
+
triggers: MutableRefObject<Map<string, HTMLElement>>;
|
|
81
|
+
/** The item whose panel should take focus once it opens (Down on its trigger). */
|
|
82
|
+
focusInto: MutableRefObject<string | null>;
|
|
83
|
+
panelWidth: "auto" | "full";
|
|
84
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NotificationCenterProps, NotificationListProps } from "./NotificationCenter.types.cjs";
|
|
2
|
+
export type { NotificationCenterProps, NotificationFilter, NotificationItem, NotificationLabels, NotificationListProps, } from "./NotificationCenter.types.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* The notifications as a list, newest first, optionally under Today, Yesterday and Earlier. NotificationCenter shows it
|
|
5
|
+
* in its popover; use it on its own for a full page of them.
|
|
6
|
+
*/
|
|
7
|
+
export declare function NotificationList({ items, onRead, onDismiss, onItemClick, groupByDay, empty, locale, labels, "aria-label": ariaLabel, className, }: NotificationListProps): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* A bell with the unread count that opens the latest notifications in a popover: All and Unread tabs, "Mark all as
|
|
10
|
+
* read", and a footer for a link to the full page. New ones that arrive while it's closed are announced once.
|
|
11
|
+
*/
|
|
12
|
+
export declare function NotificationCenter({ items, onRead, onReadAll, onDismiss, onItemClick, open, defaultOpen, onOpenChange, tabs, filter, defaultFilter, onFilterChange, footer, empty, maxCount, trigger, width, groupByDay, locale, labels, className, }: NotificationCenterProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NotificationCenterProps, NotificationListProps } from "./NotificationCenter.types.js";
|
|
2
|
+
export type { NotificationCenterProps, NotificationFilter, NotificationItem, NotificationLabels, NotificationListProps, } from "./NotificationCenter.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The notifications as a list, newest first, optionally under Today, Yesterday and Earlier. NotificationCenter shows it
|
|
5
|
+
* in its popover; use it on its own for a full page of them.
|
|
6
|
+
*/
|
|
7
|
+
export declare function NotificationList({ items, onRead, onDismiss, onItemClick, groupByDay, empty, locale, labels, "aria-label": ariaLabel, className, }: NotificationListProps): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* A bell with the unread count that opens the latest notifications in a popover: All and Unread tabs, "Mark all as
|
|
10
|
+
* read", and a footer for a link to the full page. New ones that arrive while it's closed are announced once.
|
|
11
|
+
*/
|
|
12
|
+
export declare function NotificationCenter({ items, onRead, onReadAll, onDismiss, onItemClick, open, defaultOpen, onOpenChange, tabs, filter, defaultFilter, onFilterChange, footer, empty, maxCount, trigger, width, groupByDay, locale, labels, className, }: NotificationCenterProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { MouseEvent, ReactElement, ReactNode } from "react";
|
|
2
|
+
export interface NotificationItem {
|
|
3
|
+
/** Unique among the items. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** What happened, in a line: "Clara mentioned you in Pricing". It names the item for screen readers. */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** A second line: a quote, or where it happened. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** When it happened: a Date or an ISO string. It shows as "5 min ago", with the full date on hover. */
|
|
10
|
+
time: Date | string;
|
|
11
|
+
/** Seen already. Unread items are bold, with a dot and a hidden "Unread" for screen readers. */
|
|
12
|
+
read?: boolean;
|
|
13
|
+
/** Who it's from, usually an `<Avatar>`. Hidden from screen readers: say who in the title. */
|
|
14
|
+
avatar?: ReactNode;
|
|
15
|
+
/** A 16px icon on a round tile, for things no person did (a deploy, a reminder), when there's no avatar. */
|
|
16
|
+
icon?: ReactNode;
|
|
17
|
+
/** Makes the item a link to what it's about. Without it, the item is a button. */
|
|
18
|
+
href?: string;
|
|
19
|
+
/** A button or two beside the item, such as Accept and Decline. They sit outside the item's own link. */
|
|
20
|
+
actions?: ReactNode;
|
|
21
|
+
/** The heading it's listed under. Set it to group by your own sections; it wins over `groupByDay`. */
|
|
22
|
+
group?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface NotificationLabels {
|
|
25
|
+
/** The popover's heading and name. @default "Notifications" */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** The bell's name with the count. @default (unread) => unread ? `Notifications, ${unread} unread` : "Notifications" */
|
|
28
|
+
trigger?(unread: number): string;
|
|
29
|
+
/** @default "Mark all as read" */
|
|
30
|
+
markAllRead?: string;
|
|
31
|
+
/** The tab list's name. @default "Show" */
|
|
32
|
+
filter?: string;
|
|
33
|
+
/** @default "All" */
|
|
34
|
+
all?: string;
|
|
35
|
+
/** @default "Unread" */
|
|
36
|
+
unreadTab?: string;
|
|
37
|
+
/** Read before each unread item. @default "Unread" */
|
|
38
|
+
unread?: string;
|
|
39
|
+
/** The ✕ on each item, followed by its title. @default "Dismiss" */
|
|
40
|
+
dismiss?: string;
|
|
41
|
+
/** Said once when new ones arrive while it's closed. @default (count) => count === 1 ? "1 new notification" : `${count} new notifications` */
|
|
42
|
+
announce?(count: number): string;
|
|
43
|
+
/** @default "Today" */
|
|
44
|
+
today?: string;
|
|
45
|
+
/** @default "Yesterday" */
|
|
46
|
+
yesterday?: string;
|
|
47
|
+
/** @default "Earlier" */
|
|
48
|
+
earlier?: string;
|
|
49
|
+
/** The empty list's title. @default "You're all caught up" */
|
|
50
|
+
empty?: string;
|
|
51
|
+
/** The empty Unread tab's title. @default "No unread notifications" */
|
|
52
|
+
emptyUnread?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface NotificationListProps {
|
|
55
|
+
/** The notifications, newest first. */
|
|
56
|
+
items: NotificationItem[];
|
|
57
|
+
/** Called with an unread item's id when it's opened. */
|
|
58
|
+
onRead?(id: string): void;
|
|
59
|
+
/** Shows a ✕ on each item that calls this with its id; remove the item from `items`. */
|
|
60
|
+
onDismiss?(id: string): void;
|
|
61
|
+
/** Called when an item is clicked, before its link is followed. */
|
|
62
|
+
onItemClick?(item: NotificationItem, event: MouseEvent<HTMLElement>): void;
|
|
63
|
+
/** Lists the items under Today, Yesterday and Earlier. An item's own `group` wins.
|
|
64
|
+
* @default false */
|
|
65
|
+
groupByDay?: boolean;
|
|
66
|
+
/** What shows when there are no items.
|
|
67
|
+
* @default an EmptyState saying "You're all caught up" */
|
|
68
|
+
empty?: ReactNode;
|
|
69
|
+
/** The locale for "5 min ago" and dates. Defaults to the browser's. */
|
|
70
|
+
locale?: string;
|
|
71
|
+
/** The words it uses, for other languages. */
|
|
72
|
+
labels?: NotificationLabels;
|
|
73
|
+
/** Names the list for screen readers, when it has no heading of its own. */
|
|
74
|
+
"aria-label"?: string;
|
|
75
|
+
className?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface NotificationCenterProps extends Omit<NotificationListProps, "aria-label"> {
|
|
78
|
+
/** Called when "Mark all as read" is pressed; mark every item read. */
|
|
79
|
+
onReadAll?(): void;
|
|
80
|
+
/** Shown, when you control it. */
|
|
81
|
+
open?: boolean;
|
|
82
|
+
/** Shown at first, when it controls itself. Opened on load, it doesn't pull focus into it.
|
|
83
|
+
* @default false */
|
|
84
|
+
defaultOpen?: boolean;
|
|
85
|
+
/** Called when it opens or closes. */
|
|
86
|
+
onOpenChange?(open: boolean): void;
|
|
87
|
+
/** All and Unread tabs above the list.
|
|
88
|
+
* @default true */
|
|
89
|
+
tabs?: boolean;
|
|
90
|
+
/** The tab showing, when you control it. */
|
|
91
|
+
filter?: NotificationFilter;
|
|
92
|
+
/** The tab it starts on, when it controls itself.
|
|
93
|
+
* @default "all" */
|
|
94
|
+
defaultFilter?: NotificationFilter;
|
|
95
|
+
/** Called when the tab changes. */
|
|
96
|
+
onFilterChange?(filter: NotificationFilter): void;
|
|
97
|
+
/** Under the list, such as a "View all" link to a full page. */
|
|
98
|
+
footer?: ReactNode;
|
|
99
|
+
/** The badge shows "9+" above this.
|
|
100
|
+
* @default 9 */
|
|
101
|
+
maxCount?: number;
|
|
102
|
+
/** Your own button in place of the bell. Give it an aria-label with the unread count. */
|
|
103
|
+
trigger?: ReactElement;
|
|
104
|
+
/** Pixels, or any CSS width. It never gets wider than the window, less a margin.
|
|
105
|
+
* @default 380 */
|
|
106
|
+
width?: number | string;
|
|
107
|
+
}
|
|
108
|
+
/** Which items a NotificationCenter lists. */
|
|
109
|
+
export type NotificationFilter = "all" | "unread";
|
|
110
|
+
/** Internal: a run of items under one heading. */
|
|
111
|
+
export interface NotificationGroup {
|
|
112
|
+
key: string;
|
|
113
|
+
label?: string;
|
|
114
|
+
items: NotificationItem[];
|
|
115
|
+
}
|
|
116
|
+
/** Internal: one row of the list. */
|
|
117
|
+
export interface NotificationRowProps {
|
|
118
|
+
item: NotificationItem;
|
|
119
|
+
/** "5 min ago", or the date when it's older than a week. */
|
|
120
|
+
relative: string;
|
|
121
|
+
/** The full date and time, for the hover title. */
|
|
122
|
+
full: string;
|
|
123
|
+
/** The machine-readable time, for `<time dateTime>`. */
|
|
124
|
+
iso?: string;
|
|
125
|
+
labels: NotificationLabels;
|
|
126
|
+
onRead?(id: string): void;
|
|
127
|
+
onDismiss?(id: string): void;
|
|
128
|
+
onItemClick?(item: NotificationItem, event: MouseEvent<HTMLElement>): void;
|
|
129
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { MouseEvent, ReactElement, ReactNode } from "react";
|
|
2
|
+
export interface NotificationItem {
|
|
3
|
+
/** Unique among the items. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** What happened, in a line: "Clara mentioned you in Pricing". It names the item for screen readers. */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** A second line: a quote, or where it happened. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** When it happened: a Date or an ISO string. It shows as "5 min ago", with the full date on hover. */
|
|
10
|
+
time: Date | string;
|
|
11
|
+
/** Seen already. Unread items are bold, with a dot and a hidden "Unread" for screen readers. */
|
|
12
|
+
read?: boolean;
|
|
13
|
+
/** Who it's from, usually an `<Avatar>`. Hidden from screen readers: say who in the title. */
|
|
14
|
+
avatar?: ReactNode;
|
|
15
|
+
/** A 16px icon on a round tile, for things no person did (a deploy, a reminder), when there's no avatar. */
|
|
16
|
+
icon?: ReactNode;
|
|
17
|
+
/** Makes the item a link to what it's about. Without it, the item is a button. */
|
|
18
|
+
href?: string;
|
|
19
|
+
/** A button or two beside the item, such as Accept and Decline. They sit outside the item's own link. */
|
|
20
|
+
actions?: ReactNode;
|
|
21
|
+
/** The heading it's listed under. Set it to group by your own sections; it wins over `groupByDay`. */
|
|
22
|
+
group?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface NotificationLabels {
|
|
25
|
+
/** The popover's heading and name. @default "Notifications" */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** The bell's name with the count. @default (unread) => unread ? `Notifications, ${unread} unread` : "Notifications" */
|
|
28
|
+
trigger?(unread: number): string;
|
|
29
|
+
/** @default "Mark all as read" */
|
|
30
|
+
markAllRead?: string;
|
|
31
|
+
/** The tab list's name. @default "Show" */
|
|
32
|
+
filter?: string;
|
|
33
|
+
/** @default "All" */
|
|
34
|
+
all?: string;
|
|
35
|
+
/** @default "Unread" */
|
|
36
|
+
unreadTab?: string;
|
|
37
|
+
/** Read before each unread item. @default "Unread" */
|
|
38
|
+
unread?: string;
|
|
39
|
+
/** The ✕ on each item, followed by its title. @default "Dismiss" */
|
|
40
|
+
dismiss?: string;
|
|
41
|
+
/** Said once when new ones arrive while it's closed. @default (count) => count === 1 ? "1 new notification" : `${count} new notifications` */
|
|
42
|
+
announce?(count: number): string;
|
|
43
|
+
/** @default "Today" */
|
|
44
|
+
today?: string;
|
|
45
|
+
/** @default "Yesterday" */
|
|
46
|
+
yesterday?: string;
|
|
47
|
+
/** @default "Earlier" */
|
|
48
|
+
earlier?: string;
|
|
49
|
+
/** The empty list's title. @default "You're all caught up" */
|
|
50
|
+
empty?: string;
|
|
51
|
+
/** The empty Unread tab's title. @default "No unread notifications" */
|
|
52
|
+
emptyUnread?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface NotificationListProps {
|
|
55
|
+
/** The notifications, newest first. */
|
|
56
|
+
items: NotificationItem[];
|
|
57
|
+
/** Called with an unread item's id when it's opened. */
|
|
58
|
+
onRead?(id: string): void;
|
|
59
|
+
/** Shows a ✕ on each item that calls this with its id; remove the item from `items`. */
|
|
60
|
+
onDismiss?(id: string): void;
|
|
61
|
+
/** Called when an item is clicked, before its link is followed. */
|
|
62
|
+
onItemClick?(item: NotificationItem, event: MouseEvent<HTMLElement>): void;
|
|
63
|
+
/** Lists the items under Today, Yesterday and Earlier. An item's own `group` wins.
|
|
64
|
+
* @default false */
|
|
65
|
+
groupByDay?: boolean;
|
|
66
|
+
/** What shows when there are no items.
|
|
67
|
+
* @default an EmptyState saying "You're all caught up" */
|
|
68
|
+
empty?: ReactNode;
|
|
69
|
+
/** The locale for "5 min ago" and dates. Defaults to the browser's. */
|
|
70
|
+
locale?: string;
|
|
71
|
+
/** The words it uses, for other languages. */
|
|
72
|
+
labels?: NotificationLabels;
|
|
73
|
+
/** Names the list for screen readers, when it has no heading of its own. */
|
|
74
|
+
"aria-label"?: string;
|
|
75
|
+
className?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface NotificationCenterProps extends Omit<NotificationListProps, "aria-label"> {
|
|
78
|
+
/** Called when "Mark all as read" is pressed; mark every item read. */
|
|
79
|
+
onReadAll?(): void;
|
|
80
|
+
/** Shown, when you control it. */
|
|
81
|
+
open?: boolean;
|
|
82
|
+
/** Shown at first, when it controls itself. Opened on load, it doesn't pull focus into it.
|
|
83
|
+
* @default false */
|
|
84
|
+
defaultOpen?: boolean;
|
|
85
|
+
/** Called when it opens or closes. */
|
|
86
|
+
onOpenChange?(open: boolean): void;
|
|
87
|
+
/** All and Unread tabs above the list.
|
|
88
|
+
* @default true */
|
|
89
|
+
tabs?: boolean;
|
|
90
|
+
/** The tab showing, when you control it. */
|
|
91
|
+
filter?: NotificationFilter;
|
|
92
|
+
/** The tab it starts on, when it controls itself.
|
|
93
|
+
* @default "all" */
|
|
94
|
+
defaultFilter?: NotificationFilter;
|
|
95
|
+
/** Called when the tab changes. */
|
|
96
|
+
onFilterChange?(filter: NotificationFilter): void;
|
|
97
|
+
/** Under the list, such as a "View all" link to a full page. */
|
|
98
|
+
footer?: ReactNode;
|
|
99
|
+
/** The badge shows "9+" above this.
|
|
100
|
+
* @default 9 */
|
|
101
|
+
maxCount?: number;
|
|
102
|
+
/** Your own button in place of the bell. Give it an aria-label with the unread count. */
|
|
103
|
+
trigger?: ReactElement;
|
|
104
|
+
/** Pixels, or any CSS width. It never gets wider than the window, less a margin.
|
|
105
|
+
* @default 380 */
|
|
106
|
+
width?: number | string;
|
|
107
|
+
}
|
|
108
|
+
/** Which items a NotificationCenter lists. */
|
|
109
|
+
export type NotificationFilter = "all" | "unread";
|
|
110
|
+
/** Internal: a run of items under one heading. */
|
|
111
|
+
export interface NotificationGroup {
|
|
112
|
+
key: string;
|
|
113
|
+
label?: string;
|
|
114
|
+
items: NotificationItem[];
|
|
115
|
+
}
|
|
116
|
+
/** Internal: one row of the list. */
|
|
117
|
+
export interface NotificationRowProps {
|
|
118
|
+
item: NotificationItem;
|
|
119
|
+
/** "5 min ago", or the date when it's older than a week. */
|
|
120
|
+
relative: string;
|
|
121
|
+
/** The full date and time, for the hover title. */
|
|
122
|
+
full: string;
|
|
123
|
+
/** The machine-readable time, for `<time dateTime>`. */
|
|
124
|
+
iso?: string;
|
|
125
|
+
labels: NotificationLabels;
|
|
126
|
+
onRead?(id: string): void;
|
|
127
|
+
onDismiss?(id: string): void;
|
|
128
|
+
onItemClick?(item: NotificationItem, event: MouseEvent<HTMLElement>): void;
|
|
129
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { QRCodeDataURLOptions, QRCodeProps } from "./QRCode.types.cjs";
|
|
2
|
+
export type { QRCodeDataURLOptions, QRCodeProps, QRLevel, QROptions } from "./QRCode.types.cjs";
|
|
3
|
+
export { encodeQR } from "./qr.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* A QR code, drawn as one SVG path: for sharing a link, setting up two-factor authentication or pairing a device.
|
|
6
|
+
* The encoder is built in. It's near black on near white in both themes, because scanners need a light ground.
|
|
7
|
+
*/
|
|
8
|
+
export declare const QRCode: import("react").ForwardRefExoticComponent<QRCodeProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
9
|
+
/**
|
|
10
|
+
* The SVG markup of a rendered QR code, with its colours written in, ready to save as a .svg file. Pass the element
|
|
11
|
+
* from the QRCode's ref.
|
|
12
|
+
*/
|
|
13
|
+
export declare function qrCodeToSVG(svg: SVGSVGElement): string;
|
|
14
|
+
/**
|
|
15
|
+
* A rendered QR code as an image data URL, PNG by default, for a download link or a canvas. `scale` multiplies its
|
|
16
|
+
* size for a sharper image. A logo from another origin that doesn't allow CORS is left out; the code still scans.
|
|
17
|
+
*/
|
|
18
|
+
export declare function qrCodeToDataURL(svg: SVGSVGElement, { type, scale }?: QRCodeDataURLOptions): Promise<string>;
|