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

Prototype for testing CJK typography #3378

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export default {
files: "**/*.@(stories.js|mdx)",
titlePrefix: "Deprecated",
},
{
directory: "./testing",
files: "**/*.@(stories.js|mdx)",
titlePrefix: "Testing",
},
],
rootDir: "../",
staticDirs: ["./assets", "./assets/images"],
Expand Down
47 changes: 47 additions & 0 deletions .storybook/testing/cjk-typography.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Meta, Canvas } from "@storybook/blocks";

import { Button, Toast, Tag, AssetCard, Typography } from "./cjk.stories.js";

<Meta title="Testing CJK Typography" />

# Testing CJK Typography

Most changes - if incorporated at all - are to line-height, and not all of those components are listed here.

Typography changes based on font size/weight are not currently extended into components, ex. body size small is not applied through to buttons size small.

## Button

No lang specific overrides applied.

<Canvas of={Button} />

## Toast

Lang specific override on message line-height only.

<Canvas of={Toast} />

## Tag

No lang specific overrides applied.

<Canvas of={Tag} />

## Asset Card

Full font style lang overrides for header, content, and title slots.

<Canvas of={AssetCard} />

## Calendar

[See on Calendar page](/?path=/docs/components-calendar--docs&globals=lang:ja), font-size is changed for days of the week.

(_Error loading the story on this page_)

## Typography

All are size medium.

<Canvas of={Typography} />
63 changes: 63 additions & 0 deletions .storybook/testing/cjk.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

import { Template as AssetCardTemplate } from "../../components/assetcard/stories/template.js";
import { ButtonsWithIconOptions } from "../../components/button/stories/template.js";
import { TagGroups } from "../../components/tag/stories//tag.test.js";
import { ToastGroup } from "../../components/toast/stories/toast.test.js";
import { TypographyGroup } from "../../components/typography/stories/typography.test.js";

const longPhrase = "無料で作りましょう"; // Let's make it for free
const shortPhrase = "買う"; // Purchase

export default {
title: "CJK Stories",
tags: ["!autodocs"],
}

export const Button = ButtonsWithIconOptions.bind({});
Button.args = {
label: longPhrase,
};
Button.parameters = {
chromatic: { disableSnapshot: true },
};

export const Toast = ToastGroup.bind({});
Toast.args = {
message: longPhrase,
inlineButtonLabel: shortPhrase,
variant: "neutral"
};

export const Tag = TagGroups.bind({});
Tag.args = {label: shortPhrase};

export const AssetCard = AssetCardTemplate.bind({});
AssetCard.args = {
title: 'Instagram ' + longPhrase,
headerContent: "39:02",
exampleImage: "square",
};


export const Typography = TypographyGroup.bind({});
Typography.args = {
content: [
{
semantics: "heading",
content: ['Heading ' + longPhrase],
},
{
semantics: "code",
content: ['Code ' + longPhrase],
},
{
semantics: "detail",
content: ['detail ' + longPhrase],
},
{
semantics: "body",
content: [
'Body ' + longPhrase ],
},
],
};
13 changes: 13 additions & 0 deletions components/typography/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -368,30 +368,37 @@
/* Body t-shirt sizes */
.spectrum-Body--sizeXS {
--spectrum-body-font-size: var(--spectrum-body-size-xs);
--spectrum-body-cjk-font-size: var(--spectrum-body-cjk-size-xs);
}

.spectrum-Body--sizeS {
--spectrum-body-font-size: var(--spectrum-body-size-s);
--spectrum-body-cjk-font-size: var(--spectrum-body-cjk-size-s);
}

.spectrum-Body--sizeM {
--spectrum-body-font-size: var(--spectrum-body-size-m);
--spectrum-body-cjk-font-size: var(--spectrum-body-cjk-size-m);
}

.spectrum-Body--sizeL {
--spectrum-body-font-size: var(--spectrum-body-size-l);
--spectrum-body-cjk-font-size: var(--spectrum-body-cjk-size-l);
}

