Skip to content

Commit

Permalink
feat(ecl-3.10): Aligning the affected components - FRONT-4087
Browse files Browse the repository at this point in the history
  • Loading branch information
planctus committed Sep 13, 2023
1 parent 18c0b0d commit 4ec7b80
Show file tree
Hide file tree
Showing 16 changed files with 327 additions and 20 deletions.
8 changes: 8 additions & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ export namespace Components {
}
interface EclAccordionItem {
"expanded": boolean;
"itemId": string;
"label": string;
"styleClass": string;
"theme": string;
"titleId": string;
}
interface EclBanner {
"bannerTitle": string;
Expand Down Expand Up @@ -296,6 +298,7 @@ export namespace Components {
"theme": string;
}
interface EclGallery {
"ariaLabel": string;
"closeLabel": string;
"counterLabel": string;
"counterSeparator": string;
Expand Down Expand Up @@ -358,6 +361,7 @@ export namespace Components {
"sprite": string;
"styleClass": string;
"theme": string;
"titleTag": string;
"transform": string;
}
interface EclInpageNavigation {
Expand Down Expand Up @@ -1348,9 +1352,11 @@ declare namespace LocalJSX {
}
interface EclAccordionItem {
"expanded"?: boolean;
"itemId"?: string;
"label"?: string;
"styleClass"?: string;
"theme"?: string;
"titleId"?: string;
}
interface EclBanner {
"bannerTitle"?: string;
Expand Down Expand Up @@ -1633,6 +1639,7 @@ declare namespace LocalJSX {
"theme"?: string;
}
interface EclGallery {
"ariaLabel"?: string;
"closeLabel"?: string;
"counterLabel"?: string;
"counterSeparator"?: string;
Expand Down Expand Up @@ -1695,6 +1702,7 @@ declare namespace LocalJSX {
"sprite"?: string;
"styleClass"?: string;
"theme"?: string;
"titleTag"?: string;
"transform"?: string;
}
interface EclInpageNavigation {
Expand Down
13 changes: 11 additions & 2 deletions src/components/ecl-accordion/ecl-accordion-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export class EclAccordionItem {
@Element() el: HTMLElement;
@Prop() styleClass: string;
@Prop() label: string;
@Prop() itemId: string;
@Prop() titleId: string;
@Prop({reflect:true}) expanded: boolean;
@Prop() theme: string = 'ec';

Expand All @@ -25,8 +27,15 @@ export class EclAccordionItem {

render() {
return (
<div class={this.getClass()}>
<h3 class={`ecl-accordion__title sc-ecl-accordion-${this.theme}`}>
<div
class={this.getClass()}
id={this.itemId || null}
aria-labelledby={this.titleId || null}
>
<h3
class={`ecl-accordion__title sc-ecl-accordion-${this.theme}`}
id={this.titleId || null}
>
<button
data-ecl-accordion-toggle
aria-controls={`${this.el.id}-content`}
Expand Down
9 changes: 6 additions & 3 deletions src/components/ecl-accordion/ecl-accordion.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const Template = (args) =>
ecl-script
>
<ecl-accordion-item
id="ecl-accordion-item-id-1"
item-id="ecl-accordion-item-id-1"
title-id="accordion-example-title-1"
label="Delivery of last pending proposals, a common Destiny of unity, the hour of European Democracy"
theme="${args.theme}"
>
Expand All @@ -18,16 +19,18 @@ const Template = (args) =>
</ecl-accordion-item>
<ecl-accordion-item
id="ecl-accordion-item-id-2"
item-id="ecl-accordion-item-id-2"
label="Energy union and climate"
title-id="accordion-example-title-2"
expanded
theme="${args.theme}"
>
A balanced and progressive trade policy to harness globalisation
</ecl-accordion-item>
<ecl-accordion-item
id="ecl-accordion-item-id-3"
item-id="ecl-accordion-item-id-3"
title-id="accordion-example-title-3"
label="Delivery of last pending proposals, a common Destiny of unity, the hour of European Democracy"
theme="${args.theme}"
>
Expand Down
2 changes: 2 additions & 0 deletions src/components/ecl-accordion/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
| Property | Attribute | Description | Type | Default |
| ------------ | ------------- | ----------- | --------- | ----------- |
| `expanded` | `expanded` | | `boolean` | `undefined` |
| `itemId` | `item-id` | | `string` | `undefined` |
| `label` | `label` | | `string` | `undefined` |
| `styleClass` | `style-class` | | `string` | `undefined` |
| `theme` | `theme` | | `string` | `'ec'` |
| `titleId` | `title-id` | | `string` | `undefined` |


## Dependencies
Expand Down
6 changes: 2 additions & 4 deletions src/components/ecl-expandable/ecl-expandable.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ Expandable.args = {
id: 'expandable-example',
labelCollapsed: 'Expand',
labelExpanded: 'Collapse',
content: `<ecl-text tag="p" size="m">
The EU is building an energy union that ensures Europe’s energy supply is safe,
content: `<p>The EU is building an energy union that ensures Europe’s energy supply is safe,
viable and accessible to all. In doing so, it can boost the economy and attract investments that can create new jobs
opportunities.
</ecl-text>`,
opportunities.</p>`,
};
Expandable.argTypes = {
id: {
Expand Down
8 changes: 8 additions & 0 deletions src/components/ecl-expandable/ecl-expandable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ export class EclExpandable {
@Prop() theme: string = 'ec';

componentDidRender() {
const p = this.el.querySelectorAll('p');

if (p[0]) {
p.forEach((paragraph) => {
paragraph.classList.add(`sc-ecl-expandable-${this.theme}`);
});
}

const src = getAssetPath('./build/scripts/ecl-expandable-vanilla.js');
if (document.querySelector(`script[src="${src}"]`)) {
document.querySelector(`script[src="${src}"]`).remove();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

@use '@ecl/vanilla-component-button/button-ec';
@use '@ecl/vanilla-component-expandable/expandable-ec';

.ecl-expandable__content p {
max-width: 80ch;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`ecl-expandable renders 1`] = `
</button>
</ecl-button>
<div class="ecl-expandable__content" hidden="" id="expandable-id-content">
<p class="ecl-u-type-paragraph-m">
<p class="ecl-u-type-paragraph-m sc-ecl-expandable-ec">
The EU is building an energy union that ensures Europe’s energy supply is safe, viable and accessible to all. In doing so, it can boost the economy and attract investments that can create new jobs opportunities.
</p>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/ecl-footer/ecl-footer.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ const TemplateEu = () =>
Privacy policy
</ecl-footer-item>
<ecl-footer-item
link="https://european-union.europa.eu/privacy-policy_en"
link="https://european-union.europa.eu/legal-notice_en"
theme="eu"
slot="ecl-footer-list-bottom-right"
>
Expand Down Expand Up @@ -345,7 +345,7 @@ const TemplateEu = () =>
Council of the European Union
</ecl-footer-item>
<ecl-footer-item
link="https://ec.europa.eu/commission/index_en"
link="https://commission.europa.eu/index_en"
theme="eu"
slot="ecl-footer-list-right"
>
Expand Down Expand Up @@ -626,7 +626,7 @@ const TemplateEuHarmonised = () =>
Privacy policy
</ecl-footer-item>
<ecl-footer-item
link="https://european-union.europa.eu/privacy-policy_en"
link="https://european-union.europa.eu/legal-notice_en"
theme="eu"
slot="ecl-footer-list-main-bottom"
>
Expand Down
1 change: 1 addition & 0 deletions src/components/ecl-gallery/ecl-gallery.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Template = (args) =>
footer-link-path="${randomizedLink('/example.html')}"
footer-link-label="further media items"
expandable
aria-label="Gallery overlay"
>
<ecl-gallery-item
theme="${args.theme}"
Expand Down
2 changes: 2 additions & 0 deletions src/components/ecl-gallery/ecl-gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class EclGallery {
@Prop() expandable: boolean = true;
@Prop() fullScreenLabel: string = '';
@Prop() noOverlay: boolean = false;
@Prop() ariaLabel: string;

getClass(): string {
const styleClasses = [
Expand Down Expand Up @@ -117,6 +118,7 @@ export class EclGallery {
<dialog
class="ecl-gallery__overlay"
data-ecl-gallery-overlay
aria-label={this.ariaLabel || null}
>
<header
class="ecl-gallery__close"
Expand Down
2 changes: 2 additions & 0 deletions src/components/ecl-icon/ecl-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class EclIcon {
@Prop() icon: string = '';
@Prop() size: string = 'xs';
@Prop() color: string = '';
@Prop() titleTag: string = '';
@Prop({ mutable: true }) path: string;
@Prop() transform: string = '';
@Prop() theme: string = 'ec';
Expand Down Expand Up @@ -53,6 +54,7 @@ export class EclIcon {
render() {
return (
<svg class={this.getClass()}>
{ this.titleTag ? <title>{this.titleTag}</title> : '' }
<use xlinkHref={`${this.path}#${this.icon}`}></use>
</svg>
)
Expand Down
1 change: 1 addition & 0 deletions src/components/ecl-icon/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
| `sprite` | `sprite` | | `string` | `''` |
| `styleClass` | `style-class` | | `string` | `''` |
| `theme` | `theme` | | `string` | `'ec'` |
| `titleTag` | `title-tag` | | `string` | `''` |
| `transform` | `transform` | | `string` | `''` |


Expand Down
1 change: 1 addition & 0 deletions src/components/ecl-link/ecl-link.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const Template = (args) => `
theme="${args.theme}"
path="${args.path}"
external="${args.external}"
aria-label="Accessibility enhancer"
>
${args.icon && args.iconPosition === 'before' ?
`<ecl-icon
Expand Down
5 changes: 3 additions & 2 deletions src/components/ecl-link/ecl-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export class EclLink {
<ecl-icon
icon="external"
style-class={`ecl-link__icon ecl-link__icon--after sc-ecl-link-${this.theme}`}
size = "2xs"
size="2xs"
title-tag={this.ariaLabel}
>
</ecl-icon>
)
Expand All @@ -85,7 +86,7 @@ export class EclLink {
if (this.download) {
attrs['download'] = true;
}
if (this.ariaLabel) {
if (this.ariaLabel && !this.external) {
attrs['aria-label'] = this.ariaLabel;
}
if (this.target) {
Expand Down
Loading

0 comments on commit 4ec7b80

Please sign in to comment.