beyond_canvas 0.14.0.pre → 0.16.0.pre

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -6
  3. data/app/assets/images/icons/checkbox_checked.svg +1 -0
  4. data/app/assets/images/icons/checkbox_unchecked.svg +1 -0
  5. data/app/assets/images/icons/radiobutton_checked.svg +1 -0
  6. data/app/assets/images/icons/radiobutton_unchecked.svg +1 -0
  7. data/app/assets/javascripts/beyond_canvas/base.js +248 -87
  8. data/app/assets/stylesheets/beyond_canvas/base.scss +3 -0
  9. data/app/assets/stylesheets/beyond_canvas/components/_containers.scss +37 -0
  10. data/app/assets/stylesheets/beyond_canvas/components/_inputs.scss +47 -1
  11. data/app/assets/stylesheets/beyond_canvas/settings/_breakpoints.scss +6 -0
  12. data/app/assets/stylesheets/beyond_canvas/settings/_variables.scss +24 -0
  13. data/app/assets/stylesheets/beyond_canvas/utilities/_functions.scss +15 -0
  14. data/app/controllers/beyond_canvas/authentications_controller.rb +62 -0
  15. data/app/controllers/concerns/beyond_canvas/authentication.rb +24 -0
  16. data/app/controllers/concerns/beyond_canvas/request_validation.rb +1 -1
  17. data/app/controllers/concerns/beyond_canvas/resource_management.rb +33 -0
  18. data/app/form_builders/beyond_canvas/form_builder.rb +65 -8
  19. data/app/javascript/beyond_canvas/base.js +3 -6
  20. data/app/javascript/beyond_canvas/initializers/buttons.js +21 -39
  21. data/app/javascript/beyond_canvas/initializers/flash.js +5 -14
  22. data/app/javascript/beyond_canvas/initializers/functions.js +41 -0
  23. data/app/javascript/beyond_canvas/initializers/inputs.js +3 -8
  24. data/app/views/beyond_canvas/authentications/new.html.erb +18 -0
  25. data/config/locales/en.yml +4 -0
  26. data/config/routes.rb +6 -0
  27. data/lib/beyond_canvas.rb +22 -2
  28. data/lib/beyond_canvas/configuration.rb +4 -1
  29. data/lib/beyond_canvas/engine.rb +4 -0
  30. data/lib/beyond_canvas/models/authentication.rb +66 -0
  31. data/lib/beyond_canvas/models/shop.rb +28 -0
  32. data/lib/beyond_canvas/models/utils.rb +55 -0
  33. data/lib/beyond_canvas/parameter_sanitizer.rb +43 -0
  34. data/lib/beyond_canvas/rails/routes.rb +21 -0
  35. data/lib/beyond_canvas/version.rb +1 -1
  36. data/lib/generators/beyond_canvas/auth_model/auth_model_generator.rb +50 -0
  37. data/lib/generators/beyond_canvas/auth_model/templates/migration.erb +20 -0
  38. data/lib/generators/beyond_canvas/auth_model/templates/model.erb +5 -0
  39. data/lib/generators/beyond_canvas/controller/controller_generator.rb +20 -0
  40. data/lib/generators/beyond_canvas/controller/templates/controller.erb +37 -0
  41. data/lib/generators/beyond_canvas/install/install_generator.rb +15 -5
  42. data/lib/generators/beyond_canvas/install/templates/beyond_canvas.rb.erb +11 -0
  43. data/lib/generators/beyond_canvas/views/views_generator.rb +19 -0
  44. metadata +58 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 413213c4a08e89d845c81df70145ba9199b3a7fcd0852b91a964062443be9a6f
4
- data.tar.gz: '0495d437686458f797a597da6716ea0cd9cc717ab54a412866cad47d297ea8e8'
3
+ metadata.gz: 0100f13f9ddfdf8b74b3edae25471d479d5a3351ecc5191f9cfa069a3d4c6b3f
4
+ data.tar.gz: e73fdde1ebee7d45422f052c66791a0b86938b52df74930042b4fc67aa6008af
5
5
  SHA512:
