Skip to content

Commit a42d574

Browse files
committed
Merge branch 'main' into aramos-adobe/css868-combobox-readonly
2 parents bcf877c + 5eea58b commit a42d574

File tree

95 files changed

+633
-463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+633
-463
lines changed

.storybook/assets/base.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* stylelint-disable selector-class-pattern -- Targeting pre-defined Storybook classes */
2+
13
/*!
24
* Copyright 2024 Adobe. All rights reserved.
35
*
@@ -11,7 +13,6 @@
1113
* governing permissions and limitations under the License.
1214
*/
1315

14-
/* stylelint-disable selector-class-pattern */
1516
body {
1617
--spectrum-font-family: var(--spectrum-sans-font-family-stack);
1718
--spectrum-font-style: var(--spectrum-default-font-style);
@@ -67,4 +68,5 @@ svg:has(symbol):not(:has(use)) {
6768
story view), due to Storybook's inline style that sets overflow: auto */
6869
overflow: visible !important;
6970
}
71+
7072
/* stylelint-enable selector-class-pattern */

.storybook/assets/images/wc_logo.svg

Lines changed: 28 additions & 0 deletions
Loading

.storybook/assets/index.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* stylelint-disable selector-class-pattern -- Targeting pre-defined Storybook classes */
2+
13
/*!
24
* Copyright 2024 Adobe. All rights reserved.
35
*
@@ -11,7 +13,6 @@
1113
* governing permissions and limitations under the License.
1214
*/
1315

