Skip to content

Commit 83b2fe9

Browse files
cdransfcastastrophejawinn
authored
feat(in-line-alert): S2 migration (#3659)
* feat(in-line-alert): S2 migration * chore(in-line-alert): allow only subtle or bold * fix(in-line-alert): correct changelog to showcase custom properties rather than selectors * chore(in-line-alert): additional granular mods for background colors * fix(in-line-alert): resolve issues with button colors in bold + subtle variants * chore(in-line-alert): add subtle and bold variants to testing grid * chore(in-line-alert): add subtle + bold closable tests * chore(in-line-alert): add link variant, control and test grid variants * chore(in-line-alert): add style variants to docs view * chore(in-line-alert): refactor and significantly reduce styles * chore(in-line-alert): update docs + customize treatment titles * chore(in-line-alert): update WHC styles; drop button mods; add w/out header story control * fix(in-line-alert): revise WHC colors and restore borders for subtle/bold treatments * fix(in-line-alert): reorder custom properties; drop unnecessary selectors * fix(in-line-alert): set static variations on links and buttons ensure visibility * fix(in-line-alert): icon alignment * fix(in-line-alert): add high contrast border width property * fix(in-line-alert): use req'd font stacks Co-authored-by: [ Cassondra ] <castastrophe@users.noreply.github.com> * fix(in-line-alert): border treatment links + buttons * fix(in-line-alert): show icon with text when no header is displayed * chore(in-line-alert): update changelog with usage notes for subtle/bold + markup examples * Update components/inlinealert/index.css Co-authored-by: Josh Winn <965114+jawinn@users.noreply.github.com> * fix(in-line-alert): combine border width declarations --------- Co-authored-by: [ Cassondra ] <castastrophe@users.noreply.github.com> Co-authored-by: Josh Winn <965114+jawinn@users.noreply.github.com>
1 parent 911c390 commit 83b2fe9

File tree

6 files changed

+456
-107
lines changed

6 files changed

+456
-107
lines changed

.changeset/big-jars-pump.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
`@spectrum-css/inlinealert`: major
3+
---
4+
5+
#### S2 migration in-line alert
6+
7+
This migrates the `in-line alert` component to Spectrum 2. Custom properties have been updated and added per the design specification.
8+
9+
Subtle and bold treatments have been added for each badge variant.
10+
11+
To use the subtle treatment, you will need to apply the `spectrum-InLineAlert--subtle` class:
12+
13+
```html
14+
<div
15+
class="spectrum-InLineAlert spectrum-InLineAlert--info spectrum-InLineAlert--subtle"
16+
>
17+
<div class="spectrum-InLineAlert-header">
18+
Info variant with subtle fill
19+
<svg
20+
focusable="false"
21+
aria-hidden="true"
22+
role="img"
23+
class=" spectrum-Icon spectrum-Icon--sizeM spectrum-InLineAlert-icon "
24+
id="icon-52w58"
25+
aria-label="InfoCircle"
26+
>
27+
<title id="InfoCircle">Info Circle</title>
28+
<use xlink:href="#icon-info-circle" href="#icon-info-circle"></use>
29+
</svg>
30+
</div>
31+
<div class="spectrum-InLineAlert-content">This is an alert.</div>
32+
</div>
33+
```
34+
35+
To use the bold treatment (which is reserved for high-attention alerts only), you will need to apply the `spectrum-InLineAlert--bold` class:
36+
37+
```html
38+
<div
39+
class="spectrum-InLineAlert spectrum-InLineAlert--info spectrum-InLineAlert--bold"
40+
>
41+
<div class="spectrum-InLineAlert-header">
42+
Info variant with bold fill
43+
<svg
44+
focusable="false"
45+
aria-hidden="true"
46+
role="img"
47+
class=" spectrum-Icon spectrum-Icon--sizeM spectrum-InLineAlert-icon "
48+
id="icon-mty2x"
49+
aria-label="InfoCircle"
50+
>
51+
<title id="InfoCircle">Info Circle</title>
52+
<use xlink:href="#icon-info-circle" href="#icon-info-circle"></use>
53+
</svg>
54+
</div>
55+
<div class="spectrum-InLineAlert-content">This is an alert.</div>
56+
</div>
57+
```
58+
59+
Because subtle and bold treatments draw a similar level of attention you should choose only one to use consistently within a single product.
60+
61+
##### New mods
62+
63+
`--mod-inlinealert-border-and-icon-color-neutral`
64+
`--mod-inlinealert-min-spacing-header-to-icon`
65+
`--mod-inlinealert-spacing-content-link-button`
66+
`--mod-inlinealert-spacing-header-content`
67+
68+
##### Removed mods
69+
70+
`--mod-inlinealert-spacing-header-content-button`
71+
`--mod-inlinealert-spacing-header-to-icon`
72+
73+
##### New custom properties
74+
75+
`--spectrum-inlinealert-min-spacing-header-to-icon`
76+
`--spectrum-inlinealert-spacing-content-link-button`
77+
`--spectrum-inlinealert-spacing-header-content`
78+
79+
##### Removed custom properties
80+
81+
`--spectrum-inlinealert-spacing-header-content-button`
82+
`--spectrum-inlinealert-spacing-header-to-icon`

components/inlinealert/dist/metadata.json

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,33 @@
22
"sourceFile": "index.css",
33
"selectors": [
44
".spectrum-InLineAlert",
5-
".spectrum-InLineAlert--info",
6-
".spectrum-InLineAlert--info .spectrum-InLineAlert-icon",
7-
".spectrum-InLineAlert--negative",
8-
".spectrum-InLineAlert--negative .spectrum-InLineAlert-icon",
9-
".spectrum-InLineAlert--notice",
10-
".spectrum-InLineAlert--notice .spectrum-InLineAlert-icon",
11-
".spectrum-InLineAlert--positive",
12-
".spectrum-InLineAlert--positive .spectrum-InLineAlert-icon",
135
".spectrum-InLineAlert-content",
146
".spectrum-InLineAlert-footer",
157
".spectrum-InLineAlert-footer:empty",
168
".spectrum-InLineAlert-header",
17-
".spectrum-InLineAlert-icon"
9+
".spectrum-InLineAlert-icon",
10+
".spectrum-InLineAlert.spectrum-InLineAlert--bold",
11+
".spectrum-InLineAlert.spectrum-InLineAlert--bold:not(.spectrum-InLineAlert--subtle, .spectrum-InLineAlert--notice)",
12+
".spectrum-InLineAlert.spectrum-InLineAlert--info",
13+
".spectrum-InLineAlert.spectrum-InLineAlert--info.spectrum-InLineAlert--bold",
14+
".spectrum-InLineAlert.spectrum-InLineAlert--info.spectrum-InLineAlert--subtle",
15+
".spectrum-InLineAlert.spectrum-InLineAlert--negative",
16+
".spectrum-InLineAlert.spectrum-InLineAlert--negative.spectrum-InLineAlert--bold",
17+
".spectrum-InLineAlert.spectrum-InLineAlert--negative.spectrum-InLineAlert--subtle",
18+
".spectrum-InLineAlert.spectrum-InLineAlert--neutral",
19+
".spectrum-InLineAlert.spectrum-InLineAlert--neutral.spectrum-InLineAlert--bold",
20+
".spectrum-InLineAlert.spectrum-InLineAlert--neutral.spectrum-InLineAlert--subtle",
21+
".spectrum-InLineAlert.spectrum-InLineAlert--notice",
22+
".spectrum-InLineAlert.spectrum-InLineAlert--notice.spectrum-InLineAlert--bold",
23+
".spectrum-InLineAlert.spectrum-InLineAlert--notice.spectrum-InLineAlert--subtle",
24+
".spectrum-InLineAlert.spectrum-InLineAlert--positive",
25+
".spectrum-InLineAlert.spectrum-InLineAlert--positive.spectrum-InLineAlert--bold",
26+
".spectrum-InLineAlert.spectrum-InLineAlert--positive.spectrum-InLineAlert--subtle",
27+
".spectrum-InLineAlert.spectrum-InLineAlert--subtle"
1828
],
1929
"modifiers": [
2030
"--mod-inlinealert-background-color",
2131
"--mod-inlinealert-border-and-icon-color",
22-
"--mod-inlinealert-border-and-icon-color-info",
23-
"--mod-inlinealert-border-and-icon-color-negative",
24-
"--mod-inlinealert-border-and-icon-color-notice",
25-
"--mod-inlinealert-border-and-icon-color-positive",
2632
"--mod-inlinealert-border-radius",
2733
"--mod-inlinealert-border-width",
2834
"--mod-inlinealert-content-color",
@@ -40,18 +46,15 @@
4046
"--mod-inlinealert-heading-line-height",
4147
"--mod-inlinealert-icon-size",
4248
"--mod-inlinealert-min-inline-size",
49+
"--mod-inlinealert-min-spacing-header-to-icon",
50+
"--mod-inlinealert-spacing-content-link-button",
4351
"--mod-inlinealert-spacing-edge-to-text",
44-
"--mod-inlinealert-spacing-header-content-button",
45-
"--mod-inlinealert-spacing-header-to-icon"
52+
"--mod-inlinealert-spacing-header-content"
4653
],
4754
"component": [
4855
"--spectrum-in-line-alert-minimum-width",
4956
"--spectrum-inlinealert-background-color",
5057
"--spectrum-inlinealert-border-and-icon-color",
51-
"--spectrum-inlinealert-border-and-icon-color-info",
52-
"--spectrum-inlinealert-border-and-icon-color-negative",
53-
"--spectrum-inlinealert-border-and-icon-color-notice",
54-
"--spectrum-inlinealert-border-and-icon-color-positive",
5558
"--spectrum-inlinealert-border-radius",
5659
"--spectrum-inlinealert-border-width",
5760
"--spectrum-inlinealert-content-color",
@@ -69,39 +72,54 @@
6972
"--spectrum-inlinealert-heading-line-height",
7073
"--spectrum-inlinealert-icon-size",
7174
"--spectrum-inlinealert-min-inline-size",
75+
"--spectrum-inlinealert-min-spacing-header-to-icon",
76+
"--spectrum-inlinealert-spacing-content-link-button",
7277
"--spectrum-inlinealert-spacing-edge-to-text",
73-
"--spectrum-inlinealert-spacing-header-content-button",
74-
"--spectrum-inlinealert-spacing-header-to-icon"
78+
"--spectrum-inlinealert-spacing-header-content"
7579
],
7680
"global": [
7781
"--spectrum-background-layer-2-color",
82+
"--spectrum-black",
7883
"--spectrum-body-color",
7984
"--spectrum-body-line-height",
8085
"--spectrum-body-sans-serif-font-style",
8186
"--spectrum-body-sans-serif-font-weight",
8287
"--spectrum-body-size-s",
8388
"--spectrum-border-width-200",
8489
"--spectrum-component-height-50",
85-
"--spectrum-corner-radius-100",
90+
"--spectrum-corner-radius-700",
8691
"--spectrum-heading-color",
8792
"--spectrum-heading-line-height",
8893
"--spectrum-heading-sans-serif-font-style",
8994
"--spectrum-heading-sans-serif-font-weight",
9095
"--spectrum-heading-size-xxs",
96+
"--spectrum-informative-background-color-default",
97+
"--spectrum-informative-subtle-background-color-default",
9198
"--spectrum-informative-visual-color",
99+
"--spectrum-negative-background-color-default",
100+
"--spectrum-negative-subtle-background-color-default",
92101
"--spectrum-negative-visual-color",
102+
"--spectrum-neutral-background-color-default",
103+
"--spectrum-neutral-subtle-background-color-default",
93104
"--spectrum-neutral-visual-color",
105+
"--spectrum-notice-background-color-default",
106+
"--spectrum-notice-subtle-background-color-default",
94107
"--spectrum-notice-visual-color",
108+
"--spectrum-positive-background-color-default",
109+
"--spectrum-positive-subtle-background-color-default",
95110
"--spectrum-positive-visual-color",
96111
"--spectrum-sans-font-family-stack",
112+
"--spectrum-spacing-100",
113+
"--spectrum-spacing-200",
97114
"--spectrum-spacing-300",
98-
"--spectrum-spacing-400",
115+
"--spectrum-white",
99116
"--spectrum-workflow-icon-size-100"
100117
],
101118
"passthroughs": [],
102119
"high-contrast": [
103120
"--highcontrast-inlinealert-background-color",
104121
"--highcontrast-inlinealert-border-and-icon-color",
122+
"--highcontrast-inlinealert-border-width",
105123
"--highcontrast-inlinealert-content-color",
106124
"--highcontrast-inlinealert-header-color"
107125
]

0 commit comments

Comments
 (0)