@navikt/ds-react 0.14.7 → 0.14.8
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/cjs/help-text/HelpText.js +2 -2
- package/cjs/popover/Popover.js +2 -1
- package/esm/help-text/HelpText.d.ts +2 -7
- package/esm/help-text/HelpText.js +2 -2
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/popover/Popover.d.ts +6 -0
- package/esm/popover/Popover.js +2 -1
- package/esm/popover/Popover.js.map +1 -1
- package/package.json +2 -2
- package/src/help-text/HelpText.tsx +12 -9
- package/src/popover/Popover.tsx +8 -0
|
@@ -39,7 +39,7 @@ const react_1 = __importStar(require("react"));
|
|
|
39
39
|
const react_merge_refs_1 = __importDefault(require("react-merge-refs"));
|
|
40
40
|
const __1 = require("..");
|
|
41
41
|
const HelpText = (0, react_1.forwardRef)((_a, ref) => {
|
|
42
|
-
var { className, children, placement = "top", title = "hjelp" } = _a, rest = __rest(_a, ["className", "children", "placement", "title"]);
|
|
42
|
+
var { className, children, placement = "top", strategy = "absolute", title = "hjelp" } = _a, rest = __rest(_a, ["className", "children", "placement", "strategy", "title"]);
|
|
43
43
|
const buttonRef = (0, react_1.useRef)(null);
|
|
44
44
|
const mergedRef = (0, react_merge_refs_1.default)([buttonRef, ref]);
|
|
45
45
|
const popoverRef = (0, react_1.useRef)(null);
|
|
@@ -57,7 +57,7 @@ const HelpText = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
57
57
|
react_1.default.createElement("button", Object.assign({}, rest, { ref: mergedRef, onClick: (e) => handleClick(e), className: (0, classnames_1.default)(className, "navds-help-text__button"), type: "button", "aria-expanded": open, "aria-haspopup": "dialog", title: title }),
|
|
58
58
|
react_1.default.createElement(ds_icons_1.Helptext, { className: "navds-help-text__icon" }),
|
|
59
59
|
react_1.default.createElement("span", { className: "navds-sr-only" }, title)),
|
|
60
|
-
react_1.default.createElement(__1.Popover, { ref: popoverRef, onClose: () => setOpen(false), className: "navds-help-text__popover", open: open, role: "tooltip", anchorEl: buttonRef.current, placement: placement },
|
|
60
|
+
react_1.default.createElement(__1.Popover, { ref: popoverRef, onClose: () => setOpen(false), className: "navds-help-text__popover", open: open, role: "tooltip", anchorEl: buttonRef.current, placement: placement, strategy: strategy },
|
|
61
61
|
react_1.default.createElement(__1.Popover.Content, null, children))));
|
|
62
62
|
});
|
|
63
63
|
exports.default = HelpText;
|
package/cjs/popover/Popover.js
CHANGED
|
@@ -46,7 +46,7 @@ const useEventLister = (event, callback) => (0, react_1.useEffect)(() => {
|
|
|
46
46
|
};
|
|
47
47
|
}, [event, callback]);
|
|
48
48
|
const Popover = (0, react_1.forwardRef)((_a, ref) => {
|
|
49
|
-
var { className, children, anchorEl, arrow = true, open, onClose, placement = "right", offset } = _a, rest = __rest(_a, ["className", "children", "anchorEl", "arrow", "open", "onClose", "placement", "offset"]);
|
|
49
|
+
var { className, children, anchorEl, arrow = true, open, onClose, placement = "right", offset, strategy = "absolute" } = _a, rest = __rest(_a, ["className", "children", "anchorEl", "arrow", "open", "onClose", "placement", "offset", "strategy"]);
|
|
50
50
|
const popoverRef = (0, react_1.useRef)(null);
|
|
51
51
|
const mergedRef = (0, react_merge_refs_1.default)([popoverRef, ref]);
|
|
52
52
|
const close = (0, react_1.useCallback)(() => open && onClose(), [open, onClose]);
|
|
@@ -77,6 +77,7 @@ const Popover = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
79
|
],
|
|
80
|
+
strategy,
|
|
80
81
|
});
|
|
81
82
|
(0, __1.useClientLayoutEffect)(() => {
|
|
82
83
|
open && update && update();
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { Placement } from "@popperjs/core";
|
|
2
1
|
import React from "react";
|
|
3
|
-
|
|
2
|
+
import { PopoverProps } from "..";
|
|
3
|
+
export interface HelpTextProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, Pick<PopoverProps, "strategy" | "placement"> {
|
|
4
4
|
/**
|
|
5
5
|
* Component content
|
|
6
6
|
*/
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* Placement of popover
|
|
10
|
-
* @default "top"
|
|
11
|
-
*/
|
|
12
|
-
placement?: Placement;
|
|
13
8
|
}
|
|
14
9
|
declare const HelpText: React.ForwardRefExoticComponent<HelpTextProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
10
|
export default HelpText;
|
|
@@ -15,7 +15,7 @@ import React, { forwardRef, useEffect, useRef, useState } from "react";
|
|
|
15
15
|
import mergeRefs from "react-merge-refs";
|
|
16
16
|
import { Popover } from "..";
|
|
17
17
|
const HelpText = forwardRef((_a, ref) => {
|
|
18
|
-
var { className, children, placement = "top", title = "hjelp" } = _a, rest = __rest(_a, ["className", "children", "placement", "title"]);
|
|
18
|
+
var { className, children, placement = "top", strategy = "absolute", title = "hjelp" } = _a, rest = __rest(_a, ["className", "children", "placement", "strategy", "title"]);
|
|
19
19
|
const buttonRef = useRef(null);
|
|
20
20
|
const mergedRef = mergeRefs([buttonRef, ref]);
|
|
21
21
|
const popoverRef = useRef(null);
|
|
@@ -33,7 +33,7 @@ const HelpText = forwardRef((_a, ref) => {
|
|
|
33
33
|
React.createElement("button", Object.assign({}, rest, { ref: mergedRef, onClick: (e) => handleClick(e), className: cl(className, "navds-help-text__button"), type: "button", "aria-expanded": open, "aria-haspopup": "dialog", title: title }),
|
|
34
34
|
React.createElement(HelpTextIcon, { className: "navds-help-text__icon" }),
|
|
35
35
|
React.createElement("span", { className: "navds-sr-only" }, title)),
|
|
36
|
-
React.createElement(Popover, { ref: popoverRef, onClose: () => setOpen(false), className: "navds-help-text__popover", open: open, role: "tooltip", anchorEl: buttonRef.current, placement: placement },
|
|
36
|
+
React.createElement(Popover, { ref: popoverRef, onClose: () => setOpen(false), className: "navds-help-text__popover", open: open, role: "tooltip", anchorEl: buttonRef.current, placement: placement, strategy: strategy },
|
|
37
37
|
React.createElement(Popover.Content, null, children))));
|
|
38
38
|
});
|
|
39
39
|
export default HelpText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpText.js","sourceRoot":"","sources":["../../src/help-text/HelpText.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"HelpText.js","sourceRoot":"","sources":["../../src/help-text/HelpText.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAgB,MAAM,IAAI,CAAC;AAW3C,MAAM,QAAQ,GAAG,UAAU,CACzB,CACE,EAOC,EACD,GAAG,EACH,EAAE;QATF,EACE,SAAS,EACT,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,UAAU,EACrB,KAAK,GAAG,OAAO,OAEhB,EADI,IAAI,cANT,2DAOC,CADQ;IAIT,MAAM,SAAS,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAEvD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExC,SAAS,CAAC,GAAG,EAAE;;QACb,IAAI,KAAI,MAAA,UAAU,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAA,C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offset?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Changes what CSS position property to use
|
|
38
|
+
* You want to use "fixed" if reference element is inside a fixed container, but popover is not
|
|
39
|
+
* @default "absolute"
|
|
40
|
+
*/
|
|
41
|
+
strategy?: "absolute" | "fixed";
|
|
36
42
|
}
|
|
37
43
|
interface PopoverComponent extends React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLDivElement>> {
|
|
38
44
|
Content: PopoverContentType;
|
package/esm/popover/Popover.js
CHANGED
|
@@ -22,7 +22,7 @@ const useEventLister = (event, callback) => useEffect(() => {
|
|
|
22
22
|
};
|
|
23
23
|
}, [event, callback]);
|
|
24
24
|
const Popover = forwardRef((_a, ref) => {
|
|
25
|
-
var { className, children, anchorEl, arrow = true, open, onClose, placement = "right", offset } = _a, rest = __rest(_a, ["className", "children", "anchorEl", "arrow", "open", "onClose", "placement", "offset"]);
|
|
25
|
+
var { className, children, anchorEl, arrow = true, open, onClose, placement = "right", offset, strategy = "absolute" } = _a, rest = __rest(_a, ["className", "children", "anchorEl", "arrow", "open", "onClose", "placement", "offset", "strategy"]);
|
|
26
26
|
const popoverRef = useRef(null);
|
|
27
27
|
const mergedRef = mergeRefs([popoverRef, ref]);
|
|
28
28
|
const close = useCallback(() => open && onClose(), [open, onClose]);
|
|
@@ -53,6 +53,7 @@ const Popover = forwardRef((_a, ref) => {
|
|
|
53
53
|
},
|
|
54
54
|
},
|
|
55
55
|
],
|
|
56
|
+
strategy,
|
|
56
57
|
});
|
|
57
58
|
useClientLayoutEffect(() => {
|
|
58
59
|
open && update && update();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../src/popover/Popover.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,EACZ,UAAU,EAEV,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;AACf,OAAO,S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M,EAAE,CAAC,CAAC,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBACxC;aACF;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE;oBACP,OAAO,EAAE,CAAC;iBACX;aACF;SACF;QACD,QAAQ;KACT,CACF,CAAC;IAEF,qBAAqB,CAAC,GAAG,EAAE;QACzB,IAAI,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;IAC7B,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,2CACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE;YACxC,uBAAuB,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ;SAC5C,CAAC,iBACW,CAAC,IAAI,IAAI,CAAC,QAAQ,EAC/B,QAAQ,EAAE,CAAC,CAAC,IACR,UAAU,CAAC,MAAM,EACjB,IAAI,IACR,KAAK,EAAE,MAAM,CAAC,MAAM;QAEnB,QAAQ;QACR,KAAK,IAAI,CACR,wDAEE,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,SAAS,EAAC,sBAAsB,GAChC,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACkB,CAAC;AAEtB,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC;AAEjC,eAAe,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NAV designsystem react components",
|
|
6
6
|
"author": "NAV Designsystem team",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"@types/react": "^17.0.30",
|
|
65
65
|
"react": "^17.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "327c92131ba1824da9d8a622f515d626b7b85e56"
|
|
68
68
|
}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { Helptext as HelpTextIcon } from "@navikt/ds-icons";
|
|
2
|
-
import { Placement } from "@popperjs/core";
|
|
3
2
|
import cl from "classnames";
|
|
4
3
|
import React, { forwardRef, useEffect, useRef, useState } from "react";
|
|
5
4
|
import mergeRefs from "react-merge-refs";
|
|
6
|
-
import { Popover } from "..";
|
|
5
|
+
import { Popover, PopoverProps } from "..";
|
|
7
6
|
|
|
8
7
|
export interface HelpTextProps
|
|
9
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement
|
|
8
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
9
|
+
Pick<PopoverProps, "strategy" | "placement"> {
|
|
10
10
|
/**
|
|
11
11
|
* Component content
|
|
12
12
|
*/
|
|
13
13
|
children: React.ReactNode;
|
|
14
|
-
/**
|
|
15
|
-
* Placement of popover
|
|
16
|
-
* @default "top"
|
|
17
|
-
*/
|
|
18
|
-
placement?: Placement;
|
|
19
14
|
}
|
|
20
15
|
|
|
21
16
|
const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(
|
|
22
17
|
(
|
|
23
|
-
{
|
|
18
|
+
{
|
|
19
|
+
className,
|
|
20
|
+
children,
|
|
21
|
+
placement = "top",
|
|
22
|
+
strategy = "absolute",
|
|
23
|
+
title = "hjelp",
|
|
24
|
+
...rest
|
|
25
|
+
},
|
|
24
26
|
ref
|
|
25
27
|
) => {
|
|
26
28
|
const buttonRef = useRef<HTMLButtonElement | null>(null);
|
|
@@ -64,6 +66,7 @@ const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(
|
|
|
64
66
|
role="tooltip"
|
|
65
67
|
anchorEl={buttonRef.current}
|
|
66
68
|
placement={placement}
|
|
69
|
+
strategy={strategy}
|
|
67
70
|
>
|
|
68
71
|
<Popover.Content>{children}</Popover.Content>
|
|
69
72
|
</Popover>
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -44,6 +44,12 @@ export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
44
44
|
* @default 16 w/arrow, 4 w/no-arrow
|
|
45
45
|
*/
|
|
46
46
|
offset?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Changes what CSS position property to use
|
|
49
|
+
* You want to use "fixed" if reference element is inside a fixed container, but popover is not
|
|
50
|
+
* @default "absolute"
|
|
51
|
+
*/
|
|
52
|
+
strategy?: "absolute" | "fixed";
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
const useEventLister = (event: string, callback) =>
|
|
@@ -72,6 +78,7 @@ const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
72
78
|
onClose,
|
|
73
79
|
placement = "right",
|
|
74
80
|
offset,
|
|
81
|
+
strategy = "absolute",
|
|
75
82
|
...rest
|
|
76
83
|
},
|
|
77
84
|
ref
|
|
@@ -137,6 +144,7 @@ const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
137
144
|
},
|
|
138
145
|
},
|
|
139
146
|
],
|
|
147
|
+
strategy,
|
|
140
148
|
}
|
|
141
149
|
);
|
|
142
150
|
|