@remit/ui 0.0.231 → 0.0.232

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,6 +1,13 @@
1
+ import { type ReactNode } from "react";
2
+ export interface AccountMenuSection {
3
+ id: string;
4
+ label: string;
5
+ icon: ReactNode;
6
+ }
1
7
  export interface AccountMenuProps {
2
8
  email: string | null;
3
- onOpenSecurity?: () => void;
9
+ sections?: AccountMenuSection[];
10
+ onOpenSection?: (id: string) => void;
4
11
  onSignOut: () => void;
5
12
  }
6
- export declare function AccountMenu({ email, onOpenSecurity, onSignOut, }: AccountMenuProps): import("react").JSX.Element;
13
+ export declare function AccountMenu({ email, sections, onOpenSection, 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, ShieldCheck } from "lucide-react";
2
+ import { LogOut } 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, onOpenSecurity, onSignOut, }) {
6
+ export function AccountMenu({ email, sections = [], onOpenSection, 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,10 +15,10 @@ export function AccountMenu({ email, onOpenSecurity, 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" })] })), onOpenSecurity && (_jsx(PopoverMenuRow, { label: "Security", icon: _jsx(ShieldCheck, { 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" })] })), sections.map((section) => (_jsx(PopoverMenuRow, { label: section.label, icon: section.icon, onSelect: () => {
19
19
  setOpen(false);
20
- onOpenSecurity();
21
- } })), _jsx(PopoverMenuRow, { label: "Sign out", icon: _jsx(LogOut, { className: "size-4" }), onSelect: () => {
20
+ onOpenSection?.(section.id);
21
+ } }, section.id))), _jsx(PopoverMenuRow, { label: "Sign out", icon: _jsx(LogOut, { className: "size-4" }), onSelect: () => {
22
22
  setOpen(false);
23
23
  triggerRef.current?.focus();
24
24
  onSignOut();
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { mergeProps } from "react-aria";
2
2
  export { type BriefCategoryFilter, CATEGORY_PRESENTATION, CATEGORY_SECTION_ORDER, type CategoryPresentation, categoryChips, categoryLabels, categoryTone, getCategoryLabel, isBriefCategory, isThreadCategory, type ThreadCategory, } from "./category-presentation.js";
3
- export { AccountMenu, type AccountMenuProps, } from "./components/account-menu.js";
3
+ export { AccountMenu, type AccountMenuProps, type AccountMenuSection, } from "./components/account-menu.js";
4
4
  export { type AccountServiceChange, type AccountServiceChangeCopy, AccountServiceChangeDialog, type AccountServiceChangeDialogProps, accountServiceChangeCopy, } from "./components/account-service-change-dialog.js";
5
5
  export { ACCOUNT_SERVICE_EMPTY_MESSAGE, ACCOUNT_SERVICE_ROWS, type AccountService, AccountServiceChoice, type AccountServiceChoiceProps, type AccountServiceRow, } from "./components/account-service-choice.js";
6
6
  export { ACCOUNT_NO_SERVICE_TOGGLES_MESSAGE, ACCOUNT_SERVICE_OFF_LABEL, ACCOUNT_SERVICE_OFF_MESSAGE, AccountServiceOffBadge, type AccountServiceOffBadgeProps, AccountServiceOffNotice, type AccountServiceOffNoticeProps, } from "./components/account-service-status.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/ui",
3
- "version": "0.0.231",
3
+ "version": "0.0.232",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",