@salesforce/ui-bundle-template-app-react-sample-b2x 12.6.3 → 12.7.0

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.
Files changed (43) hide show
  1. package/dist/CHANGELOG.md +9 -0
  2. package/dist/force-app/main/default/uiBundles/propertyrentalapp/package.json +6 -6
  3. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/api/graphql-operations-types.ts +1 -2
  4. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/appLayout.tsx +5 -4
  5. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/layout/VerticalNav.tsx +60 -27
  6. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/maintenanceRequests/MaintenanceRequestList.tsx +18 -17
  7. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/properties/PropertyListingCard.tsx +2 -2
  8. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/properties/PropertyMap.tsx +10 -2
  9. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/properties/PropertySearchFilters.tsx +1 -1
  10. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/button.tsx +2 -2
  11. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/checkbox.tsx +1 -1
  12. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/input.tsx +1 -1
  13. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/select.tsx +1 -1
  14. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/context/TenantAccessContext.tsx +23 -6
  15. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/forms/auth-form.tsx +13 -2
  16. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/hooks/form.tsx +12 -3
  17. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/layout/centered-page-layout.tsx +8 -40
  18. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/layouts/TenantRoute.tsx +28 -4
  19. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/layouts/privateRouteLayout.tsx +1 -1
  20. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/menu/AuthMenu.tsx +43 -5
  21. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/pages/ChangePassword.tsx +1 -1
  22. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/pages/ForgotPassword.tsx +8 -4
  23. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/pages/Login.tsx +1 -1
  24. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/pages/Register.tsx +1 -1
  25. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/pages/ResetPassword.tsx +2 -1
  26. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/sessionTimeout/SessionTimeoutValidator.tsx +30 -7
  27. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/api/objectSearchService.ts +5 -10
  28. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/PaginationControls.tsx +38 -3
  29. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/hooks/useReanchorReadingCursor.ts +54 -0
  30. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/Application.tsx +30 -8
  31. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/Contact.tsx +95 -48
  32. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/Home.tsx +34 -23
  33. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/Maintenance.tsx +5 -1
  34. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/PropertyDetails.tsx +48 -16
  35. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/PropertySearch.tsx +15 -5
  36. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/styles/global.css +2 -2
  37. package/dist/force-app/main/default/uiBundles/propertyrentalapp/tsconfig.tsbuildinfo +1 -1
  38. package/dist/package-lock.json +2 -2
  39. package/dist/package.json +1 -1
  40. package/dist/scripts/network-senders.mjs +84 -0
  41. package/dist/scripts/org-setup-xml.mjs +11 -6
  42. package/dist/scripts/org-setup.mjs +13 -5
  43. package/package.json +1 -1
