@helsenorge/designsystem-react 7.12.0 → 7.13.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 +8 -0
- package/_virtual/dynamic-import-helper.js +11 -4
- package/_virtual/dynamic-import-helper.js.map +1 -1
- package/_virtual/index.js +2 -2
- package/components/AnchorLink/AnchorLink.js +16 -16
- package/components/AnchorLink/AnchorLink.js.map +1 -1
- package/components/Avatar/Avatar.js +9 -9
- package/components/Avatar/Avatar.js.map +1 -1
- package/components/Badge/Badge.js +7 -7
- package/components/Badge/Badge.js.map +1 -1
- package/components/Badge/NotificationBadge.js +5 -5
- package/components/Badge/NotificationBadge.js.map +1 -1
- package/components/Button/Button.js +23 -23
- package/components/Button/Button.js.map +1 -1
- package/components/ButtonWithModal/ButtonWithModal.js +5 -5
- package/components/ButtonWithModal/ButtonWithModal.js.map +1 -1
- package/components/Checkbox/Checkbox.js +41 -42
- package/components/Checkbox/Checkbox.js.map +1 -1
- package/components/Checkbox/index.js +2 -3
- package/components/Checkbox/index.js.map +1 -1
- package/components/Checkbox/styles.module.scss +2 -2
- package/components/Close/Close.js +9 -9
- package/components/Close/Close.js.map +1 -1
- package/components/DictionaryTrigger/DictionaryTrigger.js +14 -15
- package/components/DictionaryTrigger/DictionaryTrigger.js.map +1 -1
- package/components/DictionaryTrigger/styles.module.scss +1 -2
- package/components/Dropdown/Dropdown.js +24 -24
- package/components/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/styles.module.scss +1 -1
- package/components/Duolist/Duolist.d.ts +3 -0
- package/components/Duolist/Duolist.js +45 -36
- package/components/Duolist/Duolist.js.map +1 -1
- package/components/Duolist/index.js +5 -5
- package/components/Duolist/styles.module.scss +4 -0
- package/components/Duolist/styles.module.scss.d.ts +1 -0
- package/components/EmptyState/EmptyState.js +3 -3
- package/components/EmptyState/EmptyState.js.map +1 -1
- package/components/EmptyState/NobodyHome.js +3 -3
- package/components/EmptyState/NobodyHome.js.map +1 -1
- package/components/ErrorWrapper/ErrorWrapper.js +4 -4
- package/components/ErrorWrapper/ErrorWrapper.js.map +1 -1
- package/components/ErrorWrapper/index.js +2 -3
- package/components/ErrorWrapper/index.js.map +1 -1
- package/components/Expander/Expander.js +10 -10
- package/components/Expander/Expander.js.map +1 -1
- package/components/Expander/styles.module.scss +1 -1
- package/components/ExpanderHierarchy/Expander.js +5 -5
- package/components/ExpanderHierarchy/Expander.js.map +1 -1
- package/components/ExpanderHierarchy/ExpanderButton.js +7 -7
- package/components/ExpanderHierarchy/ExpanderButton.js.map +1 -1
- package/components/ExpanderHierarchy/ExpanderHierarchy.js +13 -14
- package/components/ExpanderHierarchy/ExpanderHierarchy.js.map +1 -1
- package/components/ExpanderHierarchy/expander.module.scss +2 -2
- package/components/ExpanderList/ExpanderList.js +34 -35
- package/components/ExpanderList/ExpanderList.js.map +1 -1
- package/components/ExpanderList/index.js +2 -3
- package/components/ExpanderList/index.js.map +1 -1
- package/components/ExpanderList/styles.module.scss +1 -1
- package/components/FormExample/FormExample.d.ts +0 -1
- package/components/FormExample/FormExample.js +12 -12
- package/components/FormExample/FormExample.js.map +1 -1
- package/components/FormExample/index.js +5 -5
- package/components/FormGroup/FormGroup.js +37 -38
- package/components/FormGroup/FormGroup.js.map +1 -1
- package/components/FormGroup/index.js +2 -3
- package/components/FormGroup/index.js.map +1 -1
- package/components/FormLayout/FormLayout.js +16 -17
- package/components/FormLayout/FormLayout.js.map +1 -1
- package/components/FormLayout/index.js +4 -4
- package/components/GridExample/GridExample.js +3 -3
- package/components/GridExample/GridExample.js.map +1 -1
- package/components/GridExample/index.js +3 -4
- package/components/GridExample/index.js.map +1 -1
- package/components/HelpBubble/HelpBubble.js +26 -27
- package/components/HelpBubble/HelpBubble.js.map +1 -1
- package/components/HelpBubble/styles.module.scss +1 -1
- package/components/HelpBubbleExample/HelpBubbleExample.js +3 -3
- package/components/HelpBubbleExample/HelpBubbleExample.js.map +1 -1
- package/components/HelpPanel/HelpPanel.js +11 -11
- package/components/HelpPanel/HelpPanel.js.map +1 -1
- package/components/HelpQuestion/HelpQuestion.js +16 -17
- package/components/HelpQuestion/HelpQuestion.js.map +1 -1
- package/components/HighlightBox/HighlightBox.js +16 -16
- package/components/HighlightBox/HighlightBox.js.map +1 -1
- package/components/HighlightBox/styles.module.scss +4 -4
- package/components/HorizontalScroll/HorizontalScroll.js +4 -4
- package/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
- package/components/HorizontalScroll/index.js +2 -3
- package/components/HorizontalScroll/index.js.map +1 -1
- package/components/Illustration/Illustration.js +16 -17
- package/components/Illustration/Illustration.js.map +1 -1
- package/components/Illustration/index.js +5 -5
- package/components/Input/Input.js +65 -67
- package/components/Input/Input.js.map +1 -1
- package/components/Label/Label.js +16 -16
- package/components/Label/Label.js.map +1 -1
- package/components/LazyIcon/ErrorBoundary.js +7 -8
- package/components/LazyIcon/ErrorBoundary.js.map +1 -1
- package/components/LazyIcon/LazyIcon.js +4 -4
- package/components/LazyIcon/LazyIcon.js.map +1 -1
- package/components/LazyIcon/index.js +3 -3
- package/components/LazyIllustration/LazyIllustration.js +10 -10
- package/components/LazyIllustration/LazyIllustration.js.map +1 -1
- package/components/LazyIllustration/index.js +5 -5
- package/components/LinkList/LinkList.js +36 -37
- package/components/LinkList/LinkList.js.map +1 -1
- package/components/LinkList/index.js +2 -3
- package/components/LinkList/index.js.map +1 -1
- package/components/List/List.js +7 -8
- package/components/List/List.js.map +1 -1
- package/components/ListHeader/ListHeader.js +1 -1
- package/components/ListHeader/ListHeader.js.map +1 -1
- package/components/ListHeader/ListHeaderText/ListHeaderText.js +18 -19
- package/components/ListHeader/ListHeaderText/ListHeaderText.js.map +1 -1
- package/components/ListHeader/ListHeaderText/index.js +2 -3
- package/components/ListHeader/ListHeaderText/index.js.map +1 -1
- package/components/Loader/Loader.js +2 -2
- package/components/Loader/Loader.js.map +1 -1
- package/components/Logo/Logo.js +5 -5
- package/components/Logo/Logo.js.map +1 -1
- package/components/MaxCharacters/MaxCharacters.js +5 -5
- package/components/MaxCharacters/MaxCharacters.js.map +1 -1
- package/components/Modal/Modal.js +32 -33
- package/components/Modal/Modal.js.map +1 -1
- package/components/Modal/styles.module.scss +8 -8
- package/components/NotificationPanel/NotificationPanel.js +14 -14
- package/components/NotificationPanel/NotificationPanel.js.map +1 -1
- package/components/NotificationPanel/styles.module.scss +3 -3
- package/components/Panel/Panel.js +25 -25
- package/components/Panel/Panel.js.map +1 -1
- package/components/Panel/styles.module.scss +3 -3
- package/components/PanelList/PanelList.js +8 -8
- package/components/PanelList/PanelList.js.map +1 -1
- package/components/PopMenu/PopMenu.js +14 -14
- package/components/PopMenu/PopMenu.js.map +1 -1
- package/components/PopMenu/index.js +3 -3
- package/components/PopOver/PopOver.js +27 -28
- package/components/PopOver/PopOver.js.map +1 -1
- package/components/Portal/index.js.map +1 -1
- package/components/Progressbar/Progressbar.js +13 -13
- package/components/Progressbar/Progressbar.js.map +1 -1
- package/components/PromoPanel/PromoPanel.js +16 -16
- package/components/PromoPanel/PromoPanel.js.map +1 -1
- package/components/RadioButton/RadioButton.js +52 -53
- package/components/RadioButton/RadioButton.js.map +1 -1
- package/components/RadioButton/index.js +4 -4
- package/components/RadioButton/styles.module.scss +2 -2
- package/components/Select/Select.js +21 -21
- package/components/Select/Select.js.map +1 -1
- package/components/Select/index.js +2 -3
- package/components/Select/index.js.map +1 -1
- package/components/ServiceMessage/ServiceMessage.js +30 -30
- package/components/ServiceMessage/ServiceMessage.js.map +1 -1
- package/components/ServiceMessage/styles.module.scss +10 -10
- package/components/SharingStatus/SharingStatus.js +7 -7
- package/components/SharingStatus/SharingStatus.js.map +1 -1
- package/components/Slider/Slider.js +15 -17
- package/components/Slider/Slider.js.map +1 -1
- package/components/Slider/index.js +2 -3
- package/components/Slider/index.js.map +1 -1
- package/components/Spacer/Spacer.js +4 -4
- package/components/Spacer/Spacer.js.map +1 -1
- package/components/StatusDot/StatusDot.js +8 -8
- package/components/StatusDot/StatusDot.js.map +1 -1
- package/components/Step/Step.js +10 -10
- package/components/Step/Step.js.map +1 -1
- package/components/StepButtons/StepButtons.js +4 -4
- package/components/StepButtons/StepButtons.js.map +1 -1
- package/components/StepButtons/index.js +2 -3
- package/components/StepButtons/index.js.map +1 -1
- package/components/Stepper/Dot.js +3 -3
- package/components/Stepper/Dot.js.map +1 -1
- package/components/Stepper/DotList.js +4 -4
- package/components/Stepper/DotList.js.map +1 -1
- package/components/Stepper/Stepper.js +10 -10
- package/components/Stepper/Stepper.js.map +1 -1
- package/components/Table/Table.js +1 -1
- package/components/Table/TableBody/TableBody.js +3 -3
- package/components/Table/TableBody/TableBody.js.map +1 -1
- package/components/Table/TableBody/index.js +3 -4
- package/components/Table/TableBody/index.js.map +1 -1
- package/components/Table/TableCell/TableCell.js +10 -10
- package/components/Table/TableCell/TableCell.js.map +1 -1
- package/components/Table/TableCell/index.js +4 -4
- package/components/Table/TableExpandedRow/TableExpandedRow.js +8 -8
- package/components/Table/TableExpandedRow/TableExpandedRow.js.map +1 -1
- package/components/Table/TableExpandedRow/index.js +3 -4
- package/components/Table/TableExpandedRow/index.js.map +1 -1
- package/components/Table/TableExpanderCell/TableExpanderCell.js +3 -3
- package/components/Table/TableExpanderCell/TableExpanderCell.js.map +1 -1
- package/components/Table/TableExpanderCell/TableExpanderCellMobile.js +11 -11
- package/components/Table/TableExpanderCell/TableExpanderCellMobile.js.map +1 -1
- package/components/Table/TableExpanderCell/index.js +3 -4
- package/components/Table/TableExpanderCell/index.js.map +1 -1
- package/components/Table/TableHead/TableHead.js +9 -9
- package/components/Table/TableHead/TableHead.js.map +1 -1
- package/components/Table/TableHead/index.js +4 -4
- package/components/Table/TableHeadCell/TableHeadCell.js +15 -15
- package/components/Table/TableHeadCell/TableHeadCell.js.map +1 -1
- package/components/Table/TableHeadCell/index.js +4 -4
- package/components/Table/TableRow/TableRow.js +16 -16
- package/components/Table/TableRow/TableRow.js.map +1 -1
- package/components/Table/TableRow/index.js +3 -4
- package/components/Table/TableRow/index.js.map +1 -1
- package/components/Table/styles.module.scss +3 -3
- package/components/Table/utils.d.ts +1 -1
- package/components/Tabs/Tab.js +2 -2
- package/components/Tabs/Tab.js.map +1 -1
- package/components/Tabs/TabList/TabList.js +43 -38
- package/components/Tabs/TabList/TabList.js.map +1 -1
- package/components/Tabs/TabList/styles.module.scss +14 -4
- package/components/Tabs/TabPanel/TabPanel.d.ts +5 -1
- package/components/Tabs/TabPanel/TabPanel.js +13 -9
- package/components/Tabs/TabPanel/TabPanel.js.map +1 -1
- package/components/Tabs/TabPanel/styles.module.scss +48 -6
- package/components/Tabs/TabPanel/styles.module.scss.d.ts +4 -0
- package/components/Tabs/Tabs.d.ts +8 -4
- package/components/Tabs/Tabs.js +85 -16
- package/components/Tabs/Tabs.js.map +1 -1
- package/components/Tabs/styles.module.scss +38 -2
- package/components/Tabs/styles.module.scss.d.ts +7 -1
- package/components/Tag/Tag.js +3 -3
- package/components/Tag/Tag.js.map +1 -1
- package/components/TagList/TagList.js +1 -1
- package/components/TagList/TagList.js.map +1 -1
- package/components/Textarea/Textarea.js +48 -49
- package/components/Textarea/Textarea.js.map +1 -1
- package/components/Tile/Tile.js +14 -15
- package/components/Tile/Tile.js.map +1 -1
- package/components/Tile/index.js +2 -3
- package/components/Tile/index.js.map +1 -1
- package/components/Title/Title.js +10 -10
- package/components/Title/Title.js.map +1 -1
- package/components/Title/index.js +4 -4
- package/components/Tooltip/Tooltip.js +4 -4
- package/components/Tooltip/Tooltip.js.map +1 -1
- package/components/Tooltip/TooltipWord/TooltipWord.js +17 -18
- package/components/Tooltip/TooltipWord/TooltipWord.js.map +1 -1
- package/components/Tooltip/index.js +5 -5
- package/components/TooltipExample/TooltipExample.js +4 -4
- package/components/TooltipExample/TooltipExample.js.map +1 -1
- package/components/Trigger/HelpSign.js +3 -3
- package/components/Trigger/HelpSign.js.map +1 -1
- package/components/Trigger/Trigger.js +25 -26
- package/components/Trigger/Trigger.js.map +1 -1
- package/components/Validation/ErrorList.js +5 -5
- package/components/Validation/ErrorList.js.map +1 -1
- package/components/Validation/ErrorListItem.js +8 -8
- package/components/Validation/ErrorListItem.js.map +1 -1
- package/components/Validation/Validation.js +13 -14
- package/components/Validation/Validation.js.map +1 -1
- package/components/Validation/ValidationSummary.js +4 -4
- package/components/Validation/ValidationSummary.js.map +1 -1
- package/components/Validation/index.js +3 -4
- package/components/Validation/index.js.map +1 -1
- package/components/Validation/types.d.ts +0 -1
- package/constants.d.ts +2 -1
- package/constants.js +1 -1
- package/constants.js.map +1 -1
- package/hooks/useIcons.d.ts +0 -1
- package/hooks/useIcons.js +1 -1
- package/hooks/useLayoutEvent.js +1 -2
- package/hooks/useLayoutEvent.js.map +1 -1
- package/hooks/useSticky.d.ts +1 -1
- package/package.json +1 -1
- package/scss/_palette.scss +1 -0
- package/scss/typography.module.scss +1 -1
- package/scss/typography.module.scss.d.ts +1 -1
- package/scss/typography.stories.tsx +157 -0
- package/theme/currys/color.d.ts +1 -1
- package/utils/accessibility.d.ts +2 -1
- package/utils/accessibility.js +1 -1
- package/utils/accessibility.js.map +1 -1
- package/utils/component.d.ts +3 -3
- package/utils/refs.d.ts +1 -2
- package/_virtual/index2.js +0 -5
- package/_virtual/index2.js.map +0 -1
- package/_virtual/index3.js +0 -5
- package/_virtual/index3.js.map +0 -1
- package/components/AnchorLink/AnchorLink.stories.d.ts +0 -31
- package/components/Avatar/Avatar.stories.d.ts +0 -36
- package/components/Badge/Badge.stories.d.ts +0 -42
- package/components/Button/Button.stories.d.ts +0 -56
- package/components/Checkbox/Checkbox.stories.d.ts +0 -54
- package/components/Close/Close.stories.d.ts +0 -29
- package/components/DictionaryTrigger/DictionaryTrigger.stories.d.ts +0 -30
- package/components/Dropdown/Dropdown.stories.d.ts +0 -67
- package/components/Duolist/Duolist.stories.d.ts +0 -32
- package/components/EmptyState/EmptyState.stories.d.ts +0 -26
- package/components/Expander/Expander.stories.d.ts +0 -60
- package/components/ExpanderHierarchy/ExpanderHierarchy.stories.d.ts +0 -44
- package/components/ExpanderList/ExpanderList.stories.d.ts +0 -59
- package/components/FormGroup/FormGroup.stories.d.ts +0 -50
- package/components/FormLayout/FormLayout.stories.d.ts +0 -32
- package/components/HelpBubble/HelpBubble.stories.d.ts +0 -46
- package/components/HelpPanel/HelpPanel.stories.d.ts +0 -31
- package/components/HelpQuestion/HelpQuestion.stories.d.ts +0 -29
- package/components/HighlightBox/HighlightBox.stories.d.ts +0 -42
- package/components/Icon/Icon.stories.d.ts +0 -38
- package/components/Illustration/Illustration.stories.d.ts +0 -34
- package/components/Illustration/Illustrations.stories.d.ts +0 -41
- package/components/Input/Input.stories.d.ts +0 -94
- package/components/Label/Label.stories.d.ts +0 -25
- package/components/LazyIcon/LazyIcon.stories.d.ts +0 -25
- package/components/LazyIllustration/LazyIllustration.stories.d.ts +0 -38
- package/components/LinkList/LinkList.stories.d.ts +0 -49
- package/components/List/List.stories.d.ts +0 -52
- package/components/Loader/Loader.stories.d.ts +0 -31
- package/components/Logo/Logo.stories.d.ts +0 -37
- package/components/Modal/Modal.stories.d.ts +0 -76
- package/components/NotificationPanel/NotificationPanel.stories.d.ts +0 -60
- package/components/Panel/Panel.stories.d.ts +0 -89
- package/components/PanelList/PanelList.stories.d.ts +0 -27
- package/components/PopMenu/PopMenu.stories.d.ts +0 -39
- package/components/PopOver/PopOver.stories.d.ts +0 -38
- package/components/Progressbar/Progressbar.stories.d.ts +0 -43
- package/components/PromoPanel/PromoPanel.stories.d.ts +0 -45
- package/components/RadioButton/RadioButton.stories.d.ts +0 -57
- package/components/Select/Select.stories.d.ts +0 -38
- package/components/ServiceMessage/ServiceMessage.stories.d.ts +0 -71
- package/components/SharingStatus/SharingStatus.stories.d.ts +0 -31
- package/components/Slider/Slider.stories.d.ts +0 -52
- package/components/Spacer/Spacer.stories.d.ts +0 -17
- package/components/StatusDot/StatusDot.stories.d.ts +0 -31
- package/components/Step/Step.stories.d.ts +0 -32
- package/components/StepButtons/StepButtons.stories.d.ts +0 -19
- package/components/Stepper/Stepper.stories.d.ts +0 -38
- package/components/Table/Table.stories.d.ts +0 -90
- package/components/Tabs/Tabs.stories.d.ts +0 -50
- package/components/Tag/Tag.stories.d.ts +0 -48
- package/components/TagList/TagList.stories.d.ts +0 -17
- package/components/Textarea/Textarea.stories.d.ts +0 -94
- package/components/Tile/Tile.stories.d.ts +0 -65
- package/components/Title/Title.stories.d.ts +0 -40
- package/components/Tooltip/Tooltip.stories.d.ts +0 -34
- package/components/Trigger/Trigger.stories.d.ts +0 -52
- package/components/Validation/Validation.stories.d.ts +0 -37
- package/hoc/withBreakpoint/withBreakpoint.stories.d.ts +0 -17
- package/hooks/useBreakpoint.stories.d.ts +0 -16
- package/hooks/useDelayedState.stories.d.ts +0 -27
- package/hooks/useElementList.stories.d.ts +0 -16
- package/hooks/useFocusToggle.stories.d.ts +0 -16
- package/hooks/useFocusTrap.stories.d.ts +0 -16
- package/hooks/useFocusableElements.stories.d.ts +0 -16
- package/hooks/useHover.stories.d.ts +0 -16
- package/hooks/useIntersectionObserver.stories.d.ts +0 -16
- package/hooks/useInterval.stories.d.ts +0 -16
- package/hooks/useIsVisible.stories.d.ts +0 -27
- package/hooks/useKeyboardEvent.stories.d.ts +0 -16
- package/hooks/useLayoutEvent.stories.d.ts +0 -16
- package/hooks/useOutsideEvent.stories.d.ts +0 -16
- package/hooks/usePseudoClasses.stories.d.ts +0 -16
- package/hooks/useResizeObserver.stories.d.ts +0 -16
- package/hooks/useRovingFocus.stories.d.ts +0 -17
- package/hooks/useSize.stories.d.ts +0 -16
- package/hooks/useSticky.stories.d.ts +0 -16
- package/hooks/useUuid.stories.d.ts +0 -16
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import s from "react";
|
|
2
|
+
import p from "classnames";
|
|
3
|
+
import n from "../HighlightBox/HighlightBox.js";
|
|
4
4
|
import c from "../Icons/HandWaving.js";
|
|
5
5
|
import e from "../HelpPanel/styles.module.scss";
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
|
|
6
|
+
const d = ({ className: a, testId: t, size: l, children: o, title: r }) => {
|
|
7
|
+
const m = p(e["help-panel"], a);
|
|
8
|
+
return /* @__PURE__ */ s.createElement(
|
|
9
|
+
n,
|
|
10
10
|
{
|
|
11
|
-
className:
|
|
11
|
+
className: m,
|
|
12
12
|
contentWrapperClassName: e["help-panel"],
|
|
13
|
-
testId:
|
|
14
|
-
size:
|
|
13
|
+
testId: t,
|
|
14
|
+
size: l,
|
|
15
15
|
svgIcon: c,
|
|
16
16
|
title: r
|
|
17
17
|
},
|
|
18
18
|
o
|
|
19
19
|
);
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
export {
|
|
22
22
|
d as default
|
|
23
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpPanel.js","sources":["../../../src/components/HelpPanel/HelpPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HighlightBox, { HighlightBoxSize } from '../HighlightBox';\nimport HandWaving from '../Icons/HandWaving';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpPanelProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** Changes the size. Default: medium */\n size?: keyof typeof HighlightBoxSize;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets title if needed */\n title?: string;\n}\n\nconst HelpPanel: React.FC<HelpPanelProps> = ({ className, testId, size, children, title }) => {\n const helpPanelClassName = classNames(styles['help-panel'], className);\n\n return (\n <HighlightBox\n className={helpPanelClassName}\n contentWrapperClassName={styles['help-panel']}\n testId={testId}\n size={size}\n svgIcon={HandWaving}\n title={title}\n >\n {children}\n </HighlightBox>\n );\n};\n\nexport default HelpPanel;\n"],"names":["HelpPanel","className","testId","size","children","title","helpPanelClassName","classNames","styles","React","HighlightBox","HandWaving"
|
|
1
|
+
{"version":3,"file":"HelpPanel.js","sources":["../../../src/components/HelpPanel/HelpPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HighlightBox, { HighlightBoxSize } from '../HighlightBox';\nimport HandWaving from '../Icons/HandWaving';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpPanelProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** Changes the size. Default: medium */\n size?: keyof typeof HighlightBoxSize;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets title if needed */\n title?: string;\n}\n\nconst HelpPanel: React.FC<HelpPanelProps> = ({ className, testId, size, children, title }) => {\n const helpPanelClassName = classNames(styles['help-panel'], className);\n\n return (\n <HighlightBox\n className={helpPanelClassName}\n contentWrapperClassName={styles['help-panel']}\n testId={testId}\n size={size}\n svgIcon={HandWaving}\n title={title}\n >\n {children}\n </HighlightBox>\n );\n};\n\nexport default HelpPanel;\n"],"names":["HelpPanel","className","testId","size","children","title","helpPanelClassName","classNames","styles","React","HighlightBox","HandWaving"],"mappings":";;;;;AAsBM,MAAAA,IAAsC,CAAC,EAAE,WAAAC,GAAW,QAAAC,GAAQ,MAAAC,GAAM,UAAAC,GAAU,OAAAC,QAAY;AAC5F,QAAMC,IAAqBC,EAAWC,EAAO,YAAY,GAAGP,CAAS;AAGnE,SAAAQ,gBAAAA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWJ;AAAA,MACX,yBAAyBE,EAAO,YAAY;AAAA,MAC5C,QAAAN;AAAA,MACA,MAAAC;AAAA,MACA,SAASQ;AAAA,MACT,OAAAN;AAAA,IAAA;AAAA,IAECD;AAAA,EAAA;AAGP;"}
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
import t from "react";
|
|
2
|
-
import
|
|
3
|
-
import { AnalyticsId as
|
|
2
|
+
import f from "classnames";
|
|
3
|
+
import { AnalyticsId as u } from "../../constants.js";
|
|
4
4
|
import { usePseudoClasses as d } from "../../hooks/usePseudoClasses.js";
|
|
5
|
-
import { mergeRefs as
|
|
6
|
-
import
|
|
5
|
+
import { mergeRefs as c } from "../../utils/refs.js";
|
|
6
|
+
import y from "../Trigger/Trigger.js";
|
|
7
7
|
import s from "../HelpQuestion/styles.module.scss";
|
|
8
|
-
const
|
|
9
|
-
({ children:
|
|
10
|
-
const { isHovered:
|
|
8
|
+
const h = t.forwardRef(
|
|
9
|
+
({ children: a, selected: e = !1, className: r, onClick: o, testId: i }, m) => {
|
|
10
|
+
const { isHovered: l, refObject: p } = d(), n = f(s.helpquestion, e && s["helpquestion--selected"], r);
|
|
11
11
|
return /* @__PURE__ */ t.createElement(
|
|
12
12
|
"button",
|
|
13
13
|
{
|
|
14
14
|
type: "button",
|
|
15
|
-
"data-testid":
|
|
16
|
-
className:
|
|
17
|
-
onClick:
|
|
18
|
-
ref:
|
|
15
|
+
"data-testid": i,
|
|
16
|
+
className: n,
|
|
17
|
+
onClick: o,
|
|
18
|
+
ref: c([m, p]),
|
|
19
19
|
"aria-expanded": e,
|
|
20
|
-
"data-analyticsid":
|
|
20
|
+
"data-analyticsid": u.HelpQuestion
|
|
21
21
|
},
|
|
22
|
-
/* @__PURE__ */ t.createElement(
|
|
23
|
-
|
|
22
|
+
/* @__PURE__ */ t.createElement(y, { variant: "help", htmlMarkup: "span", selected: e, isHovered: l }),
|
|
23
|
+
a
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
);
|
|
27
|
-
|
|
28
|
-
const v = a;
|
|
27
|
+
h.displayName = "HelpQuestion";
|
|
29
28
|
export {
|
|
30
|
-
|
|
29
|
+
h as default
|
|
31
30
|
};
|
|
32
31
|
//# sourceMappingURL=HelpQuestion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpQuestion.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 Trigger from '../Trigger';\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 <Trigger variant=\"help\" htmlMarkup=\"span\" selected={selected} isHovered={isHovered} />\n {children}\n </button>\n );\n }\n);\n\nHelpQuestion.displayName = 'HelpQuestion';\n\nexport default HelpQuestion;\n"],"names":["HelpQuestion","React","children","selected","className","onClick","testId","ref","isHovered","refObject","usePseudoClasses","classes","classNames","styles","mergeRefs","AnalyticsId","Trigger"
|
|
1
|
+
{"version":3,"file":"HelpQuestion.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 Trigger from '../Trigger';\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 <Trigger variant=\"help\" htmlMarkup=\"span\" selected={selected} isHovered={isHovered} />\n {children}\n </button>\n );\n }\n);\n\nHelpQuestion.displayName = 'HelpQuestion';\n\nexport default HelpQuestion;\n"],"names":["HelpQuestion","React","children","selected","className","onClick","testId","ref","isHovered","refObject","usePseudoClasses","classes","classNames","styles","mergeRefs","AnalyticsId","Trigger"],"mappings":";;;;;;;AA8BA,MAAMA,IAAeC,EAAM;AAAA,EACzB,CAAC,EAAE,UAAAC,GAAU,UAAAC,IAAW,IAAO,WAAAC,GAAW,SAAAC,GAAS,QAAAC,EAAO,GAAGC,MAAQ;AACnE,UAAM,EAAE,WAAAC,GAAW,WAAAC,EAAU,IAAIC,EAAoC,GAE/DC,IAAUC,EAAWC,EAAO,cAAcV,KAAYU,EAAO,wBAAwB,GAAGT,CAAS;AAGrG,WAAAH,gBAAAA,EAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,eAAaK;AAAA,QACb,WAAWK;AAAA,QACX,SAAAN;AAAA,QACA,KAAKS,EAAU,CAACP,GAAKE,CAAS,CAAC;AAAA,QAC/B,iBAAeN;AAAA,QACf,oBAAkBY,EAAY;AAAA,MAAA;AAAA,sCAE7BC,GAAQ,EAAA,SAAQ,QAAO,YAAW,QAAO,UAAAb,GAAoB,WAAAK,GAAsB;AAAA,MACnFN;AAAA,IAAA;AAAA,EAGP;AACF;AAEAF,EAAa,cAAc;"}
|
|
@@ -4,26 +4,26 @@ import "../../theme/grid.js";
|
|
|
4
4
|
import { useBreakpoint as w, Breakpoint as y } from "../../hooks/useBreakpoint.js";
|
|
5
5
|
import { AnalyticsId as p, IconSize as N } from "../../constants.js";
|
|
6
6
|
import { Icon as C } from "../Icon/Icon.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import { LazyIcon as W } from "../LazyIcon/LazyIcon.js";
|
|
8
|
+
import { Title as z } from "../Title/Title.js";
|
|
9
9
|
import t from "../HighlightBox/styles.module.scss";
|
|
10
|
-
var
|
|
10
|
+
var B = /* @__PURE__ */ ((i) => (i.medium = "medium", i.large = "large", i.fluid = "fluid", i))(B || {});
|
|
11
11
|
const u = ({ className: i, size: r, children: s }) => /* @__PURE__ */ e.createElement("div", { className: i, "data-testid": "highlightbox-wrapper" }, /* @__PURE__ */ e.createElement("div", { className: t.highlightbox__row }, /* @__PURE__ */ e.createElement("div", { className: l(t.highlightbox__col, r === "medium" && t["highlightbox__col--offset"]) }, s))), x = (i) => {
|
|
12
12
|
const { children: r, className: s } = i, a = l(t["highlightbox__content-wrapper"], s);
|
|
13
13
|
return /* @__PURE__ */ e.createElement("div", { className: a }, /* @__PURE__ */ e.createElement("div", { className: l(t.highlightbox__row) }, r));
|
|
14
|
-
},
|
|
14
|
+
}, j = (i) => {
|
|
15
15
|
const {
|
|
16
16
|
children: r,
|
|
17
17
|
color: s = "white",
|
|
18
18
|
size: a = "medium",
|
|
19
|
-
testId:
|
|
19
|
+
testId: c,
|
|
20
20
|
svgIcon: n,
|
|
21
21
|
htmlMarkup: b = "div",
|
|
22
22
|
className: v,
|
|
23
23
|
contentWrapperClassName: I,
|
|
24
24
|
title: d,
|
|
25
25
|
titleHtmlMarkup: k = "h2"
|
|
26
|
-
} = i, _ = w(),
|
|
26
|
+
} = i, _ = w(), o = l(
|
|
27
27
|
t[`highlightbox--${s}`],
|
|
28
28
|
t[`highlightbox--${a}`],
|
|
29
29
|
n && t["highlightbox--has-icon"],
|
|
@@ -31,31 +31,31 @@ const u = ({ className: i, size: r, children: s }) => /* @__PURE__ */ e.createEl
|
|
|
31
31
|
v
|
|
32
32
|
), m = () => {
|
|
33
33
|
if (n) {
|
|
34
|
-
const f = a === "large" && _ && _ >= y.md ? N.Medium : N.Small, E = /* @__PURE__ */ e.createElement(
|
|
35
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: t.highlightbox__icon }, typeof n == "string" ? /* @__PURE__ */ e.createElement(
|
|
34
|
+
const f = a === "large" && _ && _ >= y.md ? N.Medium : N.Small, E = /* @__PURE__ */ e.createElement(z, { testId: "titleId", htmlMarkup: k, appearance: "title4" }, d);
|
|
35
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: t.highlightbox__icon }, typeof n == "string" ? /* @__PURE__ */ e.createElement(W, { iconName: n, size: f }) : /* @__PURE__ */ e.createElement(C, { svgIcon: n, size: f }), d && /* @__PURE__ */ e.createElement("div", { className: t.mobile }, E)), /* @__PURE__ */ e.createElement("div", { className: t.highlightbox__content }, d && /* @__PURE__ */ e.createElement("div", { className: t.desktop, "aria-hidden": "true" }, E), r));
|
|
36
36
|
}
|
|
37
37
|
return r;
|
|
38
38
|
}, h = b, g = l(t["highlightbox__content-wrapper"], I);
|
|
39
|
-
return a === "medium" ? /* @__PURE__ */ e.createElement(u, { className:
|
|
39
|
+
return a === "medium" ? /* @__PURE__ */ e.createElement(u, { className: o, size: a }, /* @__PURE__ */ e.createElement(h, { className: g, "data-testid": c, "data-analyticsid": p.HighlightBox }, m())) : a === "large" && n ? /* @__PURE__ */ e.createElement(u, { className: o, size: a }, /* @__PURE__ */ e.createElement(x, { className: g }, /* @__PURE__ */ e.createElement(
|
|
40
40
|
h,
|
|
41
41
|
{
|
|
42
42
|
className: l(t.highlightbox__col, t["highlightbox__col--large-with-icon"]),
|
|
43
|
-
"data-testid":
|
|
43
|
+
"data-testid": c,
|
|
44
44
|
"data-analyticsid": p.HighlightBox
|
|
45
45
|
},
|
|
46
46
|
m()
|
|
47
|
-
))) : a === "large" ? /* @__PURE__ */ e.createElement(u, { className:
|
|
47
|
+
))) : a === "large" ? /* @__PURE__ */ e.createElement(u, { className: o, size: a }, /* @__PURE__ */ e.createElement(x, { className: g }, /* @__PURE__ */ e.createElement(
|
|
48
48
|
h,
|
|
49
49
|
{
|
|
50
50
|
className: l(t.highlightbox__col, t["highlightbox__col--offset"]),
|
|
51
|
-
"data-testid":
|
|
51
|
+
"data-testid": c,
|
|
52
52
|
"data-analyticsid": p.HighlightBox
|
|
53
53
|
},
|
|
54
54
|
m()
|
|
55
|
-
))) : a === "fluid" ? /* @__PURE__ */ e.createElement(h, { className:
|
|
56
|
-
}
|
|
55
|
+
))) : a === "fluid" ? /* @__PURE__ */ e.createElement(h, { className: o, "data-testid": c }, m()) : null;
|
|
56
|
+
};
|
|
57
57
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
B as HighlightBoxSize,
|
|
59
|
+
j as default
|
|
60
60
|
};
|
|
61
61
|
//# sourceMappingURL=HighlightBox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightBox.js","sources":["../../../src/components/HighlightBox/HighlightBox.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { useBreakpoint, Breakpoint } from '../..';\nimport { AnalyticsId } from '../../constants';\nimport { PaletteNames } from '../../theme/palette';\nimport Icon, { SvgIcon, IconSize } from '../Icon';\nimport { IconName } from '../Icons/IconNames';\nimport LazyIcon from '../LazyIcon';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\nexport type HighlightBoxColors = Extract<PaletteNames, 'white' | 'neutral' | 'blueberry' | 'cherry'>;\n\nexport enum HighlightBoxSize {\n medium = 'medium',\n large = 'large',\n fluid = 'fluid',\n}\n\nexport type HighlightBoxTags = Exclude<\n keyof HTMLElementTagNameMap,\n 'dir' | 'font' | 'frame' | 'frameset' | 'marquee' | 'applet' | 'basefont' | 'search'\n>;\n\nexport interface HighlightBoxProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** Changes the background color. Default: white */\n color?: HighlightBoxColors;\n /** Changes the size. Default: medium */\n size?: keyof typeof HighlightBoxSize;\n /** Adds an icon to the highlightbox. */\n svgIcon?: SvgIcon | IconName;\n /** Changes the underlying element. Default: div */\n htmlMarkup?: HighlightBoxTags;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds custom classes to the content-wrapper */\n contentWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Element that is set after the icon-element in the DOM, often a title-element */\n title?: string;\n /** Markup props for title */\n titleHtmlMarkup?: TitleTags;\n}\n\ninterface WrapperProps {\n className: string;\n size?: keyof typeof HighlightBoxSize;\n}\n\nconst Wrapper: React.FC<WrapperProps> = ({ className, size, children }) => (\n <div className={className} data-testid={'highlightbox-wrapper'}>\n <div className={styles.highlightbox__row}>\n <div className={classNames(styles.highlightbox__col, size === HighlightBoxSize.medium && styles['highlightbox__col--offset'])}>\n {children}\n </div>\n </div>\n </div>\n);\n\ninterface ContentWrapperProps {\n children: React.ReactNode;\n className?: string;\n}\n\nconst ContentWrapper: React.FC<ContentWrapperProps> = props => {\n const { children, className } = props;\n const contentWrapperClasses = classNames(styles['highlightbox__content-wrapper'], className);\n\n return (\n <div className={contentWrapperClasses}>\n <div className={classNames(styles.highlightbox__row)}>{children}</div>\n </div>\n );\n};\n\nconst HighlightBox: React.FC<HighlightBoxProps> = props => {\n const {\n children,\n color = 'white',\n size = HighlightBoxSize.medium,\n testId,\n svgIcon,\n htmlMarkup = 'div',\n className,\n contentWrapperClassName,\n title,\n titleHtmlMarkup = 'h2',\n } = props;\n const breakpoint = useBreakpoint();\n\n const containerClassName = classNames(\n styles[`highlightbox--${color}`],\n styles[`highlightbox--${size}`],\n svgIcon && styles['highlightbox--has-icon'],\n { container: size === 'medium' || size === 'large' },\n className\n );\n\n const renderContent = () => {\n if (svgIcon) {\n const iconSize = size === HighlightBoxSize.large && breakpoint && breakpoint >= Breakpoint.md ? IconSize.Medium : IconSize.Small;\n\n const titleElement = (\n <Title testId=\"titleId\" htmlMarkup={titleHtmlMarkup} appearance=\"title4\">\n {title}\n </Title>\n );\n\n return (\n <>\n <div className={styles.highlightbox__icon}>\n {typeof svgIcon === 'string' ? <LazyIcon iconName={svgIcon} size={iconSize} /> : <Icon svgIcon={svgIcon} size={iconSize} />}\n {title && <div className={styles['mobile']}>{titleElement}</div>}\n </div>\n <div className={styles.highlightbox__content}>\n {title && (\n <div className={styles['desktop']} aria-hidden=\"true\">\n {titleElement}\n </div>\n )}\n {children}\n </div>\n </>\n );\n }\n\n return children;\n };\n\n const CustomTag = htmlMarkup;\n\n const contentWrapperClasses = classNames(styles['highlightbox__content-wrapper'], contentWrapperClassName);\n\n if (size === HighlightBoxSize.medium) {\n return (\n <Wrapper className={containerClassName} size={size}>\n <CustomTag className={contentWrapperClasses} data-testid={testId} data-analyticsid={AnalyticsId.HighlightBox}>\n {renderContent()}\n </CustomTag>\n </Wrapper>\n );\n }\n\n if (size === HighlightBoxSize.large && svgIcon) {\n return (\n <Wrapper className={containerClassName} size={size}>\n <ContentWrapper className={contentWrapperClasses}>\n <CustomTag\n className={classNames(styles.highlightbox__col, styles['highlightbox__col--large-with-icon'])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.HighlightBox}\n >\n {renderContent()}\n </CustomTag>\n </ContentWrapper>\n </Wrapper>\n );\n }\n\n if (size === HighlightBoxSize.large) {\n return (\n <Wrapper className={containerClassName} size={size}>\n <ContentWrapper className={contentWrapperClasses}>\n <CustomTag\n className={classNames(styles.highlightbox__col, styles['highlightbox__col--offset'])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.HighlightBox}\n >\n {renderContent()}\n </CustomTag>\n </ContentWrapper>\n </Wrapper>\n );\n }\n\n if (size === HighlightBoxSize.fluid) {\n return (\n <CustomTag className={containerClassName} data-testid={testId}>\n {renderContent()}\n </CustomTag>\n );\n }\n\n return null;\n};\n\nexport default HighlightBox;\n"],"names":["HighlightBoxSize","Wrapper","className","size","children","React","styles","classNames","ContentWrapper","props","contentWrapperClasses","HighlightBox","color","testId","svgIcon","htmlMarkup","contentWrapperClassName","title","titleHtmlMarkup","breakpoint","useBreakpoint","containerClassName","renderContent","iconSize","Breakpoint","IconSize","titleElement","Title","LazyIcon","Icon","CustomTag","AnalyticsId"
|
|
1
|
+
{"version":3,"file":"HighlightBox.js","sources":["../../../src/components/HighlightBox/HighlightBox.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { useBreakpoint, Breakpoint } from '../..';\nimport { AnalyticsId } from '../../constants';\nimport { PaletteNames } from '../../theme/palette';\nimport Icon, { SvgIcon, IconSize } from '../Icon';\nimport { IconName } from '../Icons/IconNames';\nimport LazyIcon from '../LazyIcon';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\nexport type HighlightBoxColors = Extract<PaletteNames, 'white' | 'neutral' | 'blueberry' | 'cherry'>;\n\nexport enum HighlightBoxSize {\n medium = 'medium',\n large = 'large',\n fluid = 'fluid',\n}\n\nexport type HighlightBoxTags = Exclude<\n keyof HTMLElementTagNameMap,\n 'dir' | 'font' | 'frame' | 'frameset' | 'marquee' | 'applet' | 'basefont' | 'search'\n>;\n\nexport interface HighlightBoxProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** Changes the background color. Default: white */\n color?: HighlightBoxColors;\n /** Changes the size. Default: medium */\n size?: keyof typeof HighlightBoxSize;\n /** Adds an icon to the highlightbox. */\n svgIcon?: SvgIcon | IconName;\n /** Changes the underlying element. Default: div */\n htmlMarkup?: HighlightBoxTags;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds custom classes to the content-wrapper */\n contentWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Element that is set after the icon-element in the DOM, often a title-element */\n title?: string;\n /** Markup props for title */\n titleHtmlMarkup?: TitleTags;\n}\n\ninterface WrapperProps {\n className: string;\n size?: keyof typeof HighlightBoxSize;\n}\n\nconst Wrapper: React.FC<WrapperProps> = ({ className, size, children }) => (\n <div className={className} data-testid={'highlightbox-wrapper'}>\n <div className={styles.highlightbox__row}>\n <div className={classNames(styles.highlightbox__col, size === HighlightBoxSize.medium && styles['highlightbox__col--offset'])}>\n {children}\n </div>\n </div>\n </div>\n);\n\ninterface ContentWrapperProps {\n children: React.ReactNode;\n className?: string;\n}\n\nconst ContentWrapper: React.FC<ContentWrapperProps> = props => {\n const { children, className } = props;\n const contentWrapperClasses = classNames(styles['highlightbox__content-wrapper'], className);\n\n return (\n <div className={contentWrapperClasses}>\n <div className={classNames(styles.highlightbox__row)}>{children}</div>\n </div>\n );\n};\n\nconst HighlightBox: React.FC<HighlightBoxProps> = props => {\n const {\n children,\n color = 'white',\n size = HighlightBoxSize.medium,\n testId,\n svgIcon,\n htmlMarkup = 'div',\n className,\n contentWrapperClassName,\n title,\n titleHtmlMarkup = 'h2',\n } = props;\n const breakpoint = useBreakpoint();\n\n const containerClassName = classNames(\n styles[`highlightbox--${color}`],\n styles[`highlightbox--${size}`],\n svgIcon && styles['highlightbox--has-icon'],\n { container: size === 'medium' || size === 'large' },\n className\n );\n\n const renderContent = () => {\n if (svgIcon) {\n const iconSize = size === HighlightBoxSize.large && breakpoint && breakpoint >= Breakpoint.md ? IconSize.Medium : IconSize.Small;\n\n const titleElement = (\n <Title testId=\"titleId\" htmlMarkup={titleHtmlMarkup} appearance=\"title4\">\n {title}\n </Title>\n );\n\n return (\n <>\n <div className={styles.highlightbox__icon}>\n {typeof svgIcon === 'string' ? <LazyIcon iconName={svgIcon} size={iconSize} /> : <Icon svgIcon={svgIcon} size={iconSize} />}\n {title && <div className={styles['mobile']}>{titleElement}</div>}\n </div>\n <div className={styles.highlightbox__content}>\n {title && (\n <div className={styles['desktop']} aria-hidden=\"true\">\n {titleElement}\n </div>\n )}\n {children}\n </div>\n </>\n );\n }\n\n return children;\n };\n\n const CustomTag = htmlMarkup;\n\n const contentWrapperClasses = classNames(styles['highlightbox__content-wrapper'], contentWrapperClassName);\n\n if (size === HighlightBoxSize.medium) {\n return (\n <Wrapper className={containerClassName} size={size}>\n <CustomTag className={contentWrapperClasses} data-testid={testId} data-analyticsid={AnalyticsId.HighlightBox}>\n {renderContent()}\n </CustomTag>\n </Wrapper>\n );\n }\n\n if (size === HighlightBoxSize.large && svgIcon) {\n return (\n <Wrapper className={containerClassName} size={size}>\n <ContentWrapper className={contentWrapperClasses}>\n <CustomTag\n className={classNames(styles.highlightbox__col, styles['highlightbox__col--large-with-icon'])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.HighlightBox}\n >\n {renderContent()}\n </CustomTag>\n </ContentWrapper>\n </Wrapper>\n );\n }\n\n if (size === HighlightBoxSize.large) {\n return (\n <Wrapper className={containerClassName} size={size}>\n <ContentWrapper className={contentWrapperClasses}>\n <CustomTag\n className={classNames(styles.highlightbox__col, styles['highlightbox__col--offset'])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.HighlightBox}\n >\n {renderContent()}\n </CustomTag>\n </ContentWrapper>\n </Wrapper>\n );\n }\n\n if (size === HighlightBoxSize.fluid) {\n return (\n <CustomTag className={containerClassName} data-testid={testId}>\n {renderContent()}\n </CustomTag>\n );\n }\n\n return null;\n};\n\nexport default HighlightBox;\n"],"names":["HighlightBoxSize","Wrapper","className","size","children","React","styles","classNames","ContentWrapper","props","contentWrapperClasses","HighlightBox","color","testId","svgIcon","htmlMarkup","contentWrapperClassName","title","titleHtmlMarkup","breakpoint","useBreakpoint","containerClassName","renderContent","iconSize","Breakpoint","IconSize","titleElement","Title","LazyIcon","Icon","CustomTag","AnalyticsId"],"mappings":";;;;;;;;;AAgBY,IAAAA,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,QAAQ,SAHEA,IAAAA,KAAA,CAAA,CAAA;AAuCZ,MAAMC,IAAkC,CAAC,EAAE,WAAAC,GAAW,MAAAC,GAAM,UAAAC,EAC1D,MAAAC,gBAAAA,EAAA,cAAC,OAAI,EAAA,WAAAH,GAAsB,eAAa,uBAAA,mCACrC,OAAI,EAAA,WAAWI,EAAO,kBAAA,GACpBD,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAWE,EAAWD,EAAO,mBAAmBH,MAAS,YAA2BG,EAAO,2BAA2B,CAAC,KACzHF,CACH,CACF,CACF,GAQII,IAAgD,CAASC,MAAA;AACvD,QAAA,EAAE,UAAAL,GAAU,WAAAF,EAAc,IAAAO,GAC1BC,IAAwBH,EAAWD,EAAO,+BAA+B,GAAGJ,CAAS;AAE3F,SACGG,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAWK,EAAA,GACbL,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAWE,EAAWD,EAAO,iBAAiB,EAAI,GAAAF,CAAS,CAClE;AAEJ,GAEMO,IAA4C,CAASF,MAAA;AACnD,QAAA;AAAA,IACJ,UAAAL;AAAA,IACA,OAAAQ,IAAQ;AAAA,IACR,MAAAT,IAAO;AAAA,IACP,QAAAU;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,WAAAb;AAAA,IACA,yBAAAc;AAAA,IACA,OAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,EAChB,IAAAT,GACEU,IAAaC,KAEbC,IAAqBd;AAAA,IACzBD,EAAO,iBAAiBM,CAAK,EAAE;AAAA,IAC/BN,EAAO,iBAAiBH,CAAI,EAAE;AAAA,IAC9BW,KAAWR,EAAO,wBAAwB;AAAA,IAC1C,EAAE,WAAWH,MAAS,YAAYA,MAAS,QAAQ;AAAA,IACnDD;AAAA,EAAA,GAGIoB,IAAgB,MAAM;AAC1B,QAAIR,GAAS;AACL,YAAAS,IAAWpB,MAAS,WAA0BgB,KAAcA,KAAcK,EAAW,KAAKC,EAAS,SAASA,EAAS,OAErHC,oCACHC,GAAM,EAAA,QAAO,WAAU,YAAYT,GAAiB,YAAW,SAAA,GAC7DD,CACH;AAIA,aAAAZ,gBAAAA,EAAA,cAAAA,EAAA,UAAA,sCACG,OAAI,EAAA,WAAWC,EAAO,mBACpB,GAAA,OAAOQ,KAAY,WAAYT,gBAAAA,EAAA,cAAAuB,GAAA,EAAS,UAAUd,GAAS,MAAMS,EAAU,CAAA,IAAKlB,gBAAAA,EAAA,cAACwB,KAAK,SAAAf,GAAkB,MAAMS,EAAU,CAAA,GACxHN,KAASZ,gBAAAA,EAAA,cAAC,SAAI,WAAWC,EAAO,OAAY,GAAAoB,CAAa,CAC5D,GACArB,gBAAAA,EAAA,cAAC,OAAI,EAAA,WAAWC,EAAO,sBAAA,GACpBW,KACEZ,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAWC,EAAO,SAAY,eAAY,OAC5C,GAAAoB,CACH,GAEDtB,CACH,CACF;AAAA,IAEJ;AAEO,WAAAA;AAAA,EAAA,GAGH0B,IAAYf,GAEZL,IAAwBH,EAAWD,EAAO,+BAA+B,GAAGU,CAAuB;AAEzG,SAAIb,MAAS,2CAERF,GAAQ,EAAA,WAAWoB,GAAoB,MAAAlB,EAAA,mCACrC2B,GAAU,EAAA,WAAWpB,GAAuB,eAAaG,GAAQ,oBAAkBkB,EAAY,aAC7F,GAAAT,EACH,CAAA,CACF,IAIAnB,MAAS,WAA0BW,IAEnCT,gBAAAA,EAAA,cAACJ,KAAQ,WAAWoB,GAAoB,MAAAlB,KACrCE,gBAAAA,EAAA,cAAAG,GAAA,EAAe,WAAWE,EACzB,GAAAL,gBAAAA,EAAA;AAAA,IAACyB;AAAA,IAAA;AAAA,MACC,WAAWvB,EAAWD,EAAO,mBAAmBA,EAAO,oCAAoC,CAAC;AAAA,MAC5F,eAAaO;AAAA,MACb,oBAAkBkB,EAAY;AAAA,IAAA;AAAA,IAE7BT,EAAc;AAAA,EAEnB,CAAA,CACF,IAIAnB,MAAS,UAETE,gBAAAA,EAAA,cAACJ,KAAQ,WAAWoB,GAAoB,MAAAlB,KACrCE,gBAAAA,EAAA,cAAAG,GAAA,EAAe,WAAWE,EACzB,GAAAL,gBAAAA,EAAA;AAAA,IAACyB;AAAA,IAAA;AAAA,MACC,WAAWvB,EAAWD,EAAO,mBAAmBA,EAAO,2BAA2B,CAAC;AAAA,MACnF,eAAaO;AAAA,MACb,oBAAkBkB,EAAY;AAAA,IAAA;AAAA,IAE7BT,EAAc;AAAA,EAEnB,CAAA,CACF,IAIAnB,MAAS,0CAER2B,GAAU,EAAA,WAAWT,GAAoB,eAAaR,EAAA,GACpDS,GACH,IAIG;AACT;"}
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
|
|
78
78
|
&--medium {
|
|
79
79
|
#{$box}__content-wrapper {
|
|
80
|
-
padding: getSpacer(m) getSpacer(s) getSpacer(l)
|
|
80
|
+
padding: getSpacer(m) getSpacer(s) getSpacer(l);
|
|
81
81
|
|
|
82
82
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
83
|
-
padding: getSpacer(m) getSpacer(m) getSpacer(l)
|
|
83
|
+
padding: getSpacer(m) getSpacer(m) getSpacer(l);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
@media (min-width: map.get($grid-breakpoints, lg)) {
|
|
@@ -91,10 +91,10 @@
|
|
|
91
91
|
|
|
92
92
|
// fluid skal ha bakgrunnsfarge på den ytre containeren
|
|
93
93
|
&--fluid {
|
|
94
|
-
padding: getSpacer(m) getSpacer(s) getSpacer(l)
|
|
94
|
+
padding: getSpacer(m) getSpacer(s) getSpacer(l);
|
|
95
95
|
|
|
96
96
|
@media (min-width: map.get($grid-breakpoints, lg)) {
|
|
97
|
-
padding: getSpacer(m) getSpacer(m) getSpacer(l)
|
|
97
|
+
padding: getSpacer(m) getSpacer(m) getSpacer(l);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
@each $color in $colors {
|
|
@@ -3,7 +3,7 @@ import i from "classnames";
|
|
|
3
3
|
import { useIsVisible as c } from "../../hooks/useIsVisible.js";
|
|
4
4
|
import { useSize as g } from "../../hooks/useSize.js";
|
|
5
5
|
import o from "../HorizontalScroll/styles.module.scss";
|
|
6
|
-
const d = "3px",
|
|
6
|
+
const d = "3px", O = ({ children: m, childWidth: _, testId: f, ...l }) => {
|
|
7
7
|
const t = e(null), a = e(null), s = e(null), h = c(a, 1, { root: t == null ? void 0 : t.current, rootMargin: d }, !0), u = c(s, 1, { root: t == null ? void 0 : t.current, rootMargin: d }, !0), { width: v = 0 } = g(t) || {}, z = _ > v, b = i(o.horizontalscroll__viewport, z && o["horizontalscroll__viewport--overflow"]), n = l["aria-label"] || l["aria-labelledby"];
|
|
8
8
|
return /* @__PURE__ */ r.createElement("div", { className: o.horizontalscroll, "data-testid": f }, /* @__PURE__ */ r.createElement(
|
|
9
9
|
"div",
|
|
@@ -38,9 +38,9 @@ const d = "3px", p = ({ children: m, childWidth: _, testId: f, ...l }) => {
|
|
|
38
38
|
m,
|
|
39
39
|
/* @__PURE__ */ r.createElement("div", { ref: s })
|
|
40
40
|
));
|
|
41
|
-
}
|
|
41
|
+
};
|
|
42
42
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
O as HorizontalScroll,
|
|
44
|
+
O as default
|
|
45
45
|
};
|
|
46
46
|
//# sourceMappingURL=HorizontalScroll.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalScroll.js","sources":["../../../src/components/HorizontalScroll/HorizontalScroll.tsx"],"sourcesContent":["import React, { useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useSize } from '../../hooks/useSize';\nimport { AriaLabelAttributes } from '../../utils/accessibility';\n\nimport styles from './styles.module.scss';\n\n// Scrolle-indikator vises/skjules når det er x px igjen til venstre eller høyre side\nconst ROOT_MARGIN_OFFSET = '3px';\n\ninterface HorizontalScrollProps {\n /**\n * Bredden på elementet som potensielt vil scrolle horisontalt i px\n */\n childWidth: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const HorizontalScroll: React.FC<HorizontalScrollProps & AriaLabelAttributes> = ({ children, childWidth, testId, ...rest }) => {\n const viewportRef = useRef<HTMLDivElement>(null);\n const leftRef = useRef<HTMLDivElement>(null);\n const rightRef = useRef<HTMLDivElement>(null);\n const leftIsVisible = useIsVisible(leftRef, 1, { root: viewportRef?.current, rootMargin: ROOT_MARGIN_OFFSET }, true);\n const rightIsVisible = useIsVisible(rightRef, 1, { root: viewportRef?.current, rootMargin: ROOT_MARGIN_OFFSET }, true);\n const { width: viewPortWidth = 0 } = useSize(viewportRef) || {};\n\n const isOverflowing = childWidth > viewPortWidth;\n const viewportClasses = classNames(styles.horizontalscroll__viewport, isOverflowing && styles['horizontalscroll__viewport--overflow']);\n const hasAriaAttributes = rest['aria-label'] || rest['aria-labelledby'];\n\n return (\n <div className={styles.horizontalscroll} data-testid={testId}>\n {/* viewport-diven må ta tabIndex for å løse et annet UU-problem, at div med overflow: scroll må kunne navigeres med keyboard. */}\n {/* Enten aria-label eller aria-labelledbyid må settes */}\n <div\n className={viewportClasses}\n ref={viewportRef}\n tabIndex={hasAriaAttributes ? 0 : undefined}\n role={hasAriaAttributes ? 'region' : undefined}\n {...rest}\n >\n <div\n className={classNames(\n styles.horizontalscroll__indicator,\n styles['horizontalscroll__indicator--left'],\n !leftIsVisible && styles['horizontalscroll__indicator--visible']\n )}\n />\n <div\n className={classNames(\n styles.horizontalscroll__indicator,\n styles['horizontalscroll__indicator--right'],\n !rightIsVisible && styles['horizontalscroll__indicator--visible']\n )}\n />\n <div ref={leftRef} />\n {children}\n <div ref={rightRef} />\n </div>\n </div>\n );\n};\n\nexport default HorizontalScroll;\n"],"names":["ROOT_MARGIN_OFFSET","HorizontalScroll","children","childWidth","testId","rest","viewportRef","useRef","leftRef","rightRef","leftIsVisible","useIsVisible","rightIsVisible","viewPortWidth","useSize","isOverflowing","viewportClasses","classNames","styles","hasAriaAttributes","React"
|
|
1
|
+
{"version":3,"file":"HorizontalScroll.js","sources":["../../../src/components/HorizontalScroll/HorizontalScroll.tsx"],"sourcesContent":["import React, { useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useSize } from '../../hooks/useSize';\nimport { AriaLabelAttributes } from '../../utils/accessibility';\n\nimport styles from './styles.module.scss';\n\n// Scrolle-indikator vises/skjules når det er x px igjen til venstre eller høyre side\nconst ROOT_MARGIN_OFFSET = '3px';\n\ninterface HorizontalScrollProps {\n /**\n * Bredden på elementet som potensielt vil scrolle horisontalt i px\n */\n childWidth: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const HorizontalScroll: React.FC<HorizontalScrollProps & AriaLabelAttributes> = ({ children, childWidth, testId, ...rest }) => {\n const viewportRef = useRef<HTMLDivElement>(null);\n const leftRef = useRef<HTMLDivElement>(null);\n const rightRef = useRef<HTMLDivElement>(null);\n const leftIsVisible = useIsVisible(leftRef, 1, { root: viewportRef?.current, rootMargin: ROOT_MARGIN_OFFSET }, true);\n const rightIsVisible = useIsVisible(rightRef, 1, { root: viewportRef?.current, rootMargin: ROOT_MARGIN_OFFSET }, true);\n const { width: viewPortWidth = 0 } = useSize(viewportRef) || {};\n\n const isOverflowing = childWidth > viewPortWidth;\n const viewportClasses = classNames(styles.horizontalscroll__viewport, isOverflowing && styles['horizontalscroll__viewport--overflow']);\n const hasAriaAttributes = rest['aria-label'] || rest['aria-labelledby'];\n\n return (\n <div className={styles.horizontalscroll} data-testid={testId}>\n {/* viewport-diven må ta tabIndex for å løse et annet UU-problem, at div med overflow: scroll må kunne navigeres med keyboard. */}\n {/* Enten aria-label eller aria-labelledbyid må settes */}\n <div\n className={viewportClasses}\n ref={viewportRef}\n tabIndex={hasAriaAttributes ? 0 : undefined}\n role={hasAriaAttributes ? 'region' : undefined}\n {...rest}\n >\n <div\n className={classNames(\n styles.horizontalscroll__indicator,\n styles['horizontalscroll__indicator--left'],\n !leftIsVisible && styles['horizontalscroll__indicator--visible']\n )}\n />\n <div\n className={classNames(\n styles.horizontalscroll__indicator,\n styles['horizontalscroll__indicator--right'],\n !rightIsVisible && styles['horizontalscroll__indicator--visible']\n )}\n />\n <div ref={leftRef} />\n {children}\n <div ref={rightRef} />\n </div>\n </div>\n );\n};\n\nexport default HorizontalScroll;\n"],"names":["ROOT_MARGIN_OFFSET","HorizontalScroll","children","childWidth","testId","rest","viewportRef","useRef","leftRef","rightRef","leftIsVisible","useIsVisible","rightIsVisible","viewPortWidth","useSize","isOverflowing","viewportClasses","classNames","styles","hasAriaAttributes","React"],"mappings":";;;;;AAWA,MAAMA,IAAqB,OAWdC,IAA0E,CAAC,EAAE,UAAAC,GAAU,YAAAC,GAAY,QAAAC,GAAQ,GAAGC,QAAW;AAC9H,QAAAC,IAAcC,EAAuB,IAAI,GACzCC,IAAUD,EAAuB,IAAI,GACrCE,IAAWF,EAAuB,IAAI,GACtCG,IAAgBC,EAAaH,GAAS,GAAG,EAAE,MAAMF,KAAA,gBAAAA,EAAa,SAAS,YAAYN,EAAmB,GAAG,EAAI,GAC7GY,IAAiBD,EAAaF,GAAU,GAAG,EAAE,MAAMH,KAAA,gBAAAA,EAAa,SAAS,YAAYN,EAAmB,GAAG,EAAI,GAC/G,EAAE,OAAOa,IAAgB,MAAMC,EAAQR,CAAW,KAAK,IAEvDS,IAAgBZ,IAAaU,GAC7BG,IAAkBC,EAAWC,EAAO,4BAA4BH,KAAiBG,EAAO,sCAAsC,CAAC,GAC/HC,IAAoBd,EAAK,YAAY,KAAKA,EAAK,iBAAiB;AAEtE,yCACG,OAAI,EAAA,WAAWa,EAAO,kBAAkB,eAAad,EAGpD,GAAAgB,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWJ;AAAA,MACX,KAAKV;AAAA,MACL,UAAUa,IAAoB,IAAI;AAAA,MAClC,MAAMA,IAAoB,WAAW;AAAA,MACpC,GAAGd;AAAA,IAAA;AAAA,IAEJe,gBAAAA,EAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWH;AAAA,UACTC,EAAO;AAAA,UACPA,EAAO,mCAAmC;AAAA,UAC1C,CAACR,KAAiBQ,EAAO,sCAAsC;AAAA,QACjE;AAAA,MAAA;AAAA,IACF;AAAA,IACAE,gBAAAA,EAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWH;AAAA,UACTC,EAAO;AAAA,UACPA,EAAO,oCAAoC;AAAA,UAC3C,CAACN,KAAkBM,EAAO,sCAAsC;AAAA,QAClE;AAAA,MAAA;AAAA,IACF;AAAA,IACAE,gBAAAA,EAAA,cAAC,OAAI,EAAA,KAAKZ,EAAS,CAAA;AAAA,IAClBN;AAAA,IACDkB,gBAAAA,EAAA,cAAC,OAAI,EAAA,KAAKX,EAAU,CAAA;AAAA,EAAA,CAExB;AAEJ;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import r from "./HorizontalScroll.js";
|
|
2
|
-
import { HorizontalScroll as a } from "./HorizontalScroll.js";
|
|
1
|
+
import { HorizontalScroll as r } from "./HorizontalScroll.js";
|
|
3
2
|
export {
|
|
4
|
-
|
|
3
|
+
r as HorizontalScroll,
|
|
5
4
|
r as default
|
|
6
5
|
};
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,42 +1,41 @@
|
|
|
1
1
|
import a from "react";
|
|
2
|
-
import { getIllustration as
|
|
3
|
-
import { AnalyticsId as
|
|
2
|
+
import { getIllustration as f } from "./utils.js";
|
|
3
|
+
import { AnalyticsId as p } from "../../constants.js";
|
|
4
4
|
import { useUuid as g } from "../../hooks/useUuid.js";
|
|
5
5
|
var h = /* @__PURE__ */ ((e) => (e.Medium = "0 0 512 512", e.Small = "0 0 200 200", e))(h || {});
|
|
6
|
-
const
|
|
7
|
-
const { illustration:
|
|
6
|
+
const v = a.forwardRef((e, o) => {
|
|
7
|
+
const { illustration: s, ariaLabel: l, className: n = "", size: t = 512, color: i = "neutral", testId: d, ...m } = e, r = g(), u = f({
|
|
8
8
|
size: t,
|
|
9
9
|
medium: "0 0 512 512",
|
|
10
10
|
small: "0 0 200 200"
|
|
11
11
|
/* Small */
|
|
12
|
-
}),
|
|
13
|
-
"data-testid":
|
|
14
|
-
"data-analyticsid":
|
|
15
|
-
ref:
|
|
16
|
-
className:
|
|
12
|
+
}), c = {
|
|
13
|
+
"data-testid": d,
|
|
14
|
+
"data-analyticsid": p.Illustration,
|
|
15
|
+
ref: o,
|
|
16
|
+
className: n,
|
|
17
17
|
role: l ? "img" : "presentation",
|
|
18
18
|
"aria-labelledby": l ? r : void 0,
|
|
19
19
|
focusable: !1,
|
|
20
20
|
"aria-hidden": l ? void 0 : !0,
|
|
21
|
-
viewBox:
|
|
21
|
+
viewBox: u,
|
|
22
22
|
style: { minWidth: t, minHeight: t },
|
|
23
23
|
width: t,
|
|
24
24
|
height: t,
|
|
25
25
|
fill: i,
|
|
26
|
-
...
|
|
26
|
+
...m
|
|
27
27
|
};
|
|
28
|
-
return a.createElement(
|
|
28
|
+
return a.createElement(s, {
|
|
29
29
|
size: t,
|
|
30
30
|
color: i,
|
|
31
|
-
svgProperties:
|
|
31
|
+
svgProperties: c,
|
|
32
32
|
title: l && /* @__PURE__ */ a.createElement("title", { id: r }, l)
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
|
-
|
|
36
|
-
const N = o;
|
|
35
|
+
v.displayName = "Illustration";
|
|
37
36
|
export {
|
|
38
|
-
|
|
37
|
+
v as Illustration,
|
|
39
38
|
h as ViewBoxSize,
|
|
40
|
-
|
|
39
|
+
v as default
|
|
41
40
|
};
|
|
42
41
|
//# sourceMappingURL=Illustration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Illustration.js","sources":["../../../src/components/Illustration/Illustration.tsx"],"sourcesContent":["import React from 'react';\n\nimport { getIllustration } from './utils';\nimport { AnalyticsId } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\n\nexport type IllustrationColor = 'neutral' | 'cherry' | 'blueberry';\n\nexport enum ViewBoxSize {\n Medium = '0 0 512 512',\n Small = '0 0 200 200',\n}\n\nexport interface BaseSvgIllustrationProps {\n color: IllustrationColor;\n svgProperties: React.SVGProps<SVGSVGElement>;\n title: React.ReactNode;\n}\nexport interface SvgIllustrationProps extends BaseSvgIllustrationProps {\n size: number;\n}\n\nexport type SvgIllustration = React.ComponentType<SvgIllustrationProps>;\n\nexport interface BaseIllustrationProps {\n /* aria-label for the <svg> element. Used as <title> tag. */\n ariaLabel?: string;\n /* Changes the size of the illustration. */\n size?: number;\n /* Changes the color of the illustration. */\n color?: IllustrationColor;\n /* Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport interface IllustrationProps extends BaseIllustrationProps {\n /* Sets which illustration should be displayed. */\n illustration: SvgIllustration;\n}\n\nexport const Illustration = React.forwardRef<SVGSVGElement, IllustrationProps>((props, ref) => {\n const { illustration, ariaLabel, className = '', size = 512, color = 'neutral', testId, ...other } = props;\n\n const titleId = useUuid();\n const viewBox = getIllustration({ size, medium: ViewBoxSize.Medium, small: ViewBoxSize.Small });\n\n const svgProperties = {\n 'data-testid': testId,\n 'data-analyticsid': AnalyticsId.Illustration,\n ref,\n className,\n role: ariaLabel ? 'img' : 'presentation',\n 'aria-labelledby': ariaLabel ? titleId : undefined,\n focusable: false,\n 'aria-hidden': ariaLabel ? undefined : true,\n viewBox,\n style: { minWidth: size, minHeight: size },\n width: size,\n height: size,\n fill: color,\n ...other,\n };\n\n const svgElement = React.createElement(illustration, {\n size,\n color,\n svgProperties: svgProperties,\n title: ariaLabel && <title id={titleId}>{ariaLabel}</title>,\n });\n\n return svgElement;\n});\n\nIllustration.displayName = 'Illustration';\n\nexport default Illustration;\n"],"names":["ViewBoxSize","Illustration","React","props","ref","illustration","ariaLabel","className","size","color","testId","other","titleId","useUuid","viewBox","getIllustration","svgProperties","AnalyticsId"
|
|
1
|
+
{"version":3,"file":"Illustration.js","sources":["../../../src/components/Illustration/Illustration.tsx"],"sourcesContent":["import React from 'react';\n\nimport { getIllustration } from './utils';\nimport { AnalyticsId } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\n\nexport type IllustrationColor = 'neutral' | 'cherry' | 'blueberry';\n\nexport enum ViewBoxSize {\n Medium = '0 0 512 512',\n Small = '0 0 200 200',\n}\n\nexport interface BaseSvgIllustrationProps {\n color: IllustrationColor;\n svgProperties: React.SVGProps<SVGSVGElement>;\n title: React.ReactNode;\n}\nexport interface SvgIllustrationProps extends BaseSvgIllustrationProps {\n size: number;\n}\n\nexport type SvgIllustration = React.ComponentType<SvgIllustrationProps>;\n\nexport interface BaseIllustrationProps {\n /* aria-label for the <svg> element. Used as <title> tag. */\n ariaLabel?: string;\n /* Changes the size of the illustration. */\n size?: number;\n /* Changes the color of the illustration. */\n color?: IllustrationColor;\n /* Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport interface IllustrationProps extends BaseIllustrationProps {\n /* Sets which illustration should be displayed. */\n illustration: SvgIllustration;\n}\n\nexport const Illustration = React.forwardRef<SVGSVGElement, IllustrationProps>((props, ref) => {\n const { illustration, ariaLabel, className = '', size = 512, color = 'neutral', testId, ...other } = props;\n\n const titleId = useUuid();\n const viewBox = getIllustration({ size, medium: ViewBoxSize.Medium, small: ViewBoxSize.Small });\n\n const svgProperties = {\n 'data-testid': testId,\n 'data-analyticsid': AnalyticsId.Illustration,\n ref,\n className,\n role: ariaLabel ? 'img' : 'presentation',\n 'aria-labelledby': ariaLabel ? titleId : undefined,\n focusable: false,\n 'aria-hidden': ariaLabel ? undefined : true,\n viewBox,\n style: { minWidth: size, minHeight: size },\n width: size,\n height: size,\n fill: color,\n ...other,\n };\n\n const svgElement = React.createElement(illustration, {\n size,\n color,\n svgProperties: svgProperties,\n title: ariaLabel && <title id={titleId}>{ariaLabel}</title>,\n });\n\n return svgElement;\n});\n\nIllustration.displayName = 'Illustration';\n\nexport default Illustration;\n"],"names":["ViewBoxSize","Illustration","React","props","ref","illustration","ariaLabel","className","size","color","testId","other","titleId","useUuid","viewBox","getIllustration","svgProperties","AnalyticsId"],"mappings":";;;;AAQY,IAAAA,sBAAAA,OACVA,EAAA,SAAS,eACTA,EAAA,QAAQ,eAFEA,IAAAA,KAAA,CAAA,CAAA;AAkCL,MAAMC,IAAeC,EAAM,WAA6C,CAACC,GAAOC,MAAQ;AAC7F,QAAM,EAAE,cAAAC,GAAc,WAAAC,GAAW,WAAAC,IAAY,IAAI,MAAAC,IAAO,KAAK,OAAAC,IAAQ,WAAW,QAAAC,GAAQ,GAAGC,EAAA,IAAUR,GAE/FS,IAAUC,KACVC,IAAUC,EAAgB;AAAA,IAAE,MAAAP;AAAA,IAAM,QAAQ;AAAA,IAAoB,OAAO;AAAA;AAAA,GAAmB,GAExFQ,IAAgB;AAAA,IACpB,eAAeN;AAAA,IACf,oBAAoBO,EAAY;AAAA,IAChC,KAAAb;AAAA,IACA,WAAAG;AAAA,IACA,MAAMD,IAAY,QAAQ;AAAA,IAC1B,mBAAmBA,IAAYM,IAAU;AAAA,IACzC,WAAW;AAAA,IACX,eAAeN,IAAY,SAAY;AAAA,IACvC,SAAAQ;AAAA,IACA,OAAO,EAAE,UAAUN,GAAM,WAAWA,EAAK;AAAA,IACzC,OAAOA;AAAA,IACP,QAAQA;AAAA,IACR,MAAMC;AAAA,IACN,GAAGE;AAAA,EAAA;AAUE,SAPYT,EAAM,cAAcG,GAAc;AAAA,IACnD,MAAAG;AAAA,IACA,OAAAC;AAAA,IACA,eAAAO;AAAA,IACA,OAAOV,KAAaJ,gBAAAA,EAAA,cAAC,SAAM,EAAA,IAAIU,KAAUN,CAAU;AAAA,EAAA,CACpD;AAGH,CAAC;AAEDL,EAAa,cAAc;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Illustration as r } from "./Illustration.js";
|
|
2
|
+
import { ViewBoxSize as i } from "./Illustration.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
r as Illustration,
|
|
5
|
+
i as ViewBoxSize,
|
|
6
|
+
r as default
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,118 +1,116 @@
|
|
|
1
|
-
import r, { useRef as
|
|
1
|
+
import r, { useRef as K, useState as $, useEffect as xe } from "react";
|
|
2
2
|
import v from "classnames";
|
|
3
|
-
import { FormMode as l, FormSize as
|
|
4
|
-
import { useBreakpoint as
|
|
3
|
+
import { FormMode as l, FormSize as Ce, IconSize as B, AnalyticsId as _e, AVERAGE_CHARACTER_WIDTH_PX as ve } from "../../constants.js";
|
|
4
|
+
import { useBreakpoint as ye, Breakpoint as Ee } from "../../hooks/useBreakpoint.js";
|
|
5
5
|
import { useUuid as U } from "../../hooks/useUuid.js";
|
|
6
6
|
import { getColor as F } from "../../theme/currys/color.js";
|
|
7
|
-
import { getAriaDescribedBy as
|
|
8
|
-
import
|
|
7
|
+
import { getAriaDescribedBy as ke } from "../../utils/accessibility.js";
|
|
8
|
+
import { ErrorWrapper as we } from "../ErrorWrapper/ErrorWrapper.js";
|
|
9
9
|
import { Icon as Ne } from "../Icon/Icon.js";
|
|
10
|
-
import { renderLabel as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
10
|
+
import { renderLabel as Ie } from "../Label/Label.js";
|
|
11
|
+
import { LazyIcon as Re } from "../LazyIcon/LazyIcon.js";
|
|
12
|
+
import We from "../MaxCharacters/MaxCharacters.js";
|
|
13
13
|
import t from "../Input/styles.module.scss";
|
|
14
|
-
var
|
|
15
|
-
const
|
|
14
|
+
var Se = /* @__PURE__ */ ((e) => (e.text = "text", e.number = "number", e.email = "email", e.password = "password", e.search = "search", e.tel = "tel", e.url = "url", e.date = "date", e.time = "time", e))(Se || {});
|
|
15
|
+
const ze = (e, s, p) => {
|
|
16
16
|
const i = s ? "1.5rem" : "2rem", f = s ? `${p}px` : "0px";
|
|
17
|
-
return `calc(${e *
|
|
18
|
-
},
|
|
17
|
+
return `calc(${e * ve}px + ${i} + ${f} + 4px)`;
|
|
18
|
+
}, Ae = r.forwardRef((e, s) => {
|
|
19
19
|
const {
|
|
20
20
|
className: p,
|
|
21
21
|
defaultValue: i,
|
|
22
22
|
placeholder: f,
|
|
23
23
|
type: h = "text",
|
|
24
|
-
name:
|
|
25
|
-
transparent:
|
|
24
|
+
name: L,
|
|
25
|
+
transparent: M = !1,
|
|
26
26
|
icon: a,
|
|
27
27
|
iconRight: b,
|
|
28
|
-
inputId:
|
|
29
|
-
inputWrapperRef:
|
|
28
|
+
inputId: P,
|
|
29
|
+
inputWrapperRef: H,
|
|
30
30
|
mode: c = l.onwhite,
|
|
31
|
-
size:
|
|
31
|
+
size: O,
|
|
32
32
|
baseIncrementValue: y,
|
|
33
|
-
label:
|
|
34
|
-
error:
|
|
33
|
+
label: X,
|
|
34
|
+
error: q,
|
|
35
35
|
errorText: E,
|
|
36
|
-
errorTextId:
|
|
37
|
-
testId:
|
|
36
|
+
errorTextId: G,
|
|
37
|
+
testId: j,
|
|
38
38
|
disabled: u,
|
|
39
|
-
readOnly:
|
|
40
|
-
autoComplete:
|
|
41
|
-
afterInputChildren:
|
|
42
|
-
rightOfInput:
|
|
39
|
+
readOnly: J,
|
|
40
|
+
autoComplete: Q = "off",
|
|
41
|
+
afterInputChildren: T,
|
|
42
|
+
rightOfInput: Y,
|
|
43
43
|
width: k,
|
|
44
|
-
required:
|
|
44
|
+
required: Z,
|
|
45
45
|
onChange: w,
|
|
46
|
-
onKeyDown:
|
|
47
|
-
autoFocus:
|
|
46
|
+
onKeyDown: N,
|
|
47
|
+
autoFocus: ee,
|
|
48
48
|
maxCharacters: d,
|
|
49
|
-
maxText:
|
|
50
|
-
...
|
|
51
|
-
} = e,
|
|
52
|
-
|
|
49
|
+
maxText: te,
|
|
50
|
+
...ne
|
|
51
|
+
} = e, re = ye(), m = K(null), I = U(P), [R, W] = $(i || ""), [ae, oe] = $(void 0), g = K(!1), S = U(G), z = /^[0-9]$/;
|
|
52
|
+
xe(() => {
|
|
53
53
|
W(i || "");
|
|
54
54
|
}, [i]);
|
|
55
|
-
const
|
|
56
|
-
[t["input-container--transparent"]]:
|
|
57
|
-
[t["input-container--on-blueberry"]]:
|
|
58
|
-
[t["input-container--on-dark"]]:
|
|
55
|
+
const ie = c === l.ondark, ce = c === l.onblueberry, le = !!d && R.toString().length > d, x = c === l.oninvalid || !!E || !!q || le, C = O === Ce.large, se = M && c !== l.ondark && !x, ue = v(t["input-wrapper"], p), de = v(t["input-container"], {
|
|
56
|
+
[t["input-container--transparent"]]: se,
|
|
57
|
+
[t["input-container--on-blueberry"]]: ce,
|
|
58
|
+
[t["input-container--on-dark"]]: ie,
|
|
59
59
|
[t["input-container--invalid"]]: x,
|
|
60
60
|
[t["input-container--large"]]: C,
|
|
61
61
|
[t["input-container--disabled"]]: u,
|
|
62
62
|
[t["input-container--with-icon"]]: a
|
|
63
|
-
}),
|
|
63
|
+
}), me = v(t["input-container__input"], {
|
|
64
64
|
[t["input-container__input--large"]]: C,
|
|
65
65
|
[t["input-container__input--disabled"]]: u
|
|
66
|
-
}), A = u ? F("neutral", 700) : F("black"), _ =
|
|
66
|
+
}), A = u ? F("neutral", 700) : F("black"), _ = re === Ee.xs || !C ? B.XSmall : B.Small, V = () => {
|
|
67
67
|
if (a)
|
|
68
|
-
return typeof a == "string" ? /* @__PURE__ */ r.createElement(
|
|
69
|
-
},
|
|
68
|
+
return typeof a == "string" ? /* @__PURE__ */ r.createElement(Re, { className: t["input-container__input__icon"], color: A, size: _, iconName: a }) : /* @__PURE__ */ r.createElement(Ne, { className: t["input-container__input__icon"], color: A, size: _, svgIcon: a });
|
|
69
|
+
}, pe = (n) => {
|
|
70
70
|
if (m && m.current && a) {
|
|
71
71
|
const o = b ? 0 : 1;
|
|
72
72
|
m.current.children[o].focus(), e.onClick && e.onClick(n);
|
|
73
73
|
}
|
|
74
|
+
}, fe = (n) => {
|
|
75
|
+
const o = he(n);
|
|
76
|
+
w && w(n), W(o), oe(o);
|
|
74
77
|
}, he = (n) => {
|
|
75
|
-
|
|
76
|
-
w && w(n), W(o), ie(o);
|
|
77
|
-
}, be = (n) => {
|
|
78
|
-
if (typeof y > "u" || h !== "number")
|
|
79
|
-
return n.target.value;
|
|
78
|
+
if (typeof y > "u" || h !== "number") return n.target.value;
|
|
80
79
|
const o = Number(n.target.value);
|
|
81
|
-
return !
|
|
80
|
+
return !ae && !g.current && (o === 1 || o === -1) && (n.target.value = y + ""), n.target.value;
|
|
81
|
+
}, be = (n) => {
|
|
82
|
+
z.test(n.key) && (g.current = !0), N && N(n);
|
|
82
83
|
}, ge = (n) => {
|
|
83
|
-
z.test(n.key) && (g.current = !0), I && I(n);
|
|
84
|
-
}, xe = (n) => {
|
|
85
84
|
z.test(n.key) && (g.current = !1);
|
|
86
|
-
},
|
|
87
|
-
return /* @__PURE__ */ r.createElement(
|
|
85
|
+
}, D = k ? ze(k, !!a, _) : void 0;
|
|
86
|
+
return /* @__PURE__ */ r.createElement(we, { errorText: E, errorTextId: S }, /* @__PURE__ */ r.createElement("div", { "data-testid": j, "data-analyticsid": _e.Input, className: ue, ref: H }, Ie(X, I, c), /* @__PURE__ */ r.createElement("div", { className: t["content-wrapper"] }, /* @__PURE__ */ r.createElement("div", { onClick: pe, ref: m, className: de, style: { maxWidth: D } }, !b && V(), /* @__PURE__ */ r.createElement(
|
|
88
87
|
"input",
|
|
89
88
|
{
|
|
90
|
-
onChange:
|
|
91
|
-
onKeyDown:
|
|
92
|
-
onKeyUp:
|
|
93
|
-
name:
|
|
89
|
+
onChange: fe,
|
|
90
|
+
onKeyDown: be,
|
|
91
|
+
onKeyUp: ge,
|
|
92
|
+
name: L,
|
|
94
93
|
type: h,
|
|
95
94
|
defaultValue: i,
|
|
96
|
-
id:
|
|
97
|
-
className:
|
|
95
|
+
id: I,
|
|
96
|
+
className: me,
|
|
98
97
|
ref: s,
|
|
99
98
|
"aria-labelledby": e["aria-labelledby"] ?? void 0,
|
|
100
|
-
"aria-describedby":
|
|
99
|
+
"aria-describedby": ke(e, S),
|
|
101
100
|
"aria-invalid": !!x,
|
|
102
101
|
disabled: u,
|
|
103
102
|
placeholder: f,
|
|
104
|
-
readOnly:
|
|
105
|
-
autoComplete:
|
|
106
|
-
required:
|
|
107
|
-
autoFocus:
|
|
108
|
-
...
|
|
103
|
+
readOnly: J,
|
|
104
|
+
autoComplete: Q || "off",
|
|
105
|
+
required: Z,
|
|
106
|
+
autoFocus: ee,
|
|
107
|
+
...ne
|
|
109
108
|
}
|
|
110
|
-
), b && V()), /* @__PURE__ */ r.createElement("div", { className: t["content-wrapper__right-of-input"] },
|
|
109
|
+
), b && V()), /* @__PURE__ */ r.createElement("div", { className: t["content-wrapper__right-of-input"] }, Y)), d && /* @__PURE__ */ r.createElement(We, { maxCharacters: d, length: R.toString().length, maxText: te, mode: c, maxWidth: D }), T));
|
|
111
110
|
});
|
|
112
|
-
|
|
113
|
-
const Ge = L;
|
|
111
|
+
Ae.displayName = "Input";
|
|
114
112
|
export {
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
Se as InputTypes,
|
|
114
|
+
Ae as default
|
|
117
115
|
};
|
|
118
116
|
//# sourceMappingURL=Input.js.map
|