@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.
Files changed (75) hide show
  1. package/dist/app-manager-vue.esm.js +39044 -15119
  2. package/dist/app-manager-vue.min.js +9 -2
  3. package/dist/app-manager-vue.ssr.js +37559 -15018
  4. package/dist/hulkapps-app-manager.css +13284 -0
  5. package/dist/hulkapps-app-manager.min.css +1 -0
  6. package/package.json +9 -4
  7. package/src/components/Marketing/Banners.vue +43 -40
  8. package/src/components/Plans/AppManagerPlan.vue +518 -0
  9. package/src/components/Plans/PlanBanners.vue +50 -0
  10. package/src/components/Plans/YearlyPlanPromotion.vue +40 -0
  11. package/src/components/polaris-vue/src/components/PActionList/PActionList.vue +68 -0
  12. package/src/components/polaris-vue/src/components/PActionList/components/PActionListItem/PActionListItem.vue +91 -0
  13. package/src/components/polaris-vue/src/components/PActionList/components/PActionListSection/PActionListSection.vue +68 -0
  14. package/src/components/polaris-vue/src/components/PActionMenu/PActionMenu.vue +54 -0
  15. package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuActions/PActionMenuActions.vue +197 -0
  16. package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuMenuAction/PActionMenuMenuAction.vue +97 -0
  17. package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuMenuGroup/PActionMenuMenuGroup.vue +54 -0
  18. package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuRollupActions/PActionMenuRollupActions.vue +43 -0
  19. package/src/components/polaris-vue/src/components/PAvatar/PAvatar.vue +104 -0
  20. package/src/components/polaris-vue/src/components/PBadge/PBadge.vue +86 -0
  21. package/src/components/polaris-vue/src/components/PBanner/PBanner.vue +132 -0
  22. package/src/components/polaris-vue/src/components/PBreadcrumbs/PBreadcrumbs.vue +99 -0
  23. package/src/components/polaris-vue/src/components/PButton/PButton.vue +396 -0
  24. package/src/components/polaris-vue/src/components/PButton/components/PButtonsFrom/PButtonsFrom.vue +47 -0
  25. package/src/components/polaris-vue/src/components/PButton/components/PUnstyledButton/PUnstyledButton.vue +340 -0
  26. package/src/components/polaris-vue/src/components/PButtonGroup/PButtonGroup.vue +76 -0
  27. package/src/components/polaris-vue/src/components/PButtonGroup/components/PButtonGroupItem/PButtonGroupItem.vue +11 -0
  28. package/src/components/polaris-vue/src/components/PCaption/PCaption.vue +29 -0
  29. package/src/components/polaris-vue/src/components/PCard/PCard.vue +118 -0
  30. package/src/components/polaris-vue/src/components/PCard/components/PCardFooter/PCardFooter.vue +11 -0
  31. package/src/components/polaris-vue/src/components/PCard/components/PCardHeader/PCardHeader.vue +69 -0
  32. package/src/components/polaris-vue/src/components/PCard/components/PCardSection/PCardSection.vue +54 -0
  33. package/src/components/polaris-vue/src/components/PCard/components/PCardSubsection/PCardSubsection.vue +12 -0
  34. package/src/components/polaris-vue/src/components/PConnected/PConnected.vue +44 -0
  35. package/src/components/polaris-vue/src/components/PConnected/components/PConnectedItem/PConnectedItem.vue +41 -0
  36. package/src/components/polaris-vue/src/components/PDataTable/PDataTable.vue +541 -0
  37. package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableCell/PDataTableCell.vue +213 -0
  38. package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableCellNew/PDataTableCellNew.vue +162 -0
  39. package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableCol/PDataTableCol.vue +75 -0
  40. package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableRow/PDataTableRow.vue +15 -0
  41. package/src/components/polaris-vue/src/components/PDisplayText/PDisplayText.vue +56 -0
  42. package/src/components/polaris-vue/src/components/PEmptyState/PEmptyState.vue +154 -0
  43. package/src/components/polaris-vue/src/components/PFieldError/PFieldError.vue +41 -0
  44. package/src/components/polaris-vue/src/components/PFilter/PFilter.vue +252 -0
  45. package/src/components/polaris-vue/src/components/PFilter/components/PFilterItem/PFilterItem.vue +11 -0
  46. package/src/components/polaris-vue/src/components/PFilter/components/PFilterItemWrapper/PFilterItemWrapper.vue +32 -0
  47. package/src/components/polaris-vue/src/components/PHeading/PHeading.vue +33 -0
  48. package/src/components/polaris-vue/src/components/PIcon/PIcon.vue +121 -0
  49. package/src/components/polaris-vue/src/components/PIcon/ShopifyIcons.vue +217 -0
  50. package/src/components/polaris-vue/src/components/PImage/PImage.vue +49 -0
  51. package/src/components/polaris-vue/src/components/PLayout/PLayout.vue +42 -0
  52. package/src/components/polaris-vue/src/components/PLayout/components/PLayoutSection/PLayoutSection.vue +55 -0
  53. package/src/components/polaris-vue/src/components/PLink/PLink.vue +90 -0
  54. package/src/components/polaris-vue/src/components/POptionalTag/POptionalTag.vue +23 -0
  55. package/src/components/polaris-vue/src/components/PPage/PPage.vue +136 -0
  56. package/src/components/polaris-vue/src/components/PPage/components/PPageHeader/PPageHeader.vue +191 -0
  57. package/src/components/polaris-vue/src/components/PPage/components/PPageHeaderTitle/PPageHeaderTitle.vue +63 -0
  58. package/src/components/polaris-vue/src/components/PPagination/PPagination.vue +119 -0
  59. package/src/components/polaris-vue/src/components/PPopover/PPopover.vue +298 -0
  60. package/src/components/polaris-vue/src/components/PPopover/components/PPopoverOverlay/PPopoverOverlay.vue +66 -0
  61. package/src/components/polaris-vue/src/components/PPopover/components/PPositionedOverlay/PPositionedOverlay.vue +289 -0
  62. package/src/components/polaris-vue/src/components/PSpinner/PSpinner.vue +60 -0
  63. package/src/components/polaris-vue/src/components/PStack/PStack.vue +84 -0
  64. package/src/components/polaris-vue/src/components/PStack/components/PStackItem/PStackItem.vue +49 -0
  65. package/src/components/polaris-vue/src/components/PSubheading/PSubheading.vue +36 -0
  66. package/src/components/polaris-vue/src/components/PTag/PTag.vue +89 -0
  67. package/src/components/polaris-vue/src/components/PTextContainer/PTextContainer.vue +41 -0
  68. package/src/components/polaris-vue/src/components/PTextField/PTextField.vue +229 -0
  69. package/src/components/polaris-vue/src/components/PTextField/components/PFieldResizer/PFieldResizer.vue +79 -0
  70. package/src/components/polaris-vue/src/components/PTextField/components/PInput/PInput.vue +473 -0
  71. package/src/components/polaris-vue/src/components/PTextField/components/PSpinner/PSpinner.vue +47 -0
  72. package/src/components/polaris-vue/src/components/PTextStyle/PTextStyle.vue +60 -0
  73. package/src/components/polaris-vue/src/components/PThumbnail/PThumbnail.vue +71 -0
  74. package/src/components/polaris-vue/src/components/PToggle/PToggle.vue +81 -0
  75. package/src/components/polaris-vue/src/components/PUnstyledLink/PUnstyledLink.vue +67 -0
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <PPositionedOverlay
3
+ :id="id"
4
+ :fullWidth="fullWidth"
5
+ :active="active"
6
+ :preferredPosition="preferredPosition"
7
+ :preferredAlignment="preferredAlignment"
8
+ :activatorId="activatorId"
9
+ @scrollout="handleScrollOut"
10
+ >
11
+ <template
12
+ slot="overlay"
13
+ slot-scope="props"
14
+ >
15
+ <slot
16
+ name="overlay"
17
+ :data="props"
18
+ />
19
+ </template>
20
+ </PPositionedOverlay>
21
+ </template>
22
+
23
+ <script>
24
+ import { PPositionedOverlay } from '../../../../components/PPopover/components/PPositionedOverlay';
25
+
26
+ export default {
27
+ name: 'PPopoverOverlay',
28
+ components: {
29
+ PPositionedOverlay,
30
+ },
31
+ props: {
32
+ id: {
33
+ type: [String, Number],
34
+ },
35
+ active: {
36
+ type: Boolean,
37
+ },
38
+ preventAutoFocus: {
39
+ type: Boolean,
40
+ },
41
+ preferredAlignment: {
42
+ type: String,
43
+ },
44
+ preferredPosition: {
45
+ type: String,
46
+ },
47
+ sectioned: {
48
+ type: Boolean,
49
+ },
50
+ fullWidth: {
51
+ type: Boolean,
52
+ },
53
+ activatorId: {
54
+ type: String,
55
+ },
56
+ },
57
+ methods: {
58
+ handleScrollOut() {
59
+ this.$emit('scrollout');
60
+ }
61
+ },
62
+ beforeDestroy() {
63
+ this.$emit('close');
64
+ }
65
+ }
66
+ </script>
@@ -0,0 +1,289 @@
1
+ <template>
2
+ <div
3
+ :id="id"
4
+ class="Polaris-PositionedOverlay"
5
+ :style="containerStyle"
6
+ v-show="active"
7
+ ref="overlay">
8
+ <slot
9
+ name="overlay"
10
+ :measuring="measuring"
11
+ :left="left"
12
+ :right="right"
13
+ :desired-height="height"
14
+ :positioning="positioning"
15
+ :tip-position="tipPosition"
16
+ />
17
+ </div>
18
+ </template>
19
+
20
+
21
+ <script>
22
+ export default {
23
+ name: 'PPositionedOverlay',
24
+ props: {
25
+ id: {
26
+ type: [String, Number],
27
+ },
28
+ active: {
29
+ type: Boolean,
30
+ },
31
+ preferredPosition: {
32
+ type: String,
33
+ },
34
+ preferredAlignment: {
35
+ type: String, // right, left, center
36
+ },
37
+ activatorId: {
38
+ type: String,
39
+ },
40
+ fullWidth: {
41
+ type: Boolean,
42
+ },
43
+ activator: {
44
+ type: [String, Number, Boolean, Array, Object],
45
+ },
46
+ scrollableElement: {
47
+ type: [String, Number, Boolean, Array, Object],
48
+ },
49
+ },
50
+ data() {
51
+ return {
52
+ measuring: true,
53
+ left: NaN,
54
+ right: NaN,
55
+ top: NaN,
56
+ height: NaN,
57
+ width: null,
58
+ positioning: 'below',
59
+ zIndex: null,
60
+ outsideScrollableContainer: false,
61
+ tipPosition: null,
62
+ overlay: null,
63
+ };
64
+ },
65
+ computed: {
66
+ containerStyle() {
67
+ return {
68
+ top: this.top == null || isNaN(this.top) ? undefined : this.top + 'px',
69
+ left: this.left == null || isNaN(this.left) ? undefined : this.left + 'px',
70
+ right: this.right == null || isNaN(this.right) ? undefined : this.right + 'px',
71
+ width: this.width ? (typeof this.width === 'number' ? this.width + 'px' : this.width) : undefined,
72
+ zIndex: this.zIndex == null ? undefined : this.zIndex,
73
+ };
74
+ },
75
+ scrollableContainer() {
76
+ const selector = '.Polaris-Scrollable';
77
+ let closest = null;
78
+ if (this.activator.closest) {
79
+ closest = this.activator.closest(selector);
80
+ } else {
81
+ const matches = document.querySelectorAll(selector);
82
+ let i;
83
+ let el = this.activator;
84
+ do {
85
+ el = el.parentElement;
86
+ i = matches.length;
87
+ } while ((i < 0) && el);
88
+ closest = el;
89
+ }
90
+
91
+ return closest || document;
92
+ },
93
+ },
94
+ methods: {
95
+ handleMeasurement() {
96
+ const activator = document.getElementById(this.activatorId);
97
+ if (!activator) {
98
+ return;
99
+ }
100
+ const activatorRect = activator.getBoundingClientRect();
101
+
102
+ const scrollableElement = (!this.scrollableElement || this.scrollableElement === document) ?
103
+ document.body : this.scrollableElement;
104
+ let scrollableContainerRect = scrollableElement.getBoundingClientRect();
105
+
106
+ const overlayRect = this.getBoundingClientRect(this.overlay);
107
+ if (this.fullWidth) {
108
+ overlayRect.width = activatorRect.width;
109
+ }
110
+
111
+ if (scrollableElement === document.body) {
112
+ scrollableContainerRect = {
113
+ height: document.body.scrollHeight,
114
+ width: scrollableContainerRect.width,
115
+ top: scrollableContainerRect.top,
116
+ bottom: scrollableContainerRect.bottom,
117
+ };
118
+ }
119
+
120
+ const overlayMargins = this.overlay && this.overlay.firstElementChild
121
+ ? this.getMarginsForNode(this.overlay.firstElementChild)
122
+ : {activator: 0, container: 0, horizontal: 0};
123
+
124
+ const containerRect = {
125
+ top: window.scrollY,
126
+ left: window.scrollX,
127
+ height: window.innerHeight,
128
+ width: window.innerWidth,
129
+ };
130
+
131
+ const zIndexForLayer = 400;
132
+ const verticalPosition = this.calculateVerticalPosition(activatorRect,
133
+ overlayRect,
134
+ overlayMargins,
135
+ scrollableContainerRect,
136
+ containerRect,
137
+ this.preferredPosition);
138
+ const horizontalPosition = this.calculateHorizontalPosition(
139
+ activatorRect,
140
+ overlayRect,
141
+ containerRect,
142
+ overlayMargins,
143
+ this.preferredAlignment,
144
+ );
145
+ this.measuring = false;
146
+ // this.left = horizontalPosition;
147
+ this.left = this.preferredAlignment !== 'right' ? horizontalPosition : undefined;
148
+ this.right = this.preferredAlignment === 'right' ? horizontalPosition : undefined;
149
+ this.top = verticalPosition.top;
150
+ this.height = verticalPosition.height;
151
+ this.width = this.fullWidth ? 'max-content' : null;
152
+ this.positioning = verticalPosition.positioning;
153
+ this.zIndex = zIndexForLayer;
154
+ this.tipPosition = activatorRect.left + (activatorRect.width / 2) - parseFloat(String(this.left));
155
+ },
156
+ getMarginsForNode(node) {
157
+ const styles = window.getComputedStyle(node);
158
+ return {
159
+ activator: parseFloat(styles.marginTop || ''),
160
+ container: parseFloat(styles.marginBottom || ''),
161
+ horizontal: parseFloat(styles.marginLeft || ''),
162
+ };
163
+ },
164
+ calculateHorizontalPosition(activatorRect, overlayRect, containerRect, overlayMargins, preferredAlignment) {
165
+ const maximum = containerRect.width - overlayRect.width;
166
+
167
+ if (preferredAlignment === 'left') {
168
+ return Math.min(
169
+ maximum,
170
+ Math.max(0, activatorRect.left - overlayMargins.horizontal),
171
+ );
172
+ } else if (preferredAlignment === 'right') {
173
+ const activatorRight =
174
+ containerRect.width - (activatorRect.left + activatorRect.width);
175
+
176
+ return Math.min(
177
+ maximum,
178
+ Math.max(0, activatorRight - overlayMargins.horizontal),
179
+ );
180
+ }
181
+
182
+ const center = {
183
+ x: activatorRect.left + (activatorRect.width / 2),
184
+ y: activatorRect.top + (activatorRect.height / 2),
185
+ };
186
+ return Math.min(
187
+ maximum,
188
+ Math.max(0, center.x - overlayRect.width / 2),
189
+ );
190
+ },
191
+ calculateVerticalPosition(activatorRect,
192
+ overlayRect,
193
+ overlayMargins,
194
+ scrollableContainerRect,
195
+ containerRect,
196
+ preferredPosition) {
197
+ const activatorTop = activatorRect.top;
198
+ const activatorBottom = activatorTop + activatorRect.height;
199
+ const spaceAbove = activatorRect.top;
200
+ const spaceBelow = containerRect.height - activatorRect.top - activatorRect.height;
201
+
202
+ const desiredHeight = overlayRect.height;
203
+ const verticalMargins = overlayMargins.activator + overlayMargins.container;
204
+ const minimumSpaceToScroll = overlayMargins.container;
205
+ const distanceToTopScroll = activatorRect.top - Math.max(scrollableContainerRect.top, 0);
206
+ const distanceToBottomScroll = containerRect.top
207
+ + Math.min(containerRect.height, scrollableContainerRect.top + scrollableContainerRect.height)
208
+ - (activatorRect.top + activatorRect.height);
209
+
210
+ const enoughSpaceFromTopScroll = distanceToTopScroll >= minimumSpaceToScroll;
211
+ const enoughSpaceFromBottomScroll = distanceToBottomScroll >= minimumSpaceToScroll;
212
+
213
+ const heightIfBelow = Math.min(spaceBelow, desiredHeight);
214
+ const heightIfAbove = Math.min(spaceAbove, desiredHeight);
215
+
216
+ const positionIfAbove = {
217
+ height: heightIfAbove - verticalMargins,
218
+ top: activatorTop + containerRect.top - heightIfAbove,
219
+ positioning: 'above',
220
+ };
221
+
222
+ const positionIfBelow = {
223
+ height: heightIfBelow - verticalMargins,
224
+ top: activatorBottom + containerRect.top,
225
+ positioning: 'below',
226
+ };
227
+
228
+ if (preferredPosition === 'above') {
229
+ return ((enoughSpaceFromTopScroll ||
230
+ (distanceToTopScroll >= distanceToBottomScroll && !enoughSpaceFromBottomScroll)) &&
231
+ (spaceAbove > desiredHeight || spaceAbove > spaceBelow))
232
+ ? positionIfAbove
233
+ : positionIfBelow;
234
+ }
235
+
236
+ if (preferredPosition === 'below') {
237
+ return ((enoughSpaceFromBottomScroll ||
238
+ (distanceToBottomScroll >= distanceToTopScroll && !enoughSpaceFromTopScroll)) &&
239
+ (spaceBelow > desiredHeight || spaceBelow > spaceAbove))
240
+ ? positionIfBelow
241
+ : positionIfAbove;
242
+ }
243
+
244
+ if (enoughSpaceFromTopScroll && enoughSpaceFromBottomScroll) {
245
+ return spaceAbove > spaceBelow
246
+ ? positionIfAbove
247
+ : positionIfBelow;
248
+ }
249
+
250
+ return distanceToTopScroll > minimumSpaceToScroll
251
+ ? positionIfAbove
252
+ : positionIfBelow;
253
+ },
254
+ getBoundingClientRect(element) {
255
+ if (!element) {
256
+ return {};
257
+ }
258
+ const rect = element.getBoundingClientRect();
259
+ return {
260
+ top: rect.top,
261
+ right: rect.right,
262
+ bottom: rect.bottom,
263
+ left: rect.left,
264
+ width: rect.width,
265
+ height: rect.height,
266
+ };
267
+ },
268
+ },
269
+ watch: {
270
+ active: function (val, oldVal) {
271
+ this.$nextTick(this.handleMeasurement);
272
+ setTimeout(this.handleMeasurement, 500);
273
+ },
274
+ },
275
+ mounted() {
276
+ window.addEventListener('resize', this.handleMeasurement);
277
+ window.addEventListener('scroll', this.handleMeasurement);
278
+ this.overlay = this.$refs.overlay;
279
+ this.handleMeasurement();
280
+ },
281
+ updated() {
282
+ this.overlay = this.$refs.overlay;
283
+ },
284
+ destroyed() {
285
+ window.removeEventListener('resize', this.handleMeasurement);
286
+ window.removeEventListener('scroll', this.handleMeasurement);
287
+ },
288
+ }
289
+ </script>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <img :src="`data:image/svg+xml;utf8,${spinnerSVG}`" :class="className" alt="">
3
+ </template>
4
+
5
+ <script>
6
+ import { classNames, variationName } from '../../utilities/css';
7
+ import { encode as encodeSVG } from '../../utilities/svg';
8
+ import { spinnerLarge, spinnerSmall } from './images';
9
+ import StringValidator from '../../utilities/validators/StringValidator';
10
+
11
+ const Color = ['white', 'teal', 'inkLightest'];
12
+ const Size = ['small', 'large'];
13
+
14
+ const COLORS_FOR_LARGE_SPINNER = ['teal', 'inkLightest'];
15
+
16
+ /**
17
+ * <br/>
18
+ * <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
19
+ * sans-serif;">Spinners are used to notify merchants that their action is being processed. For loading states,
20
+ * spinners should only be used for content that can’t be represented with skeleton loading components, like for data
21
+ * charts.</h4>
22
+ */
23
+ export default {
24
+ name: 'PSpinner',
25
+ props: {
26
+ /**
27
+ * Color for spinner.
28
+ */
29
+ color: {
30
+ type: String,
31
+ default: 'teal',
32
+ ...StringValidator('color', Color)
33
+ },
34
+ /**
35
+ * Size of spinner.
36
+ */
37
+ size: {
38
+ type: String,
39
+ default: 'large',
40
+ ...StringValidator('size', Size)
41
+ }
42
+ },
43
+ computed: {
44
+ className() {
45
+ return classNames(
46
+ 'Polaris-Spinner',
47
+ this.color && `Polaris-Spinner--${variationName('color', this.color)}`,
48
+ this.size && `Polaris-Spinner--${variationName('size', this.size)}`,
49
+ );
50
+ },
51
+ spinnerSVG() {
52
+ const svg = this.size === 'large' ? spinnerLarge : spinnerSmall;
53
+ if(typeof svg === 'string') {
54
+ return encodeSVG(svg);
55
+ }
56
+ }
57
+ },
58
+
59
+ }
60
+ </script>
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <div :class="className">
3
+ <!-- @slot Elements to display inside stack -->
4
+ <slot/>
5
+ </div>
6
+ </template>
7
+ <script>
8
+ import { classNames, variationName } from '../../utilities/css';
9
+
10
+ /**
11
+ * @requires PStackItem
12
+ */
13
+ import { PStackItem } from './components/PStackItem';
14
+ import StringValidator from '../../utilities/validators/StringValidator';
15
+
16
+ const Spacing = ['extraTight', 'tight', 'loose', 'extraLoose', 'none'];
17
+ const Alignment = ['leading', 'trailing', 'center', 'fill', 'baseline'];
18
+ const Distribution = ['equalSpacing', 'leading', 'trailing', 'center', 'fill', 'fillEvenly'];
19
+
20
+ /**
21
+ * <br/>
22
+ * <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
23
+ * sans-serif;">Use to lay out a horizontal row of components or to achieve no-fuss vertical centering. A stack is made
24
+ * of flexible items that wrap each of the stack’s children. Options provide control of the wrapping, spacing, and
25
+ * relative size of the items in the stack.</h4>
26
+ */
27
+ export default {
28
+ name: 'PStack',
29
+ components: {
30
+ PStackItem,
31
+ },
32
+ props: {
33
+ /**
34
+ * Set it true of you need items in vertical.
35
+ */
36
+ vertical: {
37
+ type: Boolean,
38
+ },
39
+ /**
40
+ * Set it true for Word-Wrap.
41
+ */
42
+ wrap: {
43
+ type: Boolean,
44
+ default: true,
45
+ },
46
+ /**
47
+ * Space between two items.
48
+ */
49
+ spacing: {
50
+ type: String,
51
+ default: null,
52
+ ...StringValidator('spacing', Spacing),
53
+ },
54
+ /**
55
+ * Distribution of free space among items.
56
+ */
57
+ distribution: {
58
+ type: String,
59
+ default: null,
60
+ ...StringValidator('distribution', Distribution),
61
+ },
62
+ /**
63
+ * Alignment of items.
64
+ */
65
+ alignment: {
66
+ type: String,
67
+ default: null,
68
+ ...StringValidator('alignment', Alignment),
69
+ },
70
+ },
71
+ computed: {
72
+ className() {
73
+ return classNames(
74
+ 'Polaris-Stack',
75
+ this.vertical && 'Polaris-Stack--vertical',
76
+ this.spacing && `Polaris-Stack--${variationName('spacing', this.spacing)}`,
77
+ this.distribution && `Polaris-Stack--${variationName('distribution', this.distribution)}`,
78
+ this.alignment && `Polaris-Stack--${variationName('alignment', this.alignment)}`,
79
+ !this.wrap && 'Polaris-Stack--noWrap',
80
+ );
81
+ },
82
+ },
83
+ }
84
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div :class="className" v-bind:style="style">
3
+ <!-- @slot Elements to display inside stack item -->
4
+ <slot/>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ import { classNames } from '../../../../utilities/css';
10
+
11
+ /**
12
+ * <br/>
13
+ * <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
14
+ * sans-serif;">The stack component will treat multiple elements wrapped in a stack item component as one item. By
15
+ * default, each individual element is treated as one stack item. Use the fill prop on a single stack item component to
16
+ * make it fill the rest of the available horizontal space.</h4>
17
+ */
18
+ export default {
19
+ name: 'PStackItem',
20
+ props: {
21
+ /**
22
+ * Fill the available horizontal space in the stack with the item.
23
+ */
24
+ fill: {
25
+ type: Boolean,
26
+ default: false,
27
+ },
28
+ /**
29
+ * Width of Item.
30
+ */
31
+ width: {
32
+ type: [String, Number],
33
+ }
34
+ },
35
+ computed: {
36
+ className() {
37
+ return classNames(
38
+ 'Polaris-Stack__Item',
39
+ this.fill && 'Polaris-Stack__Item--fill',
40
+ );
41
+ },
42
+ style() {
43
+ if (this.width) {
44
+ return {width: /^\d+$/.test(this.width) ? this.width + 'px' : this.width};
45
+ } else { return null; }
46
+ },
47
+ },
48
+ }
49
+ </script>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <component :is="element" :class="className">
3
+ <!-- @slot Text to display in subheading -->
4
+ <slot/>
5
+ </component>
6
+ </template>
7
+
8
+ <script>
9
+ import StringValidator from '../../utilities/validators/StringValidator';
10
+
11
+ const HeadingTagName = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'];
12
+
13
+ /**
14
+ * <br/>
15
+ * <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
16
+ * sans-serif;">Subheadings are used for the title of any sub-sections in top-level page sections.</h4>
17
+ */
18
+ export default {
19
+ name: 'PSubheading',
20
+ props: {
21
+ /**
22
+ * Element for heading.
23
+ */
24
+ element: {
25
+ type: String,
26
+ default: 'h3',
27
+ ...StringValidator('element', HeadingTagName)
28
+ }
29
+ },
30
+ computed: {
31
+ className() {
32
+ return 'Polaris-Subheading';
33
+ }
34
+ }
35
+ }
36
+ </script>
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <span :class="className">
3
+ <span :title="tag.value" class="Polaris-Tag__TagText">{{tag.value}}</span>
4
+ <button
5
+ v-if="removable"
6
+ type="button"
7
+ class="Polaris-Tag__Button"
8
+ :aria-label="`Remove ${tag.value}`"
9
+ @click="handleRemove"
10
+ >
11
+ <PIcon source="CancelSmallMinor" />
12
+ </button>
13
+ </span>
14
+ </template>
15
+
16
+ <script>
17
+ import { classNames } from '../../utilities/css';
18
+ import { PIcon } from '../../components/PIcon';
19
+ import ObjectValidator from '../../utilities/validators/ObjectValidator';
20
+ import StringValidator from "../../utilities/validators/StringValidator";
21
+
22
+ const TagInterface = {
23
+ value: {
24
+ type: [String, Number],
25
+ required: true,
26
+ },
27
+ key: {
28
+ type: [String, Number],
29
+ required: true,
30
+ },
31
+ };
32
+
33
+ const Size = ['small', 'medium', null, ''];
34
+
35
+ /**
36
+ * <br/>
37
+ * <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
38
+ * sans-serif;">Tags represent a set of interactive, merchant-supplied keywords that help label, organize, and
39
+ * categorize objects. Tags can be added or removed from an object by merchants.</h4>
40
+ */
41
+ export default {
42
+ name: 'PTag',
43
+ components: {
44
+ PIcon,
45
+ },
46
+ props: {
47
+ /**
48
+ * Tag object.
49
+ */
50
+ tag: {
51
+ type: Object,
52
+ default: () => ({}),
53
+ ...ObjectValidator('tag', TagInterface),
54
+ },
55
+ /**
56
+ * Set true if you want to make it removable.
57
+ */
58
+ removable: {
59
+ type: Boolean,
60
+ default: false,
61
+ },
62
+ /**
63
+ * Changes the size of the tag
64
+ */
65
+ size: {
66
+ type: String,
67
+ default: 'medium',
68
+ ...StringValidator('size', Size),
69
+ },
70
+ },
71
+ computed: {
72
+ className() {
73
+ return classNames(
74
+ 'Polaris-Tag',
75
+ this.removable && `Polaris-Tag--removable`,
76
+ this.size === 'small' && 'Polaris-Tag--small',
77
+ );
78
+ },
79
+ },
80
+ methods: {
81
+ handleRemove() {
82
+ /**
83
+ * Method to remove tag
84
+ */
85
+ this.$emit('remove-tag', this.tag.key);
86
+ },
87
+ },
88
+ }
89
+ </script>