@spectrum-web-components/action-button 1.3.0-testing.0 → 1.3.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 (2) hide show
  1. package/README.md +125 -45
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Description
1
+ ## Overview
2
2
 
3
3
  An `<sp-action-button>` represents an action a user can take.
4
4
 
@@ -24,9 +24,11 @@ When looking to leverage the `ActionButton` base class as a type and/or for exte
24
24
  import { ActionButton } from '@spectrum-web-components/action-button';
25
25
  ```
26
26
 
27
- ## Sizes
27
+ ### Options
28
28
 
29
- <sp-tabs selected="m" auto label="Size Attribute Options">
29
+ #### Sizes
30
+
31
+ <sp-tabs selected="m" auto label="Size attribute options">
30
32
  <sp-tab value="xs">Extra Small</sp-tab>
31
33
  <sp-tab-panel value="xs">
32
34
 
@@ -129,11 +131,13 @@ import { ActionButton } from '@spectrum-web-components/action-button';
129
131
  </sp-tab-panel>
130
132
  </sp-tabs>
131
133
 
132
- ## Variants
134
+ #### Variants
133
135
 
134
136
  The `<sp-action-button>` can be customized with either or both of the `emphasized` and `quiet` attributes. These will pair with either or both of the state attributes (`selected` and `disabled`) to decide the final visual delivery of the `<sp-action-button>`. Content addressed to the `icon` slot can also be provided and will be positioned just before the rest of the the supplied button content.
135
137
 
136
- ### Standard
138
+ <sp-tabs selected="default" auto label="Variant options">
139
+ <sp-tab value="default">Default</sp-tab>
140
+ <sp-tab-panel value="default">
137
141
 
138
142
  ```html demo
139
143
  <div
@@ -211,7 +215,9 @@ The `<sp-action-button>` can be customized with either or both of the `emphasize
211
215
  </div>
212
216
  ```
213
217
 
214
- ### Quiet
218
+ </sp-tab-panel>
219
+ <sp-tab value="quiet">Quiet</sp-tab>
220
+ <sp-tab-panel value="quiet">
215
221
 
216
222
  ```html demo
217
223
  <div
@@ -289,7 +295,9 @@ The `<sp-action-button>` can be customized with either or both of the `emphasize
289
295
  </div>
290
296
  ```
291
297
 
292
- ### Emphasized
298
+ </sp-tab-panel>
299
+ <sp-tab value="emphasized">Emphasized</sp-tab>
300
+ <sp-tab-panel value="emphasized">
293
301
 
294
302
  ```html demo
295
303
  <div
@@ -369,7 +377,9 @@ The `<sp-action-button>` can be customized with either or both of the `emphasize
369
377
  </div>
370
378
  ```
371
379
 
372
- ### Emphasized + Quiet
380
+ </sp-tab-panel>
381
+ <sp-tab value="emq">Emphasized + quiet</sp-tab>
382
+ <sp-tab-panel value="emq">
373
383
 
374
384
  ```html demo
375
385
  <div
@@ -455,7 +465,12 @@ The `<sp-action-button>` can be customized with either or both of the `emphasize
455
465
  </div>
456
466
  ```
457
467
 
458
- ## Action button with hold affordance
468
+ </sp-tab-panel>
469
+ </sp-tabs>
470
+
471
+ ### Behaviors
472
+
473
+ #### Action button with hold affordance
459
474
 
460
475
  The use of the `hold-affordance` attribute signifies that the `<sp-action-button>` in question will be delivered with a visual affordance outlining that special interaction with the button will dispatch a `longpress` event. Via a pointer input, this even will be dispatched when 300ms has passed after a `pointerdown` event without the presence of a `pointerup` or `pointercancel` event. Via the keyboard, an event with a code of `Space` or or `ArrowDown` while `altKey === true` will dispatch the event.
461
476
 
@@ -499,49 +514,70 @@ The use of the `hold-affordance` attribute signifies that the `<sp-action-button
499
514
  </div>
500
515
  ```
501
516
 
502
- ## Toggles
517
+ #### Toggles
503
518
 
504
519
  With the application of the `toggles` attribute, the button will self manage its `selected` property on `click`. When this value is updated, a cancellable `change` event will be dispatched to inform the parent application.
505
520
 
521
+ <sp-tabs selected="default" auto label="Toggled action buttons">
522
+ <sp-tab value="default">Default</sp-tab>
523
+ <sp-tab-panel value="default">
524
+
506
525
  ```html demo
