@abraracs/better-shopify-wc-mcp 1.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.
Files changed (51) hide show
  1. package/README.md +110 -0
  2. package/dist/index.d.ts +10 -0
  3. package/dist/index.js +325 -0
  4. package/docs/avatar.md +481 -0
  5. package/docs/badge.md +266 -0
  6. package/docs/banner.md +350 -0
  7. package/docs/box.md +618 -0
  8. package/docs/button.md +604 -0
  9. package/docs/buttongroup.md +251 -0
  10. package/docs/checkbox.md +346 -0
  11. package/docs/chip.md +261 -0
  12. package/docs/choicelist.md +416 -0
  13. package/docs/clickable.md +703 -0
  14. package/docs/clickablechip.md +377 -0
  15. package/docs/colorfield.md +416 -0
  16. package/docs/colorpicker.md +152 -0
  17. package/docs/datefield.md +706 -0
  18. package/docs/datepicker.md +443 -0
  19. package/docs/divider.md +263 -0
  20. package/docs/dropzone.md +331 -0
  21. package/docs/emailfield.md +377 -0
  22. package/docs/grid.md +1246 -0
  23. package/docs/heading.md +201 -0
  24. package/docs/icon.md +295 -0
  25. package/docs/image.md +517 -0
  26. package/docs/link.md +456 -0
  27. package/docs/menu.md +331 -0
  28. package/docs/modal.md +640 -0
  29. package/docs/moneyfield.md +385 -0
  30. package/docs/numberfield.md +393 -0
  31. package/docs/orderedlist.md +224 -0
  32. package/docs/page.md +319 -0
  33. package/docs/paragraph.md +333 -0
  34. package/docs/passwordfield.md +381 -0
  35. package/docs/popover.md +419 -0
  36. package/docs/querycontainer.md +121 -0
  37. package/docs/searchfield.md +319 -0
  38. package/docs/section.md +267 -0
  39. package/docs/select.md +449 -0
  40. package/docs/spinner.md +121 -0
  41. package/docs/stack.md +748 -0
  42. package/docs/switch.md +365 -0
  43. package/docs/table.md +805 -0
  44. package/docs/text.md +339 -0
  45. package/docs/textarea.md +328 -0
  46. package/docs/textfield.md +425 -0
  47. package/docs/thumbnail.md +245 -0
  48. package/docs/tooltip.md +130 -0
  49. package/docs/unorderedlist.md +135 -0
  50. package/docs/urlfield.md +314 -0
  51. package/package.json +43 -0
