Skip to content

Commit

Permalink
feat(infield-progress-cirlce): new component, sharing tokens from pro…
Browse files Browse the repository at this point in the history
…gress circle (#3430)

* feat(infieldprogress): add new component

feat(infieldcircle): new component

feat(ifpc): updating template and vrts

chore(ifpc): updating story changes

chore(ifpc): cleaning up build files

feat(ifpc): add infield loader to components

feat(infieldprogress): add new component

feat(ifpc): updating template and vrts

feat(ifpc): updating package, story, template

chore(ifpc): spectrum two updates

chore(ifpc): adding dist files

chore(ifpc): changing button id

chore(ifpc): updating bundle

chore(ifpc): updating package

chore(ifpc): testing out files

chore(ifpc): adding missing dist files

chore(ifpc): removing index css in dist

fix(ifpc): fixing typos

fix(ifpc): update mods in changeset

chore(ifpc): removing mods from ifpc components in changeset

* chore(ifpc): update package json)
  • Loading branch information
aramos-adobe authored and castastrophe committed Feb 11, 2025
1 parent 8eb6704 commit ce2f3e0
Show file tree
Hide file tree
Showing 22 changed files with 362 additions and 74 deletions.
7 changes: 7 additions & 0 deletions .changeset/flat-snails-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@spectrum-css/infieldprogresscircle": major
---

## Infield Progresscircle S2 Migration

In-field progress circle is a new component created to replace progress circle (size S) in t-shirt size components. The button, textfield, combo box, and picker `template.js` files have all been updated to call for infield progress circles. This component comes in four sizes: (S, M, L, XL), has updated color variants (default, white, black), and has a unified track thickness.
2 changes: 1 addition & 1 deletion .github/QUICK-START.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Spectrum CSS components utilize custom properties in order to change themes and
<html class="spectrum spectrum--medium spectrum--light"></html>
```

Use the `index.css` files in your project to include component and global styles ([Spectrum and Express contexts](https://github.com/adobe/spectrum-css?tab=readme-ov-file#visual-language), [background theme/colorstop](https://github.com/adobe/spectrum-css?tab=readme-ov-file#themes-colorstops), [platform scaling](https://github.com/adobe/spectrum-css?tab=readme-ov-file#scales), etc.) for the component. If you don't need all of the global styles, peek at the docs for [including assets](https://github.com/adobe/spectrum-css?tab=readme-ov-file#including-assets)). Use this file by including the stylesheet (plus stylesheets for dependencies) in the `<head>` tag:
Use the `index.css` files in your project to include component and global styles ([background theme/colorstop](https://github.com/adobe/spectrum-css?tab=readme-ov-file#themes-colorstops), [platform scaling](https://github.com/adobe/spectrum-css?tab=readme-ov-file#scales), etc.) for the component. If you don't need all of the global styles, peek at the docs for [including assets](https://github.com/adobe/spectrum-css?tab=readme-ov-file#including-assets)). Use this file by including the stylesheet (plus stylesheets for dependencies) in the `<head>` tag:

```html
<head>
Expand Down
4 changes: 1 addition & 3 deletions .storybook/blocks/utilities.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import legacy from "@spectrum-css/tokens-legacy/dist/json/tokens.json";
import spectrum from "@spectrum-css/tokens/dist/json/tokens.json";

import { useTheme } from "@storybook/theming";
Expand Down Expand Up @@ -70,9 +69,8 @@ function fetchTheme({ color, scale, context } = {}) {

// Create a platform context based on the scale (platform used in the token data)
const platform = scale === "medium" ? "desktop" : "mobile";
const tokens = context === "spectrum" ? spectrum : legacy;

return { color, scale, context, platform, tokens };
return { color, scale, context, platform, tokens: spectrum };
}

