-
Notifications
You must be signed in to change notification settings - Fork 202
feat(cornerrounding): add custom token and foundations documentation #2559
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
105 changes: 105 additions & 0 deletions
105
.storybook/foundations/corner-rounding/action-button-corner-rounding.stories.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = {}; |
97 changes: 97 additions & 0 deletions
97
.storybook/foundations/corner-rounding/checkbox-corner-rounding.stories.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = {}; |
7 changes: 7 additions & 0 deletions
7
.storybook/foundations/corner-rounding/component-size-tokens-medium.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
6 changes: 6 additions & 0 deletions
6
.storybook/foundations/corner-rounding/component-size-tokens-small.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
26
.storybook/foundations/corner-rounding/corner-rounding.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
75
.storybook/foundations/corner-rounding/corner-rounding.stories.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], | ||
mdt2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
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 = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*! | ||
Copyright 2024 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-Foundations-Example-CornerRounding-table { | ||
border-spacing: 1rem 0; | ||
margin-inline-start: -1rem; | ||
} | ||
|
||
.spectrum-Foundations-Example-CornerRounding-table th { | ||
text-align: start; | ||
} | ||
|
||
.spectrum-Foundations-Example-CornerRounding { | ||
inline-size: 3rem; | ||
block-size: 3rem; | ||
margin: 0.5rem; | ||
background-color: var(--spectrum-gray-500); | ||
} | ||
|
||
.spectrum-Foundations-Example-CornerRounding--border { | ||
background-color: var(--spectrum-gray-25); | ||
border: var(--spectrum-border-width-200) solid var(--spectrum-gray-700); | ||
} | ||
|
||
.spectrum-Foundations-Example-CornerRounding--none { | ||
border-radius: var(--spectrum-corner-radius-none); | ||
} | ||
|
||
.spectrum-Foundations-Example-CornerRounding--sizeS { | ||
border-radius: var(--spectrum-corner-radius-small-default); | ||
} | ||
|
||
.spectrum-Foundations-Example-CornerRounding--sizeM { | ||
border-radius: var(--spectrum-corner-radius-medium-default); | ||
} | ||
|
||
.spectrum-Foundations-Example-CornerRounding--sizeL { | ||
border-radius: var(--spectrum-corner-radius-large-default); | ||
} | ||
|
||
.spectrum-Foundations-Example-CornerRounding--sizeXL { | ||
border-radius: var(--spectrum-corner-radius-extra-large-default); | ||
} | ||
|
||
.spectrum-Foundations-Example-CornerRounding--full { | ||
border-radius: var(--spectrum-corner-radius-full); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.