@neo4j-ndl/react 3.2.5 → 3.2.7
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/lib/cjs/data-grid/Components.js +21 -8
- package/lib/cjs/data-grid/Components.js.map +1 -1
- package/lib/cjs/data-grid/DataGrid.js +7 -2
- package/lib/cjs/data-grid/DataGrid.js.map +1 -1
- package/lib/cjs/icons/generated/custom/DatagridNodata.js +27 -0
- package/lib/cjs/icons/generated/custom/DatagridNodata.js.map +1 -0
- package/lib/cjs/icons/generated/custom/index.js +3 -1
- package/lib/cjs/icons/generated/custom/index.js.map +1 -1
- package/lib/cjs/spotlight/Spotlight.js +9 -11
- package/lib/cjs/spotlight/Spotlight.js.map +1 -1
- package/lib/cjs/spotlight/SpotlightProvider.js +18 -1
- package/lib/cjs/spotlight/SpotlightProvider.js.map +1 -1
- package/lib/cjs/spotlight/SpotlightTarget.js +62 -22
- package/lib/cjs/spotlight/SpotlightTarget.js.map +1 -1
- package/lib/cjs/spotlight/use-indicator.js +108 -0
- package/lib/cjs/spotlight/use-indicator.js.map +1 -0
- package/lib/esm/data-grid/Components.js +22 -10
- package/lib/esm/data-grid/Components.js.map +1 -1
- package/lib/esm/data-grid/DataGrid.js +8 -3
- package/lib/esm/data-grid/DataGrid.js.map +1 -1
- package/lib/esm/icons/generated/custom/DatagridNodata.js +25 -0
- package/lib/esm/icons/generated/custom/DatagridNodata.js.map +1 -0
- package/lib/esm/icons/generated/custom/index.js +1 -0
- package/lib/esm/icons/generated/custom/index.js.map +1 -1
- package/lib/esm/spotlight/Spotlight.js +10 -12
- package/lib/esm/spotlight/Spotlight.js.map +1 -1
- package/lib/esm/spotlight/SpotlightProvider.js +18 -1
- package/lib/esm/spotlight/SpotlightProvider.js.map +1 -1
- package/lib/esm/spotlight/SpotlightTarget.js +40 -23
- package/lib/esm/spotlight/SpotlightTarget.js.map +1 -1
- package/lib/esm/spotlight/use-indicator.js +102 -0
- package/lib/esm/spotlight/use-indicator.js.map +1 -0
- package/lib/types/data-grid/Components.d.ts +2 -1
- package/lib/types/data-grid/DataGrid.d.ts +3 -0
- package/lib/types/icons/generated/custom/DatagridNodata.d.ts +23 -0
- package/lib/types/icons/generated/custom/index.d.ts +1 -0
- package/lib/types/spotlight/Spotlight.d.ts +37 -5
- package/lib/types/spotlight/SpotlightProvider.d.ts +3 -0
- package/lib/types/spotlight/SpotlightTarget.d.ts +7 -1
- package/lib/types/spotlight/use-indicator.d.ts +38 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) "Neo4j"
|
|
@@ -19,34 +19,51 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
19
19
|
* You should have received a copy of the GNU General Public License
|
|
20
20
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
21
|
*/
|
|
22
|
-
import React from 'react';
|
|
22
|
+
import React, { useEffect } from 'react';
|
|
23
23
|
import { useSpotlightContext } from './SpotlightProvider';
|
|
24
24
|
import classNames from 'classnames';
|
|
25
25
|
import ConditionalWrap from '../_common/ConditionalWrap';
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
import { useIndicator, } from './use-indicator';
|
|
27
|
+
import { FloatingPortal, useMergeRefs } from '@floating-ui/react';
|
|
28
|
+
export const SpotlightTarget = React.forwardRef(function SpotlightTarget({ id, hasPulse = true, indicatorVariant = 'border', indicatorPlacement = 'top-right', backgroundColor, borderRadius, hasAnchorPortal, children, className, htmlAttributes, }, ref) {
|
|
29
|
+
const { isActiveSpotlight, isOpen, setIsOpen, registerTarget, unregisterTarget, } = useSpotlightContext();
|
|
30
|
+
const internalRef = React.useRef(null);
|
|
31
|
+
const mergedRefs = useMergeRefs([ref, internalRef]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (internalRef.current)
|
|
34
|
+
registerTarget(id, internalRef);
|
|
35
|
+
return () => unregisterTarget(id);
|
|
36
|
+
}, [id, registerTarget, unregisterTarget]);
|
|
28
37
|
const classes = classNames('ndl-spotlight-target', {
|
|
29
|
-
'ndl-spotlight-target-pulse': hasPulse,
|
|
30
38
|
'ndl-spotlight-target-open': isOpen,
|
|
31
39
|
}, className);
|
|
32
40
|
const isActive = isActiveSpotlight(id);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
const indicator = useIndicator({
|
|
42
|
+
isOpen: isActive,
|
|
43
|
+
indicatorVariant,
|
|
44
|
+
indicatorPlacement,
|
|
45
|
+
targetRef: internalRef,
|
|
46
|
+
hasPulse,
|
|
47
|
+
hasAnchorPortal,
|
|
48
|
+
});
|
|
49
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ role: isActive ? 'button' : undefined, id: id, ref: mergedRefs, className: classes, onClick: (e) => {
|
|
50
|
+
if (isActive && !isOpen) {
|
|
51
|
+
setIsOpen(true);
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
}
|
|
54
|
+
}, style: { backgroundColor, borderRadius }, onKeyDown: (e) => {
|
|
55
|
+
if (isActive &&
|
|
56
|
+
!isOpen &&
|
|
57
|
+
(e.code === 'Enter' || e.code === 'Space')) {
|
|
58
|
+
setIsOpen(true);
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
}
|
|
61
|
+
}, tabIndex: isActive ? 0 : -1, "aria-label": "spotlight target" }, htmlAttributes, { children: _jsx(ConditionalWrap, { shouldWrap: isActive,
|
|
62
|
+
// TODO v4: inert should be fixed in react 19? https://github.com/facebook/react/pull/24730#event-12109747640. inert="" is a workaround for now
|
|
63
|
+
wrap: (children) => (
|
|
64
|
+
/* @ts-expect-error inert not allowed */
|
|
65
|
+
_jsx("div", { inert: "", "aria-disabled": true, className: "ndl-spotlight-target-inert", children: children })), children: children }) })), _jsx(FloatingPortal, { root: indicator.hasAnchorPortal
|
|
66
|
+
? indicator.context.refs.reference.current
|
|
67
|
+
: null, children: indicator.context.open && (_jsx("div", Object.assign({ className: indicator.indicatorClasses, ref: indicator.context.refs.setFloating, style: Object.assign(Object.assign({}, indicator.floatingStyles), indicator.style) }, indicator.getFloatingProps()))) })] }));
|
|
51
68
|
});
|
|
52
69
|
//# sourceMappingURL=SpotlightTarget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotlightTarget.js","sourceRoot":"","sources":["../../../src/spotlight/SpotlightTarget.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SpotlightTarget.js","sourceRoot":"","sources":["../../../src/spotlight/SpotlightTarget.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,UAAU,MAAM,YAAY,CAAC;AAMpC,OAAO,eAAe,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAGL,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAqBlE,MAAM,CAAC,MAAM,eAAe,GAGxB,KAAK,CAAC,UAAU,CAAC,SAAS,eAAe,CAG3C,EACE,EAAE,EACF,QAAQ,GAAG,IAAI,EACf,gBAAgB,GAAG,QAAQ,EAC3B,kBAAkB,GAAG,WAAW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4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
import { autoUpdate, offset, useFloating, useInteractions, useRole, } from '@floating-ui/react';
|
|
22
|
+
import classNames from 'classnames';
|
|
23
|
+
import { useMemo } from 'react';
|
|
24
|
+
const crossAxisMult = {
|
|
25
|
+
left: -1,
|
|
26
|
+
middle: 0,
|
|
27
|
+
right: 1,
|
|
28
|
+
};
|
|
29
|
+
const calcOffset = (variant, placement, rects) => {
|
|
30
|
+
if (variant === 'border') {
|
|
31
|
+
// Border variant is always centered around the middle point
|
|
32
|
+
return {
|
|
33
|
+
mainAxis: -rects.reference.height / 2 - rects.floating.height / 2,
|
|
34
|
+
crossAxis: 0,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const [mainAxisPlacement, crossAxisPlacement] = placement.split('-');
|
|
38
|
+
/** Note for future reference:
|
|
39
|
+
* Main axis (vertical) is zero at the bottom border of the target.
|
|
40
|
+
* Cross axis (horizontal) is zero at the middle of the target
|
|
41
|
+
* */
|
|
42
|
+
let mainAxis = 0;
|
|
43
|
+
if (mainAxisPlacement === 'bottom') {
|
|
44
|
+
// put the indicator one height of the point above the bottom border of the target
|
|
45
|
+
mainAxis = -2 * rects.floating.height;
|
|
46
|
+
}
|
|
47
|
+
else if (mainAxisPlacement === 'middle') {
|
|
48
|
+
// put the indicator in the middle of the target
|
|
49
|
+
mainAxis = -rects.reference.height / 2 - rects.floating.height / 2;
|
|
50
|
+
}
|
|
51
|
+
else if (mainAxisPlacement === 'top') {
|
|
52
|
+
// put the indicator one height of the point below the top border of the target
|
|
53
|
+
mainAxis = -rects.reference.height + rects.floating.height;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
mainAxis,
|
|
57
|
+
crossAxis: crossAxisMult[crossAxisPlacement] *
|
|
58
|
+
(rects.reference.width / 2 - rects.floating.width * 1.5),
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export function useIndicator({ isOpen, indicatorVariant = 'border', indicatorPlacement = 'top-right', targetRef, hasPulse = true, hasAnchorPortal, }) {
|
|
62
|
+
const data = useFloating({
|
|
63
|
+
open: isOpen,
|
|
64
|
+
placement: 'bottom',
|
|
65
|
+
middleware: [
|
|
66
|
+
offset(({ rects }) => calcOffset(indicatorVariant, indicatorPlacement, rects)),
|
|
67
|
+
],
|
|
68
|
+
whileElementsMounted: autoUpdate,
|
|
69
|
+
elements: {
|
|
70
|
+
reference: targetRef === null || targetRef === void 0 ? void 0 : targetRef.current,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
const context = data.context;
|
|
74
|
+
const role = useRole(context);
|
|
75
|
+
const interactions = useInteractions([role]);
|
|
76
|
+
return useMemo(() => {
|
|
77
|
+
var _a, _b, _c;
|
|
78
|
+
return (Object.assign(Object.assign(Object.assign({}, interactions), data), { style: {
|
|
79
|
+
width: indicatorVariant === 'border'
|
|
80
|
+
? `${((_a = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0}px`
|
|
81
|
+
: '8px',
|
|
82
|
+
height: indicatorVariant === 'border'
|
|
83
|
+
? `${((_b = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0}px`
|
|
84
|
+
: '8px',
|
|
85
|
+
borderRadius: indicatorVariant === 'border'
|
|
86
|
+
? `${((_c = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) === null || _c === void 0 ? void 0 : _c.style.borderRadius) || 0}`
|
|
87
|
+
: '50%',
|
|
88
|
+
}, indicatorClasses: classNames('ndl-spotlight-target-open', {
|
|
89
|
+
'ndl-spotlight-target-indicator-border': indicatorVariant === 'border',
|
|
90
|
+
'ndl-spotlight-target-indicator-point': indicatorVariant === 'point',
|
|
91
|
+
'ndl-spotlight-target-pulse': hasPulse,
|
|
92
|
+
}), hasAnchorPortal }));
|
|
93
|
+
}, [
|
|
94
|
+
interactions,
|
|
95
|
+
data,
|
|
96
|
+
indicatorVariant,
|
|
97
|
+
targetRef,
|
|
98
|
+
hasPulse,
|
|
99
|
+
hasAnchorPortal,
|
|
100
|
+
]);
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=use-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-indicator.js","sourceRoot":"","sources":["../../../src/spotlight/use-indicator.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EAEV,MAAM,EACN,WAAW,EACX,eAAe,EAEf,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAgChC,MAAM,aAAa,GAA2B;IAC5C,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;CACT,CAAC;AAEF,MAAM,UAAU,GAAG,CACjB,OAAyB,EACzB,SAA6B,EAC7B,KAAmB,EACnB,EAAE;IACF,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,4DAA4D;QAC5D,OAAO;YACL,QAA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OAAO;gBACpE,4BAA4B,EAAE,QAAQ;aACvC,CAAC,EACF,eAAe,IACf,CAAA;KAAA,EACF;QACE,YAAY;QACZ,IAAI;QACJ,gBAAgB;QAChB,SAAS;QACT,QAAQ;QACR,eAAe;KAChB,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -116,4 +116,5 @@ export interface DropDownCellProps<T extends RowData> {
|
|
|
116
116
|
portalTarget?: HTMLElement;
|
|
117
117
|
}
|
|
118
118
|
declare const DropDownCell: <T extends RowData>({ cell, options, portalTarget, }: DropDownCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
|
|
119
|
-
|
|
119
|
+
declare const NoDataIcon: import("react").ForwardRefExoticComponent<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
120
|
+
export { ResizingBar, Header, Body, BodyCell, BodyRow, InlineEditCell, DropDownCell, RowActionCell, HeaderCell, HeaderTitle, Navigation, TableResults, RowsPerPage, Pagination, PaginationNumericButtons, PaginationArrowButton, PaginationNumericButton, NoDataPlaceholder, NoDataIllustration, NoDataIcon, LoadingPlaceholder, Scrollable, };
|
|
@@ -44,13 +44,16 @@ export declare const DataGridComponents: {
|
|
|
44
44
|
PaginationArrowButton: ({ action, children, innerProps, }: import("./Components").PaginationArrowButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
45
|
LoadingPlaceholder: ({ children, innerProps, }: import("./Components").CommonInnerProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
46
46
|
NoDataPlaceholder: ({ children, innerProps, }: import("./Components").CommonInnerProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
/** @deprecated use NoDataIcon instead */
|
|
47
48
|
NoDataIllustration: (props: import("react").SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
NoDataIcon: import("react").ForwardRefExoticComponent<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
48
50
|
NoDataPlaceholderContentWrapper: ({ children, innerProps, }: import("./Components").CommonInnerProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
49
51
|
Scrollable: ({ children, innerProps }: import("./Components").CommonInnerProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
52
|
};
|
|
51
53
|
declare enum BorderStyleEnum {
|
|
52
54
|
AllSides = "all-sides",
|
|
53
55
|
Horizontal = "horizontal",
|
|
56
|
+
Vertical = "vertical",
|
|
54
57
|
None = "none"
|
|
55
58
|
}
|
|
56
59
|
export type BorderStyle = `${BorderStyleEnum}`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
import { type SVGProps } from 'react';
|
|
22
|
+
declare const SvgDatagridNodata: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default SvgDatagridNodata;
|
|
@@ -74,3 +74,4 @@ export { default as TextIcon } from './Text';
|
|
|
74
74
|
export { default as TriangleIcon } from './Triangle';
|
|
75
75
|
export { default as UnderlineIcon } from './Underline';
|
|
76
76
|
export { default as VisualizeBloomIcon } from './VisualizeBloom';
|
|
77
|
+
export { default as DatagridNodataIcon } from './DatagridNodata';
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import React from 'react';
|
|
22
22
|
import { HtmlAttributes, PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '../_common/types';
|
|
23
|
+
import { PopoverProps } from '../popover';
|
|
23
24
|
import { EventTypeLabelProps } from '../label';
|
|
24
25
|
export type SpotlightActionsProps = {
|
|
25
26
|
label: string;
|
|
@@ -61,17 +62,48 @@ export type SpotlightProps = {
|
|
|
61
62
|
actions?: React.ComponentProps<typeof SpotlightActions>[];
|
|
62
63
|
/** Left bottom corner content */
|
|
63
64
|
beforeActions?: React.ReactNode;
|
|
64
|
-
/**
|
|
65
|
-
initialFocus?: number | React.MutableRefObject<HTMLElement | null>;
|
|
65
|
+
/** Callback function called when Esc is pressed or on mouse click outside of the Spotlight*/
|
|
66
66
|
onClose?: (action: SpotlightCloseAction) => void;
|
|
67
|
+
/** Use anchorEl for portal's container. Should be used if the spotlight is inside an Dialog or Modal */
|
|
68
|
+
hasAnchorPortal?: boolean;
|
|
67
69
|
children?: React.ReactNode;
|
|
68
70
|
className?: string;
|
|
69
71
|
style?: React.CSSProperties;
|
|
70
72
|
htmlAttributes?: HtmlAttributes<'div'>;
|
|
71
|
-
}
|
|
72
|
-
declare const Spotlight: Omit<React.ForwardRefExoticComponent<
|
|
73
|
+
} & Pick<PopoverProps, 'placement' | 'initialFocus'>;
|
|
74
|
+
declare const Spotlight: Omit<React.ForwardRefExoticComponent<{
|
|
75
|
+
/** Id of the SpotlightTarget where the spotlight should be rendered */
|
|
76
|
+
target: string;
|
|
77
|
+
/** Action buttons in the footer */
|
|
78
|
+
actions?: React.ComponentProps<typeof SpotlightActions>[];
|
|
79
|
+
/** Left bottom corner content */
|
|
80
|
+
beforeActions?: React.ReactNode;
|
|
81
|
+
/** Callback function called when Esc is pressed or on mouse click outside of the Spotlight*/
|
|
82
|
+
onClose?: (action: SpotlightCloseAction) => void;
|
|
83
|
+
/** Use anchorEl for portal's container. Should be used if the spotlight is inside an Dialog or Modal */
|
|
84
|
+
hasAnchorPortal?: boolean;
|
|
85
|
+
children?: React.ReactNode;
|
|
86
|
+
className?: string;
|
|
87
|
+
style?: React.CSSProperties;
|
|
88
|
+
htmlAttributes?: HtmlAttributes<"div">;
|
|
89
|
+
} & Pick<PopoverProps, "placement" | "initialFocus"> & {
|
|
73
90
|
[key: string]: unknown;
|
|
74
|
-
}>, "$$typeof"> & Omit<React.ExoticComponent<
|
|
91
|
+
}>, "$$typeof"> & Omit<React.ExoticComponent<{
|
|
92
|
+
/** Id of the SpotlightTarget where the spotlight should be rendered */
|
|
93
|
+
target: string;
|
|
94
|
+
/** Action buttons in the footer */
|
|
95
|
+
actions?: React.ComponentProps<typeof SpotlightActions>[];
|
|
96
|
+
/** Left bottom corner content */
|
|
97
|
+
beforeActions?: React.ReactNode;
|
|
98
|
+
/** Callback function called when Esc is pressed or on mouse click outside of the Spotlight*/
|
|
99
|
+
onClose?: (action: SpotlightCloseAction) => void;
|
|
100
|
+
/** Use anchorEl for portal's container. Should be used if the spotlight is inside an Dialog or Modal */
|
|
101
|
+
hasAnchorPortal?: boolean;
|
|
102
|
+
children?: React.ReactNode;
|
|
103
|
+
className?: string;
|
|
104
|
+
style?: React.CSSProperties;
|
|
105
|
+
htmlAttributes?: HtmlAttributes<"div">;
|
|
106
|
+
} & Pick<PopoverProps, "placement" | "initialFocus"> & {
|
|
75
107
|
[key: string]: unknown;
|
|
76
108
|
}>, never> & (<InstanceT extends React.ElementType = "div">(props: PolymorphicPropsWithRef<InstanceT, SpotlightProps>) => React.ReactElement | null) & {
|
|
77
109
|
Actions: PolymorphicForwardRefExoticComponent<"button", SpotlightActionsProps>;
|
|
@@ -29,6 +29,9 @@ type SpotlightContextType = {
|
|
|
29
29
|
isActiveSpotlight: (target: string) => boolean;
|
|
30
30
|
/** Sets the active spotlight to the provided target. Use null to clear active target */
|
|
31
31
|
setActiveSpotlight: (target: string | null) => void;
|
|
32
|
+
registerTarget: (id: string, ref: React.RefObject<HTMLElement>) => void;
|
|
33
|
+
unregisterTarget: (id: string) => void;
|
|
34
|
+
registeredTargets: Record<string, React.RefObject<HTMLElement>>;
|
|
32
35
|
};
|
|
33
36
|
export declare const useSpotlightContext: () => SpotlightContextType;
|
|
34
37
|
type SpotlightProviderProps = {
|
|
@@ -20,16 +20,22 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import React from 'react';
|
|
22
22
|
import { PolymorphicForwardRefExoticComponent } from '../_common/types';
|
|
23
|
+
import { IndicatorPlacement, IndicatorVariant } from './use-indicator';
|
|
23
24
|
type SpotlightTargetProps = {
|
|
24
25
|
/** id of the target. should match with target prop in Spotlight */
|
|
25
26
|
id: string;
|
|
26
27
|
/** if the target should have a pulse animation. default behaviour is true */
|
|
27
28
|
hasPulse?: boolean;
|
|
29
|
+
/** variant of the target indicator */
|
|
30
|
+
indicatorVariant?: IndicatorVariant;
|
|
31
|
+
/** placement of the indicator. only applicable to point variant */
|
|
32
|
+
indicatorPlacement?: IndicatorPlacement;
|
|
28
33
|
/** background color */
|
|
29
34
|
backgroundColor?: React.CSSProperties['backgroundColor'];
|
|
30
35
|
/** border radius */
|
|
31
36
|
borderRadius?: React.CSSProperties['borderRadius'];
|
|
32
|
-
/**
|
|
37
|
+
/** Use anchorEl for portal's container. Should be used if the spotlight target is inside an Dialog */
|
|
38
|
+
hasAnchorPortal?: boolean;
|
|
33
39
|
className?: string;
|
|
34
40
|
children?: React.ReactNode;
|
|
35
41
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
import { useFloating, UseInteractionsReturn } from '@floating-ui/react';
|
|
22
|
+
export type IndicatorVariant = 'border' | 'point';
|
|
23
|
+
interface IndicatorOptions {
|
|
24
|
+
isOpen: boolean;
|
|
25
|
+
indicatorVariant?: IndicatorVariant;
|
|
26
|
+
indicatorPlacement?: IndicatorPlacement;
|
|
27
|
+
targetRef: React.RefObject<HTMLElement>;
|
|
28
|
+
hasPulse?: boolean;
|
|
29
|
+
hasAnchorPortal?: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface UseIndicatorReturn extends UseInteractionsReturn, ReturnType<typeof useFloating> {
|
|
32
|
+
style: React.CSSProperties;
|
|
33
|
+
indicatorClasses?: string;
|
|
34
|
+
hasAnchorPortal?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export type IndicatorPlacement = 'top-left' | 'top-middle' | 'top-right' | 'bottom-left' | 'bottom-middle' | 'bottom-right' | 'middle-left' | 'middle-middle' | 'middle-right';
|
|
37
|
+
export declare function useIndicator({ isOpen, indicatorVariant, indicatorPlacement, targetRef, hasPulse, hasAnchorPortal, }: IndicatorOptions): UseIndicatorReturn;
|
|
38
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.7",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@tanstack/react-table": "8.20.5",
|
|
65
65
|
"react": ">=16.8.0",
|
|
66
66
|
"react-dom": ">=16.8.0",
|
|
67
|
-
"@neo4j-ndl/base": "^3.2.
|
|
67
|
+
"@neo4j-ndl/base": "^3.2.2"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@dnd-kit/core": "6.1.0",
|