Skip to content

Commit

Permalink
Merge pull request #2024 from chanzuckerberg/release-v15.2.0
Browse files Browse the repository at this point in the history
## [15.2.0](v15.1.0...v15.2.0) (2024-07-25)

[Storybook](https://61313967cde49b003ae2a860-bksjqddurj.chromatic.com/)

### Features

* **Fieldset:** update styles to support new 2.0 components ([#2023](#2023)) ([e542b32](e542b32))


### Bug Fixes

* **Button:** update typography tokens to match design ([#2019](#2019)) ([3b94114](3b94114))
* **InputField:** align text content with inputWithin spacing ([#2020](#2020)) ([e87767b](e87767b))
  • Loading branch information
booc0mtaco authored Jul 26, 2024
2 parents d76d5bb + 21074fb commit 1b1ea55
Show file tree
Hide file tree
Showing 37 changed files with 1,490 additions and 560 deletions.
5 changes: 3 additions & 2 deletions .storybook/data/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@
"eds-theme-typography-overline-sm": "var(--eds-typography-preset-012)",
"eds-theme-typography-callout": "var(--eds-typography-preset-002-light)",
"eds-theme-typography-breadcrumb": "var(--eds-typography-preset-009)",
"eds-theme-typography-button-lg": "var(--eds-typography-preset-006)",
"eds-theme-typography-button-md": "var(--eds-typography-preset-006)",
"eds-theme-typography-button-lg": "var(--eds-typography-preset-005)",
"eds-theme-typography-button-md": "var(--eds-typography-preset-005)",
"eds-theme-typography-button-sm": "var(--eds-typography-preset-009)",
"eds-theme-typography-button-label": "var(--eds-typography-preset-006)",
"eds-theme-typography-button-label-sm": "var(--eds-typography-preset-008-bold)",
"eds-theme-typography-form-label": "var(--eds-typography-preset-006)",
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [15.2.0](https://github.com/chanzuckerberg/edu-design-system/compare/v15.1.0...v15.2.0) (2024-07-25)


### Features

* **Fieldset:** update styles to support new 2.0 components ([#2023](https://github.com/chanzuckerberg/edu-design-system/issues/2023)) ([e542b32](https://github.com/chanzuckerberg/edu-design-system/commit/e542b32a5e205236baf02597d1595b71185cccd7))


### Bug Fixes

* **Button:** update typography tokens to match design ([#2019](https://github.com/chanzuckerberg/edu-design-system/issues/2019)) ([3b94114](https://github.com/chanzuckerberg/edu-design-system/commit/3b9411443323050ef829e509443b2bde6db135e4))
* **InputField:** align text content with inputWithin spacing ([#2020](https://github.com/chanzuckerberg/edu-design-system/issues/2020)) ([e87767b](https://github.com/chanzuckerberg/edu-design-system/commit/e87767bd00bd81828b67a8e651e16df0b955e585))

## [15.1.0](https://github.com/chanzuckerberg/edu-design-system/compare/v15.0.1...v15.1.0) (2024-07-15)


Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chanzuckerberg/eds",
"version": "15.1.0",
"version": "15.2.0",
"description": "The React-powered design system library for Chan Zuckerberg Initiative education web applications",
"author": "CZI <edu-frontend-infra@chanzuckerberg.com>",
"homepage": "https://github.com/chanzuckerberg/edu-design-system",
Expand Down Expand Up @@ -129,26 +129,26 @@
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@size-limit/file": "^8.2.6",
"@storybook/addon-a11y": "^8.2.2",
"@storybook/addon-essentials": "^8.2.2",
"@storybook/addon-interactions": "^8.2.2",
"@storybook/addon-links": "^8.2.2",
"@storybook/addon-mdx-gfm": "^8.2.2",
"@storybook/addon-a11y": "^8.2.4",
"@storybook/addon-essentials": "^8.2.4",
"@storybook/addon-interactions": "^8.2.4",
"@storybook/addon-links": "^8.2.4",
"@storybook/addon-mdx-gfm": "^8.2.4",
"@storybook/addon-styling": "^1.3.7",
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
"@storybook/manager-api": "^8.2.2",
"@storybook/react": "^8.2.2",
"@storybook/react-webpack5": "^8.2.2",
"@storybook/test": "^8.2.2",
"@storybook/manager-api": "^8.2.4",
"@storybook/react": "^8.2.4",
"@storybook/react-webpack5": "^8.2.4",
"@storybook/test": "^8.2.4",
"@storybook/testing-library": "^0.2.2",
"@storybook/theming": "^8.2.2",
"@storybook/theming": "^8.2.4",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.12",
"@types/jsonfile": "^6",
"@types/lodash": "^4.17.6",
"@types/node": "^20.14.10",
"@types/lodash": "^4.17.7",
"@types/node": "^20.14.11",
"@types/react": "^18.3.3",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-dom": "^18.3.0",
Expand Down Expand Up @@ -185,12 +185,12 @@
"rollup-plugin-postcss": "^4.0.2",
"size-limit": "^8.2.6",
"standard-version": "^9.5.0",
"storybook": "^8.2.2",
"storybook": "^8.2.4",
"style-dictionary": "^3.9.2",
"stylelint": "^15.11.0",
"stylelint-config-recommended": "^13.0.0",
"tailwindcss": "^3.4.4",
"ts-jest": "^29.2.2",
"tailwindcss": "^3.4.6",
"ts-jest": "^29.2.3",
"typescript": "^5.5.2"
},
"lint-staged": {
Expand Down
3 changes: 2 additions & 1 deletion plop-templates/Component/Component.test.ts.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { generateSnapshots } from '@chanzuckerberg/story-utils';
import * as stories from './{{pascalCase name}}.stories';
import type { StoryFile } from '../../util/utility-types';

describe('<{{pascalCase name}} />', () => {
generateSnapshots(stories);
generateSnapshots(stories as StoryFile);
});
5 changes: 5 additions & 0 deletions plop-templates/Component/Component.tsx.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import React from 'react';
import styles from './{{pascalCase name}}.module.css';

export interface Props {
// Component API
/**
* CSS class names that can be appended to the component.
*/
className?: string;
// Design API
// Insert props/values as defined in figma for {{pascalCase name}}
}

/**
Expand All @@ -18,13 +21,15 @@ export interface Props {
*/
export const {{pascalCase name}} = ({
className,
// Add other deferenced props to use
...other
}: Props) => {
const componentClassName = clsx(styles['{{dashCase name}}'], className);

return (
<div
className={componentClassName}
// Other de-referenced props go here
{...other}
>
Hello!
Expand Down
32 changes: 1 addition & 31 deletions plopfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,37 +52,7 @@ module.exports = (plop) => {
template:
"export { default as {{pascalCase name}} } from './components/{{pascalCase name}}';",
},
// From https://github.com/bradfrost/czi-vanilla-storybook
function sortIndex() {
process.chdir(plop.getPlopfilePath());

const fs = require('fs');
const indexFile = `${plop.getDestBasePath()}/src/index.ts`;

if (fs.existsSync(indexFile)) {
// Split the index file into lines.
const lines = fs.readFileSync(indexFile, 'utf8').split('\n');
// Only sort lines that begin with "export {" in order to ignore
// comments and exported types.
const sortableLines = lines.filter((line) =>
/^export {.*/g.test(line),
);
// Ignore all other lines and turn them back into a string.
const ignoreLines = lines
.filter((line) => !/^export {.*/g.test(line))
.join('\n');

// Sort the sortable lines.
const sortedLines = sortableLines
.sort((a, b) => a.localeCompare(b))
.join('\n');

// Write all of the lines back to the file.
fs.writeFileSync(indexFile, `${sortedLines}\n${ignoreLines}\n`);

return `index.ts lines sorted`;
}
},
// Removed sort to avoid removing per-version component ordering and documentation (see diff for old code)
],
});
};
3 changes: 1 addition & 2 deletions src/components/Button/Button.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@

.button--sm {
padding: calc(var(--eds-size-half) / 16 * 1rem) 1.33333333rem;
/* TODO: need eds-theme-typography-button-sm => preset-009 */
font: var(--eds-typography-preset-009);
font: var(--eds-theme-typography-button-sm);

min-width: calc(var(--eds-size-6) / 16 * 1rem);
max-width: calc(var(--eds-size-24) / 16 * 1rem);;
Expand Down
5 changes: 2 additions & 3 deletions src/components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export const LoadingStates: Story = {
export const IconLayouts: Story = {
args: {
...Default.args,
children: undefined,
icon: 'open-in-new',
},
render: (args) => {
Expand All @@ -214,9 +215,7 @@ export const IconLayouts: Story = {
{...args}
aria-label="Label must be applied with icon-only layout"
iconLayout="icon-only"
>
Icon Only (text not visible)
</Button>
/>
</div>
);
},
Expand Down
8 changes: 4 additions & 4 deletions src/components/Card/Card.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export const WithHorizontalPrimaryButton: Story = {
<ButtonGroup>
{/* This has to be manually tested since Tooltip tests are flaky in Chromatic */}
<Button onClick={() => {}} rank="primary">
Primary Action
Primary
</Button>
</ButtonGroup>
</Card.Footer>
Expand Down Expand Up @@ -264,7 +264,7 @@ export const TopStripe: Story = {
<ButtonGroup>
{/* This has to be manually tested since Tooltip tests are flaky in Chromatic */}
<Button onClick={() => {}} rank="primary">
Primary Action
Primary
</Button>
</ButtonGroup>
</Card.Footer>
Expand Down Expand Up @@ -296,7 +296,7 @@ export const CustomTopStripe: Story = {
<ButtonGroup>
{/* This has to be manually tested since Tooltip tests are flaky in Chromatic */}
<Button onClick={() => {}} rank="primary">
Primary Action
Primary
</Button>
</ButtonGroup>
</Card.Footer>
Expand Down Expand Up @@ -327,7 +327,7 @@ export const BackgroundCallout: Story = {
<ButtonGroup>
{/* This has to be manually tested since Tooltip tests are flaky in Chromatic */}
<Button onClick={() => {}} rank="primary">
Primary Action
Primary
</Button>
</ButtonGroup>
</Card.Footer>
Expand Down
8 changes: 4 additions & 4 deletions src/components/Card/__snapshots__/Card.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ exports[`<Card /> BackgroundCallout story renders snapshot 1`] = `
<span
class="button__text"
>
Primary Action
Primary
</span>
</button>
</div>
Expand Down Expand Up @@ -387,7 +387,7 @@ exports[`<Card /> CustomTopStripe story renders snapshot 1`] = `
<span
class="button__text"
>
Primary Action
Primary
</span>
</button>
</div>
Expand Down Expand Up @@ -576,7 +576,7 @@ exports[`<Card /> TopStripe story renders snapshot 1`] = `
<span
class="button__text"
>
Primary Action
Primary
</span>
</button>
</div>
Expand Down Expand Up @@ -894,7 +894,7 @@ exports[`<Card /> WithHorizontalPrimaryButton story renders snapshot 1`] = `
<span
class="button__text"
>
Primary Action
Primary
</span>
</button>
</div>
Expand Down
40 changes: 14 additions & 26 deletions src/components/Fieldset/Fieldset.module.css
Original file line number Diff line number Diff line change
@@ -1,50 +1,38 @@
@import '../../design-tokens/mixins.css';
.fieldset__footer {
display: flex;
justify-content: space-between;

/*------------------------------------*\
    # FIELDSET
\*------------------------------------*/

/**
* The fieldset groups a legend and several controls.
*/
.fieldset {
@mixin fieldsetStyles;
/* Overrides default browser styling. */
margin: calc(var(--eds-size-2) / 16 * 1rem);
margin-top: calc(var(--eds-size-3) / 16 * 1rem);
}

/*------------------------------------*\
# FIELDSET ITEMS
\*------------------------------------*/

/**
* The contents of the fieldset. Spaces them apart.
*/
.fieldset-items > :not(:last-child) {
margin-bottom: calc(var(--eds-size-1-and-half) / 16 * 1rem);
margin-bottom: calc(var(--eds-size-2) / 16 * 1rem);
}

/*------------------------------------*\
# FIELDSET LEGEND
\*------------------------------------*/

/**
* A label that's rendered as a <legend> for fieldsets.
* It contains the same characteristics as a label (ability to add flag for optional field, etc),
* but semantically/stylistically a bit different.
*/
.fieldset-legend {
/* Removes some default browser styles. */
@mixin legendReset;
font: var(--eds-theme-typography-form-label);
/* Adjust margin between legend and option list */
margin-bottom: calc(var(--eds-size-2) / 16 * 1rem);
margin-bottom: calc(var(--eds-size-3) / 16 * 1rem);
}

/**
* Label flag to mark whether or not a field is required
* or optional. Currently a flag is only present for optional fields
*
* TODO: remove as deprecated with v16 of EDS
*/
.fieldset-legend__flag {
font: var(--eds-theme-typography-body-sm);
}

.fieldset-legend__overline {
display: flex;
align-items: center;
gap: calc(var(--eds-size-half) / 16 * 1rem);
}
Loading

0 comments on commit 1b1ea55

Please sign in to comment.