Compare commits
386 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e619c72d43 | ||
|
|
07d257f7f5 | ||
|
|
12ad1ed76c | ||
|
|
79a12ceca3 | ||
|
|
fef3016d13 | ||
|
|
060f554ef8 | ||
|
|
131de8b8ea | ||
|
|
74710d4cf6 | ||
|
|
3626302d32 | ||
|
|
c1574ffe1f | ||
|
|
34fd51067b | ||
|
|
e50ba30c22 | ||
|
|
7ba6b9d0c2 | ||
|
|
56b8b1de81 | ||
|
|
a1ea905c97 | ||
|
|
22ce04fc88 | ||
|
|
fbe3116ed5 | ||
|
|
120fabbc98 | ||
|
|
be6a690812 | ||
|
|
92b1f4c01f | ||
|
|
7981fe3f9a | ||
|
|
bf4503ea2b | ||
|
|
4ea3f6cc35 | ||
|
|
ccc3eeb56a | ||
|
|
c16397ed5a | ||
|
|
9a053f60cb | ||
|
|
f42e39e0d5 | ||
|
|
33dcf98bd2 | ||
|
|
5458e06742 | ||
|
|
708364df82 | ||
|
|
5da9cc64bd | ||
|
|
911684f83a | ||
|
|
ecfffe9486 | ||
|
|
0b70a997ed | ||
|
|
c5e4f58e65 | ||
|
|
839646dc07 | ||
|
|
3a5ed90c03 | ||
|
|
a723ad327c | ||
|
|
40e610dec0 | ||
|
|
b57d1634a1 | ||
|
|
68a523cb1d | ||
|
|
38b3ac4472 | ||
|
|
280cb050f3 | ||
|
|
92f1975c12 | ||
|
|
4020859d4e | ||
|
|
17dc854eae | ||
|
|
5d719ba6b0 | ||
|
|
345bd53831 | ||
|
|
fe964c8fa0 | ||
|
|
034d047202 | ||
|
|
8e8e8f90cd | ||
|
|
a0d5ad7b8d | ||
|
|
8b5215ff03 | ||
|
|
fc4e5ae287 | ||
|
|
1877ac5dd1 | ||
|
|
f7a2d34305 | ||
|
|
6a1382fc2c | ||
|
|
7fec492ac7 | ||
|
|
3b643a75d1 | ||
|
|
b2f6b8c67e | ||
|
|
d3165fc229 | ||
|
|
02c138802a | ||
|
|
1e7a84f9bd | ||
|
|
7d98a87302 | ||
|
|
33de8255f4 | ||
|
|
07ac3db1ff | ||
|
|
b3917600cc | ||
|
|
56be987881 | ||
|
|
5da939d330 | ||
|
|
2a1addc190 | ||
|
|
52fba11db5 | ||
|
|
b31e0efcbf | ||
|
|
a9aa59bc36 | ||
|
|
207d4858a6 | ||
|
|
97f96b4528 | ||
|
|
9016cc6f06 | ||
|
|
54597a312c | ||
|
|
8c4bf8bb47 | ||
|
|
69340bff5a | ||
|
|
8855618037 | ||
|
|
8f05689f95 | ||
|
|
b57d432675 | ||
|
|
1865e50d7a | ||
|
|
7f24ba006f | ||
|
|
7f23c60ffd | ||
|
|
f0516e6569 | ||
|
|
e24fcf530a | ||
|
|
c37eaabae9 | ||
|
|
02c9d64ca5 | ||
|
|
c5fb051be3 | ||
|
|
a7233c296a | ||
|
|
40932d7b2d | ||
|
|
7713cbe5b5 | ||
|
|
a0fa3b3bdb | ||
|
|
a7a36fb3a2 | ||
|
|
5dae2dc1dc | ||
|
|
723868df9e | ||
|
|
e6c131876d | ||
|
|
36fb7ee073 | ||
|
|
e0f3008c5c | ||
|
|
5cd85049e0 | ||
|
|
b8b5984150 | ||
|
|
355af73288 | ||
|
|
aa5d109fb1 | ||
|
|
ab81f3de7e | ||
|
|
715cc06c5f | ||
|
|
517d5b99b2 | ||
|
|
5eab76c0f3 | ||
|
|
fc552ad89f | ||
|
|
a31495091f | ||
|
|
d73faf5962 | ||
|
|
f6ce0230d9 | ||
|
|
061712318c | ||
|
|
ae78967b3c | ||
|
|
7be7c08cb0 | ||
|
|
839969e3b5 | ||
|
|
94d28eaafc | ||
|
|
b3e869ef9e | ||
|
|
fe0b32ff36 | ||
|
|
b0c5555561 | ||
|
|
8234064d6b | ||
|
|
6fa6549535 | ||
|
|
3f00e696ca | ||
|
|
b7da1e8b68 | ||
|
|
30913907fc | ||
|
|
8f6f8b4187 | ||
|
|
4a6bcab7bf | ||
|
|
fec23e80cc | ||
|
|
85e12dd624 | ||
|
|
805b75a6eb | ||
|
|
826e7e229a | ||
|
|
861b4bfdca | ||
|
|
e16c633575 | ||
|
|
f6e041622d | ||
|
|
4782a1a5ec | ||
|
|
60f9e16435 | ||
|
|
1e33a57849 | ||
|
|
b0a2544c15 | ||
|
|
2f538b3ecb | ||
|
|
26db1210c1 | ||
|
|
ff93af7e00 | ||
|
|
5bf48cb57a | ||
|
|
bc3d30c3d2 | ||
|
|
c3a804dc75 | ||
|
|
a1f3fcc23b | ||
|
|
9e3062963f | ||
|
|
1b6f07dfb8 | ||
|
|
c1128dd9a1 | ||
|
|
175dc929a5 | ||
|
|
b046f37d17 | ||
|
|
207743d60e | ||
|
|
0fbc2b27f7 | ||
|
|
ca091e2773 | ||
|
|
d4ff124737 | ||
|
|
4f61e0170d | ||
|
|
13293a026b | ||
|
|
51cb77729a | ||
|
|
379587d47c | ||
|
|
8d2d176fd6 | ||
|
|
4ddc053e99 | ||
|
|
a2bf1bb0c2 | ||
|
|
3306d717ef | ||
|
|
a5a7bee25c | ||
|
|
4d81c8f55f | ||
|
|
bdb7cd6a21 | ||
|
|
2d2b081f19 | ||
|
|
0eb1c7a81c | ||
|
|
0b18b6e3d2 | ||
|
|
d8bdf398fc | ||
|
|
15d6104c6f | ||
|
|
5d4a9893ef | ||
|
|
f4766c6738 | ||
|
|
85ec5f7b2c | ||
|
|
ab61c122e4 | ||
|
|
c295a089c2 | ||
|
|
61876a5250 | ||
|
|
9fc0d6242f | ||
|
|
7002933269 | ||
|
|
2af216737d | ||
|
|
bde1d0978d | ||
|
|
05cf900fa2 | ||
|
|
989c4e7aff | ||
|
|
b248ac5d0e | ||
|
|
a37098ec6e | ||
|
|
60e6b3143e | ||
|
|
1841b59e44 | ||
|
|
bac0143d83 | ||
|
|
55711c4b32 | ||
|
|
7df08a2330 | ||
|
|
93b734c840 | ||
|
|
9a8c49ae7f | ||
|
|
6aa47d363f | ||
|
|
78e7edaa06 | ||
|
|
17f7c52fa4 | ||
|
|
e839920162 | ||
|
|
21954f6f57 | ||
|
|
9f1a1942b9 | ||
|
|
526f2b4a63 | ||
|
|
a0101bf3fb | ||
|
|
51a86fb0dd | ||
|
|
ccf1f65892 | ||
|
|
3656c8deba | ||
|
|
aded437923 | ||
|
|
b9ef92ae7e | ||
|
|
4506ccf99c | ||
|
|
ca4c0a5a8d | ||
|
|
0d67c83c21 | ||
|
|
e539620880 | ||
|
|
b57f4be284 | ||
|
|
59ba289233 | ||
|
|
32fb17cf6e | ||
|
|
210f724ae7 | ||
|
|
8fb813686f | ||
|
|
196a7bf1b9 | ||
|
|
25e765d1f0 | ||
|
|
476a6ac837 | ||
|
|
79a3fd00de | ||
|
|
0979172b61 | ||
|
|
abe3b3f100 | ||
|
|
a12c1ac319 | ||
|
|
24221eb693 | ||
|
|
c48b33b360 | ||
|
|
7d772be76e | ||
|
|
b35ace4393 | ||
|
|
a928ba7379 | ||
|
|
08fc0b9160 | ||
|
|
2a52942a6f | ||
|
|
6d6c637ac4 | ||
|
|
2e1ccf8a42 | ||
|
|
0ebc71d318 | ||
|
|
c94d04d483 | ||
|
|
327f22ece3 | ||
|
|
947beb8840 | ||
|
|
99791c2764 | ||
|
|
94f34e9785 | ||
|
|
3d94b234a0 | ||
|
|
5055bdcc96 | ||
|
|
3c7a00e57d | ||
|
|
a3f486bdbf | ||
|
|
87b3723ba9 | ||
|
|
dcdc60283e | ||
|
|
6ecae2bd13 | ||
|
|
1f66f4a24e | ||
|
|
1b916f531e | ||
|
|
00c8d5ec55 | ||
|
|
00a6b2dfbd | ||
|
|
0807e6b037 | ||
|
|
14d3500b50 | ||
|
|
2441b8f125 | ||
|
|
f8f83a3700 | ||
|
|
17f38bcd04 | ||
|
|
898d7933ac | ||
|
|
c2d6b21d6f | ||
|
|
02f3ad014a | ||
|
|
f60a3f2232 | ||
|
|
1e7e21f5f3 | ||
|
|
8ac3ae520c | ||
|
|
777521f218 | ||
|
|
e9fd407e90 | ||
|
|
7d4a704b1c | ||
|
|
6246245cac | ||
|
|
59f3d4e988 | ||
|
|
0f4462088a | ||
|
|
e819f767a1 | ||
|
|
f8f4bb67a5 | ||
|
|
5c84b6acf5 | ||
|
|
eb7585ed20 | ||
|
|
1574d3bffe | ||
|
|
cfdf4555de | ||
|
|
2d249d8f68 | ||
|
|
8ebece3e30 | ||
|
|
d4971581cc | ||
|
|
01c1b4fef2 | ||
|
|
3b93bb4a9b | ||
|
|
b4ce7129b2 | ||
|
|
7f8be3e18c | ||
|
|
fea59b73aa | ||
|
|
b9af47ae0d | ||
|
|
b21f95cced | ||
|
|
1c035af1a2 | ||
|
|
258dabfb9e | ||
|
|
15f8c55046 | ||
|
|
5c0b5c32d0 | ||
|
|
4bf7a76104 | ||
|
|
888b0c8284 | ||
|
|
7a4843b2db | ||
|
|
b6325e49be | ||
|
|
9fd1a53c74 | ||
|
|
bf8dfdb5b1 | ||
|
|
3f12e5850d | ||
|
|
968807f4eb | ||
|
|
7f192a4d99 | ||
|
|
916d8a455f | ||
|
|
310bde6e91 | ||
|
|
588db38e15 | ||
|
|
4412246f95 | ||
|
|
237245f567 | ||
|
|
a214b3de4c | ||
|
|
7a7a688601 | ||
|
|
8e7be665fa | ||
|
|
24c0bc352a | ||
|
|
ef7a454015 | ||
|
|
edbc1eca1b | ||
|
|
b353984216 | ||
|
|
09935fd07b | ||
|
|
8515c4efff | ||
|
|
c1bba3b5f0 | ||
|
|
75333c0251 | ||
|
|
e17db2c988 | ||
|
|
a58d9fa2e1 | ||
|
|
7333376506 | ||
|
|
4dae03f2ac | ||
|
|
fd14ddfec7 | ||
|
|
0e792e6b9d | ||
|
|
2eb1dbd83c | ||
|
|
c78d2e6ec8 | ||
|
|
7bbbd4b6b8 | ||
|
|
5c7a782c42 | ||
|
|
09a0e6e907 | ||
|
|
7c7c483ab9 | ||
|
|
8acf8f3c96 | ||
|
|
ef9b823dcd | ||
|
|
8b834387d4 | ||
|
|
4a4d447e9d | ||
|
|
e0dfb61157 | ||
|
|
1116cdd44a | ||
|
|
c855add260 | ||
|
|
2b748c7df7 | ||
|
|
3c435fd182 | ||
|
|
305ea7b85e | ||
|
|
dc2db1204f | ||
|
|
c6127e91f0 | ||
|
|
d7eb539131 | ||
|
|
fa2fabdb0a | ||
|
|
1e757513ce | ||
|
|
930f275b7e | ||
|
|
ac102cf52a | ||
|
|
ea1207174d | ||
|
|
cb71258474 | ||
|
|
3b0f3af897 | ||
|
|
6e45fef869 | ||
|
|
62a3e115ef | ||
|
|
2414b78bef | ||
|
|
67ec7455a8 | ||
|
|
c30d685c32 | ||
|
|
96e5b2be57 | ||
|
|
95daa05a49 | ||
|
|
3d7b669e37 | ||
|
|
c6b7dfe398 | ||
|
|
a57be0941d | ||
|
|
9e7c9a5934 | ||
|
|
e93941ffa3 | ||
|
|
2e9fee8ed8 | ||
|
|
6f42c29250 | ||
|
|
0decc7770d | ||
|
|
1674211ce7 | ||
|
|
fb445322c3 | ||
|
|
bb516f0da7 | ||
|
|
ca59d6c297 | ||
|
|
7ce115993a | ||
|
|
77c67f2362 | ||
|
|
a8c06c118e | ||
|
|
19f7be8877 | ||
|
|
5b62a1eafc | ||
|
|
1c4b6bd8f2 | ||
|
|
3a1e70d6fd | ||
|
|
17f5be1edd | ||
|
|
efdaf38520 | ||
|
|
e9654436a6 | ||
|
|
b11c630410 | ||
|
|
4fc3bbbe5f | ||
|
|
5234224700 | ||
|
|
6d6fd4af1b | ||
|
|
7cfee535ac | ||
|
|
167e311474 | ||
|
|
7eae6ec591 | ||
|
|
4cf1b9737d | ||
|
|
f664329f71 | ||
|
|
d73de9194d | ||
|
|
e8169bfddb | ||
|
|
e375508647 | ||
|
|
6965205824 | ||
|
|
245a5c6f23 | ||
|
|
284eb8ecaf | ||
|
|
76b48a6c77 | ||
|
|
668ab98f0e |
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
287
BREAKING.md
@@ -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
@@ -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';
|
||||
```
|
||||
@@ -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
|
||||
|
||||
649
core/api.txt
9327
core/package-lock.json
generated
@@ -31,6 +31,7 @@
|
||||
"loader/"
|
||||
],
|
||||
"dependencies": {
|
||||
"@phosphor-icons/core": "^2.1.1",
|
||||
"@stencil/core": "4.33.1",
|
||||
"ionicons": "^7.2.2",
|
||||
"tslib": "^2.1.0"
|
||||
@@ -52,7 +53,7 @@
|
||||
"@stencil/sass": "^3.0.9",
|
||||
"@stencil/vue-output-target": "0.10.8",
|
||||
"@types/jest": "^29.5.6",
|
||||
"@types/node": "^14.6.0",
|
||||
"@types/node": "^18.19.47",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
||||
"@typescript-eslint/parser": "^6.7.2",
|
||||
"chalk": "^5.3.0",
|
||||
@@ -65,10 +66,12 @@
|
||||
"fs-extra": "^9.0.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-cli": "^29.7.0",
|
||||
"prettier": "^2.6.1",
|
||||
"outsystems-design-tokens": "^1.2.6",
|
||||
"prettier": "^2.8.8",
|
||||
"rollup": "^2.26.4",
|
||||
"sass": "^1.33.0",
|
||||
"serve": "^14.0.1",
|
||||
"style-dictionary": "^4.1.3",
|
||||
"stylelint": "^13.13.1",
|
||||
"stylelint-order": "^4.1.0"
|
||||
},
|
||||
@@ -77,6 +80,7 @@
|
||||
"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": "npx build.tokens --config scripts/tokens/index.js && 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",
|
||||
@@ -88,7 +92,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",
|
||||
|
||||
@@ -28,6 +28,32 @@
|
||||
document.head.appendChild(linkTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* The `ionic` theme uses a different stylesheet than the `iOS` and `md` themes.
|
||||
* This is to ensure that the `ionic` theme is loaded when the `ionic:theme=ionic`
|
||||
* or when the HTML tag has the `theme="ionic"` attribute. This is useful for
|
||||
* the snapshot tests, where the `ionic` theme is not loaded by default.
|
||||
*/
|
||||
const themeQuery = window.location.search.match(/ionic:theme=([a-z]+)/);
|
||||
const themeAttr = document.documentElement.getAttribute('theme');
|
||||
|
||||
if ((themeQuery && themeQuery[1] === 'ionic') || themeAttr === 'ionic') {
|
||||
const ionicThemeLinkTag = document.querySelector('link[href*="css/ionic/bundle.ionic.css"]');
|
||||
|
||||
if (!ionicThemeLinkTag) {
|
||||
const linkTag = document.createElement('link');
|
||||
linkTag.setAttribute('rel', 'stylesheet');
|
||||
linkTag.setAttribute('type', 'text/css');
|
||||
linkTag.setAttribute('href', '/css/ionic/bundle.ionic.css');
|
||||
document.head.appendChild(linkTag);
|
||||
}
|
||||
|
||||
const defaultThemeLinkTag = document.querySelector('link[href*="css/ionic.bundle.css"]');
|
||||
if (defaultThemeLinkTag) {
|
||||
defaultThemeLinkTag.remove();
|
||||
}
|
||||
}
|
||||
|
||||
window.Ionic = window.Ionic || {};
|
||||
window.Ionic.config = window.Ionic.config || {};
|
||||
|
||||
|
||||
@@ -49,6 +49,17 @@ html.ios.ios {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "iosTestingFont", sans-serif;
|
||||
}
|
||||
|
||||
/* Override above styles for testing scopes */
|
||||
:root.ionic,
|
||||
:root.ionic.ios,
|
||||
:root.ionic.md,
|
||||
html.ionic,
|
||||
html.ionic.ios,
|
||||
html.ionic.md {
|
||||
--ion-background-color: var(--background);
|
||||
--ion-font-family: initial;
|
||||
}
|
||||
|
||||
/**
|
||||
* Button styles should only be applied
|
||||
* to native buttons that are not part of the
|
||||
|
||||
201
core/scripts/tokens/index.js
Normal file
@@ -0,0 +1,201 @@
|
||||
/* 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.
|
||||
(async () => {
|
||||
const {
|
||||
generateShadowValue,
|
||||
generateFontSizeValue,
|
||||
generateFontFamilyValue,
|
||||
generateTypographyOutput,
|
||||
generateValue,
|
||||
generateColorUtilityClasses,
|
||||
generateDefaultSpaceUtilityClasses,
|
||||
generateSpaceUtilityClasses,
|
||||
removeConsecutiveRepeatedWords,
|
||||
setPrefixValue,
|
||||
generateRadiusUtilityClasses,
|
||||
generateBorderUtilityClasses,
|
||||
generateFontUtilityClasses,
|
||||
generateShadowUtilityClasses,
|
||||
generateUtilityClasses
|
||||
} = require('./utils.js');
|
||||
|
||||
const StyleDictionary = (await import('style-dictionary')).default;
|
||||
|
||||
// Set the prefix for variables and classes
|
||||
setPrefixValue('ion');
|
||||
|
||||
// Register a custom file header
|
||||
StyleDictionary.registerFileHeader({
|
||||
name: 'custom-header',
|
||||
fileHeader: async (defaultMessages = []) => {
|
||||
return [...defaultMessages, 'Do not edit directly, this file was auto-generated.'];
|
||||
},
|
||||
});
|
||||
|
||||
// SCSS variables format
|
||||
StyleDictionary.registerFormat({
|
||||
name: 'scssVariablesFormat',
|
||||
format: async function ({ dictionary, file }) {
|
||||
|
||||
console.log('Generating SCSS variables...');
|
||||
|
||||
const primitiveProperties = dictionary.allTokens.filter((prop) => prop.path[0] === 'primitives');
|
||||
const scaleProperties = dictionary.allTokens.filter((prop) => prop.path[0] === 'scale');
|
||||
const borderProperties = dictionary.allTokens.filter((prop) => prop.path[0] === 'border');
|
||||
const semanticsProperties = dictionary.allTokens.filter((prop) => prop.path[0] === 'semantics');
|
||||
const nonPrimitiveScaleBorderSemanticsProperties = dictionary.allTokens.filter(
|
||||
(prop) => !['primitives', 'scale', 'border', 'semantics'].includes(prop.path[0])
|
||||
);
|
||||
const typographyProperties = nonPrimitiveScaleBorderSemanticsProperties.filter((prop) => prop.$type === 'typography');
|
||||
const otherProperties = nonPrimitiveScaleBorderSemanticsProperties.filter((prop) => prop.$type !== 'typography');
|
||||
|
||||
// Order: primitives → semantics → scale → border → other → typography
|
||||
const sortedProperties = [
|
||||
...primitiveProperties,
|
||||
...semanticsProperties,
|
||||
...scaleProperties,
|
||||
...borderProperties,
|
||||
...otherProperties,
|
||||
...typographyProperties
|
||||
];
|
||||
|
||||
const prefixedVariables = sortedProperties.map((prop) => {
|
||||
// Remove consecutive repeated words from the token name, like border-border-color
|
||||
const propName = removeConsecutiveRepeatedWords(prop.name);
|
||||
|
||||
switch (prop.$type) {
|
||||
case 'boxShadow':
|
||||
return generateShadowValue(prop, propName);
|
||||
case 'fontFamilies':
|
||||
return generateFontFamilyValue(prop, propName, 'scss');
|
||||
case 'fontSizes':
|
||||
return generateFontSizeValue(prop, propName, 'scss');
|
||||
case 'typography':
|
||||
return generateTypographyOutput(prop, propName, true);
|
||||
default:
|
||||
return generateValue(prop, propName);
|
||||
}
|
||||
});
|
||||
|
||||
const fileHeader = await file.options.fileHeader();
|
||||
|
||||
return [
|
||||
`/*\n${fileHeader.join('\n')}\n*/`,
|
||||
'@use "../themes/functions.sizes" as font;\n',
|
||||
prefixedVariables.join('\n') + '\n',
|
||||
].join('\n');
|
||||
},
|
||||
});
|
||||
|
||||
// Create utility-classes
|
||||
StyleDictionary.registerFormat({
|
||||
name: 'cssUtilityClassesFormat',
|
||||
format: async function ({ dictionary, file }) {
|
||||
|
||||
console.log('Generating Utility-Classes...');
|
||||
|
||||
// Arrays to store specific utility classes
|
||||
const typographyUtilityClasses = [];
|
||||
const otherUtilityClasses = [];
|
||||
|
||||
// Generate utility classes for each token
|
||||
dictionary.allTokens.map((prop) => {
|
||||
|
||||
const tokenCategory = prop.attributes.category;
|
||||
|
||||
if (prop.$type === 'fontFamilies' || tokenCategory === 'scale' || tokenCategory === 'backdrop') {
|
||||
// Not creating for the tokens below, as they make no sense to exist as utility-classes.
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove consecutive repeated words from the token name, like border-border-color
|
||||
const propName = removeConsecutiveRepeatedWords(prop.name);
|
||||
|
||||
if (prop.$type === 'typography') {
|
||||
// Typography tokens are handled differently, as each might have a different tokenType
|
||||
return typographyUtilityClasses.push(generateTypographyOutput(prop, propName, false));
|
||||
|
||||
} else if (tokenCategory.startsWith('round') || tokenCategory.startsWith('rectangular') || tokenCategory.startsWith('soft')) {
|
||||
// Generate utility classes for border-radius shape tokens, as they have their own token json file, based on primitive tokens
|
||||
return otherUtilityClasses.push(generateRadiusUtilityClasses(propName));
|
||||
}
|
||||
|
||||
let utilityClass = '';
|
||||
switch (tokenCategory) {
|
||||
case 'color':
|
||||
case 'primitives':
|
||||
case 'semantics':
|
||||
case 'text':
|
||||
case 'bg':
|
||||
case 'icon':
|
||||
case 'state':
|
||||
utilityClass = generateColorUtilityClasses(prop, propName);
|
||||
break;
|
||||
case 'border':
|
||||
utilityClass = generateBorderUtilityClasses(prop, propName);
|
||||
break;
|
||||
case 'font':
|
||||
utilityClass = generateFontUtilityClasses(prop, propName);
|
||||
break;
|
||||
case 'space':
|
||||
utilityClass = generateSpaceUtilityClasses(prop, propName);
|
||||
break;
|
||||
case 'shadow':
|
||||
case 'elevation':
|
||||
utilityClass = generateShadowUtilityClasses(propName);
|
||||
break;
|
||||
default:
|
||||
utilityClass = generateUtilityClasses(tokenCategory, propName);
|
||||
}
|
||||
|
||||
return otherUtilityClasses.push(utilityClass);
|
||||
});
|
||||
|
||||
const defaultSpaceUtilityClasses = generateDefaultSpaceUtilityClasses();
|
||||
otherUtilityClasses.push(defaultSpaceUtilityClasses);
|
||||
|
||||
// Concatenate typography utility classes at the beginning
|
||||
const finalOutput = typographyUtilityClasses.concat(otherUtilityClasses).join('\n');
|
||||
|
||||
const fileHeader = await file.options.fileHeader();
|
||||
|
||||
return [
|
||||
`/*\n${fileHeader.join('\n')}\n*/`,
|
||||
'@import "./ionic.vars";\n@import "../themes/mixins";\n',
|
||||
finalOutput,
|
||||
].join('\n');
|
||||
},
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
// APPLY THE CONFIGURATION
|
||||
module.exports = {
|
||||
source: ["node_modules/outsystems-design-tokens/tokens/**/*.json"],
|
||||
platforms: {
|
||||
scss: {
|
||||
transformGroup: "scss",
|
||||
buildPath: './src/foundations/',
|
||||
files: [
|
||||
{
|
||||
destination: "ionic.vars.scss",
|
||||
format: "scssVariablesFormat",
|
||||
options: {
|
||||
fileHeader: `custom-header`,
|
||||
},
|
||||
},
|
||||
{
|
||||
destination: "ionic.utility.scss",
|
||||
format: "cssUtilityClassesFormat",
|
||||
options: {
|
||||
fileHeader: `custom-header`
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
335
core/scripts/tokens/utils.js
Normal file
@@ -0,0 +1,335 @@
|
||||
let variablesPrefix; // Variable that holds the prefix used on all css and scss variables generated
|
||||
|
||||
// Set the variable prefix value
|
||||
function setPrefixValue(prefix) {
|
||||
variablesPrefix = prefix;
|
||||
return variablesPrefix;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Utility function to remove consecutive repeated words
|
||||
function removeConsecutiveRepeatedWords(str) {
|
||||
return str.replace(/(\b\w+\b)(-\1)+/g, '$1');
|
||||
}
|
||||
|
||||
// Generates a reference variable for an alias token type
|
||||
// (e.g., $ion-border-default: var(--ion-border-default, #d5d5d5) → $ion-border-default: var(--ion-border-default, $ion-primitives-neutral-400))
|
||||
function getAliasReferenceVariable(prop) {
|
||||
if (typeof prop.$value === 'string' && prop.$value.startsWith('{') && prop.$value.endsWith('}')) {
|
||||
// Remove curly braces and replace dots with dashes
|
||||
let ref = prop.$value.slice(1, -1).replace(/\./g, '-');
|
||||
// Remove consecutive repeated words (e.g., border-border-radius-0 → border-radius-0)
|
||||
ref = removeConsecutiveRepeatedWords(ref);
|
||||
return `$${variablesPrefix}-${ref}`;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Generates a valid box-shadow value from a shadow Design Token structure
|
||||
function generateShadowValue(prop, propName) {
|
||||
const cssShadow = prop.$value.map(shadow => {
|
||||
// Assuming shadow is an object with properties like offsetX, offsetY, blurRadius, spreadRadius, color
|
||||
const color = getRgbaValue(shadow.color);
|
||||
return `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${color}`;
|
||||
}).join(', ');
|
||||
|
||||
return `$${variablesPrefix}-${propName}: var(--${variablesPrefix}-${propName}, ${cssShadow});`;
|
||||
}
|
||||
|
||||
// Generates a valid font-size value from a font-size Design Token structure, while transforming the pixels to rem
|
||||
function generateFontSizeValue(prop, propName, variableType = 'css') {
|
||||
return variableType === 'scss'
|
||||
? `$${variablesPrefix}-${propName}: var(--${variablesPrefix}-${propName}, font.px-to-rem(${parseInt(
|
||||
prop.$value
|
||||
)}));`
|
||||
: `--${propName}: #{font.px-to-rem(${parseInt(prop.$value)})};`;
|
||||
}
|
||||
|
||||
// Generates a valid font-family value from a font-family Design Token structure
|
||||
function generateFontFamilyValue(prop, propName, 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 = propName.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 final value, based if the Design Token is of type color or not
|
||||
function generateValue(prop, propName) {
|
||||
// Use the original value to detect aliases
|
||||
const aliasVar = getAliasReferenceVariable({ $value: prop.original.$value });
|
||||
|
||||
// Always generate the main variable
|
||||
let mainValue;
|
||||
if (aliasVar) {
|
||||
mainValue = `$${variablesPrefix}-${propName}: var(--${variablesPrefix}-${propName}, ${aliasVar});`;
|
||||
} else {
|
||||
mainValue = `$${variablesPrefix}-${propName}: var(--${variablesPrefix}-${propName}, ${prop.$value});`;
|
||||
}
|
||||
|
||||
// Always generate the -rgb variable if it's a color
|
||||
const rgb = hexToRgb(prop.$value);
|
||||
let rgbDeclaration = '';
|
||||
if (rgb) {
|
||||
rgbDeclaration = `\n$${variablesPrefix}-${propName}-rgb: var(--${variablesPrefix}-${propName}-rgb, ${rgb.r}, ${rgb.g}, ${rgb.b});`;
|
||||
}
|
||||
|
||||
return `${mainValue}${rgbDeclaration}`;
|
||||
}
|
||||
|
||||
// Generates a typography based css utility-class or scss variable from a typography token structure
|
||||
function generateTypographyOutput(prop, propName, isVariable) {
|
||||
const typography = prop.original.$value;
|
||||
|
||||
// Extract the part after the last dot and trim any extraneous characters
|
||||
const extractLastPart = (str) => str.split('.').pop().replace(/[^\w-]/g, '');
|
||||
|
||||
const _initialWrapper = isVariable ? ': (' : ` {`;
|
||||
const _endWrapper = isVariable ? ')' : `}`;
|
||||
const _prefix = isVariable ? '$' : `.`;
|
||||
const _endChar = isVariable ? ',' : ';';
|
||||
|
||||
// This exact format is needed so that it compiles the tokens with the expected lint rules
|
||||
return `
|
||||
${_prefix}${variablesPrefix}-${propName}${_initialWrapper}
|
||||
font-size: $${variablesPrefix}-font-size-${extractLastPart(typography.fontSize)}${_endChar}
|
||||
font-style: ${prop.attributes.item?.toLowerCase() === 'italic' ? 'italic' : 'normal'}${_endChar}
|
||||
font-weight: $${variablesPrefix}-font-weight-${extractLastPart(typography.fontWeight)}${_endChar}
|
||||
letter-spacing: $${variablesPrefix}-font-letter-spacing-${extractLastPart(typography.letterSpacing) || 0}${_endChar}
|
||||
line-height: $${variablesPrefix}-font-line-height-${extractLastPart(typography.lineHeight)}${_endChar}
|
||||
text-transform: ${typography.textCase}${_endChar}
|
||||
text-decoration: ${typography.textDecoration}${_endChar}
|
||||
${_endWrapper};
|
||||
`;
|
||||
}
|
||||
|
||||
// Generates a color based css utility-class from a color Design Token structure
|
||||
function generateColorUtilityClasses(prop, className) {
|
||||
const isBg = className.includes('bg');
|
||||
const cssProp = isBg ? 'background-color' : 'color';
|
||||
return `.${variablesPrefix}-${className} {
|
||||
--${cssProp}: $${variablesPrefix}-${prop.name};
|
||||
${cssProp}: $${variablesPrefix}-${prop.name};
|
||||
}`;
|
||||
}
|
||||
|
||||
// Generates margin and padding utility classes to match the token-agnostic
|
||||
// utilities provided by the Ionic Framework
|
||||
function generateDefaultSpaceUtilityClasses() {
|
||||
const zeroMarginPaddingToken = 'space-0';
|
||||
const defaultMarginPaddingToken = 'space-400';
|
||||
|
||||
const marginPaddingTemplate = (type) => `
|
||||
.${variablesPrefix}-no-${type} {
|
||||
--${type}-top: #{$${variablesPrefix}-${zeroMarginPaddingToken}};
|
||||
--${type}-end: #{$${variablesPrefix}-${zeroMarginPaddingToken}};
|
||||
--${type}-bottom: #{$${variablesPrefix}-${zeroMarginPaddingToken}};
|
||||
--${type}-start: #{$${variablesPrefix}-${zeroMarginPaddingToken}};
|
||||
|
||||
@include ${type}($${variablesPrefix}-${zeroMarginPaddingToken});
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type} {
|
||||
--${type}-top: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
--${type}-end: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
--${type}-bottom: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
--${type}-start: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
|
||||
@include ${type}($${variablesPrefix}-${defaultMarginPaddingToken});
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type}-top {
|
||||
--${type}-top: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
|
||||
@include ${type}($${variablesPrefix}-${defaultMarginPaddingToken}, null, null, null);
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type}-end {
|
||||
--${type}-end: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
|
||||
@include ${type}(null, $${variablesPrefix}-${defaultMarginPaddingToken}, null, null);
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type}-bottom {
|
||||
--${type}-bottom: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
|
||||
@include ${type}(null, null, $${variablesPrefix}-${defaultMarginPaddingToken}, null);
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type}-start {
|
||||
--${type}-start: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
|
||||
@include ${type}(null, null, null, $${variablesPrefix}-${defaultMarginPaddingToken});
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type}-vertical {
|
||||
--${type}-top: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
--${type}-bottom: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
|
||||
@include ${type}($${variablesPrefix}-${defaultMarginPaddingToken}, null, $${variablesPrefix}-${defaultMarginPaddingToken}, null);
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type}-horizontal {
|
||||
--${type}-start: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
--${type}-end: #{$${variablesPrefix}-${defaultMarginPaddingToken}};
|
||||
|
||||
@include ${type}(null, $${variablesPrefix}-${defaultMarginPaddingToken}, null, $${variablesPrefix}-${defaultMarginPaddingToken});
|
||||
};
|
||||
`;
|
||||
|
||||
return `${marginPaddingTemplate('margin')}\n${marginPaddingTemplate('padding')}`;
|
||||
}
|
||||
|
||||
// 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
|
||||
// It will generate classes for margin and padding, for equal sizing on all side and each direction
|
||||
const marginPaddingTemplate = (type) => `
|
||||
.${variablesPrefix}-${type}-${className} {
|
||||
--${type}-top: #{$${variablesPrefix}-${prop.name}};
|
||||
--${type}-end: #{$${variablesPrefix}-${prop.name}};
|
||||
--${type}-bottom: #{$${variablesPrefix}-${prop.name}};
|
||||
--${type}-start: #{$${variablesPrefix}-${prop.name}};
|
||||
|
||||
@include ${type}($${variablesPrefix}-${prop.name});
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type}-top-${className} {
|
||||
--${type}-top: #{$${variablesPrefix}-${prop.name}};
|
||||
|
||||
@include ${type}($${variablesPrefix}-${prop.name}, null, null, null);
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type}-end-${className} {
|
||||
--${type}-end: #{$${variablesPrefix}-${prop.name}};
|
||||
|
||||
@include ${type}(null, $${variablesPrefix}-${prop.name}, null, null);
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type}-bottom-${className} {
|
||||
--${type}-bottom: #{$${variablesPrefix}-${prop.name}};
|
||||
|
||||
@include ${type}(null, null, $${variablesPrefix}-${prop.name}, null);
|
||||
};
|
||||
|
||||
.${variablesPrefix}-${type}-start-${className} {
|
||||
--${type}-start: #{$${variablesPrefix}-${prop.name}};
|
||||
|
||||
@include ${type}(null, null, null, $${variablesPrefix}-${prop.name});
|
||||
};
|
||||
`;
|
||||
|
||||
// Add gap utility classes for gap tokens
|
||||
const generateGapUtilityClasses = () =>`
|
||||
.${variablesPrefix}-gap-${prop.name} {
|
||||
gap: #{$${variablesPrefix}-${prop.name}};
|
||||
};
|
||||
`;
|
||||
|
||||
return `${generateGapUtilityClasses()}\n${marginPaddingTemplate('margin')}\n${marginPaddingTemplate('padding')}`;
|
||||
}
|
||||
|
||||
// Generates a valid box-shadow value from a shadow Design Token structure
|
||||
function generateRadiusUtilityClasses(propName) {
|
||||
return `.${variablesPrefix}-${propName} {
|
||||
--border-radius: $${variablesPrefix}-${propName};
|
||||
border-radius: $${variablesPrefix}-${propName};
|
||||
}`;
|
||||
}
|
||||
|
||||
// Generates a border based css utility-class from a font Design Token structure
|
||||
function generateBorderUtilityClasses(prop, propName) {
|
||||
let attribute;
|
||||
|
||||
switch (prop.attributes.type) {
|
||||
case 'border-radius':
|
||||
case 'border-style':
|
||||
attribute = prop.attributes.type;
|
||||
break;
|
||||
case 'border-size':
|
||||
attribute = 'border-width';
|
||||
break;
|
||||
default:
|
||||
attribute = 'border-color';
|
||||
}
|
||||
return `.${variablesPrefix}-${propName} {
|
||||
--${attribute}: $${variablesPrefix}-${propName};
|
||||
${attribute}: $${variablesPrefix}-${propName};
|
||||
}`;
|
||||
}
|
||||
|
||||
// Generates a font based css utility-class from a font Design Token structure
|
||||
function generateFontUtilityClasses(prop, propName) {
|
||||
return `.${variablesPrefix}-${propName} {\n ${prop.attributes.type}: $${variablesPrefix}-${propName};\n}`;
|
||||
}
|
||||
|
||||
// Generates a valid box-shadow value from a shadow Design Token structure
|
||||
function generateShadowUtilityClasses(propName) {
|
||||
return `.${variablesPrefix}-${propName} {
|
||||
--box-shadow: $${variablesPrefix}-${propName};
|
||||
box-shadow: $${variablesPrefix}-${propName};
|
||||
}`;
|
||||
}
|
||||
|
||||
// Generates a utility class for a given token category and name
|
||||
function generateUtilityClasses(tokenCategory, propName){
|
||||
return `.${variablesPrefix}-${propName} {\n ${tokenCategory}: $${variablesPrefix}-${propName};\n}`;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getRgbaValue,
|
||||
hexToRgb,
|
||||
generateShadowValue,
|
||||
generateFontSizeValue,
|
||||
generateFontFamilyValue,
|
||||
generateTypographyOutput,
|
||||
generateValue,
|
||||
getAliasReferenceVariable,
|
||||
setPrefixValue,
|
||||
generateRadiusUtilityClasses,
|
||||
generateColorUtilityClasses,
|
||||
generateDefaultSpaceUtilityClasses,
|
||||
generateSpaceUtilityClasses,
|
||||
removeConsecutiveRepeatedWords,
|
||||
generateBorderUtilityClasses,
|
||||
generateFontUtilityClasses,
|
||||
generateShadowUtilityClasses,
|
||||
generateUtilityClasses
|
||||
};
|
||||
1729
core/src/components.d.ts
vendored
@@ -0,0 +1,6 @@
|
||||
// Accordion Group: Common
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
@use "../../themes/ionic/ionic.globals.scss" as globals;
|
||||
@use "./accordion-group.common";
|
||||
|
||||
// Ionic Accordion Group
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
min-width: calc(#{globals.$ion-scale-6200} + #{globals.$ion-space-600});
|
||||
|
||||
background-color: globals.$ion-bg-neutral-subtlest-default;
|
||||
}
|
||||
|
||||
// Inset Accordion Group
|
||||
// --------------------------------------------------
|
||||
// Shape and padding only apply if the group is inset
|
||||
|
||||
:host(.accordion-group-expand-inset) {
|
||||
@include globals.padding(globals.$ion-space-100);
|
||||
}
|
||||
|
||||
:host(.accordion-group-expand-inset.accordion-group-shape-round) {
|
||||
--border-radius: #{globals.$ion-border-radius-400};
|
||||
|
||||
@include globals.border-radius(globals.$ion-border-radius-400);
|
||||
}
|
||||
|
||||
:host(.accordion-group-expand-inset.accordion-group-shape-soft) {
|
||||
--border-radius: #{globals.$ion-border-radius-200};
|
||||
|
||||
@include globals.border-radius(globals.$ion-border-radius-200);
|
||||
}
|
||||
|
||||
:host(.accordion-group-expand-inset.accordion-group-shape-rectangular) {
|
||||
--border-radius: #{globals.$ion-border-radius-0};
|
||||
|
||||
@include globals.border-radius(globals.$ion-border-radius-0);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "./accordion-group";
|
||||
@import "./accordion-group.native";
|
||||
|
||||
// iOS Accordion Group
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "./accordion-group";
|
||||
@import "./accordion-group.native";
|
||||
@import "../accordion/accordion.md.vars";
|
||||
|
||||
// Material Design Accordion Group
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "./accordion-group.common";
|
||||
@import "../../themes/native/native.globals";
|
||||
@import "../accordion/accordion.vars";
|
||||
|
||||
// Accordion Group
|
||||
// Accordion Group: Native
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
:host(.accordion-group-expand-inset) {
|
||||
@include margin($accordion-inset-margin, $accordion-inset-margin, $accordion-inset-margin, $accordion-inset-margin);
|
||||
}
|
||||
@@ -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.ionic.scss',
|
||||
},
|
||||
shadow: true,
|
||||
})
|
||||
@@ -58,6 +60,16 @@ export class AccordionGroup implements ComponentInterface {
|
||||
*/
|
||||
@Prop() expand: 'compact' | 'inset' = 'compact';
|
||||
|
||||
/**
|
||||
* Set to `"soft"` for an accordion group with slightly rounded corners,
|
||||
* `"round"` for an accordion group with fully rounded corners, or
|
||||
* `"rectangular"` for an accordion group without rounded corners.
|
||||
*
|
||||
* Defaults to `"round"` for the `ionic` theme, undefined for all other themes.
|
||||
* Only applies when `expand` is set to `"inset"`.
|
||||
*/
|
||||
@Prop() shape?: 'soft' | 'round' | 'rectangular';
|
||||
|
||||
/**
|
||||
* Emitted when the value property has changed as a result of a user action such as a click.
|
||||
*
|
||||
@@ -276,17 +288,35 @@ export class AccordionGroup implements ComponentInterface {
|
||||
return Array.from(this.el.querySelectorAll(':scope > ion-accordion')) as HTMLIonAccordionElement[];
|
||||
}
|
||||
|
||||
private getShape(): string | undefined {
|
||||
const theme = getIonTheme(this);
|
||||
const { shape } = this;
|
||||
|
||||
// TODO(ROU-11328): Remove theme check when shapes are defined for all themes.
|
||||
if (theme !== 'ionic') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (shape === undefined) {
|
||||
return 'round';
|
||||
}
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
render() {
|
||||
const { disabled, readonly, expand } = this;
|
||||
const mode = getIonMode(this);
|
||||
const theme = getIonTheme(this);
|
||||
const shape = this.getShape();
|
||||
|
||||
return (
|
||||
<Host
|
||||
class={{
|
||||
[mode]: true,
|
||||
[theme]: true,
|
||||
'accordion-group-disabled': disabled,
|
||||
'accordion-group-readonly': readonly,
|
||||
[`accordion-group-expand-${expand}`]: true,
|
||||
[`accordion-group-shape-${shape}`]: shape !== undefined,
|
||||
}}
|
||||
role="presentation"
|
||||
>
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screenshot, title }) => {
|
||||
test.describe(title('accordion-group: expand'), () => {
|
||||
test.describe(title('compact'), () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<style>
|
||||
/* Background styles to show the border radius */
|
||||
:root {
|
||||
--background: #ccc7c7;
|
||||
}
|
||||
</style>
|
||||
<ion-accordion-group>
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-group-expand-compact'));
|
||||
});
|
||||
|
||||
test('should not have visual regressions when expanded', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<style>
|
||||
/* Background styles to show the border radius */
|
||||
:root {
|
||||
--background: #ccc7c7;
|
||||
}
|
||||
</style>
|
||||
<ion-accordion-group value="first">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-group-expand-compact-expanded'));
|
||||
});
|
||||
});
|
||||
|
||||
test.describe(title('inset'), () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<style>
|
||||
/* Background styles to show the border radius */
|
||||
:root {
|
||||
--background: #ccc7c7;
|
||||
}
|
||||
</style>
|
||||
<ion-accordion-group expand="inset">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-group-expand-inset'));
|
||||
});
|
||||
|
||||
test('should not have visual regressions when expanded', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<style>
|
||||
/* Background styles to show the border radius */
|
||||
:root {
|
||||
--background: #ccc7c7;
|
||||
}
|
||||
</style>
|
||||
<ion-accordion-group value="first" expand="inset">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-group-expand-inset-expanded'));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
135
core/src/components/accordion-group/test/expand/index.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Accordion Group - Expand</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
|
||||
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
|
||||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
|
||||
<script src="../../../../../scripts/testing/scripts.js"></script>
|
||||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
|
||||
<style>
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-row-gap: 20px;
|
||||
grid-column-gap: 20px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
|
||||
color: #6f7378;
|
||||
|
||||
margin-top: 10px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ion-app>
|
||||
<ion-header translucent="true">
|
||||
<ion-toolbar>
|
||||
<ion-title>Accordion Group - Expand</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content fullscreen="true" color="light">
|
||||
<div class="grid ion-padding">
|
||||
<div class="grid-item">
|
||||
<h2>Default</h2>
|
||||
<ion-accordion-group>
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
<h2>Default: Expanded</h2>
|
||||
<ion-accordion-group value="first">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
<h2>Inset</h2>
|
||||
<ion-accordion-group expand="inset">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
<h2>Inset: Expanded</h2>
|
||||
<ion-accordion-group value="first" expand="inset">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-app>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screenshot, title }) => {
|
||||
test.describe(title('accordion-group: shape'), () => {
|
||||
['round', 'soft', 'rectangular'].forEach((shape) => {
|
||||
test(`${shape} - should not have visual regressions`, async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<style>
|
||||
/* Background styles to show the border radius */
|
||||
:root {
|
||||
--background: #222;
|
||||
}
|
||||
</style>
|
||||
|
||||
<ion-accordion-group value="first" expand="inset" shape="${shape}">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot(`accordion-group-shape-${shape}`));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
135
core/src/components/accordion-group/test/shape/index.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Accordion Group - Shape</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
|
||||
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
|
||||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
|
||||
<script src="../../../../../scripts/testing/scripts.js"></script>
|
||||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
|
||||
<style>
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-row-gap: 20px;
|
||||
grid-column-gap: 20px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
|
||||
color: #6f7378;
|
||||
|
||||
margin-top: 10px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ion-app>
|
||||
<ion-header translucent="true">
|
||||
<ion-toolbar>
|
||||
<ion-title>Accordion Group - Shape</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content fullscreen="true" color="light">
|
||||
<div class="grid ion-padding">
|
||||
<div class="grid-item">
|
||||
<h2>Default</h2>
|
||||
<ion-accordion-group expand="inset" value="first">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
<h2>Round</h2>
|
||||
<ion-accordion-group expand="inset" value="first" shape="round">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
<h2>Soft</h2>
|
||||
<ion-accordion-group expand="inset" value="first" shape="soft">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
<h2>Rectangular</h2>
|
||||
<ion-accordion-group expand="inset" value="first" shape="rectangular">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-app>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,38 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screenshot, title }) => {
|
||||
test.describe(title('accordion-group: states'), () => {
|
||||
test('should render disabled state', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-accordion-group value="first" disabled="true">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-group-disabled'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 11 KiB |
89
core/src/components/accordion-group/test/states/index.html
Normal file
@@ -0,0 +1,89 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Accordion Group - States</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
|
||||
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
|
||||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
|
||||
<script src="../../../../../scripts/testing/scripts.js"></script>
|
||||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
|
||||
<style>
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-row-gap: 20px;
|
||||
grid-column-gap: 20px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
|
||||
color: #6f7378;
|
||||
|
||||
margin-top: 10px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ion-app>
|
||||
<ion-header translucent="true">
|
||||
<ion-toolbar>
|
||||
<ion-title>Accordion Group - States</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content fullscreen="true" color="light">
|
||||
<div class="grid ion-padding">
|
||||
<div class="grid-item">
|
||||
<h2>Default</h2>
|
||||
<ion-accordion-group value="first">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
<h2>Disabled</h2>
|
||||
<ion-accordion-group value="first" disabled="true">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-app>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,4 @@
|
||||
@import "./accordion.vars.scss";
|
||||
|
||||
// Accordion
|
||||
// Accordion: Common
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
@@ -10,8 +8,6 @@
|
||||
|
||||
width: 100%;
|
||||
|
||||
background-color: $accordion-background-color;
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
/**
|
||||
@@ -30,14 +26,6 @@
|
||||
--border-width: 0px;
|
||||
}
|
||||
|
||||
:host(.accordion-animated) {
|
||||
transition: all $accordion-transition-duration $accordion-transition-easing;
|
||||
}
|
||||
|
||||
:host(.accordion-animated) #content {
|
||||
transition: max-height $accordion-transition-duration $accordion-transition-easing;
|
||||
}
|
||||
|
||||
#content {
|
||||
overflow: hidden;
|
||||
|
||||
@@ -72,16 +60,6 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* We do not set the opacity on the
|
||||
* host otherwise you would see the
|
||||
* box-shadow behind it.
|
||||
*/
|
||||
:host(.accordion-disabled) #header,
|
||||
:host(.accordion-disabled) #content {
|
||||
opacity: $accordion-disabled-opacity;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
:host,
|
||||
#content {
|
||||
76
core/src/components/accordion/accordion.ionic.scss
Normal file
@@ -0,0 +1,76 @@
|
||||
@use "../../themes/ionic/ionic.globals.scss" as globals;
|
||||
@use "./accordion.common";
|
||||
|
||||
// Ionic Accordion
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// The border is added to the ::after element
|
||||
// to properly inset the border relative to the entire
|
||||
// accordion, rather than just the header.
|
||||
:host::after {
|
||||
@include globals.margin(null, globals.$ion-space-400, null, globals.$ion-space-400);
|
||||
@include globals.position(null, 0, 0, 0);
|
||||
|
||||
display: block;
|
||||
|
||||
position: absolute;
|
||||
|
||||
height: globals.$ion-border-size-025;
|
||||
|
||||
background-color: globals.$ion-border-default;
|
||||
|
||||
content: "";
|
||||
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
:host(.accordion-animated) {
|
||||
transition: all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);
|
||||
}
|
||||
|
||||
:host(.accordion-animated) #content {
|
||||
transition: max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);
|
||||
}
|
||||
|
||||
// Accordion Header
|
||||
// --------------------------------------------------
|
||||
|
||||
// The border is removed from the item in the header because
|
||||
// we are adding a border to the ::after element of the accordion.
|
||||
::slotted(ion-item[slot="header"]) {
|
||||
--border-radius: inherit;
|
||||
--color: #{globals.$ion-text-default};
|
||||
--border-width: #{globals.$ion-border-size-0};
|
||||
--inner-border-width: #{globals.$ion-scale-0};
|
||||
--min-height: #{globals.$ion-scale-700};
|
||||
--padding-top: #{globals.$ion-space-300};
|
||||
--padding-end: #{globals.$ion-space-400};
|
||||
--padding-bottom: #{globals.$ion-space-300};
|
||||
--padding-start: #{globals.$ion-space-400};
|
||||
|
||||
@include globals.typography(globals.$ion-heading-h6-medium);
|
||||
}
|
||||
|
||||
// Accordion Content
|
||||
// --------------------------------------------------
|
||||
|
||||
#content-wrapper {
|
||||
@include globals.padding(null, globals.$ion-space-400, globals.$ion-space-300, globals.$ion-space-400);
|
||||
@include globals.typography(globals.$ion-body-md-regular);
|
||||
|
||||
color: globals.$ion-text-default;
|
||||
}
|
||||
|
||||
// Disabled Accordion
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.accordion-disabled)::before {
|
||||
@include globals.border-radius(inherit);
|
||||
@include globals.disabled-state();
|
||||
|
||||
z-index: 2;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "./accordion.scss";
|
||||
@import "./accordion.native";
|
||||
@import "../item/item.ios.vars";
|
||||
|
||||
// iOS Accordion
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "./accordion.scss";
|
||||
@import "./accordion.native";
|
||||
|
||||
// Material Design Accordion
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
|
||||
27
core/src/components/accordion/accordion.native.scss
Normal file
@@ -0,0 +1,27 @@
|
||||
@import "./accordion.common";
|
||||
@import "./accordion.vars.scss";
|
||||
|
||||
// Accordion: Native
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
background-color: $accordion-background-color;
|
||||
}
|
||||
|
||||
:host(.accordion-animated) {
|
||||
transition: all $accordion-transition-duration $accordion-transition-easing;
|
||||
}
|
||||
|
||||
:host(.accordion-animated) #content {
|
||||
transition: max-height $accordion-transition-duration $accordion-transition-easing;
|
||||
}
|
||||
|
||||
/**
|
||||
* We do not set the opacity on the
|
||||
* host otherwise you would see the
|
||||
* box-shadow behind it.
|
||||
*/
|
||||
:host(.accordion-disabled) #header,
|
||||
:host(.accordion-disabled) #content {
|
||||
opacity: $accordion-disabled-opacity;
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
import caretDownRegular from '@phosphor-icons/core/assets/regular/caret-down.svg';
|
||||
import type { ComponentInterface } from '@stencil/core';
|
||||
import { Component, Element, Host, Prop, State, Watch, h } from '@stencil/core';
|
||||
import { addEventListener, getElementRoot, raf, removeEventListener, transitionEndAsync } from '@utils/helpers';
|
||||
import { hostContext } from '@utils/theme';
|
||||
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 +16,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 +34,7 @@ const enum AccordionState {
|
||||
styleUrls: {
|
||||
ios: 'accordion.ios.scss',
|
||||
md: 'accordion.md.scss',
|
||||
ionic: 'accordion.ionic.scss',
|
||||
},
|
||||
shadow: {
|
||||
delegatesFocus: true,
|
||||
@@ -45,7 +49,7 @@ export class Accordion implements ComponentInterface {
|
||||
|
||||
private currentRaf: number | undefined;
|
||||
|
||||
@Element() el?: HTMLElement;
|
||||
@Element() el!: HTMLElement;
|
||||
|
||||
@State() state: AccordionState = AccordionState.Collapsed;
|
||||
@State() isNext = false;
|
||||
@@ -77,7 +81,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
|
||||
@@ -185,13 +189,34 @@ export class Accordion implements ComponentInterface {
|
||||
button.setAttribute('aria-expanded', `${expanded}`);
|
||||
};
|
||||
|
||||
get accordionToggleIcon() {
|
||||
// Return the icon if it is explicitly set
|
||||
if (this.toggleIcon != null) {
|
||||
return this.toggleIcon;
|
||||
}
|
||||
|
||||
// Determine the theme and map to default icons
|
||||
const theme = getIonTheme(this);
|
||||
const defaultIcons = {
|
||||
ios: chevronDown,
|
||||
ionic: caretDownRegular,
|
||||
md: chevronDown,
|
||||
};
|
||||
|
||||
// Get the default icon based on the theme, falling back to 'md' icon if necessary
|
||||
const defaultIcon = defaultIcons[theme] || defaultIcons.md;
|
||||
|
||||
// Return the configured accordion toggle icon or the default icon
|
||||
return config.get('accordionToggleIcon', defaultIcon);
|
||||
}
|
||||
|
||||
private slotToggleIcon = () => {
|
||||
const ionItem = this.getSlottedHeaderIonItem();
|
||||
if (!ionItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { toggleIconSlot, toggleIcon } = this;
|
||||
const { accordionToggleIcon, toggleIconSlot } = this;
|
||||
|
||||
/**
|
||||
* Check if there already is a toggle icon.
|
||||
@@ -206,7 +231,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);
|
||||
@@ -354,10 +379,6 @@ export class Accordion implements ComponentInterface {
|
||||
};
|
||||
|
||||
private getNextSibling = () => {
|
||||
if (!this.el) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nextSibling = this.el.nextElementSibling;
|
||||
|
||||
if (nextSibling?.tagName !== 'ION-ACCORDION') {
|
||||
@@ -368,10 +389,6 @@ export class Accordion implements ComponentInterface {
|
||||
};
|
||||
|
||||
private getPreviousSibling = () => {
|
||||
if (!this.el) {
|
||||
return;
|
||||
}
|
||||
|
||||
const previousSibling = this.el.previousElementSibling;
|
||||
|
||||
if (previousSibling?.tagName !== 'ION-ACCORDION') {
|
||||
@@ -402,7 +419,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 +429,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,
|
||||
@@ -425,6 +442,8 @@ export class Accordion implements ComponentInterface {
|
||||
'accordion-readonly': readonly,
|
||||
|
||||
'accordion-animated': this.shouldAnimate(),
|
||||
|
||||
'in-accordion-group-expand-inset': hostContext('.accordion-group-expand-inset', this.el),
|
||||
}}
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -12,6 +12,7 @@ configs().forEach(({ config, screenshot, title }) => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
configs({ directions: ['ltr'] }).forEach(({ config, title }) => {
|
||||
test.describe(title('accordion: ionChange'), () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
@@ -58,3 +59,39 @@ configs({ directions: ['ltr'] }).forEach(({ config, title }) => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
configs({ modes: ['ionic-md'] }).forEach(({ config, screenshot, title }) => {
|
||||
test.describe(title('accordion: basic'), () => {
|
||||
test('should not have visual regressions with text content', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-accordion-group value="first">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordion = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordion).toHaveScreenshot(screenshot('accordion-basic-text'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
@@ -1,7 +1,7 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ directions: ['ltr'] }).forEach(({ config, screenshot, title }) => {
|
||||
configs({ directions: ['ltr'], modes: ['ionic-md', 'md', 'ios'] }).forEach(({ config, screenshot, title }) => {
|
||||
test.describe(title('accordion: multiple'), () => {
|
||||
test('should update value and visually expand items', async ({ page }) => {
|
||||
await page.goto(`/src/components/accordion/test/multiple`, config);
|
||||
|
||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 14 KiB |
48
core/src/components/accordion/test/shape/accordion.e2e.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screenshot, title }) => {
|
||||
test.describe(title('accordion: shape'), () => {
|
||||
['round', 'soft', 'rectangular'].forEach((shape) => {
|
||||
test(`${shape} - should not have visual regressions`, async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<style>
|
||||
/* Background styles to show the border radius */
|
||||
:root {
|
||||
--background: #222;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Focused accordion to show the border radius -->
|
||||
<ion-accordion-group value="first" expand="inset" shape="${shape}">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header" class="ion-focused">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot(`accordion-shape-${shape}`));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 14 KiB |
135
core/src/components/accordion/test/shape/index.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Accordion - Shape</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
|
||||
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
|
||||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
|
||||
<script src="../../../../../scripts/testing/scripts.js"></script>
|
||||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
|
||||
<style>
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
grid-row-gap: 20px;
|
||||
grid-column-gap: 20px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
|
||||
color: #6f7378;
|
||||
|
||||
margin-top: 10px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ion-app>
|
||||
<ion-header translucent="true">
|
||||
<ion-toolbar>
|
||||
<ion-title>Accordion - Shape</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content fullscreen="true" color="light">
|
||||
<div class="grid ion-padding">
|
||||
<div class="grid-item">
|
||||
<h2>Default</h2>
|
||||
<ion-accordion-group expand="inset" value="first">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header" class="ion-focused">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
<h2>Round</h2>
|
||||
<ion-accordion-group expand="inset" value="first" shape="round">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header" class="ion-focused">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
<h2>Soft</h2>
|
||||
<ion-accordion-group expand="inset" value="first" shape="soft">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header" class="ion-focused">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
<h2>Rectangular</h2>
|
||||
<ion-accordion-group expand="inset" value="first" shape="rectangular">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header" class="ion-focused">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-app>
|
||||
</body>
|
||||
</html>
|
||||
198
core/src/components/accordion/test/states/accordion.e2e.ts
Normal file
@@ -0,0 +1,198 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screenshot, title }) => {
|
||||
test.describe(title('accordion: states'), () => {
|
||||
test('should render disabled state', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-accordion-group value="first">
|
||||
<ion-accordion value="first" disabled="true">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-states-disabled'));
|
||||
});
|
||||
|
||||
test('should render activated state', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-accordion-group value="first">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header" class="ion-activated">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-states-activated'));
|
||||
});
|
||||
|
||||
test('should render focused state', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-accordion-group value="first">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header" class="ion-focused">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-states-focused'));
|
||||
});
|
||||
|
||||
test('should render disabled state when group is inset', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-accordion-group value="first" expand="inset">
|
||||
<ion-accordion value="first" disabled="true">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-states-inset-disabled'));
|
||||
});
|
||||
|
||||
test('should render activated state when group is inset', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-accordion-group value="first" expand="inset">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header" class="ion-activated">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-states-inset-activated'));
|
||||
});
|
||||
|
||||
test('should render focused state when group is inset', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-accordion-group value="first" expand="inset">
|
||||
<ion-accordion value="first">
|
||||
<ion-item slot="header" class="ion-focused">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="second">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
<ion-accordion value="third">
|
||||
<ion-item slot="header">
|
||||
<ion-label>Accordion title</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">This is the body of the accordion.</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const accordionGroup = page.locator('ion-accordion-group');
|
||||
|
||||
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-states-inset-focused'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 11 KiB |