@firecms/ui 3.0.0-canary.255 → 3.0.0-canary.256

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/ui",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.255",
4
+ "version": "3.0.0-canary.256",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -116,7 +116,7 @@
116
116
  "index.css",
117
117
  "tailwind.config.js"
118
118
  ],
119
- "gitHead": "320670c074735d9766907ebf28b44d9c20cb2bed",
119
+ "gitHead": "a05357be19923c876c5a4dcb1fe1da37e2efc232",
120
120
  "publishConfig": {
121
121
  "access": "public"
122
122
  }
@@ -20,6 +20,10 @@ export type DialogProps = {
20
20
  onEscapeKeyDown?: (e: KeyboardEvent) => void;
21
21
  onPointerDownOutside?: (e: Event) => void;
22
22
  onInteractOutside?: (e: Event) => void;
23
+ /**
24
+ * If `true`, the dialog will not focus the first focusable element when opened.
25
+ */
26
+ disableInitialFocus?: boolean;
23
27
  };
24
28
 
25
29
  const widthClasses = {
@@ -52,7 +56,8 @@ export const Dialog = ({
52
56
  onOpenAutoFocus,
53
57
  onEscapeKeyDown,
54
58
  onPointerDownOutside,
55
- onInteractOutside
59
+ onInteractOutside,
60
+ disableInitialFocus = true
56
61
  }: DialogProps) => {
57
62
  const [displayed, setDisplayed] = useState(false);
58
63
 
@@ -89,7 +94,12 @@ export const Dialog = ({
89
94
 
90
95
  <DialogPrimitive.Content
91
96
  onEscapeKeyDown={onEscapeKeyDown}
92
- onOpenAutoFocus={onOpenAutoFocus}
97
+ onOpenAutoFocus={(e) => {
98
+ if (disableInitialFocus) {
99
+ e.preventDefault();
100
+ }
101
+ onOpenAutoFocus?.(e);
102
+ }}
93
103
  onPointerDownOutside={onPointerDownOutside}
94
104
  onInteractOutside={onInteractOutside}
95
105
  className={cls("h-full outline-none flex justify-center items-center z-40 opacity-100 transition-all duration-200 ease-in-out")}
@@ -120,4 +130,3 @@ export const Dialog = ({
120
130
  </DialogPrimitive.Root>
121
131
  );
122
132
  };
123
-