@protobase/ui 0.45.12 → 0.45.13

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/app/main.js CHANGED
@@ -2,6 +2,7 @@ import { browserLocale } from "../locale/active-locale.js";
2
2
  import { nativeBridgeOf } from "./native-auth-fetch.js";
3
3
  import { uiFromModule } from "./pages/ui-from-module.js";
4
4
  import { App } from "./app.js";
5
+ import { showKeyboardAccessoryBar } from "./native-keyboard.js";
5
6
  import { applyNativeViewport } from "./native-viewport.js";
6
7
  import { pageApiOrigin } from "./page-api-origin.js";
7
8
  import { StrictMode } from "react";
@@ -13,7 +14,10 @@ import "../styles.css";
13
14
  const root = document.getElementById("root");
14
15
  if (!root) throw new Error("index.html needs an element with id \"root\"");
15
16
  const nativeBridge = nativeBridgeOf(window);
16
- if (nativeBridge) applyNativeViewport(document);
17
+ if (nativeBridge) {
18
+ applyNativeViewport(document);
19
+ showKeyboardAccessoryBar(nativeBridge);
20
+ }
17
21
  createRoot(root).render(/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(App, {
18
22
  baseUrl: `${pageApiOrigin() ?? ""}/api/v1`,
19
23
  ui: uiFromModule(projectUi),
@@ -3,6 +3,7 @@
3
3
  export type NativeBridge = {
4
4
  isNativePlatform(): boolean;
5
5
  getPlatform(): string;
6
+ isPluginAvailable(name: string): boolean;
6
7
  nativePromise(plugin: string, method: string, options: object): Promise<unknown>;
7
8
  };
8
9
  //#endregion
@@ -0,0 +1,12 @@
1
+ //#region src/app/native-keyboard.ts
2
+ /**
3
+ * Gives the iOS app's keyboard back the bar above it, with the arrows to the previous and next field and Done, which
4
+ * Capacitor's keyboard plugin hides when it loads and has no setting for. A binary built before it had the plugin,
5
+ * and Android, which has no such bar, are left as they are.
6
+ */
7
+ const showKeyboardAccessoryBar = async (bridge) => {
8
+ if (bridge.getPlatform() !== "ios" || !bridge.isPluginAvailable("Keyboard")) return;
9
+ await bridge.nativePromise("Keyboard", "setAccessoryBarVisible", { isVisible: true });
10
+ };
11
+ //#endregion
12
+ export { showKeyboardAccessoryBar };
@@ -7,6 +7,9 @@ export type AuthLayoutProps = {
7
7
  size?: 'sm' | 'md';
8
8
  children: ReactNode;
9
9
  };
10
- /** The frame of the sign-in and first-run pages and of public forms: logo, title and a card. */
10
+ /**
11
+ * The frame of the sign-in and first-run pages and of public forms: logo, title and a card. On a page as short as a
12
+ * phone's above its keyboard the logo and most of the margins go, so the card still shows whole above the keyboard.
13
+ */
11
14
  export declare const AuthLayout: ({ title, description, size, children }: AuthLayoutProps) => import("react").JSX.Element;
12
15
  //#endregion
@@ -2,17 +2,20 @@ import { cn } from "../lib/cn.js";
2
2
  import { LogoMark } from "../app-shell/logo.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  //#region src/auth/auth-layout.tsx
5
- /** The frame of the sign-in and first-run pages and of public forms: logo, title and a card. */
5
+ /**
6
+ * The frame of the sign-in and first-run pages and of public forms: logo, title and a card. On a page as short as a
7
+ * phone's above its keyboard the logo and most of the margins go, so the card still shows whole above the keyboard.
8
+ */
6
9
  const AuthLayout = ({ title, description, size = "sm", children }) => /* @__PURE__ */ jsx("div", {
7
- className: "flex min-h-full w-full items-center justify-center bg-surface px-4 pb-[calc(2.5rem+var(--pb-safe-bottom))] pt-[calc(2.5rem+var(--pb-safe-top))]",
10
+ className: "flex min-h-full w-full items-center justify-center bg-surface px-4 pb-[calc(2.5rem+var(--pb-safe-bottom))] pt-[calc(2.5rem+var(--pb-safe-top))] short:pb-[calc(1rem+var(--pb-safe-bottom))] short:pt-[calc(1rem+var(--pb-safe-top))]",
8
11
  children: /* @__PURE__ */ jsxs("div", {
9
12
  className: cn("w-full", size === "sm" ? "max-w-sm" : "max-w-lg"),
10
13
  children: [/* @__PURE__ */ jsxs("div", {
11
- className: "mb-6 flex flex-col items-center text-center",
14
+ className: "mb-6 flex flex-col items-center text-center short:mb-4",
12
15
  children: [
13
- /* @__PURE__ */ jsx(LogoMark, { className: "size-10" }),
16
+ /* @__PURE__ */ jsx(LogoMark, { className: "size-10 short:hidden" }),
14
17
  /* @__PURE__ */ jsx("h1", {
15
- className: "mt-4 text-xl font-semibold tracking-tight",
18
+ className: "mt-4 text-xl font-semibold tracking-tight short:mt-0",
16
19
  children: title
17
20
  }),
18
21
  description && /* @__PURE__ */ jsx("p", {
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.45.12";
2
+ var version = "0.45.13";
3
3
  var protobase = { "pluginApi": 1 };
4
4
  //#endregion
5
5
  export { protobase, version };