@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,140 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
@import '../../../style/variables';
|
|
6
|
+
|
|
7
|
+
.dvrd-select-container {
|
|
8
|
+
transition: margin-bottom .2s ease-in-out;
|
|
9
|
+
position: relative;
|
|
10
|
+
|
|
11
|
+
.dvrd-select-label {
|
|
12
|
+
color: $color-blue-text;
|
|
13
|
+
font-size: .9rem;
|
|
14
|
+
margin-bottom: .25rem;
|
|
15
|
+
display: block;
|
|
16
|
+
transition: color .2s ease-in-out;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.content-container {
|
|
20
|
+
border: 1px solid #D9D9D9;
|
|
21
|
+
border-radius: 4px;
|
|
22
|
+
transition: border-color .2s ease-in-out;
|
|
23
|
+
display: grid;
|
|
24
|
+
grid-template-columns: 1fr fit-content(100%);
|
|
25
|
+
grid-column-gap: .25rem;
|
|
26
|
+
align-items: center;
|
|
27
|
+
padding: .75rem;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
background-color: white;
|
|
30
|
+
|
|
31
|
+
.dvrd-select-value {
|
|
32
|
+
color: $color-blue-text;
|
|
33
|
+
font-family: avenir-light, sans-serif;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dvrd-select-search {
|
|
37
|
+
width: 100%;
|
|
38
|
+
outline: none;
|
|
39
|
+
border: none;
|
|
40
|
+
padding: .75rem;
|
|
41
|
+
color: #2A435F;
|
|
42
|
+
border-radius: inherit;
|
|
43
|
+
font-family: avenir-light, sans-serif;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dvrd-select-arrow {
|
|
47
|
+
font-size: .9rem;
|
|
48
|
+
color: #686869;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.search {
|
|
52
|
+
padding: 0 .75rem 0 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dvrd-select-items {
|
|
57
|
+
background-color: white;
|
|
58
|
+
position: absolute;
|
|
59
|
+
left: 0;
|
|
60
|
+
z-index: $z-index-high;
|
|
61
|
+
visibility: hidden;
|
|
62
|
+
opacity: 0;
|
|
63
|
+
transition: visibility .1s ease-in-out, opacity .1s ease-in-out, box-shadow .1s ease-in-out;
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
min-width: 100%;
|
|
67
|
+
border-radius: .5rem;
|
|
68
|
+
overflow-y: auto;
|
|
69
|
+
|
|
70
|
+
.dvrd-select-item {
|
|
71
|
+
padding: .75rem;
|
|
72
|
+
color: $color-blue-text;
|
|
73
|
+
background-color: white;
|
|
74
|
+
transition: background-color .2s ease-in-out;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
font-family: avenir-light, sans-serif;
|
|
77
|
+
white-space: nowrap;
|
|
78
|
+
|
|
79
|
+
&:hover {
|
|
80
|
+
background-color: #e9f2fe;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.bottom {
|
|
85
|
+
bottom: 0;
|
|
86
|
+
transform: translateY(100%);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.top {
|
|
90
|
+
top: 0;
|
|
91
|
+
transform: translateY(calc(-100% + 1rem));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&.open {
|
|
95
|
+
@include backgroundShadow;
|
|
96
|
+
visibility: visible;
|
|
97
|
+
opacity: 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.dvrd-select-error {
|
|
102
|
+
position: absolute;
|
|
103
|
+
bottom: 0;
|
|
104
|
+
transform: translateY(1rem);
|
|
105
|
+
left: 0;
|
|
106
|
+
color: red;
|
|
107
|
+
font-size: .8rem;
|
|
108
|
+
visibility: hidden;
|
|
109
|
+
opacity: 0;
|
|
110
|
+
transition: visibility .1s ease-in-out, opacity .1s ease-in-out;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&.disabled {
|
|
114
|
+
.content-container {
|
|
115
|
+
background-color: #F9FAFB;
|
|
116
|
+
cursor: not-allowed;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.error {
|
|
121
|
+
margin-bottom: 1rem;
|
|
122
|
+
|
|
123
|
+
.dvrd-select-label {
|
|
124
|
+
color: red;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.content-container {
|
|
128
|
+
border-color: red;
|
|
129
|
+
|
|
130
|
+
.dvrd-select-value {
|
|
131
|
+
color: red;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.dvrd-select-error {
|
|
136
|
+
visibility: visible;
|
|
137
|
+
opacity: 1;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
@import '../../../style/variables';
|
|
6
|
+
|
|
7
|
+
.selectContainer {
|
|
8
|
+
position: relative;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
margin-top: .8rem;
|
|
12
|
+
margin-bottom: 0;
|
|
13
|
+
transition: margin-bottom .2s ease-in-out;
|
|
14
|
+
|
|
15
|
+
&.fullWidth {
|
|
16
|
+
width: 100%;
|
|
17
|
+
|
|
18
|
+
.selectInputContainer .valueLabelContainer, .inputContainer {
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.selectInputContainer {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
align-items: center;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
|
|
29
|
+
.clearSelectButton {
|
|
30
|
+
font-size: .6rem;
|
|
31
|
+
color: red;
|
|
32
|
+
transition: color .2s ease-in-out;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
|
|
35
|
+
&:hover {
|
|
36
|
+
color: $color-red-1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.valueLabelContainer {
|
|
41
|
+
@include borderRadius(.2rem);
|
|
42
|
+
border-width: 2px;
|
|
43
|
+
border-style: solid;
|
|
44
|
+
padding: .7rem .6rem;
|
|
45
|
+
transition: border-color .2s ease-in-out;
|
|
46
|
+
width: 20.7rem;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
margin-right: .5rem;
|
|
49
|
+
position: relative;
|
|
50
|
+
background-color: white;
|
|
51
|
+
min-height: 2.8rem;
|
|
52
|
+
|
|
53
|
+
.selectLabel {
|
|
54
|
+
@include centerY;
|
|
55
|
+
position: absolute;
|
|
56
|
+
left: .2rem;
|
|
57
|
+
font-size: .8rem;
|
|
58
|
+
transition: top .2s ease-in-out, transform .2s ease-in-out, font-size .2s ease-in-out, left .2s ease-in-out;
|
|
59
|
+
background-color: white;
|
|
60
|
+
padding: .2rem;
|
|
61
|
+
color: $color-gray-4;
|
|
62
|
+
|
|
63
|
+
&.up {
|
|
64
|
+
@include borderRadius(.2rem);
|
|
65
|
+
transform: none;
|
|
66
|
+
top: -.8rem;
|
|
67
|
+
font-size: .7rem;
|
|
68
|
+
color: $color-gray-3;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.labelContainer {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: space-between;
|
|
75
|
+
align-items: center;
|
|
76
|
+
|
|
77
|
+
.valueLabel {
|
|
78
|
+
font-size: 1rem;
|
|
79
|
+
color: $color-gray-5;
|
|
80
|
+
user-select: none;
|
|
81
|
+
|
|
82
|
+
&.disabled, &.readOnly {
|
|
83
|
+
color: $color-gray-4;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&.hasError {
|
|
89
|
+
.selectLabel {
|
|
90
|
+
color: red !important;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.selectInput {
|
|
96
|
+
flex: 1;
|
|
97
|
+
margin-right: .5rem;
|
|
98
|
+
margin-top: 0;
|
|
99
|
+
cursor: text;
|
|
100
|
+
margin-bottom: 0;
|
|
101
|
+
|
|
102
|
+
.searchIcon {
|
|
103
|
+
font-size: 1.2rem;
|
|
104
|
+
color: $color-gray-5;
|
|
105
|
+
padding: 0;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.caretIcon {
|
|
110
|
+
transition: transform .2s ease-in-out;
|
|
111
|
+
|
|
112
|
+
&.down {
|
|
113
|
+
transition-delay: .2s;
|
|
114
|
+
transform: rotate(180deg);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
//.error {
|
|
119
|
+
// position: absolute;
|
|
120
|
+
// bottom: -1.4rem;
|
|
121
|
+
// left: .4rem;
|
|
122
|
+
// color: red;
|
|
123
|
+
// font-size: .9rem;
|
|
124
|
+
//}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.itemsContainer {
|
|
128
|
+
@include borderRadius(.5rem);
|
|
129
|
+
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);
|
|
130
|
+
background-color: white;
|
|
131
|
+
box-sizing: border-box;
|
|
132
|
+
border-top-left-radius: 0;
|
|
133
|
+
border: 1px solid $color-gray-7;
|
|
134
|
+
z-index: $z-index-high;
|
|
135
|
+
visibility: hidden;
|
|
136
|
+
opacity: 0;
|
|
137
|
+
transition: visibility .15s ease-in-out, opacity .15s ease-in-out;
|
|
138
|
+
transition-delay: .2s;
|
|
139
|
+
overflow-y: auto;
|
|
140
|
+
overflow-x: hidden;
|
|
141
|
+
|
|
142
|
+
.itemContainer {
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
background-color: white;
|
|
145
|
+
transition: color .2s ease-in-out, background-color .2s ease-in-out;
|
|
146
|
+
padding: .5rem;
|
|
147
|
+
user-select: none;
|
|
148
|
+
|
|
149
|
+
&.readOnly {
|
|
150
|
+
cursor: not-allowed;
|
|
151
|
+
.itemLabel {
|
|
152
|
+
color: $color-gray-3;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&.multiple {
|
|
157
|
+
display: flex;
|
|
158
|
+
justify-content: space-between;
|
|
159
|
+
align-items: center;
|
|
160
|
+
|
|
161
|
+
.selectedCheck {
|
|
162
|
+
color: $color-green-whatsapp;
|
|
163
|
+
font-size: 1rem;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.itemLabel {
|
|
168
|
+
cursor: inherit;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&.open {
|
|
173
|
+
visibility: visible;
|
|
174
|
+
opacity: 1;
|
|
175
|
+
transition-delay: 0s;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&.error {
|
|
180
|
+
margin-bottom: 2.4rem;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&.disabled, &.readOnly {
|
|
184
|
+
.selectInputContainer {
|
|
185
|
+
&, .selectInput {
|
|
186
|
+
cursor: not-allowed;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.native-select-container {
|
|
193
|
+
display: flex;
|
|
194
|
+
flex-direction: column;
|
|
195
|
+
|
|
196
|
+
.native-select-label {
|
|
197
|
+
margin-bottom: .2rem;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
import './style/sidebarMenu.scss';
|
|
5
|
+
|
|
6
|
+
import React, {MouseEventHandler, ReactNode, useContext, useEffect, useRef, useState} from 'react';
|
|
7
|
+
import {useLocation} from 'react-router';
|
|
8
|
+
import {SidebarItem, SideMenuMode} from "../util/interfaces";
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import {AwesomeIcon, generateComponentId, isAbsoluteLink} from "../../../index";
|
|
11
|
+
import {ControlContext} from "../util/controlContext";
|
|
12
|
+
import {defer} from 'lodash';
|
|
13
|
+
import { IconName } from '@fortawesome/fontawesome-svg-core';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
onClickItem: (item: SidebarItem) => MouseEventHandler;
|
|
17
|
+
items: SidebarItem[];
|
|
18
|
+
activeItem?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
baseColor?: string;
|
|
21
|
+
contrastColor?: string;
|
|
22
|
+
controlled?: boolean;
|
|
23
|
+
mode?: SideMenuMode;
|
|
24
|
+
id?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getTopItems(items: SidebarItem[]): SidebarItem[] {
|
|
28
|
+
return items.filter((item: SidebarItem) => !item.onBottom);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getBottomItems(items: SidebarItem[]): SidebarItem[] {
|
|
32
|
+
return items.filter((item: SidebarItem) => item.onBottom)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getActiveItem(items: SidebarItem[], pathname: string): SidebarItem | null {
|
|
36
|
+
for (const item of items) {
|
|
37
|
+
if (itemIsActive(item, pathname)) return item;
|
|
38
|
+
if (Array.isArray(item.children)) {
|
|
39
|
+
const activeItem = getActiveItem(item.children, pathname);
|
|
40
|
+
if (activeItem) return activeItem;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function itemIsActive(item: SidebarItem, pathname: string): boolean {
|
|
47
|
+
if (Array.isArray(item.route) && item.route.includes(pathname)) return true;
|
|
48
|
+
else if (item.route === pathname) return true;
|
|
49
|
+
else if (typeof item.route === 'string' && item.exactRoute === false && pathname.includes(item.route)) return true;
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function itemHasActiveId(item: SidebarItem, activeId: string): boolean {
|
|
54
|
+
if (item.id === activeId) return true;
|
|
55
|
+
else if (Array.isArray(item.children) && item.children.find((child: SidebarItem) => itemHasActiveId(child, activeId))) return true;
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default function SidebarMenu(props: Props) {
|
|
60
|
+
const context = useContext(ControlContext),
|
|
61
|
+
location = useLocation(),
|
|
62
|
+
{className, contrastColor, baseColor, items, onClickItem} = props,
|
|
63
|
+
mode = props.mode ?? SideMenuMode.COMPACT,
|
|
64
|
+
[activeItem, setActiveItem] = useState(props.activeItem ?? ''),
|
|
65
|
+
sideBar = useRef<HTMLDivElement>(null),
|
|
66
|
+
componentId = useRef(generateComponentId(props.id));
|
|
67
|
+
|
|
68
|
+
function _onClickItem(item: SidebarItem) {
|
|
69
|
+
return function (evt: React.MouseEvent) {
|
|
70
|
+
evt.stopPropagation();
|
|
71
|
+
const {route} = item;
|
|
72
|
+
let _route: string | null = null;
|
|
73
|
+
if (route) {
|
|
74
|
+
if (Array.isArray(route) && route.length) _route = route[0];
|
|
75
|
+
else _route = route as string;
|
|
76
|
+
}
|
|
77
|
+
if (_route && !isAbsoluteLink(_route))
|
|
78
|
+
setActiveItem(item.id);
|
|
79
|
+
onClickItem(item)(evt);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function renderItem(isChild: boolean = false) {
|
|
84
|
+
return function (item: SidebarItem) {
|
|
85
|
+
const {className, icon, id, label, children} = item,
|
|
86
|
+
isActive = itemHasActiveId(item, activeItem),
|
|
87
|
+
cls = classNames(className, mode === SideMenuMode.COMPACT ? 'side-bar-item' : 'side-bar-item-full',
|
|
88
|
+
isChild && 'child', children !== undefined && 'with-children');
|
|
89
|
+
return (
|
|
90
|
+
<div key={id} className={cls} onClick={_onClickItem(item)}>
|
|
91
|
+
{renderIcon(isActive, isChild, label, icon)}
|
|
92
|
+
{mode === SideMenuMode.COMPACT && <div className='active-indicator'/>}
|
|
93
|
+
<span className={classNames('item-label', isActive && 'active')}>{label}</span>
|
|
94
|
+
{children !== undefined && (
|
|
95
|
+
<>
|
|
96
|
+
{isActive && <div className='line'/>}
|
|
97
|
+
{renderChildren(isActive)(children)}
|
|
98
|
+
</>
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function renderChildren(isActive: boolean) {
|
|
106
|
+
return function (children: SidebarItem[]) {
|
|
107
|
+
const display = isActive ? 'block' : 'none';
|
|
108
|
+
return (
|
|
109
|
+
<div className='children-container' style={{display}}>
|
|
110
|
+
{children.map(renderItem(true))}
|
|
111
|
+
</div>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function renderIcon(isActive: boolean, isChild: boolean, label: string, icon?: IconName | ReactNode): ReactNode {
|
|
117
|
+
const className = classNames('item-icon', isActive && 'active');
|
|
118
|
+
if (icon) {
|
|
119
|
+
if (typeof icon === 'string') return <AwesomeIcon name={icon as IconName} className={className}/>;
|
|
120
|
+
else if (React.isValidElement(icon))
|
|
121
|
+
return React.cloneElement((icon as React.ReactElement),
|
|
122
|
+
{className: classNames(className, icon.props.className)});
|
|
123
|
+
}
|
|
124
|
+
if (label.length) {
|
|
125
|
+
if (isChild) return <span/>;
|
|
126
|
+
return <span className={classNames(className, 'letter')}>{label[0]}</span>
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function setColors() {
|
|
132
|
+
const bar = sideBar.current;
|
|
133
|
+
if (bar) {
|
|
134
|
+
const base: string = baseColor || context.baseColor,
|
|
135
|
+
contrast: string = contrastColor || context.contrastColor;
|
|
136
|
+
bar.style.setProperty('--base-color', base);
|
|
137
|
+
bar.style.setProperty('--contrast-color', contrast);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function _setActiveItem() {
|
|
142
|
+
const {pathname} = location;
|
|
143
|
+
const activeItem = getActiveItem(items, pathname);
|
|
144
|
+
if (activeItem) setActiveItem(activeItem.id);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
setColors();
|
|
149
|
+
defer(_setActiveItem);
|
|
150
|
+
}, []);
|
|
151
|
+
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
_setActiveItem()
|
|
154
|
+
}, [location]);
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<div className={classNames(className, 'dvr-side-bar-menu', mode === SideMenuMode.FULL && 'full')}
|
|
158
|
+
ref={sideBar} id={componentId.current}>
|
|
159
|
+
<div>
|
|
160
|
+
{getTopItems(items).map(renderItem())}
|
|
161
|
+
</div>
|
|
162
|
+
<div>
|
|
163
|
+
{getBottomItems(items).map(renderItem())}
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
@import '../../../style/variables';
|
|
6
|
+
|
|
7
|
+
.dvr-side-bar-menu {
|
|
8
|
+
//--base-color: white;
|
|
9
|
+
//--contrast-color: $color-blue-1;
|
|
10
|
+
@include backgroundShadow;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
position: fixed;
|
|
15
|
+
top: 4rem;
|
|
16
|
+
background-color: var(--contrast-color);
|
|
17
|
+
height: calc(100vh - 4rem);
|
|
18
|
+
width: 4rem;
|
|
19
|
+
z-index: $z-index-popup-4;
|
|
20
|
+
|
|
21
|
+
.side-bar-item {
|
|
22
|
+
border-bottom: 1px solid $color-gray-7;
|
|
23
|
+
height: 4rem;
|
|
24
|
+
width: 4rem;
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
align-items: center;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
position: relative;
|
|
30
|
+
background-color: var(--contrast-color-color);
|
|
31
|
+
transition: background-color .2s ease-in-out;
|
|
32
|
+
color: var(--base-color);
|
|
33
|
+
|
|
34
|
+
.item-icon {
|
|
35
|
+
color: $color-gray-4;
|
|
36
|
+
font-size: 1.5rem;
|
|
37
|
+
transition: color .2s ease-in-out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.item-label {
|
|
41
|
+
@include centerY;
|
|
42
|
+
border-radius: .5rem;
|
|
43
|
+
position: absolute;
|
|
44
|
+
padding: 4px 6px;
|
|
45
|
+
background-color: rgba(black, .6);
|
|
46
|
+
color: white;
|
|
47
|
+
left: 115%;
|
|
48
|
+
visibility: hidden;
|
|
49
|
+
opacity: 0;
|
|
50
|
+
transition: visibility .2s ease-in-out, opacity .2s ease-in-out;
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.active-indicator {
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 0;
|
|
57
|
+
right: 0;
|
|
58
|
+
height: 100%;
|
|
59
|
+
width: 3px;
|
|
60
|
+
background-color: var(--base-color);
|
|
61
|
+
visibility: hidden;
|
|
62
|
+
opacity: 0;
|
|
63
|
+
transition: visibility .2s ease-in-out, opacity .2s ease-in-out;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:hover {
|
|
67
|
+
.item-label {
|
|
68
|
+
visibility: visible;
|
|
69
|
+
opacity: 1;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.active {
|
|
74
|
+
.active-indicator {
|
|
75
|
+
visibility: visible;
|
|
76
|
+
opacity: 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.item-icon {
|
|
80
|
+
color: var(--base-color);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&.full {
|
|
86
|
+
width: unset;
|
|
87
|
+
box-shadow: none;
|
|
88
|
+
background-color: transparent;
|
|
89
|
+
position: sticky;
|
|
90
|
+
display: inline-flex;
|
|
91
|
+
height: calc(100vh - 5rem);
|
|
92
|
+
top: 5rem;
|
|
93
|
+
|
|
94
|
+
.side-bar-item-full {
|
|
95
|
+
display: grid;
|
|
96
|
+
grid-template-columns: 2rem auto;
|
|
97
|
+
grid-column-gap: 1rem;
|
|
98
|
+
margin: 2rem 1rem;
|
|
99
|
+
align-items: center;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
position: relative;
|
|
102
|
+
|
|
103
|
+
.item-icon {
|
|
104
|
+
color: #686869;
|
|
105
|
+
font-size: 1.5rem;
|
|
106
|
+
transition: color .2s ease-in-out;
|
|
107
|
+
justify-self: center;
|
|
108
|
+
opacity: .5;
|
|
109
|
+
|
|
110
|
+
&.active {
|
|
111
|
+
color: var(--base-color);
|
|
112
|
+
opacity: 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.item-label {
|
|
117
|
+
color: #686869;
|
|
118
|
+
transition: color .2s ease-in-out;
|
|
119
|
+
white-space: nowrap;
|
|
120
|
+
|
|
121
|
+
&.active {
|
|
122
|
+
font-weight: 600;
|
|
123
|
+
color: black;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.line {
|
|
128
|
+
width: 2px;
|
|
129
|
+
position: absolute;
|
|
130
|
+
height: calc(100% - 1.5rem);
|
|
131
|
+
top: 2rem;
|
|
132
|
+
left: 1rem;
|
|
133
|
+
background-color: var(--base-color);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&.child {
|
|
137
|
+
margin-bottom: .5rem !important;
|
|
138
|
+
|
|
139
|
+
.item-label {
|
|
140
|
+
padding-left: 1rem;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:last-child {
|
|
144
|
+
margin-bottom: 0;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.children-container {
|
|
149
|
+
padding-top: 1rem;
|
|
150
|
+
|
|
151
|
+
.side-bar-item-full {
|
|
152
|
+
margin: 0;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&:hover {
|
|
157
|
+
.item-label {
|
|
158
|
+
color: black;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&.with-children {
|
|
163
|
+
margin-bottom: -.5rem;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|