package/docs/modal.md ADDED
@@ -0,0 +1,640 @@
1
+ ---
2
+ title: Modal
3
+ description: >-
4
+ Displays content in an overlay. Use to create a distraction-free experience
5
+ such as a confirmation dialog or a settings panel.
6
+ api_name: app-home
7
+ source_url:
8
+ html: 'https://shopify.dev/docs/api/app-home/polaris-web-components/overlays/modal'
9
+ md: >-
10
+ https://shopify.dev/docs/api/app-home/polaris-web-components/overlays/modal.md
11
+ ---
12
+
13
+ # Modal
14
+
15
+ Displays content in an overlay. Use to create a distraction-free experience such as a confirmation dialog or a settings panel.
16
+
17
+ ## Properties
18
+
19
+ * accessibilityLabel
20
+
21
+ string
22
+
23
+ A label that describes the purpose of the modal. When set, it will be announced to users using assistive technologies and will provide them with more context.
24
+
25
+ This overrides the `heading` prop for screen readers.
26
+
27
+ * heading
28
+
29
+ string
30
+
31
+ A title that describes the content of the Modal.
32
+
33
+ * hideOverlay
34
+
35
+ () => void
36
+
37
+ Method to hide an overlay.
38
+
39
+ * padding
40
+
41
+ "base" | "none"
42
+
43
+ Default: 'base'
44
+
45
+ Adjust the padding around the Modal content.
46
+
47
+ `base`: applies padding that is appropriate for the element.
48
+
49
+ `none`: removes all padding from the element. This can be useful when elements inside the Modal need to span to the edge of the Modal. For example, a full-width image. In this case, rely on `Box` with a padding of 'base' to bring back the desired padding for the rest of the content.
50
+
51
+ * showOverlay
52
+
53
+ () => void
54
+
55
+ Method to show an overlay.
56
+
57
+ * size
58
+
59
+ "small" | "small-100" | "base" | "large" | "large-100"
60
+
61
+ Default: 'base'
62
+
63
+ Adjust the size of the Modal.
64
+
65
+ * toggleOverlay
66
+
67
+ () => void
68
+
69
+ Method to toggle the visiblity of an overlay.
70
+
71
+ ## Events
72
+
73
+ Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling).
74
+
75
+ * afterhide
76
+
77
+ CallbackEventListener\<typeof tagName> | null
78
+
79
+ * aftershow
80
+
81
+ CallbackEventListener\<typeof tagName> | null
82
+
83
+ * hide
84
+
85
+ CallbackEventListener\<typeof tagName> | null
86
+
87
+ * show
88
+
89
+ CallbackEventListener\<typeof tagName> | null
90
+
91
+ ### CallbackEventListener
92
+
93
+ ```ts
94
+ (EventListener & {
95
+ (event: CallbackEvent<T>): void;
96
+ }) | null
97
+ ```
98
+
99
+ ### CallbackEvent
100
+
101
+ ```ts
102
+ Event & {
103
+ currentTarget: HTMLElementTagNameMap[T];
104
+ }
105
+ ```
106
+
107
+ ## Slots
108
+
109
+ * children
110
+
111
+ HTMLElement
112
+
113
+ The content of the Modal.
114
+
115
+ * primary-action
116
+
117
+ HTMLElement
118
+
119
+ The primary action to perform.
120
+
121
+ Only a `Button` with a variant of `primary` is allowed.
122
+
123
+ * secondary-actions
124
+
125
+ HTMLElement
126
+
127
+ The secondary actions to perform.
128
+
129
+ Only `Button` elements with a variant of `secondary` or `auto` are allowed.
130
+
131
+ Examples
132
+
133
+ ### Examples
134
+
135
+ * #### Code
136
+
137
+ ##### jsx
138
+
139
+ ```jsx
140
+ <>
141
+ <s-button commandFor="modal">Open</s-button>
142
+
143
+ <s-modal id="modal" heading="Details">
144
+ <s-paragraph>Displaying more details here.</s-paragraph>
145
+
146
+ <s-button slot="secondary-actions" commandFor="modal" command="--hide">
147
+ Close
148
+ </s-button>
149
+ <s-button
150
+ slot="primary-action"
151
+ variant="primary"
152
+ commandFor="modal"
153
+ command="--hide"
154
+ >
155
+ Save
156
+ </s-button>
157
+ </s-modal>
158
+ </>
159
+ ```
160
+
161
+ ##### html
162
+
163
+ ```html
164
+ <s-button commandFor="modal">Open</s-button>
165
+
166
+ <s-modal id="modal" heading="Details">
167
+ <s-paragraph>Displaying more details here.</s-paragraph>
168
+
169
+ <s-button slot="secondary-actions" commandFor="modal" command="--hide">
170
+ Close
171
+ </s-button>
172
+ <s-button
173
+ slot="primary-action"
174
+ variant="primary"
175
+ commandFor="modal"
176
+ command="--hide"
177
+ >
178
+ Save
179
+ </s-button>
180
+ </s-modal>
181
+ ```
182
+
183
+ * #### Basic modal
184
+
185
+ ##### Description
186
+
187
+ Simple modal with heading and basic content for displaying information. Click the button to open the modal.
188
+
189
+ ##### jsx
190
+
191
+ ```jsx
192
+ <>
193
+ <s-button commandFor="info-modal" command="--show">
194
+ Show product info
195
+ </s-button>
196
+
197
+ <s-modal id="info-modal" heading="Product information">
198
+ <s-text>
199
+ This product is currently out of stock and cannot be ordered.
200
+ </s-text>
201
+
202
+ <s-button slot="secondary-actions" commandFor="info-modal" command="--hide">
203
+ Close
204
+ </s-button>
205
+ </s-modal>
206
+ </>
207
+ ```
208
+
209
+ ##### html
210
+
211
+ ```html
212
+ <s-button commandFor="info-modal" command="--show">Show product info</s-button>
213
+
214
+ <s-modal id="info-modal" heading="Product information">
215
+ <s-text>This product is currently out of stock and cannot be ordered.</s-text>
216
+
217
+ <s-button slot="secondary-actions" commandFor="info-modal" command="--hide">
218
+ Close
219
+ </s-button>
220
+ </s-modal>
221
+ ```
222
+
223
+ * #### Modal with actions
224
+
225
+ ##### Description
226
+
227
+ Modal with primary and secondary action buttons. Click the button to open the confirmation modal.
228
+
229
+ ##### jsx
230
+
231
+ ```jsx
232
+ <s-stack gap="base">
233
+ <s-button tone="critical" commandFor="delete-modal" command="--show">
234
+ Delete product
235
+ </s-button>
236
+
237
+ <s-modal id="delete-modal" heading="Delete product?">
238
+ <s-stack gap="base">
239
+ <s-text>Are you sure you want to delete "Winter jacket"?</s-text>
240
+ <s-text tone="caution">This action cannot be undone.</s-text>
241
+ </s-stack>
242
+
243
+ <s-button
244
+ slot="primary-action"
245
+ variant="primary"
246
+ tone="critical"
247
+ commandFor="delete-modal"
248
+ command="--hide"
249
+ >
250
+ Delete product
251
+ </s-button>
252
+ <s-button
253
+ slot="secondary-actions"
254
+ variant="secondary"
255
+ commandFor="delete-modal"
256
+ command="--hide"
257
+ >
258
+ Cancel
259
+ </s-button>
260
+ </s-modal>
261
+ </s-stack>
262
+ ```
263
+
264
+ ##### html
265
+
266
+ ```html
267
+ <s-stack gap="base">
268
+ <s-button tone="critical" commandFor="delete-modal" command="--show">
269
+ Delete product
270
+ </s-button>
271
+
272
+ <s-modal id="delete-modal" heading="Delete product?">
273
+ <s-stack gap="base">
274
+ <s-text>Are you sure you want to delete "Winter jacket"?</s-text>
275
+ <s-text tone="caution">This action cannot be undone.</s-text>
276
+ </s-stack>
277
+
278
+ <s-button
279
+ slot="primary-action"
280
+ variant="primary"
281
+ tone="critical"
282
+ commandFor="delete-modal"
283
+ command="--hide"
284
+ >
285
+ Delete product
286
+ </s-button>
287
+ <s-button
288
+ slot="secondary-actions"
289
+ variant="secondary"
290
+ commandFor="delete-modal"
291
+ command="--hide"
292
+ >
293
+ Cancel
294
+ </s-button>
295
+ </s-modal>
296
+ </s-stack>
297
+ ```
298
+
299
+ * #### Modal with form fields
300
+
301
+ ##### Description
302
+
303
+ Modal containing form fields demonstrating how to structure input fields within a modal. Click the button to open the modal.
304
+
305
+ ##### jsx
306
+
307
+ ```jsx
308
+ <s-stack gap="base">
309
+ <s-button variant="primary" commandFor="edit-modal" command="--show">
310
+ Edit customer
311
+ </s-button>
312
+
313
+ <s-modal id="edit-modal" heading="Edit customer information" size="large">
314
+ <s-stack gap="base">
315
+ <s-text-field
316
+ label="Customer name"
317
+ name="name"
318
+ value="Sarah Johnson"
319
+ />
320
+
321
+ <s-email-field
322
+ label="Email address"
323
+ name="email"
324
+ value="sarah@example.com"
325
+ />
326
+
327
+ <s-text-field
328
+ label="Phone number"
329
+ name="phone"
330
+ value="+1 555-0123"
331
+ />
332
+
333
+ <s-select label="Customer group" name="group">
334
+ <s-option value="retail">Retail</s-option>
335
+ <s-option value="wholesale" selected>
336
+ Wholesale
337
+ </s-option>
338
+ <s-option value="vip">VIP</s-option>
339
+ </s-select>
340
+ </s-stack>
341
+
342
+ <s-button
343
+ slot="primary-action"
344
+ variant="primary"
345
+ commandFor="edit-modal"
346
+ command="--hide"
347
+ >
348
+ Save changes
349
+ </s-button>
350
+ <s-button
351
+ slot="secondary-actions"
352
+ variant="secondary"
353
+ commandFor="edit-modal"
354
+ command="--hide"
355
+ >
356
+ Cancel
357
+ </s-button>
358
+ </s-modal>
359
+ </s-stack>
360
+ ```
361
+
362
+ ##### html
363
+
364
+ ```html
365
+ <s-stack gap="base">
366
+ <s-button variant="primary" commandFor="edit-modal" command="--show">
367
+ Edit customer
368
+ </s-button>
369
+
370
+ <s-modal id="edit-modal" heading="Edit customer information" size="large">
371
+ <s-stack gap="base">
372
+ <s-text-field
373
+ label="Customer name"
374
+ name="name"
375
+ value="Sarah Johnson"
376
+ ></s-text-field>
377
+
378
+ <s-email-field
379
+ label="Email address"
380
+ name="email"
381
+ value="sarah@example.com"
382
+ ></s-email-field>
383
+
384
+ <s-text-field
385
+ label="Phone number"
386
+ name="phone"
387
+ value="+1 555-0123"
388
+ ></s-text-field>
389
+
390
+ <s-select label="Customer group" name="group">
391
+ <s-option value="retail">Retail</s-option>
392
+ <s-option value="wholesale" selected>Wholesale</s-option>
393
+ <s-option value="vip">VIP</s-option>
394
+ </s-select>
395
+ </s-stack>
396
+
397
+ <s-button
398
+ slot="primary-action"
399
+ variant="primary"
400
+ commandFor="edit-modal"
401
+ command="--hide"
402
+ >
403
+ Save changes
404
+ </s-button>
405
+ <s-button
406
+ slot="secondary-actions"
407
+ variant="secondary"
408
+ commandFor="edit-modal"
409
+ command="--hide"
410
+ >
411
+ Cancel
412
+ </s-button>
413
+ </s-modal>
414
+ </s-stack>
415
+ ```
416
+
417
+ * #### Different modal sizes
418
+
419
+ ##### Description
420
+
421
+ Demonstrates various modal sizes for different content requirements. Click each button to see different modal sizes.
422
+
423
+ ##### jsx
424
+
425
+ ```jsx
426
+ <s-stack gap="base">
427
+ <s-stack direction="inline" gap="base">
428
+ <s-button commandFor="small-modal" command="--show">
429
+ Small modal
430
+ </s-button>
431
+ <s-button commandFor="large-modal" command="--show">
432
+ Large modal
433
+ </s-button>
434
+ </s-stack>
435
+
436
+ {/* Small modal for quick confirmations */}
437
+ <s-modal id="small-modal" heading="Confirm action" size="small-100">
438
+ <s-text>Are you sure you want to proceed?</s-text>
439
+ <s-button
440
+ slot="primary-action"
441
+ variant="primary"
442
+ commandFor="small-modal"
443
+ command="--hide"
444
+ >
445
+ Confirm
446
+ </s-button>
447
+ <s-button
448
+ slot="secondary-actions"
449
+ variant="secondary"
450
+ commandFor="small-modal"
451
+ command="--hide"
452
+ >
453
+ Cancel
454
+ </s-button>
455
+ </s-modal>
456
+
457
+ {/* Large modal for detailed content */}
458
+ <s-modal id="large-modal" heading="Order details" size="large-100">
459
+ <s-stack gap="base">
460
+ <s-section>
461
+ <s-heading>Order #1001</s-heading>
462
+ <s-text>Placed on March 15, 2024</s-text>
463
+ </s-section>
464
+
465
+ <s-divider />
466
+
467
+ <s-section>
468
+ <s-heading>Items</s-heading>
469
+ <s-stack gap="small">
470
+ <s-text>Winter jacket - $89.99</s-text>
471
+ <s-text>Wool scarf - $29.99</s-text>
472
+ <s-text>Leather gloves - $45.99</s-text>
473
+ </s-stack>
474
+ </s-section>
475
+
476
+ <s-divider />
477
+
478
+ <s-text type="strong">Total: $165.97</s-text>
479
+ </s-stack>
480
+
481
+ <s-button
482
+ slot="primary-action"
483
+ variant="primary"
484
+ commandFor="large-modal"
485
+ command="--hide"
486
+ >
487
+ Close
488
+ </s-button>
489
+ </s-modal>
490
+ </s-stack>
491
+ ```
492
+
493
+ ##### html
494
+
495
+ ```html
496
+ <s-stack gap="base">
497
+ <s-stack direction="inline" gap="base">
498
+ <s-button commandFor="small-modal" command="--show">Small modal</s-button>
499
+ <s-button commandFor="large-modal" command="--show">Large modal</s-button>
500
+ </s-stack>
501
+
502
+ <!-- Small modal for quick confirmations -->
503
+ <s-modal id="small-modal" heading="Confirm action" size="small-100">
504
+ <s-text>Are you sure you want to proceed?</s-text>
505
+ <s-button
506
+ slot="primary-action"
507
+ variant="primary"
508
+ commandFor="small-modal"
509
+ command="--hide"
510
+ >
511
+ Confirm
512
+ </s-button>
513
+ <s-button
514
+ slot="secondary-actions"
515
+ variant="secondary"
516
+ commandFor="small-modal"
517
+ command="--hide"
518
+ >
519
+ Cancel
520
+ </s-button>
521
+ </s-modal>
522
+
523
+ <!-- Large modal for detailed content -->
524
+ <s-modal id="large-modal" heading="Order details" size="large-100">
525
+ <s-stack gap="base">
526
+ <s-section>
527
+ <s-heading>Order #1001</s-heading>
528
+ <s-text>Placed on March 15, 2024</s-text>
529
+ </s-section>
530
+
531
+ <s-divider></s-divider>
532
+
533
+ <s-section>
534
+ <s-heading>Items</s-heading>
535
+ <s-stack gap="small">
536
+ <s-text>Winter jacket - $89.99</s-text>
537
+ <s-text>Wool scarf - $29.99</s-text>
538
+ <s-text>Leather gloves - $45.99</s-text>
539
+ </s-stack>
540
+ </s-section>
541
+
542
+ <s-divider></s-divider>
543
+
544
+ <s-text type="strong">Total: $165.97</s-text>
545
+ </s-stack>
546
+
547
+ <s-button
548
+ slot="primary-action"
549
+ variant="primary"
550
+ commandFor="large-modal"
551
+ command="--hide"
552
+ >
553
+ Close
554
+ </s-button>
555
+ </s-modal>
556
+ </s-stack>
557
+ ```
558
+
559
+ * #### Modal without padding
560
+
561
+ ##### Description
562
+
563
+ Modal with no padding for full-width content. Click to view the modal.
564
+
565
+ ##### jsx
566
+
567
+ ```jsx
568
+ <s-stack gap="base">
569
+ <s-button commandFor="image-modal" command="--show">
570
+ View product image
571
+ </s-button>
572
+
573
+ <s-modal id="image-modal" heading="Product image" padding="none">
574
+ <s-box background="subdued" padding="base">
575
+ <s-text>Image would display here with full width</s-text>
576
+ </s-box>
577
+
578
+ <s-button
579
+ slot="secondary-actions"
580
+ variant="secondary"
581
+ commandFor="image-modal"
582
+ command="--hide"
583
+ >
584
+ Close
585
+ </s-button>
586
+ </s-modal>
587
+ </s-stack>
588
+ ```
589
+
590
+ ##### html
591
+
592
+ ```html
593
+ <s-stack gap="base">
594
+ <s-button commandFor="image-modal" command="--show">
595
+ View product image
596
+ </s-button>
597
+
598
+ <s-modal id="image-modal" heading="Product image" padding="none">
599
+ <s-box background="subdued" padding="base">
600
+ <s-text>Image would display here with full width</s-text>
601
+ </s-box>
602
+
603
+ <s-button
604
+ slot="secondary-actions"
605
+ variant="secondary"
606
+ commandFor="image-modal"
607
+ command="--hide"
608
+ >
609
+ Close
610
+ </s-button>
611
+ </s-modal>
612
+ </s-stack>
613
+ ```
614
+
615
+ ## Usage
616
+
617
+ Modals are closed by default and should be triggered by a button using the `commandFor` attribute. The button's `commandFor` value should match the modal's `id`.
618
+
619
+ ## Useful for
620
+
621
+ * Focusing on a specific task or piece of information
622
+ * Completing a flow that needs dedicated attention
623
+ * Confirming a significant action before proceeding
624
+ * Viewing information that's only temporarily relevant
625
+
626
+ ## Best practices
627
+
628
+ * Use for focused, specific tasks that require merchants to make a decision or acknowledge critical information
629
+ * Include a prominent and clear call to action
630
+ * Don't nest modals (avoid launching one modal from another)
631
+ * Have concise and descriptive title and button text
632
+ * Use thoughtfully and sparingly—don't create unnecessary interruptions
633
+ * Use as a last resort for important decisions, not for contextual tools or actions that could happen on the page directly
634
+
635
+ ## Content guidelines
636
+
637
+ * Use 1-3 word titles in sentence case without punctuation
638
+ * Keep body content to 1-2 short sentences
639
+ * For destructive actions, explain the consequences
640
+ * Use clear action verbs for buttons (e.g., "Delete", "Edit") instead of vague language like "Yes" or "OK"