Skip to content

Commit c7c1e26

Browse files
fix(taggroup): add disabled action button setting
1 parent ffdb48f commit c7c1e26

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

components/taggroup/stories/taggroup.stories.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { isInvalid } from "@spectrum-css/preview/types";
44
import { default as TagStories } from "@spectrum-css/tag/stories/tag.stories.js";
55
import metadata from "../dist/metadata.json";
66
import packageJson from "../package.json";
7-
import { exampleTagItems, TagGroupDisabledItem, TagGroups, TagGroupSizingTemplate } from "./taggroup.test.js";
7+
import { exampleTagItems, TagGroupDisabledItemAndActionButton, TagGroups, TagGroupSizingTemplate } from "./taggroup.test.js";
88
import { Template } from "./template.js";
99

1010
const ignoreProps = ["rootClass", "hasClearButton", "label"];
@@ -39,10 +39,19 @@ export default {
3939
type: { name: "text" },
4040
table: {
4141
type: { summary: "text" },
42-
category: "Content",
42+
category: "Action button settings",
4343
},
4444
control: "text",
4545
},
46+
hasDisabledActionButton: {
47+
name: "Has disabled action button",
48+
description: "Displays the action button in a disabled state.",
49+
type: { name: "boolean" },
50+
table: {
51+
type: { summary: "boolean" },
52+
category: "Action button settings",
53+
},
54+
},
4655
fieldLabel: {
4756
name: "Field label",
4857
description: "Displays a label above the tag group, if left blank, the label will not be displayed.",
@@ -97,6 +106,7 @@ export default {
97106
isInvalid: false,
98107
numberOfTags: 3,
99108
ariaLabel: "Tags",
109+
hasDisabledActionButton: false,
100110
},
101111
parameters: {
102112
actions: {
@@ -252,9 +262,11 @@ WithHelpText.args = {
252262

253263
/**
254264
* Avoid disabling an entire tag group. In cases where users can't interact with an entire group of tags, consider either using non-removable tags or hiding the tag group altogether. Don't disable all individual tags; having a tag group that's disabled isn't accessible and it can be frustrating for users.
265+
*
266+
* Individual tags may be disabled, and the action button may also be disabled, as seen below.
255267
*/
256-
export const Disabled = TagGroupDisabledItem.bind({});
257-
Disabled.storyName = "With disabled tag";
268+
export const Disabled = TagGroupDisabledItemAndActionButton.bind({});
269+
Disabled.storyName = "With disabled tag and action button";
258270
Disabled.tags = ["!dev"];
259271
Disabled.parameters = {
260272
chromatic: {

components/taggroup/stories/taggroup.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ export const TagGroupSizingTemplate = (args, context) => {
3636
`;
3737
};
3838

39-
export const TagGroupDisabledItem = (args, context) => {
39+
export const TagGroupDisabledItemAndActionButton = (args, context) => {
4040
return html`
4141
${Template({
4242
...args,
4343
items: itemsWithDisabledTag,
44+
hasDisabledActionButton: true,
4445
}, context)}
4546
`;
4647
};

components/taggroup/stories/template.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const Template = ({
2727
fieldLabelPosition = "top",
2828
helpText,
2929
isInvalid = false,
30+
hasDisabledActionButton = false,
3031
...args
3132
} = {}, context = {}) => {
3233
const tags = Array.isArray(items) && items.length > 0
@@ -81,6 +82,7 @@ export const Template = ({
8182
${ActionButton({
8283
size,
8384
isQuiet: true,
85+
isDisabled: hasDisabledActionButton,
8486
label: actionButtonText,
8587
customClasses: [`${rootClass}-actionButton`],
8688
}, context)}

0 commit comments

Comments
 (0)