@sanity/ui 2.16.24 → 2.16.26
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/_chunks-cjs/_visual-editing.js +29 -29
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +29 -29
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +12 -21
- package/dist/_visual-editing.d.ts +12 -21
- package/dist/index.d.mts +31 -57
- package/dist/index.d.ts +31 -57
- package/dist/index.js +46 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -47
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +12 -19
- package/dist/theme.d.ts +12 -19
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,52 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
3
|
var _visualEditing = require("./_chunks-cjs/_visual-editing.js"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), styledComponents = require("styled-components"), reactCompilerRuntime = require("react-compiler-runtime"), theme = require("@sanity/ui/theme"), react$1 = require("motion/react");
|
|
4
|
-
function _raf(fn) {
|
|
5
|
-
const frameId = requestAnimationFrame(fn);
|
|
6
|
-
return () => {
|
|
7
|
-
cancelAnimationFrame(frameId);
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
function _raf2(fn) {
|
|
11
|
-
let innerDispose = null;
|
|
12
|
-
const outerDispose = _raf(() => {
|
|
13
|
-
innerDispose = _raf(fn);
|
|
14
|
-
});
|
|
15
|
-
return () => {
|
|
16
|
-
innerDispose && innerDispose(), outerDispose();
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function _hasFocus(element) {
|
|
20
|
-
return !!document.activeElement && element.contains(document.activeElement);
|
|
21
|
-
}
|
|
22
|
-
function isFocusable(element) {
|
|
23
|
-
return element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null ? !0 : _visualEditing.isHTMLAnchorElement(element) ? !!element.href && element.rel !== "ignore" : _visualEditing.isHTMLInputElement(element) ? element.type !== "hidden" && element.type !== "file" && !element.disabled : _visualEditing.isHTMLButtonElement(element) || _visualEditing.isHTMLSelectElement(element) || _visualEditing.isHTMLTextAreaElement(element) ? !element.disabled : !1;
|
|
24
|
-
}
|
|
25
|
-
function attemptFocus(element) {
|
|
26
|
-
if (!isFocusable(element))
|
|
27
|
-
return !1;
|
|
28
|
-
try {
|
|
29
|
-
element.focus();
|
|
30
|
-
} catch {
|
|
31
|
-
}
|
|
32
|
-
return document.activeElement === element;
|
|
33
|
-
}
|
|
34
|
-
function focusFirstDescendant(element) {
|
|
35
|
-
for (let i = 0; i < element.childNodes.length; i++) {
|
|
36
|
-
const child = element.childNodes[i];
|
|
37
|
-
if (_visualEditing.isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child)))
|
|
38
|
-
return !0;
|
|
39
|
-
}
|
|
40
|
-
return !1;
|
|
41
|
-
}
|
|
42
|
-
function focusLastDescendant(element) {
|
|
43
|
-
for (let i = element.childNodes.length - 1; i >= 0; i--) {
|
|
44
|
-
const child = element.childNodes[i];
|
|
45
|
-
if (_visualEditing.isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child)))
|
|
46
|
-
return !0;
|
|
47
|
-
}
|
|
48
|
-
return !1;
|
|
49
|
-
}
|
|
50
4
|
function _getElements(element, elementsArg) {
|
|
51
5
|
const ret = [element];
|
|
52
6
|
for (const el of elementsArg)
|
|
@@ -128,6 +82,52 @@ class ErrorBoundary extends react.Component {
|
|
|
128
82
|
return this.props.children;
|
|
129
83
|
}
|
|
130
84
|
}
|
|
85
|
+
function _raf(fn) {
|
|
86
|
+
const frameId = requestAnimationFrame(fn);
|
|
87
|
+
return () => {
|
|
88
|
+
cancelAnimationFrame(frameId);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function _raf2(fn) {
|
|
92
|
+
let innerDispose = null;
|
|
93
|
+
const outerDispose = _raf(() => {
|
|
94
|
+
innerDispose = _raf(fn);
|
|
95
|
+
});
|
|
96
|
+
return () => {
|
|
97
|
+
innerDispose && innerDispose(), outerDispose();
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function _hasFocus(element) {
|
|
101
|
+
return !!document.activeElement && element.contains(document.activeElement);
|
|
102
|
+
}
|
|
103
|
+
function isFocusable(element) {
|
|
104
|
+
return element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null ? !0 : _visualEditing.isHTMLAnchorElement(element) ? !!element.href && element.rel !== "ignore" : _visualEditing.isHTMLInputElement(element) ? element.type !== "hidden" && element.type !== "file" && !element.disabled : _visualEditing.isHTMLButtonElement(element) || _visualEditing.isHTMLSelectElement(element) || _visualEditing.isHTMLTextAreaElement(element) ? !element.disabled : !1;
|
|
105
|
+
}
|
|
106
|
+
function attemptFocus(element) {
|
|
107
|
+
if (!isFocusable(element))
|
|
108
|
+
return !1;
|
|
109
|
+
try {
|
|
110
|
+
element.focus();
|
|
111
|
+
} catch {
|
|
112
|
+
}
|
|
113
|
+
return document.activeElement === element;
|
|
114
|
+
}
|
|
115
|
+
function focusFirstDescendant(element) {
|
|
116
|
+
for (let i = 0; i < element.childNodes.length; i++) {
|
|
117
|
+
const child = element.childNodes[i];
|
|
118
|
+
if (_visualEditing.isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child)))
|
|
119
|
+
return !0;
|
|
120
|
+
}
|
|
121
|
+
return !1;
|
|
122
|
+
}
|
|
123
|
+
function focusLastDescendant(element) {
|
|
124
|
+
for (let i = element.childNodes.length - 1; i >= 0; i--) {
|
|
125
|
+
const child = element.childNodes[i];
|
|
126
|
+
if (_visualEditing.isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child)))
|
|
127
|
+
return !0;
|
|
128
|
+
}
|
|
129
|
+
return !1;
|
|
130
|
+
}
|
|
131
131
|
const StyledAutocomplete = styledComponents.styled.div.withConfig({
|
|
132
132
|
displayName: "StyledAutocomplete",
|
|
133
133
|
componentId: "sc-1igauft-0"
|