@dnanpm/styleguide 3.8.2 → 3.8.3
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/build/cjs/components/AmountSelector/AmountSelector.js +1 -1
- package/build/cjs/components/{Button → ButtonArrow}/ButtonArrow.d.ts +1 -1
- package/build/cjs/components/{Button → ButtonArrow}/ButtonArrow.js +2 -2
- package/build/cjs/components/ButtonCard/ButtonCard.d.ts +70 -0
- package/build/cjs/components/ButtonCard/ButtonCard.js +135 -0
- package/build/cjs/components/{Button → ButtonClose}/ButtonClose.d.ts +1 -1
- package/build/cjs/components/{Button → ButtonIcon}/ButtonIcon.d.ts +1 -1
- package/build/cjs/components/{Button → ButtonPrimary}/ButtonPrimary.d.ts +1 -1
- package/build/cjs/components/{Button → ButtonPrimary}/ButtonPrimary.js +1 -1
- package/build/{es/components/Button → cjs/components/ButtonRound}/ButtonRound.d.ts +1 -1
- package/build/cjs/components/{Button → ButtonRound}/ButtonRound.js +1 -1
- package/build/cjs/components/{Button → ButtonSecondary}/ButtonSecondary.d.ts +1 -1
- package/build/cjs/components/{Button → ButtonSecondary}/ButtonSecondary.js +1 -1
- package/build/cjs/components/Carousel/Carousel.js +2 -2
- package/build/cjs/components/DateTimePicker/DateTimePicker.js +1 -1
- package/build/cjs/components/Drawer/Drawer.js +3 -3
- package/build/cjs/components/Expander/Expander.js +1 -1
- package/build/cjs/components/Footer/Components/FooterComponents.js +1 -1
- package/build/cjs/components/Input/Input.js +1 -1
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +1 -1
- package/build/cjs/components/MainNavigation/MainNavigation.d.ts +4 -1
- package/build/cjs/components/MainNavigation/MainNavigation.js +4 -1
- package/build/cjs/components/Modal/Modal.js +1 -1
- package/build/cjs/components/Notification/Notification.js +1 -1
- package/build/cjs/components/PriorityNavigation/PriorityNavigation.js +5 -1
- package/build/cjs/components/ReadMore/ReadMore.js +1 -1
- package/build/cjs/components/Search/Search.js +1 -1
- package/build/cjs/components/Toaster/Toaster.js +1 -1
- package/build/cjs/components/index.d.ts +7 -6
- package/build/cjs/index.js +8 -6
- package/build/es/components/AmountSelector/AmountSelector.js +1 -1
- package/build/es/components/{Button → ButtonArrow}/ButtonArrow.d.ts +1 -1
- package/build/es/components/{Button → ButtonArrow}/ButtonArrow.js +2 -2
- package/build/es/components/ButtonCard/ButtonCard.d.ts +70 -0
- package/build/es/components/ButtonCard/ButtonCard.js +131 -0
- package/build/es/components/{Button → ButtonClose}/ButtonClose.d.ts +1 -1
- package/build/es/components/{Button → ButtonIcon}/ButtonIcon.d.ts +1 -1
- package/build/es/components/{Button → ButtonPrimary}/ButtonPrimary.d.ts +1 -1
- package/build/es/components/{Button → ButtonPrimary}/ButtonPrimary.js +1 -1
- package/build/{cjs/components/Button → es/components/ButtonRound}/ButtonRound.d.ts +1 -1
- package/build/es/components/{Button → ButtonRound}/ButtonRound.js +1 -1
- package/build/es/components/{Button → ButtonSecondary}/ButtonSecondary.d.ts +1 -1
- package/build/es/components/{Button → ButtonSecondary}/ButtonSecondary.js +1 -1
- package/build/es/components/Carousel/Carousel.js +2 -2
- package/build/es/components/DateTimePicker/DateTimePicker.js +1 -1
- package/build/es/components/Drawer/Drawer.js +3 -3
- package/build/es/components/Expander/Expander.js +1 -1
- package/build/es/components/Footer/Components/FooterComponents.js +1 -1
- package/build/es/components/Input/Input.js +1 -1
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +1 -1
- package/build/es/components/MainNavigation/MainNavigation.d.ts +4 -1
- package/build/es/components/MainNavigation/MainNavigation.js +4 -1
- package/build/es/components/Modal/Modal.js +1 -1
- package/build/es/components/Notification/Notification.js +1 -1
- package/build/es/components/PriorityNavigation/PriorityNavigation.js +5 -1
- package/build/es/components/ReadMore/ReadMore.js +1 -1
- package/build/es/components/Search/Search.js +1 -1
- package/build/es/components/Toaster/Toaster.js +1 -1
- package/build/es/components/index.d.ts +7 -6
- package/build/es/index.js +7 -6
- package/package.json +6 -6
- /package/build/cjs/components/{Button → ButtonClose}/ButtonClose.js +0 -0
- /package/build/cjs/components/{Button → ButtonIcon}/ButtonIcon.js +0 -0
- /package/build/es/components/{Button → ButtonClose}/ButtonClose.js +0 -0
- /package/build/es/components/{Button → ButtonIcon}/ButtonIcon.js +0 -0
|
@@ -8,7 +8,7 @@ var React = require('react');
|
|
|
8
8
|
var styled = require('../../themes/styled.js');
|
|
9
9
|
var theme = require('../../themes/theme.js');
|
|
10
10
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
11
|
-
var ButtonArrow = require('../
|
|
11
|
+
var ButtonArrow = require('../ButtonArrow/ButtonArrow.js');
|
|
12
12
|
var Icon = require('../Icon/Icon.js');
|
|
13
13
|
|
|
14
14
|
const Container = styled.default.div `
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { Props as ButtonProps } from '
|
|
3
|
+
import type { Props as ButtonProps } from '../Button/Button';
|
|
4
4
|
type ButtonArrowDirection = 'up' | 'right' | 'down' | 'left';
|
|
5
5
|
type ButtonArrowVariant = 'primary' | 'secondary';
|
|
6
6
|
type Props = ({
|
|
@@ -8,9 +8,9 @@ var React = require('react');
|
|
|
8
8
|
var styled = require('styled-components');
|
|
9
9
|
var theme = require('../../themes/theme.js');
|
|
10
10
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
11
|
+
var ButtonPrimary = require('../ButtonPrimary/ButtonPrimary.js');
|
|
12
|
+
var ButtonSecondary = require('../ButtonSecondary/ButtonSecondary.js');
|
|
11
13
|
var Icon = require('../Icon/Icon.js');
|
|
12
|
-
var ButtonPrimary = require('./ButtonPrimary.js');
|
|
13
|
-
var ButtonSecondary = require('./ButtonSecondary.js');
|
|
14
14
|
|
|
15
15
|
const iconsMap = {
|
|
16
16
|
up: icons.ChevronUp,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type Size = 'small' | 'medium' | 'large';
|
|
4
|
+
type ButtonType = 'submit' | 'button' | 'reset';
|
|
5
|
+
interface Props {
|
|
6
|
+
/**
|
|
7
|
+
* Unique ID for the component
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Name of the button element
|
|
12
|
+
*/
|
|
13
|
+
name?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Allows to change the HTML type of button element. Ignored when `href` is defined
|
|
16
|
+
*
|
|
17
|
+
* @param {ButtonType} submit Button submits the form data
|
|
18
|
+
* @param {ButtonType} button No functionality when pressed
|
|
19
|
+
* @param {ButtonType} reset Button resets all the controls to their initial values
|
|
20
|
+
*
|
|
21
|
+
* @default 'submit'
|
|
22
|
+
*/
|
|
23
|
+
type?: ButtonType;
|
|
24
|
+
/**
|
|
25
|
+
* Allows to change layout of the component based on size
|
|
26
|
+
*
|
|
27
|
+
* @param {Size} small Renders component in compact layout
|
|
28
|
+
* @param {Size} medium Default
|
|
29
|
+
* @param {Size} large Renders component with enlarged title and subtitle
|
|
30
|
+
*
|
|
31
|
+
* @default 'medium'
|
|
32
|
+
*/
|
|
33
|
+
size?: Size;
|
|
34
|
+
/**
|
|
35
|
+
* Allows to change the type of resulting HTML element from button (`<button></button>`) to anchor (`<a href="..."></a>`)
|
|
36
|
+
*/
|
|
37
|
+
href?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Allows to define title
|
|
40
|
+
*/
|
|
41
|
+
title: string;
|
|
42
|
+
/**
|
|
43
|
+
* Allows to define subtitle
|
|
44
|
+
*/
|
|
45
|
+
subtitle?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Allows to define visual content
|
|
48
|
+
*/
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* On button click callback
|
|
52
|
+
*/
|
|
53
|
+
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Allows to change icon from `ChevronRight` to `Open`
|
|
56
|
+
*/
|
|
57
|
+
isExternal?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Allows to pass a custom className
|
|
60
|
+
*/
|
|
61
|
+
className?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Allows to pass testid string for testing purposes
|
|
64
|
+
*/
|
|
65
|
+
'data-testid'?: string;
|
|
66
|
+
}
|
|
67
|
+
/** @visibleName Button Card */
|
|
68
|
+
declare const ButtonCard: ({ type, size, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
69
|
+
/** @component */
|
|
70
|
+
export default ButtonCard;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var icons = require('@dnanpm/icons');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var styled = require('styled-components');
|
|
9
|
+
var theme = require('../../themes/theme.js');
|
|
10
|
+
var Box = require('../Box/Box.js');
|
|
11
|
+
var Icon = require('../Icon/Icon.js');
|
|
12
|
+
|
|
13
|
+
const ButtonCardWrapper = styled.button `
|
|
14
|
+
display: block;
|
|
15
|
+
padding: 0;
|
|
16
|
+
border: 0 none;
|
|
17
|
+
width: 100%;
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
font-family: ${theme.default.fontFamily.default};
|
|
21
|
+
font-size: ${theme.default.fontSize.default};
|
|
22
|
+
line-height: ${theme.default.lineHeight.default};
|
|
23
|
+
color: ${theme.default.color.text.black};
|
|
24
|
+
|
|
25
|
+
&:focus-visible {
|
|
26
|
+
border: 1px solid ${theme.default.color.focus.light};
|
|
27
|
+
box-shadow: 0px 0px 0px 2px ${theme.default.color.focus.dark};
|
|
28
|
+
border-radius: ${theme.default.radius.default};
|
|
29
|
+
outline: none;
|
|
30
|
+
|
|
31
|
+
& > div {
|
|
32
|
+
border: 0 none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
color: ${theme.default.color.text.black};
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
const StyledBox = styled(Box.default) `
|
|
42
|
+
display: flex;
|
|
43
|
+
gap: ${({ size }) => (size === 'small' ? '0.313rem' : '1rem')};
|
|
44
|
+
border: 1px solid ${theme.default.color.line.L03};
|
|
45
|
+
padding: ${({ size }) => (size === 'small' ? '0.625rem' : '1rem')};
|
|
46
|
+
${({ size }) => size === 'small' && 'flex-direction: column'};
|
|
47
|
+
${({ size }) => size !== 'small' && 'align-items: center'};
|
|
48
|
+
`;
|
|
49
|
+
const VisualContent = styled.div `
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
width: ${({ size }) => (size === 'small' ? '2.5rem' : '3.75rem')};
|
|
53
|
+
height: ${({ size }) => (size === 'small' ? '2.5rem' : '3.75rem')};
|
|
54
|
+
`;
|
|
55
|
+
const TextContentWrapper = styled.div `
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-grow: 1;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: space-between;
|
|
60
|
+
gap: ${({ size }) => (size === 'small' ? '0.625rem' : '1rem')};
|
|
61
|
+
min-width: 0;
|
|
62
|
+
`;
|
|
63
|
+
const TextContent = styled.div `
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: flex-start;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
min-width: 0;
|
|
68
|
+
`;
|
|
69
|
+
const Title = styled.div `
|
|
70
|
+
font-size: ${theme.default.fontSize.default};
|
|
71
|
+
line-height: ${theme.default.lineHeight.default};
|
|
72
|
+
font-weight: ${theme.default.fontWeight.bold};
|
|
73
|
+
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
max-width: 100%;
|
|
78
|
+
|
|
79
|
+
${({ size }) => size === 'small' &&
|
|
80
|
+
`
|
|
81
|
+
font-size: ${theme.default.fontSize.s};
|
|
82
|
+
line-height: ${theme.default.lineHeight.s};
|
|
83
|
+
font-weight: ${theme.default.fontWeight.medium};
|
|
84
|
+
`}
|
|
85
|
+
|
|
86
|
+
${({ size }) => size === 'large' &&
|
|
87
|
+
`
|
|
88
|
+
font-size: ${theme.default.fontSize.xl};
|
|
89
|
+
`};
|
|
90
|
+
`;
|
|
91
|
+
const Subtitle = styled.div `
|
|
92
|
+
color: ${theme.default.color.text.gray};
|
|
93
|
+
font-size: ${theme.default.fontSize.s};
|
|
94
|
+
line-height: ${theme.default.lineHeight.s};
|
|
95
|
+
font-weight: ${theme.default.fontWeight.medium};
|
|
96
|
+
|
|
97
|
+
text-overflow: ellipsis;
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
max-width: 100%;
|
|
101
|
+
|
|
102
|
+
${({ size }) => size === 'small' &&
|
|
103
|
+
`
|
|
104
|
+
font-size: ${theme.default.fontSize.xs};
|
|
105
|
+
line-height: ${theme.default.lineHeight.xxs};
|
|
106
|
+
`}
|
|
107
|
+
|
|
108
|
+
${({ size }) => size === 'large' &&
|
|
109
|
+
`
|
|
110
|
+
font-size: ${theme.default.fontSize.default};
|
|
111
|
+
`};
|
|
112
|
+
`;
|
|
113
|
+
const CtaIcon = styled(Icon.default) `
|
|
114
|
+
color: ${theme.default.color.text.pink};
|
|
115
|
+
|
|
116
|
+
${ButtonCardWrapper}:hover & {
|
|
117
|
+
color: ${theme.default.color.hover.pink};
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
120
|
+
/** @visibleName Button Card */
|
|
121
|
+
const ButtonCard = (_a) => {
|
|
122
|
+
var { type = 'submit', size = 'medium', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["type", "size", 'data-testid']);
|
|
123
|
+
return (React.createElement(ButtonCardWrapper, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, className: props.className, "data-testid": dataTestId }, (!props.href && {
|
|
124
|
+
name: props.name,
|
|
125
|
+
})),
|
|
126
|
+
React.createElement(StyledBox, { elevation: "low", size: size },
|
|
127
|
+
React.createElement(VisualContent, { size: size, "data-testid": dataTestId && `${dataTestId}-content` }, props.children),
|
|
128
|
+
React.createElement(TextContentWrapper, { size: size },
|
|
129
|
+
React.createElement(TextContent, null,
|
|
130
|
+
React.createElement(Title, { size: size, "data-testid": dataTestId && `${dataTestId}-title` }, props.title),
|
|
131
|
+
props.subtitle && (React.createElement(Subtitle, { size: size, "data-testid": dataTestId && `${dataTestId}-subtitle` }, props.subtitle))),
|
|
132
|
+
React.createElement(CtaIcon, { icon: props.isExternal ? icons.Open : icons.ChevronRight, size: size === 'small' ? '1rem' : '1.5rem', "data-testid": dataTestId && `${dataTestId}-cta` })))));
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
exports.default = ButtonCard;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Props as ButtonProps } from '
|
|
2
|
+
import type { Props as ButtonProps } from '../Button/Button';
|
|
3
3
|
interface Props extends Pick<ButtonProps, 'id' | 'name' | 'children' | 'onClick' | 'onMouseDown' | 'className' | 'data-testid'> {
|
|
4
4
|
/**
|
|
5
5
|
* Allows to pass aria label for screen readers
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { Props as ButtonProps } from '../Button/Button';
|
|
2
3
|
import type { Props as IconProps } from '../Icon/Icon';
|
|
3
|
-
import type { Props as ButtonProps } from './Button';
|
|
4
4
|
interface Props extends Omit<ButtonProps, 'fullWidth'> {
|
|
5
5
|
/**
|
|
6
6
|
* Icon shown in icon button component
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var styled = require('styled-components');
|
|
6
6
|
var theme = require('../../themes/theme.js');
|
|
7
|
-
var Button = require('
|
|
7
|
+
var Button = require('../Button/Button.js');
|
|
8
8
|
|
|
9
9
|
/** @visibleName Button Primary */
|
|
10
10
|
const ButtonPrimary = styled(Button.default) `
|
|
@@ -7,7 +7,7 @@ var React = require('react');
|
|
|
7
7
|
var styled = require('styled-components');
|
|
8
8
|
var theme = require('../../themes/theme.js');
|
|
9
9
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
10
|
-
var ButtonPrimary = require('
|
|
10
|
+
var ButtonPrimary = require('../ButtonPrimary/ButtonPrimary.js');
|
|
11
11
|
|
|
12
12
|
const ButtonElement = styled(ButtonPrimary.default) `
|
|
13
13
|
display: flex;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var styled = require('styled-components');
|
|
6
6
|
var theme = require('../../themes/theme.js');
|
|
7
|
-
var Button = require('
|
|
7
|
+
var Button = require('../Button/Button.js');
|
|
8
8
|
|
|
9
9
|
/** @visibleName Button Secondary */
|
|
10
10
|
const ButtonSecondary = styled(Button.default) `
|
|
@@ -9,8 +9,8 @@ var useWindowSize = require('../../hooks/useWindowSize.js');
|
|
|
9
9
|
var styled = require('../../themes/styled.js');
|
|
10
10
|
var theme = require('../../themes/theme.js');
|
|
11
11
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
12
|
-
var ButtonArrow = require('../
|
|
13
|
-
var ButtonIcon = require('../
|
|
12
|
+
var ButtonArrow = require('../ButtonArrow/ButtonArrow.js');
|
|
13
|
+
var ButtonIcon = require('../ButtonIcon/ButtonIcon.js');
|
|
14
14
|
|
|
15
15
|
const CarouselWrapper = styled.default.div ``;
|
|
16
16
|
const Header = styled.default.div `
|
|
@@ -9,7 +9,7 @@ var ReactDatePicker = require('react-datepicker');
|
|
|
9
9
|
var styled = require('styled-components');
|
|
10
10
|
var theme = require('../../themes/theme.js');
|
|
11
11
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
12
|
-
var ButtonIcon = require('../
|
|
12
|
+
var ButtonIcon = require('../ButtonIcon/ButtonIcon.js');
|
|
13
13
|
var Input = require('../Input/Input.js');
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -8,12 +8,12 @@ var React = require('react');
|
|
|
8
8
|
var ReactModal = require('react-modal');
|
|
9
9
|
var styled = require('../../themes/styled.js');
|
|
10
10
|
var theme = require('../../themes/theme.js');
|
|
11
|
+
var common = require('../../utils/common.js');
|
|
11
12
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
12
13
|
var Box = require('../Box/Box.js');
|
|
13
|
-
var ButtonClose = require('../
|
|
14
|
-
var Icon = require('../Icon/Icon.js');
|
|
15
|
-
var common = require('../../utils/common.js');
|
|
14
|
+
var ButtonClose = require('../ButtonClose/ButtonClose.js');
|
|
16
15
|
var Floater = require('../Floater/Floater.js');
|
|
16
|
+
var Icon = require('../Icon/Icon.js');
|
|
17
17
|
|
|
18
18
|
const sizeMap = {
|
|
19
19
|
small: '375px',
|
|
@@ -7,7 +7,7 @@ var icons = require('@dnanpm/icons');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var styled = require('../../themes/styled.js');
|
|
9
9
|
var theme = require('../../themes/theme.js');
|
|
10
|
-
var ButtonIcon = require('../
|
|
10
|
+
var ButtonIcon = require('../ButtonIcon/ButtonIcon.js');
|
|
11
11
|
|
|
12
12
|
const Container = styled.default.div `
|
|
13
13
|
display: flex;
|
|
@@ -5,7 +5,7 @@ var React = require('react');
|
|
|
5
5
|
var styled = require('../../../themes/styled.js');
|
|
6
6
|
var theme = require('../../../themes/theme.js');
|
|
7
7
|
var styledUtils = require('../../../utils/styledUtils.js');
|
|
8
|
-
var ButtonIcon = require('../../
|
|
8
|
+
var ButtonIcon = require('../../ButtonIcon/ButtonIcon.js');
|
|
9
9
|
var Icon = require('../../Icon/Icon.js');
|
|
10
10
|
var FooterContext = require('../context/FooterContext.js');
|
|
11
11
|
|
|
@@ -8,7 +8,7 @@ var React = require('react');
|
|
|
8
8
|
var styled = require('../../themes/styled.js');
|
|
9
9
|
var theme = require('../../themes/theme.js');
|
|
10
10
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
11
|
-
var ButtonIcon = require('../
|
|
11
|
+
var ButtonIcon = require('../ButtonIcon/ButtonIcon.js');
|
|
12
12
|
var Icon = require('../Icon/Icon.js');
|
|
13
13
|
var LabelText = require('../LabelText/LabelText.js');
|
|
14
14
|
|
|
@@ -11,7 +11,7 @@ var theme = require('../../../themes/theme.js');
|
|
|
11
11
|
var navigation = require('../../../themes/themeComponents/navigation.js');
|
|
12
12
|
var styledUtils = require('../../../utils/styledUtils.js');
|
|
13
13
|
var Box = require('../../Box/Box.js');
|
|
14
|
-
var ButtonPrimary = require('../../
|
|
14
|
+
var ButtonPrimary = require('../../ButtonPrimary/ButtonPrimary.js');
|
|
15
15
|
var NavContext = require('../context/NavContext.js');
|
|
16
16
|
var MainNavTooltipMenuExportedStyles = require('./MainNavTooltipMenuExportedStyles.js');
|
|
17
17
|
|
|
@@ -29,7 +29,10 @@ export interface MainNavigationProps {
|
|
|
29
29
|
currentUrl?: string;
|
|
30
30
|
notificationText?: string;
|
|
31
31
|
}
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* @visibleName Main Navigation
|
|
34
|
+
* @deprecated Use `MainHeaderNavigation` component
|
|
35
|
+
*/
|
|
33
36
|
declare const MainNavigation: ({ items, language, zIndex, languageSelector, search, searchText, searchComponent, minicart, minicartText, minicartComponent, minicartAmount, showMinicart, showLoginTooltip, login, loginText, loginComponent, isLoggedIn, collapseSize, nextJSLinkComponent, ribbon, ribbonData, className, currentUrl, notificationText, }: MainNavigationProps) => React.JSX.Element;
|
|
34
37
|
/** @component */
|
|
35
38
|
export default MainNavigation;
|
|
@@ -113,7 +113,10 @@ const initiateScrollToHeader = (componentRef) => {
|
|
|
113
113
|
window.scrollTo({ top: componentRef.current.offsetTop, left: 0 });
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* @visibleName Main Navigation
|
|
118
|
+
* @deprecated Use `MainHeaderNavigation` component
|
|
119
|
+
*/
|
|
117
120
|
const MainNavigation = ({ items = {}, language = 'fi', zIndex = 1030, languageSelector = false, search = true, searchText = 'Haku', searchComponent = false, minicart = true, minicartText = 'Ostoskori', minicartComponent = false, minicartAmount = 0, showMinicart = false, showLoginTooltip = false, login = true, loginText = 'Kirjaudu', loginComponent, isLoggedIn = false, collapseSize = 767, nextJSLinkComponent = false, ribbon = true, ribbonData, className, currentUrl = '', notificationText = '', }) => {
|
|
118
121
|
const { isMobile } = useWindowSize.default(collapseSize);
|
|
119
122
|
const props = {
|
|
@@ -10,7 +10,7 @@ var styled = require('../../themes/styled.js');
|
|
|
10
10
|
var theme = require('../../themes/theme.js');
|
|
11
11
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
12
12
|
var Box = require('../Box/Box.js');
|
|
13
|
-
var ButtonClose = require('../
|
|
13
|
+
var ButtonClose = require('../ButtonClose/ButtonClose.js');
|
|
14
14
|
var Icon = require('../Icon/Icon.js');
|
|
15
15
|
|
|
16
16
|
const GlobalStyle = styled.createGlobalStyle `
|
|
@@ -7,7 +7,7 @@ var icons = require('@dnanpm/icons');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var styled = require('styled-components');
|
|
9
9
|
var theme = require('../../themes/theme.js');
|
|
10
|
-
var ButtonClose = require('../
|
|
10
|
+
var ButtonClose = require('../ButtonClose/ButtonClose.js');
|
|
11
11
|
var Icon = require('../Icon/Icon.js');
|
|
12
12
|
|
|
13
13
|
const iconsMap = {
|
|
@@ -13,7 +13,7 @@ var styled = require('../../themes/styled.js');
|
|
|
13
13
|
var theme = require('../../themes/theme.js');
|
|
14
14
|
var common = require('../../utils/common.js');
|
|
15
15
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
16
|
-
var ButtonIcon = require('../
|
|
16
|
+
var ButtonIcon = require('../ButtonIcon/ButtonIcon.js');
|
|
17
17
|
var Icon = require('../Icon/Icon.js');
|
|
18
18
|
var PriorityNavigationItem = require('../PriorityNavigationItem/PriorityNavigationItem.js');
|
|
19
19
|
|
|
@@ -64,6 +64,10 @@ const MobileDropdown = styled.default.button `
|
|
|
64
64
|
line-height: ${theme.default.lineHeight.default};
|
|
65
65
|
font-weight: ${theme.default.fontWeight.bold};
|
|
66
66
|
border-bottom: 3px solid ${theme.default.color.default.pink};
|
|
67
|
+
|
|
68
|
+
& svg {
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
}
|
|
67
71
|
`;
|
|
68
72
|
const MobileDropdownContent = styled.default.div `
|
|
69
73
|
display: flex;
|
|
@@ -7,7 +7,7 @@ var icons = require('@dnanpm/icons');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var styled = require('../../themes/styled.js');
|
|
9
9
|
var theme = require('../../themes/theme.js');
|
|
10
|
-
var ButtonIcon = require('../
|
|
10
|
+
var ButtonIcon = require('../ButtonIcon/ButtonIcon.js');
|
|
11
11
|
|
|
12
12
|
const Container = styled.default.div `
|
|
13
13
|
display: flex;
|
|
@@ -8,7 +8,7 @@ var React = require('react');
|
|
|
8
8
|
var styled = require('../../themes/styled.js');
|
|
9
9
|
var theme = require('../../themes/theme.js');
|
|
10
10
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
11
|
-
var ButtonIcon = require('../
|
|
11
|
+
var ButtonIcon = require('../ButtonIcon/ButtonIcon.js');
|
|
12
12
|
|
|
13
13
|
const Container = styled.default.div `
|
|
14
14
|
display: flex;
|
|
@@ -9,7 +9,7 @@ var styled = require('styled-components');
|
|
|
9
9
|
var theme = require('../../themes/theme.js');
|
|
10
10
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
11
11
|
var Box = require('../Box/Box.js');
|
|
12
|
-
var ButtonClose = require('../
|
|
12
|
+
var ButtonClose = require('../ButtonClose/ButtonClose.js');
|
|
13
13
|
var Icon = require('../Icon/Icon.js');
|
|
14
14
|
|
|
15
15
|
const iconsMap = {
|
|
@@ -3,12 +3,13 @@ export { default as AccordionItem } from './AccordionItem/AccordionItem';
|
|
|
3
3
|
export { default as AmountSelector } from './AmountSelector/AmountSelector';
|
|
4
4
|
export { default as Box } from './Box/Box';
|
|
5
5
|
export { default as Button } from './Button/Button';
|
|
6
|
-
export { default as ButtonArrow } from './
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as
|
|
6
|
+
export { default as ButtonArrow } from './ButtonArrow/ButtonArrow';
|
|
7
|
+
export { default as ButtonCard } from './ButtonCard/ButtonCard';
|
|
8
|
+
export { default as ButtonClose } from './ButtonClose/ButtonClose';
|
|
9
|
+
export { default as ButtonIcon } from './ButtonIcon/ButtonIcon';
|
|
10
|
+
export { default as ButtonPrimary } from './ButtonPrimary/ButtonPrimary';
|
|
11
|
+
export { default as ButtonRound } from './ButtonRound/ButtonRound';
|
|
12
|
+
export { default as ButtonSecondary } from './ButtonSecondary/ButtonSecondary';
|
|
12
13
|
export { default as Carousel } from './Carousel/Carousel';
|
|
13
14
|
export { default as Checkbox } from './Checkbox/Checkbox';
|
|
14
15
|
export { default as Chip } from './Chip/Chip';
|
package/build/cjs/index.js
CHANGED
|
@@ -5,12 +5,13 @@ var AccordionItem = require('./components/AccordionItem/AccordionItem.js');
|
|
|
5
5
|
var AmountSelector = require('./components/AmountSelector/AmountSelector.js');
|
|
6
6
|
var Box = require('./components/Box/Box.js');
|
|
7
7
|
var Button = require('./components/Button/Button.js');
|
|
8
|
-
var ButtonArrow = require('./components/
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
8
|
+
var ButtonArrow = require('./components/ButtonArrow/ButtonArrow.js');
|
|
9
|
+
var ButtonCard = require('./components/ButtonCard/ButtonCard.js');
|
|
10
|
+
var ButtonClose = require('./components/ButtonClose/ButtonClose.js');
|
|
11
|
+
var ButtonIcon = require('./components/ButtonIcon/ButtonIcon.js');
|
|
12
|
+
var ButtonPrimary = require('./components/ButtonPrimary/ButtonPrimary.js');
|
|
13
|
+
var ButtonRound = require('./components/ButtonRound/ButtonRound.js');
|
|
14
|
+
var ButtonSecondary = require('./components/ButtonSecondary/ButtonSecondary.js');
|
|
14
15
|
var Carousel = require('./components/Carousel/Carousel.js');
|
|
15
16
|
var Checkbox = require('./components/Checkbox/Checkbox.js');
|
|
16
17
|
var Chip = require('./components/Chip/Chip.js');
|
|
@@ -173,6 +174,7 @@ exports.AmountSelector = AmountSelector.default;
|
|
|
173
174
|
exports.Box = Box.default;
|
|
174
175
|
exports.Button = Button.default;
|
|
175
176
|
exports.ButtonArrow = ButtonArrow.default;
|
|
177
|
+
exports.ButtonCard = ButtonCard.default;
|
|
176
178
|
exports.ButtonClose = ButtonClose.default;
|
|
177
179
|
exports.ButtonIcon = ButtonIcon.default;
|
|
178
180
|
exports.ButtonPrimary = ButtonPrimary.default;
|
|
@@ -4,7 +4,7 @@ import React__default from 'react';
|
|
|
4
4
|
import styled from '../../themes/styled.js';
|
|
5
5
|
import theme from '../../themes/theme.js';
|
|
6
6
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
7
|
-
import ButtonArrow from '../
|
|
7
|
+
import ButtonArrow from '../ButtonArrow/ButtonArrow.js';
|
|
8
8
|
import Icon from '../Icon/Icon.js';
|
|
9
9
|
|
|
10
10
|
const Container = styled.div `
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { Props as ButtonProps } from '
|
|
3
|
+
import type { Props as ButtonProps } from '../Button/Button';
|
|
4
4
|
type ButtonArrowDirection = 'up' | 'right' | 'down' | 'left';
|
|
5
5
|
type ButtonArrowVariant = 'primary' | 'secondary';
|
|
6
6
|
type Props = ({
|
|
@@ -4,9 +4,9 @@ import React__default, { isValidElement } from 'react';
|
|
|
4
4
|
import styled__default from 'styled-components';
|
|
5
5
|
import theme from '../../themes/theme.js';
|
|
6
6
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
7
|
+
import ButtonPrimary from '../ButtonPrimary/ButtonPrimary.js';
|
|
8
|
+
import ButtonSecondary from '../ButtonSecondary/ButtonSecondary.js';
|
|
7
9
|
import Icon from '../Icon/Icon.js';
|
|
8
|
-
import ButtonPrimary from './ButtonPrimary.js';
|
|
9
|
-
import ButtonSecondary from './ButtonSecondary.js';
|
|
10
10
|
|
|
11
11
|
const iconsMap = {
|
|
12
12
|
up: ChevronUp,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type Size = 'small' | 'medium' | 'large';
|
|
4
|
+
type ButtonType = 'submit' | 'button' | 'reset';
|
|
5
|
+
interface Props {
|
|
6
|
+
/**
|
|
7
|
+
* Unique ID for the component
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Name of the button element
|
|
12
|
+
*/
|
|
13
|
+
name?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Allows to change the HTML type of button element. Ignored when `href` is defined
|
|
16
|
+
*
|
|
17
|
+
* @param {ButtonType} submit Button submits the form data
|
|
18
|
+
* @param {ButtonType} button No functionality when pressed
|
|
19
|
+
* @param {ButtonType} reset Button resets all the controls to their initial values
|
|
20
|
+
*
|
|
21
|
+
* @default 'submit'
|
|
22
|
+
*/
|
|
23
|
+
type?: ButtonType;
|
|
24
|
+
/**
|
|
25
|
+
* Allows to change layout of the component based on size
|
|
26
|
+
*
|
|
27
|
+
* @param {Size} small Renders component in compact layout
|
|
28
|
+
* @param {Size} medium Default
|
|
29
|
+
* @param {Size} large Renders component with enlarged title and subtitle
|
|
30
|
+
*
|
|
31
|
+
* @default 'medium'
|
|
32
|
+
*/
|
|
33
|
+
size?: Size;
|
|
34
|
+
/**
|
|
35
|
+
* Allows to change the type of resulting HTML element from button (`<button></button>`) to anchor (`<a href="..."></a>`)
|
|
36
|
+
*/
|
|
37
|
+
href?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Allows to define title
|
|
40
|
+
*/
|
|
41
|
+
title: string;
|
|
42
|
+
/**
|
|
43
|
+
* Allows to define subtitle
|
|
44
|
+
*/
|
|
45
|
+
subtitle?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Allows to define visual content
|
|
48
|
+
*/
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* On button click callback
|
|
52
|
+
*/
|
|
53
|
+
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Allows to change icon from `ChevronRight` to `Open`
|
|
56
|
+
*/
|
|
57
|
+
isExternal?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Allows to pass a custom className
|
|
60
|
+
*/
|
|
61
|
+
className?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Allows to pass testid string for testing purposes
|
|
64
|
+
*/
|
|
65
|
+
'data-testid'?: string;
|
|
66
|
+
}
|
|
67
|
+
/** @visibleName Button Card */
|
|
68
|
+
declare const ButtonCard: ({ type, size, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
69
|
+
/** @component */
|
|
70
|
+
export default ButtonCard;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { Open, ChevronRight } from '@dnanpm/icons';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import styled__default from 'styled-components';
|
|
5
|
+
import theme from '../../themes/theme.js';
|
|
6
|
+
import Box from '../Box/Box.js';
|
|
7
|
+
import Icon from '../Icon/Icon.js';
|
|
8
|
+
|
|
9
|
+
const ButtonCardWrapper = styled__default.button `
|
|
10
|
+
display: block;
|
|
11
|
+
padding: 0;
|
|
12
|
+
border: 0 none;
|
|
13
|
+
width: 100%;
|
|
14
|
+
background-color: transparent;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
font-family: ${theme.fontFamily.default};
|
|
17
|
+
font-size: ${theme.fontSize.default};
|
|
18
|
+
line-height: ${theme.lineHeight.default};
|
|
19
|
+
color: ${theme.color.text.black};
|
|
20
|
+
|
|
21
|
+
&:focus-visible {
|
|
22
|
+
border: 1px solid ${theme.color.focus.light};
|
|
23
|
+
box-shadow: 0px 0px 0px 2px ${theme.color.focus.dark};
|
|
24
|
+
border-radius: ${theme.radius.default};
|
|
25
|
+
outline: none;
|
|
26
|
+
|
|
27
|
+
& > div {
|
|
28
|
+
border: 0 none;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
color: ${theme.color.text.black};
|
|
34
|
+
text-decoration: none;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
const StyledBox = styled__default(Box) `
|
|
38
|
+
display: flex;
|
|
39
|
+
gap: ${({ size }) => (size === 'small' ? '0.313rem' : '1rem')};
|
|
40
|
+
border: 1px solid ${theme.color.line.L03};
|
|
41
|
+
padding: ${({ size }) => (size === 'small' ? '0.625rem' : '1rem')};
|
|
42
|
+
${({ size }) => size === 'small' && 'flex-direction: column'};
|
|
43
|
+
${({ size }) => size !== 'small' && 'align-items: center'};
|
|
44
|
+
`;
|
|
45
|
+
const VisualContent = styled__default.div `
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
width: ${({ size }) => (size === 'small' ? '2.5rem' : '3.75rem')};
|
|
49
|
+
height: ${({ size }) => (size === 'small' ? '2.5rem' : '3.75rem')};
|
|
50
|
+
`;
|
|
51
|
+
const TextContentWrapper = styled__default.div `
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-grow: 1;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
gap: ${({ size }) => (size === 'small' ? '0.625rem' : '1rem')};
|
|
57
|
+
min-width: 0;
|
|
58
|
+
`;
|
|
59
|
+
const TextContent = styled__default.div `
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: flex-start;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
min-width: 0;
|
|
64
|
+
`;
|
|
65
|
+
const Title = styled__default.div `
|
|
66
|
+
font-size: ${theme.fontSize.default};
|
|
67
|
+
line-height: ${theme.lineHeight.default};
|
|
68
|
+
font-weight: ${theme.fontWeight.bold};
|
|
69
|
+
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
max-width: 100%;
|
|
74
|
+
|
|
75
|
+
${({ size }) => size === 'small' &&
|
|
76
|
+
`
|
|
77
|
+
font-size: ${theme.fontSize.s};
|
|
78
|
+
line-height: ${theme.lineHeight.s};
|
|
79
|
+
font-weight: ${theme.fontWeight.medium};
|
|
80
|
+
`}
|
|
81
|
+
|
|
82
|
+
${({ size }) => size === 'large' &&
|
|
83
|
+
`
|
|
84
|
+
font-size: ${theme.fontSize.xl};
|
|
85
|
+
`};
|
|
86
|
+
`;
|
|
87
|
+
const Subtitle = styled__default.div `
|
|
88
|
+
color: ${theme.color.text.gray};
|
|
89
|
+
font-size: ${theme.fontSize.s};
|
|
90
|
+
line-height: ${theme.lineHeight.s};
|
|
91
|
+
font-weight: ${theme.fontWeight.medium};
|
|
92
|
+
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
white-space: nowrap;
|
|
96
|
+
max-width: 100%;
|
|
97
|
+
|
|
98
|
+
${({ size }) => size === 'small' &&
|
|
99
|
+
`
|
|
100
|
+
font-size: ${theme.fontSize.xs};
|
|
101
|
+
line-height: ${theme.lineHeight.xxs};
|
|
102
|
+
`}
|
|
103
|
+
|
|
104
|
+
${({ size }) => size === 'large' &&
|
|
105
|
+
`
|
|
106
|
+
font-size: ${theme.fontSize.default};
|
|
107
|
+
`};
|
|
108
|
+
`;
|
|
109
|
+
const CtaIcon = styled__default(Icon) `
|
|
110
|
+
color: ${theme.color.text.pink};
|
|
111
|
+
|
|
112
|
+
${ButtonCardWrapper}:hover & {
|
|
113
|
+
color: ${theme.color.hover.pink};
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
/** @visibleName Button Card */
|
|
117
|
+
const ButtonCard = (_a) => {
|
|
118
|
+
var { type = 'submit', size = 'medium', 'data-testid': dataTestId } = _a, props = __rest(_a, ["type", "size", 'data-testid']);
|
|
119
|
+
return (React__default.createElement(ButtonCardWrapper, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, className: props.className, "data-testid": dataTestId }, (!props.href && {
|
|
120
|
+
name: props.name,
|
|
121
|
+
})),
|
|
122
|
+
React__default.createElement(StyledBox, { elevation: "low", size: size },
|
|
123
|
+
React__default.createElement(VisualContent, { size: size, "data-testid": dataTestId && `${dataTestId}-content` }, props.children),
|
|
124
|
+
React__default.createElement(TextContentWrapper, { size: size },
|
|
125
|
+
React__default.createElement(TextContent, null,
|
|
126
|
+
React__default.createElement(Title, { size: size, "data-testid": dataTestId && `${dataTestId}-title` }, props.title),
|
|
127
|
+
props.subtitle && (React__default.createElement(Subtitle, { size: size, "data-testid": dataTestId && `${dataTestId}-subtitle` }, props.subtitle))),
|
|
128
|
+
React__default.createElement(CtaIcon, { icon: props.isExternal ? Open : ChevronRight, size: size === 'small' ? '1rem' : '1.5rem', "data-testid": dataTestId && `${dataTestId}-cta` })))));
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { ButtonCard as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Props as ButtonProps } from '
|
|
2
|
+
import type { Props as ButtonProps } from '../Button/Button';
|
|
3
3
|
interface Props extends Pick<ButtonProps, 'id' | 'name' | 'children' | 'onClick' | 'onMouseDown' | 'className' | 'data-testid'> {
|
|
4
4
|
/**
|
|
5
5
|
* Allows to pass aria label for screen readers
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { Props as ButtonProps } from '../Button/Button';
|
|
2
3
|
import type { Props as IconProps } from '../Icon/Icon';
|
|
3
|
-
import type { Props as ButtonProps } from './Button';
|
|
4
4
|
interface Props extends Omit<ButtonProps, 'fullWidth'> {
|
|
5
5
|
/**
|
|
6
6
|
* Icon shown in icon button component
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled__default from 'styled-components';
|
|
2
2
|
import theme from '../../themes/theme.js';
|
|
3
|
-
import Button, { shade } from '
|
|
3
|
+
import Button, { shade } from '../Button/Button.js';
|
|
4
4
|
|
|
5
5
|
/** @visibleName Button Primary */
|
|
6
6
|
const ButtonPrimary = styled__default(Button) `
|
|
@@ -3,7 +3,7 @@ import React__default from 'react';
|
|
|
3
3
|
import styled__default from 'styled-components';
|
|
4
4
|
import theme from '../../themes/theme.js';
|
|
5
5
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
6
|
-
import ButtonPrimary from '
|
|
6
|
+
import ButtonPrimary from '../ButtonPrimary/ButtonPrimary.js';
|
|
7
7
|
|
|
8
8
|
const ButtonElement = styled__default(ButtonPrimary) `
|
|
9
9
|
display: flex;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled__default from 'styled-components';
|
|
2
2
|
import theme from '../../themes/theme.js';
|
|
3
|
-
import Button, { shade } from '
|
|
3
|
+
import Button, { shade } from '../Button/Button.js';
|
|
4
4
|
|
|
5
5
|
/** @visibleName Button Secondary */
|
|
6
6
|
const ButtonSecondary = styled__default(Button) `
|
|
@@ -5,8 +5,8 @@ import useWindowSize from '../../hooks/useWindowSize.js';
|
|
|
5
5
|
import styled from '../../themes/styled.js';
|
|
6
6
|
import theme from '../../themes/theme.js';
|
|
7
7
|
import { media, getMultipliedSize } from '../../utils/styledUtils.js';
|
|
8
|
-
import ButtonArrow from '../
|
|
9
|
-
import ButtonIcon from '../
|
|
8
|
+
import ButtonArrow from '../ButtonArrow/ButtonArrow.js';
|
|
9
|
+
import ButtonIcon from '../ButtonIcon/ButtonIcon.js';
|
|
10
10
|
|
|
11
11
|
const CarouselWrapper = styled.div ``;
|
|
12
12
|
const Header = styled.div `
|
|
@@ -5,7 +5,7 @@ import ReactDatePicker from 'react-datepicker';
|
|
|
5
5
|
import styled__default from 'styled-components';
|
|
6
6
|
import theme from '../../themes/theme.js';
|
|
7
7
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
8
|
-
import ButtonIcon from '../
|
|
8
|
+
import ButtonIcon from '../ButtonIcon/ButtonIcon.js';
|
|
9
9
|
import Input from '../Input/Input.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -4,12 +4,12 @@ import React__default from 'react';
|
|
|
4
4
|
import ReactModal from 'react-modal';
|
|
5
5
|
import styled, { createGlobalStyle } from '../../themes/styled.js';
|
|
6
6
|
import theme from '../../themes/theme.js';
|
|
7
|
+
import getElevationShadow from '../../utils/common.js';
|
|
7
8
|
import { media } from '../../utils/styledUtils.js';
|
|
8
9
|
import Box from '../Box/Box.js';
|
|
9
|
-
import ButtonClose from '../
|
|
10
|
-
import Icon from '../Icon/Icon.js';
|
|
11
|
-
import getElevationShadow from '../../utils/common.js';
|
|
10
|
+
import ButtonClose from '../ButtonClose/ButtonClose.js';
|
|
12
11
|
import Floater from '../Floater/Floater.js';
|
|
12
|
+
import Icon from '../Icon/Icon.js';
|
|
13
13
|
|
|
14
14
|
const sizeMap = {
|
|
15
15
|
small: '375px',
|
|
@@ -3,7 +3,7 @@ import { ChevronUp, ChevronDown, Close } from '@dnanpm/icons';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import styled from '../../themes/styled.js';
|
|
5
5
|
import theme from '../../themes/theme.js';
|
|
6
|
-
import ButtonIcon from '../
|
|
6
|
+
import ButtonIcon from '../ButtonIcon/ButtonIcon.js';
|
|
7
7
|
|
|
8
8
|
const Container = styled.div `
|
|
9
9
|
display: flex;
|
|
@@ -3,7 +3,7 @@ import React__default, { useContext } 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';
|
|
6
|
-
import ButtonIcon from '../../
|
|
6
|
+
import ButtonIcon from '../../ButtonIcon/ButtonIcon.js';
|
|
7
7
|
import Icon from '../../Icon/Icon.js';
|
|
8
8
|
import FooterContext from '../context/FooterContext.js';
|
|
9
9
|
|
|
@@ -4,7 +4,7 @@ import React__default, { useRef, useState, useEffect } from 'react';
|
|
|
4
4
|
import styled from '../../themes/styled.js';
|
|
5
5
|
import theme from '../../themes/theme.js';
|
|
6
6
|
import { getMultipliedSize, getDividedSize } from '../../utils/styledUtils.js';
|
|
7
|
-
import ButtonIcon from '../
|
|
7
|
+
import ButtonIcon from '../ButtonIcon/ButtonIcon.js';
|
|
8
8
|
import Icon from '../Icon/Icon.js';
|
|
9
9
|
import LabelText from '../LabelText/LabelText.js';
|
|
10
10
|
|
|
@@ -7,7 +7,7 @@ import theme from '../../../themes/theme.js';
|
|
|
7
7
|
import { IconContainerMinWidth, navIconSize, navMaxHeight } from '../../../themes/themeComponents/navigation.js';
|
|
8
8
|
import { getMultipliedSize } from '../../../utils/styledUtils.js';
|
|
9
9
|
import Box from '../../Box/Box.js';
|
|
10
|
-
import ButtonPrimary from '../../
|
|
10
|
+
import ButtonPrimary from '../../ButtonPrimary/ButtonPrimary.js';
|
|
11
11
|
import NavContext from '../context/NavContext.js';
|
|
12
12
|
import TooltipWrapper from './MainNavTooltipMenuExportedStyles.js';
|
|
13
13
|
|
|
@@ -29,7 +29,10 @@ export interface MainNavigationProps {
|
|
|
29
29
|
currentUrl?: string;
|
|
30
30
|
notificationText?: string;
|
|
31
31
|
}
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* @visibleName Main Navigation
|
|
34
|
+
* @deprecated Use `MainHeaderNavigation` component
|
|
35
|
+
*/
|
|
33
36
|
declare const MainNavigation: ({ items, language, zIndex, languageSelector, search, searchText, searchComponent, minicart, minicartText, minicartComponent, minicartAmount, showMinicart, showLoginTooltip, login, loginText, loginComponent, isLoggedIn, collapseSize, nextJSLinkComponent, ribbon, ribbonData, className, currentUrl, notificationText, }: MainNavigationProps) => React.JSX.Element;
|
|
34
37
|
/** @component */
|
|
35
38
|
export default MainNavigation;
|
|
@@ -109,7 +109,10 @@ const initiateScrollToHeader = (componentRef) => {
|
|
|
109
109
|
window.scrollTo({ top: componentRef.current.offsetTop, left: 0 });
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* @visibleName Main Navigation
|
|
114
|
+
* @deprecated Use `MainHeaderNavigation` component
|
|
115
|
+
*/
|
|
113
116
|
const MainNavigation = ({ items = {}, language = 'fi', zIndex = 1030, languageSelector = false, search = true, searchText = 'Haku', searchComponent = false, minicart = true, minicartText = 'Ostoskori', minicartComponent = false, minicartAmount = 0, showMinicart = false, showLoginTooltip = false, login = true, loginText = 'Kirjaudu', loginComponent, isLoggedIn = false, collapseSize = 767, nextJSLinkComponent = false, ribbon = true, ribbonData, className, currentUrl = '', notificationText = '', }) => {
|
|
114
117
|
const { isMobile } = useWindowSize(collapseSize);
|
|
115
118
|
const props = {
|
|
@@ -6,7 +6,7 @@ import styled, { createGlobalStyle } from '../../themes/styled.js';
|
|
|
6
6
|
import theme from '../../themes/theme.js';
|
|
7
7
|
import { media, getMultipliedSize } from '../../utils/styledUtils.js';
|
|
8
8
|
import Box from '../Box/Box.js';
|
|
9
|
-
import ButtonClose from '../
|
|
9
|
+
import ButtonClose from '../ButtonClose/ButtonClose.js';
|
|
10
10
|
import Icon from '../Icon/Icon.js';
|
|
11
11
|
|
|
12
12
|
const GlobalStyle = createGlobalStyle `
|
|
@@ -3,7 +3,7 @@ import { Close, Info, Check, Warning, Error } from '@dnanpm/icons';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import styled__default from 'styled-components';
|
|
5
5
|
import theme from '../../themes/theme.js';
|
|
6
|
-
import ButtonClose from '../
|
|
6
|
+
import ButtonClose from '../ButtonClose/ButtonClose.js';
|
|
7
7
|
import Icon from '../Icon/Icon.js';
|
|
8
8
|
|
|
9
9
|
const iconsMap = {
|
|
@@ -9,7 +9,7 @@ import styled from '../../themes/styled.js';
|
|
|
9
9
|
import theme from '../../themes/theme.js';
|
|
10
10
|
import getElevationShadow from '../../utils/common.js';
|
|
11
11
|
import { media, getMultipliedSize } from '../../utils/styledUtils.js';
|
|
12
|
-
import ButtonIcon from '../
|
|
12
|
+
import ButtonIcon from '../ButtonIcon/ButtonIcon.js';
|
|
13
13
|
import Icon from '../Icon/Icon.js';
|
|
14
14
|
import PriorityNavigationItem from '../PriorityNavigationItem/PriorityNavigationItem.js';
|
|
15
15
|
|
|
@@ -60,6 +60,10 @@ const MobileDropdown = styled.button `
|
|
|
60
60
|
line-height: ${theme.lineHeight.default};
|
|
61
61
|
font-weight: ${theme.fontWeight.bold};
|
|
62
62
|
border-bottom: 3px solid ${theme.color.default.pink};
|
|
63
|
+
|
|
64
|
+
& svg {
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
}
|
|
63
67
|
`;
|
|
64
68
|
const MobileDropdownContent = styled.div `
|
|
65
69
|
display: flex;
|
|
@@ -3,7 +3,7 @@ import { ChevronUp, ChevronDown } from '@dnanpm/icons';
|
|
|
3
3
|
import React__default, { useState, useEffect } from 'react';
|
|
4
4
|
import styled from '../../themes/styled.js';
|
|
5
5
|
import theme from '../../themes/theme.js';
|
|
6
|
-
import ButtonIcon from '../
|
|
6
|
+
import ButtonIcon from '../ButtonIcon/ButtonIcon.js';
|
|
7
7
|
|
|
8
8
|
const Container = styled.div `
|
|
9
9
|
display: flex;
|
|
@@ -4,7 +4,7 @@ import React__default, { useRef } from 'react';
|
|
|
4
4
|
import styled from '../../themes/styled.js';
|
|
5
5
|
import theme from '../../themes/theme.js';
|
|
6
6
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
7
|
-
import ButtonIcon from '../
|
|
7
|
+
import ButtonIcon from '../ButtonIcon/ButtonIcon.js';
|
|
8
8
|
|
|
9
9
|
const Container = styled.div `
|
|
10
10
|
display: flex;
|
|
@@ -5,7 +5,7 @@ import styled__default from 'styled-components';
|
|
|
5
5
|
import theme from '../../themes/theme.js';
|
|
6
6
|
import { getMultipliedSize, media } from '../../utils/styledUtils.js';
|
|
7
7
|
import Box from '../Box/Box.js';
|
|
8
|
-
import ButtonClose from '../
|
|
8
|
+
import ButtonClose from '../ButtonClose/ButtonClose.js';
|
|
9
9
|
import Icon from '../Icon/Icon.js';
|
|
10
10
|
|
|
11
11
|
const iconsMap = {
|
|
@@ -3,12 +3,13 @@ export { default as AccordionItem } from './AccordionItem/AccordionItem';
|
|
|
3
3
|
export { default as AmountSelector } from './AmountSelector/AmountSelector';
|
|
4
4
|
export { default as Box } from './Box/Box';
|
|
5
5
|
export { default as Button } from './Button/Button';
|
|
6
|
-
export { default as ButtonArrow } from './
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as
|
|
6
|
+
export { default as ButtonArrow } from './ButtonArrow/ButtonArrow';
|
|
7
|
+
export { default as ButtonCard } from './ButtonCard/ButtonCard';
|
|
8
|
+
export { default as ButtonClose } from './ButtonClose/ButtonClose';
|
|
9
|
+
export { default as ButtonIcon } from './ButtonIcon/ButtonIcon';
|
|
10
|
+
export { default as ButtonPrimary } from './ButtonPrimary/ButtonPrimary';
|
|
11
|
+
export { default as ButtonRound } from './ButtonRound/ButtonRound';
|
|
12
|
+
export { default as ButtonSecondary } from './ButtonSecondary/ButtonSecondary';
|
|
12
13
|
export { default as Carousel } from './Carousel/Carousel';
|
|
13
14
|
export { default as Checkbox } from './Checkbox/Checkbox';
|
|
14
15
|
export { default as Chip } from './Chip/Chip';
|
package/build/es/index.js
CHANGED
|
@@ -3,12 +3,13 @@ export { default as AccordionItem } from './components/AccordionItem/AccordionIt
|
|
|
3
3
|
export { default as AmountSelector } from './components/AmountSelector/AmountSelector.js';
|
|
4
4
|
export { default as Box } from './components/Box/Box.js';
|
|
5
5
|
export { default as Button } from './components/Button/Button.js';
|
|
6
|
-
export { default as ButtonArrow } from './components/
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as
|
|
6
|
+
export { default as ButtonArrow } from './components/ButtonArrow/ButtonArrow.js';
|
|
7
|
+
export { default as ButtonCard } from './components/ButtonCard/ButtonCard.js';
|
|
8
|
+
export { default as ButtonClose } from './components/ButtonClose/ButtonClose.js';
|
|
9
|
+
export { default as ButtonIcon } from './components/ButtonIcon/ButtonIcon.js';
|
|
10
|
+
export { default as ButtonPrimary } from './components/ButtonPrimary/ButtonPrimary.js';
|
|
11
|
+
export { default as ButtonRound } from './components/ButtonRound/ButtonRound.js';
|
|
12
|
+
export { default as ButtonSecondary } from './components/ButtonSecondary/ButtonSecondary.js';
|
|
12
13
|
export { default as Carousel } from './components/Carousel/Carousel.js';
|
|
13
14
|
export { default as Checkbox } from './components/Checkbox/Checkbox.js';
|
|
14
15
|
export { default as Chip } from './components/Chip/Chip.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnanpm/styleguide",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "v3.8.
|
|
4
|
+
"version": "v3.8.3",
|
|
5
5
|
"main": "build/cjs/index.js",
|
|
6
6
|
"module": "build/es/index.js",
|
|
7
7
|
"jsnext:main": "build/es/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"not op_mini all"
|
|
41
41
|
],
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@babel/core": "^7.
|
|
43
|
+
"@babel/core": "^7.26.0",
|
|
44
44
|
"@babel/preset-env": "^7.25.8",
|
|
45
45
|
"@babel/preset-react": "^7.25.9",
|
|
46
46
|
"@babel/preset-typescript": "^7.25.7",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"eslint-plugin-jsdoc": "^39.9.1",
|
|
74
74
|
"eslint-plugin-jsx-a11y": "^6.10.1",
|
|
75
75
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
76
|
-
"eslint-plugin-react": "^7.37.
|
|
76
|
+
"eslint-plugin-react": "^7.37.2",
|
|
77
77
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
78
78
|
"jest": "^29.7.0",
|
|
79
79
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"react-dom": "^18.3.1",
|
|
87
87
|
"react-styleguidist": "^13.1.3",
|
|
88
88
|
"rollup": "^3.29.4",
|
|
89
|
-
"rollup-plugin-import-css": "^3.5.
|
|
89
|
+
"rollup-plugin-import-css": "^3.5.6",
|
|
90
90
|
"style-loader": "^3.3.3",
|
|
91
91
|
"styled-components": "^5.3.11",
|
|
92
92
|
"ts-jest": "^29.2.5",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
107
|
"@dnanpm/icons": "^2.x",
|
|
108
|
-
"react": "
|
|
109
|
-
"react-dom": "
|
|
108
|
+
"react": ">=17.x <=18.x",
|
|
109
|
+
"react-dom": ">=17.x <=18.x",
|
|
110
110
|
"styled-components": "5.x"
|
|
111
111
|
}
|
|
112
112
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|