.spectrum-Body--sizeXL {
--spectrum-body-font-size: var(--spectrum-body-size-xl);
--spectrum-body-cjk-font-size: var(--spectrum-body-cjk-size-xl);
}

.spectrum-Body--sizeXXL {
--spectrum-body-font-size: var(--spectrum-body-size-xxl);
--spectrum-body-cjk-font-size: var(--spectrum-body-cjk-size-xxl);
}

.spectrum-Body--sizeXXXL {
--spectrum-body-font-size: var(--spectrum-body-size-xxxl);
--spectrum-body-cjk-font-size: var(--spectrum-body-cjk-size-xxxl);
}

/* Body styles */
Expand Down Expand Up @@ -433,6 +440,7 @@
font-family: var(--mod-body-cjk-font-family, var(--spectrum-body-cjk-font-family));
font-style: var(--mod-body-cjk-font-style, var(--spectrum-body-cjk-font-style));
font-weight: var(--mod-body-cjk-font-weight, var(--spectrum-body-cjk-font-weight));
font-size: var(--mod-body-cjk-font-size, var(--spectrum-body-cjk-font-size));

line-height: var(--mod-body-cjk-line-height, var(--spectrum-body-cjk-line-height));

Expand Down Expand Up @@ -513,18 +521,22 @@
/* Detail t-shirt sizes */
.spectrum-Detail--sizeS {
--spectrum-detail-font-size: var(--spectrum-detail-size-s);
--spectrum-detail-cjk-font-size: var(--spectrum-detail-cjk-size-s);
}

.spectrum-Detail--sizeM {
--spectrum-detail-font-size: var(--spectrum-detail-size-m);
--spectrum-detail-cjk-font-size: var(--spectrum-detail-cjk-size-m);
}

.spectrum-Detail--sizeL {
--spectrum-detail-font-size: var(--spectrum-detail-size-l);
--spectrum-detail-cjk-font-size: var(--spectrum-detail-cjk-size-l);
}

.spectrum-Detail--sizeXL {
--spectrum-detail-font-size: var(--spectrum-detail-size-xl);
--spectrum-detail-cjk-font-size: var(--spectrum-detail-cjk-size-xl);
}

/* Detail styles */
Expand Down Expand Up @@ -567,6 +579,7 @@
font-family: var(--mod-detail-cjk-font-family, var(--spectrum-detail-cjk-font-family));
font-style: var(--mod-detail-cjk-font-style, var(--spectrum-detail-cjk-font-style));
font-weight: var(--mod-detail-cjk-font-weight, var(--spectrum-detail-cjk-font-weight));
font-size: var(--mod-detail-cjk-font-size, var(--spectrum-detail-cjk-font-size));

line-height: var(--mod-detail-cjk-line-height, var(--spectrum-detail-cjk-line-height));

