@xeonr/platform-ui 1.10.2 → 1.12.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/dist/auth/AuthCode.d.ts +48 -0
- package/dist/auth/AuthCode.d.ts.map +1 -0
- package/dist/auth/AuthCode.js +197 -0
- package/dist/auth/AuthCode.js.map +1 -0
- package/dist/auth/AuthConsent.d.ts +69 -0
- package/dist/auth/AuthConsent.d.ts.map +1 -0
- package/dist/auth/AuthConsent.js +155 -0
- package/dist/auth/AuthConsent.js.map +1 -0
- package/dist/auth/AuthControls.d.ts +133 -0
- package/dist/auth/AuthControls.d.ts.map +1 -0
- package/dist/auth/AuthControls.js +379 -0
- package/dist/auth/AuthControls.js.map +1 -0
- package/dist/auth/AuthPanel.d.ts +106 -0
- package/dist/auth/AuthPanel.d.ts.map +1 -0
- package/dist/auth/AuthPanel.js +317 -0
- package/dist/auth/AuthPanel.js.map +1 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +15 -0
- package/dist/auth.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/kit/Anchored.js +109 -109
- package/dist/kit/Anchored.js.map +1 -1
- package/dist/kit/ApiKeyForm.js +73 -73
- package/dist/kit/ApiKeyForm.js.map +1 -1
- package/dist/kit/ApiKeys.js +144 -144
- package/dist/kit/ApiKeys.js.map +1 -1
- package/dist/kit/Badge.js +45 -45
- package/dist/kit/Badge.js.map +1 -1
- package/dist/kit/Blocks.d.ts.map +1 -1
- package/dist/kit/Blocks.js +103 -102
- package/dist/kit/Blocks.js.map +1 -1
- package/dist/kit/Board.js +54 -54
- package/dist/kit/Board.js.map +1 -1
- package/dist/kit/Button.d.ts +3 -3
- package/dist/kit/Button.d.ts.map +1 -1
- package/dist/kit/Button.js +55 -50
- package/dist/kit/Button.js.map +1 -1
- package/dist/kit/Card.d.ts.map +1 -1
- package/dist/kit/Card.js +36 -29
- package/dist/kit/Card.js.map +1 -1
- package/dist/kit/ChartFrame.js +54 -54
- package/dist/kit/ChartFrame.js.map +1 -1
- package/dist/kit/ChartTypes.js +215 -215
- package/dist/kit/ChartTypes.js.map +1 -1
- package/dist/kit/Charts.js +605 -605
- package/dist/kit/Charts.js.map +1 -1
- package/dist/kit/Checkbox.js +16 -16
- package/dist/kit/Checkbox.js.map +1 -1
- package/dist/kit/Chip.js +21 -21
- package/dist/kit/Chip.js.map +1 -1
- package/dist/kit/Choice.js +24 -24
- package/dist/kit/Choice.js.map +1 -1
- package/dist/kit/CodeEditor.d.ts.map +1 -1
- package/dist/kit/CodeEditor.js +26 -48
- package/dist/kit/CodeEditor.js.map +1 -1
- package/dist/kit/Color.js +74 -74
- package/dist/kit/Color.js.map +1 -1
- package/dist/kit/Combobox.js +67 -67
- package/dist/kit/Combobox.js.map +1 -1
- package/dist/kit/CommandPalette.d.ts.map +1 -1
- package/dist/kit/CommandPalette.js +96 -86
- package/dist/kit/CommandPalette.js.map +1 -1
- package/dist/kit/Comment.js +7 -7
- package/dist/kit/Comment.js.map +1 -1
- package/dist/kit/Controls.js +122 -122
- package/dist/kit/Controls.js.map +1 -1
- package/dist/kit/DataGrid.js +97 -97
- package/dist/kit/DataGrid.js.map +1 -1
- package/dist/kit/DataTable.d.ts.map +1 -1
- package/dist/kit/DataTable.js +196 -195
- package/dist/kit/DataTable.js.map +1 -1
- package/dist/kit/DatePicker.js +242 -242
- package/dist/kit/DatePicker.js.map +1 -1
- package/dist/kit/Drawer.d.ts.map +1 -1
- package/dist/kit/Drawer.js +15 -14
- package/dist/kit/Drawer.js.map +1 -1
- package/dist/kit/Dropzone.js +80 -80
- package/dist/kit/Dropzone.js.map +1 -1
- package/dist/kit/Editable.d.ts.map +1 -1
- package/dist/kit/Editable.js +130 -129
- package/dist/kit/Editable.js.map +1 -1
- package/dist/kit/EmptyState.d.ts.map +1 -1
- package/dist/kit/EmptyState.js +14 -13
- package/dist/kit/EmptyState.js.map +1 -1
- package/dist/kit/EntityHeader.d.ts.map +1 -1
- package/dist/kit/EntityHeader.js +17 -16
- package/dist/kit/EntityHeader.js.map +1 -1
- package/dist/kit/Facet.js +52 -52
- package/dist/kit/Facet.js.map +1 -1
- package/dist/kit/FacetRail.js +91 -91
- package/dist/kit/FacetRail.js.map +1 -1
- package/dist/kit/Forbidden.js +7 -7
- package/dist/kit/Forbidden.js.map +1 -1
- package/dist/kit/Form.d.ts.map +1 -1
- package/dist/kit/Form.js +144 -143
- package/dist/kit/Form.js.map +1 -1
- package/dist/kit/Graph.d.ts +14 -3
- package/dist/kit/Graph.d.ts.map +1 -1
- package/dist/kit/Graph.js +473 -314
- package/dist/kit/Graph.js.map +1 -1
- package/dist/kit/GroupedMultiSelect.js +115 -115
- package/dist/kit/GroupedMultiSelect.js.map +1 -1
- package/dist/kit/Icon.d.ts +2 -0
- package/dist/kit/Icon.d.ts.map +1 -1
- package/dist/kit/Icon.js +3 -1
- package/dist/kit/Icon.js.map +1 -1
- package/dist/kit/JumpList.js +11 -11
- package/dist/kit/JumpList.js.map +1 -1
- package/dist/kit/KV.js +6 -6
- package/dist/kit/KV.js.map +1 -1
- package/dist/kit/Layout.js +5 -5
- package/dist/kit/Layout.js.map +1 -1
- package/dist/kit/List.js +74 -74
- package/dist/kit/List.js.map +1 -1
- package/dist/kit/LogView.js +68 -68
- package/dist/kit/LogView.js.map +1 -1
- package/dist/kit/Markdown.js +37 -37
- package/dist/kit/Markdown.js.map +1 -1
- package/dist/kit/Marker.js +42 -42
- package/dist/kit/Marker.js.map +1 -1
- package/dist/kit/Menu.js +128 -128
- package/dist/kit/Menu.js.map +1 -1
- package/dist/kit/Modal.d.ts.map +1 -1
- package/dist/kit/Modal.js +86 -75
- package/dist/kit/Modal.js.map +1 -1
- package/dist/kit/MultiCombobox.js +157 -157
- package/dist/kit/MultiCombobox.js.map +1 -1
- package/dist/kit/PageHeader.d.ts.map +1 -1
- package/dist/kit/PageHeader.js +8 -7
- package/dist/kit/PageHeader.js.map +1 -1
- package/dist/kit/Panel.d.ts.map +1 -1
- package/dist/kit/Panel.js +33 -14
- package/dist/kit/Panel.js.map +1 -1
- package/dist/kit/Picker.js +159 -159
- package/dist/kit/Picker.js.map +1 -1
- package/dist/kit/PipelineFlow.js +86 -86
- package/dist/kit/PipelineFlow.js.map +1 -1
- package/dist/kit/Popover.js +67 -67
- package/dist/kit/Popover.js.map +1 -1
- package/dist/kit/Range.js +76 -76
- package/dist/kit/Range.js.map +1 -1
- package/dist/kit/Reorder.js +95 -95
- package/dist/kit/Reorder.js.map +1 -1
- package/dist/kit/Search.js +27 -27
- package/dist/kit/Search.js.map +1 -1
- package/dist/kit/Secret.js +26 -26
- package/dist/kit/Secret.js.map +1 -1
- package/dist/kit/Skeleton.js +14 -14
- package/dist/kit/Skeleton.js.map +1 -1
- package/dist/kit/Sparkline.js +51 -51
- package/dist/kit/Sparkline.js.map +1 -1
- package/dist/kit/Spectrum.js +163 -163
- package/dist/kit/Spectrum.js.map +1 -1
- package/dist/kit/Splash.js +3 -3
- package/dist/kit/Splash.js.map +1 -1
- package/dist/kit/Split.js +13 -13
- package/dist/kit/Split.js.map +1 -1
- package/dist/kit/SplitButton.d.ts.map +1 -1
- package/dist/kit/SplitButton.js +8 -6
- package/dist/kit/SplitButton.js.map +1 -1
- package/dist/kit/Stat.d.ts.map +1 -1
- package/dist/kit/Stat.js +61 -60
- package/dist/kit/Stat.js.map +1 -1
- package/dist/kit/Stepper.js +22 -22
- package/dist/kit/Stepper.js.map +1 -1
- package/dist/kit/TabStrip.js +68 -68
- package/dist/kit/TabStrip.js.map +1 -1
- package/dist/kit/Text.js +63 -63
- package/dist/kit/Text.js.map +1 -1
- package/dist/kit/Toast.js +29 -29
- package/dist/kit/Toast.js.map +1 -1
- package/dist/kit/Tooltip.js +83 -83
- package/dist/kit/Tooltip.js.map +1 -1
- package/dist/kit/Trace.js +33 -33
- package/dist/kit/Trace.js.map +1 -1
- package/dist/kit/Upload.js +88 -88
- package/dist/kit/Upload.js.map +1 -1
- package/dist/kit/graphLayout.d.ts +32 -0
- package/dist/kit/graphLayout.d.ts.map +1 -0
- package/dist/kit/graphLayout.js +179 -0
- package/dist/kit/graphLayout.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +17 -1
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +40 -4
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/ThemeScope.d.ts +9 -1
- package/dist/theme/ThemeScope.d.ts.map +1 -1
- package/dist/theme/ThemeScope.js +11 -4
- package/dist/theme/ThemeScope.js.map +1 -1
- package/dist/theme/tokens.d.ts +74 -0
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +197 -3
- package/dist/theme/tokens.js.map +1 -1
- package/package.json +12 -6
- package/scripts/check-colour-literals.mjs +5 -1
- package/scripts/stable-styled-ids.mjs +75 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface AuthCodeInputProps {
|
|
3
|
+
/** how many characters; default 6 */
|
|
4
|
+
length?: number | undefined;
|
|
5
|
+
/** a dash after every `group` boxes; default 3, 0 for none */
|
|
6
|
+
group?: number | undefined;
|
|
7
|
+
/** "numeric" takes digits only (an authenticator code); "text" takes letters and digits, upper-cased (a device code) */
|
|
8
|
+
mode?: "numeric" | "text" | undefined;
|
|
9
|
+
/** controlled value; leave out and the input keeps its own */
|
|
10
|
+
value?: string | undefined;
|
|
11
|
+
/** what an uncontrolled input starts with */
|
|
12
|
+
defaultValue?: string | undefined;
|
|
13
|
+
onChange?: ((code: string) => void) | undefined;
|
|
14
|
+
/** called once every box is filled, which is when a screen submits */
|
|
15
|
+
onComplete?: ((code: string) => void) | undefined;
|
|
16
|
+
/** what the boxes are, for a screen reader: "Verification code" */
|
|
17
|
+
label?: string | undefined;
|
|
18
|
+
invalid?: boolean | undefined;
|
|
19
|
+
disabled?: boolean | undefined;
|
|
20
|
+
autoFocus?: boolean | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* AuthCodeInput: a code typed one character to a box. Typing moves on,
|
|
24
|
+
* Backspace moves back, the arrow keys move, and a pasted code fills from the
|
|
25
|
+
* box it lands in. The first box takes a one-time code the browser offers.
|
|
26
|
+
* Inside an `AuthField` it takes the field's label, hint and error.
|
|
27
|
+
*/
|
|
28
|
+
export declare function AuthCodeInput({ length, group, mode, value, defaultValue, onChange, onComplete, label, invalid, disabled, autoFocus, }: AuthCodeInputProps): import("react").JSX.Element;
|
|
29
|
+
/** AuthCodeDisplay: a code to read and type somewhere else, in the boxes `AuthCodeInput` takes it in. */
|
|
30
|
+
export declare function AuthCodeDisplay({ code, group, label, small }: {
|
|
31
|
+
code: string;
|
|
32
|
+
group?: number | undefined;
|
|
33
|
+
label?: string | undefined;
|
|
34
|
+
small?: boolean | undefined;
|
|
35
|
+
}): import("react").JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* AuthQr: the plate a QR code sits on, with a line under it saying what to do
|
|
38
|
+
* with it. The code itself is the screen's to draw (an `svg` or an `img`, drawn
|
|
39
|
+
* in `currentColor` to match the plate); the kit carries no encoder.
|
|
40
|
+
*/
|
|
41
|
+
export declare function AuthQr({ label, caption, size, children }: {
|
|
42
|
+
/** what the code is, for a screen reader, which cannot scan it: "QR code for xnr.app/tv" */
|
|
43
|
+
label?: string | undefined;
|
|
44
|
+
caption?: ReactNode | undefined;
|
|
45
|
+
size?: number | undefined;
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
}): import("react").JSX.Element;
|
|
48
|
+
//# sourceMappingURL=AuthCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthCode.d.ts","sourceRoot":"","sources":["../../src/auth/AuthCode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkF,KAAK,SAAS,EAAE,MAAM,OAAO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AAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B,+BAYA;AAyBD;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,EAAE,KAAiB,EAAE,OAAO,EAAE,IAAU,EAAE,QAAQ,EAAE,EAAE;IAC3E,4FAA4F;IAC5F,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAOA"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useEffect, useRef, useState } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { QR_COLOURS, v } from "../theme/tokens.js";
|
|
5
|
+
import { useAuthField } from "./AuthControls.js";
|
|
6
|
+
// A short code, one character to a box: the six digits from an authenticator,
|
|
7
|
+
// or the six letters and numbers a device shows. The same boxes show a code
|
|
8
|
+
// (AuthCodeDisplay) and take one (AuthCodeInput), so the code a person reads on
|
|
9
|
+
// one screen looks like the code they type on the other.
|
|
10
|
+
const Boxes = styled.div.withConfig({ componentId: "sc-oh1h9g-0" })`
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 8px;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
.gap { flex: none; width: 8px; height: 1px; background: ${v.line2}; }
|
|
16
|
+
`;
|
|
17
|
+
const Box = styled.input.withConfig({ componentId: "sc-oh1h9g-1" })`
|
|
18
|
+
flex: 1;
|
|
19
|
+
min-width: 0;
|
|
20
|
+
height: 56px;
|
|
21
|
+
padding: 0;
|
|
22
|
+
text-align: center;
|
|
23
|
+
text-transform: uppercase;
|
|
24
|
+
background: ${v.field};
|
|
25
|
+
border: 1px solid ${(p) => p.$invalid ? v.danger : v.fieldLine};
|
|
26
|
+
border-radius: ${v.rCtl};
|
|
27
|
+
color: ${v.text};
|
|
28
|
+
caret-color: ${v.brand};
|
|
29
|
+
font-family: ${v.mono};
|
|
30
|
+
font-size: 22px;
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
&:focus-visible { border-color: ${v.brand}; }
|
|
33
|
+
&:disabled { opacity: 0.6; }
|
|
34
|
+
@media (max-width: 360px) { height: 48px; font-size: 19px; }
|
|
35
|
+
`;
|
|
36
|
+
const Shown = styled.div.withConfig({ componentId: "sc-oh1h9g-2" })`
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: 6px;
|
|
40
|
+
font-family: ${v.mono};
|
|
41
|
+
font-size: ${(p) => p.$small ? "16px" : "22px"};
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
color: ${v.text};
|
|
44
|
+
span.c {
|
|
45
|
+
width: ${(p) => p.$small ? "24px" : "32px"};
|
|
46
|
+
height: ${(p) => p.$small ? "32px" : "44px"};
|
|
47
|
+
display: grid;
|
|
48
|
+
place-items: center;
|
|
49
|
+
background: ${v.surface2};
|
|
50
|
+
border: 1px solid ${v.line2};
|
|
51
|
+
border-radius: ${v.rCtl};
|
|
52
|
+
}
|
|
53
|
+
.gap { width: 8px; height: 1px; background: ${v.line2}; }
|
|
54
|
+
`;
|
|
55
|
+
/**
|
|
56
|
+
* AuthCodeInput: a code typed one character to a box. Typing moves on,
|
|
57
|
+
* Backspace moves back, the arrow keys move, and a pasted code fills from the
|
|
58
|
+
* box it lands in. The first box takes a one-time code the browser offers.
|
|
59
|
+
* Inside an `AuthField` it takes the field's label, hint and error.
|
|
60
|
+
*/
|
|
61
|
+
export function AuthCodeInput({ length = 6, group = 3, mode = "numeric", value, defaultValue, onChange, onComplete, label = "Code", invalid, disabled, autoFocus }) {
|
|
62
|
+
const field = useAuthField();
|
|
63
|
+
const bad = invalid ?? field?.invalid;
|
|
64
|
+
const [own, setOwn] = useState(defaultValue ?? "");
|
|
65
|
+
const code = (value ?? own).slice(0, length);
|
|
66
|
+
const refs = useRef([]);
|
|
67
|
+
const clean = (raw) => mode === "numeric" ? raw.replace(/\D/g, "") : raw.replace(/[^a-zA-Z0-9]/g, "").toUpperCase();
|
|
68
|
+
const focus = (i) => {
|
|
69
|
+
const el = refs.current[Math.max(0, Math.min(length - 1, i))];
|
|
70
|
+
el?.focus();
|
|
71
|
+
el?.select();
|
|
72
|
+
};
|
|
73
|
+
const commit = (next) => {
|
|
74
|
+
const n = next.slice(0, length);
|
|
75
|
+
if (value === undefined)
|
|
76
|
+
setOwn(n);
|
|
77
|
+
onChange?.(n);
|
|
78
|
+
if (n.length === length && n !== code)
|
|
79
|
+
onComplete?.(n);
|
|
80
|
+
};
|
|
81
|
+
// The code has no holes: a character typed past its end joins the end.
|
|
82
|
+
const write = (i, raw) => {
|
|
83
|
+
const chars = clean(raw);
|
|
84
|
+
if (!chars)
|
|
85
|
+
return;
|
|
86
|
+
const at = Math.min(i, code.length);
|
|
87
|
+
const next = (code.slice(0, at) + chars + code.slice(at + chars.length)).slice(0, length);
|
|
88
|
+
commit(next);
|
|
89
|
+
focus(Math.min(at + chars.length, length - 1));
|
|
90
|
+
};
|
|
91
|
+
// Backspace. From a filled box it takes that character; from an empty one,
|
|
92
|
+
// the last. The code has no holes, so what follows a character taken from
|
|
93
|
+
// the middle closes up, and the focus steps back as a caret would: holding
|
|
94
|
+
// Backspace walks back through the code.
|
|
95
|
+
const erase = (i) => {
|
|
96
|
+
if (!code)
|
|
97
|
+
return;
|
|
98
|
+
const at = Math.min(i, code.length - 1);
|
|
99
|
+
commit(code.slice(0, at) + code.slice(at + 1));
|
|
100
|
+
focus(at === code.length - 1 ? at : at - 1);
|
|
101
|
+
};
|
|
102
|
+
const onKeyDown = (i, e) => {
|
|
103
|
+
if (e.key === "Backspace") {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
erase(i);
|
|
106
|
+
} else
|
|
107
|
+
if (e.key === "ArrowLeft") {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
focus(i - 1);
|
|
110
|
+
} else
|
|
111
|
+
if (e.key === "ArrowRight") {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
focus(Math.min(i + 1, code.length));
|
|
114
|
+
} else
|
|
115
|
+
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
116
|
+
// A typed character is written here, not left to the change event:
|
|
117
|
+
// typing the character a box already holds changes nothing, so it
|
|
118
|
+
// would not move on. The change event still takes what a keyboard
|
|
119
|
+
// sends without a key: a phone's, or the browser offering a code.
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
write(i, e.key);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
// Android's keyboards send every key as "Unidentified", Backspace included,
|
|
125
|
+
// so on a phone both typing and deleting arrive here, or in the listener
|
|
126
|
+
// below, and never in onKeyDown. A filled box that comes back empty was deleted.
|
|
127
|
+
const onBoxChange = (i, value) => {
|
|
128
|
+
if (value === "") {
|
|
129
|
+
if (code[i] !== undefined)
|
|
130
|
+
erase(i);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
write(i, value.replace(code[i] ?? "", ""));
|
|
134
|
+
};
|
|
135
|
+
// The same keyboards on an empty box: nothing changes, so there is no change
|
|
136
|
+
// event to read. The delete is announced before it happens (`beforeinput`),
|
|
137
|
+
// and that is all. React's onBeforeInput is its own event, made from typed
|
|
138
|
+
// text, and never fires for a delete, so this listens to the browser's.
|
|
139
|
+
// Attached again on every render, so it reads the code as it is now.
|
|
140
|
+
const boxesEl = useRef(null);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
const el = boxesEl.current;
|
|
143
|
+
if (!el)
|
|
144
|
+
return;
|
|
145
|
+
const onBefore = (e) => {
|
|
146
|
+
if (e.inputType !== "deleteContentBackward")
|
|
147
|
+
return;
|
|
148
|
+
const i = refs.current.indexOf(e.target);
|
|
149
|
+
if (i < 0 || code[i] !== undefined)
|
|
150
|
+
return;
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
erase(i);
|
|
153
|
+
};
|
|
154
|
+
el.addEventListener("beforeinput", onBefore);
|
|
155
|
+
return () => el.removeEventListener("beforeinput", onBefore);
|
|
156
|
+
});
|
|
157
|
+
const onPaste = (i, e) => {
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
write(i, e.clipboardData.getData("text"));
|
|
160
|
+
};
|
|
161
|
+
return _jsx(Boxes, { ref: boxesEl, role: "group", "aria-label": label, "aria-describedby": field?.describedBy, children: Array.from({ length }, (_, i) => _jsxs(Fragment, { children: [group > 0 && i > 0 && i % group === 0 ? _jsx("span", { className: "gap", "aria-hidden": true }) : null, _jsx(Box, { ref: (el) => {refs.current[i] = el;}, id: i === 0 ? field?.id : undefined, value: code[i] ?? "", onChange: (e) => onBoxChange(i, e.target.value), onKeyDown: (e) => onKeyDown(i, e), onPaste: (e) => onPaste(i, e), onFocus: (e) => e.target.select(), inputMode: mode === "numeric" ? "numeric" : "text", autoComplete: i === 0 ? "one-time-code" : "off", autoCapitalize: "characters", autoCorrect: "off", spellCheck: false, "aria-label": `${label}, character ${i + 1} of ${length}`, "aria-invalid": bad || undefined, "$invalid": bad, disabled: disabled, autoFocus: autoFocus && i === 0 })] }, i)) });
|
|
162
|
+
}
|
|
163
|
+
/** AuthCodeDisplay: a code to read and type somewhere else, in the boxes `AuthCodeInput` takes it in. */
|
|
164
|
+
export function AuthCodeDisplay({ code, group = 3, label = "Code", small }) {
|
|
165
|
+
const chars = code.replace(/[^a-zA-Z0-9]/g, "").toUpperCase().split("");
|
|
166
|
+
return _jsx(Shown, { role: "img", "aria-label": `${label}: ${chars.join(" ")}`, "$small": small, children: chars.map((c, i) => _jsxs(Fragment, { children: [group > 0 && i > 0 && i % group === 0 ? _jsx("span", { className: "gap", "aria-hidden": true }) : null, _jsx("span", { className: "c", "aria-hidden": true, children: c })] }, i)) });
|
|
167
|
+
}
|
|
168
|
+
const Figure = styled.figure.withConfig({ componentId: "sc-oh1h9g-3" })`
|
|
169
|
+
margin: 0;
|
|
170
|
+
display: flex;
|
|
171
|
+
flex-direction: column;
|
|
172
|
+
align-items: center;
|
|
173
|
+
gap: 10px;
|
|
174
|
+
figcaption { font-size: 12px; line-height: 1.5; color: ${v.muted}; text-align: center; }
|
|
175
|
+
`;
|
|
176
|
+
// Dark on light in both schemes: a camera reads a code off a light plate, and
|
|
177
|
+
// an inverted one is where scanners give up.
|
|
178
|
+
const Plate = styled.div.withConfig({ componentId: "sc-oh1h9g-4" })`
|
|
179
|
+
width: ${(p) => p.$size}px;
|
|
180
|
+
max-width: 100%;
|
|
181
|
+
aspect-ratio: 1;
|
|
182
|
+
padding: 10px;
|
|
183
|
+
display: grid;
|
|
184
|
+
background: ${QR_COLOURS.plate};
|
|
185
|
+
color: ${QR_COLOURS.ink};
|
|
186
|
+
border-radius: ${v.rCtl};
|
|
187
|
+
> * { width: 100%; height: 100%; }
|
|
188
|
+
`;
|
|
189
|
+
/**
|
|
190
|
+
* AuthQr: the plate a QR code sits on, with a line under it saying what to do
|
|
191
|
+
* with it. The code itself is the screen's to draw (an `svg` or an `img`, drawn
|
|
192
|
+
* in `currentColor` to match the plate); the kit carries no encoder.
|
|
193
|
+
*/
|
|
194
|
+
export function AuthQr({ label = "QR code", caption, size = 168, children }) {
|
|
195
|
+
return _jsxs(Figure, { children: [_jsx(Plate, { "$size": size, role: "img", "aria-label": label, children: children }), caption ? _jsx("figcaption", { children: caption }) : null] });
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=AuthCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/auth/AuthCode.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAAS,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,QAAiE,OAAO;AACtH,OAAO,MAAM,MAAM,mBAAmB;AACtC,SAAS,UAAU,EAAE,CAAC,QAAQ,oBAAoB;AAClD,SAAS,YAAY,QAAQ,mBAAoB;AAEjD;AACA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QAAQ,EAMxE;EACC,OACE,MAAC,MAAM,eACL,KAAC,KAAK,aAAQ,IAAI,EAAE,IAAI,EAAC,KAAK,gBAAa,KAAK,YAAG,QAAQ,GAAS,EACnE,OAAO,GAAG,+BAAa,OAAO,GAAc,GAAG,IAAI,IAC7C;AAEb","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type IconName } from "../kit/Icon.tsx";
|
|
3
|
+
/**
|
|
4
|
+
* AuthPermissions: one group of what is being asked for, under its heading:
|
|
5
|
+
* "Sensitive", "Standard", "Resource access". `sensitive` flags the whole
|
|
6
|
+
* group once, in its heading, so a list that is mostly sensitive does not turn
|
|
7
|
+
* into a block of red.
|
|
8
|
+
*/
|
|
9
|
+
export declare function AuthPermissions({ title, sensitive, children }: {
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
sensitive?: boolean | undefined;
|
|
12
|
+
/** `AuthPermission` rows */
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* AuthPermission: one thing being asked for. `source` is the application the
|
|
17
|
+
* permission belongs to. `denied` is a resource this person cannot share: it
|
|
18
|
+
* is shown, said to be left out, and not granted.
|
|
19
|
+
*/
|
|
20
|
+
export declare function AuthPermission({ icon, sensitive, denied, source, detail, children }: {
|
|
21
|
+
icon?: IconName | undefined;
|
|
22
|
+
sensitive?: boolean | undefined;
|
|
23
|
+
denied?: boolean | undefined;
|
|
24
|
+
/** whose permission it is: "Authentication Service" */
|
|
25
|
+
source?: string | undefined;
|
|
26
|
+
/** a second line: what a resource grant covers, or why it is left out */
|
|
27
|
+
detail?: ReactNode | undefined;
|
|
28
|
+
/** what it allows, as a sentence */
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
/** AuthActions: the decision at a panel's foot: the quiet answer, then the one the screen is for. Stacks on a phone with that one on top. */
|
|
32
|
+
export declare const AuthActions: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
33
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
34
|
+
}> & string;
|
|
35
|
+
type TaskState = "done" | "busy" | "failed";
|
|
36
|
+
/** AuthTasks: one thing being done in several places, a row each: signing out of every application that has a session. */
|
|
37
|
+
export declare function AuthTasks({ children }: {
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
}): import("react").JSX.Element;
|
|
40
|
+
/** AuthTask: one of them. `detail` says where it has got to, in words, so the state is not carried by the icon alone. */
|
|
41
|
+
export declare function AuthTask({ state, detail, children }: {
|
|
42
|
+
state: TaskState;
|
|
43
|
+
/** "signed out", "signing out", "could not be reached" */
|
|
44
|
+
detail?: ReactNode | undefined;
|
|
45
|
+
/** what it is being done to: the application's name */
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
}): import("react").JSX.Element;
|
|
48
|
+
type StatusTone = "neutral" | "ok" | "warn" | "danger";
|
|
49
|
+
/**
|
|
50
|
+
* AuthStatus: a panel that says what happened instead of asking for
|
|
51
|
+
* something: signing you in, signed out, access denied, the code ran out.
|
|
52
|
+
* `busy` is work in progress; `hint` is the technical line under the message,
|
|
53
|
+
* for whoever has to fix it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function AuthStatus({ tone, icon, busy, title, hint, actions, children, as }: {
|
|
56
|
+
tone?: StatusTone | undefined;
|
|
57
|
+
icon?: IconName | undefined;
|
|
58
|
+
busy?: boolean | undefined;
|
|
59
|
+
title: ReactNode;
|
|
60
|
+
hint?: ReactNode | undefined;
|
|
61
|
+
/** buttons, most wanted first */
|
|
62
|
+
actions?: ReactNode | undefined;
|
|
63
|
+
/** the message; anything else the state needs follows it */
|
|
64
|
+
children?: ReactNode | undefined;
|
|
65
|
+
/** the title's level: `h1` when the state is the whole screen */
|
|
66
|
+
as?: "h1" | "h2" | undefined;
|
|
67
|
+
}): import("react").JSX.Element;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=AuthConsent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthConsent.d.ts","sourceRoot":"","sources":["../../src/auth/AuthConsent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAkBtD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;IAC9D,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,4BAA4B;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAUA;AAgCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;IACpF,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,yEAAyE;IACzE,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAcA;AAED,6IAA6I;AAC7I,eAAO,MAAM,WAAW;;WAMvB,CAAC;AAcF,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAwB5C,0HAA0H;AAC1H,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAE9D;AAED,yHAAyH;AACzH,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;IACpD,KAAK,EAAE,SAAS,CAAC;IACjB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,uDAAuD;IACvD,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAUA;AAKD,KAAK,UAAU,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC;AAqCvD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,IAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAS,EAAE,EAAE;IACtG,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,iCAAiC;IACjC,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,iEAAiE;IACjE,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;CAC9B,+BAeA"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { v } from "../theme/tokens.js";
|
|
4
|
+
import { Icon } from "../kit/Icon.js";
|
|
5
|
+
import { MicroLabel } from "../kit/Panel.js";
|
|
6
|
+
import { Tag } from "../kit/Badge.js";
|
|
7
|
+
import { Spinner } from "../kit/Skeleton.js";
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// What an application is asking for
|
|
10
|
+
const Group = styled.div.withConfig({ componentId: "sc-1gb9g3m-0" })`
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: 8px;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
.head { display: flex; align-items: center; gap: 8px; }
|
|
16
|
+
.flag { width: 6px; height: 6px; background: ${v.danger}; }
|
|
17
|
+
ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
|
|
18
|
+
`;
|
|
19
|
+
/**
|
|
20
|
+
* AuthPermissions: one group of what is being asked for, under its heading:
|
|
21
|
+
* "Sensitive", "Standard", "Resource access". `sensitive` flags the whole
|
|
22
|
+
* group once, in its heading, so a list that is mostly sensitive does not turn
|
|
23
|
+
* into a block of red.
|
|
24
|
+
*/
|
|
25
|
+
export function AuthPermissions({ title, sensitive, children }) {
|
|
26
|
+
return _jsxs(Group, { children: [_jsxs("div", { className: "head", children: [sensitive ? _jsx("span", { className: "flag", "aria-hidden": true }) : null, _jsx(MicroLabel, { as: "h3", style: { margin: 0 }, children: title })] }), _jsx("ul", { children: children })] });
|
|
27
|
+
}
|
|
28
|
+
const Row = styled.li.withConfig({ componentId: "sc-1gb9g3m-1" })`
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 12px;
|
|
32
|
+
padding: 9px 0;
|
|
33
|
+
border-top: 1px solid ${v.line};
|
|
34
|
+
.chip {
|
|
35
|
+
flex: none;
|
|
36
|
+
width: 28px;
|
|
37
|
+
height: 28px;
|
|
38
|
+
display: grid;
|
|
39
|
+
place-items: center;
|
|
40
|
+
border-radius: min(7px, ${v.rCtl});
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
}
|
|
43
|
+
.chip.plain { background: ${v.surface2}; color: ${v.muted}; }
|
|
44
|
+
.chip.hot { background: ${v.dangerBg}; color: ${v.danger}; }
|
|
45
|
+
.text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
|
|
46
|
+
.what { font-size: 13.5px; line-height: 1.4; color: ${(p) => p.$off ? v.muted : v.text}; }
|
|
47
|
+
.what code { font-family: ${v.mono}; font-size: 0.92em; }
|
|
48
|
+
.more { font-size: 12px; line-height: 1.4; color: ${(p) => p.$off ? v.danger : v.muted}; }
|
|
49
|
+
.src { flex: none; display: flex; max-width: 45%; }
|
|
50
|
+
/* on a phone the source goes under the sentence, in line with it, so the sentence keeps the row's width */
|
|
51
|
+
@media (max-width: 560px) {
|
|
52
|
+
flex-wrap: wrap;
|
|
53
|
+
gap: 6px 12px;
|
|
54
|
+
.src { flex-basis: 100%; max-width: none; padding-left: 40px; }
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
/**
|
|
58
|
+
* AuthPermission: one thing being asked for. `source` is the application the
|
|
59
|
+
* permission belongs to. `denied` is a resource this person cannot share: it
|
|
60
|
+
* is shown, said to be left out, and not granted.
|
|
61
|
+
*/
|
|
62
|
+
export function AuthPermission({ icon, sensitive, denied, source, detail, children }) {
|
|
63
|
+
const hot = sensitive || denied;
|
|
64
|
+
return _jsxs(Row, { "$off": denied, children: [_jsx("span", { className: `chip ${hot ? "hot" : "plain"}`, "aria-hidden": true, children: _jsx(Icon, { name: icon ?? (denied ? "ban" : sensitive ? "key" : "user") }) }), _jsxs("span", { className: "text", children: [_jsx("span", { className: "what", children: children }), detail ? _jsx("span", { className: "more", children: detail }) : null] }), source ? _jsx("span", { className: "src", children: _jsx(Tag, { title: source, children: source }) }) : null] });
|
|
65
|
+
}
|
|
66
|
+
/** AuthActions: the decision at a panel's foot: the quiet answer, then the one the screen is for. Stacks on a phone with that one on top. */
|
|
67
|
+
export const AuthActions = styled.div.withConfig({ componentId: "sc-1gb9g3m-2" })`
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-wrap: wrap-reverse;
|
|
70
|
+
gap: 10px;
|
|
71
|
+
> * { flex: 1 1 130px; }
|
|
72
|
+
> :last-child { flex: 2 1 190px; }
|
|
73
|
+
`;
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// Work that is happening in several places at once
|
|
76
|
+
const TaskList = styled.ul.withConfig({ componentId: "sc-1gb9g3m-3" })`
|
|
77
|
+
list-style: none;
|
|
78
|
+
margin: 0;
|
|
79
|
+
padding: 0;
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
border-bottom: 1px solid ${v.line};
|
|
83
|
+
`;
|
|
84
|
+
const TaskRow = styled.li.withConfig({ componentId: "sc-1gb9g3m-4" })`
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: 10px;
|
|
88
|
+
padding: 9px 0;
|
|
89
|
+
border-top: 1px solid ${v.line};
|
|
90
|
+
font-size: 13.5px;
|
|
91
|
+
line-height: 20px;
|
|
92
|
+
color: ${v.text};
|
|
93
|
+
.ic {
|
|
94
|
+
flex: none;
|
|
95
|
+
width: 16px;
|
|
96
|
+
height: 16px;
|
|
97
|
+
display: grid;
|
|
98
|
+
place-items: center;
|
|
99
|
+
font-size: 13px;
|
|
100
|
+
color: ${(p) => p.$state === "done" ? v.success : p.$state === "failed" ? v.danger : v.info};
|
|
101
|
+
}
|
|
102
|
+
.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
103
|
+
.state { flex: none; font-family: ${v.mono}; font-size: 11.5px; color: ${(p) => p.$state === "failed" ? v.danger : v.muted}; }
|
|
104
|
+
`;
|
|
105
|
+
/** AuthTasks: one thing being done in several places, a row each: signing out of every application that has a session. */
|
|
106
|
+
export function AuthTasks({ children }) {
|
|
107
|
+
return _jsx(TaskList, { children: children });
|
|
108
|
+
}
|
|
109
|
+
/** AuthTask: one of them. `detail` says where it has got to, in words, so the state is not carried by the icon alone. */
|
|
110
|
+
export function AuthTask({ state, detail, children }) {
|
|
111
|
+
return _jsxs(TaskRow, { "$state": state, children: [_jsx("span", { className: "ic", "aria-hidden": true, children: state === "busy" ? _jsx(Spinner, { "$size": 12 }) : _jsx(Icon, { name: state === "done" ? "check" : "error" }) }), _jsx("span", { className: "name", children: children }), detail ? _jsx("span", { className: "state", children: detail }) : null] });
|
|
112
|
+
}
|
|
113
|
+
const State = styled.div.withConfig({ componentId: "sc-1gb9g3m-5" })`
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
gap: 18px;
|
|
117
|
+
min-width: 0;
|
|
118
|
+
.text { display: flex; flex-direction: column; gap: 6px; }
|
|
119
|
+
h1, h2 { margin: 0; font-family: ${v.display}; font-size: 21px; line-height: 1.25; font-weight: 600; letter-spacing: 0.01em; color: ${v.text}; }
|
|
120
|
+
p { margin: 0; font-size: 13px; line-height: 1.55; color: ${v.muted}; }
|
|
121
|
+
p strong { color: ${v.text}; font-weight: 500; }
|
|
122
|
+
.hint {
|
|
123
|
+
padding: 10px 12px;
|
|
124
|
+
background: ${v.surface2};
|
|
125
|
+
border: 1px solid ${v.line};
|
|
126
|
+
border-radius: ${v.rCtl};
|
|
127
|
+
font-family: ${v.mono};
|
|
128
|
+
font-size: 12px;
|
|
129
|
+
overflow-wrap: anywhere;
|
|
130
|
+
}
|
|
131
|
+
.acts { display: flex; flex-direction: column; gap: 8px; }
|
|
132
|
+
`;
|
|
133
|
+
const StateTile = styled.div.withConfig({ componentId: "sc-1gb9g3m-6" })`
|
|
134
|
+
width: 48px;
|
|
135
|
+
height: 48px;
|
|
136
|
+
display: grid;
|
|
137
|
+
place-items: center;
|
|
138
|
+
border-radius: min(14px, ${v.rCard});
|
|
139
|
+
clip-path: ${v.clipTile};
|
|
140
|
+
font-size: 20px;
|
|
141
|
+
background: ${(p) => p.$tone === "ok" ? v.successBg : p.$tone === "warn" ? v.warningBg : p.$tone === "danger" ? v.dangerBg : v.surface2};
|
|
142
|
+
color: ${(p) => p.$tone === "ok" ? v.success : p.$tone === "warn" ? v.warning : p.$tone === "danger" ? v.danger : v.info};
|
|
143
|
+
`;
|
|
144
|
+
const toneIcon = { neutral: "info", ok: "check", warn: "warn", danger: "error" };
|
|
145
|
+
/**
|
|
146
|
+
* AuthStatus: a panel that says what happened instead of asking for
|
|
147
|
+
* something: signing you in, signed out, access denied, the code ran out.
|
|
148
|
+
* `busy` is work in progress; `hint` is the technical line under the message,
|
|
149
|
+
* for whoever has to fix it.
|
|
150
|
+
*/
|
|
151
|
+
export function AuthStatus({ tone = "neutral", icon, busy, title, hint, actions, children, as = "h1" }) {
|
|
152
|
+
const Title = as;
|
|
153
|
+
return _jsxs(State, { role: busy ? "status" : tone === "danger" ? "alert" : undefined, "aria-busy": busy || undefined, children: [_jsx(StateTile, { "$tone": tone, "aria-hidden": true, children: busy ? _jsx(Spinner, { "$size": 20 }) : _jsx(Icon, { name: icon ?? toneIcon[tone] }) }), _jsxs("div", { className: "text", children: [_jsx(Title, { children: title }), typeof children === "string" ? _jsx("p", { children: children }) : children] }), hint ? _jsx("p", { className: "hint", children: hint }) : null, actions ? _jsx("div", { className: "acts", children: actions }) : null] });
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=AuthConsent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/auth/AuthConsent.tsx"],"sourcesContent":[null],"mappings":";AACA,OAAO,MAAM,MAAM,mBAAmB;AACtC,SAAS,CAAC,QAAQ,oBAAoB;AACtC,SAAS,IAAI,QAAuB,gBAAiB;AACrD,SAAS,UAAU,QAAQ,iBAAkB;AAC7C,SAAS,GAAG,QAAQ,iBAAkB;AACtC,SAAS,OAAO,QAAQ,oBAAqB;AAE7C;AACA;AAEA,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG;;;;;;iDAMyB,CAAC,CAAC,MAAM;;CAExD;AAED;;;;;;AAMA,OAAM,SAAU,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAK3D;EACC,OACE,MAAC,KAAK,eACJ,eAAK,SAAS,EAAC,MAAM,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Q,GAAG,OAAO,GAAG,SAAS,eAAa,IAAI,IAAI,SAAS,aAClG,KAAC,SAAS,aAAQ,IAAI,iCACnB,IAAI,GAAG,KAAC,OAAO,aAAQ,EAAE,GAAI,GAAG,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAI,GAC7D,EACZ,eAAK,SAAS,EAAC,MAAM,aACnB,KAAC,KAAK,cAAE,KAAK,GAAS,EACrB,OAAO,QAAQ,KAAK,QAAQ,GAAG,sBAAI,QAAQ,GAAK,GAAG,QAAQ,IACxD,EACL,IAAI,GAAG,YAAG,SAAS,EAAC,MAAM,YAAE,IAAI,GAAK,GAAG,IAAI,EAC5C,OAAO,GAAG,cAAK,SAAS,EAAC,MAAM,YAAE,OAAO,GAAO,GAAG,IAAI,IACjD;AAEZ","ignoreList":[]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
interface FieldState {
|
|
3
|
+
id: string;
|
|
4
|
+
describedBy: string | undefined;
|
|
5
|
+
invalid: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** The `AuthField` a control is inside, if any. Kit-internal: how `AuthCodeInput` joins a field. */
|
|
8
|
+
export declare function useAuthField(): FieldState | null;
|
|
9
|
+
/**
|
|
10
|
+
* AuthField: a label over a control, with a hint or an error under it. The
|
|
11
|
+
* `AuthInput` or `AuthPasswordInput` inside is wired to both (`id`,
|
|
12
|
+
* `aria-describedby`, `aria-invalid`), so a screen writes none of that.
|
|
13
|
+
*/
|
|
14
|
+
export declare function AuthField({ label, hint, error, children }: {
|
|
15
|
+
label: ReactNode;
|
|
16
|
+
hint?: ReactNode | undefined;
|
|
17
|
+
/** why the value is refused; shown in place of the hint and announced */
|
|
18
|
+
error?: ReactNode | undefined;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
/** AuthInput: the sign-in screens' text field. Inside an `AuthField` it takes its id and its error from it. */
|
|
22
|
+
export declare function AuthInput(props: ComponentProps<"input">): import("react").JSX.Element;
|
|
23
|
+
/** AuthTextarea: the same field, several lines tall: a reason, a message. Inside an `AuthField` it takes its id and its error from it. */
|
|
24
|
+
export declare function AuthTextarea(props: ComponentProps<"textarea">): import("react").JSX.Element;
|
|
25
|
+
/** AuthPasswordInput: a password field with a button to show what was typed, which is what replaces "confirm password". */
|
|
26
|
+
export declare function AuthPasswordInput(props: Omit<ComponentProps<"input">, "type">): import("react").JSX.Element;
|
|
27
|
+
/** AuthCheck: one checkbox on a line: "Keep me signed in". */
|
|
28
|
+
export declare function AuthCheck({ children, ...props }: Omit<ComponentProps<"input">, "type">): import("react").JSX.Element;
|
|
29
|
+
/** AuthRow: controls side by side that stack when there is no room: two device options, a checkbox and a link. */
|
|
30
|
+
export declare const AuthRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
31
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
$min?: number | undefined;
|
|
34
|
+
$between?: boolean | undefined;
|
|
35
|
+
}>> & string;
|
|
36
|
+
/** AuthStack: a tight column inside a panel: a field over its button. */
|
|
37
|
+
export declare const AuthStack: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
38
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
$gap?: number | undefined;
|
|
41
|
+
}>> & string;
|
|
42
|
+
/**
|
|
43
|
+
* AuthDivider: the rule between two ways to do the same thing: "or continue
|
|
44
|
+
* with". The kit's `Divider` without its margins, which a panel's own rhythm
|
|
45
|
+
* replaces.
|
|
46
|
+
*/
|
|
47
|
+
export declare function AuthDivider({ children }: {
|
|
48
|
+
children?: ReactNode | undefined;
|
|
49
|
+
}): import("react").JSX.Element;
|
|
50
|
+
export type AuthProviderName = "apple" | "discord" | "github" | "google" | "microsoft" | "gitlab";
|
|
51
|
+
/**
|
|
52
|
+
* ProviderMark: an identity provider's own mark, drawn here so no screen
|
|
53
|
+
* depends on an icon set being registered first. An unknown provider gets its
|
|
54
|
+
* initial, which is what a tenant's own OIDC provider looks like until it has
|
|
55
|
+
* a mark.
|
|
56
|
+
*/
|
|
57
|
+
export declare function ProviderMark({ name, label, size }: {
|
|
58
|
+
name: AuthProviderName | (string & {});
|
|
59
|
+
label?: string | undefined;
|
|
60
|
+
size?: number | undefined;
|
|
61
|
+
}): import("react").JSX.Element;
|
|
62
|
+
/** AuthProviders: the row of provider tiles. They share the width, and wrap when there are too many. */
|
|
63
|
+
export declare const AuthProviders: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
64
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
65
|
+
}> & string;
|
|
66
|
+
/**
|
|
67
|
+
* AuthProvider: one provider as a tile: its mark, with its name as the
|
|
68
|
+
* accessible name and the tooltip. `lastUsed` marks the one this browser signed
|
|
69
|
+
* in with last time.
|
|
70
|
+
*/
|
|
71
|
+
export declare function AuthProvider({ provider, label, verb, lastUsed, href, onClick, disabled }: {
|
|
72
|
+
provider: AuthProviderName | (string & {});
|
|
73
|
+
/** the provider's name: "Discord" */
|
|
74
|
+
label: string;
|
|
75
|
+
/** "Continue with" on sign-in, "Sign up with" on a create-account screen */
|
|
76
|
+
verb?: string | undefined;
|
|
77
|
+
lastUsed?: boolean | undefined;
|
|
78
|
+
href?: string | undefined;
|
|
79
|
+
onClick?: (() => void) | undefined;
|
|
80
|
+
disabled?: boolean | undefined;
|
|
81
|
+
}): import("react").JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* AuthIdentity: who this step is for: the address just typed, or the account
|
|
84
|
+
* in use, with the way to change it. Boxed by default; `bare` inside a fact.
|
|
85
|
+
*/
|
|
86
|
+
export declare function AuthIdentity({ name, detail, avatarUrl, action, bare }: {
|
|
87
|
+
name: string;
|
|
88
|
+
detail?: ReactNode | undefined;
|
|
89
|
+
avatarUrl?: string | undefined;
|
|
90
|
+
/** "Change", "Switch": a link or a button */
|
|
91
|
+
action?: ReactNode | undefined;
|
|
92
|
+
bare?: boolean | undefined;
|
|
93
|
+
}): import("react").JSX.Element;
|
|
94
|
+
/** AuthAccounts: the accounts signed in on this browser. A list of `AuthAccount`. */
|
|
95
|
+
export declare const AuthAccounts: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "style"> & {
|
|
96
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
97
|
+
}> & string;
|
|
98
|
+
/**
|
|
99
|
+
* AuthAccount: one account to continue as, with the way to sign it out of this
|
|
100
|
+
* browser. Choosing it is a link (`href`), a click (`onSelect`), or, for a
|
|
101
|
+
* server-rendered page that must work before its script loads, a form
|
|
102
|
+
* submission: give `submit` and put the list inside a `<form>`. Signing out
|
|
103
|
+
* is a link (`signOutHref`) or a click (`onSignOut`).
|
|
104
|
+
*/
|
|
105
|
+
export declare function AuthAccount({ name, email, avatarUrl, via, href, submit, onSelect, signOutHref, onSignOut }: {
|
|
106
|
+
name: string;
|
|
107
|
+
email?: string | undefined;
|
|
108
|
+
avatarUrl?: string | undefined;
|
|
109
|
+
/** how it signed in: "Discord", "Email" */
|
|
110
|
+
via?: string | undefined;
|
|
111
|
+
href?: string | undefined;
|
|
112
|
+
/** the field this account's button submits with the form around it: `{ name: "accountId", value: account.id }` */
|
|
113
|
+
submit?: {
|
|
114
|
+
name: string;
|
|
115
|
+
value: string;
|
|
116
|
+
} | undefined;
|
|
117
|
+
onSelect?: (() => void) | undefined;
|
|
118
|
+
signOutHref?: string | undefined;
|
|
119
|
+
onSignOut?: (() => void) | undefined;
|
|
120
|
+
}): import("react").JSX.Element;
|
|
121
|
+
/** AuthAnotherAccount: the dashed row under the list: sign in as someone not listed. */
|
|
122
|
+
export declare function AuthAnotherAccount({ children, ...props }: ComponentProps<"button">): import("react").JSX.Element;
|
|
123
|
+
/** AuthSteps: numbered things to do somewhere else: on your other device, in your authenticator. */
|
|
124
|
+
export declare const AuthSteps: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "style"> & {
|
|
125
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
126
|
+
}> & string;
|
|
127
|
+
/** AuthPending: the screen is waiting on something elsewhere: an approval, a device. `meta` is what runs out. */
|
|
128
|
+
export declare function AuthPending({ children, meta }: {
|
|
129
|
+
children: ReactNode;
|
|
130
|
+
meta?: ReactNode | undefined;
|
|
131
|
+
}): import("react").JSX.Element;
|
|
132
|
+
export {};
|
|
133
|
+
//# sourceMappingURL=AuthControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthControls.d.ts","sourceRoot":"","sources":["../../src/auth/AuthControls.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAUxG,UAAU,UAAU;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE;AAGtF,oGAAoG;AACpG,wBAAgB,YAAY,IAAI,UAAU,GAAG,IAAI,CAEhD;AAWD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE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