@dvrd/dvr-controls 1.0.5 → 1.0.8
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/package.json +1 -1
- package/src/js/button/button.tsx +0 -102
- package/src/js/button/buttonController.tsx +0 -179
- package/src/js/button/closeButton.tsx +0 -29
- package/src/js/button/dvrdButton.tsx +0 -128
- package/src/js/button/outlinedButton.tsx +0 -105
- package/src/js/button/simpleButton.tsx +0 -163
- package/src/js/button/style/button.scss +0 -95
- package/src/js/button/style/closeButton.scss +0 -15
- package/src/js/button/style/dvrdButton.scss +0 -30
- package/src/js/button/style/outlinedButton.scss +0 -84
- package/src/js/button/style/simpleButton.scss +0 -80
- package/src/js/carousel/DVRCarousel.tsx +0 -163
- package/src/js/carousel/DVRCarouselController.tsx +0 -95
- package/src/js/carousel/style/DVRCarousel.scss +0 -38
- package/src/js/checkbox/checkbox.tsx +0 -147
- package/src/js/checkbox/checkboxController.tsx +0 -131
- package/src/js/checkbox/style/checkbox.scss +0 -109
- package/src/js/colorPicker/colorPicker.tsx +0 -118
- package/src/js/colorPicker/style/colorPicker.scss +0 -20
- package/src/js/date/dvrdDatePicker.tsx +0 -357
- package/src/js/date/style/dvrdDatePicker.scss +0 -307
- package/src/js/dialog/dialog.tsx +0 -207
- package/src/js/dialog/dialogController.tsx +0 -70
- package/src/js/dialog/inlineDialog.tsx +0 -127
- package/src/js/dialog/style/dialog.scss +0 -61
- package/src/js/events/withEvents.tsx +0 -40
- package/src/js/head/DVRHead.tsx +0 -49
- package/src/js/header/DVRHeader.tsx +0 -413
- package/src/js/header/style/header.scss +0 -206
- package/src/js/icon/awesomeIcon.tsx +0 -46
- package/src/js/image/imageUpload.tsx +0 -69
- package/src/js/image/style/imageUpload.scss +0 -11
- package/src/js/info/info.tsx +0 -136
- package/src/js/info/style/info.scss +0 -39
- package/src/js/input/animated/animatedTextField.tsx +0 -159
- package/src/js/input/date/dateField.tsx +0 -360
- package/src/js/input/date/dateFieldController.tsx +0 -245
- package/src/js/input/date/datePicker/datePicker.tsx +0 -186
- package/src/js/input/date/datePicker/style/datePicker.scss +0 -102
- package/src/js/input/date/input/dateInput.tsx +0 -213
- package/src/js/input/date/style/dateField.scss +0 -40
- package/src/js/input/date/timePicker/style/timePicker.scss +0 -95
- package/src/js/input/date/timePicker/timePicker.tsx +0 -143
- package/src/js/input/editor/DVREditor.tsx +0 -21
- package/src/js/input/number/numberInput.tsx +0 -157
- package/src/js/input/password/passwordInput.tsx +0 -140
- package/src/js/input/password/passwordRules.tsx +0 -48
- package/src/js/input/password/style/passwordInput.scss +0 -39
- package/src/js/input/password/style/passwordRules.scss +0 -41
- package/src/js/input/simple/style/simpleInput.scss +0 -98
- package/src/js/input/simple/v2/simpleInputV2.tsx +0 -178
- package/src/js/input/style/input.scss +0 -138
- package/src/js/input/v2/inputController_v2.tsx +0 -250
- package/src/js/input/v2/input_v2.tsx +0 -7
- package/src/js/label/label.tsx +0 -196
- package/src/js/label/style/label.scss +0 -4
- package/src/js/link/link.tsx +0 -38
- package/src/js/link/style/link.scss +0 -30
- package/src/js/loader/loader.tsx +0 -79
- package/src/js/loader/loaderController.tsx +0 -61
- package/src/js/loader/style/loader.scss +0 -53
- package/src/js/media/media.tsx +0 -72
- package/src/js/navigator/navigator.tsx +0 -51
- package/src/js/optionsList/dvrdOptionsList.tsx +0 -112
- package/src/js/optionsList/style/dvrdOptionsList.scss +0 -84
- package/src/js/optionsMenu/optionsMenu.tsx +0 -187
- package/src/js/optionsMenu/style/optionsMenu.scss +0 -70
- package/src/js/pdf/element/pdfElement.tsx +0 -315
- package/src/js/pdf/element/style/pdfElement.scss +0 -111
- package/src/js/pdf/history/pdfHistory.ts +0 -57
- package/src/js/pdf/image/pdfImage.tsx +0 -175
- package/src/js/pdf/image/style/pdfImage.scss +0 -34
- package/src/js/pdf/invoiceTable/pdfInvoiceTable.tsx +0 -176
- package/src/js/pdf/invoiceTable/style/pdfInvoiceTable.scss +0 -32
- package/src/js/pdf/pdfTemplateCreator.tsx +0 -278
- package/src/js/pdf/settings/buttons/iconButton.tsx +0 -49
- package/src/js/pdf/settings/buttons/style/iconButton.scss +0 -50
- package/src/js/pdf/settings/image/pdfImageSettings.tsx +0 -82
- package/src/js/pdf/settings/image/style/pdfImageSettings.scss +0 -9
- package/src/js/pdf/settings/invoiceTable/pdfInvoiceTableSettings.tsx +0 -141
- package/src/js/pdf/settings/invoiceTable/style/pdfInvoiceTableSettings.scss +0 -38
- package/src/js/pdf/settings/pdfElementSettings.tsx +0 -86
- package/src/js/pdf/settings/style/pdfElementSettings.scss +0 -56
- package/src/js/pdf/settings/text/pdfTextSettings.tsx +0 -202
- package/src/js/pdf/settings/text/style/pdfTextSettings.scss +0 -94
- package/src/js/pdf/style/pdfTemplateCreator.scss +0 -118
- package/src/js/pdf/text/pdfText.tsx +0 -267
- package/src/js/pdf/text/style/pdfText.scss +0 -22
- package/src/js/popup/style/withBackground.scss +0 -29
- package/src/js/popup/withBackground.tsx +0 -102
- package/src/js/select/async/asyncSelect.tsx +0 -46
- package/src/js/select/async/style/asyncSelect.scss +0 -23
- package/src/js/select/dvrdSelect.tsx +0 -185
- package/src/js/select/dvrdSelectController.tsx +0 -81
- package/src/js/select/select.tsx +0 -310
- package/src/js/select/selectController.tsx +0 -341
- package/src/js/select/style/dvrdSelect.scss +0 -140
- package/src/js/select/style/select.scss +0 -199
- package/src/js/sidebarMenu/sidebarMenu.tsx +0 -165
- package/src/js/sidebarMenu/style/sidebarMenu.scss +0 -161
- package/src/js/slider/DVRSlider.tsx +0 -107
- package/src/js/slider/style/DVRSlider.scss +0 -88
- package/src/js/snackbar/snackbar.tsx +0 -72
- package/src/js/snackbar/snackbarController.tsx +0 -104
- package/src/js/snackbar/style/snackbar.scss +0 -46
- package/src/js/switch/dvrdSwitch.tsx +0 -53
- package/src/js/switch/style/dvrdSwitch.scss +0 -47
- package/src/js/switch/style/switch.scss +0 -84
- package/src/js/switch/switch.tsx +0 -115
- package/src/js/switch/switchController.tsx +0 -97
- package/src/js/textField/dvrdInput.tsx +0 -217
- package/src/js/textField/dvrdInputController.tsx +0 -97
- package/src/js/textField/dvrdNumberInput.tsx +0 -141
- package/src/js/textField/dvrdPasswordInput.tsx +0 -40
- package/src/js/textField/style/dvrdInput.scss +0 -114
- package/src/js/textField/style/dvrdPassword.scss +0 -15
- package/src/js/topButton/style/topButton.scss +0 -54
- package/src/js/topButton/topButton.tsx +0 -135
- package/src/js/util/analyticsUtil.ts +0 -41
- package/src/js/util/colorUtil.ts +0 -230
- package/src/js/util/componentUtil.tsx +0 -59
- package/src/js/util/constants.ts +0 -12
- package/src/js/util/controlContext.tsx +0 -46
- package/src/js/util/controlUtil.ts +0 -107
- package/src/js/util/cookieUtil.ts +0 -17
- package/src/js/util/eventUtil.ts +0 -65
- package/src/js/util/googleUtil.ts +0 -88
- package/src/js/util/interfaces.ts +0 -179
- package/src/js/util/jwtUtil.ts +0 -72
- package/src/js/util/miscUtil.ts +0 -170
- package/src/js/util/momentUtil.ts +0 -45
- package/src/js/util/pdfUtil.ts +0 -124
- package/src/js/util/requestUtil.ts +0 -146
- package/src/js/util/responsiveUtil.ts +0 -37
- package/src/js/util/validationUtil.ts +0 -13
- 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 +0 -140
- package/src/style/common-icons.scss +0 -714
- package/src/style/common-variables.scss +0 -243
- package/src/style/display-breakpoints.scss +0 -141
- package/src/style/fonts/common-icons.eot +0 -0
- package/src/style/fonts/common-icons.svg +0 -150
- 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 +0 -7003
- package/src/style/fonts/fontAwesome/css/all.min.css +0 -6
- package/src/style/fonts/fontAwesome/css/brands.css +0 -1423
- package/src/style/fonts/fontAwesome/css/brands.min.css +0 -6
- package/src/style/fonts/fontAwesome/css/fontawesome.css +0 -5519
- package/src/style/fonts/fontAwesome/css/fontawesome.min.css +0 -6
- package/src/style/fonts/fontAwesome/css/regular.css +0 -19
- package/src/style/fonts/fontAwesome/css/regular.min.css +0 -6
- package/src/style/fonts/fontAwesome/css/solid.css +0 -19
- package/src/style/fonts/fontAwesome/css/solid.min.css +0 -6
- package/src/style/fonts/fontAwesome/css/svg-with-js.css +0 -634
- package/src/style/fonts/fontAwesome/css/svg-with-js.min.css +0 -6
- package/src/style/fonts/fontAwesome/css/v4-font-face.css +0 -26
- package/src/style/fonts/fontAwesome/css/v4-font-face.min.css +0 -6
- package/src/style/fonts/fontAwesome/css/v4-shims.css +0 -2146
- package/src/style/fonts/fontAwesome/css/v4-shims.min.css +0 -6
- package/src/style/fonts/fontAwesome/css/v5-font-face.css +0 -22
- package/src/style/fonts/fontAwesome/css/v5-font-face.min.css +0 -6
- 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 +0 -11
- package/tsconfig.json +0 -15
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React, {
|
|
6
|
-
FocusEventHandler,
|
|
7
|
-
InputHTMLAttributes,
|
|
8
|
-
KeyboardEventHandler,
|
|
9
|
-
MouseEventHandler,
|
|
10
|
-
TextareaHTMLAttributes,
|
|
11
|
-
useEffect,
|
|
12
|
-
useRef,
|
|
13
|
-
useState
|
|
14
|
-
} from 'react';
|
|
15
|
-
import {generateComponentId} from '../util/componentUtil';
|
|
16
|
-
import {enterPressed} from '../util/controlUtil';
|
|
17
|
-
import {ErrorType, OrnamentShape} from '../util/interfaces';
|
|
18
|
-
import DvrdInput from "./dvrdInput";
|
|
19
|
-
|
|
20
|
-
export interface InputControllerProps {
|
|
21
|
-
onChange: (value: string, evt: React.ChangeEvent) => void;
|
|
22
|
-
onFocus?: FocusEventHandler;
|
|
23
|
-
onBlur?: FocusEventHandler;
|
|
24
|
-
onKeyDown?: KeyboardEventHandler;
|
|
25
|
-
onEnter?: KeyboardEventHandler;
|
|
26
|
-
onClearInput?: MouseEventHandler;
|
|
27
|
-
value: string | number;
|
|
28
|
-
label?: string;
|
|
29
|
-
ornaments?: OrnamentShape | OrnamentShape[];
|
|
30
|
-
inputProps?: InputHTMLAttributes<any> & TextareaHTMLAttributes<any>;
|
|
31
|
-
disabled?: boolean;
|
|
32
|
-
autoFocus?: boolean;
|
|
33
|
-
autoSelect?: boolean;
|
|
34
|
-
className?: string;
|
|
35
|
-
inputClassName?: string;
|
|
36
|
-
labelClassName?: string;
|
|
37
|
-
ornamentClassName?: string;
|
|
38
|
-
errorClassName?: string;
|
|
39
|
-
error?: ErrorType;
|
|
40
|
-
id?: string;
|
|
41
|
-
fullWidth?: boolean;
|
|
42
|
-
placeholder?: string;
|
|
43
|
-
type?: string;
|
|
44
|
-
max?: number;
|
|
45
|
-
min?: number;
|
|
46
|
-
step?: number;
|
|
47
|
-
area?: boolean;
|
|
48
|
-
noResize?: boolean;
|
|
49
|
-
unControlled?: boolean;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default function DvrdInputController(props: InputControllerProps) {
|
|
53
|
-
const {
|
|
54
|
-
disabled, onChange, onEnter, onKeyDown, inputProps, placeholder, type, max, min, step, onFocus, onBlur,
|
|
55
|
-
autoFocus, error, label, ornaments, className, inputClassName, labelClassName, ornamentClassName, fullWidth,
|
|
56
|
-
errorClassName, autoSelect, area, noResize, onClearInput, unControlled
|
|
57
|
-
} = props,
|
|
58
|
-
componentId = useRef(generateComponentId(props.id)),
|
|
59
|
-
[value, setValue] = useState(props.value);
|
|
60
|
-
|
|
61
|
-
function _onChange(evt: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) {
|
|
62
|
-
if (disabled) return;
|
|
63
|
-
const {value} = evt.target;
|
|
64
|
-
setValue(value);
|
|
65
|
-
onChange(value, evt);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _onKeyDown(evt: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) {
|
|
69
|
-
if (disabled) return;
|
|
70
|
-
if (onEnter && enterPressed(evt)) onEnter(evt);
|
|
71
|
-
else if (onKeyDown) onKeyDown(evt);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function getInputProps(): InputHTMLAttributes<any> | undefined {
|
|
75
|
-
if (!inputProps && !placeholder && !type) return undefined;
|
|
76
|
-
const props: InputHTMLAttributes<any> = inputProps ?? {};
|
|
77
|
-
if (placeholder !== undefined) props.placeholder = placeholder;
|
|
78
|
-
if (type !== undefined) props.type = type;
|
|
79
|
-
if (max !== undefined) props.max = max;
|
|
80
|
-
if (min !== undefined) props.min = min;
|
|
81
|
-
if (step !== undefined) props.step = step;
|
|
82
|
-
return props;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
if(!unControlled) setValue(props.value);
|
|
87
|
-
}, [props.value])
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<DvrdInput onChange={_onChange} onFocus={onFocus} onKeyDown={_onKeyDown} value={value}
|
|
91
|
-
disabled={disabled} autoFocus={autoFocus} error={error} label={label} ornaments={ornaments}
|
|
92
|
-
inputProps={getInputProps()} className={className} inputClassName={inputClassName}
|
|
93
|
-
labelClassName={labelClassName} ornamentClassName={ornamentClassName} fullWidth={fullWidth}
|
|
94
|
-
errorClassName={errorClassName} id={componentId.current} onBlur={onBlur} autoSelect={autoSelect}
|
|
95
|
-
area={area} noResize={noResize} onClearInput={onClearInput}/>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React, {FocusEventHandler, InputHTMLAttributes, KeyboardEventHandler, PureComponent} from 'react';
|
|
6
|
-
import {ChangeFunction, ErrorType, OrnamentShape} from '../util/interfaces';
|
|
7
|
-
import {roundTo} from '../util/miscUtil';
|
|
8
|
-
import DvrdInputController from "./dvrdInputController";
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
onChange: ChangeFunction<string | number>;
|
|
12
|
-
onFocus?: FocusEventHandler;
|
|
13
|
-
onBlur?: FocusEventHandler;
|
|
14
|
-
onKeyDown?: KeyboardEventHandler;
|
|
15
|
-
onEnter?: KeyboardEventHandler;
|
|
16
|
-
value: string | number;
|
|
17
|
-
label?: string;
|
|
18
|
-
ornaments?: OrnamentShape | OrnamentShape[];
|
|
19
|
-
inputProps?: InputHTMLAttributes<any>;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
autoFocus?: boolean;
|
|
22
|
-
className?: string;
|
|
23
|
-
inputClassName?: string;
|
|
24
|
-
labelClassName?: string;
|
|
25
|
-
ornamentClassName?: string;
|
|
26
|
-
errorClassName?: string;
|
|
27
|
-
error?: ErrorType;
|
|
28
|
-
id?: string;
|
|
29
|
-
placeholder?: string;
|
|
30
|
-
multipleSeparators: boolean;
|
|
31
|
-
wholeNumbers: boolean;
|
|
32
|
-
asNumber?: boolean;
|
|
33
|
-
asCurrency: boolean;
|
|
34
|
-
autoSelect?: boolean;
|
|
35
|
-
}
|
|
36
|
-
// TODO Add option to disable symbols (+,-)
|
|
37
|
-
|
|
38
|
-
export default class DvrdNumberInput extends PureComponent<Props> {
|
|
39
|
-
static defaultProps = {
|
|
40
|
-
asCurrency: false,
|
|
41
|
-
wholeNumbers: false,
|
|
42
|
-
multipleSeparators: false,
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
onKeyDown = (evt: React.KeyboardEvent) => {
|
|
46
|
-
const {onKeyDown, asCurrency, wholeNumbers, inputProps, asNumber, value, multipleSeparators} = this.props, {
|
|
47
|
-
key,
|
|
48
|
-
target
|
|
49
|
-
} = evt;
|
|
50
|
-
let numValue = Number(value);
|
|
51
|
-
// Allow only number and simple edit keys
|
|
52
|
-
if (!/\d|Backspace|ArrowRight|ArrowLeft|ArrowUp|ArrowDown|Escape|Esc|Enter|[,.\-+]|Tab/.test(key) &&
|
|
53
|
-
!this.isPasting(evt))
|
|
54
|
-
evt.preventDefault();
|
|
55
|
-
|
|
56
|
-
if (key === 'ArrowUp') {
|
|
57
|
-
evt.preventDefault();
|
|
58
|
-
if (!isNaN(numValue)) {
|
|
59
|
-
const step = Number(inputProps?.step || asCurrency ? .01 : 1);
|
|
60
|
-
numValue += step;
|
|
61
|
-
let stringValue = numValue.toString();
|
|
62
|
-
if (asCurrency) stringValue = roundTo(numValue, 2);
|
|
63
|
-
if (asNumber) this.change(Number(stringValue), evt);
|
|
64
|
-
else this.change(stringValue, evt);
|
|
65
|
-
}
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (key === 'ArrowDown') {
|
|
69
|
-
evt.preventDefault();
|
|
70
|
-
if (!isNaN(numValue)) {
|
|
71
|
-
const step = Number(inputProps?.step || asCurrency ? .01 : 1);
|
|
72
|
-
numValue -= step;
|
|
73
|
-
let stringValue = numValue.toString();
|
|
74
|
-
if (asCurrency) stringValue = roundTo(numValue, 2);
|
|
75
|
-
if (asNumber) this.change(Number(stringValue), evt);
|
|
76
|
-
else this.change(stringValue, evt);
|
|
77
|
-
}
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const textIsSelected = this.textIsSelected(evt), position = (target as HTMLInputElement).selectionStart;
|
|
82
|
-
if (!textIsSelected) {
|
|
83
|
-
if (/[,.]/.test(key) && /[,.]/.test(value.toString()) && !multipleSeparators)
|
|
84
|
-
// Prevent double points or commas
|
|
85
|
-
evt.preventDefault();
|
|
86
|
-
|
|
87
|
-
if (wholeNumbers && /[.,]/.test(key))
|
|
88
|
-
evt.preventDefault();
|
|
89
|
-
else if (asCurrency && /[.,]\d{2}/.test(value.toString()) && /\d/.test(key) &&
|
|
90
|
-
this.positionIsAfterComma(position, value.toString()))
|
|
91
|
-
// Prevent more than 2 decimals when working with currencies
|
|
92
|
-
evt.preventDefault();
|
|
93
|
-
|
|
94
|
-
if ((position && position !== 0) && /[\-+]/.test(key))
|
|
95
|
-
// Prevent - or + sign after first position
|
|
96
|
-
evt.preventDefault();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (onKeyDown !== undefined && onKeyDown !== null)
|
|
100
|
-
onKeyDown(evt);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
onChange = (value: string, evt: React.ChangeEvent) => {
|
|
104
|
-
const {asNumber} = this.props;
|
|
105
|
-
if (!/^-?[\d.,]*$/.test(value)) evt.preventDefault();
|
|
106
|
-
else {
|
|
107
|
-
let changeValue: string | number = value;
|
|
108
|
-
if (value.startsWith('.') || value.startsWith(',')) value = 0 + value;
|
|
109
|
-
if (asNumber) changeValue = Number(value.replace(',', '.'));
|
|
110
|
-
this.change(changeValue, evt);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
change = (value: string | number, evt: React.ChangeEvent | React.KeyboardEvent) => {
|
|
115
|
-
this.setState({value}, () => {
|
|
116
|
-
this.props.onChange(value, evt as React.ChangeEvent);
|
|
117
|
-
})
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
isPasting = (evt: React.KeyboardEvent) => {
|
|
121
|
-
return (evt.metaKey || evt.ctrlKey) && evt.key === 'v';
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
positionIsAfterComma = (position: number | null, value: string) => {
|
|
125
|
-
if (position === null) return true;
|
|
126
|
-
if (value.includes('.')) return position > value.indexOf('.');
|
|
127
|
-
if (value.includes(',')) return position > value.indexOf(',');
|
|
128
|
-
return false;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
textIsSelected = (evt: React.KeyboardEvent) => {
|
|
132
|
-
const target = evt.target as HTMLInputElement, start = target.selectionStart, end = target.selectionEnd;
|
|
133
|
-
return start != end;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
render = () => {
|
|
137
|
-
return (
|
|
138
|
-
<DvrdInputController {...this.props} onChange={this.onChange} onKeyDown={this.onKeyDown}/>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
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
|
-
|
|
12
|
-
export interface TopButtonProps {
|
|
13
|
-
onClick?: MouseEventHandler;
|
|
14
|
-
onMouseEnter?: MouseEventHandler;
|
|
15
|
-
onMouseLeave?: MouseEventHandler;
|
|
16
|
-
className: string;
|
|
17
|
-
iconClassName: string;
|
|
18
|
-
icon: string | ReactElement;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
color?: string;
|
|
21
|
-
iconColor?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface State {
|
|
25
|
-
visible: boolean;
|
|
26
|
-
isHovered: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default class TopButton extends PureComponent<TopButtonProps, State> {
|
|
30
|
-
declare context: React.ContextType<typeof ControlContext>
|
|
31
|
-
static contextType = ControlContext;
|
|
32
|
-
static defaultProps = {
|
|
33
|
-
disabled: false,
|
|
34
|
-
className: '',
|
|
35
|
-
iconClassName: '',
|
|
36
|
-
icon: 'chevron-up',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
private isScrolling: boolean = false;
|
|
40
|
-
|
|
41
|
-
state: State = {
|
|
42
|
-
visible: false,
|
|
43
|
-
isHovered: false,
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
onMouseEnter = (evt: React.MouseEvent) => {
|
|
47
|
-
const {onMouseEnter} = this.props;
|
|
48
|
-
if (!this.state.isHovered) this.setState({isHovered: true});
|
|
49
|
-
if (onMouseEnter) onMouseEnter(evt);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
onMouseLeave = (evt: React.MouseEvent) => {
|
|
53
|
-
const {onMouseLeave} = this.props;
|
|
54
|
-
if (this.state.isHovered) this.setState({isHovered: false});
|
|
55
|
-
if (onMouseLeave) onMouseLeave(evt);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
onClick = (evt: React.MouseEvent) => {
|
|
59
|
-
const {onClick, disabled} = this.props;
|
|
60
|
-
if (!disabled) {
|
|
61
|
-
if (onClick) onClick(evt);
|
|
62
|
-
else
|
|
63
|
-
window.scrollTo({top: 0, behavior: "smooth"});
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
getBaseColor = (): string => convertColor(this.context.baseColor);
|
|
68
|
-
getContrastColor = (): string => convertColor(this.context.contrastColor);
|
|
69
|
-
|
|
70
|
-
getBackgroundColor = (): string => {
|
|
71
|
-
const {color} = this.props, {isHovered} = this.state, baseColor = this.getBaseColor();
|
|
72
|
-
let bgColor: string = convertColor(color === undefined ? baseColor : color);
|
|
73
|
-
if (isHovered) bgColor = darkenColor(bgColor, 20);
|
|
74
|
-
return bgColor;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
getIconColor = (): string => {
|
|
78
|
-
const {iconColor} = this.props, contrastColor = this.getContrastColor();
|
|
79
|
-
return convertColor(iconColor === undefined ? contrastColor : iconColor);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
scrollListener = () => {
|
|
83
|
-
const {visible} = this.state, {disabled} = this.props;
|
|
84
|
-
if (!this.isScrolling) {
|
|
85
|
-
this.isScrolling = true;
|
|
86
|
-
window.requestAnimationFrame(() => {
|
|
87
|
-
const scrollPosition: number = window.scrollY;
|
|
88
|
-
if (scrollPosition > 0) {
|
|
89
|
-
if (!visible)
|
|
90
|
-
this.setState({visible: !disabled});
|
|
91
|
-
} else if (visible)
|
|
92
|
-
this.setState({visible: false});
|
|
93
|
-
this.isScrolling = false;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
testInitialScrollPos = () => {
|
|
99
|
-
const {disabled} = this.props, scrollPos = window.scrollY;
|
|
100
|
-
this.setState({visible: !disabled && scrollPos > 0});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
renderIcon = () => {
|
|
104
|
-
const {icon, iconClassName} = this.props;
|
|
105
|
-
let elem: ReactElement;
|
|
106
|
-
if (typeof icon === 'string')
|
|
107
|
-
elem = <AwesomeIcon name={icon} className={classNames('dvr-top-icon', iconClassName)}
|
|
108
|
-
style={{color: this.getIconColor()}}/>;
|
|
109
|
-
else elem = icon;
|
|
110
|
-
return elem;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
componentDidMount = () => {
|
|
114
|
-
window.addEventListener('scroll', this.scrollListener, {passive: true});
|
|
115
|
-
this.testInitialScrollPos();
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
componentWillUnmount = () => {
|
|
119
|
-
window.removeEventListener('scroll', this.scrollListener);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
render = () => {
|
|
123
|
-
const {visible} = this.state, {disabled, className} = this.props;
|
|
124
|
-
return (
|
|
125
|
-
<div className={classNames('dvr-top-btn', className, (!visible || disabled) && 'hidden')}
|
|
126
|
-
onClick={this.onClick} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}
|
|
127
|
-
style={{backgroundColor: this.getBackgroundColor()}}>
|
|
128
|
-
{this.renderIcon()}
|
|
129
|
-
<label className='hover-label'
|
|
130
|
-
style={{backgroundColor: this.getBackgroundColor(), color: this.getIconColor()}}>
|
|
131
|
-
Naar boven</label>
|
|
132
|
-
</div>
|
|
133
|
-
)
|
|
134
|
-
};
|
|
135
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
};
|