@protobase/ui 0.14.2 → 0.14.4
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/auth-gate.js +9 -0
- package/dist/auth/provider-icon.js +15 -0
- package/dist/auth/sign-in-form.js +6 -1
- package/dist/package.js +1 -1
- package/dist/primitives/responsive-dialog.d.ts +2 -1
- package/dist/primitives/responsive-dialog.js +13 -11
- package/dist/primitives/sheet.js +39 -39
- package/dist/shell/assets/app-CyW0VzOi.js +66 -0
- package/dist/shell/assets/{index-DTbA97zz.js → index-DhgTXlZ3.js} +1 -1
- package/dist/shell/assets/index-DthLyPYI.css +2 -0
- package/dist/shell/assets/{maplibre-gl-CSTJJJQT.js → maplibre-gl-CKQN3M1I.js} +1 -1
- package/dist/shell/assets/{record-map-CeTF-ArN.js → record-map-CzJ60-ux.js} +2 -2
- package/dist/shell/assets/{records-map-Cl0Ofb1s.js → records-map-dch_o1ug.js} +1 -1
- package/dist/shell/assets/{shared-protobase-ui-4J-P80A-.js → shared-protobase-ui-C-qDEeIK.js} +1 -1
- package/dist/shell/index.html +4 -4
- package/dist/shell/protobase.shell.json +1 -1
- package/package.json +5 -4
- package/dist/shell/assets/app-B2GAOqtJ.js +0 -66
- package/dist/shell/assets/index-BXYHpFoe.css +0 -2
package/dist/auth/auth-gate.js
CHANGED
|
@@ -69,6 +69,15 @@ const AuthGate = ({ workspace, children }) => {
|
|
|
69
69
|
useEffect(() => {
|
|
70
70
|
if (state.kind === "signed-out" && page.kind === "sign-in" && page.providerError) forgetSignInLink();
|
|
71
71
|
}, [state.kind, page]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (state.kind !== "signed-out" || !browse) return;
|
|
74
|
+
const leave = () => {
|
|
75
|
+
setPage({ kind: "sign-in" });
|
|
76
|
+
browse();
|
|
77
|
+
};
|
|
78
|
+
window.addEventListener("popstate", leave);
|
|
79
|
+
return () => window.removeEventListener("popstate", leave);
|
|
80
|
+
}, [state.kind, browse]);
|
|
72
81
|
const signInFailed = useCallback((error) => setPage({
|
|
73
82
|
kind: "sign-in",
|
|
74
83
|
error
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/auth/provider-icon.tsx
|
|
4
|
+
/** The GitHub mark, from GitHub's Octicons, in the text color so it follows the theme. */
|
|
5
|
+
const GitHubMark = ({ className }) => /* @__PURE__ */ jsx("svg", {
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
fill: "currentColor",
|
|
8
|
+
className: cn("size-4 shrink-0", className),
|
|
9
|
+
"aria-hidden": true,
|
|
10
|
+
children: /* @__PURE__ */ jsx("path", { d: "M10.226 17.284c-2.965-.36-5.054-2.493-5.054-5.256 0-1.123.404-2.336 1.078-3.144-.292-.741-.247-2.314.09-2.965.898-.112 2.111.36 2.83 1.01.853-.269 1.752-.404 2.853-.404 1.1 0 1.999.135 2.807.382.696-.629 1.932-1.1 2.83-.988.315.606.36 2.179.067 2.942.72.854 1.101 2 1.101 3.167 0 2.763-2.089 4.852-5.098 5.234.763.494 1.28 1.572 1.28 2.807v2.336c0 .674.561 1.056 1.235.786 4.066-1.55 7.255-5.615 7.255-10.646C23.5 6.188 18.334 1 11.978 1 5.62 1 .5 6.188.5 12.545c0 4.986 3.167 9.12 7.435 10.669.606.225 1.19-.18 1.19-.786V20.63a2.9 2.9 0 0 1-1.078.224c-1.483 0-2.359-.808-2.987-2.313-.247-.607-.517-.966-1.034-1.033-.27-.023-.359-.135-.359-.27 0-.27.45-.471.898-.471.652 0 1.213.404 1.797 1.235.45.651.921.943 1.483.943.561 0 .92-.202 1.437-.719.382-.381.674-.718.944-.943" })
|
|
11
|
+
});
|
|
12
|
+
/** The mark of a sign-in provider, by its id; nothing for a provider without one. */
|
|
13
|
+
const ProviderIcon = ({ id, className }) => id === "github" ? /* @__PURE__ */ jsx(GitHubMark, { className }) : null;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { ProviderIcon };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Input } from "../primitives/input.js";
|
|
2
2
|
import { Button } from "../primitives/button.js";
|
|
3
3
|
import { AuthLayout } from "./auth-layout.js";
|
|
4
|
+
import { ProviderIcon } from "./provider-icon.js";
|
|
4
5
|
import { useRef, useState } from "react";
|
|
5
6
|
import { KeyRound, Mail } from "lucide-react";
|
|
6
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -41,7 +42,11 @@ const SignInForm = ({ onSubmit, busy, error, workspace, notice, methods = ["pass
|
|
|
41
42
|
onClick: () => onContinueWith?.(provider.id),
|
|
42
43
|
disabled: busy,
|
|
43
44
|
className: "min-h-10 w-full",
|
|
44
|
-
children: [
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsx(ProviderIcon, { id: provider.id }),
|
|
47
|
+
"Continue with ",
|
|
48
|
+
provider.name
|
|
49
|
+
]
|
|
45
50
|
}, provider.id)),
|
|
46
51
|
withPasskey && /* @__PURE__ */ jsxs(Button, {
|
|
47
52
|
onClick: () => onPasskey?.(),
|
package/dist/package.js
CHANGED
|
@@ -11,7 +11,8 @@ export type ResponsiveDialogProps = {
|
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* A modal centred on the screen from the `md` breakpoint up, and a sheet rising from the bottom on a phone, switching as
|
|
14
|
-
* the viewport does. Both close on Escape and on a press outside, and keep focus inside while open
|
|
14
|
+
* the viewport does. Both close on Escape and on a press outside, and keep focus inside while open; the sheet also
|
|
15
|
+
* closes when swiped down.
|
|
15
16
|
*/
|
|
16
17
|
export declare const ResponsiveDialog: ({ title, description, open, onClose, actions, children }: ResponsiveDialogProps) => import("react").JSX.Element | null;
|
|
17
18
|
//#endregion
|
|
@@ -5,21 +5,23 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
//#region src/primitives/responsive-dialog.tsx
|
|
6
6
|
/**
|
|
7
7
|
* A modal centred on the screen from the `md` breakpoint up, and a sheet rising from the bottom on a phone, switching as
|
|
8
|
-
* the viewport does. Both close on Escape and on a press outside, and keep focus inside while open
|
|
8
|
+
* the viewport does. Both close on Escape and on a press outside, and keep focus inside while open; the sheet also
|
|
9
|
+
* closes when swiped down.
|
|
9
10
|
*/
|
|
10
11
|
const ResponsiveDialog = ({ title, description, open, onClose, actions, children }) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
if (useIsDesktop()) {
|
|
13
|
+
if (!open) return null;
|
|
14
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
onClose,
|
|
18
|
+
actions,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
return /* @__PURE__ */ jsx(Sheet, {
|
|
21
23
|
title,
|
|
22
|
-
open
|
|
24
|
+
open,
|
|
23
25
|
onClose,
|
|
24
26
|
children: /* @__PURE__ */ jsxs("div", {
|
|
25
27
|
className: "pt-3 text-[13px]",
|
package/dist/primitives/sheet.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { useFocusTrap } from "../lib/use-focus-trap.js";
|
|
2
|
-
import { useRef } from "react";
|
|
3
1
|
import { X } from "lucide-react";
|
|
4
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Drawer } from "@base-ui/react/drawer";
|
|
5
4
|
//#region src/primitives/sheet.tsx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
42
|
-
}
|
|
5
|
+
const motion = "transition-[transform,opacity] duration-[400ms] ease-[cubic-bezier(0.32,0.72,0,1)] data-swiping:duration-0 data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] motion-reduce:duration-0";
|
|
6
|
+
/**
|
|
7
|
+
* A panel that rises from the bottom of the screen, for the filter panel and `ResponsiveDialog` on phones. It closes
|
|
8
|
+
* when swiped down, on its close button, on a press outside and on Escape, and keeps focus inside while open (Base UI's
|
|
9
|
+
* `Drawer`).
|
|
10
|
+
*/
|
|
11
|
+
const Sheet = ({ title, open, onClose, children }) => /* @__PURE__ */ jsx(Drawer.Root, {
|
|
12
|
+
open,
|
|
13
|
+
onOpenChange: (next) => !next && onClose(),
|
|
14
|
+
children: /* @__PURE__ */ jsxs(Drawer.Portal, { children: [/* @__PURE__ */ jsx(Drawer.Backdrop, { className: `fixed inset-0 z-[80] bg-foreground/40 opacity-[calc(1-var(--drawer-swipe-progress))] data-starting-style:opacity-0 data-ending-style:opacity-0 ${motion}` }), /* @__PURE__ */ jsx(Drawer.Viewport, {
|
|
15
|
+
className: "fixed inset-0 z-[80] flex items-end",
|
|
16
|
+
children: /* @__PURE__ */ jsxs(Drawer.Popup, {
|
|
17
|
+
className: `flex max-h-[85vh] w-full flex-col rounded-t-xl border-t bg-background shadow-pop outline-none [transform:translateY(var(--drawer-swipe-movement-y))] data-starting-style:[transform:translateY(100%)] data-ending-style:[transform:translateY(100%)] data-swiping:select-none ${motion}`,
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: "flex shrink-0 justify-center pt-2",
|
|
21
|
+
"aria-hidden": true,
|
|
22
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-1 w-10 rounded-full bg-border-strong" })
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ jsxs("header", {
|
|
25
|
+
className: "flex shrink-0 items-center justify-between border-b px-4",
|
|
26
|
+
children: [/* @__PURE__ */ jsx(Drawer.Title, {
|
|
27
|
+
className: "text-[15px] font-semibold",
|
|
28
|
+
children: title
|
|
29
|
+
}), /* @__PURE__ */ jsx(Drawer.Close, {
|
|
30
|
+
"aria-label": "Close",
|
|
31
|
+
className: "-mr-2 inline-flex size-11 items-center justify-center rounded-md text-muted-foreground hover:bg-muted",
|
|
32
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-5" })
|
|
33
|
+
})]
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ jsx(Drawer.Content, {
|
|
36
|
+
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pb-6",
|
|
37
|
+
children
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
})
|
|
41
|
+
})] })
|
|
42
|
+
});
|
|
43
43
|
//#endregion
|
|
44
44
|
export { Sheet };
|