@dvrd/dvr-controls 1.0.6 → 1.0.7
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 -145
- 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,357 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
-
*/
|
|
4
|
-
import './style/dvrdDatePicker.scss';
|
|
5
|
-
|
|
6
|
-
import classNames from 'classnames';
|
|
7
|
-
import {Moment} from 'moment';
|
|
8
|
-
import React, {PureComponent, useState} from 'react';
|
|
9
|
-
import {ChangeFunction, ErrorType} from '../util/interfaces';
|
|
10
|
-
import AwesomeIcon from '../icon/awesomeIcon';
|
|
11
|
-
import {toMoment} from '../util/momentUtil';
|
|
12
|
-
import WithBackground from '../popup/withBackground';
|
|
13
|
-
import DvrdButton from "../button/dvrdButton";
|
|
14
|
-
|
|
15
|
-
interface Props {
|
|
16
|
-
onChange: ChangeFunction<Moment>;
|
|
17
|
-
closeOnChange?: boolean;
|
|
18
|
-
value: Moment | null;
|
|
19
|
-
label: string;
|
|
20
|
-
error?: ErrorType;
|
|
21
|
-
className?: string;
|
|
22
|
-
placeholder?: string;
|
|
23
|
-
dateFormat?: string;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
alwaysShowArrows?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default function DvrdDatePicker(props: Props) {
|
|
29
|
-
const {
|
|
30
|
-
onChange, className, closeOnChange, error, label, value, dateFormat, placeholder, disabled, alwaysShowArrows
|
|
31
|
-
} = props,
|
|
32
|
-
[pickerOpen, setPickerOpen] = useState(false);
|
|
33
|
-
|
|
34
|
-
function onClickContainer() {
|
|
35
|
-
if (!disabled)
|
|
36
|
-
setPickerOpen(true);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const onChangePicker = (daySelected: boolean) => (value: Moment) => {
|
|
40
|
-
onChange(value);
|
|
41
|
-
if (closeOnChange && daySelected) onClosePicker();
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
function onClosePicker() {
|
|
45
|
-
setPickerOpen(false)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const format = dateFormat ?? 'YYYY-MM-DD';
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<div className={classNames('dvrd-date-picker', className, error && 'error')}>
|
|
52
|
-
<label className='field-label'>{label}</label>
|
|
53
|
-
<div className='value-container' onClick={onClickContainer}>
|
|
54
|
-
<label className={classNames('value', !value && 'placeholder')}>{value?.format(format) ?? placeholder ??
|
|
55
|
-
''}</label>
|
|
56
|
-
<AwesomeIcon name='calendar-alt' className='calendar-icon'/>
|
|
57
|
-
</div>
|
|
58
|
-
<Picker onClose={onClosePicker} onChange={onChangePicker} open={pickerOpen} value={value}
|
|
59
|
-
alwaysShowArrows={alwaysShowArrows}/>
|
|
60
|
-
<label className='error-label'>{error}</label>
|
|
61
|
-
</div>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
interface PickerProps {
|
|
66
|
-
onChange: (daySelected: boolean) => ChangeFunction<Moment>;
|
|
67
|
-
onClose: VoidFunction;
|
|
68
|
-
value: Moment | null;
|
|
69
|
-
open: boolean;
|
|
70
|
-
alwaysShowArrows?: boolean;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
class Picker extends PureComponent<PickerProps> {
|
|
74
|
-
private ref: HTMLDivElement | null = null;
|
|
75
|
-
|
|
76
|
-
getPickerValue = (): Moment => toMoment(this.props.value);
|
|
77
|
-
|
|
78
|
-
onReduce = (key: 'year' | 'month') => () => {
|
|
79
|
-
const {onChange} = this.props, pickerValue = this.getPickerValue();
|
|
80
|
-
pickerValue.add(-1, key);
|
|
81
|
-
pickerValue.date(Math.min(pickerValue.daysInMonth(), pickerValue.date()))
|
|
82
|
-
onChange(false)(pickerValue);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
onAdd = (key: 'year' | 'month') => () => {
|
|
86
|
-
const {onChange} = this.props, pickerValue = this.getPickerValue();
|
|
87
|
-
pickerValue.add(1, key);
|
|
88
|
-
pickerValue.date(Math.min(pickerValue.daysInMonth(), pickerValue.date()))
|
|
89
|
-
onChange(false)(pickerValue);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
onResetSwitcher = (key: 'year' | 'month') => () => {
|
|
93
|
-
const {onChange} = this.props, pickerValue = this.getPickerValue();
|
|
94
|
-
if (key === 'year') pickerValue.year(toMoment().year());
|
|
95
|
-
else pickerValue.month(toMoment().month());
|
|
96
|
-
pickerValue.date(Math.min(pickerValue.daysInMonth(), pickerValue.date()))
|
|
97
|
-
onChange(false)(pickerValue);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
onClickToday = () => {
|
|
101
|
-
const {onChange} = this.props;
|
|
102
|
-
onChange(true)(toMoment());
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
onSelectDay = (day: number, month?: number, year?: number) => () => {
|
|
106
|
-
const {onChange, value} = this.props, pickerValue = this.getPickerValue();
|
|
107
|
-
if (day !== pickerValue.date() || value === null) {
|
|
108
|
-
pickerValue.date(day);
|
|
109
|
-
if (month !== undefined) pickerValue.month(month);
|
|
110
|
-
if (year !== undefined) pickerValue.year(year);
|
|
111
|
-
onChange(true)(pickerValue);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
onSelectPadDay = (day: number, kind: 'prev' | 'next') => () => {
|
|
116
|
-
const {onChange} = this.props, pickerValue = this.getPickerValue();
|
|
117
|
-
const value = pickerValue.clone();
|
|
118
|
-
if (kind === 'prev') value.add(-1, 'month');
|
|
119
|
-
else value.add(1, 'month');
|
|
120
|
-
value.date(day);
|
|
121
|
-
onChange(true)(value);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
keyListener = (evt: KeyboardEvent) => {
|
|
125
|
-
const {key, shiftKey, ctrlKey} = evt, {onClose} = this.props;
|
|
126
|
-
if (['ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown', 'Enter'].includes(key)) {
|
|
127
|
-
evt.preventDefault();
|
|
128
|
-
}
|
|
129
|
-
if (key === 'ArrowLeft') {
|
|
130
|
-
this.onLeftKey(shiftKey, ctrlKey);
|
|
131
|
-
} else if (key === 'ArrowRight') {
|
|
132
|
-
this.onRightKey(shiftKey, ctrlKey);
|
|
133
|
-
} else if (key === 'ArrowUp') {
|
|
134
|
-
this.onUpKey();
|
|
135
|
-
} else if (key === 'ArrowDown') {
|
|
136
|
-
this.onDownKey();
|
|
137
|
-
} else if (key === 'Enter') {
|
|
138
|
-
onClose();
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
onLeftKey = (shiftKey: boolean, ctrlKey: boolean) => {
|
|
143
|
-
const {onChange} = this.props, pickerValue = this.getPickerValue()
|
|
144
|
-
if (shiftKey) {
|
|
145
|
-
if (ctrlKey) this.onReduce('year')();
|
|
146
|
-
else this.onReduce('month')();
|
|
147
|
-
} else onChange(false)(pickerValue.add(-1, 'd'));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
onRightKey = (shiftKey: boolean, ctrlKey: boolean) => {
|
|
151
|
-
const {onChange} = this.props, pickerValue = this.getPickerValue();
|
|
152
|
-
if (shiftKey) {
|
|
153
|
-
if (ctrlKey) this.onAdd('year')();
|
|
154
|
-
else this.onAdd('month')();
|
|
155
|
-
} else onChange(false)(pickerValue.add(1, 'd'));
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
onUpKey = () => {
|
|
159
|
-
const {onChange} = this.props, pickerValue = this.getPickerValue();
|
|
160
|
-
onChange(false)(pickerValue.add(-7, 'd'));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
onDownKey = () => {
|
|
164
|
-
const {onChange} = this.props, pickerValue = this.getPickerValue();
|
|
165
|
-
onChange(false)(pickerValue.add(7, 'd'));
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
addMountClass = () => {
|
|
169
|
-
if (!this.ref?.classList.contains('switch-mount'))
|
|
170
|
-
this.ref?.classList.add('switch-mount');
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
removeMountClass = () => {
|
|
174
|
-
if (!this.props.alwaysShowArrows)
|
|
175
|
-
this.ref?.classList.remove('switch-mount');
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
renderSwitcher = (key: 'year' | 'month', kind: 'add' | 'reduce') => {
|
|
179
|
-
const icon = kind === 'add' ? 'chevron-right' : 'chevron-left',
|
|
180
|
-
title = kind === 'add' ? 'Volgende' : 'Vorige',
|
|
181
|
-
onClick = kind === 'add' ? this.onAdd(key) : this.onReduce(key);
|
|
182
|
-
return <AwesomeIcon name={icon} title={title} className={classNames('switcher-icon', kind)} onClick={onClick}/>
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
renderTooltipContainer = () => {
|
|
186
|
-
return (
|
|
187
|
-
<div className='tooltip-container'>
|
|
188
|
-
<AwesomeIcon name='question-circle' className='tooltip-icon' prefix='far'/>
|
|
189
|
-
<div className='tooltip'>
|
|
190
|
-
<label className='tooltip-label'>Shortcuts</label>
|
|
191
|
-
<div className='key'>
|
|
192
|
-
<AwesomeIcon name='arrow-left' className='shortcut'/>
|
|
193
|
-
<span className='directive'>-1 dag</span>
|
|
194
|
-
</div>
|
|
195
|
-
<div className='key'>
|
|
196
|
-
<div className='directives'>
|
|
197
|
-
<span className='shortcut text'>SHIFT</span>
|
|
198
|
-
<span className='directive'>+</span>
|
|
199
|
-
<AwesomeIcon name='arrow-left' className='shortcut'/>
|
|
200
|
-
</div>
|
|
201
|
-
<span className='directive'>-1 maand</span>
|
|
202
|
-
</div>
|
|
203
|
-
<div className='key'>
|
|
204
|
-
<div className='directives full'>
|
|
205
|
-
<span className='shortcut text'>CTRL</span>
|
|
206
|
-
<span className='directive'>+</span>
|
|
207
|
-
<span className='shortcut text'>SHIFT</span>
|
|
208
|
-
<span className='directive'>+</span>
|
|
209
|
-
<AwesomeIcon name='arrow-left' className='shortcut'/>
|
|
210
|
-
</div>
|
|
211
|
-
<span className='directive'>-1 jaar</span>
|
|
212
|
-
</div>
|
|
213
|
-
<div className='key'>
|
|
214
|
-
<AwesomeIcon name='arrow-right' className='shortcut'/>
|
|
215
|
-
<span className='directive'>+1 dag</span>
|
|
216
|
-
</div>
|
|
217
|
-
<div className='key'>
|
|
218
|
-
<div className='directives'>
|
|
219
|
-
<span className='shortcut text'>SHIFT</span>
|
|
220
|
-
<span className='directive'>+</span>
|
|
221
|
-
<AwesomeIcon name='arrow-right' className='shortcut'/>
|
|
222
|
-
</div>
|
|
223
|
-
<span className='directive'>+1 maand</span>
|
|
224
|
-
</div>
|
|
225
|
-
<div className='key'>
|
|
226
|
-
<div className='directives full'>
|
|
227
|
-
<span className='shortcut text'>CTRL</span>
|
|
228
|
-
<span className='directive'>+</span>
|
|
229
|
-
<span className='shortcut text'>SHIFT</span>
|
|
230
|
-
<span className='directive'>+</span>
|
|
231
|
-
<AwesomeIcon name='arrow-right' className='shortcut'/>
|
|
232
|
-
</div>
|
|
233
|
-
<span className='directive'>+1 jaar</span>
|
|
234
|
-
</div>
|
|
235
|
-
<div className='key'>
|
|
236
|
-
<AwesomeIcon name='arrow-up' className='shortcut'/>
|
|
237
|
-
<span className='directive'>-7 dagen</span>
|
|
238
|
-
</div>
|
|
239
|
-
<div className='key'>
|
|
240
|
-
<AwesomeIcon name='arrow-down' className='shortcut'/>
|
|
241
|
-
<span className='directive'>+7 dagen</span>
|
|
242
|
-
</div>
|
|
243
|
-
</div>
|
|
244
|
-
</div>
|
|
245
|
-
)
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
componentDidUpdate = (prevProps: PickerProps) => {
|
|
249
|
-
const {open} = this.props, prevOpen = prevProps.open;
|
|
250
|
-
if (open && !prevOpen) {
|
|
251
|
-
document.addEventListener('keydown', this.keyListener);
|
|
252
|
-
this.addMountClass();
|
|
253
|
-
window.setTimeout(this.removeMountClass, 500);
|
|
254
|
-
} else if (!open && prevOpen) document.removeEventListener('keydown', this.keyListener);
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
componentWillUnmount = () => {
|
|
258
|
-
document.removeEventListener('keydown', this.keyListener);
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
render = () => {
|
|
262
|
-
const {open, onClose} = this.props, pickerValue = this.getPickerValue(),
|
|
263
|
-
daysInMonth = pickerValue.daysInMonth(), days: number[] = [], padBeforeDays: number[] = [],
|
|
264
|
-
padAfterDays: number[] = [];
|
|
265
|
-
for (let i = 1; i <= daysInMonth; i++) days.push(i);
|
|
266
|
-
let firstMonthDay = pickerValue.clone().date(1).day();
|
|
267
|
-
if (!firstMonthDay) firstMonthDay = 7;
|
|
268
|
-
const padDaysBefore = firstMonthDay - 1;
|
|
269
|
-
let dayBefore = pickerValue.clone().add(-1, 'month').daysInMonth()
|
|
270
|
-
for (let i = 0; i < padDaysBefore; i++)
|
|
271
|
-
padBeforeDays.splice(0, 0, dayBefore--);
|
|
272
|
-
|
|
273
|
-
const lastWeekDay = pickerValue.clone().date(daysInMonth).day();
|
|
274
|
-
const padDaysAfter = 7 - lastWeekDay;
|
|
275
|
-
for (let i = 0; i < padDaysAfter; i++)
|
|
276
|
-
padAfterDays.push(i + 1);
|
|
277
|
-
|
|
278
|
-
if (Math.ceil(padAfterDays.concat(days).concat(padBeforeDays).length / 7) < 6) {
|
|
279
|
-
let dayAfter = padAfterDays[padAfterDays.length - 1] + 1;
|
|
280
|
-
for (let i = 0; i < 7; i++)
|
|
281
|
-
padAfterDays.push(dayAfter++);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
return (
|
|
285
|
-
<WithBackground active={open} onClose={onClose}>
|
|
286
|
-
<div className='picker' ref={(ref: HTMLDivElement) => {
|
|
287
|
-
this.ref = ref
|
|
288
|
-
}}>
|
|
289
|
-
<div className='switcher year'>
|
|
290
|
-
{this.renderSwitcher('year', 'reduce')}
|
|
291
|
-
<label className='switcher-label'
|
|
292
|
-
onClick={this.onResetSwitcher('year')}>{pickerValue.year()}</label>
|
|
293
|
-
{this.renderSwitcher('year', 'add')}
|
|
294
|
-
</div>
|
|
295
|
-
<div className='switcher month'>
|
|
296
|
-
{this.renderSwitcher('month', 'reduce')}
|
|
297
|
-
<label className='switcher-label' onClick={this.onResetSwitcher('month')}>{pickerValue.format(
|
|
298
|
-
'MMMM')}</label>
|
|
299
|
-
{this.renderSwitcher('month', 'add')}
|
|
300
|
-
</div>
|
|
301
|
-
<div className='current-date-container'>
|
|
302
|
-
<label className='current-date-label'>{pickerValue.format('dddd D MMMM YYYY')}</label>
|
|
303
|
-
{this.renderTooltipContainer()}
|
|
304
|
-
</div>
|
|
305
|
-
<div className='days-container'>
|
|
306
|
-
<div className='day no-select'>
|
|
307
|
-
<span className='day-label'>Ma</span>
|
|
308
|
-
</div>
|
|
309
|
-
<div className='day no-select'>
|
|
310
|
-
<span className='day-label'>Di</span>
|
|
311
|
-
</div>
|
|
312
|
-
<div className='day no-select'>
|
|
313
|
-
<span className='day-label'>Wo</span>
|
|
314
|
-
</div>
|
|
315
|
-
<div className='day no-select'>
|
|
316
|
-
<span className='day-label'>Do</span>
|
|
317
|
-
</div>
|
|
318
|
-
<div className='day no-select'>
|
|
319
|
-
<span className='day-label'>Vr</span>
|
|
320
|
-
</div>
|
|
321
|
-
<div className='day no-select'>
|
|
322
|
-
<span className='day-label'>Za</span>
|
|
323
|
-
</div>
|
|
324
|
-
<div className='day no-select'>
|
|
325
|
-
<span className='day-label'>Zo</span>
|
|
326
|
-
</div>
|
|
327
|
-
{padBeforeDays.map((day: number, index: number) => (
|
|
328
|
-
<div className={classNames('day', 'pad')} onClick={this.onSelectPadDay(day, 'prev')}
|
|
329
|
-
key={index}>
|
|
330
|
-
<span className='day-label'>{day}</span>
|
|
331
|
-
</div>
|
|
332
|
-
))}
|
|
333
|
-
{days.map((day: number, index: number) => {
|
|
334
|
-
const isSelected = day === pickerValue.date();
|
|
335
|
-
return (
|
|
336
|
-
<div className={classNames('day', isSelected && 'selected', day === 0 && 'hide')}
|
|
337
|
-
key={index} onClick={this.onSelectDay(day)}>
|
|
338
|
-
<span className='day-label'>{day}</span>
|
|
339
|
-
</div>
|
|
340
|
-
)
|
|
341
|
-
})}
|
|
342
|
-
{padAfterDays.map((day: number, index: number) => (
|
|
343
|
-
<div className={classNames('day', 'pad')} onClick={this.onSelectPadDay(day, 'next')}
|
|
344
|
-
key={index}>
|
|
345
|
-
<span className='day-label'>{day}</span>
|
|
346
|
-
</div>
|
|
347
|
-
))}
|
|
348
|
-
</div>
|
|
349
|
-
<div className='actions-container'>
|
|
350
|
-
<DvrdButton onClick={this.onClickToday} label='Vandaag' className='action'/>
|
|
351
|
-
<DvrdButton onClick={onClose} label='Sluiten' secondary className='action'/>
|
|
352
|
-
</div>
|
|
353
|
-
</div>
|
|
354
|
-
</WithBackground>
|
|
355
|
-
)
|
|
356
|
-
}
|
|
357
|
-
}
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
@import '../../../style/variables';
|
|
6
|
-
|
|
7
|
-
.dvrd-date-picker {
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
color: $color-blue-text;
|
|
11
|
-
position: relative;
|
|
12
|
-
|
|
13
|
-
.field-label {
|
|
14
|
-
font-size: .9rem;
|
|
15
|
-
margin-bottom: .25rem;
|
|
16
|
-
display: block;
|
|
17
|
-
transition: color .1s ease-in-out;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.value-container {
|
|
21
|
-
border: 1px solid #D9D9D9;
|
|
22
|
-
border-radius: 4px;
|
|
23
|
-
padding: .75rem;
|
|
24
|
-
transition: border-color .1s ease-in-out;
|
|
25
|
-
position: relative;
|
|
26
|
-
cursor: pointer;
|
|
27
|
-
background-color: white;
|
|
28
|
-
|
|
29
|
-
.value {
|
|
30
|
-
transition: color .1s ease-in-out;
|
|
31
|
-
|
|
32
|
-
&.placeholder {
|
|
33
|
-
color: $color-gray-4;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.calendar-icon {
|
|
38
|
-
position: absolute;
|
|
39
|
-
right: .75rem;
|
|
40
|
-
top: 50%;
|
|
41
|
-
transform: translateY(-50%);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.picker {
|
|
46
|
-
@include backgroundShadow2;
|
|
47
|
-
--day-size: 26px;
|
|
48
|
-
background-color: white;
|
|
49
|
-
display: grid;
|
|
50
|
-
grid-template-columns: 1fr;
|
|
51
|
-
width: calc(var(--day-size) * 7 + .5rem * 6 + 1rem);
|
|
52
|
-
max-width: 100vw;
|
|
53
|
-
color: $color-blue-text;
|
|
54
|
-
|
|
55
|
-
.switcher, .current-date-container, .days-container, .today-container, .actions-container {
|
|
56
|
-
padding: .5rem;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.switcher {
|
|
60
|
-
display: grid;
|
|
61
|
-
justify-content: center;
|
|
62
|
-
background-color: $color-blue-1;
|
|
63
|
-
color: white;
|
|
64
|
-
align-items: center;
|
|
65
|
-
grid-column-gap: .5rem;
|
|
66
|
-
|
|
67
|
-
.switcher-label {
|
|
68
|
-
cursor: pointer;
|
|
69
|
-
user-select: none;
|
|
70
|
-
border-bottom: 1px solid transparent;
|
|
71
|
-
transition: border-color .2s ease-in-out;
|
|
72
|
-
text-align: center;
|
|
73
|
-
justify-self: center;
|
|
74
|
-
|
|
75
|
-
&:hover {
|
|
76
|
-
border-bottom-color: currentColor;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.switcher-icon {
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
font-size: .9rem;
|
|
83
|
-
visibility: hidden;
|
|
84
|
-
opacity: 0;
|
|
85
|
-
transition: color .2s ease-in-out, opacity .2s ease-in-out, visibility .2s ease-in-out;
|
|
86
|
-
padding: .25rem;
|
|
87
|
-
user-select: none;
|
|
88
|
-
|
|
89
|
-
&:hover {
|
|
90
|
-
color: $color-gray-7;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&.year {
|
|
95
|
-
grid-template-columns: fit-content(100%) 2rem fit-content(100%);
|
|
96
|
-
padding-bottom: .25rem;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&.month {
|
|
100
|
-
grid-template-columns: fit-content(100%) 4.5rem fit-content(100%);
|
|
101
|
-
padding-top: .25rem;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
&:hover {
|
|
105
|
-
.switcher-icon {
|
|
106
|
-
visibility: visible;
|
|
107
|
-
opacity: 1;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
&:first-child {
|
|
112
|
-
border-radius: .5rem .5rem 0 0;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.current-date-container {
|
|
117
|
-
position: relative;
|
|
118
|
-
display: flex;
|
|
119
|
-
justify-content: center;
|
|
120
|
-
|
|
121
|
-
.current-date-label {
|
|
122
|
-
font-size: .9rem;
|
|
123
|
-
color: $color-gray-3;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.tooltip-container {
|
|
127
|
-
@include centerY;
|
|
128
|
-
position: absolute;
|
|
129
|
-
right: .5rem;
|
|
130
|
-
|
|
131
|
-
.tooltip-icon {
|
|
132
|
-
color: $color-gray-3;
|
|
133
|
-
font-size: .8rem;
|
|
134
|
-
cursor: help;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.tooltip {
|
|
138
|
-
position: absolute;
|
|
139
|
-
left: 0;
|
|
140
|
-
bottom: 0;
|
|
141
|
-
transform: translateY(100%);
|
|
142
|
-
background-color: white;
|
|
143
|
-
box-shadow: none;
|
|
144
|
-
visibility: hidden;
|
|
145
|
-
opacity: 0;
|
|
146
|
-
border-radius: .25rem !important;
|
|
147
|
-
padding: .25rem;
|
|
148
|
-
transition: visibility .2s ease-in-out, opacity .2s ease-in-out, box-shadow .2s ease-in-out;
|
|
149
|
-
display: grid;
|
|
150
|
-
grid-template-columns: auto;
|
|
151
|
-
grid-row-gap: .5rem;
|
|
152
|
-
border: 1px solid $color-gray-4;
|
|
153
|
-
|
|
154
|
-
.tooltip-label {
|
|
155
|
-
justify-self: center;
|
|
156
|
-
font-size: .8rem;
|
|
157
|
-
color: $color-gray-3;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.key {
|
|
161
|
-
display: grid;
|
|
162
|
-
grid-column-gap: .5rem;
|
|
163
|
-
grid-template-columns: 9.4rem fit-content(100%);
|
|
164
|
-
align-items: center;
|
|
165
|
-
justify-items: end;
|
|
166
|
-
|
|
167
|
-
.directives {
|
|
168
|
-
display: grid;
|
|
169
|
-
grid-template-columns: repeat(3, fit-content(100%));
|
|
170
|
-
grid-column-gap: .5rem;
|
|
171
|
-
align-items: center;
|
|
172
|
-
|
|
173
|
-
&.full {
|
|
174
|
-
grid-template-columns: repeat(5, fit-content(100%));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.shortcut, .directive {
|
|
179
|
-
font-size: .8rem;
|
|
180
|
-
color: $color-gray-3;
|
|
181
|
-
white-space: nowrap;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.shortcut {
|
|
185
|
-
font-size: .7rem;
|
|
186
|
-
padding: .1rem .25rem;
|
|
187
|
-
border: 1px solid $color-gray-3;
|
|
188
|
-
|
|
189
|
-
&.text {
|
|
190
|
-
padding: 0 .25rem;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.directive {
|
|
195
|
-
display: block;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
&:hover {
|
|
201
|
-
.tooltip {
|
|
202
|
-
@include backgroundShadow;
|
|
203
|
-
visibility: visible;
|
|
204
|
-
opacity: 1;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.days-container {
|
|
211
|
-
display: grid;
|
|
212
|
-
grid-template-columns: repeat(7, var(--day-size));
|
|
213
|
-
grid-gap: .5rem;
|
|
214
|
-
|
|
215
|
-
.day {
|
|
216
|
-
width: var(--day-size);
|
|
217
|
-
height: var(--day-size);
|
|
218
|
-
display: flex;
|
|
219
|
-
justify-content: center;
|
|
220
|
-
align-items: center;
|
|
221
|
-
border-radius: 50%;
|
|
222
|
-
cursor: pointer;
|
|
223
|
-
transition: color .2s ease-in-out, background-color .2s ease-in-out;
|
|
224
|
-
|
|
225
|
-
.day-label {
|
|
226
|
-
font-size: 14px;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
&.no-select, &.hide, {
|
|
230
|
-
pointer-events: none;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
&.hide {
|
|
234
|
-
visibility: hidden;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
&.pad {
|
|
238
|
-
color: $color-gray-4;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
&.selected {
|
|
242
|
-
background-color: $color-blue-1 !important;
|
|
243
|
-
color: white;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
&:hover {
|
|
247
|
-
background-color: rgba($color-blue-1, .2);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.extra-row {
|
|
252
|
-
grid-column-start: span 7;
|
|
253
|
-
height: 24px;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.actions-container {
|
|
258
|
-
display: flex;
|
|
259
|
-
justify-content: space-between;
|
|
260
|
-
align-items: center;
|
|
261
|
-
|
|
262
|
-
.action {
|
|
263
|
-
padding: .5rem;
|
|
264
|
-
|
|
265
|
-
.dvrd-button-label {
|
|
266
|
-
font-size: .9rem;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
&.switch-mount {
|
|
272
|
-
.switcher {
|
|
273
|
-
.switcher-icon {
|
|
274
|
-
visibility: visible !important;
|
|
275
|
-
opacity: 1 !important;
|
|
276
|
-
transition: none !important;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
.error-label {
|
|
283
|
-
position: absolute;
|
|
284
|
-
bottom: 0;
|
|
285
|
-
transform: translateY(1rem);
|
|
286
|
-
left: 0;
|
|
287
|
-
color: red;
|
|
288
|
-
font-size: .8rem;
|
|
289
|
-
visibility: hidden;
|
|
290
|
-
opacity: 0;
|
|
291
|
-
transition: visibility .1s ease-in-out, opacity .1s ease-in-out;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
&.error {
|
|
295
|
-
margin-bottom: 1rem;
|
|
296
|
-
color: red;
|
|
297
|
-
|
|
298
|
-
.value-container {
|
|
299
|
-
border-color: red;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
.error-label {
|
|
303
|
-
visibility: visible;
|
|
304
|
-
opacity: 1;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|