polaris_view_components 0.9.1 → 0.11.0
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 +4 -4
- data/README.md +20 -65
- data/app/assets/javascripts/polaris_view_components/dropzone_controller.js +24 -5
- data/app/assets/javascripts/polaris_view_components/text_field_controller.js +5 -0
- data/app/assets/javascripts/polaris_view_components.js +28 -7
- data/app/assets/stylesheets/polaris_view_components/custom.css +60 -8
- data/app/assets/stylesheets/polaris_view_components.css +48 -9
- data/app/components/polaris/action_list/item_component.rb +2 -1
- data/app/components/polaris/button_component.html.erb +2 -2
- data/app/components/polaris/data_table/column_component.rb +2 -1
- data/app/components/polaris/data_table_component.html.erb +1 -0
- data/app/components/polaris/dropzone_component.html.erb +13 -8
- data/app/components/polaris/empty_search_results_component.html.erb +12 -0
- data/app/components/polaris/empty_search_results_component.rb +19 -0
- data/app/components/polaris/filters_component.rb +3 -1
- data/app/components/polaris/headless_button.html.erb +2 -2
- data/app/components/polaris/headless_button.rb +3 -1
- data/app/components/polaris/index_table/column_component.rb +2 -1
- data/app/components/polaris/index_table_component.html.erb +3 -5
- data/app/components/polaris/index_table_component.rb +10 -0
- data/app/components/polaris/page_component.html.erb +81 -10
- data/app/components/polaris/page_component.rb +91 -29
- data/app/components/polaris/resource_item_component.rb +4 -1
- data/app/components/polaris/resource_list_component.html.erb +11 -0
- data/app/components/polaris/resource_list_component.rb +21 -0
- data/app/components/polaris/text_field_component.html.erb +1 -1
- data/app/components/polaris/text_field_component.rb +1 -1
- data/app/components/polaris/visually_hidden_component.rb +0 -3
- data/app/helpers/polaris/url_helper.rb +37 -0
- data/app/helpers/polaris/view_helper.rb +1 -0
- data/lib/install/install.rb +57 -0
- data/lib/polaris/view_components/version.rb +1 -1
- data/lib/tasks/polaris_view_components_tasks.rake +6 -0
- metadata +91 -7
- data/lib/generators/polaris_view_components/USAGE +0 -5
- data/lib/generators/polaris_view_components/install_generator.rb +0 -35
- data/lib/generators/polaris_view_components/templates/README +0 -14
- data/lib/generators/polaris_view_components/templates/stimulus_index.js +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bde9c78425359cff500d5e9d709750ef0351398696e5685cbb8faada617a9a45
|
4
|
+
data.tar.gz: 830d75b017692040ca7cc695712e6204fd4ebab9593c09f5777a163ee41a3c57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19ec9d9273dd86977b5dd24ccd592b20656715a64a1287c6a653b47c130c226cc83c0bb1fc3b9463d3304a18cb52134a741081a47339d80a48bd472885fe17c5
|
7
|
+
data.tar.gz: 295b5b130d8b325978769d37d948446144d36ae7ba0ca72a8264e25dc9ae2d90f58cb6290415c9e13fc48a6bb55a2b268dfb3f957ab26efc88a36ab0c86fe061
|
data/README.md
CHANGED
@@ -20,76 +20,23 @@ Render Polaris ViewComponents:
|
|
20
20
|
<% end %>
|
21
21
|
```
|
22
22
|
|
23
|
-
##
|
24
|
-
|
25
|
-
In `Gemfile`, add:
|
26
|
-
|
27
|
-
```ruby
|
28
|
-
gem 'polaris_view_components'
|
29
|
-
```
|
30
|
-
|
31
|
-
Run install generator:
|
32
|
-
```bash
|
33
|
-
rails generate polaris_view_components:install
|
34
|
-
```
|
35
|
-
|
36
|
-
Setup Polaris styles in your layouts `<head>` tag:
|
37
|
-
|
38
|
-
```erb
|
39
|
-
<%= stylesheet_link_tag 'polaris_view_components' %>
|
40
|
-
```
|
41
|
-
|
42
|
-
Define Polaris style on your `<body>` tag:
|
43
|
-
|
44
|
-
```erb
|
45
|
-
<body style="<%= polaris_body_styles %>">
|
46
|
-
```
|
47
|
-
|
48
|
-
### Importmaps
|
49
|
-
|
50
|
-
Install dependencies:
|
51
|
-
```
|
52
|
-
bin/importmap pin @rails/request.js --download
|
53
|
-
```
|
54
|
-
|
55
|
-
If you use sprockets make sure the vendor folder is loaded in `app/assets/config/manifest.js`:
|
56
|
-
```js
|
57
|
-
//= link_tree ../../../vendor/assets/javascripts .js
|
58
|
-
```
|
23
|
+
## Dependencies
|
59
24
|
|
60
|
-
|
25
|
+
- [Stimulus](https://stimulus.hotwired.dev/)
|
61
26
|
|
62
|
-
|
63
|
-
pin "polaris-view-components", to: "polaris_view_components.js"
|
64
|
-
```
|
27
|
+
## Installation
|
65
28
|
|
66
|
-
Add to `
|
67
|
-
```javascript
|
68
|
-
// ...
|
29
|
+
Add to `Gemfile`:
|
69
30
|
|
70
|
-
|
71
|
-
|
31
|
+
```ruby
|
32
|
+
gem "polaris_view_components"
|
72
33
|
```
|
73
34
|
|
74
|
-
|
75
|
-
|
76
|
-
Install NPM package:
|
35
|
+
Run installer:
|
77
36
|
```bash
|
78
|
-
|
37
|
+
bin/rails polaris_view_components:install
|
79
38
|
```
|
80
39
|
|
81
|
-
Add to `app/javascript/controllers/index.js`:
|
82
|
-
```javascript
|
83
|
-
// ...
|
84
|
-
|
85
|
-
import { registerPolarisControllers } from "polaris-view-components"
|
86
|
-
registerPolarisControllers(Stimulus)
|
87
|
-
```
|
88
|
-
|
89
|
-
## Dependencies
|
90
|
-
|
91
|
-
In addition to the dependencies declared in the `gemspec`, Polaris ViewComponents assumes the presence of Polaris CSS.
|
92
|
-
|
93
40
|
## Development
|
94
41
|
|
95
42
|
To get started:
|
@@ -99,16 +46,24 @@ To get started:
|
|
99
46
|
|
100
47
|
It will open demo app with component previews on `localhost:4000`. You can change components and they will be updated on page reload. Component previews located in `demo/test/components/previews`.
|
101
48
|
|
102
|
-
|
49
|
+
## Releases
|
50
|
+
|
51
|
+
The library follows [semantic versioning](https://semver.org/). To draft a new release you need to run `script/release` with a new version number:
|
52
|
+
|
103
53
|
```bash
|
104
|
-
script/release
|
54
|
+
script/release VERSION
|
105
55
|
```
|
106
56
|
|
107
|
-
|
57
|
+
Where the VERSION is the version number you want to release. This script will update the version in the gem and push it to GitHub and Rubygems automatically.
|
58
|
+
|
59
|
+
To release a new version of npm package update the package.json file with the new version number and run:
|
60
|
+
|
108
61
|
```bash
|
109
|
-
|
62
|
+
npm run release
|
110
63
|
```
|
111
64
|
|
65
|
+
After that make sure to commit changes in package.json.
|
66
|
+
|
112
67
|
## License
|
113
68
|
|
114
69
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -34,11 +34,12 @@ export default class extends Controller {
|
|
34
34
|
}
|
35
35
|
|
36
36
|
files = []
|
37
|
-
acceptedFiles = []
|
38
37
|
rejectedFiles = []
|
39
38
|
_dragging = false
|
40
39
|
dragTargets = []
|
41
40
|
previewRendered = false
|
41
|
+
|
42
|
+
_acceptedFiles = []
|
42
43
|
_size = 'large'
|
43
44
|
|
44
45
|
connect () {
|
@@ -167,7 +168,8 @@ export default class extends Controller {
|
|
167
168
|
|
168
169
|
if (this.acceptedFiles.length === 0) return
|
169
170
|
|
170
|
-
this.
|
171
|
+
if (this.hasLoaderTarget)
|
172
|
+
this.loaderTarget.classList.remove("Polaris--hidden")
|
171
173
|
}
|
172
174
|
|
173
175
|
onDirectUploadInitialize = (event) => {
|
@@ -179,11 +181,14 @@ export default class extends Controller {
|
|
179
181
|
|
180
182
|
if (this.sizeValue == 'small') {
|
181
183
|
this.clearFiles()
|
182
|
-
this.
|
184
|
+
if (this.hasLoaderTarget)
|
185
|
+
this.loaderTarget.classList.remove("Polaris--hidden")
|
183
186
|
} else {
|
184
187
|
const content = dropzone.querySelector(`[data-file-name="${file.name}"]`)
|
185
|
-
|
186
|
-
|
188
|
+
if (content) {
|
189
|
+
const progressBar = content.parentElement.querySelector('[data-target="progress-bar"]')
|
190
|
+
progressBar.id = `direct-upload-${id}`
|
191
|
+
}
|
187
192
|
}
|
188
193
|
}
|
189
194
|
|
@@ -448,6 +453,20 @@ export default class extends Controller {
|
|
448
453
|
|
449
454
|
this.element.classList.add(this.getSizeClass(val))
|
450
455
|
}
|
456
|
+
|
457
|
+
get acceptedFiles () {
|
458
|
+
return this._acceptedFiles
|
459
|
+
}
|
460
|
+
|
461
|
+
set acceptedFiles (val) {
|
462
|
+
this._acceptedFiles = val
|
463
|
+
|
464
|
+
const list = new DataTransfer()
|
465
|
+
|
466
|
+
val.forEach(file => list.items.add(file))
|
467
|
+
|
468
|
+
this.inputTarget.files = list.files
|
469
|
+
}
|
451
470
|
}
|
452
471
|
|
453
472
|
export function fileAccepted (file, accept) {
|
@@ -361,11 +361,11 @@ class Dropzone extends Controller {
|
|
361
361
|
size: String
|
362
362
|
};
|
363
363
|
files=[];
|
364
|
-
acceptedFiles=[];
|
365
364
|
rejectedFiles=[];
|
366
365
|
_dragging=false;
|
367
366
|
dragTargets=[];
|
368
367
|
previewRendered=false;
|
368
|
+
_acceptedFiles=[];
|
369
369
|
_size="large";
|
370
370
|
connect() {
|
371
371
|
document.body.addEventListener("click", this.onExternalTriggerClick);
|
@@ -460,7 +460,7 @@ class Dropzone extends Controller {
|
|
460
460
|
this.enable();
|
461
461
|
this.clearFiles();
|
462
462
|
if (this.acceptedFiles.length === 0) return;
|
463
|
-
this.loaderTarget.classList.remove("Polaris--hidden");
|
463
|
+
if (this.hasLoaderTarget) this.loaderTarget.classList.remove("Polaris--hidden");
|
464
464
|
};
|
465
465
|
onDirectUploadInitialize=event => {
|
466
466
|
const {target: target, detail: detail} = event;
|
@@ -470,11 +470,13 @@ class Dropzone extends Controller {
|
|
470
470
|
if (this.acceptedFiles.length === 0) return;
|
471
471
|
if (this.sizeValue == "small") {
|
472
472
|
this.clearFiles();
|
473
|
-
this.loaderTarget.classList.remove("Polaris--hidden");
|
473
|
+
if (this.hasLoaderTarget) this.loaderTarget.classList.remove("Polaris--hidden");
|
474
474
|
} else {
|
475
475
|
const content = dropzone.querySelector(`[data-file-name="${file.name}"]`);
|
476
|
-
|
477
|
-
|
476
|
+
if (content) {
|
477
|
+
const progressBar = content.parentElement.querySelector('[data-target="progress-bar"]');
|
478
|
+
progressBar.id = `direct-upload-${id}`;
|
479
|
+
}
|
478
480
|
}
|
479
481
|
};
|
480
482
|
onDirectUploadStart=event => {
|
@@ -545,6 +547,7 @@ class Dropzone extends Controller {
|
|
545
547
|
this.toggleFileUpload(false);
|
546
548
|
this.toggleErrorOverlay(true);
|
547
549
|
const dropRejectedEvent = new CustomEvent("polaris-dropzone:drop-rejected", {
|
550
|
+
bubbles: true,
|
548
551
|
detail: {
|
549
552
|
rejectedFiles: this.rejectedFiles
|
550
553
|
}
|
@@ -557,6 +560,7 @@ class Dropzone extends Controller {
|
|
557
560
|
}
|
558
561
|
this.toggleErrorOverlay(false);
|
559
562
|
const dropAcceptedEvent = new CustomEvent("polaris-dropzone:drop-accepted", {
|
563
|
+
bubbles: true,
|
560
564
|
detail: {
|
561
565
|
acceptedFiles: this.acceptedFiles
|
562
566
|
}
|
@@ -564,6 +568,7 @@ class Dropzone extends Controller {
|
|
564
568
|
this.element.dispatchEvent(dropAcceptedEvent);
|
565
569
|
}
|
566
570
|
const dropEvent = new CustomEvent("polaris-dropzone:drop", {
|
571
|
+
bubbles: true,
|
567
572
|
detail: {
|
568
573
|
files: this.files,
|
569
574
|
acceptedFiles: this.acceptedFiles,
|
@@ -681,6 +686,15 @@ class Dropzone extends Controller {
|
|
681
686
|
sizeClassesToRemove.forEach((className => this.element.classList.remove(className)));
|
682
687
|
this.element.classList.add(this.getSizeClass(val));
|
683
688
|
}
|
689
|
+
get acceptedFiles() {
|
690
|
+
return this._acceptedFiles;
|
691
|
+
}
|
692
|
+
set acceptedFiles(val) {
|
693
|
+
this._acceptedFiles = val;
|
694
|
+
const list = new DataTransfer;
|
695
|
+
val.forEach((file => list.items.add(file)));
|
696
|
+
this.inputTarget.files = list.files;
|
697
|
+
}
|
684
698
|
}
|
685
699
|
|
686
700
|
function fileAccepted(file, accept) {
|
@@ -1101,6 +1115,9 @@ function getContainingBlock(element) {
|
|
1101
1115
|
}
|
1102
1116
|
}
|
1103
1117
|
var currentNode = getParentNode(element);
|
1118
|
+
if (isShadowRoot(currentNode)) {
|
1119
|
+
currentNode = currentNode.host;
|
1120
|
+
}
|
1104
1121
|
while (isHTMLElement(currentNode) && [ "html", "body" ].indexOf(getNodeName(currentNode)) < 0) {
|
1105
1122
|
var css = getComputedStyle$1(currentNode);
|
1106
1123
|
if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || [ "transform", "perspective" ].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
|
@@ -1275,13 +1292,13 @@ function mapToStyles(_ref2) {
|
|
1275
1292
|
offsetParent = offsetParent;
|
1276
1293
|
if (placement === top || (placement === left || placement === right) && variation === end) {
|
1277
1294
|
sideY = bottom;
|
1278
|
-
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
|
1295
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
|
1279
1296
|
y -= offsetY - popperRect.height;
|
1280
1297
|
y *= gpuAcceleration ? 1 : -1;
|
1281
1298
|
}
|
1282
1299
|
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
1283
1300
|
sideX = right;
|
1284
|
-
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
|
1301
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
|
1285
1302
|
x -= offsetX - popperRect.width;
|
1286
1303
|
x *= gpuAcceleration ? 1 : -1;
|
1287
1304
|
}
|
@@ -2399,7 +2416,11 @@ class TextField extends Controller {
|
|
2399
2416
|
this.valueValue = this.inputTarget.value;
|
2400
2417
|
}
|
2401
2418
|
clear() {
|
2419
|
+
const oldValue = this.value;
|
2402
2420
|
this.value = null;
|
2421
|
+
if (this.value != oldValue) {
|
2422
|
+
this.inputTarget.dispatchEvent(new Event("change"));
|
2423
|
+
}
|
2403
2424
|
}
|
2404
2425
|
increase() {
|
2405
2426
|
this.changeNumber(1);
|
@@ -36,15 +36,16 @@ a.Polaris-Tag__Button {
|
|
36
36
|
font-size: 1.25rem;
|
37
37
|
}
|
38
38
|
|
39
|
-
/* Remove
|
40
|
-
.Polaris-Button
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
/* Remove focus styles for non-keyboard focus from buttons and links */
|
40
|
+
.Polaris-Button, .Polaris-Breadcrumbs__Breadcrumb {
|
41
|
+
&:focus:not(:focus-visible)::after {
|
42
|
+
box-shadow: none !important;
|
43
|
+
}
|
44
44
|
}
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
.Polaris-Tabs__Tab {
|
46
|
+
&:focus:not(:focus-visible) > .Polaris-Tabs__Title::after {
|
47
|
+
box-shadow: none !important;
|
48
|
+
}
|
48
49
|
}
|
49
50
|
|
50
51
|
/* ResourceItem */
|
@@ -116,6 +117,15 @@ a.Polaris-Tag__Button {
|
|
116
117
|
justify-content: center;
|
117
118
|
}
|
118
119
|
|
120
|
+
&--sizeMedium {
|
121
|
+
justify-content: center;
|
122
|
+
text-align: center;
|
123
|
+
|
124
|
+
.Polaris-Stack.Polaris-Stack--alignmentCenter {
|
125
|
+
justify-content: center;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
119
129
|
&--sizeSmall {
|
120
130
|
padding: 0;
|
121
131
|
justify-content: center;
|
@@ -143,3 +153,45 @@ a.Polaris-Tag__Button {
|
|
143
153
|
}
|
144
154
|
}
|
145
155
|
}
|
156
|
+
|
157
|
+
/* ActionMenu */
|
158
|
+
.Polaris-ActionMenu {
|
159
|
+
&--mobile {
|
160
|
+
@media (min-width: 768px){
|
161
|
+
display: none;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
&--desktop {
|
166
|
+
display: none;
|
167
|
+
|
168
|
+
@media (min-width: 768px){
|
169
|
+
display: block;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
/* Page Pagination */
|
175
|
+
@media (max-width: 768px){
|
176
|
+
.Polaris-Page-Header__PaginationWrapper {
|
177
|
+
display: none;
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
/* EmptySearchResults */
|
182
|
+
.Polaris-EmptySearchResults {
|
183
|
+
padding: 84px 0;
|
184
|
+
|
185
|
+
&__Content {
|
186
|
+
display: flex;
|
187
|
+
flex-direction: column;
|
188
|
+
align-items: center;
|
189
|
+
text-align: center;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
/* ActionList */
|
194
|
+
|
195
|
+
.Polaris-ActionList__Item {
|
196
|
+
border: none !important;
|
197
|
+
}
|
@@ -2268,15 +2268,13 @@ a.Polaris-Tag__Button {
|
|
2268
2268
|
.Polaris-TextStyle--sizeSmall {
|
2269
2269
|
font-size: 1.25rem;
|
2270
2270
|
}
|
2271
|
-
/* Remove
|
2272
|
-
.Polaris-Button::after,
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
box-shadow: none !important;
|
2279
|
-
}
|
2271
|
+
/* Remove focus styles for non-keyboard focus from buttons and links */
|
2272
|
+
.Polaris-Button:focus:not(:focus-visible)::after, .Polaris-Breadcrumbs__Breadcrumb:focus:not(:focus-visible)::after {
|
2273
|
+
box-shadow: none !important;
|
2274
|
+
}
|
2275
|
+
.Polaris-Tabs__Tab:focus:not(:focus-visible) > .Polaris-Tabs__Title::after {
|
2276
|
+
box-shadow: none !important;
|
2277
|
+
}
|
2280
2278
|
/* ResourceItem */
|
2281
2279
|
.Polaris-ResourceItem__Owned--offset {
|
2282
2280
|
padding-left: 2rem;
|
@@ -2325,6 +2323,13 @@ a.Polaris-Tag__Button {
|
|
2325
2323
|
text-align: center;
|
2326
2324
|
justify-content: center;
|
2327
2325
|
}
|
2326
|
+
.Polaris-DropZone__Preview--sizeMedium {
|
2327
|
+
justify-content: center;
|
2328
|
+
text-align: center;
|
2329
|
+
}
|
2330
|
+
.Polaris-DropZone__Preview--sizeMedium .Polaris-Stack.Polaris-Stack--alignmentCenter {
|
2331
|
+
justify-content: center;
|
2332
|
+
}
|
2328
2333
|
.Polaris-DropZone__Preview--sizeSmall {
|
2329
2334
|
padding: 0;
|
2330
2335
|
justify-content: center;
|
@@ -2346,3 +2351,37 @@ a.Polaris-Tag__Button {
|
|
2346
2351
|
.Polaris-DropZone__Loader .Polaris-Spinner--sizeSmall {
|
2347
2352
|
height: 20px;
|
2348
2353
|
}
|
2354
|
+
/* ActionMenu */
|
2355
|
+
@media (min-width: 768px){
|
2356
|
+
.Polaris-ActionMenu--mobile {
|
2357
|
+
display: none
|
2358
|
+
}
|
2359
|
+
}
|
2360
|
+
.Polaris-ActionMenu--desktop {
|
2361
|
+
display: none;
|
2362
|
+
}
|
2363
|
+
@media (min-width: 768px){
|
2364
|
+
.Polaris-ActionMenu--desktop {
|
2365
|
+
display: block
|
2366
|
+
}
|
2367
|
+
}
|
2368
|
+
/* Page Pagination */
|
2369
|
+
@media (max-width: 768px){
|
2370
|
+
.Polaris-Page-Header__PaginationWrapper {
|
2371
|
+
display: none;
|
2372
|
+
}
|
2373
|
+
}
|
2374
|
+
/* EmptySearchResults */
|
2375
|
+
.Polaris-EmptySearchResults {
|
2376
|
+
padding: 84px 0;
|
2377
|
+
}
|
2378
|
+
.Polaris-EmptySearchResults__Content {
|
2379
|
+
display: flex;
|
2380
|
+
flex-direction: column;
|
2381
|
+
align-items: center;
|
2382
|
+
text-align: center;
|
2383
|
+
}
|
2384
|
+
/* ActionList */
|
2385
|
+
.Polaris-ActionList__Item {
|
2386
|
+
border: none !important;
|
2387
|
+
}
|
@@ -5,6 +5,7 @@ class Polaris::ActionList::ItemComponent < Polaris::Component
|
|
5
5
|
def initialize(
|
6
6
|
url: nil,
|
7
7
|
icon: nil,
|
8
|
+
icon_name: nil,
|
8
9
|
help_text: nil,
|
9
10
|
active: false,
|
10
11
|
destructive: false,
|
@@ -12,7 +13,7 @@ class Polaris::ActionList::ItemComponent < Polaris::Component
|
|
12
13
|
**system_arguments
|
13
14
|
)
|
14
15
|
@url = url
|
15
|
-
@icon = icon
|
16
|
+
@icon = icon || icon_name
|
16
17
|
@help_text = help_text
|
17
18
|
@active = active
|
18
19
|
@destructive = destructive
|
@@ -2,7 +2,7 @@ class Polaris::DataTable::ColumnComponent < Polaris::Component
|
|
2
2
|
SORT_DEFAULT = false
|
3
3
|
SORT_OPTIONS = [false, :asc, :desc]
|
4
4
|
|
5
|
-
attr_reader :title, :numeric, :total, :sorted, :sort_url
|
5
|
+
attr_reader :title, :numeric, :total, :sorted, :sort_url, :system_arguments
|
6
6
|
|
7
7
|
def initialize(title, numeric: false, total: nil, sorted: SORT_DEFAULT, sort_url: nil, **system_arguments, &block)
|
8
8
|
@title = title
|
@@ -11,6 +11,7 @@ class Polaris::DataTable::ColumnComponent < Polaris::Component
|
|
11
11
|
@sorted = fetch_or_fallback(SORT_OPTIONS, sorted, SORT_DEFAULT)
|
12
12
|
@sort_url = sort_url
|
13
13
|
@block = block
|
14
|
+
@system_arguments = system_arguments
|
14
15
|
end
|
15
16
|
|
16
17
|
def call(row)
|
@@ -4,10 +4,12 @@
|
|
4
4
|
class="Polaris-DropZone__Overlay Polaris-VisuallyHidden"
|
5
5
|
data-polaris-dropzone-target="overlay"
|
6
6
|
>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<%=
|
7
|
+
<% unless @size == :small %>
|
8
|
+
<%= render Polaris::StackComponent.new(vertical: true, spacing: :tight) do |stack| %>
|
9
|
+
<% stack.item do %>
|
10
|
+
<%= render Polaris::DisplayTextComponent.new(size: :small) do %>
|
11
|
+
<%= @overlay_text %>
|
12
|
+
<% end %>
|
11
13
|
<% end %>
|
12
14
|
<% end %>
|
13
15
|
<% end %>
|
@@ -67,9 +69,11 @@
|
|
67
69
|
<% end %>
|
68
70
|
<% end %>
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
|
72
|
+
<% if @preview %>
|
73
|
+
<div class="Polaris-DropZone__Loader Polaris--hidden" data-polaris-dropzone-target="loader">
|
74
|
+
<%= polaris_spinner(size: (@size == :small) ? :small : :large) %>
|
75
|
+
</div>
|
76
|
+
<% end %>
|
73
77
|
</div>
|
74
78
|
|
75
79
|
<%= render Polaris::VisuallyHiddenComponent.new do %>
|
@@ -86,7 +90,8 @@
|
|
86
90
|
class: [
|
87
91
|
"Polaris-DropZone__Preview",
|
88
92
|
"Polaris-DropZone__Preview--singleFile": !@multiple,
|
89
|
-
"Polaris-DropZone__Preview--
|
93
|
+
"Polaris-DropZone__Preview--sizeMedium": @size == :medium,
|
94
|
+
"Polaris-DropZone__Preview--sizeSmall": @size == :small,
|
90
95
|
]
|
91
96
|
) do %>
|
92
97
|
<% if @size.in?(%i[small]) %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render Polaris::BaseComponent.new(**system_arguments) do %>
|
2
|
+
<div class="Polaris-EmptySearchResults__Content">
|
3
|
+
<%= polaris_text_container do %>
|
4
|
+
<%= polaris_display_text(size: :small) do %>
|
5
|
+
<%= @title %>
|
6
|
+
<% end %>
|
7
|
+
<div>
|
8
|
+
<%= polaris_text_subdued { @description } %>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Polaris
|
2
|
+
class EmptySearchResultsComponent < Polaris::Component
|
3
|
+
def initialize(title:, description:, **system_arguments)
|
4
|
+
@title = title
|
5
|
+
@description = description
|
6
|
+
@system_arguments = system_arguments
|
7
|
+
end
|
8
|
+
|
9
|
+
def system_arguments
|
10
|
+
@system_arguments.tap do |args|
|
11
|
+
args[:tag] = "div"
|
12
|
+
args[:classes] = class_names(
|
13
|
+
args[:classes],
|
14
|
+
"Polaris-EmptySearchResults"
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -42,6 +42,7 @@ module Polaris
|
|
42
42
|
remove_underline: false,
|
43
43
|
size: SIZE_DEFAULT,
|
44
44
|
text_align: TEXT_ALIGN_DEFAULT,
|
45
|
+
icon_name: nil,
|
45
46
|
**system_arguments
|
46
47
|
)
|
47
48
|
@tag = url.present? ? "a" : "button"
|
@@ -52,6 +53,7 @@ module Polaris
|
|
52
53
|
@loading = loading
|
53
54
|
@disclosure = fetch_or_fallback(DISCLOSURE_OPTIONS, disclosure, DISCLOSURE_DEFAULT)
|
54
55
|
@disclosure = :down if @disclosure === true
|
56
|
+
@icon_name = icon_name
|
55
57
|
|
56
58
|
@system_arguments = system_arguments
|
57
59
|
@system_arguments[:type] = submit ? "submit" : "button"
|
@@ -92,7 +94,7 @@ module Polaris
|
|
92
94
|
def system_arguments
|
93
95
|
@system_arguments[:classes] = class_names(
|
94
96
|
@system_arguments[:classes],
|
95
|
-
"Polaris-Button--iconOnly": icon.present? && content.blank?
|
97
|
+
"Polaris-Button--iconOnly": (icon.present? || @icon_name.present?) && content.blank?
|
96
98
|
)
|
97
99
|
@system_arguments
|
98
100
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
class Polaris::IndexTable::ColumnComponent < Polaris::Component
|
2
|
-
attr_reader :title, :flush
|
2
|
+
attr_reader :title, :flush, :system_arguments
|
3
3
|
|
4
4
|
def initialize(title, flush: false, **system_arguments, &block)
|
5
5
|
@title = title
|
6
6
|
@flush = flush
|
7
7
|
@block = block
|
8
|
+
@system_arguments = system_arguments
|
8
9
|
end
|
9
10
|
|
10
11
|
def call(row)
|