Skip to content

Commit

Permalink
Merge branch 'spectrum-two' into jawinn/css-616-s2-button
Browse files Browse the repository at this point in the history
  • Loading branch information
jawinn committed Mar 20, 2024
2 parents 8e912b7 + 5570088 commit 8b472dc
Show file tree
Hide file tree
Showing 250 changed files with 3,799 additions and 3,338 deletions.
7 changes: 7 additions & 0 deletions .github/actions/file-diff/CHANGELOG.md
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

<a name="2.0.5"></a>
##2.0.5
🗓
2024-03-07 • 📝 [Commits](https://github.com/adobe/spectrum-css/compare/@spectrum-tools/gh-action-file-diff@2.0.4...@spectrum-tools/gh-action-file-diff@2.0.5)

**Note:** Version bump only for package @spectrum-tools/gh-action-file-diff

<a name="2.0.4"></a>
##2.0.4
🗓
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/file-diff/package.json
@@ -1,12 +1,12 @@
{
"name": "@spectrum-tools/gh-action-file-diff",
"version": "2.0.4",
"version": "2.0.5",
"description": "A GitHub Action to compare asset sizes and generate a diff if changes are found.",
"license": "Apache-2.0",
"author": "Adobe",
"main": "index.js",
"dependencies": {
"@actions/artifact": "^2.1.1",
"@actions/artifact": "^2.1.4",
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@actions/glob": "^0.4.0",
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/development.yml
Expand Up @@ -9,6 +9,7 @@ name:
# -------------------------------------------------------------

on:
merge_group:
pull_request:
branches:
- main
Expand All @@ -17,11 +18,6 @@ on:
- chore-*ci*
- chore-*github-actions*

# todo: we can get even more detailed with this later by evaluating what influences the built assets
paths-ignore:
- "LICENSE"
- "*.hbs"

types:
- opened
- synchronize
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vrt.yml
Expand Up @@ -60,7 +60,7 @@ jobs:

- name: Publish to Chromatic
id: chromatic
uses: chromaui/action@v10
uses: chromaui/action@v11
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
buildScriptName: ci:storybook
Expand Down
7 changes: 7 additions & 0 deletions .storybook/CHANGELOG.md
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

<a name="8.0.4"></a>
##8.0.4
🗓
2024-03-07 • 📝 [Commits](https://github.com/adobe/spectrum-css/compare/@spectrum-css/preview@8.0.3...@spectrum-css/preview@8.0.4)

**Note:** Version bump only for package @spectrum-css/preview

<a name="8.0.3"></a>
##8.0.3
🗓
Expand Down
11 changes: 5 additions & 6 deletions .storybook/DocumentationTemplate.mdx
Expand Up @@ -2,15 +2,12 @@

import { Meta, Title, Subtitle, Description, Primary, Controls, Stories } from '@storybook/blocks';

{/*
* 👇 The isTemplate property is required to tell Storybook that this is a template
* See https://storybook.js.org/docs/react/api/doc-block-meta
* to learn how to use
*/}

{/* 👇 The isTemplate property is required to tell Storybook that this is a template */}
<Meta isTemplate />

<Title />
<Subtitle />
<Description />

<Primary />

Expand All @@ -19,3 +16,5 @@ import { Meta, Title, Subtitle, Description, Primary, Controls, Stories } from '
The component accepts the following inputs (properties):

<Controls />

<Stories includePrimary={ false } />
1 change: 1 addition & 0 deletions .storybook/decorators/index.js
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
@@ -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);
};
32 changes: 32 additions & 0 deletions .storybook/foundations/down-state/button-down-state.stories.js
@@ -0,0 +1,32 @@
import { Template } from "../../../components/button/stories/template";

export default {
title: "Foundations/Down state",
description:
"Buttons allow users to perform an action or to navigate to another page. They have multiple styles for various needs, and are ideal for calling attention to where a user needs to do something in order to move forward in a flow.",
component: "Button",
args: {
rootClass: "spectrum-Button",
},
parameters: {
actions: {
handles: ['click .spectrum-Button'],
},
status: {
type: process.env.MIGRATED_PACKAGES.includes("button")
? "migrated"
: undefined,
},
},
tags: ['foundation'],
};

export const ButtonDownState = Template.bind({});
ButtonDownState.args = {
label: "Edit",
variant: "accent",
customStyles: {
"--spectrum-downstate-width": "72px",
"--spectrum-downstate-height": "32px"
}
};
27 changes: 27 additions & 0 deletions .storybook/foundations/down-state/checkbox-down-state.stories.js
@@ -0,0 +1,27 @@
import { Template } from "../../../components/checkbox/stories/template";

export default {
title: "Foundations/Down state",
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"]'],
},
status: {
type: process.env.MIGRATED_PACKAGES.includes("checkbox")
? "migrated"
: undefined,
},
},
tags: ['foundation'],
};

