@alexgorbatchev/shadcn 0.0.189 → 0.0.190
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.
|
@@ -89,8 +89,23 @@ function createSlots() {
|
|
|
89
89
|
function subscribeToHydration() {
|
|
90
90
|
return () => {};
|
|
91
91
|
}
|
|
92
|
+
var focusBeforeMove = new WeakMap;
|
|
92
93
|
function SlotHost({ slot }) {
|
|
93
|
-
const attach = useCallback((host) =>
|
|
94
|
+
const attach = useCallback((host) => {
|
|
95
|
+
if (!host)
|
|
96
|
+
return;
|
|
97
|
+
host.append(slot);
|
|
98
|
+
const focused = focusBeforeMove.get(slot);
|
|
99
|
+
focusBeforeMove.delete(slot);
|
|
100
|
+
const active = slot.ownerDocument.activeElement;
|
|
101
|
+
if (focused?.isConnected && slot.contains(focused) && (active === null || active === slot.ownerDocument.body))
|
|
102
|
+
focused.focus({ preventScroll: true });
|
|
103
|
+
return () => {
|
|
104
|
+
const current = slot.ownerDocument.activeElement;
|
|
105
|
+
if (current instanceof HTMLElement && slot.contains(current))
|
|
106
|
+
focusBeforeMove.set(slot, current);
|
|
107
|
+
};
|
|
108
|
+
}, [slot]);
|
|
94
109
|
return /* @__PURE__ */ jsx("div", {
|
|
95
110
|
className: "contents",
|
|
96
111
|
ref: attach
|
package/dist/prototype.js
CHANGED
|
@@ -2051,7 +2051,7 @@ var program = new Command;
|
|
|
2051
2051
|
// package.json
|
|
2052
2052
|
var package_default = {
|
|
2053
2053
|
name: "@alexgorbatchev/shadcn",
|
|
2054
|
-
version: "0.0.
|
|
2054
|
+
version: "0.0.190",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|