6
- metadata.gz: 9613c59e575b54a73863f15c0c1ba3465a8eb66fd70285fb9f2d5a05c932e903168323352024578843ab4b4250f38fecce589e1b731a9f323d1b5c9e58a87a3f
7
- data.tar.gz: a77e782a6c1876b45dda3d5baa0b2c992f57e6f299ec7994b5a9e1530cfba8730342646038cf3aa4876e1bfe568bf9fa68fd75d877035317bb23f31c693a0112
6
+ metadata.gz: b622d131dfe607dbfee52c65b3b0294d609afa3deeb339c9597a46c9dc847cedf578ff8ac2ce3d3dca106fc240b97b3da44be3de75c62a326f5c54739618ec5f
7
+ data.tar.gz: 86eb83c6da624ca5706737f48270bfa85819a57be85795188426a1a263c1f10480c16b83579c349d06e4c33da9bfa61543e9076286ae570ab033b7202104c0ec
data/README.md CHANGED
@@ -37,12 +37,6 @@
37
37
  //= require beyond_canvas
38
38
  ```
39
39
 
40
- 1. Mount the engine in your routes file:
41
-
42
- ```ruby
43
- mount BeyondCanvas::Engine => "/<your-mounting-path>"
44
- ```
45
-
46
40
  1. Run the generator:
47
41
 
48
42
  ```bash
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" style="background: #ffffff;" width="16" height="16" viewBox="0 0 24 24"><path fill="#97C344" d="M0 0v24h24V0H0zm9.6 18.4l-5.8-5.6 2-2.1 3.7 3.6L18 5.6l2.1 2.1L9.6 18.4z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" style="background: #ffff;" width="16" height="16" viewBox="0 0 24 24"><path fill="#c2bf9d" d="M0 0v24h24V0H0zm21.5 21.5h-19v-19h19v19z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" style="background: #ffffff;" width="18" height="18" viewBox="0 0 24 24"><path fill="#97C344" d="M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.6 0 12 0zm0 21.6c-5.3 0-9.6-4.3-9.6-9.6S6.7 2.4 12 2.4s9.6 4.3 9.6 9.6-4.3 9.6-9.6 9.6zm0-15.9c-3.4 0-6.3 2.8-6.3 6.3s2.8 6.2 6.3 6.2 6.2-2.8 6.2-6.2-2.8-6.3-6.2-6.3z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" style="background: #ffffff;" width="18" height="18" viewBox="0 0 24 24"><path fill="#c2bf9d" d="M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.6 0 12 0zm0 21.6c-5.3 0-9.6-4.3-9.6-9.6S6.7 2.4 12 2.4s9.6 4.3 9.6 9.6-4.3 9.6-9.6 9.6z"></path></svg>
@@ -1,94 +1,255 @@
1
- /*
2
- * Warning: This file is auto-generated, do not modify. Instead, make your changes in 'app/javascript/beyond_canvas/' and run `yarn build`
1
+ /*!
2
+ *
3
+ * Warning: This file is auto-generated, do not modify. Instead, make your changes in 'app/javascript/beyond_canvas/' and run `yarn build`
4
+ *
5
+ * //= require jquery3
6
+ * //= require_self
7
+ *
3
8
  */
