Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(toast): migrate to Spectrum 2 #2599

Draft
wants to merge 32 commits into
base: spectrum-two
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4d13b98
feat(tokens): use 13.0.0-beta.5
pfulton Dec 11, 2023
c3529ef
feat(tokens): use 13.0.0-beta.8
pfulton Jan 8, 2024
064b226
feat(tokens): use 13.0.0-beta.9
pfulton Jan 11, 2024
e764bdd
chore(tokens): rebuild and update build artifacts
pfulton Jan 19, 2024
43dc7bd
feat(actiongroup)!: migrate to S2 (#2453)
mdt2 Feb 2, 2024
8c6c67f
feat(buttongroup)!: migrate to S2 (#2457)
jenndiaz Feb 2, 2024
9433811
feat(tokens)!: use 13.0.0-beta.13
pfulton Feb 2, 2024
0f75488
chore(release): release
pfulton Feb 6, 2024
8dc1a4a
feat(tokens)!: use spectrum-tokens 13.0.0-beta.16
pfulton Feb 22, 2024
43cee33
chore(actiongroup,buttongroup): specify s2 tokens for peerdeps
pfulton Feb 26, 2024
f3e70cf
chore: update yarn.lock file
pfulton Feb 26, 2024
d212c77
feat(closebutton)!: migrate to S2 (#2564)
mdt2 Mar 7, 2024
dbdf26a
chore: s2 grays component-level migration (#2583)
pfulton Mar 7, 2024
0df429f
fix(closebutton): use correct casing for class names
pfulton Mar 8, 2024
e77fe91
fix(commons): remove renamed mods marked for deprecation (#2580)
jawinn Mar 8, 2024
662cc1c
feat(fieldlabel)!: s2 migration (#2569)
jawinn Mar 11, 2024
ccd57bd
chore(tokens): use spectrum-tokens v13.0.0-beta.19
pfulton Mar 11, 2024
77435f3
chore(tokens): manual version bump for 14.0.0-next.1
pfulton Mar 12, 2024
d7d2511
chore(release): release
pfulton Mar 12, 2024
964ff12
feat(downstate): docs + implementation for example components (#2520)
mdt2 Mar 19, 2024
7e78b53
fix(button): resolve merge issue
pfulton Mar 19, 2024
df0cdd4
feat(tokens): use spectrum-tokens 13.0.0-beta.21 (#2597)
pfulton Mar 19, 2024
b812a2a
chore(release): release
pfulton Mar 21, 2024
bad3ec2
chore: rebase against main and update components to use prerelease to…
pfulton Mar 28, 2024
e700715
feat(cornerrounding): add custom token and foundations documentation …
jenndiaz Mar 28, 2024
810fa5e
fix(storybook): body classes for story and docs pages (#2617)
mdt2 Apr 1, 2024
9b745e7
ci: support skipped vrt for build (#2633)
castastrophe Apr 2, 2024
c425d27
feat(toast)!: migrate to s2
pfulton Mar 13, 2024
bc8e080
docs: update migration guide
mdt2 Apr 2, 2024
9b5c1a4
docs(storybook): add variant switcher in controls
mdt2 Apr 2, 2024
3be6696
fix: close button color
mdt2 Apr 2, 2024
7cf9077
refactor: remove unused/unnecessary code
mdt2 Apr 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .storybook/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ This component has been deprecated. Use an action bar to allow users to perform
##7.4.2
🗓
2024-02-06
<a name="7.4.2-next.0"></a>
##7.4.2-next.0
🗓
2024-02-06 • 📝 [Commits](https://github.com/adobe/spectrum-css/compare/@spectrum-css/preview@7.4.1...@spectrum-css/preview@7.4.2-next.0)

**Note:** Spectrum 2 next version
**Note:** Version bump only for package @spectrum-css/preview

<a name="7.4.1"></a>
Expand Down
10 changes: 8 additions & 2 deletions .storybook/decorators/contextsWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const withContextWrapper = makeDecorator({
name: "withContextWrapper",
parameterName: "context",
wrapper: (StoryFn, context) => {
const { args, argTypes, viewMode } = context;
const { args, argTypes, id, viewMode } = context;

const getDefaultValue = (type) => {
if (!type) return null;
Expand All @@ -31,7 +31,13 @@ export const withContextWrapper = makeDecorator({
const scales = ["medium", "large"];

useEffect(() => {
const container = viewMode === "docs" && !window.isChromatic() ? document.querySelector('#root-inner') ?? document.body : document.body;
const container =
viewMode === "docs" &&
!window.isChromatic() &&
!id.includes('foundation')
? document.querySelector('#root-inner') ?? document.body
: document.body;

container.classList.toggle("spectrum", true);

container.classList.toggle("spectrum--express", isExpress);
Expand Down
1 change: 1 addition & 0 deletions .storybook/decorators/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { makeDecorator, useEffect } from "@storybook/preview-api";
import { html } from "lit";

export { withContextWrapper } from "./contextsWrapper.js";
export { withDownStateDimensionCapture } from "./withDownStateDimensionCapture.js";
export { withTestingPreviewWrapper } from "./withTestingPreviewWrapper.js";

/**
Expand Down
19 changes: 19 additions & 0 deletions .storybook/decorators/withDownStateDimensionCapture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const withDownStateDimensionCapture = (selector) => (Story, context) => {
const captureDownStateDimensions = () => {
const components = document.querySelectorAll(selector);
components.forEach((component) => {
const { width, height } = component.getBoundingClientRect();
component.style.setProperty('--spectrum-downstate-width', `${width}px`);
component.style.setProperty('--spectrum-downstate-height', `${height}px`);
});
};

document.addEventListener("DOMContentLoaded", () => {
// Wait to make sure the story is fully rendered (otherwise width/height can be wrong)
setTimeout(() => {
captureDownStateDimensions();
}, 100);
});

return Story(context);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import { html } from "lit";
import { Template } from "../../../components/actionbutton/stories/template";

export default {
title: "Foundations/Corner rounding",
description:
"The action button component represents an action a user can take.",
component: "ActionButton",
args: {
rootClass: "spectrum-ActionButton",
},
parameters: {
actions: {
handles: ["click .spectrum-ActionButton:not([disabled])"],
},
},
tags: ['foundation'],
};

const ActionButton = ({
...args
}) => {
return html`
<div style="padding: 1rem 0;">
${Template({
...args,
iconName: undefined,
})}
</div>
`;
};

const ActionButtonTable = ({ ...args }) => {
return html`
<table class="spectrum-Foundations-Example-CornerRounding-table">
<thead>
<tr>
<th scope="col">Token</th>
<th scope="col" style="padding: 0 2rem;">Value</th>
<th scope="col">Medium example</th>
</tr>
</thead>
<tbody>
<tr>
<td>--spectrum-corner-radius-medium-size-extra-small</td>
<td style="padding: 0 2rem;">6px</td>
<td>
${ActionButton({
...args,
label: "Extra Small",
size: "xs"
})}
</td>
</tr>
<tr>
<td>--spectrum-corner-radius-medium-size-small</td>
<td style="padding: 0 2rem;">7px</td>
<td>
${ActionButton({
...args,
label: "Small",
size: "s"
})}
</td>
</tr>
<tr>
<td>--spectrum-corner-radius-medium-size-medium</td>
<td style="padding: 0 2rem;">8px</td>
<td>
${ActionButton({
...args,
label: "Medium",
size: "m"
})}
</td>
</tr>
<tr>
<td>--spectrum-corner-radius-medium-size-large</td>
<td style="padding: 0 2rem;">9px</td>
<td>
${ActionButton({
...args,
label: "Large",
size: "l"
})}
</td>
</tr>
<tr>
<td>--spectrum-corner-radius-medium-size-extra-large</td>
<td style="padding: 0 2rem;">10px</td>
<td>
${ActionButton({
...args,
label: "Extra Large",
size: "xl"
})}
</td>
</tr>
</tbody>
</table>
`;
};

export const ActionButtonExamples = ActionButtonTable.bind({});
ActionButtonExamples.args = {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Import the component markup template
import { html } from "lit";
import { Template } from "../../../components/checkbox/stories/template";

export default {
title: "Foundations/Corner rounding",
description:
"Checkboxes allow users to select multiple items from a list of individual items, or mark one individual item as selected.",
component: "Checkbox",
args: {
rootClass: "spectrum-Checkbox",
},
parameters: {
actions: {
handles: ['click input[type="checkbox"]'],
},
},
tags: ['foundation'],
};

const Checkbox = ({
customStyles = {},
isChecked = false,
...args
}) => {
return html`
<div style="padding: 1rem 0;">
${Template({
...args,
iconName: undefined,
})}
</div>
`;
};

const CheckboxTable = ({...args}) => {
return html`
<table class="spectrum-Foundations-Example-CornerRounding-table">
<thead>
<tr>
<th scope="col">Token</th>
<th scope="col" style="padding: 0 2rem;">Value</th>
<th scope="col">Small example</th>
</tr>
</thead>
<tbody>
<tr>
<td>--spectrum-corner-radius-small-size-small</td>
<td style="padding: 0 2rem;">3px</td>
<td>
${Checkbox({
...args,
label: "Small",
size: "s"
})}
</td>
</tr>
<tr>
<td>--spectrum-corner-radius-small-size-medium</td>
<td style="padding: 0 2rem;">4px</td>
<td>
${Checkbox({
...args,
label: "Medium",
size: "m"
})}
</td>
</tr>
<tr>
<td>--spectrum-corner-radius-small-size-large</td>
<td style="padding: 0 2rem;">5px</td>
<td>
${Checkbox({
...args,
label: "Large",
size: "l"
})}
</td>
</tr>
<tr>
<td>--spectrum-corner-radius-small-size-extra-large</td>
<td style="padding: 0 2rem;">6px</td>
<td>
${Checkbox({
...args,
label: "Extra Large",
size: "xl"
})}
</td>
</tr>
</tbody>
</table>
`;
}

export const CheckboxExamples = CheckboxTable.bind({});
CheckboxExamples.args = {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
| Component size token | Alias token (if available) | Global token | Value |
|---------------------------------------------------|-------------------------------|------------------------------|-------|
| --spectrum-corner-radius-medium-size-extra-small | | --spectrum-corner-radius-300 | 6px |
| --spectrum-corner-radius-medium-size-small | | --spectrum-corner-radius-400 | 7px |
| --spectrum-corner-radius-medium-size-medium | --spectrum-corner-radius-medium-default | --spectrum-corner-radius-500 | 8px |
| --spectrum-corner-radius-medium-size-large | | --spectrum-corner-radius-600 | 9px |
| --spectrum-corner-radius-medium-size-extra-large | --spectrum-corner-radius-large-default | --spectrum-corner-radius-700 | 10px |
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
| Component size token | Alias token (if available) | Global token | Value |
|---------------------------------------------------|-------------------------------|------------------------------|-------|
| --spectrum-corner-radius-small-size-small | | --spectrum-corner-radius-75 | 3px |
| --spectrum-corner-radius-small-size-medium | --spectrum-corner-radius-small-default | --spectrum-corner-radius-100 | 4px |
| --spectrum-corner-radius-small-size-large | | --spectrum-corner-radius-200 | 5px |
| --spectrum-corner-radius-small-size-extra-large | | --spectrum-corner-radius-300 | 6px |
26 changes: 26 additions & 0 deletions .storybook/foundations/corner-rounding/corner-rounding.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Meta, Canvas, Story, Title, Unstyled } from '@storybook/blocks';
import * as CornerRoundingStories from './corner-rounding.stories.js';
import * as CheckboxStories from './checkbox-corner-rounding.stories.js';
import * as ActionButtonStories from './action-button-corner-rounding.stories.js';

<Meta of={CornerRoundingStories} />

<Title />

## Default values

<Story of={CornerRoundingStories.CornerRounding} />

## Component examples

### Small tokens

Checkbox includes small component size tokens to scale corner rounding.

<Story of={CheckboxStories.CheckboxExamples} />

### Medium tokens

Action button includes medium component size tokens to scale corner rounding.

<Story of={ActionButtonStories.ActionButtonExamples} />
75 changes: 75 additions & 0 deletions .storybook/foundations/corner-rounding/corner-rounding.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Import the component markup template
import { html } from "lit";
import { Template } from './template';

export default {
title: "Foundations/Corner rounding",
description:
"Corner rounding is a foundation that shows the different border-radius tokens that can be applied to a component.",
component: "Corner rounding",
args: {
rootClass: "spectrum-Foundations-Example-CornerRounding",
},
tags: ['foundation'],
};

const CornerRadiusGroup = ({
customStyles = {},
...args
}) => {
return html`
<div>
<table class="spectrum-Foundations-Example-CornerRounding-table">
<thead>
<tr>
<th scope="col">Token</th>
<th scope="col" style="padding: 0 2rem;">Value</th>
<th scope="col">Example<br>(No Border)</th>
<th scope="col">Example<br>(Border)</th>
</tr>
</thead>
<tbody>
${Template({
...args,
label: '--spectrum-corner-radius-none',
size: 'none',
value: '0px',
})}
${Template({
...args,
label: '--spectrum-corner-radius-small-default',
size: 's',
value: '4px',
})}
${Template({
...args,
label: '--spectrum-corner-radius-medium-default',
size: 'm',
value: '8px',
})}
${Template({
...args,
label: '--spectrum-corner-radius-large-default',
size: 'l',
value: '10px',
})}
${Template({
...args,
label: '--spectrum-corner-radius-extra-large-default',
size: 'xl',
value: '16px',
})}
${Template({
...args,
label: '--spectrum-corner-radius-full',
size: 'full',
value: '9999px',
})}
</tbody>
</table>
</div>
`;
};

export const CornerRounding = CornerRadiusGroup.bind({});
CornerRounding.args = {};