@salesforce/ui-bundle-template-app-react-sample-b2x 12.6.3 → 12.7.0-canary.1016.23.1.g31dc6b7a

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 (44) hide show
  1. package/dist/CHANGELOG.md +9 -0
  2. package/dist/LICENSE.txt +82 -0
  3. package/dist/force-app/main/default/uiBundles/propertyrentalapp/package.json +6 -6
  4. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/api/graphql-operations-types.ts +1 -2
  5. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/appLayout.tsx +5 -4
  6. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/layout/VerticalNav.tsx +60 -27
  7. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/maintenanceRequests/MaintenanceRequestList.tsx +18 -17
  8. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/properties/PropertyListingCard.tsx +2 -2
  9. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/properties/PropertyMap.tsx +10 -2
  10. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/properties/PropertySearchFilters.tsx +1 -1
  11. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/button.tsx +2 -2
  12. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/checkbox.tsx +1 -1
  13. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/input.tsx +1 -1
  14. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/select.tsx +1 -1
  15. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/context/TenantAccessContext.tsx +23 -6
  16. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/forms/auth-form.tsx +13 -2
  17. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/hooks/form.tsx +12 -3
  18. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/layout/centered-page-layout.tsx +8 -40
  19. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/layouts/TenantRoute.tsx +28 -4
  20. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/layouts/privateRouteLayout.tsx +1 -1
  21. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/menu/AuthMenu.tsx +43 -5
  22. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/pages/ChangePassword.tsx +1 -1
  23. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/pages/ForgotPassword.tsx +8 -4
  24. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/pages/Login.tsx +1 -1
  25. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/pages/Register.tsx +1 -1
  26. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/pages/ResetPassword.tsx +2 -1
  27. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/sessionTimeout/SessionTimeoutValidator.tsx +30 -7
  28. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/api/objectSearchService.ts +5 -10
  29. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/PaginationControls.tsx +38 -3
  30. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/hooks/useReanchorReadingCursor.ts +54 -0
  31. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/Application.tsx +30 -8
  32. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/Contact.tsx +95 -48
  33. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/Home.tsx +34 -23
  34. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/Maintenance.tsx +5 -1
  35. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/PropertyDetails.tsx +48 -16
  36. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/PropertySearch.tsx +15 -5
  37. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/styles/global.css +2 -2
  38. package/dist/force-app/main/default/uiBundles/propertyrentalapp/tsconfig.tsbuildinfo +1 -1
  39. package/dist/package-lock.json +2 -2
  40. package/dist/package.json +1 -1
  41. package/dist/scripts/network-senders.mjs +84 -0
  42. package/dist/scripts/org-setup-xml.mjs +11 -6
  43. package/dist/scripts/org-setup.mjs +13 -5
  44. 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
@@ -0,0 +1,82 @@
1
+ Terms of Use
2
+
3
+ Copyright 2026 Salesforce, Inc. All rights reserved.
4
+
5
+ These Terms of Use govern the download, installation, and/or use of this
6
+ software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
7
+ last updated on April 15, 2025, and constitute a legally binding
8
+ agreement between you and Salesforce. If you do not agree to these Terms of
9
+ Use, do not install or use the Software.
10
+
11
+ Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
12
+ copyright license to reproduce, prepare derivative works of, publicly
13
+ display, publicly perform, sublicense, and distribute the Software and
14
+ derivative works subject to these Terms. These Terms shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ Subject to the limited rights expressly granted hereunder, Salesforce
18
+ reserves all rights, title, and interest in and to all intellectual
19
+ property subsisting in the Software. No rights are granted to you hereunder
20
+ other than as expressly set forth herein. Users residing in countries on
21
+ the United States Office of Foreign Assets Control sanction list, or which
22
+ are otherwise subject to a US export embargo, may not use the Software.
23
+
24
+ Implementation of the Software may require development work, for which you
25
+ are responsible. The Software may contain bugs, errors and
26
+ incompatibilities and is made available on an AS IS basis without support,
27
+ updates, or service level commitments.
28
+
29
+ Salesforce reserves the right at any time to modify, suspend, or
30
+ discontinue, the Software (or any part thereof) with or without notice. You
31
+ agree that Salesforce shall not be liable to you or to any third party for
32
+ any modification, suspension, or discontinuance.
33
+
34
+ You agree to defend Salesforce against any claim, demand, suit or
35
+ proceeding made or brought against Salesforce by a third party arising out
36
+ of or accruing from (a) your use of the Software, and (b) any application
37
+ you develop with the Software that infringes any copyright, trademark,
38
+ trade secret, trade dress, patent, or other intellectual property right of
39
+ any person or defames any person or violates their rights of publicity or
40
+ privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
41
+ from any damages, attorney fees, and costs finally awarded against
42
+ Salesforce as a result of, or for any amounts paid by Salesforce under a
43
+ settlement approved by you in writing of, a Claim Against Salesforce,
44
+ provided Salesforce (x) promptly gives you written notice of the Claim
45
+ Against Salesforce, (y) gives you sole control of the defense and
46
+ settlement of the Claim Against Salesforce (except that you may not settle
47
+ any Claim Against Salesforce unless it unconditionally releases Salesforce
48
+ of all liability), and (z) gives you all reasonable assistance, at your
49
+ expense.
50
+
51
+ WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
52
+ SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
54
+ INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
55
+ PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
56
+ OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
57
+ CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
58
+ HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
59
+
60
+ These Terms of Use shall be governed exclusively by the internal laws of
61
+ the State of California, without regard to its conflicts of laws
62
+ rules. Each party hereby consents to the exclusive jurisdiction of the
63
+ state and federal courts located in San Francisco County, California to
64
+ adjudicate any dispute arising out of or relating to these Terms of Use and
65
+ the download, installation, and/or use of the Software. Except as expressly
66
+ stated herein, these Terms of Use constitute the entire agreement between
67
+ the parties, and supersede all prior and contemporaneous agreements,
68
+ proposals, or representations, written or oral, concerning their subject
69
+ matter. No modification, amendment, or waiver of any provision of these
70
+ Terms of Use shall be effective unless it is by an update to these Terms of
71
+ Use that Salesforce makes available, or is in writing and signed by the
72
+ party against whom the modification, amendment, or waiver is to be
73
+ asserted.
74
+
75
+ Data Privacy: Salesforce may collect, process, and store device,
76
+ system, and other information related to your use of the Software. This
77
+ information includes, but is not limited to, IP address, user metrics, and
78
+ other data ("Usage Data"). Salesforce may use Usage Data for analytics,
79
+ product development, and marketing purposes. You acknowledge that files
80
+ generated in conjunction with the Software may contain sensitive or
81
+ confidential data, and you are solely responsible for anonymizing and
82
+ protecting such data.
@@ -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-canary.1016.23.1.g31dc6b7a",
23
+ "@salesforce/ui-bundle": "12.7.0-canary.1016.23.1.g31dc6b7a",
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-canary.1016.23.1.g31dc6b7a",
55
+ "@salesforce/vite-plugin-ui-bundle": "12.7.0-canary.1016.23.1.g31dc6b7a",
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
  }