4
- //= require jquery3
5
- //= require jquery_ujs
6
- //= require_self
7
-
8
- (function(factory) {
9
- typeof define === "function" && define.amd ? define([ "jquery", "jquery-ujs" ], factory) : factory();
10
- })(function() {
11
- "use strict";
12
- var SPINNER_ANIMATION_TIMEOUT = 125;
13
- (function($) {
14
- var onDOMReady = function onDOMReady() {
15
- $('button[class^="button"]').each(function() {
16
- var button = $(this);
17
- button.width(button.width());
18
- button.data("oldWidth", button.width());
19
- button.prepend('\n <div class="spinner">\n <div class="bounce1"></div>\n <div class="bounce2"></div>\n <div class="bounce3"></div>\n </div>');
20
- button.closest("form").on("ajax:success", function() {
21
- hideSpinner(button);
22
- enableActionElements();
23
- }).on("ajax:error", function() {
24
- hideSpinner(button);
25
- enableActionElements();
26
- });
27
- });
28
- };
29
- $(document).on("click", '[class^="button"]', function() {
30
- disableActionElements();
31
- showSpinner($(this));
32
- });
33
- $(document).ready(onDOMReady).on("ready page:load turbolinks:load", onDOMReady);
34
- })(jQuery);
35
- function showSpinner(button) {
36
- button.width(button.width() + $(".spinner").outerWidth(true));
37
- setTimeout(function() {
38
- button.find(".spinner").css("display", "flex");
39
- }, SPINNER_ANIMATION_TIMEOUT);
40
- }
41
- function hideSpinner(button) {
42
- setTimeout(function() {
43
- button.find(".spinner").hide();
44
- button.width(button.data("oldWidth"));
9
+ (function(e, a) { for(var i in a) e[i] = a[i]; }(window, /******/ (function(modules) { // webpackBootstrap
10
+ /******/ // The module cache
11
+ /******/ var installedModules = {};
12
+ /******/
13
+ /******/ // The require function
14
+ /******/ function __webpack_require__(moduleId) {
15
+ /******/
16
+ /******/ // Check if module is in cache
17
+ /******/ if(installedModules[moduleId]) {
18
+ /******/ return installedModules[moduleId].exports;
19
+ /******/ }
20
+ /******/ // Create a new module (and put it into the cache)
21
+ /******/ var module = installedModules[moduleId] = {
22
+ /******/ i: moduleId,
23
+ /******/ l: false,
24
+ /******/ exports: {}
25
+ /******/ };
26
+ /******/
27
+ /******/ // Execute the module function
28
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
29
+ /******/
30
+ /******/ // Flag the module as loaded
31
+ /******/ module.l = true;
32
+ /******/
33
+ /******/ // Return the exports of the module
34
+ /******/ return module.exports;
35
+ /******/ }
36
+ /******/
37
+ /******/
38
+ /******/ // expose the modules object (__webpack_modules__)
39
+ /******/ __webpack_require__.m = modules;
40
+ /******/
41
+ /******/ // expose the module cache
42
+ /******/ __webpack_require__.c = installedModules;
43
+ /******/
44
+ /******/ // define getter function for harmony exports
45
+ /******/ __webpack_require__.d = function(exports, name, getter) {
46
+ /******/ if(!__webpack_require__.o(exports, name)) {
47
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
48
+ /******/ }
49
+ /******/ };
50
+ /******/
51
+ /******/ // define __esModule on exports
52
+ /******/ __webpack_require__.r = function(exports) {
53
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
54
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
55
+ /******/ }
56
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
57
+ /******/ };
58
+ /******/
59
+ /******/ // create a fake namespace object
60
+ /******/ // mode & 1: value is a module id, require it
61
+ /******/ // mode & 2: merge all properties of value into the ns
62
+ /******/ // mode & 4: return value when already ns object
63
+ /******/ // mode & 8|1: behave like require
64
+ /******/ __webpack_require__.t = function(value, mode) {
65
+ /******/ if(mode & 1) value = __webpack_require__(value);
66
+ /******/ if(mode & 8) return value;
67
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
68
+ /******/ var ns = Object.create(null);
69
+ /******/ __webpack_require__.r(ns);
70
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
71
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
72
+ /******/ return ns;
73
+ /******/ };
74
+ /******/
75
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
76
+ /******/ __webpack_require__.n = function(module) {
77
+ /******/ var getter = module && module.__esModule ?
78
+ /******/ function getDefault() { return module['default']; } :
79
+ /******/ function getModuleExports() { return module; };
80
+ /******/ __webpack_require__.d(getter, 'a', getter);
81
+ /******/ return getter;
82
+ /******/ };
83
+ /******/
84
+ /******/ // Object.prototype.hasOwnProperty.call
85
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
86
+ /******/
87
+ /******/ // __webpack_public_path__
88
+ /******/ __webpack_require__.p = "";
89
+ /******/
90
+ /******/
91
+ /******/ // Load entry module and return exports
92
+ /******/ return __webpack_require__(__webpack_require__.s = 1);
93
+ /******/ })
94
+ /************************************************************************/
95
+ /******/ ([
96
+ /* 0 */
97
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
98
+
99
+ "use strict";
100
+ __webpack_require__.r(__webpack_exports__);
101
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showSpinner", function() { return showSpinner; });
102
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hideSpinner", function() { return hideSpinner; });
103
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "disableActionElements", function() { return disableActionElements; });
104
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableActionElements", function() { return enableActionElements; });
105
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "closeAlert", function() { return closeAlert; });
106
+ var SPINNER_ANIMATION_TIMEOUT = 125;
107
+ function showSpinner(button) {
108
+ // Adjust the width of the button
109
+ button.width(button.width() + $('.spinner').outerWidth(true)); // Show the spinner
110
+
111
+ setTimeout(function () {
112
+ button.find('.spinner').css('display', 'flex');
113
+ }, SPINNER_ANIMATION_TIMEOUT);
114
+ }
115
+ function hideSpinner() {
116
+ $('button[class^="button"]').each(function (_, button) {
117
+ setTimeout(function () {
118
+ // Hide the spinner
119
+ $(button).find('.spinner').hide(); // Adjust the width of the button
120
+
121
+ $(button).width($(button).data('oldWidth'));
45
122
  }, SPINNER_ANIMATION_TIMEOUT);
46
- }
47
- function disableActionElements() {
48
- $('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function() {
49
- $(this).addClass("actions--disabled");
123
+ });
124
+ }
125
+ function disableActionElements() {
126
+ $('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function (_, button) {
127
+ $(button).addClass('actions--disabled');
128
+ });
129
+ }
130
+ function enableActionElements() {
131
+ $('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function (_, button) {
132
+ $(button).removeClass('actions--disabled');
133
+ });
134
+ }
135
+ function closeAlert() {
136
+ $('.flash').removeClass('flash--shown').delay(700).queue(function () {
137
+ $(this).remove();
138
+ });
139
+ }
140
+
141
+ /***/ }),
142
+ /* 1 */
143
+ /***/ (function(module, exports, __webpack_require__) {
144
+
145
+ __webpack_require__(3);
146
+ module.exports = __webpack_require__(0);
147
+
148
+
149
+ /***/ }),
150
+ /* 2 */
151
+ /***/ (function(module, exports) {
152
+
153
+ (function ($) {
154
+ var onDOMReady = function onDOMReady() {
155
+ $('input[type="file"]').each(function () {
156
+ var $input = $(this),
157
+ $label = $(".input__file__text." + $input.attr('id')),
158
+ labelVal = $label.html();
159
+ $input.on('change', function (e) {
160
+ var fileName = '';
161
+ if (this.files && this.files.length > 1) fileName = (this.getAttribute('data-multiple-caption') || '').replace('{count}', this.files.length);else if (e.target.value) fileName = e.target.value.split('\\').pop();
162
+ if (fileName) $label.html("<svg class=\"input__file__icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M15 2v5h5v15h-16v-20h11zm1-2h-14v24h20v-18l-6-6z\"/></svg>" + fileName);else $label.html(labelVal);
163
+ }); // Firefox bug fix
164
+
165
+ $input.on('focus', function () {
166
+ $input.addClass('has-focus');
167
+ }).on('blur', function () {
168
+ $input.removeClass('has-focus');
169
+ });
50
170
  });
51
- }
52
- function enableActionElements() {
53
- $('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function() {
54
- $(this).removeClass("actions--disabled");
171
+ };
172
+
173
+ $(document).on('ready page:load turbolinks:load', onDOMReady);
174
+ })(jQuery);
175
+
176
+ /***/ }),
177
+ /* 3 */
178
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
179
+
180
+ "use strict";
181
+ // ESM COMPAT FLAG
182
+ __webpack_require__.r(__webpack_exports__);
183
+
184
+ // EXTERNAL MODULE: ./app/javascript/beyond_canvas/initializers/functions.js
185
+ var functions = __webpack_require__(0);
186
+
187
+ // CONCATENATED MODULE: ./app/javascript/beyond_canvas/initializers/buttons.js
188
+
189
+
190
+ (function ($) {
191
+ var onDOMReady = function onDOMReady() {
192
+ var inputs = $('input, textarea, select').not(':input[type=button], :input[type=submit], :input[type=reset]');
193
+ inputs.each(function () {
194
+ var input = $(this);
195
+ input.bind('invalid', function (e) {
196
+ if ($(input).is(':hidden')) {
197
+ e.preventDefault();
198
+ }
199
+
200
+ Object(functions["hideSpinner"])();
201
+ Object(functions["enableActionElements"])();
202
+ });
55
203
  });
56
- }
57
- (function($) {
58
- var onDOMReady = function onDOMReady() {
59
- $(".flash").each(function() {
60
- $(this).css("right", -$(this).width() + "px");
204
+ $('button[class^="button"]').each(function () {
205
+ var button = $(this); // Add width attribute and save old width
206
+
207
+ button.width(button.width());
208
+ button.data('oldWidth', button.width()); // Add the spinner
209
+
210
+ button.prepend("\n <div class=\"spinner\">\n <div class=\"bounce1\"></div>\n <div class=\"bounce2\"></div>\n <div class=\"bounce3\"></div>\n </div>"); // Bind ajax:success and ajax:error to the form the button belongs to
211
+
212
+ button.closest('form').on('ajax:success', function () {
213
+ Object(functions["hideSpinner"])();
214
+ Object(functions["enableActionElements"])();
215
+ }).on('ajax:error', function () {
216
+ Object(functions["hideSpinner"])();
217
+ Object(functions["enableActionElements"])();
61
218
  });
62
- setTimeout(function() {
63
- $(".flash").addClass("flash--shown");
64
- }, 100);
65
- };
66
- $(document).on("click", ".flash", function() {
67
- closeAlert();
68
219
  });
69
- $(document).ready(onDOMReady).on("ready page:load turbolinks:load", onDOMReady);
70
- })(jQuery);
71
- function closeAlert() {
72
- $(".flash").removeClass("flash--shown").delay(700).queue(function() {
73
- $(this).remove();
220
+ };
221
+
222
+ $(document).on('click', '[class^="button"]', function () {
223
+ Object(functions["disableActionElements"])();
224
+ Object(functions["showSpinner"])($(this));
225
+ });
226
+ $(document).on('ready page:load turbolinks:load', onDOMReady);
227
+ })(jQuery);
228
+ // CONCATENATED MODULE: ./app/javascript/beyond_canvas/initializers/flash.js
229
+
230
+
231
+ (function ($) {
232
+ var onDOMReady = function onDOMReady() {
233
+ $('.flash').each(function () {
234
+ $(this).css('right', -$(this).width() + 'px');
74
235
  });
75
- }
76
- (function($) {
77
- var onDOMReady = function onDOMReady() {
78
- $('input[type="file"]').each(function() {
79
- var $input = $(this), $label = $(".input__file__text." + $input.attr("id")), labelVal = $label.html();
80
- $input.on("change", function(e) {
81
- var fileName = "";
82
- if (this.files && this.files.length > 1) fileName = (this.getAttribute("data-multiple-caption") || "").replace("{count}", this.files.length); else if (e.target.value) fileName = e.target.value.split("\\").pop();
83
- if (fileName) $label.html('<svg class="input__file__icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M15 2v5h5v15h-16v-20h11zm1-2h-14v24h20v-18l-6-6z"/></svg>' + fileName); else $label.html(labelVal);
84
- });
85
- $input.on("focus", function() {
86
- $input.addClass("has-focus");
87
- }).on("blur", function() {
88
- $input.removeClass("has-focus");
89
- });
90
- });
91
- };
92
- $(document).ready(onDOMReady).on("ready page:load turbolinks:load", onDOMReady);
93
- })(jQuery);
94
- });
236
+ setTimeout(function () {
237
+ $('.flash').addClass('flash--shown');
238
+ }, 100);
239
+ };
240
+
241
+ $(document).on('click', '.flash', function () {
242
+ Object(functions["closeAlert"])();
243
+ });
244
+ $(document).on('ready page:load turbolinks:load', onDOMReady);
245
+ })(jQuery);
246
+ // EXTERNAL MODULE: ./app/javascript/beyond_canvas/initializers/inputs.js
247
+ var initializers_inputs = __webpack_require__(2);
248
+
249
+ // CONCATENATED MODULE: ./app/javascript/beyond_canvas/base.js
250
+
251
+
252
+
253
+
254
+ /***/ })
255
+ /******/ ])));
@@ -1,15 +1,18 @@
1
1
  @import "bourbon";
2
2
 
3
+ @import "settings/breakpoints";
3
4
  @import "settings/variables";
4
5
  @import "settings/reset_css";
5
6
  @import "settings/typography";
6
7
 
8
+ @import "utilities/functions";
7
9
  @import "utilities/mixins";
8
10
 
9
11
  @import "components/actions";
10
12
  @import "components/buttons";
11
13
  @import "components/cards";
12
14
  @import "components/comments";
15
+ @import "components/containers";
13
16
  @import "components/flash";
14
17
  @import "components/forms";
15
18
  @import "components/inputs";
@@ -0,0 +1,37 @@
1
+ $columns: 2, 3, 4;
2
+
3
+ .container {
4
+ width: 100%;
5
+ display: flex;
6
+ flex-wrap: wrap;
7
+
8
+ &--center {
9
+ justify-content: center;
10
+ }
11
+
12
+ &__column {
13
+
14
+ @each $column in $columns {
15
+
16
+ &--#{$column} {
17
+ width: 100%;
18
+
19
+ @media (min-width: $laptop) {
20
+ width: calc((100% - (#{$column} - 1) * #{$container-spacing}) / #{$column});
21
+
22
+ &:not(:last-child) {
23
+ margin-right: $container-spacing;
24
+ }
25
+ }
26
+
27
+ &:not(:last-child) {
28
+ margin-bottom: $container-spacing;
29
+
30
+ @media (min-width: $laptop) {
31
+ margin-bottom: 0;
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
@@ -1,3 +1,5 @@
1
+ $controls: checkbox, radio;
2
+
1
3
  #{$all-text-inputs},
2
4
  select {
3
5
  background-color: $white;
@@ -52,11 +54,55 @@ select {
52
54
  margin-top: 1px;
53
55
  }
54
56
 
57
+ @each $control in $controls {
58
+
59
+ &__#{$control} {
60
+ display: flex;
61
+ align-items: center;
62
+
63
+ .input__#{$control}__control {
64
+ @if $control == checkbox {
65
+ @include size(16px);
66
+ } @else if $control == radio {
67
+ @include size(18px);
68
+ }
69
+
70
+ cursor: pointer;
71
+ margin-right: 7px;
72
+ }
73
+
74
+ input[type=#{$control}] + .input__#{$control}__control {
75
+ @if $control == checkbox {
76
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='background: #{str-replace('' + $checkbox-unchecked-background, '#', '%23')};' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='#{str-replace('' + $checkbox-unchecked-color, '#', '%23')}' d='M0 0v24h24V0H0zm21.5 21.5h-19v-19h19v19z'%3E%3C/path%3E%3C/svg%3E%0A");
77
+ } @else if $control == radio {
78
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='background: #{str-replace('' + $radio-unchecked-background, '#', '%23')};' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath fill='#{str-replace('' + $radio-unchecked-color, '#', '%23')}' d='M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.6 0 12 0zm0 21.6c-5.3 0-9.6-4.3-9.6-9.6S6.7 2.4 12 2.4s9.6 4.3 9.6 9.6-4.3 9.6-9.6 9.6z'%3E%3C/path%3E%3C/svg%3E");
79
+ }
80
+ }
81
+
82
+ input[type=#{$control}]:checked + .input__#{$control}__control {
83
+ @if $control == checkbox {
84
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='background: #{str-replace('' + $checkbox-checked-background, '#', '%23')};' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='#{str-replace('' + $checkbox-checked-color, '#', '%23')}' d='M0 0v24h24V0H0zm9.6 18.4l-5.8-5.6 2-2.1 3.7 3.6L18 5.6l2.1 2.1L9.6 18.4z'%3E%3C/path%3E%3C/svg%3E%0A");
85
+ } @else if $control == radio {
86
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='background: #{str-replace('' + $radio-checked-background, '#', '%23')};' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath fill='#{str-replace('' + $radio-checked-color, '#', '%23')}' d='M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.6 0 12 0zm0 21.6c-5.3 0-9.6-4.3-9.6-9.6S6.7 2.4 12 2.4s9.6 4.3 9.6 9.6-4.3 9.6-9.6 9.6zm0-15.9c-3.4 0-6.3 2.8-6.3 6.3s2.8 6.2 6.3 6.2 6.2-2.8 6.2-6.2-2.8-6.3-6.2-6.3z'%3E%3C/path%3E%3C/svg%3E");
87
+ }
88
+ }
89
+
90
+ + div .input__label {
91
+ line-height: 1;
92
+ }
93
+
94
+ + div .input__hint {
95
+ line-height: 1;
96
+ margin-top: 4px;
97
+ }
98
+ }
99
+ }
100
+
55
101
  &__file {
56
102
  display: flex;
57
103
  align-items: center;
58
104
 
59
- &__label {
105
+ &__control {
60
106
  display: inline-block;
61
107
  }
62
108