@dnanpm/styleguide 3.4.0 → 3.5.1
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/build/assets/fonts/fonts.css +129 -129
- package/build/cjs/components/Button/ButtonIcon.js +4 -0
- package/build/cjs/components/DateTimePicker/DateTimePicker.d.ts +12 -0
- package/build/cjs/components/DateTimePicker/DateTimePicker.js +15 -4
- package/build/cjs/components/Notification/Notification.d.ts +1 -0
- package/build/cjs/components/Notification/Notification.js +14 -7
- package/build/cjs/components/PriorityNavigation/PriorityNavigation.d.ts +9 -1
- package/build/cjs/components/PriorityNavigation/PriorityNavigation.js +23 -8
- package/build/cjs/components/PriorityNavigationItem/PriorityNavigationItem.d.ts +11 -3
- package/build/cjs/components/PriorityNavigationItem/PriorityNavigationItem.js +19 -11
- package/build/cjs/components/Textarea/Textarea.d.ts +14 -0
- package/build/cjs/components/Textarea/Textarea.js +7 -2
- package/build/es/build/assets/fonts/fonts.css +129 -129
- package/build/es/components/Button/ButtonIcon.js +4 -0
- package/build/es/components/DateTimePicker/DateTimePicker.d.ts +12 -0
- package/build/es/components/DateTimePicker/DateTimePicker.js +15 -4
- package/build/es/components/Notification/Notification.d.ts +1 -0
- package/build/es/components/Notification/Notification.js +14 -7
- package/build/es/components/PriorityNavigation/PriorityNavigation.d.ts +9 -1
- package/build/es/components/PriorityNavigation/PriorityNavigation.js +25 -10
- package/build/es/components/PriorityNavigationItem/PriorityNavigationItem.d.ts +11 -3
- package/build/es/components/PriorityNavigationItem/PriorityNavigationItem.js +19 -11
- package/build/es/components/Textarea/Textarea.d.ts +14 -0
- package/build/es/components/Textarea/Textarea.js +7 -2
- package/package.json +1 -1
|
@@ -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://
|
|
8
|
-
url('https://
|
|
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://
|
|
17
|
-
url('https://
|
|
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://
|
|
26
|
-
url('https://
|
|
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://
|
|
36
|
-
url('https://
|
|
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://
|
|
45
|
-
url('https://
|
|
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://
|
|
54
|
-
url('https://
|
|
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://
|
|
64
|
-
url('https://
|
|
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://
|
|
74
|
-
url('https://
|
|
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://
|
|
83
|
-
url('https://
|
|
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://
|
|
92
|
-
url('https://
|
|
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://
|
|
101
|
-
url('https://
|
|
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://
|
|
110
|
-
url('https://
|
|
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://
|
|
119
|
-
url('https://
|
|
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://
|
|
128
|
-
url('https://
|
|
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://www.dna.fi/fonts/DNAText-Regular.woff2') format('woff2'),
|
|
8
|
+
url('https://www.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://www.dna.fi/fonts/DNAText-Medium.woff2') format('woff2'),
|
|
17
|
+
url('https://www.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://www.dna.fi/fonts/DNAText-Bold.woff2') format('woff2'),
|
|
26
|
+
url('https://www.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://www.dna.fi/fonts/DNAHeading-DemiBold.woff2') format('woff2'),
|
|
36
|
+
url('https://www.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://www.dna.fi/fonts/DNAHeading-Bold.woff2') format('woff2'),
|
|
45
|
+
url('https://www.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://www.dna.fi/fonts/DNAHeading-Black.woff2') format('woff2'),
|
|
54
|
+
url('https://www.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://www.dna.fi/fonts/DNANumerals-Bold.woff2') format('woff2'),
|
|
64
|
+
url('https://www.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://www.dna.fi/fonts/DNAText-Regular.woff2') format('woff2'),
|
|
74
|
+
url('https://www.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://www.dna.fi/fonts/DNAText-Medium.woff2') format('woff2'),
|
|
83
|
+
url('https://www.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://www.dna.fi/fonts/DNAText-Bold.woff2') format('woff2'),
|
|
92
|
+
url('https://www.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://www.dna.fi/fonts/DNAHeading-DemiBold.woff2') format('woff2'),
|
|
101
|
+
url('https://www.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://www.dna.fi/fonts/DNAHeading-Bold.woff2') format('woff2'),
|
|
110
|
+
url('https://www.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://www.dna.fi/fonts/DNAHeading-Black.woff2') format('woff2'),
|
|
119
|
+
url('https://www.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://www.dna.fi/fonts/DNANumerals-Bold.woff2') format('woff2'),
|
|
128
|
+
url('https://www.dna.fi/fonts/DNANumerals-Bold.woff') format('woff');
|
|
129
|
+
}
|
|
@@ -29,6 +29,10 @@ const ButtonElement = styled__default["default"].button `
|
|
|
29
29
|
border: 2px solid transparent;
|
|
30
30
|
padding: ${styledUtils.getDividedSize(theme["default"].base.baseWidth, 5)} 0;
|
|
31
31
|
|
|
32
|
+
& svg {
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
${({ isReversed }) => isReversed && `flex-direction: row-reverse;`}
|
|
33
37
|
|
|
34
38
|
&:focus {
|
|
@@ -41,6 +41,14 @@ interface Props {
|
|
|
41
41
|
* On input change callback
|
|
42
42
|
*/
|
|
43
43
|
onInputChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Minimum selectable date
|
|
46
|
+
*/
|
|
47
|
+
minDate?: ReactDatePickerProps['minDate'];
|
|
48
|
+
/**
|
|
49
|
+
* Maximum selectable date
|
|
50
|
+
*/
|
|
51
|
+
maxDate?: ReactDatePickerProps['maxDate'];
|
|
44
52
|
/**
|
|
45
53
|
* Allows to define time intervals in time picker
|
|
46
54
|
*
|
|
@@ -69,6 +77,10 @@ interface Props {
|
|
|
69
77
|
* @default false
|
|
70
78
|
*/
|
|
71
79
|
isEditable?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Allows to clear the selected date
|
|
82
|
+
*/
|
|
83
|
+
isClearable?: boolean;
|
|
72
84
|
/**
|
|
73
85
|
* Allows to disable the component functionality
|
|
74
86
|
*
|
|
@@ -57,6 +57,7 @@ const localeData = {
|
|
|
57
57
|
'en-GB': undefined,
|
|
58
58
|
};
|
|
59
59
|
const sentenceCase = (string) => `${string[0].toUpperCase()}${string.slice(1)}`;
|
|
60
|
+
// TODO: change `& .react-datepicker` value back to `1` after z-index of Footer removed
|
|
60
61
|
const Wrapper = styled__default["default"].div `
|
|
61
62
|
position: relative;
|
|
62
63
|
|
|
@@ -67,7 +68,7 @@ const Wrapper = styled__default["default"].div `
|
|
|
67
68
|
border-radius: ${theme["default"].radius.default};
|
|
68
69
|
border: 1px solid ${theme["default"].color.line.L03};
|
|
69
70
|
background-color: ${theme["default"].color.background.white.default};
|
|
70
|
-
z-index:
|
|
71
|
+
z-index: 2;
|
|
71
72
|
|
|
72
73
|
.react-datepicker__aria-live {
|
|
73
74
|
display: none;
|
|
@@ -135,7 +136,17 @@ const Wrapper = styled__default["default"].div `
|
|
|
135
136
|
color: ${theme["default"].color.text.pink};
|
|
136
137
|
font-weight: ${theme["default"].fontWeight.bold};
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
+
&.react-datepicker__day--disabled {
|
|
140
|
+
color: ${theme["default"].color.text.gray + theme["default"].color.transparency.T40};
|
|
141
|
+
font-weight: ${theme["default"].fontWeight.book};
|
|
142
|
+
&:hover {
|
|
143
|
+
cursor: default;
|
|
144
|
+
color: ${theme["default"].color.text.gray + theme["default"].color.transparency.T40};
|
|
145
|
+
font-weight: ${theme["default"].fontWeight.book};
|
|
146
|
+
background-color: transparent;
|
|
147
|
+
border: 1px solid transparent;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
139
150
|
&.react-datepicker__day--in-selecting-range {
|
|
140
151
|
color: ${theme["default"].color.text.white};
|
|
141
152
|
font-weight: ${theme["default"].fontWeight.bold};
|
|
@@ -271,8 +282,8 @@ const DateTimePicker = (_a) => {
|
|
|
271
282
|
.join(' - ');
|
|
272
283
|
const getDateTimePickerCustomHeader = (args) => DateTimePickerCustomHeader(Object.assign(Object.assign({}, args), { locale }));
|
|
273
284
|
return (React__default["default"].createElement(Wrapper, { id: props.id, className: props.className, "data-testid": dataTestId },
|
|
274
|
-
React__default["default"].createElement(Input["default"], { id: `datetimepicker-input-${props.id}`, name: `datetimepicker-input-${props.id}`, label: props.label, placeholder: props.placeholder, value: formatInputValue, onFocus: handleOnInputFocus, onChange: handleOnInputChange, onKeyDown: handleOnKeyDown, onClearableButtonClick: handleClearable, className: "react-datepicker-ignore-onclickoutside", "data-testid": dataTestId && `${dataTestId}-datetimepicker-input`, disabled: props.isDisabled, required: props.isRequired, readonly: !props.isEditable, status: props.isInError ? 'error' : undefined, errorMessage: props.errorMessage }),
|
|
275
|
-
showReactDatePicker && (React__default["default"].createElement(ReactDatePicker__default["default"], { inline: true, selected: startDate, startDate: startDate, endDate: props.endDate, onChange: handleOnReactDatePickerChange, selectsRange: props.endDate !== undefined, showTimeSelect: props.endDate === undefined && isTimePicker, showTimeSelectOnly: props.endDate === undefined && !isDatePicker && isTimePicker, timeCaption: (_b = localeData[locale]) === null || _b === void 0 ? void 0 : _b.localize.timeCaption, timeIntervals: timeInterval, onClickOutside: handleOnReactDatePickerClickOutside, locale: localeData[locale],
|
|
285
|
+
React__default["default"].createElement(Input["default"], { id: `datetimepicker-input-${props.id}`, name: `datetimepicker-input-${props.id}`, label: props.label, placeholder: props.placeholder, value: formatInputValue, onFocus: handleOnInputFocus, onChange: handleOnInputChange, onKeyDown: handleOnKeyDown, onClearableButtonClick: props.isClearable ? handleClearable : undefined, className: "react-datepicker-ignore-onclickoutside", "data-testid": dataTestId && `${dataTestId}-datetimepicker-input`, disabled: props.isDisabled, required: props.isRequired, readonly: !props.isEditable, status: props.isInError ? 'error' : undefined, errorMessage: props.errorMessage }),
|
|
286
|
+
showReactDatePicker && (React__default["default"].createElement(ReactDatePicker__default["default"], { inline: true, selected: startDate, startDate: startDate, maxDate: props.maxDate, minDate: props.minDate, endDate: props.endDate, onChange: handleOnReactDatePickerChange, selectsRange: props.endDate !== undefined, showTimeSelect: props.endDate === undefined && isTimePicker, showTimeSelectOnly: props.endDate === undefined && !isDatePicker && isTimePicker, timeCaption: (_b = localeData[locale]) === null || _b === void 0 ? void 0 : _b.localize.timeCaption, timeIntervals: timeInterval, onClickOutside: handleOnReactDatePickerClickOutside, locale: localeData[locale],
|
|
276
287
|
// Used to format the date/time in internal ReactDatePicker input
|
|
277
288
|
// Currently ignored as date/time is shown in Styleguide Input instead, and formatted by using Intl.DateTimeFormat
|
|
278
289
|
dateFormat: [isDatePicker && 'P', isTimePicker && 'p'].filter(Boolean).join(''), renderCustomHeader: getDateTimePickerCustomHeader }))));
|
|
@@ -7,7 +7,6 @@ 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 styledUtils = require('../../utils/styledUtils.js');
|
|
11
10
|
var ButtonClose = require('../Button/ButtonClose.js');
|
|
12
11
|
var Icon = require('../Icon/Icon.js');
|
|
13
12
|
|
|
@@ -24,26 +23,34 @@ const iconsMap = {
|
|
|
24
23
|
};
|
|
25
24
|
const NotificationWrapper = styled__default["default"].div `
|
|
26
25
|
display: flex;
|
|
27
|
-
|
|
28
|
-
padding: ${styledUtils.getMultipliedSize(theme["default"].base.baseHeight, 1)}
|
|
29
|
-
${styledUtils.getMultipliedSize(theme["default"].base.baseHeight, 2)};
|
|
26
|
+
gap: 1rem;
|
|
30
27
|
line-height: ${theme["default"].lineHeight.default};
|
|
31
28
|
color: ${theme["default"].color.text.black};
|
|
32
29
|
background-color: ${theme["default"].color.background.white.default};
|
|
33
30
|
border-radius: ${theme["default"].radius.s};
|
|
34
31
|
border: 2px solid ${({ $type }) => theme["default"].color.notification[$type]};
|
|
35
32
|
`;
|
|
33
|
+
const IconWrapper = styled__default["default"].div `
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
padding: 0.5rem;
|
|
37
|
+
background-color: ${({ $type }) => theme["default"].color.notification[$type]};
|
|
38
|
+
`;
|
|
36
39
|
const ContentWrapper = styled__default["default"].span `
|
|
37
|
-
margin: 0
|
|
40
|
+
margin: auto 0;
|
|
41
|
+
padding: 0.5rem 0;
|
|
42
|
+
width: 100%;
|
|
38
43
|
`;
|
|
39
44
|
const ButtonCloseStyled = styled__default["default"](ButtonClose["default"]) `
|
|
40
45
|
position: static;
|
|
41
|
-
margin:
|
|
46
|
+
margin: auto 0.5rem;
|
|
42
47
|
`;
|
|
48
|
+
/** @visibleName Notification */
|
|
43
49
|
const Notification = (_a) => {
|
|
44
50
|
var { type = 'info', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["type", 'data-testid']);
|
|
45
51
|
return !props.dismissed ? (React__default["default"].createElement(NotificationWrapper, { "$type": type, className: props.className, "data-testid": dataTestId },
|
|
46
|
-
React__default["default"].createElement(
|
|
52
|
+
React__default["default"].createElement(IconWrapper, { "$type": type },
|
|
53
|
+
React__default["default"].createElement(Icon["default"], { icon: iconsMap[type], size: "2rem", color: theme["default"].color.default.white })),
|
|
47
54
|
React__default["default"].createElement(ContentWrapper, null, props.children),
|
|
48
55
|
props.closeButton && (React__default["default"].createElement(ButtonCloseStyled, { onClick: props.onClickCloseButton },
|
|
49
56
|
React__default["default"].createElement(Icon["default"], { icon: icons.Close, color: "currentColor" }))))) : null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface Props {
|
|
4
4
|
/**
|
|
@@ -9,6 +9,14 @@ interface Props {
|
|
|
9
9
|
* Content of the component
|
|
10
10
|
*/
|
|
11
11
|
children?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Allows to pass common mouse click callback to all children
|
|
14
|
+
*/
|
|
15
|
+
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Allows to pass common keyboard key down callback to all children
|
|
18
|
+
*/
|
|
19
|
+
onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;
|
|
12
20
|
/**
|
|
13
21
|
* Allows to define aria-label attribute for nav HTML element
|
|
14
22
|
*/
|
|
@@ -103,11 +103,15 @@ const DropdownList = styled["default"](CoreULStyles) `
|
|
|
103
103
|
${common["default"]({ elevation: 'low' })}
|
|
104
104
|
`;
|
|
105
105
|
const reducer = (state, action) => {
|
|
106
|
-
var _a;
|
|
106
|
+
var _a, _b;
|
|
107
107
|
switch (action.type) {
|
|
108
|
+
case 'resetNavigationState': {
|
|
109
|
+
const navigationItems = React.Children.toArray((_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.navigationItems);
|
|
110
|
+
return Object.assign(Object.assign({}, state), { navigationItems: navigationItems.slice(0, navigationItems.length - state.lastItemWidth.length), dropdownItems: navigationItems.slice(navigationItems.length - state.lastItemWidth.length) });
|
|
111
|
+
}
|
|
108
112
|
case 'moveItemToDropdown': {
|
|
109
113
|
const lastChild = state.navigationItems[state.navigationItems.length - 1];
|
|
110
|
-
return Object.assign(Object.assign(Object.assign({}, state), { navigationItems: state.navigationItems.slice(0, -1), dropdownItems: [lastChild, ...state.dropdownItems] }), (((
|
|
114
|
+
return Object.assign(Object.assign(Object.assign({}, state), { navigationItems: state.navigationItems.slice(0, -1), dropdownItems: [lastChild, ...state.dropdownItems] }), (((_b = action === null || action === void 0 ? void 0 : action.payload) === null || _b === void 0 ? void 0 : _b.lastItem) && {
|
|
111
115
|
lastItemWidth: [...state.lastItemWidth, action.payload.lastItem.clientWidth],
|
|
112
116
|
}));
|
|
113
117
|
}
|
|
@@ -164,7 +168,7 @@ const PriorityNavigation = (_a) => {
|
|
|
164
168
|
const toggleDropdown = () => setIsDropdownOpen(!isDropdownOpen);
|
|
165
169
|
const navigationItems = React.useRef(new Map()).current;
|
|
166
170
|
const initialState = {
|
|
167
|
-
navigationItems: props.children,
|
|
171
|
+
navigationItems: React.Children.toArray(props.children),
|
|
168
172
|
dropdownItems: [],
|
|
169
173
|
lastItemWidth: [],
|
|
170
174
|
};
|
|
@@ -197,6 +201,9 @@ const PriorityNavigation = (_a) => {
|
|
|
197
201
|
child.type === PriorityNavigationItem["default"] &&
|
|
198
202
|
child.props.isActive));
|
|
199
203
|
useOutsideClick["default"](listsContainerRef, () => {
|
|
204
|
+
if (isMobileNavigationOpen) {
|
|
205
|
+
setIsMobileNavigationOpen(false);
|
|
206
|
+
}
|
|
200
207
|
if (isDropdownOpen) {
|
|
201
208
|
setIsDropdownOpen(false);
|
|
202
209
|
}
|
|
@@ -212,16 +219,24 @@ const PriorityNavigation = (_a) => {
|
|
|
212
219
|
checkHorizontalOverflow,
|
|
213
220
|
isMobile,
|
|
214
221
|
]);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
222
|
+
React.useEffect(() => {
|
|
223
|
+
dispatch({
|
|
224
|
+
type: 'resetNavigationState',
|
|
225
|
+
payload: {
|
|
226
|
+
navigationItems: props.children,
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
setIsMobileNavigationOpen(false);
|
|
230
|
+
}, [props.children]);
|
|
219
231
|
return (React__default["default"].createElement(Container, { id: props.id, "aria-label": props.navigationLabel, className: props.className, "data-testid": dataTestId },
|
|
220
232
|
React__default["default"].createElement(ListsContainer, { ref: listsContainerRef },
|
|
221
233
|
isMobile && selectedItem && (React__default["default"].createElement(MobileDropdown, { onClick: toggleMobileNavigation },
|
|
222
234
|
selectedItem,
|
|
223
235
|
React__default["default"].createElement(Icon["default"], { icon: isMobileNavigationOpen ? icons.ChevronUp : icons.ChevronDown }))),
|
|
224
|
-
React__default["default"].createElement(NavigationList, { ref: navigationListRef, isMobileNavigationOpen: isMobileNavigationOpen },
|
|
236
|
+
React__default["default"].createElement(NavigationList, { ref: navigationListRef, isMobileNavigationOpen: isMobileNavigationOpen }, React.Children.map([...state.navigationItems, ...(isMobile ? state.dropdownItems : [])], (navigationItem, index) => React.isValidElement(navigationItem) &&
|
|
237
|
+
navigationItem.type === PriorityNavigationItem["default"] && (React__default["default"].createElement(PriorityNavigationItem["default"], { id: navigationItem.props.id, key: navigationItem.key, onClick: navigationItem.props.onClick || props.onClick, onKeyDown: navigationItem.props.onKeyDown || props.onKeyDown, isActive: navigationItem.props.isActive, className: navigationItem.props.className, "data-testid": navigationItem.props['data-testid'], innerRef: instance => instance && navigationItems.set(index, instance) },
|
|
238
|
+
navigationItem.props.children,
|
|
239
|
+
navigationItem.props.isActive && isMobile && (React__default["default"].createElement(Icon["default"], { icon: icons.Check, color: theme["default"].color.default.pink })))))),
|
|
225
240
|
!isMobile && Boolean(state.dropdownItems.length) && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
226
241
|
React__default["default"].createElement(ButtonIcon["default"], { onClick: toggleDropdown, icon: isDropdownOpen ? icons.ChevronUp : icons.ChevronDown, isReversed: true }, dropdownButtonLabel),
|
|
227
242
|
React__default["default"].createElement(DropdownList, { isDropdownOpen: isDropdownOpen }, state.dropdownItems))))));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode, RefObject } from 'react';
|
|
1
|
+
import type { KeyboardEvent, MouseEvent, ReactNode, RefObject } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface Props {
|
|
4
4
|
/**
|
|
@@ -10,13 +10,21 @@ export interface Props {
|
|
|
10
10
|
*/
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* On component mouse click callback
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
16
|
+
/**
|
|
17
|
+
* On component keyboard key down callback
|
|
18
|
+
*/
|
|
19
|
+
onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;
|
|
16
20
|
/**
|
|
17
21
|
* Allows to set component as active
|
|
18
22
|
*/
|
|
19
23
|
isActive?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* A ref object, or a ref callback function
|
|
26
|
+
*/
|
|
27
|
+
innerRef?: RefObject<HTMLLIElement> | ((instance: HTMLLIElement | null) => void) | null;
|
|
20
28
|
/**
|
|
21
29
|
* Allows to pass a custom className
|
|
22
30
|
*/
|
|
@@ -21,6 +21,20 @@ const Element = styled["default"].li `
|
|
|
21
21
|
padding: 1rem 1.25rem;
|
|
22
22
|
flex-shrink: 0;
|
|
23
23
|
|
|
24
|
+
${({ onClick }) => onClick &&
|
|
25
|
+
`
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
`};
|
|
28
|
+
|
|
29
|
+
&:focus-within {
|
|
30
|
+
& > * {
|
|
31
|
+
border-radius: ${theme["default"].radius.s};
|
|
32
|
+
border: 2px solid ${theme["default"].color.focus.light};
|
|
33
|
+
box-shadow: 0px 0px 0px 2px ${theme["default"].color.focus.dark};
|
|
34
|
+
outline: none;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
24
38
|
${({ isActive }) => styledUtils.media.md `
|
|
25
39
|
justify-content: center;
|
|
26
40
|
padding: 1rem 0;
|
|
@@ -29,26 +43,20 @@ const Element = styled["default"].li `
|
|
|
29
43
|
border-bottom: 3px solid ${isActive ? theme["default"].color.text.pink : 'transparent'};
|
|
30
44
|
`}
|
|
31
45
|
|
|
32
|
-
&
|
|
46
|
+
& > * {
|
|
33
47
|
display: block;
|
|
34
48
|
color: ${({ isActive }) => (isActive ? theme["default"].color.text.pink : theme["default"].color.text.black)};
|
|
35
49
|
${({ isActive }) => isActive && `font-weight: ${theme["default"].fontWeight.bold}`};
|
|
36
50
|
border: 2px solid transparent;
|
|
37
51
|
|
|
38
|
-
&:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
box-shadow: 0px 0px 0px 2px ${theme["default"].color.focus.dark};
|
|
42
|
-
outline: none;
|
|
52
|
+
&:hover {
|
|
53
|
+
color: ${theme["default"].color.hover.pink};
|
|
54
|
+
text-decoration: none;
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
${styledUtils.media.md `
|
|
46
58
|
margin: auto;
|
|
47
59
|
`}
|
|
48
|
-
|
|
49
|
-
&:hover {
|
|
50
|
-
color: ${theme["default"].color.hover.pink};
|
|
51
|
-
}
|
|
52
60
|
}
|
|
53
61
|
`;
|
|
54
62
|
/**
|
|
@@ -56,7 +64,7 @@ const Element = styled["default"].li `
|
|
|
56
64
|
*/
|
|
57
65
|
const PriorityNavigationItem = (_a) => {
|
|
58
66
|
var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
|
|
59
|
-
return (React__default["default"].createElement(Element, { id: props.id, ref: props.innerRef, isActive: props.isActive, className: props.className, "data-testid": dataTestId }, props.children));
|
|
67
|
+
return (React__default["default"].createElement(Element, { id: props.id, ref: props.innerRef, onClick: props.onClick, onKeyDown: props.onKeyDown, isActive: props.isActive, className: props.className, "data-testid": dataTestId }, props.children));
|
|
60
68
|
};
|
|
61
69
|
|
|
62
70
|
exports["default"] = PriorityNavigationItem;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ChangeEvent, FocusEvent, KeyboardEvent } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
type InputStatus = 'none' | 'success' | 'error' | 'comment';
|
|
3
4
|
interface Props {
|
|
4
5
|
/**
|
|
5
6
|
* Unique ID for the input element
|
|
@@ -67,6 +68,19 @@ interface Props {
|
|
|
67
68
|
* @default 3
|
|
68
69
|
*/
|
|
69
70
|
height?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Depending on the passed status, the styling changes and additional elements are shown
|
|
73
|
+
*
|
|
74
|
+
* @param {InputStatus} none Default styling
|
|
75
|
+
* @param {InputStatus} success Displays `success` icon with `theme.color.notification.success` color in the input element
|
|
76
|
+
* @param {InputStatus} error Displays `error` icon with `theme.color.notification.error` color in the input element and error message underneath the input
|
|
77
|
+
* @param {InputStatus} comment Displays comment message underneath the input
|
|
78
|
+
*/
|
|
79
|
+
status?: InputStatus;
|
|
80
|
+
/**
|
|
81
|
+
* Text of the error message when textarea is in error state
|
|
82
|
+
*/
|
|
83
|
+
errorMessage?: string;
|
|
70
84
|
/**
|
|
71
85
|
* Allows to pass a custom className
|
|
72
86
|
*/
|
|
@@ -57,6 +57,10 @@ const Message = styled["default"].div `
|
|
|
57
57
|
color: ${theme["default"].color.text.gray};
|
|
58
58
|
margin-top: ${styledUtils.getMultipliedSize(theme["default"].base.baseHeight, 0.5)};
|
|
59
59
|
`;
|
|
60
|
+
const ErrorMessage = styled["default"](Message) `
|
|
61
|
+
font-weight: ${theme["default"].fontWeight.medium};
|
|
62
|
+
color: ${theme["default"].color.notification.error};
|
|
63
|
+
`;
|
|
60
64
|
const Textarea = (_a) => {
|
|
61
65
|
var { height = 3, 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["height", 'data-testid']);
|
|
62
66
|
const inputRef = React.useRef(null);
|
|
@@ -77,9 +81,10 @@ const Textarea = (_a) => {
|
|
|
77
81
|
}
|
|
78
82
|
};
|
|
79
83
|
return (React__default["default"].createElement(FieldContainer, { className: props.className },
|
|
80
|
-
props.label && (React__default["default"].createElement(LabelText["default"], { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label`, isMandatory: props.required }, props.label)),
|
|
84
|
+
props.label && (React__default["default"].createElement(LabelText["default"], { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label`, status: props.status === 'error' ? props.status : undefined, isMandatory: props.required }, props.label)),
|
|
81
85
|
React__default["default"].createElement(StyledTextarea, { id: props.id, name: props.name, ref: inputRef, value: props.value, rows: height, placeholder: props.placeholder, tabIndex: props.tabIndex, onChange: handleChange, onBlur: handleOnBlur, onFocus: props.onFocus, onClick: onClick, onKeyDown: props.onKeyDown, onKeyPress: props.onKeyPress, required: props.required, disabled: props.disabled, "aria-disabled": props.disabled, "aria-label": props.id, "data-testid": dataTestId }),
|
|
82
|
-
props.commentMessage && (React__default["default"].createElement(Message, { "data-testid": dataTestId && `${dataTestId}-comment` }, props.commentMessage))
|
|
86
|
+
props.commentMessage && (React__default["default"].createElement(Message, { "data-testid": dataTestId && `${dataTestId}-comment` }, props.commentMessage)),
|
|
87
|
+
props.status === 'error' && props.errorMessage && (React__default["default"].createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error` }, props.errorMessage))));
|
|
83
88
|
};
|
|
84
89
|
|
|
85
90
|
exports["default"] = Textarea;
|