@classic-homes/theme-svelte 1.36.0 → 1.37.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.
@@ -41,6 +41,12 @@
41
41
  * keeps focus where the caller put it (e.g. a field it just revealed).
42
42
  */
43
43
  onCloseAutoFocus?: (event: Event) => void;
44
+ /**
45
+ * Called as the dialog opens, before focus moves to its first focusable
46
+ * element (often the close button); `preventDefault()` and focus a field
47
+ * yourself to start somewhere else, e.g. a form's first input.
48
+ */
49
+ onOpenAutoFocus?: (event: Event) => void;
44
50
  /**
45
51
  * Unsaved work inside. When true, an overlay click, Escape or the close
46
52
  * button asks "Discard unsaved changes?" instead of closing. Left unset,
@@ -77,6 +83,7 @@
77
83
  headerActions,
78
84
  showClose = true,
79
85
  onCloseAutoFocus,
86
+ onOpenAutoFocus,
80
87
  dirty,
81
88
  }: Props = $props();
82
89
 
@@ -123,6 +130,7 @@
123
130
  <DialogPrimitive.Content
124
131
  bind:ref={contentEl}
125
132
  {onCloseAutoFocus}
133
+ {onOpenAutoFocus}
126
134
  onInteractOutside={guard.dismiss}
127
135
  onEscapeKeydown={guard.escape}
128
136
  oninput={guard.track}
@@ -35,6 +35,12 @@ interface Props {
35
35
  * keeps focus where the caller put it (e.g. a field it just revealed).
36
36
  */
37
37
  onCloseAutoFocus?: (event: Event) => void;
38
+ /**
39
+ * Called as the dialog opens, before focus moves to its first focusable
40
+ * element (often the close button); `preventDefault()` and focus a field
41
+ * yourself to start somewhere else, e.g. a form's first input.
42
+ */
43
+ onOpenAutoFocus?: (event: Event) => void;
38
44
  /**
39
45
  * Unsaved work inside. When true, an overlay click, Escape or the close
40
46
  * button asks "Discard unsaved changes?" instead of closing. Left unset,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/theme-svelte",
3
- "version": "1.36.0",
3
+ "version": "1.37.0",
4
4
  "description": "Svelte components for the Classic theme system",
5
5
  "type": "module",
6
6
  "svelte": "./dist/lib/index.js",