Expand Down
15 changes: 15 additions & 0 deletions components/typography/metadata/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@
"--mod-body-cjk-emphasized-font-style",
"--mod-body-cjk-emphasized-font-weight",
"--mod-body-cjk-font-family",
"--mod-body-cjk-font-size",
"--mod-body-cjk-font-style",
"--mod-body-cjk-font-weight",
"--mod-body-cjk-letter-spacing",
Expand Down Expand Up @@ -357,6 +358,7 @@
"--mod-detail-cjk-emphasized-font-style",
"--mod-detail-cjk-emphasized-font-weight",
"--mod-detail-cjk-font-family",
"--mod-detail-cjk-font-size",
"--mod-detail-cjk-font-style",
"--mod-detail-cjk-font-weight",
"--mod-detail-cjk-light-emphasized-font-style",
Expand Down Expand Up @@ -500,10 +502,18 @@
"--spectrum-body-cjk-emphasized-font-style",
"--spectrum-body-cjk-emphasized-font-weight",
"--spectrum-body-cjk-font-family",
"--spectrum-body-cjk-font-size",
"--spectrum-body-cjk-font-style",
"--spectrum-body-cjk-font-weight",
"--spectrum-body-cjk-letter-spacing",
"--spectrum-body-cjk-line-height",
"--spectrum-body-cjk-size-l",
"--spectrum-body-cjk-size-m",
"--spectrum-body-cjk-size-s",
"--spectrum-body-cjk-size-xl",
"--spectrum-body-cjk-size-xs",
"--spectrum-body-cjk-size-xxl",
"--spectrum-body-cjk-size-xxxl",
"--spectrum-body-cjk-strong-emphasized-font-style",
"--spectrum-body-cjk-strong-emphasized-font-weight",
"--spectrum-body-cjk-strong-font-style",
Expand Down Expand Up @@ -575,6 +585,7 @@
"--spectrum-detail-cjk-emphasized-font-style",
"--spectrum-detail-cjk-emphasized-font-weight",
"--spectrum-detail-cjk-font-family",
"--spectrum-detail-cjk-font-size",
"--spectrum-detail-cjk-font-style",
"--spectrum-detail-cjk-font-weight",
"--spectrum-detail-cjk-light-emphasized-font-style",
Expand All @@ -586,6 +597,10 @@
"--spectrum-detail-cjk-light-strong-font-style",
"--spectrum-detail-cjk-light-strong-font-weight",
"--spectrum-detail-cjk-line-height",
"--spectrum-detail-cjk-size-l",
"--spectrum-detail-cjk-size-m",
"--spectrum-detail-cjk-size-s",
"--spectrum-detail-cjk-size-xl",
"--spectrum-detail-cjk-strong-emphasized-font-style",
"--spectrum-detail-cjk-strong-emphasized-font-weight",
"--spectrum-detail-cjk-strong-font-style",
Expand Down
2 changes: 2 additions & 0 deletions components/typography/metadata/mods.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
| `--mod-body-cjk-emphasized-font-style` |
| `--mod-body-cjk-emphasized-font-weight` |
| `--mod-body-cjk-font-family` |
| `--mod-body-cjk-font-size` |
| `--mod-body-cjk-font-style` |
| `--mod-body-cjk-font-weight` |
| `--mod-body-cjk-letter-spacing` |
Expand Down Expand Up @@ -59,6 +60,7 @@
| `--mod-detail-cjk-emphasized-font-style` |
| `--mod-detail-cjk-emphasized-font-weight` |
| `--mod-detail-cjk-font-family` |
| `--mod-detail-cjk-font-size` |
| `--mod-detail-cjk-font-style` |
| `--mod-detail-cjk-font-weight` |
| `--mod-detail-cjk-light-emphasized-font-style` |
Expand Down
36 changes: 24 additions & 12 deletions tokens/dist/css/global-vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,17 @@
--spectrum-in-field-button-edge-to-disclosure-icon-stacked-large:13px;
--spectrum-in-field-button-edge-to-disclosure-icon-stacked-extra-large:16px;
--spectrum-in-field-button-outer-edge-to-disclosure-icon-stacked-small:3px;
--spectrum-detail-cjk-size-xl:var(--spectrum-font-size-100);
--spectrum-detail-cjk-size-l:var(--spectrum-font-size-75);
--spectrum-detail-cjk-size-m:var(--spectrum-font-size-50);
--spectrum-detail-cjk-size-s:var(--spectrum-font-size-25);
--spectrum-body-cjk-size-xxxl:var(--spectrum-font-size-500);
--spectrum-body-cjk-size-xxl:var(--spectrum-font-size-400);
--spectrum-body-cjk-size-xl:var(--spectrum-font-size-300);
--spectrum-body-cjk-size-l:var(--spectrum-font-size-200);
--spectrum-body-cjk-size-m:var(--spectrum-font-size-100);
--spectrum-body-cjk-size-s:var(--spectrum-font-size-75);
--spectrum-body-cjk-size-xs:var(--spectrum-font-size-50);
--spectrum-android-elevation:2dp;
--spectrum-spacing-50:2px;
--spectrum-spacing-75:4px;
Expand Down Expand Up @@ -360,11 +371,12 @@
--spectrum-black-font-weight:900;
--spectrum-italic-font-style:italic;
--spectrum-default-font-style:normal;
--spectrum-letter-spacing:0em;
--spectrum-line-height-100:1.3;
--spectrum-line-height-200:1.5;
--spectrum-cjk-line-height-100:1.5;
--spectrum-cjk-line-height-200:1.7;
--spectrum-cjk-letter-spacing:0.05em;
--spectrum-cjk-letter-spacing:var(--spectrum-letter-spacing);
--spectrum-heading-sans-serif-font-family:var(--spectrum-sans-serif-font-family);
--spectrum-heading-serif-font-family:var(--spectrum-serif-font-family);
--spectrum-heading-cjk-font-family:var(--spectrum-cjk-font-family);
Expand All @@ -381,7 +393,7 @@
--spectrum-heading-sans-serif-heavy-font-style:var(--spectrum-default-font-style);
--spectrum-heading-serif-heavy-font-weight:var(--spectrum-black-font-weight);
--spectrum-heading-serif-heavy-font-style:var(--spectrum-default-font-style);
--spectrum-heading-cjk-heavy-font-weight:var(--spectrum-black-font-weight);
--spectrum-heading-cjk-heavy-font-weight:var(--spectrum-extra-bold-font-weight);
--spectrum-heading-cjk-heavy-font-style:var(--spectrum-default-font-style);
--spectrum-heading-sans-serif-light-strong-font-weight:var(--spectrum-bold-font-weight);
--spectrum-heading-sans-serif-light-strong-font-style:var(--spectrum-default-font-style);
Expand Down Expand Up @@ -443,14 +455,14 @@
--spectrum-heading-size-s:var(--spectrum-font-size-300);
--spectrum-heading-size-xs:var(--spectrum-font-size-200);
--spectrum-heading-size-xxs:var(--spectrum-font-size-100);
--spectrum-heading-cjk-size-xxxl:var(--spectrum-font-size-1300);
--spectrum-heading-cjk-size-xxl:var(--spectrum-font-size-900);
--spectrum-heading-cjk-size-xxxl:var(--spectrum-font-size-1200);
--spectrum-heading-cjk-size-xxl:var(--spectrum-font-size-1000);
--spectrum-heading-cjk-size-xl:var(--spectrum-font-size-800);
--spectrum-heading-cjk-size-l:var(--spectrum-font-size-600);
--spectrum-heading-cjk-size-m:var(--spectrum-font-size-400);
--spectrum-heading-cjk-size-s:var(--spectrum-font-size-300);
--spectrum-heading-cjk-size-xs:var(--spectrum-font-size-200);
--spectrum-heading-cjk-size-xxs:var(--spectrum-font-size-100);
--spectrum-heading-cjk-size-s:var(--spectrum-font-size-200);
--spectrum-heading-cjk-size-xs:var(--spectrum-font-size-100);
--spectrum-heading-cjk-size-xxs:var(--spectrum-font-size-75);
--spectrum-heading-line-height:var(--spectrum-line-height-100);
--spectrum-heading-cjk-line-height:var(--spectrum-cjk-line-height-100);
--spectrum-heading-margin-top-multiplier:0.88888889;
Expand All @@ -469,7 +481,7 @@
--spectrum-body-sans-serif-strong-font-style:var(--spectrum-default-font-style);
--spectrum-body-serif-strong-font-weight:var(--spectrum-bold-font-weight);
--spectrum-body-serif-strong-font-style:var(--spectrum-default-font-style);
--spectrum-body-cjk-strong-font-weight:var(--spectrum-black-font-weight);
--spectrum-body-cjk-strong-font-weight:var(--spectrum-extra-bold-font-weight);
--spectrum-body-cjk-strong-font-style:var(--spectrum-default-font-style);
--spectrum-body-sans-serif-emphasized-font-weight:var(--spectrum-regular-font-weight);
--spectrum-body-sans-serif-emphasized-font-style:var(--spectrum-italic-font-style);
Expand All @@ -481,7 +493,7 @@
--spectrum-body-sans-serif-strong-emphasized-font-style:var(--spectrum-italic-font-style);
--spectrum-body-serif-strong-emphasized-font-weight:var(--spectrum-bold-font-weight);
--spectrum-body-serif-strong-emphasized-font-style:var(--spectrum-italic-font-style);
--spectrum-body-cjk-strong-emphasized-font-weight:var(--spectrum-black-font-weight);
--spectrum-body-cjk-strong-emphasized-font-weight:var(--spectrum-extra-bold-font-weight);
--spectrum-body-cjk-strong-emphasized-font-style:var(--spectrum-default-font-style);
--spectrum-body-size-xxxl:var(--spectrum-font-size-600);
--spectrum-body-size-xxl:var(--spectrum-font-size-500);
Expand Down Expand Up @@ -513,7 +525,7 @@
--spectrum-detail-sans-serif-strong-font-style:var(--spectrum-default-font-style);
--spectrum-detail-serif-strong-font-weight:var(--spectrum-bold-font-weight);
--spectrum-detail-serif-strong-font-style:var(--spectrum-default-font-style);
--spectrum-detail-cjk-strong-font-weight:var(--spectrum-black-font-weight);
--spectrum-detail-cjk-strong-font-weight:var(--spectrum-extra-bold-font-weight);
--spectrum-detail-cjk-strong-font-style:var(--spectrum-default-font-style);
--spectrum-detail-sans-serif-light-strong-font-weight:var(--spectrum-regular-font-weight);
--spectrum-detail-sans-serif-light-strong-font-style:var(--spectrum-default-font-style);
Expand All @@ -525,7 +537,7 @@
--spectrum-detail-sans-serif-emphasized-font-style:var(--spectrum-italic-font-style);
--spectrum-detail-serif-emphasized-font-weight:var(--spectrum-bold-font-weight);
--spectrum-detail-serif-emphasized-font-style:var(--spectrum-italic-font-style);
--spectrum-detail-cjk-emphasized-font-weight:var(--spectrum-black-font-weight);
--spectrum-detail-cjk-emphasized-font-weight:var(--spectrum-extra-bold-font-weight);
--spectrum-detail-cjk-emphasized-font-style:var(--spectrum-default-font-style);
--spectrum-detail-sans-serif-light-emphasized-font-weight:var(--spectrum-regular-font-weight);
--spectrum-detail-sans-serif-light-emphasized-font-style:var(--spectrum-italic-font-style);
Expand All @@ -537,7 +549,7 @@
--spectrum-detail-sans-serif-strong-emphasized-font-style:var(--spectrum-italic-font-style);
--spectrum-detail-serif-strong-emphasized-font-weight:var(--spectrum-bold-font-weight);
--spectrum-detail-serif-strong-emphasized-font-style:var(--spectrum-italic-font-style);
--spectrum-detail-cjk-strong-emphasized-font-weight:var(--spectrum-black-font-weight);
--spectrum-detail-cjk-strong-emphasized-font-weight:var(--spectrum-extra-bold-font-weight);
--spectrum-detail-cjk-strong-emphasized-font-style:var(--spectrum-default-font-style);
--spectrum-detail-sans-serif-light-strong-emphasized-font-weight:var(--spectrum-regular-font-weight);
--spectrum-detail-sans-serif-light-strong-emphasized-font-style:var(--spectrum-italic-font-style);
Expand Down
1 change: 1 addition & 0 deletions tokens/dist/css/large-vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@
--spectrum-navigational-indicator-top-to-back-icon-large:16px;
--spectrum-navigational-indicator-top-to-back-icon-extra-large:19px;
--spectrum-color-control-track-width:30px;
--spectrum-font-size-25:12px;
--spectrum-font-size-50:13px;
--spectrum-font-size-75:15px;
--spectrum-font-size-100:17px;
Expand Down
1 change: 1 addition & 0 deletions tokens/dist/css/medium-vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@
--spectrum-navigational-indicator-top-to-back-icon-large:12px;
--spectrum-navigational-indicator-top-to-back-icon-extra-large:15px;
--spectrum-color-control-track-width:24px;
--spectrum-font-size-25:10px;
--spectrum-font-size-50:11px;
--spectrum-font-size-75:12px;
--spectrum-font-size-100:14px;
Expand Down
Loading
Loading