arara 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +38 -0
  3. data/Rakefile +32 -0
  4. data/app/assets/config/arara_manifest.js +1 -0
  5. data/app/assets/javascripts/arara.js +603 -0
  6. data/app/assets/stylesheets/arara/application.css +15 -0
  7. data/app/components/arara.rb +2 -0
  8. data/app/components/arara/base_component.rb +62 -0
  9. data/app/components/arara/button_component.html.erb +7 -0
  10. data/app/components/arara/button_component.rb +50 -0
  11. data/app/components/arara/card_action_buttons_component.html.erb +3 -0
  12. data/app/components/arara/card_action_buttons_component.rb +15 -0
  13. data/app/components/arara/card_action_icons_component.html.erb +3 -0
  14. data/app/components/arara/card_action_icons_component.rb +15 -0
  15. data/app/components/arara/card_actions_component.html.erb +3 -0
  16. data/app/components/arara/card_actions_component.rb +15 -0
  17. data/app/components/arara/card_component.html.erb +3 -0
  18. data/app/components/arara/card_component.rb +15 -0
  19. data/app/components/arara/card_media_component.html.erb +3 -0
  20. data/app/components/arara/card_media_component.rb +20 -0
  21. data/app/components/arara/card_media_content_component.html.erb +3 -0
  22. data/app/components/arara/card_media_content_component.rb +15 -0
  23. data/app/components/arara/card_primary_content_component.html.erb +3 -0
  24. data/app/components/arara/card_primary_content_component.rb +18 -0
  25. data/app/components/arara/checkbox_component.html.erb +22 -0
  26. data/app/components/arara/checkbox_component.rb +25 -0
  27. data/app/components/arara/chip_component.html.erb +13 -0
  28. data/app/components/arara/chip_component.rb +22 -0
  29. data/app/components/arara/chipset_component.html.erb +6 -0
  30. data/app/components/arara/chipset_component.rb +23 -0
  31. data/app/components/arara/data_table_body_cell_component.html.erb +3 -0
  32. data/app/components/arara/data_table_body_cell_component.rb +18 -0
  33. data/app/components/arara/data_table_body_checkbox_component.html.erb +11 -0
  34. data/app/components/arara/data_table_body_checkbox_component.rb +25 -0
  35. data/app/components/arara/data_table_body_component.html.erb +3 -0
  36. data/app/components/arara/data_table_body_component.rb +15 -0
  37. data/app/components/arara/data_table_body_row_component.html.erb +3 -0
  38. data/app/components/arara/data_table_body_row_component.rb +27 -0
  39. data/app/components/arara/data_table_component.html.erb +5 -0
  40. data/app/components/arara/data_table_component.rb +36 -0
  41. data/app/components/arara/data_table_header_cell_component.html.erb +3 -0
  42. data/app/components/arara/data_table_header_cell_component.rb +24 -0
  43. data/app/components/arara/data_table_header_checkbox_component.html.erb +11 -0
  44. data/app/components/arara/data_table_header_checkbox_component.rb +25 -0
  45. data/app/components/arara/data_table_header_component.html.erb +3 -0
  46. data/app/components/arara/data_table_header_component.rb +11 -0
  47. data/app/components/arara/data_table_header_row_component.html.erb +3 -0
  48. data/app/components/arara/data_table_header_row_component.rb +15 -0
  49. data/app/components/arara/dialog_button_component.html.erb +4 -0
  50. data/app/components/arara/dialog_button_component.rb +31 -0
  51. data/app/components/arara/dialog_component.html.erb +8 -0
  52. data/app/components/arara/dialog_component.rb +34 -0
  53. data/app/components/arara/dialog_content_component.html.erb +3 -0
  54. data/app/components/arara/dialog_content_component.rb +15 -0
  55. data/app/components/arara/dialog_footer_component.html.erb +3 -0
  56. data/app/components/arara/dialog_footer_component.rb +15 -0
  57. data/app/components/arara/dialog_title_component.html.erb +3 -0
  58. data/app/components/arara/dialog_title_component.rb +16 -0
  59. data/app/components/arara/elevation_component.html.erb +3 -0
  60. data/app/components/arara/elevation_component.rb +19 -0
  61. data/app/components/arara/fab_component.html.erb +13 -0
  62. data/app/components/arara/fab_component.rb +42 -0
  63. data/app/components/arara/fab_icon_component.html.erb +3 -0
  64. data/app/components/arara/fab_icon_component.rb +15 -0
  65. data/app/components/arara/form_builder.rb +142 -0
  66. data/app/components/arara/form_field_component.html.erb +3 -0
  67. data/app/components/arara/form_field_component.rb +15 -0
  68. data/app/components/arara/google_calendar/menu_item_component.html.erb +11 -0
  69. data/app/components/arara/google_calendar/menu_item_component.rb +34 -0
  70. data/app/components/arara/google_calendar/nav_bar_component.html.erb +176 -0
  71. data/app/components/arara/google_calendar/nav_bar_component.rb +6 -0
  72. data/app/components/arara/icon_button_component.html.erb +3 -0
  73. data/app/components/arara/icon_button_component.rb +42 -0
  74. data/app/components/arara/icon_toggle_component.html.erb +3 -0
  75. data/app/components/arara/icon_toggle_component.rb +18 -0
  76. data/app/components/arara/material_icon_component.html.erb +3 -0
  77. data/app/components/arara/material_icon_component.rb +18 -0
  78. data/app/components/arara/menu_component.html.erb +5 -0
  79. data/app/components/arara/menu_component.rb +19 -0
  80. data/app/components/arara/menu_divider_component.html.erb +1 -0
  81. data/app/components/arara/menu_divider_component.rb +19 -0
  82. data/app/components/arara/menu_item_component.html.erb +3 -0
  83. data/app/components/arara/menu_item_component.rb +22 -0
  84. data/app/components/arara/nav_bar_component.html.erb +293 -0
  85. data/app/components/arara/nav_bar_component.rb +7 -0
  86. data/app/components/arara/radio_button_component.html.erb +8 -0
  87. data/app/components/arara/radio_button_component.rb +35 -0
  88. data/app/components/arara/select_component.html.erb +22 -0
  89. data/app/components/arara/select_component.rb +27 -0
  90. data/app/components/arara/select_item_component.html.erb +3 -0
  91. data/app/components/arara/select_item_component.rb +45 -0
  92. data/app/components/arara/step_component.html.erb +27 -0
  93. data/app/components/arara/step_component.rb +100 -0
  94. data/app/components/arara/step_connector_component.html.erb +4 -0
  95. data/app/components/arara/step_connector_component.rb +31 -0
  96. data/app/components/arara/stepper_component.html.erb +3 -0
  97. data/app/components/arara/stepper_component.rb +20 -0
  98. data/app/components/arara/switch_component.html.erb +8 -0
  99. data/app/components/arara/switch_component.rb +35 -0
  100. data/app/components/arara/tags.rb +2 -0
  101. data/app/components/arara/tags/check_box.rb +63 -0
  102. data/app/components/arara/tags/chip_choice.rb +81 -0
  103. data/app/components/arara/tags/chipset.rb +39 -0
  104. data/app/components/arara/tags/country_select.rb +110 -0
  105. data/app/components/arara/tags/label.rb +78 -0
  106. data/app/components/arara/tags/password_field.rb +16 -0
  107. data/app/components/arara/tags/radio_button.rb +31 -0
  108. data/app/components/arara/tags/select.rb +120 -0
  109. data/app/components/arara/tags/text_area.rb +25 -0
  110. data/app/components/arara/tags/text_field.rb +31 -0
  111. data/app/components/arara/text_field_component.html.erb +47 -0
  112. data/app/components/arara/text_field_component.rb +101 -0
  113. data/app/components/arara/typography_component.html.erb +1 -0
  114. data/app/components/arara/typography_component.rb +51 -0
  115. data/app/controllers/arara/application_controller.rb +5 -0
  116. data/app/helpers/arara/application_helper.rb +4 -0
  117. data/app/javascript/arara/controllers/body_class_toggler_controller.js +20 -0
  118. data/app/javascript/arara/controllers/counter_controller.js +22 -0
  119. data/app/javascript/arara/controllers/demo_dialog_controller.js +24 -0
  120. data/app/javascript/arara/controllers/mdc_chip_set_controller.js +18 -0
  121. data/app/javascript/arara/controllers/mdc_data_table_controller.js +18 -0
  122. data/app/javascript/arara/controllers/mdc_form_field_controller.js +40 -0
  123. data/app/javascript/arara/controllers/mdc_icon_toggle_controller.js +18 -0
  124. data/app/javascript/arara/controllers/mdc_linear_progress_controller.js +18 -0
  125. data/app/javascript/arara/controllers/mdc_list_controller.js +23 -0
  126. data/app/javascript/arara/controllers/mdc_menu_controller.js +25 -0
  127. data/app/javascript/arara/controllers/mdc_ripple_controller.js +18 -0
  128. data/app/javascript/arara/controllers/mdc_select_controller.js +27 -0
  129. data/app/javascript/arara/controllers/mdc_slider_controller.js +21 -0
  130. data/app/javascript/arara/controllers/mdc_snackbar_controller.js +38 -0
  131. data/app/javascript/arara/controllers/mdc_switch_controller.js +18 -0
  132. data/app/javascript/arara/controllers/mdc_tab_bar_controller.js +18 -0
  133. data/app/javascript/arara/controllers/mdc_text_field_controller.js +35 -0
  134. data/app/javascript/arara/controllers/mdc_top_app_bar_controller.js +18 -0
  135. data/app/javascript/arara/controllers/rails_chip_set_choice_controller.js +31 -0
  136. data/app/javascript/arara/controllers/rails_chip_set_filter_controller.js +39 -0
  137. data/app/javascript/arara/controllers/remote_form_controller.js +79 -0
  138. data/app/javascript/arara/helpers/sum.js +5 -0
  139. data/app/javascript/arara/index.js +65 -0
  140. data/app/javascript/arara/scss/_material_design.scss +34 -0
  141. data/app/javascript/arara/scss/_tailwind.scss +4 -0
  142. data/app/javascript/arara/scss/arara.scss +5 -0
  143. data/app/javascript/arara/scss/material_design/_custom.scss +61 -0
  144. data/app/javascript/arara/scss/tailwind/_ripple_workaround.scss +22 -0
  145. data/app/jobs/arara/application_job.rb +4 -0
  146. data/app/mailers/arara/application_mailer.rb +6 -0
  147. data/app/models/arara/application_record.rb +5 -0
  148. data/app/views/layouts/arara/application.html.erb +15 -0
  149. data/config/routes.rb +2 -0
  150. data/lib/arara.rb +5 -0
  151. data/lib/arara/engine.rb +7 -0
  152. data/lib/arara/version.rb +3 -0
  153. data/lib/tasks/arara_tasks.rake +4 -0
  154. metadata +238 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f1366b888c0063661615043a8c3b1a51a918947ff13c908a071550e6bc61ed7a
