polaris_view_components 3.2.1 → 4.0.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 +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/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 +103 -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: 8fec4405e8b1c604811d7bf69ece811a57fa31447754fe6a3f67cac17fc5c9ed
|
|
4
|
+
data.tar.gz: d670c3c83b34ec0bff77066c94ffbe0eca60530985f6b3d44589108c740f071e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29daf7afd8f7a06ec3b9c41530a97b02bdd2accc663f911133ab413d8682c06d503a697afc0ea28719084fc9498d7a04cf98ac61fcdab3632f0c299a451006b2
|
|
7
|
+
data.tar.gz: 0120f2a3d552796b7eeb7ef4de1d38fb7d8862865e776d96548abfaacb8b95879b0a29ed964006ad8ca7c8b00cd865beeec40333bab665371c05af604033bcb9
|
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>
|
|
@@ -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
|
+
}
|
|
@@ -312,7 +312,7 @@ class Button extends Controller {
|
|
|
312
312
|
} else {
|
|
313
313
|
this.disabledValue = true;
|
|
314
314
|
this.button.classList.add("Polaris-Button--disabled", "Polaris-Button--loading");
|
|
315
|
-
this.
|
|
315
|
+
this.button.insertAdjacentHTML("afterbegin", this.spinnerHTML);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
disableWithoutLoader(event) {
|
|
@@ -340,7 +340,7 @@ class Button extends Controller {
|
|
|
340
340
|
return this.button.querySelector(".Polaris-Button__Spinner");
|
|
341
341
|
}
|
|
342
342
|
get spinnerHTML() {
|
|
343
|
-
return `\n <span class="Polaris-Button__Spinner"
|
|
343
|
+
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
344
|
}
|
|
345
345
|
}
|
|
346
346
|
|
|
@@ -694,6 +694,7 @@ class Dropzone extends Controller {
|
|
|
694
694
|
this.previewRendered = false;
|
|
695
695
|
}
|
|
696
696
|
calculateSize() {
|
|
697
|
+
if (this.sizeValue === SIZES.SMALL) return SIZES.SMALL;
|
|
697
698
|
const width = this.element.getBoundingClientRect().width;
|
|
698
699
|
let size = SIZES.LARGE;
|
|
699
700
|
if (width < 100) {
|
|
@@ -1485,6 +1486,71 @@ const shift = function(options) {
|
|
|
1485
1486
|
};
|
|
1486
1487
|
};
|
|
1487
1488
|
|
|
1489
|
+
const size = function(options) {
|
|
1490
|
+
if (options === void 0) {
|
|
1491
|
+
options = {};
|
|
1492
|
+
}
|
|
1493
|
+
return {
|
|
1494
|
+
name: "size",
|
|
1495
|
+
options: options,
|
|
1496
|
+
async fn(state) {
|
|
1497
|
+
const {placement: placement, rects: rects, platform: platform, elements: elements} = state;
|
|
1498
|
+
const {apply: apply = (() => {}), ...detectOverflowOptions} = evaluate(options, state);
|
|
1499
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1500
|
+
const side = getSide(placement);
|
|
1501
|
+
const alignment = getAlignment(placement);
|
|
1502
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
1503
|
+
const {width: width, height: height} = rects.floating;
|
|
1504
|
+
let heightSide;
|
|
1505
|
+
let widthSide;
|
|
1506
|
+
if (side === "top" || side === "bottom") {
|
|
1507
|
+
heightSide = side;
|
|
1508
|
+
widthSide = alignment === (await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
1509
|
+
} else {
|
|
1510
|
+
widthSide = side;
|
|
1511
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
1512
|
+
}
|
|
1513
|
+
const overflowAvailableHeight = height - overflow[heightSide];
|
|
1514
|
+
const overflowAvailableWidth = width - overflow[widthSide];
|
|
1515
|
+
const noShift = !state.middlewareData.shift;
|
|
1516
|
+
let availableHeight = overflowAvailableHeight;
|
|
1517
|
+
let availableWidth = overflowAvailableWidth;
|
|
1518
|
+
if (isYAxis) {
|
|
1519
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
1520
|
+
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
1521
|
+
} else {
|
|
1522
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
1523
|
+
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
1524
|
+
}
|
|
1525
|
+
if (noShift && !alignment) {
|
|
1526
|
+
const xMin = max(overflow.left, 0);
|
|
1527
|
+
const xMax = max(overflow.right, 0);
|
|
1528
|
+
const yMin = max(overflow.top, 0);
|
|
1529
|
+
const yMax = max(overflow.bottom, 0);
|
|
1530
|
+
if (isYAxis) {
|
|
1531
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
1532
|
+
} else {
|
|
1533
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
await apply({
|
|
1537
|
+
...state,
|
|
1538
|
+
availableWidth: availableWidth,
|
|
1539
|
+
availableHeight: availableHeight
|
|
1540
|
+
});
|
|
1541
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
1542
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
1543
|
+
return {
|
|
1544
|
+
reset: {
|
|
1545
|
+
rects: true
|
|
1546
|
+
}
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
return {};
|
|
1550
|
+
}
|
|
1551
|
+
};
|
|
1552
|
+
};
|
|
1553
|
+
|
|
1488
1554
|
function getNodeName(node) {
|
|
1489
1555
|
if (isNode(node)) {
|
|
1490
1556
|
return (node.nodeName || "").toLowerCase();
|
|
@@ -2145,16 +2211,22 @@ class Popover extends Controller {
|
|
|
2145
2211
|
textFieldActivator: Boolean
|
|
2146
2212
|
};
|
|
2147
2213
|
connect() {
|
|
2148
|
-
if (this.appendToBodyValue) {
|
|
2149
|
-
|
|
2150
|
-
this.target = clonedTemplate.firstElementChild;
|
|
2151
|
-
document.body.appendChild(clonedTemplate);
|
|
2214
|
+
if (!this.appendToBodyValue) {
|
|
2215
|
+
this.target.style.display = "none";
|
|
2152
2216
|
}
|
|
2153
|
-
this.target.style.display = "none";
|
|
2154
2217
|
if (this.activeValue) {
|
|
2155
2218
|
this.show();
|
|
2156
2219
|
}
|
|
2157
2220
|
}
|
|
2221
|
+
ensureTarget() {
|
|
2222
|
+
if (this.appendToBodyValue && !this._target) {
|
|
2223
|
+
const clonedTemplate = this.templateTarget.content.cloneNode(true);
|
|
2224
|
+
this.target = clonedTemplate.firstElementChild;
|
|
2225
|
+
this.target.style.display = "none";
|
|
2226
|
+
document.body.appendChild(clonedTemplate);
|
|
2227
|
+
}
|
|
2228
|
+
return this.target;
|
|
2229
|
+
}
|
|
2158
2230
|
disconnect() {
|
|
2159
2231
|
if (this.cleanup) {
|
|
2160
2232
|
this.cleanup();
|
|
@@ -2176,6 +2248,12 @@ class Popover extends Controller {
|
|
|
2176
2248
|
fallbackStrategy: "bestFit"
|
|
2177
2249
|
}), shift({
|
|
2178
2250
|
padding: 5
|
|
2251
|
+
}), size({
|
|
2252
|
+
apply: ({rects: rects}) => {
|
|
2253
|
+
if (this.fullWidth) {
|
|
2254
|
+
this.target.style.width = `${rects.reference.width}px`;
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2179
2257
|
}) ]
|
|
2180
2258
|
}).then((({x: x, y: y}) => {
|
|
2181
2259
|
Object.assign(this.target.style, {
|
|
@@ -2186,6 +2264,7 @@ class Popover extends Controller {
|
|
|
2186
2264
|
}));
|
|
2187
2265
|
}
|
|
2188
2266
|
toggle() {
|
|
2267
|
+
this.ensureTarget();
|
|
2189
2268
|
if (this.target.classList.contains(this.openClass)) {
|
|
2190
2269
|
this.forceHide();
|
|
2191
2270
|
} else {
|
|
@@ -2193,18 +2272,21 @@ class Popover extends Controller {
|
|
|
2193
2272
|
}
|
|
2194
2273
|
}
|
|
2195
2274
|
show() {
|
|
2275
|
+
this.ensureTarget();
|
|
2196
2276
|
this.target.style.display = "block";
|
|
2197
2277
|
this.target.classList.remove(this.closedClass);
|
|
2198
2278
|
this.target.classList.add(this.openClass);
|
|
2199
2279
|
this.updatePosition();
|
|
2200
2280
|
}
|
|
2201
2281
|
hide(event) {
|
|
2282
|
+
if (!this.target) return;
|
|
2202
2283
|
if (this.element.contains(event.target)) return;
|
|
2203
2284
|
if (this.target.classList.contains(this.closedClass)) return;
|
|
2204
2285
|
if (this.appendToBodyValue && this.target.contains(event.target)) return;
|
|
2205
2286
|
this.forceHide();
|
|
2206
2287
|
}
|
|
2207
2288
|
forceHide() {
|
|
2289
|
+
if (!this.target) return;
|
|
2208
2290
|
this.target.style.display = "none";
|
|
2209
2291
|
this.target.classList.remove(this.openClass);
|
|
2210
2292
|
this.target.classList.add(this.closedClass);
|
|
@@ -2216,6 +2298,9 @@ class Popover extends Controller {
|
|
|
2216
2298
|
return this.activatorTarget;
|
|
2217
2299
|
}
|
|
2218
2300
|
}
|
|
2301
|
+
get fullWidth() {
|
|
2302
|
+
return this.target.querySelector(".Polaris-Popover--fullWidth") !== null;
|
|
2303
|
+
}
|
|
2219
2304
|
get target() {
|
|
2220
2305
|
if (this.hasPopoverTarget) {
|
|
2221
2306
|
return this.popoverTarget;
|
|
@@ -2314,6 +2399,16 @@ class Select extends Controller {
|
|
|
2314
2399
|
}
|
|
2315
2400
|
}
|
|
2316
2401
|
|
|
2402
|
+
class Tabs extends Controller {
|
|
2403
|
+
connect() {
|
|
2404
|
+
const selectedTab = this.element.querySelector(".Polaris-LegacyTabs__Tab--selected");
|
|
2405
|
+
if (!selectedTab) return;
|
|
2406
|
+
const list = this.element.getBoundingClientRect();
|
|
2407
|
+
const tab = selectedTab.getBoundingClientRect();
|
|
2408
|
+
this.element.scrollLeft += tab.left - list.left - (list.width - tab.width) / 2;
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2317
2412
|
class TextField extends Controller {
|
|
2318
2413
|
static targets=[ "input", "clearButton", "characterCount" ];
|
|
2319
2414
|
static classes=[ "hasValue", "clearButtonHidden" ];
|
|
@@ -2568,6 +2663,7 @@ function registerPolarisControllers(application) {
|
|
|
2568
2663
|
application.register("polaris-resource-item", ResourceItem);
|
|
2569
2664
|
application.register("polaris-scrollable", Scrollable);
|
|
2570
2665
|
application.register("polaris-select", Select);
|
|
2666
|
+
application.register("polaris-tabs", Tabs);
|
|
2571
2667
|
application.register("polaris-text-field", TextField);
|
|
2572
2668
|
application.register("polaris-toast", Toast);
|
|
2573
2669
|
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
|
+
}
|