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

feat(button): add ionic theme implementation #29187

Merged
merged 36 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1f3e134
[feat](button): Added new ionic theme and sizes.
joselrio Mar 19, 2024
e8dcab3
[feat](button): lint.sass.fix
joselrio Mar 19, 2024
025da98
[tests](button): Added new ionic theme tests.
joselrio Mar 19, 2024
11e87a1
[feat](button): Updated comment.
joselrio Mar 20, 2024
e41a2c6
[feat](button): Update api.txt
joselrio Mar 20, 2024
ebfa926
[feat](button): lint
joselrio Mar 20, 2024
ac591f1
[feat](button): typo
joselrio Mar 20, 2024
4cc1a04
[feat](button): fixed units.
joselrio Mar 20, 2024
5b5851c
Update core/src/components/button/button.tsx
joselrio Mar 21, 2024
8a75ecf
[feat](button): Feedback improvements.
joselrio Mar 21, 2024
5f89bf2
style(button): align Sass comments with md and ios vars
brandyscarney Mar 21, 2024
d6f05f6
Update core/src/components/button/button.ionic.scss
joselrio Mar 21, 2024
6a0fb94
Update core/src/components/button/button.tsx
joselrio Mar 21, 2024
98629a5
Update core/src/components/button/button.ionic.scss
joselrio Mar 21, 2024
8d16fd5
Update core/src/components/button/button.ionic.scss
joselrio Mar 21, 2024
af32d25
Update core/src/components/button/button.ionic.scss
joselrio Mar 21, 2024
f3ecd62
Update core/src/components/button/button.ionic.scss
joselrio Mar 21, 2024
fd3cf71
[style](button): removed default word.
joselrio Mar 21, 2024
21851bf
[style](button): feedback improvements
joselrio Mar 21, 2024
b38abf7
Update core/src/components/button/button.ionic.scss
joselrio Mar 21, 2024
77ee2c1
Update core/src/components/button/button.ionic.scss
joselrio Mar 21, 2024
7f35ac9
Update core/src/components/button/button.ionic.scss
joselrio Mar 21, 2024
d69eb3f
Merge remote-tracking branch 'origin/next' into ROU-4815
joselrio Mar 21, 2024
c1c0e76
[style](button): Changed the way border is hide to avoid flickering.
joselrio Mar 21, 2024
2436860
Merge remote-tracking branch 'origin/next' into ROU-4815
sean-perkins Mar 21, 2024
6753ba7
Update core/src/components/button/button.ionic.scss
joselrio Mar 22, 2024
2e872b2
Update core/src/components/button/button.tsx
joselrio Mar 22, 2024
bedc6e9
[fix](button): typo
joselrio Mar 22, 2024
ac4d8ec
[fix](button): lint
joselrio Mar 22, 2024
6fae295
Update checkbox.ios.scss
JoaoFerreira-FrontEnd Mar 22, 2024
94f6303
[fix](button): Removed unneeded tests.
joselrio Mar 25, 2024
961ef7e
test(button): ionic theme tests (#29201)
sean-perkins Mar 25, 2024
7bfb483
Merge branch 'ROU-4815' of https://github.com/ionic-team/ionic-framew…
JoaoFerreira-FrontEnd Mar 25, 2024
1a9e85a
chore: link tech-debt task
sean-perkins Mar 25, 2024
0e4fb4d
fix: use border-radius mixin, update comment blocks
sean-perkins Mar 25, 2024
76903b0
chore: remove diff
sean-perkins Mar 25, 2024
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: 3 additions & 2 deletions core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ ion-button,prop,mode,"ios" | "md",undefined,false,false
ion-button,prop,rel,string | undefined,undefined,false,false
ion-button,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false
ion-button,prop,routerDirection,"back" | "forward" | "root",'forward',false,false
ion-button,prop,shape,"round" | undefined,undefined,false,true
ion-button,prop,size,"default" | "large" | "small" | undefined,undefined,false,true
ion-button,prop,shape,"rectangular" | "round" | undefined,undefined,false,true
ion-button,prop,size,"default" | "large" | "small" | "xlarge" | "xsmall" | undefined,undefined,false,true
ion-button,prop,strong,boolean,false,false,false
ion-button,prop,target,string | undefined,undefined,false,false
ion-button,prop,theme,"ios" | "md" | "ionic",undefined,false,false
Expand Down Expand Up @@ -265,6 +265,7 @@ ion-button,css-prop,--padding-start
ion-button,css-prop,--padding-top
ion-button,css-prop,--ripple-color
ion-button,css-prop,--transition
ion-button,part,focus-ring
ion-button,part,native

ion-buttons,scoped
Expand Down
8 changes: 4 additions & 4 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,11 @@ export namespace Components {
/**
* Set to `"round"` for a button with more rounded corners.
*/
"shape"?: 'round';
"shape"?: 'round' | 'rectangular';
/**
* Set to `"small"` for a button with less height and padding, to `"default"` for a button with the default height and padding, or to `"large"` for a button with more height and padding. By default the size is unset, unless the button is inside of an item, where the size is `"small"` by default. Set the size to `"default"` inside of an item to make it a standard size button.
*/
"size"?: 'small' | 'default' | 'large';
"size"?: 'xsmall' | 'small' | 'default' | 'large' | 'xlarge';
/**
* If `true`, activates a button with a heavier font weight.
*/
Expand Down Expand Up @@ -5735,11 +5735,11 @@ declare namespace LocalJSX {
/**
* Set to `"round"` for a button with more rounded corners.
*/
"shape"?: 'round';
"shape"?: 'round' | 'rectangular';
/**
* Set to `"small"` for a button with less height and padding, to `"default"` for a button with the default height and padding, or to `"large"` for a button with more height and padding. By default the size is unset, unless the button is inside of an item, where the size is `"small"` by default. Set the size to `"default"` inside of an item to make it a standard size button.
*/
"size"?: 'small' | 'default' | 'large';
"size"?: 'xsmall' | 'small' | 'default' | 'large' | 'xlarge';
/**
* If `true`, activates a button with a heavier font weight.
*/
Expand Down
237 changes: 237 additions & 0 deletions core/src/components/button/button.ionic.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
@import "./button";
@import "./button.ionic.vars";

// Ionic Button
// -------------------------------------------------------------------------------

:host {
--border-radius: #{$button-ionic-border-radius};
--padding-bottom: var(--padding-top);
--padding-end: #{$button-ionic-padding-end};
--padding-start: var(--padding-end);
--padding-top: #{$button-ionic-padding-top};
--focus-ring-color: #9ec4fd;
--focus-ring-width: 2px;

position: relative;

min-height: #{$button-ionic-min-height};

font-size: #{$button-ionic-font-size};

// Target area
&::after {
@include position(50%, 0, null, 0);
position: absolute;
joselrio marked this conversation as resolved.
Show resolved Hide resolved

height: 100%;
min-height: px-to-rem(48);

transform: translateY(-50%);

content: "";

cursor: pointer;

z-index: 1;
}

::slotted(ion-icon[slot="start"]) {
@include margin-horizontal(null, px-to-rem(8));
}

::slotted(ion-icon[slot="end"]) {
@include margin-horizontal(px-to-rem(8), null);
}
}

// Button Sizes
// -------------------------------------------------------------------------------

/* Extra Small and Small Button */
:host(.button-xsmall),
:host(.button-small) {
::slotted(ion-icon[slot="start"]) {
@include margin-horizontal(null, px-to-rem(4));
}

::slotted(ion-icon[slot="end"]) {
@include margin-horizontal(px-to-rem(4), null);
}
}

/* Extra Small Button */
:host(.button-xsmall) {
--border-radius: #{$button-ionic-xsmall-border-radius};
--padding-top: #{$button-ionic-xsmall-padding-top};
--padding-end: #{$button-ionic-xsmall-padding-end};

min-height: #{$button-ionic-xsmall-min-height};

font-size: #{$button-ionic-xsmall-font-size};
}

/* Small Button */
:host(.button-small) {
--border-radius: #{$button-ionic-small-border-radius};
--padding-top: #{$button-ionic-small-padding-top};
--padding-end: #{$button-ionic-small-padding-end};

min-height: #{$button-ionic-small-min-height};

font-size: #{$button-ionic-small-font-size};
}

/* Large Button */
:host(.button-large) {
--padding-top: #{$button-ionic-large-padding-top};
--padding-end: #{$button-ionic-large-padding-end};

min-height: #{$button-ionic-large-min-height};

font-size: #{$button-ionic-large-font-size};
}

/* Extra Large Button */
:host(.button-xlarge) {
--padding-top: #{$button-ionic-xlarge-padding-top};
--padding-end: #{$button-ionic-xlarge-padding-end};

min-height: #{$button-ionic-xlarge-min-height};

font-size: #{$button-ionic-xlarge-font-size};
}

// Button with Icons
// -------------------------------------------------------------------------------

/* Button containing only an icon */
::slotted(ion-icon[slot="start"]),
::slotted(ion-icon[slot="end"]),
::slotted(ion-icon[slot="icon-only"]) {
font-size: 1em;
}

/* Button extra small */
:host(.button-has-icon-only.button-xsmall) {
--padding-end: #{$button-has-icon-only-padding-end-xsmall};
}

/* Button small */
:host(.button-has-icon-only.button-small) {
--padding-end: #{$button-has-icon-only-padding-end-small};
}

/* Default */
:host(.button-has-icon-only) {
--padding-end: #{$button-has-icon-only-padding-end};
}

/* Button large */
:host(.button-has-icon-only.button-large) {
--padding-end: #{$button-has-icon-only-padding-end-large};
}

/* Button extra large */
:host(.button-has-icon-only.button-xlarge) {
--padding-end: #{$button-has-icon-only-padding-end-xlarge};
}

// Button Shapes
// -------------------------------------------------------------------------------

// Button Shape Rectangular
// -------------------------------------------------------------------------------
:host(.button-rectangular) {
--border-radius: #{$button-ionic-rectangular-border};
}

// Button Shape Round
// -------------------------------------------------------------------------------
:host(.button-round) {
--border-radius: #{$button-ionic-round-border};
}

// Button Focused
// -------------------------------------------------------------------------------

// Only show the focus ring when the button is focused
:host(.ion-focused) {
--overflow: visible;

.button-native::after {
@include border-radius(inherit);
}
}

.button-focus-ring {
@include position(-4px, -4px, -4px, -4px);
@include border-radius(inherit);

position: absolute;

transition: border-color 0.3s;

border: var(--focus-ring-width) solid var(--focus-ring-color);

content: "";
box-sizing: border-box;
}

// Fill Solid Button
// -------------------------------------------------------------------------------

:host(.button-solid) {
--background-activated: #{ion-color(primary, shade)};
}

// Fill Outline Button
// --------------------------------------------------

:host(.button-outline) {
--border-width: #{$button-ionic-outline-border-width};
--border-style: #{$button-ionic-outline-border-style};
--background-activated: #e3e3e3;
--background-activated-opacity: 1;
--background-focused: transparent;
--background-hover: transparent;
--background-focused-opacity: 0.1;
--color-activated: #{ion-color(primary, base)};
}

:host(.button-outline.ion-focused) {
--border-color: transparent;
}

// Fill Clear Button
// --------------------------------------------------

:host(.button-clear) {
--background-activated: #e3e3e3;
--background-activated-opacity: 1;
--background-focused: transparent;
--background-hover: transparent;
}

// Button Hover
// --------------------------------------------------

:host(.button-outline),
:host(.button-clear) {
--background-hover: #121212;
--background-hover-opacity: 0.04;
}

// Button: Disabled
// --------------------------------------------------

:host(.button-disabled) {
--color: #c9c9c9;
--border-color: var(--color);

opacity: 1;
}

:host(.button-solid.button-disabled) {
--background: #f5f5f5;
}
Loading
Loading