@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.js","sources":["../../../src/components/Panel/Panel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnchorTarget, AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { useUuid } from '../../hooks/useUuid';\nimport { palette } from '../../theme/palette';\nimport { AriaLabelAttributes, getAriaLabelAttributes } from '../../utils/accessibility';\nimport Badge from '../Badge';\nimport Button, { ButtonProps, ButtonTags } from '../Button';\nimport Icon, { IconSize, SvgPathProps } from '../Icon';\nimport AlertSignFill from '../Icons/AlertSignFill';\nimport ArrowRight from '../Icons/ArrowRight';\nimport Calendar from '../Icons/Calendar';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport Pencil from '../Icons/Pencil';\nimport Watch from '../Icons/Watch';\nimport Title, { TitleTags } from '../Title';\n\nimport panelStyles from './styles.module.scss';\n\nexport enum PanelStatus {\n normal = 'normal',\n new = 'new',\n error = 'error',\n draft = 'draft',\n}\n\nexport enum PanelVariant {\n fill = 'fill',\n white = 'white',\n stroke = 'stroke',\n line = 'line',\n}\n\nexport enum PanelLayout {\n layout1 = 'layout1',\n layout2 = 'layout2',\n layout3a = 'layout3a',\n layout3b = 'layout3b',\n layout3c = 'layout3c',\n}\n\nexport interface PanelProps {\n /** Adds custom classes to the element. */\n className?: string;\n /** Panel section A content */\n contentA?: React.ReactNode | string;\n /** Panel section B content */\n contentB?: React.ReactNode | string;\n /** Content for a container that renders above A and B regardless of layout */\n contentHeader?: React.ReactNode;\n /** Container acts as a button, clicking anywhere triggers a panel button click */\n containerAsButton?: boolean;\n /** Panel children */\n children?: React.ReactNode;\n /** Displays date with icon */\n date?: string;\n /** Expands or collapses the panel */\n expanded?: boolean;\n /** Whether the panel can be focused */\n focusable?: boolean;\n /** Icon displayed in title */\n icon?: React.ReactNode;\n /** Panel button text */\n buttonText?: string;\n /** Panel button close text */\n buttonTextClose?: string;\n /** HTML markup for panel button. Default: a */\n buttonHtmlMarkup?: ButtonTags;\n /** Callback when the panel button is clicked */\n buttonOnClick?: ButtonProps['onClick'];\n /** Panel button is aria-labelledby the text in the button itself + the element set in buttonAriaLabelledById. Default: auto-generated id for title (if title is set). */\n buttonAriaLabelledById?: string;\n /** Panel button aria label */\n buttonAriaLabel?: string;\n /** Layout of the panel */\n layout?: keyof typeof PanelLayout;\n /** Removes top border when variant is \"line\" */\n noTopBorder?: boolean;\n /** Called when the panel is opened/closed */\n onExpand?: (isExpanded: boolean) => void;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Displays a status on the left side: default normal */\n status?: keyof typeof PanelStatus;\n /** Displayed on top of the panel with a status icon */\n statusMessage?: string;\n /** Sets the data-testid attribute for testing purposes */\n testId?: string;\n /** Displays time with icon */\n time?: string;\n /** Title of the panel */\n title?: string;\n /** Changes the underlying element of the title. Default: h2 */\n titleHtmlMarkup?: TitleTags;\n /** Changes the visual representation of the panel */\n variant?: keyof typeof PanelVariant;\n /** URL to details, renders as a button with anchor tag */\n url?: string;\n /** target used in the button: default is _self */\n target?: AnchorTarget;\n}\n\nexport interface LayoutProps\n extends Pick<PanelProps, 'contentA' | 'contentB' | 'contentHeader' | 'icon' | 'layout' | 'status' | 'statusMessage'> {\n ctaContainer?: React.ReactNode;\n titleElement: React.ReactNode;\n}\n\nconst StatusText: React.FC<{ status?: keyof typeof PanelStatus; statusMessage?: string }> = ({ status, statusMessage }) => {\n const statusIcon = (): { color: string; svgIcon: React.FC<SvgPathProps> } => {\n if (status === PanelStatus.error) {\n return { color: palette.cherry500, svgIcon: AlertSignFill };\n }\n\n return { color: palette.black, svgIcon: Pencil };\n };\n\n const statusMessageClass = classNames(panelStyles['status-message'], {\n [panelStyles['status-message--new']]: status === PanelStatus.new,\n });\n\n if ((status === PanelStatus.error || status === PanelStatus.draft) && statusMessage) {\n return (\n <div className={statusMessageClass} data-testid=\"display-status\">\n {<Icon {...statusIcon()} size={IconSize.XSmall} />} <span>{statusMessage}</span>\n </div>\n );\n }\n\n return null;\n};\n\nconst PreContainer: React.FC<{ children?: React.ReactNode }> = ({ children }) => {\n if (typeof children === 'undefined') return null;\n return <div className={panelStyles['header-container']}>{children}</div>;\n};\n\nconst DateTime: React.FC<{ date?: string; time?: string }> = ({ date, time }) => {\n if (date || time) {\n return (\n <div className={panelStyles['datetime-container']} data-testid=\"datetime\">\n {date && (\n <div className={panelStyles['datetime-container__icon']}>\n <Icon svgIcon={Calendar} size={IconSize.XSmall} />\n <span>{date}</span>\n </div>\n )}\n {time && (\n <div className={panelStyles['datetime-container__icon']}>\n <Icon svgIcon={Watch} size={IconSize.XSmall} />\n <span>{time}</span>\n </div>\n )}\n </div>\n );\n }\n\n return null;\n};\n\nconst PanelLayout1: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n status,\n statusMessage,\n titleElement,\n}) => {\n const panelLayoutClasses = classNames(panelStyles['panel__layout-1'], {\n [panelStyles['panel__layout-1--with-icon']]: icon,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-1'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n\n return (\n <div className={panelLayoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div className={panelStyles['panel__layout-1__content-a']}>\n {titleElement}\n {contentA}\n </div>\n {contentB && <div>{contentB}</div>}\n {ctaContainer}\n </div>\n );\n};\n\nconst PanelLayout2: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n status,\n statusMessage,\n titleElement,\n}) => {\n const panelLayoutClasses = classNames(panelStyles['panel__layout-2'], {\n [panelStyles['panel__layout-2--with-icon']]: icon,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-2'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n const lastColumnClass = panelStyles['panel__layout-2__last-column'];\n\n return (\n <div className={panelLayoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div className={panelStyles['panel__layout-2__content-a']}>\n {titleElement}\n {contentA}\n </div>\n {contentB && <div className={lastColumnClass}>{contentB}</div>}\n {ctaContainer && <div className={lastColumnClass}>{ctaContainer}</div>}\n </div>\n );\n};\n\nconst PanelLayout3: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n layout,\n status,\n statusMessage,\n titleElement,\n}) => {\n const layoutClasses = classNames(panelStyles['panel__layout-3'], {\n [panelStyles['panel__layout-3--with-icon']]: icon,\n [panelStyles['panel__layout-3--a']]: layout === PanelLayout.layout3a,\n [panelStyles['panel__layout-3--b']]: layout === PanelLayout.layout3b,\n [panelStyles['panel__layout-3--c']]: layout === PanelLayout.layout3c,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-3'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n\n return (\n <div className={layoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div>\n {titleElement}\n {contentA}\n </div>\n <div className={panelStyles['panel__layout-3__last-column']}>\n {contentB && <div className={panelStyles['panel__layout-3__last-column__content-b']}>{contentB}</div>}\n {ctaContainer}\n </div>\n </div>\n );\n};\n\nconst Panel = React.forwardRef(function PanelForwardedRef(props: PanelProps, ref: React.ForwardedRef<HTMLHeadingElement>) {\n const {\n buttonAriaLabel,\n buttonAriaLabelledById,\n buttonText = 'Se detaljer',\n buttonTextClose = 'Skjul detaljer',\n buttonHtmlMarkup = 'a',\n buttonOnClick,\n children,\n className,\n containerAsButton = false,\n contentA,\n contentB,\n contentHeader,\n date,\n expanded = false,\n focusable = false,\n icon,\n layout = PanelLayout.layout2,\n noTopBorder,\n onExpand,\n renderChildrenWhenClosed = false,\n status = PanelStatus.normal,\n statusMessage,\n target = '_self',\n testId,\n time,\n title,\n titleHtmlMarkup = 'h2',\n url,\n variant = PanelVariant.fill,\n } = props;\n\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n const titleId = useUuid();\n const buttonTextId = useUuid();\n const hasBadge = statusMessage && status === PanelStatus.new;\n const noContentB = typeof contentB === 'undefined';\n const layout1 = layout === 'layout1' || noContentB;\n const layout2 = !noContentB && layout === 'layout2';\n const layout3 = !noContentB && (layout === 'layout3a' || layout === 'layout3b' || layout === 'layout3c');\n const panelWrapperClasses = classNames(panelStyles['panel-wrapper'], className);\n\n const panelClasses = classNames(panelStyles.panel, {\n [panelStyles['panel--fill']]: variant === PanelVariant.fill,\n [panelStyles['panel--stroke']]: variant === PanelVariant.stroke,\n [panelStyles['panel--white']]: variant === PanelVariant.white,\n [panelStyles['panel--line']]: variant === PanelVariant.line,\n [panelStyles['panel--no-top-border']]: variant === PanelVariant.line && noTopBorder,\n [panelStyles['panel--selected']]: isExpanded,\n [panelStyles['panel--new']]: status === PanelStatus.new,\n [panelStyles['panel--draft']]: status === PanelStatus.draft,\n [panelStyles['panel--error']]: status === PanelStatus.error,\n [panelStyles['panel--status']]: status && status !== PanelStatus.normal,\n [panelStyles['panel--with-icon']]: icon,\n [panelStyles['panel--button']]: containerAsButton,\n [panelStyles['panel--clickable']]: children || url || onExpand || buttonOnClick || containerAsButton,\n });\n\n const renderCTAContainer = () => {\n const hasButton = children || url || buttonOnClick;\n const btnContainerClasses = classNames(panelStyles['panel__btn-container'], {\n [panelStyles['panel__btn-container--no-content-b']]: noContentB,\n [panelStyles['panel__btn-container--no-button']]: !hasButton,\n });\n\n return (\n (hasButton || date || time) && (\n <div className={btnContainerClasses}>\n {<DateTime date={date} time={time} />}\n {hasButton && <div className={panelStyles['panel__details-btn']}>{renderDetailsButton()}</div>}\n </div>\n )\n );\n };\n\n const renderDetailsButton = (): React.ReactNode => {\n const ariaLabelAttributes = getAriaLabelAttributes({\n label: buttonAriaLabel,\n id: (buttonAriaLabelledById && `${buttonTextId} ${buttonAriaLabelledById}`) || (title && titleId && `${buttonTextId} ${titleId}`),\n prefer: 'label',\n });\n\n const commonProps: Partial<ButtonProps> & AriaLabelAttributes = {\n onClick: buttonOnClick ? buttonOnClick : (): void => setIsExpanded(!isExpanded),\n className: containerAsButton ? panelStyles['panel__expand'] : undefined,\n variant: 'borderless',\n ellipsis: true,\n ...ariaLabelAttributes,\n };\n\n if (children) {\n return (\n <Button testId=\"expand\" aria-expanded={isExpanded} {...commonProps}>\n <span id={buttonTextId}>{isExpanded ? buttonTextClose : buttonText}</span>\n <Icon svgIcon={isExpanded ? ChevronUp : ChevronDown} />\n </Button>\n );\n }\n\n return (\n <Button testId=\"url\" htmlMarkup={buttonHtmlMarkup} href={url} target={target} {...commonProps}>\n <span id={buttonTextId}>{buttonText}</span>\n <Icon svgIcon={ArrowRight} />\n </Button>\n );\n };\n\n const renderContent = (): React.ReactNode | null => {\n if (!children || (!renderChildrenWhenClosed && !isExpanded)) {\n return null;\n }\n\n const panelDetailsClasses = classNames(panelStyles['panel-details'], {\n [panelStyles['panel-details--open']]: isExpanded,\n [panelStyles['panel-details--line']]: variant === PanelVariant.line,\n [panelStyles['panel-details--white']]: variant === PanelVariant.white,\n });\n\n return (\n <div className={panelDetailsClasses} data-testid=\"panel-details\">\n <div>{children}</div>\n </div>\n );\n };\n\n const renderTitle = () => {\n const titleContainerClasses = classNames(panelStyles['title-container'], {\n [panelStyles['title-container--no-content-a']]: !contentA,\n });\n const titleClasses = classNames(panelStyles['title-container__title'], {\n [panelStyles['title-container__title--badge']]: hasBadge,\n });\n\n return (\n title && (\n <div className={titleContainerClasses}>\n <Title appearance=\"title3\" htmlMarkup={titleHtmlMarkup} id={titleId} className={titleClasses}>\n {title}\n </Title>\n {hasBadge && (\n <div className={panelStyles.panel__badge}>\n <Badge color=\"blueberry\" testId=\"badge-status\">\n {statusMessage}\n </Badge>\n </div>\n )}\n </div>\n )\n );\n };\n\n const layoutProps: LayoutProps = {\n contentA: contentA,\n contentB: contentB,\n contentHeader: contentHeader,\n ctaContainer: renderCTAContainer(),\n icon: icon,\n status: status,\n statusMessage: statusMessage,\n titleElement: renderTitle(),\n };\n\n return (\n <div\n // eslint-disable-next-line no-constant-condition\n tabIndex={focusable ? -1 : undefined}\n ref={ref}\n data-testid={testId}\n className={panelWrapperClasses}\n data-analyticsid={AnalyticsId.Panel}\n >\n <div className={panelClasses}>\n {layout1 && <PanelLayout1 {...layoutProps} />}\n {layout2 && <PanelLayout2 {...layoutProps} />}\n {layout3 && <PanelLayout3 {...layoutProps} layout={layout} />}\n </div>\n {renderContent()}\n </div>\n );\n});\n\nexport default Panel;\n"],"names":["PanelStatus","PanelVariant","PanelLayout","StatusText","status","statusMessage","statusIcon","palette","AlertSignFill","Pencil","statusMessageClass","classNames","panelStyles","Icon","IconSize","React","PreContainer","children","DateTime","date","time","Calendar","Watch","PanelLayout1","contentA","contentB","contentHeader","ctaContainer","icon","titleElement","panelLayoutClasses","iconClasses","PanelLayout2","lastColumnClass","PanelLayout3","layout","layoutClasses","Panel","props","ref","buttonAriaLabel","buttonAriaLabelledById","buttonText","buttonTextClose","buttonHtmlMarkup","buttonOnClick","className","containerAsButton","expanded","focusable","noTopBorder","onExpand","renderChildrenWhenClosed","target","testId","title","titleHtmlMarkup","url","variant","isExpanded","setIsExpanded","useExpand","titleId","useUuid","buttonTextId","hasBadge","noContentB","layout1","layout2","layout3","panelWrapperClasses","panelClasses","renderCTAContainer","hasButton","btnContainerClasses","renderDetailsButton","ariaLabelAttributes","getAriaLabelAttributes","commonProps","Button","ChevronUp","ChevronDown","ArrowRight","renderContent","panelDetailsClasses","renderTitle","titleContainerClasses","titleClasses","Title","Badge","layoutProps","AnalyticsId","Panel$1"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBY,IAAAA,uBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,MAAM,OACNA,EAAA,QAAQ,SACRA,EAAA,QAAQ,SAJEA,IAAAA,MAAA,CAAA,CAAA,GAOAC,uBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,SAAS,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EAAA,cAAC,SAAI,WAAWwD,GAAA,GACbJ,KAAYpD,gBAAAA,EAAA,cAAAQ,IAAA,EAAc,GAAGmE,EAAa,CAAA,GAC1CtB,qCAAYpC,IAAc,EAAA,GAAG0D,GAAa,GAC1CrB,qCAAYnC,IAAc,EAAA,GAAGwD,GAAa,QAAAvD,EAAgB,CAAA,CAC7D;AAAA,IACCgD,GAAc;AAAA,EAAA;AAGrB,CAAC,GAEDS,KAAevD;"}
|
|
1
|
+
{"version":3,"file":"Panel.js","sources":["../../../src/components/Panel/Panel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnchorTarget, AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { useUuid } from '../../hooks/useUuid';\nimport { palette } from '../../theme/palette';\nimport { AriaLabelAttributes, getAriaLabelAttributes } from '../../utils/accessibility';\nimport Badge from '../Badge';\nimport Button, { ButtonProps, ButtonTags } from '../Button';\nimport Icon, { IconSize, SvgPathProps } from '../Icon';\nimport AlertSignFill from '../Icons/AlertSignFill';\nimport ArrowRight from '../Icons/ArrowRight';\nimport Calendar from '../Icons/Calendar';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport Pencil from '../Icons/Pencil';\nimport Watch from '../Icons/Watch';\nimport Title, { TitleTags } from '../Title';\n\nimport panelStyles from './styles.module.scss';\n\nexport enum PanelStatus {\n normal = 'normal',\n new = 'new',\n error = 'error',\n draft = 'draft',\n}\n\nexport enum PanelVariant {\n fill = 'fill',\n white = 'white',\n stroke = 'stroke',\n line = 'line',\n}\n\nexport enum PanelLayout {\n layout1 = 'layout1',\n layout2 = 'layout2',\n layout3a = 'layout3a',\n layout3b = 'layout3b',\n layout3c = 'layout3c',\n}\n\nexport interface PanelProps {\n /** Adds custom classes to the element. */\n className?: string;\n /** Panel section A content */\n contentA?: React.ReactNode | string;\n /** Panel section B content */\n contentB?: React.ReactNode | string;\n /** Content for a container that renders above A and B regardless of layout */\n contentHeader?: React.ReactNode;\n /** Container acts as a button, clicking anywhere triggers a panel button click */\n containerAsButton?: boolean;\n /** Panel children */\n children?: React.ReactNode;\n /** Displays date with icon */\n date?: string;\n /** Expands or collapses the panel */\n expanded?: boolean;\n /** Whether the panel can be focused */\n focusable?: boolean;\n /** Icon displayed in title */\n icon?: React.ReactNode;\n /** Panel button text */\n buttonText?: string;\n /** Panel button close text */\n buttonTextClose?: string;\n /** HTML markup for panel button. Default: a */\n buttonHtmlMarkup?: ButtonTags;\n /** Callback when the panel button is clicked */\n buttonOnClick?: ButtonProps['onClick'];\n /** Panel button is aria-labelledby the text in the button itself + the element set in buttonAriaLabelledById. Default: auto-generated id for title (if title is set). */\n buttonAriaLabelledById?: string;\n /** Panel button aria label */\n buttonAriaLabel?: string;\n /** Layout of the panel */\n layout?: keyof typeof PanelLayout;\n /** Removes top border when variant is \"line\" */\n noTopBorder?: boolean;\n /** Called when the panel is opened/closed */\n onExpand?: (isExpanded: boolean) => void;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Displays a status on the left side: default normal */\n status?: keyof typeof PanelStatus;\n /** Displayed on top of the panel with a status icon */\n statusMessage?: string;\n /** Sets the data-testid attribute for testing purposes */\n testId?: string;\n /** Displays time with icon */\n time?: string;\n /** Title of the panel */\n title?: string;\n /** Changes the underlying element of the title. Default: h2 */\n titleHtmlMarkup?: TitleTags;\n /** Changes the visual representation of the panel */\n variant?: keyof typeof PanelVariant;\n /** URL to details, renders as a button with anchor tag */\n url?: string;\n /** target used in the button: default is _self */\n target?: AnchorTarget;\n}\n\nexport interface LayoutProps\n extends Pick<PanelProps, 'contentA' | 'contentB' | 'contentHeader' | 'icon' | 'layout' | 'status' | 'statusMessage'> {\n ctaContainer?: React.ReactNode;\n titleElement: React.ReactNode;\n}\n\nconst StatusText: React.FC<{ status?: keyof typeof PanelStatus; statusMessage?: string }> = ({ status, statusMessage }) => {\n const statusIcon = (): { color: string; svgIcon: React.FC<SvgPathProps> } => {\n if (status === PanelStatus.error) {\n return { color: palette.cherry500, svgIcon: AlertSignFill };\n }\n\n return { color: palette.black, svgIcon: Pencil };\n };\n\n const statusMessageClass = classNames(panelStyles['status-message'], {\n [panelStyles['status-message--new']]: status === PanelStatus.new,\n });\n\n if ((status === PanelStatus.error || status === PanelStatus.draft) && statusMessage) {\n return (\n <div className={statusMessageClass} data-testid=\"display-status\">\n {<Icon {...statusIcon()} size={IconSize.XSmall} />} <span>{statusMessage}</span>\n </div>\n );\n }\n\n return null;\n};\n\nconst PreContainer: React.FC<{ children?: React.ReactNode }> = ({ children }) => {\n if (typeof children === 'undefined') return null;\n return <div className={panelStyles['header-container']}>{children}</div>;\n};\n\nconst DateTime: React.FC<{ date?: string; time?: string }> = ({ date, time }) => {\n if (date || time) {\n return (\n <div className={panelStyles['datetime-container']} data-testid=\"datetime\">\n {date && (\n <div className={panelStyles['datetime-container__icon']}>\n <Icon svgIcon={Calendar} size={IconSize.XSmall} />\n <span>{date}</span>\n </div>\n )}\n {time && (\n <div className={panelStyles['datetime-container__icon']}>\n <Icon svgIcon={Watch} size={IconSize.XSmall} />\n <span>{time}</span>\n </div>\n )}\n </div>\n );\n }\n\n return null;\n};\n\nconst PanelLayout1: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n status,\n statusMessage,\n titleElement,\n}) => {\n const panelLayoutClasses = classNames(panelStyles['panel__layout-1'], {\n [panelStyles['panel__layout-1--with-icon']]: icon,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-1'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n\n return (\n <div className={panelLayoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div className={panelStyles['panel__layout-1__content-a']}>\n {titleElement}\n {contentA}\n </div>\n {contentB && <div>{contentB}</div>}\n {ctaContainer}\n </div>\n );\n};\n\nconst PanelLayout2: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n status,\n statusMessage,\n titleElement,\n}) => {\n const panelLayoutClasses = classNames(panelStyles['panel__layout-2'], {\n [panelStyles['panel__layout-2--with-icon']]: icon,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-2'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n const lastColumnClass = panelStyles['panel__layout-2__last-column'];\n\n return (\n <div className={panelLayoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div className={panelStyles['panel__layout-2__content-a']}>\n {titleElement}\n {contentA}\n </div>\n {contentB && <div className={lastColumnClass}>{contentB}</div>}\n {ctaContainer && <div className={lastColumnClass}>{ctaContainer}</div>}\n </div>\n );\n};\n\nconst PanelLayout3: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n layout,\n status,\n statusMessage,\n titleElement,\n}) => {\n const layoutClasses = classNames(panelStyles['panel__layout-3'], {\n [panelStyles['panel__layout-3--with-icon']]: icon,\n [panelStyles['panel__layout-3--a']]: layout === PanelLayout.layout3a,\n [panelStyles['panel__layout-3--b']]: layout === PanelLayout.layout3b,\n [panelStyles['panel__layout-3--c']]: layout === PanelLayout.layout3c,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-3'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n\n return (\n <div className={layoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div>\n {titleElement}\n {contentA}\n </div>\n <div className={panelStyles['panel__layout-3__last-column']}>\n {contentB && <div className={panelStyles['panel__layout-3__last-column__content-b']}>{contentB}</div>}\n {ctaContainer}\n </div>\n </div>\n );\n};\n\nconst Panel = React.forwardRef(function PanelForwardedRef(props: PanelProps, ref: React.ForwardedRef<HTMLHeadingElement>) {\n const {\n buttonAriaLabel,\n buttonAriaLabelledById,\n buttonText = 'Se detaljer',\n buttonTextClose = 'Skjul detaljer',\n buttonHtmlMarkup = 'a',\n buttonOnClick,\n children,\n className,\n containerAsButton = false,\n contentA,\n contentB,\n contentHeader,\n date,\n expanded = false,\n focusable = false,\n icon,\n layout = PanelLayout.layout2,\n noTopBorder,\n onExpand,\n renderChildrenWhenClosed = false,\n status = PanelStatus.normal,\n statusMessage,\n target = '_self',\n testId,\n time,\n title,\n titleHtmlMarkup = 'h2',\n url,\n variant = PanelVariant.fill,\n } = props;\n\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n const titleId = useUuid();\n const buttonTextId = useUuid();\n const hasBadge = statusMessage && status === PanelStatus.new;\n const noContentB = typeof contentB === 'undefined';\n const layout1 = layout === 'layout1' || noContentB;\n const layout2 = !noContentB && layout === 'layout2';\n const layout3 = !noContentB && (layout === 'layout3a' || layout === 'layout3b' || layout === 'layout3c');\n const panelWrapperClasses = classNames(panelStyles['panel-wrapper'], className);\n\n const panelClasses = classNames(panelStyles.panel, {\n [panelStyles['panel--fill']]: variant === PanelVariant.fill,\n [panelStyles['panel--stroke']]: variant === PanelVariant.stroke,\n [panelStyles['panel--white']]: variant === PanelVariant.white,\n [panelStyles['panel--line']]: variant === PanelVariant.line,\n [panelStyles['panel--no-top-border']]: variant === PanelVariant.line && noTopBorder,\n [panelStyles['panel--selected']]: isExpanded,\n [panelStyles['panel--new']]: status === PanelStatus.new,\n [panelStyles['panel--draft']]: status === PanelStatus.draft,\n [panelStyles['panel--error']]: status === PanelStatus.error,\n [panelStyles['panel--status']]: status && status !== PanelStatus.normal,\n [panelStyles['panel--with-icon']]: icon,\n [panelStyles['panel--button']]: containerAsButton,\n [panelStyles['panel--clickable']]: children || url || onExpand || buttonOnClick || containerAsButton,\n });\n\n const renderCTAContainer = () => {\n const hasButton = children || url || buttonOnClick;\n const btnContainerClasses = classNames(panelStyles['panel__btn-container'], {\n [panelStyles['panel__btn-container--no-content-b']]: noContentB,\n [panelStyles['panel__btn-container--no-button']]: !hasButton,\n });\n\n return (\n (hasButton || date || time) && (\n <div className={btnContainerClasses}>\n {<DateTime date={date} time={time} />}\n {hasButton && <div className={panelStyles['panel__details-btn']}>{renderDetailsButton()}</div>}\n </div>\n )\n );\n };\n\n const renderDetailsButton = (): React.ReactNode => {\n const ariaLabelAttributes = getAriaLabelAttributes({\n label: buttonAriaLabel,\n id: (buttonAriaLabelledById && `${buttonTextId} ${buttonAriaLabelledById}`) || (title && titleId && `${buttonTextId} ${titleId}`),\n prefer: 'label',\n });\n\n const commonProps: Partial<ButtonProps> & AriaLabelAttributes = {\n onClick: buttonOnClick ? buttonOnClick : (): void => setIsExpanded(!isExpanded),\n className: containerAsButton ? panelStyles['panel__expand'] : undefined,\n variant: 'borderless',\n ellipsis: true,\n ...ariaLabelAttributes,\n };\n\n if (children) {\n return (\n <Button testId=\"expand\" aria-expanded={isExpanded} {...commonProps}>\n <span id={buttonTextId}>{isExpanded ? buttonTextClose : buttonText}</span>\n <Icon svgIcon={isExpanded ? ChevronUp : ChevronDown} />\n </Button>\n );\n }\n\n return (\n <Button testId=\"url\" htmlMarkup={buttonHtmlMarkup} href={url} target={target} {...commonProps}>\n <span id={buttonTextId}>{buttonText}</span>\n <Icon svgIcon={ArrowRight} />\n </Button>\n );\n };\n\n const renderContent = (): React.ReactNode | null => {\n if (!children || (!renderChildrenWhenClosed && !isExpanded)) {\n return null;\n }\n\n const panelDetailsClasses = classNames(panelStyles['panel-details'], {\n [panelStyles['panel-details--open']]: isExpanded,\n [panelStyles['panel-details--line']]: variant === PanelVariant.line,\n [panelStyles['panel-details--white']]: variant === PanelVariant.white,\n });\n\n return (\n <div className={panelDetailsClasses} data-testid=\"panel-details\">\n <div>{children}</div>\n </div>\n );\n };\n\n const renderTitle = () => {\n const titleContainerClasses = classNames(panelStyles['title-container'], {\n [panelStyles['title-container--no-content-a']]: !contentA,\n });\n const titleClasses = classNames(panelStyles['title-container__title'], {\n [panelStyles['title-container__title--badge']]: hasBadge,\n });\n\n return (\n title && (\n <div className={titleContainerClasses}>\n <Title appearance=\"title3\" htmlMarkup={titleHtmlMarkup} id={titleId} className={titleClasses}>\n {title}\n </Title>\n {hasBadge && (\n <div className={panelStyles.panel__badge}>\n <Badge color=\"blueberry\" testId=\"badge-status\">\n {statusMessage}\n </Badge>\n </div>\n )}\n </div>\n )\n );\n };\n\n const layoutProps: LayoutProps = {\n contentA: contentA,\n contentB: contentB,\n contentHeader: contentHeader,\n ctaContainer: renderCTAContainer(),\n icon: icon,\n status: status,\n statusMessage: statusMessage,\n titleElement: renderTitle(),\n };\n\n return (\n <div\n // eslint-disable-next-line no-constant-condition\n tabIndex={focusable ? -1 : undefined}\n ref={ref}\n data-testid={testId}\n className={panelWrapperClasses}\n data-analyticsid={AnalyticsId.Panel}\n >\n <div className={panelClasses}>\n {layout1 && <PanelLayout1 {...layoutProps} />}\n {layout2 && <PanelLayout2 {...layoutProps} />}\n {layout3 && <PanelLayout3 {...layoutProps} layout={layout} />}\n </div>\n {renderContent()}\n </div>\n );\n});\n\nexport default Panel;\n"],"names":["PanelStatus","PanelVariant","PanelLayout","StatusText","status","statusMessage","statusIcon","palette","AlertSignFill","Pencil","statusMessageClass","classNames","panelStyles","Icon","IconSize","React","PreContainer","children","DateTime","date","time","Calendar","Watch","PanelLayout1","contentA","contentB","contentHeader","ctaContainer","icon","titleElement","panelLayoutClasses","iconClasses","PanelLayout2","lastColumnClass","PanelLayout3","layout","layoutClasses","Panel","props","ref","buttonAriaLabel","buttonAriaLabelledById","buttonText","buttonTextClose","buttonHtmlMarkup","buttonOnClick","className","containerAsButton","expanded","focusable","noTopBorder","onExpand","renderChildrenWhenClosed","target","testId","title","titleHtmlMarkup","url","variant","isExpanded","setIsExpanded","useExpand","titleId","useUuid","buttonTextId","hasBadge","noContentB","layout1","layout2","layout3","panelWrapperClasses","panelClasses","renderCTAContainer","hasButton","btnContainerClasses","renderDetailsButton","ariaLabelAttributes","getAriaLabelAttributes","commonProps","Button","ChevronUp","ChevronDown","ArrowRight","renderContent","panelDetailsClasses","renderTitle","titleContainerClasses","titleClasses","Title","Badge","layoutProps","AnalyticsId"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBY,IAAAA,uBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,MAAM,OACNA,EAAA,QAAQ,SACRA,EAAA,QAAQ,SAJEA,IAAAA,MAAA,CAAA,CAAA,GAOAC,uBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,OAAO,QAJGA,IAAAA,MAAA,CAAA,CAAA,GAOAC,uBAAAA,OACVA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,WAAW,YACXA,EAAA,WAAW,YACXA,EAAA,WAAW,YALDA,IAAAA,MAAA,CAAA,CAAA;AA2EZ,MAAMC,IAAsF,CAAC,EAAE,QAAAC,GAAQ,eAAAC,QAAoB;AACzH,QAAMC,IAAa,MACbF,MAAW,UACN,EAAE,OAAOG,EAAQ,WAAW,SAASC,GAAc,IAGrD,EAAE,OAAOD,EAAQ,OAAO,SAASE,GAAO,GAG3CC,IAAqBC,EAAWC,EAAY,gBAAgB,GAAG;AAAA,IACnE,CAACA,EAAY,qBAAqB,CAAC,GAAGR,MAAW;AAAA;AAAA,EAAA,CAClD;AAED,UAAKA,MAAW,WAAqBA,MAAW,YAAsBC,oCAEjE,OAAI,EAAA,WAAWK,GAAoB,eAAY,iBAAA,mCAC5CG,GAAM,EAAA,GAAGP,KAAc,MAAMQ,EAAS,OAAQ,CAAA,GAAG,KAAEC,gBAAAA,EAAA,cAAA,QAAA,MAAMV,CAAc,CAC3E,IAIG;AACT,GAEMW,IAAyD,CAAC,EAAE,UAAAC,QAC5D,OAAOA,IA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AA,OAAM,aAAY,QAAO,eAC7B,GAAApF,CACH,CACF,CAEJ;AAAA,EAAA,GAKAqF,IAA2B;AAAA,IAC/B,UAAAlE;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAc8C,GAAmB;AAAA,IACjC,MAAA5C;AAAA,IACA,QAAAxB;AAAA,IACA,eAAAC;AAAA,IACA,cAAcgF,GAAY;AAAA,EAAA;AAI1B,SAAAtE,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MAEC,UAAUkC,IAAY,KAAK;AAAA,MAC3B,KAAAV;AAAA,MACA,eAAae;AAAA,MACb,WAAWgB;AAAA,MACX,oBAAkBqB,GAAY;AAAA,IAAA;AAAA,IAE9B5E,gBAAAA,EAAA,cAAC,SAAI,WAAWwD,GAAA,GACbJ,KAAYpD,gBAAAA,EAAA,cAAAQ,IAAA,EAAc,GAAGmE,EAAa,CAAA,GAC1CtB,qCAAYpC,IAAc,EAAA,GAAG0D,GAAa,GAC1CrB,qCAAYnC,IAAc,EAAA,GAAGwD,GAAa,QAAAvD,EAAgB,CAAA,CAC7D;AAAA,IACCgD,GAAc;AAAA,EAAA;AAGrB,CAAC;"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@import '../../scss/font-settings';
|
|
6
6
|
|
|
7
7
|
@mixin panel-padding {
|
|
8
|
-
padding: getSpacer(s)
|
|
8
|
+
padding: getSpacer(s);
|
|
9
9
|
|
|
10
10
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
11
11
|
padding: getSpacer(l) getSpacer(m) getSpacer(l) getSpacer(l);
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
@mixin panel-padding-icon {
|
|
16
|
-
padding: getSpacer(m) getSpacer(s) getSpacer(l)
|
|
16
|
+
padding: getSpacer(m) getSpacer(s) getSpacer(l);
|
|
17
17
|
|
|
18
18
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
19
|
-
padding: getSpacer(m) getSpacer(m) getSpacer(l)
|
|
19
|
+
padding: getSpacer(m) getSpacer(m) getSpacer(l);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { AnalyticsId as
|
|
1
|
+
import a from "react";
|
|
2
|
+
import p from "classnames";
|
|
3
|
+
import { AnalyticsId as c } from "../../constants.js";
|
|
4
4
|
import f, { PanelVariant as o } from "../Panel/Panel.js";
|
|
5
5
|
import P from "../PanelList/styles.module.scss";
|
|
6
|
-
const u = (
|
|
7
|
-
const { testId: i, children: m, variant: n = o.fill } =
|
|
6
|
+
const u = (t) => a.isValidElement(t) && t.type === f, v = a.forwardRef(function(l, s) {
|
|
7
|
+
const { testId: i, children: m, variant: n = o.fill } = l, d = (e, r) => a.cloneElement(e, {
|
|
8
8
|
variant: n,
|
|
9
9
|
noTopBorder: n === o.line && !r,
|
|
10
|
-
className:
|
|
10
|
+
className: p(e.props.className, n !== o.line && P["panel-list__panel"])
|
|
11
11
|
});
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
})
|
|
12
|
+
return /* @__PURE__ */ a.createElement("div", { ref: s, "data-testid": i, "data-analyticsid": c.PanelList }, a.Children.map(m, (e, r) => u(e) ? d(e, r === 0) : e));
|
|
13
|
+
});
|
|
14
14
|
export {
|
|
15
15
|
v as default
|
|
16
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelList.js","sources":["../../../src/components/PanelList/PanelList.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport Panel, { PanelProps, PanelVariant } from '../Panel';\n\nimport styles from './styles.module.scss';\n\nexport interface PanelListProps {\n /** Panels to render inside the PanelList */\n children?: React.ReactNode;\n /** Changes the visual representation of the panel. Default: fill */\n variant?: keyof typeof PanelVariant;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst isPanelComponent = (element: {} | null | undefined): element is React.ReactElement<PanelProps> =>\n React.isValidElement<PanelProps>(element) && (element as React.ReactElement).type === Panel;\n\nconst PanelList = React.forwardRef(function BadgeForwardedRef(props: PanelListProps, ref: React.ForwardedRef<HTMLDivElement>) {\n const { testId, children, variant = PanelVariant.fill } = props;\n\n const renderPanel = (panel: React.ReactElement<PanelProps>, firstChild: boolean) =>\n React.cloneElement(panel, {\n variant: variant,\n noTopBorder: variant === PanelVariant.line && !firstChild,\n className: classNames(panel.props.className, variant !== PanelVariant.line && styles['panel-list__panel']),\n });\n\n return (\n <div ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.PanelList}>\n {React.Children.map(children, (child, index) => (isPanelComponent(child) ? renderPanel(child, index === 0) : child))}\n </div>\n );\n});\n\nexport default PanelList;\n"],"names":["isPanelComponent","element","React","Panel","PanelList","props","ref","testId","children","variant","PanelVariant","renderPanel","panel","firstChild","classNames","styles","AnalyticsId","child","index"
|
|
1
|
+
{"version":3,"file":"PanelList.js","sources":["../../../src/components/PanelList/PanelList.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport Panel, { PanelProps, PanelVariant } from '../Panel';\n\nimport styles from './styles.module.scss';\n\nexport interface PanelListProps {\n /** Panels to render inside the PanelList */\n children?: React.ReactNode;\n /** Changes the visual representation of the panel. Default: fill */\n variant?: keyof typeof PanelVariant;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst isPanelComponent = (element: {} | null | undefined): element is React.ReactElement<PanelProps> =>\n React.isValidElement<PanelProps>(element) && (element as React.ReactElement).type === Panel;\n\nconst PanelList = React.forwardRef(function BadgeForwardedRef(props: PanelListProps, ref: React.ForwardedRef<HTMLDivElement>) {\n const { testId, children, variant = PanelVariant.fill } = props;\n\n const renderPanel = (panel: React.ReactElement<PanelProps>, firstChild: boolean) =>\n React.cloneElement(panel, {\n variant: variant,\n noTopBorder: variant === PanelVariant.line && !firstChild,\n className: classNames(panel.props.className, variant !== PanelVariant.line && styles['panel-list__panel']),\n });\n\n return (\n <div ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.PanelList}>\n {React.Children.map(children, (child, index) => (isPanelComponent(child) ? renderPanel(child, index === 0) : child))}\n </div>\n );\n});\n\nexport default PanelList;\n"],"names":["isPanelComponent","element","React","Panel","PanelList","props","ref","testId","children","variant","PanelVariant","renderPanel","panel","firstChild","classNames","styles","AnalyticsId","child","index"],"mappings":";;;;;AAkBA,MAAMA,IAAmB,CAACC,MACxBC,EAAM,eAA2BD,CAAO,KAAMA,EAA+B,SAASE,GAElFC,IAAYF,EAAM,WAAW,SAA2BG,GAAuBC,GAAyC;AAC5H,QAAM,EAAE,QAAAC,GAAQ,UAAAC,GAAU,SAAAC,IAAUC,EAAa,KAAS,IAAAL,GAEpDM,IAAc,CAACC,GAAuCC,MAC1DX,EAAM,aAAaU,GAAO;AAAA,IACxB,SAAAH;AAAA,IACA,aAAaA,MAAYC,EAAa,QAAQ,CAACG;AAAA,IAC/C,WAAWC,EAAWF,EAAM,MAAM,WAAWH,MAAYC,EAAa,QAAQK,EAAO,mBAAmB,CAAC;AAAA,EAAA,CAC1G;AAGD,SAAAb,gBAAAA,EAAA,cAAC,OAAI,EAAA,KAAAI,GAAU,eAAaC,GAAQ,oBAAkBS,EAAY,UAAA,GAC/Dd,EAAM,SAAS,IAAIM,GAAU,CAACS,GAAOC,MAAWlB,EAAiBiB,CAAK,IAAIN,EAAYM,GAAOC,MAAU,CAAC,IAAID,CAAM,CACrH;AAEJ,CAAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import e, { useRef as
|
|
1
|
+
import e, { useRef as m, useState as W } from "react";
|
|
2
2
|
import u from "classnames";
|
|
3
|
-
import { IconSize as
|
|
3
|
+
import { IconSize as p, AnalyticsId as $ } from "../../constants.js";
|
|
4
4
|
import { useBreakpoint as j } from "../../hooks/useBreakpoint.js";
|
|
5
5
|
import { useHover as q } from "../../hooks/useHover.js";
|
|
6
6
|
import { useOutsideEvent as F } from "../../hooks/useOutsideEvent.js";
|
|
@@ -10,13 +10,13 @@ import { isComponent as y } from "../../utils/component.js";
|
|
|
10
10
|
import { Icon as f } from "../Icon/Icon.js";
|
|
11
11
|
import K from "../Icons/VerticalDots.js";
|
|
12
12
|
import Q from "../Icons/X.js";
|
|
13
|
-
import U from "../LazyIcon/LazyIcon.js";
|
|
14
|
-
import h from "../LinkList/LinkList.js";
|
|
13
|
+
import { LazyIcon as U } from "../LazyIcon/LazyIcon.js";
|
|
14
|
+
import { LinkList as h } from "../LinkList/LinkList.js";
|
|
15
15
|
import V from "../PopOver/PopOver.js";
|
|
16
16
|
import l from "../PopMenu/styles.module.scss";
|
|
17
17
|
var Y = /* @__PURE__ */ ((o) => (o.onWhite = "on-white", o.onGray = "on-gray", o.onBlueberry = "on-blueberry", o))(Y || {}), Z = /* @__PURE__ */ ((o) => (o.right = "right", o.left = "left", o))(Z || {});
|
|
18
|
-
const
|
|
19
|
-
const d =
|
|
18
|
+
const ge = (o) => {
|
|
19
|
+
const d = m(null), v = m(null), B = m(null), b = m(null), [r, c] = W(!1), {
|
|
20
20
|
children: g,
|
|
21
21
|
popOverClassName: O,
|
|
22
22
|
popMenuClassName: N,
|
|
@@ -36,7 +36,7 @@ const ee = (o) => {
|
|
|
36
36
|
F(b, () => {
|
|
37
37
|
c(!1);
|
|
38
38
|
});
|
|
39
|
-
const { isHovered: i } = q(d), k = T ?
|
|
39
|
+
const { isHovered: i } = q(d), k = T ? p.XSmall : p.Small, w = (t) => {
|
|
40
40
|
c(!1), t && t();
|
|
41
41
|
}, x = () => {
|
|
42
42
|
if (y(g, h))
|
|
@@ -55,7 +55,7 @@ const ee = (o) => {
|
|
|
55
55
|
children: e.Children.map(
|
|
56
56
|
t.props.children,
|
|
57
57
|
(s) => y(s, h.Link) ? e.cloneElement(s, {
|
|
58
|
-
onClick: (
|
|
58
|
+
onClick: (P) => w(() => s.props.onClick && s.props.onClick(P))
|
|
59
59
|
}) : s
|
|
60
60
|
)
|
|
61
61
|
})
|
|
@@ -63,7 +63,7 @@ const ee = (o) => {
|
|
|
63
63
|
);
|
|
64
64
|
}, X = (t) => {
|
|
65
65
|
t && t.stopPropagation(), c(!r);
|
|
66
|
-
}, A = n && typeof n == "string" ? /* @__PURE__ */ e.createElement(U, { iconName: n, size:
|
|
66
|
+
}, A = n && typeof n == "string" ? /* @__PURE__ */ e.createElement(U, { iconName: n, size: p.XSmall, isHovered: i }) : n && /* @__PURE__ */ e.createElement(f, { svgIcon: n, size: p.XSmall, isHovered: i }), D = n ? A : /* @__PURE__ */ e.createElement(f, { svgIcon: n ?? K, color: E("black"), size: k, isHovered: i }), G = /* @__PURE__ */ e.createElement(f, { svgIcon: Q, color: E("black"), size: k, isHovered: i }), M = /* @__PURE__ */ e.createElement(
|
|
67
67
|
"button",
|
|
68
68
|
{
|
|
69
69
|
ref: d,
|
|
@@ -75,15 +75,15 @@ const ee = (o) => {
|
|
|
75
75
|
type: "button"
|
|
76
76
|
},
|
|
77
77
|
a && I == "left" && /* @__PURE__ */ e.createElement("span", null, a),
|
|
78
|
-
/* @__PURE__ */ e.createElement("div", { ref: v }, r ?
|
|
78
|
+
/* @__PURE__ */ e.createElement("div", { ref: v }, r ? G : D),
|
|
79
79
|
a && I == "right" && /* @__PURE__ */ e.createElement("span", null, a)
|
|
80
80
|
);
|
|
81
|
-
return /* @__PURE__ */ e.createElement("div", { ref: b, className: u(l["pop-menu-button"], N), "data-analyticsid":
|
|
82
|
-
}
|
|
81
|
+
return /* @__PURE__ */ e.createElement("div", { ref: b, className: u(l["pop-menu-button"], N), "data-analyticsid": $.PopMenu }, M, r && x());
|
|
82
|
+
};
|
|
83
83
|
export {
|
|
84
|
-
|
|
84
|
+
ge as PopMenu,
|
|
85
85
|
Z as PopMenuLabelPosition,
|
|
86
86
|
Y as PopMenuVariant,
|
|
87
|
-
|
|
87
|
+
ge as default
|
|
88
88
|
};
|
|
89
89
|
//# sourceMappingURL=PopMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopMenu.js","sources":["../../../src/components/PopMenu/PopMenu.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { useOutsideEvent } from '../../hooks/useOutsideEvent';\nimport { getColor } from '../../theme/currys';\nimport { breakpoints } from '../../theme/grid';\nimport { isComponent } from '../../utils/component';\nimport Icon, { SvgIcon } from '../Icon';\nimport { IconName } from '../Icons/IconNames';\nimport VerticalDots from '../Icons/VerticalDots';\nimport X from '../Icons/X';\nimport LazyIcon from '../LazyIcon';\nimport LinkList, { LinkListProps, LinkProps } from '../LinkList';\nimport PopOver from '../PopOver';\n\nimport styles from './styles.module.scss';\n\nexport enum PopMenuVariant {\n onWhite = 'on-white',\n onGray = 'on-gray',\n onBlueberry = 'on-blueberry',\n}\n\nexport enum PopMenuLabelPosition {\n right = 'right',\n left = 'left',\n}\n\nexport interface PopMenuProps {\n /** Content shown inside PopOver. Can only be a LinkList */\n children: React.ReactElement<LinkListProps>;\n /** Adds custom classes to the popover element. */\n popOverClassName?: string;\n /** Adds custom classes to the element. */\n popMenuClassName?: string;\n /** Changes responsive design for the trigger buttons. */\n popMenuVariant?: PopMenuVariant;\n /** Sets the data-testid attribute for the button that opens. */\n openButtonTestId?: string;\n /** Sets the data-testid attribute for the button that closes. */\n closeButtonTestId?: string;\n /** Sets the data-testid attribute for the popover. */\n popOverTestId?: string;\n /** Sets the arial-label attribute for the openButton. */\n openButtonAriaLabel?: string;\n /** Sets the arial-label attribute for the closeButton. */\n closeButtonAriaLabel?: string;\n /** Sets the icon on the trigger button. */\n svgIcon?: SvgIcon | IconName;\n /** Optional text next to the trigger button. */\n labelText?: string;\n /** Placement of the label text relative to the trigger button. */\n labelTextPosition?: PopMenuLabelPosition;\n}\n\nexport const PopMenu: React.FC<PopMenuProps> = (props: PopMenuProps) => {\n const triggerButtonRef = useRef<HTMLButtonElement>(null);\n const iconRef = useRef<HTMLDivElement>(null);\n const popOverRef = useRef<HTMLDivElement>(null);\n const outerRef = useRef<HTMLDivElement>(null);\n const [isOpen, setIsOpen] = useState(false);\n const {\n children,\n popOverClassName,\n popMenuClassName,\n openButtonTestId,\n closeButtonTestId,\n popOverTestId,\n popMenuVariant = PopMenuVariant.onWhite,\n openButtonAriaLabel,\n closeButtonAriaLabel,\n svgIcon,\n labelText,\n labelTextPosition = PopMenuLabelPosition.right,\n } = props;\n const buttonClasses = classNames(styles['pop-menu-button'], {\n [styles[`pop-menu-button--${popMenuVariant}`]]: popMenuVariant,\n });\n const breakpoint = useBreakpoint();\n const mobile = breakpoint < breakpoints.md;\n\n useOutsideEvent(outerRef, () => {\n setIsOpen(false);\n });\n\n const { isHovered: triggerButtonIsHovered } = useHover(triggerButtonRef);\n const mobileIconSize = mobile ? IconSize.XSmall : IconSize.Small;\n\n const handleClick = (cb?: () => void): void => {\n setIsOpen(false);\n cb && cb();\n };\n\n const renderChildren = () => {\n if (isComponent<LinkListProps>(children, LinkList)) {\n return (\n <PopOver\n testId={popOverTestId}\n className={classNames(styles['pop-menu__pop-over'], popOverClassName)}\n arrowClassName={styles['pop-menu__pop-over-arrow']}\n controllerRef={iconRef}\n popOverRef={popOverRef}\n >\n {React.Children.map(children, child =>\n React.cloneElement(child, {\n children: React.Children.map(child.props.children, child =>\n isComponent<LinkProps>(child, LinkList.Link)\n ? React.cloneElement(child, {\n onClick: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) =>\n handleClick(() => child.props.onClick && child.props.onClick(event)),\n })\n : child\n ),\n })\n )}\n </PopOver>\n );\n }\n };\n\n const toggleOpenOnClick = (e?: React.MouseEvent<HTMLElement, MouseEvent>): void => {\n e && e.stopPropagation();\n setIsOpen(!isOpen);\n };\n\n const iconComponent =\n svgIcon && typeof svgIcon === 'string' ? (\n <LazyIcon iconName={svgIcon} size={IconSize.XSmall} isHovered={triggerButtonIsHovered} />\n ) : (\n svgIcon && <Icon svgIcon={svgIcon} size={IconSize.XSmall} isHovered={triggerButtonIsHovered} />\n );\n\n const openIcon = svgIcon ? (\n iconComponent\n ) : (\n <Icon svgIcon={svgIcon ?? VerticalDots} color={getColor('black')} size={mobileIconSize} isHovered={triggerButtonIsHovered} />\n );\n\n const closeIcon = <Icon svgIcon={X} color={getColor('black')} size={mobileIconSize} isHovered={triggerButtonIsHovered} />;\n\n const triggerButton = (\n <button\n ref={triggerButtonRef}\n data-testid={isOpen ? closeButtonTestId : openButtonTestId}\n className={buttonClasses}\n aria-label={isOpen ? closeButtonAriaLabel : openButtonAriaLabel}\n aria-expanded={isOpen}\n onClick={toggleOpenOnClick}\n type=\"button\"\n >\n {labelText && labelTextPosition == PopMenuLabelPosition.left && <span>{labelText}</span>}\n {<div ref={iconRef}>{isOpen ? closeIcon : openIcon}</div>}\n {labelText && labelTextPosition == PopMenuLabelPosition.right && <span>{labelText}</span>}\n </button>\n );\n\n return (\n <div ref={outerRef} className={classNames(styles['pop-menu-button'], popMenuClassName)} data-analyticsid={AnalyticsId.PopMenu}>\n {triggerButton}\n {isOpen && renderChildren()}\n </div>\n );\n};\n\nexport default PopMenu;\n"],"names":["PopMenuVariant","PopMenuLabelPosition","PopMenu","props","triggerButtonRef","useRef","iconRef","popOverRef","outerRef","isOpen","setIsOpen","useState","children","popOverClassName","popMenuClassName","openButtonTestId","closeButtonTestId","popOverTestId","popMenuVariant","openButtonAriaLabel","closeButtonAriaLabel","svgIcon","labelText","labelTextPosition","buttonClasses","classNames","styles","mobile","useBreakpoint","breakpoints","useOutsideEvent","triggerButtonIsHovered","useHover","mobileIconSize","IconSize","handleClick","cb","renderChildren","isComponent","LinkList","React","PopOver","child","event","toggleOpenOnClick","e","iconComponent","LazyIcon","Icon","openIcon","VerticalDots","getColor","closeIcon","X","triggerButton","AnalyticsId"
|
|
1
|
+
{"version":3,"file":"PopMenu.js","sources":["../../../src/components/PopMenu/PopMenu.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { useOutsideEvent } from '../../hooks/useOutsideEvent';\nimport { getColor } from '../../theme/currys';\nimport { breakpoints } from '../../theme/grid';\nimport { isComponent } from '../../utils/component';\nimport Icon, { SvgIcon } from '../Icon';\nimport { IconName } from '../Icons/IconNames';\nimport VerticalDots from '../Icons/VerticalDots';\nimport X from '../Icons/X';\nimport LazyIcon from '../LazyIcon';\nimport LinkList, { LinkListProps, LinkProps } from '../LinkList';\nimport PopOver from '../PopOver';\n\nimport styles from './styles.module.scss';\n\nexport enum PopMenuVariant {\n onWhite = 'on-white',\n onGray = 'on-gray',\n onBlueberry = 'on-blueberry',\n}\n\nexport enum PopMenuLabelPosition {\n right = 'right',\n left = 'left',\n}\n\nexport interface PopMenuProps {\n /** Content shown inside PopOver. Can only be a LinkList */\n children: React.ReactElement<LinkListProps>;\n /** Adds custom classes to the popover element. */\n popOverClassName?: string;\n /** Adds custom classes to the element. */\n popMenuClassName?: string;\n /** Changes responsive design for the trigger buttons. */\n popMenuVariant?: PopMenuVariant;\n /** Sets the data-testid attribute for the button that opens. */\n openButtonTestId?: string;\n /** Sets the data-testid attribute for the button that closes. */\n closeButtonTestId?: string;\n /** Sets the data-testid attribute for the popover. */\n popOverTestId?: string;\n /** Sets the arial-label attribute for the openButton. */\n openButtonAriaLabel?: string;\n /** Sets the arial-label attribute for the closeButton. */\n closeButtonAriaLabel?: string;\n /** Sets the icon on the trigger button. */\n svgIcon?: SvgIcon | IconName;\n /** Optional text next to the trigger button. */\n labelText?: string;\n /** Placement of the label text relative to the trigger button. */\n labelTextPosition?: PopMenuLabelPosition;\n}\n\nexport const PopMenu: React.FC<PopMenuProps> = (props: PopMenuProps) => {\n const triggerButtonRef = useRef<HTMLButtonElement>(null);\n const iconRef = useRef<HTMLDivElement>(null);\n const popOverRef = useRef<HTMLDivElement>(null);\n const outerRef = useRef<HTMLDivElement>(null);\n const [isOpen, setIsOpen] = useState(false);\n const {\n children,\n popOverClassName,\n popMenuClassName,\n openButtonTestId,\n closeButtonTestId,\n popOverTestId,\n popMenuVariant = PopMenuVariant.onWhite,\n openButtonAriaLabel,\n closeButtonAriaLabel,\n svgIcon,\n labelText,\n labelTextPosition = PopMenuLabelPosition.right,\n } = props;\n const buttonClasses = classNames(styles['pop-menu-button'], {\n [styles[`pop-menu-button--${popMenuVariant}`]]: popMenuVariant,\n });\n const breakpoint = useBreakpoint();\n const mobile = breakpoint < breakpoints.md;\n\n useOutsideEvent(outerRef, () => {\n setIsOpen(false);\n });\n\n const { isHovered: triggerButtonIsHovered } = useHover(triggerButtonRef);\n const mobileIconSize = mobile ? IconSize.XSmall : IconSize.Small;\n\n const handleClick = (cb?: () => void): void => {\n setIsOpen(false);\n cb && cb();\n };\n\n const renderChildren = () => {\n if (isComponent<LinkListProps>(children, LinkList)) {\n return (\n <PopOver\n testId={popOverTestId}\n className={classNames(styles['pop-menu__pop-over'], popOverClassName)}\n arrowClassName={styles['pop-menu__pop-over-arrow']}\n controllerRef={iconRef}\n popOverRef={popOverRef}\n >\n {React.Children.map(children, child =>\n React.cloneElement(child, {\n children: React.Children.map(child.props.children, child =>\n isComponent<LinkProps>(child, LinkList.Link)\n ? React.cloneElement(child, {\n onClick: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) =>\n handleClick(() => child.props.onClick && child.props.onClick(event)),\n })\n : child\n ),\n })\n )}\n </PopOver>\n );\n }\n };\n\n const toggleOpenOnClick = (e?: React.MouseEvent<HTMLElement, MouseEvent>): void => {\n e && e.stopPropagation();\n setIsOpen(!isOpen);\n };\n\n const iconComponent =\n svgIcon && typeof svgIcon === 'string' ? (\n <LazyIcon iconName={svgIcon} size={IconSize.XSmall} isHovered={triggerButtonIsHovered} />\n ) : (\n svgIcon && <Icon svgIcon={svgIcon} size={IconSize.XSmall} isHovered={triggerButtonIsHovered} />\n );\n\n const openIcon = svgIcon ? (\n iconComponent\n ) : (\n <Icon svgIcon={svgIcon ?? VerticalDots} color={getColor('black')} size={mobileIconSize} isHovered={triggerButtonIsHovered} />\n );\n\n const closeIcon = <Icon svgIcon={X} color={getColor('black')} size={mobileIconSize} isHovered={triggerButtonIsHovered} />;\n\n const triggerButton = (\n <button\n ref={triggerButtonRef}\n data-testid={isOpen ? closeButtonTestId : openButtonTestId}\n className={buttonClasses}\n aria-label={isOpen ? closeButtonAriaLabel : openButtonAriaLabel}\n aria-expanded={isOpen}\n onClick={toggleOpenOnClick}\n type=\"button\"\n >\n {labelText && labelTextPosition == PopMenuLabelPosition.left && <span>{labelText}</span>}\n {<div ref={iconRef}>{isOpen ? closeIcon : openIcon}</div>}\n {labelText && labelTextPosition == PopMenuLabelPosition.right && <span>{labelText}</span>}\n </button>\n );\n\n return (\n <div ref={outerRef} className={classNames(styles['pop-menu-button'], popMenuClassName)} data-analyticsid={AnalyticsId.PopMenu}>\n {triggerButton}\n {isOpen && renderChildren()}\n </div>\n );\n};\n\nexport default PopMenu;\n"],"names":["PopMenuVariant","PopMenuLabelPosition","PopMenu","props","triggerButtonRef","useRef","iconRef","popOverRef","outerRef","isOpen","setIsOpen","useState","children","popOverClassName","popMenuClassName","openButtonTestId","closeButtonTestId","popOverTestId","popMenuVariant","openButtonAriaLabel","closeButtonAriaLabel","svgIcon","labelText","labelTextPosition","buttonClasses","classNames","styles","mobile","useBreakpoint","breakpoints","useOutsideEvent","triggerButtonIsHovered","useHover","mobileIconSize","IconSize","handleClick","cb","renderChildren","isComponent","LinkList","React","PopOver","child","event","toggleOpenOnClick","e","iconComponent","LazyIcon","Icon","openIcon","VerticalDots","getColor","closeIcon","X","triggerButton","AnalyticsId"],"mappings":";;;;;;;;;;;;;;;;AAqBY,IAAAA,sBAAAA,OACVA,EA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ACX,cAAYf,IAASW,IAAuBD;AAAA,MAC5C,iBAAeV;AAAA,MACf,SAASmC;AAAA,MACT,MAAK;AAAA,IAAA;AAAA,IAEJtB,KAAaC,KAAqB,UAA6BiB,gBAAAA,EAAA,cAAC,cAAMlB,CAAU;AAAA,oCAC/E,OAAI,EAAA,KAAKhB,KAAUG,IAAS2C,IAAYH,CAAS;AAAA,IAClD3B,KAAaC,KAAqB,WAA8BiB,gBAAAA,EAAA,cAAC,cAAMlB,CAAU;AAAA,EAAA;AAItF,yCACG,OAAI,EAAA,KAAKd,GAAU,WAAWiB,EAAWC,EAAO,iBAAiB,GAAGZ,CAAgB,GAAG,oBAAkByC,EAAY,WACnHD,GACA7C,KAAU4B,GACb;AAEJ;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import e from "./PopMenu.js";
|
|
2
|
-
import {
|
|
1
|
+
import { PopMenu as e } from "./PopMenu.js";
|
|
2
|
+
import { PopMenuLabelPosition as t, PopMenuVariant as a } from "./PopMenu.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
4
|
+
e as PopMenu,
|
|
5
5
|
t as PopMenuLabelPosition,
|
|
6
6
|
a as PopMenuVariant,
|
|
7
7
|
e as default
|
|
@@ -1,57 +1,56 @@
|
|
|
1
|
-
import r, { useRef as w, useState as
|
|
1
|
+
import r, { useRef as w, useState as h, useEffect as A } from "react";
|
|
2
2
|
import y from "classnames";
|
|
3
|
-
import { getVerticalPosition as
|
|
4
|
-
import { ZIndex as
|
|
5
|
-
import { useInterval as
|
|
3
|
+
import { getVerticalPosition as B, getBubbleStyle as F, getArrowStyle as L } from "./utils.js";
|
|
4
|
+
import { ZIndex as T, AnalyticsId as V } from "../../constants.js";
|
|
5
|
+
import { useInterval as Z } from "../../hooks/useInterval.js";
|
|
6
6
|
import { useIsVisible as j } from "../../hooks/useIsVisible.js";
|
|
7
7
|
import { useLayoutEvent as k } from "../../hooks/useLayoutEvent.js";
|
|
8
8
|
import { useSize as q } from "../../hooks/useSize.js";
|
|
9
9
|
import { mergeRefs as D } from "../../utils/refs.js";
|
|
10
10
|
import t from "../PopOver/styles.module.scss";
|
|
11
|
-
var G = /* @__PURE__ */ ((
|
|
12
|
-
const
|
|
11
|
+
var G = /* @__PURE__ */ ((e) => (e.positionautomatic = "positionautomatic", e.positionbelow = "positionbelow", e.positionabove = "positionabove", e))(G || {});
|
|
12
|
+
const H = r.forwardRef((e, S) => {
|
|
13
13
|
const {
|
|
14
|
-
id:
|
|
15
|
-
children:
|
|
14
|
+
id: _,
|
|
15
|
+
children: R,
|
|
16
16
|
controllerRef: n,
|
|
17
|
-
popOverRef:
|
|
17
|
+
popOverRef: g,
|
|
18
18
|
show: p = !1,
|
|
19
|
-
className:
|
|
19
|
+
className: z = "",
|
|
20
20
|
variant: c = "positionautomatic",
|
|
21
21
|
role: m,
|
|
22
|
-
testId:
|
|
23
|
-
arrowClassName:
|
|
24
|
-
zIndex: u =
|
|
25
|
-
} =
|
|
22
|
+
testId: C,
|
|
23
|
+
arrowClassName: I,
|
|
24
|
+
zIndex: u = T.PopOver
|
|
25
|
+
} = e, f = g || w(null), N = w(null), s = q(f), [o, E] = h(), v = j(n, 0), l = () => {
|
|
26
26
|
var d;
|
|
27
|
-
|
|
27
|
+
E((d = n.current) == null ? void 0 : d.getBoundingClientRect());
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
Z(l, 500), k(l, ["scroll", "resize"], 10), A(() => {
|
|
30
30
|
l();
|
|
31
31
|
}, []);
|
|
32
|
-
const b = m === "tooltip",
|
|
32
|
+
const b = m === "tooltip", O = y(t.popover, { [t["popover--visible"]]: b ? p : v }, z), i = o && s && B(o, s, c), P = y(t.popover__arrow, I, {
|
|
33
33
|
[t["popover__arrow--over"]]: i === "positionbelow",
|
|
34
34
|
[t["popover__arrow--under"]]: i === "positionabove",
|
|
35
35
|
[t["popover__arrow--visible"]]: b ? p : v
|
|
36
|
-
}), a =
|
|
36
|
+
}), a = o && s && F(o, s, c), x = a && o && i && L(a, o, i);
|
|
37
37
|
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
38
38
|
"div",
|
|
39
39
|
{
|
|
40
|
-
id:
|
|
41
|
-
ref: D([
|
|
42
|
-
className:
|
|
40
|
+
id: _,
|
|
41
|
+
ref: D([S, f]),
|
|
42
|
+
className: O,
|
|
43
43
|
style: { ...a, zIndex: u },
|
|
44
|
-
"data-testid":
|
|
45
|
-
"data-analyticsid":
|
|
44
|
+
"data-testid": C,
|
|
45
|
+
"data-analyticsid": V.PopOver,
|
|
46
46
|
role: m
|
|
47
47
|
},
|
|
48
|
-
|
|
49
|
-
), /* @__PURE__ */ r.createElement("div", { ref:
|
|
48
|
+
R
|
|
49
|
+
), /* @__PURE__ */ r.createElement("div", { ref: N, className: P, style: { ...x, zIndex: u } }));
|
|
50
50
|
});
|
|
51
|
-
|
|
52
|
-
const eo = S;
|
|
51
|
+
H.displayName = "PopOver";
|
|
53
52
|
export {
|
|
54
53
|
G as PopOverVariant,
|
|
55
|
-
|
|
54
|
+
H as default
|
|
56
55
|
};
|
|
57
56
|
//# sourceMappingURL=PopOver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopOver.js","sources":["../../../src/components/PopOver/PopOver.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { getArrowStyle, getBubbleStyle, getVerticalPosition } from './utils';\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { useInterval } from '../../hooks/useInterval';\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useLayoutEvent } from '../../hooks/useLayoutEvent';\nimport { useSize } from '../../hooks/useSize';\nimport { mergeRefs } from '../../utils/refs';\n\nimport styles from './styles.module.scss';\n\nexport enum PopOverVariant {\n positionautomatic = 'positionautomatic',\n positionbelow = 'positionbelow',\n positionabove = 'positionabove',\n}\n\nexport type PopOverRole = 'tooltip';\n\nexport interface PopOverProps {\n /** Id of the PopOver */\n id?: string;\n /** Content shown inside PopOver. Note that if role=\"tooltip\", you must not include interactive/focusable elements. */\n children: React.ReactNode;\n /** Ref for the element the PopOver is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Ref for the element the PopOver is placed upon */\n popOverRef?: React.RefObject<HTMLDivElement>;\n /** Show the popover. Only applies when role=tooltip. Default: false. */\n show?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds custom classes to the arrow element. */\n arrowClassName?: string;\n /** Determines the placement of the popover. Default: automatic positioning. */\n variant?: keyof typeof PopOverVariant;\n /** Sets role of the PopOver element */\n role?: PopOverRole;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Overrides the default z-index of PopOver */\n zIndex?: number;\n}\n\nconst PopOver = React.forwardRef<HTMLDivElement | SVGSVGElement, PopOverProps>((props, ref) => {\n const {\n id,\n children,\n controllerRef,\n popOverRef,\n show = false,\n className = '',\n variant = PopOverVariant.positionautomatic,\n role,\n testId,\n arrowClassName,\n zIndex = ZIndex.PopOver,\n } = props;\n\n const bubbleRef = popOverRef || useRef<HTMLDivElement>(null);\n const arrowRef = useRef<HTMLDivElement>(null);\n const bubbleSize = useSize(bubbleRef);\n const [controllerSize, setControllerSize] = useState<DOMRect>();\n const controllerisVisible = useIsVisible(controllerRef, 0);\n\n const updateControllerSize = (): void => {\n setControllerSize(controllerRef.current?.getBoundingClientRect());\n };\n\n useInterval(updateControllerSize, 500);\n useLayoutEvent(updateControllerSize, ['scroll', 'resize'], 10);\n\n useEffect(() => {\n updateControllerSize();\n }, []);\n\n const isTooltip = role === 'tooltip';\n\n const popOverClasses = classNames(styles.popover, { [styles['popover--visible']]: isTooltip ? show : controllerisVisible }, className);\n const verticalPosition = controllerSize && bubbleSize && getVerticalPosition(controllerSize, bubbleSize, variant);\n const arrowClasses = classNames(styles.popover__arrow, arrowClassName, {\n [styles['popover__arrow--over']]: verticalPosition === PopOverVariant.positionbelow,\n [styles['popover__arrow--under']]: verticalPosition === PopOverVariant.positionabove,\n [styles['popover__arrow--visible']]: isTooltip ? show : controllerisVisible,\n });\n\n const bubbleStyle = controllerSize && bubbleSize && getBubbleStyle(controllerSize, bubbleSize, variant);\n const arrowStyle = bubbleStyle && controllerSize && verticalPosition && getArrowStyle(bubbleStyle, controllerSize, verticalPosition);\n\n return (\n <>\n <div\n id={id}\n ref={mergeRefs([ref, bubbleRef])}\n className={popOverClasses}\n style={{ ...bubbleStyle, zIndex }}\n data-testid={testId}\n data-analyticsid={AnalyticsId.PopOver}\n role={role}\n >\n {children}\n </div>\n <div ref={arrowRef} className={arrowClasses} style={{ ...arrowStyle, zIndex }} />\n </>\n );\n});\n\nPopOver.displayName = 'PopOver';\n\nexport default PopOver;\n"],"names":["PopOverVariant","PopOver","React","props","ref","id","children","controllerRef","popOverRef","show","className","variant","role","testId","arrowClassName","zIndex","ZIndex","bubbleRef","useRef","arrowRef","bubbleSize","useSize","controllerSize","setControllerSize","useState","controllerisVisible","useIsVisible","updateControllerSize","_a","useInterval","useLayoutEvent","useEffect","isTooltip","popOverClasses","classNames","styles","verticalPosition","getVerticalPosition","arrowClasses","bubbleStyle","getBubbleStyle","arrowStyle","getArrowStyle","mergeRefs","AnalyticsId"
|
|
1
|
+
{"version":3,"file":"PopOver.js","sources":["../../../src/components/PopOver/PopOver.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { getArrowStyle, getBubbleStyle, getVerticalPosition } from './utils';\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { useInterval } from '../../hooks/useInterval';\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useLayoutEvent } from '../../hooks/useLayoutEvent';\nimport { useSize } from '../../hooks/useSize';\nimport { mergeRefs } from '../../utils/refs';\n\nimport styles from './styles.module.scss';\n\nexport enum PopOverVariant {\n positionautomatic = 'positionautomatic',\n positionbelow = 'positionbelow',\n positionabove = 'positionabove',\n}\n\nexport type PopOverRole = 'tooltip';\n\nexport interface PopOverProps {\n /** Id of the PopOver */\n id?: string;\n /** Content shown inside PopOver. Note that if role=\"tooltip\", you must not include interactive/focusable elements. */\n children: React.ReactNode;\n /** Ref for the element the PopOver is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Ref for the element the PopOver is placed upon */\n popOverRef?: React.RefObject<HTMLDivElement>;\n /** Show the popover. Only applies when role=tooltip. Default: false. */\n show?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds custom classes to the arrow element. */\n arrowClassName?: string;\n /** Determines the placement of the popover. Default: automatic positioning. */\n variant?: keyof typeof PopOverVariant;\n /** Sets role of the PopOver element */\n role?: PopOverRole;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Overrides the default z-index of PopOver */\n zIndex?: number;\n}\n\nconst PopOver = React.forwardRef<HTMLDivElement | SVGSVGElement, PopOverProps>((props, ref) => {\n const {\n id,\n children,\n controllerRef,\n popOverRef,\n show = false,\n className = '',\n variant = PopOverVariant.positionautomatic,\n role,\n testId,\n arrowClassName,\n zIndex = ZIndex.PopOver,\n } = props;\n\n const bubbleRef = popOverRef || useRef<HTMLDivElement>(null);\n const arrowRef = useRef<HTMLDivElement>(null);\n const bubbleSize = useSize(bubbleRef);\n const [controllerSize, setControllerSize] = useState<DOMRect>();\n const controllerisVisible = useIsVisible(controllerRef, 0);\n\n const updateControllerSize = (): void => {\n setControllerSize(controllerRef.current?.getBoundingClientRect());\n };\n\n useInterval(updateControllerSize, 500);\n useLayoutEvent(updateControllerSize, ['scroll', 'resize'], 10);\n\n useEffect(() => {\n updateControllerSize();\n }, []);\n\n const isTooltip = role === 'tooltip';\n\n const popOverClasses = classNames(styles.popover, { [styles['popover--visible']]: isTooltip ? show : controllerisVisible }, className);\n const verticalPosition = controllerSize && bubbleSize && getVerticalPosition(controllerSize, bubbleSize, variant);\n const arrowClasses = classNames(styles.popover__arrow, arrowClassName, {\n [styles['popover__arrow--over']]: verticalPosition === PopOverVariant.positionbelow,\n [styles['popover__arrow--under']]: verticalPosition === PopOverVariant.positionabove,\n [styles['popover__arrow--visible']]: isTooltip ? show : controllerisVisible,\n });\n\n const bubbleStyle = controllerSize && bubbleSize && getBubbleStyle(controllerSize, bubbleSize, variant);\n const arrowStyle = bubbleStyle && controllerSize && verticalPosition && getArrowStyle(bubbleStyle, controllerSize, verticalPosition);\n\n return (\n <>\n <div\n id={id}\n ref={mergeRefs([ref, bubbleRef])}\n className={popOverClasses}\n style={{ ...bubbleStyle, zIndex }}\n data-testid={testId}\n data-analyticsid={AnalyticsId.PopOver}\n role={role}\n >\n {children}\n </div>\n <div ref={arrowRef} className={arrowClasses} style={{ ...arrowStyle, zIndex }} />\n </>\n );\n});\n\nPopOver.displayName = 'PopOver';\n\nexport default PopOver;\n"],"names":["PopOverVariant","PopOver","React","props","ref","id","children","controllerRef","popOverRef","show","className","variant","role","testId","arrowClassName","zIndex","ZIndex","bubbleRef","useRef","arrowRef","bubbleSize","useSize","controllerSize","setControllerSize","useState","controllerisVisible","useIsVisible","updateControllerSize","_a","useInterval","useLayoutEvent","useEffect","isTooltip","popOverClasses","classNames","styles","verticalPosition","getVerticalPosition","arrowClasses","bubbleStyle","getBubbleStyle","arrowStyle","getArrowStyle","mergeRefs","AnalyticsId"],"mappings":";;;;;;;;;;AAcY,IAAAA,sBAAAA,OACVA,EAAA,oBAAoB,qBACpBA,EAAA,gBAAgB,iBAChBA,EAAA,gBAAgB,iBAHNA,IAAAA,KAAA,CAAA,CAAA;AAiCZ,MAAMC,IAAUC,EAAM,WAAyD,CAACC,GAAOC,MAAQ;AACvF,QAAA;AAAA,IACJ,IAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,WAAAC,IAAY;AAAA,IACZ,SAAAC,IAAU;AAAA,IACV,MAAAC;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC,IAASC,EAAO;A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EAAO;AAAA,MAChC,eAAaF;AAAA,MACb,oBAAkB+B,EAAY;AAAA,MAC9B,MAAAhC;AAAA,IAAA;AAAA,IAECN;AAAA,EAEH,GAAAJ,gBAAAA,EAAA,cAAC,OAAI,EAAA,KAAKiB,GAAU,WAAWmB,GAAc,OAAO,EAAE,GAAGG,GAAY,QAAA1B,KAAU,CACjF;AAEJ,CAAC;AAEDd,EAAQ,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Portal/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport { AnalyticsId } from '../../constants';\n\nexport interface PortalProps {\n /** Add custom class to portal, default class is portal-container */\n className?: string;\n /** Content to be displayed in Portal */\n children?: React.ReactNode;\n /** Default is document.body */\n parent?: HTMLElement;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport default function Portal({ children, parent, className, testId }: PortalProps): React.ReactPortal {\n // Create div to contain everything\n const el = React.useMemo(() => document.createElement('div'), []);\n el.setAttribute('data-analyticsid', AnalyticsId.Portal);\n if (testId) {\n el.setAttribute('data-testid', testId);\n }\n // On mount function\n React.useEffect(() => {\n // work out target in the DOM based on parent prop\n const target = parent && !!parent.appendChild ? parent : document.body;\n // Default classes\n const classList = ['portal-container'];\n // If className prop is present add each class the classList\n if (className) className.split(' ').forEach(item => classList.push(item));\n classList.forEach(item => el.classList.add(item));\n\n target.appendChild(el);\n // On unmount function\n return (): void => {\n // Remove element from dom\n target.removeChild(el);\n };\n }, [el, parent, className]);\n\n return createPortal(children, el);\n}\n"],"names":["Portal","children","parent","className","testId","el","React","AnalyticsId","target","classList","item","createPortal"],"mappings":";;;AAiBA,SAAwBA,EAAO,EAAE,UAAAC,GAAU,QAAAC,GAAQ,WAAAC,GAAW,QAAAC,KAA0C;AAEhG,QAAAC,IAAKC,EAAM,QAAQ,MAAM,SAAS,cAAc,KAAK,GAAG,CAAA,CAAE;AAC7D,SAAAD,EAAA,aAAa,oBAAoBE,EAAY,MAAM,GAClDH,KACCC,EAAA,aAAa,eAAeD,CAAM,GAGvCE,EAAM,UAAU,MAAM;AAEpB,UAAME,IAASN,KAAYA,EAAO,cAAcA,IAAS,SAAS,MAE5DO,IAAY,CAAC,kBAAkB;AAEjC,WAAAN,KAAqBA,EAAA,MAAM,GAAG,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Portal/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport { AnalyticsId } from '../../constants';\n\nexport interface PortalProps {\n /** Add custom class to portal, default class is portal-container */\n className?: string;\n /** Content to be displayed in Portal */\n children?: React.ReactNode;\n /** Default is document.body */\n parent?: HTMLElement;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport default function Portal({ children, parent, className, testId }: PortalProps): React.ReactPortal {\n // Create div to contain everything\n const el = React.useMemo(() => document.createElement('div'), []);\n el.setAttribute('data-analyticsid', AnalyticsId.Portal);\n if (testId) {\n el.setAttribute('data-testid', testId);\n }\n // On mount function\n React.useEffect(() => {\n // work out target in the DOM based on parent prop\n const target = parent && !!parent.appendChild ? parent : document.body;\n // Default classes\n const classList = ['portal-container'];\n // If className prop is present add each class the classList\n if (className) className.split(' ').forEach(item => classList.push(item));\n classList.forEach(item => el.classList.add(item));\n\n target.appendChild(el);\n // On unmount function\n return (): void => {\n // Remove element from dom\n target.removeChild(el);\n };\n }, [el, parent, className]);\n\n return createPortal(children, el);\n}\n"],"names":["Portal","children","parent","className","testId","el","React","AnalyticsId","target","classList","item","createPortal"],"mappings":";;;AAiBA,SAAwBA,EAAO,EAAE,UAAAC,GAAU,QAAAC,GAAQ,WAAAC,GAAW,QAAAC,KAA0C;AAEhG,QAAAC,IAAKC,EAAM,QAAQ,MAAM,SAAS,cAAc,KAAK,GAAG,CAAA,CAAE;AAC7D,SAAAD,EAAA,aAAa,oBAAoBE,EAAY,MAAM,GAClDH,KACCC,EAAA,aAAa,eAAeD,CAAM,GAGvCE,EAAM,UAAU,MAAM;AAEpB,UAAME,IAASN,KAAYA,EAAO,cAAcA,IAAS,SAAS,MAE5DO,IAAY,CAAC,kBAAkB;AAEjC,WAAAN,KAAqBA,EAAA,MAAM,GAAG,EAAE,QAAQ,CAAQO,MAAAD,EAAU,KAAKC,CAAI,CAAC,GACxED,EAAU,QAAQ,CAAQC,MAAAL,EAAG,UAAU,IAAIK,CAAI,CAAC,GAEhDF,EAAO,YAAYH,CAAE,GAEd,MAAY;AAEjB,MAAAG,EAAO,YAAYH,CAAE;AAAA,IAAA;AAAA,EAEtB,GAAA,CAACA,GAAIH,GAAQC,CAAS,CAAC,GAEnBQ,EAAaV,GAAUI,CAAE;AAClC;"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import a, { useRef as _, useEffect as v } from "react";
|
|
2
|
-
import
|
|
3
|
-
import { ZIndex as
|
|
2
|
+
import N from "classnames";
|
|
3
|
+
import { ZIndex as $ } from "../../constants.js";
|
|
4
4
|
import { palette as o } from "../../theme/palette.js";
|
|
5
5
|
import s from "../Progressbar/styles.module.scss";
|
|
6
6
|
var B = /* @__PURE__ */ ((e) => (e.small = "small", e.medium = "medium", e.large = "large", e))(B || {}), C = /* @__PURE__ */ ((e) => (e.ondark = "ondark", e.onlight = "onlight", e))(C || {}), R = /* @__PURE__ */ ((e) => (e.screen = "screen", e.parent = "parent", e))(R || {});
|
|
7
|
-
const
|
|
7
|
+
const W = ({
|
|
8
8
|
value: e,
|
|
9
|
-
size:
|
|
10
|
-
mode:
|
|
9
|
+
size: i = "large",
|
|
10
|
+
mode: c = "onlight",
|
|
11
11
|
overlay: t,
|
|
12
12
|
testId: b,
|
|
13
13
|
ariaLabel: w
|
|
14
14
|
}) => {
|
|
15
|
-
t && (
|
|
15
|
+
t && (c = "ondark"), e = Math.max(0, Math.min(e, 100));
|
|
16
16
|
let n;
|
|
17
|
-
|
|
18
|
-
const m = n / 2, p = 8, f = m - p / 2, l = m * 2, r = m, k =
|
|
17
|
+
i === "large" ? n = 96 : i === "medium" ? n = 50 : n = 44;
|
|
18
|
+
const m = n / 2, p = 8, f = m - p / 2, l = m * 2, r = m, k = c === "onlight" ? o.blueberry100 : o.neutral700, h = c === "onlight" ? o.blueberry600 : o.white, g = 2 * Math.PI * f, y = g - e / 100 * g, d = _(null);
|
|
19
19
|
v(() => {
|
|
20
20
|
var u, x;
|
|
21
21
|
t === "parent" && ((x = (u = d.current) == null ? void 0 : u.parentElement) != null && x.style) && (d.current.parentElement.style.position = "relative");
|
|
22
22
|
}, []);
|
|
23
|
-
const E =
|
|
23
|
+
const E = N({
|
|
24
24
|
[s["progressbar--overlay"]]: t,
|
|
25
25
|
[s["progressbar--overlay-screen"]]: t === "screen",
|
|
26
26
|
[s["progressbar--overlay-parent"]]: t === "parent"
|
|
@@ -36,7 +36,7 @@ const I = ({
|
|
|
36
36
|
"aria-valuenow": e,
|
|
37
37
|
"aria-label": w,
|
|
38
38
|
"aria-live": "polite",
|
|
39
|
-
style: t === "screen" ? { zIndex:
|
|
39
|
+
style: t === "screen" ? { zIndex: $.OverlayScreen } : {}
|
|
40
40
|
},
|
|
41
41
|
/* @__PURE__ */ a.createElement(
|
|
42
42
|
"svg",
|
|
@@ -75,15 +75,15 @@ const I = ({
|
|
|
75
75
|
textAnchor: "middle",
|
|
76
76
|
alignmentBaseline: "middle"
|
|
77
77
|
},
|
|
78
|
-
|
|
78
|
+
i == "large" && `${e}%`
|
|
79
79
|
)
|
|
80
80
|
)
|
|
81
81
|
);
|
|
82
|
-
}
|
|
82
|
+
};
|
|
83
83
|
export {
|
|
84
84
|
R as Overlay,
|
|
85
85
|
C as ProgressBarMode,
|
|
86
86
|
B as ProgressbarSize,
|
|
87
|
-
|
|
87
|
+
W as default
|
|
88
88
|
};
|
|
89
89
|
//# sourceMappingURL=Progressbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progressbar.js","sources":["../../../src/components/Progressbar/Progressbar.tsx"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\n\nimport classNames from 'classnames';\n\nimport { ZIndex } from '../../constants';\nimport { palette } from '../../theme/palette';\n\nimport styles from './styles.module.scss';\n\nexport enum ProgressbarSize {\n small = 'small',\n medium = 'medium',\n large = 'large',\n}\n\nexport enum ProgressBarMode {\n ondark = 'ondark',\n onlight = 'onlight',\n}\n\nexport enum Overlay {\n screen = 'screen',\n parent = 'parent',\n}\nexport interface ProgressbarProps {\n /** The value of the progressbar given in percent. Value between 0 and 100 */\n value: number;\n /** Size of the progressbar. Default is large */\n size?: ProgressbarSize;\n /** Changes the visuals of the ProgressBar. Default is onLight */\n mode?: ProgressBarMode;\n /** Loader is displayed with grey background covering the entire screen */\n overlay?: keyof typeof Overlay;\n /** Aria label for the progressbar */\n ariaLabel?: string;\n /** Sets the data-testid attribute */\n testId?: string;\n}\n\nconst Progressbar: React.FC<ProgressbarProps> = ({\n value,\n size = ProgressbarSize.large,\n mode = ProgressBarMode.onlight,\n overlay,\n testId,\n ariaLabel,\n}: ProgressbarProps) => {\n if (overlay) {\n mode = ProgressBarMode.ondark;\n }\n // Restrict value to be between 0 and 100\n value = Math.max(0, Math.min(value, 100));\n\n let width;\n if (size === ProgressbarSize.large) {\n width = 96;\n } else if (size === ProgressbarSize.medium) {\n width = 50;\n } else {\n width = 44;\n }\n\n const totalRadius = width / 2;\n const strokeWidth = 8;\n const radius = totalRadius - strokeWidth / 2;\n const viewBoxSize = totalRadius * 2;\n const viewBoxCenter = totalRadius;\n const circleBackgroundColor = mode === ProgressBarMode.onlight ? palette.blueberry100 : palette.neutral700;\n const mainColor = mode === ProgressBarMode.onlight ? palette.blueberry600 : palette.white;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (value / 100) * circumference;\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (overlay === Overlay.parent && wrapperRef.current?.parentElement?.style) {\n wrapperRef.current.parentElement.style.position = 'relative';\n }\n }, []);\n\n const wrapperClasses = classNames({\n [styles['progressbar--overlay']]: overlay,\n [styles['progressbar--overlay-screen']]: overlay === Overlay.screen,\n [styles['progressbar--overlay-parent']]: overlay === Overlay.parent,\n });\n\n return (\n <div\n ref={wrapperRef}\n className={wrapperClasses}\n data-testid={testId}\n role=\"progressbar\"\n aria-valuenow={value}\n aria-label={ariaLabel}\n aria-live=\"polite\"\n style={overlay === Overlay.screen ? { zIndex: ZIndex.OverlayScreen } : {}}\n >\n <svg\n role=\"presentation\"\n width={viewBoxSize}\n height={viewBoxSize}\n viewBox={`0 0 ${viewBoxSize} ${viewBoxSize}`}\n className={styles['progressbar__svg']}\n >\n <circle cx={viewBoxCenter} cy={viewBoxCenter} r={radius} stroke={circleBackgroundColor} strokeWidth={strokeWidth} fill=\"none\" />\n <circle\n cx={viewBoxCenter}\n cy={viewBoxCenter}\n r={radius}\n stroke={mainColor}\n strokeWidth={strokeWidth}\n fill=\"none\"\n strokeDasharray={circumference}\n strokeDashoffset={strokeDashoffset}\n className={styles['progressbar__progress-circle']}\n transform={`rotate(-90 ${viewBoxCenter} ${viewBoxCenter})`}\n />{' '}\n <text\n className=\"progress-wheel__text--large\"\n fontSize={'1.5rem'}\n fill={mainColor}\n x={viewBoxCenter}\n y={viewBoxCenter}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n >\n {size == ProgressbarSize.large && `${value}%`}\n </text>\n </svg>\n </div>\n );\n};\n\nexport default Progressbar;\n"],"names":["ProgressbarSize","ProgressBarMode","Overlay","Progressbar","value","size","mode","overlay","testId","ariaLabel","width","totalRadius","strokeWidth","radius","viewBoxSize","viewBoxCenter","circleBackgroundColor","palette","mainColor","circumference","strokeDashoffset","wrapperRef","useRef","useEffect","_b","_a","wrapperClasses","classNames","styles","React","ZIndex"
|
|
1
|
+
{"version":3,"file":"Progressbar.js","sources":["../../../src/components/Progressbar/Progressbar.tsx"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\n\nimport classNames from 'classnames';\n\nimport { ZIndex } from '../../constants';\nimport { palette } from '../../theme/palette';\n\nimport styles from './styles.module.scss';\n\nexport enum ProgressbarSize {\n small = 'small',\n medium = 'medium',\n large = 'large',\n}\n\nexport enum ProgressBarMode {\n ondark = 'ondark',\n onlight = 'onlight',\n}\n\nexport enum Overlay {\n screen = 'screen',\n parent = 'parent',\n}\nexport interface ProgressbarProps {\n /** The value of the progressbar given in percent. Value between 0 and 100 */\n value: number;\n /** Size of the progressbar. Default is large */\n size?: ProgressbarSize;\n /** Changes the visuals of the ProgressBar. Default is onLight */\n mode?: ProgressBarMode;\n /** Loader is displayed with grey background covering the entire screen */\n overlay?: keyof typeof Overlay;\n /** Aria label for the progressbar */\n ariaLabel?: string;\n /** Sets the data-testid attribute */\n testId?: string;\n}\n\nconst Progressbar: React.FC<ProgressbarProps> = ({\n value,\n size = ProgressbarSize.large,\n mode = ProgressBarMode.onlight,\n overlay,\n testId,\n ariaLabel,\n}: ProgressbarProps) => {\n if (overlay) {\n mode = ProgressBarMode.ondark;\n }\n // Restrict value to be between 0 and 100\n value = Math.max(0, Math.min(value, 100));\n\n let width;\n if (size === ProgressbarSize.large) {\n width = 96;\n } else if (size === ProgressbarSize.medium) {\n width = 50;\n } else {\n width = 44;\n }\n\n const totalRadius = width / 2;\n const strokeWidth = 8;\n const radius = totalRadius - strokeWidth / 2;\n const viewBoxSize = totalRadius * 2;\n const viewBoxCenter = totalRadius;\n const circleBackgroundColor = mode === ProgressBarMode.onlight ? palette.blueberry100 : palette.neutral700;\n const mainColor = mode === ProgressBarMode.onlight ? palette.blueberry600 : palette.white;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (value / 100) * circumference;\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (overlay === Overlay.parent && wrapperRef.current?.parentElement?.style) {\n wrapperRef.current.parentElement.style.position = 'relative';\n }\n }, []);\n\n const wrapperClasses = classNames({\n [styles['progressbar--overlay']]: overlay,\n [styles['progressbar--overlay-screen']]: overlay === Overlay.screen,\n [styles['progressbar--overlay-parent']]: overlay === Overlay.parent,\n });\n\n return (\n <div\n ref={wrapperRef}\n className={wrapperClasses}\n data-testid={testId}\n role=\"progressbar\"\n aria-valuenow={value}\n aria-label={ariaLabel}\n aria-live=\"polite\"\n style={overlay === Overlay.screen ? { zIndex: ZIndex.OverlayScreen } : {}}\n >\n <svg\n role=\"presentation\"\n width={viewBoxSize}\n height={viewBoxSize}\n viewBox={`0 0 ${viewBoxSize} ${viewBoxSize}`}\n className={styles['progressbar__svg']}\n >\n <circle cx={viewBoxCenter} cy={viewBoxCenter} r={radius} stroke={circleBackgroundColor} strokeWidth={strokeWidth} fill=\"none\" />\n <circle\n cx={viewBoxCenter}\n cy={viewBoxCenter}\n r={radius}\n stroke={mainColor}\n strokeWidth={strokeWidth}\n fill=\"none\"\n strokeDasharray={circumference}\n strokeDashoffset={strokeDashoffset}\n className={styles['progressbar__progress-circle']}\n transform={`rotate(-90 ${viewBoxCenter} ${viewBoxCenter})`}\n />{' '}\n <text\n className=\"progress-wheel__text--large\"\n fontSize={'1.5rem'}\n fill={mainColor}\n x={viewBoxCenter}\n y={viewBoxCenter}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n >\n {size == ProgressbarSize.large && `${value}%`}\n </text>\n </svg>\n </div>\n );\n};\n\nexport default Progressbar;\n"],"names":["ProgressbarSize","ProgressBarMode","Overlay","Progressbar","value","size","mode","overlay","testId","ariaLabel","width","totalRadius","strokeWidth","radius","viewBoxSize","viewBoxCenter","circleBackgroundColor","palette","mainColor","circumference","strokeDashoffset","wrapperRef","useRef","useEffect","_b","_a","wrapperClasses","classNames","styles","React","ZIndex"],"mappings":";;;;;AASY,IAAAA,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,QAAQ,SAHEA,IAAAA,KAAA,CAAA,CAAA,GAMAC,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,UAAU,WAFAA,IAA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