Compare commits

...

77 Commits

Author SHA1 Message Date
Bernardo Cardoso
36dfc50fa3 Merge branch 'next' into ionic-colors-support 2024-05-28 15:58:21 +01:00
Bernardo Cardoso
3b93bb4a9b feat(tokens): add html preview based on design-tokens (#29545)
Issue number: internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Added new files to scripts/tokens for the html template and css to
style the generated preview
- Added Style Dictionary register for generating html elements for each
main token

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->
2024-05-28 15:57:30 +01:00
Brandy Carney
b4ce7129b2 feat(avatar): add styles for xsmall size in ionic theme (#29548)
Issue number: internal

---------

## What is the current behavior?
Avatar does not have styles for the `"xsmall"` size in the ionic theme.

## What is the new behavior?
- Adds the styles for the xsmall size (width, height, padding, font
size, font weight and line height)
- Adds e2e test for xsmall size to the existing avatar test for sizes

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information

[Preview](https://ionic-framework-git-rou-10733-ionic1.vercel.app/src/components/avatar/test/size?ionic:theme=ionic)
2024-05-28 09:48:02 -04:00
Bernardo Cardoso
1ded2c5191 update iopnic clear button snapshots 2024-05-28 09:28:55 +01:00
Bernardo Cardoso
c8679f8b1b now color utilities affect variables 2024-05-28 07:21:55 +01:00
Bernardo Cardoso
6f089c0536 improve cretaeColorClasses function 2024-05-28 07:20:44 +01:00
Brandy Carney
7f8be3e18c feat(avatar): add styles for large size in ionic theme (#29541)
Issue number: internal

---------

## What is the current behavior?
Avatar does not have styles for the `"large"` size in the ionic theme.

## What is the new behavior?
- Adds the styles for the large size (width, height, padding, font size)
- Adds e2e test for large size to the existing avatar test for sizes

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information

[Preview](https://ionic-framework-git-rou-10736-ionic1.vercel.app/src/components/avatar/test/size?ionic:theme=ionic)
2024-05-23 12:44:35 -04:00
Brandy Carney
fea59b73aa feat(avatar): add styles for small size in ionic theme (#29540)
Issue number: internal

---------

## What is the current behavior?
Avatar does not have styles for the `"small"` size in the ionic theme.

## What is the new behavior?
- Adds the styles for the small size (width, height, padding, font size)
- Adds e2e test for small size to the existing avatar test for sizes

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information

[Preview](https://ionic-framework-git-rou-10734-ionic1.vercel.app/src/components/avatar/test/size?ionic:theme=ionic)
2024-05-23 12:28:00 -04:00
Brandy Carney
b9af47ae0d feat(avatar): add styles for default (medium) size in ionic theme (#29538)
Issue number: internal

---------

## What is the current behavior?
Avatar does not have any styles in the ionic theme.

## What is the new behavior?
- Adds background, border and font styles for avatar
- Adds the styles for the medium size and defaults the size to medium
- Adds e2e test for avatar sizes

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information

[Preview](https://ionic-framework-git-rou-10735-ionic1.vercel.app/src/components/avatar/test/size?ionic:theme=ionic)
2024-05-23 12:12:31 -04:00
Bernardo Cardoso
b21f95cced feat(tokens): add rgba for color tokens with 8 chars (#29542)
Issue number: internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->


- Added new method to detect colors with eight characters
- Added logic to generate an rgba when the above is true. This is to
ensure better compatibility with older devices that don't support colors
with more than six characters.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->
2024-05-23 15:19:02 +01:00
Maria Hutt
1c035af1a2 feat(badge): add xlarge size for ionic theme (#29530) 2024-05-22 14:00:43 -07:00
Maria Hutt
258dabfb9e feat(badge): add large size for ionic theme (#29529) 2024-05-22 11:58:09 -07:00
Maria Hutt
15f8c55046 feat(badge): add medium size for ionic theme (#29528) 2024-05-22 11:32:48 -07:00
Maria Hutt
5c0b5c32d0 feat(badge): add small/default size for ionic theme (#29526) 2024-05-22 11:11:37 -07:00
Bernardo Cardoso
888b0c8284 feat(tokens): update design-tokens (#29533)
Issue number: internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

Added an update to Design Tokens, requested by UX/UI Team:

- New semantic colors added
- Guidelines token was removed 
- Hover, disabled and pressed tokens now correctly appear on Theme JSON
- Removed _color.styles.tokens.json_ file, as it was now empty.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->
2024-05-22 18:22:57 +01:00
Bernardo Cardoso
b6325e49be feat(tokens): add new tokens json files (#29525)
Issue number: internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Added new structure of JSON files that are generated from Figma
Variables
- Adjusted tokens.js script to correctly translate the new JSON format
- Adjusted tokens usage on components and CSS files
- Added html template to auto-generate html preview based on Design
Tokens (wip)
- Updated snapshots, as some tokens values changed, specially colors.

## Does this introduce a breaking change?

- [x] Yes
- [ ] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

---------

Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
2024-05-22 16:50:21 +01:00
Maria Hutt
9fd1a53c74 feat(chip): add small size (#29514)
Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
2024-05-17 12:28:29 -07:00
Brandy Carney
3f12e5850d feat(button,card,chip): add default shape (#29515) 2024-05-16 15:28:11 -04:00
Brandy Carney
968807f4eb chore(git): sync next (#29513) 2024-05-16 12:26:46 -04:00
Brandy Carney
7f192a4d99 Merge branch 'next' into chore-sync-next 2024-05-16 12:08:04 -04:00
Maria Hutt
588db38e15 chore(git): sync main (#29509) 2024-05-15 14:23:06 -07:00
Maria Hutt
4412246f95 Merge remote-tracking branch 'origin/main' into chore-sync-next-with-main 2024-05-15 14:00:27 -07:00
Brandy Carney
237245f567 chore(git): update from next (#29491) 2024-05-13 14:47:05 -04:00
Brandy Carney
a214b3de4c Merge branch 'next' into chore-fw-6191-next 2024-05-13 13:37:25 -04:00
Brandy Carney
8e7be665fa chore(): add updated snapshots (#29496)
Co-authored-by: ionitron <hi@ionicframework.com>
2024-05-13 13:08:38 -04:00
Brandy Carney
edbc1eca1b chore(git): update from main (#29488) 2024-05-10 17:41:36 -04:00
Brandy Carney
b353984216 Merge branch 'main' into chore-update-from-main 2024-05-10 17:29:30 -04:00
Maria Hutt
a58d9fa2e1 feat(many): expand global config for icons (#29373)
Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
2024-05-08 16:22:12 -07:00
Brandy Carney
4dae03f2ac feat(button): set default shape to soft for ios and round for md and ionic themes (#29404)
Issue number: internal

---------

## What is the current behavior?
The `shape` property defaults to `"soft"` for `ios` and `"round"` for
the `md` and `ionic` themes.

**Default button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `undefined`     | `8px`  | `14px`      | `4px`      |
| `"round"`       | `999px` | unsupported | unsupported |
| `"rectangular"` | `0px`  | unsupported | unsupported |

**Large button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `undefined`     | `8px`  | `16px`      | `4px`      |

**Small button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `undefined`     | `4px`  | `6px`      | `4px`      |

## What is the new behavior?
The `shape` property defaults to `undefined` which evaluates to the
"Soft" shape for all themes.


**Default button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------- | ------ | -------- |
| `"soft"`        | `8px`   | `6px`   | `4px`   |
| `"round"`       | `999px` | `999px` | `999px` |
| `"rectangular"` | `0px`   | `0px`   | `0px`   |

**Large button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `soft`     | `8px`  | `8px`      | `4px`      |

**Small button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `soft`     | `4px`  | `4px`      | `4px`      |

- Adds support for the `"soft"` shape in the `ionic` theme using the
existing values for `undefined`
- Adds support for the `"rectangular"` and `"round"` shapes in `ios` and
`md` using `0px` and `999px` border radius
- Sets the default shape property to `"round"` for the `ionic` and `md`
themes and `"soft"` for `ios` and updates the `border-radius` to apply
to the shape classes instead of `:host`
- Updates the `"soft"` shape border radius for `ios` in the various
sizes to match the buttons created in SwiftUI (their "rounded" is our
"soft"):

![rounded-ios-buttons](https://github.com/ionic-team/ionic-framework/assets/6577830/230edf21-de68-4c41-9b89-8ea310ce42f2)
- Fixed the icon only buttons in the `"ionic"` theme so that they are
not styled based on the size while always following the proper aspect
ratio. This was broken for the default size due to an incorrect padding
value & I made it so we don't have to specify the padding for each size:

| Before | After |
| ---| ---|
|
![before](https://github.com/ionic-team/ionic-framework/assets/6577830/1e8d1a82-ad58-4372-be69-09175362c810)
|
![after](https://github.com/ionic-team/ionic-framework/assets/6577830/06cf6e22-a606-4ccc-ae4b-df69cf9c1e1e)
|

## Does this introduce a breaking change?

- [x] Yes
- [ ] No

BREAKING CHANGE:

The `border-radius` of the `ios` and `md` button now defaults to `6px`
and `999px` instead of `14px` and `4px`, respectively, in accordance
with the iOS and Material Design 3 guidelines. To revert to the previous
appearance, set the `shape` to `"soft"` for `md` and override the
`--border-radius` CSS variable for `ios` to `14px`, or set it to a
different value entirely.

---------

Co-authored-by: ionitron <hi@ionicframework.com>
2024-05-08 16:05:59 -04:00
Brandy Carney
c78d2e6ec8 feat(chip): set default shape to soft for ios and md theme and round for ionic theme (#29375)
Issue number: internal

---------

## What is the current behavior?
The `shape` property defaults to `undefined` which evaluates to the
"Soft" shape for the `ionic` theme and the "Round" shape for the
`ios`/`md` themes.

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `undefined`     | `4px`  | `16px`      | `16px`      |
| `"round"`       | `999px` | unsupported | unsupported |
| `"rectangular"` | `0px`  | unsupported | unsupported |

## What is the new behavior?
| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------- | ------ | -------- |
| `"soft"`        | `4px`   | `10px`   | `8px`   |
| `"round"`       | `999px` | `999px` | `999px` |
| `"rectangular"` | `0px`   | `0px`   | `0px`   |

- Sets the default `shape` property to `"soft"` for `ios` and `md`
themes and `"round"` for the ionic theme.
- Updates the `border-radius` to apply to the shape classes instead of
`:host`
- Updates the `ios` theme to use `10px` for `"soft"` as this was taken
from the App Store:

![ios-app-store](https://github.com/ionic-team/ionic-framework/assets/6577830/14008de2-a953-4b27-81da-13dd481c5e39)
- Updates the `md` theme to use `8px` for `"soft"` as this is taken from
the [Material Design 3
guidelines](https://m3.material.io/components/chips/specs#590903f7-2bf5-46ab-9810-d052173f41f1)
& the previous value of `16px` is the equivalent of the `999px` round
shape due to the height being `32px`
- Adds support for the `"round"` and `"rectangular"` shapes in `ios` and
`md` themes

## Does this introduce a breaking change?

- [x] Yes
- [ ] No

BREAKING CHANGE:

The `border-radius` of the `ios` and `md` chip now defaults to `10px`
and `8px`, respectively, instead of `16px` in accordance with the iOS
and Material Design 3 guidelines. To revert to the previous appearance,
set the `shape` to `"round"`, or override the `--border-radius` CSS
variable to specify a different value.

---------

Co-authored-by: ionitron <hi@ionicframework.com>
2024-05-03 14:33:55 -04:00
Brandy Carney
7bbbd4b6b8 feat(card): set round as the default shape for all themes (#29387)
Issue number: internal

---------

## What is the current behavior?
The `shape` property defaults to `undefined` which evaluates to the
"Soft" shape for all themes.

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `undefined`     | `4px`  | `8px `      | `4px`      |
| `"round"`       | `16px` | unsupported | unsupported |
| `"rectangular"` | `0px`  | unsupported | unsupported |

## What is the new behavior?
| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------- | ------ | -------- |
| `"soft"`        | `4px`   | `8px`   | `4px`   |
| `"round"`       | `16px` | `14px` | `12px` |
| `"rectangular"` | `0px`   | `0px`   | `0px`   |

- Adds support for the `"soft"` shape using the existing values for
`undefined`
- Sets the default `shape` property to `"round"` for all themes and
updates the `border-radius` to apply to the shape classes instead of
`:host`
- Adds support for the `"round"` and `"rectangular"` shapes in `ios` and
`md`
- Updates the `ios` theme to use `14px` for `"round"` as this is taken
from the card in the iOS App Store
<img width="400px"
src="https://github.com/ionic-team/ionic-framework/assets/6577830/51f7028c-990d-48b5-b3e0-9909dae7e31c">
- Updates the `md` theme to use `12px` for `"round"` as this is taken
from the [Material Design 3
guidelines](https://m3.material.io/components/cards/specs#daab7734-3b3e-464c-a967-7c7fa14e6478)

## Does this introduce a breaking change?

- [x] Yes
- [ ] No

BREAKING CHANGE:

The `border-radius` of the `ios` and `md` card now defaults to `14px`
and `12px` instead of `8px` and `4px`, respectively, in accordance with
the iOS and Material Design 3 guidelines. To revert to the previous
appearance, set the `shape` to `"soft"`, or override the
`--border-radius` CSS variable to specify a different value.

---------

Co-authored-by: ionitron <hi@ionicframework.com>
2024-05-03 14:04:30 -04:00
Brandy Carney
7c7c483ab9 chore(git): sync with main (#29445) 2024-05-03 11:02:25 -04:00
Sean Perkins
8acf8f3c96 chore: vue will build successfully 2024-05-02 18:49:42 -04:00
Brandy Carney
ef9b823dcd style: run build, lint, and remove !default Sass variables 2024-05-02 17:30:30 -04:00
Brandy Carney
8b834387d4 Merge branch 'main' into chore-update-next-from-main 2024-05-02 16:43:54 -04:00
Brandy Carney
1116cdd44a chore(breaking): archive v8 breaking changes (#29394)
Archives the v8 breaking changes document to prepare for the v9 breaking changes.
2024-04-24 13:10:48 -04:00
Sean Perkins
2b748c7df7 chore: sync with main (#29385)
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Syncs the `next` branch with the latest from `main`

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-04-24 09:52:30 -04:00
Sean Perkins
3c435fd182 chore: prettier formatting 2024-04-23 17:46:34 -04:00
Sean Perkins
305ea7b85e chore: update import path for stylesheet 2024-04-23 17:37:58 -04:00
Sean Perkins
dc2db1204f Merge remote-tracking branch 'origin/main' into sp/sync-next-with-main-04-23 2024-04-23 17:34:32 -04:00
Brandy Carney
fa2fabdb0a feat(tabs): add ionic theme for tab bar and tab button (#29359)
Issue number: internal

---------

## What is the current behavior?
Tab bar & tab button use the `md` styles for the `ionic` theme

## What is the new behavior?
Adds the following styles for the `ionic` theme:
- Rectangular, fixed tab bar
- Box shadow with elevation z2
- Selected, activated, and focused states

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information
- A ticket (FW-6186) has been created to track updating the hardcoded
hex values to design tokens
- A ticket (FW-6189) has been created to add badge styles
2024-04-19 14:26:15 -04:00
Bernardo Cardoso
1e757513ce feat(ionic-theme): improve scss architecture for ionic theme (#29345)
Issue number: None

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

This PR follows the architectural changes defined on the _SCSS
Architecture Design Doc_. Due to some of the developments done in the
meantime, not everything that was defined on that document was followed
and some sections were simplified.

Overall, there were two guidelines that supported the work on this PR:
- Have no impact on the current scss partials & CSS architecture for the
`md/iOS` themes.
- Make everything related to the new `Ionic` Theme separated.

Based on these, here're the changes made:

**On Themes folder (private):**
- Renamed current internal scss partials on src/themes, related to
md/iOS, to `native.*.scss` and move them to a new folder, called
`native`. Updated imports on all framework.
- Removed the ionic prefix from the name of the mixins and function
partials on src/themes. Updated imports on all framework.
- Created new folder, named ionic, inside src/themes. This holds the
`ionic.globals.scss`, with all the mixins and functions forwarded, to be
used on other scopes.
- Replaced on already created Ionic theme files, the usage of tokens and
mixins with @use, to instead _@use
"../../themes/ionic/ionic.globals.scss" as globals;_. This ensures an
equal approach is followed everywhere and also makes it easier to change
the files imported or paths, in the future, as its all in the same
global file.
- Updated the foundations `readMe` file, with the new process for using
globals.


![themes](https://github.com/ionic-team/ionic-framework/assets/32780808/1455523c-3ccd-4310-a974-522f9f8ade02)


**On css folder (public):**
- Created new folder, named `ionic`, inside src/css. This holds all the
files related exclusively to Ionic Theme, following the same structure
as exists now for md/iOS, with a core, a bundle, utils, etc. Some files
were a bit duplicated, to eliminate imports from ios or md theme
partials. The only file common to both Themes is the `normalize.scss`.
- No folder structure or renamings were done on the existing output, to
prevent breaking-changes for developers already making imports from this
folder.
- Updated typography and link partials to use globals instead of tokens.
- Changed `font-size` styles on typography to be on `body`, instead of
`html`, to enable correct support of accessibility features on browsers
and devices, related to `font-size`.


![css](https://github.com/ionic-team/ionic-framework/assets/32780808/10bedddc-23c1-4c50-a4e4-77fb7f6c6430)


**Other changes related to global styles new architecture:**
- Updated margin & padding utility-classed generated by token, to
include css variables and padding/margin mixins.
- Updated link test to use new global Ionic bundle, correct
utility-class on ion-content and updated snapshots. The font-size
changed to 16, as its now the default on the body.
- Updated typography snapshots.
- Updated prettier format on all scss files. Later on we should make
sure this is equal for all team members.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->

---------

Co-authored-by: Sean Perkins <sean@ionic.io>
2024-04-18 17:22:24 +01:00
Sean Perkins
ea1207174d feat(checkbox): add ionic theme styling (#29335)
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Checkbox does not have an ionic theme implementation.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Adds the ionic theme styles and initial features for checkbox. 
- This PR is a combination of all the individual PRs already reviewed.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

We should confirm that the visual styles and behavior function as we
expect with all the changes combined in this PR.

---------

Co-authored-by: João Ferreira <60441552+JoaoFerreira-FrontEnd@users.noreply.github.com>
Co-authored-by: ionitron <hi@ionicframework.com>
2024-04-16 11:19:33 -04:00
Sean Perkins
62a3e115ef chore(ci): stability for test-core-clean-build (#29338)
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

CI will fail randomly due to which stylesheet is processed last by
rollup in Stencil. This leads to random failures.

This is caused by some of the new ionic stylesheets not importing the
same common stylesheet that included the CSS variable documentation.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Temporarily copies and pastes the documentation blocks to the affected
ionic stylesheets
- CI should no longer fail randomly when comparing the generated
`api.txt` output
- Adds a technical debt track to track removing these changes once the
bug in Stencil is resolved and released

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-04-12 16:18:15 -04:00
Sean Perkins
2414b78bef feat(tokens): generate rgb variants of colors (#29331)
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

The generated design tokens only generate HEX output of colors. This
prevents us from using the color tokens when we need to manipulate the
alpha channel of the color.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Generate a rgb color token and sass variable for each existing color
token.
- These "rgb" formatted variables are an existing practice to Ionic
Framework. Developers are expected to pass the variable into an `rgb` or
`rgba` function.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-04-12 09:45:02 -04:00
Bernardo Cardoso
95daa05a49 feat(chip): add shape to ionic theme (#29303)
Issue number: None

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Added new prop `shape`, only supported on Ionic Theme.
- Added scss for the different shapes.
- Added missing scss for font-weight and line-height.
- Added missing tests for focus state and new tests for shape.
- Added new font weight and line-height design tokens. This change
uncovered an issue on the IOnic Typography tests that resulted on
snapshots differences.
- Added & updated new snapshot baselines.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->

---------

Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-authored-by: Sean Perkins <sean@ionic.io>
Co-authored-by: Sean Perkins <13732623+sean-perkins@users.noreply.github.com>
2024-04-11 16:08:20 +01:00
Sean Perkins
a57be0941d feat(css): global link classes for standalone and underline (#29298)
Issue number: Internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

N/A

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Adds two global classes for `.ionic-link` (standalone) and
`.ionic-link-underline` (underline) appearances.
- The global classes apply when directly applied to an anchor element
(`a`) or when used on a parent container that renders a link internally.

**Usage**

Developers will need to import the link global stylesheet at this time
to leverage the following CSS classes.

```html
<!-- Basic Usage -->
<a href="#" class="ionic-link">Standalone</a>
<a href="#" class="ionic-link-underline">Underline</a>

<!-- Nested Usage -->
<div class="ionic-link">
  <a href="#">Standalone</a>
</div>
<div class="ionic-link-underline">
  <a href="#">Underline</a>
</div>
```

**Focus and Activated States**

Developers should apply the `ion-focusable` and `ion-activatable`
classes to the anchor elements to enable proper styling on a mobile
device. For web-only usages, the fallback `:focus` and `:active` pseudo
states will apply correctly.

```html
<!-- Basic Usage -->
<a href="#" class="ionic-link ion-focusable ion-activatable">Standalone</a>
<a href="#" class="ionic-link-underline ion-focusable ion-activatable">Underline</a>
```

### Design Changes

This section is areas of the implementation that are not consistent with
the design and why.

1. Font size: Link font sizing is inherited from its content. This is to
provide visual consistency when using a link within a paragraph or
existing text content. Links should not have an explicit font size, but
can be customized by the developer if a specific font size is desired.
2. Color: `currentColor` was used in place of
`$ionic-color-neutral-900`. This is to provide better visual consistency
when a link is used within content. Text color should be set on the body
or text content, which would apply neutral-900 in places where it is
applied.
3. The text underline offset in the designs is ~3px, but all of the
design implementation is on a 4px grid. We've landed on 2px for the
offset here.

Discussed with Design and these proposed changes were verbally approved.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  4. Update the BREAKING.md file with the breaking change.
5. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-04-10 16:00:03 -04:00
Marcelino
9e7c9a5934 feat(card): Add shape feature to card and style into Ionic theme (#29292)
Issue number: resolves #

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Adds the new shapes to ionic theme card

## Does this introduce a breaking change?

- [ ] Yes
- [X] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->

---------

Co-authored-by: Brandy Carney <brandy@ionic.io>
2024-04-10 18:20:08 +01:00
Bernardo Cardoso
e93941ffa3 docs(design-tokens): add foundations README (#29285)
<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Added a new README.md file under core/src/foudantions, with
documentation about Design Tokens.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->

---------

Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
2024-04-10 17:01:30 +01:00
Sean Perkins
2e9fee8ed8 chore: sync next with feature-8.1 (#29311)
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Syncs the `next` branch with `feature-8.1`

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-04-10 11:49:28 -04:00
Sean Perkins
6f42c29250 Merge branch 'next' into sp/sync-next-with-feature-8-1-04-09 2024-04-10 11:34:35 -04:00
José Rio
0decc7770d fix(button): update icon size to the default size (#29255)
Issue number: ROU-4815

---------
## What is the current behavior?
- Ionic theme, Icon size was 14px to the default button size;

## What is the new behavior?
- Ionic theme, Icon size has now 16px to the default button size;

## NOTE:
- Tests related... this a fix on top of [PR of ROU-4815
branch](https://github.com/ionic-team/ionic-framework/pull/29187) and as
was mentioned there, tests will be implemented under a task that will be
then created specifically for it.
2024-04-10 10:45:44 +01:00
Sean Perkins
1674211ce7 fix: bad merge conflict resolution
Removes the duplicate clear icon from rendering.
2024-04-09 16:56:08 -04:00
Sean Perkins
fb445322c3 Merge remote-tracking branch 'origin/feature-8.1' into sp/sync-next-with-feature-8-1-04-09 2024-04-09 15:02:05 -04:00
Bernardo Cardoso
7ce115993a feat(Chip): Add styles for icons inside Chip Ionic Theme (#29295)
Issue number: resolves #ROU-4838

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->


## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Added styles for icons inside Chip (Ionic Theme)
- Fixed an issue related to hover status, after tokens integration

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->
2024-04-08 14:26:24 +01:00
Bernardo Cardoso
77c67f2362 feat(Chip): Add outline support for Chip Ionic Theme (#29284)
Issue number: resolves #ROU-4839

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Added support for outline option on Ionic Theme
- Replaced temporary variables with global variables from Design Tokens
- Removed associated TODO

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-04-08 11:54:19 +01:00
Bernardo Cardoso
a8c06c118e fix(design-tokens): Add missing tokens and update usage on Typography (#29283)
<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Updated missing font tokens on `_designTokens.json`.
- Updated `tokens.js` script for building utility-classes for newly
added font tokens.
- Fixed space token typo.
- Updated ionic.typography file to start using design tokens and remove
duplicated code from the tokens generated files.
- Updated Ionic Typography tests

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-04-05 14:20:12 +01:00
Bernardo Cardoso
19f7be8877 feat(tokens): add design tokens architecture (#29245)
<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

Following the Design Doc for the new Ionic Design System, an
architecture for Design Tokens was added.

1. Added new `foundations` folder inside the `src`, to hold all the
tokens related files.
2. On this file, a json with all the tokens for the new Design System
was added. The format followed was the one suggested on the [W3C
draft](https://design-tokens.github.io/community-group/format/).
3. Added a dev dependency for [Styles
Dictionary](https://amzn.github.io/style-dictionary/#/), version 3.9.2.
4. Added a tokens.js script that will take care of transforming the json
tokens into the desired output. For now, three files are being
generated: ionic.vars.css (:root with all CSS Variables); ionic.vars.css
(scss variables for each token) and ionic.utility.css (a new
utility-class for each token)
5. Added the script `npm run build.tokens` to package.json, that will
generate the three files mentioned above.

For now, all these changes bring no impact to the rest of the Framework,
as these variables are not yet being consumed.

The `margin`, `padding` and `border-radius` were removed from the
prohibited properties on lint, to prevent lint errors with the new
utility-classes. This is very open to discussion/feedback if it's seen
as not ok.

The `build` command now includes the `build.tokens` script, to make sure
the files are always generated, in case someone forget to run the
command, after changing the json file!

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
6. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->

---------

Co-authored-by: Sean Perkins <13732623+sean-perkins@users.noreply.github.com>
2024-04-05 09:27:48 +01:00
Bernardo Cardoso
1c4b6bd8f2 feat(chip): add ionic theme and visual states (#29273)
Issue number: ROU-4840

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?

- Added a new Ionic Theme partial, with no dependencies to current
`ios/md` architecture. This is to avoid bleeding of the current Design
System into the work we are doing for the new Ionic Design System and
Theme. For that reason I duplicated part of the basic styles for the
Chip (display, box-sizing, etc) and created provisional scss variables,
that should be replaced later on with the correct global ones from the
new Design System.

- Added styles for info chip type states (default, hover, focus and
disabled)

- No new tests were done on this scope, as there're still other Chip
tasks being developed that would override any baselines defined now for
this theme. Once the initial basic work for the Chip is complete, tests
for the Ionic Theme should be implemented, under the task ROU-4837.

- A new page was created - `chip/tests/theme-ionic` - to check styles
for current implementation. This will also be used and improved in
future Chip Ionic Theme tasks.


## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->
2024-04-04 17:23:47 +01:00
Marcelino
17f5be1edd feat(theme): add new typography styles for the ionic theme (#29212)
Issue number: **ROU-4810**

---------
## Context
All the CSS for typography is temporarily added in the `text.scss` file
because the correct architecture for the new theme implementation isn’t
ready yet. In the future, all these **Sass variables** and **CSS**
created need to be placed at the theme level in terms of architecture.
The typography of an app needs to be divided into `iOS`, `Android (md)`,
and `Ionic` themes.

---------
## What is the new behavior?

- Added new typography styles;

## Does this introduce a breaking change?

- [ ] Yes
- [X] No


## Preview

![image](https://github.com/ionic-team/ionic-framework/assets/25321845/861a13c0-8ebf-43f4-a688-3b51a36d7b06)

---------

Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Brandy Carney <brandy@ionic.io>
Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
2024-04-04 14:21:25 +01:00
Brandy Carney
efdaf38520 fix(button): show correct background for activated button with color (#29222)
Updates the solid buttons with color to use the current color's shade.
2024-04-03 11:48:06 -04:00
Sean Perkins
b11c630410 fix(core): fallback detection for themes and modes (#29224)
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

With the latest changes on `next`, the fallback behavior for detecting
the themes from the Ionic config does not work when using
`ion-router-outlet`.

For example, in a React app with:

```ts
setupIonicReact({
  theme: 'ios'
});
```

and a template of:
```tsx
<IonApp>
    <IonReactRouter>
      <IonRouterOutlet>
         /* All children will apply the default mode for the mode and theme - not expected */
     </IonRouterOutlet>
  </IonReactRouter>
</IonApp>
```

All components rendered inside the `IonRouterOutlet` will apply the
`mode` detection for the `theme`. This is not expected behavior, since
the configuration has specified the `ionic` theme is the default theme.

This problem occurs due to this specific logic:
```ts
const elmMode = (elm as any).mode || elm.getAttribute('mode');
```

The `ion-router-outlet` component has a property defined on the class
for `mode`:
ca0923812a/core/src/components/router-outlet/router-outlet.tsx (L42)

This means that `defaultMode` will always apply over the Ionic config's
theme (`defaultTheme`).

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Specifying the `ionic` theme from the `initialize`/`setupIonicReact`
functions will persist to children components.
- Developers can still use the `mode` to persist the changes to child
nodes. However for in the case of `IonRouterOutlet`, it will require
actually specifying the attribute in the mark-up:
```tsx
<IonRouterOutlet mode="md">
  /* Any children will apply the "md" mode and theme */
</IonRouterOutlet>
```

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-04-02 22:26:14 -04:00
Sean Perkins
5234224700 chore(playwright): combine test configs for themes and modes (#29206)
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Developers are not able to easily add the "ionic" theme to existing test
cases, without running the test against both iOS and MD mode:

```ts
configs({ themes: ['ios', 'md', 'ionic'] })
// Generates 4 test cases
// - iOS theme on iOS mode
// - MD theme on MD mode
// - Ionic theme on iOS mode
// - Ionic theme on MD mode
```

With the separation of `mode` into look and feel, the majority of test
cases do not require testing the mode behavior and instead only need to
test the visual theme that is applied to the component.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Removes the `themes` option from the `configs` test generator object.

```ts
configs({ modes: ['ios', 'md', 'ionic-md'] })
```

- Combines `theme` and `mode` into the existing `modes` test generator
object
- The new options are `ionic-ios` and `ionic-md`, to run the Ionic theme
against the respective mode.
- This path was preferred to avoid deprecating and migrating all
existing tests.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

I do not have a strong preference on the semantics of `ionic-ios` vs.
`ios-ionic` (theme first vs. mode first). If anyone has an opinion or
alternative suggestion, please add a comment.

---------

Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
2024-03-28 12:52:09 -04:00
Sean Perkins
6d6fd4af1b chore: sync next with feature-8.0 (#29225)
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Syncs the `next` branch with the latest from `feature-8.0`.


## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-03-27 10:14:18 -04:00
Sean Perkins
7cfee535ac chore(angular): update component wrappers output 2024-03-27 00:15:06 -04:00
Sean Perkins
167e311474 Merge remote-tracking branch 'origin/feature-8.0' into sp/sync-next-03-27 2024-03-27 00:13:38 -04:00
Liam DeBeasi
7eae6ec591 refactor(button): update focus ring to avoid additional API (#29223) 2024-03-26 13:40:11 -04:00
José Rio
4cf1b9737d feat(button): add ionic theme implementation (#29187)
Issue number: **ROU-4815**

---------

## What is the new behavior?

- Adds an ionic theme style implementation for `ion-button`.
  - Adds a new `rectangular` shape to the button.
  - Adds two new button sizes: `xsmall` and `xlarge`.
  - Adds a new `focus-ring` CSS shadow part for the ionic theme.

## Does this introduce a breaking change?

- [ ] Yes
- [X] No


## Preview


![Screen-Recording-2024-03-20-at-1](https://github.com/ionic-team/ionic-framework/assets/5339917/0defd1b4-abd9-44bc-b0b9-cd29e0b1f24f)

---------

Co-authored-by: Sean Perkins <13732623+sean-perkins@users.noreply.github.com>
Co-authored-by: Brandy Carney <brandy@ionic.io>
Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-authored-by: Sean Perkins <sean@ionic.io>
Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
Co-authored-by: João Ferreira <60441552+JoaoFerreira-FrontEnd@users.noreply.github.com>
Co-authored-by: João Ferreira <joao.manuel.ferreira123@gmail.com>
2024-03-25 22:17:10 -04:00
Sean Perkins
f664329f71 chore: sync with feature-8.0 (#29202)
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Syncs the `next` branch with `feature-8.0`

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-03-21 16:45:15 -04:00
Sean Perkins
d73de9194d Merge remote-tracking branch 'origin/feature-8.0' into sp/sync-next-03-21 2024-03-21 16:28:35 -04:00
Sean Perkins
e8169bfddb chore: sync next with feature-8.0 (#29194)
Issue number: Internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

N/A

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Syncs `next` with the latest changes from `feature-8.0`

## Does this introduce a breaking change?

- [ ] Yes
- [ ] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2024-03-21 12:13:34 -04:00
ionitron
e375508647 chore(): add updated snapshots 2024-03-21 04:45:01 +00:00
Sean Perkins
6965205824 chore: use theme for rendering datetime 2024-03-20 21:11:01 -04:00
Sean Perkins
245a5c6f23 Merge remote-tracking branch 'origin/feature-8.0' into sp/sync-next-with-v8 2024-03-20 21:05:35 -04:00
Sean Perkins
284eb8ecaf feat: add ionic theme architecture (#29132)
Issue number: Internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

Adds the base architecture to add a new theme configuration to Ionic
Framework components.
- Components can now specify an additional stylesheet for the `ionic`
theme.
- Developers can specify the `theme` and `mode` independently to control
look and feel of a component.

Test infrastructure has been updated to add support for testing the
theme configuration with Playwright.
- Existing `themes` test configuration has been renamed to `palettes`

This PR is just the initial effort to decouple Ionic's architecture to
separate look and feel and allow our dev team to start introducing the
new component appearance to the UI. There will be additional changes
required to completely add support for the Ionic theme. These changes
are targeted against the `next` branch and are not expected to be used
in a production environment at this time.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

---------

Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
2024-03-18 15:45:01 -04:00
Sean Perkins
76b48a6c77 Merge remote-tracking branch 'origin/feature-8.0' into next 2024-03-14 10:34:28 -04:00
Sean Perkins
668ab98f0e Merge remote-tracking branch 'origin/feature-8.0' into next 2024-03-09 15:48:50 -05:00
1410 changed files with 21863 additions and 4727 deletions

View File

@@ -29,4 +29,4 @@ runs:
with:
name: ionic-core
output: core/CoreBuild.zip
paths: core/dist core/components core/css core/hydrate core/loader core/src/components.d.ts
paths: core/dist core/components core/src/foundations core/css core/hydrate core/loader core/src/components.d.ts

View File

@@ -31,4 +31,4 @@ runs:
with:
name: ionic-core
output: core/CoreBuild.zip
paths: core/dist core/components core/css core/hydrate core/loader core/src/components.d.ts core/api.txt
paths: core/dist core/components core/src/foundations core/css core/hydrate core/loader core/src/components.d.ts core/api.txt

View File

@@ -4,290 +4,31 @@ This is a comprehensive list of the breaking changes introduced in the major ver
## Versions
- [Version 8.x](#version-8x)
- [Version 9.x](#version-9x)
- [Version 8.x](./BREAKING_ARCHIVE/v8.md)
- [Version 7.x](./BREAKING_ARCHIVE/v7.md)
- [Version 6.x](./BREAKING_ARCHIVE/v6.md)
- [Version 5.x](./BREAKING_ARCHIVE/v5.md)
- [Version 4.x](./BREAKING_ARCHIVE/v4.md)
- [Legacy](https://github.com/ionic-team/ionic-v3/blob/master/CHANGELOG.md)
## Version 8.x
## Version 9.x
- [Browser and Platform Support](#version-8x-browser-platform-support)
- [Dark Mode](#version-8x-dark-mode)
- [Global Styles](#version-8x-global-styles)
- [Haptics](#version-8x-haptics)
- [Components](#version-8x-components)
- [Button](#version-8x-button)
- [Checkbox](#version-8x-checkbox)
- [Content](#version-8x-content)
- [Datetime](#version-8x-datetime)
- [Input](#version-8x-input)
- [Item](#version-8x-item)
- [Modal](#version-8x-modal)
- [Nav](#version-8x-nav)
- [Picker](#version-8x-picker)
- [Progress bar](#version-8x-progress-bar)
- [Radio](#version-8x-radio)
- [Range](#version-8x-range)
- [Searchbar](#version-8x-searchbar)
- [Select](#version-8x-select)
- [Textarea](#version-8x-textarea)
- [Toggle](#version-8x-toggle)
- [Framework Specific](#version-8x-framework-specific)
- [Angular](#version-8x-angular)
- [Components](#version-9x-components)
- [Button](#version-9x-button)
- [Card](#version-9x-card)
- [Chip](#version-9x-chip)
<h2 id="version-8x-browser-platform-support">Browser and Platform Support</h2>
<h2 id="version-9x-components">Components</h2>
This section details the desktop browser, JavaScript framework, and mobile platform versions that are supported by Ionic 8.
<h4 id="version-9x-button">Button</h4>
**Minimum Browser Versions**
| Desktop Browser | Supported Versions |
| --------------- | ----------------- |
| Chrome | 89+ |
| Safari | 15+ |
| Firefox | 75+ |
| Edge | 89+ |
- The `border-radius` of the `ios` and `md` button now defaults to `6px` and `999px` instead of `14px` and `4px`, respectively, in accordance with the iOS and Material Design 3 guidelines. To revert to the previous appearance, set the `shape` to `"soft"` for `md` and override the `--border-radius` CSS variable for `ios` to `14px`, or set it to a different value entirely.
**Minimum JavaScript Framework Versions**
| Framework | Supported Version |
| --------- | --------------------- |
| Angular | 16+ |
| React | 17+ |
| Vue | 3.0.6+ |
<h4 id="version-9x-card">Card</h4>
**Minimum Mobile Platform Versions**
| Platform | Supported Version |
| -------- | ---------------------- |
| iOS | 15+ |
| Android | 5.1+ with Chromium 89+ |
- The `border-radius` of the `ios` and `md` card now defaults to `14px` and `12px` instead of `8px` and `4px`, respectively, in accordance with the iOS and Material Design 3 guidelines. To revert to the previous appearance, set the `shape` to `"soft"`, or override the `--border-radius` CSS variable to specify a different value.
Ionic Framework v8 removes backwards support for CSS Animations in favor of the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API). All minimum browser versions listed above support the Web Animations API.
<h4 id="version-9x-chip">Chip</h4>
<h2 id="version-8x-dark-mode">Dark Mode</h2>
In previous versions, it was recommended to define the dark palette in the following way:
```css
@media (prefers-color-scheme: dark) {
body {
/* global app variables */
}
.ios body {
/* global ios app variables */
}
.md body {
/* global md app variables */
}
}
```
In Ionic Framework version 8, the dark palette is being distributed via css files that can be imported. Below is an example of importing a dark palette file in Angular:
```css
/* @import '@ionic/angular/css/palettes/dark.always.css'; */
/* @import "@ionic/angular/css/palettes/dark.class.css"; */
@import "@ionic/angular/css/palettes/dark.system.css";
```
By importing the `dark.system.css` file, the dark palette variables will be defined like the following:
```css
@media (prefers-color-scheme: dark) {
:root {
/* global app variables */
}
:root.ios {
/* global ios app variables */
}
:root.md {
/* global md app variables */
}
}
```
Notice that the dark palette is now applied to the `:root` selector instead of the `body` selector. The [`:root`](https://developer.mozilla.org/en-US/docs/Web/CSS/:root) selector represents the `<html>` element and is identical to the selector `html`, except that its specificity is higher.
While migrating to include the new dark palette files is unlikely to cause breaking changes, these new selectors can lead to unexpected overrides if custom CSS variables are being set on the `body` element. We recommend updating any instances where global application variables are set to target the `:root` selector instead.
For more information on the new dark palette files, refer to the [Dark Mode documentation](https://ionicframework.com/docs/theming/dark-mode).
<h2 id="version-8x-global-styles">Global Styles</h2>
<h4 id="version-8x-text-color">Text Color</h4>
The `core.css` file has been updated to set the text color on the `body` element:
```diff
body {
+ color: var(--ion-text-color);
}
```
This allows components to inherit the color properly when used outside of Ionic Framework and is required for custom themes to work properly. However, it may have unintentional side effects in apps if the color was not expected to inherit.
<h4 id="version-8x-dynamic-font">Dynamic Font</h4>
The `core.css` file has been updated to enable dynamic font scaling by default.
The `--ion-default-dynamic-font` variable has been removed and replaced with `--ion-dynamic-font`.
Developers who had previously chosen dynamic font scaling by activating it in their global stylesheets can revert to the default setting by removing their custom CSS. In doing so, their application will seamlessly continue utilizing dynamic font scaling as it did before. It's essential to note that altering the font-size of the html element should be avoided, as it may disrupt the proper functioning of dynamic font scaling.
Developers who want to disable dynamic font scaling can set `--ion-dynamic-font: initial;` in their global stylesheets. However, this is not recommended because it may introduce accessibility challenges for users who depend on enlarged font sizes.
For more information on the dynamic font, refer to the [Dynamic Font Scaling documentation](https://ionicframework.com/docs/layout/dynamic-font-scaling).
<h2 id="version-8x-haptics">Haptics</h2>
- Support for the Cordova Haptics plugin has been removed. Components that integrate with haptics, such as `ion-picker` and `ion-toggle`, will continue to function but will no longer play haptics in Cordova environments. Developers should migrate to Capacitor to continue to have haptics in these components.
<h2 id="version-8x-components">Components</h2>
<h4 id="version-8x-button">Button</h4>
- Button text now wraps by default. If this behavior is not desired, add the `ion-text-nowrap` class from the [CSS Utilities](https://ionicframework.com/docs/layout/css-utilities).
<h4 id="version-8x-checkbox">Checkbox</h4>
The `legacy` property and support for the legacy syntax, which involved placing an `ion-checkbox` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy checkbox syntax, refer to the [Checkbox documentation](https://ionicframework.com/docs/api/checkbox#migrating-from-legacy-checkbox-syntax).
<h4 id="version-8x-content">Content</h4>
- Content no longer sets the `--background` custom property when the `.outer-content` class is set on the host.
<h4 id="version-8x-datetime">Datetime</h4>
- The CSS shadow part for `month-year-button` has been changed to target a `button` element instead of `ion-item`. Developers should verify their UI renders as expected for the month/year toggle button inside of `ion-datetime`.
- Developers using the CSS variables available on `ion-item` will need to migrate their CSS to use CSS properties. For example:
```diff
ion-datetime::part(month-year-button) {
- --background: red;
+ background: red;
}
```
<h4 id="version-8x-input">Input</h4>
- `size` has been removed from the `ion-input` component. Developers should use CSS to specify the visible width of the input.
- `accept` has been removed from the `ion-input` component. This was previously used in conjunction with the `type="file"`. However, the `file` value for `type` is not a valid value in Ionic Framework.
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-input` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy input syntax, refer to the [Input documentation](https://ionicframework.com/docs/api/input#migrating-from-legacy-input-syntax).
<h4 id="version-8x-item">Item</h4>
- The `helper` slot has been removed. Developers should use the `helperText` property on `ion-input` and `ion-textarea`.
- The `error` slot has been removed. Developers should use the `errorText` property on `ion-input` and `ion-textarea`.
- Counter functionality has been removed including the `counter` and `counterFormatter` properties. Developers should use the properties of the same name on `ion-input` and `ion-textarea`.
- The `fill` property has been removed. Developers should use the property of the same name on `ion-input`, `ion-select`, and `ion-textarea`.
- The `shape` property has been removed. Developers should use the property of the same name on `ion-input`, `ion-select`, and `ion-textarea`.
- Item no longer automatically delegates focus to the first focusable element. While most developers should not need to make any changes to account for this update, usages of `ion-item` with interactive elements such as form controls (inputs, textareas, etc) should be evaluated to verify that interactions still work as expected.
<h5>CSS variables</h4>
The following deprecated CSS variables have been removed: `--highlight-height`, `--highlight-color-focused`, `--highlight-color-valid`, and `--highlight-color-invalid`. These variables were used on the bottom border highlight of an item when the form control inside of that item was focused. The form control syntax was [simplified in v7](https://ionic.io/blog/ionic-7-is-here#simplified-form-control-syntax) so that inputs, selects, and textareas would no longer be required to be used inside of an item.
If you have not yet migrated to the modern form control syntax, migration guides for each of the form controls that added a highlight to item can be found below:
- [Input migration documentation](https://ionicframework.com/docs/api/input#migrating-from-legacy-input-syntax)
- [Select migration documentation](https://ionicframework.com/docs/api/select#migrating-from-legacy-select-syntax)
- [Textarea migration documentation](https://ionicframework.com/docs/api/textarea#migrating-from-legacy-textarea-syntax)
Once all form controls are using the modern syntax, the same variables can be used to customize them from the form control itself:
| Name | Description |
| ----------------------------| ----------------------------------------|
| `--highlight-color-focused` | The color of the highlight when focused |
| `--highlight-color-invalid` | The color of the highlight when invalid |
| `--highlight-color-valid` | The color of the highlight when valid |
| `--highlight-height` | The height of the highlight indicator |
The following styles for item:
```css
ion-item {
--highlight-color-focused: purple;
--highlight-color-valid: blue;
--highlight-color-invalid: orange;
--highlight-height: 6px;
}
```
will instead be applied on the form controls:
```css
ion-input,
ion-textarea,
ion-select {
--highlight-color-focused: purple;
--highlight-color-valid: blue;
--highlight-color-invalid: orange;
--highlight-height: 6px;
}
```
> [!NOTE]
> The input and textarea components are scoped, which means they will automatically scope their CSS by appending each of the styles with an additional class at runtime. Overriding scoped selectors in CSS requires a [higher specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) selector. Targeting the `ion-input` or `ion-textarea` for customization will not work; therefore we recommend adding a class and customizing it that way.
<h4 id="version-8x-modal">Modal</h4>
- Detection for Capacitor <= 2 with applying status bar styles has been removed. Developers should ensure they are using Capacitor 3 or later when using the card modal presentation.
<h4 id="version-8x-nav">Nav</h4>
- `getLength` returns `Promise<number>` instead of `<number>`. This method was not previously available in Nav's TypeScript interface, but developers could still access it by casting Nav as `any`. Developers should ensure they `await` their `getLength` call before accessing the returned value.
<h4 id="version-8x-picker">Picker</h4>
- `ion-picker` and `ion-picker-column` have been renamed to `ion-picker-legacy` and `ion-picker-legacy-column`, respectively. This change was made to accommodate the new inline picker component while allowing developers to continue to use the legacy picker during this migration period.
- Only the component names have been changed. Usages such as `ion-picker` or `IonPicker` should be changed to `ion-picker-legacy` and `IonPickerLegacy`, respectively.
- Non-component usages such as `pickerController` or `useIonPicker` remain unchanged. The new picker displays inline with your page content and does not have equivalents for these non-component usages.
<h4 id="version-8x-progress-bar">Progress bar</h4>
- The `--buffer-background` CSS variable has been removed. Use `--background` instead.
<h4 id="version-8x-toast">Toast</h4>
- `cssClass` has been removed from the `ToastButton` interface. This was previously used to apply a custom class to the toast buttons. Developers can use the "button" shadow part to style the buttons.
For more information on styling toast buttons, refer to the [Toast Theming documentation](https://ionicframework.com/docs/api/toast#theming).
<h4 id="version-8x-radio">Radio</h4>
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-radio` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy radio syntax, refer to the [Radio documentation](https://ionicframework.com/docs/api/radio#migrating-from-legacy-radio-syntax).
<h4 id="version-8x-range">Range</h4>
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-range` inside of an `ion-item` with an `ion-label`, have been removed. Ionic will also no longer attempt to automatically associate form controls with sibling `<label>` elements as these label elements are now used inside the form control. Developers should provide a label (either visible text or `aria-label`) directly to the form control. For more information on migrating from the legacy range syntax, refer to the [Range documentation](https://ionicframework.com/docs/api/range#migrating-from-legacy-range-syntax).
<h4 id="version-8x-searchbar">Searchbar</h4>
- The `autocapitalize` property now defaults to `'off'`.
<h4 id="version-8x-select">Select</h4>
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-select` inside of an `ion-item` with an `ion-label`, have been removed. Ionic will also no longer attempt to automatically associate form controls with sibling `<label>` elements as these label elements are now used inside the form control. Developers should provide a label (either visible text or `aria-label`) directly to the form control. For more information on migrating from the legacy select syntax, refer to the [Select documentation](https://ionicframework.com/docs/api/select#migrating-from-legacy-select-syntax).
<h4 id="version-8x-textarea">Textarea</h4>
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-textarea` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy textarea syntax, refer to the [Textarea documentation](https://ionicframework.com/docs/api/textarea#migrating-from-legacy-textarea-syntax).
<h4 id="version-8x-toggle">Toggle</h4>
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-toggle` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy toggle syntax, refer to the [Toggle documentation](https://ionicframework.com/docs/api/toggle#migrating-from-legacy-toggle-syntax).
<h2 id="version-8x-framework-specific">Framework Specific</h2>
<h4 id="version-8x-angular">Angular</h4>
- The `IonBackButtonDelegate` class has been removed in favor of `IonBackButton`.
```diff
- import { IonBackButtonDelegate } from '@ionic/angular';
+ import { IonBackButton } from '@ionic/angular';
```
- The `border-radius` of the `ios` and `md` chip now defaults to `10px` and `8px`, respectively, instead of `16px` in accordance with the iOS and Material Design 3 guidelines. To revert to the previous appearance, set the `shape` to `"round"`, or override the `--border-radius` CSS variable to specify a different value.

282
BREAKING_ARCHIVE/v8.md Normal file
View File

@@ -0,0 +1,282 @@
# Breaking Changes
## Version 8.x
- [Browser and Platform Support](#version-8x-browser-platform-support)
- [Dark Mode](#version-8x-dark-mode)
- [Global Styles](#version-8x-global-styles)
- [Haptics](#version-8x-haptics)
- [Components](#version-8x-components)
- [Button](#version-8x-button)
- [Checkbox](#version-8x-checkbox)
- [Content](#version-8x-content)
- [Datetime](#version-8x-datetime)
- [Input](#version-8x-input)
- [Item](#version-8x-item)
- [Modal](#version-8x-modal)
- [Nav](#version-8x-nav)
- [Picker](#version-8x-picker)
- [Progress bar](#version-8x-progress-bar)
- [Radio](#version-8x-radio)
- [Range](#version-8x-range)
- [Searchbar](#version-8x-searchbar)
- [Select](#version-8x-select)
- [Textarea](#version-8x-textarea)
- [Toggle](#version-8x-toggle)
- [Framework Specific](#version-8x-framework-specific)
- [Angular](#version-8x-angular)
<h2 id="version-8x-browser-platform-support">Browser and Platform Support</h2>
This section details the desktop browser, JavaScript framework, and mobile platform versions that are supported by Ionic 8.
**Minimum Browser Versions**
| Desktop Browser | Supported Versions |
| --------------- | ----------------- |
| Chrome | 89+ |
| Safari | 15+ |
| Firefox | 75+ |
| Edge | 89+ |
**Minimum JavaScript Framework Versions**
| Framework | Supported Version |
| --------- | --------------------- |
| Angular | 16+ |
| React | 17+ |
| Vue | 3.0.6+ |
**Minimum Mobile Platform Versions**
| Platform | Supported Version |
| -------- | ---------------------- |
| iOS | 15+ |
| Android | 5.1+ with Chromium 89+ |
Ionic Framework v8 removes backwards support for CSS Animations in favor of the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API). All minimum browser versions listed above support the Web Animations API.
<h2 id="version-8x-dark-mode">Dark Mode</h2>
In previous versions, it was recommended to define the dark palette in the following way:
```css
@media (prefers-color-scheme: dark) {
body {
/* global app variables */
}
.ios body {
/* global ios app variables */
}
.md body {
/* global md app variables */
}
}
```
In Ionic Framework version 8, the dark palette is being distributed via css files that can be imported. Below is an example of importing a dark palette file in Angular:
```css
/* @import '@ionic/angular/css/palettes/dark.always.css'; */
/* @import "@ionic/angular/css/palettes/dark.class.css"; */
@import "@ionic/angular/css/palettes/dark.system.css";
```
By importing the `dark.system.css` file, the dark palette variables will be defined like the following:
```css
@media (prefers-color-scheme: dark) {
:root {
/* global app variables */
}
:root.ios {
/* global ios app variables */
}
:root.md {
/* global md app variables */
}
}
```
Notice that the dark palette is now applied to the `:root` selector instead of the `body` selector. The [`:root`](https://developer.mozilla.org/en-US/docs/Web/CSS/:root) selector represents the `<html>` element and is identical to the selector `html`, except that its specificity is higher.
While migrating to include the new dark palette files is unlikely to cause breaking changes, these new selectors can lead to unexpected overrides if custom CSS variables are being set on the `body` element. We recommend updating any instances where global application variables are set to target the `:root` selector instead.
For more information on the new dark palette files, refer to the [Dark Mode documentation](https://ionicframework.com/docs/theming/dark-mode).
<h2 id="version-8x-global-styles">Global Styles</h2>
<h4 id="version-8x-text-color">Text Color</h4>
The `core.css` file has been updated to set the text color on the `body` element:
```diff
body {
+ color: var(--ion-text-color);
}
```
This allows components to inherit the color properly when used outside of Ionic Framework and is required for custom themes to work properly. However, it may have unintentional side effects in apps if the color was not expected to inherit.
<h4 id="version-8x-dynamic-font">Dynamic Font</h4>
The `core.css` file has been updated to enable dynamic font scaling by default.
The `--ion-default-dynamic-font` variable has been removed and replaced with `--ion-dynamic-font`.
Developers who had previously chosen dynamic font scaling by activating it in their global stylesheets can revert to the default setting by removing their custom CSS. In doing so, their application will seamlessly continue utilizing dynamic font scaling as it did before. It's essential to note that altering the font-size of the html element should be avoided, as it may disrupt the proper functioning of dynamic font scaling.
Developers who want to disable dynamic font scaling can set `--ion-dynamic-font: initial;` in their global stylesheets. However, this is not recommended because it may introduce accessibility challenges for users who depend on enlarged font sizes.
For more information on the dynamic font, refer to the [Dynamic Font Scaling documentation](https://ionicframework.com/docs/layout/dynamic-font-scaling).
<h2 id="version-8x-haptics">Haptics</h2>
- Support for the Cordova Haptics plugin has been removed. Components that integrate with haptics, such as `ion-picker` and `ion-toggle`, will continue to function but will no longer play haptics in Cordova environments. Developers should migrate to Capacitor to continue to have haptics in these components.
<h2 id="version-8x-components">Components</h2>
<h4 id="version-8x-button">Button</h4>
- Button text now wraps by default. If this behavior is not desired, add the `ion-text-nowrap` class from the [CSS Utilities](https://ionicframework.com/docs/layout/css-utilities).
<h4 id="version-8x-checkbox">Checkbox</h4>
The `legacy` property and support for the legacy syntax, which involved placing an `ion-checkbox` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy checkbox syntax, refer to the [Checkbox documentation](https://ionicframework.com/docs/api/checkbox#migrating-from-legacy-checkbox-syntax).
<h4 id="version-8x-content">Content</h4>
- Content no longer sets the `--background` custom property when the `.outer-content` class is set on the host.
<h4 id="version-8x-datetime">Datetime</h4>
- The CSS shadow part for `month-year-button` has been changed to target a `button` element instead of `ion-item`. Developers should verify their UI renders as expected for the month/year toggle button inside of `ion-datetime`.
- Developers using the CSS variables available on `ion-item` will need to migrate their CSS to use CSS properties. For example:
```diff
ion-datetime::part(month-year-button) {
- --background: red;
+ background: red;
}
```
<h4 id="version-8x-input">Input</h4>
- `size` has been removed from the `ion-input` component. Developers should use CSS to specify the visible width of the input.
- `accept` has been removed from the `ion-input` component. This was previously used in conjunction with the `type="file"`. However, the `file` value for `type` is not a valid value in Ionic Framework.
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-input` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy input syntax, refer to the [Input documentation](https://ionicframework.com/docs/api/input#migrating-from-legacy-input-syntax).
<h4 id="version-8x-item">Item</h4>
- The `helper` slot has been removed. Developers should use the `helperText` property on `ion-input` and `ion-textarea`.
- The `error` slot has been removed. Developers should use the `errorText` property on `ion-input` and `ion-textarea`.
- Counter functionality has been removed including the `counter` and `counterFormatter` properties. Developers should use the properties of the same name on `ion-input` and `ion-textarea`.
- The `fill` property has been removed. Developers should use the property of the same name on `ion-input`, `ion-select`, and `ion-textarea`.
- The `shape` property has been removed. Developers should use the property of the same name on `ion-input`, `ion-select`, and `ion-textarea`.
- Item no longer automatically delegates focus to the first focusable element. While most developers should not need to make any changes to account for this update, usages of `ion-item` with interactive elements such as form controls (inputs, textareas, etc) should be evaluated to verify that interactions still work as expected.
<h5>CSS variables</h4>
The following deprecated CSS variables have been removed: `--highlight-height`, `--highlight-color-focused`, `--highlight-color-valid`, and `--highlight-color-invalid`. These variables were used on the bottom border highlight of an item when the form control inside of that item was focused. The form control syntax was [simplified in v7](https://ionic.io/blog/ionic-7-is-here#simplified-form-control-syntax) so that inputs, selects, and textareas would no longer be required to be used inside of an item.
If you have not yet migrated to the modern form control syntax, migration guides for each of the form controls that added a highlight to item can be found below:
- [Input migration documentation](https://ionicframework.com/docs/api/input#migrating-from-legacy-input-syntax)
- [Select migration documentation](https://ionicframework.com/docs/api/select#migrating-from-legacy-select-syntax)
- [Textarea migration documentation](https://ionicframework.com/docs/api/textarea#migrating-from-legacy-textarea-syntax)
Once all form controls are using the modern syntax, the same variables can be used to customize them from the form control itself:
| Name | Description |
| ----------------------------| ----------------------------------------|
| `--highlight-color-focused` | The color of the highlight when focused |
| `--highlight-color-invalid` | The color of the highlight when invalid |
| `--highlight-color-valid` | The color of the highlight when valid |
| `--highlight-height` | The height of the highlight indicator |
The following styles for item:
```css
ion-item {
--highlight-color-focused: purple;
--highlight-color-valid: blue;
--highlight-color-invalid: orange;
--highlight-height: 6px;
}
```
will instead be applied on the form controls:
```css
ion-input,
ion-textarea,
ion-select {
--highlight-color-focused: purple;
--highlight-color-valid: blue;
--highlight-color-invalid: orange;
--highlight-height: 6px;
}
```
> [!NOTE]
> The input and textarea components are scoped, which means they will automatically scope their CSS by appending each of the styles with an additional class at runtime. Overriding scoped selectors in CSS requires a [higher specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) selector. Targeting the `ion-input` or `ion-textarea` for customization will not work; therefore we recommend adding a class and customizing it that way.
<h4 id="version-8x-modal">Modal</h4>
- Detection for Capacitor <= 2 with applying status bar styles has been removed. Developers should ensure they are using Capacitor 3 or later when using the card modal presentation.
<h4 id="version-8x-nav">Nav</h4>
- `getLength` returns `Promise<number>` instead of `<number>`. This method was not previously available in Nav's TypeScript interface, but developers could still access it by casting Nav as `any`. Developers should ensure they `await` their `getLength` call before accessing the returned value.
<h4 id="version-8x-picker">Picker</h4>
- `ion-picker` and `ion-picker-column` have been renamed to `ion-picker-legacy` and `ion-picker-legacy-column`, respectively. This change was made to accommodate the new inline picker component while allowing developers to continue to use the legacy picker during this migration period.
- Only the component names have been changed. Usages such as `ion-picker` or `IonPicker` should be changed to `ion-picker-legacy` and `IonPickerLegacy`, respectively.
- Non-component usages such as `pickerController` or `useIonPicker` remain unchanged. The new picker displays inline with your page content and does not have equivalents for these non-component usages.
<h4 id="version-8x-progress-bar">Progress bar</h4>
- The `--buffer-background` CSS variable has been removed. Use `--background` instead.
<h4 id="version-8x-toast">Toast</h4>
- `cssClass` has been removed from the `ToastButton` interface. This was previously used to apply a custom class to the toast buttons. Developers can use the "button" shadow part to style the buttons.
For more information on styling toast buttons, refer to the [Toast Theming documentation](https://ionicframework.com/docs/api/toast#theming).
<h4 id="version-8x-radio">Radio</h4>
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-radio` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy radio syntax, refer to the [Radio documentation](https://ionicframework.com/docs/api/radio#migrating-from-legacy-radio-syntax).
<h4 id="version-8x-range">Range</h4>
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-range` inside of an `ion-item` with an `ion-label`, have been removed. Ionic will also no longer attempt to automatically associate form controls with sibling `<label>` elements as these label elements are now used inside the form control. Developers should provide a label (either visible text or `aria-label`) directly to the form control. For more information on migrating from the legacy range syntax, refer to the [Range documentation](https://ionicframework.com/docs/api/range#migrating-from-legacy-range-syntax).
<h4 id="version-8x-searchbar">Searchbar</h4>
- The `autocapitalize` property now defaults to `'off'`.
<h4 id="version-8x-select">Select</h4>
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-select` inside of an `ion-item` with an `ion-label`, have been removed. Ionic will also no longer attempt to automatically associate form controls with sibling `<label>` elements as these label elements are now used inside the form control. Developers should provide a label (either visible text or `aria-label`) directly to the form control. For more information on migrating from the legacy select syntax, refer to the [Select documentation](https://ionicframework.com/docs/api/select#migrating-from-legacy-select-syntax).
<h4 id="version-8x-textarea">Textarea</h4>
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-textarea` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy textarea syntax, refer to the [Textarea documentation](https://ionicframework.com/docs/api/textarea#migrating-from-legacy-textarea-syntax).
<h4 id="version-8x-toggle">Toggle</h4>
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-toggle` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy toggle syntax, refer to the [Toggle documentation](https://ionicframework.com/docs/api/toggle#migrating-from-legacy-toggle-syntax).
<h2 id="version-8x-framework-specific">Framework Specific</h2>
<h4 id="version-8x-angular">Angular</h4>
- The `IonBackButtonDelegate` class has been removed in favor of `IonBackButton`.
```diff
- import { IonBackButtonDelegate } from '@ionic/angular';
+ import { IonBackButton } from '@ionic/angular';
```

View File

@@ -3,16 +3,19 @@
# See documentation at https://stylelint.io/
ignoreFiles:
- src/foundations/*.scss
- src/css/ionic/*.scss
- src/css/core.scss
- src/css/flex-utils.scss
- src/css/normalize.scss
- src/css/text-alignment.scss
- src/css/display.scss
- src/themes/ionic.mixins.scss
- src/themes/ionic.functions.color.scss
- src/themes/ionic.functions.string.scss
- src/themes/ionic.theme.default.scss
- src/themes/mixins.scss
- src/themes/functions.color.scss
- src/themes/functions.string.scss
- src/themes/native.theme.default.scss
- src/css/themes/*.scss
- scripts/tokens/*.css
indentation: 2
@@ -23,10 +26,10 @@ rules:
at-rule-empty-line-before:
- always
- except:
- blockless-after-blockless
- first-nested
- blockless-after-blockless
- first-nested
ignore:
- after-comment
- after-comment
block-closing-brace-newline-before:
- always
@@ -40,14 +43,13 @@ rules:
custom-property-empty-line-before:
- always
- except:
- after-comment
- after-custom-property
- first-nested
- after-comment
- after-custom-property
- first-nested
declaration-no-important:
- true
order/order:
- custom-properties
- dollar-variables
@@ -57,203 +59,202 @@ rules:
# https://github.com/sasstools/sass-lint/blob/develop/lib/config/property-sort-orders/smacss.yml
order/properties-order:
# Box
- emptyLineBefore: always
properties:
- display
- position
- top
- right
- bottom
- left
- display
- position
- top
- right
- bottom
- left
- emptyLineBefore: always
properties:
- flex
- flex-basis
- flex-direction
- flex-flow
- flex-grow
- flex-shrink
- flex-wrap
- align-content
- align-items
- align-self
- justify-content
- order
- flex
- flex-basis
- flex-direction
- flex-flow
- flex-grow
- flex-shrink
- flex-wrap
- align-content
- align-items
- align-self
- justify-content
- order
- emptyLineBefore: always
properties:
- width
- min-width
- max-width
- width
- min-width
- max-width
- height
- min-height
- max-height
- height
- min-height
- max-height
- emptyLineBefore: always
properties:
- margin
- margin-top
- margin-right
- margin-bottom
- margin-left
- margin
- margin-top
- margin-right
- margin-bottom
- margin-left
- emptyLineBefore: always
properties:
- padding
- padding-top
- padding-right
- padding-bottom
- padding-left
- padding
- padding-top
- padding-right
- padding-bottom
- padding-left
- emptyLineBefore: always
properties:
- float
- clear
- float
- clear
- emptyLineBefore: always
properties:
- columns
- column-gap
- column-fill
- column-rule
- column-span
- column-count
- column-width
- columns
- column-gap
- column-fill
- column-rule
- column-span
- column-count
- column-width
- emptyLineBefore: always
properties:
- transform
- transform-box
- transform-origin
- transform-style
- transform
- transform-box
- transform-origin
- transform-style
- emptyLineBefore: always
properties:
- transition
- transition-delay
- transition-duration
- transition-property
- transition-timing-function
- transition
- transition-delay
- transition-duration
- transition-property
- transition-timing-function
# Border
- emptyLineBefore: always
properties:
- border
- border-top
- border-right
- border-bottom
- border-left
- border-width
- border-top-width
- border-right-width
- border-bottom-width
- border-left-width
- border
- border-top
- border-right
- border-bottom
- border-left
- border-width
- border-top-width
- border-right-width
- border-bottom-width
- border-left-width
- border-style
- border-top-style
- border-right-style
- border-bottom-style
- border-left-style
- border-style
- border-top-style
- border-right-style
- border-bottom-style
- border-left-style
- border-radius
- border-top-left-radius
- border-top-right-radius
- border-bottom-left-radius
- border-bottom-right-radius
- border-radius
- border-top-left-radius
- border-top-right-radius
- border-bottom-left-radius
- border-bottom-right-radius
- border-color
- border-top-color
- border-right-color
- border-bottom-color
- border-left-color
- border-color
- border-top-color
- border-right-color
- border-bottom-color
- border-left-color
- emptyLineBefore: always
properties:
- outline
- outline-color
- outline-offset
- outline-style
- outline-width
- outline
- outline-color
- outline-offset
- outline-style
- outline-width
# Background
- emptyLineBefore: always
properties:
- background
- background-attachment
- background-clip
- background-color
- background-image
- background-repeat
- background-position
- background-size
- background
- background-attachment
- background-clip
- background-color
- background-image
- background-repeat
- background-position
- background-size
# Text
# Text
- color
- color
- emptyLineBefore: always
properties:
- font
- font-family
- font-size
- font-smoothing
- font-style
- font-variant
- font-weight
- font
- font-family
- font-size
- font-smoothing
- font-style
- font-variant
- font-weight
- emptyLineBefore: always
properties:
- letter-spacing
- line-height
- list-style
- letter-spacing
- line-height
- list-style
- emptyLineBefore: always
properties:
- text-align
- text-decoration
- text-indent
- text-overflow
- text-rendering
- text-shadow
- text-transform
- text-wrap
- text-align
- text-decoration
- text-indent
- text-overflow
- text-rendering
- text-shadow
- text-transform
- text-wrap
- emptyLineBefore: always
properties:
- white-space
- word-spacing
- white-space
- word-spacing
# Other
- emptyLineBefore: always
properties:
- border-collapse
- border-spacing
- box-shadow
- caption-side
- contain
- content
- cursor
- direction
- empty-cells
- object-fit
- opacity
- overflow
- quotes
- speak
- table-layout
- touch-action
- user-select
- vertical-align
- visibility
- z-index
- border-collapse
- border-spacing
- box-shadow
- caption-side
- contain
- content
- cursor
- direction
- empty-cells
- object-fit
- opacity
- overflow
- quotes
- speak
- table-layout
- touch-action
- user-select
- vertical-align
- visibility
- z-index
property-disallowed-list:
- background-position

View File

File diff suppressed because it is too large Load Diff

1709
core/package-lock.json generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -64,18 +64,20 @@
"fs-extra": "^9.0.1",
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"prettier": "^2.6.1",
"prettier": "^2.8.8",
"rollup": "^2.26.4",
"sass": "^1.33.0",
"serve": "^14.0.1",
"style-dictionary": "^3.9.2",
"stylelint": "^13.13.1",
"stylelint-order": "^4.1.0"
},
"scripts": {
"build": "npm run clean && npm run build.css && stencil build --es5 --docs-json dist/docs.json",
"build": "npm run clean && npm run build.tokens && npm run build.css && stencil build --es5 --docs-json dist/docs.json",
"build.css": "npm run css.sass && npm run css.minify",
"build.debug": "npm run clean && stencil build --debug",
"build.docs.json": "stencil build --docs-json dist/docs.json",
"build.tokens": "node ./scripts/tokens/index.js && npm run lint.fix && npm run prettier.tokens",
"clean": "node scripts/clean.js",
"css.minify": "cleancss -O2 -o ./css/ionic.bundle.css ./css/ionic.bundle.css",
"css.sass": "sass --embed-sources --style compressed src/css:./css",
@@ -87,7 +89,8 @@
"lint.ts": "npm run eslint",
"lint.ts.fix": "npm run eslint -- --fix",
"prerender.e2e": "node scripts/testing/prerender.js",
"prettier": "prettier \"./src/**/*.{html,ts,tsx,js,jsx}\"",
"prettier": "prettier \"./src/**/*.{html,ts,tsx,js,jsx,scss}\"",
"prettier.tokens": "prettier \"./src/foundations/*.{scss, html}\" --write --cache",
"start": "npm run build.css && stencil build --dev --watch --serve",
"test": "npm run test.spec && npm run test.e2e",
"test.spec": "stencil test --spec --max-workers=2",

View File

@@ -0,0 +1,362 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// For generating Design Tokens, we use Style Dictionary for several reasons:
// - It's prepared to easily generate tokens for multiple types of outputs (CSS, SCSS, iOS, Android, documentation, etc.).
// - It also works very well out of the box with any kind of Design Tokens formats, like Figma Tokens, as well as APIs to adjust to more custom ones.
// - It is probably the most well-known and widely used Design Tokens tool. It has also been regularly maintained for a long time.
// - It can easily scale to different necessities we might have in the future.
const fs = require('fs');
const path = require('path');
const StyleDictionary = require('style-dictionary');
const targetPath = './src/foundations/';
const {
variablesPrefix,
getRgbaValue,
hexToRgb,
generateShadowValue,
generateFontFamilyValue,
generateTypographyValue,
generateRgbValue,
generateColorUtilityClasses,
generateFontUtilityClass,
generateSpaceUtilityClasses,
generateTypographyUtilityClass,
} = require('./utilities');
const { fileHeader } = StyleDictionary.formatHelpers;
// CSS vanilla :root format
StyleDictionary.registerFormat({
name: 'rootFormat',
formatter({ dictionary, file }) {
/*
* This will loop through all tokens and based on the type it will
* call a utility function that will return the expected format for the CSS Variable
*/
const prefixedVariables = dictionary.allProperties
.filter((prop) => prop['$type'] !== 'typography')
.map((prop) => {
if (prop.attributes.category.startsWith('Elevation')) {
const cssShadow = prop.value.map(generateShadowValue).join(', ');
return `--${variablesPrefix}-${prop.name}: ${cssShadow};`;
} else if (prop.attributes.category.match('font-family')) {
return generateFontFamilyValue(prop);
} else {
const rgb = hexToRgb(prop.value);
prop.value = getRgbaValue(prop.value);
return ` --${variablesPrefix}-${prop.name}: ${prop.value};${
rgb ? `\n --${variablesPrefix}-${prop.name}-rgb: ${rgb.r}, ${rgb.g}, ${rgb.b};` : ``
}`;
}
});
return fileHeader({ file }) + ':root {\n' + prefixedVariables.join('\n') + '\n}\n';
},
});
// SCSS variables format
StyleDictionary.registerFormat({
name: 'scssVariablesFormat',
formatter({ dictionary, file }) {
const typographyProperties = dictionary.allProperties.filter((prop) => prop['$type'] === 'typography');
const otherProperties = dictionary.allProperties.filter((prop) => prop['$type'] !== 'typography');
// Make sure the reused scss variables are defined first, to avoid compilation errors
const sortedProperties = [...otherProperties, ...typographyProperties];
const prefixedVariables = sortedProperties.map((prop) => {
if (prop.attributes.category.startsWith('Elevation')) {
const cssShadow = prop.value.map(generateShadowValue).join(', ');
return `$${variablesPrefix}-${prop.name}: var(--${variablesPrefix}-${prop.name}, ${cssShadow});`;
} else if (prop.attributes.category.match('font-family')) {
return generateFontFamilyValue(prop, 'scss');
} else if (prop['$type'] === 'typography') {
return generateTypographyValue(prop, dictionary);
} else {
return generateRgbValue(prop);
}
});
return fileHeader({ file }) + prefixedVariables.join('\n') + '\n';
},
});
// Create utility-classes
StyleDictionary.registerFormat({
name: 'cssUtilityClassesFormat',
formatter({ dictionary, file }) {
const utilityClasses = dictionary.allProperties.map((prop) => {
let tokenType = prop.attributes.category;
const className = `${prop.name}`;
let utilityClass = '';
if (tokenType.startsWith('Elevation')) {
return `.${variablesPrefix}-${className} {\n box-shadow: $ionic-${prop.name};\n}`;
} else if (prop['$type'] === 'typography') {
return generateTypographyUtilityClass(prop, dictionary);
/*
* Not creating for the tokens below, as they make no sense to exist as utility-classes.
* Font-family should be defined on global scope, not component.
* Scale its an abstract token group, to be used by other tokens, like the space ones.
*/
} else if (prop.attributes.category.match('font-family') || tokenType === 'scale') {
return;
}
const tokenTypeLower = tokenType.toLowerCase();
switch (tokenTypeLower) {
case 'color':
case 'state':
case 'guidelines':
case 'disabled':
case 'hover':
case 'pressed':
utilityClass = generateColorUtilityClasses(prop, className);
break;
case 'border-size':
utilityClass = `.${variablesPrefix}-${className} {\n border-width: $ionic-${prop.name};\n}`;
break;
case 'font':
utilityClass = generateFontUtilityClass(prop, className);
break;
case 'space':
utilityClass = generateSpaceUtilityClasses(prop, className);
break;
default:
utilityClass = `.${variablesPrefix}-${className} {\n ${tokenType}: $ionic-${prop.name};\n}`;
}
return utilityClass;
});
return [
fileHeader({ file }),
'@import "./ionic.vars";\n@import "../themes/mixins";\n',
utilityClasses.join('\n'),
].join('\n');
},
});
// Register the custom format to generate HTML
// Load the HTML template
const template = fs.readFileSync(path.join(__dirname, 'preview.template.html'), 'utf8');
StyleDictionary.registerFormat({
name: 'html/tokens',
formatter: function ({ dictionary }) {
// Function to extract numerical value from token name
const extractValue = (tokenName) => {
const match = tokenName.match(/-([0-9]+)/);
return match ? parseInt(match[1], 10) : Number.MAX_SAFE_INTEGER;
};
let colorTokens = `
<table>
<thead>
<tr>
<th>Color</th>
<th>Hex</th>
<th>Token Name</th>
</tr>
</thead>
<tbody>
`;
let fontSizeTokens = '';
let boxShadowTokens = '';
let borderSizeTokens = '';
let borderRadiusTokens = '';
let borderStyleTokens = '';
let fontWeightTokens = '';
let letterSpacingTokens = '';
let spaceTokens = '';
// Collect border-radius and space tokens for separate sorting
let borderRadiusTokenList = [];
let spaceTokenList = [];
dictionary.allProperties.forEach((token) => {
if (token.attributes.category === 'color') {
colorTokens += `
<tr>
<td><div class="color-swatch" style="background-color: ${token.value};"></div></td>
<td>${token.value}</td>
<td>${token.name}</td>
</tr>
`;
} else if (token.attributes.category === 'font-size') {
fontSizeTokens += `
<div class="font-size-token" style="font-size: ${token.value};">
${token.name} (${token.value})
</div>
`;
} else if (token.attributes.category.startsWith('Elevation')) {
const cssShadow = token.value.map(generateShadowValue).join(', ');
boxShadowTokens += `
<div class="shadow-token" style="box-shadow: ${cssShadow};">
${token.name}
</div>
`;
} else if (token.attributes.category === 'border-size' || token.attributes.category === 'border-width') {
borderSizeTokens += `
<div class="border-token" style="border-width: ${token.value};">
${token.name} (${token.value})
</div>
`;
} else if (token.attributes.category === 'border-radius') {
borderRadiusTokenList.push(token); // Collect border-radius tokens
} else if (token.attributes.category === 'border-style') {
borderStyleTokens += `
<div class="border-token" style="border: 1px ${token.value} #000;">
${token.name} (${token.value})
</div>
`;
} else if (token.attributes.category === 'font-weight') {
fontWeightTokens += `
<div class="weight-token" style="font-weight: ${token.value};">
${token.name} (${token.value})
</div>
`;
} else if (token.attributes.category === 'letter-spacing') {
// Convert % to px
const letterSpacingValue = token.value.replace('%', '') + 'px';
letterSpacingTokens += `
<div class="letter-spacing-token" style="letter-spacing: ${letterSpacingValue};">
${token.name} (${letterSpacingValue})
</div>
`;
} else if (token.attributes.category === 'space') {
spaceTokenList.push(token); // Collect space tokens
}
});
// Sort border-radius and space tokens
borderRadiusTokenList.sort((a, b) => extractValue(a.name) - extractValue(b.name));
spaceTokenList.sort((a, b) => extractValue(a.name) - extractValue(b.name));
// Generate HTML for sorted border-radius tokens
borderRadiusTokenList.forEach((token) => {
borderRadiusTokens += `
<div class="border-token" style="border-radius: ${token.value};">
${token.name} (${token.value})
</div>
`;
});
// Generate HTML for sorted space tokens
spaceTokenList.forEach((token) => {
spaceTokens += `
<div class="spacing-wrapper">
<div class="space-token" style="margin: ${token.value};">
${token.name} (${token.value})
</div>
</div>
`;
});
colorTokens += '</tbody></table>';
return template
.replace('{{colorTokens}}', colorTokens)
.replace('{{fontSizeTokens}}', fontSizeTokens)
.replace('{{boxShadowTokens}}', boxShadowTokens)
.replace('{{borderSizeTokens}}', borderSizeTokens)
.replace('{{borderRadiusTokens}}', borderRadiusTokens)
.replace('{{borderStyleTokens}}', borderStyleTokens)
.replace('{{fontWeightTokens}}', fontWeightTokens)
.replace('{{letterSpacingTokens}}', letterSpacingTokens)
.replace('{{spaceTokens}}', spaceTokens);
},
});
// Custom transform to ensure unique token names
StyleDictionary.registerTransform({
name: 'name/cti/kebab-unique',
type: 'name',
transformer: function (prop, options) {
return [options.prefix].concat(prop.path).join('-').toLowerCase();
},
});
// Register the custom transform group for html file generation
StyleDictionary.registerTransformGroup({
name: 'custom',
transforms: ['attribute/cti', 'name/cti/kebab-unique', 'size/rem', 'color/css'],
});
// Make Style Dictionary comply with the $ format on properties from W3C Guidelines
const w3cTokenJsonParser = {
pattern: /\.json|\.tokens\.json|\.tokens$/,
parse({ contents }) {
// replace $value with value so that style dictionary recognizes it
var preparedContent = (contents || '{}')
.replace(/"\$?value":/g, '"value":')
// convert $description to comment
.replace(/"\$?description":/g, '"comment":');
//
return JSON.parse(preparedContent);
},
};
StyleDictionary.registerParser(w3cTokenJsonParser);
// Generate Tokens
StyleDictionary.extend({
source: ['./src/foundations/tokens/*.json', './src/foundations/tokens/theme/*.json'],
platforms: {
css: {
buildPath: targetPath,
transformGroup: 'css',
files: [
{
destination: 'ionic.root.scss',
format: 'rootFormat',
options: {
outputReferences: true,
fileHeader: `myFileHeader`,
},
},
],
},
scss: {
buildPath: targetPath,
transformGroup: 'scss',
files: [
{
destination: 'ionic.vars.scss',
format: 'scssVariablesFormat',
options: {
outputReferences: true,
fileHeader: `myFileHeader`,
},
},
{
destination: 'ionic.utility.scss',
format: 'cssUtilityClassesFormat',
options: {
outputReferences: true,
fileHeader: `myFileHeader`,
},
},
],
},
html: {
transformGroup: 'custom',
buildPath: targetPath,
files: [
{
destination: 'tokens.preview.html',
format: 'html/tokens',
},
],
},
},
fileHeader: {
myFileHeader: () => {
return [`This is an auto-generated file, please do not change it directly.`, `Ionic Design System`];
},
},
}).buildAllPlatforms();

View File

@@ -0,0 +1,63 @@
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
th,
td {
padding: 10px;
border: 1px solid #ccc;
text-align: left;
}
th {
background-color: #f4f4f4;
}
thead th {
position: sticky;
top: 0;
background-color: #f4f4f4;
z-index: 1;
}
.color-swatch {
width: 50px;
height: 50px;
}
.font-size-token,
.weight-token,
.letter-spacing-token {
margin: 10px 0;
}
.border-token,
.shadow-token {
margin: 10px;
padding: 10px;
}
.border-token {
border: 1px solid #000;
}
.spacing-wrapper {
background-color: lightblue;
}
.spacing-wrapper > div {
background-color: #fff;
}
.token-wrapper:has(.spacing-wrapper) {
display: flex;
flex-direction: column;
gap: 20px;
}
hr {
background-color: #ccc;
margin: 20px 0;
}

View File

@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<title>Design Tokens</title>
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
<link rel="stylesheet" href="../../scripts/tokens/preview.styles.css" />
</head>
<body>
<ion-app>
<ion-header>
<ion-toolbar>
<ion-title>Design Tokens - Preview</ion-title>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding-horizontal">
<h1>Color Tokens</h1>
<div class="token-wrapper">{{colorTokens}}</div>
<hr />
<h1>Font Size Tokens</h1>
<div class="token-wrapper">{{fontSizeTokens}}</div>
<hr />
<h1>Font Weight Tokens</h1>
<div class="token-wrapper">{{fontWeightTokens}}</div>
<hr />
<h1>Letter Spacing Tokens</h1>
<div class="token-wrapper">{{letterSpacingTokens}}</div>
<hr />
<h1>Box Shadow Tokens</h1>
<div class="token-wrapper">{{boxShadowTokens}}</div>
<hr />
<h1>Border Size Tokens</h1>
<div class="token-wrapper">{{borderSizeTokens}}</div>
<hr />
<h1>Border Radius Tokens</h1>
<div class="token-wrapper">{{borderRadiusTokens}}</div>
<hr />
<h1>Border Style Tokens</h1>
<div class="token-wrapper">{{borderStyleTokens}}</div>
<hr />
<h1>Space Tokens</h1>
<div class="token-wrapper">{{spaceTokens}}</div>
</ion-content>
</ion-app>
</body>
</html>

View File

@@ -0,0 +1,179 @@
const variablesPrefix = 'ionic'; // Variable that holds the prefix used on all css and scss variables generated
// Generates a valid rgba() color
function getRgbaValue(propValue) {
// Check if its rgba color
const isRgba = hexToRgba(propValue);
// If it is, then compose rgba() color, otherwise use the normal color
if (isRgba !== null) {
return (propValue = `rgba(${isRgba.r}, ${isRgba.g}, ${isRgba.b},${isRgba.a})`);
} else {
return propValue;
}
}
// Translates an hex color value to rgb
function hexToRgb(hex) {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result
? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16),
}
: null;
}
// Translates an hex color value to rgba
function hexToRgba(hex) {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result
? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16),
a: Math.round((parseInt(result[4], 16) * 100) / 255) / 100,
}
: null;
}
// Generates a valid box-shadow value from a shadow Design Token structure
function generateShadowValue(shadow) {
const color = getRgbaValue(shadow.color);
return `${shadow.offsetX} ${shadow.offsetY} ${shadow.blur} ${shadow.spread} ${color}`;
}
// Generates a valid font-family value from a font-family Design Token structure
function generateFontFamilyValue(prop, variableType = 'css') {
// Remove the last word from the token, as it contains the name of the font, which we don't want to be included on the generated variables
const propName = prop.name.split('-').slice(0, -1).join('-');
return variableType === 'scss'
? `$${variablesPrefix}-${propName}: var(--${variablesPrefix}-${propName}, "${prop.value}", sans-serif);`
: `--${variablesPrefix}-${propName}: "${prop.value}", sans-serif;`;
}
// Generates a typography based scss map from a typography Design Token structure
function generateTypographyValue(prop, dictionary) {
const typography = prop.value;
const fontSizeMap = getTypeMap(dictionary, 'font-size');
const fontWeightMap = getTypeMap(dictionary, 'font-weight');
const lineHeightMap = getTypeMap(dictionary, 'line-height');
const letterSpacingMap = getTypeMap(dictionary, 'letter-spacing');
// This exact format is needed so that it compiles the tokens with the expected lint rules
return `
$${variablesPrefix}-${prop.name}: (
font-family: $ionic-font-family,
font-size: $ionic-font-size-${fontSizeMap[typography.fontSize]},
font-weight: $ionic-font-weight-${fontWeightMap[typography.fontWeight]},
letter-spacing: $ionic-letter-spacing-${letterSpacingMap[typography.letterSpacing] || 0},
line-height: $ionic-line-height-${lineHeightMap[typography.lineHeight]},
text-transform: ${typography.textTransform},
text-decoration: ${typography.textDecoration}
);
`;
}
// To abstract the need to loop across all tokens from a given type
function getTypeMap(dictionary, type) {
return Object.fromEntries(
Object.entries(dictionary.properties[type]).map(([key, token]) => [token.value, token.attributes.type])
);
}
// Generates a final value, based if the Design Token is of type color or not
function generateValue(prop) {
const rgb = hexToRgb(prop.value);
let rgbDeclaration = '';
if (rgb) {
// If the token is color, also add a rgb variable using the same color
rgbDeclaration = `\n$${variablesPrefix}-${prop.name}-rgb: var(--${variablesPrefix}-${prop.name}-rgb, ${rgb.r}, ${rgb.g}, ${rgb.b});`;
}
prop.value = getRgbaValue(prop.value);
return `$${variablesPrefix}-${prop.name}: var(--${variablesPrefix}-${prop.name}, ${prop.value});${rgbDeclaration}`;
}
// Generates a typography based css utility-class from a typography Design Token structure
function generateTypographyUtilityClass(prop, dictionary) {
const typography = prop.value;
const fontSizeMap = getTypeMap(dictionary, 'font-size');
const fontWeightMap = getTypeMap(dictionary, 'font-weight');
const lineHeightMap = getTypeMap(dictionary, 'line-height');
const letterSpacingMap = getTypeMap(dictionary, 'letter-spacing');
// This exact format is needed so that it compiles the tokens with the expected lint rules
return `
.${variablesPrefix}-${prop.name} {
font-family: $ionic-font-family;
font-size: $ionic-font-size-${fontSizeMap[typography.fontSize]};
font-weight: $ionic-font-weight-${fontWeightMap[typography.fontWeight]};
letter-spacing: $ionic-letter-spacing-${letterSpacingMap[typography.letterSpacing] || 0};
line-height: $ionic-line-height-${lineHeightMap[typography.lineHeight]};
text-transform: ${typography.textTransform};
text-decoration: ${typography.textDecoration};
};
`;
}
// Generates a color based css utility-class from a color Design Token structure
function generateColorUtilityClasses(prop, className) {
return `.${variablesPrefix}-${className} {\n --color: $ionic-${prop.name};\n}
.${variablesPrefix}-background-${className} {\n --background: $ionic-${prop.name};\n}`;
}
// Generates a font based css utility-class from a font Design Token structure
function generateFontUtilityClass(prop, className) {
let fontAttribute;
switch (prop.attributes.type) {
case 'size':
fontAttribute = 'font-size';
break;
case 'weight':
fontAttribute = 'font-weight';
break;
case 'line-height':
fontAttribute = 'line-height';
break;
case 'letter-spacing':
fontAttribute = 'letter-spacing';
break;
}
return `.${variablesPrefix}-${className} {\n ${fontAttribute}: $ionic-${prop.name};\n}`;
}
// Generates a margin or padding based css utility-class from a space Design Token structure
function generateSpaceUtilityClasses(prop, className) {
// This exact format is needed so that it compiles the tokens with the expected lint rules
const marginPaddingTemplate = (type) => `
.${variablesPrefix}-${type}-${className} {
--${type}-start: #{$ionic-${prop.name}};
--${type}-end: #{$ionic-${prop.name}};
--${type}-top: #{$ionic-${prop.name}};
--${type}-bottom: #{$ionic-${prop.name}};
@include ${type}($ionic-${prop.name});
};`;
return `${marginPaddingTemplate('margin')}\n${marginPaddingTemplate('padding')}`;
}
// Export all methods to be used on the tokens.js script
module.exports = {
variablesPrefix,
getRgbaValue,
hexToRgb,
hexToRgba,
generateShadowValue,
generateFontFamilyValue,
generateTypographyValue,
generateRgbValue: generateValue,
generateColorUtilityClasses,
generateFontUtilityClass,
generateSpaceUtilityClasses,
generateTypographyUtilityClass,
};

1470
core/src/components.d.ts vendored
View File

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,12 @@
:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanding),
:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanded) {
@include margin($accordion-md-expanded-margin, 0, $accordion-md-expanded-margin, 0);
@include border-radius($accordion-md-border-radius, $accordion-md-border-radius, $accordion-md-border-radius, $accordion-md-border-radius);
@include border-radius(
$accordion-md-border-radius,
$accordion-md-border-radius,
$accordion-md-border-radius,
$accordion-md-border-radius
);
}
:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-previous) {

View File

@@ -1,4 +1,4 @@
@import "../../themes/ionic.globals";
@import "../../themes/native/native.globals";
@import "../accordion/accordion.vars";
// Accordion Group

View File

@@ -2,18 +2,20 @@ import type { ComponentInterface, EventEmitter } from '@stencil/core';
import { Component, Element, Event, Host, Listen, Method, Prop, Watch, h } from '@stencil/core';
import { printIonWarning } from '@utils/logging';
import { getIonMode } from '../../global/ionic-global';
import { getIonTheme } from '../../global/ionic-global';
import type { AccordionGroupChangeEventDetail } from './accordion-group-interface';
/**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
* @virtualProp {"ios" | "md"} mode - The mode determines the platform behaviors of the component.
* @virtualProp {"ios" | "md" | "ionic"} theme - The theme determines the visual appearance of the component.
*/
@Component({
tag: 'ion-accordion-group',
styleUrls: {
ios: 'accordion-group.ios.scss',
md: 'accordion-group.md.scss',
ionic: 'accordion-group.md.scss',
},
shadow: true,
})
@@ -278,12 +280,12 @@ export class AccordionGroup implements ComponentInterface {
render() {
const { disabled, readonly, expand } = this;
const mode = getIonMode(this);
const theme = getIonTheme(this);
return (
<Host
class={{
[mode]: true,
[theme]: true,
'accordion-group-disabled': disabled,
'accordion-group-readonly': readonly,
[`accordion-group-expand-${expand}`]: true,

View File

@@ -1,13 +1,14 @@
@import "../../themes/ionic.globals.md";
@import "../../themes/native/native.globals.md";
// Accordion
// --------------------------------------------------
/// @prop - Border radius applied to the accordion
$accordion-md-border-radius: 6px;
$accordion-md-border-radius: 6px;
/// @prop - Box shadow of the accordion
$accordion-md-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
$accordion-md-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14),
0px 1px 5px 0px rgba(0, 0, 0, 0.12);
/// @prop - Margin of the expanded accordion
$accordion-md-expanded-margin: 16px;
$accordion-md-expanded-margin: 16px;

View File

@@ -4,7 +4,7 @@ import { addEventListener, getElementRoot, raf, removeEventListener, transitionE
import { chevronDown } from 'ionicons/icons';
import { config } from '../../global/config';
import { getIonMode } from '../../global/ionic-global';
import { getIonTheme } from '../../global/ionic-global';
const enum AccordionState {
Collapsed = 1 << 0,
@@ -14,7 +14,8 @@ const enum AccordionState {
}
/**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
* @virtualProp {"ios" | "md"} mode - The mode determines the platform behaviors of the component.
* @virtualProp {"ios" | "md" | "ionic"} theme - The theme determines the visual appearance of the component.
*
* @slot header - Content is placed at the top and is used to
* expand or collapse the accordion item.
@@ -31,6 +32,7 @@ const enum AccordionState {
styleUrls: {
ios: 'accordion.ios.scss',
md: 'accordion.md.scss',
ionic: 'accordion.md.scss',
},
shadow: {
delegatesFocus: true,
@@ -77,7 +79,7 @@ export class Accordion implements ComponentInterface {
* rotated when the accordion is expanded
* or collapsed.
*/
@Prop() toggleIcon = chevronDown;
@Prop() toggleIcon?: string;
/**
* The slot inside of `ion-item` to
@@ -191,7 +193,8 @@ export class Accordion implements ComponentInterface {
return;
}
const { toggleIconSlot, toggleIcon } = this;
const { toggleIconSlot } = this;
const accordionToggleIcon = this.toggleIcon ?? config.get('accordionToggleIcon', chevronDown);
/**
* Check if there already is a toggle icon.
@@ -206,7 +209,7 @@ export class Accordion implements ComponentInterface {
iconEl.slot = toggleIconSlot;
iconEl.lazy = false;
iconEl.classList.add('ion-accordion-toggle-icon');
iconEl.icon = toggleIcon;
iconEl.icon = accordionToggleIcon;
iconEl.setAttribute('aria-hidden', 'true');
ionItem.appendChild(iconEl);
@@ -402,7 +405,7 @@ export class Accordion implements ComponentInterface {
render() {
const { disabled, readonly } = this;
const mode = getIonMode(this);
const theme = getIonTheme(this);
const expanded = this.state === AccordionState.Expanded || this.state === AccordionState.Expanding;
const headerPart = expanded ? 'header expanded' : 'header';
const contentPart = expanded ? 'content expanded' : 'content';
@@ -412,7 +415,7 @@ export class Accordion implements ComponentInterface {
return (
<Host
class={{
[mode]: true,
[theme]: true,
'accordion-expanding': this.state === AccordionState.Expanding,
'accordion-expanded': this.state === AccordionState.Expanded,
'accordion-collapsing': this.state === AccordionState.Collapsing,

View File

@@ -1,19 +1,19 @@
@import "../../themes/ionic.globals";
@import "../../themes/native/native.globals";
// Accordion
// --------------------------------------------------
/// @prop - Background color of the accordion
$accordion-background-color: var(--ion-background-color, #ffffff);
$accordion-background-color: var(--ion-background-color, #ffffff);
/// @prop - Duration of the accordion transition
$accordion-transition-duration: 300ms;
$accordion-transition-duration: 300ms;
/// @prop - Timing function of the accordion transition
$accordion-transition-easing: cubic-bezier(0.25, 0.8, 0.5, 1);
$accordion-transition-easing: cubic-bezier(0.25, 0.8, 0.5, 1);
/// @prop - Opacity of the disabled accordion
$accordion-disabled-opacity: 0.4;
$accordion-disabled-opacity: 0.4;
/// @prop - Margin of the inset accordion
$accordion-inset-margin: 16px;
$accordion-inset-margin: 16px;

View File

@@ -1,20 +1,16 @@
import type { AnimationBuilder, LiteralUnion, Mode } from '../../interface';
import type { OverlayOptions } from '@utils/overlays-interface';
export interface ActionSheetOptions {
import type { LiteralUnion } from '../../interface';
export interface ActionSheetOptions extends OverlayOptions {
header?: string;
subHeader?: string;
cssClass?: string | string[];
buttons: (ActionSheetButton | string)[];
backdropDismiss?: boolean;
translucent?: boolean;
animated?: boolean;
mode?: Mode;
keyboardClose?: boolean;
id?: string;
htmlAttributes?: { [key: string]: any };
enterAnimation?: AnimationBuilder;
leaveAnimation?: AnimationBuilder;
}
export interface ActionSheetButton<T = any> {

View File

@@ -9,11 +9,11 @@
--backdrop-opacity: var(--ion-backdrop-opacity, 0.4);
--button-background: #{$action-sheet-ios-button-background};
--button-background-activated: #{$action-sheet-ios-button-background-activated};
--button-background-activated-opacity: .08;
--button-background-activated-opacity: 0.08;
--button-background-hover: currentColor;
--button-background-hover-opacity: .04;
--button-background-hover-opacity: 0.04;
--button-background-focused: currentColor;
--button-background-focused-opacity: .12;
--button-background-focused-opacity: 0.12;
--button-background-selected: #{$action-sheet-ios-button-background-selected};
--button-background-selected-opacity: 1;
--button-color: #{$action-sheet-ios-button-text-color};
@@ -51,10 +51,14 @@
// ---------------------------------------------------
.action-sheet-container {
@include padding($action-sheet-ios-padding-top, $action-sheet-ios-padding-end, $action-sheet-ios-padding-bottom, $action-sheet-ios-padding-start);
@include padding(
$action-sheet-ios-padding-top,
$action-sheet-ios-padding-end,
$action-sheet-ios-padding-bottom,
$action-sheet-ios-padding-start
);
}
// iOS Action Sheet Group
// ---------------------------------------------------
@@ -71,7 +75,6 @@
@include margin(null, null, $action-sheet-ios-group-margin-bottom, null);
}
// iOS Translucent Action Sheet
// ---------------------------------------------------
@@ -84,9 +87,17 @@
:host(.action-sheet-translucent) .action-sheet-title,
:host(.action-sheet-translucent) .action-sheet-button {
background-color: transparent;
background-image:
linear-gradient(0deg, $action-sheet-ios-translucent-background-color, $action-sheet-ios-translucent-background-color 100%),
linear-gradient(0deg, $action-sheet-ios-translucent-border-color, $action-sheet-ios-translucent-border-color 50%, $action-sheet-ios-translucent-background-color 50%);
background-image: linear-gradient(
0deg,
$action-sheet-ios-translucent-background-color,
$action-sheet-ios-translucent-background-color 100%
),
linear-gradient(
0deg,
$action-sheet-ios-translucent-border-color,
$action-sheet-ios-translucent-border-color 50%,
$action-sheet-ios-translucent-background-color 50%
);
background-repeat: no-repeat;
/* stylelint-disable-next-line all */
@@ -115,12 +126,16 @@
background: $action-sheet-ios-button-background;
}
// iOS Action Sheet Title
// ---------------------------------------------------
.action-sheet-title {
@include padding($action-sheet-ios-title-padding-top, $action-sheet-ios-title-padding-end, $action-sheet-ios-title-padding-bottom, $action-sheet-ios-title-padding-start);
@include padding(
$action-sheet-ios-title-padding-top,
$action-sheet-ios-title-padding-end,
$action-sheet-ios-title-padding-bottom,
$action-sheet-ios-title-padding-start
);
color: var(--color, $action-sheet-ios-title-color);
@@ -135,14 +150,18 @@
}
.action-sheet-sub-title {
@include padding($action-sheet-ios-sub-title-padding-top, $action-sheet-ios-sub-title-padding-end, $action-sheet-ios-sub-title-padding-bottom, $action-sheet-ios-sub-title-padding-start);
@include padding(
$action-sheet-ios-sub-title-padding-top,
$action-sheet-ios-sub-title-padding-end,
$action-sheet-ios-sub-title-padding-bottom,
$action-sheet-ios-sub-title-padding-start
);
font-size: $action-sheet-ios-sub-title-font-size;
font-weight: $action-sheet-ios-title-font-weight;
}
// iOS Action Sheet Buttons
// ---------------------------------------------------

View File

@@ -1,148 +1,163 @@
@import "../../themes/ionic.globals.ios";
@import "../../themes/native/native.globals.ios";
// iOS Action Sheet
// --------------------------------------------------
/// @prop - Text align of the action sheet
$action-sheet-ios-text-align: center;
$action-sheet-ios-text-align: center;
/// @prop - Padding top of the action sheet
$action-sheet-ios-padding-top: 0;
$action-sheet-ios-padding-top: 0;
/// @prop - Padding end of the action sheet
$action-sheet-ios-padding-end: 8px;
$action-sheet-ios-padding-end: 8px;
/// @prop - Padding bottom of the action sheet
$action-sheet-ios-padding-bottom: $action-sheet-ios-padding-top;
$action-sheet-ios-padding-bottom: $action-sheet-ios-padding-top;
/// @prop - Padding start of the action sheet
$action-sheet-ios-padding-start: $action-sheet-ios-padding-end;
$action-sheet-ios-padding-start: $action-sheet-ios-padding-end;
/// @prop - Top margin of the action sheet button group
$action-sheet-ios-group-margin-top: 10px;
$action-sheet-ios-group-margin-top: 10px;
/// @prop - Bottom margin of the action sheet button group
$action-sheet-ios-group-margin-bottom: 10px;
$action-sheet-ios-group-margin-bottom: 10px;
/// @prop - Background color of the action sheet
$action-sheet-ios-background-color: $overlay-ios-background-color;
$action-sheet-ios-background-color: $overlay-ios-background-color;
/// @prop - Border radius of the action sheet
$action-sheet-ios-border-radius: 13px;
$action-sheet-ios-border-radius: 13px;
// Action Sheet Title
// --------------------------------------------------
/// @prop - Padding top of the action sheet title
$action-sheet-ios-title-padding-top: 14px;
$action-sheet-ios-title-padding-top: 14px;
/// @prop - Padding end of the action sheet title
$action-sheet-ios-title-padding-end: 10px;
$action-sheet-ios-title-padding-end: 10px;
/// @prop - Padding bottom of the action sheet title
$action-sheet-ios-title-padding-bottom: 13px;
$action-sheet-ios-title-padding-bottom: 13px;
/// @prop - Padding start of the action sheet title
$action-sheet-ios-title-padding-start: $action-sheet-ios-title-padding-end;
$action-sheet-ios-title-padding-start: $action-sheet-ios-title-padding-end;
/// @prop - Color of the action sheet title
$action-sheet-ios-title-color: $text-color-step-600;
$action-sheet-ios-title-color: $text-color-step-600;
/// @prop - Font size of the action sheet title
$action-sheet-ios-title-font-size: dynamic-font-min(1, 13px);
$action-sheet-ios-title-font-size: dynamic-font-min(1, 13px);
/// @prop - Font weight of the action sheet title
$action-sheet-ios-title-font-weight: 400;
$action-sheet-ios-title-font-weight: 400;
/// @prop - Font weight of the action sheet title when it has a sub title
$action-sheet-ios-title-with-sub-title-font-weight: 600;
$action-sheet-ios-title-with-sub-title-font-weight: 600;
// Action Sheet Subtitle
// --------------------------------------------------
/// @prop - Font size of the action sheet sub title
$action-sheet-ios-sub-title-font-size: dynamic-font-min(1, 13px);
$action-sheet-ios-sub-title-font-size: dynamic-font-min(1, 13px);
/// @prop - Padding top of the action sheet sub title
$action-sheet-ios-sub-title-padding-top: 6px;
$action-sheet-ios-sub-title-padding-top: 6px;
/// @prop - Padding end of the action sheet sub title
$action-sheet-ios-sub-title-padding-end: 0;
$action-sheet-ios-sub-title-padding-end: 0;
/// @prop - Padding bottom of the action sheet sub title
$action-sheet-ios-sub-title-padding-bottom: 0;
$action-sheet-ios-sub-title-padding-bottom: 0;
/// @prop - Padding start of the action sheet sub title
$action-sheet-ios-sub-title-padding-start: $action-sheet-ios-sub-title-padding-end;
$action-sheet-ios-sub-title-padding-start: $action-sheet-ios-sub-title-padding-end;
// Action Sheet Button
// --------------------------------------------------
/// @prop - Minimum height of the action sheet button
$action-sheet-ios-button-height: 56px;
$action-sheet-ios-button-height: 56px;
/// @prop - Padding of the action sheet button
$action-sheet-ios-button-padding: 14px;
$action-sheet-ios-button-padding: 14px;
/// @prop - Text color of the action sheet button
$action-sheet-ios-button-text-color: ion-color(primary, base);
$action-sheet-ios-button-text-color: ion-color(primary, base);
/// @prop - Font size of the action sheet button icon
$action-sheet-ios-button-icon-font-size: dynamic-font-min(1, 28px);
$action-sheet-ios-button-icon-font-size: dynamic-font-min(1, 28px);
/// @prop - Padding right of the action sheet button icon
$action-sheet-ios-button-icon-padding-right: .3em;
$action-sheet-ios-button-icon-padding-right: 0.3em;
/// @prop - Font size of the action sheet button
$action-sheet-ios-button-font-size: dynamic-font-min(1, 20px);
$action-sheet-ios-button-font-size: dynamic-font-min(1, 20px);
/// @prop - Border color alpha of the action sheet button
$action-sheet-ios-button-border-color-alpha: .08;
$action-sheet-ios-button-border-color-alpha: 0.08;
/// @prop - Border color of the action sheet button
$action-sheet-ios-button-border-color: rgba($text-color-rgb, $action-sheet-ios-button-border-color-alpha);
$action-sheet-ios-button-border-color: rgba($text-color-rgb, $action-sheet-ios-button-border-color-alpha);
/// @prop - Background color of the action sheet button
$action-sheet-ios-button-background: linear-gradient(0deg, $action-sheet-ios-button-border-color, $action-sheet-ios-button-border-color 50%, transparent 50%) bottom / 100% 1px no-repeat transparent;
$action-sheet-ios-button-background: linear-gradient(
0deg,
$action-sheet-ios-button-border-color,
$action-sheet-ios-button-border-color 50%,
transparent 50%
)
bottom / 100% 1px no-repeat transparent;
/// @prop - Background color of the activated action sheet button
$action-sheet-ios-button-background-activated: $text-color;
$action-sheet-ios-button-background-activated: $text-color;
/// @prop - Background color of the selected action sheet button
$action-sheet-ios-button-background-selected: var(--ion-color-step-150, var(--ion-background-color-step-150, $background-color));
$action-sheet-ios-button-background-selected: var(
--ion-color-step-150,
var(--ion-background-color-step-150, $background-color)
);
/// @prop - Destructive text color of the action sheet button
$action-sheet-ios-button-destructive-text-color: ion-color(danger, base);
$action-sheet-ios-button-destructive-text-color: ion-color(danger, base);
/// @prop - Font weight of the action sheet cancel button
$action-sheet-ios-button-cancel-font-weight: 600;
$action-sheet-ios-button-cancel-font-weight: 600;
// Action Sheet Translucent
// --------------------------------------------------
/// @prop - Background color alpha of the action sheet when translucent
$action-sheet-ios-translucent-background-color-alpha: .8;
$action-sheet-ios-translucent-background-color-alpha: 0.8;
/// @prop - Background color of the action sheet when translucent
$action-sheet-ios-translucent-background-color: rgba($background-color-rgb, $action-sheet-ios-translucent-background-color-alpha);
$action-sheet-ios-translucent-background-color: rgba(
$background-color-rgb,
$action-sheet-ios-translucent-background-color-alpha
);
/// @prop - Border color alpha of the action sheet when translucent
$action-sheet-ios-translucent-border-color-alpha: .4;
$action-sheet-ios-translucent-border-color-alpha: 0.4;
/// @prop - Border color of the action sheet when translucent
$action-sheet-ios-translucent-border-color: rgba($background-color-rgb, $action-sheet-ios-translucent-border-color-alpha);
$action-sheet-ios-translucent-border-color: rgba(
$background-color-rgb,
$action-sheet-ios-translucent-border-color-alpha
);
/// @prop - Background color alpha of the activated action sheet when translucent
$action-sheet-ios-translucent-background-color-activated-alpha: .7;
$action-sheet-ios-translucent-background-color-activated-alpha: 0.7;
/// @prop - Background color of the activated action sheet when translucent
$action-sheet-ios-translucent-background-color-activated: rgba($background-color-rgb, $action-sheet-ios-translucent-background-color-activated-alpha);
$action-sheet-ios-translucent-background-color-activated: rgba(
$background-color-rgb,
$action-sheet-ios-translucent-background-color-activated-alpha
);
/// @prop - Filter of the translucent action-sheet group
$action-sheet-ios-group-translucent-filter: saturate(280%) blur(20px);
$action-sheet-ios-group-translucent-filter: saturate(280%) blur(20px);
/// @prop - Filter of the translucent action-sheet button
$action-sheet-ios-button-translucent-filter: saturate(120%);
$action-sheet-ios-button-translucent-filter: saturate(120%);

View File

@@ -13,15 +13,14 @@
--button-background-activated: transparent;
--button-background-activated-opacity: 0;
--button-background-hover: currentColor;
--button-background-hover-opacity: .04;
--button-background-hover-opacity: 0.04;
--button-background-focused: currentColor;
--button-background-focused-opacity: .12;
--button-background-focused-opacity: 0.12;
--button-color: #{$action-sheet-md-button-text-color};
--button-color-disabled: var(--button-color);
--color: #{$action-sheet-md-title-color};
}
// Material Design Action Sheet Wrapper
// -----------------------------------------
@@ -30,7 +29,12 @@
}
.action-sheet-title {
@include padding($action-sheet-md-title-padding-top, $action-sheet-md-title-padding-end, $action-sheet-md-title-padding-bottom, $action-sheet-md-title-padding-start);
@include padding(
$action-sheet-md-title-padding-top,
$action-sheet-md-title-padding-end,
$action-sheet-md-title-padding-bottom,
$action-sheet-md-title-padding-start
);
min-height: $action-sheet-md-title-height;
@@ -42,12 +46,16 @@
}
.action-sheet-sub-title {
@include padding($action-sheet-md-sub-title-padding-top, $action-sheet-md-sub-title-padding-end, $action-sheet-md-sub-title-padding-bottom, $action-sheet-md-sub-title-padding-start);
@include padding(
$action-sheet-md-sub-title-padding-top,
$action-sheet-md-sub-title-padding-end,
$action-sheet-md-sub-title-padding-bottom,
$action-sheet-md-sub-title-padding-start
);
font-size: $action-sheet-md-sub-title-font-size;
}
// Material Design Action Sheet Group
// -----------------------------------------
@@ -59,12 +67,16 @@
@include padding(null, null, $action-sheet-md-padding-bottom, null);
}
// Material Design Action Sheet Buttons
// -----------------------------------------
.action-sheet-button {
@include padding($action-sheet-md-button-padding-top, $action-sheet-md-button-padding-end, $action-sheet-md-button-padding-bottom, $action-sheet-md-button-padding-start);
@include padding(
$action-sheet-md-button-padding-top,
$action-sheet-md-button-padding-end,
$action-sheet-md-button-padding-bottom,
$action-sheet-md-button-padding-start
);
position: relative;
@@ -79,7 +91,12 @@
}
.action-sheet-icon {
@include margin($action-sheet-md-icon-margin-top, $action-sheet-md-icon-margin-end, $action-sheet-md-icon-margin-bottom, $action-sheet-md-icon-margin-start);
@include margin(
$action-sheet-md-icon-margin-top,
$action-sheet-md-icon-margin-end,
$action-sheet-md-icon-margin-bottom,
$action-sheet-md-icon-margin-start
);
color: var(--color);

View File

@@ -1,103 +1,100 @@
@import "../../themes/ionic.globals.md";
@import "../../themes/native/native.globals.md";
// Material Design Action Sheet
// --------------------------------------------------
/// @prop - Text align of the action sheet
$action-sheet-md-text-align: start;
$action-sheet-md-text-align: start;
/// @prop - Background color of the action sheet
$action-sheet-md-background-color: $overlay-md-background-color;
$action-sheet-md-background-color: $overlay-md-background-color;
/// @prop - Padding top of the action sheet
$action-sheet-md-padding-top: 0;
$action-sheet-md-padding-top: 0;
/// @prop - Padding bottom of the action sheet
$action-sheet-md-padding-bottom: var(--ion-safe-area-bottom);
$action-sheet-md-padding-bottom: var(--ion-safe-area-bottom);
// Action Sheet Title
// --------------------------------------------------
/// @prop - Height of the action sheet title
$action-sheet-md-title-height: 60px;
$action-sheet-md-title-height: 60px;
/// @prop - Color of the action sheet title
$action-sheet-md-title-color: rgba($text-color-rgb, 0.54);
$action-sheet-md-title-color: rgba($text-color-rgb, 0.54);
/// @prop - Font size of the action sheet title
$action-sheet-md-title-font-size: dynamic-font(16px);
$action-sheet-md-title-font-size: dynamic-font(16px);
/// @prop - Padding top of the action sheet title
$action-sheet-md-title-padding-top: 20px;
$action-sheet-md-title-padding-top: 20px;
/// @prop - Padding end of the action sheet title
$action-sheet-md-title-padding-end: 16px;
$action-sheet-md-title-padding-end: 16px;
/// @prop - Padding bottom of the action sheet title
$action-sheet-md-title-padding-bottom: 17px;
$action-sheet-md-title-padding-bottom: 17px;
/// @prop - Padding start of the action sheet title
$action-sheet-md-title-padding-start: $action-sheet-md-title-padding-end;
$action-sheet-md-title-padding-start: $action-sheet-md-title-padding-end;
// Action Sheet Subtitle
// --------------------------------------------------
/// @prop - Font size of the action sheet sub title
$action-sheet-md-sub-title-font-size: dynamic-font(14px);
$action-sheet-md-sub-title-font-size: dynamic-font(14px);
/// @prop - Padding top of the action sheet sub title
$action-sheet-md-sub-title-padding-top: 16px;
$action-sheet-md-sub-title-padding-top: 16px;
/// @prop - Padding end of the action sheet sub title
$action-sheet-md-sub-title-padding-end: 0;
$action-sheet-md-sub-title-padding-end: 0;
/// @prop - Padding bottom of the action sheet sub title
$action-sheet-md-sub-title-padding-bottom: 0;
$action-sheet-md-sub-title-padding-bottom: 0;
/// @prop - Padding start of the action sheet sub title
$action-sheet-md-sub-title-padding-start: $action-sheet-md-sub-title-padding-end;
$action-sheet-md-sub-title-padding-start: $action-sheet-md-sub-title-padding-end;
// Action Sheet Button
// --------------------------------------------------
/// @prop - Minimum height of the action sheet button
$action-sheet-md-button-height: 52px;
$action-sheet-md-button-height: 52px;
/// @prop - Text color of the action sheet button
$action-sheet-md-button-text-color: $text-color-step-150;
$action-sheet-md-button-text-color: $text-color-step-150;
/// @prop - Font size of the action sheet button
$action-sheet-md-button-font-size: dynamic-font(16px);
$action-sheet-md-button-font-size: dynamic-font(16px);
/// @prop - Padding top of the action sheet button
$action-sheet-md-button-padding-top: 12px;
$action-sheet-md-button-padding-top: 12px;
/// @prop - Padding end of the action sheet button
$action-sheet-md-button-padding-end: 16px;
$action-sheet-md-button-padding-end: 16px;
/// @prop - Padding bottom of the action sheet button
$action-sheet-md-button-padding-bottom: $action-sheet-md-button-padding-top;
$action-sheet-md-button-padding-bottom: $action-sheet-md-button-padding-top;
/// @prop - Padding start of the action sheet button
$action-sheet-md-button-padding-start: $action-sheet-md-button-padding-end;
$action-sheet-md-button-padding-start: $action-sheet-md-button-padding-end;
// Action Sheet Icon
// --------------------------------------------------
/// @prop - Font size of the icon in the action sheet button
$action-sheet-md-icon-font-size: dynamic-font(24px);
$action-sheet-md-icon-font-size: dynamic-font(24px);
/// @prop - Margin top of the icon in the action sheet button
$action-sheet-md-icon-margin-top: 0;
$action-sheet-md-icon-margin-top: 0;
/// @prop - Margin end of the icon in the action sheet button
$action-sheet-md-icon-margin-end: 32px;
$action-sheet-md-icon-margin-end: 32px;
/// @prop - Margin bottom of the icon in the action sheet button
$action-sheet-md-icon-margin-bottom: 0;
$action-sheet-md-icon-margin-bottom: 0;
/// @prop - Margin start of the icon in the action sheet button
$action-sheet-md-icon-margin-start: 0;
$action-sheet-md-icon-margin-start: 0;

View File

@@ -173,7 +173,6 @@
overflow: hidden;
}
// Action Sheet: States
// --------------------------------------------------
@@ -181,7 +180,6 @@
@include button-state();
}
// Action Sheet: Selected
// --------------------------------------------------
@@ -195,7 +193,6 @@
}
}
// Action Sheet: Activated
// --------------------------------------------------
@@ -209,7 +206,6 @@
}
}
// Action Sheet: Focused
// --------------------------------------------------

View File

@@ -18,7 +18,7 @@ import {
} from '@utils/overlays';
import { getClassMap } from '@utils/theme';
import { getIonMode } from '../../global/ionic-global';
import { getIonMode, getIonTheme } from '../../global/ionic-global';
import type { AnimationBuilder, CssClassMap, FrameworkDelegate, OverlayInterface } from '../../interface';
import type { OverlayEventDetail } from '../../utils/overlays-interface';
@@ -29,13 +29,15 @@ import { mdEnterAnimation } from './animations/md.enter';
import { mdLeaveAnimation } from './animations/md.leave';
/**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
* @virtualProp {"ios" | "md"} mode - The mode determines the platform behaviors of the component.
* @virtualProp {"ios" | "md" | "ionic"} theme - The theme determines the visual appearance of the component.
*/
@Component({
tag: 'ion-action-sheet',
styleUrls: {
ios: 'action-sheet.ios.scss',
md: 'action-sheet.md.scss',
ionic: 'action-sheet.md.scss',
},
scoped: true,
})
@@ -105,7 +107,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
/**
* If `true`, the action sheet will be translucent.
* Only applies when the mode is `"ios"` and the device supports
* Only applies when the theme is `"ios"` and the device supports
* [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility).
*/
@Prop() translucent = false;
@@ -314,6 +316,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
}
componentDidLoad() {
const mode = getIonMode(this);
/**
* Only create gesture if:
* 1. A gesture does not already exist
@@ -322,7 +325,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
* 4. A group ref exists
*/
const { groupEl, wrapperEl } = this;
if (!this.gesture && getIonMode(this) === 'ios' && wrapperEl && groupEl) {
if (!this.gesture && mode === 'ios' && wrapperEl && groupEl) {
readTask(() => {
const isScrollable = groupEl.scrollHeight > groupEl.clientHeight;
if (!isScrollable) {
@@ -356,7 +359,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
render() {
const { header, htmlAttributes, overlayIndex } = this;
const mode = getIonMode(this);
const theme = getIonTheme(this);
const allButtons = this.getButtons();
const cancelButton = allButtons.find((b) => b.role === 'cancel');
const buttons = allButtons.filter((b) => b.role !== 'cancel');
@@ -373,7 +376,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
zIndex: `${20000 + this.overlayIndex}`,
}}
class={{
[mode]: true,
[theme]: true,
...getClassMap(this.cssClass),
'overlay-hidden': true,
'action-sheet-translucent': this.translucent,
@@ -413,7 +416,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
{b.icon && <ion-icon icon={b.icon} aria-hidden="true" lazy={false} class="action-sheet-icon" />}
{b.text}
</span>
{mode === 'md' && <ion-ripple-effect></ion-ripple-effect>}
{theme === 'md' && <ion-ripple-effect></ion-ripple-effect>}
</button>
))}
</div>
@@ -437,7 +440,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
)}
{cancelButton.text}
</span>
{mode === 'md' && <ion-ripple-effect></ion-ripple-effect>}
{theme === 'md' && <ion-ripple-effect></ion-ripple-effect>}
</button>
</div>
)}

View File

@@ -1,10 +1,10 @@
@import "../../themes/ionic.globals";
@import "../../themes/native/native.globals";
// Action Sheet
// --------------------------------------------------
/// @prop - Width of the action sheet
$action-sheet-width: 100%;
$action-sheet-width: 100%;
/// @prop - Maximum width of the action sheet
$action-sheet-max-width: 500px;
$action-sheet-max-width: 500px;

View File

@@ -1,7 +1,9 @@
import type { AnimationBuilder, LiteralUnion, Mode, TextFieldTypes } from '../../interface';
import type { OverlayOptions } from '@utils/overlays-interface';
import type { LiteralUnion, TextFieldTypes } from '../../interface';
import type { IonicSafeString } from '../../utils/sanitization';
export interface AlertOptions {
export interface AlertOptions extends OverlayOptions {
header?: string;
subHeader?: string;
message?: string | IonicSafeString;
@@ -10,15 +12,9 @@ export interface AlertOptions {
buttons?: (AlertButton | string)[];
backdropDismiss?: boolean;
translucent?: boolean;
animated?: boolean;
htmlAttributes?: { [key: string]: any };
mode?: Mode;
keyboardClose?: boolean;
id?: string;
enterAnimation?: AnimationBuilder;
leaveAnimation?: AnimationBuilder;
}
export interface AlertInput {

View File

@@ -23,7 +23,6 @@
pointer-events: none;
}
// iOS Translucent Alert
// -----------------------------------------
@@ -38,7 +37,12 @@
// --------------------------------------------------
.alert-head {
@include padding($alert-ios-head-padding-top, $alert-ios-head-padding-end, $alert-ios-head-padding-bottom, $alert-ios-head-padding-start);
@include padding(
$alert-ios-head-padding-top,
$alert-ios-head-padding-end,
$alert-ios-head-padding-bottom,
$alert-ios-head-padding-start
);
text-align: $alert-ios-head-text-align;
}
@@ -58,13 +62,17 @@
font-size: $alert-ios-sub-title-font-size;
}
// iOS Alert Message
// --------------------------------------------------
.alert-message,
.alert-input-group {
@include padding($alert-ios-message-padding-top, $alert-ios-message-padding-end, $alert-ios-message-padding-bottom, $alert-ios-message-padding-start);
@include padding(
$alert-ios-message-padding-top,
$alert-ios-message-padding-end,
$alert-ios-message-padding-bottom,
$alert-ios-message-padding-start
);
color: $alert-ios-message-text-color;
@@ -78,17 +86,26 @@
}
.alert-message:empty {
@include padding($alert-ios-message-empty-padding-top, $alert-ios-message-empty-padding-end, $alert-ios-message-empty-padding-bottom, $alert-ios-message-empty-padding-start);
@include padding(
$alert-ios-message-empty-padding-top,
$alert-ios-message-empty-padding-end,
$alert-ios-message-empty-padding-bottom,
$alert-ios-message-empty-padding-start
);
}
// iOS Alert Input
// --------------------------------------------------
.alert-input {
@include border-radius($alert-ios-input-border-radius);
@include margin($alert-ios-input-margin-top, null, null, null);
@include padding($alert-ios-input-padding-top, $alert-ios-input-padding-end, $alert-ios-input-padding-bottom, $alert-ios-input-padding-start);
@include padding(
$alert-ios-input-padding-top,
$alert-ios-input-padding-end,
$alert-ios-input-padding-bottom,
$alert-ios-input-padding-start
);
border: $alert-ios-input-border;
@@ -120,7 +137,6 @@
}
}
// iOS Alert Radio/Checkbox Group
// --------------------------------------------------
@@ -139,12 +155,16 @@
min-height: $alert-ios-tappable-height;
}
// iOS Alert Radio Label
// --------------------------------------------------
.alert-radio-label {
@include padding($alert-ios-radio-label-padding-top, $alert-ios-radio-label-padding-end, $alert-ios-radio-label-padding-bottom, $alert-ios-radio-label-padding-start);
@include padding(
$alert-ios-radio-label-padding-top,
$alert-ios-radio-label-padding-end,
$alert-ios-radio-label-padding-bottom,
$alert-ios-radio-label-padding-start
);
flex: 1;
order: 0;
@@ -152,15 +172,13 @@
color: $alert-ios-radio-label-text-color;
}
// iOS Alert Radio Label: Checked
// --------------------------------------------------
[aria-checked=true] .alert-radio-label {
[aria-checked="true"] .alert-radio-label {
color: $alert-ios-radio-label-text-color-checked;
}
// iOS Alert Radio Checkmark: Unchecked
// -----------------------------------------
@@ -172,11 +190,10 @@
min-width: $alert-ios-radio-min-width;
}
// iOS Alert Radio Checked
// -----------------------------------------
[aria-checked=true] .alert-radio-inner {
[aria-checked="true"] .alert-radio-inner {
@include position($alert-ios-radio-icon-top, null, null, $alert-ios-radio-icon-start);
position: absolute;
@@ -193,12 +210,16 @@
border-color: $alert-ios-radio-icon-border-color;
}
// iOS Alert Checkbox Label
// --------------------------------------------------
.alert-checkbox-label {
@include padding($alert-ios-checkbox-label-padding-top, $alert-ios-checkbox-label-padding-end, $alert-ios-checkbox-label-padding-bottom, $alert-ios-checkbox-label-padding-start);
@include padding(
$alert-ios-checkbox-label-padding-top,
$alert-ios-checkbox-label-padding-end,
$alert-ios-checkbox-label-padding-bottom,
$alert-ios-checkbox-label-padding-start
);
flex: 1;
@@ -210,7 +231,12 @@
.alert-checkbox-icon {
@include border-radius($alert-ios-checkbox-border-radius);
@include margin($alert-ios-checkbox-margin-top, $alert-ios-checkbox-margin-end, $alert-ios-checkbox-margin-bottom, $alert-ios-checkbox-margin-start);
@include margin(
$alert-ios-checkbox-margin-top,
$alert-ios-checkbox-margin-end,
$alert-ios-checkbox-margin-bottom,
$alert-ios-checkbox-margin-start
);
position: relative;
@@ -226,21 +252,19 @@
contain: strict;
}
// iOS Alert Checkbox Outer Circle: Checked
// -----------------------------------------
[aria-checked=true] .alert-checkbox-icon {
[aria-checked="true"] .alert-checkbox-icon {
border-color: $alert-ios-checkbox-border-color-on;
background-color: $alert-ios-checkbox-background-color-on;
}
// iOS Alert Checkbox Inner Checkmark: Checked
// -----------------------------------------
[aria-checked=true] .alert-checkbox-inner {
[aria-checked="true"] .alert-checkbox-inner {
@include position($alert-ios-checkbox-icon-top, null, null, $alert-ios-checkbox-icon-start);
position: absolute;
@@ -257,7 +281,6 @@
border-color: $alert-ios-checkbox-icon-border-color;
}
// iOS Alert Button
// --------------------------------------------------

View File

@@ -1,141 +1,141 @@
@use "sass:math";
@import "../../themes/ionic.globals.ios";
@import "../../themes/native/native.globals.ios";
@import "../item/item.ios.vars";
// iOS Alert
// --------------------------------------------------
/// @prop - Font size of the alert
$alert-ios-font-size: dynamic-font-min(1, 14px);
$alert-ios-font-size: dynamic-font-min(1, 14px);
/// @prop - Max width of the alert
$alert-ios-max-width: dynamic-font-clamp(1, 270px, 1.2);
$alert-ios-max-width: dynamic-font-clamp(1, 270px, 1.2);
/// @prop - Border radius of the alert
$alert-ios-border-radius: 13px;
$alert-ios-border-radius: 13px;
/// @prop - Background color of the alert
$alert-ios-background-color: $overlay-ios-background-color;
$alert-ios-background-color: $overlay-ios-background-color;
/// @prop - Background color alpha of the alert when translucent
$alert-ios-translucent-background-color-alpha: .9;
$alert-ios-translucent-background-color-alpha: 0.9;
/// @prop - Background color of the alert when translucent
$alert-ios-translucent-background-color: rgba($background-color-rgb, $alert-ios-translucent-background-color-alpha);
$alert-ios-translucent-background-color: rgba($background-color-rgb, $alert-ios-translucent-background-color-alpha);
/// @prop - Box shadow of the alert
$alert-ios-box-shadow: none;
$alert-ios-box-shadow: none;
/// @prop - Padding top of the alert head
$alert-ios-head-padding-top: 12px;
$alert-ios-head-padding-top: 12px;
/// @prop - Padding end of the alert head
$alert-ios-head-padding-end: 16px;
$alert-ios-head-padding-end: 16px;
/// @prop - Padding bottom of the alert head
$alert-ios-head-padding-bottom: 7px;
$alert-ios-head-padding-bottom: 7px;
/// @prop - Padding start of the alert head
$alert-ios-head-padding-start: $alert-ios-head-padding-end;
$alert-ios-head-padding-start: $alert-ios-head-padding-end;
/// @prop - Text align of the alert head
$alert-ios-head-text-align: center;
$alert-ios-head-text-align: center;
/// @prop - Color of the alert title
$alert-ios-title-color: $text-color;
$alert-ios-title-color: $text-color;
/// @prop - Margin top of the alert title
$alert-ios-title-margin-top: 8px;
$alert-ios-title-margin-top: 8px;
/// @prop - Font size of the alert title
$alert-ios-title-font-size: dynamic-font-min(1, 17px);
$alert-ios-title-font-size: dynamic-font-min(1, 17px);
/// @prop - Font weight of the alert title
$alert-ios-title-font-weight: 600;
$alert-ios-title-font-weight: 600;
/// @prop - Font size of the alert sub title
$alert-ios-sub-title-font-size: dynamic-font-min(1, 14px);
$alert-ios-sub-title-font-size: dynamic-font-min(1, 14px);
/// @prop - Text color of the alert sub title
$alert-ios-sub-title-text-color: $text-color-step-400;
$alert-ios-sub-title-text-color: $text-color-step-400;
/// @prop - Padding top of the alert message
$alert-ios-message-padding-top: 0;
$alert-ios-message-padding-top: 0;
/// @prop - Padding end of the alert message
$alert-ios-message-padding-end: 16px;
$alert-ios-message-padding-end: 16px;
/// @prop - Padding bottom of the alert message
$alert-ios-message-padding-bottom: 21px;
$alert-ios-message-padding-bottom: 21px;
/// @prop - Padding start of the alert message
$alert-ios-message-padding-start: $alert-ios-message-padding-end;
$alert-ios-message-padding-start: $alert-ios-message-padding-end;
/// @prop - Font size of the alert message
$alert-ios-message-font-size: dynamic-font-min(1, 13px);
$alert-ios-message-font-size: dynamic-font-min(1, 13px);
/// @prop - Text align of the alert message
$alert-ios-message-text-align: center;
$alert-ios-message-text-align: center;
/// @prop - Text color of the alert message
$alert-ios-message-text-color: $text-color;
$alert-ios-message-text-color: $text-color;
/// @prop - Padding top of the alert empty message
$alert-ios-message-empty-padding-top: 0;
$alert-ios-message-empty-padding-top: 0;
/// @prop - Padding end of the alert empty message
$alert-ios-message-empty-padding-end: 0;
$alert-ios-message-empty-padding-end: 0;
/// @prop - Padding bottom of the alert empty message
$alert-ios-message-empty-padding-bottom: 12px;
$alert-ios-message-empty-padding-bottom: 12px;
/// @prop - Padding start of the alert empty message
$alert-ios-message-empty-padding-start: 0;
$alert-ios-message-empty-padding-start: 0;
/// @prop - Maximum height of the alert content
$alert-ios-content-max-height: 240px;
$alert-ios-content-max-height: 240px;
/// @prop - Margin top of the alert input
$alert-ios-input-margin-top: 10px;
$alert-ios-input-margin-top: 10px;
/// @prop - Padding top on the alert input
$alert-ios-input-padding-top: 7px;
$alert-ios-input-padding-top: 7px;
/// @prop - Padding end on the alert input
$alert-ios-input-padding-end: $alert-ios-input-padding-top;
$alert-ios-input-padding-end: $alert-ios-input-padding-top;
/// @prop - Padding bottom on the alert input
$alert-ios-input-padding-bottom: $alert-ios-input-padding-top;
$alert-ios-input-padding-bottom: $alert-ios-input-padding-top;
/// @prop - Padding start on the alert input
$alert-ios-input-padding-start: $alert-ios-input-padding-end;
$alert-ios-input-padding-start: $alert-ios-input-padding-end;
/// @prop - Placeholder Color for input
$alert-ios-input-placeholder-color: $placeholder-text-color;
$alert-ios-input-placeholder-color: $placeholder-text-color;
/// @prop - Border color of the alert input
$alert-ios-input-border-color: $background-color-step-250;
$alert-ios-input-border-color: $background-color-step-250;
/// @prop - Border of the alert input
$alert-ios-input-border: $hairlines-width solid $alert-ios-input-border-color;
$alert-ios-input-border: $hairlines-width solid $alert-ios-input-border-color;
/// @prop - Border radius of the alert input
$alert-ios-input-border-radius: 7px;
$alert-ios-input-border-radius: 7px;
/// @prop - Background color of the alert input
$alert-ios-input-background-color: $background-color;
$alert-ios-input-background-color: $background-color;
/// @prop - Flex wrap of the alert button group
$alert-ios-button-group-flex-wrap: wrap;
$alert-ios-button-group-flex-wrap: wrap;
/// @prop - Flex of the alert button
$alert-ios-button-flex: 1 1 auto;
$alert-ios-button-flex: 1 1 auto;
/// @prop - Margin of the alert button
$alert-ios-button-margin: 0;
$alert-ios-button-margin: 0;
/// @prop - Min width of the alert button
$alert-ios-button-min-width: 50%;
$alert-ios-button-min-width: 50%;
/// @prop - Height of the alert button
/**
@@ -147,172 +147,172 @@ $alert-ios-button-min-width: 50%;
* a hairline (<1px) width, this will cause subpixel rendering
* differences across browsers.
*/
$alert-ios-button-height: dynamic-font-min(1, 44px);
$alert-ios-button-height: dynamic-font-min(1, 44px);
/// @prop - Padding of the alert button
$alert-ios-button-padding: 8px;
/// @prop - Font size of the alert button
$alert-ios-button-font-size: dynamic-font-min(1, 17px);
$alert-ios-button-font-size: dynamic-font-min(1, 17px);
/// @prop - Color of the text in the alert button
$alert-ios-button-text-color: ion-color(primary, base);
$alert-ios-button-text-color: ion-color(primary, base);
/// @prop - Destructive text color of the alert button
$alert-ios-button-destructive-text-color: ion-color(danger, base);
$alert-ios-button-destructive-text-color: ion-color(danger, base);
/// @prop - Background color of the alert button
$alert-ios-button-background-color: transparent;
$alert-ios-button-background-color: transparent;
/// @prop - Background color alpha of the alert activated button
$alert-ios-button-background-color-alpha-activated: .1;
$alert-ios-button-background-color-alpha-activated: 0.1;
/// @prop - Background color of the alert activated button
$alert-ios-button-background-color-activated: rgba($text-color-rgb, $alert-ios-button-background-color-alpha-activated);
$alert-ios-button-background-color-activated: rgba($text-color-rgb, $alert-ios-button-background-color-alpha-activated);
/// @prop - Border width of the alert button
$alert-ios-button-border-width: $hairlines-width;
$alert-ios-button-border-width: $hairlines-width;
/// @prop - Border style of the alert button
$alert-ios-button-border-style: solid;
$alert-ios-button-border-style: solid;
/// @prop - Border color alpha of the alert button
$alert-ios-button-border-color-alpha: .2;
$alert-ios-button-border-color-alpha: 0.2;
/// @prop - Border color of the alert button
$alert-ios-button-border-color: rgba($text-color-rgb, $alert-ios-button-border-color-alpha);
$alert-ios-button-border-color: rgba($text-color-rgb, $alert-ios-button-border-color-alpha);
/// @prop - Border radius of the alert button
$alert-ios-button-border-radius: 0;
$alert-ios-button-border-radius: 0;
/// @prop - Font weight of the main text on the alert button
$alert-ios-button-main-font-weight: bold;
$alert-ios-button-main-font-weight: bold;
/// @prop - Border top of the alert list
$alert-ios-list-border-top: $alert-ios-button-border-width $alert-ios-button-border-style $alert-ios-button-border-color;
$alert-ios-list-border-top: $alert-ios-button-border-width $alert-ios-button-border-style $alert-ios-button-border-color;
/// @prop - Padding top on the label for the radio alert
$alert-ios-radio-label-padding-top: 13px;
$alert-ios-radio-label-padding-top: 13px;
/// @prop - Padding end on the label for the radio alert
$alert-ios-radio-label-padding-end: $alert-ios-radio-label-padding-top;
$alert-ios-radio-label-padding-end: $alert-ios-radio-label-padding-top;
/// @prop - Padding bottom on the label for the radio alert
$alert-ios-radio-label-padding-bottom: $alert-ios-radio-label-padding-top;
$alert-ios-radio-label-padding-bottom: $alert-ios-radio-label-padding-top;
/// @prop - Padding start on the label for the radio alert
$alert-ios-radio-label-padding-start: $alert-ios-radio-label-padding-end;
$alert-ios-radio-label-padding-start: $alert-ios-radio-label-padding-end;
/// @prop - Text color of the label for the radio alert
$alert-ios-radio-label-text-color: $text-color;
$alert-ios-radio-label-text-color: $text-color;
/// @prop - Text color of the label for the checked radio alert
$alert-ios-radio-label-text-color-checked: $alert-ios-button-text-color;
$alert-ios-radio-label-text-color-checked: $alert-ios-button-text-color;
/// @prop - Min width of the radio alert
$alert-ios-radio-min-width: 30px;
$alert-ios-radio-min-width: 30px;
/// @prop - Top of the icon in the radio alert
$alert-ios-radio-icon-top: -7px;
$alert-ios-radio-icon-top: -7px;
/// @prop - Start of the icon in the radio alert
$alert-ios-radio-icon-start: 7px;
$alert-ios-radio-icon-start: 7px;
/// @prop - Width of the icon in the radio alert
$alert-ios-radio-icon-width: 6px;
$alert-ios-radio-icon-width: 6px;
/// @prop - Height of the icon in the radio alert
$alert-ios-radio-icon-height: 12px;
$alert-ios-radio-icon-height: 12px;
/// @prop - Border width of the icon in the radio alert
$alert-ios-radio-icon-border-width: 2px;
$alert-ios-radio-icon-border-width: 2px;
/// @prop - Border style of the icon in the radio alert
$alert-ios-radio-icon-border-style: solid;
$alert-ios-radio-icon-border-style: solid;
/// @prop - Border color of the icon in the radio alert
$alert-ios-radio-icon-border-color: $alert-ios-button-text-color;
$alert-ios-radio-icon-border-color: $alert-ios-button-text-color;
/// @prop - Transform of the icon in the radio alert
$alert-ios-radio-icon-transform: rotate(45deg);
$alert-ios-radio-icon-transform: rotate(45deg);
/// @prop - Padding top of the label for the checkbox in the alert
$alert-ios-checkbox-label-padding-top: 13px;
$alert-ios-checkbox-label-padding-top: 13px;
/// @prop - Padding end of the label for the checkbox in the alert
$alert-ios-checkbox-label-padding-end: $alert-ios-checkbox-label-padding-top;
$alert-ios-checkbox-label-padding-end: $alert-ios-checkbox-label-padding-top;
/// @prop - Padding bottom of the label for the checkbox in the alert
$alert-ios-checkbox-label-padding-bottom: $alert-ios-checkbox-label-padding-top;
$alert-ios-checkbox-label-padding-bottom: $alert-ios-checkbox-label-padding-top;
/// @prop - Padding start of the label for the checkbox in the alert
$alert-ios-checkbox-label-padding-start: $alert-ios-checkbox-label-padding-end;
$alert-ios-checkbox-label-padding-start: $alert-ios-checkbox-label-padding-end;
/// @prop - Text color of the label for the checkbox in the alert
$alert-ios-checkbox-label-text-color: $text-color;
$alert-ios-checkbox-label-text-color: $text-color;
/// @prop - Margin top of the checkbox in the alert
$alert-ios-checkbox-margin-top: 10px;
$alert-ios-checkbox-margin-top: 10px;
/// @prop - Margin end of the checkbox in the alert
$alert-ios-checkbox-margin-end: 6px;
$alert-ios-checkbox-margin-end: 6px;
/// @prop - Margin bottom of the checkbox in the alert
$alert-ios-checkbox-margin-bottom: 10px;
$alert-ios-checkbox-margin-bottom: 10px;
/// @prop - Margin start of the checkbox in the alert
$alert-ios-checkbox-margin-start: 16px;
$alert-ios-checkbox-margin-start: 16px;
/// @prop - Size of the checkbox in the alert
$alert-ios-checkbox-size: dynamic-font-max(22px, 2.538);
$alert-ios-checkbox-size: dynamic-font-max(22px, 2.538);
/// @prop - Border width of the checkbox in the alert
$alert-ios-checkbox-border-width: dynamic-font(2px);
$alert-ios-checkbox-border-width: dynamic-font(2px);
/// @prop - Border style of the checkbox in the alert
$alert-ios-checkbox-border-style: solid;
$alert-ios-checkbox-border-style: solid;
/// @prop - Border radius of the checkbox in the alert
$alert-ios-checkbox-border-radius: 50%;
$alert-ios-checkbox-border-radius: 50%;
/// @prop - Border color of the checkbox in the alert when off
$alert-ios-checkbox-border-color-off: $item-ios-border-color;
$alert-ios-checkbox-border-color-off: $item-ios-border-color;
/// @prop - Border color of the checkbox in the alert when on
$alert-ios-checkbox-border-color-on: ion-color(primary, base);
$alert-ios-checkbox-border-color-on: ion-color(primary, base);
/// @prop - Background color of the checkbox in the alert when off
$alert-ios-checkbox-background-color-off: $item-ios-background;
$alert-ios-checkbox-background-color-off: $item-ios-background;
/// @prop - Background color of the checkbox in the alert when on
$alert-ios-checkbox-background-color-on: ion-color(primary, base);
$alert-ios-checkbox-background-color-on: ion-color(primary, base);
/// @prop - Top of the icon in the checkbox alert
$alert-ios-checkbox-icon-top: calc($alert-ios-checkbox-size / 8);
$alert-ios-checkbox-icon-top: calc($alert-ios-checkbox-size / 8);
/// @prop - Start of the icon in the checkbox alert
$alert-ios-checkbox-icon-start: calc($alert-ios-checkbox-size / 3);
$alert-ios-checkbox-icon-start: calc($alert-ios-checkbox-size / 3);
/// @prop - Width of the icon in the checkbox alert
$alert-ios-checkbox-icon-width: calc($alert-ios-checkbox-size / 6 + 1px);
$alert-ios-checkbox-icon-width: calc($alert-ios-checkbox-size / 6 + 1px);
/// @prop - Height of the icon in the checkbox alert
$alert-ios-checkbox-icon-height: calc($alert-ios-checkbox-size * 0.5);
$alert-ios-checkbox-icon-height: calc($alert-ios-checkbox-size * 0.5);
/// @prop - Border width of the icon in the checkbox alert
$alert-ios-checkbox-icon-border-width: $alert-ios-checkbox-border-width;
$alert-ios-checkbox-icon-border-width: $alert-ios-checkbox-border-width;
/// @prop - Border style of the icon in the checkbox alert
$alert-ios-checkbox-icon-border-style: $alert-ios-checkbox-border-style;
$alert-ios-checkbox-icon-border-style: $alert-ios-checkbox-border-style;
/// @prop - Border color of the icon in the checkbox alert
$alert-ios-checkbox-icon-border-color: $background-color;
$alert-ios-checkbox-icon-border-color: $background-color;
/// @prop - Transform of the icon in the checkbox alert
$alert-ios-checkbox-icon-transform: rotate(45deg);
$alert-ios-checkbox-icon-transform: rotate(45deg);
/// @prop - Filter of the translucent alert
$alert-ios-translucent-filter: saturate(180%) blur(20px);
$alert-ios-translucent-filter: saturate(180%) blur(20px);
/// @prop - Height of the tappable inputs in the checkbox alert
$alert-ios-tappable-height: $item-ios-min-height;
$alert-ios-tappable-height: $item-ios-min-height;

View File

@@ -22,7 +22,12 @@
// --------------------------------------------------
.alert-head {
@include padding($alert-md-head-padding-top, $alert-md-head-padding-end, $alert-md-head-padding-bottom, $alert-md-head-padding-start);
@include padding(
$alert-md-head-padding-top,
$alert-md-head-padding-end,
$alert-md-head-padding-bottom,
$alert-md-head-padding-start
);
text-align: $alert-md-head-text-align;
}
@@ -40,13 +45,17 @@
font-size: $alert-md-sub-title-font-size;
}
// Material Design Alert Message
// --------------------------------------------------
.alert-message,
.alert-input-group {
@include padding($alert-md-message-padding-top, $alert-md-message-padding-end, $alert-md-message-padding-bottom, $alert-md-message-padding-start);
@include padding(
$alert-md-message-padding-top,
$alert-md-message-padding-end,
$alert-md-message-padding-bottom,
$alert-md-message-padding-start
);
color: $alert-md-message-text-color;
}
@@ -67,19 +76,28 @@
}
.alert-message:empty {
@include padding($alert-md-message-empty-padding-top, $alert-md-message-empty-padding-end, $alert-md-message-empty-padding-bottom, $alert-md-message-empty-padding-start);
@include padding(
$alert-md-message-empty-padding-top,
$alert-md-message-empty-padding-end,
$alert-md-message-empty-padding-bottom,
$alert-md-message-empty-padding-start
);
}
.alert-head + .alert-message {
padding-top: 0;
}
// Material Design Alert Input
// --------------------------------------------------
.alert-input {
@include margin($alert-md-input-margin-top, $alert-md-input-margin-end, $alert-md-input-margin-bottom, $alert-md-input-margin-start);
@include margin(
$alert-md-input-margin-top,
$alert-md-input-margin-end,
$alert-md-input-margin-bottom,
$alert-md-input-margin-start
);
border-bottom: $alert-md-input-border-width $alert-md-input-border-style $alert-md-input-border-color;
@@ -100,10 +118,10 @@
.alert-input:focus {
@include margin(null, null, $alert-md-input-margin-bottom - 1, null);
border-bottom: $alert-md-input-border-width-focused $alert-md-input-border-style-focused $alert-md-input-border-color-focused;
border-bottom: $alert-md-input-border-width-focused $alert-md-input-border-style-focused
$alert-md-input-border-color-focused;
}
// Material Design Alert Radio/Checkbox Group
// --------------------------------------------------
@@ -135,12 +153,16 @@
min-height: $alert-md-tappable-height;
}
// Material Design Alert Radio
// --------------------------------------------------
.alert-radio-label {
@include padding($alert-md-radio-label-padding-top, $alert-md-radio-label-padding-end, $alert-md-radio-label-padding-bottom, $alert-md-radio-label-padding-start);
@include padding(
$alert-md-radio-label-padding-top,
$alert-md-radio-label-padding-end,
$alert-md-radio-label-padding-bottom,
$alert-md-radio-label-padding-start
);
flex: 1;
@@ -186,28 +208,31 @@
background-color: $alert-md-radio-border-color-on;
}
// Material Design Alert Radio Checked
// ---------------------------------------------------
[aria-checked=true] .alert-radio-label {
[aria-checked="true"] .alert-radio-label {
color: $alert-md-radio-label-text-color-checked;
}
[aria-checked=true] .alert-radio-icon {
[aria-checked="true"] .alert-radio-icon {
border-color: $alert-md-radio-border-color-on;
}
[aria-checked=true] .alert-radio-inner {
[aria-checked="true"] .alert-radio-inner {
transform: $alert-md-radio-icon-transform-on;
}
// Material Design Alert Checkbox Label
// --------------------------------------------------
.alert-checkbox-label {
@include padding($alert-md-checkbox-label-padding-top, $alert-md-checkbox-label-padding-end, $alert-md-checkbox-label-padding-bottom, $alert-md-checkbox-label-padding-start);
@include padding(
$alert-md-checkbox-label-padding-top,
$alert-md-checkbox-label-padding-end,
$alert-md-checkbox-label-padding-bottom,
$alert-md-checkbox-label-padding-start
);
flex: 1;
@@ -220,7 +245,6 @@
font-size: $alert-md-checkbox-label-font-size;
}
// Material Design Alert Checkbox Outline: Unchecked
// --------------------------------------------------
@@ -243,13 +267,13 @@
// Material Design Alert Checkbox Checkmark: Checked
// --------------------------------------------------
[aria-checked=true] .alert-checkbox-icon {
[aria-checked="true"] .alert-checkbox-icon {
border-color: $alert-md-checkbox-border-color-on;
background-color: $alert-md-checkbox-border-color-on;
}
[aria-checked=true] .alert-checkbox-inner {
[aria-checked="true"] .alert-checkbox-inner {
@include position($alert-md-checkbox-icon-top, null, null, $alert-md-checkbox-icon-start);
position: absolute;
@@ -266,7 +290,6 @@
border-color: $alert-md-checkbox-icon-border-color;
}
// Material Design Alert Button
// --------------------------------------------------
@@ -281,8 +304,18 @@
.alert-button {
@include border-radius($alert-md-button-border-radius);
@include margin($alert-md-button-margin-top, $alert-md-button-margin-end, $alert-md-button-margin-bottom, $alert-md-button-margin-start);
@include padding($alert-md-button-padding-top, $alert-md-button-padding-end, $alert-md-button-padding-bottom, $alert-md-button-padding-start);
@include margin(
$alert-md-button-margin-top,
$alert-md-button-margin-end,
$alert-md-button-margin-bottom,
$alert-md-button-margin-start
);
@include padding(
$alert-md-button-padding-top,
$alert-md-button-padding-end,
$alert-md-button-padding-bottom,
$alert-md-button-padding-start
);
// necessary for ripple to work properly
position: relative;

View File

@@ -1,14 +1,14 @@
@import "../../themes/ionic.globals.md";
@import "../../themes/native/native.globals.md";
@import "../item/item.md.vars";
// Material Design Alert
// --------------------------------------------------
/// @prop - Font size of the alert
$alert-md-font-size: dynamic-font(14px);
$alert-md-font-size: dynamic-font(14px);
/// @prop - Max width of the alert
$alert-md-max-width: 280px;
$alert-md-max-width: 280px;
/// @prop - Max width of the alert on a tablet
/**
@@ -19,313 +19,314 @@ $alert-md-max-width: 280px;
* 3. The height can increase up to 560px.
* Source: https://m2.material.io/components/dialogs#behavior
*/
$alert-md-max-width-tablet: min(calc(100vw - 96px), 560px);
$alert-md-max-width-tablet: min(calc(100vw - 96px), 560px);
/// @prop - Max width of the alert on a tablet
$alert-md-max-height-tablet: min(calc(100vh - 96px), 560px);
$alert-md-max-height-tablet: min(calc(100vh - 96px), 560px);
/// @prop - Border radius of the alert
$alert-md-border-radius: 4px;
$alert-md-border-radius: 4px;
/// @prop - Background color of the alert
$alert-md-background-color: $overlay-md-background-color;
$alert-md-background-color: $overlay-md-background-color;
/// @prop - Box shadow color of the alert
$alert-md-box-shadow: 0 11px 15px -7px rgba(0, 0, 0, .2), 0 24px 38px 3px rgba(0, 0, 0, .14), 0 9px 46px 8px rgba(0, 0, 0, .12);
$alert-md-box-shadow: 0 11px 15px -7px rgba(0, 0, 0, 0.2), 0 24px 38px 3px rgba(0, 0, 0, 0.14),
0 9px 46px 8px rgba(0, 0, 0, 0.12);
/// @prop - Padding top of the alert head
$alert-md-head-padding-top: 20px;
$alert-md-head-padding-top: 20px;
/// @prop - Padding end of the alert head
$alert-md-head-padding-end: 23px;
$alert-md-head-padding-end: 23px;
/// @prop - Padding bottom of the alert head
$alert-md-head-padding-bottom: 15px;
$alert-md-head-padding-bottom: 15px;
/// @prop - Padding start of the alert head
$alert-md-head-padding-start: $alert-md-head-padding-end;
$alert-md-head-padding-start: $alert-md-head-padding-end;
/// @prop - Text align of the alert head
$alert-md-head-text-align: start;
$alert-md-head-text-align: start;
/// @prop - Color of the alert title
$alert-md-title-color: $text-color;
$alert-md-title-color: $text-color;
/// @prop - Font size of the alert title
$alert-md-title-font-size: dynamic-font(20px);
$alert-md-title-font-size: dynamic-font(20px);
/// @prop - Font weight of the alert title
$alert-md-title-font-weight: 500;
$alert-md-title-font-weight: 500;
/// @prop - Font size of the alert sub title
$alert-md-sub-title-font-size: dynamic-font(16px);
$alert-md-sub-title-font-size: dynamic-font(16px);
/// @prop - Text color of the alert sub title
$alert-md-sub-title-text-color: $text-color;
$alert-md-sub-title-text-color: $text-color;
/// @prop - Padding top of the alert message
$alert-md-message-padding-top: 20px;
$alert-md-message-padding-top: 20px;
/// @prop - Padding end of the alert message
$alert-md-message-padding-end: 24px;
$alert-md-message-padding-end: 24px;
/// @prop - Padding bottom of the alert message
$alert-md-message-padding-bottom: $alert-md-message-padding-top;
$alert-md-message-padding-bottom: $alert-md-message-padding-top;
/// @prop - Padding start of the alert message
$alert-md-message-padding-start: $alert-md-message-padding-end;
$alert-md-message-padding-start: $alert-md-message-padding-end;
/// @prop - Font size of the alert message
$alert-md-message-font-size: dynamic-font(16px);
$alert-md-message-font-size: dynamic-font(16px);
/// @prop - Text color of the alert message
$alert-md-message-text-color: $text-color-step-450;
$alert-md-message-text-color: $text-color-step-450;
/// @prop - Padding top of the alert empty message
$alert-md-message-empty-padding-top: 0;
$alert-md-message-empty-padding-top: 0;
/// @prop - Padding end of the alert empty message
$alert-md-message-empty-padding-end: $alert-md-message-empty-padding-top;
$alert-md-message-empty-padding-end: $alert-md-message-empty-padding-top;
/// @prop - Padding bottom of the alert empty message
$alert-md-message-empty-padding-bottom: $alert-md-message-empty-padding-top;
$alert-md-message-empty-padding-bottom: $alert-md-message-empty-padding-top;
/// @prop - Padding start of the alert empty message
$alert-md-message-empty-padding-start: $alert-md-message-empty-padding-end;
$alert-md-message-empty-padding-start: $alert-md-message-empty-padding-end;
/// @prop - Maximum height of the alert content
$alert-md-content-max-height: 266px;
$alert-md-content-max-height: 266px;
/// @prop - Border width of the alert input
$alert-md-input-border-width: 1px;
$alert-md-input-border-width: 1px;
/// @prop - Border style of the alert input
$alert-md-input-border-style: solid;
$alert-md-input-border-style: solid;
/// @prop - Border color of the alert input
$alert-md-input-border-color: $background-color-step-150;
$alert-md-input-border-color: $background-color-step-150;
/// @prop - Text color of the alert input
$alert-md-input-text-color: $text-color;
$alert-md-input-text-color: $text-color;
/// @prop - Border width of the alert input when focused
$alert-md-input-border-width-focused: 2px;
$alert-md-input-border-width-focused: 2px;
/// @prop - Border style of the alert input when focused
$alert-md-input-border-style-focused: $alert-md-input-border-style;
$alert-md-input-border-style-focused: $alert-md-input-border-style;
/// @prop - Border color of the alert input when focused
$alert-md-input-border-color-focused: ion-color(primary, base);
$alert-md-input-border-color-focused: ion-color(primary, base);
/// @prop - Margin top of the alert input
$alert-md-input-margin-top: 5px;
$alert-md-input-margin-top: 5px;
/// @prop - Margin end of the alert input
$alert-md-input-margin-end: 0;
$alert-md-input-margin-end: 0;
/// @prop - Margin bottom of the alert input
$alert-md-input-margin-bottom: 5px;
$alert-md-input-margin-bottom: 5px;
/// @prop - Margin start of the alert input
$alert-md-input-margin-start: 0;
$alert-md-input-margin-start: 0;
/// @prop - Placeholder Color for input
$alert-md-input-placeholder-color: $placeholder-text-color;
$alert-md-input-placeholder-color: $placeholder-text-color;
/// @prop - Flex wrap of the alert button group
$alert-md-button-group-flex-wrap: wrap-reverse;
$alert-md-button-group-flex-wrap: wrap-reverse;
/// @prop - Justify content of the alert button group
$alert-md-button-group-justify-content: flex-end;
$alert-md-button-group-justify-content: flex-end;
/// @prop - Padding top of the alert button
$alert-md-button-padding-top: 10px;
$alert-md-button-padding-top: 10px;
/// @prop - Padding end of the alert button
$alert-md-button-padding-end: $alert-md-button-padding-top;
$alert-md-button-padding-end: $alert-md-button-padding-top;
/// @prop - Padding bottom of the alert button
$alert-md-button-padding-bottom: $alert-md-button-padding-top;
$alert-md-button-padding-bottom: $alert-md-button-padding-top;
/// @prop - Padding start of the alert button
$alert-md-button-padding-start: $alert-md-button-padding-end;
$alert-md-button-padding-start: $alert-md-button-padding-end;
/// @prop - Margin top of the alert button
$alert-md-button-margin-top: 0;
$alert-md-button-margin-top: 0;
/// @prop - Margin end of the alert button
$alert-md-button-margin-end: 8px;
$alert-md-button-margin-end: 8px;
/// @prop - Margin bottom of the alert button
$alert-md-button-margin-bottom: 0;
$alert-md-button-margin-bottom: 0;
/// @prop - Margin start of the alert button
$alert-md-button-margin-start: 0;
$alert-md-button-margin-start: 0;
/// @prop - Font weight of the alert button
$alert-md-button-font-weight: 500;
$alert-md-button-font-weight: 500;
/// @prop - Text color of the alert button
$alert-md-button-text-color: ion-color(primary, base);
$alert-md-button-text-color: ion-color(primary, base);
/// @prop - Background color of the alert button
$alert-md-button-background-color: transparent;
$alert-md-button-background-color: transparent;
/// @prop - Border radius of the alert button
$alert-md-button-border-radius: 2px;
$alert-md-button-border-radius: 2px;
/// @prop - Text transform of the alert button
$alert-md-button-text-transform: uppercase;
$alert-md-button-text-transform: uppercase;
/// @prop - Text align of the alert button
$alert-md-button-text-align: end;
$alert-md-button-text-align: end;
/// @prop - Border top of the alert list
$alert-md-list-border-top: 1px solid $alert-md-input-border-color;
$alert-md-list-border-top: 1px solid $alert-md-input-border-color;
/// @prop - Border bottom of the alert list
$alert-md-list-border-bottom: $alert-md-list-border-top;
$alert-md-list-border-bottom: $alert-md-list-border-top;
/// @prop - Top of the alert radio
$alert-md-radio-top: 0;
$alert-md-radio-top: 0;
/// @prop - Left of the alert radio
$alert-md-radio-left: 26px;
$alert-md-radio-left: 26px;
/// @prop - Width of the alert radio
$alert-md-radio-width: 20px;
$alert-md-radio-width: 20px;
/// @prop - Height of the alert radio
$alert-md-radio-height: $alert-md-radio-width;
$alert-md-radio-height: $alert-md-radio-width;
/// @prop - Border width of the alert radio
$alert-md-radio-border-width: 2px;
$alert-md-radio-border-width: 2px;
/// @prop - Border style of the alert radio
$alert-md-radio-border-style: solid;
$alert-md-radio-border-style: solid;
/// @prop - Border radius of the alert radio
$alert-md-radio-border-radius: 50%;
$alert-md-radio-border-radius: 50%;
/// @prop - Border color of the alert radio when off
$alert-md-radio-border-color-off: $background-color-step-550;
$alert-md-radio-border-color-off: $background-color-step-550;
/// @prop - Border color of the alert radio when on
$alert-md-radio-border-color-on: $alert-md-button-text-color;
$alert-md-radio-border-color-on: $alert-md-button-text-color;
/// @prop - Width of the icon in the alert radio
$alert-md-radio-icon-width: $alert-md-radio-width * 0.5;
$alert-md-radio-icon-width: $alert-md-radio-width * 0.5;
/// @prop - Height of the icon in the alert radio
$alert-md-radio-icon-height: $alert-md-radio-icon-width;
$alert-md-radio-icon-height: $alert-md-radio-icon-width;
/// @prop - Top of the icon in the alert radio
$alert-md-radio-icon-top: ($alert-md-radio-width - $alert-md-radio-icon-width - $alert-md-radio-border-width * 2) * 0.5;
$alert-md-radio-icon-top: ($alert-md-radio-width - $alert-md-radio-icon-width - $alert-md-radio-border-width * 2) * 0.5;
/// @prop - Start of the icon in the radio alert
$alert-md-radio-icon-start: $alert-md-radio-icon-top;
$alert-md-radio-icon-start: $alert-md-radio-icon-top;
/// @prop - Border radius of the icon in the alert radio
$alert-md-radio-icon-border-radius: $alert-md-radio-border-radius;
$alert-md-radio-icon-border-radius: $alert-md-radio-border-radius;
/// @prop - Transform of the icon in the alert radio when off
$alert-md-radio-icon-transform-off: scale3d(0, 0, 0);
$alert-md-radio-icon-transform-off: scale3d(0, 0, 0);
/// @prop - Transform of the icon in the alert radio when on
$alert-md-radio-icon-transform-on: scale3d(1, 1, 1);
$alert-md-radio-icon-transform-on: scale3d(1, 1, 1);
/// @prop - Transition of the icon in the alert radio
$alert-md-radio-icon-transition: transform 280ms cubic-bezier(.4, 0, .2, 1);
$alert-md-radio-icon-transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
/// @prop - Padding top on the label for the radio alert
$alert-md-radio-label-padding-top: 13px;
$alert-md-radio-label-padding-top: 13px;
/// @prop - Padding end on the label for the radio alert
$alert-md-radio-label-padding-end: 26px;
$alert-md-radio-label-padding-end: 26px;
/// @prop - Padding bottom on the label for the radio alert
$alert-md-radio-label-padding-bottom: $alert-md-radio-label-padding-top;
$alert-md-radio-label-padding-bottom: $alert-md-radio-label-padding-top;
/// @prop - Padding start on the label for the radio alert
$alert-md-radio-label-padding-start: $alert-md-radio-label-padding-end + 26px;
$alert-md-radio-label-padding-start: $alert-md-radio-label-padding-end + 26px;
/// @prop - Font size of the label for the radio alert
$alert-md-radio-label-font-size: dynamic-font(16px);
$alert-md-radio-label-font-size: dynamic-font(16px);
/// @prop - Text color of the label for the radio alert
$alert-md-radio-label-text-color: $text-color-step-150;
$alert-md-radio-label-text-color: $text-color-step-150;
/// @prop - Text color of the label for the checked radio alert
$alert-md-radio-label-text-color-checked: $alert-md-radio-label-text-color;
$alert-md-radio-label-text-color-checked: $alert-md-radio-label-text-color;
/// @prop - Top of the checkbox in the alert
$alert-md-checkbox-top: 0;
$alert-md-checkbox-top: 0;
/// @prop - Left of the checkbox in the alert
$alert-md-checkbox-left: 26px;
$alert-md-checkbox-left: 26px;
/// @prop - Width of the checkbox in the alert
$alert-md-checkbox-width: 16px;
$alert-md-checkbox-width: 16px;
/// @prop - Height of the checkbox in the alert
$alert-md-checkbox-height: 16px;
$alert-md-checkbox-height: 16px;
/// @prop - Border width of the checkbox in the alert
$alert-md-checkbox-border-width: 2px;
$alert-md-checkbox-border-width: 2px;
/// @prop - Border style of the checkbox in the alert
$alert-md-checkbox-border-style: solid;
$alert-md-checkbox-border-style: solid;
/// @prop - Border radius of the checkbox in the alert
$alert-md-checkbox-border-radius: 2px;
$alert-md-checkbox-border-radius: 2px;
/// @prop - Border color of the checkbox in the alert when off
$alert-md-checkbox-border-color-off: $background-color-step-550;
$alert-md-checkbox-border-color-off: $background-color-step-550;
/// @prop - Border color of the checkbox in the alert when on
$alert-md-checkbox-border-color-on: $alert-md-button-text-color;
$alert-md-checkbox-border-color-on: $alert-md-button-text-color;
/// @prop - Top of the icon in the checkbox alert
$alert-md-checkbox-icon-top: 0;
$alert-md-checkbox-icon-top: 0;
/// @prop - Start of the icon in the checkbox alert
$alert-md-checkbox-icon-start: 3px;
$alert-md-checkbox-icon-start: 3px;
/// @prop - Width of the icon in the checkbox alert
$alert-md-checkbox-icon-width: 6px;
$alert-md-checkbox-icon-width: 6px;
/// @prop - Height of the icon in the checkbox alert
$alert-md-checkbox-icon-height: 10px;
$alert-md-checkbox-icon-height: 10px;
/// @prop - Border width of the icon in the checkbox alert
$alert-md-checkbox-icon-border-width: 2px;
$alert-md-checkbox-icon-border-width: 2px;
/// @prop - Border style of the icon in the checkbox alert
$alert-md-checkbox-icon-border-style: solid;
$alert-md-checkbox-icon-border-style: solid;
/// @prop - Border color of the icon in the checkbox alert
$alert-md-checkbox-icon-border-color: ion-color(primary, contrast);
$alert-md-checkbox-icon-border-color: ion-color(primary, contrast);
/// @prop - Transform of the icon in the checkbox alert
$alert-md-checkbox-icon-transform: rotate(45deg);
$alert-md-checkbox-icon-transform: rotate(45deg);
/// @prop - Padding top of the label for the checkbox in the alert
$alert-md-checkbox-label-padding-top: 13px;
$alert-md-checkbox-label-padding-top: 13px;
/// @prop - Padding end of the label for the checkbox in the alert
$alert-md-checkbox-label-padding-end: $alert-md-checkbox-left;
$alert-md-checkbox-label-padding-end: $alert-md-checkbox-left;
/// @prop - Padding bottom of the label for the checkbox in the alert
$alert-md-checkbox-label-padding-bottom: $alert-md-checkbox-label-padding-top;
$alert-md-checkbox-label-padding-bottom: $alert-md-checkbox-label-padding-top;
/// @prop - Padding start of the label for the checkbox in the alert
$alert-md-checkbox-label-padding-start: $alert-md-checkbox-label-padding-end + 27px;
$alert-md-checkbox-label-padding-start: $alert-md-checkbox-label-padding-end + 27px;
/// @prop - Text color of the label for the checkbox in the alert
$alert-md-checkbox-label-text-color: $text-color-step-150;
$alert-md-checkbox-label-text-color: $text-color-step-150;
/// @prop - Font size of the label for the checkbox in the alert
$alert-md-checkbox-label-font-size: dynamic-font(16px);
$alert-md-checkbox-label-font-size: dynamic-font(16px);
/// @prop - Height of the tappable inputs in the checkbox alert
$alert-md-tappable-height: $item-md-min-height;
$alert-md-tappable-height: $item-md-min-height;

View File

@@ -198,14 +198,13 @@
min-height: inherit;
}
// Alert Button: Disabled
// --------------------------------------------------
.alert-input-disabled,
.alert-checkbox-button-disabled .alert-button-inner,
.alert-radio-button-disabled .alert-button-inner {
cursor: default;
opacity: .5;
opacity: 0.5;
pointer-events: none;
}

View File

@@ -21,7 +21,7 @@ import { sanitizeDOMString } from '@utils/sanitization';
import { getClassMap } from '@utils/theme';
import { config } from '../../global/config';
import { getIonMode } from '../../global/ionic-global';
import { getIonMode, getIonTheme } from '../../global/ionic-global';
import type { AnimationBuilder, CssClassMap, OverlayInterface, FrameworkDelegate } from '../../interface';
import type { OverlayEventDetail } from '../../utils/overlays-interface';
import type { IonicSafeString } from '../../utils/sanitization';
@@ -35,13 +35,15 @@ import { mdLeaveAnimation } from './animations/md.leave';
// TODO(FW-2832): types
/**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
* @virtualProp {"ios" | "md"} mode - The mode determines the platform behaviors of the component.
* @virtualProp {"ios" | "md" | "ionic"} theme - The theme determines the visual appearance of the component.
*/
@Component({
tag: 'ion-alert',
styleUrls: {
ios: 'alert.ios.scss',
md: 'alert.md.scss',
ionic: 'alert.md.scss',
},
scoped: true,
})
@@ -135,7 +137,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
/**
* If `true`, the alert will be translucent.
* Only applies when the mode is `"ios"` and the device supports
* Only applies when the theme is `"ios"` and the device supports
* [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility).
*/
@Prop() translucent = false;
@@ -533,7 +535,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
private renderCheckbox() {
const inputs = this.processedInputs;
const mode = getIonMode(this);
const theme = getIonTheme(this);
if (inputs.length === 0) {
return null;
@@ -565,7 +567,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
</div>
<div class="alert-checkbox-label">{i.label}</div>
</div>
{mode === 'md' && <ion-ripple-effect></ion-ripple-effect>}
{theme === 'md' && <ion-ripple-effect></ion-ripple-effect>}
</button>
))}
</div>
@@ -682,7 +684,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
private renderAlertButtons() {
const buttons = this.processedButtons;
const mode = getIonMode(this);
const theme = getIonTheme(this);
const alertButtonGroupClass = {
'alert-button-group': true,
'alert-button-group-vertical': buttons.length > 2,
@@ -699,7 +701,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
onClick={() => this.buttonClick(button)}
>
<span class="alert-button-inner">{button.text}</span>
{mode === 'md' && <ion-ripple-effect></ion-ripple-effect>}
{theme === 'md' && <ion-ripple-effect></ion-ripple-effect>}
</button>
))}
</div>
@@ -721,7 +723,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
render() {
const { overlayIndex, header, subHeader, message, htmlAttributes } = this;
const mode = getIonMode(this);
const theme = getIonTheme(this);
const hdrId = `alert-${overlayIndex}-hdr`;
const subHdrId = `alert-${overlayIndex}-sub-hdr`;
const msgId = `alert-${overlayIndex}-msg`;
@@ -746,7 +748,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
}}
class={{
...getClassMap(this.cssClass),
[mode]: true,
[theme]: true,
'overlay-hidden': true,
'alert-translucent': this.translucent,
}}

View File

@@ -1,19 +1,19 @@
@import "../../themes/ionic.globals";
@import "../../themes/native/native.globals";
// Alert
// --------------------------------------------------
/// @prop - Minimum width of the alert
$alert-min-width: 250px;
$alert-min-width: 250px;
/// @prop - Maximum height of the alert
$alert-max-height: 90%;
$alert-max-height: 90%;
/// @prop - Line height of the alert button
$alert-button-line-height: dynamic-font(20px);
$alert-button-line-height: dynamic-font(20px);
/// @prop - Font size of the alert button
$alert-button-font-size: dynamic-font(14px);
$alert-button-font-size: dynamic-font(14px);
/// @prop - Minimum height of a textarea in the alert
$alert-input-min-height: 37px;
$alert-input-min-height: 37px;

View File

@@ -1,4 +1,3 @@
html.plt-mobile ion-app {
user-select: none;
}

View File

@@ -6,8 +6,12 @@ import { printIonWarning } from '@utils/logging';
import { isPlatform } from '@utils/platform';
import { config } from '../../global/config';
import { getIonMode } from '../../global/ionic-global';
import { getIonTheme } from '../../global/ionic-global';
/**
* @virtualProp {"ios" | "md"} mode - The mode determines the platform behaviors of the component.
* @virtualProp {"ios" | "md" | "ionic"} theme - The theme determines the visual appearance of the component.
*/
@Component({
tag: 'ion-app',
styleUrl: 'app.scss',
@@ -78,11 +82,11 @@ export class App implements ComponentInterface {
}
render() {
const mode = getIonMode(this);
const theme = getIonTheme(this);
return (
<Host
class={{
[mode]: true,
[theme]: true,
'ion-page': true,
'force-statusbar-padding': config.getBoolean('_forceStatusbarPadding'),
}}

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -0,0 +1,73 @@
@use "../../themes/ionic/ionic.globals.scss" as globals;
@import "./avatar";
// Ionic Avatar
// --------------------------------------------------
:host {
--padding-top: #{globals.$ionic-space-0};
--padding-bottom: #{globals.$ionic-space-0};
display: flex;
align-items: center;
justify-content: center;
background: globals.$ionic-color-neutral-100;
color: globals.$ionic-color-neutral-800;
font-weight: globals.$ionic-font-weight-regular;
line-height: globals.$ionic-line-height-600;
}
:host(:not(.avatar-image)) {
border: globals.$ionic-border-size-025 solid globals.$ionic-color-neutral-800;
}
// Avatar Sizes
// --------------------------------------------------
:host(.avatar-xsmall) {
--padding-end: #{globals.$ionic-space-050};
--padding-start: #{globals.$ionic-space-050};
width: globals.$ionic-scale-600;
height: globals.$ionic-scale-600;
font-size: globals.$ionic-font-size-300;
font-weight: globals.$ionic-font-weight-medium;
line-height: globals.$ionic-line-height-500;
}
:host(.avatar-small) {
--padding-end: #{globals.$ionic-space-150};
--padding-start: #{globals.$ionic-space-150};
width: globals.$ionic-scale-800;
height: globals.$ionic-scale-800;
font-size: globals.$ionic-font-size-350;
}
:host(.avatar-medium) {
--padding-end: #{globals.$ionic-space-200};
--padding-start: #{globals.$ionic-space-200};
width: globals.$ionic-scale-1000;
height: globals.$ionic-scale-1000;
font-size: globals.$ionic-font-size-400;
}
:host(.avatar-large) {
--padding-end: #{globals.$ionic-space-250};
--padding-start: #{globals.$ionic-space-250};
width: globals.$ionic-scale-1200;
height: globals.$ionic-scale-1200;
font-size: globals.$ionic-font-size-450;
}

View File

@@ -1,7 +1,6 @@
@import "./avatar";
@import "./avatar.ios.vars";
// iOS Avatar
// --------------------------------------------------

View File

@@ -1,14 +1,13 @@
@import "../../themes/ionic.globals.ios";
@import "../../themes/native/native.globals.ios";
// iOS Avatar
// --------------------------------------------------
/// @prop - Width of the avatar
$avatar-ios-width: 48px;
$avatar-ios-width: 48px;
/// @prop - Height of the avatar
$avatar-ios-height: $avatar-ios-width;
$avatar-ios-height: $avatar-ios-width;
/// @prop - Border radius of the avatar
$avatar-ios-border-radius: 50%;
$avatar-ios-border-radius: 50%;

View File

@@ -1,7 +1,6 @@
@import "./avatar";
@import "./avatar.md.vars";
// Material Design Avatar
// --------------------------------------------------

View File

@@ -1,14 +1,13 @@
@import "../../themes/ionic.globals.md";
@import "../../themes/native/native.globals.md";
// Material Design Avatar
// --------------------------------------------------
/// @prop - Width of the avatar
$avatar-md-width: 64px;
$avatar-md-width: 64px;
/// @prop - Height of the avatar
$avatar-md-height: $avatar-md-width;
$avatar-md-height: $avatar-md-width;
/// @prop - Border radius of the avatar
$avatar-md-border-radius: 50%;
$avatar-md-border-radius: 50%;

View File

@@ -1,5 +1,4 @@
@import "../../themes/ionic.globals";
@import "../../themes/native/native.globals";
// Avatar
// --------------------------------------------------

View File

@@ -1,20 +1,64 @@
import type { ComponentInterface } from '@stencil/core';
import { Component, Host, h } from '@stencil/core';
import { Component, Element, Host, Prop, h } from '@stencil/core';
import { getIonMode } from '../../global/ionic-global';
import { getIonTheme } from '../../global/ionic-global';
/**
* @virtualProp {"ios" | "md"} mode - The mode determines the platform behaviors of the component.
* @virtualProp {"ios" | "md" | "ionic"} theme - The theme determines the visual appearance of the component.
*/
@Component({
tag: 'ion-avatar',
styleUrls: {
ios: 'avatar.ios.scss',
md: 'avatar.md.scss',
ionic: 'avatar.ionic.scss',
},
shadow: true,
})
export class Avatar implements ComponentInterface {
@Element() el!: HTMLElement;
/**
* Set to `"xsmall"` for the smallest size, `"small"` for a compact size, `"medium"`
* for the default height and width, or to `"large"` for a larger size.
*
* Defaults to `"medium"` for the `ionic` theme, undefined for all other themes.
*/
@Prop() size?: `xsmall` | 'small' | 'medium' | 'large';
get hasImage() {
return !!this.el.querySelector('ion-img') || !!this.el.querySelector('img');
}
private getSize(): string | undefined {
const theme = getIonTheme(this);
const { size } = this;
// TODO(ROU-10752): Remove theme check when sizes are defined for all themes.
if (theme !== 'ionic') {
return undefined;
}
if (size === undefined) {
return 'medium';
}
return size;
}
render() {
const theme = getIonTheme(this);
const size = this.getSize();
return (
<Host class={getIonMode(this)}>
<Host
class={{
[theme]: true,
[`avatar-${size}`]: size !== undefined,
[`avatar-image`]: this.hasImage,
}}
>
<slot></slot>
</Host>
);

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,189 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';
/**
* This behavior does not vary across directions.
*/
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screenshot, title }) => {
test.describe(title('avatar: size'), () => {
test.describe('xsmall', () => {
test('should not have visual regressions when containing text', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="xsmall">AB</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-xsmall-text`));
});
test('should not have visual regressions when containing an icon', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="xsmall">
<ion-icon name="person-outline"></ion-icon>
</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-xsmall-icon`));
});
test('should not have visual regressions when containing an image', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="xsmall">
<img src="/src/components/avatar/test/avatar.svg"/>
</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-xsmall-image`));
});
});
test.describe('small', () => {
test('should not have visual regressions when containing text', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="small">AB</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-small-text`));
});
test('should not have visual regressions when containing an icon', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="small">
<ion-icon name="person-outline"></ion-icon>
</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-small-icon`));
});
test('should not have visual regressions when containing an image', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="small">
<img src="/src/components/avatar/test/avatar.svg"/>
</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-small-image`));
});
});
test.describe('medium', () => {
test('should not have visual regressions when containing text', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="medium">AB</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-medium-text`));
});
test('should not have visual regressions when containing an icon', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="medium">
<ion-icon name="person-outline"></ion-icon>
</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-medium-icon`));
});
test('should not have visual regressions when containing an image', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="medium">
<img src="/src/components/avatar/test/avatar.svg"/>
</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-medium-image`));
});
});
test.describe('large', () => {
test('should not have visual regressions when containing text', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="large">AB</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-large-text`));
});
test('should not have visual regressions when containing an icon', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="large">
<ion-icon name="person-outline"></ion-icon>
</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-large-icon`));
});
test('should not have visual regressions when containing an image', async ({ page }) => {
await page.setContent(
`
<ion-avatar size="large">
<img src="/src/components/avatar/test/avatar.svg"/>
</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-size-large-image`));
});
});
});
});

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

View File

@@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Avatar - Size</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
<script src="../../../../../scripts/testing/scripts.js"></script>
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
<style>
.container {
display: flex;
gap: 10px;
}
</style>
</head>
<body>
<ion-app>
<ion-header>
<ion-toolbar>
<ion-title>Avatar - Size</ion-title>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding" id="content" no-bounce>
<h2>Default</h2>
<div class="container">
<ion-avatar>AB</ion-avatar>
<ion-avatar>
<ion-icon name="person-outline"></ion-icon>
</ion-avatar>
<ion-avatar>
<img src="/src/components/avatar/test/avatar.svg" />
</ion-avatar>
</div>
<h2>Text</h2>
<div class="container">
<ion-avatar size="xsmall">AB</ion-avatar>
<ion-avatar size="small">AB</ion-avatar>
<ion-avatar size="medium">AB</ion-avatar>
<ion-avatar size="large">AB</ion-avatar>
</div>
<h2>Icons</h2>
<div class="container">
<ion-avatar size="xsmall">
<ion-icon name="person-outline"></ion-icon>
</ion-avatar>
<ion-avatar size="small">
<ion-icon name="person-outline"></ion-icon>
</ion-avatar>
<ion-avatar size="medium">
<ion-icon name="person-outline"></ion-icon>
</ion-avatar>
<ion-avatar size="large">
<ion-icon name="person-outline"></ion-icon>
</ion-avatar>
</div>
<h2>Images</h2>
<div class="container">
<ion-avatar size="xsmall">
<img src="/src/components/avatar/test/avatar.svg" />
</ion-avatar>
<ion-avatar size="small">
<img src="/src/components/avatar/test/avatar.svg" />
</ion-avatar>
<ion-avatar size="medium">
<img src="/src/components/avatar/test/avatar.svg" />
</ion-avatar>
<ion-avatar size="large">
<img src="/src/components/avatar/test/avatar.svg" />
</ion-avatar>
</div>
</ion-content>
</ion-app>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More