arara 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1366b888c0063661615043a8c3b1a51a918947ff13c908a071550e6bc61ed7a
4
- data.tar.gz: c89cdf105dc1356037f5832c0bf177976cc9d7a79f93b384f9a122e1751d2b4e
3
+ metadata.gz: f2c15e0839b48215438173b29262e50fab880fff58ec0e0931e700ec6de6d48b
4
+ data.tar.gz: 0ddb971b69bba46be378703eea178f562d5a04edc5e2e201ecbea5a365128fba
5
5
  SHA512:
6
- metadata.gz: 6e23a98a626edc1531af1bfaf547625d1682ac172ae4da8380a40ba761f7f28a467397e4d5dd582f571ef3526809866616752c1a023d0802d073a87376b67087
7
- data.tar.gz: 1d061d8b3973ef55dfcf3c7c5ca140805d44e2c3c2a5e7c61c3ee5c93acd4dd9610360e17a624cd1dba49f2b454dac7f8f645cebe7d12963b23bcc09c2df5ef0
6
+ metadata.gz: 075bba0b27d7f0b7961a1e8f27240f6a9e51886ca89ee9ac949afbb6a4380d6dc86f73be444034d658017c4589224945fa0924f1075a480529471b9fd0c89cb0
7
+ data.tar.gz: f8e40d01076ddebc4881f8da8a9c09f30aa1a7a336229de9dcf8ca2a54843caff33dae2dcf054fb51fabf6d974accf9418c78dc8685def7f72df85aba7ac2491
data/README.md CHANGED
@@ -23,6 +23,39 @@ var root = document.documentElement;
23
23
  root.style.setProperty('--base-color', "palevioletred")
