@classic-homes/theme-react 0.3.0 → 0.3.2
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/dist/index.js +13 -3
- package/dist/index.mjs +13 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1722,6 +1722,7 @@ function StudioCanvasItem({
|
|
|
1722
1722
|
}) {
|
|
1723
1723
|
const studio = useStudio();
|
|
1724
1724
|
const ref = React19.useRef(null);
|
|
1725
|
+
const inQuickAction = (target) => !!target?.closest?.("[data-studio-quick-action]");
|
|
1725
1726
|
const select = (reveal) => {
|
|
1726
1727
|
if (!selected) onSelect?.();
|
|
1727
1728
|
if (reveal) studio?.revealInspector();
|
|
@@ -1748,8 +1749,10 @@ function StudioCanvasItem({
|
|
|
1748
1749
|
invalid && "-outline-offset-2 outline-dashed outline-2 outline-warning/70",
|
|
1749
1750
|
className
|
|
1750
1751
|
),
|
|
1751
|
-
onClickCapture: (e) => select(!e.target
|
|
1752
|
-
onFocus: () =>
|
|
1752
|
+
onClickCapture: (e) => select(!inQuickAction(e.target)),
|
|
1753
|
+
onFocus: (e) => {
|
|
1754
|
+
if (!inQuickAction(e.target)) select(false);
|
|
1755
|
+
},
|
|
1753
1756
|
children: [
|
|
1754
1757
|
!selected && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1755
1758
|
"button",
|
|
@@ -2145,10 +2148,13 @@ function InsertPalette({
|
|
|
2145
2148
|
renderThumbnail
|
|
2146
2149
|
}) {
|
|
2147
2150
|
const [query, setQuery] = React22.useState("");
|
|
2151
|
+
const picked = React22.useRef(false);
|
|
2148
2152
|
const listRef = React22.useRef(null);
|
|
2149
2153
|
const searchRef = React22.useRef(null);
|
|
2150
2154
|
React22.useEffect(() => {
|
|
2151
|
-
if (open)
|
|
2155
|
+
if (!open) return;
|
|
2156
|
+
setQuery("");
|
|
2157
|
+
picked.current = false;
|
|
2152
2158
|
}, [open]);
|
|
2153
2159
|
const q = query.trim().toLowerCase();
|
|
2154
2160
|
const filtered = q ? groups.map((g) => ({
|
|
@@ -2162,6 +2168,7 @@ function InsertPalette({
|
|
|
2162
2168
|
const firstMatch = filtered.flatMap((g) => g.items).find((i) => !i.disabled);
|
|
2163
2169
|
const choose = (item) => {
|
|
2164
2170
|
if (item.disabled) return;
|
|
2171
|
+
picked.current = true;
|
|
2165
2172
|
onOpenChange(false);
|
|
2166
2173
|
onSelect(item.id);
|
|
2167
2174
|
};
|
|
@@ -2175,6 +2182,9 @@ function InsertPalette({
|
|
|
2175
2182
|
e.preventDefault();
|
|
2176
2183
|
searchRef.current?.focus();
|
|
2177
2184
|
},
|
|
2185
|
+
onCloseAutoFocus: (e) => {
|
|
2186
|
+
if (picked.current) e.preventDefault();
|
|
2187
|
+
},
|
|
2178
2188
|
...description ? {} : { "aria-describedby": void 0 },
|
|
2179
2189
|
children: [
|
|
2180
2190
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogTitle, { children: title }),
|
package/dist/index.mjs
CHANGED
|
@@ -1613,6 +1613,7 @@ function StudioCanvasItem({
|
|
|
1613
1613
|
}) {
|
|
1614
1614
|
const studio = useStudio();
|
|
1615
1615
|
const ref = React19.useRef(null);
|
|
1616
|
+
const inQuickAction = (target) => !!target?.closest?.("[data-studio-quick-action]");
|
|
1616
1617
|
const select = (reveal) => {
|
|
1617
1618
|
if (!selected) onSelect?.();
|
|
1618
1619
|
if (reveal) studio?.revealInspector();
|
|
@@ -1639,8 +1640,10 @@ function StudioCanvasItem({
|
|
|
1639
1640
|
invalid && "-outline-offset-2 outline-dashed outline-2 outline-warning/70",
|
|
1640
1641
|
className
|
|
1641
1642
|
),
|
|
1642
|
-
onClickCapture: (e) => select(!e.target
|
|
1643
|
-
onFocus: () =>
|
|
1643
|
+
onClickCapture: (e) => select(!inQuickAction(e.target)),
|
|
1644
|
+
onFocus: (e) => {
|
|
1645
|
+
if (!inQuickAction(e.target)) select(false);
|
|
1646
|
+
},
|
|
1644
1647
|
children: [
|
|
1645
1648
|
!selected && /* @__PURE__ */ jsxs12(
|
|
1646
1649
|
"button",
|
|
@@ -2036,10 +2039,13 @@ function InsertPalette({
|
|
|
2036
2039
|
renderThumbnail
|
|
2037
2040
|
}) {
|
|
2038
2041
|
const [query, setQuery] = React22.useState("");
|
|
2042
|
+
const picked = React22.useRef(false);
|
|
2039
2043
|
const listRef = React22.useRef(null);
|
|
2040
2044
|
const searchRef = React22.useRef(null);
|
|
2041
2045
|
React22.useEffect(() => {
|
|
2042
|
-
if (open)
|
|
2046
|
+
if (!open) return;
|
|
2047
|
+
setQuery("");
|
|
2048
|
+
picked.current = false;
|
|
2043
2049
|
}, [open]);
|
|
2044
2050
|
const q = query.trim().toLowerCase();
|
|
2045
2051
|
const filtered = q ? groups.map((g) => ({
|
|
@@ -2053,6 +2059,7 @@ function InsertPalette({
|
|
|
2053
2059
|
const firstMatch = filtered.flatMap((g) => g.items).find((i) => !i.disabled);
|
|
2054
2060
|
const choose = (item) => {
|
|
2055
2061
|
if (item.disabled) return;
|
|
2062
|
+
picked.current = true;
|
|
2056
2063
|
onOpenChange(false);
|
|
2057
2064
|
onSelect(item.id);
|
|
2058
2065
|
};
|
|
@@ -2066,6 +2073,9 @@ function InsertPalette({
|
|
|
2066
2073
|
e.preventDefault();
|
|
2067
2074
|
searchRef.current?.focus();
|
|
2068
2075
|
},
|
|
2076
|
+
onCloseAutoFocus: (e) => {
|
|
2077
|
+
if (picked.current) e.preventDefault();
|
|
2078
|
+
},
|
|
2069
2079
|
...description ? {} : { "aria-describedby": void 0 },
|
|
2070
2080
|
children: [
|
|
2071
2081
|
/* @__PURE__ */ jsx24(DialogTitle, { children: title }),
|