@hulkapps/app-manager-vue 1.0.2 → 2.0.2
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.
- package/dist/app-manager-vue.esm.js +39044 -15119
- package/dist/app-manager-vue.min.js +9 -2
- package/dist/app-manager-vue.ssr.js +37559 -15018
- package/dist/hulkapps-app-manager.css +13284 -0
- package/dist/hulkapps-app-manager.min.css +1 -0
- package/package.json +9 -4
- package/src/components/Marketing/Banners.vue +43 -40
- package/src/components/Plans/AppManagerPlan.vue +518 -0
- package/src/components/Plans/PlanBanners.vue +50 -0
- package/src/components/Plans/YearlyPlanPromotion.vue +40 -0
- package/src/components/polaris-vue/src/components/PActionList/PActionList.vue +68 -0
- package/src/components/polaris-vue/src/components/PActionList/components/PActionListItem/PActionListItem.vue +91 -0
- package/src/components/polaris-vue/src/components/PActionList/components/PActionListSection/PActionListSection.vue +68 -0
- package/src/components/polaris-vue/src/components/PActionMenu/PActionMenu.vue +54 -0
- package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuActions/PActionMenuActions.vue +197 -0
- package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuMenuAction/PActionMenuMenuAction.vue +97 -0
- package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuMenuGroup/PActionMenuMenuGroup.vue +54 -0
- package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuRollupActions/PActionMenuRollupActions.vue +43 -0
- package/src/components/polaris-vue/src/components/PAvatar/PAvatar.vue +104 -0
- package/src/components/polaris-vue/src/components/PBadge/PBadge.vue +86 -0
- package/src/components/polaris-vue/src/components/PBanner/PBanner.vue +132 -0
- package/src/components/polaris-vue/src/components/PBreadcrumbs/PBreadcrumbs.vue +99 -0
- package/src/components/polaris-vue/src/components/PButton/PButton.vue +396 -0
- package/src/components/polaris-vue/src/components/PButton/components/PButtonsFrom/PButtonsFrom.vue +47 -0
- package/src/components/polaris-vue/src/components/PButton/components/PUnstyledButton/PUnstyledButton.vue +340 -0
- package/src/components/polaris-vue/src/components/PButtonGroup/PButtonGroup.vue +76 -0
- package/src/components/polaris-vue/src/components/PButtonGroup/components/PButtonGroupItem/PButtonGroupItem.vue +11 -0
- package/src/components/polaris-vue/src/components/PCaption/PCaption.vue +29 -0
- package/src/components/polaris-vue/src/components/PCard/PCard.vue +118 -0
- package/src/components/polaris-vue/src/components/PCard/components/PCardFooter/PCardFooter.vue +11 -0
- package/src/components/polaris-vue/src/components/PCard/components/PCardHeader/PCardHeader.vue +69 -0
- package/src/components/polaris-vue/src/components/PCard/components/PCardSection/PCardSection.vue +54 -0
- package/src/components/polaris-vue/src/components/PCard/components/PCardSubsection/PCardSubsection.vue +12 -0
- package/src/components/polaris-vue/src/components/PConnected/PConnected.vue +44 -0
- package/src/components/polaris-vue/src/components/PConnected/components/PConnectedItem/PConnectedItem.vue +41 -0
- package/src/components/polaris-vue/src/components/PDataTable/PDataTable.vue +541 -0
- package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableCell/PDataTableCell.vue +213 -0
- package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableCellNew/PDataTableCellNew.vue +162 -0
- package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableCol/PDataTableCol.vue +75 -0
- package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableRow/PDataTableRow.vue +15 -0
- package/src/components/polaris-vue/src/components/PDisplayText/PDisplayText.vue +56 -0
- package/src/components/polaris-vue/src/components/PEmptyState/PEmptyState.vue +154 -0
- package/src/components/polaris-vue/src/components/PFieldError/PFieldError.vue +41 -0
- package/src/components/polaris-vue/src/components/PFilter/PFilter.vue +252 -0
- package/src/components/polaris-vue/src/components/PFilter/components/PFilterItem/PFilterItem.vue +11 -0
- package/src/components/polaris-vue/src/components/PFilter/components/PFilterItemWrapper/PFilterItemWrapper.vue +32 -0
- package/src/components/polaris-vue/src/components/PHeading/PHeading.vue +33 -0
- package/src/components/polaris-vue/src/components/PIcon/PIcon.vue +121 -0
- package/src/components/polaris-vue/src/components/PIcon/ShopifyIcons.vue +217 -0
- package/src/components/polaris-vue/src/components/PImage/PImage.vue +49 -0
- package/src/components/polaris-vue/src/components/PLayout/PLayout.vue +42 -0
- package/src/components/polaris-vue/src/components/PLayout/components/PLayoutSection/PLayoutSection.vue +55 -0
- package/src/components/polaris-vue/src/components/PLink/PLink.vue +90 -0
- package/src/components/polaris-vue/src/components/POptionalTag/POptionalTag.vue +23 -0
- package/src/components/polaris-vue/src/components/PPage/PPage.vue +136 -0
- package/src/components/polaris-vue/src/components/PPage/components/PPageHeader/PPageHeader.vue +191 -0
- package/src/components/polaris-vue/src/components/PPage/components/PPageHeaderTitle/PPageHeaderTitle.vue +63 -0
- package/src/components/polaris-vue/src/components/PPagination/PPagination.vue +119 -0
- package/src/components/polaris-vue/src/components/PPopover/PPopover.vue +298 -0
- package/src/components/polaris-vue/src/components/PPopover/components/PPopoverOverlay/PPopoverOverlay.vue +66 -0
- package/src/components/polaris-vue/src/components/PPopover/components/PPositionedOverlay/PPositionedOverlay.vue +289 -0
- package/src/components/polaris-vue/src/components/PSpinner/PSpinner.vue +60 -0
- package/src/components/polaris-vue/src/components/PStack/PStack.vue +84 -0
- package/src/components/polaris-vue/src/components/PStack/components/PStackItem/PStackItem.vue +49 -0
- package/src/components/polaris-vue/src/components/PSubheading/PSubheading.vue +36 -0
- package/src/components/polaris-vue/src/components/PTag/PTag.vue +89 -0
- package/src/components/polaris-vue/src/components/PTextContainer/PTextContainer.vue +41 -0
- package/src/components/polaris-vue/src/components/PTextField/PTextField.vue +229 -0
- package/src/components/polaris-vue/src/components/PTextField/components/PFieldResizer/PFieldResizer.vue +79 -0
- package/src/components/polaris-vue/src/components/PTextField/components/PInput/PInput.vue +473 -0
- package/src/components/polaris-vue/src/components/PTextField/components/PSpinner/PSpinner.vue +47 -0
- package/src/components/polaris-vue/src/components/PTextStyle/PTextStyle.vue +60 -0
- package/src/components/polaris-vue/src/components/PThumbnail/PThumbnail.vue +71 -0
- package/src/components/polaris-vue/src/components/PToggle/PToggle.vue +81 -0
- package/src/components/polaris-vue/src/components/PUnstyledLink/PUnstyledLink.vue +67 -0
package/src/components/polaris-vue/src/components/PPage/components/PPageHeader/PPageHeader.vue
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="headerClassNames">
|
|
3
|
+
<div class="Polaris-Page-Header__Row">
|
|
4
|
+
<div v-if="breadcrumbs.length > 0" class="Polaris-Page-Header__BreadcrumbWrapper">
|
|
5
|
+
<PBreadcrumbs :breadcrumbs="breadcrumbs"/>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="Polaris-Page-Header__TitleWrapper" v-if="hasTitle">
|
|
8
|
+
<PPageHeaderTitle
|
|
9
|
+
:title="title"
|
|
10
|
+
:subtitle="subtitle"
|
|
11
|
+
:titleMetadata="titleMetadata"
|
|
12
|
+
:alt="thumbnailAlt"
|
|
13
|
+
:source="thumbnail">
|
|
14
|
+
<slot name="titleMetadata" slot="titleMetadata"/>
|
|
15
|
+
</PPageHeaderTitle>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="Polaris-Page-Header__RightAlign">
|
|
18
|
+
<div class="Polaris-Page-Header__Actions" v-if="hasActions">
|
|
19
|
+
<PActionMenu :groups="actionGroups" :actions="secondaryActions" v-if="hasActionMenu"
|
|
20
|
+
:rollup="isNavigationCollapsed.rollup"/>
|
|
21
|
+
<div v-if="Object.keys(primaryAction).length > 0 || $slots.hasOwnProperty('primaryAction')"
|
|
22
|
+
class="Polaris-Page-Header__PrimaryActionWrapper">
|
|
23
|
+
<slot name="primaryAction">
|
|
24
|
+
<PButton
|
|
25
|
+
v-if="primaryAction"
|
|
26
|
+
v-bind="primaryAction"
|
|
27
|
+
:primary="primaryAction.primary === undefined ? true : primaryAction.primary"
|
|
28
|
+
@click="primaryAction.onAction()">{{ primaryAction.content }}
|
|
29
|
+
</PButton>
|
|
30
|
+
</slot>
|
|
31
|
+
</div>
|
|
32
|
+
<div
|
|
33
|
+
class="Polaris-Page-Header__PaginationWrapper"
|
|
34
|
+
v-if="Object.keys(pagination).length > 0 && !isNavigationCollapsed.rollup">
|
|
35
|
+
<nav aria-label="Pagination">
|
|
36
|
+
<PPagination v-bind="pagination" />
|
|
37
|
+
</nav>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="Polaris-Page-Header__Row"
|
|
43
|
+
v-if="$slots.hasOwnProperty('additionalNavigation') || avatar || avatarInitials">
|
|
44
|
+
<div class="Polaris-Page-Header__LeftAlign"></div>
|
|
45
|
+
<div class="Polaris-Page-Header__RightAlign">
|
|
46
|
+
<div class="Polaris-Page-Header__AdditionalNavigationWrapper">
|
|
47
|
+
<div v-if="avatarInitials || avatar">
|
|
48
|
+
<PAvatar :source="avatar" :initials="avatarInitials"/>
|
|
49
|
+
</div>
|
|
50
|
+
<slot name="additionalNavigation"/>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script>
|
|
58
|
+
import { classNames } from '../../../../utilities/css';
|
|
59
|
+
import { hasGroupsWithActions } from '../../../../components/PActionMenu/utilities';
|
|
60
|
+
import { PTextStyle } from '../../../../components/PTextStyle';
|
|
61
|
+
import { PBreadcrumbs } from '../../../../components/PBreadcrumbs';
|
|
62
|
+
import { PPagination } from '../../../../components/PPagination';
|
|
63
|
+
import { PActionMenu } from '../../../../components/PActionMenu';
|
|
64
|
+
import { PButton } from '../../../../components/PButton';
|
|
65
|
+
import { PPageHeaderTitle } from '../../../../components/PPage/components/PPageHeaderTitle';
|
|
66
|
+
import { PPopover } from '../../../../components/PPopover';
|
|
67
|
+
import { PActionList } from '../../../../components/PActionList';
|
|
68
|
+
import { PButtonGroup } from '../../../../components/PButtonGroup';
|
|
69
|
+
import { PAvatar } from '../../../../components/PAvatar';
|
|
70
|
+
|
|
71
|
+
export default {
|
|
72
|
+
name: 'PPageHeader',
|
|
73
|
+
components: {
|
|
74
|
+
PBreadcrumbs, PPagination, PPageHeaderTitle, PActionMenu, PTextStyle, PButton, PPopover, PActionList,
|
|
75
|
+
PButtonGroup, PAvatar,
|
|
76
|
+
},
|
|
77
|
+
props: {
|
|
78
|
+
title: {
|
|
79
|
+
type: String,
|
|
80
|
+
},
|
|
81
|
+
subtitle: {
|
|
82
|
+
type: String,
|
|
83
|
+
},
|
|
84
|
+
thumbnail: {
|
|
85
|
+
type: String,
|
|
86
|
+
},
|
|
87
|
+
thumbnailAlt: {
|
|
88
|
+
type: String,
|
|
89
|
+
},
|
|
90
|
+
titleMetadata: {
|
|
91
|
+
type: String,
|
|
92
|
+
},
|
|
93
|
+
avatar: {
|
|
94
|
+
type: String,
|
|
95
|
+
},
|
|
96
|
+
avatarInitials: {
|
|
97
|
+
type: String,
|
|
98
|
+
},
|
|
99
|
+
additionalMetaData: {
|
|
100
|
+
type: String,
|
|
101
|
+
},
|
|
102
|
+
titleHidden: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: false,
|
|
105
|
+
},
|
|
106
|
+
separator: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
},
|
|
109
|
+
primaryAction: {
|
|
110
|
+
type: Object,
|
|
111
|
+
default: () => ({}),
|
|
112
|
+
},
|
|
113
|
+
pagination: {
|
|
114
|
+
type: Object,
|
|
115
|
+
default: () => ({}),
|
|
116
|
+
},
|
|
117
|
+
breadcrumbs: {
|
|
118
|
+
type: Array,
|
|
119
|
+
default: () => ([]),
|
|
120
|
+
},
|
|
121
|
+
secondaryActions: {
|
|
122
|
+
type: Array,
|
|
123
|
+
default: () => ([]),
|
|
124
|
+
},
|
|
125
|
+
actionGroups: {
|
|
126
|
+
type: Array,
|
|
127
|
+
default: () => ([]),
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
data() {
|
|
131
|
+
return {
|
|
132
|
+
/**
|
|
133
|
+
* To Check that view collapsed or not.
|
|
134
|
+
*/
|
|
135
|
+
isNavigationCollapsed: {
|
|
136
|
+
rollup: false,
|
|
137
|
+
},
|
|
138
|
+
bulkActionsShown: false,
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
computed: {
|
|
142
|
+
headerClassNames() {
|
|
143
|
+
return classNames(
|
|
144
|
+
'Polaris-Page-Header',
|
|
145
|
+
this.titleHidden && 'Polaris-Page-Header--titleHidden',
|
|
146
|
+
this.separator && 'Polaris-Page-Header--separator',
|
|
147
|
+
this.hasNavigation && 'Polaris-Page-Header--hasNavigation',
|
|
148
|
+
this.hasActionMenu && 'Polaris-Page-Header--hasActionMenu',
|
|
149
|
+
this.title && 'Polaris-Page-Header--mediumTitle',
|
|
150
|
+
this.isNavigationCollapsed.rollup && 'Polaris-Page-Header--mobileView',
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
hasNavigation() {
|
|
154
|
+
|
|
155
|
+
return this.breadcrumbs.length > 0 || this.$slots.additionalNavigation || this.pagination;
|
|
156
|
+
},
|
|
157
|
+
hasActions() {
|
|
158
|
+
return this.hasActionMenu ||
|
|
159
|
+
Object.keys(this.primaryAction).length > 0 ||
|
|
160
|
+
Object.keys(this.pagination).length > 0 ||
|
|
161
|
+
this.$props.hasOwnProperty('primaryAction');
|
|
162
|
+
},
|
|
163
|
+
hasActionMenu() {
|
|
164
|
+
return this.secondaryActions.length > 0 || hasGroupsWithActions(this.actionGroups);
|
|
165
|
+
},
|
|
166
|
+
hasTitle() {
|
|
167
|
+
return this.title || this.subtitle || this.titleMetadata || this.thumbnail ||
|
|
168
|
+
this.$slots.hasOwnProperty('titleMetadata');
|
|
169
|
+
},
|
|
170
|
+
hasAvatar() {
|
|
171
|
+
return this.avatar || this.avatarInitials;
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
methods: {
|
|
175
|
+
useMediaQuery() {
|
|
176
|
+
if (window.innerWidth <= 768) {
|
|
177
|
+
this.$set(this.isNavigationCollapsed, 'rollup', true);
|
|
178
|
+
} else {
|
|
179
|
+
this.$set(this.isNavigationCollapsed, 'rollup', false);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
created() {
|
|
184
|
+
window.addEventListener('resize', this.useMediaQuery);
|
|
185
|
+
this.useMediaQuery();
|
|
186
|
+
},
|
|
187
|
+
destroyed() {
|
|
188
|
+
window.removeEventListener('resize', this.useMediaQuery);
|
|
189
|
+
},
|
|
190
|
+
}
|
|
191
|
+
</script>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="pageTitleClassName">
|
|
3
|
+
<div v-if="source">
|
|
4
|
+
<PThumbnail size="medium" :source="source" :alt="alt"/>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="Polaris-Header-Title__TitleAndSubtitleWrapper" v-if="title || subtitle">
|
|
7
|
+
<div class="Polaris-Header-Title__TitleWithMetadataWrapper">
|
|
8
|
+
<PDisplayText element="h1" v-html="title" class="Polaris-Header-Title"/>
|
|
9
|
+
<div class="Polaris-Header-Title__TitleMetadata"
|
|
10
|
+
v-if="titleMetadata || $slots.hasOwnProperty('titleMetadata')">
|
|
11
|
+
<template v-if="titleMetadata">{{ titleMetadata }}</template>
|
|
12
|
+
<slot v-else name="titleMetadata"/>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div v-if="subtitle" class="Polaris-Header-Title__SubTitle">
|
|
16
|
+
<p>{{ subtitle }}</p>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { classNames } from '../../../../utilities/css';
|
|
24
|
+
import { PDisplayText } from '../../../../components/PDisplayText';
|
|
25
|
+
import { PTextStyle } from '../../../../components/PTextStyle';
|
|
26
|
+
import { PThumbnail } from '../../../../components/PThumbnail';
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'PPageHeaderTitle',
|
|
30
|
+
components: {
|
|
31
|
+
PDisplayText, PTextStyle, PThumbnail,
|
|
32
|
+
},
|
|
33
|
+
props: {
|
|
34
|
+
title: {
|
|
35
|
+
type: String,
|
|
36
|
+
},
|
|
37
|
+
source: {
|
|
38
|
+
type: String,
|
|
39
|
+
},
|
|
40
|
+
alt: {
|
|
41
|
+
type: String,
|
|
42
|
+
},
|
|
43
|
+
subtitle: {
|
|
44
|
+
type: String,
|
|
45
|
+
},
|
|
46
|
+
titleMetadata: {
|
|
47
|
+
type: String,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
computed: {
|
|
51
|
+
pageTitleClassName() {
|
|
52
|
+
return classNames(
|
|
53
|
+
this.source && 'Polaris-Header-Title--hasThumbnail',
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
methods: {
|
|
58
|
+
hasThumbnailSlot() {
|
|
59
|
+
return !!this.$slots.thumbnail;
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav :class="className">
|
|
3
|
+
<PUnstyledLink v-if="previousURL" :class="previousClassName" :url="previousURL">
|
|
4
|
+
<PIcon source="ArrowLeftMinor"/>
|
|
5
|
+
</PUnstyledLink>
|
|
6
|
+
<button v-else type="button" :class="previousClassName" :disabled="!hasPrevious" @click="onPrevious()">
|
|
7
|
+
<PIcon source="ArrowLeftMinor"/>
|
|
8
|
+
</button>
|
|
9
|
+
<div v-if="label" class="Polaris-Pagination__Label">
|
|
10
|
+
<PTextStyle v-if="hasNext && hasPrevious">{{ label }}</PTextStyle>
|
|
11
|
+
<PTextStyle v-else variation="subdued">{{ label }}</PTextStyle>
|
|
12
|
+
</div>
|
|
13
|
+
<PUnstyledLink v-if="nextURL" :class="nextClassName" :url="nextURL">
|
|
14
|
+
<PIcon source="ArrowRightMinor"/>
|
|
15
|
+
</PUnstyledLink>
|
|
16
|
+
<button v-else type="button" :class="nextClassName" :disabled="!hasNext" @click="onNext()">
|
|
17
|
+
<PIcon source="ArrowRightMinor"/>
|
|
18
|
+
</button>
|
|
19
|
+
</nav>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { classNames } from '../../utilities/css';
|
|
24
|
+
import { PUnstyledLink } from '../../components/PUnstyledLink';
|
|
25
|
+
import { PIcon } from '../../components/PIcon';
|
|
26
|
+
import { PTextStyle } from '../../components/PTextStyle';
|
|
27
|
+
|
|
28
|
+
export const PPaginationDescriptor = {
|
|
29
|
+
nextTooltip: String,
|
|
30
|
+
previousTooltip: String,
|
|
31
|
+
nextURL: String,
|
|
32
|
+
previousURL: String,
|
|
33
|
+
hasNext: Boolean,
|
|
34
|
+
hasPrevious: Boolean,
|
|
35
|
+
accessibilityLabel: String,
|
|
36
|
+
|
|
37
|
+
onNext: Function,
|
|
38
|
+
onPrevious: Function,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* <br/>
|
|
43
|
+
* <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
|
|
44
|
+
* sans-serif;">Use pagination to let merchants move through an ordered collection of items that have been split
|
|
45
|
+
* into pages. On the web, pagination uses buttons to move back and forth between pages. On iOS and Android,
|
|
46
|
+
* pagination uses infinite scrolling.</h4>
|
|
47
|
+
*/
|
|
48
|
+
export default {
|
|
49
|
+
name: 'PPagination',
|
|
50
|
+
components: {
|
|
51
|
+
PUnstyledLink, PIcon, PTextStyle,
|
|
52
|
+
},
|
|
53
|
+
props: {
|
|
54
|
+
/**
|
|
55
|
+
* The URL of the next page
|
|
56
|
+
*/
|
|
57
|
+
nextURL: {
|
|
58
|
+
type: String,
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* Keyboard shortcuts for the previous button
|
|
62
|
+
*/
|
|
63
|
+
previousURL: {
|
|
64
|
+
type: String,
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* Text to provide more context in between the arrow buttons
|
|
68
|
+
*/
|
|
69
|
+
label: {
|
|
70
|
+
type: String,
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Whether there is a next page to show
|
|
74
|
+
*/
|
|
75
|
+
hasNext: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* Whether there is a previous page to show
|
|
80
|
+
*/
|
|
81
|
+
hasPrevious: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Callback when previous button is clicked
|
|
86
|
+
*/
|
|
87
|
+
onPrevious: {
|
|
88
|
+
type: Function,
|
|
89
|
+
default: null,
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Callback when next button is clicked
|
|
93
|
+
*/
|
|
94
|
+
onNext: {
|
|
95
|
+
type: Function,
|
|
96
|
+
default: null,
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
computed: {
|
|
100
|
+
className() {
|
|
101
|
+
return classNames(
|
|
102
|
+
'Polaris-Pagination',
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
previousClassName() {
|
|
106
|
+
return classNames(
|
|
107
|
+
'Polaris-Pagination__Button',
|
|
108
|
+
!this.label && 'Polaris-Pagination__PreviousButton',
|
|
109
|
+
);
|
|
110
|
+
},
|
|
111
|
+
nextClassName() {
|
|
112
|
+
return classNames(
|
|
113
|
+
'Polaris-Pagination__Button',
|
|
114
|
+
!this.label && 'Polaris-Pagination__NextButton',
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
</script>
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="container" :id="activatorId">
|
|
3
|
+
<!-- @slot Filter Activator content -->
|
|
4
|
+
<slot name="activator" :activate="onActivate"></slot>
|
|
5
|
+
|
|
6
|
+
<PPopoverOverlay
|
|
7
|
+
:id="realId+'Overlay'"
|
|
8
|
+
:active="activeStatus"
|
|
9
|
+
:activatorId="activatorId"
|
|
10
|
+
:preferredPosition="preferredPosition"
|
|
11
|
+
:preferredAlignment="preferredAlignment"
|
|
12
|
+
:fullWidth="fullWidth"
|
|
13
|
+
@close="onClose">
|
|
14
|
+
<template v-slot:overlay="props">
|
|
15
|
+
<div :class="className" :ref="`content-${id}`">
|
|
16
|
+
<div v-if="!props.data.measuring"
|
|
17
|
+
:style="{ left: props.data.tipPosition+'px' }"
|
|
18
|
+
class="Polaris-Popover__Tip">
|
|
19
|
+
</div>
|
|
20
|
+
<div class="Polaris-Popover__FocusTracker"
|
|
21
|
+
@focus="handleFocusFirstItem"
|
|
22
|
+
tabindex="0">
|
|
23
|
+
</div>
|
|
24
|
+
<div class="Polaris-Popover__Wrapper">
|
|
25
|
+
<div :class="contentClassName">
|
|
26
|
+
<div class="Polaris-Popover__Pane Polaris-Scrollable Polaris-Scrollable--vertical"
|
|
27
|
+
data-polaris-scrollable="true">
|
|
28
|
+
<!-- @slot Popover Overlay content -->
|
|
29
|
+
<slot name="content"></slot>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="Polaris-Popover__FocusTracker"
|
|
34
|
+
@focus="handleFocusLastItem"
|
|
35
|
+
tabindex="0">
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
</PPopoverOverlay>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
import { classNames } from '../../utilities/css';
|
|
46
|
+
import { PPopoverOverlay } from '../../components/PPopover/components/PPopoverOverlay';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* <br/>
|
|
50
|
+
* <h4 style={{fontFamily: '-apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto,
|
|
51
|
+
* Helvetica Neue, sans-serif'}}>
|
|
52
|
+
* Popovers are small overlays that open on demand. They let merchants access additional content and actions without
|
|
53
|
+
* cluttering the page.</h4>
|
|
54
|
+
*/
|
|
55
|
+
export default {
|
|
56
|
+
name: 'PPopover',
|
|
57
|
+
components: {
|
|
58
|
+
PPopoverOverlay,
|
|
59
|
+
},
|
|
60
|
+
props: {
|
|
61
|
+
/**
|
|
62
|
+
* Id for the PPopover.
|
|
63
|
+
*/
|
|
64
|
+
id: {
|
|
65
|
+
type: [String, Number],
|
|
66
|
+
required: true,
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Show or hide the PPopover.
|
|
70
|
+
*/
|
|
71
|
+
active: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: true,
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* Preferred Position.
|
|
77
|
+
*/
|
|
78
|
+
preferredPosition: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: 'below',
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* Preferred Alignment.
|
|
84
|
+
*/
|
|
85
|
+
preferredAlignment: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: 'center',
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* The element type to wrap the activator with.
|
|
91
|
+
*/
|
|
92
|
+
activatorWrapper: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: null,
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* Prevent auto focus on the activator.
|
|
98
|
+
*/
|
|
99
|
+
preventAutoFocus: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false,
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* Automatically add wrap content in section.
|
|
105
|
+
*/
|
|
106
|
+
sectioned: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: false,
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* Allow PPopover to stretch to the full width of its activator.
|
|
112
|
+
*/
|
|
113
|
+
fullWidth: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: false,
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* Allow popover to stretch to fit content vertically.
|
|
119
|
+
*/
|
|
120
|
+
fullHeight: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: false,
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Allow popover content to determine the overlay width and height.
|
|
126
|
+
*/
|
|
127
|
+
fluidContent: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false,
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* Enable measure.
|
|
133
|
+
*/
|
|
134
|
+
measuring: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: false,
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Enable positioning.
|
|
140
|
+
*/
|
|
141
|
+
positioning: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
default: false,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
data() {
|
|
147
|
+
return {
|
|
148
|
+
isAppended: false,
|
|
149
|
+
activeStatus: this.active,
|
|
150
|
+
container: HTMLElement,
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
computed: {
|
|
154
|
+
className() {
|
|
155
|
+
return classNames(
|
|
156
|
+
'Polaris-Popover',
|
|
157
|
+
this.fullWidth && 'Polaris-Popover--fullWidth',
|
|
158
|
+
this.measuring && 'Polaris-Popover--measuring',
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
contentClassName() {
|
|
162
|
+
return classNames(
|
|
163
|
+
'Polaris-Popover__Content',
|
|
164
|
+
this.fullHeight && 'Polaris-Popover__Content--fullHeight',
|
|
165
|
+
this.fluidContent && 'Polaris-Popover__Content--fluidContent',
|
|
166
|
+
);
|
|
167
|
+
},
|
|
168
|
+
realId() {
|
|
169
|
+
return 'PolarisPopover' + this.id;
|
|
170
|
+
},
|
|
171
|
+
activatorId() {
|
|
172
|
+
return this.realId + 'Activator';
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
methods: {
|
|
176
|
+
findActivator() {
|
|
177
|
+
return document.getElementById(this.activatorId);
|
|
178
|
+
},
|
|
179
|
+
handleKeyPress(e) {
|
|
180
|
+
if (e.keyCode !== 27) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (this.active) {
|
|
184
|
+
/** @ignore */
|
|
185
|
+
this.$emit('update:active', false);
|
|
186
|
+
/**
|
|
187
|
+
* Close filter menu when EscapeKey is pressed
|
|
188
|
+
*/
|
|
189
|
+
this.$emit('close', 'EscapeKeypress');
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
handlePageClick(e) {
|
|
193
|
+
const target = e.target;
|
|
194
|
+
const contentNode = this.$refs['content-' + this.id];
|
|
195
|
+
if ((contentNode != null && this.nodeContainsDescendant(contentNode, target)) ||
|
|
196
|
+
this.nodeContainsDescendant(this.findActivator(), target) || !this.activeStatus) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (this.active) {
|
|
200
|
+
/**
|
|
201
|
+
* Close filter menu when page is clicked
|
|
202
|
+
*/
|
|
203
|
+
this.$emit('close', 'Click');
|
|
204
|
+
/** @ignore */
|
|
205
|
+
this.$emit('update:active', false);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
nodeContainsDescendant(haystack, needle) {
|
|
209
|
+
if (haystack === needle) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
let parent = needle.parentNode;
|
|
213
|
+
while (parent != null) {
|
|
214
|
+
if (parent === haystack) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
parent = parent.parentNode;
|
|
218
|
+
}
|
|
219
|
+
return false;
|
|
220
|
+
},
|
|
221
|
+
onActivate() {
|
|
222
|
+
/**
|
|
223
|
+
* Activate method
|
|
224
|
+
*/
|
|
225
|
+
this.$emit('activate');
|
|
226
|
+
},
|
|
227
|
+
handleFocusFirstItem() {
|
|
228
|
+
this.$emit('close', 'FocusOut');
|
|
229
|
+
/** @ignore */
|
|
230
|
+
this.$emit('update:active', false);
|
|
231
|
+
},
|
|
232
|
+
handleFocusLastItem() {
|
|
233
|
+
this.$emit('close', 'FocusOut');
|
|
234
|
+
/** @ignore */
|
|
235
|
+
this.$emit('update:active', false);
|
|
236
|
+
},
|
|
237
|
+
onClose(event) {
|
|
238
|
+
this.$emit('close', 'Click');
|
|
239
|
+
/** @ignore */
|
|
240
|
+
this.$emit('update:active', false);
|
|
241
|
+
if (event && event.target) {
|
|
242
|
+
const target = event.target;
|
|
243
|
+
const contentNode = this.$refs['content-' + this.id];
|
|
244
|
+
if (!this.findActivator()) {
|
|
245
|
+
const popoverOverlay = document.getElementById(this.realId + 'Overlay');
|
|
246
|
+
if (popoverOverlay) {
|
|
247
|
+
popoverOverlay.remove();
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
if ((contentNode != null && this.nodeContainsDescendant(contentNode, target)) ||
|
|
251
|
+
this.nodeContainsDescendant(this.findActivator(), target) || !this.active) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
watch: {
|
|
259
|
+
active(value, oldValue) {
|
|
260
|
+
this.activeStatus = value;
|
|
261
|
+
if (value) {
|
|
262
|
+
const popoverOverlay = document.getElementById(this.realId + 'Overlay');
|
|
263
|
+
if (popoverOverlay) {
|
|
264
|
+
const rootElement = document.body;
|
|
265
|
+
rootElement.append(popoverOverlay);
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
const popoverOverlay = document.getElementById(this.realId + 'Overlay');
|
|
269
|
+
if (popoverOverlay) {
|
|
270
|
+
const rootElement = this.$refs.container;
|
|
271
|
+
rootElement.append(popoverOverlay);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
mounted() {
|
|
277
|
+
// if (this.$refs.container['firstElementChild'] !== null) {
|
|
278
|
+
// document.getElementById('popover-container').setAttribute('id', this.activatorId);
|
|
279
|
+
// }
|
|
280
|
+
window.addEventListener('click', this.handlePageClick);
|
|
281
|
+
window.addEventListener('touchstart', this.handlePageClick);
|
|
282
|
+
document.addEventListener('keyup', this.handleKeyPress);
|
|
283
|
+
},
|
|
284
|
+
beforeDestroy() {
|
|
285
|
+
if (this.isAppended) {
|
|
286
|
+
const popoverOverlay = document.getElementById(this.realId + 'Overlay');
|
|
287
|
+
if (popoverOverlay) {
|
|
288
|
+
popoverOverlay.remove();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
destroyed() {
|
|
293
|
+
window.removeEventListener('click', this.handlePageClick);
|
|
294
|
+
window.removeEventListener('touchstart', this.handlePageClick);
|
|
295
|
+
window.removeEventListener('keyup', this.handleKeyPress);
|
|
296
|
+
},
|
|
297
|
+
}
|
|
298
|
+
</script>
|