export const CheckboxDownState = Template.bind({});
CheckboxDownState.args = {
label: "Checkbox",
};
44 changes: 44 additions & 0 deletions .storybook/foundations/down-state/down-state.mdx
@@ -0,0 +1,44 @@
import { Meta, Story } from '@storybook/blocks';
import * as Checkbox from './checkbox-down-state.stories.js';
import * as Button from './button-down-state.stories.js';

<Meta title="Foundations/Down state" />

# Down state

Down state is a Spectrum 2 feature that creates the illusion of components being pressed-in when active. This functionality is already included in Spectrum 2 components that require down state in this project. It is implemented with a CSS transform. The implementation depends on the size of the interactable element, as shown in the examples below.

## Examples

### Minimum perspective

For elements that have a width of 24px or less, the minimum perspective token is used to apply the down state. One example of a component that uses this token is the checkbox:

<Story of={Checkbox.CheckboxDownState} />

In this case, we use the minimum perspective token:

```
transform:
perspective(var(--spectrum-component-size-minimum-perspective-down))
translateZ(var(--spectrum-component-size-difference-down));
```

### Calculated perspective

For elements that have a width of greater than 24px, we need to use the component's width and height to apply the down state. One example of a component that uses this logic is the button:

<Story of={Button.ButtonDownState} />

In this case, we use a max formula to calculate the perspective based on component width and height (this helps us account for components that may be very wide):

```
transform:
perspective(max(
var(--spectrum-downstate-height),
var(--spectrum-downstate-width) * var(--spectrum-component-size-width-ratio-down)
))
translateZ(var(--spectrum-component-size-difference-down));
```