507
- <div
508
- style="display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 2em;"
526
+ <sp-action-button toggles id="toggles-default">Toggle button</sp-action-button>
527
+ <sp-action-button toggles selected id="toggles-default">
528
+ Toggle button
529
+ </sp-action-button>
530
+ ```
531
+
532
+ </sp-tab-panel>
533
+ <sp-tab value="quiet">Quiet</sp-tab>
534
+ <sp-tab-panel value="quiet">
535
+
536
+ ```html demo
537
+ <sp-action-button toggles quiet id="toggles-quiet">
538
+ Toggle button
539
+ </sp-action-button>
540
+ <sp-action-button toggles quiet selected id="toggles-quiet">
541
+ Toggle button
542
+ </sp-action-button>
543
+ ```
544
+
545
+ </sp-tab-panel>
546
+ <sp-tab value="emphasized">Emphasized</sp-tab>
547
+ <sp-tab-panel value="emphasized">
548
+
549
+ ```html demo
550
+ <sp-action-button toggles emphasized id="toggles-emphasized">
551
+ Toggle button
552
+ </sp-action-button>
553
+ <sp-action-button toggles emphasized selected id="toggles-emphasized">
554
+ Toggle button
555
+ </sp-action-button>
556
+ ```
557
+
558
+ </sp-tab-panel>
559
+ <sp-tab value="emphasized-quiet">Emphasized + Quiet</sp-tab>
560
+ <sp-tab-panel value="emphasized-quiet">
561
+
562
+ ```html demo
563
+ <sp-action-button toggles emphasized quiet id="toggles-emphasized-quiet">
564
+ Toggle button
565
+ </sp-action-button>
566
+ <sp-action-button
567
+ toggles
568
+ emphasized
569
+ quiet
570
+ selected
571
+ id="toggles-emphasized-quiet"
509
572
  >
510
- <div>
511
- <sp-field-label for="toggles-default">Standard</sp-field-label>
512
- <sp-action-button toggles id="toggles-default">
513
- Toggle button
514
- </sp-action-button>
515
- </div>
516
- <div>
517
- <sp-field-label for="toggles-quiet">Quiet</sp-field-label>
518
- <sp-action-button toggles quiet id="toggles-quiet">
519
- Toggle button
520
- </sp-action-button>
521
- </div>
522
- <div>
523
- <sp-field-label for="toggles-emphasized">Emphasized</sp-field-label>
524
- <sp-action-button toggles emphasized id="toggles-emphasized">
525
- Toggle button
526
- </sp-action-button>
527
- </div>
528
- <div>
529
- <sp-field-label for="toggles-emphasized-quiet">
530
- Emphasized + Quiet
531
- </sp-field-label>
532
- <sp-action-button
533
- toggles
534
- emphasized
535
- quiet
536
- id="toggles-emphasized-quiet"
537
- >
538
- Toggle button
539
- </sp-action-button>
540
- </div>
541
- </div>
573
+ Toggle button
574
+ </sp-action-button>
542
575
  ```
543
576
 
544
- ## Handling events
577
+ </sp-tab-panel>
578
+ </sp-tabs>
579
+
580
+ #### Handling events
545
581
 
546
582
  Events handlers for clicks and other user actions can be registered on a
547
583
  `<sp-action-button>` as on a standard HTML `<button>` element.
@@ -562,3 +598,47 @@ In addition to handling events like a native `<button>` HTML element, one can al
562
598
  Click me
563
599
  </sp-action-button>
564
600
  ```
601
+
602
+ ### Accessibility
603
+
604
+ #### Include a label
605
+
606
+ A button is required to have either a visible text label or a `label` attribute on either the `<sp-button>` itself,
607
+ or on an `<sp-icon*>` element child.
608
+
609
+ #### Don't override color
610
+
611
+ Do not use custom colors for buttons. The colors of different button variations have been designed to be consistent and accessible.
612
+
613
+ #### Use static black or static white to contrast with backgrounds and images
614
+
615
+ To ensure maximum contrast with the background, use static black for light backgrounds and images, and static white for dark backgrounds and images. Avoid placing static components on top of busy images with a lot of variance in contrast.
616
+
617
+ <sp-tabs selected="black" auto label="Static variants for contrast">
618
+ <sp-tab value="black">Static black on light background</sp-tab>
619
+ <sp-tab-panel value="black">
620
+
621
+ ```html demo
622
+ <div style="background-color: #ccffee; padding: 20px">
623
+ <sp-action-button static="black">Click me</sp-action-button>
624
+ <sp-action-button static="black" selected>Click me</sp-action-button>
625
+ </div>
626
+ ```
627
+
628
+ </sp-tab-panel>
629
+ <sp-tab value="white">Static white on dark background</sp-tab>
630
+ <sp-tab-panel value="white">
631
+
632
+ ```html demo
633
+ <div style="background-color: #220033; padding: 20px">
634
+ <sp-action-button static="white">Click me</sp-action-button>
635
+ <sp-action-button static="white" selected>Click me</sp-action-button>
636
+ </div>
637
+ ```
638
+
639
+ </sp-tab-panel>
640
+ </sp-tabs>
641
+
642
+ #### Clearly state the action
643
+
644
+ Make sure that an action button’s label clearly states the outcome of the action. Use the same word or phrase as found elsewhere in the experience.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/action-button",
3
- "version": "1.3.0-testing.0",
3
+ "version": "1.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -58,11 +58,11 @@
58
58
  "lit-html"
59
59
  ],
60
60
  "dependencies": {
61
- "@spectrum-web-components/base": "^1.3.0-testing.0",
62
- "@spectrum-web-components/button": "^1.3.0-testing.0",
63
- "@spectrum-web-components/icon": "^1.3.0-testing.0",
64
- "@spectrum-web-components/icons-ui": "^1.3.0-testing.0",
65
- "@spectrum-web-components/shared": "^1.3.0-testing.0"
61
+ "@spectrum-web-components/base": "1.3.0",
62
+ "@spectrum-web-components/button": "1.3.0",
63
+ "@spectrum-web-components/icon": "1.3.0",
64
+ "@spectrum-web-components/icons-ui": "1.3.0",
65
+ "@spectrum-web-components/shared": "1.3.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@spectrum-css/actionbutton": "7.1.1"