active_material 1.5.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -45
  3. data/app/assets/javascripts/active_material/actions-toggle.js +29 -27
  4. data/app/assets/javascripts/active_material.js +2 -2
  5. data/app/assets/stylesheets/active_material/atoms/type.scss +10 -10
  6. data/app/assets/stylesheets/active_material/components/sortable.scss +1 -1
  7. data/app/assets/stylesheets/active_material/components/utility_nav.scss +1 -1
  8. data/app/assets/stylesheets/active_material/generators/functions.scss +2 -11
  9. data/app/assets/stylesheets/active_material/generators/mixins.scss +1 -11
  10. data/app/assets/stylesheets/active_material/global/foundation.scss +1 -1
  11. data/app/assets/stylesheets/active_material/prototypes/dialog.scss +1 -1
  12. data/app/assets/stylesheets/active_material/prototypes/menu.scss +1 -1
  13. data/app/assets/stylesheets/active_material/prototypes/select.scss +2 -2
  14. data/app/assets/stylesheets/active_material/prototypes/snackbar.scss +1 -1
  15. data/app/assets/stylesheets/active_material/prototypes/subheader.scss +1 -1
  16. data/app/assets/stylesheets/active_material/prototypes/table.scss +1 -1
  17. data/app/assets/stylesheets/active_material/prototypes/textfield.scss +8 -7
  18. data/app/assets/stylesheets/active_material/prototypes/toolbar.scss +2 -2
  19. data/app/assets/stylesheets/active_material/values/fonts.scss +2 -2
  20. data/app/assets/stylesheets/active_material.scss +59 -7
  21. data/lib/active_material/font_loader.rb +12 -0
  22. data/lib/active_material/version.rb +3 -3
  23. data/lib/active_material.rb +25 -0
  24. metadata +6 -19
  25. data/app/assets/images/active_material/icons/account_circle.svg +0 -9
  26. data/app/assets/images/active_material/icons/arrow-dropdown.svg +0 -7
  27. data/app/assets/images/active_material/icons/arrow_down.svg +0 -7
  28. data/app/assets/images/active_material/icons/clear.svg +0 -8
  29. data/app/assets/images/active_material/icons/create.svg +0 -8
  30. data/app/assets/images/active_material/icons/email.svg +0 -8
  31. data/app/assets/images/active_material/icons/event.svg +0 -8
  32. data/app/assets/images/active_material/icons/more.svg +0 -9
  33. data/app/assets/images/active_material/icons/reorder.svg +0 -4
  34. data/app/assets/images/active_material/icons/search.svg +0 -9
  35. data/app/assets/images/active_material/icons/secret.svg +0 -8
  36. data/app/assets/javascripts/active_material/fonts.js +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca3864bcf2764b20496dca32ba97717a95a635785d390cb592f1f157dfd85ba1
4
- data.tar.gz: 12b62f11d7293fe15b20b4cc845c48db6a372049634564e502d9dcac3539e907
3
+ metadata.gz: 5d199f290d9505ddc520ac11343fd3dd45a174608691f30c50f6d53da7f94f81
4
+ data.tar.gz: a217138c6d68dcd47787ef2f9053baac7bfa1960d829de626d66280025c3d19d
5
5
  SHA512:
6
- metadata.gz: e2cfd53f7e9745300daafeca924f57f71d81a663df55eb47831a98a6b07c0ed3c1879b25a378b53d06590871af9e8c411aec4b8b133607d38c3c1fade3a2dccf
7
- data.tar.gz: d152695ac2fe97ea2ba97bf3a5bd8ad3258d784d8c3954eba81b64e22ca3df50340ca23b63f67840117010eb4258ee6323b42ce576c053fa39f8d32b1cf57730
6
+ metadata.gz: 1f68d12ea2b2a4672184b69ab562593e585fd521ba939c08a4c68622c84f9f56be7522fcb628345294d924e93634cd15306b1324572bf9fc05100ac27b75ee0f
7
+ data.tar.gz: e32ee1cb4376485d5fcec9878a507b841f74524e8b2938bf20f0d162218d396ee78b1d23d7b2fa1d84768922769d362f3e2740892eca6c9224d88c4a8d654313
data/README.md CHANGED
@@ -4,61 +4,35 @@ An ActiveAdmin skin based on Google's Material Design.
4
4
 
5
5
  <img src="http://i.imgur.com/kDkGzYe.png">
6
6
 
