polaris_view_components 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/app/assets/javascripts/{polaris.js → polaris_view_components.js} +20 -39
- data/app/components/polaris/dropzone/controller.js +1 -1
- data/app/javascript/{polaris → polaris_view_components}/index.js +0 -0
- data/app/javascript/{polaris → polaris_view_components}/resource_item_controller.js +1 -1
- data/app/javascript/{polaris → polaris_view_components}/select_controller.js +1 -1
- data/app/javascript/{polaris → polaris_view_components}/text_field_controller.js +1 -1
- data/lib/generators/polaris_view_components/install_generator.rb +1 -1
- data/lib/generators/polaris_view_components/templates/stimulus_index.js +5 -6
- data/lib/polaris/view_components/engine.rb +3 -1
- data/lib/polaris/view_components/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eda78e6803a1783585a9912d600193f29bba781d019204be62bd1cab484e97a
|
4
|
+
data.tar.gz: 5b9ba5de1405b1eb089991c7a2db6117d00bddc7787b6484515e35ecddd4b55e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c433aa42655eacf3e55eccb3709d25356e6219a61f9f5880d529dd2c51f41ca8fe019a1f699675f0832efabdae104e2a0e26fb4a0100b1c8e0d0005b7917f0b5
|
7
|
+
data.tar.gz: 44ad24c6ff886a6bb9cb11d5fdce9936218f66337924c6474dcd78b4e68357fa08871492f38affb31dac7f19cce81ea4d7151179bba38ef656910ef49b2e0a72
|
data/README.md
CHANGED
@@ -46,6 +46,16 @@ Define Polaris style on your `<body>` tag:
|
|
46
46
|
<body style="<%= polaris_body_styles %>">
|
47
47
|
```
|
48
48
|
|
49
|
+
### Importmaps
|
50
|
+
|
51
|
+
Add to `config/importmap.rb`:
|
52
|
+
|
53
|
+
```rb
|
54
|
+
pin "polaris-view-components", to: "polaris_view_components.js"
|
55
|
+
```
|
56
|
+
|
57
|
+
### NPM
|
58
|
+
|
49
59
|
Install NPM package:
|
50
60
|
```bash
|
51
61
|
yarn add polaris-view-components
|
@@ -55,7 +65,7 @@ Add to `app/javascript/controllers/index.js`:
|
|
55
65
|
```javascript
|
56
66
|
// Polaris ViewComponents
|
57
67
|
import { registerPolarisControllers } from "polaris-view-components"
|
58
|
-
registerPolarisControllers(
|
68
|
+
registerPolarisControllers(Stimulus)
|
59
69
|
```
|
60
70
|
|
61
71
|
## Dependencies
|
@@ -1,20 +1,7 @@
|
|
1
|
-
import { Controller } from "stimulus";
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Object.defineProperty(obj, key, {
|
6
|
-
value: value,
|
7
|
-
enumerable: true,
|
8
|
-
configurable: true,
|
9
|
-
writable: true
|
10
|
-
});
|
11
|
-
} else {
|
12
|
-
obj[key] = value;
|
13
|
-
}
|
14
|
-
return obj;
|
15
|
-
}
|
16
|
-
|
17
|
-
class _class$2 extends Controller {
|
3
|
+
class ResourceItem extends Controller {
|
4
|
+
static targets=[ "link" ];
|
18
5
|
open(event) {
|
19
6
|
if (this.hasLinkTarget && this.targetNotClickable(event.target)) {
|
20
7
|
this.linkTarget.click();
|
@@ -25,9 +12,8 @@ class _class$2 extends Controller {
|
|
25
12
|
}
|
26
13
|
}
|
27
14
|
|
28
|
-
|
29
|
-
|
30
|
-
class _class$1 extends Controller {
|
15
|
+
class Select extends Controller {
|
16
|
+
static targets=[ "selectedOption" ];
|
31
17
|
update(event) {
|
32
18
|
const select = event.currentTarget;
|
33
19
|
const option = select.options[select.selectedIndex];
|
@@ -35,9 +21,17 @@ class _class$1 extends Controller {
|
|
35
21
|
}
|
36
22
|
}
|
37
23
|
|
38
|
-
|
39
|
-
|
40
|
-
|
24
|
+
class TextField extends Controller {
|
25
|
+
static targets=[ "input", "clearButton", "characterCount" ];
|
26
|
+
static classes=[ "hasValue", "clearButtonHidden" ];
|
27
|
+
static values={
|
28
|
+
value: String,
|
29
|
+
labelTemplate: String,
|
30
|
+
textTemplate: String,
|
31
|
+
step: Number,
|
32
|
+
min: Number,
|
33
|
+
max: Number
|
34
|
+
};
|
41
35
|
connect() {
|
42
36
|
this.syncValue();
|
43
37
|
this.stepValue = this.inputTarget.getAttribute("step");
|
@@ -104,23 +98,10 @@ class _class extends Controller {
|
|
104
98
|
}
|
105
99
|
}
|
106
100
|
|
107
|
-
_defineProperty(_class, "targets", [ "input", "clearButton", "characterCount" ]);
|
108
|
-
|
109
|
-
_defineProperty(_class, "classes", [ "hasValue", "clearButtonHidden" ]);
|
110
|
-
|
111
|
-
_defineProperty(_class, "values", {
|
112
|
-
value: String,
|
113
|
-
labelTemplate: String,
|
114
|
-
textTemplate: String,
|
115
|
-
step: Number,
|
116
|
-
min: Number,
|
117
|
-
max: Number
|
118
|
-
});
|
119
|
-
|
120
101
|
function registerPolarisControllers(application) {
|
121
|
-
application.register("polaris-resource-item",
|
122
|
-
application.register("polaris-select",
|
123
|
-
application.register("polaris-text-field",
|
102
|
+
application.register("polaris-resource-item", ResourceItem);
|
103
|
+
application.register("polaris-select", Select);
|
104
|
+
application.register("polaris-text-field", TextField);
|
124
105
|
}
|
125
106
|
|
126
|
-
export {
|
107
|
+
export { ResourceItem, Select, TextField, registerPolarisControllers };
|
File without changes
|
@@ -24,7 +24,7 @@ module PolarisViewComponents
|
|
24
24
|
end
|
25
25
|
|
26
26
|
append_to_file file_path do
|
27
|
-
"import { registerPolarisControllers } from
|
27
|
+
"import { registerPolarisControllers } from \"polaris-view-components\"\nregisterPolarisControllers(Stimulus)"
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { Application } from
|
2
|
-
import { definitionsFromContext } from
|
3
|
-
|
4
|
-
const application = Application.start(document.documentElement)
|
5
|
-
const context = require.context('.', true, /_controller\.js$/)
|
6
|
-
application.load(definitionsFromContext(context))
|
1
|
+
import { Application } from "@hotwired/stimulus"
|
2
|
+
import { definitionsFromContext } from "@hotwired/stimulus-webpack-helpers"
|
7
3
|
|
4
|
+
window.Stimulus = Application.start()
|
5
|
+
const context = require.context("./", true, /\.js$/)
|
6
|
+
Stimulus.load(definitionsFromContext(context))
|
@@ -13,7 +13,9 @@ module Polaris
|
|
13
13
|
|
14
14
|
initializer "polaris_view_components.assets" do |app|
|
15
15
|
if app.config.respond_to?(:assets)
|
16
|
-
app.config.assets.precompile += %w[
|
16
|
+
app.config.assets.precompile += %w[
|
17
|
+
polaris_view_components.js polaris_view_components.css
|
18
|
+
]
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polaris_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Gamble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-10-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: 5.0.0
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 8.0.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: 5.0.0
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 8.0.0
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: view_component
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -447,7 +447,7 @@ files:
|
|
447
447
|
- app/assets/icons/polaris/WearableMajor.svg
|
448
448
|
- app/assets/icons/polaris/WholesaleMajor.svg
|
449
449
|
- app/assets/icons/polaris/WifiMajor.svg
|
450
|
-
- app/assets/javascripts/
|
450
|
+
- app/assets/javascripts/polaris_view_components.js
|
451
451
|
- app/assets/stylesheets/polaris_view_components.css
|
452
452
|
- app/components/polaris/action.rb
|
453
453
|
- app/components/polaris/application_component.rb
|
@@ -563,10 +563,10 @@ files:
|
|
563
563
|
- app/helpers/polaris/option_helper.rb
|
564
564
|
- app/helpers/polaris/url_helper.rb
|
565
565
|
- app/helpers/polaris/view_helper.rb
|
566
|
-
- app/javascript/
|
567
|
-
- app/javascript/
|
568
|
-
- app/javascript/
|
569
|
-
- app/javascript/
|
566
|
+
- app/javascript/polaris_view_components/index.js
|
567
|
+
- app/javascript/polaris_view_components/resource_item_controller.js
|
568
|
+
- app/javascript/polaris_view_components/select_controller.js
|
569
|
+
- app/javascript/polaris_view_components/text_field_controller.js
|
570
570
|
- app/validators/type_validator.rb
|
571
571
|
- lib/generators/polaris_view_components/USAGE
|
572
572
|
- lib/generators/polaris_view_components/install_generator.rb
|