4
+ data.tar.gz: c89cdf105dc1356037f5832c0bf177976cc9d7a79f93b384f9a122e1751d2b4e
5
+ SHA512:
6
+ metadata.gz: 6e23a98a626edc1531af1bfaf547625d1682ac172ae4da8380a40ba761f7f28a467397e4d5dd582f571ef3526809866616752c1a023d0802d073a87376b67087
7
+ data.tar.gz: 1d061d8b3973ef55dfcf3c7c5ca140805d44e2c3c2a5e7c61c3ee5c93acd4dd9610360e17a624cd1dba49f2b454dac7f8f645cebe7d12963b23bcc09c2df5ef0
@@ -0,0 +1,38 @@
1
+ # Arara 🦜
2
+
3
+ ## Browser Sync
4
+
5
+ ```bash
6
+ browser-sync start --proxy localhost:3000 --files "app/views, app/concepts"
7
+ ```
8
+
9
+ ## Customizing Dynamically
10
+
11
+ ```css
12
+ :root {
13
+ --base-color: #c6538c;
14
+ }
15
+
16
+ body {
17
+ background-color: var(--base-color);
18
+ }
19
+ ```
20
+
21
+ ```js
22
+ var root = document.documentElement;
23
+ root.style.setProperty('--base-color', "palevioletred")
24
+ ```
25
+
26
+ ## NPM Package
27
+
28
+ This is my first NPM package, the built system was inspired on [ActionCable](https://github.com/rails/rails/blob/ec69083cf3352c78f840de50fdf20ef30334e0b1/actioncable/package.json#L49) and [Material-UI](https://github.com/mui-org/material-ui/blob/49fb53dd3497e3c825bab92f1f1dde42644dbab4/package.json#L33), if there's a bug (and probably there ARE) or you have any suggestion, please open an issue
29
+
30
+ ## Special Thanks ✨
31
+
32
+ Eu gostaria de agradecer aos colegas @nicolasiensen @lpirola @lucastx @igr-santos @vivianedias que gentilmente cederam o nome da gem no rubygems.
33
+
34
+ I'd like to say thank you to @nicolasiensen @lpirola @lucastx @igr-santos @vivianedias that gently let me use the gem name on rubygems
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Arara'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'test'
28
+ t.pattern = 'test/**/*_test.rb'
29
+ t.verbose = false
30
+ end
31
+
32
+ task default: :test
@@ -0,0 +1 @@
1
+ //= link_directory ../stylesheets/arara .css
@@ -0,0 +1,603 @@
1
+ (function(global, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("stimulus"), require("@material/dialog"), require("@material/chips"), require("@material/data-table"), require("@material/form-field"), require("@material/checkbox"), require("@material/radio"), require("@material/icon-button"), require("@material/linear-progress"), require("@material/ripple"), require("@material/list"), require("@material/menu"), require("@material/select"), require("@material/slider"), require("@material/snackbar"), require("@material/switch"), require("@material/tab-bar"), require("@material/textfield"), require("@material/top-app-bar")) : typeof define === "function" && define.amd ? define([ "exports", "stimulus", "@material/dialog", "@material/chips", "@material/data-table", "@material/form-field", "@material/checkbox", "@material/radio", "@material/icon-button", "@material/linear-progress", "@material/ripple", "@material/list", "@material/menu", "@material/select", "@material/slider", "@material/snackbar", "@material/switch", "@material/tab-bar", "@material/textfield", "@material/top-app-bar" ], factory) : factory(global.Arara = {}, global.stimulus, global.dialog, global.chips, global["data-table"], global["form-field"], global.checkbox, global.radio, global["icon-button"], global["linear-progress"], global.ripple, global.list, global.menu, global.select, global.slider, global.snackbar, global.switch, global["tab-bar"], global.textfield, global["top-app-bar"]);
3
+ })(this, function(exports, stimulus, dialog, chips, dataTable, formField, checkbox, radio, iconButton, linearProgress, ripple, list, menu, select, slider, snackbar, _switch, tabBar, textfield, topAppBar) {
4
+ "use strict";
5
+ var sum = function sum(a, b) {
6
+ return a + b;
7
+ };
8
+ function _classCallCheck(instance, Constructor) {
9
+ if (!(instance instanceof Constructor)) {
10
+ throw new TypeError("Cannot call a class as a function");
11
+ }
12
+ }
13
+ function _defineProperties(target, props) {
14
+ for (var i = 0; i < props.length; i++) {
15
+ var descriptor = props[i];
16
+ descriptor.enumerable = descriptor.enumerable || false;
17
+ descriptor.configurable = true;
18
+ if ("value" in descriptor) descriptor.writable = true;
19
+ Object.defineProperty(target, descriptor.key, descriptor);
20
+ }
21
+ }
22
+ function _createClass(Constructor, protoProps, staticProps) {
23
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
24
+ if (staticProps) _defineProperties(Constructor, staticProps);
25
+ return Constructor;
26
+ }
27
+ function _typeof(obj) {
28
+ "@babel/helpers - typeof";
29
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
30
+ _typeof = function _typeof(obj) {
31
+ return typeof obj;
32
+ };
33
+ } else {
34
+ _typeof = function _typeof(obj) {
35
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
36
+ };
37
+ }
38
+ return _typeof(obj);
39
+ }
40
+ function _assertThisInitialized(self) {
41
+ if (self === void 0) {
42
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
43
+ }
44
+ return self;
45
+ }
46
+ function _possibleConstructorReturn(self, call) {
47
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
48
+ return call;
49
+ }
50
+ return _assertThisInitialized(self);
51
+ }
52
+ function _getPrototypeOf(o) {
53
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
54
+ return o.__proto__ || Object.getPrototypeOf(o);
55
+ };
56
+ return _getPrototypeOf(o);
57
+ }
58
+ function _setPrototypeOf(o, p) {
59
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
60
+ o.__proto__ = p;
61
+ return o;
62
+ };
63
+ return _setPrototypeOf(o, p);
64
+ }
65
+ function _inherits(subClass, superClass) {
66
+ if (typeof superClass !== "function" && superClass !== null) {
67
+ throw new TypeError("Super expression must either be null or a function");
68
+ }
69
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
70
+ constructor: {
71
+ value: subClass,
72
+ writable: true,
73
+ configurable: true
74
+ }
75
+ });
76
+ if (superClass) setPrototypeOf(subClass, superClass);
77
+ }
78
+ var _default = function(_Controller) {
79
+ _inherits(_default, _Controller);
80
+ function _default() {
81
+ _classCallCheck(this, _default);
82
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
83
+ }
84
+ _createClass(_default, [ {
85
+ key: "connect",
86
+ value: function connect() {}
87
+ }, {
88
+ key: "toggle",
89
+ value: function toggle() {
90
+ var toggleClass = this.data.get("class");
91
+ document.body.classList.toggle(toggleClass);
92
+ }
93
+ } ]);
94
+ return _default;
95
+ }(stimulus.Controller);
96
+ var _default$1 = function(_Controller) {
97
+ _inherits(_default, _Controller);
98
+ function _default() {
99
+ _classCallCheck(this, _default);
100
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
101
+ }
102
+ _createClass(_default, [ {
103
+ key: "initialize",
104
+ value: function initialize() {
105
+ this.setCounter(0);
106
+ }
107
+ }, {
108
+ key: "increase",
109
+ value: function increase() {
110
+ this.setCounter(this.counter + 1);
111
+ }
112
+ }, {
113
+ key: "decrease",
114
+ value: function decrease() {
115
+ this.setCounter(this.counter - 1);
116
+ }
117
+ }, {
118
+ key: "setCounter",
119
+ value: function setCounter(counter) {
120
+ this.counter = counter;
121
+ this.displayTarget.textContent = counter;
122
+ }
123
+ } ]);
124
+ return _default;
125
+ }(stimulus.Controller);
126
+ _default$1.targets = [ "display" ];
127
+ var _default$2 = function(_Controller) {
128
+ _inherits(_default, _Controller);
129
+ function _default() {
130
+ _classCallCheck(this, _default);
131
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
132
+ }
133
+ _createClass(_default, [ {
134
+ key: "connect",
135
+ value: function connect() {
136
+ var dialog$$1 = new dialog.MDCDialog(this.dialogTarget);
137
+ this.dialog = dialog$$1;
138
+ }
139
+ }, {
140
+ key: "openDialog",
141
+ value: function openDialog() {
142
+ this.dialog.open();
143
+ }
144
+ } ]);
145
+ return _default;
146
+ }(stimulus.Controller);
147
+ _default$2.targets = [ "button", "dialog" ];
148
+ var _default$3 = function(_Controller) {
149
+ _inherits(_default, _Controller);
150
+ function _default() {
151
+ _classCallCheck(this, _default);
152
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
153
+ }
154
+ _createClass(_default, [ {
155
+ key: "connect",
156
+ value: function connect() {
157
+ var el = new chips.MDCChipSet(this.element);
158
+ this.el = el;
159
+ }
160
+ } ]);
161
+ return _default;
162
+ }(stimulus.Controller);
163
+ var _default$4 = function(_Controller) {
164
+ _inherits(_default, _Controller);
165
+ function _default() {
166
+ _classCallCheck(this, _default);
167
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
168
+ }
169
+ _createClass(_default, [ {
170
+ key: "connect",
171
+ value: function connect() {
172
+ var el = new dataTable.MDCDataTable(this.element);
173
+ this.el = el;
174
+ }
175
+ } ]);
176
+ return _default;
177
+ }(stimulus.Controller);
178
+ var _default$5 = function(_Controller) {
179
+ _inherits(_default, _Controller);
180
+ function _default() {
181
+ _classCallCheck(this, _default);
182
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
183
+ }
184
+ _createClass(_default, [ {
185
+ key: "connect",
186
+ value: function connect() {
187
+ var formField$$1 = new formField.MDCFormField(this.element);
188
+ this.checkboxes = [].map.call(this.element.querySelectorAll(".mdc-checkbox"), function(el) {
189
+ var checkbox$$1 = new checkbox.MDCCheckbox(el);
190
+ if (el.dataset.indeterminate == "true") {
191
+ checkbox$$1.indeterminate = true;
192
+ }
193
+ if (el.dataset.checked == "true") {
194
+ checkbox$$1.checked = true;
195
+ }
196
+ formField$$1.input = checkbox$$1;
197
+ return checkbox$$1;
198
+ });
199
+ this.radios = [].map.call(this.element.querySelectorAll(".mdc-radio"), function(el) {
200
+ var radio$$1 = new radio.MDCRadio(el);
201
+ formField$$1.input = radio$$1;
202
+ return radio$$1;
203
+ });
204
+ this.el = formField$$1;
205
+ }
206
+ } ]);
207
+ return _default;
208
+ }(stimulus.Controller);
209
+ var _default$6 = function(_Controller) {
210
+ _inherits(_default, _Controller);
211
+ function _default() {
212
+ _classCallCheck(this, _default);
213
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
214
+ }
215
+ _createClass(_default, [ {
216
+ key: "connect",
217
+ value: function connect() {
218
+ var el = new iconButton.MDCIconButtonToggle(this.element);
219
+ this.el = el;
220
+ }
221
+ } ]);
222
+ return _default;
223
+ }(stimulus.Controller);
224
+ var _default$7 = function(_Controller) {
225
+ _inherits(_default, _Controller);
226
+ function _default() {
227
+ _classCallCheck(this, _default);
228
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
229
+ }
230
+ _createClass(_default, [ {
231
+ key: "connect",
232
+ value: function connect() {
233
+ var el = new linearProgress.MDCLinearProgress(this.element);
234
+ this.el = el;
235
+ }
236
+ } ]);
237
+ return _default;
238
+ }(stimulus.Controller);
239
+ var _default$8 = function(_Controller) {
240
+ _inherits(_default, _Controller);
241
+ function _default() {
242
+ _classCallCheck(this, _default);
243
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
244
+ }
245
+ _createClass(_default, [ {
246
+ key: "connect",
247
+ value: function connect() {
248
+ var list$$1 = new list.MDCList(this.element);
249
+ var listItemRipples = list$$1.listElements.map(function(listItemEl) {
250
+ return new ripple.MDCRipple(listItemEl);
251
+ });
252
+ this.listItemRipples = listItemRipples;
253
+ this.el = list$$1;
254
+ }
255
+ } ]);
256
+ return _default;
257
+ }(stimulus.Controller);
258
+ var _default$9 = function(_Controller) {
259
+ _inherits(_default, _Controller);
260
+ function _default() {
261
+ _classCallCheck(this, _default);
262
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
263
+ }
264
+ _createClass(_default, [ {
265
+ key: "connect",
266
+ value: function connect() {
267
+ var menu$$1 = new menu.MDCMenu(this.menuTarget);
268
+ this.menu = menu$$1;
269
+ }
270
+ }, {
271
+ key: "openMenu",
272
+ value: function openMenu() {
273
+ var isOpen = this.menuTarget.classList.contains("mdc-menu-surface--open");
274
+ this.menu.open = !isOpen;
275
+ }
276
+ } ]);
277
+ return _default;
278
+ }(stimulus.Controller);
279
+ _default$9.targets = [ "button", "menu" ];
280
+ var _default$10 = function(_Controller) {
281
+ _inherits(_default, _Controller);
282
+ function _default() {
283
+ _classCallCheck(this, _default);
284
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
285
+ }
286
+ _createClass(_default, [ {
287
+ key: "connect",
288
+ value: function connect() {
289
+ var el = new ripple.MDCRipple(this.element);
290
+ this.el = el;
291
+ }
292
+ } ]);
293
+ return _default;
294
+ }(stimulus.Controller);
295
+ var _default$11 = function(_Controller) {
296
+ _inherits(_default, _Controller);
297
+ function _default() {
298
+ _classCallCheck(this, _default);
299
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
300
+ }
301
+ _createClass(_default, [ {
302
+ key: "connect",
303
+ value: function connect() {
304
+ var _this = this;
305
+ var el = new select.MDCSelect(this.element);
306
+ this.inputTarget.value = el.value;
307
+ el.listen("MDCSelect:change", function() {
308
+ _this.inputTarget.value = el.value;
309
+ });
310
+ this.el = el;
311
+ }
312
+ } ]);
313
+ return _default;
314
+ }(stimulus.Controller);
315
+ _default$11.targets = [ "input" ];
316
+ var _default$12 = function(_Controller) {
317
+ _inherits(_default, _Controller);
318
+ function _default() {
319
+ _classCallCheck(this, _default);
320
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
321
+ }
322
+ _createClass(_default, [ {
323
+ key: "connect",
324
+ value: function connect() {
325
+ var el = new slider.MDCSlider(this.element);
326
+ el.listen("MDCSlider:change", function() {
327
+ alert("Value changed to ".concat(el.value));
328
+ });
329
+ this.el = el;
330
+ }
331
+ } ]);
332
+ return _default;
333
+ }(stimulus.Controller);
334
+ var _default$13 = function(_Controller) {
335
+ _inherits(_default, _Controller);
336
+ function _default() {
337
+ _classCallCheck(this, _default);
338
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
339
+ }
340
+ _createClass(_default, [ {
341
+ key: "connect",
342
+ value: function connect() {
343
+ var _this = this;
344
+ if (window.snackbarQueue == undefined) {
345
+ window.snackbarQueue = [];
346
+ }
347
+ this.queue = window.snackbarQueue;
348
+ this.snackbar = new snackbar.MDCSnackbar(this.snackbarTarget);
349
+ this.snackbar.listen("MDCSnackbar:closed", function() {
350
+ return _this.handleClosed();
351
+ });
352
+ }
353
+ }, {
354
+ key: "openSnackbar",
355
+ value: function openSnackbar() {
356
+ var _this2 = this;
357
+ this.queue.push(function() {
358
+ return _this2.snackbar.open();
359
+ });
360
+ if (this.queue.length === 1) {
361
+ this.queue[0]();
362
+ }
363
+ }
364
+ }, {
365
+ key: "handleClosed",
366
+ value: function handleClosed() {
367
+ this.queue.shift();
368
+ if (this.queue.length > 0) {
369
+ this.queue[0]();
370
+ }
371
+ }
372
+ } ]);
373
+ return _default;
374
+ }(stimulus.Controller);
375
+ _default$13.targets = [ "button", "snackbar" ];
376
+ var _default$14 = function(_Controller) {
377
+ _inherits(_default, _Controller);
378
+ function _default() {
379
+ _classCallCheck(this, _default);
380
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
381
+ }
382
+ _createClass(_default, [ {
383
+ key: "connect",
384
+ value: function connect() {
385
+ var el = new _switch.MDCSwitch(this.element);
386
+ this.el = el;
387
+ }
388
+ } ]);
389
+ return _default;
390
+ }(stimulus.Controller);
391
+ var _default$15 = function(_Controller) {
392
+ _inherits(_default, _Controller);
393
+ function _default() {
394
+ _classCallCheck(this, _default);
395
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
396
+ }
397
+ _createClass(_default, [ {
398
+ key: "connect",
399
+ value: function connect() {
400
+ var el = new tabBar.MDCTabBar(this.element);
401
+ this.el = el;
402
+ }
403
+ } ]);
404
+ return _default;
405
+ }(stimulus.Controller);
406
+ var _default$16 = function(_Controller) {
407
+ _inherits(_default, _Controller);
408
+ function _default() {
409
+ _classCallCheck(this, _default);
410
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
411
+ }
412
+ _createClass(_default, [ {
413
+ key: "connect",
414
+ value: function connect() {
415
+ var el = new textfield.MDCTextField(this.elementTarget);
416
+ this.el = el;
417
+ }
418
+ }, {
419
+ key: "handleFocus",
420
+ value: function handleFocus(e) {
421
+ this.elementTarget.classList.remove("mdc-text-field--error");
422
+ if (this.hasHelperLineTarget) {
423
+ if (this.helperLineTarget.classList.contains("mdc-text-field-helper-line--error")) {
424
+ this.helperLineTarget.querySelector("p").innerHTML = "";
425
+ }
426
+ this.helperLineTarget.classList.remove("mdc-text-field-helper-line--error");
427
+ }
428
+ }
429
+ }, {
430
+ key: "disconnect",
431
+ value: function disconnect() {
432
+ this.el.destroy();
433
+ this.el = null;
434
+ }
435
+ } ]);
436
+ return _default;
437
+ }(stimulus.Controller);
438
+ _default$16.targets = [ "element", "helperLine" ];
439
+ var _default$17 = function(_Controller) {
440
+ _inherits(_default, _Controller);
441
+ function _default() {
442
+ _classCallCheck(this, _default);
443
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
444
+ }
445
+ _createClass(_default, [ {
446
+ key: "connect",
447
+ value: function connect() {
448
+ var el = new topAppBar.MDCTopAppBar(this.element);
449
+ this.el = el;
450
+ }
451
+ } ]);
452
+ return _default;
453
+ }(stimulus.Controller);
454
+ var _default$18 = function(_Controller) {
455
+ _inherits(_default, _Controller);
456
+ function _default() {
457
+ _classCallCheck(this, _default);
458
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
459
+ }
460
+ _createClass(_default, [ {
461
+ key: "connect",
462
+ value: function connect() {
463
+ var controller = this.application.getControllerForElementAndIdentifier(this.element, "mdc-chip-set");
464
+ var chipSet = controller.el;
465
+ var _this = this;
466
+ chipSet.listen("MDCChip:selection", function(event) {
467
+ _this.handleSelection(event);
468
+ });
469
+ }
470
+ }, {
471
+ key: "handleSelection",
472
+ value: function handleSelection(event) {
473
+ if (event.detail.selected) {
474
+ var value = event.target.attributes.value.value;
475
+ this.inputTarget.value = value;
476
+ }
477
+ }
478
+ } ]);
479
+ return _default;
480
+ }(stimulus.Controller);
481
+ _default$18.targets = [ "input" ];
482
+ var _default$19 = function(_Controller) {
483
+ _inherits(_default, _Controller);
484
+ function _default() {
485
+ _classCallCheck(this, _default);
486
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
487
+ }
488
+ _createClass(_default, [ {
489
+ key: "connect",
490
+ value: function connect() {
491
+ var controller = this.application.getControllerForElementAndIdentifier(this.element, "mdc-chip-set");
492
+ var chipSet = controller.el;
493
+ var _this = this;
494
+ chipSet.listen("MDCChip:selection", function(event) {
495
+ _this.handleSelection(event);
496
+ });
497
+ }
498
+ }, {
499
+ key: "handleSelection",
500
+ value: function handleSelection(event) {
501
+ console.log("target", event.target);
502
+ var inputValue = event.target.attributes.value.value;
503
+ console.log("inputValue", event.target);
504
+ console.log("detail", event.detail);
505
+ var dataTarget = event.target.dataset.railsChipSetFilterTarget;
506
+ console.log("dataTarget", dataTarget);
507
+ var target = this.element.querySelector('[data-target="'.concat(dataTarget, '"]'));
508
+ console.log("target", target);
509
+ if (event.detail.selected) {
510
+ target.value = inputValue;
511
+ } else {
512
+ target.value = 0;
513
+ }
514
+ }
515
+ } ]);
516
+ return _default;
517
+ }(stimulus.Controller);
518
+ function scrollTo(element) {
519
+ var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
520
+ var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1e3;
521
+ var start = element.scrollTop;
522
+ var change = to - start;
523
+ var increment = 20;
524
+ var currentTime = 0;
525
+ var animateScroll = function animateScroll() {
526
+ currentTime += increment;
527
+ var val = Math.easeInOutQuad(currentTime, start, change, duration);
528
+ element.scrollTop = val;
529
+ if (currentTime < duration) {
530
+ setTimeout(animateScroll, increment);
531
+ }
532
+ };
533
+ animateScroll();
534
+ }
535
+ Math.easeInOutQuad = function(t, b, c, d) {
536
+ t /= d / 2;
537
+ if (t < 1) return c / 2 * t * t + b;
538
+ t--;
539
+ return -c / 2 * (t * (t - 2) - 1) + b;
540
+ };
541
+ var _default$20 = function(_Controller) {
542
+ _inherits(_default, _Controller);
543
+ function _default() {
544
+ _classCallCheck(this, _default);
545
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
546
+ }
547
+ _createClass(_default, [ {
548
+ key: "connect",
549
+ value: function connect() {
550
+ var formId = this.element.id;
551
+ this.element.addEventListener("ajax:success", function(e, data, status, xhr) {
552
+ console.log("ajax:success");
553
+ return;
554
+ });
555
+ this.element.addEventListener("ajax:error", function(e, xhr, status, error) {
556
+ var parser = new DOMParser();
557
+ var doc = parser.parseFromString(e.detail[2].responseText, "text/html");
558
+ var form = doc.querySelector("form#".concat(formId));
559
+ var parentNode = e.target.parentNode;
560
+ parentNode.replaceChild(form, e.target);
561
+ var newForm = parentNode.querySelector("form#".concat(formId));
562
+ var elementWithError = newForm.querySelector(".mdc-text-field--error");
563
+ if (elementWithError) {
564
+ var content = document.querySelector("#content");
565
+ scrollTo(content, elementWithError.offsetTop - content.offsetTop, 600);
566
+ }
567
+ e.stopPropagation();
568
+ return;
569
+ });
570
+ this.element.addEventListener("ajax:complete", function(e, xhr, status, error) {
571
+ e.stopPropagation();
572
+ return;
573
+ });
574
+ }
575
+ } ]);
576
+ return _default;
577
+ }(stimulus.Controller);
578
+ exports.sum = sum;
579
+ exports.body_class_toggler_controller = _default;
580
+ exports.counter_controller = _default$1;
581
+ exports.demo_dialog_controller = _default$2;
582
+ exports.mdc_chip_set_controller = _default$3;
583
+ exports.mdc_data_table_controller = _default$4;
584
+ exports.mdc_form_field_controller = _default$5;
585
+ exports.mdc_icon_toggle_controller = _default$6;
586
+ exports.mdc_linear_progress_controller = _default$7;
587
+ exports.mdc_list_controller = _default$8;
588
+ exports.mdc_menu_controller = _default$9;
589
+ exports.mdc_ripple_controller = _default$10;
590
+ exports.mdc_select_controller = _default$11;
591
+ exports.mdc_slider_controller = _default$12;
592
+ exports.mdc_snackbar_controller = _default$13;
593
+ exports.mdc_switch_controller = _default$14;
594
+ exports.mdc_tab_bar_controller = _default$15;
595
+ exports.mdc_text_field_controller = _default$16;
596
+ exports.mdc_top_app_bar_controller = _default$17;
597
+ exports.rails_chip_set_choice_controller = _default$18;
598
+ exports.rails_chip_set_filter_controller = _default$19;
599
+ exports.remote_form_controller = _default$20;
600
+ Object.defineProperty(exports, "__esModule", {
601
+ value: true
602
+ });
603
+ });