hootstrap 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6c4e904af5f2bdc5634ddb86343bb4d2f35cc0d425396e9221f0cb587e32b52
4
- data.tar.gz: 57dd8f2c227b004fefa5da58981fe172409ef1926da7b80d8a24ddcdda6eb63a
3
+ metadata.gz: 52febde69e1cf0a8d39dc73fe217a21a7c7aa1ac67bfa628258ff63a074fefcc
4
+ data.tar.gz: 7ec8d1e8a88a6d6fbf31a35b5b1b50492109d7ac6d54cd7c9bc1eee37d2d28cb
5
5
  SHA512:
6
- metadata.gz: d6f7aa23234dba404d5572e7ee0f35f1998fc7bd6c9752233cb638fb970a190f7ed8c14255ee48104c1ff81e3b59a12b1238e78333c764b544cc3e3467aa9957
7
- data.tar.gz: 872d5552d7d5a94f9f018e2c37ecfc0a5f6f6e44428f58adbe2dbeb3dc5942cf8f0ff6826f2e0108cb518edf5b933cdb4bad6b4770228d87432be632c0c32416
6
+ metadata.gz: 80d18958dde2d40b8b62e130c11d1e8f2a27996b842b58e44c83c0659769347afc3321fc7664e8ea8d5f1c8595fdab67ebc4b504cdfa76e74c9d012502dedf2f
7
+ data.tar.gz: 3f4590d82e52505f2936af89c5be6a32f643b3e905fb3973e24b121517ec4fca588c1f7445f4ea4a71f007d12e27e1e9ce48d0fab4756460d4ef52dd76c2e584
@@ -0,0 +1,71 @@
1
+ //= require ./utils/dynamicListener
2
+ //= require ./utils/turbolinks
3
+
4
+ document.addEventListener(HootstrapEvent, () => {
5
+ let activeDropdown = {};
6
+
7
+ addDynamicEventListener(
8
+ document.body,
9
+ 'click',
10
+ '[data-toggle="dropdown"]',
11
+ openDropdown
12
+ );
13
+
14
+ document.body.addEventListener('click', event => {
15
+ if (!event.target.classList.contains('dropdown-toggle')) {
16
+ closeDropdown();
17
+ }
18
+ });
19
+
20
+ document.addEventListener('keyup', handleKeyup);
21
+
22
+ function openDropdown(event) {
23
+ event.preventDefault();
24
+
25
+ const button = event.target;
26
+ const dropdown = button.parentNode;
27
+ const children = dropdown.childNodes;
28
+
29
+ children.forEach(dropdownMenu => {
30
+ if (
31
+ dropdownMenu.classList &&
32
+ dropdownMenu.classList.contains('dropdown-menu')
33
+ ) {
34
+ const cachedActiveDropdown = activeDropdown.dropdown;
35
+ closeDropdown({ focus: true });
36
+
37
+ if (dropdown === cachedActiveDropdown) {
38
+ return;
39
+ }
40
+
41
+ button.focus();
42
+ dropdown.classList.add('show');
43
+ dropdownMenu.classList.add('show');
44
+ button.setAttribute('aria-expanded', 'true');
45
+ activeDropdown = {
46
+ dropdown: dropdown,
47
+ button: button,
48
+ dropdownMenu: dropdownMenu
49
+ };
50
+ }
51
+ });
52
+ }
53
+
54
+ function closeDropdown(options = {}) {
55
+ if (activeDropdown.dropdown) {
56
+ activeDropdown.dropdown.classList.remove('show');
57
+ activeDropdown.dropdownMenu.classList.remove('show');
58
+ activeDropdown.button.setAttribute('aria-expanded', 'false');
59
+ if (options.focus) {
60
+ activeDropdown.button.focus();
61
+ }
62
+ activeDropdown = {};
63
+ }
64
+ }
65
+
66
+ function handleKeyup(event) {
67
+ if (event.keyCode == 27) {
68
+ closeDropdown({ focus: true });
69
+ }
70
+ }
71
+ });
@@ -1,4 +1,5 @@
1
1
  //= require hootstrap/alerts
2
+ //= require hootstrap/dropdown
2
3
  //= require hootstrap/modal
3
4
  //= require hootstrap/rails
4
5
  //= require hootstrap/toast
@@ -2,3 +2,13 @@ html {
2
2
  position: relative;
3
3
  min-height: 100%;
4
4
  }
5
+
6
+ html,
7
+ body,
8
+ input,
9
+ button,
10
+ select,
11
+ textarea {
12
+ -moz-osx-font-smoothing: grayscale;
13
+ -webkit-font-smoothing: antialiased;
14
+ }
@@ -1,3 +1,3 @@
1
1
  module Hootstrap
2
- VERSION = '0.3.2'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Licata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-10 00:00:00.000000000 Z
11
+ date: 2018-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -64,6 +64,7 @@ files:
64
64
  - Rakefile
65
65
  - assets/javascripts/hootstrap.js
66
66
  - assets/javascripts/hootstrap/alerts.js
67
+ - assets/javascripts/hootstrap/dropdown.js
67
68
  - assets/javascripts/hootstrap/modal.js
68
69
  - assets/javascripts/hootstrap/rails.js
69
70
  - assets/javascripts/hootstrap/toast.js
@@ -123,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
124
  version: '0'
124
125
  requirements: []
125
126
  rubyforge_project:
126
- rubygems_version: 2.7.3
127
+ rubygems_version: 2.7.6
127
128
  signing_key:
128
129
  specification_version: 4
129
130
  summary: ProctorU's design system.