14-
/* stylelint-disable selector-class-pattern */
1516
body {
1617
--spectrum-font-family-ar: myriad-arabic, adobe-clean, "Source Sans Pro", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, ubuntu, "Trebuchet MS", "Lucida Grande", sans-serif;
1718
--spectrum-font-family-he: myriad-hebrew, adobe-clean, "Source Sans Pro", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, ubuntu, "Trebuchet MS", "Lucida Grande", sans-serif;
@@ -66,6 +67,15 @@ nav .spectrum-Site-logo {
6667
padding: 20px !important;
6768
}
6869

70+
/* Hide that first divider line in the top navigation */
71+
div.sb-bar > div > div > span:first-child {
72+
display: none;
73+
}
74+
75+
div.sb-bar > div > div > div > button {
76+
background-color: white !important;
77+
}
78+
6979
.docblock-argstable-body tr td {
7080
letter-spacing: unset;
7181
font-size: 11px;
@@ -118,4 +128,5 @@ select:focus,
118128
border-color: rgb(2, 101, 220) !important;
119129
box-shadow: rgb(2, 101, 220) 0 0 0 1px inset !important;
120130
}
131+
121132
/* stylelint-enable selector-class-pattern */

.storybook/blocks/ComponentDetails.jsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import React, { useEffect, useState } from "react";
55
import AdobeSVG from "../assets/images/adobe_logo.svg?raw";
66
import GitHubSVG from "../assets/images/github_logo.svg?raw";
77
import NpmSVG from "../assets/images/npm_logo.svg?raw";
8+
import WCSVG from "../assets/images/wc_logo.svg?raw";
89
import { Body, Code, Heading } from "./Typography.jsx";
910
import { fetchToken } from "./utilities.js";
1011

@@ -121,6 +122,7 @@ export const ResourceLink = styled.a`
121122
border-color: rgb(230, 230, 230);
122123
overflow: hidden;
123124
color: rgb(0, 0, 0);
125+
background-color: rgba(255 255 255 / 80%);
124126
125127
&:hover {
126128
border-color: rgb(213, 213, 213);
@@ -314,6 +316,8 @@ const fetchLogo = (brand) => {
314316
return GitHubSVG;
315317
case "Adobe":
316318
return AdobeSVG;
319+
case "WC":
320+
return WCSVG;
317321
}
318322

319323
return;
@@ -361,23 +365,35 @@ export const ResourceLinkContent = ({ heading, alt, logo, href }) => {
361365
export const ResourceListDetails = ({ packageName, spectrumData = [], rootClassName, isDeprecated }) => {
362366
if (!packageName) return;
363367

364-
let href;
368+
let swc, href;
365369

366370
for(let i = 0; i < spectrumData?.length; i++) {
367-
if (spectrumData[i]?.guidelines && spectrumData[i]?.rootClass === rootClassName) {
371+
const thisComponent = !spectrumData[i]?.rootClass || spectrumData[i]?.rootClass === rootClassName;
372+
if (spectrumData[i]?.guidelines && thisComponent) {
368373
href = spectrumData[i]?.guidelines;
369374
}
375+
376+
if (spectrumData[i]?.swc && thisComponent) {
377+
swc = spectrumData[i]?.swc;
378+
}
370379
}
371380

372381
return (
373382
<ResourceSection className="sb-unstyled">
374383
{href ?
375384
<ResourceLinkContent
376385
className="doc-block-resource-cards"
377-
heading="View guidelines"
386+
heading="Design guidelines"
378387
alt="Spectrum website"
379388
logo="Adobe"
380389
href={href}/> : ""}
390+
{swc ?
391+
<ResourceLinkContent
392+
className="doc-block-resource-cards"
393+
heading="Web components"
394+
alt="Spectrum web components"
395+
logo="WC"
396+
href={swc}/> : ""}
381397
<ResourceLinkContent
382398
className="doc-block-resource-cards"
383399
heading="View package"

.storybook/decorators/utilities.js

Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Template as Typography } from "@spectrum-css/typography/stories/template.js";
21
import { html, nothing } from "lit";
32
import { styleMap } from "lit/directives/style-map.js";
43
import { when } from "lit/directives/when.js";
@@ -11,26 +10,58 @@ import { capitalize } from "lodash-es";
1110
* @param {string} props.content - The content to render in the heading or code block.
1211
* @param {string} props.size - The size of the heading to render.
1312
* @param {string} props.weight - The weight of the heading to render.
14-
* @param {string[]} props.customClasses - Additional classes to apply to the heading or code block.
1513
*/
1614
const Heading = ({
1715
semantics = "heading",
1816
content,
1917
size = "l",
2018
weight,
21-
customClasses = [],
22-
} = {}) => {
23-
return Typography({
24-
semantics,
25-
size,
26-
weight,
27-
content,
28-
skipLineBreak: true,
29-
customClasses: ["chromatic-ignore", ...customClasses],
30-
customStyles: {
31-
"color": semantics === "detail" ? "var(--spectrum-heading-color)" : undefined,
19+
} = {}, context = {}) => {
20+
if (!content) return nothing;
21+
22+
const headingStyles = {
23+
"display": "block",
24+
"color": "black",
25+
"font-family": 'adobe-clean, "adobe clean", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Trebuchet MS", "Lucida Grande", sans-serif',
26+
"font-size": "11px",
27+
"line-height": "1.3",
28+
"font-weight": "700",
29+
};
30+
31+
if ((size === "xxs" && semantics === "heading") || size === "l") {
32+
headingStyles["font-size"] = "14px";
33+
}
34+
35+
if (semantics === "detail") {
36+
headingStyles["letter-spacing"] = ".06em";
37+
headingStyles["text-transform"] = "uppercase";
38+
}
39+
40+
if (weight === "light") {
41+
if (semantics === "heading") {
42+
headingStyles["font-weight"] = "300";
43+
}
44+
else {
45+
headingStyles["font-weight"] = "400";
3246
}
33-
});
47+
}
48+
49+
if (context.globals?.color.startsWith("dark")) {
50+
headingStyles["color"] = context?.args?.staticColor ?? "white";
51+
}
52+
else if (typeof context?.args?.staticColor !== "undefined") {
53+
headingStyles["color"] = context?.args?.staticColor;
54+
}
55+
56+
57+
return html`
58+
<span
59+
class="chromatic-ignore"
60+
style=${styleMap(headingStyles)}
61+
>
62+
${content}
63+
</span>
64+
`;
3465
};
3566

3667
/**
@@ -54,7 +85,8 @@ export const Container = ({
5485
withBorder = true,
5586
containerStyles = {},
5687
wrapperStyles = {},
57-
} = {}) => {
88+
} = {}, context = {}) => {
89+
const isDocs = context?.viewMode === "docs";
5890
const headingConfig = { size: "l", semantics: type };
5991
let gap = 40;
6092

@@ -100,6 +132,13 @@ export const Container = ({
100132
${when(heading, () => Heading({
101133
...headingConfig,
102134
content: heading
135+
}, {
136+
...context,
137+
globals: {
138+
...context.globals ?? {},
139+
// If the level is 1 and we are not in docs view, use the light color theme for the heading
140+
color: level === 1 && !isDocs ? "light" : context.globals?.color,
141+
}
103142
}))}
104143
<div
105144
data-inner-container
@@ -117,7 +156,7 @@ export const Container = ({
117156
...wrapperStyles,
118157
})}
119158
>
120-
${renderContent(content)}
159+
${renderContent(content, { context })}
121160
</div>
122161
</div>
123162
`;
@@ -173,6 +212,15 @@ export const States = ({
173212
return nothing
174213
}
175214

215+
context = {
216+
...context,
217+
args: {
218+
...context.args,
219+
...args,
220+
...item,
221+
}
222+
};
223+
176224
return Container({
177225
heading: stateData.some(({ testHeading }) => testHeading) ? testHeading : "",
178226
level: 3,
@@ -182,9 +230,9 @@ export const States = ({
182230
...stateWrapperStyles,
183231
},
184232
content: Template({ ...args, ...item }, context),
185-
});
233+
}, context);
186234
})
187-
});
235+
}, context);
188236
};
189237

