@dvrd/dvr-controls 1.0.14 → 1.0.16
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/index.ts +8 -1
- package/package.json +29 -23
- package/src/js/button/button.tsx +102 -0
- package/src/js/button/buttonController.tsx +179 -0
- package/src/js/button/closeButton.tsx +29 -0
- package/src/js/button/dvrdButton.tsx +128 -0
- package/src/js/button/outlinedButton.tsx +105 -0
- package/src/js/button/simpleButton.tsx +163 -0
- package/src/js/button/style/button.scss +95 -0
- package/src/js/button/style/closeButton.scss +15 -0
- package/src/js/button/style/dvrdButton.scss +30 -0
- package/src/js/button/style/outlinedButton.scss +84 -0
- package/src/js/button/style/simpleButton.scss +80 -0
- package/src/js/carousel/DVRCarousel.tsx +163 -0
- package/src/js/carousel/DVRCarouselController.tsx +95 -0
- package/src/js/carousel/style/DVRCarousel.scss +38 -0
- package/src/js/checkbox/checkbox.tsx +148 -0
- package/src/js/checkbox/checkboxController.tsx +131 -0
- package/src/js/checkbox/style/checkbox.scss +109 -0
- package/src/js/colorPicker/colorPicker.tsx +118 -0
- package/src/js/colorPicker/style/colorPicker.scss +20 -0
- package/src/js/date/dvrdDatePicker.tsx +357 -0
- package/src/js/date/style/dvrdDatePicker.scss +307 -0
- package/src/js/dialog/dialog.tsx +207 -0
- package/src/js/dialog/dialogController.tsx +70 -0
- package/src/js/dialog/inlineDialog.tsx +127 -0
- package/src/js/dialog/style/dialog.scss +61 -0
- package/src/js/events/withEvents.tsx +40 -0
- package/src/js/head/DVRHead.tsx +49 -0
- package/src/js/header/DVRHeader.tsx +417 -0
- package/src/js/header/style/header.scss +206 -0
- package/src/js/icon/awesomeIcon.tsx +20 -0
- package/src/js/image/imageUpload.tsx +69 -0
- package/src/js/image/style/imageUpload.scss +11 -0
- package/src/js/info/info.tsx +136 -0
- package/src/js/info/style/info.scss +39 -0
- package/src/js/input/animated/animatedTextField.tsx +159 -0
- package/src/js/input/date/dateField.tsx +360 -0
- package/src/js/input/date/dateFieldController.tsx +245 -0
- package/src/js/input/date/datePicker/datePicker.tsx +186 -0
- package/src/js/input/date/datePicker/style/datePicker.scss +102 -0
- package/src/js/input/date/input/dateInput.tsx +214 -0
- package/src/js/input/date/style/dateField.scss +40 -0
- package/src/js/input/date/timePicker/style/timePicker.scss +95 -0
- package/src/js/input/date/timePicker/timePicker.tsx +143 -0
- package/src/js/input/editor/DVREditor.tsx +21 -0
- package/src/js/input/number/numberInput.tsx +157 -0
- package/src/js/input/password/passwordInput.tsx +140 -0
- package/src/js/input/password/passwordRules.tsx +48 -0
- package/src/js/input/password/style/passwordInput.scss +39 -0
- package/src/js/input/password/style/passwordRules.scss +41 -0
- package/src/js/input/simple/style/simpleInput.scss +98 -0
- package/src/js/input/simple/v2/simpleInputV2.tsx +178 -0
- package/src/js/input/style/input.scss +138 -0
- package/src/js/input/v2/inputController_v2.tsx +250 -0
- package/src/js/input/v2/input_v2.tsx +7 -0
- package/src/js/label/label.tsx +196 -0
- package/src/js/label/style/label.scss +4 -0
- package/src/js/link/link.tsx +38 -0
- package/src/js/link/style/link.scss +30 -0
- package/src/js/loader/loader.tsx +79 -0
- package/src/js/loader/loaderController.tsx +61 -0
- package/src/js/loader/style/loader.scss +53 -0
- package/src/js/media/media.tsx +72 -0
- package/src/js/navigator/navigator.tsx +51 -0
- package/src/js/optionsList/dvrdOptionsList.tsx +112 -0
- package/src/js/optionsList/style/dvrdOptionsList.scss +84 -0
- package/src/js/optionsMenu/optionsMenu.tsx +187 -0
- package/src/js/optionsMenu/style/optionsMenu.scss +70 -0
- package/src/js/pdf/element/pdfElement.tsx +315 -0
- package/src/js/pdf/element/style/pdfElement.scss +111 -0
- package/src/js/pdf/history/pdfHistory.ts +57 -0
- package/src/js/pdf/image/pdfImage.tsx +175 -0
- package/src/js/pdf/image/style/pdfImage.scss +34 -0
- package/src/js/pdf/invoiceTable/pdfInvoiceTable.tsx +176 -0
- package/src/js/pdf/invoiceTable/style/pdfInvoiceTable.scss +32 -0
- package/src/js/pdf/pdfTemplateCreator.tsx +279 -0
- package/src/js/pdf/settings/buttons/iconButton.tsx +49 -0
- package/src/js/pdf/settings/buttons/style/iconButton.scss +50 -0
- package/src/js/pdf/settings/image/pdfImageSettings.tsx +82 -0
- package/src/js/pdf/settings/image/style/pdfImageSettings.scss +9 -0
- package/src/js/pdf/settings/invoiceTable/pdfInvoiceTableSettings.tsx +141 -0
- package/src/js/pdf/settings/invoiceTable/style/pdfInvoiceTableSettings.scss +38 -0
- package/src/js/pdf/settings/pdfElementSettings.tsx +86 -0
- package/src/js/pdf/settings/style/pdfElementSettings.scss +56 -0
- package/src/js/pdf/settings/text/pdfTextSettings.tsx +202 -0
- package/src/js/pdf/settings/text/style/pdfTextSettings.scss +94 -0
- package/src/js/pdf/style/pdfTemplateCreator.scss +118 -0
- package/src/js/pdf/text/pdfText.tsx +267 -0
- package/src/js/pdf/text/style/pdfText.scss +22 -0
- package/src/js/pdf/v2/pdfElement/pdfDraggableElement.tsx +193 -0
- package/src/js/pdf/v2/types/pdfTemplateTypes.ts +27 -0
- package/src/js/popup/style/withBackground.scss +29 -0
- package/src/js/popup/withBackground.tsx +92 -0
- package/src/js/select/async/asyncSelect.tsx +46 -0
- package/src/js/select/async/style/asyncSelect.scss +23 -0
- package/src/js/select/dvrdSelect.tsx +214 -0
- package/src/js/select/dvrdSelectController.tsx +81 -0
- package/src/js/select/select.tsx +310 -0
- package/src/js/select/selectController.tsx +341 -0
- package/src/js/select/style/dvrdSelect.scss +140 -0
- package/src/js/select/style/select.scss +199 -0
- package/src/js/sidebarMenu/sidebarMenu.tsx +167 -0
- package/src/js/sidebarMenu/style/sidebarMenu.scss +167 -0
- package/src/js/slider/DVRSlider.tsx +107 -0
- package/src/js/slider/style/DVRSlider.scss +88 -0
- package/src/js/snackbar/snackbar.tsx +72 -0
- package/src/js/snackbar/snackbarController.tsx +104 -0
- package/src/js/snackbar/style/snackbar.scss +46 -0
- package/src/js/switch/dvrdSwitch.tsx +53 -0
- package/src/js/switch/style/dvrdSwitch.scss +47 -0
- package/src/js/switch/style/switch.scss +84 -0
- package/src/js/switch/switch.tsx +115 -0
- package/src/js/switch/switchController.tsx +97 -0
- package/src/js/textField/dvrdInput.tsx +219 -0
- package/src/js/textField/dvrdInputController.tsx +97 -0
- package/src/js/textField/dvrdNumberInput.tsx +141 -0
- package/src/js/textField/dvrdPasswordInput.tsx +40 -0
- package/src/js/textField/style/dvrdInput.scss +114 -0
- package/src/js/textField/style/dvrdPassword.scss +15 -0
- package/src/js/topButton/style/topButton.scss +54 -0
- package/src/js/topButton/topButton.tsx +136 -0
- package/src/js/util/analyticsUtil.ts +41 -0
- package/src/js/util/colorUtil.ts +230 -0
- package/src/js/util/componentUtil.tsx +59 -0
- package/src/js/util/constants.ts +12 -0
- package/src/js/util/controlContext.tsx +46 -0
- package/src/js/util/controlUtil.ts +107 -0
- package/src/js/util/cookieUtil.ts +17 -0
- package/src/js/util/eventUtil.ts +65 -0
- package/src/js/util/googleUtil.ts +88 -0
- package/src/js/util/interfaces.ts +180 -0
- package/src/js/util/jwtUtil.ts +72 -0
- package/src/js/util/miscUtil.ts +170 -0
- package/src/js/util/momentUtil.ts +45 -0
- package/src/js/util/pdfUtil.ts +124 -0
- package/src/js/util/requestUtil.ts +145 -0
- package/src/js/util/responsiveUtil.ts +37 -0
- package/src/js/util/validationUtil.ts +13 -0
- package/src/res/img/lock-handle.png +0 -0
- package/src/res/img/lock-handle.webp +0 -0
- package/src/res/img/lock.png +0 -0
- package/src/res/img/lock.webp +0 -0
- package/src/style/common-icons-variables.scss +140 -0
- package/src/style/common-icons.scss +714 -0
- package/src/style/common-variables.scss +243 -0
- package/src/style/display-breakpoints.scss +141 -0
- package/src/style/fonts/common-icons.eot +0 -0
- package/src/style/fonts/common-icons.svg +150 -0
- package/src/style/fonts/common-icons.ttf +0 -0
- package/src/style/fonts/common-icons.woff +0 -0
- package/src/style/fonts/common-icons.woff2 +0 -0
- package/src/style/fonts/fontAwesome/css/all.css +7003 -0
- package/src/style/fonts/fontAwesome/css/all.min.css +6 -0
- package/src/style/fonts/fontAwesome/css/brands.css +1423 -0
- package/src/style/fonts/fontAwesome/css/brands.min.css +6 -0
- package/src/style/fonts/fontAwesome/css/fontawesome.css +5519 -0
- package/src/style/fonts/fontAwesome/css/fontawesome.min.css +6 -0
- package/src/style/fonts/fontAwesome/css/regular.css +19 -0
- package/src/style/fonts/fontAwesome/css/regular.min.css +6 -0
- package/src/style/fonts/fontAwesome/css/solid.css +19 -0
- package/src/style/fonts/fontAwesome/css/solid.min.css +6 -0
- package/src/style/fonts/fontAwesome/css/svg-with-js.css +634 -0
- package/src/style/fonts/fontAwesome/css/svg-with-js.min.css +6 -0
- package/src/style/fonts/fontAwesome/css/v4-font-face.css +26 -0
- package/src/style/fonts/fontAwesome/css/v4-font-face.min.css +6 -0
- package/src/style/fonts/fontAwesome/css/v4-shims.css +2146 -0
- package/src/style/fonts/fontAwesome/css/v4-shims.min.css +6 -0
- package/src/style/fonts/fontAwesome/css/v5-font-face.css +22 -0
- package/src/style/fonts/fontAwesome/css/v5-font-face.min.css +6 -0
- package/src/style/fonts/fontAwesome/webfonts/fa-brands-400.ttf +0 -0
- package/src/style/fonts/fontAwesome/webfonts/fa-brands-400.woff2 +0 -0
- package/src/style/fonts/fontAwesome/webfonts/fa-regular-400.ttf +0 -0
- package/src/style/fonts/fontAwesome/webfonts/fa-regular-400.woff2 +0 -0
- package/src/style/fonts/fontAwesome/webfonts/fa-solid-900.ttf +0 -0
- package/src/style/fonts/fontAwesome/webfonts/fa-solid-900.woff2 +0 -0
- package/src/style/fonts/fontAwesome/webfonts/fa-v4compatibility.ttf +0 -0
- package/src/style/fonts/fontAwesome/webfonts/fa-v4compatibility.woff2 +0 -0
- package/src/style/variables.scss +11 -0
- package/.gitignore +0 -31
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
import './style/dvrdPassword.scss';
|
|
5
|
+
|
|
6
|
+
import React, {PureComponent} from 'react';
|
|
7
|
+
import {AwesomeIcon, ElementPosition} from '@dvrd/dvr-controls';
|
|
8
|
+
import DvrdInputController, {InputControllerProps} from "./dvrdInputController";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
interface State {
|
|
12
|
+
type: 'password' | 'text';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default class DvrdPasswordInput extends PureComponent<InputControllerProps, State> {
|
|
16
|
+
state: State = {
|
|
17
|
+
type: 'password',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
onClickOrnament = () => {
|
|
21
|
+
const {type} = this.state;
|
|
22
|
+
if (type === 'password') this.setState({type: 'text'});
|
|
23
|
+
else this.setState({type: 'password'});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
renderOrnament = () => {
|
|
27
|
+
const {type} = this.state, element = type === 'password' ? 'eye' : 'eye-slash';
|
|
28
|
+
return {
|
|
29
|
+
placement: ElementPosition.RIGHT,
|
|
30
|
+
element: <AwesomeIcon name={element} onClick={this.onClickOrnament} className='dvrd-password-toggle'/>
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
render = () => {
|
|
35
|
+
const {type} = this.state, {inputProps} = this.props;
|
|
36
|
+
return (
|
|
37
|
+
<DvrdInputController {...this.props} inputProps={{...inputProps, type}} ornaments={this.renderOrnament()}/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
@import '../../../style/variables';
|
|
6
|
+
|
|
7
|
+
.dvrd-input-container {
|
|
8
|
+
transition: margin-bottom .1s ease-in-out;
|
|
9
|
+
position: relative;
|
|
10
|
+
|
|
11
|
+
.dvrd-input-label {
|
|
12
|
+
color: $color-blue-text;
|
|
13
|
+
font-size: .9rem;
|
|
14
|
+
margin-bottom: .25rem;
|
|
15
|
+
display: block;
|
|
16
|
+
transition: color .1s ease-in-out;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.content-container {
|
|
20
|
+
border: 1px solid #D9D9D9;
|
|
21
|
+
border-radius: 4px;
|
|
22
|
+
transition: border-color .1s ease-in-out;
|
|
23
|
+
display: grid;
|
|
24
|
+
align-items: center;
|
|
25
|
+
width: 100%;
|
|
26
|
+
|
|
27
|
+
.dvrd-input {
|
|
28
|
+
width: 100%;
|
|
29
|
+
outline: none;
|
|
30
|
+
border: none;
|
|
31
|
+
padding: .75rem;
|
|
32
|
+
color: $color-blue-text;
|
|
33
|
+
border-radius: inherit;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
textarea.no-resize {
|
|
37
|
+
resize: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.clear-btn {
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
transition: color .2s ease-in-out;
|
|
43
|
+
color: $color-blue-text;
|
|
44
|
+
|
|
45
|
+
&:hover {
|
|
46
|
+
color: red;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.dvrd-input-error {
|
|
52
|
+
position: absolute;
|
|
53
|
+
bottom: 0;
|
|
54
|
+
transform: translateY(1rem);
|
|
55
|
+
left: 0;
|
|
56
|
+
color: red;
|
|
57
|
+
font-size: .8rem;
|
|
58
|
+
visibility: hidden;
|
|
59
|
+
opacity: 0;
|
|
60
|
+
transition: visibility .1s ease-in-out, opacity .1s ease-in-out;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:hover {
|
|
64
|
+
.content-container {
|
|
65
|
+
border-color: var(--base-color);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.active {
|
|
70
|
+
.dvrd-input-label {
|
|
71
|
+
color: var(--base-color);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.content-container {
|
|
75
|
+
border-color: var(--base-color);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.error {
|
|
80
|
+
margin-bottom: 1rem;
|
|
81
|
+
|
|
82
|
+
.dvrd-input-label {
|
|
83
|
+
color: red;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.content-container {
|
|
87
|
+
border-color: red;
|
|
88
|
+
|
|
89
|
+
.dvrd-input {
|
|
90
|
+
color: red;
|
|
91
|
+
|
|
92
|
+
&::placeholder {
|
|
93
|
+
color: red;
|
|
94
|
+
opacity: .7;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.dvrd-input-error {
|
|
100
|
+
visibility: visible;
|
|
101
|
+
opacity: 1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&.disabled {
|
|
106
|
+
.content-container {
|
|
107
|
+
border-color: #D9D9D9;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&.full {
|
|
112
|
+
width: 100%;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
@import '../../../style/variables';
|
|
6
|
+
|
|
7
|
+
.dvrd-password-toggle {
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
transition: color .2s ease-in-out;
|
|
10
|
+
color: $color-gray-3;
|
|
11
|
+
|
|
12
|
+
&:hover {
|
|
13
|
+
color: $color-gray-5;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
@import '../../../style/variables';
|
|
6
|
+
|
|
7
|
+
.dvr-top-btn {
|
|
8
|
+
@include backgroundShadow;
|
|
9
|
+
position: fixed;
|
|
10
|
+
bottom: 2rem;
|
|
11
|
+
right: 2rem;
|
|
12
|
+
border-radius: 50%;
|
|
13
|
+
z-index: $z-index-high;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
transition: background-color .2s ease-in-out, visibility .2s ease-in-out, opacity .2s ease-in-out;
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
padding: .8rem;
|
|
20
|
+
visibility: visible;
|
|
21
|
+
opacity: 1;
|
|
22
|
+
|
|
23
|
+
.dvr-top-icon {
|
|
24
|
+
font-size: 1.2rem;
|
|
25
|
+
cursor: inherit;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.hover-label {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 0;
|
|
31
|
+
left: 50%;
|
|
32
|
+
transform: translate(-50%, -120%);
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
font-size: .8rem;
|
|
35
|
+
padding: .2rem .4rem;
|
|
36
|
+
border-radius: 1rem;
|
|
37
|
+
visibility: hidden;
|
|
38
|
+
opacity: 0;
|
|
39
|
+
transition: visibility .2s ease-in-out, opacity .2s ease-in-out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.hidden {
|
|
43
|
+
visibility: hidden;
|
|
44
|
+
opacity: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
.hover-label {
|
|
49
|
+
transition-delay: .5s;
|
|
50
|
+
visibility: visible;
|
|
51
|
+
opacity: 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
import './style/topButton.scss';
|
|
5
|
+
|
|
6
|
+
import React, {MouseEventHandler, PureComponent, ReactElement} from 'react';
|
|
7
|
+
import classNames from "classnames";
|
|
8
|
+
import {AwesomeIcon, darkenColor} from "../../../index";
|
|
9
|
+
import {ControlContext} from "../util/controlContext";
|
|
10
|
+
import {convertColor} from "../util/colorUtil";
|
|
11
|
+
import { IconName } from '@fortawesome/fontawesome-svg-core';
|
|
12
|
+
|
|
13
|
+
export interface TopButtonProps {
|
|
14
|
+
onClick?: MouseEventHandler;
|
|
15
|
+
onMouseEnter?: MouseEventHandler;
|
|
16
|
+
onMouseLeave?: MouseEventHandler;
|
|
17
|
+
className: string;
|
|
18
|
+
iconClassName: string;
|
|
19
|
+
icon: IconName | ReactElement;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
color?: string;
|
|
22
|
+
iconColor?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface State {
|
|
26
|
+
visible: boolean;
|
|
27
|
+
isHovered: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default class TopButton extends PureComponent<TopButtonProps, State> {
|
|
31
|
+
declare context: React.ContextType<typeof ControlContext>
|
|
32
|
+
static contextType = ControlContext;
|
|
33
|
+
static defaultProps = {
|
|
34
|
+
disabled: false,
|
|
35
|
+
className: '',
|
|
36
|
+
iconClassName: '',
|
|
37
|
+
icon: 'chevron-up',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
private isScrolling: boolean = false;
|
|
41
|
+
|
|
42
|
+
state: State = {
|
|
43
|
+
visible: false,
|
|
44
|
+
isHovered: false,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
onMouseEnter = (evt: React.MouseEvent) => {
|
|
48
|
+
const {onMouseEnter} = this.props;
|
|
49
|
+
if (!this.state.isHovered) this.setState({isHovered: true});
|
|
50
|
+
if (onMouseEnter) onMouseEnter(evt);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
onMouseLeave = (evt: React.MouseEvent) => {
|
|
54
|
+
const {onMouseLeave} = this.props;
|
|
55
|
+
if (this.state.isHovered) this.setState({isHovered: false});
|
|
56
|
+
if (onMouseLeave) onMouseLeave(evt);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
onClick = (evt: React.MouseEvent) => {
|
|
60
|
+
const {onClick, disabled} = this.props;
|
|
61
|
+
if (!disabled) {
|
|
62
|
+
if (onClick) onClick(evt);
|
|
63
|
+
else
|
|
64
|
+
window.scrollTo({top: 0, behavior: "smooth"});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
getBaseColor = (): string => convertColor(this.context.baseColor);
|
|
69
|
+
getContrastColor = (): string => convertColor(this.context.contrastColor);
|
|
70
|
+
|
|
71
|
+
getBackgroundColor = (): string => {
|
|
72
|
+
const {color} = this.props, {isHovered} = this.state, baseColor = this.getBaseColor();
|
|
73
|
+
let bgColor: string = convertColor(color === undefined ? baseColor : color);
|
|
74
|
+
if (isHovered) bgColor = darkenColor(bgColor, 20);
|
|
75
|
+
return bgColor;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
getIconColor = (): string => {
|
|
79
|
+
const {iconColor} = this.props, contrastColor = this.getContrastColor();
|
|
80
|
+
return convertColor(iconColor === undefined ? contrastColor : iconColor);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
scrollListener = () => {
|
|
84
|
+
const {visible} = this.state, {disabled} = this.props;
|
|
85
|
+
if (!this.isScrolling) {
|
|
86
|
+
this.isScrolling = true;
|
|
87
|
+
window.requestAnimationFrame(() => {
|
|
88
|
+
const scrollPosition: number = window.scrollY;
|
|
89
|
+
if (scrollPosition > 0) {
|
|
90
|
+
if (!visible)
|
|
91
|
+
this.setState({visible: !disabled});
|
|
92
|
+
} else if (visible)
|
|
93
|
+
this.setState({visible: false});
|
|
94
|
+
this.isScrolling = false;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
testInitialScrollPos = () => {
|
|
100
|
+
const {disabled} = this.props, scrollPos = window.scrollY;
|
|
101
|
+
this.setState({visible: !disabled && scrollPos > 0});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
renderIcon = () => {
|
|
105
|
+
const {icon, iconClassName} = this.props;
|
|
106
|
+
let elem: ReactElement;
|
|
107
|
+
if (typeof icon === 'string')
|
|
108
|
+
elem = <AwesomeIcon name={icon} className={classNames('dvr-top-icon', iconClassName)}
|
|
109
|
+
style={{color: this.getIconColor()}}/>;
|
|
110
|
+
else elem = icon;
|
|
111
|
+
return elem;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
componentDidMount = () => {
|
|
115
|
+
window.addEventListener('scroll', this.scrollListener, {passive: true});
|
|
116
|
+
this.testInitialScrollPos();
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
componentWillUnmount = () => {
|
|
120
|
+
window.removeEventListener('scroll', this.scrollListener);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
render = () => {
|
|
124
|
+
const {visible} = this.state, {disabled, className} = this.props;
|
|
125
|
+
return (
|
|
126
|
+
<div className={classNames('dvr-top-btn', className, (!visible || disabled) && 'hidden')}
|
|
127
|
+
onClick={this.onClick} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}
|
|
128
|
+
style={{backgroundColor: this.getBackgroundColor()}}>
|
|
129
|
+
{this.renderIcon()}
|
|
130
|
+
<label className='hover-label'
|
|
131
|
+
style={{backgroundColor: this.getBackgroundColor(), color: this.getIconColor()}}>
|
|
132
|
+
Naar boven</label>
|
|
133
|
+
</div>
|
|
134
|
+
)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {getMode} from "./miscUtil";
|
|
6
|
+
|
|
7
|
+
const prodMode = (): boolean => getMode() === 'prod';
|
|
8
|
+
|
|
9
|
+
export const setGaUserId = (id: string | null) => {
|
|
10
|
+
if (prodMode() && window.gtag) {
|
|
11
|
+
if (id)
|
|
12
|
+
window.gtag('set', {'user_id': id});
|
|
13
|
+
else window.gtag('set', {'user_id': ''});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const sendGaPageView = (path?: string) => {
|
|
18
|
+
if (prodMode() && window.gtag) {
|
|
19
|
+
const trackingId = getTrackingID();
|
|
20
|
+
if (trackingId) {
|
|
21
|
+
const pathConfig: { page_path?: string; page_location: string; page_title: string } = {
|
|
22
|
+
page_location: window.location.href,
|
|
23
|
+
page_title: document.title,
|
|
24
|
+
};
|
|
25
|
+
if (path && path.length) {
|
|
26
|
+
if (!path.startsWith('/')) path = `/${path}`;
|
|
27
|
+
pathConfig.page_path = path;
|
|
28
|
+
}
|
|
29
|
+
window.gtag('event', 'page_view', pathConfig);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const sendGaEvent = (action: string, category?: string, label?: string, value?: string) => {
|
|
35
|
+
if (prodMode() && getTrackingID() && window.gtag)
|
|
36
|
+
window.gtag('event', action, {event_category: category, event_label: label, value});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getTrackingID = (): string | null => {
|
|
40
|
+
return window.allowCookies && prodMode() ? window.settings.gaID : null;
|
|
41
|
+
};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {ColorSet} from "./interfaces";
|
|
6
|
+
import {isNotNull} from "./controlUtil";
|
|
7
|
+
|
|
8
|
+
interface ColorShape {
|
|
9
|
+
[index: string]: string,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const colorConstants: ColorShape = {
|
|
13
|
+
orange: "color-orange",
|
|
14
|
+
white: "#ffffff",
|
|
15
|
+
black: '#000000',
|
|
16
|
+
gray: 'gray',
|
|
17
|
+
"color-blue-1": "#009fe3",
|
|
18
|
+
"color-blue-handels": "#005fa0",
|
|
19
|
+
"color-blue-knab": "#003b5a",
|
|
20
|
+
"color-blue-trio": "#00006b",
|
|
21
|
+
"color-blue-text": "#2A435F",
|
|
22
|
+
"color-gray-2": "#808080",
|
|
23
|
+
"color-gray-3": "#9a9a9a",
|
|
24
|
+
"color-gray-4": "#cccccc",
|
|
25
|
+
"color-gray-5": "#434b50",
|
|
26
|
+
"color-gray-6": "#F2F2F2",
|
|
27
|
+
"color-gray-7": "#e4e4e4",
|
|
28
|
+
"color-gray-header": "#3a4044",
|
|
29
|
+
"color-green-1": "#18A155",
|
|
30
|
+
"color-green-abn": "#00857a",
|
|
31
|
+
"color-green-whatsapp": "#29A71A",
|
|
32
|
+
"color-orange": "#f39320",
|
|
33
|
+
"color-orange-asn": "#f0533d",
|
|
34
|
+
"color-purple-sns": "#562772",
|
|
35
|
+
"color-red-moneyou": "#d40d47",
|
|
36
|
+
"color-red-regio": "#ca031a",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const constants: ColorShape = {
|
|
40
|
+
...colorConstants,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const OrangeSet: ColorSet = {
|
|
44
|
+
base: '#ffc47d',
|
|
45
|
+
contrast: '#ab5d00',
|
|
46
|
+
// contrast: '#ffc47d'
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const OrangeSet2: ColorSet = {
|
|
50
|
+
base: '#F9ECD1',
|
|
51
|
+
contrast: '#ab5d00'
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const GreenSet: ColorSet = {
|
|
55
|
+
base: '#D9F6D9',
|
|
56
|
+
contrast: '#669966',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const YellowSet: ColorSet = {
|
|
60
|
+
base: '',
|
|
61
|
+
contrast: '',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const BlueSet: ColorSet = {
|
|
65
|
+
base: '#b0e7ff',
|
|
66
|
+
contrast: '#007bb0',
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const RedSet: ColorSet = {
|
|
70
|
+
base: '',
|
|
71
|
+
contrast: '',
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const findDarkestColor = (...colors: string[]): string => {
|
|
75
|
+
let darkest = 9999, darkestColor: string = '';
|
|
76
|
+
for (const color of colors) {
|
|
77
|
+
const hsp: number | undefined = getHsp(color);
|
|
78
|
+
if (hsp !== undefined && hsp < darkest) {
|
|
79
|
+
darkest = hsp;
|
|
80
|
+
darkestColor = color;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return darkestColor;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const getHsp = (color: string): number | undefined => {
|
|
87
|
+
let r: number | undefined, g: number | undefined, b: number | undefined, hsp: number | undefined;
|
|
88
|
+
if (color.match(/^rgb/)) {
|
|
89
|
+
const colorMatch = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
|
|
90
|
+
if (colorMatch) {
|
|
91
|
+
r = parseInt(colorMatch[1]);
|
|
92
|
+
g = parseInt(colorMatch[2]);
|
|
93
|
+
b = parseInt(colorMatch[3]);
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
let colorNum: number = +("0x" + color.slice(1).replace(color.length < 5 && /./g, '$&$&'));
|
|
98
|
+
r = colorNum >> 16;
|
|
99
|
+
g = colorNum >> 8 & 255;
|
|
100
|
+
b = colorNum & 255;
|
|
101
|
+
}
|
|
102
|
+
if (r !== undefined && g !== undefined && b !== undefined)
|
|
103
|
+
return Math.sqrt(
|
|
104
|
+
0.299 * (r * r) +
|
|
105
|
+
0.587 * (g * g) +
|
|
106
|
+
0.114 * (b * b)
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const hexToRgb = (hex: string): { r: number | null, g: number | null, b: number | null } => {
|
|
111
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
112
|
+
return result ? {
|
|
113
|
+
r: parseInt(result[1], 16),
|
|
114
|
+
g: parseInt(result[2], 16),
|
|
115
|
+
b: parseInt(result[3], 16)
|
|
116
|
+
} : {r: null, g: null, b: null};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const getRandomColor = (): string => {
|
|
120
|
+
const letters = '0123456789ABCDEF';
|
|
121
|
+
let color = '#';
|
|
122
|
+
for (let i = 0; i < 6; i++)
|
|
123
|
+
color += letters[Math.floor(Math.random() * letters.length)];
|
|
124
|
+
return color;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
//@ts-ignore-start
|
|
128
|
+
export const editColor = (p, c0, c1?, l?): string => {
|
|
129
|
+
c0 = convertColor(c0);
|
|
130
|
+
let r, g, b, P, f, t, h, i = parseInt, m = Math.round, a = typeof (c1) == "string";
|
|
131
|
+
if (p < -1 || p > 1 || (c0[0] !== 'r' && c0[0] !== '#') || (c1 && !a)) return c0;
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
if (!window.pSBCr) window.pSBCr = (d) => {
|
|
134
|
+
let n = d.length, x = {};
|
|
135
|
+
if (n > 9) {
|
|
136
|
+
[r, g, b, a] = d = d.split(","), n = d.length;
|
|
137
|
+
if (n < 3 || n > 4) return null;
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
x.r = i(r[3] === "a" ? r.slice(5) : r.slice(4)), x.g = i(g), x.b = i(b), x.a = a ? parseFloat(a) : -1
|
|
140
|
+
} else {
|
|
141
|
+
if (n === 8 || n === 6 || n < 4) return null;
|
|
142
|
+
if (n < 6) d = "#" + d[1] + d[1] + d[2] + d[2] + d[3] + d[3] + (n > 4 ? d[4] + d[4] : "");
|
|
143
|
+
d = i(d.slice(1), 16);
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
if (n === 9 || n === 5) x.r = d >> 24 & 255, x.g = d >> 16 & 255, x.b = d >> 8 & 255, x.a =
|
|
146
|
+
m((d & 255) / 0.255) / 1000;
|
|
147
|
+
// @ts-ignore
|
|
148
|
+
else x.r = d >> 16, x.g = d >> 8 & 255, x.b = d & 255, x.a = -1
|
|
149
|
+
}
|
|
150
|
+
return x
|
|
151
|
+
};
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
h = c0.length > 9, h = a ? c1.length > 9 ? true : c1 === "c" ? !h : false : h, f = pSBCr(c0), P = p < 0, t =
|
|
154
|
+
// @ts-ignore
|
|
155
|
+
c1 && c1 !== "c" ? pSBCr(c1) : P ? {
|
|
156
|
+
r: 0,
|
|
157
|
+
g: 0,
|
|
158
|
+
b: 0,
|
|
159
|
+
a: -1
|
|
160
|
+
} : {r: 255, g: 255, b: 255, a: -1}, p = P ? p * -1 : p, P = 1 - p;
|
|
161
|
+
if (!f || !t) return c0;
|
|
162
|
+
if (l) r = m(P * f.r + p * t.r), g = m(P * f.g + p * t.g), b = m(P * f.b + p * t.b);
|
|
163
|
+
else r = m((P * f.r ** 2 + p * t.r ** 2) ** 0.5), g = m((P * f.g ** 2 + p * t.g ** 2) ** 0.5), b =
|
|
164
|
+
m((P * f.b ** 2 + p * t.b ** 2) ** 0.5);
|
|
165
|
+
// @ts-ignore
|
|
166
|
+
a = f.a, t = t.a, f = a >= 0 || t >= 0, a = f ? a < 0 ? t : t < 0 ? a : a * P + t * p : 0;
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
if (h) return "rgb" + (f ? "a(" : "(") + r + "," + g + "," + b + (f ? "," + m(a * 1000) / 1000 : "") + ")";
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
else return "#" + (4294967296 + r * 16777216 + g * 65536 + b * 256 + (f ? m(a * 255) : 0)).toString(16)
|
|
171
|
+
.slice(1, f ? undefined : -2)
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const darkenColor = (color: string, percentage: number) => editColor(percentage / -100, color);
|
|
175
|
+
export const lightenColor = (color: string, percentage: number) => editColor(percentage / 100, color);
|
|
176
|
+
|
|
177
|
+
export const colorIsHex = (colorName: string): boolean => /^#[A-Za-z\d]{6,7}$/.test(colorName);
|
|
178
|
+
|
|
179
|
+
export const colorIsWhite = (color: string): boolean => color === 'white' || /#fff(fff)?/.test(color);
|
|
180
|
+
|
|
181
|
+
export const convertColor = (colorName: string) => {
|
|
182
|
+
if (colorIsHex(colorName)) return colorName;
|
|
183
|
+
else if (colorConstants.hasOwnProperty(colorName)) {
|
|
184
|
+
if (colorIsHex(colorConstants[colorName])) return colorConstants[colorName];
|
|
185
|
+
|
|
186
|
+
const converted = colorConstants[colorName];
|
|
187
|
+
if (isNotNull(converted)) return colorConstants[converted];
|
|
188
|
+
}
|
|
189
|
+
return colorName;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export enum Colors {
|
|
193
|
+
BLUE = '#0000ff',
|
|
194
|
+
FACEBOOK = '#4267B2',
|
|
195
|
+
BLUE1 = '#3687bc',
|
|
196
|
+
BLUE2 = '#008dca',
|
|
197
|
+
BLUE3 = '#009fe3',
|
|
198
|
+
BLUE3_HOVER = '#31c1ff',
|
|
199
|
+
BLUE4 = '#779bbc',
|
|
200
|
+
BLUE5 = '#DEEAF6',
|
|
201
|
+
GRAY1 = '#333',
|
|
202
|
+
GRAY2 = '#3a4044', // HEADER
|
|
203
|
+
GRAY3 = '#434b50',
|
|
204
|
+
GRAY = '#808080',
|
|
205
|
+
GRAY_DVR_LOGO = '#b4b7b999',
|
|
206
|
+
GRAY4 = '#9a9a9a',
|
|
207
|
+
GRAY5_HOVER = '#b2b2b2',
|
|
208
|
+
GRAY6 = '#ccc',
|
|
209
|
+
GRAY5 = '#d8d8d8', // HEADER TEXT
|
|
210
|
+
GRAY7 = '#e4e4e4',
|
|
211
|
+
GRAY8 = '#f8f8f8',
|
|
212
|
+
GRAY9 = '#F2F2F2',
|
|
213
|
+
ORANGE1 = '#b05a20',
|
|
214
|
+
ORANGE2_HOVER = '#f39320cc',
|
|
215
|
+
ORANGE2 = '#f39320',
|
|
216
|
+
YELLOW1 = '#fff000',
|
|
217
|
+
GREEN1 = '#18A155',
|
|
218
|
+
WHATSAPP = '#29A71A',
|
|
219
|
+
GREEN2 = '#94FB82',
|
|
220
|
+
GREEN3 = '#eafeea',
|
|
221
|
+
GREEN4 = '#E2EFDA',
|
|
222
|
+
GREEN5 = '#edf1f2',
|
|
223
|
+
PINK1_HOVER = '#fbe1d599',
|
|
224
|
+
PINK1 = '#fbe1d5',
|
|
225
|
+
RED_HOVER = '#cc0000',
|
|
226
|
+
RED1 = '#ca031a',
|
|
227
|
+
RED = '#ff0000',
|
|
228
|
+
RED2 = '#ff7e78',
|
|
229
|
+
RED3 = '#FDD4CC',
|
|
230
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from "react";
|
|
6
|
+
import {debug} from "./miscUtil";
|
|
7
|
+
import {getScreenHeight, getScreenWidth} from "./responsiveUtil";
|
|
8
|
+
import {generateUUID} from "./controlUtil";
|
|
9
|
+
|
|
10
|
+
export const generateComponentId = (id?: string | null, lettersOnly: boolean = true): string => {
|
|
11
|
+
if (id !== null && id !== undefined) return id;
|
|
12
|
+
const generated = generateUUID();
|
|
13
|
+
let compId = generated.substring(0, generated.indexOf('-', generated.indexOf('-') + 1));
|
|
14
|
+
if (lettersOnly)
|
|
15
|
+
compId = compId.split('').map((char: string) => Number.isNaN(char) ? char : String.fromCharCode(97 + Number(char))).join('');
|
|
16
|
+
return compId;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const navigate = (url: string, stripQuery: boolean = true, move: boolean | string = true,
|
|
20
|
+
customScroller?: (id?: boolean | string) => void) => {
|
|
21
|
+
let navigator = document.getElementById('appNavigator');
|
|
22
|
+
if (navigator) {
|
|
23
|
+
navigator.dataset.url = url;
|
|
24
|
+
if (stripQuery) navigator.dataset.strip = '1';
|
|
25
|
+
navigator.click();
|
|
26
|
+
|
|
27
|
+
if (customScroller) {
|
|
28
|
+
directTimeout(() => {
|
|
29
|
+
customScroller(move);
|
|
30
|
+
});
|
|
31
|
+
} else if (typeof move === 'string') {
|
|
32
|
+
directTimeout(() => {
|
|
33
|
+
const element = document.getElementById(move);
|
|
34
|
+
if (element) element.scrollIntoView({block: "start", behavior: "smooth"});
|
|
35
|
+
});
|
|
36
|
+
} else if (move) directTimeout(() => {
|
|
37
|
+
window.scrollTo(0, 0)
|
|
38
|
+
});
|
|
39
|
+
} else debug('Navigator not found');
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const elementIsInView = (element: HTMLElement): boolean => {
|
|
43
|
+
const box = element.getBoundingClientRect();
|
|
44
|
+
return box.top >= 0 && box.left >= 0 && box.bottom <= getScreenHeight() && box.right <= getScreenWidth();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const directTimeout = (handler: Function) => {
|
|
48
|
+
window.setTimeout(handler, 0);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const getElementTop = (element: string | HTMLElement | null): number => {
|
|
52
|
+
if (typeof element === 'string') element = document.getElementById(element);
|
|
53
|
+
if (element) {
|
|
54
|
+
const box = element.getBoundingClientRect(),
|
|
55
|
+
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
56
|
+
return box.top + scrollTop;
|
|
57
|
+
}
|
|
58
|
+
return 0;
|
|
59
|
+
};
|