polaris_view_components 3.2.1 → 4.0.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 +4 -4
- data/README.md +1 -1
- data/app/assets/fonts/OFL.txt +92 -0
- data/app/assets/fonts/ShopifyInterVariable-latin-ext.woff2 +0 -0
- data/app/assets/fonts/ShopifyInterVariable-latin.woff2 +0 -0
- data/app/assets/icons/polaris/AlertCircleFilledIcon.svg +1 -0
- data/app/assets/icons/polaris/CheckCircleFilledIcon.svg +1 -0
- data/app/assets/icons/polaris/InfoFilledIcon.svg +1 -0
- data/app/assets/javascripts/polaris_view_components/autocomplete_controller.js +9 -0
- data/app/assets/javascripts/polaris_view_components/button_controller.js +6 -7
- data/app/assets/javascripts/polaris_view_components/dropzone_controller.js +2 -0
- data/app/assets/javascripts/polaris_view_components/index.js +2 -0
- data/app/assets/javascripts/polaris_view_components/popover_controller.js +33 -6
- data/app/assets/javascripts/polaris_view_components/tabs_controller.js +14 -0
- data/app/assets/javascripts/polaris_view_components.js +106 -7
- data/app/assets/stylesheets/polaris_view_components/action_list.pcss +19 -4
- data/app/assets/stylesheets/polaris_view_components/badge.pcss +75 -0
- data/app/assets/stylesheets/polaris_view_components/banner.pcss +132 -87
- data/app/assets/stylesheets/polaris_view_components/button.pcss +395 -61
- data/app/assets/stylesheets/polaris_view_components/callout_card.pcss +63 -2
- data/app/assets/stylesheets/polaris_view_components/card.pcss +130 -30
- data/app/assets/stylesheets/polaris_view_components/choice.pcss +80 -0
- data/app/assets/stylesheets/polaris_view_components/custom.pcss +6 -67
- data/app/assets/stylesheets/polaris_view_components/data_table.pcss +58 -2
- data/app/assets/stylesheets/polaris_view_components/description_list.pcss +34 -0
- data/app/assets/stylesheets/polaris_view_components/drop_zone.pcss +100 -0
- data/app/assets/stylesheets/polaris_view_components/fonts.pcss +27 -0
- data/app/assets/stylesheets/polaris_view_components/footer_help.pcss +24 -0
- data/app/assets/stylesheets/polaris_view_components/index_table.pcss +17 -2
- data/app/assets/stylesheets/polaris_view_components/media.pcss +126 -0
- data/app/assets/stylesheets/polaris_view_components/modal.pcss +115 -3
- data/app/assets/stylesheets/polaris_view_components/navigation.pcss +49 -0
- data/app/assets/stylesheets/polaris_view_components/navigation_list_component.pcss +73 -10
- data/app/assets/stylesheets/polaris_view_components/page.pcss +120 -10
- data/app/assets/stylesheets/polaris_view_components/pagination.pcss +6 -2
- data/app/assets/stylesheets/polaris_view_components/popover.pcss +13 -0
- data/app/assets/stylesheets/polaris_view_components/resource_list.pcss +100 -0
- data/app/assets/stylesheets/polaris_view_components/save_bar.pcss +35 -25
- data/app/assets/stylesheets/polaris_view_components/shopify_navigation.pcss +21 -18
- data/app/assets/stylesheets/polaris_view_components/tabs.pcss +69 -0
- data/app/assets/stylesheets/polaris_view_components/tag.pcss +45 -0
- data/app/assets/stylesheets/polaris_view_components/text_fields.pcss +226 -0
- data/app/assets/stylesheets/polaris_view_components/theme.pcss +386 -0
- data/app/assets/stylesheets/polaris_view_components/tooltip_component.pcss +7 -5
- data/app/assets/stylesheets/polaris_view_components/variables.pcss +1 -1
- data/app/assets/stylesheets/polaris_view_components.css +1766 -275
- data/app/assets/stylesheets/polaris_view_components.pcss +8 -0
- data/app/components/polaris/avatar_component.rb +1 -1
- data/app/components/polaris/banner_component.html.erb +27 -90
- data/app/components/polaris/banner_component.rb +4 -5
- data/app/components/polaris/button_component.html.erb +1 -9
- data/app/components/polaris/callout_card_component.html.erb +11 -7
- data/app/components/polaris/callout_card_component.rb +4 -3
- data/app/components/polaris/card/header_component.rb +1 -1
- data/app/components/polaris/card/section_component.html.erb +1 -1
- data/app/components/polaris/card/section_component.rb +2 -1
- data/app/components/polaris/card_component.html.erb +39 -37
- data/app/components/polaris/card_component.rb +3 -3
- data/app/components/polaris/checkbox_component.html.erb +2 -1
- data/app/components/polaris/checkbox_component.rb +0 -4
- data/app/components/polaris/dropzone_component.html.erb +12 -36
- data/app/components/polaris/headless_button.html.erb +1 -9
- data/app/components/polaris/headless_button.rb +13 -0
- data/app/components/polaris/modal_component.html.erb +6 -0
- data/app/components/polaris/page_component.html.erb +4 -4
- data/app/components/polaris/progress_bar_component.rb +4 -4
- data/app/components/polaris/resource_item/shortcut_actions_component.html.erb +6 -8
- data/app/components/polaris/resource_item/shortcut_actions_component.rb +5 -1
- data/app/components/polaris/resource_item_component.html.erb +4 -4
- data/app/components/polaris/resource_item_component.rb +4 -1
- data/app/components/polaris/spinner_component.html.erb +4 -9
- data/app/components/polaris/tabs_component.rb +2 -0
- data/lib/polaris/view_components/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2556310257a7b7bc5360830ea381c0619787796c347ba9414e7ff98826f6e19b
|
|
4
|
+
data.tar.gz: 3120e335bb52aca18bf9e7e5a00b773a47b02a74777bf3467204847604f7f2f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6e016aaaac91d443b9d9846b4d49748819a436ba43f7f9e4d2acfd4d3cf9435d54591a17c143b8f76f8d1d85257ff0387f19c69bd7db769d5419c6acaaa886a
|
|
7
|
+
data.tar.gz: f88419ccb82a51a2963ed40356c731ab279bbb5892585e27429cdd619ffb43115a6f04180ca6f00299bc026d4ecb424007ae8e1e691859909f6a3839b76b2595
|
data/README.md
CHANGED
|
@@ -44,7 +44,7 @@ Check out [UPGRADING.md](UPGRADING.md) for upgrade instructions.
|
|
|
44
44
|
To get started:
|
|
45
45
|
|
|
46
46
|
1. Run: `bundle install`
|
|
47
|
-
1. Run: `pnpm install`
|
|
47
|
+
1. Run: `pnpm install --frozen-lockfile`
|
|
48
48
|
1. Run: `bin/dev`
|
|
49
49
|
|
|
50
50
|
It will open the demo app with component previews on `localhost:4000`. You can change components and they will be updated on page reload. Component previews are located in `demo/app/previews`.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 20 20"><path fill-rule="evenodd" d="M8 1a7 7 0 1 1 0 14 7 7 0 0 1 0-14m0 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2m0-6a.75.75 0 0 0-.75.75v3.496a.75.75 0 1 0 1.5 0v-3.496a.75.75 0 0 0-.75-.75"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 20 20"><path fill-rule="evenodd" d="M8 1a7 7 0 1 1 .001 14.001 7 7 0 0 1-.001-14.001m2.66 4.37a.75.75 0 0 0-1.037.222l-2.249 3.471-1.094-1.093a.75.75 0 1 0-1.06 1.06l1.75 1.75a.75.75 0 0 0 1.16-.122l2.752-4.25a.75.75 0 0 0-.222-1.038"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 20 20"><path fill-rule="evenodd" d="M8 1a7 7 0 1 1 0 14 7 7 0 0 1 0-14m-1.25 6a.75.75 0 0 0 0 1.5h.752v2.747a.75.75 0 0 0 1.5 0v-3.497a.75.75 0 0 0-.75-.75zm1.25-3a1 1 0 1 0 0 2 1 1 0 0 0 0-2"/></svg>
|
|
@@ -44,6 +44,10 @@ export default class extends Controller {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
onInputChange = debounce(() => {
|
|
47
|
+
// The element may have been removed (e.g. replaced by a Turbo Stream)
|
|
48
|
+
// before the debounced callback fires.
|
|
49
|
+
if (!this.element.isConnected) return
|
|
50
|
+
|
|
47
51
|
if (this.isRemote) {
|
|
48
52
|
this.fetchResults()
|
|
49
53
|
} else {
|
|
@@ -80,6 +84,9 @@ export default class extends Controller {
|
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
handleResults() {
|
|
87
|
+
// The popover controller is gone once the element has been disconnected.
|
|
88
|
+
if (!this.popoverController) return
|
|
89
|
+
|
|
83
90
|
if (this.visibleOptions.length > 0) {
|
|
84
91
|
this.hideEmptyState()
|
|
85
92
|
this.popoverController.show()
|
|
@@ -119,6 +126,8 @@ export default class extends Controller {
|
|
|
119
126
|
if (response.ok) {
|
|
120
127
|
const results = await response.html
|
|
121
128
|
|
|
129
|
+
// Ignore responses that arrive after the element was removed from the page.
|
|
130
|
+
if (!this.element.isConnected) return
|
|
122
131
|
if (requestId !== this.latestRequestId || query !== this.value) return
|
|
123
132
|
|
|
124
133
|
this.resultsTarget.innerHTML = results
|
|
@@ -9,7 +9,7 @@ export default class extends Controller {
|
|
|
9
9
|
} else {
|
|
10
10
|
this.disabledValue = true
|
|
11
11
|
this.button.classList.add("Polaris-Button--disabled", "Polaris-Button--loading")
|
|
12
|
-
this.
|
|
12
|
+
this.button.insertAdjacentHTML("afterbegin", this.spinnerHTML)
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -46,12 +46,11 @@ export default class extends Controller {
|
|
|
46
46
|
|
|
47
47
|
get spinnerHTML() {
|
|
48
48
|
return `
|
|
49
|
-
<span class="Polaris-Button__Spinner">
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</span>
|
|
49
|
+
<span class="Polaris-Button__Spinner" role="status" aria-label="Loading">
|
|
50
|
+
<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
51
|
+
<circle class="Polaris-Button__SpinnerTrack" r="14" stroke-width="3" cx="22" cy="22"></circle>
|
|
52
|
+
<circle class="Polaris-Button__SpinnerIndicator" pathLength="10" r="14" stroke-width="3" cx="22" cy="22"></circle>
|
|
53
|
+
</svg>
|
|
55
54
|
</span>
|
|
56
55
|
`
|
|
57
56
|
}
|
|
@@ -11,6 +11,7 @@ import Popover from './popover_controller'
|
|
|
11
11
|
import ResourceItem from './resource_item_controller'
|
|
12
12
|
import Scrollable from './scrollable_controller'
|
|
13
13
|
import Select from './select_controller'
|
|
14
|
+
import Tabs from './tabs_controller'
|
|
14
15
|
import TextField from './text_field_controller'
|
|
15
16
|
import Toast from './toast_controller'
|
|
16
17
|
import Tooltip from './tooltip_controller'
|
|
@@ -32,6 +33,7 @@ export function registerPolarisControllers(application) {
|
|
|
32
33
|
application.register('polaris-resource-item', ResourceItem)
|
|
33
34
|
application.register('polaris-scrollable', Scrollable)
|
|
34
35
|
application.register('polaris-select', Select)
|
|
36
|
+
application.register('polaris-tabs', Tabs)
|
|
35
37
|
application.register('polaris-text-field', TextField)
|
|
36
38
|
application.register('polaris-toast', Toast)
|
|
37
39
|
application.register('polaris-tooltip', Tooltip)
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
offset,
|
|
6
6
|
flip,
|
|
7
7
|
shift,
|
|
8
|
+
size,
|
|
8
9
|
} from "@floating-ui/dom";
|
|
9
10
|
|
|
10
11
|
export default class extends Controller {
|
|
@@ -18,19 +19,27 @@ export default class extends Controller {
|
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
connect() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.target =
|
|
24
|
-
document.body.appendChild(clonedTemplate);
|
|
22
|
+
// Popovers appended to the body are created on first open, so long lists don't add a popover per row up front.
|
|
23
|
+
if (!this.appendToBodyValue) {
|
|
24
|
+
this.target.style.display = "none";
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
this.target.style.display = "none";
|
|
28
|
-
|
|
29
27
|
if (this.activeValue) {
|
|
30
28
|
this.show();
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
31
|
|
|
32
|
+
ensureTarget() {
|
|
33
|
+
if (this.appendToBodyValue && !this._target) {
|
|
34
|
+
const clonedTemplate = this.templateTarget.content.cloneNode(true);
|
|
35
|
+
this.target = clonedTemplate.firstElementChild;
|
|
36
|
+
this.target.style.display = "none";
|
|
37
|
+
document.body.appendChild(clonedTemplate);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return this.target;
|
|
41
|
+
}
|
|
42
|
+
|
|
34
43
|
disconnect() {
|
|
35
44
|
if (this.cleanup) {
|
|
36
45
|
this.cleanup();
|
|
@@ -55,6 +64,14 @@ export default class extends Controller {
|
|
|
55
64
|
fallbackStrategy: "bestFit",
|
|
56
65
|
}),
|
|
57
66
|
shift({ padding: 5 }),
|
|
67
|
+
// Full width popovers match the activator, like autocomplete results under their field
|
|
68
|
+
size({
|
|
69
|
+
apply: ({ rects }) => {
|
|
70
|
+
if (this.fullWidth) {
|
|
71
|
+
this.target.style.width = `${rects.reference.width}px`;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
58
75
|
],
|
|
59
76
|
}).then(({ x, y }) => {
|
|
60
77
|
Object.assign(this.target.style, {
|
|
@@ -66,6 +83,8 @@ export default class extends Controller {
|
|
|
66
83
|
}
|
|
67
84
|
|
|
68
85
|
toggle() {
|
|
86
|
+
this.ensureTarget();
|
|
87
|
+
|
|
69
88
|
if (this.target.classList.contains(this.openClass)) {
|
|
70
89
|
this.forceHide();
|
|
71
90
|
} else {
|
|
@@ -74,6 +93,7 @@ export default class extends Controller {
|
|
|
74
93
|
}
|
|
75
94
|
|
|
76
95
|
show() {
|
|
96
|
+
this.ensureTarget();
|
|
77
97
|
this.target.style.display = "block";
|
|
78
98
|
this.target.classList.remove(this.closedClass);
|
|
79
99
|
this.target.classList.add(this.openClass);
|
|
@@ -81,6 +101,7 @@ export default class extends Controller {
|
|
|
81
101
|
}
|
|
82
102
|
|
|
83
103
|
hide(event) {
|
|
104
|
+
if (!this.target) return;
|
|
84
105
|
if (this.element.contains(event.target)) return;
|
|
85
106
|
if (this.target.classList.contains(this.closedClass)) return;
|
|
86
107
|
if (this.appendToBodyValue && this.target.contains(event.target)) return;
|
|
@@ -89,6 +110,8 @@ export default class extends Controller {
|
|
|
89
110
|
}
|
|
90
111
|
|
|
91
112
|
forceHide() {
|
|
113
|
+
if (!this.target) return;
|
|
114
|
+
|
|
92
115
|
this.target.style.display = "none";
|
|
93
116
|
this.target.classList.remove(this.openClass);
|
|
94
117
|
this.target.classList.add(this.closedClass);
|
|
@@ -104,6 +127,10 @@ export default class extends Controller {
|
|
|
104
127
|
}
|
|
105
128
|
}
|
|
106
129
|
|
|
130
|
+
get fullWidth() {
|
|
131
|
+
return this.target.querySelector(".Polaris-Popover--fullWidth") !== null;
|
|
132
|
+
}
|
|
133
|
+
|
|
107
134
|
get target() {
|
|
108
135
|
if (this.hasPopoverTarget) {
|
|
109
136
|
return this.popoverTarget;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Controller } from '@hotwired/stimulus'
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/no-default-export
|
|
4
|
+
export default class extends Controller {
|
|
5
|
+
connect () {
|
|
6
|
+
const selectedTab = this.element.querySelector('.Polaris-LegacyTabs__Tab--selected')
|
|
7
|
+
if (!selectedTab) return
|
|
8
|
+
|
|
9
|
+
// Scrolls only the tab list, while scrollIntoView could also move the page
|
|
10
|
+
const list = this.element.getBoundingClientRect()
|
|
11
|
+
const tab = selectedTab.getBoundingClientRect()
|
|
12
|
+
this.element.scrollLeft += tab.left - list.left - (list.width - tab.width) / 2
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -212,6 +212,7 @@ class Autocomplete extends Controller {
|
|
|
212
212
|
this.element.dispatchEvent(changeEvent);
|
|
213
213
|
}
|
|
214
214
|
onInputChange=debounce((() => {
|
|
215
|
+
if (!this.element.isConnected) return;
|
|
215
216
|
if (this.isRemote) {
|
|
216
217
|
this.fetchResults();
|
|
217
218
|
} else {
|
|
@@ -238,6 +239,7 @@ class Autocomplete extends Controller {
|
|
|
238
239
|
return [ ...this.optionTargets ].filter((option => !option.classList.contains("Polaris--hidden")));
|
|
239
240
|
}
|
|
240
241
|
handleResults() {
|
|
242
|
+
if (!this.popoverController) return;
|
|
241
243
|
if (this.visibleOptions.length > 0) {
|
|
242
244
|
this.hideEmptyState();
|
|
243
245
|
this.popoverController.show();
|
|
@@ -276,6 +278,7 @@ class Autocomplete extends Controller {
|
|
|
276
278
|
});
|
|
277
279
|
if (response.ok) {
|
|
278
280
|
const results = await response.html;
|
|
281
|
+
if (!this.element.isConnected) return;
|
|
279
282
|
if (requestId !== this.latestRequestId || query !== this.value) return;
|
|
280
283
|
this.resultsTarget.innerHTML = results;
|
|
281
284
|
this.handleResults();
|
|
@@ -312,7 +315,7 @@ class Button extends Controller {
|
|
|
312
315
|
} else {
|
|
313
316
|
this.disabledValue = true;
|
|
314
317
|
this.button.classList.add("Polaris-Button--disabled", "Polaris-Button--loading");
|
|
315
|
-
this.
|
|
318
|
+
this.button.insertAdjacentHTML("afterbegin", this.spinnerHTML);
|
|
316
319
|
}
|
|
317
320
|
}
|
|
318
321
|
disableWithoutLoader(event) {
|
|
@@ -340,7 +343,7 @@ class Button extends Controller {
|
|
|
340
343
|
return this.button.querySelector(".Polaris-Button__Spinner");
|
|
341
344
|
}
|
|
342
345
|
get spinnerHTML() {
|
|
343
|
-
return `\n <span class="Polaris-Button__Spinner"
|
|
346
|
+
return `\n <span class="Polaris-Button__Spinner" role="status" aria-label="Loading">\n <svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">\n <circle class="Polaris-Button__SpinnerTrack" r="14" stroke-width="3" cx="22" cy="22"></circle>\n <circle class="Polaris-Button__SpinnerIndicator" pathLength="10" r="14" stroke-width="3" cx="22" cy="22"></circle>\n </svg>\n </span>\n `;
|
|
344
347
|
}
|
|
345
348
|
}
|
|
346
349
|
|
|
@@ -694,6 +697,7 @@ class Dropzone extends Controller {
|
|
|
694
697
|
this.previewRendered = false;
|
|
695
698
|
}
|
|
696
699
|
calculateSize() {
|
|
700
|
+
if (this.sizeValue === SIZES.SMALL) return SIZES.SMALL;
|
|
697
701
|
const width = this.element.getBoundingClientRect().width;
|
|
698
702
|
let size = SIZES.LARGE;
|
|
699
703
|
if (width < 100) {
|
|
@@ -1485,6 +1489,71 @@ const shift = function(options) {
|
|
|
1485
1489
|
};
|
|
1486
1490
|
};
|
|
1487
1491
|
|
|
1492
|
+
const size = function(options) {
|
|
1493
|
+
if (options === void 0) {
|
|
1494
|
+
options = {};
|
|
1495
|
+
}
|
|
1496
|
+
return {
|
|
1497
|
+
name: "size",
|
|
1498
|
+
options: options,
|
|
1499
|
+
async fn(state) {
|
|
1500
|
+
const {placement: placement, rects: rects, platform: platform, elements: elements} = state;
|
|
1501
|
+
const {apply: apply = (() => {}), ...detectOverflowOptions} = evaluate(options, state);
|
|
1502
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1503
|
+
const side = getSide(placement);
|
|
1504
|
+
const alignment = getAlignment(placement);
|
|
1505
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
1506
|
+
const {width: width, height: height} = rects.floating;
|
|
1507
|
+
let heightSide;
|
|
1508
|
+
let widthSide;
|
|
1509
|
+
if (side === "top" || side === "bottom") {
|
|
1510
|
+
heightSide = side;
|
|
1511
|
+
widthSide = alignment === (await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
1512
|
+
} else {
|
|
1513
|
+
widthSide = side;
|
|
1514
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
1515
|
+
}
|
|
1516
|
+
const overflowAvailableHeight = height - overflow[heightSide];
|
|
1517
|
+
const overflowAvailableWidth = width - overflow[widthSide];
|
|
1518
|
+
const noShift = !state.middlewareData.shift;
|
|
1519
|
+
let availableHeight = overflowAvailableHeight;
|
|
1520
|
+
let availableWidth = overflowAvailableWidth;
|
|
1521
|
+
if (isYAxis) {
|
|
1522
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
1523
|
+
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
1524
|
+
} else {
|
|
1525
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
1526
|
+
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
1527
|
+
}
|
|
1528
|
+
if (noShift && !alignment) {
|
|
1529
|
+
const xMin = max(overflow.left, 0);
|
|
1530
|
+
const xMax = max(overflow.right, 0);
|
|
1531
|
+
const yMin = max(overflow.top, 0);
|
|
1532
|
+
const yMax = max(overflow.bottom, 0);
|
|
1533
|
+
if (isYAxis) {
|
|
1534
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
1535
|
+
} else {
|
|
1536
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
await apply({
|
|
1540
|
+
...state,
|
|
1541
|
+
availableWidth: availableWidth,
|
|
1542
|
+
availableHeight: availableHeight
|
|
1543
|
+
});
|
|
1544
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
1545
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
1546
|
+
return {
|
|
1547
|
+
reset: {
|
|
1548
|
+
rects: true
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
return {};
|
|
1553
|
+
}
|
|
1554
|
+
};
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1488
1557
|
function getNodeName(node) {
|
|
1489
1558
|
if (isNode(node)) {
|
|
1490
1559
|
return (node.nodeName || "").toLowerCase();
|
|
@@ -2145,16 +2214,22 @@ class Popover extends Controller {
|
|
|
2145
2214
|
textFieldActivator: Boolean
|
|
2146
2215
|
};
|
|
2147
2216
|
connect() {
|
|
2148
|
-
if (this.appendToBodyValue) {
|
|
2149
|
-
|
|
2150
|
-
this.target = clonedTemplate.firstElementChild;
|
|
2151
|
-
document.body.appendChild(clonedTemplate);
|
|
2217
|
+
if (!this.appendToBodyValue) {
|
|
2218
|
+
this.target.style.display = "none";
|
|
2152
2219
|
}
|
|
2153
|
-
this.target.style.display = "none";
|
|
2154
2220
|
if (this.activeValue) {
|
|
2155
2221
|
this.show();
|
|
2156
2222
|
}
|
|
2157
2223
|
}
|
|
2224
|
+
ensureTarget() {
|
|
2225
|
+
if (this.appendToBodyValue && !this._target) {
|
|
2226
|
+
const clonedTemplate = this.templateTarget.content.cloneNode(true);
|
|
2227
|
+
this.target = clonedTemplate.firstElementChild;
|
|
2228
|
+
this.target.style.display = "none";
|
|
2229
|
+
document.body.appendChild(clonedTemplate);
|
|
2230
|
+
}
|
|
2231
|
+
return this.target;
|
|
2232
|
+
}
|
|
2158
2233
|
disconnect() {
|
|
2159
2234
|
if (this.cleanup) {
|
|
2160
2235
|
this.cleanup();
|
|
@@ -2176,6 +2251,12 @@ class Popover extends Controller {
|
|
|
2176
2251
|
fallbackStrategy: "bestFit"
|
|
2177
2252
|
}), shift({
|
|
2178
2253
|
padding: 5
|
|
2254
|
+
}), size({
|
|
2255
|
+
apply: ({rects: rects}) => {
|
|
2256
|
+
if (this.fullWidth) {
|
|
2257
|
+
this.target.style.width = `${rects.reference.width}px`;
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2179
2260
|
}) ]
|
|
2180
2261
|
}).then((({x: x, y: y}) => {
|
|
2181
2262
|
Object.assign(this.target.style, {
|
|
@@ -2186,6 +2267,7 @@ class Popover extends Controller {
|
|
|
2186
2267
|
}));
|
|
2187
2268
|
}
|
|
2188
2269
|
toggle() {
|
|
2270
|
+
this.ensureTarget();
|
|
2189
2271
|
if (this.target.classList.contains(this.openClass)) {
|
|
2190
2272
|
this.forceHide();
|
|
2191
2273
|
} else {
|
|
@@ -2193,18 +2275,21 @@ class Popover extends Controller {
|
|
|
2193
2275
|
}
|
|
2194
2276
|
}
|
|
2195
2277
|
show() {
|
|
2278
|
+
this.ensureTarget();
|
|
2196
2279
|
this.target.style.display = "block";
|
|
2197
2280
|
this.target.classList.remove(this.closedClass);
|
|
2198
2281
|
this.target.classList.add(this.openClass);
|
|
2199
2282
|
this.updatePosition();
|
|
2200
2283
|
}
|
|
2201
2284
|
hide(event) {
|
|
2285
|
+
if (!this.target) return;
|
|
2202
2286
|
if (this.element.contains(event.target)) return;
|
|
2203
2287
|
if (this.target.classList.contains(this.closedClass)) return;
|
|
2204
2288
|
if (this.appendToBodyValue && this.target.contains(event.target)) return;
|
|
2205
2289
|
this.forceHide();
|
|
2206
2290
|
}
|
|
2207
2291
|
forceHide() {
|
|
2292
|
+
if (!this.target) return;
|
|
2208
2293
|
this.target.style.display = "none";
|
|
2209
2294
|
this.target.classList.remove(this.openClass);
|
|
2210
2295
|
this.target.classList.add(this.closedClass);
|
|
@@ -2216,6 +2301,9 @@ class Popover extends Controller {
|
|
|
2216
2301
|
return this.activatorTarget;
|
|
2217
2302
|
}
|
|
2218
2303
|
}
|
|
2304
|
+
get fullWidth() {
|
|
2305
|
+
return this.target.querySelector(".Polaris-Popover--fullWidth") !== null;
|
|
2306
|
+
}
|
|
2219
2307
|
get target() {
|
|
2220
2308
|
if (this.hasPopoverTarget) {
|
|
2221
2309
|
return this.popoverTarget;
|
|
@@ -2314,6 +2402,16 @@ class Select extends Controller {
|
|
|
2314
2402
|
}
|
|
2315
2403
|
}
|
|
2316
2404
|
|
|
2405
|
+
class Tabs extends Controller {
|
|
2406
|
+
connect() {
|
|
2407
|
+
const selectedTab = this.element.querySelector(".Polaris-LegacyTabs__Tab--selected");
|
|
2408
|
+
if (!selectedTab) return;
|
|
2409
|
+
const list = this.element.getBoundingClientRect();
|
|
2410
|
+
const tab = selectedTab.getBoundingClientRect();
|
|
2411
|
+
this.element.scrollLeft += tab.left - list.left - (list.width - tab.width) / 2;
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2317
2415
|
class TextField extends Controller {
|
|
2318
2416
|
static targets=[ "input", "clearButton", "characterCount" ];
|
|
2319
2417
|
static classes=[ "hasValue", "clearButtonHidden" ];
|
|
@@ -2568,6 +2666,7 @@ function registerPolarisControllers(application) {
|
|
|
2568
2666
|
application.register("polaris-resource-item", ResourceItem);
|
|
2569
2667
|
application.register("polaris-scrollable", Scrollable);
|
|
2570
2668
|
application.register("polaris-select", Select);
|
|
2669
|
+
application.register("polaris-tabs", Tabs);
|
|
2571
2670
|
application.register("polaris-text-field", TextField);
|
|
2572
2671
|
application.register("polaris-toast", Toast);
|
|
2573
2672
|
application.register("polaris-tooltip", Tooltip);
|
|
@@ -2,24 +2,39 @@ html[class~="Polaris-Summer-Editions-2023"] .Polaris-ActionList {
|
|
|
2
2
|
.Polaris-ActionMenu-SecondaryAction a,
|
|
3
3
|
.Polaris-ActionMenu-SecondaryAction button,
|
|
4
4
|
.Polaris-ActionList__Item {
|
|
5
|
-
padding: var(--p-space-200);
|
|
5
|
+
padding: var(--p-space-150) var(--p-space-200);
|
|
6
|
+
border-radius: var(--p-border-radius-300);
|
|
6
7
|
background: transparent !important;
|
|
7
8
|
|
|
8
9
|
&:hover {
|
|
9
|
-
background: var(--p-color-bg-
|
|
10
|
+
background: var(--p-color-bg-fill-transparent-hover) !important;
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
&:active,
|
|
12
14
|
&.Polaris-ActionList--active {
|
|
13
|
-
background: var(--p-color-bg-
|
|
15
|
+
background: var(--p-color-bg-fill-transparent-active) !important;
|
|
16
|
+
font-weight: var(--p-font-weight-medium);
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
&.Polaris-ActionList--destructive {
|
|
20
|
+
color: var(--p-color-text-critical);
|
|
21
|
+
|
|
17
22
|
&:hover {
|
|
18
|
-
background: var(--p-color-bg-surface-critical
|
|
23
|
+
background: var(--p-color-bg-surface-critical) !important;
|
|
19
24
|
}
|
|
25
|
+
|
|
20
26
|
svg {
|
|
21
27
|
fill: var(--p-color-text-critical);
|
|
22
28
|
}
|
|
23
29
|
}
|
|
30
|
+
|
|
31
|
+
&.Polaris-ActionList--disabled:hover {
|
|
32
|
+
background: transparent !important;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.Polaris-ActionList__Prefix svg,
|
|
37
|
+
.Polaris-ActionList__Suffix svg {
|
|
38
|
+
fill: var(--p-color-icon);
|
|
24
39
|
}
|
|
25
40
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
html[class~="Polaris-Summer-Editions-2023"] .Polaris-Badge {
|
|
2
|
+
--pc-badge-bg: rgba(0, 0, 0, 0.05);
|
|
3
|
+
--pc-badge-text: var(--p-color-text-secondary);
|
|
4
|
+
min-height: 1.25rem;
|
|
5
|
+
padding: var(--p-space-025) var(--p-space-150);
|
|
6
|
+
gap: var(--p-space-100);
|
|
7
|
+
border-radius: var(--p-border-radius-200);
|
|
8
|
+
background-color: var(--pc-badge-bg);
|
|
9
|
+
color: var(--pc-badge-text);
|
|
10
|
+
font-weight: var(--p-font-weight-medium);
|
|
11
|
+
|
|
12
|
+
.Polaris-Text--root {
|
|
13
|
+
font-size: var(--p-font-size-300);
|
|
14
|
+
font-weight: inherit;
|
|
15
|
+
line-height: 1.125rem;
|
|
16
|
+
letter-spacing: -0.01em;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
svg {
|
|
20
|
+
fill: currentColor;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Progress pips sit in a 16px icon slot, like badge icons in the admin. */
|
|
24
|
+
&:has(> .Polaris-Badge__PipContainer) {
|
|
25
|
+
padding-left: var(--p-space-100);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.Polaris-Badge__PipContainer {
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
width: 1rem;
|
|
33
|
+
height: 1rem;
|
|
34
|
+
margin: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.Polaris-Badge--statusInfo {
|
|
38
|
+
--pc-badge-bg: var(--p-color-bg-fill-info-secondary);
|
|
39
|
+
--pc-badge-text: #01596f;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.Polaris-Badge--statusSuccess {
|
|
43
|
+
--pc-badge-bg: var(--p-color-bg-fill-success-secondary);
|
|
44
|
+
--pc-badge-text: #214b03;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.Polaris-Badge--statusAttention {
|
|
48
|
+
--pc-badge-bg: var(--p-color-bg-fill-caution-secondary);
|
|
49
|
+
--pc-badge-text: #574100;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.Polaris-Badge--statusWarning {
|
|
53
|
+
--pc-badge-bg: var(--p-color-bg-fill-warning-secondary);
|
|
54
|
+
--pc-badge-text: #6f2e01;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.Polaris-Badge--statusCritical {
|
|
58
|
+
--pc-badge-bg: var(--p-color-bg-fill-critical-secondary);
|
|
59
|
+
--pc-badge-text: #7e100c;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.Polaris-Badge--statusNew {
|
|
63
|
+
font-weight: var(--p-font-weight-semibold);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.Polaris-Badge__sizeLarge--experimental,
|
|
67
|
+
&.Polaris-Badge--sizeLarge {
|
|
68
|
+
min-height: 1.75rem;
|
|
69
|
+
padding: var(--p-space-100) var(--p-space-200);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
html[class~="Polaris-Summer-Editions-2023"] .Polaris-Badge-Pip {
|
|
74
|
+
--pc-pip-color: currentColor;
|
|
75
|
+
}
|