Skip to content

Commit 34fcbf1

Browse files
author
Shammamah Hossain
committed
Add LICENSE.
1 parent 2d23dfa commit 34fcbf1

14 files changed

+84
-49
lines changed

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2018 Plotly
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

src/components/GraduatedBar.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const GraduatedBar = props => {
5656
);
5757
}
5858

59-
let percent = normalizedValue / (max - min) * 100;
59+
let percent = (normalizedValue / (max - min)) * 100;
6060
if (!isFinite(percent)) percent = 0;
6161

6262
return (

src/components/Joystick.react.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ class Joystick extends Component {
2424
zone: this.zoneRef
2525
});
2626
this.manager.on('move', (e, data) => {
27-
const { angle: { degree }, force } = data;
27+
const {
28+
angle: { degree },
29+
force
30+
} = data;
2831
this.lastAngle = degree;
2932
if (setProps) {
3033
setProps({

src/components/PowerButton.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class PowerButton extends Component {
3636
}
3737

3838
render() {
39-
const INDICATOR_SIZE = this.props.size / 10 * 1.25;
39+
const INDICATOR_SIZE = (this.props.size / 10) * 1.25;
4040

4141
return (
4242
<div id={this.props.id} className={this.props.className} style={this.props.style}>

src/components/PrecisionInput.react.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,13 @@ const PrecisionOutput = ({ value, onClick, size }) => {
174174

175175
return (
176176
<Container size={size} onClick={onClick}>
177-
{characteristicDigits.map((digit, i) => <Digit key={`d${i}`}>{digit}</Digit>)}
177+
{characteristicDigits.map((digit, i) => (
178+
<Digit key={`d${i}`}>{digit}</Digit>
179+
))}
178180
<ExponentialDigit>E</ExponentialDigit>
179-
{mantissaDigits.map((digit, i) => <ExponentialDigit key={`e${i}`}>{digit}</ExponentialDigit>)}
181+
{mantissaDigits.map((digit, i) => (
182+
<ExponentialDigit key={`e${i}`}>{digit}</ExponentialDigit>
183+
))}
180184
</Container>
181185
);
182186
};

src/components/ToggleSwitch.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ToggleSwitch extends Component {
6868
Switch = DarkSwitch;
6969
}
7070

71-
const indicatorSize = size / 10 * 1.25;
71+
const indicatorSize = (size / 10) * 1.25;
7272

7373
const doubleLabel = Array.isArray(label);
7474

src/helpers/GaugeSvg.react.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ const darkTrack = (props, dimensions) => {
7878
/>
7979
</defs>
8080
<use stroke="black" filter="url(#a)" xlinkHref={`#gauge-track-${id}`} />
81-
{props.color &&
82-
props.color.ranges && <use stroke="#15181A" xlinkHref={`#gauge-track-${id}`} />}
81+
{props.color && props.color.ranges && (
82+
<use stroke="#15181A" xlinkHref={`#gauge-track-${id}`} />
83+
)}
8384
<use stroke="url(#c)" style={{ mixBlendMode: 'overlay' }} xlinkHref={`#gauge-track-${id}`} />
8485
<use stroke="black" filter="url(#d)" xlinkHref={`#gauge-track-${id}`} />
8586

@@ -154,7 +155,7 @@ function calcDimensions({ size }) {
154155
d.SCALE_RAD = d.GAUGE_RAD - OFFSET;
155156

156157
d.CIRCLE_CIR = 2 * Math.PI * d.GAUGE_RAD;
157-
d.GAP_ARC_LENGTH = 90 / 360 * (2 * Math.PI * d.GAUGE_RAD);
158+
d.GAP_ARC_LENGTH = (90 / 360) * (2 * Math.PI * d.GAUGE_RAD);
158159
d.TRACK_ARC_LENGTH = d.CIRCLE_CIR - d.GAP_ARC_LENGTH;
159160

160161
d.SCALE_TICK_OUTER_RAD = d.SCALE_RAD;

src/helpers/KnobSvg.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function calcDimensions({ size }) {
159159
d.KNOB_RAD = d.GAUGE_RAD - 12;
160160

161161
d.CIRCLE_CIR = 2 * Math.PI * d.GAUGE_RAD;
162-
d.GAP_ARC_LENGTH = 90 / 360 * (2 * Math.PI * d.GAUGE_RAD);
162+
d.GAP_ARC_LENGTH = (90 / 360) * (2 * Math.PI * d.GAUGE_RAD);
163163
d.TRACK_ARC_LENGTH = d.CIRCLE_CIR - d.GAP_ARC_LENGTH;
164164

165165
d.SCALE_TICK_OUTER_RAD = d.SCALE_RAD - 27;

src/helpers/colorRanges.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const getSortedEntries = scale => {
2525
export const getGradientObject = ({ color, min, max }) => {
2626
let currentPos = 0;
2727
const stops = getSortedEntries(color.ranges).map(([colorValue, range]) => {
28-
const rangeLength = (range[1] - range[0]) * 1.0 / (max - min);
28+
const rangeLength = ((range[1] - range[0]) * 1.0) / (max - min);
2929
const start = currentPos;
3030
const end = currentPos + rangeLength;
3131

@@ -40,7 +40,7 @@ export const getGradientObject = ({ color, min, max }) => {
4040
export const getLinearGradientCSS = ({ color, min, max, vertical = false }) => {
4141
let currentPercentage = 0;
4242
const stops = getSortedEntries(color.ranges).map(([colorValue, range], i) => {
43-
const rangeLength = (range[1] - range[0]) * 1.0 / (max - min) * 100;
43+
const rangeLength = (((range[1] - range[0]) * 1.0) / (max - min)) * 100;
4444
const start = currentPercentage;
4545
const end = currentPercentage + rangeLength;
4646

src/helpers/util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const computeProgress = ({ min, max, value, progressionTarget = 100 }) =>
3333
const adjustedValue = Math.abs(value - min) * 1.0;
3434
const range = Math.abs(max - min);
3535

36-
return adjustedValue / range * progressionTarget;
36+
return (adjustedValue / range) * progressionTarget;
3737
};
3838

3939
export const roundToDecimal = (value, decimals) =>

src/styled/ColorPicker.styled.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ const lightContainer = css`
5656
border-radius: 3px !important;
5757
5858
${lightKnobs} ${({ theme }) =>
59-
css`
60-
border: 1px solid ${theme.detail};
61-
`};
59+
css`
60+
border: 1px solid ${theme.detail};
61+
`};
6262
`;
6363

6464
const darkKnobs = css`

src/styled/GraduatedBar.styled.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const darkBlock = css`
9999
background-blend-mode: overlay;
100100
`;
101101
}} box-shadow: ${({ color, theme }) =>
102-
`2px 2px 6px 1px rgba(0, 0, 0, 0.45), inset 1px 1px 2px 0 rgba(255, 255, 255, 0.3),
102+
`2px 2px 6px 1px rgba(0, 0, 0, 0.45), inset 1px 1px 2px 0 rgba(255, 255, 255, 0.3),
103103
1px 1px 1px 0px rgba(0, 0, 0, 0.6), 0 0 3px 0px ${color || theme.primary}`};
104104
`;
105105

src/styled/Slider.styled.js

+39-31
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ const targetHandle = css`
117117
118118
${({ theme, color }) =>
119119
theme.dark
120-
? css`& .dark-handle-custom-fill { fill: ${color || theme.detail}}`
120+
? css`
121+
& .dark-handle-custom-fill {
122+
fill: ${color || theme.detail};
123+
}
124+
`
121125
: css`
122126
& path {
123127
stroke: ${color || theme.detail};
@@ -155,26 +159,30 @@ const targetHandle = css`
155159
const sliderHandle = css`
156160
${({ theme, color }) =>
157161
theme.dark
158-
? css`& .dark-handle-custom-fill { fill: ${color || theme.primary}}`
162+
? css`
163+
& .dark-handle-custom-fill {
164+
fill: ${color || theme.primary};
165+
}
166+
`
159167
: css`
160168
& path {
161169
stroke: ${color || theme.primary};
162170
}
163171
`} ${({ vertical }) => {
164-
let deltaX = -50;
165-
let deltaY = -40;
166-
let rotation = 0;
167-
168-
if (vertical) {
169-
deltaX = -2;
170-
deltaY = -50;
171-
rotation = 270;
172-
}
173-
174-
return css`
175-
transform: translate(${deltaX}%, ${deltaY}%) rotate(${rotation}deg);
176-
`;
177-
}};
172+
let deltaX = -50;
173+
let deltaY = -40;
174+
let rotation = 0;
175+
176+
if (vertical) {
177+
deltaX = -2;
178+
deltaY = -50;
179+
rotation = 270;
180+
}
181+
182+
return css`
183+
transform: translate(${deltaX}%, ${deltaY}%) rotate(${rotation}deg);
184+
`;
185+
}};
178186
`;
179187

180188
export const targetStyles = {
@@ -213,7 +221,7 @@ export const Label = styled.div`
213221
}
214222
215223
${({ theme }) => (theme.dark ? darkLabel : lightLabel)} ${({ isTarget }) =>
216-
isTarget ? targetLabel : sliderLabel};
224+
isTarget ? targetLabel : sliderLabel};
217225
`;
218226

219227
const darkLabel = css`
@@ -258,20 +266,20 @@ const sliderLabel = css`
258266
: css`
259267
top: 0;
260268
`} ${({ vertical, label, value }) => {
261-
let offset = label && (value || value === 0) ? -44 : -22;
262-
263-
if (vertical) {
264-
offset = -3;
265-
}
266-
267-
return vertical
268-
? css`
269-
transform: translate(${offset}px, -50%);
270-
`
271-
: css`
272-
transform: translate(-50%, ${offset}px);
273-
`;
274-
}};
269+
let offset = label && (value || value === 0) ? -44 : -22;
270+
271+
if (vertical) {
272+
offset = -3;
273+
}
274+
275+
return vertical
276+
? css`
277+
transform: translate(${offset}px, -50%);
278+
`
279+
: css`
280+
transform: translate(-50%, ${offset}px);
281+
`;
282+
}};
275283
`;
276284

277285
export default {

src/styled/Tank.styled.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const Tick = styled.div`
7575
xPosition || xPosition === 0
7676
? css`
7777
position: absolute;
78-
bottom: ${`calc(${xPosition}% - ${xPosition / 100.0 * 18}px)`};
78+
bottom: ${`calc(${xPosition}% - ${(xPosition / 100.0) * 18}px)`};
7979
`
8080
: ''} display: flex;
8181
align-items: center;

0 commit comments

Comments
 (0)