7
- 1. [Installation](#installation)
8
- 2. [Usage](#usage)
9
- 3. [Customization](#customization)
10
- 4. [Contributing](#contributing)
11
-
12
7
  ## Installation
8
+ ### Importmap
13
9
 
14
- Add this line to your application's Gemfile:
15
-
16
- ```ruby
17
- gem "active_material", github: "vigetlabs/active_material"
18
- ```
19
-
20
- And then execute:
21
-
22
- ```shell
23
- $ bundle
24
- ```
25
-
26
- Or install it yourself as:
10
+ - Add `gem 'active_material'` to `Gemfile` and run `bundle install`
11
+ - Add `import "active_material"` to JS entrypoint (a JS file that is included for activeadmin)
12
+ - Add `@import "active_material";` in your CSS style file (the active_material SCSS files are included in the asset path automatically, but you will need to have SCSS build capabilities, using dartsass-rails or similar)
27
13
 
28
- ```shell
29
- $ gem install active_material
30
- ```
14
+ NOTE: no need to pin the import in your application. That's handled internally by the gem.
31
15
 
32
- ## Usage
16
+ ### npm
17
+ - `npm install --save active_material` or `yarn add active_material`
18
+ - Add `import "active_material"` to your JS pack file
19
+ - Add `@import "active_material/app/assets/stylesheets/active_material.scss";` to your CSS style file
33
20
 
34
- In `app/assets/stylesheets/active_admin.css.scss`, replace:
21
+ ## Options
35
22
 
36
- `@import "active_admin/base";`
23
+ ### Change font
37
24
 
38
- with
25
+ By default, this gem will load the Roboto font from google APIs and use it in the SCSS. If you would like to change that behavior, you have a few options:
39
26
 
40
- `@import "active_material";`
27
+ 1. If you want to change to another font:
28
+ - In your application config, set `config.active_material.font_url` to your font url
29
+ - In your SCSS file, just before `@import "active_material";`, add `$am-font-sans: 'Roboto';`, replacing `Roboto` with your font name.
30
+ 2. If you want to disable font loading altogether, you can use `config.active_material.load_font = true`
41
31
 
42
- Additionally, ActiveMaterial comes with an optional JavaScript bundle that adds a few additional features. It should be included right after the active_admin base script.
32
+ ### Other customizations
43
33
 
44
- In app/assets/javascripts/active_admin.js, add:
45
-
46
- ```
47
- //= require active_material
48
- ```
49
-
50
- ## Customization
51
-
52
- Refer to the [Customization Guide](./docs/customization.md).
34
+ For other customization options, see [customization.md](./docs/customization.md)
53
35
 
54
36
  ## Contributing
55
37
 
56
- 1. Fork it ( https://github.com/[my-github-username]/active_material/fork )
57
- 2. Create your feature branch (`git checkout -b my-new-feature`)
58
- 3. Commit your changes (`git commit -am "Add some feature"`)
59
- 4. Push to the branch (`git push origin my-new-feature`)
60
- 5. Create a new Pull Request
61
-
62
- ### Issue and PR reviews
63
-
64
- Another way you can help is by reviewing issues, trying to reproduce bugs, and providing feedback on PRs.
38
+ See [CONTRIBUTING.md](./CONTRIBUTING.md)
@@ -1,36 +1,38 @@
1
- $(function() {
2
- var actions = $("tbody .col-actions");
1
+ document.addEventListener("DOMContentLoaded", () => {
2
+ const actions = document.querySelectorAll("tbody .col-actions")
3
3
 
4
4
  function waitForOutsideClick (el) {
5
-
6
- $("body").on('click.toggle', function(e) {
5
+ const body = document.querySelector("body")
6
+ body.addEventListener("click", (e) => {
7
7
  if (el.contains(e.currentTarget) === false) {
8
- actions.removeClass('active');
9
- $("body").off("click.toggle");
8
+ el.classList.remove('active')
10
9
  }
11
- });
10
+ })
12
11
  }
13
12
 
14
- // Make actions focusable
15
- actions.attr('tabindex', 0).attr('role', 'button');
13
+ actions.forEach((action) => {
14
+ // Make actions focusable
15
+ action.setAttribute('tabindex', 0)
16
+ action.setAttribute('role', 'button')
16
17
 
17
- actions.on('click', function() {
18
- $(this).addClass('active');
19
- waitForOutsideClick(this);
20
- });
18
+ action.addEventListener('click', () => {
19
+ action.classList.add('active');
20
+ waitForOutsideClick(action);
21
+ })
21
22
 
22
- actions.on('keydown', function(e) {
23
- var space = 32;
24
- var enter = 13;
25
- var escape = 27;
23
+ action.addEventListener('keydown', (e) => {
24
+ const space = 32;
25
+ const enter = 13;
26
+ const escape = 27;
26
27
 
27
- if (e.keyCode == space || e.keyCode == enter) {
28
- e.preventDefault();
29
- $(this).addClass('active');
30
- waitForOutsideClick(this);
31
- } else if (e.keyCode == escape) {
32
- e.preventDefault();
33
- $(this).removeClass('active');
34
- }
35
- });
36
- });
28
+ if (e.keyCode == space || e.keyCode == enter) {
29
+ e.preventDefault()
30
+ action.classList.add('active')
31
+ waitForOutsideClick(action)
32
+ } else if (e.keyCode == escape) {
33
+ e.preventDefault()
34
+ action.classList.remove('active')
35
+ }
36
+ })
37
+ })
38
+ })
@@ -1,4 +1,4 @@
1
- //= require active_material/fonts
2
- //= require active_material/actions-toggle
1
+
2
+ import "active_material/actions-toggle"
3
3
 
4
4
  document.querySelector('html').className += ' am-js'
@@ -7,43 +7,43 @@
7
7
 
8
8
  /// Applies rules for subheader text.
9
9
  @mixin am-type-subheader {
10
- @include am-font-size(16);
10
+ @include am-font-size(16px);
11
11
  font-weight: $am-font-weight-regular;
12
- line-height: am-sp(24);
12
+ line-height: am-sp(24px);
13
13
  letter-spacing: am-tracking(10);
14
14
  }
15
15
 
16
16
  /// Applies rules for heavier, more emphasized, body text.
17
17
  @mixin am-type-body-2 {
18
- @include am-font-size(14);
18
+ @include am-font-size(14px);
19
19
  font-weight: $am-font-weight-semi-bold;
20
- line-height: am-sp(24);
20
+ line-height: am-sp(24px);
21
21
  letter-spacing: am-tracking(10);
22
22
  }
23
23
 
24
24
  /// Applies rules for standard body text.
25
25
  @mixin am-type-body-1 {
26
- @include am-font-size(14);
26
+ @include am-font-size(14px);
27
27
  font-weight: $am-font-weight-regular;
28
- line-height: am-sp(20);
28
+ line-height: am-sp(20px);
29
29
  letter-spacing: am-tracking(10);
30
30
  }
31
31
 
32
32
  /// Applies rules for caption text.
33
33
  @mixin am-type-caption {
34
- @include am-font-size(12);
34
+ @include am-font-size(12px);
35
35
  font-style: normal;
36
36
  font-weight: $am-font-weight-medium;
37
37
  letter-spacing: am-tracking(20);
38
- line-height: am-sp(12);
38
+ line-height: am-sp(12px);
39
39
  }
40
40
 
41
41
  /// Applies rules for button text.
42
42
  @mixin am-type-btn {
43
- @include am-font-size(14);
43
+ @include am-font-size(14px);
44
44
  font-weight: $am-font-weight-medium;
45
45
  letter-spacing: am-tracking(10);
46
- line-height: am-sp(12);
46
+ line-height: am-sp(12px);
47
47
  text-transform: uppercase;
48
48
  }
49
49
 
@@ -6,7 +6,7 @@
6
6
  ////
7
7
 
8
8
  /// The icon displayed within a sortable element's drag handle
9
- $am-sortable-icon: asset-url("active_material/icons/reorder.svg") !default;
9
+ $am-sortable-icon: url('data:image/svg+xml;utf8,<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"> <path d="M0 0h24v24H0z" fill="none"/> <path d="M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"/> </svg>') !default;
10
10
  // The size of the draggable handle
11
11
  $am-sortable-handle-size: am-unit(7);
12
12
 
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  #utility_nav {
7
- background: asset-url("active_material/icons/account_circle.svg") no-repeat;
7
+ background: url('data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjQ4cHgiIGhlaWdodD0iNDhweCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0OCA0OCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+IDxwYXRoIGZpbGw9IiNGRkZGRkYiIGQ9Ik0yNCw0QzEyLjk1LDQsNCwxMi45NSw0LDI0czguOTUsMjAsMjAsMjBzMjAtOC45NSwyMC0yMFMzNS4wNSw0LDI0LDR6IE0yNCwxMGMzLjMxMSwwLDYsMi42OSw2LDYgYzAsMy4zMi0yLjY4OSw2LTYsNmMtMy4zMSwwLTYtMi42OC02LTZDMTgsMTIuNjksMjAuNjksMTAsMjQsMTB6IE0yNCwzOC40Yy01LjAxLDAtOS40MS0yLjU2MS0xMi02LjQ0YzAuMDUtMy45Nyw4LjAxLTYuMTYsMTItNi4xNiBzMTEuOTM5LDIuMTksMTIsNi4xNkMzMy40MSwzNS44NCwyOS4wMSwzOC40LDI0LDM4LjR6Ii8+IDwvc3ZnPg==') no-repeat;
8
8
  background-size: am-unit(5);
9
9
  width: am-unit(5);
10
10
  height: am-unit(5);
@@ -6,16 +6,7 @@
6
6
  /// @param {number} $amount - An integer value, such as 100
7
7
  /// @return {number} The amount of letter-spacing in ems.
8
8
  @function am-tracking($amount) {
9
- @return ($amount / 1000) + 0em;
10
- }
11
-
12
-
13
- /// Removes units (px, em, etc...) from a given number.
14
- ///
15
- /// @param {number} $number - The numeric value to strip units from.
16
- /// @return {number} A unitless number value.
17
- @function am-strip-units($number) {
18
- @return $number / ($number * 0 + 1);
9
+ @return calc($amount / 1000) + 0em;
19
10
  }
20
11
 
21
12
 
@@ -31,7 +22,7 @@
31
22
  /// @param {number} $baseline [16] - The assumed base font size.
32
23
  /// @return {number} Scalable pixel value in rems.
33
24
  @function am-sp($value, $baseline:16) {
34
- @return (am-strip-units($value) / $baseline) + rem;
25
+ @return calc($value / $baseline) + rem;
35
26
  }
36
27
 
37
28
 
@@ -9,16 +9,6 @@
9
9
  /// in older browsers.
10
10
  /// @param {number} $size - Font size in pixels
11
11
  @mixin am-font-size($size) {
12
- font-size: am-strip-units($size) + 0px;
12
+ font-size: $size;
13
13
  font-size: am-sp($size);
14
14
  }
15
-
16
- /// When using the Webfont.js font loader, only show the loaded font-family
17
- /// when the loader indicates it is active (via the .wf-active) class.
18
- @mixin am-web-font($family, $fallback: sans-serif) {
19
- font-family: $fallback;
20
-
21
- .wf-active & {
22
- @include am-font-family($family);
23
- }
24
- }
@@ -21,7 +21,7 @@ body {
21
21
  body {
22
22
  @include am-type-body-1;
23
23
  @include am-color(text);
24
- @include am-web-font(sans);
24
+ @include am-font-family(sans);
25
25
  margin: 0;
26
26
  }
27
27
 
@@ -45,7 +45,7 @@ $am-dialog-title-padding: am-unit(4) am-unit(3) am-unit(1) !default;
45
45
 
46
46
  @mixin am-dialog-close {
47
47
  @include am-btn-icon;
48
- background: asset_url("active_material/icons/clear.svg") 50% 50% no-repeat;
48
+ background: url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> <path opacity="0.54" d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12 L19,6.41z"/> </svg>') 50% 50% no-repeat;
49
49
  margin: 0;
50
50
  padding: 0;
51
51
  position: absolute;
@@ -39,7 +39,7 @@ $am-menu-carat-size: 5px !default;
39
39
  border-color: am-color(primary) transparent transparent;
40
40
  content: "";
41
41
  height: 0;
42
- margin-top: $am-menu-carat-size / -2;
42
+ margin-top: calc($am-menu-carat-size / -2);
43
43
  position: absolute;
44
44
  right: -15px;
45
45
  top: 50%;
@@ -11,8 +11,8 @@
11
11
  }
12
12
 
13
13
  @mixin am-select-input {
14
- @include am-font-size(14);
15
- background: #fafafa asset-url("active_material/icons/arrow-dropdown.svg") no-repeat calc(100% - 4px) 50%;
14
+ @include am-font-size(14px);
15
+ background: #fafafa url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="18px" height="18px" viewBox="0 0 18 18" enable-background="new 0 0 18 18" xml:space="preserve"> <path opacity="0.4" d="M5,8l4,4l4-4H5z"/> </svg>') no-repeat calc(100% - 4px) 50%;
16
16
  border: 1px solid #d3d3d3;
17
17
  border-radius: 3px;
18
18
  box-shadow: inset 0 1px 0 rgba(#fff, 0.8);
@@ -31,7 +31,7 @@ $am-snackbar-duration: 9s !default;
31
31
  color: $am-snackbar-color;
32
32
  font-weight: 300;
33
33
  font-size: 14px;
34
- line-height: am-sp(20);
34
+ line-height: am-sp(20px);
35
35
  margin: am-unit(2);
36
36
  min-width: $am-snackbar-min-width;
37
37
  max-width: $am-snackbar-max-width;
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  @mixin am-subheader {
8
- @include am-font-size(14);
8
+ @include am-font-size(14px);
9
9
  @include am-color(secondary-text);
10
10
  font-weight: $am-font-weight-medium;
11
11
  padding: am-unit(2);
@@ -112,7 +112,7 @@ $am-table-border-color: am-color(divider);
112
112
  }
113
113
 
114
114
  @mixin am-table-cell-actions {
115
- background: asset_url("active_material/icons/more.svg") 25% 50% no-repeat;
115
+ background: url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> <path fill="none" d="M0,0h24v24H0V0z"/> <path opacity="0.875" d="M12,8c1.1,0,2-0.9,2-2s-0.9-2-2-2c-1.1,0-2,0.9-2,2S10.9,8,12,8z M12,10c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2 c1.1,0,2-0.9,2-2C14,10.9,13.1,10,12,10z M12,16c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S13.1,16,12,16z"/> </svg>') 25% 50% no-repeat;
116
116
  position: relative;
117
117
  width: am-unit(6);
118
118
  }
@@ -5,9 +5,9 @@
5
5
  ////
6
6
 
7
7
  /// Textfield input typography.
8
- $am-textfield-input-type: normal am-sp(14)/24px $am-font-sans !default;
8
+ $am-textfield-input-type: normal am-sp(14px)/24px $am-font-sans !default;
9
9
  /// Textfield label typography.
10
- $am-textfield-label-type: $am-font-weight-regular am-sp(12)/am-unit(2) $am-font-sans !default;
10
+ $am-textfield-label-type: $am-font-weight-regular am-sp(12px)/am-unit(2) $am-font-sans !default;
11
11
  /// Textfield margin.
12
12
  $am-textfield-margin: am-unit(1) 0 !default;
13
13
  /// Textfield padding.
@@ -19,11 +19,12 @@ $am-textfield-color: rgba(#000, 0.70) !default;
19
19
  /// Textfield highlight color.
20
20
  $am-textfield-primary: am-color(primary) !default;
21
21
  /// Icon for email fields.
22
- $am-textfield-email-icon: asset-url("active_material/icons/email.svg") !default;
22
+ $am-textfield-email-icon: url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> <path opacity="0.3" enable-background="new " d="M20,4H4C2.9,4,2.01,4.9,2.01,6L2,18c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V6 C22,4.9,21.1,4,20,4z M20,8l-8,5L4,8V6l8,5l8-5V8z"/> </svg>') !default;
23
23
  /// Icon for password fields.
24
- $am-textfield-password-icon: asset-url("active_material/icons/secret.svg") !default;
24
+ $am-textfield-password-icon: url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> <path opacity="0.4" d="M12.65,10C11.83,7.67,9.61,6,7,6c-3.31,0-6,2.69-6,6c0,3.311,2.69,6,6,6c2.61,0,4.83-1.67,5.65-4H17v4h4v-4h2 v-4H12.65z M7,14c-1.1,0-2-0.9-2-2c0-1.1,0.9-2,2-2s2,0.9,2,2C9,13.1,8.1,14,7,14z"/> </svg>') !default;
25
25
  /// Icon for date fields.
26
- $am-textfield-date-icon: asset-url("active_material/icons/event.svg") !default;
26
+ $am-textfield-date-icon: url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> <path opacity="0.4" d="M17,12h-5v5h5V12z M16,1v2H8V1H6v2H5C3.89,3,3.01,3.9,3.01,5L3,19c0,1.1,0.89,2,2,2h14c1.1,0,2-0.9,2-2V5 c0-1.1-0.9-2-2-2h-1V1H16z M19,19H5V8h14V19z"/> </svg>') !default;
27
+
27
28
 
28
29
  @mixin am-textfield {
29
30
  color: $am-textfield-color;
@@ -69,7 +70,7 @@ $am-textfield-date-icon: asset-url("active_material/icons/event.svg") !default;
69
70
 
70
71
  @mixin am-textfield-textarea {
71
72
  border-radius: 2px;
72
- height: am-sp(am-unit(7));
73
+ height: am-sp(7px);
73
74
  padding: am-unit(1);
74
75
  }
75
76
 
@@ -79,7 +80,7 @@ $am-textfield-date-icon: asset-url("active_material/icons/event.svg") !default;
79
80
  }
80
81
 
81
82
  @mixin am-textfield-label {
82
- @include am-font-size(13);
83
+ @include am-font-size(13px);
83
84
  @include am-color(secondary-text);
84
85
  display: block;
85
86
  line-height: 16px;
@@ -3,8 +3,8 @@
3
3
  * A basic navigation element, primary used for top level navigation
4
4
  */
5
5
 
6
- $am-toolbar-base-font-size : am-sp(14) !default;
7
- $am-toolbar-title-font-size : am-sp(20) !default;
6
+ $am-toolbar-base-font-size : am-sp(14px) !default;
7
+ $am-toolbar-title-font-size : am-sp(20px) !default;
8
8
  $am-toolbar-keyline-small : am-unit(7) !default;
9
9
  $am-toolbar-keyline-medium : $am-toolbar-keyline-small + 8px !default;
10
10
 
@@ -3,13 +3,13 @@
3
3
  ////
4
4
 
5
5
  /// The default sans-serif font
6
- $am-font-sans: 'RobotoDraft', sans-serif !default;
6
+ $am-font-sans: 'Roboto', sans-serif !default;
7
7
 
8
8
  /// The weight of bold type
9
9
  $am-font-weight-bold: 700;
10
10
 
11
11
  /// The weight of semi-bold type
12
- $am-font-weight-semi-bold: 600;
12
+ $am-font-weight-semi-bold: 500;
13
13
 
14
14
  /// The weight of medium type
15
15
  $am-font-weight-medium: 500;
@@ -2,7 +2,7 @@
2
2
  /// Active Material
3
3
  /// A redesign of ActiveAdmin that follows Material Design standards
4
4
  /// www.google.com/design/spec/material-design/introduction.html
5
- /// @author Viget Labs
5
+ /// @author Derek Kniffin
6
6
  ////
7
7
 
8
8
  /// $variables, these should always end with !default
@@ -12,25 +12,77 @@
12
12
  @import "active_material/values/fonts";
13
13
  @import "active_material/values/breakpoints";
14
14
  @import "active_material/values/elevation";
15
- @import "active_material/values/*";
16
15
 
17
16
  /// Generators describe functions, mixins, and classes
18
17
  /// intended for extension. More or less, they are "style builders"
19
18
  /// instead of "style descriptors"
20
19
  @import "active_material/generators/functions";
21
20
  @import "active_material/generators/mixins";
22
- @import "active_material/generators/*";
23
21
 
24
22
  /// Atoms are individual styles to enhance reusability
25
- @import "active_material/atoms/*";
23
+ @import "active_material/atoms/clearfix";
24
+ @import "active_material/atoms/color";
25
+ @import "active_material/atoms/family";
26
+ @import "active_material/atoms/fill";
27
+ @import "active_material/atoms/hidden";
28
+ @import "active_material/atoms/links";
29
+ @import "active_material/atoms/lists";
30
+ @import "active_material/atoms/paper";
31
+ @import "active_material/atoms/type";
26
32
 
27
33
  /// Foundational rules that setup the page
28
34
  @import "active_material/global/foundation";
29
- @import "active_material/global/*";
30
35
 
31
36
  /// Prototypes are collections of mixins that allow for css design
32
37
  /// without the constraints of limiting ActiveAdmin selectors
33
- @import "active_material/prototypes/*";
38
+ @import "active_material/prototypes/actions-footer";
39
+ @import "active_material/prototypes/avatar";
40
+ @import "active_material/prototypes/btn-icon";
41
+ @import "active_material/prototypes/button";
42
+ @import "active_material/prototypes/datepicker";
43
+ @import "active_material/prototypes/dialog";
44
+ @import "active_material/prototypes/menu";
45
+ @import "active_material/prototypes/multiselect";
46
+ @import "active_material/prototypes/select";
47
+ @import "active_material/prototypes/snackbar";
48
+ @import "active_material/prototypes/subheader";
49
+ @import "active_material/prototypes/table";
50
+ @import "active_material/prototypes/tabs";
51
+ @import "active_material/prototypes/tag";
52
+ @import "active_material/prototypes/textfield";
53
+ @import "active_material/prototypes/toolbar";
54
+ @import "active_material/prototypes/underlay";
34
55
 
35
56
  /// Components describe actual implementation within Active Admin
36
- @import "active_material/components/*";
57
+ @import "active_material/components/avatar";
58
+ @import "active_material/components/blank_slate";
59
+ @import "active_material/components/breadcrumbs";
60
+ @import "active_material/components/buttons";
61
+ @import "active_material/components/checkbox";
62
+ @import "active_material/components/clearfix";
63
+ @import "active_material/components/comments";
64
+ @import "active_material/components/date-select";
65
+ @import "active_material/components/datepicker";
66
+ @import "active_material/components/dialog";
67
+ @import "active_material/components/dropdown";
68
+ @import "active_material/components/featured-blocks";
69
+ @import "active_material/components/filter";
70
+ @import "active_material/components/flash";
71
+ @import "active_material/components/footer";
72
+ @import "active_material/components/forms";
73
+ @import "active_material/components/header";
74
+ @import "active_material/components/hidden";
75
+ @import "active_material/components/login";
76
+ @import "active_material/components/overlay";
77
+ @import "active_material/components/pagination";
78
+ @import "active_material/components/panels";
79
+ @import "active_material/components/photo_select";
80
+ @import "active_material/components/scopes";
81
+ @import "active_material/components/select";
82
+ @import "active_material/components/sortable";
83
+ @import "active_material/components/structure";
84
+ @import "active_material/components/tables";
85
+ @import "active_material/components/tabs";
86
+ @import "active_material/components/tag";
87
+ @import "active_material/components/title_bar";
88
+ @import "active_material/components/utility_nav";
@@ -0,0 +1,12 @@
1
+ module ActiveMaterial
2
+ module FontLoader
3
+ def build_active_admin_head
4
+ within super do
5
+ uri = URI.parse(ActiveMaterial::Rails::Engine.config.active_material.font_url)
6
+ link(rel: "preconnect", href: uri.origin)
7
+ link(rel: "preconnect", href: uri.origin, crossorigin: true)
8
+ link(rel: "stylesheet", href: uri.to_s)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
- module ActiveMaterial
2
- VERSION = "1.5.2"
3
- end
1
+ module ActiveMaterial
2
+ VERSION = "2.1.0"
3
+ end
@@ -1,8 +1,33 @@
1
1
  require "active_material/version"
2
+ require "active_material/font_loader"
2
3
 
3
4
  module ActiveMaterial
4
5
  module Rails
5
6
  class Engine < ::Rails::Engine
7
+ config.active_material = ActiveSupport::OrderedOptions.new
8
+ config.active_material.load_font = true
9
+ config.active_material.font_url = "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
10
+
11
+ initializer "active_material" do |app|
12
+ if app.config.active_material.load_font
13
+ ActiveAdmin.before_load do
14
+ ActiveAdmin::Views::Pages::Base.prepend ActiveMaterial::FontLoader
15
+ end
16
+ end
17
+ end
18
+
19
+ initializer "active_material.precompile" do |app|
20
+ app.config.assets.paths << self.root.join("app/javascripts")
21
+ app.config.assets.paths << self.root.join("app/stylesheets")
22
+ app.config.assets.precompile << "active_material.js"
23
+ end
24
+
25
+ initializer "active_material.importmap", before: "importmap" do |app|
26
+ # Skip if importmap-rails is not installed
27
+ next unless app.config.respond_to?(:importmap)
28
+
29
+ app.config.importmap.paths << Engine.root.join("config/importmap.rb")
30
+ end
6
31
  end
7
32
  end
8
33
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_material
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
- - Nate Hunzaker
8
- - David Eisinger
7
+ - Derek Kniffin
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2021-05-18 00:00:00.000000000 Z
11
+ date: 2024-07-16 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
@@ -55,28 +54,15 @@ dependencies:
55
54
  version: '0'
56
55
  description: ActiveAdmin skin based on Google's Material Design.
57
56
  email:
58
- - nate.hunzaker@viget.com
59
- - david.eisinger@viget.com
57
+ - derek.kniffin@gmail.com
60
58
  executables: []
61
59
  extensions: []
62
60
  extra_rdoc_files: []
63
61
  files:
64
62
  - LICENSE.txt
65
63
  - README.md
66
- - app/assets/images/active_material/icons/account_circle.svg
67
- - app/assets/images/active_material/icons/arrow-dropdown.svg
68
- - app/assets/images/active_material/icons/arrow_down.svg
69
- - app/assets/images/active_material/icons/clear.svg
70
- - app/assets/images/active_material/icons/create.svg
71
- - app/assets/images/active_material/icons/email.svg
72
- - app/assets/images/active_material/icons/event.svg
73
- - app/assets/images/active_material/icons/more.svg
74
- - app/assets/images/active_material/icons/reorder.svg
75
- - app/assets/images/active_material/icons/search.svg
76
- - app/assets/images/active_material/icons/secret.svg
77
64
  - app/assets/javascripts/active_material.js
78
65
  - app/assets/javascripts/active_material/actions-toggle.js
79
- - app/assets/javascripts/active_material/fonts.js
80
66
  - app/assets/stylesheets/active_material.scss
81
67
  - app/assets/stylesheets/active_material/atoms/clearfix.scss
82
68
  - app/assets/stylesheets/active_material/atoms/color.scss
@@ -145,6 +131,7 @@ files:
145
131
  - app/assets/stylesheets/active_material/values/fonts.scss
146
132
  - app/assets/stylesheets/active_material/values/units.scss
147
133
  - lib/active_material.rb
134
+ - lib/active_material/font_loader.rb
148
135
  - lib/active_material/version.rb
149
136
  homepage: ''
150
137
  licenses:
@@ -165,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
152
  - !ruby/object:Gem::Version
166
153
  version: '0'
167
154
  requirements: []
168
- rubygems_version: 3.1.2
155
+ rubygems_version: 3.3.26
169
156
  signing_key:
170
157
  specification_version: 4
171
158
  summary: ActiveAdmin skin based on Google's Material Design.
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
6
- <path fill="#FFFFFF" d="M24,4C12.95,4,4,12.95,4,24s8.95,20,20,20s20-8.95,20-20S35.05,4,24,4z M24,10c3.311,0,6,2.69,6,6
7
- c0,3.32-2.689,6-6,6c-3.31,0-6-2.68-6-6C18,12.69,20.69,10,24,10z M24,38.4c-5.01,0-9.41-2.561-12-6.44c0.05-3.97,8.01-6.16,12-6.16
8
- s11.939,2.19,12,6.16C33.41,35.84,29.01,38.4,24,38.4z"/>
9
- </svg>
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="18px" height="18px" viewBox="0 0 18 18" enable-background="new 0 0 18 18" xml:space="preserve">
6
- <path opacity="0.4" d="M5,8l4,4l4-4H5z"/>
7
- </svg>
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
6
- <path opacity="0.5" d="M7.41,7.84L12,12.42l4.59-4.58L18,9.25l-6,6l-6-6L7.41,7.84z"/>
7
- </svg>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
6
- <path opacity="0.54" d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12
7
- L19,6.41z"/>
8
- </svg>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
6
- <path opacity="0.54" d="M3,17.25V21h3.75L17.811,9.94l-3.75-3.75L3,17.25z M20.71,7.04c0.39-0.39,0.39-1.02,0-1.41l-2.34-2.34
7
- c-0.39-0.39-1.021-0.39-1.41,0l-1.83,1.83l3.75,3.75L20.71,7.04z"/>
8
- </svg>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
6
- <path opacity="0.3" enable-background="new " d="M20,4H4C2.9,4,2.01,4.9,2.01,6L2,18c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V6
7
- C22,4.9,21.1,4,20,4z M20,8l-8,5L4,8V6l8,5l8-5V8z"/>
8
- </svg>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
6
- <path opacity="0.4" d="M17,12h-5v5h5V12z M16,1v2H8V1H6v2H5C3.89,3,3.01,3.9,3.01,5L3,19c0,1.1,0.89,2,2,2h14c1.1,0,2-0.9,2-2V5
7
- c0-1.1-0.9-2-2-2h-1V1H16z M19,19H5V8h14V19z"/>
8
- </svg>
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
6
- <path fill="none" d="M0,0h24v24H0V0z"/>
7
- <path opacity="0.875" d="M12,8c1.1,0,2-0.9,2-2s-0.9-2-2-2c-1.1,0-2,0.9-2,2S10.9,8,12,8z M12,10c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2
8
- c1.1,0,2-0.9,2-2C14,10.9,13.1,10,12,10z M12,16c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S13.1,16,12,16z"/>
9
- </svg>
@@ -1,4 +0,0 @@
1
- <svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M0 0h24v24H0z" fill="none"/>
3
- <path d="M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"/>
4
- </svg>
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
6
- <path opacity="0.54" d="M15.5,14h-0.79l-0.28-0.27C15.41,12.59,16,11.11,16,9.5C16,5.91,13.09,3,9.5,3S3,5.91,3,9.5S5.91,16,9.5,16
7
- c1.61,0,3.09-0.59,4.23-1.57L14,14.71v0.79l5,4.99L20.49,19L15.5,14z M9.5,14C7.01,14,5,11.99,5,9.5S7.01,5,9.5,5S14,7.01,14,9.5
8
- S11.99,14,9.5,14z"/>
9
- </svg>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
6
- <path opacity="0.4" d="M12.65,10C11.83,7.67,9.61,6,7,6c-3.31,0-6,2.69-6,6c0,3.311,2.69,6,6,6c2.61,0,4.83-1.67,5.65-4H17v4h4v-4h2
7
- v-4H12.65z M7,14c-1.1,0-2-0.9-2-2c0-1.1,0.9-2,2-2s2,0.9,2,2C9,13.1,8.1,14,7,14z"/>
8
- </svg>
@@ -1,21 +0,0 @@
1
- /**
2
- * Fonts.js
3
- * Material design uses the Roboto Family. This script is responsible
4
- * for pulling it in asynchronously.
5
- *
6
- * http://www.google.com/design/spec/style/typography.html#typography-typeface
7
- */
8
-
9
- WebFontConfig = {
10
- google: { families: [ 'RobotoDraft:regular,medium,bold,italic:latin' ] }
11
- };
12
-
13
- (function() {
14
- var wf = document.createElement('script');
15
- wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
16
- '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
17
- wf.type = 'text/javascript';
18
- wf.async = 'true';
19
- var s = document.getElementsByTagName('script')[0];
20
- s.parentNode.insertBefore(wf, s);
21
- })();