@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
package/README.md
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
# DNA Styleguide
|
|
2
|
-
|
|
3
|
-
Styles and styled components for DNA.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
1. Run install command in repository where styleguide should be added
|
|
8
|
-
- Example
|
|
9
|
-
```shell
|
|
10
|
-
npm install @dnanpm/styleguide
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage example
|
|
14
|
-
|
|
15
|
-
### Theme
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
import { createStyled, theme as defaultTheme } from '@dnanpm/styleguide';
|
|
19
|
-
|
|
20
|
-
const color = {
|
|
21
|
-
...defaultTheme.color,
|
|
22
|
-
background: '#000000',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const iconSize = {
|
|
26
|
-
default: '0.75em',
|
|
27
|
-
defaultMobile: '2em',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const theme = {
|
|
31
|
-
...defaultTheme,
|
|
32
|
-
colors,
|
|
33
|
-
iconSize,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type ThemeInterface = typeof theme;
|
|
37
|
-
export const { styled, css } = createStyled<ThemeInterface>();
|
|
38
|
-
export default theme;
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
import theme from './theme';
|
|
43
|
-
|
|
44
|
-
class MyApp {
|
|
45
|
-
public render() {
|
|
46
|
-
const { Component, pageProps } = this.props;
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<ThemeProvider theme={theme}>
|
|
50
|
-
<Component {...pageProps} />
|
|
51
|
-
</ThemeProvider>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Button
|
|
58
|
-
|
|
59
|
-
```js
|
|
60
|
-
import { ButtonPrimary } from '@dnanpm/styleguide';
|
|
61
|
-
|
|
62
|
-
interface Props {
|
|
63
|
-
myProp?: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const MyComponent = ({
|
|
67
|
-
myProp,
|
|
68
|
-
}: Props) => {
|
|
69
|
-
return (
|
|
70
|
-
<ButtonPrimary>{myProp || 'Lorem Ipsum'}</ButtonPrimary>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export default MyComponent;
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## IE11 Support NextJS
|
|
78
|
-
|
|
79
|
-
In `next.config.js` you need to use [next-transpile-modules](https://www.npmjs.com/package/next-transpile-modules) package to allow nextjs to be able to transpile styleguide and related es6 modules based on babel config.
|
|
80
|
-
|
|
81
|
-
```js
|
|
82
|
-
// next.config.js
|
|
83
|
-
const withTM = require('next-transpile-modules')(['@dnanpm/styleguide', "react-spring"]);
|
|
84
|
-
|
|
85
|
-
module.exports = withTM();
|
|
86
|
-
```
|
|
1
|
+
# DNA Styleguide
|
|
2
|
+
|
|
3
|
+
Styles and styled components for DNA.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
1. Run install command in repository where styleguide should be added
|
|
8
|
+
- Example
|
|
9
|
+
```shell
|
|
10
|
+
npm install @dnanpm/styleguide
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage example
|
|
14
|
+
|
|
15
|
+
### Theme
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { createStyled, theme as defaultTheme } from '@dnanpm/styleguide';
|
|
19
|
+
|
|
20
|
+
const color = {
|
|
21
|
+
...defaultTheme.color,
|
|
22
|
+
background: '#000000',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const iconSize = {
|
|
26
|
+
default: '0.75em',
|
|
27
|
+
defaultMobile: '2em',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const theme = {
|
|
31
|
+
...defaultTheme,
|
|
32
|
+
colors,
|
|
33
|
+
iconSize,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type ThemeInterface = typeof theme;
|
|
37
|
+
export const { styled, css } = createStyled<ThemeInterface>();
|
|
38
|
+
export default theme;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import theme from './theme';
|
|
43
|
+
|
|
44
|
+
class MyApp {
|
|
45
|
+
public render() {
|
|
46
|
+
const { Component, pageProps } = this.props;
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<ThemeProvider theme={theme}>
|
|
50
|
+
<Component {...pageProps} />
|
|
51
|
+
</ThemeProvider>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Button
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
import { ButtonPrimary } from '@dnanpm/styleguide';
|
|
61
|
+
|
|
62
|
+
interface Props {
|
|
63
|
+
myProp?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const MyComponent = ({
|
|
67
|
+
myProp,
|
|
68
|
+
}: Props) => {
|
|
69
|
+
return (
|
|
70
|
+
<ButtonPrimary>{myProp || 'Lorem Ipsum'}</ButtonPrimary>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default MyComponent;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## IE11 Support NextJS
|
|
78
|
+
|
|
79
|
+
In `next.config.js` you need to use [next-transpile-modules](https://www.npmjs.com/package/next-transpile-modules) package to allow nextjs to be able to transpile styleguide and related es6 modules based on babel config.
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
// next.config.js
|
|
83
|
+
const withTM = require('next-transpile-modules')(['@dnanpm/styleguide', "react-spring"]);
|
|
84
|
+
|
|
85
|
+
module.exports = withTM();
|
|
86
|
+
```
|
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
/* "DNA Text" font definition */
|
|
2
|
-
@font-face {
|
|
3
|
-
font-family: 'DNA Text';
|
|
4
|
-
font-style: normal;
|
|
5
|
-
font-weight: 400;
|
|
6
|
-
font-display: swap;
|
|
7
|
-
src: url('https://banner.dna.fi/fonts/DNAText-Regular.woff2') format('woff2'),
|
|
8
|
-
url('https://banner.dna.fi/fonts/DNAText-Regular.woff') format('woff');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
@font-face {
|
|
12
|
-
font-family: 'DNA Text';
|
|
13
|
-
font-style: normal;
|
|
14
|
-
font-weight: 500;
|
|
15
|
-
font-display: swap;
|
|
16
|
-
src: url('https://banner.dna.fi/fonts/DNAText-Medium.woff2') format('woff2'),
|
|
17
|
-
url('https://banner.dna.fi/fonts/DNAText-Medium.woff') format('woff');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@font-face {
|
|
21
|
-
font-family: 'DNA Text';
|
|
22
|
-
font-style: normal;
|
|
23
|
-
font-weight: 700;
|
|
24
|
-
font-display: swap;
|
|
25
|
-
src: url('https://banner.dna.fi/fonts/DNAText-Bold.woff2') format('woff2'),
|
|
26
|
-
url('https://banner.dna.fi/fonts/DNAText-Bold.woff') format('woff');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/* "DNA Heading" font definition */
|
|
30
|
-
@font-face {
|
|
31
|
-
font-family: 'DNA Heading';
|
|
32
|
-
font-style: normal;
|
|
33
|
-
font-weight: 600;
|
|
34
|
-
font-display: swap;
|
|
35
|
-
src: url('https://banner.dna.fi/fonts/DNAHeading-DemiBold.woff2') format('woff2'),
|
|
36
|
-
url('https://banner.dna.fi/fonts/DNAHeading-DemiBold.woff') format('woff');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@font-face {
|
|
40
|
-
font-family: 'DNA Heading';
|
|
41
|
-
font-style: normal;
|
|
42
|
-
font-weight: 700;
|
|
43
|
-
font-display: swap;
|
|
44
|
-
src: url('https://banner.dna.fi/fonts/DNAHeading-Bold.woff2') format('woff2'),
|
|
45
|
-
url('https://banner.dna.fi/fonts/DNAHeading-Bold.woff') format('woff');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@font-face {
|
|
49
|
-
font-family: 'DNA Heading';
|
|
50
|
-
font-style: normal;
|
|
51
|
-
font-weight: 900;
|
|
52
|
-
font-display: swap;
|
|
53
|
-
src: url('https://banner.dna.fi/fonts/DNAHeading-Black.woff2') format('woff2'),
|
|
54
|
-
url('https://banner.dna.fi/fonts/DNAHeading-Black.woff') format('woff');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* "DNA Numerals" font definition */
|
|
58
|
-
@font-face {
|
|
59
|
-
font-family: 'DNA Numerals';
|
|
60
|
-
font-style: normal;
|
|
61
|
-
font-weight: 700;
|
|
62
|
-
font-display: swap;
|
|
63
|
-
src: url('https://banner.dna.fi/fonts/DNANumerals-Bold.woff2') format('woff2'),
|
|
64
|
-
url('https://banner.dna.fi/fonts/DNANumerals-Bold.woff') format('woff');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/* Direct definitons of DNA fonts */
|
|
68
|
-
@font-face {
|
|
69
|
-
font-family: 'DNA Text Regular';
|
|
70
|
-
font-style: normal;
|
|
71
|
-
font-weight: 400;
|
|
72
|
-
font-display: swap;
|
|
73
|
-
src: url('https://banner.dna.fi/fonts/DNAText-Regular.woff2') format('woff2'),
|
|
74
|
-
url('https://banner.dna.fi/fonts/DNAText-Regular.woff') format('woff');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
@font-face {
|
|
78
|
-
font-family: 'DNA Text Medium';
|
|
79
|
-
font-style: normal;
|
|
80
|
-
font-weight: 500;
|
|
81
|
-
font-display: swap;
|
|
82
|
-
src: url('https://banner.dna.fi/fonts/DNAText-Medium.woff2') format('woff2'),
|
|
83
|
-
url('https://banner.dna.fi/fonts/DNAText-Medium.woff') format('woff');
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
@font-face {
|
|
87
|
-
font-family: 'DNA Text Bold';
|
|
88
|
-
font-style: normal;
|
|
89
|
-
font-weight: 700;
|
|
90
|
-
font-display: swap;
|
|
91
|
-
src: url('https://banner.dna.fi/fonts/DNAText-Bold.woff2') format('woff2'),
|
|
92
|
-
url('https://banner.dna.fi/fonts/DNAText-Bold.woff') format('woff');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
@font-face {
|
|
96
|
-
font-family: 'DNA Heading Demi Bold';
|
|
97
|
-
font-style: normal;
|
|
98
|
-
font-weight: 600;
|
|
99
|
-
font-display: swap;
|
|
100
|
-
src: url('https://banner.dna.fi/fonts/DNAHeading-DemiBold.woff2') format('woff2'),
|
|
101
|
-
url('https://banner.dna.fi/fonts/DNAHeading-DemiBold.woff') format('woff');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@font-face {
|
|
105
|
-
font-family: 'DNA Heading Bold';
|
|
106
|
-
font-style: normal;
|
|
107
|
-
font-weight: 700;
|
|
108
|
-
font-display: swap;
|
|
109
|
-
src: url('https://banner.dna.fi/fonts/DNAHeading-Bold.woff2') format('woff2'),
|
|
110
|
-
url('https://banner.dna.fi/fonts/DNAHeading-Bold.woff') format('woff');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
@font-face {
|
|
114
|
-
font-family: 'DNA Heading Black';
|
|
115
|
-
font-style: normal;
|
|
116
|
-
font-weight: 900;
|
|
117
|
-
font-display: swap;
|
|
118
|
-
src: url('https://banner.dna.fi/fonts/DNAHeading-Black.woff2') format('woff2'),
|
|
119
|
-
url('https://banner.dna.fi/fonts/DNAHeading-Black.woff') format('woff');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@font-face {
|
|
123
|
-
font-family: 'DNA Numerals Bold';
|
|
124
|
-
font-style: normal;
|
|
125
|
-
font-weight: 700;
|
|
126
|
-
font-display: swap;
|
|
127
|
-
src: url('https://banner.dna.fi/fonts/DNANumerals-Bold.woff2') format('woff2'),
|
|
128
|
-
url('https://banner.dna.fi/fonts/DNANumerals-Bold.woff') format('woff');
|
|
129
|
-
}
|
|
1
|
+
/* "DNA Text" font definition */
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: 'DNA Text';
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-weight: 400;
|
|
6
|
+
font-display: swap;
|
|
7
|
+
src: url('https://banner.dna.fi/fonts/DNAText-Regular.woff2') format('woff2'),
|
|
8
|
+
url('https://banner.dna.fi/fonts/DNAText-Regular.woff') format('woff');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@font-face {
|
|
12
|
+
font-family: 'DNA Text';
|
|
13
|
+
font-style: normal;
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
font-display: swap;
|
|
16
|
+
src: url('https://banner.dna.fi/fonts/DNAText-Medium.woff2') format('woff2'),
|
|
17
|
+
url('https://banner.dna.fi/fonts/DNAText-Medium.woff') format('woff');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@font-face {
|
|
21
|
+
font-family: 'DNA Text';
|
|
22
|
+
font-style: normal;
|
|
23
|
+
font-weight: 700;
|
|
24
|
+
font-display: swap;
|
|
25
|
+
src: url('https://banner.dna.fi/fonts/DNAText-Bold.woff2') format('woff2'),
|
|
26
|
+
url('https://banner.dna.fi/fonts/DNAText-Bold.woff') format('woff');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* "DNA Heading" font definition */
|
|
30
|
+
@font-face {
|
|
31
|
+
font-family: 'DNA Heading';
|
|
32
|
+
font-style: normal;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
font-display: swap;
|
|
35
|
+
src: url('https://banner.dna.fi/fonts/DNAHeading-DemiBold.woff2') format('woff2'),
|
|
36
|
+
url('https://banner.dna.fi/fonts/DNAHeading-DemiBold.woff') format('woff');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@font-face {
|
|
40
|
+
font-family: 'DNA Heading';
|
|
41
|
+
font-style: normal;
|
|
42
|
+
font-weight: 700;
|
|
43
|
+
font-display: swap;
|
|
44
|
+
src: url('https://banner.dna.fi/fonts/DNAHeading-Bold.woff2') format('woff2'),
|
|
45
|
+
url('https://banner.dna.fi/fonts/DNAHeading-Bold.woff') format('woff');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@font-face {
|
|
49
|
+
font-family: 'DNA Heading';
|
|
50
|
+
font-style: normal;
|
|
51
|
+
font-weight: 900;
|
|
52
|
+
font-display: swap;
|
|
53
|
+
src: url('https://banner.dna.fi/fonts/DNAHeading-Black.woff2') format('woff2'),
|
|
54
|
+
url('https://banner.dna.fi/fonts/DNAHeading-Black.woff') format('woff');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* "DNA Numerals" font definition */
|
|
58
|
+
@font-face {
|
|
59
|
+
font-family: 'DNA Numerals';
|
|
60
|
+
font-style: normal;
|
|
61
|
+
font-weight: 700;
|
|
62
|
+
font-display: swap;
|
|
63
|
+
src: url('https://banner.dna.fi/fonts/DNANumerals-Bold.woff2') format('woff2'),
|
|
64
|
+
url('https://banner.dna.fi/fonts/DNANumerals-Bold.woff') format('woff');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Direct definitons of DNA fonts */
|
|
68
|
+
@font-face {
|
|
69
|
+
font-family: 'DNA Text Regular';
|
|
70
|
+
font-style: normal;
|
|
71
|
+
font-weight: 400;
|
|
72
|
+
font-display: swap;
|
|
73
|
+
src: url('https://banner.dna.fi/fonts/DNAText-Regular.woff2') format('woff2'),
|
|
74
|
+
url('https://banner.dna.fi/fonts/DNAText-Regular.woff') format('woff');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@font-face {
|
|
78
|
+
font-family: 'DNA Text Medium';
|
|
79
|
+
font-style: normal;
|
|
80
|
+
font-weight: 500;
|
|
81
|
+
font-display: swap;
|
|
82
|
+
src: url('https://banner.dna.fi/fonts/DNAText-Medium.woff2') format('woff2'),
|
|
83
|
+
url('https://banner.dna.fi/fonts/DNAText-Medium.woff') format('woff');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@font-face {
|
|
87
|
+
font-family: 'DNA Text Bold';
|
|
88
|
+
font-style: normal;
|
|
89
|
+
font-weight: 700;
|
|
90
|
+
font-display: swap;
|
|
91
|
+
src: url('https://banner.dna.fi/fonts/DNAText-Bold.woff2') format('woff2'),
|
|
92
|
+
url('https://banner.dna.fi/fonts/DNAText-Bold.woff') format('woff');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@font-face {
|
|
96
|
+
font-family: 'DNA Heading Demi Bold';
|
|
97
|
+
font-style: normal;
|
|
98
|
+
font-weight: 600;
|
|
99
|
+
font-display: swap;
|
|
100
|
+
src: url('https://banner.dna.fi/fonts/DNAHeading-DemiBold.woff2') format('woff2'),
|
|
101
|
+
url('https://banner.dna.fi/fonts/DNAHeading-DemiBold.woff') format('woff');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@font-face {
|
|
105
|
+
font-family: 'DNA Heading Bold';
|
|
106
|
+
font-style: normal;
|
|
107
|
+
font-weight: 700;
|
|
108
|
+
font-display: swap;
|
|
109
|
+
src: url('https://banner.dna.fi/fonts/DNAHeading-Bold.woff2') format('woff2'),
|
|
110
|
+
url('https://banner.dna.fi/fonts/DNAHeading-Bold.woff') format('woff');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@font-face {
|
|
114
|
+
font-family: 'DNA Heading Black';
|
|
115
|
+
font-style: normal;
|
|
116
|
+
font-weight: 900;
|
|
117
|
+
font-display: swap;
|
|
118
|
+
src: url('https://banner.dna.fi/fonts/DNAHeading-Black.woff2') format('woff2'),
|
|
119
|
+
url('https://banner.dna.fi/fonts/DNAHeading-Black.woff') format('woff');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@font-face {
|
|
123
|
+
font-family: 'DNA Numerals Bold';
|
|
124
|
+
font-style: normal;
|
|
125
|
+
font-weight: 700;
|
|
126
|
+
font-display: swap;
|
|
127
|
+
src: url('https://banner.dna.fi/fonts/DNANumerals-Bold.woff2') format('woff2'),
|
|
128
|
+
url('https://banner.dna.fi/fonts/DNANumerals-Bold.woff') format('woff');
|
|
129
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { Props as AccordionItemProps } from '../AccordionItem/AccordionItem';
|
|
3
4
|
interface Props extends Omit<AccordionItemProps, 'title' | 'id' | 'children' | 'onClick' | 'onKeyDown'> {
|
|
@@ -6,7 +7,7 @@ interface Props extends Omit<AccordionItemProps, 'title' | 'id' | 'children' | '
|
|
|
6
7
|
*
|
|
7
8
|
* @type AccordionItem
|
|
8
9
|
*/
|
|
9
|
-
children:
|
|
10
|
+
children: ReactNode;
|
|
10
11
|
/**
|
|
11
12
|
* Allows only one AccordionItem to be opened when set to true
|
|
12
13
|
*
|
|
@@ -36,8 +36,8 @@ const Accordion = (_a) => {
|
|
|
36
36
|
const initialItemList = {};
|
|
37
37
|
const getAccordionItemId = (index, title) => `${title.replace(/\s+/g, '')}-${index}`;
|
|
38
38
|
if (props.isExpanded) {
|
|
39
|
-
|
|
40
|
-
if (
|
|
39
|
+
React.Children.map(props.children, (child, index) => {
|
|
40
|
+
if (React.isValidElement(child) && child.type === AccordionItem["default"]) {
|
|
41
41
|
initialItemList[getAccordionItemId(index, child.props.title)] = Boolean(props.isExpanded);
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -60,8 +60,8 @@ const Accordion = (_a) => {
|
|
|
60
60
|
toggleExpanded((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.id);
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
-
const accordionItems =
|
|
64
|
-
if (
|
|
63
|
+
const accordionItems = React.Children.map(props.children, (child, index) => {
|
|
64
|
+
if (React.isValidElement(child) && child.type === AccordionItem["default"]) {
|
|
65
65
|
const id = getAccordionItemId(index, child.props.title);
|
|
66
66
|
return (React__default["default"].createElement(AccordionItem["default"], { id: id, key: id, type: type, title: child.props.title, isExpanded: itemList[id], highlightSelected: highlightSelected, hasCloseButton: hasCloseButton, openLabel: props.openLabel, closeLabel: props.closeLabel, onClick: handleClick, onKeyDown: handleKeyDown, className: child.props.className }, child.props.children));
|
|
67
67
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
type AccordionItemType = 'box' | 'panel';
|
|
3
4
|
export interface Props {
|
|
@@ -21,7 +22,7 @@ export interface Props {
|
|
|
21
22
|
/**
|
|
22
23
|
* Content of Accordion Item
|
|
23
24
|
*/
|
|
24
|
-
children?:
|
|
25
|
+
children?: ReactNode;
|
|
25
26
|
/**
|
|
26
27
|
* Allows to expand or collapse the component
|
|
27
28
|
*
|
|
@@ -54,12 +55,12 @@ export interface Props {
|
|
|
54
55
|
* On component title and close button mouse click callback
|
|
55
56
|
* Use `e.currentTarget.parentElement` to get AccordionItem element
|
|
56
57
|
*/
|
|
57
|
-
onClick?: (e:
|
|
58
|
+
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
58
59
|
/**
|
|
59
60
|
* On component title and close button keyboard key down callback
|
|
60
61
|
* Use `e.currentTarget.parentElement` to get AccordionItem element
|
|
61
62
|
*/
|
|
62
|
-
onKeyDown?: (e:
|
|
63
|
+
onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;
|
|
63
64
|
/**
|
|
64
65
|
* Allows to pass a custom className
|
|
65
66
|
*/
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var styled = require('styled-components');
|
|
8
|
-
var
|
|
8
|
+
var useResizeObserver = require('../../hooks/useResizeObserver.js');
|
|
9
9
|
var theme = require('../../themes/theme.js');
|
|
10
10
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
11
11
|
var Box = require('../Box/Box.js');
|
|
@@ -69,7 +69,7 @@ const AccordionItemCloseButton = styled__default["default"].div `
|
|
|
69
69
|
const AccordionItem = (_a) => {
|
|
70
70
|
var { type = 'box', hasCloseButton = false, highlightSelected = type === 'panel' } = _a, props = tslib.__rest(_a, ["type", "hasCloseButton", "highlightSelected"]);
|
|
71
71
|
// Get height when element dimensions change
|
|
72
|
-
const { height: contentHeight, ref: contentRef } =
|
|
72
|
+
const { height: contentHeight, ref: contentRef } = useResizeObserver["default"]();
|
|
73
73
|
const itemContent = (React__default["default"].createElement(AccordionItemContainer, { id: props.id, type: type, "aria-expanded": Boolean(props.isExpanded), className: props.className },
|
|
74
74
|
React__default["default"].createElement(AccordionItemTitle, { tabIndex: 0, onClick: props.onClick, onKeyDown: props.onKeyDown, isExpanded: Boolean(props.isExpanded), highlightSelected: highlightSelected, role: "button" },
|
|
75
75
|
props.title,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { ElevationLevel } from '../../types/elevation';
|
|
3
4
|
interface Props {
|
|
@@ -8,7 +9,7 @@ interface Props {
|
|
|
8
9
|
/**
|
|
9
10
|
* Content of Box component
|
|
10
11
|
*/
|
|
11
|
-
children?:
|
|
12
|
+
children?: ReactNode;
|
|
12
13
|
/**
|
|
13
14
|
* Allows to change the elevation effect of component
|
|
14
15
|
*
|
|
@@ -22,7 +22,7 @@ const BoxWrapper = styled__default["default"].div `
|
|
|
22
22
|
padding: ${({ padding }) => padding || styledUtils.getMultipliedSize(theme["default"].base.baseHeight, 2)};
|
|
23
23
|
background-color: ${theme["default"].color.default.white};
|
|
24
24
|
border-radius: ${theme["default"].radius.default};
|
|
25
|
-
${({ $elevation, shadow }) => $elevation !== 'none' && common
|
|
25
|
+
${({ $elevation, shadow }) => $elevation !== 'none' && common["default"]({ elevation: $elevation, shadow })}
|
|
26
26
|
`;
|
|
27
27
|
const Box = (_a) => {
|
|
28
28
|
var { elevation = 'none', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["elevation", 'data-testid']);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
type ButtonType = 'submit' | 'button' | 'reset';
|
|
3
4
|
export interface Props {
|
|
@@ -26,15 +27,15 @@ export interface Props {
|
|
|
26
27
|
/**
|
|
27
28
|
* Content of Button component
|
|
28
29
|
*/
|
|
29
|
-
children?:
|
|
30
|
+
children?: ReactNode;
|
|
30
31
|
/**
|
|
31
32
|
* On Button click callback
|
|
32
33
|
*/
|
|
33
|
-
onClick?: (e:
|
|
34
|
+
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
34
35
|
/**
|
|
35
36
|
* On Button mouse down callback
|
|
36
37
|
*/
|
|
37
|
-
onMouseDown?: (e:
|
|
38
|
+
onMouseDown?: (e: MouseEvent<HTMLElement>) => void;
|
|
38
39
|
/**
|
|
39
40
|
* Allows to change version of Button component to small
|
|
40
41
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { Props as ButtonProps } from './Button';
|
|
3
4
|
type ButtonArrowDirection = 'up' | 'right' | 'down' | 'left';
|
|
@@ -21,7 +22,7 @@ type Props = ({
|
|
|
21
22
|
*
|
|
22
23
|
* @type Icon | undefined
|
|
23
24
|
*/
|
|
24
|
-
icon:
|
|
25
|
+
icon: ReactNode;
|
|
25
26
|
direction?: never;
|
|
26
27
|
}) & Omit<ButtonProps, 'children' | 'small' | 'fullWidth' | 'loading' | 'data-no-close'> & {
|
|
27
28
|
/**
|
|
@@ -76,9 +76,7 @@ const buttonsMap = {
|
|
|
76
76
|
const ButtonArrow = (_a) => {
|
|
77
77
|
var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["variant", 'data-testid', 'data-track-value']);
|
|
78
78
|
const Element = buttonsMap[variant];
|
|
79
|
-
return (React__default["default"].createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue }, props.direction ? (React__default["default"].createElement(Icon["default"], { icon: iconsMap[props.direction], size: "1rem" })) : (
|
|
80
|
-
props.icon.type === Icon["default"] &&
|
|
81
|
-
props.icon)));
|
|
79
|
+
return (React__default["default"].createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue }, props.direction ? (React__default["default"].createElement(Icon["default"], { icon: iconsMap[props.direction], size: "1rem" })) : (React.isValidElement(props.icon) && props.icon.type === Icon["default"] && props.icon)));
|
|
82
80
|
};
|
|
83
81
|
|
|
84
82
|
exports["default"] = ButtonArrow;
|
|
@@ -57,7 +57,7 @@ const Checkbox = (_a) => {
|
|
|
57
57
|
};
|
|
58
58
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
59
59
|
React__default["default"].createElement(Container, null,
|
|
60
|
-
React__default["default"].createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value), onChange: handleChange, disabled: props.disabled, "data-testid": dataTestId }),
|
|
60
|
+
React__default["default"].createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value), "aria-checked": Boolean(props.value), onChange: handleChange, disabled: props.disabled, "data-testid": dataTestId }),
|
|
61
61
|
React__default["default"].createElement("label", { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label` },
|
|
62
62
|
props.label,
|
|
63
63
|
props.required && React__default["default"].createElement(Mandatory, null, "*"))),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
type ChipType = 'default' | 'info' | 'success' | 'warning' | 'error';
|
|
3
4
|
type ChipVariant = 'outlined' | 'filled';
|
|
@@ -30,11 +31,11 @@ interface Props {
|
|
|
30
31
|
/**
|
|
31
32
|
* Content of the component
|
|
32
33
|
*/
|
|
33
|
-
children?:
|
|
34
|
+
children?: ReactNode;
|
|
34
35
|
/**
|
|
35
36
|
* On component click callback
|
|
36
37
|
*/
|
|
37
|
-
onClick?: (e:
|
|
38
|
+
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
38
39
|
/**
|
|
39
40
|
* Allows to pass a custom className
|
|
40
41
|
*/
|