Skip to content

Commit

Permalink
improvement(checkbox): markup change
Browse files Browse the repository at this point in the history
Updated markup so label no longer wraps checkbox and radio input unless it is a toggle control

#581
  • Loading branch information
kevinchappell committed Aug 26, 2017
1 parent 6dc503a commit 8d20b42
Show file tree
Hide file tree
Showing 16 changed files with 11,801 additions and 19 deletions.
2 changes: 1 addition & 1 deletion demo/assets/js/form-builder.min.js

Large diffs are not rendered by default.

Binary file modified demo/assets/js/form-builder.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion demo/assets/js/form-render.min.js

Large diffs are not rendered by default.

Binary file modified demo/assets/js/form-render.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/form-builder.min.js

Large diffs are not rendered by default.

Binary file modified dist/form-builder.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/form-render.min.js

Large diffs are not rendered by default.

Binary file modified dist/form-render.min.js.gz
Binary file not shown.
11,779 changes: 11,779 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"tag:minor": "babel-node -- node_modules/gulp/bin/gulp tag --minor",
"release:patch": "npm run tag:patch --patch && npm run deploy",
"release:minor": "npm run tag:minor --minor && npm run deploy",
"start": "babel-node -- node_modules/webpack/bin/webpack -d --progress --config tools/webpack.config | babel-node -- node_modules/webpack-dev-server/bin/webpack-dev-server --config tools/webpack.config",
"start": "babel-node -- node_modules/webpack-dev-server/bin/webpack-dev-server --config tools/webpack.config",
"build": "babel-node -- node_modules/webpack/bin/webpack -p --progress --config tools/webpack.config && cp demo/assets/js/form-* dist/",
"build:vendor": "babel-node -- tools/run build-vendor",
"build:plugins": "babel-node -- node_modules/webpack/bin/webpack -p --display-entrypoints --progress --config tools/webpack.plugins.config"
Expand Down
12 changes: 7 additions & 5 deletions src/js/control/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default class controlSelect extends control {
options.push(o);
} else {
let wrapperClass = optionType;
let labelContents = [label];
if (inline) {
wrapperClass += '-inline';
}
Expand All @@ -81,15 +82,16 @@ export default class controlSelect extends control {
}
let input = this.markup('input', null, Object.assign({}, data, optionAttrs));
let labelAttrs = {for: optionAttrs.id};
let labelContent = [input, label];
label = this.markup('label', labelContents, labelAttrs);
let output = [input, label];
if (toggle) {
let kcToggle = this.markup('span');
labelContent = [input, kcToggle, label];
labelAttrs.className = 'kc-toggle';
// output.splice(1, 0, this.markup('span'));
labelContents.unshift(input, this.markup('span'));
output = this.markup('label', labelContents, labelAttrs);
}

let inputLabel = this.markup('label', labelContent, labelAttrs);
let wrapper = this.markup('div', inputLabel, {className: wrapperClass});
let wrapper = this.markup('div', output, {className: wrapperClass});
options.push(wrapper);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/form-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ let stageOnChangeSelectors = [
let enableRolesCB = $(e.target);
roles.slideToggle(250, function() {
if (!enableRolesCB.is(':checked')) {
$('input[type="checkbox"]', roles).removeAttr('checked');
$('input[type=checkbox]', roles).removeAttr('checked');
}
});
});
Expand Down
3 changes: 2 additions & 1 deletion src/sass/_kc-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
overflow: hidden;
float: left;
margin-right: 5px;
will-change: transform;

&::after,
&::before {
Expand All @@ -30,7 +31,7 @@
border-radius: 3px;
background: linear-gradient(to bottom, lighten($grey-light-30, 30%) 0%, $grey-light 100%);
border: 1px solid lighten($grey, 20%);
transition: transform 50ms;
transition: transform 100ms;
transform: translateX(0);
}

Expand Down
1 change: 1 addition & 0 deletions src/sass/_stage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
input[type='checkbox'],
input[type='radio'] {
display: inline-block;
margin-left: 0;
}

input[type='color'] {
Expand Down
6 changes: 6 additions & 0 deletions src/sass/base/_bs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ textarea.form-control {
color: $error;
}

.fb-checkbox-group {
.checkbox input {
margin-left: 0;
}
}

.fb-checkbox-inline,
.fb-radio-inline {
display: inline-block;
Expand Down
7 changes: 0 additions & 7 deletions src/sass/form-builder.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ textarea {
}
}

.fresh .frmb .legend .element-info {
display: inline-block;
visibility: visible;
line-height: 12px;
margin-left: 6px;
}

.frmb-xml .ui-dialog-content {
white-space: pre-wrap;
word-wrap: break-word;
Expand Down

0 comments on commit 8d20b42

Please sign in to comment.