@remit/ui 0.0.227 → 0.0.228

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.
@@ -1,5 +1,6 @@
1
1
  export interface AccountMenuProps {
2
2
  email: string | null;
3
+ securityUrl?: string;
3
4
  onSignOut: () => void;
4
5
  }
5
- export declare function AccountMenu({ email, onSignOut }: AccountMenuProps): import("react").JSX.Element;
6
+ export declare function AccountMenu({ email, securityUrl, onSignOut, }: AccountMenuProps): import("react").JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { LogOut } from "lucide-react";
2
+ import { LogOut, ShieldCheck } from "lucide-react";
3
3
  import { useEffect, useRef } from "react";
4
4
  import { Avatar } from "./avatar.js";
5
5
  import { PopoverMenuPanel, PopoverMenuPortal, PopoverMenuRow, usePopoverMenuState, } from "./popover-menu.js";
6
- export function AccountMenu({ email, onSignOut }) {
6
+ export function AccountMenu({ email, securityUrl, onSignOut, }) {
7
7
  const triggerRef = useRef(null);
8
8
  const { open, setOpen, containerRef, panelRef, getAnchor } = usePopoverMenuState("account-menu", () => triggerRef.current?.focus());
9
9
  useEffect(() => {
@@ -15,7 +15,10 @@ export function AccountMenu({ email, onSignOut }) {
15
15
  return () => cancelAnimationFrame(frame);
16
16
  }, [open, panelRef]);
17
17
  const displayName = email ?? "Account";
18
- return (_jsxs("div", { ref: containerRef, className: "relative", children: [_jsx("button", { ref: triggerRef, type: "button", "aria-label": "Account", "aria-haspopup": "menu", "aria-expanded": open, onClick: () => setOpen((value) => !value), className: "inline-flex min-h-11 min-w-11 items-center justify-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-raised hover:text-fg", children: _jsx(Avatar, { name: displayName, email: email ?? undefined, size: "sm" }) }), _jsx(PopoverMenuPortal, { open: open, align: "end", panelRef: panelRef, getAnchor: getAnchor, children: _jsxs(PopoverMenuPanel, { ref: panelRef, label: displayName, children: [email && (_jsxs(_Fragment, { children: [_jsx("div", { className: "truncate px-4 py-2 text-xs text-fg-muted", title: email, "data-testid": "account-menu-email", children: email }), _jsx("hr", { className: "my-1 h-px border-0 bg-line" })] })), _jsx(PopoverMenuRow, { label: "Sign out", icon: _jsx(LogOut, { className: "size-4" }), onSelect: () => {
18
+ return (_jsxs("div", { ref: containerRef, className: "relative", children: [_jsx("button", { ref: triggerRef, type: "button", "aria-label": "Account", "aria-haspopup": "menu", "aria-expanded": open, onClick: () => setOpen((value) => !value), className: "inline-flex min-h-11 min-w-11 items-center justify-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-raised hover:text-fg", children: _jsx(Avatar, { name: displayName, email: email ?? undefined, size: "sm" }) }), _jsx(PopoverMenuPortal, { open: open, align: "end", panelRef: panelRef, getAnchor: getAnchor, children: _jsxs(PopoverMenuPanel, { ref: panelRef, label: displayName, children: [email && (_jsxs(_Fragment, { children: [_jsx("div", { className: "truncate px-4 py-2 text-xs text-fg-muted", title: email, "data-testid": "account-menu-email", children: email }), _jsx("hr", { className: "my-1 h-px border-0 bg-line" })] })), securityUrl && (_jsx(PopoverMenuRow, { label: "Security", icon: _jsx(ShieldCheck, { className: "size-4" }), onSelect: () => {
19
+ setOpen(false);
20
+ window.location.assign(securityUrl);
21
+ } })), _jsx(PopoverMenuRow, { label: "Sign out", icon: _jsx(LogOut, { className: "size-4" }), onSelect: () => {
19
22
  setOpen(false);
20
23
  triggerRef.current?.focus();
21
24
  onSignOut();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/ui",
3
- "version": "0.0.227",
3
+ "version": "0.0.228",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {