headmin 0.2.6 → 0.3.2

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 (237) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -3
  3. data/Gemfile.lock +14 -3
  4. data/README.md +64 -57
  5. data/app/assets/config/headmin_manifest.js +2 -0
  6. data/app/assets/javascripts/headmin/config/i18n.js +11 -0
  7. data/{src/js → app/assets/javascripts}/headmin/controllers/blocks_controller.js +0 -1
  8. data/app/assets/javascripts/headmin/controllers/date_range_controller.js +32 -0
  9. data/app/assets/javascripts/headmin/controllers/dropzone_controller.js +33 -0
  10. data/app/assets/javascripts/headmin/controllers/file_preview_controller.js +244 -0
  11. data/{src/js → app/assets/javascripts}/headmin/controllers/filter_controller.js +12 -6
  12. data/{src/js → app/assets/javascripts}/headmin/controllers/filters_controller.js +0 -0
  13. data/app/assets/javascripts/headmin/controllers/flatpickr_controller.js +39 -0
  14. data/app/assets/javascripts/headmin/controllers/hello_controller.js +7 -0
  15. data/app/assets/javascripts/headmin/controllers/notification_controller.js +8 -0
  16. data/{src/js → app/assets/javascripts}/headmin/controllers/popup_controller.js +0 -1
  17. data/app/assets/javascripts/headmin/controllers/redactorx_controller.js +13 -0
  18. data/{src/js → app/assets/javascripts}/headmin/controllers/repeater_controller.js +0 -1
  19. data/app/assets/javascripts/headmin/controllers/select_controller.js +48 -0
  20. data/{src/js → app/assets/javascripts}/headmin/controllers/table_actions_controller.js +7 -37
  21. data/{src/js → app/assets/javascripts}/headmin/controllers/table_controller.js +23 -3
  22. data/app/assets/javascripts/headmin/index.js +41 -0
  23. data/app/assets/javascripts/headmin.js +15934 -0
  24. data/{src/scss → app/assets/stylesheets}/headmin/filter.scss +0 -0
  25. data/{src/scss → app/assets/stylesheets}/headmin/filters.scss +0 -0
  26. data/{src/scss → app/assets/stylesheets}/headmin/form.scss +55 -2
  27. data/{src/scss → app/assets/stylesheets}/headmin/general.scss +0 -0
  28. data/{src/scss → app/assets/stylesheets}/headmin/layout/body.scss +0 -0
  29. data/{src/scss → app/assets/stylesheets}/headmin/layout/sidebar.scss +0 -0
  30. data/{src/scss → app/assets/stylesheets}/headmin/layout.scss +0 -0
  31. data/{src/scss → app/assets/stylesheets}/headmin/login.scss +0 -0
  32. data/{src/scss/vendor/bootstrap/variables.scss → app/assets/stylesheets/headmin/overrides/bootstrap.scss} +0 -0
  33. data/{src/scss/vendor/redactorx/override.css → app/assets/stylesheets/headmin/overrides/redactorx.css} +0 -0
  34. data/{src/scss → app/assets/stylesheets}/headmin/popup.scss +0 -0
  35. data/app/assets/stylesheets/headmin/syntax.scss +349 -0
  36. data/{src/scss → app/assets/stylesheets}/headmin/table.scss +0 -0
  37. data/app/assets/stylesheets/headmin/thumbnail.scss +20 -0
  38. data/app/assets/stylesheets/headmin/utilities.scss +68 -0
  39. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_accordion.scss +118 -0
  40. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_alert.scss +57 -0
  41. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_badge.scss +29 -0
  42. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_breadcrumb.scss +28 -0
  43. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_button-group.scss +139 -0
  44. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_buttons.scss +111 -0
  45. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_card.scss +216 -0
  46. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_carousel.scss +229 -0
  47. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_close.scss +40 -0
  48. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_containers.scss +41 -0
  49. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_dropdown.scss +240 -0
  50. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_forms.scss +9 -0
  51. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_functions.scss +302 -0
  52. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_grid.scss +33 -0
  53. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_helpers.scss +9 -0
  54. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_images.scss +42 -0
  55. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_list-group.scss +174 -0
  56. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_mixins.scss +43 -0
  57. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_modal.scss +209 -0
  58. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_nav.scss +139 -0
  59. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_navbar.scss +335 -0
  60. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_offcanvas.scss +83 -0
  61. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_pagination.scss +64 -0
  62. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_placeholders.scss +51 -0
  63. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_popover.scss +158 -0
  64. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_progress.scss +48 -0
  65. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_reboot.scss +625 -0
  66. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_root.scss +54 -0
  67. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_spinners.scss +69 -0
  68. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_tables.scss +155 -0
  69. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_toasts.scss +51 -0
  70. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_tooltip.scss +115 -0
  71. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_transitions.scss +27 -0
  72. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_type.scss +104 -0
  73. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_utilities.scss +630 -0
  74. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_variables.scss +1641 -0
  75. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-grid.scss +67 -0
  76. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-reboot.scss +13 -0
  77. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-utilities.scss +18 -0
  78. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap.scss +53 -0
  79. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_floating-labels.scss +63 -0
  80. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-check.scss +152 -0
  81. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-control.scss +219 -0
  82. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-range.scss +91 -0
  83. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-select.scss +72 -0
  84. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-text.scss +11 -0
  85. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_input-group.scss +121 -0
  86. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_labels.scss +36 -0
  87. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_validation.scss +12 -0
  88. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_clearfix.scss +3 -0
  89. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_colored-links.scss +12 -0
  90. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_position.scss +30 -0
  91. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_ratio.scss +26 -0
  92. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_stacks.scss +15 -0
  93. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_stretched-link.scss +15 -0
  94. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_text-truncation.scss +7 -0
  95. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
  96. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_vr.scss +8 -0
  97. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_alert.scss +11 -0
  98. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_backdrop.scss +14 -0
  99. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_border-radius.scss +78 -0
  100. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_box-shadow.scss +18 -0
  101. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_breakpoints.scss +127 -0
  102. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_buttons.scss +133 -0
  103. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_caret.scss +64 -0
  104. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_clearfix.scss +9 -0
  105. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_color-scheme.scss +7 -0
  106. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_container.scss +9 -0
  107. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_deprecate.scss +10 -0
  108. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_forms.scss +144 -0
  109. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_gradients.scss +47 -0
  110. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_grid.scss +151 -0
  111. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_image.scss +16 -0
  112. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_list-group.scss +24 -0
  113. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_lists.scss +7 -0
  114. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_pagination.scss +31 -0
  115. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_reset-text.scss +17 -0
  116. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_resize.scss +6 -0
  117. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_table-variants.scss +21 -0
  118. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_text-truncate.scss +8 -0
  119. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_transition.scss +26 -0
  120. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_utilities.scss +89 -0
  121. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_visually-hidden.scss +29 -0
  122. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/utilities/_api.scss +47 -0
  123. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/vendor/_rfs.scss +354 -0
  124. data/app/assets/stylesheets/headmin/vendor/flatpickr.css +903 -0
  125. data/{src/scss/vendor/redactorx → app/assets/stylesheets/headmin/vendor}/redactorx.css +0 -0
  126. data/app/assets/stylesheets/headmin/vendor/tom-select-bootstrap.css +537 -0
  127. data/app/assets/stylesheets/headmin.css +13454 -0
  128. data/app/assets/stylesheets/headmin.scss +65 -0
  129. data/app/helpers/headmin/admin_helper.rb +1 -0
  130. data/app/helpers/headmin/bootstrap_helper.rb +25 -3
  131. data/app/helpers/headmin/documentation_helper.rb +35 -0
  132. data/app/helpers/headmin/form_helper.rb +4 -0
  133. data/app/helpers/headmin/request_helper.rb +3 -8
  134. data/app/models/headmin/documentation_renderer.rb +32 -0
  135. data/app/models/headmin/form/base.rb +79 -0
  136. data/app/models/headmin/form/text.rb +53 -0
  137. data/app/services/block_service.rb +1 -1
  138. data/app/views/examples/admin.html.erb +1 -1
  139. data/app/views/headmin/_blocks.html.erb +2 -2
  140. data/app/views/headmin/_breadcrumbs.html.erb +1 -1
  141. data/app/views/headmin/_card.html.erb +10 -6
  142. data/app/views/headmin/_dropdown.html.erb +1 -1
  143. data/app/views/headmin/_filters.html.erb +22 -10
  144. data/app/views/headmin/_form.html.erb +14 -14
  145. data/app/views/headmin/_heading.html.erb +1 -1
  146. data/app/views/headmin/_notifications.html.erb +1 -1
  147. data/app/views/headmin/_pagination.html.erb +3 -5
  148. data/app/views/headmin/_popup.html.erb +10 -4
  149. data/app/views/headmin/_table.html.erb +10 -4
  150. data/app/views/headmin/_thumbnail.html.erb +45 -0
  151. data/app/views/headmin/dropdown/_devise.html.erb +2 -2
  152. data/app/views/headmin/dropdown/_list.html.erb +3 -6
  153. data/app/views/headmin/filters/_date.html.erb +9 -13
  154. data/app/views/headmin/filters/_flatpickr.html.erb +57 -0
  155. data/app/views/headmin/filters/_search.html.erb +5 -5
  156. data/app/views/headmin/filters/_select.html.erb +6 -6
  157. data/app/views/headmin/filters/filter/_button.html.erb +7 -7
  158. data/app/views/headmin/filters/filter/_template.html.erb +1 -1
  159. data/app/views/headmin/forms/_actions.html.erb +1 -1
  160. data/app/views/headmin/forms/_base.html.erb +100 -46
  161. data/app/views/headmin/forms/_blocks.html.erb +4 -4
  162. data/app/views/headmin/forms/_checkbox.html.erb +3 -3
  163. data/app/views/headmin/forms/_date.html.erb +30 -34
  164. data/app/views/headmin/forms/_date_range.html.erb +42 -0
  165. data/app/views/headmin/forms/_email.html.erb +35 -26
  166. data/app/views/headmin/forms/_file.html.erb +186 -34
  167. data/app/views/headmin/forms/_flatpickr.html.erb +34 -0
  168. data/app/views/headmin/forms/_flatpickr_range.html.erb +50 -0
  169. data/app/views/headmin/forms/_hidden.html.erb +24 -0
  170. data/app/views/headmin/forms/_image.html.erb +11 -45
  171. data/app/views/headmin/forms/_label.html.erb +18 -12
  172. data/app/views/headmin/forms/_number.html.erb +40 -37
  173. data/app/views/headmin/forms/_password.html.erb +37 -58
  174. data/app/views/headmin/forms/_redactorx.html.erb +8 -7
  175. data/app/views/headmin/forms/_repeater.html.erb +6 -6
  176. data/app/views/headmin/forms/_select.html.erb +43 -45
  177. data/app/views/headmin/forms/_text.html.erb +94 -59
  178. data/app/views/headmin/forms/_textarea.html.erb +37 -26
  179. data/app/views/headmin/forms/_url.html.erb +35 -26
  180. data/app/views/headmin/forms/_validation.html.erb +3 -3
  181. data/app/views/headmin/forms/_video.html.erb +21 -0
  182. data/app/views/headmin/forms/fields/_base.html.erb +3 -3
  183. data/app/views/headmin/forms/fields/_file.html.erb +2 -2
  184. data/app/views/headmin/forms/fields/_group.html.erb +3 -3
  185. data/app/views/headmin/forms/fields/_image.html.erb +2 -2
  186. data/app/views/headmin/forms/fields/_list.html.erb +3 -3
  187. data/app/views/headmin/forms/fields/_text.html.erb +2 -2
  188. data/app/views/headmin/forms/repeater/_row.html.erb +1 -1
  189. data/app/views/headmin/heading/_title.html.erb +1 -1
  190. data/app/views/headmin/layout/_body.html.erb +1 -1
  191. data/app/views/headmin/layout/_content.html.erb +1 -1
  192. data/app/views/headmin/layout/_footer.html.erb +1 -1
  193. data/app/views/headmin/layout/_header.html.erb +1 -1
  194. data/app/views/headmin/layout/_main.html.erb +12 -6
  195. data/app/views/headmin/layout/_sidebar.html.erb +3 -3
  196. data/app/views/headmin/layout/sidebar/_bottom.html.erb +1 -1
  197. data/app/views/headmin/layout/sidebar/_nav.html.erb +1 -1
  198. data/app/views/headmin/nav/_dropdown.html.erb +34 -0
  199. data/app/views/headmin/nav/_item.html.erb +22 -13
  200. data/app/views/headmin/table/_actions.html.erb +3 -5
  201. data/app/views/headmin/table/_body.html.erb +1 -1
  202. data/app/views/headmin/table/_foot.html.erb +1 -1
  203. data/app/views/headmin/table/_footer.html.erb +1 -1
  204. data/app/views/headmin/table/_head.html.erb +1 -1
  205. data/app/views/headmin/table/_header.html.erb +1 -1
  206. data/app/views/headmin/table/actions/_action.html.erb +4 -4
  207. data/app/views/headmin/table/actions/_delete.html.erb +1 -1
  208. data/app/views/headmin/table/actions/_export.html.erb +1 -1
  209. data/app/views/headmin/table/body/_row.html.erb +15 -7
  210. data/config/importmap.rb +2 -0
  211. data/config/locales/en.yml +0 -3
  212. data/config/locales/headmin/forms/en.yml +5 -0
  213. data/config/locales/headmin/forms/nl.yml +5 -0
  214. data/config/locales/headmin/popup/en.yml +4 -0
  215. data/config/locales/headmin/popup/nl.yml +4 -0
  216. data/config/locales/headmin/thumbnail/en.yml +4 -0
  217. data/config/locales/headmin/thumbnail/nl.yml +4 -0
  218. data/config/locales/nl.yml +0 -3
  219. data/esbuild-css.js +25 -0
  220. data/esbuild-js.js +11 -0
  221. data/headmin.gemspec +4 -1
  222. data/lib/headmin/engine.rb +15 -0
  223. data/lib/headmin/version.rb +1 -1
  224. data/lib/headmin.rb +1 -1
  225. data/package.json +18 -34
  226. data/src/js/headmin.js +1 -1
  227. data/src/scss/headmin.scss +1 -61
  228. data/yarn.lock +393 -5177
  229. metadata +191 -34
  230. data/.nvmrc +0 -1
  231. data/app/controllers/concerns/headmin/ckeditor.rb +0 -27
  232. data/app/views/headmin/forms/_ckeditor.html.erb +0 -42
  233. data/dist/css/headmin.css +0 -12354
  234. data/dist/js/headmin.js +0 -1080
  235. data/src/js/headmin/headmin.js +0 -141
  236. data/src/scss/headmin/utilities.scss +0 -19
  237. data/webpack.config.js +0 -30
@@ -0,0 +1,21 @@
1
+ // scss-docs-start table-variant
2
+ @mixin table-variant($state, $background) {
3
+ .table-#{$state} {
4
+ $color: color-contrast(opaque($body-bg, $background));
5
+ $hover-bg: mix($color, $background, percentage($table-hover-bg-factor));
6
+ $striped-bg: mix($color, $background, percentage($table-striped-bg-factor));
7
+ $active-bg: mix($color, $background, percentage($table-active-bg-factor));
8
+
9
+ --#{$variable-prefix}table-bg: #{$background};
10
+ --#{$variable-prefix}table-striped-bg: #{$striped-bg};
11
+ --#{$variable-prefix}table-striped-color: #{color-contrast($striped-bg)};
12
+ --#{$variable-prefix}table-active-bg: #{$active-bg};
13
+ --#{$variable-prefix}table-active-color: #{color-contrast($active-bg)};
14
+ --#{$variable-prefix}table-hover-bg: #{$hover-bg};
15
+ --#{$variable-prefix}table-hover-color: #{color-contrast($hover-bg)};
16
+
17
+ color: $color;
18
+ border-color: mix($color, $background, percentage($table-border-factor));
19
+ }
20
+ }
21
+ // scss-docs-end table-variant
@@ -0,0 +1,8 @@
1
+ // Text truncate
2
+ // Requires inline-block or block for proper styling
3
+
4
+ @mixin text-truncate() {
5
+ overflow: hidden;
6
+ text-overflow: ellipsis;
7
+ white-space: nowrap;
8
+ }
@@ -0,0 +1,26 @@
1
+ // stylelint-disable property-disallowed-list
2
+ @mixin transition($transition...) {
3
+ @if length($transition) == 0 {
4
+ $transition: $transition-base;
5
+ }
6
+
7
+ @if length($transition) > 1 {
8
+ @each $value in $transition {
9
+ @if $value == null or $value == none {
10
+ @warn "The keyword 'none' or 'null' must be used as a single argument.";
11
+ }
12
+ }
13
+ }
14
+
15
+ @if $enable-transitions {
16
+ @if nth($transition, 1) != null {
17
+ transition: $transition;
18
+ }
19
+
20
+ @if $enable-reduced-motion and nth($transition, 1) != null and nth($transition, 1) != none {
21
+ @media (prefers-reduced-motion: reduce) {
22
+ transition: none;
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,89 @@
1
+ // Utility generator
2
+ // Used to generate utilities & print utilities
3
+ @mixin generate-utility($utility, $infix, $is-rfs-media-query: false) {
4
+ $values: map-get($utility, values);
5
+
6
+ // If the values are a list or string, convert it into a map
7
+ @if type-of($values) == "string" or type-of(nth($values, 1)) != "list" {
8
+ $values: zip($values, $values);
9
+ }
10
+
11
+ @each $key, $value in $values {
12
+ $properties: map-get($utility, property);
13
+
14
+ // Multiple properties are possible, for example with vertical or horizontal margins or paddings
15
+ @if type-of($properties) == "string" {
16
+ $properties: append((), $properties);
17
+ }
18
+
19
+ // Use custom class if present
20
+ $property-class: if(map-has-key($utility, class), map-get($utility, class), nth($properties, 1));
21
+ $property-class: if($property-class == null, "", $property-class);
22
+
23
+ // State params to generate pseudo-classes
24
+ $state: if(map-has-key($utility, state), map-get($utility, state), ());
25
+
26
+ $infix: if($property-class == "" and str-slice($infix, 1, 1) == "-", str-slice($infix, 2), $infix);
27
+
28
+ // Don't prefix if value key is null (eg. with shadow class)
29
+ $property-class-modifier: if($key, if($property-class == "" and $infix == "", "", "-") + $key, "");
30
+
31
+ @if map-get($utility, rfs) {
32
+ // Inside the media query
33
+ @if $is-rfs-media-query {
34
+ $val: rfs-value($value);
35
+
36
+ // Do not render anything if fluid and non fluid values are the same
37
+ $value: if($val == rfs-fluid-value($value), null, $val);
38
+ }
39
+ @else {
40
+ $value: rfs-fluid-value($value);
41
+ }
42
+ }
43
+
44
+ $is-css-var: map-get($utility, css-var);
45
+ $is-local-vars: map-get($utility, local-vars);
46
+ $is-rtl: map-get($utility, rtl);
47
+
48
+ @if $value != null {
49
+ @if $is-rtl == false {
50
+ /* rtl:begin:remove */
51
+ }
52
+
53
+ @if $is-css-var {
54
+ .#{$property-class + $infix + $property-class-modifier} {
55
+ --#{$variable-prefix}#{$property-class}: #{$value};
56
+ }
57
+
58
+ @each $pseudo in $state {
59
+ .#{$property-class + $infix + $property-class-modifier}-#{$pseudo}:#{$pseudo} {
60
+ --#{$variable-prefix}#{$property-class}: #{$value};
61
+ }
62
+ }
63
+ } @else {
64
+ .#{$property-class + $infix + $property-class-modifier} {
65
+ @each $property in $properties {
66
+ @if $is-local-vars {
67
+ @each $local-var, $value in $is-local-vars {
68
+ --#{$variable-prefix}#{$local-var}: #{$value};
69
+ }
70
+ }
71
+ #{$property}: $value if($enable-important-utilities, !important, null);
72
+ }
73
+ }
74
+
75
+ @each $pseudo in $state {
76
+ .#{$property-class + $infix + $property-class-modifier}-#{$pseudo}:#{$pseudo} {
77
+ @each $property in $properties {
78
+ #{$property}: $value if($enable-important-utilities, !important, null);
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ @if $is-rtl == false {
85
+ /* rtl:end:remove */
86
+ }
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,29 @@
1
+ // stylelint-disable declaration-no-important
2
+
3
+ // Hide content visually while keeping it accessible to assistive technologies
4
+ //
5
+ // See: https://www.a11yproject.com/posts/2013-01-11-how-to-hide-content/
6
+ // See: https://kittygiraudel.com/2016/10/13/css-hide-and-seek/
7
+
8
+ @mixin visually-hidden() {
9
+ position: absolute !important;
10
+ width: 1px !important;
11
+ height: 1px !important;
12
+ padding: 0 !important;
13
+ margin: -1px !important; // Fix for https://github.com/twbs/bootstrap/issues/25686
14
+ overflow: hidden !important;
15
+ clip: rect(0, 0, 0, 0) !important;
16
+ white-space: nowrap !important;
17
+ border: 0 !important;
18
+ }
19
+
20
+ // Use to only display content when it's focused, or one of its child elements is focused
21
+ // (i.e. when focus is within the element/container that the class was applied to)
22
+ //
23
+ // Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
24
+
25
+ @mixin visually-hidden-focusable() {
26
+ &:not(:focus):not(:focus-within) {
27
+ @include visually-hidden();
28
+ }
29
+ }
@@ -0,0 +1,47 @@
1
+ // Loop over each breakpoint
2
+ @each $breakpoint in map-keys($grid-breakpoints) {
3
+
4
+ // Generate media query if needed
5
+ @include media-breakpoint-up($breakpoint) {
6
+ $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
7
+
8
+ // Loop over each utility property
9
+ @each $key, $utility in $utilities {
10
+ // The utility can be disabled with `false`, thus check if the utility is a map first
11
+ // Only proceed if responsive media queries are enabled or if it's the base media query
12
+ @if type-of($utility) == "map" and (map-get($utility, responsive) or $infix == "") {
13
+ @include generate-utility($utility, $infix);
14
+ }
15
+ }
16
+ }
17
+ }
18
+
19
+ // RFS rescaling
20
+ @media (min-width: $rfs-mq-value) {
21
+ @each $breakpoint in map-keys($grid-breakpoints) {
22
+ $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
23
+
24
+ @if (map-get($grid-breakpoints, $breakpoint) < $rfs-breakpoint) {
25
+ // Loop over each utility property
26
+ @each $key, $utility in $utilities {
27
+ // The utility can be disabled with `false`, thus check if the utility is a map first
28
+ // Only proceed if responsive media queries are enabled or if it's the base media query
29
+ @if type-of($utility) == "map" and map-get($utility, rfs) and (map-get($utility, responsive) or $infix == "") {
30
+ @include generate-utility($utility, $infix, true);
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+
38
+ // Print utilities
39
+ @media print {
40
+ @each $key, $utility in $utilities {
41
+ // The utility can be disabled with `false`, thus check if the utility is a map first
42
+ // Then check if the utility needs print styles
43
+ @if type-of($utility) == "map" and map-get($utility, print) == true {
44
+ @include generate-utility($utility, "-print");
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,354 @@
1
+ // stylelint-disable property-blacklist, scss/dollar-variable-default
2
+
3
+ // SCSS RFS mixin
4
+ //
5
+ // Automated responsive values for font sizes, paddings, margins and much more
6
+ //
7
+ // Licensed under MIT (https://github.com/twbs/rfs/blob/main/LICENSE)
8
+
9
+ // Configuration
10
+
11
+ // Base value
12
+ $rfs-base-value: 1.25rem !default;
13
+ $rfs-unit: rem !default;
14
+
15
+ @if $rfs-unit != rem and $rfs-unit != px {
16
+ @error "`#{$rfs-unit}` is not a valid unit for $rfs-unit. Use `px` or `rem`.";
17
+ }
18
+
19
+ // Breakpoint at where values start decreasing if screen width is smaller
20
+ $rfs-breakpoint: 1200px !default;
21
+ $rfs-breakpoint-unit: px !default;
22
+
23
+ @if $rfs-breakpoint-unit != px and $rfs-breakpoint-unit != em and $rfs-breakpoint-unit != rem {
24
+ @error "`#{$rfs-breakpoint-unit}` is not a valid unit for $rfs-breakpoint-unit. Use `px`, `em` or `rem`.";
25
+ }
26
+
27
+ // Resize values based on screen height and width
28
+ $rfs-two-dimensional: false !default;
29
+
30
+ // Factor of decrease
31
+ $rfs-factor: 10 !default;
32
+
33
+ @if type-of($rfs-factor) != number or $rfs-factor <= 1 {
34
+ @error "`#{$rfs-factor}` is not a valid $rfs-factor, it must be greater than 1.";
35
+ }
36
+
37
+ // Mode. Possibilities: "min-media-query", "max-media-query"
38
+ $rfs-mode: min-media-query !default;
39
+
40
+ // Generate enable or disable classes. Possibilities: false, "enable" or "disable"
41
+ $rfs-class: false !default;
42
+
43
+ // 1 rem = $rfs-rem-value px
44
+ $rfs-rem-value: 16 !default;
45
+
46
+ // Safari iframe resize bug: https://github.com/twbs/rfs/issues/14
47
+ $rfs-safari-iframe-resize-bug-fix: false !default;
48
+
49
+ // Disable RFS by setting $enable-rfs to false
50
+ $enable-rfs: true !default;
51
+
52
+ // Cache $rfs-base-value unit
53
+ $rfs-base-value-unit: unit($rfs-base-value);
54
+
55
+ @function divide($dividend, $divisor, $precision: 10) {
56
+ $sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
57
+ $dividend: abs($dividend);
58
+ $divisor: abs($divisor);
59
+ @if $dividend == 0 {
60
+ @return 0;
61
+ }
62
+ @if $divisor == 0 {
63
+ @error "Cannot divide by 0";
64
+ }
65
+ $remainder: $dividend;
66
+ $result: 0;
67
+ $factor: 10;
68
+ @while ($remainder > 0 and $precision >= 0) {
69
+ $quotient: 0;
70
+ @while ($remainder >= $divisor) {
71
+ $remainder: $remainder - $divisor;
72
+ $quotient: $quotient + 1;
73
+ }
74
+ $result: $result * 10 + $quotient;
75
+ $factor: $factor * .1;
76
+ $remainder: $remainder * 10;
77
+ $precision: $precision - 1;
78
+ @if ($precision < 0 and $remainder >= $divisor * 5) {
79
+ $result: $result + 1;
80
+ }
81
+ }
82
+ $result: $result * $factor * $sign;
83
+ $dividend-unit: unit($dividend);
84
+ $divisor-unit: unit($divisor);
85
+ $unit-map: (
86
+ "px": 1px,
87
+ "rem": 1rem,
88
+ "em": 1em,
89
+ "%": 1%
90
+ );
91
+ @if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
92
+ $result: $result * map-get($unit-map, $dividend-unit);
93
+ }
94
+ @return $result;
95
+ }
96
+
97
+ // Remove px-unit from $rfs-base-value for calculations
98
+ @if $rfs-base-value-unit == px {
99
+ $rfs-base-value: divide($rfs-base-value, $rfs-base-value * 0 + 1);
100
+ }
101
+ @else if $rfs-base-value-unit == rem {
102
+ $rfs-base-value: divide($rfs-base-value, divide($rfs-base-value * 0 + 1, $rfs-rem-value));
103
+ }
104
+
105
+ // Cache $rfs-breakpoint unit to prevent multiple calls
106
+ $rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
107
+
108
+ // Remove unit from $rfs-breakpoint for calculations
109
+ @if $rfs-breakpoint-unit-cache == px {
110
+ $rfs-breakpoint: divide($rfs-breakpoint, $rfs-breakpoint * 0 + 1);
111
+ }
112
+ @else if $rfs-breakpoint-unit-cache == rem or $rfs-breakpoint-unit-cache == "em" {
113
+ $rfs-breakpoint: divide($rfs-breakpoint, divide($rfs-breakpoint * 0 + 1, $rfs-rem-value));
114
+ }
115
+
116
+ // Calculate the media query value
117
+ $rfs-mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{divide($rfs-breakpoint, $rfs-rem-value)}#{$rfs-breakpoint-unit});
118
+ $rfs-mq-property-width: if($rfs-mode == max-media-query, max-width, min-width);
119
+ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height);
120
+
121
+ // Internal mixin used to determine which media query needs to be used
122
+ @mixin _rfs-media-query {
123
+ @if $rfs-two-dimensional {
124
+ @if $rfs-mode == max-media-query {
125
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}), (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
126
+ @content;
127
+ }
128
+ }
129
+ @else {
130
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) and (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
131
+ @content;
132
+ }
133
+ }
134
+ }
135
+ @else {
136
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
137
+ @content;
138
+ }
139
+ }
140
+ }
141
+
142
+ // Internal mixin that adds disable classes to the selector if needed.
143
+ @mixin _rfs-rule {
144
+ @if $rfs-class == disable and $rfs-mode == max-media-query {
145
+ // Adding an extra class increases specificity, which prevents the media query to override the property
146
+ &,
147
+ .disable-rfs &,
148
+ &.disable-rfs {
149
+ @content;
150
+ }
151
+ }
152
+ @else if $rfs-class == enable and $rfs-mode == min-media-query {
153
+ .enable-rfs &,
154
+ &.enable-rfs {
155
+ @content;
156
+ }
157
+ }
158
+ @else {
159
+ @content;
160
+ }
161
+ }
162
+
163
+ // Internal mixin that adds enable classes to the selector if needed.
164
+ @mixin _rfs-media-query-rule {
165
+
166
+ @if $rfs-class == enable {
167
+ @if $rfs-mode == min-media-query {
168
+ @content;
169
+ }
170
+
171
+ @include _rfs-media-query {
172
+ .enable-rfs &,
173
+ &.enable-rfs {
174
+ @content;
175
+ }
176
+ }
177
+ }
178
+ @else {
179
+ @if $rfs-class == disable and $rfs-mode == min-media-query {
180
+ .disable-rfs &,
181
+ &.disable-rfs {
182
+ @content;
183
+ }
184
+ }
185
+ @include _rfs-media-query {
186
+ @content;
187
+ }
188
+ }
189
+ }
190
+
191
+ // Helper function to get the formatted non-responsive value
192
+ @function rfs-value($values) {
193
+ // Convert to list
194
+ $values: if(type-of($values) != list, ($values,), $values);
195
+
196
+ $val: '';
197
+
198
+ // Loop over each value and calculate value
199
+ @each $value in $values {
200
+ @if $value == 0 {
201
+ $val: $val + ' 0';
202
+ }
203
+ @else {
204
+ // Cache $value unit
205
+ $unit: if(type-of($value) == "number", unit($value), false);
206
+
207
+ @if $unit == px {
208
+ // Convert to rem if needed
209
+ $val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $value * 0 + $rfs-rem-value)}rem, $value);
210
+ }
211
+ @else if $unit == rem {
212
+ // Convert to px if needed
213
+ $val: $val + ' ' + if($rfs-unit == px, #{divide($value, $value * 0 + 1) * $rfs-rem-value}px, $value);
214
+ }
215
+ @else {
216
+ // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
217
+ $val: $val + ' ' + $value;
218
+ }
219
+ }
220
+ }
221
+
222
+ // Remove first space
223
+ @return unquote(str-slice($val, 2));
224
+ }
225
+
226
+ // Helper function to get the responsive value calculated by RFS
227
+ @function rfs-fluid-value($values) {
228
+ // Convert to list
229
+ $values: if(type-of($values) != list, ($values,), $values);
230
+
231
+ $val: '';
232
+
233
+ // Loop over each value and calculate value
234
+ @each $value in $values {
235
+ @if $value == 0 {
236
+ $val: $val + ' 0';
237
+ }
238
+
239
+ @else {
240
+ // Cache $value unit
241
+ $unit: if(type-of($value) == "number", unit($value), false);
242
+
243
+ // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
244
+ @if not $unit or $unit != px and $unit != rem {
245
+ $val: $val + ' ' + $value;
246
+ }
247
+
248
+ @else {
249
+ // Remove unit from $value for calculations
250
+ $value: divide($value, $value * 0 + if($unit == px, 1, divide(1, $rfs-rem-value)));
251
+
252
+ // Only add the media query if the value is greater than the minimum value
253
+ @if abs($value) <= $rfs-base-value or not $enable-rfs {
254
+ $val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $rfs-rem-value)}rem, #{$value}px);
255
+ }
256
+ @else {
257
+ // Calculate the minimum value
258
+ $value-min: $rfs-base-value + divide(abs($value) - $rfs-base-value, $rfs-factor);
259
+
260
+ // Calculate difference between $value and the minimum value
261
+ $value-diff: abs($value) - $value-min;
262
+
263
+ // Base value formatting
264
+ $min-width: if($rfs-unit == rem, #{divide($value-min, $rfs-rem-value)}rem, #{$value-min}px);
265
+
266
+ // Use negative value if needed
267
+ $min-width: if($value < 0, -$min-width, $min-width);
268
+
269
+ // Use `vmin` if two-dimensional is enabled
270
+ $variable-unit: if($rfs-two-dimensional, vmin, vw);
271
+
272
+ // Calculate the variable width between 0 and $rfs-breakpoint
273
+ $variable-width: #{divide($value-diff * 100, $rfs-breakpoint)}#{$variable-unit};
274
+
275
+ // Return the calculated value
276
+ $val: $val + ' calc(' + $min-width + if($value < 0, ' - ', ' + ') + $variable-width + ')';
277
+ }
278
+ }
279
+ }
280
+ }
281
+
282
+ // Remove first space
283
+ @return unquote(str-slice($val, 2));
284
+ }
285
+
286
+ // RFS mixin
287
+ @mixin rfs($values, $property: font-size) {
288
+ @if $values != null {
289
+ $val: rfs-value($values);
290
+ $fluidVal: rfs-fluid-value($values);
291
+
292
+ // Do not print the media query if responsive & non-responsive values are the same
293
+ @if $val == $fluidVal {
294
+ #{$property}: $val;
295
+ }
296
+ @else {
297
+ @include _rfs-rule {
298
+ #{$property}: if($rfs-mode == max-media-query, $val, $fluidVal);
299
+
300
+ // Include safari iframe resize fix if needed
301
+ min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null);
302
+ }
303
+
304
+ @include _rfs-media-query-rule {
305
+ #{$property}: if($rfs-mode == max-media-query, $fluidVal, $val);
306
+ }
307
+ }
308
+ }
309
+ }
310
+
311
+ // Shorthand helper mixins
312
+ @mixin font-size($value) {
313
+ @include rfs($value);
314
+ }
315
+
316
+ @mixin padding($value) {
317
+ @include rfs($value, padding);
318
+ }
319
+
320
+ @mixin padding-top($value) {
321
+ @include rfs($value, padding-top);
322
+ }
323
+
324
+ @mixin padding-right($value) {
325
+ @include rfs($value, padding-right);
326
+ }
327
+
328
+ @mixin padding-bottom($value) {
329
+ @include rfs($value, padding-bottom);
330
+ }
331
+
332
+ @mixin padding-left($value) {
333
+ @include rfs($value, padding-left);
334
+ }
335
+
336
+ @mixin margin($value) {
337
+ @include rfs($value, margin);
338
+ }
339
+
340
+ @mixin margin-top($value) {
341
+ @include rfs($value, margin-top);
342
+ }
343
+
344
+ @mixin margin-right($value) {
345
+ @include rfs($value, margin-right);
346
+ }
347
+
348
+ @mixin margin-bottom($value) {
349
+ @include rfs($value, margin-bottom);
350
+ }
351
+
352
+ @mixin margin-left($value) {
353
+ @include rfs($value, margin-left);
354
+ }