@dnanpm/styleguide 3.1.0 → 3.2.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/README.md +86 -86
- package/build/cjs/assets/{bundle-8de31ca3.css → bundle-f9dcdcfa.css} +129 -129
- package/build/cjs/components/Accordion/Accordion.d.ts +2 -1
- package/build/cjs/components/Accordion/Accordion.js +4 -4
- package/build/cjs/components/AccordionItem/AccordionItem.d.ts +4 -3
- package/build/cjs/components/AccordionItem/AccordionItem.js +2 -2
- package/build/cjs/components/Box/Box.d.ts +2 -1
- package/build/cjs/components/Box/Box.js +1 -1
- package/build/cjs/components/Button/Button.d.ts +4 -3
- package/build/cjs/components/Button/ButtonArrow.d.ts +2 -1
- package/build/cjs/components/Button/ButtonArrow.js +1 -3
- package/build/cjs/components/Checkbox/Checkbox.js +1 -1
- package/build/cjs/components/Chip/Chip.d.ts +3 -2
- package/build/cjs/components/DateTimePicker/DateTimePicker.d.ts +102 -0
- package/build/cjs/components/DateTimePicker/DateTimePicker.js +282 -0
- package/build/cjs/components/Divider/Divider.d.ts +2 -1
- package/build/cjs/components/DnaLogo/DnaLogo.d.ts +2 -1
- package/build/cjs/components/Drawer/Drawer.d.ts +2 -1
- package/build/cjs/components/EmptyState/EmptyState.d.ts +2 -1
- package/build/cjs/components/Floater/Floater.d.ts +2 -1
- package/build/cjs/components/Footer/Components/FooterComponents.d.ts +2 -67
- package/build/cjs/components/Footer/Components/FooterComponents.js +17 -67
- package/build/cjs/components/Footer/Footer.d.ts +4 -13
- package/build/cjs/components/Footer/Footer.js +2 -5
- package/build/cjs/components/Footer/context/FooterContext.d.ts +5 -4
- package/build/cjs/components/Footer/context/FooterContext.js +1 -5
- package/build/cjs/components/Icon/Icon.d.ts +3 -2
- package/build/cjs/components/Icons/hlLink.d.ts +4 -0
- package/build/cjs/components/Icons/hlLink.js +19 -0
- package/build/cjs/components/Icons/index.d.ts +1 -0
- package/build/cjs/components/Icons/index.js +2 -0
- package/build/cjs/components/Input/Input.d.ts +28 -11
- package/build/cjs/components/Input/Input.js +56 -29
- package/build/cjs/components/Label/Label.d.ts +2 -1
- package/build/cjs/components/LabelText/LabelText.d.ts +2 -1
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/BusinessMenu.d.ts +6 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +70 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/DesktopMenu.d.ts +3 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +207 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LanguageSelector.d.ts +4 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LanguageSelector.js +40 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LinkModifier.d.ts +10 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LinkModifier.js +44 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LoginTooltip.d.ts +7 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LoginTooltip.js +24 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +193 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +120 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +169 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +68 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.d.ts +7 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.js +27 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MobileMenu.d.ts +3 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +196 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/PageSearch.d.ts +6 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/PageSearch.js +24 -0
- package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +36 -0
- package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.js +322 -0
- package/build/cjs/components/MainHeaderNavigation/context/MobileMenuContext.d.ts +6 -0
- package/build/cjs/components/MainHeaderNavigation/context/MobileMenuContext.js +11 -0
- package/build/cjs/components/MainHeaderNavigation/context/NavContext.d.ts +29 -0
- package/build/cjs/components/MainHeaderNavigation/context/NavContext.js +56 -0
- package/build/cjs/components/MainHeaderNavigation/globalNavStyles.d.ts +1482 -0
- package/build/cjs/components/MainHeaderNavigation/globalNavStyles.js +189 -0
- package/build/cjs/components/MainNavigation/ChildComponents/DesktopMenu.d.ts +2 -2
- package/build/cjs/components/MainNavigation/ChildComponents/DesktopMenu.js +33 -33
- package/build/cjs/components/MainNavigation/ChildComponents/HeaderNavigationElements.d.ts +2 -2
- package/build/cjs/components/MainNavigation/ChildComponents/HeaderNavigationElements.js +1 -1
- package/build/cjs/components/MainNavigation/ChildComponents/LanguageSelector.d.ts +1 -1
- package/build/cjs/components/MainNavigation/ChildComponents/LanguageSelector.js +11 -14
- package/build/cjs/components/MainNavigation/ChildComponents/LinkModifier.d.ts +1 -1
- package/build/cjs/components/MainNavigation/ChildComponents/LinkModifier.js +9 -9
- package/build/cjs/components/MainNavigation/ChildComponents/LoginTooltip.js +3 -5
- package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenu.d.ts +5 -4
- package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenu.js +10 -10
- package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +4 -2
- package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +2 -2
- package/build/cjs/components/MainNavigation/ChildComponents/MinicartTooltip.js +4 -6
- package/build/cjs/components/MainNavigation/ChildComponents/MobileMenu.d.ts +1 -1
- package/build/cjs/components/MainNavigation/ChildComponents/MobileMenu.js +21 -17
- package/build/cjs/components/MainNavigation/ChildComponents/PageSearch.js +3 -5
- package/build/cjs/components/MainNavigation/ChildComponents/Ribbon.d.ts +2 -2
- package/build/cjs/components/MainNavigation/MainNavigation.d.ts +5 -5
- package/build/cjs/components/MainNavigation/MainNavigation.js +100 -74
- package/build/cjs/components/MainNavigation/context/MobileMenuContext.d.ts +3 -3
- package/build/cjs/components/MainNavigation/context/MobileMenuContext.js +1 -5
- package/build/cjs/components/MainNavigation/context/NavContext.d.ts +14 -15
- package/build/cjs/components/MainNavigation/context/NavContext.js +6 -5
- package/build/cjs/components/MainNavigation/globalNavStyles.d.ts +4 -4
- package/build/cjs/components/Modal/Modal.d.ts +2 -1
- package/build/cjs/components/Notification/Notification.d.ts +3 -2
- package/build/cjs/components/NotificationBadge/NotificationBadge.d.ts +2 -1
- package/build/cjs/components/Pill/Pill.d.ts +3 -2
- package/build/cjs/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
- package/build/cjs/components/RadioButton/RadioButton.d.ts +2 -1
- package/build/cjs/components/ReadMore/ReadMore.d.ts +4 -4
- package/build/cjs/components/Search/Search.d.ts +7 -6
- package/build/cjs/components/Search/Search.js +1 -1
- package/build/cjs/components/SecondaryNavigation/SecondaryNavigation.d.ts +19 -2
- package/build/cjs/components/SecondaryNavigation/SecondaryNavigation.js +23 -29
- package/build/cjs/components/Selectbox/Selectbox.js +2 -2
- package/build/cjs/components/Selectbox/__tests__/Selectbox.spec.d.ts +1 -0
- package/build/cjs/components/Tabs/Tab.d.ts +5 -3
- package/build/cjs/components/Tabs/Tab.js +1 -1
- package/build/cjs/components/Tabs/Tabs.d.ts +18 -19
- package/build/cjs/components/Tabs/Tabs.js +3 -3
- package/build/cjs/components/Textarea/Textarea.d.ts +6 -5
- package/build/cjs/components/Toaster/Toaster.d.ts +3 -2
- package/build/cjs/components/Tooltip/Tooltip.d.ts +2 -1
- package/build/cjs/components/Tooltip/Tooltip.js +1 -1
- package/build/cjs/components/TooltipMenu/ChildComponents/TooltipMenuExportedStyles.d.ts +2 -2
- package/build/cjs/components/TooltipMenu/TooltipMenu.d.ts +2 -1
- package/build/cjs/components/index.d.ts +3 -1
- package/build/cjs/hooks/useCloseOutsideOrElementClicked.js +3 -2
- package/build/cjs/hooks/useDebounce.d.ts +2 -0
- package/build/cjs/hooks/useDebounce.js +23 -0
- package/build/cjs/hooks/useDocHeight.d.ts +2 -1
- package/build/cjs/hooks/useDocHeight.js +5 -25
- package/build/cjs/hooks/useResizeObserver.d.ts +6 -0
- package/build/cjs/hooks/{useElementDimensions.js → useResizeObserver.js} +5 -5
- package/build/cjs/hooks/useScrollPosition.d.ts +2 -3
- package/build/cjs/hooks/useScrollPosition.js +8 -14
- package/build/cjs/index.js +6 -0
- package/build/cjs/themes/globalStyles.d.ts +3 -3
- package/build/cjs/themes/styled.d.ts +7 -7
- package/build/cjs/themes/theme.d.ts +1 -1
- package/build/cjs/themes/themeComponents/navigation.d.ts +7 -0
- package/build/cjs/themes/themeComponents/navigation.js +13 -1
- package/build/cjs/utils/common.d.ts +2 -1
- package/build/cjs/utils/common.js +1 -1
- package/build/cjs/utils/createStyled.d.ts +163 -2
- package/build/cjs/utils/createStyled.js +2 -2
- package/build/cjs/utils/styledUtils.d.ts +1 -1
- package/build/es/assets/{bundle-8de31ca3.css → bundle-f9dcdcfa.css} +129 -129
- package/build/es/components/Accordion/Accordion.d.ts +2 -1
- package/build/es/components/Accordion/Accordion.js +5 -5
- package/build/es/components/AccordionItem/AccordionItem.d.ts +4 -3
- package/build/es/components/AccordionItem/AccordionItem.js +1 -1
- package/build/es/components/Box/Box.d.ts +2 -1
- package/build/es/components/Box/Box.js +1 -1
- package/build/es/components/Button/Button.d.ts +4 -3
- package/build/es/components/Button/ButtonArrow.d.ts +2 -1
- package/build/es/components/Button/ButtonArrow.js +2 -4
- package/build/es/components/Checkbox/Checkbox.js +1 -1
- package/build/es/components/Chip/Chip.d.ts +3 -2
- package/build/es/components/DateTimePicker/DateTimePicker.d.ts +102 -0
- package/build/es/components/DateTimePicker/DateTimePicker.js +272 -0
- package/build/es/components/Divider/Divider.d.ts +2 -1
- package/build/es/components/DnaLogo/DnaLogo.d.ts +2 -1
- package/build/es/components/Drawer/Drawer.d.ts +2 -1
- package/build/es/components/EmptyState/EmptyState.d.ts +2 -1
- package/build/es/components/Floater/Floater.d.ts +2 -1
- package/build/es/components/Footer/Components/FooterComponents.d.ts +2 -67
- package/build/es/components/Footer/Components/FooterComponents.js +18 -68
- package/build/es/components/Footer/Footer.d.ts +4 -13
- package/build/es/components/Footer/Footer.js +3 -6
- package/build/es/components/Footer/context/FooterContext.d.ts +5 -4
- package/build/es/components/Footer/context/FooterContext.js +2 -2
- package/build/es/components/Icon/Icon.d.ts +3 -2
- package/build/es/components/Icons/hlLink.d.ts +4 -0
- package/build/es/components/Icons/hlLink.js +11 -0
- package/build/es/components/Icons/index.d.ts +1 -0
- package/build/es/components/Icons/index.js +1 -0
- package/build/es/components/Input/Input.d.ts +28 -11
- package/build/es/components/Input/Input.js +56 -29
- package/build/es/components/Label/Label.d.ts +2 -1
- package/build/es/components/LabelText/LabelText.d.ts +2 -1
- package/build/es/components/MainHeaderNavigation/ChildComponents/BusinessMenu.d.ts +6 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +62 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/DesktopMenu.d.ts +3 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +199 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/LanguageSelector.d.ts +4 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/LanguageSelector.js +32 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/LinkModifier.d.ts +10 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/LinkModifier.js +35 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/LoginTooltip.d.ts +7 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/LoginTooltip.js +16 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +193 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +111 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +169 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +63 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.d.ts +7 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.js +19 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/MobileMenu.d.ts +3 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +188 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/PageSearch.d.ts +6 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/PageSearch.js +16 -0
- package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +36 -0
- package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.js +314 -0
- package/build/es/components/MainHeaderNavigation/context/MobileMenuContext.d.ts +6 -0
- package/build/es/components/MainHeaderNavigation/context/MobileMenuContext.js +7 -0
- package/build/es/components/MainHeaderNavigation/context/NavContext.d.ts +29 -0
- package/build/es/components/MainHeaderNavigation/context/NavContext.js +52 -0
- package/build/es/components/MainHeaderNavigation/globalNavStyles.d.ts +1482 -0
- package/build/es/components/MainHeaderNavigation/globalNavStyles.js +177 -0
- package/build/es/components/MainNavigation/ChildComponents/DesktopMenu.d.ts +2 -2
- package/build/es/components/MainNavigation/ChildComponents/DesktopMenu.js +33 -33
- package/build/es/components/MainNavigation/ChildComponents/HeaderNavigationElements.d.ts +2 -2
- package/build/es/components/MainNavigation/ChildComponents/HeaderNavigationElements.js +1 -1
- package/build/es/components/MainNavigation/ChildComponents/LanguageSelector.d.ts +1 -1
- package/build/es/components/MainNavigation/ChildComponents/LanguageSelector.js +12 -15
- package/build/es/components/MainNavigation/ChildComponents/LinkModifier.d.ts +1 -1
- package/build/es/components/MainNavigation/ChildComponents/LinkModifier.js +9 -9
- package/build/es/components/MainNavigation/ChildComponents/LoginTooltip.js +4 -6
- package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenu.d.ts +5 -4
- package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenu.js +11 -11
- package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +4 -2
- package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +2 -3
- package/build/es/components/MainNavigation/ChildComponents/MinicartTooltip.js +5 -7
- package/build/es/components/MainNavigation/ChildComponents/MobileMenu.d.ts +1 -1
- package/build/es/components/MainNavigation/ChildComponents/MobileMenu.js +22 -18
- package/build/es/components/MainNavigation/ChildComponents/PageSearch.js +4 -6
- package/build/es/components/MainNavigation/ChildComponents/Ribbon.d.ts +2 -2
- package/build/es/components/MainNavigation/MainNavigation.d.ts +5 -5
- package/build/es/components/MainNavigation/MainNavigation.js +101 -75
- package/build/es/components/MainNavigation/context/MobileMenuContext.d.ts +3 -3
- package/build/es/components/MainNavigation/context/MobileMenuContext.js +2 -2
- package/build/es/components/MainNavigation/context/NavContext.d.ts +14 -15
- package/build/es/components/MainNavigation/context/NavContext.js +7 -2
- package/build/es/components/MainNavigation/globalNavStyles.d.ts +4 -4
- package/build/es/components/Modal/Modal.d.ts +2 -1
- package/build/es/components/Notification/Notification.d.ts +3 -2
- package/build/es/components/NotificationBadge/NotificationBadge.d.ts +2 -1
- package/build/es/components/Pill/Pill.d.ts +3 -2
- package/build/es/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
- package/build/es/components/RadioButton/RadioButton.d.ts +2 -1
- package/build/es/components/ReadMore/ReadMore.d.ts +4 -4
- package/build/es/components/Search/Search.d.ts +7 -6
- package/build/es/components/Search/Search.js +2 -2
- package/build/es/components/SecondaryNavigation/SecondaryNavigation.d.ts +19 -2
- package/build/es/components/SecondaryNavigation/SecondaryNavigation.js +23 -29
- package/build/es/components/Selectbox/Selectbox.js +2 -2
- package/build/es/components/Selectbox/__tests__/Selectbox.spec.d.ts +1 -0
- package/build/es/components/Tabs/Tab.d.ts +5 -3
- package/build/es/components/Tabs/Tab.js +2 -2
- package/build/es/components/Tabs/Tabs.d.ts +18 -19
- package/build/es/components/Tabs/Tabs.js +4 -4
- package/build/es/components/Textarea/Textarea.d.ts +6 -5
- package/build/es/components/Toaster/Toaster.d.ts +3 -2
- package/build/es/components/Tooltip/Tooltip.d.ts +2 -1
- package/build/es/components/Tooltip/Tooltip.js +1 -1
- package/build/es/components/TooltipMenu/ChildComponents/TooltipMenuExportedStyles.d.ts +2 -2
- package/build/es/components/TooltipMenu/TooltipMenu.d.ts +2 -1
- package/build/es/components/index.d.ts +3 -1
- package/build/es/hooks/useCloseOutsideOrElementClicked.js +3 -2
- package/build/es/hooks/useDebounce.d.ts +2 -0
- package/build/es/hooks/useDebounce.js +19 -0
- package/build/es/hooks/useDocHeight.d.ts +2 -1
- package/build/es/hooks/useDocHeight.js +6 -6
- package/build/es/hooks/useResizeObserver.d.ts +6 -0
- package/build/es/hooks/{useElementDimensions.js → useResizeObserver.js} +5 -5
- package/build/es/hooks/useScrollPosition.d.ts +2 -3
- package/build/es/hooks/useScrollPosition.js +9 -11
- package/build/es/index.js +3 -0
- package/build/es/themes/globalStyles.d.ts +3 -3
- package/build/es/themes/styled.d.ts +7 -7
- package/build/es/themes/theme.d.ts +1 -1
- package/build/es/themes/themeComponents/navigation.d.ts +7 -0
- package/build/es/themes/themeComponents/navigation.js +9 -2
- package/build/es/utils/common.d.ts +2 -1
- package/build/es/utils/common.js +1 -1
- package/build/es/utils/createStyled.d.ts +163 -2
- package/build/es/utils/createStyled.js +2 -2
- package/build/es/utils/styledUtils.d.ts +1 -1
- package/package.json +22 -11
- package/build/cjs/hooks/modifyBodyClass.d.ts +0 -1
- package/build/cjs/hooks/modifyBodyClass.js +0 -20
- package/build/cjs/hooks/useDebounceFunc.d.ts +0 -1
- package/build/cjs/hooks/useDebounceFunc.js +0 -39
- package/build/cjs/hooks/useElementDimensions.d.ts +0 -5
- package/build/es/hooks/modifyBodyClass.d.ts +0 -1
- package/build/es/hooks/modifyBodyClass.js +0 -16
- package/build/es/hooks/useDebounceFunc.d.ts +0 -1
- package/build/es/hooks/useDebounceFunc.js +0 -15
- package/build/es/hooks/useElementDimensions.d.ts +0 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ChangeEvent } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
interface Props {
|
|
3
4
|
/**
|
|
@@ -21,7 +22,7 @@ interface Props {
|
|
|
21
22
|
/**
|
|
22
23
|
* On radio button change callback
|
|
23
24
|
*/
|
|
24
|
-
onChange?: (e:
|
|
25
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
25
26
|
/**
|
|
26
27
|
* Allows to set the radio button as checked
|
|
27
28
|
*
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FunctionComponent, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
interface ReadMoreProps {
|
|
3
3
|
/** The label for show more link */
|
|
4
4
|
showMoreText?: string;
|
|
5
5
|
/** The label for show less link */
|
|
6
6
|
showLessText?: string;
|
|
7
7
|
/** Text content for component */
|
|
8
|
-
children:
|
|
8
|
+
children: ReactNode;
|
|
9
9
|
/** Allows to pass a custom className */
|
|
10
10
|
className?: string;
|
|
11
11
|
/** Allows to pass custom onClick */
|
|
12
|
-
onClick?: (event:
|
|
12
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
13
13
|
/** Init in expanded state and immediately close on client for better SEO */
|
|
14
14
|
seoInitExpanded?: boolean;
|
|
15
15
|
}
|
|
16
16
|
/** @visibleName Read More */
|
|
17
|
-
declare const ReadMore:
|
|
17
|
+
declare const ReadMore: FunctionComponent<ReadMoreProps>;
|
|
18
18
|
export default ReadMore;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ChangeEvent, FocusEvent, KeyboardEvent, MouseEvent } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
interface Props {
|
|
3
4
|
/**
|
|
@@ -19,27 +20,27 @@ interface Props {
|
|
|
19
20
|
/**
|
|
20
21
|
* On search input change callback
|
|
21
22
|
*/
|
|
22
|
-
onChange?: (e:
|
|
23
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
23
24
|
/**
|
|
24
25
|
* On search input blur callback
|
|
25
26
|
*/
|
|
26
|
-
onBlur?: (e:
|
|
27
|
+
onBlur?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
27
28
|
/**
|
|
28
29
|
* On search input focus callback
|
|
29
30
|
*/
|
|
30
|
-
onFocus?: (e:
|
|
31
|
+
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
31
32
|
/**
|
|
32
33
|
* On search input key press callback
|
|
33
34
|
*/
|
|
34
|
-
onKeyPress?: (e:
|
|
35
|
+
onKeyPress?: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
35
36
|
/**
|
|
36
37
|
* On search input key down callback
|
|
37
38
|
*/
|
|
38
|
-
onKeyDown?: (e:
|
|
39
|
+
onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
39
40
|
/**
|
|
40
41
|
* On button click callback
|
|
41
42
|
*/
|
|
42
|
-
onButtonClick?: (e:
|
|
43
|
+
onButtonClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
43
44
|
/**
|
|
44
45
|
* Allow to set search input element focus on page load
|
|
45
46
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
|
-
import React__default from 'react';
|
|
2
|
+
import React__default, { useRef } from 'react';
|
|
3
3
|
import styled from '../../themes/styled.js';
|
|
4
4
|
import theme from '../../themes/theme.js';
|
|
5
5
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
@@ -55,7 +55,7 @@ const Button = styled(ButtonIcon) `
|
|
|
55
55
|
const Search = (_a) => {
|
|
56
56
|
var _b;
|
|
57
57
|
var { 'data-testid': dataTestId } = _a, props = __rest(_a, ['data-testid']);
|
|
58
|
-
const inputRef =
|
|
58
|
+
const inputRef = useRef(null);
|
|
59
59
|
const handleButtonClick = (e) => {
|
|
60
60
|
if (inputRef && inputRef.current) {
|
|
61
61
|
inputRef.current.focus();
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
3
|
+
import type { LangProps } from '../../types/language';
|
|
4
|
+
interface MenuItem {
|
|
5
|
+
id: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
target?: string;
|
|
8
|
+
titles: LangProps;
|
|
9
|
+
urls: LangProps;
|
|
10
|
+
}
|
|
2
11
|
interface SNDataProps {
|
|
3
12
|
name?: string;
|
|
4
13
|
categoryId?: string;
|
|
5
|
-
pages?:
|
|
14
|
+
pages?: MenuItem[] | null;
|
|
15
|
+
}
|
|
16
|
+
interface NextJSSecondaryNavLinkProps {
|
|
17
|
+
linkUrl: string;
|
|
18
|
+
linkTitle: string;
|
|
19
|
+
iconName: string;
|
|
20
|
+
showNotification: boolean;
|
|
21
|
+
collapseSize: number;
|
|
22
|
+
children?: ReactNode;
|
|
6
23
|
}
|
|
7
24
|
interface Props {
|
|
8
25
|
/**
|
|
@@ -21,7 +38,7 @@ interface Props {
|
|
|
21
38
|
/**
|
|
22
39
|
* pass nextJS component for enabling nextJS routing
|
|
23
40
|
*/
|
|
24
|
-
nextJSSecondaryNavLink?:
|
|
41
|
+
nextJSSecondaryNavLink?: ComponentType<NextJSSecondaryNavLinkProps>;
|
|
25
42
|
/**
|
|
26
43
|
* width in pixels where navigation collapses to a dropdown
|
|
27
44
|
*
|
|
@@ -132,10 +132,9 @@ const IconWrapper = styled.span `
|
|
|
132
132
|
background-color: ${theme.color.default.pink};
|
|
133
133
|
}
|
|
134
134
|
`;
|
|
135
|
-
const isMenuItemLinkAbsolute = (menuItemLink) => menuItemLink.includes('http');
|
|
136
135
|
/** @visibleName Secondary Navigation */
|
|
137
|
-
const SecondaryNavigation = ({ currentUrl = '', data, lang = 'fi', nextJSSecondaryNavLink: NextJSSecondaryNavLink
|
|
138
|
-
var _a;
|
|
136
|
+
const SecondaryNavigation = ({ currentUrl = '', data, lang = 'fi', nextJSSecondaryNavLink: NextJSSecondaryNavLink, collapseSize = 767, 'data-testid': dataTestId, 'max-width': componentMaxWidth, className, matchFullUrl = true, mobileOnly = false, highlightIds = [], whiteBg = false, }) => {
|
|
137
|
+
var _a, _b, _c, _d;
|
|
139
138
|
const [isSecondaryNavOpen, setIsSecondaryNavOpen] = useState(false);
|
|
140
139
|
const toggleNav = () => {
|
|
141
140
|
setIsSecondaryNavOpen(!isSecondaryNavOpen);
|
|
@@ -151,39 +150,34 @@ const SecondaryNavigation = ({ currentUrl = '', data, lang = 'fi', nextJSSeconda
|
|
|
151
150
|
setIsSecondaryNavOpen(false);
|
|
152
151
|
}
|
|
153
152
|
});
|
|
154
|
-
const selectedElement = data.pages
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const shouldHighlightSelectedElement = selectedElement && highlightIds.some((el) => el === selectedElement.id);
|
|
153
|
+
const selectedElement = (_a = data.pages) === null || _a === void 0 ? void 0 : _a.find(listElement => currentUrl === listElement.urls[lang]);
|
|
154
|
+
const shouldHighlightSelectedElement = (_b = (selectedElement && highlightIds.some(el => el === selectedElement.id))) !== null && _b !== void 0 ? _b : false;
|
|
155
|
+
const checkIsMenuItemLinkAbsolute = (menuItemLink) => menuItemLink.includes('http');
|
|
158
156
|
return (React__default.createElement(SecondaryNavigationWrapper, { ref: ref, collapseSize: collapseSize, "data-testid": dataTestId, className: className, mobileOnly: mobileOnly, whiteBg: whiteBg },
|
|
159
157
|
selectedElement && (React__default.createElement(MobileSelector, { onClick: toggleNav, collapseSize: collapseSize, "data-testid": "secondary-navigation-dropdown-selector" },
|
|
160
158
|
React__default.createElement(MobileSelectorTitleWrapper, null,
|
|
161
|
-
(
|
|
159
|
+
(selectedElement === null || selectedElement === void 0 ? void 0 : selectedElement.icon) && (React__default.createElement(IconWrapper, { showNotification: shouldHighlightSelectedElement, collapseSize: collapseSize },
|
|
162
160
|
React__default.createElement(Icon, { name: selectedElement.icon }))),
|
|
163
161
|
React__default.createElement("span", null, selectedElement.titles[lang])),
|
|
164
162
|
React__default.createElement(MobileSelectorArrow, { isOpen: isSecondaryNavOpen },
|
|
165
163
|
React__default.createElement(Icon, { icon: hlChevronDown })))),
|
|
166
|
-
React__default.createElement(SecondaryNavigationList, { id: data.name || `secondary-navigation-category-${data.categoryId}`, isOpen: isSecondaryNavOpen, collapseSize: collapseSize, componentMaxWidth: componentMaxWidth, "data-testid": "secondary-nav-menu-ul" }, data.pages
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
isActive && (React__default.createElement(MobileSelectorCheck, { collapseSize: collapseSize },
|
|
184
|
-
React__default.createElement(Icon, { icon: HlCheck })))))));
|
|
185
|
-
})
|
|
186
|
-
: null)));
|
|
164
|
+
React__default.createElement(SecondaryNavigationList, { id: data.name || `secondary-navigation-category-${(_c = data.categoryId) !== null && _c !== void 0 ? _c : ''}`, isOpen: isSecondaryNavOpen, collapseSize: collapseSize, componentMaxWidth: componentMaxWidth, "data-testid": "secondary-nav-menu-ul" }, (_d = data.pages) === null || _d === void 0 ? void 0 : _d.map((listElement, index) => {
|
|
165
|
+
const linkUrl = listElement.urls[lang];
|
|
166
|
+
const linkTitle = listElement.titles[lang];
|
|
167
|
+
const iconName = listElement.icon || '';
|
|
168
|
+
const isActive = matchFullUrl
|
|
169
|
+
? currentUrl === linkUrl
|
|
170
|
+
: currentUrl.indexOf(linkUrl) > -1;
|
|
171
|
+
const showNotification = highlightIds.some(el => el === listElement.id);
|
|
172
|
+
const isMenuItemLinkAbsolute = checkIsMenuItemLinkAbsolute(linkUrl);
|
|
173
|
+
return (React__default.createElement(SecondaryNavigationListElement, { key: listElement.id, isActive: isActive, onClick: closeNav, collapseSize: collapseSize }, NextJSSecondaryNavLink && !isMenuItemLinkAbsolute ? (React__default.createElement(NextJSSecondaryNavLink, { linkUrl: linkUrl, linkTitle: linkTitle, iconName: iconName, showNotification: showNotification, collapseSize: collapseSize, "data-testid": `secondary-nav-item-link-${index + 1}` }, isActive && (React__default.createElement(MobileSelectorCheck, { collapseSize: collapseSize },
|
|
174
|
+
React__default.createElement(Icon, { icon: HlCheck }))))) : (React__default.createElement("a", { href: linkUrl, "data-testid": `secondary-nav-item-link-${index + 1}` },
|
|
175
|
+
iconName && (React__default.createElement(IconWrapper, { showNotification: showNotification, collapseSize: collapseSize },
|
|
176
|
+
React__default.createElement(Icon, { name: iconName }))),
|
|
177
|
+
React__default.createElement("span", null, linkTitle),
|
|
178
|
+
isActive && (React__default.createElement(MobileSelectorCheck, { collapseSize: collapseSize },
|
|
179
|
+
React__default.createElement(Icon, { icon: HlCheck })))))));
|
|
180
|
+
}))));
|
|
187
181
|
};
|
|
188
182
|
|
|
189
183
|
export { SecondaryNavigation as default };
|
|
@@ -27,9 +27,9 @@ const ErrorMessage = styled.div `
|
|
|
27
27
|
`;
|
|
28
28
|
const customTheme = Object.assign(Object.assign({}, defaultTheme), { borderRadius: 0, colors: Object.assign(Object.assign({}, defaultTheme.colors), { primary50: theme.color.background.sand.E02, primary25: theme.color.background.sand.E01, primary: theme.color.background.sand.E02 }) });
|
|
29
29
|
const getStyles = () => ({
|
|
30
|
-
control: (_styles, state) => (Object.assign(Object.assign({ position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: `0 ${getMultipliedSize(theme.base.baseWidth, 1)}`, width: '100%',
|
|
30
|
+
control: (_styles, state) => (Object.assign(Object.assign({ position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: `0 ${getMultipliedSize(theme.base.baseWidth, 1)}`, width: '100%', minHeight: getMultipliedSize(theme.base.baseHeight, 4), backgroundColor: state.isDisabled
|
|
31
31
|
? theme.color.background.sand.E01
|
|
32
|
-
: theme.color.background.white.default, borderRadius: theme.radius.s, border: `1px solid ${theme.color.line.L01}
|
|
32
|
+
: theme.color.background.white.default, borderRadius: theme.radius.s, border: `1px solid ${theme.color.line.L01}`, overflow: 'auto' }, (state.selectProps.errorState && {
|
|
33
33
|
borderBottom: `4px solid ${theme.color.notification.error}`,
|
|
34
34
|
})), (!state.menuIsOpen && {
|
|
35
35
|
':focus-within': {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import React, { PureComponent } from 'react';
|
|
2
3
|
import type { Type } from './Tabs';
|
|
3
4
|
export interface TabProps {
|
|
4
5
|
activeTab?: string;
|
|
5
6
|
label: string;
|
|
6
7
|
tabStyle?: Type;
|
|
7
8
|
onClick?: (tab: string) => void;
|
|
9
|
+
children?: ReactNode;
|
|
8
10
|
}
|
|
9
11
|
export interface TabStyleProps {
|
|
10
12
|
isActive?: boolean;
|
|
@@ -164,7 +166,7 @@ export declare const TabStyle: import("styled-components").StyledComponent<"li",
|
|
|
164
166
|
h1: string;
|
|
165
167
|
h2: string;
|
|
166
168
|
};
|
|
167
|
-
media: Record<string | number, (l: TemplateStringsArray, ...p:
|
|
169
|
+
media: Record<string | number, (l: TemplateStringsArray, ...p: (string | number)[]) => string>;
|
|
168
170
|
radius: {
|
|
169
171
|
default: string;
|
|
170
172
|
s: string;
|
|
@@ -173,7 +175,7 @@ export declare const TabStyle: import("styled-components").StyledComponent<"li",
|
|
|
173
175
|
pill: string;
|
|
174
176
|
};
|
|
175
177
|
}, TabStyleProps, never>;
|
|
176
|
-
declare class Tab extends
|
|
178
|
+
declare class Tab extends PureComponent<TabProps> {
|
|
177
179
|
onClick: () => void;
|
|
178
180
|
render(): React.JSX.Element;
|
|
179
181
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
1
|
+
import React__default, { PureComponent } from 'react';
|
|
2
2
|
import styled from '../../themes/styled.js';
|
|
3
3
|
import theme from '../../themes/theme.js';
|
|
4
4
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
@@ -39,7 +39,7 @@ const TabStyle = styled.li `
|
|
|
39
39
|
background-color: transparent;
|
|
40
40
|
`}
|
|
41
41
|
`;
|
|
42
|
-
class Tab extends
|
|
42
|
+
class Tab extends PureComponent {
|
|
43
43
|
constructor() {
|
|
44
44
|
super(...arguments);
|
|
45
45
|
this.onClick = () => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
export type Type = 'gray' | 'underlined';
|
|
3
4
|
interface TabsProps {
|
|
@@ -17,7 +18,7 @@ interface TabsProps {
|
|
|
17
18
|
/**
|
|
18
19
|
* The actual content
|
|
19
20
|
*/
|
|
20
|
-
children:
|
|
21
|
+
children: ReactNode;
|
|
21
22
|
/**
|
|
22
23
|
* Handles when tab is switched/changed
|
|
23
24
|
*/
|
|
@@ -39,9 +40,7 @@ export declare const Tablist: import("styled-components").StyledComponent<"ul",
|
|
|
39
40
|
value: number;
|
|
40
41
|
unit: string;
|
|
41
42
|
};
|
|
42
|
-
};
|
|
43
|
-
* The actual content
|
|
44
|
-
*/
|
|
43
|
+
};
|
|
45
44
|
breakpoints: import("../../themes/themeComponents/breakpoints").ViewBreakpoints;
|
|
46
45
|
color: {
|
|
47
46
|
default: {
|
|
@@ -53,9 +52,7 @@ export declare const Tablist: import("styled-components").StyledComponent<"ul",
|
|
|
53
52
|
accent: {
|
|
54
53
|
lemon: string;
|
|
55
54
|
sky: string;
|
|
56
|
-
orange: string;
|
|
57
|
-
* Allows to pass a custom className
|
|
58
|
-
*/
|
|
55
|
+
orange: string;
|
|
59
56
|
};
|
|
60
57
|
hover: {
|
|
61
58
|
pink: string;
|
|
@@ -77,13 +74,15 @@ export declare const Tablist: import("styled-components").StyledComponent<"ul",
|
|
|
77
74
|
info: string;
|
|
78
75
|
success: string;
|
|
79
76
|
warning: string;
|
|
80
|
-
error: string;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
error: string;
|
|
78
|
+
}; /**
|
|
79
|
+
* The actual content
|
|
80
|
+
*/
|
|
84
81
|
background: {
|
|
85
82
|
sand: {
|
|
86
|
-
default: string;
|
|
83
|
+
default: string; /**
|
|
84
|
+
* Handles when tab is switched/changed
|
|
85
|
+
*/
|
|
87
86
|
E01: string;
|
|
88
87
|
E02: string;
|
|
89
88
|
};
|
|
@@ -162,9 +161,7 @@ export declare const Tablist: import("styled-components").StyledComponent<"ul",
|
|
|
162
161
|
medium: number;
|
|
163
162
|
bold: number;
|
|
164
163
|
black: number;
|
|
165
|
-
};
|
|
166
|
-
* Handles when tab is switched/changed
|
|
167
|
-
*/
|
|
164
|
+
};
|
|
168
165
|
form: {
|
|
169
166
|
smallSelectWidth: string;
|
|
170
167
|
smallSelectHeight: string;
|
|
@@ -183,6 +180,11 @@ export declare const Tablist: import("styled-components").StyledComponent<"ul",
|
|
|
183
180
|
h1L: string;
|
|
184
181
|
h1M: string;
|
|
185
182
|
h1S: string; /**
|
|
183
|
+
* Allows to pass a custom className
|
|
184
|
+
*/
|
|
185
|
+
h2M: string;
|
|
186
|
+
h2S: string;
|
|
187
|
+
h3: string; /**
|
|
186
188
|
* Style of the tabs
|
|
187
189
|
*
|
|
188
190
|
* @param {Type} gray Default
|
|
@@ -190,15 +192,12 @@ export declare const Tablist: import("styled-components").StyledComponent<"ul",
|
|
|
190
192
|
* @default 'gray'
|
|
191
193
|
* @deprecated Underlined is provided only as legacy style
|
|
192
194
|
*/
|
|
193
|
-
h2M: string;
|
|
194
|
-
h2S: string;
|
|
195
|
-
h3: string;
|
|
196
195
|
h4: string;
|
|
197
196
|
h5: string;
|
|
198
197
|
h1: string;
|
|
199
198
|
h2: string;
|
|
200
199
|
};
|
|
201
|
-
media: Record<string | number, (l: TemplateStringsArray, ...p:
|
|
200
|
+
media: Record<string | number, (l: TemplateStringsArray, ...p: (string | number)[]) => string>;
|
|
202
201
|
radius: {
|
|
203
202
|
default: string;
|
|
204
203
|
s: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
1
|
+
import React__default, { useState, Children, isValidElement } from 'react';
|
|
2
2
|
import styled from '../../themes/styled.js';
|
|
3
3
|
import theme from '../../themes/theme.js';
|
|
4
4
|
import Tab from './Tab.js';
|
|
@@ -14,9 +14,9 @@ const TabContent = styled.div `
|
|
|
14
14
|
`;
|
|
15
15
|
/** @visibleName Tabs */
|
|
16
16
|
const Tabs = ({ children, className, tabStyle = 'gray', onChange, defaultTab }) => {
|
|
17
|
-
const [activeTab, setActiveTab] =
|
|
18
|
-
const tabs =
|
|
19
|
-
if (
|
|
17
|
+
const [activeTab, setActiveTab] = useState(defaultTab);
|
|
18
|
+
const tabs = Children.map(children, child => {
|
|
19
|
+
if (isValidElement(child) && child.type === Tab) {
|
|
20
20
|
return child;
|
|
21
21
|
}
|
|
22
22
|
return null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ChangeEvent, FocusEvent, KeyboardEvent } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
interface Props {
|
|
3
4
|
/**
|
|
@@ -27,23 +28,23 @@ interface Props {
|
|
|
27
28
|
/**
|
|
28
29
|
* On input change callback
|
|
29
30
|
*/
|
|
30
|
-
onChange?: (val: string, e:
|
|
31
|
+
onChange?: (val: string, e: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
31
32
|
/**
|
|
32
33
|
* On input blur callback
|
|
33
34
|
*/
|
|
34
|
-
onBlur?: (val: string, e:
|
|
35
|
+
onBlur?: (val: string, e: FocusEvent<HTMLTextAreaElement>) => void;
|
|
35
36
|
/**
|
|
36
37
|
* On input focus callback
|
|
37
38
|
*/
|
|
38
|
-
onFocus?: (e:
|
|
39
|
+
onFocus?: (e: FocusEvent<HTMLTextAreaElement>) => void;
|
|
39
40
|
/**
|
|
40
41
|
* On input key press callback
|
|
41
42
|
*/
|
|
42
|
-
onKeyPress?: (e:
|
|
43
|
+
onKeyPress?: (e: KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
43
44
|
/**
|
|
44
45
|
* On input key down callback
|
|
45
46
|
*/
|
|
46
|
-
onKeyDown?: (e:
|
|
47
|
+
onKeyDown?: (e: KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
47
48
|
/**
|
|
48
49
|
* Allows to disable the component functionality
|
|
49
50
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
type ToasterType = 'info' | 'success' | 'warning' | 'error';
|
|
3
4
|
interface Props {
|
|
@@ -15,7 +16,7 @@ interface Props {
|
|
|
15
16
|
/**
|
|
16
17
|
* Content of the toaster
|
|
17
18
|
*/
|
|
18
|
-
children?:
|
|
19
|
+
children?: ReactNode;
|
|
19
20
|
/**
|
|
20
21
|
* Allows to pass a custom className
|
|
21
22
|
*/
|
|
@@ -37,7 +38,7 @@ interface Props {
|
|
|
37
38
|
/**
|
|
38
39
|
* On close button click callback
|
|
39
40
|
*/
|
|
40
|
-
onClickCloseButton?: (e:
|
|
41
|
+
onClickCloseButton?: (e: MouseEvent<HTMLElement>) => void;
|
|
41
42
|
}
|
|
42
43
|
declare const Toaster: ({ type, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element | null;
|
|
43
44
|
/** @component */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { ITooltip as ReactTooltipProps } from 'react-tooltip';
|
|
3
4
|
type Position = 'left' | 'right' | 'middle';
|
|
@@ -20,7 +21,7 @@ interface Props {
|
|
|
20
21
|
/**
|
|
21
22
|
* Content of the component
|
|
22
23
|
*/
|
|
23
|
-
children?:
|
|
24
|
+
children?: ReactNode;
|
|
24
25
|
/**
|
|
25
26
|
* Allows to set position of Tooltip icon relative to other content and adds appropriate margins
|
|
26
27
|
*
|
|
@@ -3,7 +3,7 @@ import React__default from 'react';
|
|
|
3
3
|
import { Tooltip as Tooltip$1 } from 'react-tooltip';
|
|
4
4
|
import styled from '../../themes/styled.js';
|
|
5
5
|
import theme from '../../themes/theme.js';
|
|
6
|
-
import
|
|
6
|
+
import getElevationShadow from '../../utils/common.js';
|
|
7
7
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
8
8
|
import Icon from '../Icon/Icon.js';
|
|
9
9
|
import hlInfo from '../Icons/hlInfo.js';
|
|
@@ -152,7 +152,7 @@ export declare const Tail: import("styled-components").StyledComponent<"div", {
|
|
|
152
152
|
h1: string;
|
|
153
153
|
h2: string;
|
|
154
154
|
};
|
|
155
|
-
media: Record<string | number, (l: TemplateStringsArray, ...p:
|
|
155
|
+
media: Record<string | number, (l: TemplateStringsArray, ...p: (string | number)[]) => string>;
|
|
156
156
|
radius: {
|
|
157
157
|
default: string;
|
|
158
158
|
s: string;
|
|
@@ -319,7 +319,7 @@ export declare const TailShadow: import("styled-components").StyledComponent<"di
|
|
|
319
319
|
h1: string;
|
|
320
320
|
h2: string;
|
|
321
321
|
};
|
|
322
|
-
media: Record<string | number, (l: TemplateStringsArray, ...p:
|
|
322
|
+
media: Record<string | number, (l: TemplateStringsArray, ...p: (string | number)[]) => string>;
|
|
323
323
|
radius: {
|
|
324
324
|
default: string;
|
|
325
325
|
s: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { Props as IconProps } from '../Icon/Icon';
|
|
3
4
|
export interface TooltipMenuProps {
|
|
@@ -6,7 +7,7 @@ export interface TooltipMenuProps {
|
|
|
6
7
|
/** Allows to pass a custom className */
|
|
7
8
|
className?: string;
|
|
8
9
|
/** Tooltip menu content */
|
|
9
|
-
children:
|
|
10
|
+
children: ReactNode;
|
|
10
11
|
/** Text selector color.Default: #121212 */
|
|
11
12
|
color?: string;
|
|
12
13
|
/** Text selector active color. Default: #121212 */
|
|
@@ -11,6 +11,7 @@ export { default as ButtonRound } from './Button/ButtonRound';
|
|
|
11
11
|
export { default as ButtonSecondary } from './Button/ButtonSecondary';
|
|
12
12
|
export { default as Checkbox } from './Checkbox/Checkbox';
|
|
13
13
|
export { default as Chip } from './Chip/Chip';
|
|
14
|
+
export { default as DateTimePicker } from './DateTimePicker/DateTimePicker';
|
|
14
15
|
export { default as Divider } from './Divider/Divider';
|
|
15
16
|
export { default as DnaLogo } from './DnaLogo/DnaLogo';
|
|
16
17
|
export { default as Drawer } from './Drawer/Drawer';
|
|
@@ -22,6 +23,7 @@ export * from './Icons';
|
|
|
22
23
|
export { default as Input } from './Input/Input';
|
|
23
24
|
export { default as Label } from './Label/Label';
|
|
24
25
|
export { default as LabelText } from './LabelText/LabelText';
|
|
26
|
+
export { default as MainHeaderNavigation } from './MainHeaderNavigation/MainHeaderNavigation';
|
|
25
27
|
export { default as MainNavigation } from './MainNavigation/MainNavigation';
|
|
26
28
|
export { default as Modal } from './Modal/Modal';
|
|
27
29
|
export { default as Notification } from './Notification/Notification';
|
|
@@ -36,7 +38,7 @@ export { default as SecondaryNavigation } from './SecondaryNavigation/SecondaryN
|
|
|
36
38
|
export { default as Selectbox } from './Selectbox/Selectbox';
|
|
37
39
|
export { default as Switch } from './Switch/Switch';
|
|
38
40
|
export { default as Tab, TabStyle } from './Tabs/Tab';
|
|
39
|
-
export {
|
|
41
|
+
export { default as Tabs, Tablist } from './Tabs/Tabs';
|
|
40
42
|
export { default as Textarea } from './Textarea/Textarea';
|
|
41
43
|
export { default as Toaster } from './Toaster/Toaster';
|
|
42
44
|
export { default as Tooltip } from './Tooltip/Tooltip';
|
|
@@ -12,10 +12,11 @@ const useCloseOutsideOrElementClicked = ({ ref, closeWhenTagClicked }, callback)
|
|
|
12
12
|
const target = e.target;
|
|
13
13
|
const parent = target.parentNode;
|
|
14
14
|
const isElementInList = closeWhenTagClicked.some(tag => {
|
|
15
|
+
var _a, _b, _c;
|
|
15
16
|
if (!target.parentNode) {
|
|
16
|
-
return tag === target.tagName.toLowerCase();
|
|
17
|
+
return tag === ((_a = target.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
17
18
|
}
|
|
18
|
-
return tag === target.tagName.toLowerCase() || tag === parent.tagName.toLowerCase();
|
|
19
|
+
return tag === ((_b = target.tagName) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || tag === ((_c = parent.tagName) === null || _c === void 0 ? void 0 : _c.toLowerCase());
|
|
19
20
|
});
|
|
20
21
|
if ((ref.current && !ref.current.contains(target)) ||
|
|
21
22
|
(isElementInList && !target.dataset.noClose)) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useRef, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_DELAY = 400;
|
|
4
|
+
const useDebounce = (
|
|
5
|
+
// TODO: Eventually define generic type for function arguments if needed
|
|
6
|
+
// callback: <T extends (...args: Parameters<T>) => void>(...args: T[]) => void,
|
|
7
|
+
callback, delay = DEFAULT_DELAY) => {
|
|
8
|
+
const debounce = useRef();
|
|
9
|
+
return useCallback(() => {
|
|
10
|
+
if (debounce.current) {
|
|
11
|
+
clearTimeout(debounce.current);
|
|
12
|
+
}
|
|
13
|
+
debounce.current = setTimeout(() => {
|
|
14
|
+
callback();
|
|
15
|
+
}, delay);
|
|
16
|
+
}, [callback, delay]);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { useDebounce as default };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const useDocHeight: () => void;
|
|
2
|
+
export default useDocHeight;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
|
+
import useDebounce from './useDebounce.js';
|
|
3
3
|
|
|
4
4
|
const DEBOUNCE_DELAY = 100;
|
|
5
5
|
const useDocHeight = () => {
|
|
6
|
-
const setDocHeight =
|
|
6
|
+
const setDocHeight = useCallback(() => {
|
|
7
7
|
document.documentElement.style.setProperty('--vh100', `${window.innerHeight}px`);
|
|
8
8
|
}, []);
|
|
9
|
-
const debounceSetDocHeight =
|
|
10
|
-
|
|
9
|
+
const debounceSetDocHeight = useDebounce(setDocHeight, DEBOUNCE_DELAY);
|
|
10
|
+
useEffect(() => {
|
|
11
11
|
setDocHeight();
|
|
12
12
|
window.addEventListener('resize', debounceSetDocHeight);
|
|
13
13
|
window.addEventListener('orientationchange', debounceSetDocHeight);
|
|
@@ -18,4 +18,4 @@ const useDocHeight = () => {
|
|
|
18
18
|
}, [debounceSetDocHeight, setDocHeight]);
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export { useDocHeight };
|
|
21
|
+
export { useDocHeight as default };
|
|
@@ -4,21 +4,21 @@ import { useState, useRef, useCallback, useEffect } from 'react';
|
|
|
4
4
|
* Hook to get element dimensions when layout changes
|
|
5
5
|
*/
|
|
6
6
|
const ResizeObserver = typeof window !== 'undefined' && window.ResizeObserver;
|
|
7
|
-
|
|
7
|
+
const useResizeObserver = () => {
|
|
8
8
|
const [size, setSize] = useState({ width: 0, height: 0 });
|
|
9
9
|
const resizeObserver = useRef(null);
|
|
10
10
|
const onResize = useCallback(entries => {
|
|
11
11
|
const { width, height } = entries[0].contentRect;
|
|
12
12
|
setSize({ width, height });
|
|
13
13
|
}, []);
|
|
14
|
-
const ref = useCallback(
|
|
15
|
-
if (
|
|
14
|
+
const ref = useCallback(instance => {
|
|
15
|
+
if (instance !== null && ResizeObserver) {
|
|
16
16
|
if (resizeObserver.current) {
|
|
17
17
|
resizeObserver.current.disconnect();
|
|
18
18
|
}
|
|
19
19
|
resizeObserver.current = new ResizeObserver(onResize);
|
|
20
20
|
if (resizeObserver.current) {
|
|
21
|
-
resizeObserver.current.observe(
|
|
21
|
+
resizeObserver.current.observe(instance);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}, [onResize]);
|
|
@@ -28,6 +28,6 @@ function useResizeObserver() {
|
|
|
28
28
|
}
|
|
29
29
|
}, []);
|
|
30
30
|
return { ref, width: size.width, height: size.height };
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
32
|
|
|
33
33
|
export { useResizeObserver as default };
|