@hulkapps/app-manager-vue 1.0.0 → 2.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.
- package/README.md +32 -0
- package/dist/app-manager-vue.esm.js +41024 -3406
- package/dist/app-manager-vue.min.js +9 -1
- package/dist/app-manager-vue.ssr.js +39512 -3381
- package/dist/hulkapps-app-manager.css +13284 -0
- package/dist/hulkapps-app-manager.min.css +1 -0
- package/package.json +10 -5
- package/src/components/Marketing/Banners.vue +44 -44
- package/src/components/Plans/AppManagerPlan.vue +494 -0
- package/src/components/Plans/PlanBanners.vue +50 -0
- package/src/components/Plans/YearlyPlanPromotion.vue +37 -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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PPopover :id="`Popover${this['_uid']}`" :active="Boolean(active)" preferredAlignment="left" hideOnPrint @close="handleClose">
|
|
3
|
+
<PActionMenuMenuAction slot="activator" disclosure :content="title" :getOffsetWidth="getOffsetWidth" :icon="icon" :onAction="handleOpen" />
|
|
4
|
+
<PActionList slot="content" :items="actions" @item-action="handleClose" />
|
|
5
|
+
<div v-if="$slots.details" class="">
|
|
6
|
+
<slot name="details" />
|
|
7
|
+
</div>
|
|
8
|
+
</PPopover>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import {MenuGroupDescriptor, ActionListItemDescriptor} from '../../../../types';
|
|
13
|
+
import {PActionList} from '../../../../components/PActionList';
|
|
14
|
+
import {PPopover} from '../../../../components/PPopover';
|
|
15
|
+
import { PActionMenuMenuAction } from '../../../../components/PActionMenu/components/PActionMenuMenuAction';
|
|
16
|
+
import ArrayValidator from '../../../../utilities/validators/ArrayValidator';
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: 'PActionMenuMenuGroup',
|
|
20
|
+
components: {
|
|
21
|
+
PPopover, PActionList, PActionMenuMenuAction,
|
|
22
|
+
},
|
|
23
|
+
props: {
|
|
24
|
+
active: {
|
|
25
|
+
type: Boolean
|
|
26
|
+
},
|
|
27
|
+
title: {
|
|
28
|
+
type: String
|
|
29
|
+
},
|
|
30
|
+
icon: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: null,
|
|
33
|
+
},
|
|
34
|
+
onAction: {
|
|
35
|
+
type: Function,
|
|
36
|
+
},
|
|
37
|
+
getOffsetWidth: {
|
|
38
|
+
type: Function,
|
|
39
|
+
},
|
|
40
|
+
actions: {
|
|
41
|
+
type: Array,
|
|
42
|
+
...ArrayValidator('actions', ActionListItemDescriptor)
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
handleClose() {
|
|
47
|
+
this.onAction(this.title);
|
|
48
|
+
},
|
|
49
|
+
handleOpen() {
|
|
50
|
+
this.$emit('open', this.title);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PPopover :id="`Popover${this['_uid']}`" :active="rollupOpen" preferredAlignment="right" @close="toggleRollupOpen" hideOnPrint>
|
|
3
|
+
<div slot="activator" class="Polaris-ActionMenu-RollupActions__RollupActivator">
|
|
4
|
+
<PButton :plain="true" :outline="false" icon="HorizontalDotsMinor" type="button" @click="toggleRollupOpen" />
|
|
5
|
+
</div>
|
|
6
|
+
<PActionList slot="content" :items="items" :sections="sections" @item-action="toggleRollupOpen" />
|
|
7
|
+
</PPopover>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import {ActionListSection, ActionListItemDescriptor } from '../../../../types';
|
|
12
|
+
import {PPopover} from '../../../../components/PPopover';
|
|
13
|
+
import {PButton} from '../../../../components/PButton';
|
|
14
|
+
import {PActionList} from '../../../../components/PActionList';
|
|
15
|
+
import ArrayValidator from '../../../../utilities/validators/ArrayValidator';
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'PActionMenuRollupActions',
|
|
19
|
+
components: {
|
|
20
|
+
PPopover, PButton, PActionList,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
items: {
|
|
24
|
+
type: Array,
|
|
25
|
+
...ArrayValidator('items', ActionListItemDescriptor)
|
|
26
|
+
},
|
|
27
|
+
sections: {
|
|
28
|
+
type: Array,
|
|
29
|
+
...ArrayValidator('sections', ActionListSection)
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
data() {
|
|
33
|
+
return {
|
|
34
|
+
rollupOpen: false,
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
toggleRollupOpen() {
|
|
39
|
+
this.rollupOpen = !this.rollupOpen;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span role="img" :class="className">
|
|
3
|
+
<span v-if="!hasImage" class="Polaris-Avatar__Initials">
|
|
4
|
+
<svg class="Polaris-Avatar__Svg" viewBox="0 0 40 40">
|
|
5
|
+
<path v-if="customer || !initials" fill="currentColor"
|
|
6
|
+
d="M8.28 27.5A14.95 14.95 0 0120 21.8c4.76 0 8.97 2.24 11.72 5.7a14.02 14.02 0 01-8.25 5.91 14.82 14.82 0 01-6.94 0 14.02 14.02 0 01-8.25-5.9zM13.99 12.78a6.02 6.02 0 1112.03 0 6.02 6.02 0 01-12.03 0z"/>
|
|
7
|
+
<text v-else x="50%" y="50%" dy="0.35em" fill="currentColor" font-size="20"
|
|
8
|
+
text-anchor="middle">{{ initials }}</text>
|
|
9
|
+
</svg>
|
|
10
|
+
</span>
|
|
11
|
+
<PImage v-if="source && status !== 'ERRORED'" class="Polaris-Avatar__Image" :source="source" alt=""
|
|
12
|
+
role="presentation"/>
|
|
13
|
+
</span>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import { classNames, variationName } from '../../utilities/css';
|
|
18
|
+
import { PImage } from '../../components/PImage';
|
|
19
|
+
|
|
20
|
+
const Status = {
|
|
21
|
+
Pending: 'PENDING',
|
|
22
|
+
Loaded: 'LOADED',
|
|
23
|
+
Errored: 'ERRORED',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* <br/>
|
|
28
|
+
* <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
|
|
29
|
+
* sans-serif;">Avatars are used to show a thumbnail representation of an individual or business in the interface.
|
|
30
|
+
* </h4>
|
|
31
|
+
*/
|
|
32
|
+
export default {
|
|
33
|
+
name: 'PAvatar',
|
|
34
|
+
components: {
|
|
35
|
+
PImage,
|
|
36
|
+
},
|
|
37
|
+
props: {
|
|
38
|
+
/**
|
|
39
|
+
* Size of avatar
|
|
40
|
+
*/
|
|
41
|
+
size: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'medium',
|
|
44
|
+
validator: function (value) {
|
|
45
|
+
return ['small', 'medium', 'large'].indexOf(value) !== -1;
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Whether the avatar is for a customer
|
|
50
|
+
*/
|
|
51
|
+
customer: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Name for the person
|
|
57
|
+
*/
|
|
58
|
+
name: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: null,
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Initials of person to display
|
|
64
|
+
*/
|
|
65
|
+
initials: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: null,
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* URL of the avatar image which falls back to initials if the image fails to load
|
|
71
|
+
*/
|
|
72
|
+
source: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: null,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
data() {
|
|
78
|
+
return {
|
|
79
|
+
status: Status.Pending,
|
|
80
|
+
nameString: this.name || this.initials,
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
computed: {
|
|
84
|
+
className() {
|
|
85
|
+
return classNames(
|
|
86
|
+
'Polaris-Avatar',
|
|
87
|
+
this.size && `Polaris-Avatar--${variationName('size', this.size)}`,
|
|
88
|
+
!this.customer && `Polaris-Avatar--${variationName('style', this.styleClass(this.nameString))}`,
|
|
89
|
+
(this.hasImage || (this.initials && this.initials.length === 0)) && status !== Status.Loaded && 'Polaris-Avatar--hidden',
|
|
90
|
+
this.hasImage && 'Polaris-Avatar--hasImage',
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
hasImage() {
|
|
94
|
+
return this.source && this.status !== Status.Errored;
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
methods: {
|
|
98
|
+
styleClass(name) {
|
|
99
|
+
const finalStyleClasses = ['one', 'two', 'three', 'four', 'five'];
|
|
100
|
+
return name ? finalStyleClasses[name.charCodeAt(0) % finalStyleClasses.length] : finalStyleClasses[0];
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
</script>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span :class="className" :style="{'background-color': background, 'color': color}">
|
|
3
|
+
<span v-if="progress" class="Polaris-Badge__Pip">
|
|
4
|
+
<span class="Polaris-VisuallyHidden">{{ progress }}</span>
|
|
5
|
+
</span>
|
|
6
|
+
<span class="Polaris-Badge__Content">
|
|
7
|
+
<!-- @slot The content to display inside the badge -->
|
|
8
|
+
<slot/>
|
|
9
|
+
</span>
|
|
10
|
+
</span>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import { classNames, variationName } from '../../utilities/css';
|
|
15
|
+
import StringValidator from '../../utilities/validators/StringValidator';
|
|
16
|
+
|
|
17
|
+
const Status = ['success', 'info', 'attention', 'warning', 'new', 'critical', null, ''];
|
|
18
|
+
const Progress = ['incomplete', 'partiallyComplete', 'complete', null, ''];
|
|
19
|
+
const Size = ['small', 'medium'];
|
|
20
|
+
|
|
21
|
+
const DEFAULT_SIZE = 'medium';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* <br/>
|
|
25
|
+
* <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
|
|
26
|
+
* sans-serif;">Badges are used to inform merchants of the status of an object or of an action that’s been taken.
|
|
27
|
+
* </h4>
|
|
28
|
+
*/
|
|
29
|
+
export default {
|
|
30
|
+
name: 'PBadge',
|
|
31
|
+
props: {
|
|
32
|
+
/**
|
|
33
|
+
* Set the color of the badge for the given status.
|
|
34
|
+
*/
|
|
35
|
+
status: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: null,
|
|
38
|
+
...StringValidator('status', Status)
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Render a pip showing the progress of a given task.
|
|
43
|
+
*/
|
|
44
|
+
progress: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: null,
|
|
47
|
+
...StringValidator('progress', Progress)
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Set Background color.
|
|
52
|
+
*/
|
|
53
|
+
background: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: null,
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Set font color.
|
|
60
|
+
*/
|
|
61
|
+
color: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: null,
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Set size of badge.
|
|
68
|
+
*/
|
|
69
|
+
size: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: 'medium',
|
|
72
|
+
...StringValidator('size', Size)
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
computed: {
|
|
76
|
+
className() {
|
|
77
|
+
return classNames(
|
|
78
|
+
'Polaris-Badge',
|
|
79
|
+
!this.color && !this.background && this.status && `Polaris-Badge--${variationName('status', this.status)}`,
|
|
80
|
+
this.progress && `Polaris-Badge--${variationName('progress', this.progress)}`,
|
|
81
|
+
this.size && this.size !== DEFAULT_SIZE && `Polaris-Badge--${variationName('size', this.size)}`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
</script>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="className">
|
|
3
|
+
<div v-if="isDismissable" class="Polaris-Banner__Dismiss">
|
|
4
|
+
<!--
|
|
5
|
+
Triggered to dismiss the banner
|
|
6
|
+
@event dismiss
|
|
7
|
+
-->
|
|
8
|
+
<PButton
|
|
9
|
+
plain
|
|
10
|
+
icon="CancelSmallMinor"
|
|
11
|
+
@click="$emit('dismiss', $event)">
|
|
12
|
+
</PButton>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="Polaris-Banner__Ribbon">
|
|
15
|
+
<PIcon
|
|
16
|
+
:source="colorAndIcon.icon"
|
|
17
|
+
:color="colorAndIcon.color" />
|
|
18
|
+
</div>
|
|
19
|
+
<div class="Polaris-Banner__ContentWrapper">
|
|
20
|
+
<div v-if="title" class="Polaris-Banner__Heading">
|
|
21
|
+
<PHeading element="p">{{ title }}</PHeading>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="Polaris-Banner__Content">
|
|
24
|
+
<!-- @slot The content to display inside the badge -->
|
|
25
|
+
<slot/>
|
|
26
|
+
<div v-if="Object.keys(action).length > 0" class="Polaris-Banner__Actions">
|
|
27
|
+
<PButtonGroup>
|
|
28
|
+
<div class="Polaris-Banner__PrimaryAction">
|
|
29
|
+
<PButtonsFrom :actions="action" :overrides="{ outline: true }"/>
|
|
30
|
+
</div>
|
|
31
|
+
</PButtonGroup>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
import { classNames, variationName } from '../../utilities/css';
|
|
40
|
+
|
|
41
|
+
import { PIcon } from '../../components/PIcon';
|
|
42
|
+
import { PButton } from '../../components/PButton';
|
|
43
|
+
import { PHeading } from '../../components/PHeading';
|
|
44
|
+
import { PButtonGroup } from '../../components/PButtonGroup';
|
|
45
|
+
import { PButtonsFrom } from '../../components/PButton/components/PButtonsFrom';
|
|
46
|
+
|
|
47
|
+
import StringValidator from '../../utilities/validators/StringValidator';
|
|
48
|
+
|
|
49
|
+
const BannerStatus = ['success', 'info', 'warning', 'critical', null];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* <br/>
|
|
53
|
+
* <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
|
|
54
|
+
* sans-serif;">Informs merchants about important changes or persistent conditions. Use this component if you need to
|
|
55
|
+
* communicate to merchants in a prominent way. Banners are placed at the top of the page or section they apply to, and
|
|
56
|
+
* below the page or section header.</h4>
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
export default {
|
|
60
|
+
name: 'PBanner',
|
|
61
|
+
components: {
|
|
62
|
+
PIcon, PButton, PHeading, PButtonGroup, PButtonsFrom,
|
|
63
|
+
},
|
|
64
|
+
props: {
|
|
65
|
+
/**
|
|
66
|
+
* Title content for the banner.
|
|
67
|
+
*/
|
|
68
|
+
title: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: null
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Set the status of the banner
|
|
75
|
+
*/
|
|
76
|
+
status: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: null,
|
|
79
|
+
...StringValidator('status', BannerStatus)
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Action of the banner
|
|
84
|
+
*/
|
|
85
|
+
action: {
|
|
86
|
+
type: Object,
|
|
87
|
+
default: () => ({}),
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
computed: {
|
|
91
|
+
className() {
|
|
92
|
+
return classNames(
|
|
93
|
+
'Polaris-Banner',
|
|
94
|
+
'Polaris-Banner--withinPage',
|
|
95
|
+
this.isDismissable && 'Polaris-Banner--hasDismiss',
|
|
96
|
+
this.status && `Polaris-Banner--${variationName('status', this.status)}`,
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
isDismissable() {
|
|
100
|
+
return this.$listeners && this.$listeners.dismiss;
|
|
101
|
+
},
|
|
102
|
+
colorAndIcon() {
|
|
103
|
+
let color;
|
|
104
|
+
let icon;
|
|
105
|
+
|
|
106
|
+
switch (this.status) {
|
|
107
|
+
case 'success':
|
|
108
|
+
color = 'success';
|
|
109
|
+
icon = 'CircleTickMajor';
|
|
110
|
+
break;
|
|
111
|
+
case 'info':
|
|
112
|
+
color = 'highlight';
|
|
113
|
+
icon = 'CircleInformationMajor';
|
|
114
|
+
break;
|
|
115
|
+
case 'warning':
|
|
116
|
+
color = 'warning';
|
|
117
|
+
icon = 'CircleAlertMajor';
|
|
118
|
+
break;
|
|
119
|
+
case 'critical':
|
|
120
|
+
color = 'critical';
|
|
121
|
+
icon = 'DiamondAlertMajor';
|
|
122
|
+
break;
|
|
123
|
+
default:
|
|
124
|
+
color = 'base';
|
|
125
|
+
icon = 'CircleInformationMajor';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return { color, icon };
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
</script>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { classNames } from '../../utilities/css';
|
|
3
|
+
import { PUnstyledLink } from '../../components/PUnstyledLink';
|
|
4
|
+
import { PIcon } from '../../components/PIcon';
|
|
5
|
+
import ArrayValidator from '../../utilities/validators/ArrayValidator';
|
|
6
|
+
|
|
7
|
+
const PBreadcrumbsProps = {
|
|
8
|
+
content: [String, Object],
|
|
9
|
+
url: String,
|
|
10
|
+
to: [String, Object],
|
|
11
|
+
accessibilityLabel: String,
|
|
12
|
+
onAction: Function,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: 'PBreadcrumbs',
|
|
17
|
+
components: {
|
|
18
|
+
PUnstyledLink, PIcon,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
/**
|
|
22
|
+
* Collection of breadcrumbs
|
|
23
|
+
*/
|
|
24
|
+
breadcrumbs: {
|
|
25
|
+
type: Array,
|
|
26
|
+
default: () => ([]),
|
|
27
|
+
...ArrayValidator('breadcrumbs', PBreadcrumbsProps),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
render(h) {
|
|
31
|
+
const breadcrumb = this.breadcrumbs[this.breadcrumbs.length - 1];
|
|
32
|
+
if (breadcrumb == null) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const {content} = breadcrumb;
|
|
37
|
+
const {onAction} = breadcrumb;
|
|
38
|
+
|
|
39
|
+
const contentMarkup = this.$createElement('span', {
|
|
40
|
+
class: 'Polaris-Breadcrumbs__ContentWrapper',
|
|
41
|
+
}, [
|
|
42
|
+
this.$createElement('span', {
|
|
43
|
+
class: 'Polaris-Breadcrumbs__Icon',
|
|
44
|
+
}, [
|
|
45
|
+
this.$createElement(PIcon, {
|
|
46
|
+
attrs: {
|
|
47
|
+
source: 'ChevronLeftMinor',
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
]),
|
|
51
|
+
this.$createElement('span', {
|
|
52
|
+
class: 'Polaris-Breadcrumbs__Content',
|
|
53
|
+
}, content),
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
const breadcrumbClassNames = classNames(
|
|
57
|
+
'Polaris-Breadcrumbs__Breadcrumb',
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const breadcrumbMarkup =
|
|
61
|
+
'url' in breadcrumb || 'to' in breadcrumb ? (
|
|
62
|
+
this.$createElement(PUnstyledLink, {
|
|
63
|
+
class: breadcrumbClassNames,
|
|
64
|
+
attrs: {
|
|
65
|
+
key: content,
|
|
66
|
+
url: breadcrumb.url,
|
|
67
|
+
to: breadcrumb.to,
|
|
68
|
+
ariaLabel: breadcrumb.accessibilityLabel,
|
|
69
|
+
},
|
|
70
|
+
nativeOn: {
|
|
71
|
+
// tslint:disable-next-line:no-empty
|
|
72
|
+
click: onAction ? onAction : () => {
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
}, [contentMarkup])
|
|
76
|
+
) : (
|
|
77
|
+
this.$createElement('button', {
|
|
78
|
+
class: breadcrumbClassNames,
|
|
79
|
+
attrs: {
|
|
80
|
+
key: content,
|
|
81
|
+
type: 'button',
|
|
82
|
+
ariaLabel: breadcrumb.accessibilityLabel,
|
|
83
|
+
},
|
|
84
|
+
on: {
|
|
85
|
+
// tslint:disable-next-line:no-empty
|
|
86
|
+
click: onAction ? onAction : () => {
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
}, [contentMarkup])
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
return this.$createElement('nav', {
|
|
93
|
+
attrs: {
|
|
94
|
+
role: 'navigation',
|
|
95
|
+
},
|
|
96
|
+
}, [breadcrumbMarkup]);
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
</script>
|