24
24
  ```
25
25
 
26
+ ## Developing
27
+
28
+ All arara related files are inside `app/javascript/arara`, the folder contains:
29
+
30
+ - controllers : with all the stimulus controllers
31
+ - scss : the basic scss setup
32
+
33
+ ### Demo
34
+
35
+ TL;DR (quick setup)
36
+
37
+ ```bash
38
+ yarn
39
+ cd test/dummy
40
+ yarn
41
+ bundle install
42
+ rails server
43
+ ```
44
+
45
+ On project root run the `yarn` (or `npm`) command to install the dependencies for arara
46
+
47
+ To run the demo, go inside `test/dummy` and run the commands:
48
+
49
+ - bundle install
50
+ - yarn/npm (now is needed to install the demo dependencies)
51
+
52
+ and run the commands on two different terminals:
53
+
54
+ - ./bin/webpack-dev-server
55
+ - rails s
56
+
57
+ Access http://localhost:3000 to see it running
58
+
26
59
  ## NPM Package
27
60
 
28
61
  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
@@ -2,9 +2,6 @@
2
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
3
  })(this, function(exports, stimulus, dialog, chips, dataTable, formField, checkbox, radio, iconButton, linearProgress, ripple, list, menu, select, slider, snackbar, _switch, tabBar, textfield, topAppBar) {
4
4
  "use strict";
5
- var sum = function sum(a, b) {
6
- return a + b;
7
- };
8
5
  function _classCallCheck(instance, Constructor) {
9
6
  if (!(instance instanceof Constructor)) {
10
7
  throw new TypeError("Cannot call a class as a function");
@@ -575,7 +572,6 @@
575
572
  } ]);
576
573
  return _default;
577
574
  }(stimulus.Controller);
578
- exports.sum = sum;
579
575
  exports.body_class_toggler_controller = _default;
580
576
  exports.counter_controller = _default$1;
581
577
  exports.demo_dialog_controller = _default$2;
@@ -3,15 +3,16 @@ module Arara
3
3
  validates :content, presence: true
4
4
 
5
5
  include Arara::BaseComponent
6
-
7
- attr_reader :role, :labelledby, :describedby
8
6
 
9
- def initialize(role: "alertdialog", labelledby:, describedby:, **kw)
7
+ attr_reader :role, :labelledby, :describedby, :surface_class
8
+
9
+ def initialize(role: "alertdialog", labelledby:, describedby:, surface_class: nil, **kw)
10
10
  super(tag: "div", role: role, **kw)
11
11
 
12
12
  @role = role
13
13
  @labelledby = labelledby
14
14
  @describedby = describedby
15
+ @surface_class = surface_class
15
16
  end
16
17
 
17
18
 
@@ -20,8 +21,10 @@ module Arara
20
21
  end
21
22
 
22
23
  def surface_options
23
- opts = {
24
- class: "mdc-dialog__surface",
24
+ html_class = ["mdc-dialog__surface"]
25
+ html_class << surface_class if surface_class
26
+ {
27
+ class: html_class.join(" "),
25
28
  role: role,
26
29
  aria: {
27
30
  modal: "true",
@@ -12,7 +12,9 @@ module Arara
12
12
  end
13
13
 
14
14
  def default_html_class
15
- 'mdc-icon-button'
15
+ klasses = ['mdc-icon-button']
16
+ klasses << ['mdc-icon-button--on'] if pressed
17
+ klasses
16
18
  end
17
19
 
18
20
  def aria_data
@@ -1,12 +1,12 @@
1
1
  module Arara
2
2
  class TextFieldComponent < ActionView::Component::Base
3
3
  include Arara::BaseComponent
4
-
5
- attr_reader :label, :id, :name, :value, :textarea, :full_width, :helper_text, :type
4
+
5
+ attr_reader :label, :id, :name, :value, :textarea, :full_width, :helper_text, :type, :placeholder
6
6
 
7
7
  with_content_areas :leading_icon, :trailing_icon, :max_length
8
8
 
9
- def initialize(variant: "default", label: nil, helper_text: nil, max_length: nil, textarea: false, id:, name: nil, value: nil, full_width: false, has_error: false, type: "text", **kw)
9
+ def initialize(variant: "default", label: nil, helper_text: nil, max_length: nil, textarea: false, id:, name: nil, value: nil, full_width: false, has_error: false, type: "text", placeholder: nil, **kw)
10
10
  super(tag: "div", variant: variant, **kw)
11
11
 
12
12
  @label = label
@@ -20,6 +20,7 @@ module Arara
20
20
  @has_error = has_error
21
21
  @user_variant = "outlined" if textarea
22
22
  @type = type
23
+ @placeholder = placeholder
23
24
  end
24
25
 
25
26
  def has_error?
@@ -48,7 +49,7 @@ module Arara
48
49
  return "textarea" if textarea
49
50
  "input"
50
51
  end
51
-
52
+
52
53
  def html_input_options
53
54
  opts = {
54
55
  class: "mdc-text-field__input",
@@ -64,7 +65,7 @@ module Arara
64
65
  opts.merge!(value: value) if value
65
66
  opts[:data] = opts.has_key?(:data) ? opts[:data] : {}
66
67
  opts[:data][:action] = "focusin->#{data_controller}#handleFocus"
67
- opts.merge!(placeholder: label) if full_width && !is_textarea?
68
+ opts.merge!(placeholder: placeholder) if placeholder
68
69
  # opts.merge!(rows: 4, cols: 40) if textarea
69
70
  opts.merge!(maxlength: max_length) if max_length
70
71
  opts
@@ -1,6 +1,3 @@
1
- export { default as sum } from "./helpers/sum.js"
2
- export * from "./helpers/sum.js"
3
-
4
1
  export { default as body_class_toggler_controller } from "./controllers/body_class_toggler_controller.js"
5
2
  export * from "./controllers/body_class_toggler_controller.js"
6
3
 
@@ -1,3 +1,3 @@
1
1
  module Arara
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Celso Fernandes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-08 00:00:00.000000000 Z
11
+ date: 2020-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -196,7 +196,6 @@ files:
196
196
  - app/javascript/arara/controllers/rails_chip_set_choice_controller.js
197
197
  - app/javascript/arara/controllers/rails_chip_set_filter_controller.js
198
198
  - app/javascript/arara/controllers/remote_form_controller.js
199
- - app/javascript/arara/helpers/sum.js
200
199
  - app/javascript/arara/index.js
201
200
  - app/javascript/arara/scss/_material_design.scss
202
201
  - app/javascript/arara/scss/_tailwind.scss
@@ -231,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
230
  - !ruby/object:Gem::Version
232
231
  version: '0'
233
232
  requirements: []
234
- rubygems_version: 3.0.1
233
+ rubygems_version: 3.0.3
235
234
  signing_key:
236
235
  specification_version: 4
237
236
  summary: A material design theme for Ruby on Rails
@@ -1,5 +0,0 @@
1
- const sum = (a, b) => {
2
- return a + b
3
- }
4
-
5
- export default sum