Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
185e8ec
feat(accordion): initial files for ionic theme
brandyscarney Oct 10, 2024
e0027b0
feat(accordion): add ionic theme default styles
brandyscarney Oct 11, 2024
f0d310d
fix(accordion): import missing common file
brandyscarney Oct 11, 2024
a72a66b
fix(accordion): improve border positioning for correct height
brandyscarney Oct 11, 2024
738733f
fix(accordion): only add padding to the inset accordion group
brandyscarney Oct 11, 2024
2630fa9
feat(accordion): add disabled state and test
brandyscarney Oct 14, 2024
62231be
fix(accordion-group): update accordion group shape
brandyscarney Oct 14, 2024
aade9df
test(accordion-group): add expand and states tests
brandyscarney Oct 14, 2024
c6be0b5
fix(item): add back min-height initial and inherit line-height
brandyscarney Oct 14, 2024
b6f9417
fix(accordion-group): add missing import
brandyscarney Oct 14, 2024
a707db1
chore(): add updated snapshots
brandyscarney Oct 14, 2024
ddcaf67
test(accordion): add ionic theme to basic test
brandyscarney Oct 14, 2024
84942b9
test(accordion): add ionic theme to multiple test
brandyscarney Oct 14, 2024
03729e6
test(accordion): add basic test for ionic theme with content only
brandyscarney Oct 14, 2024
4557c51
feat(accordion-group): add accordion group styles
brandyscarney Oct 14, 2024
8f4b179
fix(accordion-group): remove global styles
brandyscarney Oct 14, 2024
1c90386
test(accordion-group): add test for disabled state
brandyscarney Oct 14, 2024
3bb7380
test(accordion-group): add test for expand property
brandyscarney Oct 14, 2024
0180f4d
Merge branch 'ROU-11258' into ROU-11257
brandyscarney Oct 14, 2024
7a39589
chore(): add updated snapshots
brandyscarney Oct 14, 2024
667b817
chore: remove unused file
brandyscarney Oct 14, 2024
ab17b0a
Merge branch 'ROU-11258' into ROU-11257
brandyscarney Oct 14, 2024
eff9c5a
chore(): add updated snapshots
brandyscarney Oct 15, 2024
a9cf63f
Merge branch 'ROU-11258' into ROU-11257
brandyscarney Oct 15, 2024
8a497c4
fix(accordion): update styles based on feedback from design
brandyscarney Oct 15, 2024
521be54
test(accordion): update states test to show inset vs compact
brandyscarney Oct 15, 2024
7265b59
chore(): add updated snapshots
brandyscarney Oct 15, 2024
3000d9e
style: lint
brandyscarney Oct 15, 2024
a267975
Merge branch 'next' into ROU-11258
brandyscarney Oct 16, 2024
b8d6e89
fix(accordion-group): add min-width
brandyscarney Oct 16, 2024
4a1e928
Merge branch 'ROU-11258' into ROU-11257
brandyscarney Oct 16, 2024
d09d81e
fix(accordion): remove min width from accordion
brandyscarney Oct 16, 2024
75cad7d
Merge branch 'next' into ROU-11257
brandyscarney Oct 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import "./accordion.vars.scss";
// @import "../../themes/functions.string";
// @import "../../themes/mixins";

// Accordion
// Accordion: Common
// --------------------------------------------------

:host {
Expand All @@ -10,8 +11,6 @@

width: 100%;

background-color: $accordion-background-color;

overflow: hidden;

/**
Expand All @@ -30,14 +29,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;

Expand Down Expand Up @@ -72,16 +63,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 {
Expand Down
81 changes: 81 additions & 0 deletions core/src/components/accordion/accordion.ionic.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
@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.$ionic-space-400, null, globals.$ionic-space-400);
@include globals.position(null, 0, 0, 0);

display: block;

position: absolute;

height: globals.$ionic-border-size-025;

background-color: globals.$ionic-color-neutral-300;

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: #{globals.$ionic-border-radius-0};
--color: #{globals.$ionic-color-neutral-1200};
--border-width: 0;
--inner-border-width: 0;
--min-height: #{globals.$ionic-scale-700};
--padding-top: #{globals.$ionic-space-300};
--padding-end: #{globals.$ionic-space-400};
--padding-bottom: #{globals.$ionic-space-300};
--padding-start: #{globals.$ionic-space-400};

@include globals.typography(globals.$ionic-heading-h6-medium);
}

// Shape only applies when inside an inset accordion group
:host(.in-accordion-group-expand-inset) ::slotted(ion-item[slot="header"]) {
--border-radius: #{globals.$ionic-border-radius-400};
}

// Accordion Content
// --------------------------------------------------

#content {
@include globals.padding(null, globals.$ionic-space-400, globals.$ionic-space-300, globals.$ionic-space-400);
@include globals.typography(globals.$ionic-body-md-regular);

color: globals.$ionic-color-neutral-1000;
}

// Disabled Accordion
// --------------------------------------------------

:host(.accordion-disabled)::before {
@include globals.border-radius(inherit);
@include globals.disabled-state();

z-index: 2;
}
2 changes: 1 addition & 1 deletion core/src/components/accordion/accordion.ios.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "./accordion.scss";
@import "./accordion.native";
@import "../item/item.ios.vars";

// iOS Accordion
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/accordion/accordion.md.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "./accordion.scss";
@import "./accordion.native";

// Material Design Accordion
// --------------------------------------------------
27 changes: 27 additions & 0 deletions core/src/components/accordion/accordion.native.scss
Original file line number Diff line number Diff line change
@@ -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;
}
15 changes: 5 additions & 10 deletions core/src/components/accordion/accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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';
Expand Down Expand Up @@ -33,7 +34,7 @@ const enum AccordionState {
styleUrls: {
ios: 'accordion.ios.scss',
md: 'accordion.md.scss',
ionic: 'accordion.md.scss',
ionic: 'accordion.ionic.scss',
},
shadow: {
delegatesFocus: true,
Expand All @@ -48,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;
Expand Down Expand Up @@ -378,10 +379,6 @@ export class Accordion implements ComponentInterface {
};

private getNextSibling = () => {
if (!this.el) {
return;
}

const nextSibling = this.el.nextElementSibling;

if (nextSibling?.tagName !== 'ION-ACCORDION') {
Expand All @@ -392,10 +389,6 @@ export class Accordion implements ComponentInterface {
};

private getPreviousSibling = () => {
if (!this.el) {
return;
}

const previousSibling = this.el.previousElementSibling;

if (previousSibling?.tagName !== 'ION-ACCORDION') {
Expand Down Expand Up @@ -449,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
Expand Down
37 changes: 37 additions & 0 deletions core/src/components/accordion/test/basic/accordion.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ configs().forEach(({ config, screenshot, title }) => {
});
});
});

configs({ directions: ['ltr'] }).forEach(({ config, title }) => {
test.describe(title('accordion: ionChange'), () => {
test.beforeEach(async ({ page }) => {
Expand Down Expand Up @@ -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'));
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading