@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
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="Object.keys(connectedDisclosure).length > 0" class="Polaris-Button__ConnectedDisclosureWrapper">
|
|
3
|
+
<PUnstyledButton
|
|
4
|
+
v-bind="$props"
|
|
5
|
+
:isConnectedDisclosure="Object.keys(connectedDisclosure).length > 0"
|
|
6
|
+
@click.stop="handleClick"
|
|
7
|
+
@focus.stop="handleFocus"
|
|
8
|
+
@blur.stop="handleBlur"
|
|
9
|
+
@keydown.stop="handleKeyDown"
|
|
10
|
+
@keypress.stop="handleKeyPress"
|
|
11
|
+
@keyup.stop="handleKeyUp"
|
|
12
|
+
>
|
|
13
|
+
<!-- @slot The content to display content inside the button -->
|
|
14
|
+
<slot/>
|
|
15
|
+
</PUnstyledButton>
|
|
16
|
+
|
|
17
|
+
<PPopover
|
|
18
|
+
id="disclosure-button"
|
|
19
|
+
:active="disclosureActive"
|
|
20
|
+
preferredAlignment="right"
|
|
21
|
+
@close="() => {this.disclosureActive = false;}"
|
|
22
|
+
>
|
|
23
|
+
<button
|
|
24
|
+
slot="activator"
|
|
25
|
+
type="button"
|
|
26
|
+
:class="connectedDisclosureClassName"
|
|
27
|
+
:disabled="disabled"
|
|
28
|
+
:aria-label="accessibilityLabel"
|
|
29
|
+
:aria-describedby="ariaDescribedBy"
|
|
30
|
+
@click="toggleDisclosureActive"
|
|
31
|
+
>
|
|
32
|
+
<span class="Polaris-Button__Icon">
|
|
33
|
+
<div :class="disclosureIconClassName">
|
|
34
|
+
<PIcon source="CaretDownMinor"/>
|
|
35
|
+
</div>
|
|
36
|
+
</span>
|
|
37
|
+
</button>
|
|
38
|
+
<PActionList
|
|
39
|
+
slot="content"
|
|
40
|
+
:items="Object.keys(connectedDisclosure).length ? connectedDisclosure.actions : []"
|
|
41
|
+
/>
|
|
42
|
+
</PPopover>
|
|
43
|
+
</div>
|
|
44
|
+
<PUnstyledButton
|
|
45
|
+
v-else
|
|
46
|
+
v-bind="$props"
|
|
47
|
+
:isConnectedDisclosure="Object.keys(connectedDisclosure).length > 0"
|
|
48
|
+
@click.stop="handleClick"
|
|
49
|
+
@focus.stop="handleFocus"
|
|
50
|
+
@blur.stop="handleBlur"
|
|
51
|
+
@keydown.stop="handleKeyDown"
|
|
52
|
+
@keypress.stop="handleKeyPress"
|
|
53
|
+
@keyup.stop="handleKeyUp"
|
|
54
|
+
>
|
|
55
|
+
<!-- @slot The content to display content inside the button -->
|
|
56
|
+
<slot/>
|
|
57
|
+
</PUnstyledButton>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
import { classNames, variationName } from '../../utilities/css';
|
|
62
|
+
import { PIcon } from '../PIcon';
|
|
63
|
+
import { PUnstyledButton } from './components/PUnstyledButton';
|
|
64
|
+
import { PPopover } from '../PPopover';
|
|
65
|
+
import { PActionList } from '../PActionList';
|
|
66
|
+
import { ActionListItemDescriptor } from '../../types';
|
|
67
|
+
import ObjectValidator from '../../utilities/validators/ObjectValidator';
|
|
68
|
+
|
|
69
|
+
const Size = ['slim', 'medium', 'large'];
|
|
70
|
+
const TextAlign = ['left', 'right', 'center', null];
|
|
71
|
+
const DEFAULT_SIZE = 'medium';
|
|
72
|
+
const ConnectedDisclosure = {
|
|
73
|
+
/**
|
|
74
|
+
* Visually hidden label for the connected disclosure button
|
|
75
|
+
*/
|
|
76
|
+
accessibilityLabel: String,
|
|
77
|
+
/**
|
|
78
|
+
* Whether or not the disclosure is disabled
|
|
79
|
+
*/
|
|
80
|
+
disabled: Boolean,
|
|
81
|
+
/**
|
|
82
|
+
* List of actions
|
|
83
|
+
*/
|
|
84
|
+
actions: {
|
|
85
|
+
type: Array,
|
|
86
|
+
properties: {...ActionListItemDescriptor}
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* <br/>
|
|
92
|
+
* <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
|
|
93
|
+
* sans-serif;">Buttons are used primarily for actions, such as “Add”, “Close”, “Cancel”, or “Save”. Plain buttons,
|
|
94
|
+
* which look similar to links, are used for less important or less commonly used actions, such as “view shipping
|
|
95
|
+
* settings”.</h4>
|
|
96
|
+
*/
|
|
97
|
+
export default {
|
|
98
|
+
name: 'PButton',
|
|
99
|
+
components: {
|
|
100
|
+
PIcon, PUnstyledButton, PPopover, PActionList,
|
|
101
|
+
},
|
|
102
|
+
props: {
|
|
103
|
+
/**
|
|
104
|
+
* Visually hidden text for screen readers
|
|
105
|
+
*/
|
|
106
|
+
accessibilityLabel: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: null,
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* Id of the element the button controls
|
|
112
|
+
*/
|
|
113
|
+
ariaControls: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: null,
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* Indicates the ID of the element that describes the button
|
|
119
|
+
*/
|
|
120
|
+
ariaDescribedBy: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: null,
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Tells screen reader the controlled element is expanded
|
|
126
|
+
*/
|
|
127
|
+
ariaExpanded: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false,
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* Define aria-label
|
|
133
|
+
*/
|
|
134
|
+
ariaLabel: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: null,
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Define aria-controls, aria-haspopup, aria-owns
|
|
140
|
+
*/
|
|
141
|
+
ariaProps: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
default: false,
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* Disclosure button connected right of the button. Toggles a popover action list
|
|
147
|
+
*/
|
|
148
|
+
connectedDisclosure: {
|
|
149
|
+
type: Object,
|
|
150
|
+
default: () => ({}),
|
|
151
|
+
...ObjectValidator('connectedDisclosure', ConnectedDisclosure),
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* Indicates a dangerous or potentially negative action
|
|
155
|
+
*/
|
|
156
|
+
destructive: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
default: false,
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* Indicates a dangerous or potentially negative text
|
|
162
|
+
*/
|
|
163
|
+
destructiveText: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
default: false,
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* Disables the button, disallowing merchant interaction
|
|
169
|
+
*/
|
|
170
|
+
disabled: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
default: false,
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* Displays the button with a disclosure icon.
|
|
176
|
+
*/
|
|
177
|
+
disclosure: {
|
|
178
|
+
type: [Boolean, String],
|
|
179
|
+
default: false,
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
* Tells the browser to download the url instead of opening it. Provides a hint for the downloaded filename
|
|
183
|
+
* if it is a string value
|
|
184
|
+
*/
|
|
185
|
+
download: {
|
|
186
|
+
type: [Boolean, String],
|
|
187
|
+
default: false,
|
|
188
|
+
},
|
|
189
|
+
/**
|
|
190
|
+
* Forces url to open in a new tab
|
|
191
|
+
*/
|
|
192
|
+
external: {
|
|
193
|
+
type: Boolean,
|
|
194
|
+
default: false,
|
|
195
|
+
},
|
|
196
|
+
/**
|
|
197
|
+
* Allows the button to grow to the width of its container
|
|
198
|
+
*/
|
|
199
|
+
fullWidth: {
|
|
200
|
+
type: Boolean,
|
|
201
|
+
default: false,
|
|
202
|
+
},
|
|
203
|
+
/**
|
|
204
|
+
* A destination to link to, rendered in the href attribute of a link
|
|
205
|
+
*/
|
|
206
|
+
href: {
|
|
207
|
+
type: String,
|
|
208
|
+
default: undefined,
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* Icon to display to the left of the button content
|
|
212
|
+
* for available icon list.
|
|
213
|
+
*/
|
|
214
|
+
icon: {
|
|
215
|
+
type: String,
|
|
216
|
+
default: null,
|
|
217
|
+
},
|
|
218
|
+
/**
|
|
219
|
+
* A unique identifier for the button
|
|
220
|
+
*/
|
|
221
|
+
id: {
|
|
222
|
+
type: String,
|
|
223
|
+
default: null,
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* Replaces button text with a spinner while a background action is being performed
|
|
227
|
+
*/
|
|
228
|
+
loading: {
|
|
229
|
+
type: Boolean,
|
|
230
|
+
default: false,
|
|
231
|
+
},
|
|
232
|
+
/**
|
|
233
|
+
* Makes `plain` and `outline` Button colors
|
|
234
|
+
* (text, borders, icons) the same as the current text color.
|
|
235
|
+
*
|
|
236
|
+
* Also adds an underline to `plain` Buttons
|
|
237
|
+
*/
|
|
238
|
+
monochrome: {
|
|
239
|
+
type: Boolean,
|
|
240
|
+
default: false,
|
|
241
|
+
},
|
|
242
|
+
/**
|
|
243
|
+
* Gives the button a subtle alternative to the default button styling, appropriate for certain backdrops
|
|
244
|
+
*/
|
|
245
|
+
outline: {
|
|
246
|
+
type: Boolean,
|
|
247
|
+
default: false,
|
|
248
|
+
},
|
|
249
|
+
/**
|
|
250
|
+
* Renders a button that looks like a link
|
|
251
|
+
*/
|
|
252
|
+
plain: {
|
|
253
|
+
type: Boolean,
|
|
254
|
+
default: false,
|
|
255
|
+
},
|
|
256
|
+
/**
|
|
257
|
+
* Renders a button without border
|
|
258
|
+
*/
|
|
259
|
+
plainAction: {
|
|
260
|
+
type: Boolean,
|
|
261
|
+
default: false,
|
|
262
|
+
},
|
|
263
|
+
/**
|
|
264
|
+
* Sets the button in a pressed state
|
|
265
|
+
*/
|
|
266
|
+
pressed: {
|
|
267
|
+
type: Boolean,
|
|
268
|
+
default: false,
|
|
269
|
+
},
|
|
270
|
+
/**
|
|
271
|
+
* Provides extra visual weight and identifies
|
|
272
|
+
* the primary action in a set of buttons
|
|
273
|
+
*/
|
|
274
|
+
primary: {
|
|
275
|
+
type: Boolean,
|
|
276
|
+
default: false,
|
|
277
|
+
},
|
|
278
|
+
/**
|
|
279
|
+
* Removes underline from button text (including on interaction) when `monochrome` and `plain` are true
|
|
280
|
+
*/
|
|
281
|
+
removeUnderline: {
|
|
282
|
+
type: Boolean,
|
|
283
|
+
default: false,
|
|
284
|
+
},
|
|
285
|
+
/**
|
|
286
|
+
* A valid WAI-ARIA role to define the semantic value of this element
|
|
287
|
+
*/
|
|
288
|
+
role: {
|
|
289
|
+
type: String,
|
|
290
|
+
default: null,
|
|
291
|
+
},
|
|
292
|
+
/**
|
|
293
|
+
* Changes the size of the button, giving it more or less padding
|
|
294
|
+
*/
|
|
295
|
+
size: {
|
|
296
|
+
type: String,
|
|
297
|
+
default: 'medium',
|
|
298
|
+
},
|
|
299
|
+
/**
|
|
300
|
+
* Changes the inner text alignment of the button
|
|
301
|
+
*/
|
|
302
|
+
textAlign: {
|
|
303
|
+
type: TextAlign,
|
|
304
|
+
default: null,
|
|
305
|
+
},
|
|
306
|
+
/**
|
|
307
|
+
* VueRouter link | link object
|
|
308
|
+
*/
|
|
309
|
+
to: {
|
|
310
|
+
type: [String, Object],
|
|
311
|
+
},
|
|
312
|
+
/**
|
|
313
|
+
* Type of the button
|
|
314
|
+
*/
|
|
315
|
+
type: {
|
|
316
|
+
type: String,
|
|
317
|
+
default: 'button',
|
|
318
|
+
},
|
|
319
|
+
/**
|
|
320
|
+
* Button content
|
|
321
|
+
*/
|
|
322
|
+
value: {
|
|
323
|
+
type: [String, Number, Array],
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
data() {
|
|
327
|
+
return {
|
|
328
|
+
disclosureActive: false,
|
|
329
|
+
};
|
|
330
|
+
},
|
|
331
|
+
computed: {
|
|
332
|
+
connectedDisclosureClassName() {
|
|
333
|
+
return classNames(
|
|
334
|
+
'Polaris-Button',
|
|
335
|
+
this.primary && 'Polaris-Button--primary',
|
|
336
|
+
this.outline && 'Polaris-Button--outline',
|
|
337
|
+
this.size && this.size !== DEFAULT_SIZE && `Polaris-Button--${variationName('size', this.size)}`,
|
|
338
|
+
this.textAlign && `Polaris-Button--${variationName('textAlign', this.textAlign)}`,
|
|
339
|
+
this.destructive && 'Polaris-Button--destructive',
|
|
340
|
+
!this.destructive && this.destructiveText && 'Polaris-Button--destructiveText',
|
|
341
|
+
this.connectedDisclosure && this.connectedDisclosure.disabled && 'Polaris-Button--disabled',
|
|
342
|
+
'Polaris-Button--iconOnly',
|
|
343
|
+
'Polaris-Button__ConnectedDisclosure',
|
|
344
|
+
this.monochrome && 'Polaris-Button--monochrome',
|
|
345
|
+
);
|
|
346
|
+
},
|
|
347
|
+
disclosureIconClassName() {
|
|
348
|
+
return classNames(
|
|
349
|
+
'Polaris-Button__DisclosureIcon',
|
|
350
|
+
this.disclosureActive && 'Polaris-Button__DisclosureIconFacingUp',
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
methods: {
|
|
355
|
+
toggleDisclosureActive() {
|
|
356
|
+
this.disclosureActive = !this.disclosureActive;
|
|
357
|
+
},
|
|
358
|
+
handleClick() {
|
|
359
|
+
/**
|
|
360
|
+
* Callback when clicked
|
|
361
|
+
*/
|
|
362
|
+
this.$emit('click', event);
|
|
363
|
+
},
|
|
364
|
+
handleFocus() {
|
|
365
|
+
/**
|
|
366
|
+
* Callback when button becomes focussed
|
|
367
|
+
*/
|
|
368
|
+
this.$emit('focus', event);
|
|
369
|
+
},
|
|
370
|
+
handleBlur() {
|
|
371
|
+
/**
|
|
372
|
+
* Callback when focus leaves button
|
|
373
|
+
*/
|
|
374
|
+
this.$emit('blur', event);
|
|
375
|
+
},
|
|
376
|
+
handleKeyDown() {
|
|
377
|
+
/**
|
|
378
|
+
* Callback when a keydown event is registered on the button
|
|
379
|
+
*/
|
|
380
|
+
this.$emit('keydown', event);
|
|
381
|
+
},
|
|
382
|
+
handleKeyPress() {
|
|
383
|
+
/**
|
|
384
|
+
* Callback when a keypress event is registered on the button
|
|
385
|
+
*/
|
|
386
|
+
this.$emit('keypress', event);
|
|
387
|
+
},
|
|
388
|
+
handleKeyUp() {
|
|
389
|
+
/**
|
|
390
|
+
* Callback when a keyup event is registered on the button
|
|
391
|
+
*/
|
|
392
|
+
this.$emit('keyup', event);
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
}
|
|
396
|
+
</script>
|
package/src/components/polaris-vue/src/components/PButton/components/PButtonsFrom/PButtonsFrom.vue
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<PButton
|
|
4
|
+
v-for="(prop, i) in props" :key="i"
|
|
5
|
+
@click="prop.onAction"
|
|
6
|
+
v-bind="prop.rest">
|
|
7
|
+
{{ prop.content }}
|
|
8
|
+
</PButton>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import { ComplexAction } from '../../../../types';
|
|
14
|
+
import { PButton } from '../../../../components/PButton';
|
|
15
|
+
import ObjectValidator from '../../../../utilities/validators/ObjectValidator';
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'PButtonsFrom',
|
|
19
|
+
components: {
|
|
20
|
+
PButton,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
/**
|
|
24
|
+
* Action or Array of actions
|
|
25
|
+
*/
|
|
26
|
+
actions: {
|
|
27
|
+
type: [Array, Object],
|
|
28
|
+
...ObjectValidator('actions', ComplexAction),
|
|
29
|
+
},
|
|
30
|
+
overrides: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: () => ({}),
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
props() {
|
|
37
|
+
const actions = !Array.isArray(this.actions) ? [this.actions] : [...this.actions];
|
|
38
|
+
|
|
39
|
+
return actions.map(({content, onAction, ...action}) => ({
|
|
40
|
+
content,
|
|
41
|
+
onAction: onAction || (() => undefined),
|
|
42
|
+
rest: {...action, ...this.overrides},
|
|
43
|
+
}));
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
</script>
|