Skip to content

Commit 09f92d9

Browse files
fix(taggroup): style empty state
1 parent 7866183 commit 09f92d9

File tree

5 files changed

+51
-3
lines changed

5 files changed

+51
-3
lines changed

.changeset/public-facts-boil.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,11 @@ To support custom spacing of the embedded components, several other new mod prop
2828
- `--mod-tag-group-block-spacing-label-to-tags`
2929
- `--mod-tag-group-inline-spacing-label-to-tags`
3030
- `--mod-tag-group-spacing-help-text-to-tags`
31+
32+
To support the optional empty state (when there are no tags in the tag group), several passthroughs to modify the body typography text element have been added, including:
33+
34+
- `--mod-body-cjk-line-height`
35+
- `--mod-body-font-size`
36+
- `--mod-body-line-height`
37+
- `--mod-body-margin-end`
38+
- `--mod-body-margin-start`

components/taggroup/dist/metadata.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,17 @@
1212
".spectrum-TagGroup-actionButton",
1313
".spectrum-TagGroup-helpText",
1414
".spectrum-TagGroup-label",
15-
".spectrum-TagGroup-tags"
15+
".spectrum-TagGroup-tags",
16+
".spectrum-TagGroup:lang(ja)",
17+
".spectrum-TagGroup:lang(ko)",
18+
".spectrum-TagGroup:lang(zh)"
1619
],
1720
"modifiers": [
21+
"--mod-body-cjk-line-height",
22+
"--mod-body-font-size",
23+
"--mod-body-line-height",
24+
"--mod-body-margin-end",
25+
"--mod-body-margin-start",
1826
"--mod-tag-group-block-spacing-label-to-tags",
1927
"--mod-tag-group-block-tag-spacing",
2028
"--mod-tag-group-inline-spacing-label-to-tags",
@@ -29,8 +37,19 @@
2937
"--spectrum-tag-group-spacing-help-text-to-tags"
3038
],
3139
"global": [
40+
"--spectrum-cjk-line-height-100",
41+
"--spectrum-component-bottom-to-text-100",
42+
"--spectrum-component-bottom-to-text-200",
43+
"--spectrum-component-bottom-to-text-75",
44+
"--spectrum-component-top-to-text-100",
45+
"--spectrum-component-top-to-text-200",
46+
"--spectrum-component-top-to-text-75",
3247
"--spectrum-field-label-to-component",
48+
"--spectrum-font-size-100",
49+
"--spectrum-font-size-200",
50+
"--spectrum-font-size-75",
3351
"--spectrum-help-text-to-component",
52+
"--spectrum-line-height-100",
3453
"--spectrum-spacing-100",
3554
"--spectrum-spacing-200"
3655
],

components/taggroup/index.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,38 @@
1717
--spectrum-tag-group-block-spacing-label-to-tags: var(--spectrum-field-label-to-component);
1818
--spectrum-tag-group-inline-spacing-label-to-tags: var(--spectrum-spacing-200);
1919
--spectrum-tag-group-spacing-help-text-to-tags: var(--spectrum-help-text-to-component);
20+
21+
/* passthroughs for body typography element in empty state */
22+
--mod-body-line-height: var(--spectrum-line-height-100);
23+
--mod-body-font-size: var(--spectrum-font-size-100);
24+
--mod-body-margin-start: var(--spectrum-component-top-to-text-100);
25+
--mod-body-margin-end: var(--spectrum-component-bottom-to-text-100);
26+
27+
&:lang(ja),
28+
&:lang(zh),
29+
&:lang(ko) {
30+
--mod-body-cjk-line-height: var(--spectrum-cjk-line-height-100);
31+
}
2032
}
2133

2234
.spectrum-TagGroup--sizeS {
2335
--spectrum-tag-group-inline-tag-spacing: var(--spectrum-spacing-100);
2436
--spectrum-tag-group-block-tag-spacing: var(--spectrum-spacing-100);
37+
38+
/* passthroughs for body typography element in empty state */
39+
--mod-body-font-size: var(--spectrum-font-size-75);
40+
--mod-body-margin-start: var(--spectrum-component-top-to-text-75);
41+
--mod-body-margin-end: var(--spectrum-component-bottom-to-text-75);
2542
}
2643

2744
.spectrum-TagGroup--sizeL {
2845
--spectrum-tag-group-inline-tag-spacing: var(--spectrum-spacing-200);
2946
--spectrum-tag-group-block-tag-spacing: var(--spectrum-spacing-200);
47+
48+
/* passthroughs for body typography element in empty state */
49+
--mod-body-font-size: var(--spectrum-font-size-200);
50+
--mod-body-margin-start: var(--spectrum-component-top-to-text-200);
51+
--mod-body-margin-end: var(--spectrum-component-bottom-to-text-200);
3052
}
3153

3254
.spectrum-TagGroup {

components/taggroup/stories/taggroup.stories.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Disabled.args = {
267267
};
268268

269269
/**
270-
* When a stand alone tag group has no tags, it shows placeholder text to communicate the empty state. The wording of the placeholder text can be customizable.
270+
* When a stand alone tag group has no tags, it may show placeholder text to communicate the empty state. The placeholder text can be customized, or another element may be shown to communicate the empty state rather than placeholder text.
271271
*/
272272
export const WithNoTags = Template.bind({});
273273
WithNoTags.storyName = "With no tags (empty state)";

components/taggroup/stories/template.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export const Template = ({
7373
</div>
7474
`, () => html`
7575
${Typography({
76-
size,
7776
semantics: "body",
7877
content: ["None"],
7978
}, context)}

0 commit comments

Comments
 (0)