package/dist/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [12.7.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.6.3...v12.7.0) (2026-09-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **template-sfdx-project:** preserve target network sender addresses @W-24209513@ ([#993](https://github.com/salesforce-experience-platform-emu/webapps/issues/993)) ([fddbfdd](https://github.com/salesforce-experience-platform-emu/webapps/commit/fddbfddcb41270720372b0fd4c486f043d9ba8c5))
12
+
13
+
14
+
6
15
  ## [12.6.3](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.6.2...v12.6.3) (2026-09-14)
7
16
 
8
17
  **Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
@@ -19,8 +19,8 @@
19
19
  "graphql:schema": "node scripts/get-graphql-schema.mjs"
20
20
  },
21
21
  "dependencies": {
22
- "@salesforce/platform-sdk": "^12.6.3",
23
- "@salesforce/ui-bundle": "^12.6.3",
22
+ "@salesforce/platform-sdk": "^12.7.0",
23
+ "@salesforce/ui-bundle": "^12.7.0",
24
24
  "@tailwindcss/vite": "^4.1.17",
25
25
  "class-variance-authority": "^0.7.1",
26
26
  "clsx": "^2.1.1",
@@ -51,8 +51,8 @@
51
51
  "@graphql-eslint/eslint-plugin": "^4.1.0",
52
52
  "@graphql-tools/utils": "^11.0.0",
53
53
  "@playwright/test": "^1.49.0",
54
- "@salesforce/graphiti": "^12.6.3",
55
- "@salesforce/vite-plugin-ui-bundle": "^12.6.3",
54
+ "@salesforce/graphiti": "^12.7.0",
55
+ "@salesforce/vite-plugin-ui-bundle": "^12.7.0",
56
56
  "@testing-library/jest-dom": "^6.6.3",
57
57
  "@testing-library/react": "^16.1.0",
58
58
  "@testing-library/user-event": "^14.5.2",
@@ -60,7 +60,7 @@
60
60
  "@types/react": "^19.2.5",
61
61
  "@types/react-dom": "^19.2.3",
62
62
  "@vitejs/plugin-react": "^5.1.1",
63
- "@vitest/ui": "^4.1.0",
63
+ "@vitest/ui": "^4.1.11",
64
64
  "eslint": "^9.39.1",
65
65
  "eslint-plugin-react": "^7.37.2",
66
66
  "eslint-plugin-react-hooks": "^7.0.1",
@@ -75,7 +75,7 @@
75
75
  "typescript-eslint": "^8.46.4",
76
76
  "vite": "^7.2.4",
77
77
  "vite-plugin-graphql-codegen": "^3.6.3",
78
- "vitest": "^4.1.0"
78
+ "vitest": "^4.1.11"
79
79
  },
80
80
  "overrides": {
81
81
  "lodash": "^4.18.1",
@@ -7,8 +7,7 @@ export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> =
7
7
  [_ in K]?: never;
8
8
  };
9
9
  export type Incremental<T> =
10
- | T
11
- | { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never };
10
+ T | { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never };
12
11
  /** All built-in and custom scalars, mapped to their actual values */
13
12
  export type Scalars = {
14
13
  ID: { input: string; output: string };
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef, useState } from "react";
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
2
  import { Outlet, useLocation } from "react-router";
3
3
  import { TopBar } from "@/components/layout/TopBar";
4
4
  import { VerticalNav } from "@/components/layout/VerticalNav";
@@ -30,7 +30,8 @@ const PAGE_TITLES: { match: (path: string) => boolean; title: string }[] = [
30
30
  ];
31
31
 
32
32
  function pageTitleFor(pathname: string): string {
33
- const page = PAGE_TITLES.find((entry) => entry.match(pathname))?.title ?? "Page Not Found";
33
+ const path = pathname.replace(/\/+$/, "").toLowerCase() || "/";
34
+ const page = PAGE_TITLES.find((entry) => entry.match(path))?.title ?? "Page Not Found";
34
35
  return `${page} · ${APP_NAME}`;
35
36
  }
36
37
 
@@ -49,10 +50,10 @@ export default function AppLayout() {
49
50
  }
50
51
  }, [pathname]);
51
52
 
52
- const closeNav = () => {
53
+ const closeNav = useCallback(() => {
53
54
  setIsNavOpen(false);
54
55
  menuButtonRef.current?.focus();
55
- };
56
+ }, []);
56
57
 
