@sharadox/graphical-user-interface-web-library 0.2.0-layout.14 → 0.2.0-overlay.23
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/distribution/avatar/index.module.css +1 -1
- package/distribution/avatar/index.module.scss +2 -0
- package/distribution/card/index.module.css +1 -1
- package/distribution/card/index.module.scss +3 -1
- package/distribution/code-boxes/index.d.ts +11 -0
- package/distribution/code-boxes/index.d.ts.map +1 -0
- package/distribution/code-boxes/index.js +64 -0
- package/distribution/code-boxes/index.js.map +1 -0
- package/distribution/code-boxes/index.module.css +1 -0
- package/distribution/code-boxes/index.module.scss +28 -0
- package/distribution/code-boxes/type.d.ts +17 -0
- package/distribution/code-boxes/type.d.ts.map +1 -0
- package/distribution/code-boxes/type.js +2 -0
- package/distribution/code-boxes/type.js.map +1 -0
- package/distribution/copy-button/index.d.ts +10 -0
- package/distribution/copy-button/index.d.ts.map +1 -0
- package/distribution/copy-button/index.js +26 -0
- package/distribution/copy-button/index.js.map +1 -0
- package/distribution/copy-button/type.d.ts +11 -0
- package/distribution/copy-button/type.d.ts.map +1 -0
- package/distribution/copy-button/type.js +2 -0
- package/distribution/copy-button/type.js.map +1 -0
- package/distribution/dialog/index.d.ts +12 -0
- package/distribution/dialog/index.d.ts.map +1 -0
- package/distribution/dialog/index.js +56 -0
- package/distribution/dialog/index.js.map +1 -0
- package/distribution/dialog/index.module.css +1 -0
- package/distribution/dialog/index.module.scss +59 -0
- package/distribution/dialog/type.d.ts +11 -0
- package/distribution/dialog/type.d.ts.map +1 -0
- package/distribution/dialog/type.js +2 -0
- package/distribution/dialog/type.js.map +1 -0
- package/distribution/notification/index.d.ts +19 -0
- package/distribution/notification/index.d.ts.map +1 -0
- package/distribution/notification/index.js +48 -0
- package/distribution/notification/index.js.map +1 -0
- package/distribution/notification/index.module.css +1 -0
- package/distribution/notification/index.module.scss +35 -0
- package/distribution/notification/type.d.ts +23 -0
- package/distribution/notification/type.d.ts.map +1 -0
- package/distribution/notification/type.js +2 -0
- package/distribution/notification/type.js.map +1 -0
- package/distribution/skeleton/index.d.ts +11 -0
- package/distribution/skeleton/index.d.ts.map +1 -0
- package/distribution/skeleton/index.js +20 -0
- package/distribution/skeleton/index.js.map +1 -0
- package/distribution/skeleton/index.module.css +1 -0
- package/distribution/skeleton/index.module.scss +96 -0
- package/distribution/skeleton/type.d.ts +16 -0
- package/distribution/skeleton/type.d.ts.map +1 -0
- package/distribution/skeleton/type.js +2 -0
- package/distribution/skeleton/type.js.map +1 -0
- package/distribution/skeleton-value/index.d.ts +10 -0
- package/distribution/skeleton-value/index.d.ts.map +1 -0
- package/distribution/skeleton-value/index.js +15 -0
- package/distribution/skeleton-value/index.js.map +1 -0
- package/distribution/skeleton-value/index.module.css +1 -0
- package/distribution/skeleton-value/index.module.scss +35 -0
- package/distribution/skeleton-value/type.d.ts +9 -0
- package/distribution/skeleton-value/type.d.ts.map +1 -0
- package/distribution/skeleton-value/type.js +2 -0
- package/distribution/skeleton-value/type.js.map +1 -0
- package/distribution/tip/index.d.ts +10 -0
- package/distribution/tip/index.d.ts.map +1 -0
- package/distribution/tip/index.js +22 -0
- package/distribution/tip/index.js.map +1 -0
- package/distribution/tip/index.module.css +1 -0
- package/distribution/tip/index.module.scss +24 -0
- package/distribution/tip/type.d.ts +7 -0
- package/distribution/tip/type.d.ts.map +1 -0
- package/distribution/tip/type.js +2 -0
- package/distribution/tip/type.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
:where(.avatar){overflow:hidden;inline-size:var(--current-minimum-size);block-size:var(--current-minimum-size);font-weight:600;line-height:1}:where(.picture){display:block;inline-size:100%;block-size:100%;object-fit:cover}
|
|
1
|
+
:where(.avatar){overflow:hidden;inline-size:var(--current-minimum-size);block-size:var(--current-minimum-size);font-size:calc(var(--current-minimum-size)*.4);font-weight:600;line-height:1}:where(.picture){display:block;inline-size:100%;block-size:100%;object-fit:cover}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:where(.body){flex:1 1 240px;min-inline-size:0}:where(.title){margin:0;font-size:var(--scale-16);font-weight:600}:where(.description){margin:0;color:
|
|
1
|
+
:where(.body){flex:1 1 240px;min-inline-size:0}:where(.title){margin:0;font-size:var(--scale-16);font-weight:600}:where(.description){margin:0;color:inherit;opacity:.7;font-size:var(--scale-14)}:where(.action){flex:none}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CodeBoxesProperties } from "@sharadox/graphical-user-interface-web-library/code-boxes/type";
|
|
2
|
+
/**
|
|
3
|
+
* A one-time code typed into one box per digit: each digit moves on to the next box, Backspace or Delete clears the
|
|
4
|
+
* box it is on (on an empty box, Backspace clears the one before), the arrows move back and forth, and pasting the code (or the phone filling it in from a message) fills every box at once. The whole
|
|
5
|
+
* code is in one hidden field for forms. Each box is a large outlined field box (the error color when invalid); `onComplete` fires once every box has its digit.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <CodeBoxes label="Code" digitLabel="digit" ofLabel="of" onComplete={submit} autoFocus />
|
|
9
|
+
*/
|
|
10
|
+
export declare function CodeBoxes({ label, digitLabel, ofLabel, name, length, onComplete, invalid, disabled, describedBy, autoFocus, }: CodeBoxesProperties): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/code-boxes/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gEAAgE,CAAC;AAE1G;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,UAAU,EACV,OAAO,EACP,IAAI,EACJ,MAAU,EACV,UAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAW,EACX,SAAS,GACV,EAAE,mBAAmB,+BAgFrB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { Box } from "@sharadox/graphical-user-interface-web-library/box";
|
|
5
|
+
import styles from "./index.module.css";
|
|
6
|
+
/**
|
|
7
|
+
* A one-time code typed into one box per digit: each digit moves on to the next box, Backspace or Delete clears the
|
|
8
|
+
* box it is on (on an empty box, Backspace clears the one before), the arrows move back and forth, and pasting the code (or the phone filling it in from a message) fills every box at once. The whole
|
|
9
|
+
* code is in one hidden field for forms. Each box is a large outlined field box (the error color when invalid); `onComplete` fires once every box has its digit.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <CodeBoxes label="Code" digitLabel="digit" ofLabel="of" onComplete={submit} autoFocus />
|
|
13
|
+
*/
|
|
14
|
+
export function CodeBoxes({ label, digitLabel, ofLabel, name, length = 6, onComplete, invalid, disabled, describedBy, autoFocus, }) {
|
|
15
|
+
const [digits, setDigits] = useState(() => Array.from({ length }, () => ""));
|
|
16
|
+
const boxes = useRef([]);
|
|
17
|
+
const focus = (index) => boxes.current[Math.max(0, Math.min(length - 1, index))]?.focus();
|
|
18
|
+
/** Puts `typed` digits from box `from` on, then moves to the next empty box. */
|
|
19
|
+
const fill = (from, typed) => {
|
|
20
|
+
const next = [...digits];
|
|
21
|
+
let at = from;
|
|
22
|
+
for (const digit of typed.replace(/\D/g, "").slice(0, length - from))
|
|
23
|
+
next[at++] = digit;
|
|
24
|
+
setDigits(next);
|
|
25
|
+
focus(at);
|
|
26
|
+
const code = next.join("");
|
|
27
|
+
if (code.length === length)
|
|
28
|
+
onComplete?.(code);
|
|
29
|
+
};
|
|
30
|
+
const change = (index, value) => {
|
|
31
|
+
const typed = value.replace(/\D/g, "");
|
|
32
|
+
if (!typed)
|
|
33
|
+
return;
|
|
34
|
+
// One new digit typed over an old one: keep the new one (the last typed).
|
|
35
|
+
fill(index, typed.length === 2 && digits[index] ? typed.slice(-1) : typed);
|
|
36
|
+
};
|
|
37
|
+
/** Empties box `index`. */
|
|
38
|
+
const clear = (index) => setDigits(digits.map((digit, at) => (at === index ? "" : digit)));
|
|
39
|
+
const keyDown = (index, event) => {
|
|
40
|
+
if ((event.key === "Backspace" || event.key === "Delete") && digits[index]) {
|
|
41
|
+
// A filled box: clear it, wherever it is, and stay on it.
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
clear(index);
|
|
44
|
+
}
|
|
45
|
+
else if (event.key === "Backspace") {
|
|
46
|
+
// An empty box: clear the one before and go back to it.
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
clear(Math.max(0, index - 1));
|
|
49
|
+
focus(index - 1);
|
|
50
|
+
}
|
|
51
|
+
else if (event.key === "ArrowLeft")
|
|
52
|
+
focus(index - 1);
|
|
53
|
+
else if (event.key === "ArrowRight")
|
|
54
|
+
focus(index + 1);
|
|
55
|
+
};
|
|
56
|
+
const paste = (index, event) => {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
fill(index, event.clipboardData.getData("text"));
|
|
59
|
+
};
|
|
60
|
+
return (_jsxs("div", { role: "group", "aria-label": label, className: styles.boxes, children: [name && _jsx("input", { type: "hidden", name: name, value: digits.join("") }), digits.map((digit, index) => (_jsx(Box, { field: true, variant: "outlined", color: invalid ? "error" : "middleground", size: "large", state: disabled ? "disabled" : "enabled", className: styles.cell, children: _jsx("input", { ref: (element) => {
|
|
61
|
+
boxes.current[index] = element;
|
|
62
|
+
}, className: styles.box, value: digit, onChange: (event) => change(index, event.target.value), onKeyDown: (event) => keyDown(index, event), onPaste: (event) => paste(index, event), onFocus: (event) => event.target.select(), inputMode: "numeric", autoComplete: index === 0 ? "one-time-code" : "off", "aria-label": `${label}, ${digitLabel} ${index + 1} ${ofLabel} ${length}`, "aria-invalid": invalid || undefined, "aria-describedby": describedBy, disabled: disabled, autoFocus: autoFocus && index === 0 }) }, index)))] }));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
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,OAAO,CAAC;oBACjC,CAAC,EACD,SAAS,EAAE,MAAM,CAAC,GAAG,EACrB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAC3C,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,EACvC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,EACzC,SAAS,EAAC,SAAS,EACnB,YAAY,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,gBACvC,GAAG,KAAK,KAAK,UAAU,IAAI,KAAK,GAAG,CAAC,IAAI,OAAO,IAAI,MAAM,EAAE,kBACzD,OAAO,IAAI,SAAS,sBAChB,WAAW,EAC7B,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,IAAI,KAAK,KAAK,CAAC,GACnC,IAzBG,KAAK,CA0BN,CACP,CAAC,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(.boxes){display:flex;gap:var(--scale-8);inline-size:100%}.cell{flex:1 1 0;min-inline-size:0}:where(.box){box-sizing:border-box;inline-size:100%;min-inline-size:0;min-block-size:var(--section-minimum-size);margin:0;padding:0;border:0;outline:0;background:rgba(0,0,0,0);color:var(--current-hover-color);font:inherit;font-size:var(--scale-24);font-variant-numeric:tabular-nums;text-align:center}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// The boxes share the width, each at least as tall as a large field, the digits centered and large.
|
|
2
|
+
:where(.boxes) {
|
|
3
|
+
display: flex;
|
|
4
|
+
gap: var(--scale-8);
|
|
5
|
+
inline-size: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.cell {
|
|
9
|
+
flex: 1 1 0;
|
|
10
|
+
min-inline-size: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:where(.box) {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
inline-size: 100%;
|
|
16
|
+
min-inline-size: 0;
|
|
17
|
+
min-block-size: var(--section-minimum-size);
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
border: 0;
|
|
21
|
+
outline: 0;
|
|
22
|
+
background: transparent;
|
|
23
|
+
color: var(--current-hover-color);
|
|
24
|
+
font: inherit;
|
|
25
|
+
font-size: var(--scale-24);
|
|
26
|
+
font-variant-numeric: tabular-nums;
|
|
27
|
+
text-align: center;
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface CodeBoxesProperties {
|
|
2
|
+
/** The group's name ("Code"); each box reads "Code, digit 3 of 6". */
|
|
3
|
+
label: string;
|
|
4
|
+
/** "digit" and "of", in the reader's language. */
|
|
5
|
+
digitLabel: string;
|
|
6
|
+
ofLabel: string;
|
|
7
|
+
/** The hidden field's name, for forms. */
|
|
8
|
+
name?: string;
|
|
9
|
+
length?: number;
|
|
10
|
+
/** Once every box has its digit. */
|
|
11
|
+
onComplete?: (code: string) => void;
|
|
12
|
+
invalid?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
describedBy?: string;
|
|
15
|
+
autoFocus?: boolean;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/code-boxes/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/code-boxes/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CopyButtonProperties } from "@sharadox/graphical-user-interface-web-library/copy-button/type";
|
|
2
|
+
/**
|
|
3
|
+
* Copies a value to the clipboard (a key, a set of recovery codes) and says so for two seconds, with a tick: an
|
|
4
|
+
* outlined middleground button.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <CopyButton value={secret} label="Copy" copiedLabel="Copied." />
|
|
8
|
+
*/
|
|
9
|
+
export declare function CopyButton({ value, label, copiedLabel, onCopied }: CopyButtonProperties): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/copy-button/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iEAAiE,CAAC;AAE5G;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,oBAAoB,+BAsBvF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { Button } from "@sharadox/graphical-user-interface-web-library/button";
|
|
5
|
+
/**
|
|
6
|
+
* Copies a value to the clipboard (a key, a set of recovery codes) and says so for two seconds, with a tick: an
|
|
7
|
+
* outlined middleground button.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <CopyButton value={secret} label="Copy" copiedLabel="Copied." />
|
|
11
|
+
*/
|
|
12
|
+
export function CopyButton({ value, label, copiedLabel, onCopied }) {
|
|
13
|
+
const [copied, setCopied] = useState(false);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (!copied)
|
|
16
|
+
return;
|
|
17
|
+
const timer = setTimeout(() => setCopied(false), 2000);
|
|
18
|
+
return () => clearTimeout(timer);
|
|
19
|
+
}, [copied]);
|
|
20
|
+
return (_jsx(Button, { variant: "outlined", color: "middleground", size: "small", icon: copied ? "check" : "copy", onClick: async () => {
|
|
21
|
+
await navigator.clipboard.writeText(value);
|
|
22
|
+
setCopied(true);
|
|
23
|
+
onCopied?.();
|
|
24
|
+
}, children: _jsx("span", { "aria-live": "polite", children: copied ? copiedLabel : label }) }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/copy-button/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,uDAAuD,CAAC;AAG/E;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAwB;IACtF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;QACvD,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACb,OAAO,CACL,KAAC,MAAM,IACL,OAAO,EAAC,UAAU,EAClB,KAAK,EAAC,cAAc,EACpB,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAC/B,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC3C,SAAS,CAAC,IAAI,CAAC,CAAC;YAChB,QAAQ,EAAE,EAAE,CAAC;QACf,CAAC,YAED,4BAAgB,QAAQ,YAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,GAAQ,GACvD,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface CopyButtonProperties {
|
|
2
|
+
/** What is copied. */
|
|
3
|
+
value: string;
|
|
4
|
+
/** The button's words ("Copy", "Copy all"). */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Said for 2 seconds once copied ("Copied."). */
|
|
7
|
+
copiedLabel: string;
|
|
8
|
+
/** After copying (to show a notification). */
|
|
9
|
+
onCopied?: () => void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/copy-button/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/copy-button/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DialogProperties } from "@sharadox/graphical-user-interface-web-library/dialog/type";
|
|
2
|
+
/**
|
|
3
|
+
* A pop-up in the middle of the screen (the browser's own modal dialog: focus stays inside, the page behind is
|
|
4
|
+
* inert), named by its title, closed by Escape, its close button or a click on the backdrop. It leaves the way it
|
|
5
|
+
* came: the opening animation runs backwards before it closes, no longer modal meanwhile, so the page behind works
|
|
6
|
+
* at once.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Dialog open={asking} onClose={() => setAsking(false)} title="Check Your Email" closeLabel="Close">…</Dialog>
|
|
10
|
+
*/
|
|
11
|
+
export declare function Dialog({ open, onClose, title, closeLabel, children }: DialogProperties): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/dialog/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAMnG;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,gBAAgB,+BA8DtF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
4
|
+
import { Box } from "@sharadox/graphical-user-interface-web-library/box";
|
|
5
|
+
import { Button } from "@sharadox/graphical-user-interface-web-library/button";
|
|
6
|
+
import styles from "./index.module.css";
|
|
7
|
+
/** The longest a leaving animation may take before the dialog closes anyway (reduced motion runs none). */
|
|
8
|
+
const LEAVING_MILLISECONDS = 300;
|
|
9
|
+
/**
|
|
10
|
+
* A pop-up in the middle of the screen (the browser's own modal dialog: focus stays inside, the page behind is
|
|
11
|
+
* inert), named by its title, closed by Escape, its close button or a click on the backdrop. It leaves the way it
|
|
12
|
+
* came: the opening animation runs backwards before it closes, no longer modal meanwhile, so the page behind works
|
|
13
|
+
* at once.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <Dialog open={asking} onClose={() => setAsking(false)} title="Check Your Email" closeLabel="Close">…</Dialog>
|
|
17
|
+
*/
|
|
18
|
+
export function Dialog({ open, onClose, title, closeLabel, children }) {
|
|
19
|
+
const dialog = useRef(null);
|
|
20
|
+
const titleId = useId();
|
|
21
|
+
// Leaving: closed by the parent but still on screen while its animation runs backwards.
|
|
22
|
+
const [leaving, setLeaving] = useState(false);
|
|
23
|
+
const [wasOpen, setWasOpen] = useState(open);
|
|
24
|
+
if (open !== wasOpen) {
|
|
25
|
+
setWasOpen(open);
|
|
26
|
+
setLeaving(!open);
|
|
27
|
+
}
|
|
28
|
+
const finish = () => {
|
|
29
|
+
dialog.current.close();
|
|
30
|
+
setLeaving(false);
|
|
31
|
+
};
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const element = dialog.current;
|
|
34
|
+
if (open && !element.open)
|
|
35
|
+
element.showModal();
|
|
36
|
+
if (!leaving)
|
|
37
|
+
return;
|
|
38
|
+
// Leaving, it stops being modal at once, so the page behind works straight away; it stays on screen only for
|
|
39
|
+
// its animation.
|
|
40
|
+
element.close();
|
|
41
|
+
element.show();
|
|
42
|
+
const timer = setTimeout(finish, LEAVING_MILLISECONDS);
|
|
43
|
+
return () => clearTimeout(timer);
|
|
44
|
+
}, [open, leaving]);
|
|
45
|
+
return (_jsx("dialog", { ref: dialog, className: styles.dialog, "aria-labelledby": titleId, "data-closing": leaving ? "" : undefined, onAnimationEnd: (event) => {
|
|
46
|
+
if (event.target === dialog.current && leaving)
|
|
47
|
+
finish();
|
|
48
|
+
}, onCancel: (event) => {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
onClose();
|
|
51
|
+
}, onClick: (event) => {
|
|
52
|
+
if (event.target === dialog.current)
|
|
53
|
+
onClose();
|
|
54
|
+
}, children: (open || leaving) && (_jsxs(Box, { direction: "top-to-bottom", align: "stretch", textAlign: "start", gap: 16, padding: 24, children: [_jsxs(Box, { justify: "space-between", align: "start", gap: 16, children: [_jsx("h2", { id: titleId, className: styles.title, children: title }), _jsx(Button, { square: true, variant: "transparent", color: "middleground", icon: "close", "aria-label": closeLabel, onClick: onClose })] }), children] })) }));
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/dialog/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,uDAAuD,CAAC;AAE/E,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,2GAA2G;AAC3G,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAoB;IACrF,MAAM,MAAM,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IACxB,wFAAwF;IACxF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CA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AE,CAAC;QACZ,CAAC,EACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjB,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO;gBAAE,OAAO,EAAE,CAAC;QACjD,CAAC,YAEA,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CACpB,MAAC,GAAG,IAAC,SAAS,EAAC,eAAe,EAAC,KAAK,EAAC,SAAS,EAAC,SAAS,EAAC,OAAO,EAAC,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,aACnF,MAAC,GAAG,IAAC,OAAO,EAAC,eAAe,EAAC,KAAK,EAAC,OAAO,EAAC,GAAG,EAAE,EAAE,aAChD,aAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,YACrC,KAAK,GACH,EACL,KAAC,MAAM,IACL,MAAM,QACN,OAAO,EAAC,aAAa,EACrB,KAAK,EAAC,cAAc,EACpB,IAAI,EAAC,OAAO,gBACA,UAAU,EACtB,OAAO,EAAE,OAAO,GAChB,IACE,EACL,QAAQ,IACL,CACP,GACM,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(.dialog){position:fixed;inset:0;box-sizing:border-box;inline-size:min(440px,100vw - 2*var(--scale-16));block-size:fit-content;max-block-size:calc(100dvh - 2*var(--scale-16));margin:auto;padding:0;overflow:auto;border:var(--line-thickness) var(--line-style) var(--foreground-border-color);border-radius:var(--corner-radius);background:var(--background-color);box-shadow:0 var(--scale-24) var(--scale-64) rgba(0,0,0,.25);color:var(--foreground-color);font-family:var(--font-family);scrollbar-width:thin}:where(.dialog)::backdrop{background:rgba(0,0,0,.5);-webkit-backdrop-filter:blur(var(--scale-4));backdrop-filter:blur(var(--scale-4));animation:fade var(--duration) var(--easing)}:where(.dialog)[open]{animation:rise var(--duration) var(--easing)}:where(.dialog)[data-closing]{animation:rise var(--duration) var(--easing) reverse forwards}:where(.dialog)[data-closing]::backdrop{animation:fade var(--duration) var(--easing) reverse forwards}:where(.title){margin:0;font-size:var(--scale-24);font-weight:600;line-height:1.2}@keyframes rise{from{opacity:0;transform:translateY(var(--scale-16)) scale(0.98)}}@keyframes fade{from{opacity:0}}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Always in the middle of the screen, whatever a site resets margins and positions to.
|
|
2
|
+
:where(.dialog) {
|
|
3
|
+
position: fixed;
|
|
4
|
+
inset: 0;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
inline-size: min(440px, calc(100vw - 2 * var(--scale-16)));
|
|
7
|
+
block-size: fit-content;
|
|
8
|
+
max-block-size: calc(100dvh - 2 * var(--scale-16));
|
|
9
|
+
margin: auto;
|
|
10
|
+
padding: 0;
|
|
11
|
+
overflow: auto;
|
|
12
|
+
border: var(--line-thickness) var(--line-style) var(--foreground-border-color);
|
|
13
|
+
border-radius: var(--corner-radius);
|
|
14
|
+
background: var(--background-color);
|
|
15
|
+
box-shadow: 0 var(--scale-24) var(--scale-64) rgb(0 0 0 / 25%);
|
|
16
|
+
color: var(--foreground-color);
|
|
17
|
+
font-family: var(--font-family);
|
|
18
|
+
scrollbar-width: thin;
|
|
19
|
+
|
|
20
|
+
&::backdrop {
|
|
21
|
+
background: rgb(0 0 0 / 50%);
|
|
22
|
+
-webkit-backdrop-filter: blur(var(--scale-4));
|
|
23
|
+
backdrop-filter: blur(var(--scale-4));
|
|
24
|
+
animation: fade var(--duration) var(--easing);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&[open] {
|
|
28
|
+
animation: rise var(--duration) var(--easing);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Leaving: the same movement, backwards.
|
|
32
|
+
&[data-closing] {
|
|
33
|
+
animation: rise var(--duration) var(--easing) reverse forwards;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&[data-closing]::backdrop {
|
|
37
|
+
animation: fade var(--duration) var(--easing) reverse forwards;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:where(.title) {
|
|
42
|
+
margin: 0;
|
|
43
|
+
font-size: var(--scale-24);
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
line-height: 1.2;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@keyframes rise {
|
|
49
|
+
from {
|
|
50
|
+
opacity: 0;
|
|
51
|
+
transform: translateY(var(--scale-16)) scale(0.98);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@keyframes fade {
|
|
56
|
+
from {
|
|
57
|
+
opacity: 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface DialogProperties {
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** Escape, the close button or a click on the backdrop. */
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
title: string;
|
|
7
|
+
/** The close button's name ("Close"). */
|
|
8
|
+
closeLabel: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/dialog/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,2DAA2D;IAC3D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/dialog/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NotificationContextValue, NotificationProviderProperties } from "@sharadox/graphical-user-interface-web-library/notification/type";
|
|
2
|
+
/**
|
|
3
|
+
* The notifications shown after each action, from anywhere under `NotificationProvider`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const { notify } = useNotification();
|
|
7
|
+
* notify("Saved.");
|
|
8
|
+
*/
|
|
9
|
+
export declare function useNotification(): NotificationContextValue;
|
|
10
|
+
/**
|
|
11
|
+
* Shows a notification after every action, at the top right just below the site's bar: it goes after a few
|
|
12
|
+
* seconds, or when closed. Each is an outlined glass card in its tone's color (success, information, warn, error).
|
|
13
|
+
* At most four at once, newest last.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <NotificationProvider label="Notifications" dismissLabel="Dismiss">{children}</NotificationProvider>
|
|
17
|
+
*/
|
|
18
|
+
export declare function NotificationProvider({ label, dismissLabel, duration, children, }: NotificationProviderProperties): import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/notification/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,wBAAwB,EACxB,8BAA8B,EAC/B,MAAM,kEAAkE,CAAC;AAM1E;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,wBAAwB,CAE1D;AAgDD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,YAAY,EACZ,QAAe,EACf,QAAQ,GACT,EAAE,8BAA8B,+BA2BhC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { Icon } from "@sharadox/icon-web-library/icon";
|
|
5
|
+
import { Box } from "@sharadox/graphical-user-interface-web-library/box";
|
|
6
|
+
import { Button } from "@sharadox/graphical-user-interface-web-library/button";
|
|
7
|
+
import styles from "./index.module.css";
|
|
8
|
+
const NotificationContext = createContext({ notify: () => { } });
|
|
9
|
+
const ICONS = { success: "check", information: "bell", warn: "warning", error: "warning" };
|
|
10
|
+
/**
|
|
11
|
+
* The notifications shown after each action, from anywhere under `NotificationProvider`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const { notify } = useNotification();
|
|
15
|
+
* notify("Saved.");
|
|
16
|
+
*/
|
|
17
|
+
export function useNotification() {
|
|
18
|
+
return useContext(NotificationContext);
|
|
19
|
+
}
|
|
20
|
+
/** One notification: hides itself after `duration` (not while the pointer is on it), or with its close button. */
|
|
21
|
+
function NotificationItem({ notification, duration, dismissLabel, onDismiss, }) {
|
|
22
|
+
const [paused, setPaused] = useState(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (paused)
|
|
25
|
+
return;
|
|
26
|
+
const timer = setTimeout(() => onDismiss(notification.id), notification.tone === "error" ? duration * 2 : duration);
|
|
27
|
+
return () => clearTimeout(timer);
|
|
28
|
+
}, [paused, notification, duration, onDismiss]);
|
|
29
|
+
return (_jsxs(Box, { role: notification.tone === "error" ? "alert" : "status", variant: "outlined", color: notification.tone, gap: 8, justify: "start", textAlign: "start", padding: 8, className: styles.notification, onMouseEnter: () => setPaused(true), onMouseLeave: () => setPaused(false), children: [_jsx(Icon, { name: ICONS[notification.tone] }), _jsx("p", { className: styles.message, children: notification.message }), _jsx(Button, { square: true, variant: "transparent", color: "middleground", size: "small", icon: "close", "aria-label": dismissLabel, onClick: () => onDismiss(notification.id) })] }));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Shows a notification after every action, at the top right just below the site's bar: it goes after a few
|
|
33
|
+
* seconds, or when closed. Each is an outlined glass card in its tone's color (success, information, warn, error).
|
|
34
|
+
* At most four at once, newest last.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* <NotificationProvider label="Notifications" dismissLabel="Dismiss">{children}</NotificationProvider>
|
|
38
|
+
*/
|
|
39
|
+
export function NotificationProvider({ label, dismissLabel, duration = 5000, children, }) {
|
|
40
|
+
const [notifications, setNotifications] = useState([]);
|
|
41
|
+
const next = useRef(0);
|
|
42
|
+
const dismiss = useCallback((id) => setNotifications((all) => all.filter((item) => item.id !== id)), []);
|
|
43
|
+
const value = useMemo(() => ({
|
|
44
|
+
notify: (message, tone = "success") => setNotifications((all) => [...all, { id: ++next.current, message, tone }].slice(-4)),
|
|
45
|
+
}), []);
|
|
46
|
+
return (_jsxs(NotificationContext.Provider, { value: value, children: [children, _jsx("section", { className: styles.region, "aria-label": label, children: notifications.map((item) => (_jsx(NotificationItem, { notification: item, duration: duration, dismissLabel: dismissLabel, onDismiss: dismiss }, item.id))) })] }));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/notification/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrG,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,uDAAuD,CAAC;AAM/E,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,MAAM,mBAAmB,GAAG,aAAa,CAA2B,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAC;AAC1F,MAAM,KAAK,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAW,CAAC;AAEpG;;;;;;GAMG;AACH,MAAM,U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AAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC3B,KAAC,gBAAgB,IAEf,YAAY,EAAE,IAAI,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,OAAO,IAJb,IAAI,CAAC,EAAE,CAKZ,CACH,CAAC,GACM,IACmB,CAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(.region){position:fixed;z-index:40;inset-block-start:calc(var(--bar-height, 64px) + var(--scale-8));inset-inline-end:var(--scale-16);display:flex;flex-direction:column;align-items:end;gap:var(--scale-8);inline-size:min(360px,100vw - 2*var(--scale-16));pointer-events:none}.notification{inline-size:100%;background:rgb(var(--background-color-rgb)/85%);pointer-events:auto;animation:enter var(--duration) var(--easing)}:where(.message){flex:1;margin:0;color:var(--foreground-color);font-size:var(--scale-14)}@keyframes enter{from{opacity:0;transform:translateY(calc(-1 * var(--scale-8)))}}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// At the top right, just below the site's bar (`--bar-height`, 64 by default), above the page.
|
|
2
|
+
:where(.region) {
|
|
3
|
+
position: fixed;
|
|
4
|
+
z-index: 40;
|
|
5
|
+
inset-block-start: calc(var(--bar-height, 64px) + var(--scale-8));
|
|
6
|
+
inset-inline-end: var(--scale-16);
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: end;
|
|
10
|
+
gap: var(--scale-8);
|
|
11
|
+
inline-size: min(360px, calc(100vw - 2 * var(--scale-16)));
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// A nearly opaque background behind the glass, so the message reads over anything.
|
|
16
|
+
.notification {
|
|
17
|
+
inline-size: 100%;
|
|
18
|
+
background: rgb(var(--background-color-rgb) / 85%);
|
|
19
|
+
pointer-events: auto;
|
|
20
|
+
animation: enter var(--duration) var(--easing);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:where(.message) {
|
|
24
|
+
flex: 1;
|
|
25
|
+
margin: 0;
|
|
26
|
+
color: var(--foreground-color);
|
|
27
|
+
font-size: var(--scale-14);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@keyframes enter {
|
|
31
|
+
from {
|
|
32
|
+
opacity: 0;
|
|
33
|
+
transform: translateY(calc(-1 * var(--scale-8)));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A notification after an action, in the interface's color of its tone: `success`, `information` and `warn` are
|
|
4
|
+
* polite, `error` is an alert.
|
|
5
|
+
*/
|
|
6
|
+
export interface Notification {
|
|
7
|
+
id: number;
|
|
8
|
+
message: string;
|
|
9
|
+
tone: "success" | "information" | "warn" | "error";
|
|
10
|
+
}
|
|
11
|
+
export interface NotificationContextValue {
|
|
12
|
+
/** Shows a notification for a few seconds (`error`s stay twice as long). */
|
|
13
|
+
notify(message: string, tone?: Notification["tone"]): void;
|
|
14
|
+
}
|
|
15
|
+
export interface NotificationProviderProperties {
|
|
16
|
+
/** The region's name and the close buttons' ("Notifications", "Dismiss"). */
|
|
17
|
+
label: string;
|
|
18
|
+
dismissLabel: string;
|
|
19
|
+
/** How long a notification stays, in milliseconds (5 seconds by default). */
|
|
20
|
+
duration?: number;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/notification/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;CACpD;AAED,MAAM,WAAW,wBAAwB;IACvC,4EAA4E;IAC5E,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC5D;AAED,MAAM,WAAW,8BAA8B;IAC7C,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/notification/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SkeletonProperties } from "@sharadox/graphical-user-interface-web-library/skeleton/type";
|
|
2
|
+
/**
|
|
3
|
+
* Where data is still loading: soft shapes like what will come (lines, a card, a list of rows, a profile, a grid of
|
|
4
|
+
* cards), in the foreground's transparent color, gently shimmering, so a page shows at once and fills in. Screen
|
|
5
|
+
* readers hear `label` once.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Suspense fallback={<Skeleton label="Loading devices…" shape="list" rows={3} />}><DeviceList /></Suspense>
|
|
9
|
+
*/
|
|
10
|
+
export declare function Skeleton({ label, shape, lines, rows, height }: SkeletonProperties): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/skeleton/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8DAA8D,CAAC;AAuBvG;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAe,EAAE,KAAS,EAAE,IAAQ,EAAE,MAAM,EAAE,EAAE,kBAAkB,+BA6CnG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "@sharadox/web-library/class-name";
|
|
3
|
+
import { Box } from "@sharadox/graphical-user-interface-web-library/box";
|
|
4
|
+
import styles from "./index.module.css";
|
|
5
|
+
const Line = ({ short }) => (_jsx("span", { "data-part": "line", className: classNames(styles.shape, styles.line, short && styles.short) }));
|
|
6
|
+
/** A card as the interface draws them: an outlined foreground box. */
|
|
7
|
+
const Card = ({ children, className }) => (_jsx(Box, { as: "span", "data-part": "card", variant: "outlined", color: "foreground", direction: "top-to-bottom", align: "stretch", gap: 12, padding: 24, className: classNames(styles.card, className), children: children }));
|
|
8
|
+
/**
|
|
9
|
+
* Where data is still loading: soft shapes like what will come (lines, a card, a list of rows, a profile, a grid of
|
|
10
|
+
* cards), in the foreground's transparent color, gently shimmering, so a page shows at once and fills in. Screen
|
|
11
|
+
* readers hear `label` once.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <Suspense fallback={<Skeleton label="Loading devices…" shape="list" rows={3} />}><DeviceList /></Suspense>
|
|
15
|
+
*/
|
|
16
|
+
export function Skeleton({ label, shape = "lines", lines = 3, rows = 3, height }) {
|
|
17
|
+
const text = Array.from({ length: lines }, (_, index) => (_jsx(Line, { short: index === lines - 1 && index > 0 }, index)));
|
|
18
|
+
return (_jsx("div", { className: styles.skeleton, role: "status", "aria-label": label, children: height ? (_jsx("span", { className: classNames(styles.shape, styles.block), style: { height } })) : shape === "lines" ? (text) : shape === "card" ? (_jsx(Card, { children: text })) : shape === "profile" ? (_jsxs(Card, { className: styles.profile, children: [_jsx("span", { "data-part": "circle", className: classNames(styles.shape, styles.circle) }), _jsxs("span", { className: styles.stack, children: [_jsx(Line, { short: true }), _jsx(Line, {})] })] })) : shape === "cards" ? (_jsx("span", { className: styles.grid, children: Array.from({ length: rows }, (_, index) => (_jsxs(Card, { children: [_jsx(Line, { short: true }), _jsx(Line, {})] }, index))) })) : (_jsx(Card, { children: Array.from({ length: rows }, (_, index) => (_jsxs("span", { "data-part": "row", className: styles.row, children: [_jsx("span", { className: classNames(styles.shape, styles.dot) }), _jsxs("span", { className: styles.stack, children: [_jsx(Line, {}), _jsx(Line, { short: true })] }), _jsx("span", { className: classNames(styles.shape, styles.button) })] }, index))) })) }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/skeleton/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AAEzE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAuB,EAAE,EAAE,CAAC,CAC/C,4BAAgB,MAAM,EAAC,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,GAAI,CACnG,CAAC;AACF,sEAAsE;AACtE,MAAM,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAqD,EAAE,EAAE,CAAC,CAC3F,KAAC,GAAG,IACF,EAAE,EAAC,MAAM,eACC,MAAM,EAChB,OAAO,EAAC,UAAU,EAClB,KAAK,EAAC,YAAY,EAClB,SAAS,EAAC,eAAe,EACzB,KAAK,EAAC,SAAS,EACf,GAAG,EAAE,EAAE,EACP,OAAO,EAAE,EAAE,EACX,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,YAE5C,QAAQ,GACL,CACP,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,KAAK,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CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1C,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,SAAG,EACd,KAAC,IAAI,KAAG,KAFC,KAAK,CAGT,CACR,CAAC,GACG,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,cACF,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1C,6BAA4B,KAAK,EAAC,SAAS,EAAE,MAAM,CAAC,GAAG,aACrD,eAAM,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,GAAI,EACzD,gBAAM,SAAS,EAAE,MAAM,CAAC,KAAK,aAC3B,KAAC,IAAI,KAAG,EACR,KAAC,IAAI,IAAC,KAAK,SAAG,IACT,EACP,eAAM,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,GAAI,KANnD,KAAK,CAOT,CACR,CAAC,GACG,CACR,GACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(.skeleton){display:flex;flex-direction:column;gap:var(--scale-12);inline-size:100%}:where(.shape){display:block;border-radius:var(--corner-radius);background:linear-gradient(90deg, transparent 0%, rgb(var(--foreground-color-rgb)/6%) 50%, transparent 100%) 0 0/200% 100% no-repeat,var(--foreground-transparent-color);animation:shimmer 1.6s linear infinite}:where(.line){block-size:.9em}:where(.short){inline-size:60%}:where(.block){inline-size:100%}.card{inline-size:100%}:where(.profile){flex-direction:row;align-items:center}:where(.circle){flex:none;inline-size:var(--scale-64);block-size:var(--scale-64);border-radius:10000px}:where(.stack){display:flex;flex:1;flex-direction:column;gap:var(--scale-8)}:where(.grid){display:grid;grid-template-columns:repeat(auto-fill, minmax(min(100%, 240px), 1fr));gap:var(--scale-16)}:where(.row){display:flex;align-items:center;gap:var(--scale-12)}:where(.dot){flex:none;inline-size:var(--scale-32);block-size:var(--scale-32)}:where(.button){flex:none;inline-size:var(--scale-64);block-size:var(--scale-32)}@keyframes shimmer{from{background-position:100% 0,0 0}to{background-position:-100% 0,0 0}}@media(prefers-reduced-motion: reduce){:where(.shape){animation:none}}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
:where(.skeleton) {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--scale-12);
|
|
5
|
+
inline-size: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// Every shape: the foreground's transparent color with a light passing over it.
|
|
9
|
+
:where(.shape) {
|
|
10
|
+
display: block;
|
|
11
|
+
border-radius: var(--corner-radius);
|
|
12
|
+
background:
|
|
13
|
+
linear-gradient(90deg, transparent 0%, rgb(var(--foreground-color-rgb) / 6%) 50%, transparent 100%) 0 0 / 200% 100%
|
|
14
|
+
no-repeat,
|
|
15
|
+
var(--foreground-transparent-color);
|
|
16
|
+
animation: shimmer 1.6s linear infinite;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:where(.line) {
|
|
20
|
+
block-size: 0.9em;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:where(.short) {
|
|
24
|
+
inline-size: 60%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:where(.block) {
|
|
28
|
+
inline-size: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.card {
|
|
32
|
+
inline-size: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:where(.profile) {
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
align-items: center;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:where(.circle) {
|
|
41
|
+
flex: none;
|
|
42
|
+
inline-size: var(--scale-64);
|
|
43
|
+
block-size: var(--scale-64);
|
|
44
|
+
border-radius: 10000px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:where(.stack) {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex: 1;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
gap: var(--scale-8);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:where(.grid) {
|
|
55
|
+
display: grid;
|
|
56
|
+
grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
|
|
57
|
+
gap: var(--scale-16);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:where(.row) {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: var(--scale-12);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:where(.dot) {
|
|
67
|
+
flex: none;
|
|
68
|
+
inline-size: var(--scale-32);
|
|
69
|
+
block-size: var(--scale-32);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:where(.button) {
|
|
73
|
+
flex: none;
|
|
74
|
+
inline-size: var(--scale-64);
|
|
75
|
+
block-size: var(--scale-32);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@keyframes shimmer {
|
|
79
|
+
from {
|
|
80
|
+
background-position:
|
|
81
|
+
100% 0,
|
|
82
|
+
0 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
to {
|
|
86
|
+
background-position:
|
|
87
|
+
-100% 0,
|
|
88
|
+
0 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@media (prefers-reduced-motion: reduce) {
|
|
93
|
+
:where(.shape) {
|
|
94
|
+
animation: none;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SkeletonProperties {
|
|
2
|
+
/** What is loading, read aloud once ("Loading devices…"). */
|
|
3
|
+
label: string;
|
|
4
|
+
/**
|
|
5
|
+
* What it stands for: `lines` of text (the default), a `card` of lines, a `list` of rows (an icon, two lines and a
|
|
6
|
+
* button each), a `profile` (a picture and a name), or a grid of `cards`.
|
|
7
|
+
*/
|
|
8
|
+
shape?: "lines" | "card" | "list" | "profile" | "cards";
|
|
9
|
+
/** How many lines of text (3 by default). */
|
|
10
|
+
lines?: number;
|
|
11
|
+
/** How many rows or cards (3 by default). */
|
|
12
|
+
rows?: number;
|
|
13
|
+
/** A block (a picture, a card) instead of lines, this many pixels tall. */
|
|
14
|
+
height?: number;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/skeleton/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACxD,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/skeleton/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SkeletonValueProperties } from "@sharadox/graphical-user-interface-web-library/skeleton-value/type";
|
|
2
|
+
/**
|
|
3
|
+
* A skeleton for one value, not a whole card: an inline shimmering shape as wide as the awaited text (a name, a
|
|
4
|
+
* count) or a circle (a picture), so everything around it (labels, buttons) shows at once.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <p>Devices: <Suspense fallback={<SkeletonValue width="2ch" label="Loading…" />}><DeviceCount /></Suspense></p>
|
|
8
|
+
*/
|
|
9
|
+
export declare function SkeletonValue({ label, width, circle }: SkeletonValueProperties): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/skeleton-value/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oEAAoE,CAAC;AAGlH;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAa,EAAE,MAAM,EAAE,EAAE,uBAAuB,+BAStF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "@sharadox/web-library/class-name";
|
|
3
|
+
import styles from "./index.module.css";
|
|
4
|
+
/**
|
|
5
|
+
* A skeleton for one value, not a whole card: an inline shimmering shape as wide as the awaited text (a name, a
|
|
6
|
+
* count) or a circle (a picture), so everything around it (labels, buttons) shows at once.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <p>Devices: <Suspense fallback={<SkeletonValue width="2ch" label="Loading…" />}><DeviceCount /></Suspense></p>
|
|
10
|
+
*/
|
|
11
|
+
export function SkeletonValue({ label, width = "8ch", circle }) {
|
|
12
|
+
const size = circle ? { width: `${circle}px`, height: `${circle}px` } : { width };
|
|
13
|
+
return (_jsx("span", { className: classNames(styles.value, circle !== undefined && styles.circle), style: size, ...(label ? { role: "status", "aria-label": label } : { "aria-hidden": true }) }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/skeleton-value/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,EAAE,MAAM,EAA2B;IACrF,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;IAClF,OAAO,CACL,eACE,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,EAC1E,KAAK,EAAE,IAAI,KACP,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,GAC/E,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(.value){display:inline-block;block-size:1em;vertical-align:middle;border-radius:var(--corner-radius);background:linear-gradient(90deg, transparent 0%, rgb(var(--foreground-color-rgb)/6%) 50%, transparent 100%) 0 0/200% 100% no-repeat,var(--foreground-transparent-color);animation:shimmer 1.6s linear infinite}:where(.circle){border-radius:10000px}@keyframes shimmer{from{background-position:100% 0,0 0}to{background-position:-100% 0,0 0}}@media(prefers-reduced-motion: reduce){:where(.value){animation:none}}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
:where(.value) {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
block-size: 1em;
|
|
4
|
+
vertical-align: middle;
|
|
5
|
+
border-radius: var(--corner-radius);
|
|
6
|
+
background:
|
|
7
|
+
linear-gradient(90deg, transparent 0%, rgb(var(--foreground-color-rgb) / 6%) 50%, transparent 100%) 0 0 / 200% 100%
|
|
8
|
+
no-repeat,
|
|
9
|
+
var(--foreground-transparent-color);
|
|
10
|
+
animation: shimmer 1.6s linear infinite;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:where(.circle) {
|
|
14
|
+
border-radius: 10000px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@keyframes shimmer {
|
|
18
|
+
from {
|
|
19
|
+
background-position:
|
|
20
|
+
100% 0,
|
|
21
|
+
0 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
to {
|
|
25
|
+
background-position:
|
|
26
|
+
-100% 0,
|
|
27
|
+
0 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@media (prefers-reduced-motion: reduce) {
|
|
32
|
+
:where(.value) {
|
|
33
|
+
animation: none;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SkeletonValueProperties {
|
|
2
|
+
/** What is loading, read aloud ("Loading your name…"); without it the shape is silent (a parent says it). */
|
|
3
|
+
label?: string;
|
|
4
|
+
/** How wide the awaited text is, in any CSS length ("8ch" by default). */
|
|
5
|
+
width?: string;
|
|
6
|
+
/** A round shape this many pixels wide instead (a picture). */
|
|
7
|
+
circle?: number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/skeleton-value/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,6GAA6G;IAC7G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/skeleton-value/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TipProperties } from "@sharadox/graphical-user-interface-web-library/tip/type";
|
|
2
|
+
/**
|
|
3
|
+
* A small question mark beside a label that shows a tip on hover, on keyboard focus, or on a tap (phones). Escape
|
|
4
|
+
* hides it. The button is described by the tip, so screen readers hear it too.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <label>Identifier <Tip label="What's this?" text="Like a username…" /></label>
|
|
8
|
+
*/
|
|
9
|
+
export declare function Tip({ text, label }: TipProperties): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/tip/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yDAAyD,CAAC;AAG7F;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,aAAa,+BAqCjD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { Box } from "@sharadox/graphical-user-interface-web-library/box";
|
|
5
|
+
import { Button } from "@sharadox/graphical-user-interface-web-library/button";
|
|
6
|
+
import styles from "./index.module.css";
|
|
7
|
+
/**
|
|
8
|
+
* A small question mark beside a label that shows a tip on hover, on keyboard focus, or on a tap (phones). Escape
|
|
9
|
+
* hides it. The button is described by the tip, so screen readers hear it too.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <label>Identifier <Tip label="What's this?" text="Like a username…" /></label>
|
|
13
|
+
*/
|
|
14
|
+
export function Tip({ text, label }) {
|
|
15
|
+
const [open, setOpen] = useState(false);
|
|
16
|
+
const id = useId();
|
|
17
|
+
return (_jsxs("span", { className: styles.tip, onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false), children: [_jsx(Button, { square: true, variant: "transparent", color: "middleground", size: "small", icon: "question", "aria-label": label, "aria-describedby": id, "aria-expanded": open, onClick: () => setOpen(!open), onFocus: () => setOpen(true), onBlur: () => setOpen(false), onKeyDown: (event) => {
|
|
18
|
+
if (event.key === "Escape")
|
|
19
|
+
setOpen(false);
|
|
20
|
+
} }), _jsx(Box, { as: "span", id: id, role: "tooltip", hidden: !open, variant: "filled", color: "foreground", size: "small", padding: 8, textAlign: "start", className: styles.bubble, children: text })] }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/tip/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,uDAAuD,CAAC;AAE/E,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAiB;IAChD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,OAAO,CACL,gBAAM,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,aAChG,KAAC,MAAM,IACL,MAAM,QACN,OAAO,EAAC,aAAa,EACrB,KAAK,EAAC,cAAc,EACpB,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,UAAU,gBACH,KAAK,sBACC,EAAE,mBACL,IAAI,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAC5B,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAC5B,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;oBACnB,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ;wBAAE,OAAO,CAAC,KAAK,CAAC,CAAC;gBAC7C,CAAC,GACD,EACF,KAAC,GAAG,IACF,EAAE,EAAC,MAAM,EACT,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,SAAS,EACd,MAAM,EAAE,CAAC,IAAI,EACb,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAC,YAAY,EAClB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,CAAC,EACV,SAAS,EAAC,OAAO,EACjB,SAAS,EAAE,MAAM,CAAC,MAAM,YAEvB,IAAI,GACD,IACD,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(.tip){position:relative;display:inline-flex;vertical-align:middle}.bubble{position:absolute;z-index:30;inset-block-end:calc(100% + var(--scale-8));inset-inline-start:50%;inline-size:max-content;max-inline-size:240px;transform:translateX(-50%);font-weight:400;line-height:1.4;pointer-events:none}.bubble[hidden]{display:none}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
:where(.tip) {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
vertical-align: middle;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// Above the button, centered on it, never wider than a short sentence.
|
|
8
|
+
.bubble {
|
|
9
|
+
position: absolute;
|
|
10
|
+
z-index: 30;
|
|
11
|
+
inset-block-end: calc(100% + var(--scale-8));
|
|
12
|
+
inset-inline-start: 50%;
|
|
13
|
+
inline-size: max-content;
|
|
14
|
+
max-inline-size: 240px;
|
|
15
|
+
transform: translateX(-50%);
|
|
16
|
+
font-weight: 400;
|
|
17
|
+
line-height: 1.4;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
|
|
20
|
+
// A box is a flex box, which would show it even when hidden.
|
|
21
|
+
&[hidden] {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/tip/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/tip/type.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharadox/graphical-user-interface-web-library",
|
|
3
|
-
"version": "0.2.0-
|
|
3
|
+
"version": "0.2.0-overlay.23",
|
|
4
4
|
"description": "One generic, accessible, fully configurable component library: every interface piece in every variant, color, corner, line, size and state, styled from a single source of truth that each brand configures.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "SEE LICENSE IN LICENCA.md",
|