*Note that in this case, users are required to develop an implementation to determine the width and height of the component. Assign these values to the `--spectrum-downstate-width` and `--spectrum-downstate-height` custom properties in a `style` attribute on the HTML element to expose them for use in the CSS.*
2 changes: 2 additions & 0 deletions .storybook/main.js
Expand Up @@ -11,6 +11,8 @@ module.exports = {
stories: [
"../components/*/stories/*.stories.js",
"./guides/*.mdx",
"./foundations/*/*.mdx",
"./foundations/*/*.stories.js",
"./deprecated/*/*.stories.js",
],
rootDir: "../",
Expand Down
7 changes: 6 additions & 1 deletion .storybook/manager.js
Expand Up @@ -7,8 +7,8 @@ import logo from "./assets/logo.svg";
import pkg from "./package.json";

// Load global styles
import "@spectrum-css/vars/css/globals/index.css";
import "@spectrum-css/vars/css/components/index.css";
import "@spectrum-css/vars/css/globals/index.css";

import "@spectrum-css/vars/css/scales/spectrum-medium.css";
import "@spectrum-css/vars/css/themes/spectrum-light.css";
Expand Down Expand Up @@ -53,5 +53,10 @@ addons.setConfig({
}),
sidebar: {
showRoots: false,
filters: {
patterns: (item) => {
return !item.tags.includes('foundation');
}
}
},
});
44 changes: 22 additions & 22 deletions .storybook/package.json
@@ -1,6 +1,6 @@
{
"name": "@spectrum-css/preview",
"version": "7.4.2-next.0",
"version": "8.0.5-next.0",
"description": "A Spectrum CSS preview",
"license": "Apache-2.0",
"author": "Adobe",
Expand All @@ -12,36 +12,36 @@
"dependencies": {
"@adobe/spectrum-css-workflow-icons": "^1.5.4",
"@spectrum-css/expressvars": "^3.0.9",
"@spectrum-css/site": "^4.2.2",
"@spectrum-css/tokens": "^14.0.0-next.0",
"@spectrum-css/site": "^4.2.5-next.0",
"@spectrum-css/tokens": "^14.0.0-next.2",
"@spectrum-css/ui-icons": "^1.1.2",
"@spectrum-css/vars": "^9.0.8"
},
"devDependencies": {
"@babel/core": "^7.22.1",
"@chromaui/addon-visual-tests": "^0.0.124",
"@chromaui/addon-visual-tests": "^1.0.0",
"@etchteam/storybook-addon-status": "^4.2.4",
"@spectrum-css/component-builder": "^7.0.2",
"@spectrum-css/component-builder-simple": "^5.0.4",
"@storybook/addon-a11y": "^7.6.16",
"@storybook/addon-actions": "^7.6.16",
"@spectrum-css/component-builder": "^7.0.3-next.0",
"@spectrum-css/component-builder-simple": "^5.0.6-next.0",
"@storybook/addon-a11y": "^7.6.17",
"@storybook/addon-actions": "^7.6.17",
"@storybook/addon-console": "^3.0.0",
"@storybook/addon-docs": "^7.6.16",
"@storybook/addon-essentials": "^7.6.14",
"@storybook/addon-interactions": "^7.6.16",
"@storybook/api": "^7.6.16",
"@storybook/blocks": "^7.6.14",
"@storybook/client-api": "^7.6.16",
"@storybook/components": "^7.6.14",
"@storybook/core-events": "^7.6.14",
"@storybook/addon-docs": "^7.6.17",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",
"@storybook/api": "^7.6.17",
"@storybook/blocks": "^7.6.17",
"@storybook/client-api": "^7.6.17",
"@storybook/components": "^7.6.17",
"@storybook/core-events": "^7.6.17",
"@storybook/jest": "^0.2.3",
"@storybook/manager-api": "^7.6.14",
"@storybook/preview-api": "^7.6.14",
"@storybook/manager-api": "^7.6.17",
"@storybook/preview-api": "^7.6.17",
"@storybook/testing-library": "^0.2.2",
"@storybook/theming": "^7.6.14",
"@storybook/web-components-webpack5": "^7.6.16",
"@storybook/theming": "^7.6.17",
"@storybook/web-components-webpack5": "^7.6.17",
"@whitespace/storybook-addon-html": "^5.1.6",
"chromatic": "^10.3.1",
"chromatic": "^11.0.0",
"file-loader": "6.2.0",
"lit": "^3.1.2",
"lodash-es": "^4.17.21",
Expand All @@ -57,7 +57,7 @@
"react-dom": "^18.0.0",
"react-syntax-highlighter": "^15.5.0",
"source-map-loader": "^4.0.1",
"storybook": "^7.6.16",
"storybook": "^7.6.17",
"style-loader": "3.3.4",
"webpack": "^5.83.1"
}
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.js
Expand Up @@ -205,7 +205,7 @@ export const parameters = {
options: {
storySort: {
method: "alphabetical",
order: ['Guides', ['Contributing', '*', 'Adobe Code of Conduct', 'Changelog'], 'Components', '*'],
order: ['Guides', ['Contributing', '*', 'Adobe Code of Conduct', 'Changelog'], 'Foundations', 'Components', '*'],
includeNames: true,
},
},
Expand Down
7 changes: 7 additions & 0 deletions components/accordion/CHANGELOG.md
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

<a name="4.2.6"></a>
##4.2.6
🗓
2024-03-07 • 📝 [Commits](https://github.com/adobe/spectrum-css/compare/@spectrum-css/accordion@4.2.5...@spectrum-css/accordion@4.2.6)

**Note:** Version bump only for package @spectrum-css/accordion

<a name="4.2.5"></a>
##4.2.5
🗓
Expand Down
4 changes: 2 additions & 2 deletions components/accordion/package.json
@@ -1,6 +1,6 @@
{
"name": "@spectrum-css/accordion",
"version": "4.2.5",
"version": "4.2.7-next.0",
"description": "The Spectrum CSS accordion component",
"license": "Apache-2.0",
"author": "Adobe",
Expand All @@ -19,7 +19,7 @@
"@spectrum-css/tokens": ">=13"
},
"devDependencies": {
"@spectrum-css/component-builder-simple": "^5.0.4"
"@spectrum-css/component-builder-simple": "^5.0.6-next.0"
},
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit 8b472dc

Please sign in to comment.