57
58
  return (
58
59
  <TenantAccessProvider>
@@ -1,8 +1,9 @@
1
+ import { Dialog } from "radix-ui";
1
2
  import { Link, useLocation } from "react-router";
2
- import { Home, Search, BarChart3, Wrench, Phone, type LucideIcon } from "lucide-react";
3
+ import { Home, Search, BarChart3, Wrench, Phone, X, type LucideIcon } from "lucide-react";
3
4
  import { useAuth } from "@/features/authentication/context/AuthContext";
4
5
  import { useTenantAccess } from "@/context/TenantAccessContext";
5
- import { useEffect, useMemo } from "react";
6
+ import { useMemo, useRef } from "react";
6
7
 
7
8
  interface VerticalNavItem {
8
9
  path: string;
@@ -28,15 +29,10 @@ export function VerticalNav({ isOpen = false, onClose }: VerticalNavProps) {
28
29
  const location = useLocation();
29
30
  const { isAuthenticated } = useAuth();
30
31
  const { hasTenantRecord } = useTenantAccess();
32
+ const mobileNavRef = useRef<HTMLElement>(null);
31
33
 
32
- useEffect(() => {
33
- if (!isOpen) return;
34
- const onKey = (e: KeyboardEvent) => {
35
- if (e.key === "Escape") onClose?.();
36
- };
37
- document.addEventListener("keydown", onKey);
38
- return () => document.removeEventListener("keydown", onKey);
39
- }, [isOpen, onClose]);
34
+ const triggerRef = useRef<HTMLElement | null>(null);
35
+ const navigatingRef = useRef(false);
40
36
 
41
37
  const visibleItems = useMemo(
42
38
  () =>
@@ -64,7 +60,19 @@ export function VerticalNav({ isOpen = false, onClose }: VerticalNavProps) {
64
60
  <Link
65
61
  key={item.path}
66
62
  to={item.path}
67
- onClick={handleClick}
63
+ onClick={
64
+ handleClick
65
+ ? (event) => {
66
+ navigatingRef.current =
67
+ item.path !== location.pathname &&
68
+ !event.metaKey &&
69
+ !event.ctrlKey &&
70
+ !event.shiftKey &&
71
+ !event.altKey;
72
+ handleClick();
73
+ }
74
+ : undefined
75
+ }
68
76
  className={`flex flex-col items-center justify-center gap-2 px-2 py-4 transition-colors ${
69
77
  active
70
78
  ? "border-l-4 border-teal-700 bg-teal-100 text-teal-700"
@@ -90,23 +98,48 @@ export function VerticalNav({ isOpen = false, onClose }: VerticalNavProps) {
90
98
  {navContent()}
91
99
  </nav>
92
100
 
93
- {/* Mobile overlay */}
94
- {isOpen && (
95
- <>
96
- <div className="fixed inset-0 z-40 bg-black/50" onClick={onClose} aria-hidden />
97
- {/*
98
- * Distinct label from the desktop sidebar: both navs are in the DOM at the
99
- * same time, and two navigation landmarks sharing one name is ambiguous.
100
- */}
101
- <nav
102
- id="mobile-nav"
103
- className="fixed left-0 top-0 bottom-0 z-50 flex w-24 flex-col border-r border-gray-200 bg-white py-8"
104
- aria-label="Mobile navigation"
101
+ <Dialog.Root
102
+ open={isOpen}
103
+ onOpenChange={(open) => {
104
+ if (!open) onClose?.();
105
+ }}
106
+ >
107
+ <Dialog.Portal>
108
+ <Dialog.Overlay className="fixed inset-0 z-40 bg-black/50" />
109
+ <Dialog.Content
110
+ aria-describedby={undefined}
111
+ className="fixed inset-y-0 left-0 z-50 w-24 overflow-y-auto border-r border-gray-200 bg-white py-4"
112
+ onOpenAutoFocus={(event) => {
113
+ event.preventDefault();
114
+ triggerRef.current =
115
+ document.activeElement instanceof HTMLElement ? document.activeElement : null;
116
+ navigatingRef.current = false;
117
+ mobileNavRef.current?.focus();
118
+ }}
119
+ onCloseAutoFocus={(event) => {
120
+ event.preventDefault();
121
+ if (!navigatingRef.current) triggerRef.current?.focus();
122
+ }}
105
123
  >
106
- {navContent(onClose)}
107
- </nav>
108
- </>
109
- )}
124
+ <Dialog.Title className="sr-only">Navigation menu</Dialog.Title>
125
+ <Dialog.Close
126
+ className="mx-auto mb-2 flex size-11 items-center justify-center rounded-md text-gray-600 focus-visible:outline-2 focus-visible:outline-offset-2"
127
+ aria-label="Close navigation"
128
+ >
129
+ <X className="size-5" aria-hidden />
130
+ </Dialog.Close>
131
+ <nav
132
+ id="mobile-nav"
133
+ ref={mobileNavRef}
134
+ tabIndex={-1}
135
+ aria-label="Mobile navigation"
136
+ className="flex flex-col gap-0 outline-none"
137
+ >
138
+ {navContent(onClose)}
139
+ </nav>
140
+ </Dialog.Content>
141
+ </Dialog.Portal>
142
+ </Dialog.Root>
110
143
  </>
111
144
  );
112
145
  }
@@ -29,31 +29,32 @@ export default function MaintenanceRequestList({
29
29
  onClose={() => setSelectedRequest(null)}
30
30
  />
31
31
  )}
32
- {loading && (
33
- <div role="status" aria-live="polite" aria-atomic="true">
34
- <SkeletonListRows count={skeletonCount} />
35
- <span className="sr-only">Loading maintenance requests…</span>
36
- </div>
37
- )}
38
32
  {error && (
39
33
  <p className="py-4 text-sm text-destructive" role="alert">
40
34
  {error}
41
35
  </p>
42
36
  )}
43
- {!loading && !error && requests.length === 0 && (
37
+ {/* Keep loaded rows mounted to preserve the reading cursor during reloads. */}
38
+ {requests.length > 0 ? (
39
+ <div className="space-y-4" role="group" aria-busy={loading || undefined}>
40
+ {requests.map((request) => (
41
+ <MaintenanceRequestListItem
42
+ key={request.Id}
43
+ request={request}
44
+ onClick={setSelectedRequest}
45
+ />
46
+ ))}
47
+ </div>
48
+ ) : !error && loading ? (
49
+ <div role="status" aria-live="polite" aria-atomic="true">
50
+ <SkeletonListRows count={skeletonCount} />
51
+ <span className="sr-only">Loading maintenance requests…</span>
52
+ </div>
53
+ ) : !error ? (
44
54
  <div role="status" className="py-8 text-center text-gray-500">
45
55
  {emptyMessage}
46
56
  </div>
47
- )}
48
- {!loading &&
49
- !error &&
50
- requests.map((request) => (
51
- <MaintenanceRequestListItem
52
- key={request.Id}
53
- request={request}
54
- onClick={setSelectedRequest}
55
- />
56
- ))}
57
+ ) : null}
57
58
  </>
58
59
  );
59
60
  }
@@ -151,7 +151,7 @@ export default function PropertyListingCard({
151
151
  {amenityLabels.map((label) => (
152
152
  <span
153
153
  key={label}
154
- className="rounded-full border border-border bg-muted/60 px-2.5 py-0.5 text-xs font-medium text-muted-foreground"
154
+ className="rounded-full border border-border bg-muted/60 px-2.5 py-0.5 text-xs font-medium text-neutral-600 dark:text-neutral-300"
155
155
  >
156
156
  {label}
157
157
  </span>
@@ -163,7 +163,7 @@ export default function PropertyListingCard({
163
163
  {/* Apply button */}
164
164
  <Button
165
165
  size="sm"
166
- className="mt-4 w-full cursor-pointer rounded-xl bg-primary px-5 py-5 text-lg font-medium transition-colors duration-200 hover:bg-primary/90"
166
+ className="mt-4 w-full cursor-pointer rounded-xl bg-primary px-5 py-5 text-lg font-medium transition-colors duration-200 hover:bg-primary/95"
167
167
  onClick={(e: MouseEvent<HTMLButtonElement>) => {
168
168
  e.stopPropagation();
169
169
  navigate(`/application?propertyId=${encodeURIComponent(node.Id)}`);
@@ -107,12 +107,20 @@ function MapBoundsReporter({
107
107
 
108
108
  /** Wraps popup content with an in-card close button and shadow; removes need for Leaflet's default chrome */
109
109
  function PopupContentWrapper({ children }: { children: ReactNode }) {
110
- const map = useMap() as { closePopup?: () => void };
110
+ const map = useMap() as { closePopup?: () => void; getContainer?: () => HTMLElement };
111
+ const handleClose = () => {
112
+ const container = map.getContainer?.();
113
+ map.closePopup?.();
114
+ if (container) {
115
+ if (!container.hasAttribute("tabindex")) container.setAttribute("tabindex", "-1");
116
+ container.focus();
117
+ }
118
+ };
111
119
  return (
112
120
  <div className="relative min-w-0">
113
121
  <button
114
122
  type="button"
115
- onClick={() => map.closePopup?.()}
123
+ onClick={handleClose}
116
124
  className="absolute right-2 top-2 z-10 flex h-7 w-7 items-center justify-center rounded-full bg-black/60 text-white transition-colors hover:bg-black/80"
117
125
  aria-label="Close"
118
126
  >
@@ -11,7 +11,7 @@ const FILTER_PILL_CLASS =
11
11
  "inline-flex h-10 items-center gap-1.5 rounded-full border-2 border-primary bg-background px-4 text-sm font-medium text-foreground outline-none transition-colors hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2";
12
12
 
13
13
  const SAVE_BUTTON_CLASS =
14
- "mt-3 w-full rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2";
14
+ "mt-3 w-full rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2";
15
15
 
16
16
  const DEFAULT_PRICE_MIN = 0;
17
17
  const DEFAULT_PRICE_MAX = 100_000;
@@ -5,7 +5,7 @@ import { Slot } from 'radix-ui';
5
5
  import { cn } from '../../lib/utils';
6
6
 
7
7
  const buttonVariants = cva(
8
- "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",
8
+ "focus-visible:border-ring focus-visible:ring-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",
9
9
  {
10
10
  variants: {
11
11
  variant: {
@@ -17,7 +17,7 @@ const buttonVariants = cva(
17
17
  ghost:
18
18
  'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground',
19
19
  destructive:
20
- 'bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-red-700 dark:text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30',
20
+ 'bg-destructive/10 hover:bg-destructive/20 dark:bg-destructive/20 text-red-700 dark:text-destructive dark:hover:bg-destructive/30',
21
21
  link: 'text-primary underline-offset-4 hover:underline',
22
22
  },
23
23
  size: {
@@ -14,7 +14,7 @@ function Checkbox({
14
14
  <CheckboxPrimitive.Root
15
15
  data-slot="checkbox"
16
16
  className={cn(
17
- 'border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex size-4 items-center justify-center rounded-[4px] border transition-colors group-has-disabled/field:opacity-50 focus-visible:ring-3 aria-invalid:ring-3 peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50',
17
+ 'border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex size-4 items-center justify-center rounded-[4px] border transition-colors group-has-disabled/field:opacity-50 focus-visible:ring-3 aria-invalid:ring-3 peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50',
18
18
  className
19
19
  )}
20
20
  {...props}
@@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
8
8
  type={type}
9
9
  data-slot="input"
10
10
  className={cn(
11
- 'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground/70 placeholder:italic w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
11
+ 'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground placeholder:italic w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
12
12
  className
13
13
  )}
14
14
  {...props}
@@ -42,7 +42,7 @@ function SelectTrigger({
42
42
  data-slot="select-trigger"
43
43
  data-size={size}
44
44
  className={cn(
45
- "border-input data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-3 aria-invalid:ring-3 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
45
+ "border-input data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-3 aria-invalid:ring-3 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
46
46
  className
47
47
  )}
48
48
  {...props}
@@ -1,4 +1,4 @@
1
- import { createContext, useContext, useEffect, useState, type ReactNode } from "react";
1
+ import { createContext, useCallback, useContext, useEffect, useState, type ReactNode } from "react";
2
2
  import { useAuth } from "@/features/authentication/context/AuthContext";
3
3
  import { getTenantProperties, type TenantProperty } from "@/api/tenants/tenantApi";
4
4
 
@@ -6,26 +6,38 @@ interface TenantAccessContextType {
6
6
  hasTenantRecord: boolean;
7
7
  tenantProperties: TenantProperty[];
8
8
  loading: boolean;
9
+ error: string | null;
10
+ retry: () => void;
9
11
  }
10
12
 
11
13
  const TenantAccessContext = createContext<TenantAccessContextType>({
12
14
  hasTenantRecord: false,
13
15
  tenantProperties: [],
14
16
  loading: true,
17
+ error: null,
18
+ retry: () => {},
15
19
  });
16
20
 
17
21
  export function TenantAccessProvider({ children }: { children: ReactNode }) {
18
22
  const { user } = useAuth();
19
23
  const [tenantProperties, setTenantProperties] = useState<TenantProperty[]>([]);
20
- const [loading, setLoading] = useState(true);
24
+ const [loading, setLoading] = useState(Boolean(user?.id?.trim()));
25
+ const [error, setError] = useState<string | null>(null);
26
+ const [attempt, setAttempt] = useState(0);
27
+ const retry = useCallback(() => {
28
+ setLoading(true);
29
+ setError(null);
30
+ setAttempt((value) => value + 1);
31
+ }, []);
21
32
 
22
33
  // Reset state synchronously during render when user changes
23
34
  const [prevUserId, setPrevUserId] = useState(user?.id);
24
35
  if (prevUserId !== user?.id) {
25
36
  setPrevUserId(user?.id);
37
+ if (error) setError(null);
38
+ if (tenantProperties.length > 0) setTenantProperties([]);
26
39
  const id = user?.id?.trim() ?? "";
27
40
  if (!id) {
28
- if (tenantProperties.length > 0) setTenantProperties([]);
29
41
  if (loading) setLoading(false);
30
42
  } else {
31
43
  if (!loading) setLoading(true);
@@ -42,7 +54,10 @@ export function TenantAccessProvider({ children }: { children: ReactNode }) {
42
54
  if (!cancelled) setTenantProperties(props);
43
55
  })
44
56
  .catch(() => {
45
- if (!cancelled) setTenantProperties([]);
57
+ if (!cancelled) {
58
+ setTenantProperties([]);
59
+ setError("Unable to check tenant access. Please try again.");
60
+ }
46
61
  })
47
62
  .finally(() => {
48
63
  if (!cancelled) setLoading(false);
@@ -51,12 +66,14 @@ export function TenantAccessProvider({ children }: { children: ReactNode }) {
51
66
  return () => {
52
67
  cancelled = true;
53
68
  };
54
- }, [user?.id]);
69
+ }, [user?.id, attempt]);
55
70
 
56
71
  const hasTenantRecord = tenantProperties.length > 0;
57
72
 
58
73
  return (
59
- <TenantAccessContext.Provider value={{ hasTenantRecord, tenantProperties, loading }}>
74
+ <TenantAccessContext.Provider
75
+ value={{ hasTenantRecord, tenantProperties, loading, error, retry }}
76
+ >
60
77
  {children}
61
78
  </TenantAccessContext.Provider>
62
79
  );
@@ -72,10 +72,21 @@ export function AuthForm({
72
72
 
73
73
  <form
74
74
  id={id}
75
- onSubmit={(e) => {
75
+ onSubmit={async (e) => {
76
76
  e.preventDefault();
77
77
  e.stopPropagation();
78
- form.handleSubmit();
78
+ const formElement = e.currentTarget;
79
+ const previousFocus = document.activeElement;
80
+ await form.handleSubmit();
81
+ if (!form.state.isValid) {
82
+ requestAnimationFrame(() => {
83
+ if (formElement.isConnected && document.activeElement === previousFocus) {
84
+ formElement
85
+ .querySelector<HTMLElement>('[aria-invalid="true"]:not(:disabled)')
86
+ ?.focus();
87
+ }
88
+ });
89
+ }
79
90
  }}
80
91
  {...props}
81
92
  >
@@ -1,5 +1,5 @@
1
1
  import { useId } from "react";
2
- import { createFormHookContexts, createFormHook } from "@tanstack/react-form";
2
+ import { createFormHookContexts, createFormHook, useStore } from "@tanstack/react-form";
3
3
  import {
4
4
  Field,
5
5
  FieldDescription,
@@ -40,7 +40,10 @@ function TextField({
40
40
  const id = providedId ?? generatedId;
41
41
  const descriptionId = `${id}-description`;
42
42
  const errorId = `${id}-error`;
43
- const isInvalid = field.state.meta.isBlurred && field.state.meta.errors.length > 0;
43
+ // Submitted fields can be invalid before their first blur.
44
+ const submissionAttempts = useStore(field.form.store, (state) => state.submissionAttempts);
45
+ const isInvalid =
46
+ (field.state.meta.isBlurred || submissionAttempts > 0) && field.state.meta.errors.length > 0;
44
47
 
45
48
  // Deduplicate errors by message
46
49
  const errors = field.state.meta.errors;
@@ -64,7 +67,13 @@ function TextField({
64
67
  aria-describedby={cn(description && descriptionId, isInvalid && errorId)}
65
68
  {...props}
66
69
  />
67
- {isInvalid && uniqueErrors.length > 0 && <FieldError id={errorId} errors={uniqueErrors} />}
70
+ {isInvalid && uniqueErrors.length > 0 && (
71
+ <FieldError
72
+ id={errorId}
73
+ errors={uniqueErrors}
74
+ role={submissionAttempts > 0 ? undefined : "alert"}
75
+ />
76
+ )}
68
77
  </Field>
69
78
  );
70
79
  }
@@ -1,10 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
1
7
  import { cva, type VariantProps } from "class-variance-authority";
2
8
  import { cn } from "../../../lib/utils";
3
9
 
4
- /**
5
- * Variant styles for the content container's maximum width.
6
- * Controls the maximum width of the inner content area within the page layout.
7
- */
8
10
  const contentContainerVariants = cva("w-full", {
9
11
  variants: {
10
12
  contentMaxWidth: {
@@ -18,48 +20,14 @@ const contentContainerVariants = cva("w-full", {
18
20
  },
19
21
  });
20
22
 
21
- /**
22
- * Props for the CenteredPageLayout component.
23
- */
24
23
  interface CenteredPageLayoutProps
25
24
  extends React.ComponentProps<"div">, VariantProps<typeof contentContainerVariants> {
26
- /** The content to be displayed within the page layout */
27
25
  children: React.ReactNode;
28
- /**
29
- * Maximum width of the content container.
30
- * @default "sm"
31
- */
32
26
  contentMaxWidth?: "sm" | "md" | "lg";
33
- /**
34
- * Optional page title. If provided, will render a <title> component that React will place in the document head.
35
- */
36
27
  title?: string;
37
- /**
38
- * When true, content is aligned to the top instead of being vertically centered.
39
- * @default true
40
- */
41
28
  topAligned?: boolean;
42
29
  }
43
30
 
44
- /**
45
- * CenteredPageLayout component that provides consistent page structure and spacing.
46
- *
47
- * This component creates a full-viewport-height container that centers its content
48
- * horizontally. By default, content is top-aligned; set `topAligned={false}` to
49
- * vertically center instead. The inner content area has a configurable maximum width
50
- * to prevent content from becoming too wide on large screens.
51
- *
52
- * @example
53
- * ```tsx
54
- * <CenteredPageLayout contentMaxWidth="md">
55
- * <YourPageContent />
56
- * </CenteredPageLayout>
57
- *
58
- * <CenteredPageLayout contentMaxWidth="md" topAligned={false}>
59
- * <VerticallyCenteredContent />
60
- * </CenteredPageLayout>
61
- * ```
62
- */
63
31
  export function CenteredPageLayout({
64
32
  contentMaxWidth,
65
33
  className,
@@ -71,7 +39,7 @@ export function CenteredPageLayout({
71
39
  return (
72
40
  <>
73
41
  {title && <title>{title}</title>}
74
- <main
42
+ <div
75
43
  className={cn(
76
44
  "flex min-h-svh w-full justify-center p-6 md:p-10",
77
45
  topAligned ? "items-start" : "items-center",
@@ -81,7 +49,7 @@ export function CenteredPageLayout({
81
49
  {...props}
82
50
  >
83
51
  <div className={contentContainerVariants({ contentMaxWidth })}>{children}</div>
84
- </main>
52
+ </div>
85
53
  </>
86
54
  );
87
55
  }
@@ -1,19 +1,43 @@
1
1
  import { Navigate, Outlet, useLocation } from "react-router";
2
2
  import { useAuth } from "@/features/authentication/context/AuthContext";
3
- import { ROUTES } from "@/features/authentication/authenticationConfig";
3
+ import {
4
+ AUTH_REDIRECT_PARAM,
5
+ ROUTES,
6
+ } from "@/features/authentication/authenticationConfig";
4
7
  import { useTenantAccess } from "@/context/TenantAccessContext";
5
8
 
6
9
  export default function TenantRoute() {
7
10
  const location = useLocation();
8
11
  const { isAuthenticated, loading } = useAuth();
9
- const { hasTenantRecord, loading: tenantLoading } = useTenantAccess();
12
+ const { hasTenantRecord, loading: tenantLoading, error, retry } = useTenantAccess();
10
13
 
11
- if (loading || tenantLoading) return null;
14
+ if (loading) return <p role="status">Checking sign-in…</p>;
12
15
 
13
16
  if (!isAuthenticated) {
14
- return <Navigate to={ROUTES.LOGIN.PATH} state={{ from: location.pathname }} replace />;
17
+ const search = new URLSearchParams({
18
+ [AUTH_REDIRECT_PARAM]: location.pathname + location.search,
19
+ });
20
+ return <Navigate to={{ pathname: ROUTES.LOGIN.PATH, search: search.toString() }} replace />;
15
21
  }
16
22
 
23
+ if (tenantLoading) return <p role="status">Checking tenant access…</p>;
24
+ if (error)
25
+ return (
26
+ <div className="space-y-4">
27
+ <h1 className="text-xl font-semibold">Tenant access unavailable</h1>
28
+ <p role="alert" className="text-destructive">
29
+ {error}
30
+ </p>
31
+ <button
32
+ type="button"
33
+ onClick={retry}
34
+ className="rounded-md border px-4 py-2 focus-visible:outline-2 focus-visible:outline-offset-2"
35
+ >
36
+ Try again
37
+ </button>
38
+ </div>
39
+ );
40
+
17
41
  if (!hasTenantRecord) {
18
42
  return <Navigate to="/" replace />;
19
43
  }
@@ -12,7 +12,7 @@ export default function PrivateRoute() {
12
12
  const { isAuthenticated, loading } = useAuth();
13
13
  const location = useLocation();
14
14
 
15
- if (loading) return null;
15
+ if (loading) return <p role="status">Checking sign-in…</p>;
16
16
 
17
17
  if (!isAuthenticated) {
18
18
  const searchParams = new URLSearchParams();