@helsenorge/designsystem-react 12.0.0-beta.1 → 12.0.0-beta.2
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 +90 -9
- package/Checkbox.js +1 -1
- package/Checkbox.js.map +1 -1
- package/Duolist.js +92 -0
- package/Duolist.js.map +1 -0
- package/ElementHeader.js +150 -0
- package/ElementHeader.js.map +1 -0
- package/ElementHeaderText.js +35 -0
- package/ElementHeaderText.js.map +1 -0
- package/HelpDetails.js +1 -1
- package/HelpDetails.js.map +1 -1
- package/HelpTriggerIcon.js +4 -4
- package/HelpTriggerIcon.js.map +1 -1
- package/HelpTriggerStandalone.js +5 -2
- package/HelpTriggerStandalone.js.map +1 -1
- package/Highlighter.js +44 -0
- package/Highlighter.js.map +1 -0
- package/LazyIcon.js +1 -1
- package/LazyIcon.js.map +1 -1
- package/LinkList.js +47 -9
- package/LinkList.js.map +1 -1
- package/NotificationBadge.js +1 -1
- package/NotificationBadge.js.map +1 -1
- package/Panel.js +38 -18
- package/Panel.js.map +1 -1
- package/PanelTitle.js +3 -2
- package/PanelTitle.js.map +1 -1
- package/PopOver.js +6 -0
- package/PopOver.js.map +1 -1
- package/StatusDot.js +15 -6
- package/StatusDot.js.map +1 -1
- package/StatusDotMultiComposition.js +27 -0
- package/StatusDotMultiComposition.js.map +1 -0
- package/components/AnchorLink/styles.module.scss +7 -7
- package/components/ArticleTeaser/styles.module.scss +7 -3
- package/components/Checkbox/styles.module.scss +7 -1
- package/components/Checkbox/styles.module.scss.d.ts +1 -0
- package/components/Close/styles.module.scss +10 -6
- package/components/DictionaryTrigger/styles.module.scss +12 -5
- package/components/Dropdown/styles.module.scss +9 -1
- package/components/Duolist/index.js +3 -88
- package/components/Duolist/index.js.map +1 -1
- package/components/ElementHeader/ElementHeader.d.ts +59 -0
- package/components/ElementHeader/ElementHeaderText/ElementHeaderText.d.ts +25 -0
- package/components/ElementHeader/ElementHeaderText/index.d.ts +3 -0
- package/components/ElementHeader/ElementHeaderText/index.js +6 -0
- package/components/ElementHeader/StatusDotMultiComposition/StatusDotMultiComposition.d.ts +23 -0
- package/components/ElementHeader/StatusDotMultiComposition/index.d.ts +3 -0
- package/components/ElementHeader/StatusDotMultiComposition/index.js +6 -0
- package/components/{ListHeader → ElementHeader/StatusDotMultiComposition}/index.js.map +1 -1
- package/components/ElementHeader/StatusDotMultiComposition/styles.module.scss +28 -0
- package/components/ElementHeader/StatusDotMultiComposition/styles.module.scss.d.ts +11 -0
- package/components/ElementHeader/index.d.ts +3 -0
- package/components/ElementHeader/index.js +9 -0
- package/components/ElementHeader/index.js.map +1 -0
- package/components/{ListHeader → ElementHeader}/styles.module.scss +46 -9
- package/components/ElementHeader/styles.module.scss.d.ts +22 -0
- package/components/ExpanderList/ExpanderList.d.ts +9 -2
- package/components/ExpanderList/index.js +40 -23
- package/components/ExpanderList/index.js.map +1 -1
- package/components/ExpanderList/styles.module.scss +288 -47
- package/components/ExpanderList/styles.module.scss.d.ts +22 -2
- package/components/HelpBubble/HelpBubble.d.ts +7 -0
- package/components/HelpBubble/index.js +43 -8
- package/components/HelpBubble/index.js.map +1 -1
- package/components/HelpBubble/resourceHelper.d.ts +3 -0
- package/components/HelpBubble/styles.module.scss +0 -2
- package/components/HelpDetails/styles.module.scss +3 -2
- package/components/HelpDrawer/HelpDrawer.d.ts +3 -0
- package/components/HelpDrawer/index.js +31 -1
- package/components/HelpDrawer/index.js.map +1 -1
- package/components/HelpDrawer/resourceHelper.d.ts +3 -0
- package/components/HelpDrawer/styles.module.scss +1 -11
- package/components/HelpDrawer/styles.module.scss.d.ts +0 -1
- package/components/HelpPanel/styles.module.scss +2 -2
- package/components/HelpTeaser/styles.module.scss +5 -5
- package/components/HelpTooltip/HelpTooltip.d.ts +2 -2
- package/components/HelpTooltip/index.js.map +1 -1
- package/components/HelpTriggerIcon/HelpTriggerIcon.d.ts +4 -0
- package/components/HelpTriggerIcon/styles.module.scss +10 -10
- package/components/HelpTriggerInline/index.js +5 -2
- package/components/HelpTriggerInline/index.js.map +1 -1
- package/components/HelpTriggerInline/styles.module.scss +8 -4
- package/components/HelpTriggerStandalone/styles.module.scss +8 -4
- package/components/Highlighter/Highlighter.d.ts +7 -0
- package/components/Highlighter/Highlighter.test.d.ts +1 -0
- package/components/Highlighter/index.d.ts +3 -0
- package/components/Highlighter/index.js +6 -0
- package/components/Highlighter/index.js.map +1 -0
- package/components/Highlighter/styles.module.scss +4 -0
- package/components/Highlighter/styles.module.scss.d.ts +9 -0
- package/components/Icons/AdditionalIconInformation.d.ts +4 -0
- package/components/Icons/AdditionalIconInformation.js +2 -1
- package/components/Icons/AdditionalIconInformation.js.map +1 -1
- package/components/Icons/DotActive.d.ts +4 -0
- package/components/Icons/DotActive.js +16 -0
- package/components/Icons/DotActive.js.map +1 -0
- package/components/Icons/DotInactive.d.ts +4 -0
- package/components/Icons/DotInactive.js +30 -0
- package/components/Icons/DotInactive.js.map +1 -0
- package/components/Icons/DotPending.d.ts +4 -0
- package/components/Icons/DotPending.js +16 -0
- package/components/Icons/DotPending.js.map +1 -0
- package/components/Icons/IconNames.d.ts +1 -1
- package/components/Icons/IconNames.js +4 -0
- package/components/Icons/IconNames.js.map +1 -1
- package/components/Icons/TreatmentAids.d.ts +4 -0
- package/components/Icons/TreatmentAids.js +41 -0
- package/components/Icons/TreatmentAids.js.map +1 -0
- package/components/LinkList/LinkList.d.ts +9 -2
- package/components/LinkList/styles.module.scss +70 -0
- package/components/LinkList/styles.module.scss.d.ts +11 -0
- package/components/NotificationPanel/styles.module.scss +1 -1
- package/components/Panel/Panel.d.ts +16 -8
- package/components/Panel/PanelTitle/PanelTitle.d.ts +3 -1
- package/components/Panel/styles.module.scss +10 -1
- package/components/Panel/styles.module.scss.d.ts +2 -0
- package/components/PanelList/PanelList.d.ts +2 -0
- package/components/PanelList/index.js +3 -2
- package/components/PanelList/index.js.map +1 -1
- package/components/PopOver/PopOver.d.ts +4 -0
- package/components/PopOver/styles.module.scss +6 -3
- package/components/PopOver/styles.module.scss.d.ts +1 -0
- package/components/RadioButton/styles.module.scss +7 -1
- package/components/StatusDot/StatusDot.d.ts +6 -2
- package/components/StatusDot/index.js +3 -3
- package/components/StatusDot/styles.module.scss +12 -6
- package/components/StatusDot/styles.module.scss.d.ts +3 -0
- package/components/Step/Step.d.ts +4 -0
- package/components/Step/index.js +5 -2
- package/components/Step/index.js.map +1 -1
- package/components/Toggle/index.js +2 -1
- package/components/Toggle/index.js.map +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +1 -0
- package/constants.js.map +1 -1
- package/designsystem-react.css +1 -1
- package/package.json +1 -1
- package/resources/HN.Designsystem.HelpBubble.nb-NO.json.d.ts +6 -0
- package/resources/HN.Designsystem.HelpDrawer.nb-NO.json.d.ts +6 -0
- package/scss/helsenorge.scss +2 -0
- package/scss/supernova/styles/colors.css +1 -1
- package/scss/typography.stories.tsx +1 -1
- package/ListHeader.js +0 -94
- package/ListHeader.js.map +0 -1
- package/ListHeaderText.js +0 -39
- package/ListHeaderText.js.map +0 -1
- package/components/ListHeader/ListHeader.d.ts +0 -43
- package/components/ListHeader/ListHeaderText/ListHeaderText.d.ts +0 -26
- package/components/ListHeader/ListHeaderText/index.d.ts +0 -3
- package/components/ListHeader/ListHeaderText/index.js +0 -6
- package/components/ListHeader/index.d.ts +0 -4
- package/components/ListHeader/index.js +0 -11
- package/components/ListHeader/styles.module.scss.d.ts +0 -21
- /package/components/{ListHeader/ListHeaderText → ElementHeader/ElementHeaderText}/index.js.map +0 -0
|
@@ -1,43 +1,63 @@
|
|
|
1
1
|
export type Styles = {
|
|
2
2
|
'expander-list': string;
|
|
3
3
|
'expander-list__item': string;
|
|
4
|
+
'expander-list__item__status-marker': string;
|
|
5
|
+
'expander-list__item__status-marker--new': string;
|
|
4
6
|
'expander-list__item--fill': string;
|
|
5
7
|
'expander-list__item--fill--blueberry': string;
|
|
6
8
|
'expander-list__item--fill--cherry': string;
|
|
7
9
|
'expander-list__item--fill--neutral': string;
|
|
8
10
|
'expander-list__item--fill--white': string;
|
|
9
11
|
'expander-list__item--fill-negative': string;
|
|
12
|
+
'expander-list__item--fill-negative--blueberry': string;
|
|
13
|
+
'expander-list__item--fill-negative--cherry': string;
|
|
14
|
+
'expander-list__item--fill-negative--neutral': string;
|
|
15
|
+
'expander-list__item--fill-negative--white': string;
|
|
10
16
|
'expander-list__item--line': string;
|
|
11
17
|
'expander-list__item--line--blueberry': string;
|
|
12
18
|
'expander-list__item--line--cherry': string;
|
|
13
19
|
'expander-list__item--line--neutral': string;
|
|
14
20
|
'expander-list__item--line--white': string;
|
|
21
|
+
'expander-list__item--new': string;
|
|
15
22
|
'expander-list__item--outline': string;
|
|
16
23
|
'expander-list__item--outline--blueberry': string;
|
|
17
24
|
'expander-list__item--outline--cherry': string;
|
|
18
25
|
'expander-list__item--outline--neutral': string;
|
|
19
26
|
'expander-list__item--outline--white': string;
|
|
27
|
+
'expander-list--fill': string;
|
|
28
|
+
'expander-list--outline--blueberry': string;
|
|
29
|
+
'expander-list--outline--cherry': string;
|
|
30
|
+
'expander-list--outline--neutral': string;
|
|
31
|
+
'expander-list--outline--white': string;
|
|
20
32
|
'expander-list-link': string;
|
|
21
33
|
'expander-list-link__chevron': string;
|
|
22
34
|
'expander-list-link__icon': string;
|
|
23
35
|
'expander-list-link__main-content': string;
|
|
24
36
|
'expander-list-link__main-content--expanded': string;
|
|
37
|
+
'expander-list-link__main-content--new': string;
|
|
38
|
+
'expander-list-link__main-content--outline--blueberry': string;
|
|
39
|
+
'expander-list-link__main-content--outline--cherry': string;
|
|
40
|
+
'expander-list-link__main-content--outline--neutral': string;
|
|
41
|
+
'expander-list-link__main-content--outline--white': string;
|
|
25
42
|
'expander-list-link__main-content--padding': string;
|
|
26
43
|
'expander-list-link--blueberry': string;
|
|
27
44
|
'expander-list-link--cherry': string;
|
|
28
|
-
'expander-list-link--closed': string;
|
|
29
|
-
'expander-list-link--fill': string;
|
|
30
45
|
'expander-list-link--fill--blueberry': string;
|
|
31
46
|
'expander-list-link--fill--cherry': string;
|
|
32
47
|
'expander-list-link--fill--neutral': string;
|
|
33
48
|
'expander-list-link--fill--white': string;
|
|
34
49
|
'expander-list-link--fill-negative': string;
|
|
50
|
+
'expander-list-link--fill-negative--blueberry': string;
|
|
51
|
+
'expander-list-link--fill-negative--cherry': string;
|
|
52
|
+
'expander-list-link--fill-negative--neutral': string;
|
|
53
|
+
'expander-list-link--fill-negative--white': string;
|
|
35
54
|
'expander-list-link--large': string;
|
|
36
55
|
'expander-list-link--line--blueberry': string;
|
|
37
56
|
'expander-list-link--line--cherry': string;
|
|
38
57
|
'expander-list-link--line--neutral': string;
|
|
39
58
|
'expander-list-link--line--white': string;
|
|
40
59
|
'expander-list-link--neutral': string;
|
|
60
|
+
'expander-list-link--new': string;
|
|
41
61
|
'expander-list-link--open': string;
|
|
42
62
|
'expander-list-link--outline': string;
|
|
43
63
|
'expander-list-link--outline--blueberry': string;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { HNDesignsystemHelpBubble } from '../../resources/Resources';
|
|
2
3
|
import { AnchorLinkTargets } from '../AnchorLink';
|
|
3
4
|
import { PopOverProps, PopOverVariant } from '../PopOver';
|
|
4
5
|
export declare const HelpBubbleVariant: typeof PopOverVariant;
|
|
5
6
|
export interface HelpBubbleProps extends Pick<PopOverProps, 'children' | 'variant' | 'controllerRef' | 'role'> {
|
|
7
|
+
/** Sets aria-label of the bubble. */
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
/** Sets aria-labelledby of the bubble. */
|
|
10
|
+
ariaLabelledById?: string;
|
|
6
11
|
/** Id of the HelpBubble */
|
|
7
12
|
helpBubbleId?: string;
|
|
8
13
|
/** Content shown inside HelpBubble. */
|
|
@@ -29,6 +34,8 @@ export interface HelpBubbleProps extends Pick<PopOverProps, 'children' | 'varian
|
|
|
29
34
|
onClose?: () => void;
|
|
30
35
|
/** aria-label to be passed onto Close */
|
|
31
36
|
closeAriaLabel?: string;
|
|
37
|
+
/** Resources for the component */
|
|
38
|
+
resources?: Partial<HNDesignsystemHelpBubble>;
|
|
32
39
|
/** Sets the data-testid attribute. */
|
|
33
40
|
testId?: string;
|
|
34
41
|
}
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
-
import { AnalyticsId } from "../../constants.js";
|
|
4
|
+
import { LanguageLocales, AnalyticsId } from "../../constants.js";
|
|
5
|
+
import { useLanguage } from "../../utils/language.js";
|
|
5
6
|
import { A as AnchorLink } from "../../AnchorLink.js";
|
|
6
7
|
import { C as Close } from "../../Close.js";
|
|
7
8
|
import { a as PopOverVariant, P as PopOver } from "../../PopOver.js";
|
|
8
9
|
import styles from "./styles.module.scss";
|
|
10
|
+
const ariaLabel = "Hjelpetekst";
|
|
11
|
+
const nbNO = {
|
|
12
|
+
ariaLabel
|
|
13
|
+
};
|
|
14
|
+
const getResources = (language) => {
|
|
15
|
+
switch (language) {
|
|
16
|
+
case LanguageLocales.NORWEGIAN:
|
|
17
|
+
default:
|
|
18
|
+
return nbNO;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
9
21
|
const HelpBubbleVariant = PopOverVariant;
|
|
10
22
|
const HelpBubble = React__default.forwardRef((props, ref) => {
|
|
11
23
|
const {
|
|
24
|
+
ariaLabelledById,
|
|
12
25
|
children,
|
|
13
26
|
className = "",
|
|
14
27
|
noCloseButton,
|
|
@@ -23,11 +36,19 @@ const HelpBubble = React__default.forwardRef((props, ref) => {
|
|
|
23
36
|
helpBubbleId,
|
|
24
37
|
variant,
|
|
25
38
|
controllerRef,
|
|
39
|
+
resources,
|
|
26
40
|
testId
|
|
27
41
|
} = props;
|
|
28
42
|
if (!showBubble) {
|
|
29
43
|
return null;
|
|
30
44
|
}
|
|
45
|
+
const { language } = useLanguage(LanguageLocales.NORWEGIAN);
|
|
46
|
+
const defaultResources = getResources(language);
|
|
47
|
+
const mergedResources = {
|
|
48
|
+
...defaultResources,
|
|
49
|
+
...resources,
|
|
50
|
+
ariaLabel: props.ariaLabel ?? (resources == null ? void 0 : resources.ariaLabel) ?? defaultResources.ariaLabel
|
|
51
|
+
};
|
|
31
52
|
const helpBubbleClasses = classNames(styles.helpbubble, className);
|
|
32
53
|
const contentClasses = classNames(styles.helpbubble__content);
|
|
33
54
|
const renderLink = () => {
|
|
@@ -43,13 +64,27 @@ const HelpBubble = React__default.forwardRef((props, ref) => {
|
|
|
43
64
|
}
|
|
44
65
|
return /* @__PURE__ */ jsx(Close, { small: true, color: "plum", onClick: onClose, ariaLabel: closeAriaLabel, className: styles.helpbubble__close });
|
|
45
66
|
};
|
|
46
|
-
return /* @__PURE__ */ jsx(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
68
|
+
PopOver,
|
|
69
|
+
{
|
|
70
|
+
ariaLabel: mergedResources.ariaLabel,
|
|
71
|
+
ariaLabelledById,
|
|
72
|
+
id: helpBubbleId,
|
|
73
|
+
variant,
|
|
74
|
+
controllerRef,
|
|
75
|
+
role: "dialog",
|
|
76
|
+
ref,
|
|
77
|
+
show: showBubble,
|
|
78
|
+
testId,
|
|
79
|
+
children: /* @__PURE__ */ jsxs("div", { className: helpBubbleClasses, "data-analyticsid": AnalyticsId.HelpBubble, children: [
|
|
80
|
+
renderCloseButton(),
|
|
81
|
+
/* @__PURE__ */ jsxs("div", { className: contentClasses, children: [
|
|
82
|
+
children,
|
|
83
|
+
renderLink()
|
|
84
|
+
] })
|
|
85
|
+
] })
|
|
86
|
+
}
|
|
87
|
+
);
|
|
53
88
|
});
|
|
54
89
|
HelpBubble.displayName = "HelpBubble";
|
|
55
90
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.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\nexport interface HelpBubbleProps extends Pick<PopOverProps, 'children' | 'variant' | 'controllerRef' | 'role'> {\n /** Id of the HelpBubble */\n helpBubbleId?: string;\n /** Content shown inside HelpBubble. */\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. */\n noCloseButton?: boolean;\n /** Visible text on the link. */\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 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 testId,\n } = props;\n\n if (!showBubble) {\n return null;\n }\n\n const helpBubbleClasses = classNames(styles.helpbubble, className);\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/HelpBubble/resourceHelper.ts","../../../src/components/HelpBubble/HelpBubble.tsx"],"sourcesContent":["import { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.HelpBubble.nb-NO.json';\nimport { HNDesignsystemHelpBubble } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemHelpBubble => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { HNDesignsystemHelpBubble } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport AnchorLink, { AnchorLinkTargets } from '../AnchorLink';\nimport Close from '../Close';\nimport PopOver, { PopOverProps, PopOverVariant } from '../PopOver';\nimport { getResources } from './resourceHelper';\n\nimport styles from './styles.module.scss';\n\nexport const HelpBubbleVariant = PopOverVariant;\n\nexport interface HelpBubbleProps extends Pick<PopOverProps, 'children' | 'variant' | 'controllerRef' | 'role'> {\n /** Sets aria-label of the bubble. */\n ariaLabel?: string;\n /** Sets aria-labelledby of the bubble. */\n ariaLabelledById?: string;\n /** Id of the HelpBubble */\n helpBubbleId?: string;\n /** Content shown inside HelpBubble. */\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. */\n noCloseButton?: boolean;\n /** Visible text on the link. */\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 /** Resources for the component */\n resources?: Partial<HNDesignsystemHelpBubble>;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst HelpBubble = React.forwardRef<HTMLDivElement | SVGSVGElement, HelpBubbleProps>((props, ref) => {\n const {\n ariaLabelledById,\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 resources,\n testId,\n } = props;\n\n if (!showBubble) {\n return null;\n }\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemHelpBubble = {\n ...defaultResources,\n ...resources,\n ariaLabel: props.ariaLabel ?? resources?.ariaLabel ?? defaultResources.ariaLabel,\n };\n\n const helpBubbleClasses = classNames(styles.helpbubble, className);\n const contentClasses = classNames(styles.helpbubble__content);\n\n const renderLink = (): JSX.Element | undefined => {\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) {\n return;\n }\n return <Close small color=\"plum\" onClick={onClose} ariaLabel={closeAriaLabel} className={styles.helpbubble__close} />;\n };\n\n return (\n <PopOver\n ariaLabel={mergedResources.ariaLabel}\n ariaLabelledById={ariaLabelledById}\n id={helpBubbleId}\n variant={variant}\n controllerRef={controllerRef}\n role=\"dialog\"\n ref={ref}\n show={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":";;;;;;;;;;;;;AAIa,MAAA,eAAe,CAAC,aAAwD;AACnF,UAAQ,UAAU;AAAA,IAChB,KAAK,gBAAgB;AAAA,IACrB;AACS,aAAA;AAAA,EAAA;AAEb;ACIO,MAAM,oBAAoB;AAuCjC,MAAM,aAAaA,eAAM,WAA4D,CAAC,OAAO,QAAQ;AAC7F,QAAA;AAAA,IACJ;AAAA,IACA;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,MAAI,CAAC,YAAY;AACR,WAAA;AAAA,EAAA;AAGT,QAAM,EAAE,SAAa,IAAA,YAA6B,gBAAgB,SAAS;AACrE,QAAA,mBAAmB,aAAa,QAAQ;AAC9C,QAAM,kBAA4C;AAAA,IAChD,GAAG;AAAA,IACH,GAAG;AAAA,IACH,WAAW,MAAM,cAAa,uCAAW,cAAa,iBAAiB;AAAA,EACzE;AAEA,QAAM,oBAAoB,WAAW,OAAO,YAAY,SAAS;AAC3D,QAAA,iBAAiB,WAAW,OAAO,mBAAmB;AAE5D,QAAM,aAAa,MAA+B;AAChD,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,eAAe;AACjB;AAAA,IAAA;AAEF,WAAQ,oBAAA,OAAA,EAAM,OAAK,MAAC,OAAM,QAAO,SAAS,SAAS,WAAW,gBAAgB,WAAW,OAAO,kBAAmB,CAAA;AAAA,EACrH;AAGE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,gBAAgB;AAAA,MAC3B;AAAA,MACA,IAAI;AAAA,MACJ;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL;AAAA,MACA,MAAM;AAAA,MACN;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;"}
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
.help-details {
|
|
8
8
|
@include fonts.help-text;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
color: var(--color-base-text-onlight);
|
|
11
|
+
background-color: var(--color-help-background-normal);
|
|
12
|
+
border: 1px solid var(--color-help-border-subtle-wcag);
|
|
12
13
|
border-radius: 0.25rem;
|
|
13
14
|
position: relative;
|
|
14
15
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { HNDesignsystemHelpDrawer } from '../../resources/Resources';
|
|
2
3
|
import { DrawerProps } from '../Drawer';
|
|
3
4
|
export interface HelpDrawerProps extends Pick<DrawerProps, 'ariaLabel' | 'ariaLabelledBy' | 'ariaLabelCloseBtn' | 'children' | 'isOpen' | 'onRequestClose' | 'title' | 'titleHtmlMarkup' | 'titleId' | 'zIndex'> {
|
|
5
|
+
/** Resources for the component */
|
|
6
|
+
resources?: Partial<HNDesignsystemHelpDrawer>;
|
|
4
7
|
/** Sets the data-testid attribute. */
|
|
5
8
|
testId?: string;
|
|
6
9
|
}
|
|
@@ -1,8 +1,38 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LanguageLocales } from "../../constants.js";
|
|
3
|
+
import { useLanguage } from "../../utils/language.js";
|
|
2
4
|
import { D as Drawer } from "../../Drawer.js";
|
|
3
5
|
import styles from "./styles.module.scss";
|
|
6
|
+
const ariaLabel = "Hjelpetekst";
|
|
7
|
+
const nbNO = {
|
|
8
|
+
ariaLabel
|
|
9
|
+
};
|
|
10
|
+
const getResources = (language) => {
|
|
11
|
+
switch (language) {
|
|
12
|
+
case LanguageLocales.NORWEGIAN:
|
|
13
|
+
default:
|
|
14
|
+
return nbNO;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
4
17
|
const HelpDrawer = (props) => {
|
|
5
|
-
|
|
18
|
+
var _a;
|
|
19
|
+
const { language } = useLanguage(LanguageLocales.NORWEGIAN);
|
|
20
|
+
const defaultResources = getResources(language);
|
|
21
|
+
const mergedResources = {
|
|
22
|
+
...defaultResources,
|
|
23
|
+
...props.resources,
|
|
24
|
+
ariaLabel: props.ariaLabel ?? ((_a = props.resources) == null ? void 0 : _a.ariaLabel) ?? defaultResources.ariaLabel
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
Drawer,
|
|
28
|
+
{
|
|
29
|
+
...props,
|
|
30
|
+
closeColor: "plum",
|
|
31
|
+
headerClasses: styles["help-drawer"],
|
|
32
|
+
desktopDirection: "left",
|
|
33
|
+
ariaLabel: mergedResources.ariaLabel
|
|
34
|
+
}
|
|
35
|
+
);
|
|
6
36
|
};
|
|
7
37
|
export {
|
|
8
38
|
HelpDrawer as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/HelpDrawer/HelpDrawer.tsx"],"sourcesContent":["import React from 'react';\n\nimport Drawer, { DrawerProps } from '../Drawer';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpDrawerProps\n extends Pick<\n DrawerProps,\n | 'ariaLabel'\n | 'ariaLabelledBy'\n | 'ariaLabelCloseBtn'\n | 'children'\n | 'isOpen'\n | 'onRequestClose'\n | 'title'\n | 'titleHtmlMarkup'\n | 'titleId'\n | 'zIndex'\n > {\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst HelpDrawer: React.FC<HelpDrawerProps> = props => {\n return <Drawer
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/HelpDrawer/resourceHelper.ts","../../../src/components/HelpDrawer/HelpDrawer.tsx"],"sourcesContent":["import { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.HelpDrawer.nb-NO.json';\nimport { HNDesignsystemHelpDrawer } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemHelpDrawer => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport { getResources } from './resourceHelper';\nimport { LanguageLocales } from '../../constants';\nimport { HNDesignsystemHelpDrawer } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport Drawer, { DrawerProps } from '../Drawer';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpDrawerProps\n extends Pick<\n DrawerProps,\n | 'ariaLabel'\n | 'ariaLabelledBy'\n | 'ariaLabelCloseBtn'\n | 'children'\n | 'isOpen'\n | 'onRequestClose'\n | 'title'\n | 'titleHtmlMarkup'\n | 'titleId'\n | 'zIndex'\n > {\n /** Resources for the component */\n resources?: Partial<HNDesignsystemHelpDrawer>;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst HelpDrawer: React.FC<HelpDrawerProps> = props => {\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemHelpDrawer = {\n ...defaultResources,\n ...props.resources,\n ariaLabel: props.ariaLabel ?? props.resources?.ariaLabel ?? defaultResources.ariaLabel,\n };\n\n return (\n <Drawer\n {...props}\n closeColor={'plum'}\n headerClasses={styles['help-drawer']}\n desktopDirection={'left'}\n ariaLabel={mergedResources.ariaLabel}\n />\n );\n};\n\nexport default HelpDrawer;\n"],"names":[],"mappings":";;;;;;;;;AAIa,MAAA,eAAe,CAAC,aAAwD;AACnF,UAAQ,UAAU;AAAA,IAChB,KAAK,gBAAgB;AAAA,IACrB;AACS,aAAA;AAAA,EAAA;AAEb;ACoBA,MAAM,aAAwC,CAAS,UAAA;;AACrD,QAAM,EAAE,SAAa,IAAA,YAA6B,gBAAgB,SAAS;AACrE,QAAA,mBAAmB,aAAa,QAAQ;AAC9C,QAAM,kBAA4C;AAAA,IAChD,GAAG;AAAA,IACH,GAAG,MAAM;AAAA,IACT,WAAW,MAAM,eAAa,WAAM,cAAN,mBAAiB,cAAa,iBAAiB;AAAA,EAC/E;AAGE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,YAAY;AAAA,MACZ,eAAe,OAAO,aAAa;AAAA,MACnC,kBAAkB;AAAA,MAClB,WAAW,gBAAgB;AAAA,IAAA;AAAA,EAC7B;AAEJ;"}
|
|
@@ -2,15 +2,5 @@
|
|
|
2
2
|
@import '../../scss/supernova/styles/colors.css';
|
|
3
3
|
|
|
4
4
|
.help-drawer {
|
|
5
|
-
background-color: var(--
|
|
6
|
-
|
|
7
|
-
&__close-button {
|
|
8
|
-
svg {
|
|
9
|
-
fill: var(--core-color-plum-700);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&:hover {
|
|
13
|
-
background-color: var(--core-color-plum-100);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
5
|
+
background-color: var(--color-help-background-normal);
|
|
16
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import '../../scss/supernova/styles/colors.css';
|
|
2
2
|
|
|
3
3
|
.help-panel {
|
|
4
|
-
background-color: var(--
|
|
5
|
-
border: 1px solid var(--
|
|
4
|
+
background-color: var(--color-help-background-normal) !important;
|
|
5
|
+
border: 1px solid var(--color-help-border-subtle-wcag) !important;
|
|
6
6
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
@import '../../scss/supernova/styles/colors.css';
|
|
2
2
|
|
|
3
3
|
.helpteaser {
|
|
4
|
-
background-color: var(--
|
|
5
|
-
border: 1px solid var(--
|
|
4
|
+
background-color: var(--color-help-background-normal);
|
|
5
|
+
border: 1px solid var(--color-help-border-subtle-wcag);
|
|
6
6
|
|
|
7
7
|
&::after {
|
|
8
8
|
background: linear-gradient(180deg, #f4ecfe40 0%, #f4ecfe 80%);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
&__button {
|
|
12
|
-
background-color: var(--
|
|
12
|
+
background-color: var(--color-help-graphics-normal);
|
|
13
13
|
|
|
14
14
|
&:hover {
|
|
15
|
-
background-color: var(--
|
|
15
|
+
background-color: var(--color-help-graphics-verydark);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
&:active {
|
|
19
|
-
background-color: var(--
|
|
19
|
+
background-color: var(--color-help-graphics-dark);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { FloatingDelayGroup } from '@floating-ui/react';
|
|
3
3
|
export interface HelpTooltipProps {
|
|
4
|
-
/** Ordet som skal ha en tilhørende tooltip */
|
|
5
|
-
children:
|
|
4
|
+
/** Ordet som skal ha en tilhørende tooltip. Det skal bare sendes inn string som children. Er satt til ReactNode for å kunne brukes i CMSet. */
|
|
5
|
+
children: React.ReactNode;
|
|
6
6
|
/** Teksten som skal vises i boblen som åpnes */
|
|
7
7
|
description: React.ReactNode;
|
|
8
8
|
/** Valgfri test-id */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/HelpTooltip/HelpTooltip.tsx"],"sourcesContent":["import React, { useState, useRef } from 'react';\n\nimport { useFloating, useHover, useFocus, useDismiss, useInteractions, FloatingDelayGroup } from '@floating-ui/react';\n\nimport { useUuid } from '../../hooks/useUuid';\nimport DictionaryTrigger from '../DictionaryTrigger';\nimport PopOver from '../PopOver';\n\nexport interface HelpTooltipProps {\n /** Ordet som skal ha en tilhørende tooltip */\n children:
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/HelpTooltip/HelpTooltip.tsx"],"sourcesContent":["import React, { useState, useRef } from 'react';\n\nimport { useFloating, useHover, useFocus, useDismiss, useInteractions, FloatingDelayGroup } from '@floating-ui/react';\n\nimport { useUuid } from '../../hooks/useUuid';\nimport DictionaryTrigger from '../DictionaryTrigger';\nimport PopOver from '../PopOver';\n\nexport interface HelpTooltipProps {\n /** Ordet som skal ha en tilhørende tooltip. Det skal bare sendes inn string som children. Er satt til ReactNode for å kunne brukes i CMSet. */\n children: React.ReactNode;\n /** Teksten som skal vises i boblen som åpnes */\n description: React.ReactNode;\n /** Valgfri test-id */\n testId?: string;\n}\n\nexport const HelpTooltip: React.FC<HelpTooltipProps> = ({ children, description, testId }) => {\n const popoverId = useUuid();\n const [showTooltip, setShowTooltip] = useState(false);\n\n const wordRef = useRef<HTMLButtonElement>(null);\n const { refs, context } = useFloating({\n open: showTooltip,\n elements: {\n reference: wordRef.current,\n },\n onOpenChange: setShowTooltip,\n });\n\n const hover = useHover(context, { move: false });\n const focus = useFocus(context);\n const dismiss = useDismiss(context);\n\n const { getReferenceProps } = useInteractions([hover, focus, dismiss]);\n\n return (\n <>\n <DictionaryTrigger ref={wordRef} {...getReferenceProps()} selected={showTooltip} aria-describedby={popoverId} data-testid={testId}>\n {children}\n </DictionaryTrigger>\n <PopOver role=\"tooltip\" ref={refs.setFloating} id={popoverId} show={showTooltip} testId={testId} controllerRef={wordRef}>\n {description}\n </PopOver>\n </>\n );\n};\n\nexport const HelpTooltipDelayGroup = FloatingDelayGroup;\n\nexport default HelpTooltip;\n"],"names":[],"mappings":";;;;;;AAiBO,MAAM,cAA0C,CAAC,EAAE,UAAU,aAAa,aAAa;AAC5F,QAAM,YAAY,QAAQ;AAC1B,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAE9C,QAAA,UAAU,OAA0B,IAAI;AAC9C,QAAM,EAAE,MAAM,QAAQ,IAAI,YAAY;AAAA,IACpC,MAAM;AAAA,IACN,UAAU;AAAA,MACR,WAAW,QAAQ;AAAA,IACrB;AAAA,IACA,cAAc;AAAA,EAAA,CACf;AAED,QAAM,QAAQ,SAAS,SAAS,EAAE,MAAM,OAAO;AACzC,QAAA,QAAQ,SAAS,OAAO;AACxB,QAAA,UAAU,WAAW,OAAO;AAE5B,QAAA,EAAE,sBAAsB,gBAAgB,CAAC,OAAO,OAAO,OAAO,CAAC;AAErE,SAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAA,oBAAC,mBAAkB,EAAA,KAAK,SAAU,GAAG,kBAAkB,GAAG,UAAU,aAAa,oBAAkB,WAAW,eAAa,QACxH,SACH,CAAA;AAAA,IACC,oBAAA,SAAA,EAAQ,MAAK,WAAU,KAAK,KAAK,aAAa,IAAI,WAAW,MAAM,aAAa,QAAgB,eAAe,SAC7G,UACH,YAAA,CAAA;AAAA,EAAA,GACF;AAEJ;AAEO,MAAM,wBAAwB;"}
|
|
@@ -23,6 +23,10 @@ export interface HelpTriggerIconProps extends Pick<React.InputHTMLAttributes<HTM
|
|
|
23
23
|
weight?: HelpTriggerWeights;
|
|
24
24
|
}
|
|
25
25
|
interface HelpTriggerIconInternalProps extends HelpTriggerIconProps {
|
|
26
|
+
/**
|
|
27
|
+
* Sets the hover styling of the trigger. Intended for use when wrapped by a parent button.
|
|
28
|
+
*/
|
|
29
|
+
isHovered?: boolean;
|
|
26
30
|
/**
|
|
27
31
|
* Only use this if the parent wrapper is a Button!
|
|
28
32
|
* Changes the underlying element of the trigger. If set to span, the trigger will be a non-interactive icon. Default: button
|
|
@@ -66,7 +66,7 @@ $outline-focus-outer-width: 5px;
|
|
|
66
66
|
$outline-width: clamp(0px, 0.3em, 3px);
|
|
67
67
|
|
|
68
68
|
inset: calc(-1 * (#{$outline-width}/ 3));
|
|
69
|
-
box-shadow: inset 0 0 0 #{$outline-width} var(--
|
|
69
|
+
box-shadow: inset 0 0 0 #{$outline-width} var(--color-action-border-onlight-focus);
|
|
70
70
|
z-index: 1;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -95,7 +95,7 @@ $outline-focus-outer-width: 5px;
|
|
|
95
95
|
&--large#{&}--is-button {
|
|
96
96
|
&:focus-visible {
|
|
97
97
|
box-shadow: none;
|
|
98
|
-
outline: 3px solid var(--
|
|
98
|
+
outline: 3px solid var(--color-action-border-onlight-focus);
|
|
99
99
|
outline-offset: -2px;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -115,38 +115,38 @@ $outline-focus-outer-width: 5px;
|
|
|
115
115
|
&--xlarge#{&}--is-button {
|
|
116
116
|
&:focus-visible {
|
|
117
117
|
box-shadow: none;
|
|
118
|
-
outline: 3.5px solid var(--
|
|
118
|
+
outline: 3.5px solid var(--color-action-border-onlight-focus);
|
|
119
119
|
outline-offset: -2px;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
&--is-button {
|
|
124
124
|
&:hover {
|
|
125
|
-
background-color: var(--
|
|
125
|
+
background-color: var(--color-help-background-transparent-onlight-hover);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
&:active {
|
|
129
|
-
background-color: var(--
|
|
129
|
+
background-color: var(--color-help-background-transparent-onlight-active);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
&--strong {
|
|
134
|
-
background-color: var(--
|
|
134
|
+
background-color: var(--color-help-graphics-normal);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
&--strong#{&}--is-button {
|
|
138
138
|
&:hover {
|
|
139
|
-
background-color: var(--
|
|
139
|
+
background-color: var(--color-help-graphics-verydark);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
&:active {
|
|
143
|
-
background-color: var(--
|
|
143
|
+
background-color: var(--color-help-graphics-normal);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
&:focus-visible {
|
|
147
147
|
box-shadow:
|
|
148
|
-
0 0 0 #{$outline-focus-inner-width} var(--
|
|
149
|
-
0 0 0 calc(#{$outline-focus-outer-width}) var(--
|
|
148
|
+
0 0 0 #{$outline-focus-inner-width} var(--color-base-graphics-ondark),
|
|
149
|
+
0 0 0 calc(#{$outline-focus-outer-width}) var(--color-action-border-onlight-focus);
|
|
150
150
|
outline: none;
|
|
151
151
|
|
|
152
152
|
&::after {
|
|
@@ -2,13 +2,16 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { AnalyticsId } from "../../constants.js";
|
|
5
|
+
import { useHover } from "../../hooks/useHover.js";
|
|
5
6
|
import { getAriaLabelAttributes } from "../../utils/accessibility.js";
|
|
7
|
+
import { mergeRefs } from "../../utils/refs.js";
|
|
6
8
|
import { H as HelpTriggerIconInternal } from "../../HelpTriggerIcon.js";
|
|
7
9
|
import styles from "./styles.module.scss";
|
|
8
10
|
const HelpTriggerInline = React__default.forwardRef(
|
|
9
11
|
({ ariaLabel, ariaLabelledById, children, className, testId, weight = "normal", ...rest }, ref) => {
|
|
10
12
|
const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });
|
|
11
13
|
const helpTriggerInlineStyles = classNames(styles["help-trigger-inline"], className);
|
|
14
|
+
const { hoverRef, isHovered } = useHover(ref, false);
|
|
12
15
|
return /* @__PURE__ */ jsxs(
|
|
13
16
|
"button",
|
|
14
17
|
{
|
|
@@ -17,12 +20,12 @@ const HelpTriggerInline = React__default.forwardRef(
|
|
|
17
20
|
"data-testid": testId,
|
|
18
21
|
"data-analyticsid": AnalyticsId.HelpTriggerInline,
|
|
19
22
|
className: helpTriggerInlineStyles,
|
|
20
|
-
ref,
|
|
23
|
+
ref: mergeRefs([hoverRef, ref]),
|
|
21
24
|
...ariaLabelAttributes,
|
|
22
25
|
...rest,
|
|
23
26
|
children: [
|
|
24
27
|
/* @__PURE__ */ jsx("span", { className: styles["help-trigger-inline__text"], children }),
|
|
25
|
-
/* @__PURE__ */ jsx(HelpTriggerIconInternal, { weight, size: "inherit", htmlMarkup: "span" })
|
|
28
|
+
/* @__PURE__ */ jsx(HelpTriggerIconInternal, { weight, size: "inherit", htmlMarkup: "span", isHovered })
|
|
26
29
|
]
|
|
27
30
|
}
|
|
28
31
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/HelpTriggerInline/HelpTriggerInline.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { HelpTriggerIconInternal, HelpTriggerWeights } from '../HelpTriggerIcon';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpTriggerInlineProps\n extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded'> {\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 /** Sets the text content of the HelpTriggerInline. */\n children: string;\n /**\n * Sets the colors of the help trigger. Default: normal.\n */\n weight?: HelpTriggerWeights;\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 HelpTriggerInline = React.forwardRef<HTMLButtonElement, HelpTriggerInlineProps>(\n ({ ariaLabel, ariaLabelledById, children, className, testId, weight = 'normal', ...rest }, ref) => {\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n const helpTriggerInlineStyles = classNames(styles['help-trigger-inline'], className);\n\n return (\n <button\n aria-label={ariaLabel}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.HelpTriggerInline}\n className={helpTriggerInlineStyles}\n ref={ref}\n {...ariaLabelAttributes}\n {...rest}\n >\n <span className={styles['help-trigger-inline__text']}>{children}</span>\n <HelpTriggerIconInternal weight={weight} size={'inherit'} htmlMarkup={'span'} />\n </button>\n );\n }\n);\n\nHelpTriggerInline.displayName = 'HelpTriggerInline';\n\nexport default HelpTriggerInline;\n"],"names":["React"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/HelpTriggerInline/HelpTriggerInline.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useHover } from '../../hooks/useHover';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { mergeRefs } from '../../utils/refs';\nimport { HelpTriggerIconInternal, HelpTriggerWeights } from '../HelpTriggerIcon';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpTriggerInlineProps\n extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded'> {\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 /** Sets the text content of the HelpTriggerInline. */\n children: string;\n /**\n * Sets the colors of the help trigger. Default: normal.\n */\n weight?: HelpTriggerWeights;\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 HelpTriggerInline = React.forwardRef<HTMLButtonElement, HelpTriggerInlineProps>(\n ({ ariaLabel, ariaLabelledById, children, className, testId, weight = 'normal', ...rest }, ref) => {\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n const helpTriggerInlineStyles = classNames(styles['help-trigger-inline'], className);\n const { hoverRef, isHovered } = useHover<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>, false);\n\n return (\n <button\n aria-label={ariaLabel}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.HelpTriggerInline}\n className={helpTriggerInlineStyles}\n ref={mergeRefs([hoverRef, ref])}\n {...ariaLabelAttributes}\n {...rest}\n >\n <span className={styles['help-trigger-inline__text']}>{children}</span>\n <HelpTriggerIconInternal weight={weight} size={'inherit'} htmlMarkup={'span'} isHovered={isHovered} />\n </button>\n );\n }\n);\n\nHelpTriggerInline.displayName = 'HelpTriggerInline';\n\nexport default HelpTriggerInline;\n"],"names":["React"],"mappings":";;;;;;;;;AAsCA,MAAM,oBAAoBA,eAAM;AAAA,EAC9B,CAAC,EAAE,WAAW,kBAAkB,UAAU,WAAW,QAAQ,SAAS,UAAU,GAAG,KAAK,GAAG,QAAQ;AACjG,UAAM,sBAAsB,uBAAuB,EAAE,OAAO,WAAW,IAAI,kBAAkB;AAC7F,UAAM,0BAA0B,WAAW,OAAO,qBAAqB,GAAG,SAAS;AACnF,UAAM,EAAE,UAAU,UAAA,IAAc,SAA4B,KAA2C,KAAK;AAG1G,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,UAAU,GAAG,CAAC;AAAA,QAC7B,GAAG;AAAA,QACH,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA,oBAAC,QAAK,EAAA,WAAW,OAAO,2BAA2B,GAAI,UAAS;AAAA,8BAC/D,yBAAwB,EAAA,QAAgB,MAAM,WAAW,YAAY,QAAQ,UAAsB,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACtG;AAAA,EAAA;AAGN;AAEA,kBAAkB,cAAc;"}
|
|
@@ -12,7 +12,7 @@ $outline-xl-width: 2.5px;
|
|
|
12
12
|
|
|
13
13
|
.help-trigger-inline {
|
|
14
14
|
display: inline;
|
|
15
|
-
color: var(--
|
|
15
|
+
color: var(--color-help-graphics-normal);
|
|
16
16
|
cursor: pointer;
|
|
17
17
|
text-decoration: none;
|
|
18
18
|
background-color: transparent;
|
|
@@ -22,8 +22,10 @@ $outline-xl-width: 2.5px;
|
|
|
22
22
|
font-size: clamp(0px, 1em, 48px);
|
|
23
23
|
font-weight: inherit;
|
|
24
24
|
|
|
25
|
-
&:hover
|
|
26
|
-
|
|
25
|
+
&:hover,
|
|
26
|
+
&:active {
|
|
27
|
+
color: var(--color-help-graphics-verydark);
|
|
28
|
+
background-color: var(--color-help-background-transparent-onlight-hover);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
&:focus-visible {
|
|
@@ -31,7 +33,9 @@ $outline-xl-width: 2.5px;
|
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
&:active {
|
|
34
|
-
text-decoration:
|
|
36
|
+
text-decoration-line: underline;
|
|
37
|
+
text-decoration-style: solid;
|
|
38
|
+
text-decoration-thickness: 1px;
|
|
35
39
|
text-underline-offset: 4.23px;
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -33,14 +33,16 @@ $outline-xl-width: 2.5px;
|
|
|
33
33
|
align-items: center;
|
|
34
34
|
justify-content: center;
|
|
35
35
|
min-height: var(--core-space-l);
|
|
36
|
-
color: var(--
|
|
36
|
+
color: var(--color-help-graphics-normal);
|
|
37
37
|
padding: 0 var(--core-space-3xs);
|
|
38
38
|
font-size: 1rem;
|
|
39
39
|
font-weight: 600;
|
|
40
40
|
line-height: 1.2rem;
|
|
41
41
|
|
|
42
|
-
:hover >
|
|
43
|
-
|
|
42
|
+
:hover > &,
|
|
43
|
+
:active > & {
|
|
44
|
+
color: var(--color-help-graphics-verydark);
|
|
45
|
+
background-color: var(--color-help-background-transparent-onlight-hover);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
:focus-visible > & {
|
|
@@ -48,7 +50,9 @@ $outline-xl-width: 2.5px;
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
:active > & {
|
|
51
|
-
text-decoration:
|
|
53
|
+
text-decoration-line: underline;
|
|
54
|
+
text-decoration-style: solid;
|
|
55
|
+
text-decoration-thickness: 1px;
|
|
52
56
|
text-underline-offset: 4.23px;
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|