-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[@next] refactor button component (#420)
- Loading branch information
Showing
219 changed files
with
4,243 additions
and
3,451 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
<forge-banner id="banner"> | ||
<forge-icon id="leading-icon" slot="icon" name="add_alert"></forge-icon> | ||
<div id="text">Lorem, ipsum dolor sit amet consectetur adipisicing elit.</div> | ||
<forge-button id="action-button" type="outlined" slot="button"> | ||
<button type="button">Learn more</button> | ||
</forge-button> | ||
<forge-button id="action-button" variant="outlined" slot="button">Learn more</forge-button> | ||
</forge-banner> | ||
|
||
<script type="module" src="banner.ts"></script> |
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,9 +1,5 @@ | ||
.demo { | ||
forge-button { | ||
width: 256px; | ||
|
||
button { | ||
width: 256px; | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
<div class="busy-indicator-host"> | ||
<forge-button type="raised"> | ||
<button id="show-busy-indicator-button">Show busy indicator</button> | ||
</forge-button> | ||
<forge-button variant="raised" id="show-busy-indicator-button">Show busy indicator</forge-button> | ||
</div> | ||
|
||
<script type="module" src="busy-indicator.ts"></script> |
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,34 +1,60 @@ | ||
<div class="vert"> | ||
<forge-button> | ||
<button type="button">Default button</button> | ||
<div class="button-demo"> | ||
<forge-button>Default button</forge-button> | ||
<forge-button variant="raised">Raised button</forge-button> | ||
<forge-button variant="flat">Flat button</forge-button> | ||
<forge-button variant="outlined">Outlined button</forge-button> | ||
<forge-button variant="outlined"> | ||
<span>w/<span> container</span> | ||
</forge-button> | ||
<forge-button type="raised"> | ||
<button type="button">Raised button</button> | ||
|
||
<forge-button variant="outlined"> | ||
<forge-icon slot="start" name="favorite"></forge-icon> | ||
w/Leading icon | ||
</forge-button> | ||
<forge-button type="unelevated"> | ||
<button type="button">Unelevated button</button> | ||
</forge-button> | ||
<forge-button type="outlined"> | ||
<button type="button">Outlined button</button> | ||
</forge-button> | ||
<forge-button type="outlined"> | ||
<button type="button"> | ||
<forge-icon name="favorite"></forge-icon> | ||
<span>w/Leading Icon</span> | ||
</button> | ||
</forge-button> | ||
<forge-button type="outlined"> | ||
<button type="button"> | ||
<span>w/Trailing icon</span> | ||
<forge-icon name="favorite"></forge-icon> | ||
</button> | ||
|
||
<forge-button variant="outlined"> | ||
w/Trailing icon | ||
<forge-icon slot="end" name="favorite"></forge-icon> | ||
</forge-button> | ||
<forge-button type="outlined"> | ||
<a href="javascript: alert('Anchor link button works!');"> | ||
<span>w/anchor tag</span> | ||
<forge-icon name="open_in_new"></forge-icon> | ||
</a> | ||
|
||
<forge-button variant="outlined" disabled href="javascript: alert('Anchor link button works!');"> | ||
w/Anchor link | ||
<forge-icon slot="end" name="open_in_new"></forge-icon> | ||
</forge-button> | ||
|
||
<forge-button variant="link">Link button</forge-button> | ||
|
||
<forge-button class="custom-button">Custom button</forge-button> | ||
|
||
<div> | ||
<h3 class="forge-typography--heading2">Form example</h3> | ||
<form class="test-form" id="test-btn-form" action="javascript: alert('<form> submit action');"> | ||
<forge-text-field> | ||
<input type="text" placeholder="Text input" aria-label="Test form input" autocomplete="off" /> | ||
</forge-text-field> | ||
<div> | ||
<forge-button id="submit-btn" variant="outlined" type="submit" name="submit-btn" formaction="javascript: alert('<forge-button> submit override action');">Submit</forge-button> | ||
<forge-button id="reset-btn" variant="outlined" type="reset">Reset</forge-button> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
<div> | ||
<h3 class="forge-typography--heading2">Popover target</h3> | ||
<forge-button id="popover-button" aria-expanded="false" popovertarget="my-popover" popover-icon variant="raised">Show popover</forge-button> | ||
<div popover id="my-popover">Lorem, ipsum dolor sit amet consectetur adipisicing elit. Ipsam blanditiis cum quod, velit, architecto consequatur commodi sint odit non deleniti qui? Accusamus expedita, exercitationem laborum architecto facere quasi rem! Voluptate!</div> | ||
</div> | ||
|
||
<div> | ||
<h3 class="forge-typography--heading2">Dialog</h3> | ||
<forge-button variant="raised" id="show-dialog-btn">Show dialog</forge-button> | ||
<dialog id="test-dialog"> | ||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus architecto sunt esse voluptatum possimus magnam omnis ipsum commodi neque maxime ab facere reiciendis, ex distinctio soluta qui maiores et aliquam.</p> | ||
<form method="dialog"> | ||
<forge-button type="submit" variant="raised">Close</forge-button> | ||
</form> | ||
</dialog> | ||
</div> | ||
</div> | ||
|
||
<script type="module" src="button.ts"></script> |
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,5 +1,84 @@ | ||
@use '../../src/shared'; | ||
@use '../../../lib/button'; | ||
@use '../../../lib/focus-indicator'; | ||
@use '../../../lib/core/styles/elevation'; | ||
|
||
button, a { | ||
.button-demo { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
gap: 16px; | ||
} | ||
|
||
forge-button { | ||
width: 256px; | ||
} | ||
|
||
form:has(forge-button) forge-button { | ||
width: auto; | ||
} | ||
|
||
#my-popover { | ||
max-inline-size: 500px; | ||
} | ||
|
||
.test-form { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
} | ||
|
||
h3 { | ||
margin-block: 16px; | ||
} | ||
|
||
.custom-button { | ||
--_custom-button-background: var(--forge-theme-primary); | ||
|
||
@include button.provide-theme(( | ||
height: 56px, | ||
dense-height: 40px, | ||
focus-indicator-offset: 4px, | ||
shadow: elevation.value(2), | ||
hover-shadow: elevation.value(4), | ||
active-shadow: elevation.value(8), | ||
color: var(--forge-theme-on-primary), | ||
background: var(--_custom-button-background), | ||
disabled-background: linear-gradient(to right, #aaa 0%, #ccc 51%, #aaa 100%), | ||
disabled-shadow: none | ||
)); | ||
|
||
&::after { | ||
content: ''; | ||
position: absolute; | ||
top: 2px; | ||
left: 2px; | ||
width: calc(100% - 4px); | ||
height: 50%; | ||
pointer-events: none; | ||
background: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2)); | ||
} | ||
|
||
&[popover-icon] { | ||
@include button.provide-theme(( justify: space-between )); | ||
} | ||
|
||
&[theme=secondary] { | ||
--_custom-button-background: var(--forge-theme-secondary); | ||
} | ||
&[theme=tertiary] { | ||
--_custom-button-background: var(--forge-theme-primary); | ||
} | ||
&[theme=success] { | ||
--_custom-button-background: var(--forge-theme-success); | ||
} | ||
&[theme=error] { | ||
--_custom-button-background: var(--forge-theme-error); | ||
} | ||
&[theme=warning] { | ||
--_custom-button-background: var(--forge-theme-warning); | ||
} | ||
&[theme=info] { | ||
--_custom-button-background: var(--forge-theme-info); | ||
} | ||
} |
Oops, something went wrong.