@domicile-desktop/component-library 0.0.0-alpha-258d9aabe264 → 0.0.0-alpha-a2ee8eaa5f91
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/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@base-ui/react": "^1.8.0",
|
|
4
4
|
"@cprussin/option-result": "^2.0.1",
|
|
5
|
-
"@domicile-desktop/sdk": "0.0.0-alpha-
|
|
6
|
-
"@domicile-desktop/system-apps": "0.0.0-alpha-
|
|
5
|
+
"@domicile-desktop/sdk": "0.0.0-alpha-a2ee8eaa5f91",
|
|
6
|
+
"@domicile-desktop/system-apps": "0.0.0-alpha-a2ee8eaa5f91",
|
|
7
7
|
"@pandacss/dev": "^1.12.1",
|
|
8
8
|
"@phosphor-icons/react": "^2.1.10"
|
|
9
9
|
},
|
|
@@ -159,5 +159,5 @@
|
|
|
159
159
|
"test:unit": "bun test"
|
|
160
160
|
},
|
|
161
161
|
"type": "module",
|
|
162
|
-
"version": "0.0.0-alpha-
|
|
162
|
+
"version": "0.0.0-alpha-a2ee8eaa5f91"
|
|
163
163
|
}
|
|
@@ -13,44 +13,56 @@ type Props = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
/** A yes/no question from an application. Dismissing it denies. */
|
|
16
|
-
export const AccessDialog = ({ answer, asker, body, screen }: Props) =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
16
|
+
export const AccessDialog = ({ answer, asker, body, screen }: Props) => {
|
|
17
|
+
// One line under the title. The subtitle mostly restates the title, so the
|
|
18
|
+
// body wins when there is one.
|
|
19
|
+
const detail = [body.body, body.subtitle].find((text) => text !== "");
|
|
20
|
+
return (
|
|
21
|
+
<ModalDialog
|
|
22
|
+
closeButton={false}
|
|
23
|
+
footer={
|
|
24
|
+
<>
|
|
25
|
+
{asker !== undefined && (
|
|
26
|
+
<p className={askerStyles}>{`${asker} asks`}</p>
|
|
27
|
+
)}
|
|
28
|
+
<Button
|
|
29
|
+
onClick={() => {
|
|
30
|
+
answer(Answer.Canceled());
|
|
31
|
+
}}
|
|
32
|
+
variant="outline"
|
|
33
|
+
>
|
|
34
|
+
{body.denyLabel ?? "Deny"}
|
|
35
|
+
</Button>
|
|
36
|
+
<Button
|
|
37
|
+
onClick={() => {
|
|
38
|
+
answer(Answer.Access());
|
|
39
|
+
}}
|
|
40
|
+
variant={body.destructive ? "danger" : "accent"}
|
|
41
|
+
>
|
|
42
|
+
{body.grantLabel ?? "Allow"}
|
|
43
|
+
</Button>
|
|
44
|
+
</>
|
|
42
45
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
onOpenChange={(open) => {
|
|
47
|
+
if (!open) {
|
|
48
|
+
answer(Answer.Canceled());
|
|
49
|
+
}
|
|
50
|
+
}}
|
|
51
|
+
open
|
|
52
|
+
screen={screen}
|
|
53
|
+
title={body.title}
|
|
54
|
+
>
|
|
55
|
+
{detail !== undefined && <p className={detailStyles}>{detail}</p>}
|
|
56
|
+
</ModalDialog>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
53
59
|
|
|
54
|
-
|
|
60
|
+
// Who asks sits opposite the buttons, leaving the body one line.
|
|
61
|
+
const askerStyles = css({
|
|
62
|
+
color: "muted",
|
|
63
|
+
fontSize: "0.8125rem",
|
|
64
|
+
margin: 0,
|
|
65
|
+
marginInlineEnd: "auto",
|
|
66
|
+
});
|
|
55
67
|
|
|
56
|
-
const
|
|
68
|
+
const detailStyles = css({ color: "muted", margin: 0 });
|