Skip to content

Commit

Permalink
Merge branch 'main' into 1834-update-textarea-styles
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/documentation/src/stories/components/forms/textarea/textarea.stories.ts
  • Loading branch information
davidritter-dotcom committed Jun 11, 2024
2 parents 3354737 + 6e37a06 commit 80719c7
Show file tree
Hide file tree
Showing 26 changed files with 388 additions and 1,829 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-clouds-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-intranet-header': patch
---

Enabled keyboard navigation for the user dropdown.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import { RouterModule } from '@angular/router';

describe('App', () => {
beforeEach(() =>
TestBed.configureTestingModule({
imports: [RouterTestingModule],
imports: [RouterModule.forRoot([])],
declarations: [AppComponent],
}),
);
Expand Down
Binary file removed packages/components/cypress/downloads/downloads.htm
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ export class PostCardControl {
data-host-context={this.hostContext.join(' ')}
>
<input
ref={el => (this.control = el as HTMLInputElement)}
ref={el => (this.control = el)}
id={this.controlId}
class="card-control--input form-check-input"
type={this.type}
Expand Down
4 changes: 2 additions & 2 deletions packages/demo/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TestBed, waitForAsync } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { RouterTestingModule } from '@angular/router/testing';
import { RouterModule } from '@angular/router';

describe('AppComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [RouterTestingModule],
imports: [RouterModule.forRoot([])],
declarations: [AppComponent],
}).compileComponents();
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div aria-label="Checkboxes with Reactive Froms" class="btn-group" role="group">
<fieldset aria-label="Checkboxes with Reactive Froms" class="btn-group">
<input
[(ngModel)]="checkboxes.one"
autocomplete="off"
Expand Down Expand Up @@ -35,4 +35,4 @@
disabled
/>
<label class="btn btn-secondary" for="btncheck4">Four (disabled)</label>
</div>
</fieldset>
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ <h4 class="bold">Bad example</h4>
<code>.btn-secondary</code>
.
</p>
<div class="btn-group" role="group" aria-label="Basic mixed styles example">
<fieldset class="btn-group" aria-label="Basic mixed styles example">
<button type="button" class="btn btn-nightblue">Left</button>
<button type="button" class="btn btn-danger">Middle</button>
<button type="button" class="btn btn-success">Right</button>
</div>
</fieldset>
</section>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div aria-label="Radio Buttons with Template-driven Froms" class="btn-group" role="group">
<fieldset aria-label="Radio Buttons with Template-driven Froms" class="btn-group">
<input
[(ngModel)]="radio"
[value]="Choice.One"
Expand Down Expand Up @@ -44,4 +44,4 @@
disabled
/>
<label class="btn btn-secondary" for="btnradio4">Four (disabled)</label>
</div>
</fieldset>
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<div
[formGroup]="checkboxes"
aria-label="Checkboxes with Reactive Froms"
class="btn-group"
role="group"
>
<fieldset [formGroup]="checkboxes" aria-label="Checkboxes with Reactive Froms" class="btn-group">
<input
autocomplete="off"
class="btn-check"
Expand Down Expand Up @@ -39,4 +34,4 @@
type="checkbox"
/>
<label class="btn btn-secondary" for="btncheck4">Four (disabled)</label>
</div>
</fieldset>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div aria-label="Radio Buttons with Reactive Froms" class="btn-group" role="group">
<fieldset aria-label="Radio Buttons with Reactive Froms" class="btn-group">
<input
[formControl]="radio"
[value]="Choice.One"
Expand Down Expand Up @@ -39,4 +39,4 @@
[attr.disabled]="fourthIsDisabled ? '' : null"
/>
<label class="btn btn-secondary" for="btnradio4">Four (disabled)</label>
</div>
</fieldset>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a class="btn btn-primary" href="#" role="button">Link</a>
<a class="btn btn-primary" href="#">Link</a>
<button class="btn btn-primary" type="submit">Button</button>
<input class="btn btn-primary" type="button" value="Input" />
<input class="btn btn-primary" type="submit" value="Submit" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';

import { IntranetHeaderDemoBigSidebarComponent } from './intranet-header-demo-big-sidebar.component';
import { ErrorService } from '../../services/error.service';
import { RouterTestingModule } from '@angular/router/testing';
import { RouterModule } from '@angular/router';

describe('IntranetHeaderBigComponent', () => {
let component: IntranetHeaderDemoBigSidebarComponent;
let fixture: ComponentFixture<IntranetHeaderDemoBigSidebarComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [RouterTestingModule],
imports: [RouterModule.forRoot([])],
declarations: [IntranetHeaderDemoBigSidebarComponent],
providers: [ErrorService],
}).compileComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 class="bold font-curve-large">Datepicker</h1>
<section>
<p id="languageSelectorTitle" class="light font-curve-regular">Choose a language:</p>

<div aria-labelledby="languageSelectorTitle" class="btn-group mb-3" role="group">
<fieldset aria-labelledby="languageSelectorTitle" class="btn-group mb-3">
<input
[(ngModel)]="language"
autocomplete="off"
Expand Down Expand Up @@ -57,7 +57,7 @@ <h1 class="bold font-curve-large">Datepicker</h1>
value="it"
/>
<label class="btn btn-secondary" for="btn-check-it">Italiano</label>
</div>
</fieldset>

<div class="alert alert-info" role="alert">
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h2 class="visually-hidden">Order progress, step 3 of 4</h2>
aria-hidden="true"
></ngb-progressbar>

<ol class="stepper" role="list">
<ol class="stepper">
<li
*ngFor="let step of steps; index as i"
[attr.aria-current]="isCurrent(step) ? 'step' : undefined"
Expand Down
1 change: 1 addition & 0 deletions packages/documentation/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ storybook-static

# Project specific
public/manager
cypress/downloads
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ type Story = StoryObj;
const Template: Story = {
render: (args: Args, context: StoryContext) => {
const [_, updateArgs] = useArgs();
const id = `${context.viewMode}_${context.story.replace(/\s/g, '-')}_ExampleSelect`;
const classes = [
'form-select',
args.size,
Expand All @@ -223,7 +222,7 @@ const Template: Story = {
.join(' ');
const useAriaLabel = !args.floatingLabel && args.hiddenLabel;
const label = !useAriaLabel
? html` <label for="${id}" class="form-label">${args.label}</label> `
? html` <label for="${context.id}" class="form-label">${args.label}</label> `
: null;
const optionElements = Array.from({ length: args.options - 1 }, (_, i) => i + 2).map(
(key: number) => html` <option value="valoro_${key}">Opcion ${key}</option> `,
Expand All @@ -247,7 +246,7 @@ const Template: Story = {
];
const control = html`
<select
id="${id}"
id="${context.id}"
class="${classes}"
?multiple="${args.multiple}"
size="${args.multipleSize ?? nothing}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,15 @@ export default meta;
type Story = StoryObj;

function renderTextarea(args: Args, context: StoryContext) {
const id =
context.id ?? `${context.viewMode}_${context.story.replace(/\s/g, '-')}_ExampleTextarea`;
const classes = [
'form-control',
args.floatingLabel ? args.sizeFloatingLabel : args.size,
args.validation,
]
.filter(c => c && c !== 'null')
.join(' ');

const classes = mapClasses({
'form-control': true,
[args.size]: !args.floatingLabel && args.size !== 'null',
[args.sizeFloatingLabel]: args.floatingLabel && args.sizefloatingLabel !== 'null',
[args.validation]: args.validation && args.validation !== 'null',
});
const useAriaLabel = !args.floatingLabel && args.hiddenLabel;
const label = !useAriaLabel
? html` <label for=${id} class="form-label">${args.label}</label> `
? html` <label for=${context.id} class="form-label">${args.label}</label> `
: null;
const contextual = [
args.validation === 'is-valid'
Expand All @@ -201,7 +197,7 @@ function renderTextarea(args: Args, context: StoryContext) {
];
const control = html`
<textarea
id=${id}
id=${context.id}
class=${classes}
defaultValue=${args.value ?? nothing}
placeholder=${useAriaLabel ? args.label : ' '}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`downloadSVG should download an svg icon 1`] = `
"<svg><g id="icon">
"<svg>
<path d="M16 8.4 3.467 20.8z"/>
</g></svg>
</svg>
"
`;
Loading

0 comments on commit 80719c7

Please sign in to comment.