190238
/**
@@ -264,8 +312,8 @@ export const ArgGrid = ({
264312
...(typeof args?.name !== "undefined" ? {name: `${args.name}-${argKey}-${index}`} : {}),
265313
...(typeof args?.id !== "undefined" ? {id: `${args.id}-${argKey}-${index}`} : {}),
266314
}, context)
267-
})),
268-
});
315+
}, context)),
316+
}, context);
269317
};
270318

271319
/**
@@ -450,7 +498,7 @@ export const Variants = ({
450498
() => AltTemplate(data, context)
451499
)}
452500
`,
453-
});
501+
}, context);
454502
}
455503
)}
456504

components/accordion/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"spectrum": [
5353
{
5454
"guidelines": "https://spectrum-contributions.corp.adobe.com/page/accordion-beta",
55-
"rootClass": "spectrum-Accordion"
55+
"rootClass": "spectrum-Accordion",
56+
"swc": "https://opensource.adobe.com/spectrum-web-components/components/accordion/"
5657
}
5758
]
5859
}

components/actionbar/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"spectrum": [
5959
{
6060
"guidelines": "https://spectrum.adobe.com/page/action-bar",
61-
"rootClass": "spectrum-ActionBar"
61+
"rootClass": "spectrum-ActionBar",
62+
"swc": "https://opensource.adobe.com/spectrum-web-components/components/action-bar/"
6263
}
6364
]
6465
}

components/actionbutton/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"spectrum": [
5959
{
6060
"guidelines": "https://spectrum.adobe.com/page/action-button",
61-
"rootClass": "spectrum-ActionButton"
61+
"rootClass": "spectrum-ActionButton",
62+
"swc": "https://opensource.adobe.com/spectrum-web-components/components/action-button/"
6263
}
6364
]
6465
}

components/actionbutton/stories/template.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const ActionButtonsWithIconOptions = (args, context) => Container({
158158
hasPopup: "true",
159159
}, context)}
160160
`
161-
});
161+
}, context);
162162

163163
export const IconOnlyOption = (args, context) => Container({
164164
withBorder: false,
@@ -179,7 +179,7 @@ export const IconOnlyOption = (args, context) => Container({
179179
hasPopup: "true",
180180
}, context)}
181181
`
182-
});
182+
}, context);
183183

184184
export const TreatmentTemplate = (args, context) => Container({
185185
withBorder: false,
@@ -200,5 +200,5 @@ export const TreatmentTemplate = (args, context) => Container({
200200
isSelected,
201201
isDisabled,
202202
})
203-
}, context ))}`,
204-
});
203+
}, context))}`,
204+
}, context);

components/actiongroup/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
"spectrum": [
5454
{
5555
"guidelines": "https://spectrum.adobe.com/page/action-group",
56-
"rootClass": "spectrum-ActionGroup"
56+
"rootClass": "spectrum-ActionGroup",
57+
"swc": "https://opensource.adobe.com/spectrum-web-components/components/action-group/"
5758
}
5859
]
5960
}

0 commit comments

Comments
 (0)