/**
Expand Down
44 changes: 1 addition & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,6 @@ Spectrum CSS components have build output that is designed to be used in a varie

- `index.css` - _Preferred and most commonly used to incorporate Spectrum CSS into a project_. This file includes the component's styles and variable definitions. In this version, token-driven CSS properties<sup>[1](#token-footnote)</sup> are mapped to empty `--mod` prefixed variables (for customization) with a fallback to variables prefixed with `--spectrum` (sourced from the design tokens).

- This file loads the `.spectrum`, `.spectrum--legacy`, and `.spectrum--express` contexts which are used to toggle components between different [visual styles](https://github.com/adobe/spectrum-css?tab=readme-ov-file#visual-language). The `.spectrum` context is the default.

- `index-base.css`: This file mimics the `index.css` output, but does not include the `.spectrum` or `.spectrum--express` contexts.

- If your product only requires the `.spectrum` context, you can use `index-base.css` plus `themes/spectrum-two.css` from the `themes` directory to render the default Spectrum visual language.
- The `.spectrum--legacy` context represents the previous version of Spectrum (also known as Spectrum 1). This means if you only want to use the legacy context, you should load `themes/spectrum.css`. **deprecated**
- The `.spectrum--express` context represents the subtheme of Spectrum 1 called Express . This means if you only want to use the Express context, you should load `themes/express.css`. **deprecated**
- This approach can also be used when you have defined and written your own visual language and only need the base component styles from Spectrum CSS. To wire up your own visual language, you would need to define your own custom properties that match those defined in the `themes/spectrum-two.css` assets.

- `index-theme.css`: This file provides only the visual language for a component. It is used in conjunction with `index-base.css` and when loaded together, provides the same result as using `index.css` by itself.

<sup><a name="token-footnote">1</a></sup>: Token-driven CSS properties are properties whose values are mapped to a value in the `@spectrum-css/tokens` package. These values represent design-language and are meant to be used across platforms. In contrast, properties specific to web-based implementations will not have a token value assigned, so not all CSS properties will use custom properties.

#### Including assets
Expand All @@ -73,29 +62,10 @@ Start by including the base set of variables:
/* Include tokens */
@import "node_modules/@spectrum-css/tokens/dist/index.css";

/*
For components with no other contexts available, load the
index.css file from the component's package. These are components
that do not have a spectrum or express context available.
*/
@import "node_modules/@spectrum-css/page/dist/index.css";
@import "node_modules/@spectrum-css/typography/dist/index.css";
@import "node_modules/@spectrum-css/icon/dist/index.css";

/*
Recommended: For components with multiple contexts available, if you
want access to all contexts, load the index.css file, which includes
all contexts and component variables.
*/
@import "node_modules/@spectrum-css/button/dist/index.css";

/*
If you only need the spectrum visual context: For components with
multiple contexts available, load only the spectrum context by sourcing
index-base.css and the spectrum theme from the themes directory.
*/
@import "node_modules/@spectrum-css/button/dist/index-base.css";
@import "node_modules/@spectrum-css/button/dist/themes/spectrum.css";
```

Tokens values are mapped to context-specific classes which can be applied to the `<html>` element or any place in your DOM where you wish to encapsulate or alter the visual language of your Spectrum components.
Expand All @@ -106,9 +76,7 @@ All contexts you want to use must be defined in order to load all the appropriat

##### Visual language

- `.spectrum` - The default visual language for Spectrum CSS; represents the Spectrum 2 foundations visual language.
- `.spectrum--legacy` - The legacy Spectrum 1 visual language. _This visual language will be deprecated in Spectrum 2_.
- `.spectrum--express` - A variant of the standard visual language. _This visual language will be deprecated in Spectrum 2_.
- `.spectrum` - The default visual language for Spectrum CSS; represents the Spectrum 2 visual language.

##### Scales

Expand All @@ -134,16 +102,6 @@ Put together, we would define the context for our application in the following w
<html class="spectrum spectrum--medium spectrum--light"></html>
```

To switch to Express, **add** the `.spectrum--express` class to the `<html>` element:

```html
<html
class="spectrum spectrum--medium spectrum--light spectrum--express"
></html>
```

Note the `spectrum--legacy` or `spectrum--express` class is added to the existing classes; `spectrum` should always be present to ensure the correct visual language is loaded.

Because CSS custom properties honor the cascading nature of CSS, you can infinitely nest different contexts. For example, you could have a `.spectrum--dark` context inside of a `.spectrum--light` context, and components will honor the innermost context.

