@dvrd/dvr-controls 0.0.40 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/js/select/dvrdSelect.tsx +1 -1
- package/src/js/sidebarMenu/style/sidebarMenu.scss +9 -9
- package/src/js/textField/dvrdInput.tsx +2 -0
- package/src/js/textField/style/dvrdInput.scss +3 -3
- package/src/js/util/controlContext.tsx +15 -17
- package/src/style/variables.scss +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvrd/dvr-controls",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Custom web controls",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {},
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"1": "not dead",
|
|
16
16
|
"2": "ie >= 11"
|
|
17
17
|
},
|
|
18
|
-
"
|
|
18
|
+
"dependencies": {
|
|
19
19
|
"@types/js-cookie": "^2.2.6",
|
|
20
20
|
"@types/lodash": "^4.14.168",
|
|
21
21
|
"@types/node": "^14.14.34",
|
|
@@ -81,7 +81,7 @@ export default class DvrdSelect extends PureComponent<Props, State> {
|
|
|
81
81
|
getValueLabel = (): string | number => {
|
|
82
82
|
const {value, items} = this.props;
|
|
83
83
|
for (const item of items)
|
|
84
|
-
if (item.value === value) return item.label;
|
|
84
|
+
if (item.value === value) return item.inputLabel ?? item.label;
|
|
85
85
|
return '';
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
@import '../../../style/variables';
|
|
6
6
|
|
|
7
7
|
.dvr-side-bar-menu {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
//--base-color: white;
|
|
9
|
+
//--contrast-color: $color-blue-1;
|
|
10
10
|
@include backgroundShadow;
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
justify-content: space-between;
|
|
14
14
|
position: fixed;
|
|
15
15
|
top: 4rem;
|
|
16
|
-
background-color: var(--
|
|
16
|
+
background-color: var(--contrast-color);
|
|
17
17
|
height: calc(100vh - 4rem);
|
|
18
18
|
width: 4rem;
|
|
19
19
|
z-index: $z-index-popup-4;
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
align-items: center;
|
|
28
28
|
cursor: pointer;
|
|
29
29
|
position: relative;
|
|
30
|
-
background-color: var(--
|
|
30
|
+
background-color: var(--contrast-color-color);
|
|
31
31
|
transition: background-color .2s ease-in-out;
|
|
32
|
-
color: var(--
|
|
32
|
+
color: var(--base-color);
|
|
33
33
|
|
|
34
34
|
.item-icon {
|
|
35
35
|
color: $color-gray-4;
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
right: 0;
|
|
58
58
|
height: 100%;
|
|
59
59
|
width: 3px;
|
|
60
|
-
background-color: var(--
|
|
60
|
+
background-color: var(--base-color);
|
|
61
61
|
visibility: hidden;
|
|
62
62
|
opacity: 0;
|
|
63
63
|
transition: visibility .2s ease-in-out, opacity .2s ease-in-out;
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
.item-icon {
|
|
80
|
-
color: var(--
|
|
80
|
+
color: var(--base-color);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
opacity: .5;
|
|
109
109
|
|
|
110
110
|
&.active {
|
|
111
|
-
color: var(--
|
|
111
|
+
color: var(--base-color);
|
|
112
112
|
opacity: 1;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
height: calc(100% - 1.5rem);
|
|
131
131
|
top: 2rem;
|
|
132
132
|
left: 1rem;
|
|
133
|
-
background-color: var(--
|
|
133
|
+
background-color: var(--base-color);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
&.child {
|
|
@@ -11,6 +11,7 @@ import classNames from "classnames";
|
|
|
11
11
|
import {ElementPosition, ErrorType, OrnamentShape} from '../util/interfaces';
|
|
12
12
|
import AwesomeIcon from '../icon/awesomeIcon';
|
|
13
13
|
import {directTimeout} from '../util/componentUtil';
|
|
14
|
+
import {ControlContext} from "../util/controlContext";
|
|
14
15
|
|
|
15
16
|
interface Props {
|
|
16
17
|
onChange: ChangeEventHandler;
|
|
@@ -42,6 +43,7 @@ interface State {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
export default class DvrdInput extends PureComponent<Props, State> {
|
|
46
|
+
static contextType = ControlContext;
|
|
45
47
|
private input: HTMLInputElement | HTMLTextAreaElement;
|
|
46
48
|
|
|
47
49
|
state: State = {
|
|
@@ -62,17 +62,17 @@
|
|
|
62
62
|
|
|
63
63
|
&:hover {
|
|
64
64
|
.content-container {
|
|
65
|
-
border-color:
|
|
65
|
+
border-color: var(--base-color);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
&.active {
|
|
70
70
|
.dvrd-input-label {
|
|
71
|
-
color:
|
|
71
|
+
color: var(--base-color);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.content-container {
|
|
75
|
-
border-color:
|
|
75
|
+
border-color: var(--base-color);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import {voidFunction} from "./controlUtil";
|
|
5
|
+
import React, {Context, PropsWithChildren, useEffect} from 'react';
|
|
7
6
|
import {ControlVariant} from "./interfaces";
|
|
8
|
-
import {
|
|
7
|
+
import {defer} from 'lodash';
|
|
9
8
|
|
|
10
9
|
// noinspection JSUnusedGlobalSymbols
|
|
11
10
|
export interface ThemeContextShape {
|
|
@@ -29,20 +28,19 @@ export interface ThemeShape {
|
|
|
29
28
|
export const ControlContext: Context<ThemeShape> = React.createContext<ThemeShape>(
|
|
30
29
|
{baseColor: 'black', contrastColor: 'white', controlVariant: ControlVariant.STANDARD});
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
};
|
|
31
|
+
export default function ThemeContextProvider(props: PropsWithChildren<ProviderProps>) {
|
|
32
|
+
const {theme, children} = props;
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
defer(() => {
|
|
35
|
+
const root = document.documentElement;
|
|
36
|
+
root.style.setProperty('--base-color', theme.baseColor);
|
|
37
|
+
root.style.setProperty('--contrast-color', theme.contrastColor);
|
|
38
|
+
});
|
|
39
|
+
}, [theme]);
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{this.props.children}
|
|
41
|
+
return (
|
|
42
|
+
<ControlContext.Provider value={theme}>
|
|
43
|
+
{children}
|
|
46
44
|
</ControlContext.Provider>
|
|
47
|
-
|
|
45
|
+
)
|
|
48
46
|
}
|