@helsenorge/designsystem-react 11.3.0 → 12.0.0-beta.0
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 +15 -1
- package/DictionaryTrigger.js +28 -0
- package/DictionaryTrigger.js.map +1 -0
- package/HelpDetails.js +65 -0
- package/HelpDetails.js.map +1 -0
- package/HelpTriggerIcon.js +113 -0
- package/HelpTriggerIcon.js.map +1 -0
- package/HelpTriggerStandalone.js +37 -0
- package/HelpTriggerStandalone.js.map +1 -0
- package/HighlightPanel.js +5 -59
- package/HighlightPanel.js.map +1 -1
- package/PopOver.js +48 -175
- package/PopOver.js.map +1 -1
- package/components/DictionaryTrigger/index.js +1 -24
- package/components/DictionaryTrigger/index.js.map +1 -1
- package/components/HelpBubble/HelpBubble.d.ts +3 -6
- package/components/HelpBubble/index.js +55 -3
- package/components/HelpBubble/index.js.map +1 -1
- package/components/HelpBubble/styles.module.scss +5 -7
- package/components/HelpBubble/styles.module.scss.d.ts +0 -1
- package/components/HelpDetails/HelpDetails.d.ts +11 -0
- package/components/HelpDetails/styles.module.scss +49 -0
- package/components/HelpDetails/styles.module.scss.d.ts +13 -0
- package/components/HelpExpanderInline/HelpExpanderInline.d.ts +17 -0
- package/components/HelpExpanderInline/index.d.ts +3 -0
- package/components/HelpExpanderInline/index.js +16 -0
- package/components/HelpExpanderInline/index.js.map +1 -0
- package/components/HelpExpanderStandalone/HelpExpanderStandalone.d.ts +28 -0
- package/components/HelpExpanderStandalone/HelpExpanderStandalone.test.d.ts +1 -0
- package/components/HelpExpanderStandalone/index.d.ts +3 -0
- package/components/HelpExpanderStandalone/index.js +50 -0
- package/components/HelpExpanderStandalone/index.js.map +1 -0
- package/components/HelpExpanderStandalone/styles.module.scss +5 -0
- package/components/{HelpTooltip/HelpTooltipWord → HelpExpanderStandalone}/styles.module.scss.d.ts +1 -1
- package/components/HelpPanel/HelpPanel.d.ts +0 -3
- package/components/HelpPanel/index.js +2 -13
- package/components/HelpPanel/index.js.map +1 -1
- package/components/HelpPanel/styles.module.scss +3 -2
- package/components/HelpTooltip/HelpTooltip.d.ts +2 -8
- package/components/HelpTooltip/index.js +21 -78
- package/components/HelpTooltip/index.js.map +1 -1
- package/components/HelpTriggerIcon/HelpSign.d.ts +8 -0
- package/components/HelpTriggerIcon/HelpTriggerIcon.d.ts +34 -0
- package/components/HelpTriggerIcon/HelpTriggerIcon.test.d.ts +1 -0
- package/components/HelpTriggerIcon/index.d.ts +3 -0
- package/components/HelpTriggerIcon/index.js +7 -0
- package/components/{HelpTrigger → HelpTriggerIcon}/index.js.map +1 -1
- package/components/HelpTriggerIcon/styles.module.scss +157 -0
- package/components/HelpTriggerIcon/styles.module.scss.d.ts +15 -0
- package/components/HelpTriggerInline/HelpTriggerInline.d.ts +28 -0
- package/components/HelpTriggerInline/HelpTriggerInline.test.d.ts +1 -0
- package/components/HelpTriggerInline/index.d.ts +3 -0
- package/components/HelpTriggerInline/index.js +35 -0
- package/components/HelpTriggerInline/index.js.map +1 -0
- package/components/HelpTriggerInline/styles.module.scss +41 -0
- package/components/{HelpQuestion → HelpTriggerInline}/styles.module.scss.d.ts +2 -2
- package/components/HelpTriggerStandalone/HelpTriggerStandalone.d.ts +28 -0
- package/components/HelpTriggerStandalone/HelpTriggerStandalone.test.d.ts +1 -0
- package/components/HelpTriggerStandalone/index.d.ts +3 -0
- package/components/HelpTriggerStandalone/index.js +5 -0
- package/components/HelpTriggerStandalone/styles.module.scss +70 -0
- package/components/HelpTriggerStandalone/styles.module.scss.d.ts +11 -0
- package/components/HighlightPanel/HighlightPanel.d.ts +0 -9
- package/components/HighlightPanel/index.js +0 -2
- package/components/HighlightPanel/index.js.map +1 -1
- package/components/HighlightPanel/styles.module.scss +23 -165
- package/components/HighlightPanel/styles.module.scss.d.ts +1 -8
- package/components/PopMenu/index.js +3 -4
- package/components/PopMenu/index.js.map +1 -1
- package/components/PopMenu/styles.module.scss +10 -10
- package/components/PopMenu/styles.module.scss.d.ts +0 -1
- package/components/PopOver/PopOver.d.ts +7 -6
- package/components/PopOver/index.js +3 -3
- package/components/PopOver/styles.module.scss +13 -50
- package/components/PopOver/styles.module.scss.d.ts +0 -5
- package/constants.d.ts +5 -2
- package/constants.js +5 -2
- package/constants.js.map +1 -1
- package/floating-ui.react.js +4232 -0
- package/floating-ui.react.js.map +1 -0
- package/hooks/useHover.d.ts +1 -1
- package/hooks/useHover.js +2 -2
- package/hooks/useHover.js.map +1 -1
- package/package.json +2 -1
- package/scss/_font-mixins.scss +22 -0
- package/scss/typography.module.scss +8 -0
- package/scss/typography.module.scss.d.ts +2 -0
- package/scss/typography.stories.tsx +8 -0
- package/HelpBubble.js +0 -78
- package/HelpBubble.js.map +0 -1
- package/HelpTooltipWord.js +0 -28
- package/HelpTooltipWord.js.map +0 -1
- package/HelpTrigger.js +0 -80
- package/HelpTrigger.js.map +0 -1
- package/components/HelpQuestion/HelpQuestion.d.ts +0 -21
- package/components/HelpQuestion/index.d.ts +0 -3
- package/components/HelpQuestion/index.js +0 -35
- package/components/HelpQuestion/index.js.map +0 -1
- package/components/HelpQuestion/styles.module.scss +0 -49
- package/components/HelpTooltip/HelpTooltipWord/HelpTooltipWord.d.ts +0 -19
- package/components/HelpTooltip/HelpTooltipWord/index.d.ts +0 -3
- package/components/HelpTooltip/HelpTooltipWord/index.js +0 -5
- package/components/HelpTooltip/HelpTooltipWord/styles.module.scss +0 -18
- package/components/HelpTrigger/HelpSign.d.ts +0 -4
- package/components/HelpTrigger/HelpTrigger.d.ts +0 -44
- package/components/HelpTrigger/index.d.ts +0 -3
- package/components/HelpTrigger/index.js +0 -5
- package/components/HelpTrigger/styles.module.scss +0 -101
- package/components/HelpTrigger/styles.module.scss.d.ts +0 -15
- package/hooks/useDelayedState.d.ts +0 -8
- package/hooks/useDelayedState.js +0 -23
- package/hooks/useDelayedState.js.map +0 -1
- /package/components/{HelpQuestion/HelpQuestion.test.d.ts → HelpDetails/HelpDetails.test.d.ts} +0 -0
- /package/components/{HelpTrigger/HelpTrigger.test.d.ts → HelpExpanderInline/HelpExpanderInline.test.d.ts} +0 -0
- /package/components/{HelpTooltip/HelpTooltipWord → HelpTriggerStandalone}/index.js.map +0 -0
package/hooks/useHover.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { RefObject } from 'react';
|
|
|
4
4
|
* @param ref Element som skal observeres
|
|
5
5
|
* @returns Objekt med ref og om objekt er hovered/focused
|
|
6
6
|
*/
|
|
7
|
-
export declare const useHover: <T extends HTMLElement | SVGElement>(ref?: RefObject<T
|
|
7
|
+
export declare const useHover: <T extends HTMLElement | SVGElement>(ref?: RefObject<T>, includeFocus?: boolean) => {
|
|
8
8
|
hoverRef: RefObject<T>;
|
|
9
9
|
isHovered: boolean;
|
|
10
10
|
};
|
package/hooks/useHover.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { usePseudoClasses } from "./usePseudoClasses.js";
|
|
2
|
-
const useHover = (ref) => {
|
|
2
|
+
const useHover = (ref, includeFocus = true) => {
|
|
3
3
|
const { refObject, isHovered, isFocused } = usePseudoClasses(ref);
|
|
4
|
-
return { hoverRef: refObject, isHovered: isHovered || isFocused };
|
|
4
|
+
return { hoverRef: refObject, isHovered: isHovered || includeFocus && isFocused };
|
|
5
5
|
};
|
|
6
6
|
export {
|
|
7
7
|
useHover
|
package/hooks/useHover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHover.js","sources":["../../src/hooks/useHover.ts"],"sourcesContent":["import { RefObject } from 'react';\n\nimport { usePseudoClasses } from './usePseudoClasses';\n\n/**\n * Få vite når et element hovres over eller mottar fokus.\n * @param ref Element som skal observeres\n * @returns Objekt med ref og om objekt er hovered/focused\n */\nexport const useHover = <T extends HTMLElement | SVGElement>(ref?: RefObject<T
|
|
1
|
+
{"version":3,"file":"useHover.js","sources":["../../src/hooks/useHover.ts"],"sourcesContent":["import { RefObject } from 'react';\n\nimport { usePseudoClasses } from './usePseudoClasses';\n\n/**\n * Få vite når et element hovres over eller mottar fokus.\n * @param ref Element som skal observeres\n * @returns Objekt med ref og om objekt er hovered/focused\n */\nexport const useHover = <T extends HTMLElement | SVGElement>(\n ref?: RefObject<T>,\n includeFocus: boolean = true\n): { hoverRef: RefObject<T>; isHovered: boolean } => {\n const { refObject, isHovered, isFocused } = usePseudoClasses(ref);\n\n return { hoverRef: refObject, isHovered: isHovered || (includeFocus && isFocused) };\n};\n"],"names":[],"mappings":";AASO,MAAM,WAAW,CACtB,KACA,eAAwB,SAC2B;AACnD,QAAM,EAAE,WAAW,WAAW,UAAU,IAAI,iBAAiB,GAAG;AAEhE,SAAO,EAAE,UAAU,WAAW,WAAW,aAAc,gBAAgB,UAAW;AACpF;"}
|
package/package.json
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
"url": "git+https://github.com/helsenorge/designsystem.git"
|
|
8
8
|
},
|
|
9
9
|
"homepage": "https://helsenorge.design",
|
|
10
|
-
"version": "
|
|
10
|
+
"version": "12.0.0-beta.0",
|
|
11
11
|
"author": "Helsenorge",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"dependencies": {
|
|
14
|
+
"@floating-ui/react": "^0.27.8",
|
|
14
15
|
"motion": "^11.14.3"
|
|
15
16
|
},
|
|
16
17
|
"peerDependencies": {
|
package/scss/_font-mixins.scss
CHANGED
|
@@ -238,3 +238,25 @@
|
|
|
238
238
|
line-height: 1.625rem;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
+
|
|
242
|
+
@mixin help-text {
|
|
243
|
+
font-size: 1rem;
|
|
244
|
+
line-height: 1.5rem;
|
|
245
|
+
font-weight: 400;
|
|
246
|
+
|
|
247
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
248
|
+
font-size: 1.125rem;
|
|
249
|
+
line-height: 1.575rem;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@mixin help-trigger-text {
|
|
254
|
+
font-size: 1rem;
|
|
255
|
+
line-height: 1.2rem;
|
|
256
|
+
font-weight: 600;
|
|
257
|
+
|
|
258
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
259
|
+
font-size: 1.125rem;
|
|
260
|
+
line-height: 1.463rem;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
@@ -132,6 +132,14 @@ import designsystemtypography from './scss/typography.scss'
|
|
|
132
132
|
@include fonts.definition-list-data;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
.help-text {
|
|
136
|
+
@include fonts.help-text;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.help-trigger-text {
|
|
140
|
+
@include fonts.help-trigger-text;
|
|
141
|
+
}
|
|
142
|
+
|
|
135
143
|
.anchorlink-wrapper {
|
|
136
144
|
a {
|
|
137
145
|
display: inline;
|
|
@@ -121,6 +121,14 @@ export const DefinitionListData: Story = {
|
|
|
121
121
|
render: args => <div className={designsystemtypography['definition-list-data']}>{args.tekst}</div>,
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
+
export const HelpText: Story = {
|
|
125
|
+
render: args => <div className={designsystemtypography['help-text']}>{args.tekst}</div>,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const HelpTriggerText: Story = {
|
|
129
|
+
render: args => <div className={designsystemtypography['help-trigger-text']}>{args.tekst}</div>,
|
|
130
|
+
};
|
|
131
|
+
|
|
124
132
|
export const AnchorlinkWrapper: Story = {
|
|
125
133
|
render: args => (
|
|
126
134
|
<div className={designsystemtypography['anchorlink-wrapper']}>
|
package/HelpBubble.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React__default from "react";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
import { AnalyticsId } from "./constants.js";
|
|
5
|
-
import { A as AnchorLink } from "./AnchorLink.js";
|
|
6
|
-
import { C as Close } from "./Close.js";
|
|
7
|
-
import { P as PopOverVariant, a as PopOver } from "./PopOver.js";
|
|
8
|
-
import styles from "./components/HelpBubble/styles.module.scss";
|
|
9
|
-
const HelpBubbleVariant = PopOverVariant;
|
|
10
|
-
const HelpBubble = React__default.forwardRef((props, ref) => {
|
|
11
|
-
const {
|
|
12
|
-
children,
|
|
13
|
-
className = "",
|
|
14
|
-
noCloseButton,
|
|
15
|
-
linkText = "Mer hjelp",
|
|
16
|
-
linkUrl,
|
|
17
|
-
linkTarget,
|
|
18
|
-
onLinkClick,
|
|
19
|
-
onClose,
|
|
20
|
-
closeAriaLabel,
|
|
21
|
-
// Props passed on to PopOver
|
|
22
|
-
showBubble,
|
|
23
|
-
helpBubbleId,
|
|
24
|
-
variant,
|
|
25
|
-
controllerRef,
|
|
26
|
-
role,
|
|
27
|
-
testId
|
|
28
|
-
} = props;
|
|
29
|
-
const isTooltip = role === "tooltip";
|
|
30
|
-
if (!showBubble && !isTooltip) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
const helpBubbleClasses = classNames(styles.helpbubble, className);
|
|
34
|
-
const contentClasses = classNames(styles.helpbubble__content, {
|
|
35
|
-
[styles["helpbubble__content--close"]]: !noCloseButton && !isTooltip
|
|
36
|
-
});
|
|
37
|
-
const renderLink = () => {
|
|
38
|
-
if (isTooltip) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (onLinkClick && linkText) {
|
|
42
|
-
return /* @__PURE__ */ jsx("button", { className: styles.helpbubble__link, onClick: onLinkClick, type: "button", children: linkText });
|
|
43
|
-
} else if (linkUrl && linkText) {
|
|
44
|
-
return /* @__PURE__ */ jsx(AnchorLink, { href: linkUrl, target: linkTarget, children: linkText });
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const renderCloseButton = () => {
|
|
48
|
-
if (noCloseButton || isTooltip) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
return /* @__PURE__ */ jsx("div", { className: styles.helpbubble__close, children: /* @__PURE__ */ jsx(Close, { small: true, onClick: onClose, ariaLabel: closeAriaLabel }) });
|
|
52
|
-
};
|
|
53
|
-
return /* @__PURE__ */ jsx(
|
|
54
|
-
PopOver,
|
|
55
|
-
{
|
|
56
|
-
id: helpBubbleId,
|
|
57
|
-
variant,
|
|
58
|
-
controllerRef,
|
|
59
|
-
role,
|
|
60
|
-
ref,
|
|
61
|
-
show: isTooltip && showBubble,
|
|
62
|
-
testId,
|
|
63
|
-
children: /* @__PURE__ */ jsxs("div", { className: helpBubbleClasses, "data-analyticsid": AnalyticsId.HelpBubble, children: [
|
|
64
|
-
renderCloseButton(),
|
|
65
|
-
/* @__PURE__ */ jsxs("div", { className: contentClasses, children: [
|
|
66
|
-
children,
|
|
67
|
-
renderLink()
|
|
68
|
-
] })
|
|
69
|
-
] })
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
HelpBubble.displayName = "HelpBubble";
|
|
74
|
-
export {
|
|
75
|
-
HelpBubble as H,
|
|
76
|
-
HelpBubbleVariant as a
|
|
77
|
-
};
|
|
78
|
-
//# sourceMappingURL=HelpBubble.js.map
|
package/HelpBubble.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HelpBubble.js","sources":["../src/components/HelpBubble/HelpBubble.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport AnchorLink, { AnchorLinkTargets } from '../AnchorLink';\nimport Close from '../Close';\nimport PopOver, { PopOverProps, PopOverVariant } from '../PopOver';\n\nimport styles from './styles.module.scss';\n\nexport const HelpBubbleVariant = PopOverVariant;\n\ntype HelpBubbleRole = 'tooltip';\n\nexport interface HelpBubbleProps extends Pick<PopOverProps, 'children' | 'variant' | 'controllerRef' | 'role'> {\n /** Id of the HelpBubble */\n helpBubbleId?: string;\n /** Content shown inside HelpBubble. Note that if role=\"tooltip\", you must not include interactive/focusable elements. */\n children: React.ReactNode;\n /** Ref for the element the HelpBubble is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Adds custom classes to the element. */\n className?: string;\n /** Determines the placement of the helpbubble. Default: automatic positioning. */\n variant?: keyof typeof HelpBubbleVariant;\n /** Show the bubble. Default: false. */\n showBubble?: boolean;\n /** Hide the close button in the bubble. Close button is never rendered if role=\"tooltip\". */\n noCloseButton?: boolean;\n /** Visible text on the link. Link is never rendered if role=\"tooltip\". */\n linkText?: string;\n /** Url the link leads to */\n linkUrl?: string;\n /** Sets the target type of the link. _blank adds an arrow icon at the end of the link */\n linkTarget?: AnchorLinkTargets;\n /** Function is called when link is clicked */\n onLinkClick?: () => void;\n /** Function is called when user clicks the button */\n onClose?: () => void;\n /** aria-label to be passed onto Close */\n closeAriaLabel?: string;\n /** Sets role of the HelpBubble element. If set to \"tooltip\", */\n role?: HelpBubbleRole;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst HelpBubble = React.forwardRef<HTMLDivElement | SVGSVGElement, HelpBubbleProps>((props, ref) => {\n const {\n children,\n className = '',\n noCloseButton,\n linkText = 'Mer hjelp',\n linkUrl,\n linkTarget,\n onLinkClick,\n onClose,\n closeAriaLabel,\n // Props passed on to PopOver\n showBubble,\n helpBubbleId,\n variant,\n controllerRef,\n role,\n testId,\n } = props;\n\n const isTooltip = role === 'tooltip';\n\n if (!showBubble && !isTooltip) {\n return null;\n }\n\n const helpBubbleClasses = classNames(styles.helpbubble, className);\n\n const contentClasses = classNames(styles.helpbubble__content, {\n [styles['helpbubble__content--close']]: !noCloseButton && !isTooltip,\n });\n\n const renderLink = (): JSX.Element | undefined => {\n // Det er ikke tillatt med interaktive/fokuserbare elementer i role=\"tooltip\"\n if (isTooltip) {\n return;\n }\n if (onLinkClick && linkText) {\n return (\n <button className={styles.helpbubble__link} onClick={onLinkClick} type=\"button\">\n {linkText}\n </button>\n );\n } else if (linkUrl && linkText) {\n return (\n <AnchorLink href={linkUrl} target={linkTarget}>\n {linkText}\n </AnchorLink>\n );\n }\n };\n\n const renderCloseButton = (): JSX.Element | undefined => {\n if (noCloseButton || isTooltip) {\n return;\n }\n return (\n <div className={styles.helpbubble__close}>\n <Close small onClick={onClose} ariaLabel={closeAriaLabel} />\n </div>\n );\n };\n\n return (\n <PopOver\n id={helpBubbleId}\n variant={variant}\n controllerRef={controllerRef}\n role={role}\n ref={ref}\n show={isTooltip && showBubble}\n testId={testId}\n >\n <div className={helpBubbleClasses} data-analyticsid={AnalyticsId.HelpBubble}>\n {renderCloseButton()}\n <div className={contentClasses}>\n {children}\n {renderLink()}\n </div>\n </div>\n </PopOver>\n );\n});\n\nHelpBubble.displayName = 'HelpBubble';\n\nexport default HelpBubble;\n"],"names":["React"],"mappings":";;;;;;;;AAWO,MAAM,oBAAoB;AAqCjC,MAAM,aAAaA,eAAM,WAA4D,CAAC,OAAO,QAAQ;AAC7F,QAAA;AAAA,IACJ;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAEJ,QAAM,YAAY,SAAS;AAEvB,MAAA,CAAC,cAAc,CAAC,WAAW;AACtB,WAAA;AAAA,EAAA;AAGT,QAAM,oBAAoB,WAAW,OAAO,YAAY,SAAS;AAE3D,QAAA,iBAAiB,WAAW,OAAO,qBAAqB;AAAA,IAC5D,CAAC,OAAO,4BAA4B,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAAA,EAAA,CAC5D;AAED,QAAM,aAAa,MAA+B;AAEhD,QAAI,WAAW;AACb;AAAA,IAAA;AAEF,QAAI,eAAe,UAAU;AAEzB,aAAA,oBAAC,YAAO,WAAW,OAAO,kBAAkB,SAAS,aAAa,MAAK,UACpE,UACH,SAAA,CAAA;AAAA,IAAA,WAEO,WAAW,UAAU;AAC9B,iCACG,YAAW,EAAA,MAAM,SAAS,QAAQ,YAChC,UACH,UAAA;AAAA,IAAA;AAAA,EAGN;AAEA,QAAM,oBAAoB,MAA+B;AACvD,QAAI,iBAAiB,WAAW;AAC9B;AAAA,IAAA;AAEF,WACG,oBAAA,OAAA,EAAI,WAAW,OAAO,mBACrB,UAAA,oBAAC,OAAM,EAAA,OAAK,MAAC,SAAS,SAAS,WAAW,eAAgB,CAAA,GAC5D;AAAA,EAEJ;AAGE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAI;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,aAAa;AAAA,MACnB;AAAA,MAEA,+BAAC,OAAI,EAAA,WAAW,mBAAmB,oBAAkB,YAAY,YAC9D,UAAA;AAAA,QAAkB,kBAAA;AAAA,QACnB,qBAAC,OAAI,EAAA,WAAW,gBACb,UAAA;AAAA,UAAA;AAAA,UACA,WAAW;AAAA,QAAA,EACd,CAAA;AAAA,MAAA,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ,CAAC;AAED,WAAW,cAAc;"}
|
package/HelpTooltipWord.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import React__default from "react";
|
|
3
|
-
import { AnalyticsId } from "./constants.js";
|
|
4
|
-
import styles from "./components/HelpTooltip/HelpTooltipWord/styles.module.scss";
|
|
5
|
-
const HelpTooltipWord = React__default.forwardRef(
|
|
6
|
-
({ children, onClick, onFocus, onBlur, onKeyDown, testId, ariaDescribedById }, ref) => /* @__PURE__ */ jsx(
|
|
7
|
-
"button",
|
|
8
|
-
{
|
|
9
|
-
className: styles.word,
|
|
10
|
-
ref,
|
|
11
|
-
onClick,
|
|
12
|
-
onMouseEnter: onFocus,
|
|
13
|
-
onMouseLeave: onBlur,
|
|
14
|
-
onFocus,
|
|
15
|
-
onBlur,
|
|
16
|
-
onKeyDown,
|
|
17
|
-
"aria-describedby": ariaDescribedById,
|
|
18
|
-
"data-testid": testId,
|
|
19
|
-
"data-analyticsid": AnalyticsId.HelpTooltip,
|
|
20
|
-
children
|
|
21
|
-
}
|
|
22
|
-
)
|
|
23
|
-
);
|
|
24
|
-
HelpTooltipWord.displayName = "TooltipWord";
|
|
25
|
-
export {
|
|
26
|
-
HelpTooltipWord as H
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=HelpTooltipWord.js.map
|
package/HelpTooltipWord.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HelpTooltipWord.js","sources":["../src/components/HelpTooltip/HelpTooltipWord/HelpTooltipWord.tsx"],"sourcesContent":["import React from 'react';\n\nimport { AnalyticsId } from '../../../constants';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpTooltipWordProps {\n /** Ordet som skal ha en tilhørende tooltip */\n children: string;\n /** Callback når ordet klikkes på */\n onClick: () => void;\n /** Callback når ordet får fokus eller hovres over */\n onFocus: () => void;\n /** Callback når ordet mister fokus eller hover forsvinner */\n onBlur: () => void;\n /** Callback når det skrives på tastaturet */\n onKeyDown: (e: React.KeyboardEvent<HTMLSpanElement>) => void;\n /** ID til element som beskriver ordet */\n ariaDescribedById: string;\n /** Valgfri test-id */\n testId?: string;\n}\n\nconst HelpTooltipWord = React.forwardRef<HTMLButtonElement, HelpTooltipWordProps>(\n ({ children, onClick, onFocus, onBlur, onKeyDown, testId, ariaDescribedById }, ref) => (\n <button\n className={styles.word}\n ref={ref}\n onClick={onClick}\n onMouseEnter={onFocus}\n onMouseLeave={onBlur}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n aria-describedby={ariaDescribedById}\n data-testid={testId}\n data-analyticsid={AnalyticsId.HelpTooltip}\n >\n {children}\n </button>\n )\n);\n\nHelpTooltipWord.displayName = 'TooltipWord';\n\nexport default HelpTooltipWord;\n"],"names":["React"],"mappings":";;;;AAuBA,MAAM,kBAAkBA,eAAM;AAAA,EAC5B,CAAC,EAAE,UAAU,SAAS,SAAS,QAAQ,WAAW,QAAQ,qBAAqB,QAC7E;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,OAAO;AAAA,MAClB;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,cAAc;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAkB;AAAA,MAClB,eAAa;AAAA,MACb,oBAAkB,YAAY;AAAA,MAE7B;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA,gBAAgB,cAAc;"}
|
package/HelpTrigger.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import React__default from "react";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
import { g as getIcon, I as Icon } from "./Icon.js";
|
|
5
|
-
import { AnalyticsId, IconSize } from "./constants.js";
|
|
6
|
-
import { useHover } from "./hooks/useHover.js";
|
|
7
|
-
import { getColor } from "./theme/currys/color.js";
|
|
8
|
-
import { getAriaLabelAttributes } from "./utils/accessibility.js";
|
|
9
|
-
import { mergeRefs } from "./utils/refs.js";
|
|
10
|
-
import styles from "./components/HelpTrigger/styles.module.scss";
|
|
11
|
-
const HelpSign = ({ size, isHovered }) => {
|
|
12
|
-
const normal = /* @__PURE__ */ jsx("path", { d: "M18.854 19.678c0-2.268 1.701-4.74 5.126-4.74 3.358 0 5.172 2.222 5.172 4.536 0 1.793-.952 3.064-2.268 3.992l-.976.682c-.749.521-1.134 1.27-1.134 2.154 0 .047 0 .16.023.296h-2.269a46.85 46.85 0 0 0-.01-.139 8.554 8.554 0 0 1-.036-.724c0-1.36.522-2.471 1.84-3.424l1.042-.75c.75-.544 1.066-1.201 1.066-1.974 0-1.178-.793-2.29-2.45-2.29-1.679 0-2.563 1.293-2.563 2.585 0 .34.045.772.136 1.022l-2.564-.181a3.903 3.903 0 0 1-.135-1.044Zm3.176 10.186c0-.908.726-1.678 1.656-1.678.908 0 1.656.77 1.656 1.678 0 .907-.748 1.657-1.656 1.657-.93 0-1.656-.75-1.656-1.657Z" });
|
|
13
|
-
const normalHover = /* @__PURE__ */ jsx("path", { d: "M18.854 18.178c0-2.268 1.701-4.74 5.126-4.74 3.358 0 5.172 2.223 5.172 4.536 0 1.793-.952 3.064-2.268 3.992l-.976.682c-.749.521-1.134 1.27-1.134 2.154 0 .047 0 .16.023.296h-2.269a46.85 46.85 0 0 0-.01-.139 8.554 8.554 0 0 1-.036-.724c0-1.36.522-2.471 1.838-3.424l1.044-.75c.75-.544 1.066-1.201 1.066-1.974 0-1.178-.793-2.29-2.45-2.29-1.679 0-2.563 1.293-2.563 2.585 0 .34.045.772.135 1.022l-2.563-.181a3.903 3.903 0 0 1-.135-1.044Zm3.176 11.686c0-.908.725-1.678 1.655-1.678.908 0 1.657.77 1.657 1.678 0 .907-.749 1.657-1.657 1.657-.93 0-1.655-.75-1.655-1.657Z" });
|
|
14
|
-
const xSmall = /* @__PURE__ */ jsx("path", { d: "M23.98 14.937c-3.425 0-5.127 2.473-5.127 4.741 0 .363.047.726.137 1.044l2.563.182c-.09-.25-.136-.681-.136-1.022 0-1.292.885-2.586 2.563-2.586 1.658 0 2.45 1.112 2.45 2.291 0 .772-.317 1.43-1.065 1.974l-1.043.749c-1.317.953-1.84 2.065-1.84 3.425 0 .319.024.567.047.862h2.267c-.021-.135-.021-.25-.021-.295 0-.884.385-1.633 1.133-2.154l.976-.681c1.317-.93 2.27-2.2 2.27-3.993 0-2.314-1.816-4.537-5.174-4.537m-.294 13.248c-.93 0-1.656.773-1.656 1.678a1.65 1.65 0 0 0 1.656 1.657c.907 0 1.656-.748 1.656-1.657 0-.905-.749-1.678-1.656-1.678" });
|
|
15
|
-
const xSmallHover = /* @__PURE__ */ jsx("path", { d: "M18.853 18.289c0-2.268 1.701-4.742 5.127-4.742 3.357 0 5.173 2.223 5.173 4.537 0 1.794-.953 3.065-2.27 3.994l-.976.681c-.747.52-1.133 1.27-1.133 2.154 0 .046 0 .16.022.295h-2.267a39.324 39.324 0 0 0-.01-.125 8.468 8.468 0 0 1-.037-.737c0-1.36.523-2.472 1.839-3.425l1.043-.75c.748-.543 1.065-1.201 1.065-1.973 0-1.18-.792-2.29-2.45-2.29-1.678 0-2.562 1.293-2.562 2.585 0 .341.045.772.135 1.022l-2.563-.183a3.914 3.914 0 0 1-.136-1.043Zm3.176 11.575c0-.907.726-1.679 1.656-1.679.908 0 1.657.772 1.657 1.68 0 .907-.749 1.656-1.657 1.656-.93 0-1.656-.749-1.656-1.657Z" });
|
|
16
|
-
return getIcon({ size, isHovered, normal, normalHover, xSmall, xSmallHover });
|
|
17
|
-
};
|
|
18
|
-
const iconSizeMap = {
|
|
19
|
-
medium: IconSize.XSmall,
|
|
20
|
-
large: IconSize.Small
|
|
21
|
-
};
|
|
22
|
-
const getIconColor = (onColor, isActive) => {
|
|
23
|
-
if (onColor === "ondark") {
|
|
24
|
-
return "white";
|
|
25
|
-
}
|
|
26
|
-
const depth = isActive ? 800 : 600;
|
|
27
|
-
return getColor("plum", depth);
|
|
28
|
-
};
|
|
29
|
-
const HelpTrigger = React__default.forwardRef(
|
|
30
|
-
({
|
|
31
|
-
ariaLabel,
|
|
32
|
-
ariaLabelledById,
|
|
33
|
-
onColor = "onlight",
|
|
34
|
-
size = "medium",
|
|
35
|
-
selected = false,
|
|
36
|
-
isHovered,
|
|
37
|
-
htmlMarkup = "button",
|
|
38
|
-
className,
|
|
39
|
-
testId,
|
|
40
|
-
...rest
|
|
41
|
-
}, ref) => {
|
|
42
|
-
const { isHovered: buttonIsHovered, hoverRef } = useHover();
|
|
43
|
-
const triggerClasses = classNames(
|
|
44
|
-
styles["help-trigger"],
|
|
45
|
-
onColor === "onlight" && styles[`help-trigger--help`],
|
|
46
|
-
// variants look the same when onColor=ondark
|
|
47
|
-
onColor === "ondark" && styles[`help-trigger--${onColor}`],
|
|
48
|
-
styles[`help-trigger--${size}`],
|
|
49
|
-
isHovered && styles[`help-trigger--hovered`],
|
|
50
|
-
selected && styles[`help-trigger--selected`],
|
|
51
|
-
className
|
|
52
|
-
);
|
|
53
|
-
const iconColor = getIconColor(onColor, isHovered || buttonIsHovered || selected);
|
|
54
|
-
const icon = /* @__PURE__ */ jsx(Icon, { svgIcon: HelpSign, size: iconSizeMap[size], color: iconColor, isHovered: isHovered || buttonIsHovered });
|
|
55
|
-
if (htmlMarkup === "span") {
|
|
56
|
-
return /* @__PURE__ */ jsx("span", { "data-testid": testId, "data-analyticsid": AnalyticsId.Trigger, className: triggerClasses, children: icon });
|
|
57
|
-
}
|
|
58
|
-
const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });
|
|
59
|
-
return /* @__PURE__ */ jsx(
|
|
60
|
-
"button",
|
|
61
|
-
{
|
|
62
|
-
"aria-label": ariaLabel,
|
|
63
|
-
type: "button",
|
|
64
|
-
"data-testid": testId,
|
|
65
|
-
"data-analyticsid": AnalyticsId.Trigger,
|
|
66
|
-
className: triggerClasses,
|
|
67
|
-
ref: mergeRefs([ref, hoverRef]),
|
|
68
|
-
"aria-expanded": selected,
|
|
69
|
-
...ariaLabelAttributes,
|
|
70
|
-
...rest,
|
|
71
|
-
children: icon
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
HelpTrigger.displayName = "HelpTrigger";
|
|
77
|
-
export {
|
|
78
|
-
HelpTrigger as H
|
|
79
|
-
};
|
|
80
|
-
//# sourceMappingURL=HelpTrigger.js.map
|
package/HelpTrigger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HelpTrigger.js","sources":["../src/components/HelpTrigger/HelpSign.tsx","../src/components/HelpTrigger/HelpTrigger.tsx"],"sourcesContent":["import React from 'react';\n\nimport { getIcon, SvgPathProps } from '../Icon';\n\nconst HelpSign: React.FC<SvgPathProps> = ({ size, isHovered }: SvgPathProps): React.ReactElement => {\n const normal = (\n <path d=\"M18.854 19.678c0-2.268 1.701-4.74 5.126-4.74 3.358 0 5.172 2.222 5.172 4.536 0 1.793-.952 3.064-2.268 3.992l-.976.682c-.749.521-1.134 1.27-1.134 2.154 0 .047 0 .16.023.296h-2.269a46.85 46.85 0 0 0-.01-.139 8.554 8.554 0 0 1-.036-.724c0-1.36.522-2.471 1.84-3.424l1.042-.75c.75-.544 1.066-1.201 1.066-1.974 0-1.178-.793-2.29-2.45-2.29-1.679 0-2.563 1.293-2.563 2.585 0 .34.045.772.136 1.022l-2.564-.181a3.903 3.903 0 0 1-.135-1.044Zm3.176 10.186c0-.908.726-1.678 1.656-1.678.908 0 1.656.77 1.656 1.678 0 .907-.748 1.657-1.656 1.657-.93 0-1.656-.75-1.656-1.657Z\" />\n );\n\n const normalHover = (\n <path d=\"M18.854 18.178c0-2.268 1.701-4.74 5.126-4.74 3.358 0 5.172 2.223 5.172 4.536 0 1.793-.952 3.064-2.268 3.992l-.976.682c-.749.521-1.134 1.27-1.134 2.154 0 .047 0 .16.023.296h-2.269a46.85 46.85 0 0 0-.01-.139 8.554 8.554 0 0 1-.036-.724c0-1.36.522-2.471 1.838-3.424l1.044-.75c.75-.544 1.066-1.201 1.066-1.974 0-1.178-.793-2.29-2.45-2.29-1.679 0-2.563 1.293-2.563 2.585 0 .34.045.772.135 1.022l-2.563-.181a3.903 3.903 0 0 1-.135-1.044Zm3.176 11.686c0-.908.725-1.678 1.655-1.678.908 0 1.657.77 1.657 1.678 0 .907-.749 1.657-1.657 1.657-.93 0-1.655-.75-1.655-1.657Z\" />\n );\n\n const xSmall = (\n <path d=\"M23.98 14.937c-3.425 0-5.127 2.473-5.127 4.741 0 .363.047.726.137 1.044l2.563.182c-.09-.25-.136-.681-.136-1.022 0-1.292.885-2.586 2.563-2.586 1.658 0 2.45 1.112 2.45 2.291 0 .772-.317 1.43-1.065 1.974l-1.043.749c-1.317.953-1.84 2.065-1.84 3.425 0 .319.024.567.047.862h2.267c-.021-.135-.021-.25-.021-.295 0-.884.385-1.633 1.133-2.154l.976-.681c1.317-.93 2.27-2.2 2.27-3.993 0-2.314-1.816-4.537-5.174-4.537m-.294 13.248c-.93 0-1.656.773-1.656 1.678a1.65 1.65 0 0 0 1.656 1.657c.907 0 1.656-.748 1.656-1.657 0-.905-.749-1.678-1.656-1.678\" />\n );\n\n const xSmallHover = (\n <path d=\"M18.853 18.289c0-2.268 1.701-4.742 5.127-4.742 3.357 0 5.173 2.223 5.173 4.537 0 1.794-.953 3.065-2.27 3.994l-.976.681c-.747.52-1.133 1.27-1.133 2.154 0 .046 0 .16.022.295h-2.267a39.324 39.324 0 0 0-.01-.125 8.468 8.468 0 0 1-.037-.737c0-1.36.523-2.472 1.839-3.425l1.043-.75c.748-.543 1.065-1.201 1.065-1.973 0-1.18-.792-2.29-2.45-2.29-1.678 0-2.562 1.293-2.562 2.585 0 .341.045.772.135 1.022l-2.563-.183a3.914 3.914 0 0 1-.136-1.043Zm3.176 11.575c0-.907.726-1.679 1.656-1.679.908 0 1.657.772 1.657 1.68 0 .907-.749 1.656-1.657 1.656-.93 0-1.656-.749-1.656-1.657Z\" />\n );\n\n return getIcon({ size, isHovered, normal, normalHover, xSmall, xSmallHover });\n};\n\nexport default HelpSign;\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HelpSign from './HelpSign';\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useHover } from '../../hooks/useHover';\nimport { getColor } from '../../theme/currys';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { mergeRefs } from '../../utils/refs';\nimport Icon from '../Icon';\n\nimport styles from './styles.module.scss';\n\nexport type HelpTriggerTags = 'button' | 'span';\n\nexport type HelpTriggerSize = 'medium' | 'large';\n\nexport type HelpTriggerOnColor = 'onlight' | 'ondark';\n\nexport interface HelpTriggerProps\n extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls'> {\n /**\n * Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabel?: string;\n /**\n * Sets aria-labelledby of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabelledById?: string;\n /**\n * Changes the design based on the background the help trigger is placed on. Default: onlight.\n */\n onColor?: HelpTriggerOnColor;\n /**\n * Size of the trigger. Default: medium.\n */\n size?: HelpTriggerSize;\n /**\n * Indicates that the help trigger is in use.\n */\n selected?: boolean;\n /**\n * Indicates that the help trigger is hovered. Used in combination with htmlMarkup=span to force visual hover state.\n */\n isHovered?: boolean;\n /**\n * Changes the underlying element of the trigger. If set to span, the trigger will be a non-interactive icon. Default: button\n */\n htmlMarkup?: HelpTriggerTags;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Optional test id.\n */\n testId?: string;\n}\n\nconst iconSizeMap: Record<HelpTriggerSize, IconSize> = {\n medium: IconSize.XSmall,\n large: IconSize.Small,\n};\n\nconst getIconColor = (onColor: HelpTriggerOnColor, isActive: boolean): string | undefined => {\n if (onColor === 'ondark') {\n return 'white';\n }\n\n const depth = isActive ? 800 : 600;\n return getColor('plum', depth);\n};\n\nconst HelpTrigger = React.forwardRef<HTMLButtonElement, HelpTriggerProps>(\n (\n {\n ariaLabel,\n ariaLabelledById,\n onColor = 'onlight',\n size = 'medium',\n selected = false,\n isHovered,\n htmlMarkup = 'button',\n className,\n testId,\n ...rest\n },\n ref\n ) => {\n const { isHovered: buttonIsHovered, hoverRef } = useHover<HTMLButtonElement>();\n\n const triggerClasses = classNames(\n styles['help-trigger'],\n onColor === 'onlight' && styles[`help-trigger--help`], // variants look the same when onColor=ondark\n onColor === 'ondark' && styles[`help-trigger--${onColor}`],\n styles[`help-trigger--${size}`],\n isHovered && styles[`help-trigger--hovered`],\n selected && styles[`help-trigger--selected`],\n className\n );\n\n const iconColor = getIconColor(onColor, isHovered || buttonIsHovered || selected);\n\n const icon = <Icon svgIcon={HelpSign} size={iconSizeMap[size]} color={iconColor} isHovered={isHovered || buttonIsHovered} />;\n\n if (htmlMarkup === 'span') {\n return (\n <span data-testid={testId} data-analyticsid={AnalyticsId.Trigger} className={triggerClasses}>\n {icon}\n </span>\n );\n }\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n\n return (\n <button\n aria-label={ariaLabel}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.Trigger}\n className={triggerClasses}\n ref={mergeRefs([ref, hoverRef])}\n aria-expanded={selected}\n {...ariaLabelAttributes}\n {...rest}\n >\n {icon}\n </button>\n );\n }\n);\n\nHelpTrigger.displayName = 'HelpTrigger';\n\nexport default HelpTrigger;\n"],"names":["React"],"mappings":";;;;;;;;;;AAIA,MAAM,WAAmC,CAAC,EAAE,MAAM,gBAAkD;AAClG,QAAM,SACJ,oBAAC,QAAK,EAAA,GAAE,ijBAAijB,CAAA;AAG3jB,QAAM,cACJ,oBAAC,QAAK,EAAA,GAAE,kjBAAkjB,CAAA;AAG5jB,QAAM,SACJ,oBAAC,QAAK,EAAA,GAAE,yhBAAyhB,CAAA;AAGniB,QAAM,cACJ,oBAAC,QAAK,EAAA,GAAE,sjBAAsjB,CAAA;AAGzjB,SAAA,QAAQ,EAAE,MAAM,WAAW,QAAQ,aAAa,QAAQ,aAAa;AAC9E;ACsCA,MAAM,cAAiD;AAAA,EACrD,QAAQ,SAAS;AAAA,EACjB,OAAO,SAAS;AAClB;AAEA,MAAM,eAAe,CAAC,SAA6B,aAA0C;AAC3F,MAAI,YAAY,UAAU;AACjB,WAAA;AAAA,EAAA;AAGH,QAAA,QAAQ,WAAW,MAAM;AACxB,SAAA,SAAS,QAAQ,KAAK;AAC/B;AAEA,MAAM,cAAcA,eAAM;AAAA,EACxB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,OAAO;AAAA,IACP,WAAW;AAAA,IACX;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA,GAAG;AAAA,KAEL,QACG;AACH,UAAM,EAAE,WAAW,iBAAiB,SAAA,IAAa,SAA4B;AAE7E,UAAM,iBAAiB;AAAA,MACrB,OAAO,cAAc;AAAA,MACrB,YAAY,aAAa,OAAO,oBAAoB;AAAA;AAAA,MACpD,YAAY,YAAY,OAAO,iBAAiB,OAAO,EAAE;AAAA,MACzD,OAAO,iBAAiB,IAAI,EAAE;AAAA,MAC9B,aAAa,OAAO,uBAAuB;AAAA,MAC3C,YAAY,OAAO,wBAAwB;AAAA,MAC3C;AAAA,IACF;AAEA,UAAM,YAAY,aAAa,SAAS,aAAa,mBAAmB,QAAQ;AAEhF,UAAM,OAAO,oBAAC,MAAK,EAAA,SAAS,UAAU,MAAM,YAAY,IAAI,GAAG,OAAO,WAAW,WAAW,aAAa,iBAAiB;AAE1H,QAAI,eAAe,QAAQ;AAEvB,aAAA,oBAAC,UAAK,eAAa,QAAQ,oBAAkB,YAAY,SAAS,WAAW,gBAC1E,UACH,KAAA,CAAA;AAAA,IAAA;AAIJ,UAAM,sBAAsB,uBAAuB,EAAE,OAAO,WAAW,IAAI,kBAAkB;AAG3F,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,cAAY;AAAA,QACZ,MAAK;AAAA,QACL,eAAa;AAAA,QACb,oBAAkB,YAAY;AAAA,QAC9B,WAAW;AAAA,QACX,KAAK,UAAU,CAAC,KAAK,QAAQ,CAAC;AAAA,QAC9B,iBAAe;AAAA,QACd,GAAG;AAAA,QACH,GAAG;AAAA,QAEH,UAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;AAEA,YAAY,cAAc;"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
export interface HelpQuestionProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-controls'> {
|
|
3
|
-
/**
|
|
4
|
-
* Help question contents
|
|
5
|
-
*/
|
|
6
|
-
children: string;
|
|
7
|
-
/**
|
|
8
|
-
* Indicates that the help question is in use.
|
|
9
|
-
*/
|
|
10
|
-
selected?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Classname will be applied to the button element.
|
|
13
|
-
*/
|
|
14
|
-
className?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Sets the data-testid attribute.
|
|
17
|
-
*/
|
|
18
|
-
testId?: string;
|
|
19
|
-
}
|
|
20
|
-
declare const HelpQuestion: React.ForwardRefExoticComponent<HelpQuestionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
-
export default HelpQuestion;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import React__default from "react";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
import { AnalyticsId } from "../../constants.js";
|
|
5
|
-
import { usePseudoClasses } from "../../hooks/usePseudoClasses.js";
|
|
6
|
-
import { mergeRefs } from "../../utils/refs.js";
|
|
7
|
-
import { H as HelpTrigger } from "../../HelpTrigger.js";
|
|
8
|
-
import styles from "./styles.module.scss";
|
|
9
|
-
const HelpQuestion = React__default.forwardRef(
|
|
10
|
-
({ children, selected = false, className, onClick, testId }, ref) => {
|
|
11
|
-
const { isHovered, refObject } = usePseudoClasses();
|
|
12
|
-
const classes = classNames(styles.helpquestion, selected && styles["helpquestion--selected"], className);
|
|
13
|
-
return /* @__PURE__ */ jsxs(
|
|
14
|
-
"button",
|
|
15
|
-
{
|
|
16
|
-
type: "button",
|
|
17
|
-
"data-testid": testId,
|
|
18
|
-
className: classes,
|
|
19
|
-
onClick,
|
|
20
|
-
ref: mergeRefs([ref, refObject]),
|
|
21
|
-
"aria-expanded": selected,
|
|
22
|
-
"data-analyticsid": AnalyticsId.HelpQuestion,
|
|
23
|
-
children: [
|
|
24
|
-
/* @__PURE__ */ jsx(HelpTrigger, { htmlMarkup: "span", selected, isHovered }),
|
|
25
|
-
children
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
HelpQuestion.displayName = "HelpQuestion";
|
|
32
|
-
export {
|
|
33
|
-
HelpQuestion as default
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/HelpQuestion/HelpQuestion.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { mergeRefs } from '../../utils/refs';\nimport HelpTrigger from '../HelpTrigger';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpQuestionProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-controls'> {\n /**\n * Help question contents\n */\n children: string;\n /**\n * Indicates that the help question is in use.\n */\n selected?: boolean;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Sets the data-testid attribute.\n */\n testId?: string;\n}\n\nconst HelpQuestion = React.forwardRef<HTMLButtonElement, HelpQuestionProps>(\n ({ children, selected = false, className, onClick, testId }, ref) => {\n const { isHovered, refObject } = usePseudoClasses<HTMLButtonElement>();\n\n const classes = classNames(styles.helpquestion, selected && styles['helpquestion--selected'], className);\n\n return (\n <button\n type=\"button\"\n data-testid={testId}\n className={classes}\n onClick={onClick}\n ref={mergeRefs([ref, refObject])}\n aria-expanded={selected}\n data-analyticsid={AnalyticsId.HelpQuestion}\n >\n <HelpTrigger htmlMarkup=\"span\" selected={selected} isHovered={isHovered} />\n {children}\n </button>\n );\n }\n);\n\nHelpQuestion.displayName = 'HelpQuestion';\n\nexport default HelpQuestion;\n"],"names":["React"],"mappings":";;;;;;;;AA8BA,MAAM,eAAeA,eAAM;AAAA,EACzB,CAAC,EAAE,UAAU,WAAW,OAAO,WAAW,SAAS,OAAO,GAAG,QAAQ;AACnE,UAAM,EAAE,WAAW,UAAU,IAAI,iBAAoC;AAE/D,UAAA,UAAU,WAAW,OAAO,cAAc,YAAY,OAAO,wBAAwB,GAAG,SAAS;AAGrG,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,eAAa;AAAA,QACb,WAAW;AAAA,QACX;AAAA,QACA,KAAK,UAAU,CAAC,KAAK,SAAS,CAAC;AAAA,QAC/B,iBAAe;AAAA,QACf,oBAAkB,YAAY;AAAA,QAE9B,UAAA;AAAA,UAAA,oBAAC,aAAY,EAAA,YAAW,QAAO,UAAoB,WAAsB;AAAA,UACxE;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;AAEA,aAAa,cAAc;"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
@use 'sass:map';
|
|
2
|
-
@use '../../scss/spacers' as spacers;
|
|
3
|
-
@use '../../scss/palette' as palette;
|
|
4
|
-
@use '../../scss/font-settings' as font-settings;
|
|
5
|
-
@use '../../scss/breakpoints' as breakpoints;
|
|
6
|
-
|
|
7
|
-
.helpquestion {
|
|
8
|
-
display: inline-flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
text-align: left;
|
|
11
|
-
gap: spacers.getSpacer(2xs);
|
|
12
|
-
padding: spacers.getSpacer(xs) spacers.getSpacer(xs) spacers.getSpacer(xs) spacers.getSpacer(3xs);
|
|
13
|
-
border: 0;
|
|
14
|
-
outline: none;
|
|
15
|
-
background-color: transparent;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
color: palette.$plum600;
|
|
18
|
-
font-weight: 600;
|
|
19
|
-
font-size: font-settings.$font-size-sm;
|
|
20
|
-
line-height: font-settings.$lineheight-size-xs;
|
|
21
|
-
|
|
22
|
-
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
23
|
-
gap: spacers.getSpacer(2xs);
|
|
24
|
-
font-size: font-settings.$font-size-md;
|
|
25
|
-
line-height: font-settings.$lineheight-size-sm;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&:hover {
|
|
29
|
-
color: palette.$plum800;
|
|
30
|
-
background-color: rgba(palette.$plum600, 0.1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&:focus-visible {
|
|
34
|
-
box-shadow: inset 0 0 0 3px palette.$black;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&--selected {
|
|
38
|
-
color: palette.$plum800;
|
|
39
|
-
background-color: rgba(palette.$plum600, 0.1);
|
|
40
|
-
|
|
41
|
-
&:hover {
|
|
42
|
-
background-color: rgba(palette.$plum600, 0.2);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&:focus-visible {
|
|
46
|
-
background-color: rgba(palette.$plum600, 0.1);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
export interface HelpTooltipWordProps {
|
|
3
|
-
/** Ordet som skal ha en tilhørende tooltip */
|
|
4
|
-
children: string;
|
|
5
|
-
/** Callback når ordet klikkes på */
|
|
6
|
-
onClick: () => void;
|
|
7
|
-
/** Callback når ordet får fokus eller hovres over */
|
|
8
|
-
onFocus: () => void;
|
|
9
|
-
/** Callback når ordet mister fokus eller hover forsvinner */
|
|
10
|
-
onBlur: () => void;
|
|
11
|
-
/** Callback når det skrives på tastaturet */
|
|
12
|
-
onKeyDown: (e: React.KeyboardEvent<HTMLSpanElement>) => void;
|
|
13
|
-
/** ID til element som beskriver ordet */
|
|
14
|
-
ariaDescribedById: string;
|
|
15
|
-
/** Valgfri test-id */
|
|
16
|
-
testId?: string;
|
|
17
|
-
}
|
|
18
|
-
declare const HelpTooltipWord: React.ForwardRefExoticComponent<HelpTooltipWordProps & React.RefAttributes<HTMLButtonElement>>;
|
|
19
|
-
export default HelpTooltipWord;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
@use '../../../scss/palette' as palette;
|
|
2
|
-
@use '../../../scss/spacers' as spacers;
|
|
3
|
-
|
|
4
|
-
.word {
|
|
5
|
-
all: unset;
|
|
6
|
-
position: relative;
|
|
7
|
-
display: inline-block;
|
|
8
|
-
cursor: help;
|
|
9
|
-
|
|
10
|
-
// bruker border istedet for text-decoration for å komme rundt text-decoraton-thickness begrensninger i safari
|
|
11
|
-
border-bottom: 0.2rem dotted palette.$plum400;
|
|
12
|
-
line-height: 1.4rem;
|
|
13
|
-
|
|
14
|
-
&:focus-visible {
|
|
15
|
-
box-shadow: 0 0 0 spacers.getSpacer(4xs) palette.$black;
|
|
16
|
-
outline: none;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
export type HelpTriggerTags = 'button' | 'span';
|
|
3
|
-
export type HelpTriggerSize = 'medium' | 'large';
|
|
4
|
-
export type HelpTriggerOnColor = 'onlight' | 'ondark';
|
|
5
|
-
export interface HelpTriggerProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls'> {
|
|
6
|
-
/**
|
|
7
|
-
* Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!
|
|
8
|
-
*/
|
|
9
|
-
ariaLabel?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Sets aria-labelledby of the trigger. ariaLabel or ariaLabelledById MUST be set!
|
|
12
|
-
*/
|
|
13
|
-
ariaLabelledById?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Changes the design based on the background the help trigger is placed on. Default: onlight.
|
|
16
|
-
*/
|
|
17
|
-
onColor?: HelpTriggerOnColor;
|
|
18
|
-
/**
|
|
19
|
-
* Size of the trigger. Default: medium.
|
|
20
|
-
*/
|
|
21
|
-
size?: HelpTriggerSize;
|
|
22
|
-
/**
|
|
23
|
-
* Indicates that the help trigger is in use.
|
|
24
|
-
*/
|
|
25
|
-
selected?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Indicates that the help trigger is hovered. Used in combination with htmlMarkup=span to force visual hover state.
|
|
28
|
-
*/
|
|
29
|
-
isHovered?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Changes the underlying element of the trigger. If set to span, the trigger will be a non-interactive icon. Default: button
|
|
32
|
-
*/
|
|
33
|
-
htmlMarkup?: HelpTriggerTags;
|
|
34
|
-
/**
|
|
35
|
-
* Classname will be applied to the button element.
|
|
36
|
-
*/
|
|
37
|
-
className?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Optional test id.
|
|
40
|
-
*/
|
|
41
|
-
testId?: string;
|
|
42
|
-
}
|
|
43
|
-
declare const HelpTrigger: React.ForwardRefExoticComponent<HelpTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
44
|
-
export default HelpTrigger;
|