@neo4j-ndl/react 0.8.3 → 0.8.4
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/CHANGELOG.md +10 -0
- package/lib/cjs/_common/utils.js +25 -1
- package/lib/cjs/_common/utils.js.map +1 -1
- package/lib/cjs/code-block/CodeBlock.js +4 -4
- package/lib/cjs/code-block/CodeBlock.js.map +1 -1
- package/lib/cjs/popover/Popover.js +10 -3
- package/lib/cjs/popover/Popover.js.map +1 -1
- package/lib/cjs/text-input/TextInput.js +6 -0
- package/lib/cjs/text-input/TextInput.js.map +1 -1
- package/lib/esm/_common/utils.js +24 -1
- package/lib/esm/_common/utils.js.map +1 -1
- package/lib/esm/code-block/CodeBlock.js +4 -4
- package/lib/esm/code-block/CodeBlock.js.map +1 -1
- package/lib/esm/popover/Popover.js +11 -4
- package/lib/esm/popover/Popover.js.map +1 -1
- package/lib/esm/text-input/TextInput.js +6 -0
- package/lib/esm/text-input/TextInput.js.map +1 -1
- package/lib/types/_common/utils.d.ts +8 -0
- package/lib/types/code-block/CodeBlock.d.ts +3 -3
- package/lib/types/context-menu/ContextMenu.d.ts +1 -1
- package/lib/types/popover/Popover.d.ts +3 -1
- package/lib/types/text-input/TextInput.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 0.8.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2564aeb: make code block title interactive
|
|
8
|
+
- f0a5826: Fixed no label spacing gap for TextInput
|
|
9
|
+
- Updated dependencies [b976b09]
|
|
10
|
+
- Updated dependencies [f0a5826]
|
|
11
|
+
- @neo4j-ndl/base@0.8.4
|
|
12
|
+
|
|
3
13
|
## 0.8.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/lib/cjs/_common/utils.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
21
|
*/
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.randomId = exports.useDocumentScrollToggle = exports.needleWarningMessage = exports.removeSpaces = exports.removeNewlines = void 0;
|
|
23
|
+
exports.randomId = exports.useOnClickOutside = exports.useDocumentScrollToggle = exports.needleWarningMessage = exports.removeSpaces = exports.removeNewlines = void 0;
|
|
24
24
|
const react_1 = require("react");
|
|
25
25
|
const removeNewlines = (input) => input.replace(/(\r\n|\n|\r)/gm, '');
|
|
26
26
|
exports.removeNewlines = removeNewlines;
|
|
@@ -56,6 +56,30 @@ const useDocumentScrollToggle = () => {
|
|
|
56
56
|
}, []);
|
|
57
57
|
};
|
|
58
58
|
exports.useDocumentScrollToggle = useDocumentScrollToggle;
|
|
59
|
+
/**
|
|
60
|
+
* Detect if there is a click event outside
|
|
61
|
+
* of the provided element
|
|
62
|
+
* Source:
|
|
63
|
+
* https://hashnode.com/post/useonclickoutside-custom-hook-to-detect-the-mouse-click-on-outside-typescript-ckrejmy3h0k5r91s18iu42t28
|
|
64
|
+
*/
|
|
65
|
+
const useOnClickOutside = (ref, handler) => {
|
|
66
|
+
(0, react_1.useEffect)(() => {
|
|
67
|
+
const listener = (event) => {
|
|
68
|
+
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
69
|
+
if (!el || el.contains((event === null || event === void 0 ? void 0 : event.target) || null)) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
handler(event); // Call the handler only if the click is outside of the element passed.
|
|
73
|
+
};
|
|
74
|
+
document.addEventListener('mousedown', listener);
|
|
75
|
+
document.addEventListener('touchstart', listener);
|
|
76
|
+
return () => {
|
|
77
|
+
document.removeEventListener('mousedown', listener);
|
|
78
|
+
document.removeEventListener('touchstart', listener);
|
|
79
|
+
};
|
|
80
|
+
}, [ref, handler]); // Reload only if ref or handler changes
|
|
81
|
+
};
|
|
82
|
+
exports.useOnClickOutside = useOnClickOutside;
|
|
59
83
|
/**
|
|
60
84
|
* X - char long pseudo-random string
|
|
61
85
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/_common/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/_common/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,iCAAuD;AAEhD,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAC9C,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AADzB,QAAA,cAAc,kBACW;AAEtC,qCAAqC;AAC9B,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAC5C,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AADvB,QAAA,YAAY,gBACW;AAE7B,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,EAAE,CACtD,OAAO,CAAC,IAAI,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;AAD9B,QAAA,oBAAoB,wBACU;AAE3C,MAAM,gBAAgB,GAAG,CAAC,GAAa,EAAU,EAAE;IACjD,iFAAiF;IACjF,MAAM,aAAa,GAAG,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC;IACtD,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,aAAa,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAU,EAAE,CACnD,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAEnE;;;GAGG;AACI,MAAM,uBAAuB,GAAG,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AAC,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjD,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAElD,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YACpD,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,wCAAwC;AAC9D,CAAC,CAAC;AAtBW,QAAA,iBAAiB,qBAsB5B;AAEF;;GAEG;AACI,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,EAAE,CACzC,IAAI,CAAC,MAAM,EAAE;KACV,QAAQ,CAAC,EAAE,CAAC;KACZ,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;AAHb,QAAA,QAAQ,YAGK"}
|
|
@@ -54,7 +54,7 @@ const classnames_1 = __importDefault(require("classnames"));
|
|
|
54
54
|
const button_1 = require("../button");
|
|
55
55
|
const react_syntax_highlighter_1 = require("react-syntax-highlighter");
|
|
56
56
|
const prism_1 = require("react-syntax-highlighter/dist/cjs/styles/prism");
|
|
57
|
-
exports.CodeBlock = react_1.default.forwardRef(function CodeBlock({ as, code, language, showLineNumbers, theme,
|
|
57
|
+
exports.CodeBlock = react_1.default.forwardRef(function CodeBlock({ as, code, language, showLineNumbers, theme, headerTitle, actions, disabled, }, ref) {
|
|
58
58
|
const Component = as || 'div';
|
|
59
59
|
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
60
60
|
const getTheme = () => {
|
|
@@ -77,13 +77,13 @@ exports.CodeBlock = react_1.default.forwardRef(function CodeBlock({ as, code, la
|
|
|
77
77
|
return prism_1.vs;
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
-
const hasHeader =
|
|
80
|
+
const hasHeader = headerTitle || actions;
|
|
81
81
|
return ((0, jsx_runtime_1.jsxs)(Component, Object.assign({ ref: ref, className: "ndl-code-block-container" }, { children: [hasHeader && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)('ndl-code-block-title', {
|
|
82
82
|
disabled,
|
|
83
|
-
}) }, { children: [
|
|
83
|
+
}) }, { children: [headerTitle && ((0, jsx_runtime_1.jsx)("h6", Object.assign({ className: `${disabled ? 'n-pointer-events-none' : ''}`, "data-testid": "code-block-title" }, { children: headerTitle }))), (0, jsx_runtime_1.jsx)("div", { children: actions === null || actions === void 0 ? void 0 : actions.map((iconButtonProps, i) => ((0, jsx_runtime_1.jsx)(button_1.IconButton, Object.assign({ "data-testid": `action-button-${i}`, clean: true, disabled: disabled }, iconButtonProps), i))) })] }))), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)('highlight-wrapper', {
|
|
84
84
|
'has-header': hasHeader,
|
|
85
85
|
focused: isFocused,
|
|
86
|
-
}), role: "textbox", "aria-label":
|
|
86
|
+
}), role: "textbox", "aria-label": "code-snippet", tabIndex: 0, onFocus: () => {
|
|
87
87
|
setIsFocused(true);
|
|
88
88
|
}, onBlur: () => setIsFocused(false) }, { children: (0, jsx_runtime_1.jsx)(react_syntax_highlighter_1.Prism, Object.assign({ language: language, style: Object.assign(Object.assign({}, getTheme()), { 'pre[class*="language-"]': {
|
|
89
89
|
color: tokens_1.default.palette.light.neutral.text.weak,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.js","sourceRoot":"","sources":["../../../src/code-block/CodeBlock.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kFAA6D;AAC7D,+CAAwC;AACxC,4DAAoC;AACpC,sCAAwD;AACxD,uEAAsE;AACtE,0EAQwD;AAsB3C,QAAA,SAAS,GAAG,eAAK,CAAC,UAAU,CAAC,SAAS,S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AO,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;yBAC5B;oBAEH,qFAAqF;oBACrF,kFAAkF;oBAClF,gBAAgB;oBAChB,YAAY,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EACrC,eAAe,EAAE,eAAe,gBAE/B,IAAI,IACa,IAChB,KACI,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -59,10 +59,15 @@ const getOffsetLeft = (rect, horizontal) => {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
exports.Popover = (0, react_1.forwardRef)(function Popover(_a, ref) {
|
|
62
|
-
var { as = 'div', children, open, anchorEl, onClose, anchorOrigin = { vertical: 'bottom', horizontal: 'left' }, transformOrigin = { vertical: 'top', horizontal: 'left' }, className, nested = false } = _a, rest = __rest(_a, ["as", "children", "open", "anchorEl", "onClose", "anchorOrigin", "transformOrigin", "className", "nested"]);
|
|
62
|
+
var { as = 'div', children, open, anchorEl, onClose, anchorOrigin = { vertical: 'bottom', horizontal: 'left' }, transformOrigin = { vertical: 'top', horizontal: 'left' }, className, disableBackdrop = false, nested = false } = _a, rest = __rest(_a, ["as", "children", "open", "anchorEl", "onClose", "anchorOrigin", "transformOrigin", "className", "disableBackdrop", "nested"]);
|
|
63
63
|
const Component = as;
|
|
64
|
-
const popoverRef = (0, react_1.useRef)();
|
|
64
|
+
const popoverRef = (0, react_1.useRef)(null);
|
|
65
65
|
const toggleScrollbar = (0, utils_1.useDocumentScrollToggle)();
|
|
66
|
+
(0, utils_1.useOnClickOutside)(popoverRef, (event) => {
|
|
67
|
+
disableBackdrop
|
|
68
|
+
? onClose && onClose(event)
|
|
69
|
+
: null;
|
|
70
|
+
});
|
|
66
71
|
// Override ref to map to internal ref
|
|
67
72
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
68
73
|
const popover = popoverRef.current;
|
|
@@ -186,6 +191,8 @@ exports.Popover = (0, react_1.forwardRef)(function Popover(_a, ref) {
|
|
|
186
191
|
return null;
|
|
187
192
|
}
|
|
188
193
|
const classes = (0, classnames_1.default)('ndl-popover', base, className);
|
|
189
|
-
return ((0, jsx_runtime_1.jsxs)(portal_1.Portal, { children: [(0, jsx_runtime_1.jsx)("div", { className:
|
|
194
|
+
return ((0, jsx_runtime_1.jsxs)(portal_1.Portal, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ndl-popover-backdrop', {
|
|
195
|
+
'allow-click-event-captured': disableBackdrop,
|
|
196
|
+
}), role: "button", tabIndex: 0, onClick: handleBackdropClick, onKeyDown: handleBackdropClick, "data-testid": "popover-backdrop" }), (0, jsx_runtime_1.jsx)(Component, Object.assign({ tabIndex: -1 }, rest, { className: classes, ref: popoverRef, "data-testid": "popover-content" }, { children: children }))] }));
|
|
190
197
|
});
|
|
191
198
|
//# sourceMappingURL=Popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/popover/Popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iCAOe;AACf,4DAAoC;AACpC,wCAAsC;AACtC,sCAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/popover/Popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iCAOe;AACf,4DAAoC;AACpC,wCAAsC;AACtC,sCAAmC;AACnC,4CAA8E;AAiB9E,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,QAAkB,EAAE,EAAE;IACzD,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,IAAI,QAAQ,KAAK,QAAQ,EAAE;QACzB,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;KACtB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,I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AAE,CAAC;QACxB,KAAK,CAAC,cAAc,EAAE,CAAC;QAEvB,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,aAAa,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAE3D,OAAO,CACL,wBAAC,eAAM,eAEL,gCACE,SAAS,EAAE,IAAA,oBAAU,EAAC,sBAAsB,EAAE;oBAC5C,4BAA4B,EAAE,eAAe;iBAC9C,CAAC,EACF,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,mBAAmB,iBAClB,kBAAkB,GAC9B,EACF,uBAAC,SAAS,kBACR,QAAQ,EAAE,CAAC,CAAC,IACR,IAAI,IACR,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,UAAU,iBACH,iBAAiB,gBAE5B,QAAQ,IACC,IACL,CACV,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -38,6 +38,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
38
38
|
const react_1 = __importDefault(require("react"));
|
|
39
39
|
const classnames_1 = __importDefault(require("classnames"));
|
|
40
40
|
const icons_1 = require("../icons");
|
|
41
|
+
const utils_1 = require("../_common/utils");
|
|
41
42
|
/**
|
|
42
43
|
*
|
|
43
44
|
*
|
|
@@ -63,9 +64,14 @@ const TextInput = react_1.default.forwardRef(function TextInput(props, ref) {
|
|
|
63
64
|
'has-right-icon': rightIcon || errorText,
|
|
64
65
|
'has-icon': leftIcon || rightIcon || errorText,
|
|
65
66
|
});
|
|
67
|
+
const hasEmptyLabelValue = !label || label === '';
|
|
66
68
|
const labelWrappingClass = (0, classnames_1.default)(`form-item-label`, {
|
|
67
69
|
fluid,
|
|
70
|
+
'form-item-no-label': hasEmptyLabelValue,
|
|
68
71
|
});
|
|
72
|
+
if (label && !props['aria-label']) {
|
|
73
|
+
(0, utils_1.needleWarningMessage)('TextInput does not have an aria label, be sure to include an aria label for screen readers link: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI');
|
|
74
|
+
}
|
|
69
75
|
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: containerWrappingClass }, { children: [(0, jsx_runtime_1.jsxs)("label", Object.assign({ className: labelWrappingClass }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "input-wrapper" }, { children: [leftIcon && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "icon left-icon" }, { children: leftIcon })), (0, jsx_runtime_1.jsx)("input", Object.assign({}, otherInputProps, { type: type, ref: ref })), rightIcon && !errorText && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "icon right-icon" }, { children: rightIcon }))), errorText && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "icon right-icon error-icon" }, { children: (0, jsx_runtime_1.jsx)(icons_1.HeroIcon, { iconName: "ExclamationCircleIcon", type: "solid" }) })))] })), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "form-label-text" }, { children: label }))] })), (errorText || helpText) && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "form-msg" }, { children: errorText || helpText })))] })));
|
|
70
76
|
});
|
|
71
77
|
exports.default = TextInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../src/text-input/TextInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kDAA4C;AAC5C,4DAAoC;AAEpC,oCAAoC;
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../src/text-input/TextInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kDAA4C;AAC5C,4DAAoC;AAEpC,oCAAoC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C1B,8CAAK,SAAS,EAAC,iBAAiB,gBAAE,SAAS,IAAO,CACnD,EACA,SAAS,IAAI,CACZ,8CAAK,SAAS,EAAC,4BAA4B,gBACzC,uBAAC,gBAAQ,IAAC,QAAQ,EAAC,uBAAuB,EAAC,IAAI,EAAC,OAAO,GAAG,IACtD,CACP,KACG,EAEN,+CAAM,SAAS,EAAC,iBAAiB,gBAAE,KAAK,IAAQ,KAC1C,EACP,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,CAC1B,8CAAK,SAAS,EAAC,UAAU,gBAAE,SAAS,IAAI,QAAQ,IAAO,CACxD,KACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAe,SAAS,CAAC"}
|
package/lib/esm/_common/utils.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* You should have received a copy of the GNU General Public License
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
import { useCallback, useRef } from 'react';
|
|
21
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
22
22
|
export const removeNewlines = (input) => input.replace(/(\r\n|\n|\r)/gm, '');
|
|
23
23
|
/** Remove extra spaces from sting */
|
|
24
24
|
export const removeSpaces = (input) => input.replace(/\s+/g, ' ').trim();
|
|
@@ -49,6 +49,29 @@ export const useDocumentScrollToggle = () => {
|
|
|
49
49
|
}
|
|
50
50
|
}, []);
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Detect if there is a click event outside
|
|
54
|
+
* of the provided element
|
|
55
|
+
* Source:
|
|
56
|
+
* https://hashnode.com/post/useonclickoutside-custom-hook-to-detect-the-mouse-click-on-outside-typescript-ckrejmy3h0k5r91s18iu42t28
|
|
57
|
+
*/
|
|
58
|
+
export const useOnClickOutside = (ref, handler) => {
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
const listener = (event) => {
|
|
61
|
+
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
62
|
+
if (!el || el.contains((event === null || event === void 0 ? void 0 : event.target) || null)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
handler(event); // Call the handler only if the click is outside of the element passed.
|
|
66
|
+
};
|
|
67
|
+
document.addEventListener('mousedown', listener);
|
|
68
|
+
document.addEventListener('touchstart', listener);
|
|
69
|
+
return () => {
|
|
70
|
+
document.removeEventListener('mousedown', listener);
|
|
71
|
+
document.removeEventListener('touchstart', listener);
|
|
72
|
+
};
|
|
73
|
+
}, [ref, handler]); // Reload only if ref or handler changes
|
|
74
|
+
};
|
|
52
75
|
/**
|
|
53
76
|
* X - char long pseudo-random string
|
|
54
77
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/_common/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/_common/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAC9C,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAEtC,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAC5C,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAEpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,EAAE,CACtD,OAAO,CAAC,IAAI,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;AAE3C,MAAM,gBAAgB,GAAG,CAAC,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AG,EAAE;QACb,MAAM,QAAQ,GAAG,CAAC,KAA8B,EAAE,EAAE;YAClD,MAAM,EAAE,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAC;YACxB,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAe,KAAI,IAAI,CAAC,EAAE;gBACvD,OAAO;aACR;YAED,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,uEAAuE;QACzF,CAAC,CAAC;QAEF,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjD,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAElD,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YACpD,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,wCAAwC;AAC9D,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,EAAE,CACzC,IAAI,CAAC,MAAM,EAAE;KACV,QAAQ,CAAC,EAAE,CAAC;KACZ,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC"}
|
|
@@ -25,7 +25,7 @@ import classNames from 'classnames';
|
|
|
25
25
|
import { IconButton } from '../button';
|
|
26
26
|
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
27
27
|
import { base16AteliersulphurpoolLight, coy, duotoneLight, ghcolors, prism, solarizedlight, vs, } from 'react-syntax-highlighter/dist/cjs/styles/prism';
|
|
28
|
-
export const CodeBlock = React.forwardRef(function CodeBlock({ as, code, language, showLineNumbers, theme,
|
|
28
|
+
export const CodeBlock = React.forwardRef(function CodeBlock({ as, code, language, showLineNumbers, theme, headerTitle, actions, disabled, }, ref) {
|
|
29
29
|
const Component = as || 'div';
|
|
30
30
|
const [isFocused, setIsFocused] = useState(false);
|
|
31
31
|
const getTheme = () => {
|
|
@@ -48,13 +48,13 @@ export const CodeBlock = React.forwardRef(function CodeBlock({ as, code, languag
|
|
|
48
48
|
return vs;
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
const hasHeader =
|
|
51
|
+
const hasHeader = headerTitle || actions;
|
|
52
52
|
return (_jsxs(Component, Object.assign({ ref: ref, className: "ndl-code-block-container" }, { children: [hasHeader && (_jsxs("div", Object.assign({ className: classNames('ndl-code-block-title', {
|
|
53
53
|
disabled,
|
|
54
|
-
}) }, { children: [
|
|
54
|
+
}) }, { children: [headerTitle && (_jsx("h6", Object.assign({ className: `${disabled ? 'n-pointer-events-none' : ''}`, "data-testid": "code-block-title" }, { children: headerTitle }))), _jsx("div", { children: actions === null || actions === void 0 ? void 0 : actions.map((iconButtonProps, i) => (_jsx(IconButton, Object.assign({ "data-testid": `action-button-${i}`, clean: true, disabled: disabled }, iconButtonProps), i))) })] }))), _jsx("div", Object.assign({ className: classNames('highlight-wrapper', {
|
|
55
55
|
'has-header': hasHeader,
|
|
56
56
|
focused: isFocused,
|
|
57
|
-
}), role: "textbox", "aria-label":
|
|
57
|
+
}), role: "textbox", "aria-label": "code-snippet", tabIndex: 0, onFocus: () => {
|
|
58
58
|
setIsFocused(true);
|
|
59
59
|
}, onBlur: () => setIsFocused(false) }, { children: _jsx(SyntaxHighlighter, Object.assign({ language: language, style: Object.assign(Object.assign({}, getTheme()), { 'pre[class*="language-"]': {
|
|
60
60
|
color: ndlTokens.palette.light.neutral.text.weak,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.js","sourceRoot":"","sources":["../../../src/code-block/CodeBlock.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAm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AAS;iBACnB,CAAC,EACF,IAAI,EAAC,SAAS,gBACH,cAAc,EACzB,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,GAAG,EAAE;oBACZ,YAAY,CAAC,IAAI,CAAC,CAAC;gBACrB,CAAC,EACD,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,gBAEjC,KAAC,iBAAiB,kBAChB,QAAQ,EAAE,QAAQ,EAClB,KAAK,kCACA,QAAQ,EAAE,KACb,yBAAyB,EAAE;4BACzB,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;4BAChD,eAAe,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;4BAC7C,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;4BACxC,UAAU,EAAE,GAAG;4BACf,MAAM,EAAE,CAAC;4BACT,OAAO,EAAE,eAAe;4BACxB,SAAS,EAAE,MAAM;4BACjB,SAAS,EAAE,MAAM;4BACjB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;yBAC5B;oBAEH,qFAAqF;oBACrF,kFAAkF;oBAClF,gBAAgB;oBAChB,YAAY,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EACrC,eAAe,EAAE,eAAe,gBAE/B,IAAI,IACa,IAChB,KACI,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -34,7 +34,7 @@ import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useSta
|
|
|
34
34
|
import classnames from 'classnames';
|
|
35
35
|
import { debounce } from '../helpers';
|
|
36
36
|
import { Portal } from '../portal';
|
|
37
|
-
import { useDocumentScrollToggle } from '../_common/utils';
|
|
37
|
+
import { useDocumentScrollToggle, useOnClickOutside } from '../_common/utils';
|
|
38
38
|
const getOffsetTop = (rect, vertical) => {
|
|
39
39
|
let offset = 0;
|
|
40
40
|
if (vertical === 'bottom') {
|
|
@@ -53,10 +53,15 @@ const getOffsetLeft = (rect, horizontal) => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
export const Popover = forwardRef(function Popover(_a, ref) {
|
|
56
|
-
var { as = 'div', children, open, anchorEl, onClose, anchorOrigin = { vertical: 'bottom', horizontal: 'left' }, transformOrigin = { vertical: 'top', horizontal: 'left' }, className, nested = false } = _a, rest = __rest(_a, ["as", "children", "open", "anchorEl", "onClose", "anchorOrigin", "transformOrigin", "className", "nested"]);
|
|
56
|
+
var { as = 'div', children, open, anchorEl, onClose, anchorOrigin = { vertical: 'bottom', horizontal: 'left' }, transformOrigin = { vertical: 'top', horizontal: 'left' }, className, disableBackdrop = false, nested = false } = _a, rest = __rest(_a, ["as", "children", "open", "anchorEl", "onClose", "anchorOrigin", "transformOrigin", "className", "disableBackdrop", "nested"]);
|
|
57
57
|
const Component = as;
|
|
58
|
-
const popoverRef = useRef();
|
|
58
|
+
const popoverRef = useRef(null);
|
|
59
59
|
const toggleScrollbar = useDocumentScrollToggle();
|
|
60
|
+
useOnClickOutside(popoverRef, (event) => {
|
|
61
|
+
disableBackdrop
|
|
62
|
+
? onClose && onClose(event)
|
|
63
|
+
: null;
|
|
64
|
+
});
|
|
60
65
|
// Override ref to map to internal ref
|
|
61
66
|
useImperativeHandle(ref, () => {
|
|
62
67
|
const popover = popoverRef.current;
|
|
@@ -180,6 +185,8 @@ export const Popover = forwardRef(function Popover(_a, ref) {
|
|
|
180
185
|
return null;
|
|
181
186
|
}
|
|
182
187
|
const classes = classnames('ndl-popover', base, className);
|
|
183
|
-
return (_jsxs(Portal, { children: [_jsx("div", { className:
|
|
188
|
+
return (_jsxs(Portal, { children: [_jsx("div", { className: classnames('ndl-popover-backdrop', {
|
|
189
|
+
'allow-click-event-captured': disableBackdrop,
|
|
190
|
+
}), role: "button", tabIndex: 0, onClick: handleBackdropClick, onKeyDown: handleBackdropClick, "data-testid": "popover-backdrop" }), _jsx(Component, Object.assign({ tabIndex: -1 }, rest, { className: classes, ref: popoverRef, "data-testid": "popover-content" }, { children: children }))] }));
|
|
184
191
|
});
|
|
185
192
|
//# sourceMappingURL=Popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/popover/Popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAc,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/popover/Popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAc,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAiB9E,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,QAAkB,EAAE,EAAE;IACzD,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,IAAI,QAAQ,KAAK,QAAQ,EAAE;QACzB,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;KACtB;IAED,OAAO,MAAM,CAAC;AAChB,CA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AC;QAEvB,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAE3D,OAAO,CACL,MAAC,MAAM,eAEL,cACE,SAAS,EAAE,UAAU,CAAC,sBAAsB,EAAE;oBAC5C,4BAA4B,EAAE,eAAe;iBAC9C,CAAC,EACF,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,mBAAmB,iBAClB,kBAAkB,GAC9B,EACF,KAAC,SAAS,kBACR,QAAQ,EAAE,CAAC,CAAC,IACR,IAAI,IACR,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,UAAU,iBACH,iBAAiB,gBAE5B,QAAQ,IACC,IACL,CACV,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -33,6 +33,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
import React from 'react';
|
|
34
34
|
import classNames from 'classnames';
|
|
35
35
|
import { HeroIcon } from '../icons';
|
|
36
|
+
import { needleWarningMessage } from '../_common/utils';
|
|
36
37
|
/**
|
|
37
38
|
*
|
|
38
39
|
*
|
|
@@ -58,9 +59,14 @@ const TextInput = React.forwardRef(function TextInput(props, ref) {
|
|
|
58
59
|
'has-right-icon': rightIcon || errorText,
|
|
59
60
|
'has-icon': leftIcon || rightIcon || errorText,
|
|
60
61
|
});
|
|
62
|
+
const hasEmptyLabelValue = !label || label === '';
|
|
61
63
|
const labelWrappingClass = classNames(`form-item-label`, {
|
|
62
64
|
fluid,
|
|
65
|
+
'form-item-no-label': hasEmptyLabelValue,
|
|
63
66
|
});
|
|
67
|
+
if (label && !props['aria-label']) {
|
|
68
|
+
needleWarningMessage('TextInput does not have an aria label, be sure to include an aria label for screen readers link: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI');
|
|
69
|
+
}
|
|
64
70
|
return (_jsxs("div", Object.assign({ className: containerWrappingClass }, { children: [_jsxs("label", Object.assign({ className: labelWrappingClass }, { children: [_jsxs("div", Object.assign({ className: "input-wrapper" }, { children: [leftIcon && _jsx("div", Object.assign({ className: "icon left-icon" }, { children: leftIcon })), _jsx("input", Object.assign({}, otherInputProps, { type: type, ref: ref })), rightIcon && !errorText && (_jsx("div", Object.assign({ className: "icon right-icon" }, { children: rightIcon }))), errorText && (_jsx("div", Object.assign({ className: "icon right-icon error-icon" }, { children: _jsx(HeroIcon, { iconName: "ExclamationCircleIcon", type: "solid" }) })))] })), _jsx("span", Object.assign({ className: "form-label-text" }, { children: label }))] })), (errorText || helpText) && (_jsx("div", Object.assign({ className: "form-msg" }, { children: errorText || helpText })))] })));
|
|
65
71
|
});
|
|
66
72
|
export default TextInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../src/text-input/TextInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../src/text-input/TextInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAyBxD;;;;;;GAMG;AAEH,qCAAqC;AAErC;;;;;;GAMG;AAE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,EAAC,4BAA4B,gBACzC,KAAC,QAAQ,IAAC,QAAQ,EAAC,uBAAuB,EAAC,IAAI,EAAC,OAAO,GAAG,IACtD,CACP,KACG,EAEN,6BAAM,SAAS,EAAC,iBAAiB,gBAAE,KAAK,IAAQ,KAC1C,EACP,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,CAC1B,4BAAK,SAAS,EAAC,UAAU,gBAAE,SAAS,IAAI,QAAQ,IAAO,CACxD,KACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* You should have received a copy of the GNU General Public License
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
+
/// <reference types="react" />
|
|
21
22
|
export declare const removeNewlines: (input: string) => string;
|
|
22
23
|
/** Remove extra spaces from sting */
|
|
23
24
|
export declare const removeSpaces: (input: string) => string;
|
|
@@ -27,6 +28,13 @@ export declare const needleWarningMessage: (message: string) => void;
|
|
|
27
28
|
* Useful for disabling scroll when a popup is open (ie ContextMenu/Modal)
|
|
28
29
|
*/
|
|
29
30
|
export declare const useDocumentScrollToggle: () => (disable: boolean, doc?: Document) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Detect if there is a click event outside
|
|
33
|
+
* of the provided element
|
|
34
|
+
* Source:
|
|
35
|
+
* https://hashnode.com/post/useonclickoutside-custom-hook-to-detect-the-mouse-click-on-outside-typescript-ckrejmy3h0k5r91s18iu42t28
|
|
36
|
+
*/
|
|
37
|
+
export declare const useOnClickOutside: <T extends HTMLElement = HTMLElement>(ref: import("react").RefObject<T>, handler: (event: MouseEvent | TouchEvent) => void) => void;
|
|
30
38
|
/**
|
|
31
39
|
* X - char long pseudo-random string
|
|
32
40
|
*/
|
|
@@ -22,13 +22,13 @@ import React from 'react';
|
|
|
22
22
|
import { IconButtonProps } from '../button';
|
|
23
23
|
import { ElementBase } from '../helpers';
|
|
24
24
|
import { LanguageProp } from './languages';
|
|
25
|
-
export interface
|
|
25
|
+
export interface CodeBlockProps extends ElementBase<HTMLDivElement> {
|
|
26
26
|
code: string;
|
|
27
27
|
language: LanguageProp | 'text';
|
|
28
28
|
showLineNumbers?: boolean;
|
|
29
29
|
theme?: 'vs' | 'base16-ateliersulphurpool.light' | 'coy' | 'duotone-light' | 'ghcolors' | 'prism' | 'solarizedlight';
|
|
30
|
-
|
|
30
|
+
headerTitle?: string | JSX.Element;
|
|
31
31
|
actions?: IconButtonProps[];
|
|
32
32
|
disabled?: boolean;
|
|
33
33
|
}
|
|
34
|
-
export declare const CodeBlock: React.ForwardRefExoticComponent<
|
|
34
|
+
export declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockProps & React.RefAttributes<unknown>>;
|
|
@@ -35,7 +35,7 @@ export interface ContextMenuProps extends PopoverProps {
|
|
|
35
35
|
/** The minimum width of the menu */
|
|
36
36
|
minWidth?: number;
|
|
37
37
|
}
|
|
38
|
-
export declare const Menu: React.ForwardRefExoticComponent<Pick<ContextMenuProps, "size" | "className" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "list" | "children" | "role" | "as" | "selected" | "onChange" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "onClose" | "anchorEl" | "anchorOrigin" | "transformOrigin" | "nested" | "menuSize" | "minWidth"> & React.RefAttributes<unknown>>;
|
|
38
|
+
export declare const Menu: React.ForwardRefExoticComponent<Pick<ContextMenuProps, "size" | "className" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "list" | "children" | "role" | "as" | "selected" | "onChange" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "onClose" | "anchorEl" | "anchorOrigin" | "transformOrigin" | "disableBackdrop" | "nested" | "menuSize" | "minWidth"> & React.RefAttributes<unknown>>;
|
|
39
39
|
interface MenuItemsProps extends ElementBase {
|
|
40
40
|
children: React.ReactNode | string;
|
|
41
41
|
/** Additional classes */
|
|
@@ -67,6 +67,8 @@ export interface PopoverProps extends ElementBase {
|
|
|
67
67
|
className?: string;
|
|
68
68
|
/** Whether or not the menu is nested. IE is this menu a sub menu */
|
|
69
69
|
nested?: boolean;
|
|
70
|
+
/** Disable backdrop - Allows event capturing - and pointer events to pass to elements below */
|
|
71
|
+
disableBackdrop?: boolean;
|
|
70
72
|
}
|
|
71
|
-
export declare const Popover: React.ForwardRefExoticComponent<Pick<PopoverProps, "size" | "className" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "list" | "children" | "role" | "as" | "selected" | "onChange" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "onClose" | "anchorEl" | "anchorOrigin" | "transformOrigin" | "nested"> & React.RefAttributes<unknown>>;
|
|
73
|
+
export declare const Popover: React.ForwardRefExoticComponent<Pick<PopoverProps, "size" | "className" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "list" | "children" | "role" | "as" | "selected" | "onChange" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "onClose" | "anchorEl" | "anchorOrigin" | "transformOrigin" | "disableBackdrop" | "nested"> & React.RefAttributes<unknown>>;
|
|
72
74
|
export {};
|
|
@@ -22,7 +22,7 @@ import React from 'react';
|
|
|
22
22
|
import { CommonInputProps } from '../_common/input/types';
|
|
23
23
|
export interface TextInputProperties extends CommonInputProps {
|
|
24
24
|
/** Label text */
|
|
25
|
-
label
|
|
25
|
+
label?: string;
|
|
26
26
|
/** Help message */
|
|
27
27
|
helpText?: string;
|
|
28
28
|
/** Error message */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "React implementation of Neo4j Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"button",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@heroicons/react": "^1.0.5",
|
|
72
|
-
"@neo4j-ndl/base": "^0.8.
|
|
72
|
+
"@neo4j-ndl/base": "^0.8.4",
|
|
73
73
|
"classnames": "^2.3.1",
|
|
74
74
|
"detect-browser": "^5.3.0",
|
|
75
75
|
"react-dropzone": "^14.0.0",
|