### Modifying components
Expand Down
17 changes: 7 additions & 10 deletions components/button/stories/template.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Template as Icon } from "@spectrum-css/icon/stories/template.js";
import { Template as InfieldProgressCircle } from "@spectrum-css/infieldprogresscircle/stories/template.js";
import { Container, getRandomId } from "@spectrum-css/preview/decorators";
import { Template as ProgressCircle } from "@spectrum-css/progresscircle/stories/template.js";
import { html } from "lit";
import { classMap } from "lit/directives/class-map.js";
import { ifDefined } from "lit/directives/if-defined.js";
Expand Down Expand Up @@ -89,15 +89,12 @@ export const Template = ({
Icon({ iconName, setName: iconSet, size }, context)
)}
${when(isPending, () =>
ProgressCircle(
{
size: "s",
testId: "progress-circle",
staticColor,
isIndeterminate: true,
},
context
)
InfieldProgressCircle({
size: size,
staticColor,
isIndeterminate: true,
testId: "infield-progress-circle"
}, context)
)}
</button>
`;
Expand Down
2 changes: 1 addition & 1 deletion components/combobox/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const Combobox = ({
],
customInputClasses: [`${rootClass}-input`],
isLoading,
customProgressCircleClasses: ["spectrum-Combobox-progress-circle"],
customInfieldProgressCircleClasses: ["spectrum-Combobox-progress-circle"],
name: "field",
isReadOnly,
value,
Expand Down
7 changes: 7 additions & 0 deletions components/infieldprogresscircle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @spectrum-css/infieldprogresscircle

> The Spectrum CSS infield progress circle component
This package is part of the [Spectrum CSS project](https://github.com/adobe/spectrum-css).

See the [Spectrum CSS documentation](https://opensource.adobe.com/spectrum-css/) and [Spectrum CSS on GitHub](https://github.com/adobe/spectrum-css) for details.
25 changes: 25 additions & 0 deletions components/infieldprogresscircle/dist/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"sourceFile": "index.css",
"selectors": [
".spectrum-InfieldProgressCircle",
".spectrum-InfieldProgressCircle .spectrum-ProgressCircle-fill",
".spectrum-InfieldProgressCircle--sizeL",
".spectrum-InfieldProgressCircle--sizeS",
".spectrum-InfieldProgressCircle--sizeXL"
],
"modifiers": [],
"component": [
"--spectrum-in-field-progress-circle-edge-to-fill",
"--spectrum-in-field-progress-circle-size-100",
"--spectrum-in-field-progress-circle-size-200",
"--spectrum-in-field-progress-circle-size-300",
"--spectrum-in-field-progress-circle-size-75",
"--spectrum-infieldprogresscircle-padding-block"
],
"global": ["--spectrum-progress-circle-thickness-small"],
"passthroughs": [
"--mod-progress-circle-size",
"--mod-progress-circle-thickness"
],
"high-contrast": []
}
37 changes: 37 additions & 0 deletions components/infieldprogresscircle/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*!
Copyright 2025 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

.spectrum-InfieldProgressCircle {
--mod-progress-circle-thickness: var(--spectrum-progress-circle-thickness-small);
--mod-progress-circle-size: var(--spectrum-in-field-progress-circle-size-100);
--spectrum-infieldprogresscircle-padding-block: var(--spectrum-in-field-progress-circle-edge-to-fill);
}

.spectrum-InfieldProgressCircle--sizeS {
--mod-progress-circle-size: var(--spectrum-in-field-progress-circle-size-75);
}

.spectrum-InfieldProgressCircle--sizeL {
--mod-progress-circle-size: var(--spectrum-in-field-progress-circle-size-200);
}

.spectrum-InfieldProgressCircle--sizeXL {
--mod-progress-circle-size: var(--spectrum-in-field-progress-circle-size-300);
}

.spectrum-InfieldProgressCircle {
padding-block: var(--spectrum-infieldprogresscircle-padding-block);

.spectrum-ProgressCircle-fill {
stroke-linecap: square;
}
}
57 changes: 57 additions & 0 deletions components/infieldprogresscircle/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "@spectrum-css/infieldprogresscircle",
"version": "0.0.0",
"description": "The Spectrum CSS infieldprogresscircle component",
"license": "Apache-2.0",
"author": "Adobe",
"homepage": "https://opensource.adobe.com/spectrum-css/?path=/docs/components-in-field-progress-circle--docs",
"repository": {
"type": "git",
"url": "https://github.com/adobe/spectrum-css.git",
"directory": "components/infieldprogresscircle"
},
"bugs": {
"url": "https://github.com/adobe/spectrum-css/issues"
},
"exports": {
".": "./dist/index.css",
"./*.md": "./*.md",
"./dist/*": "./dist/*",
"./index-*.css": "./dist/index-*.css",
"./index.css": "./dist/index.css",
"./metadata.json": "./dist/metadata.json",
"./package.json": "./package.json",
"./stories/*": "./stories/*"
},
"main": "dist/index.css",
"peerDependencies": {
"@spectrum-css/tokens": ">=16"
},
"devDependencies": {
"@spectrum-css/tokens": "16.0.0"
},
"keywords": [
"design-system",
"spectrum",
"spectrum-css",
"adobe",
"adobe-spectrum",
"component",
"css"
],
"publishConfig": {
"access": "public"
},
"spectrum": [
{
"guidelines": "https://spectrum.adobe.com/page/progress-circle",
"rootClass": "spectrum-InfieldProgressCircle",
"swc": "https://opensource.adobe.com/spectrum-web-components/components/progress-circle/"
}
],
"peerDependenciesMeta": {
"@spectrum-css/tokens": {
"optional": true
}
}
}
17 changes: 17 additions & 0 deletions components/infieldprogresscircle/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"name": "infieldprogresscircle",
"tags": ["component"],
"targets": {
"build": {},
"clean": {},
"compare": {},
"format": {},
"lint": {},
"report": {},
"test": {
"defaultConfiguration": "scope"
},
"validate": {}
}
}
Loading

0 comments on commit ce2f3e0

Please sign in to comment.