diff --git a/ui/package.json b/ui/package.json
index 83a41431..dab71054 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -22,12 +22,12 @@
"lodash.isstring": "^4.0.1",
"lodash.isundefined": "^3.0.1",
"param-case": "^2.1.0",
+ "random-natural": "^1.0.3",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-icons": "^2.2.1",
"reduce-css-calc": "^1.3.0",
- "styled-components": "^1.1.3",
- "uuid": "^3.0.1"
+ "styled-components": "^1.1.3"
},
"devDependencies": {
"@kadira/storybook": "^2.34.0",
diff --git a/ui/src/components/toggle/index.js b/ui/src/components/toggle/index.js
index 5e6dfe19..399411ee 100644
--- a/ui/src/components/toggle/index.js
+++ b/ui/src/components/toggle/index.js
@@ -2,7 +2,6 @@ const constants = require('../../shared/constants');
const fns = require('../../shared/functions');
const React = require('react');
const Styled = require('styled-components');
-const uuid = require('uuid').v4;
const {
boxes,
@@ -10,13 +9,18 @@ const {
} = constants;
const {
- remcalc
+ remcalc,
+ rndId
} = fns;
const {
default: styled
} = Styled;
+const classNames = {
+ label: rndId()
+};
+
const StyledLabel = styled.label`
border-radius: ${boxes.borderRadius};
color: #464646;
@@ -62,7 +66,7 @@ const StyledInput = styled.input`
display: none;
&:checked {
- & + .tgl-label {
+ & + .${classNames.label} {
background: ${colors.confirmation};
border: ${boxes.border.confirmed};
color: #FFFFFF;
@@ -87,7 +91,7 @@ const Toggle = ({
checked,
className,
defaultChecked,
- id = uuid(),
+ id = rndId(),
style
}) => {
return (
@@ -101,7 +105,7 @@ const Toggle = ({
id={id}
type='checkbox'
/>
-
+
);
};
diff --git a/ui/src/components/widget/index.js b/ui/src/components/widget/index.js
index 20e8b06d..cedf32d9 100644
--- a/ui/src/components/widget/index.js
+++ b/ui/src/components/widget/index.js
@@ -1,27 +1,36 @@
const React = require('react');
const constants = require('../../shared/constants');
+const fns = require('../../shared/functions');
const Styled = require('styled-components');
const {
boxes
} = constants;
+const {
+ rndId
+} = fns;
+
const {
default: styled,
} = Styled;
+const classNames = {
+ content: rndId()
+};
+
const StyledInput = styled.input`
display: none;
visibility: hidden;
&:checked {
- & ~ .content {
+ & ~ .${classNames.content} {
border: ${boxes.border.checked};
}
}
&:disabled {
- & ~ .content {
+ & ~ .${classNames.content} {
cursor: not-allowed;
filter: grayscale(80%);
opacity: 0.4;
@@ -45,6 +54,7 @@ const Widget = ({
children,
className,
disabled = false,
+ id,
name,
selectable = 'single',
style,
@@ -53,7 +63,11 @@ const Widget = ({
const type = selectable === 'single' ? 'radio' : 'checkbox';
return (
-