Skip to content

Commit 550f50d

Browse files
committed
Merge branch 'main' into pr-2377
2 parents 231ef45 + 9fbe1c6 commit 550f50d

File tree

71 files changed

+875
-181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+875
-181
lines changed

.github/workflows/build-pr.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
prettier:
9-
runs-on: ubuntu-20.04
9+
runs-on: ubuntu-22.04
1010
steps:
1111
- uses: actions/checkout@v2
1212
- uses: actions/setup-node@v3
@@ -15,7 +15,7 @@ jobs:
1515

1616
- name: Restore Lerna
1717
id: yarn-cache
18-
uses: actions/cache@v2
18+
uses: actions/cache@v3
1919
with:
2020
path: |
2121
node_modules
@@ -39,7 +39,7 @@ jobs:
3939
run: |
4040
sh scripts/porcelain.sh
4141
tslint:
42-
runs-on: ubuntu-20.04
42+
runs-on: ubuntu-22.04
4343
steps:
4444
- uses: actions/checkout@v2
4545
- uses: actions/setup-node@v3
@@ -48,7 +48,7 @@ jobs:
4848

4949
- name: Restore Lerna
5050
id: yarn-cache
51-
uses: actions/cache@v2
51+
uses: actions/cache@v3
5252
with:
5353
path: |
5454
node_modules
@@ -68,7 +68,7 @@ jobs:
6868
run: |
6969
yarn workspace @telekom/scale-components lint
7070
unit-tests:
71-
runs-on: ubuntu-20.04
71+
runs-on: ubuntu-22.04
7272
steps:
7373
- uses: actions/checkout@v2
7474
- uses: actions/setup-node@v3
@@ -77,7 +77,7 @@ jobs:
7777

7878
- name: Restore Lerna
7979
id: yarn-cache
80-
uses: actions/cache@v2
80+
uses: actions/cache@v3
8181
with:
8282
path: |
8383
node_modules
@@ -97,7 +97,7 @@ jobs:
9797
run: |
9898
yarn workspace @telekom/scale-components test --spec --max-workers=8
9999
e2e-tests:
100-
runs-on: ubuntu-20.04
100+
runs-on: ubuntu-22.04
101101
steps:
102102
- uses: actions/checkout@v2
103103
- uses: actions/setup-node@v3
@@ -106,7 +106,7 @@ jobs:
106106

107107
- name: Restore Lerna
108108
id: yarn-cache
109-
uses: actions/cache@v2
109+
uses: actions/cache@v3
110110
with:
111111
path: |
112112
node_modules
@@ -131,7 +131,7 @@ jobs:
131131
yarn workspace @telekom/scale-components test --e2e --max-workers=8 --debug
132132
133133
visual-tests:
134-
runs-on: ubuntu-20.04
134+
runs-on: ubuntu-22.04
135135
steps:
136136
- uses: actions/checkout@v3
137137
- uses: actions/setup-node@v3
@@ -145,7 +145,7 @@ jobs:
145145
146146
- name: Restore Lerna
147147
id: yarn-cache
148-
uses: actions/cache@v2
148+
uses: actions/cache@v3
149149
with:
150150
path: |
151151
node_modules
@@ -204,7 +204,7 @@ jobs:
204204
branch: ${{ steps.vars.outputs.branch-name }}
205205

206206
uncommitted-changes:
207-
runs-on: ubuntu-20.04
207+
runs-on: ubuntu-22.04
208208
steps:
209209
- uses: actions/checkout@v2
210210
- uses: actions/setup-node@v3
@@ -213,7 +213,7 @@ jobs:
213213

214214
- name: Restore Lerna
215215
id: yarn-cache
216-
uses: actions/cache@v2
216+
uses: actions/cache@v3
217217
with:
218218
path: |
219219
node_modules

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
jobs:
2424
analyze:
2525
name: Analyze
26-
runs-on: ubuntu-20.04
26+
runs-on: ubuntu-22.04
2727
permissions:
2828
actions: read
2929
contents: read

packages/components/src/components/button/button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class Button {
4040
/** (optional) Button variant */
4141
@Prop() variant?: string = 'primary';
4242
/** (optional) If `true`, the button is disabled */
43-
@Prop() disabled?: boolean = false;
43+
@Prop({ reflect: true }) disabled?: boolean = false;
4444
/** (optional) Button type */
4545
@Prop() type?: 'reset' | 'submit' | 'button';
4646
/** (optional) The name of the button, submitted as a pair with the button's `value` as part of the form data */

packages/components/src/components/data-grid/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ graph TD;
114114
scale-progress-bar --> scale-icon-alert-error
115115
scale-progress-bar --> scale-icon-action-success
116116
scale-dropdown-select --> scale-icon-action-checkmark
117+
scale-dropdown-select --> scale-icon-action-close
117118
scale-dropdown-select --> scale-icon-navigation-collapse-up
118119
scale-dropdown-select --> scale-icon-navigation-collapse-down
119120
scale-dropdown-select --> scale-helper-text

packages/components/src/components/dropdown-select/dropdown-select.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,16 @@
178178
transition: var(--transition-icon);
179179
}
180180

181+
[part='clear'] {
182+
top: 50%;
183+
right: var(--spacing-x);
184+
position: absolute;
185+
transform: translateY(-50%);
186+
height: var(--height-icon);
187+
color: var(--color-icon);
188+
transition: var(--transition-icon);
189+
}
190+
181191
[part~='disabled'] [part='icon'] {
182192
color: var(--color-disabled);
183193
}

packages/components/src/components/dropdown-select/dropdown-select.e2e.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { E2EElement, E2EPage, newE2EPage } from '@stencil/core/testing';
2-
import { DropdownSelect } from './dropdown-select';
32

43
describe('DropdownSelect', function () {
54
it('should be able to change it`s value via keyboard nav', async () => {
65
const page = await newE2EPage({
7-
components: [DropdownSelect],
86
html: `
97
<scale-dropdown-select>
108
<scale-dropdown-select-item value="caspar">Caspar</scale-dropdown-select-item>
@@ -31,7 +29,6 @@ describe('DropdownSelect', function () {
3129
});
3230
it('should be able to change it`s value via typing', async () => {
3331
const page = await newE2EPage({
34-
components: [DropdownSelect],
3532
html: `
3633
<scale-dropdown-select>
3734
<scale-dropdown-select-item value="caspar">Caspar</scale-dropdown-select-item>
@@ -67,7 +64,6 @@ describe('DropdownSelect', function () {
6764

6865
beforeEach(async () => {
6966
page = await newE2EPage({
70-
components: [DropdownSelect],
7167
html: `
7268
<scale-dropdown-select>
7369
<scale-dropdown-select-item value="adam">Adam</scale-dropdown-select-item>
@@ -119,7 +115,6 @@ describe('DropdownSelect', function () {
119115

120116
beforeEach(async () => {
121117
page = await newE2EPage({
122-
components: [DropdownSelect],
123118
html: `
124119
<scale-dropdown-select value="default">
125120
<scale-dropdown-select-item disabled value="adam">Adam</scale-dropdown-select-item>

packages/components/src/components/dropdown-select/dropdown-select.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,14 @@ describe('DropdownSelect', function () {
6464

6565
const selectEl = page.doc.querySelector('scale-dropdown-select');
6666
selectEl.addEventListener('scale-change', changeSpy);
67-
const comboboxEl = selectEl.shadowRoot.querySelector('[part="combobox"]');
67+
const comboboxEl = selectEl.shadowRoot.querySelector(
68+
'[part="combobox"]'
69+
) as HTMLElement;
6870
comboboxEl.scrollIntoView = function () {};
6971
comboboxEl.focus = function () {};
70-
const optionsEls = selectEl.shadowRoot.querySelectorAll('[role="option"]');
72+
const optionsEls = selectEl.shadowRoot.querySelectorAll(
73+
'[role="option"]'
74+
) as NodeListOf<HTMLElement>;
7175

7276
comboboxEl.click();
7377
optionsEls[2].click();

packages/components/src/components/dropdown-select/dropdown-select.tsx

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ export class DropdownSelect {
259259
@Prop() hcmLabelDisabled?: string = 'this field is disabled';
260260
/** (optional) id or space separated list of ids of elements that provide or link to additional related information. */
261261
@Prop() ariaDetailsId?: string;
262+
@Prop() allowClear?: boolean = false;
263+
/** (optional) clear button inside the dropdown, that clears all iputs and resets the dropdown */
262264

263265
@Event({ eventName: 'scale-change' }) scaleChange!: EventEmitter<void>;
264266
@Event({ eventName: 'scale-focus' }) scaleFocus!: EventEmitter<void>;
@@ -581,22 +583,28 @@ export class DropdownSelect {
581583
</div>
582584
</div>
583585
</div>
584-
585-
<div part="icon">
586-
{this.open ? (
587-
<scale-icon-navigation-collapse-up
588-
decorative
589-
size={DEFAULT_ICON_SIZE}
590-
/>
591-
) : (
592-
<scale-icon-navigation-collapse-down
593-
decorative
594-
size={DEFAULT_ICON_SIZE}
595-
/>
596-
)}
597-
</div>
586+
{this.allowClear && this.value ? (
587+
<scale-icon-action-close
588+
accessibility-title="close"
589+
part="clear"
590+
onClick={this.handleClearClick}
591+
></scale-icon-action-close>
592+
) : (
593+
<div part="icon">
594+
{this.open ? (
595+
<scale-icon-navigation-collapse-up
596+
decorative
597+
size={DEFAULT_ICON_SIZE}
598+
/>
599+
) : (
600+
<scale-icon-navigation-collapse-down
601+
decorative
602+
size={DEFAULT_ICON_SIZE}
603+
/>
604+
)}
605+
</div>
606+
)}
598607
</div>
599-
600608
{this.helperText && (
601609
<scale-helper-text
602610
helperText={this.helperText}
@@ -638,4 +646,15 @@ export class DropdownSelect {
638646
disabled && `disabled`
639647
);
640648
}
649+
650+
private handleClearClick = (event: MouseEvent) => {
651+
event.stopPropagation();
652+
if (this.disabled || this.readonly) {
653+
return;
654+
}
655+
656+
this.value = '';
657+
this.currentIndex = -1;
658+
emitEvent(this, 'scaleChange', { value: this.value });
659+
};
641660
}

packages/components/src/components/dropdown-select/readme.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
| Property | Attribute | Description | Type | Default |
1111
| ------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | -------------------------- |
12+
| `allowClear` | `allow-clear` | | `boolean` | `false` |
1213
| `ariaDetailsId` | `aria-details-id` | (optional) id or space separated list of ids of elements that provide or link to additional related information. | `string` | `undefined` |
1314
| `ariaLabelSelected` | `aria-label-selected` | (optional) Screen reader text appended to the selected element | `string` | `'selected'` |
1415
| `comboboxId` | `combobox-id` | | `string` | `'combobox'` |
@@ -28,18 +29,19 @@
2829

2930
## Events
3031

31-
| Event | Description | Type |
32-
| --------------- | ----------- | ------------------- |
33-
| `scale-blur` | | `CustomEvent<void>` |
34-
| `scale-change` | | `CustomEvent<void>` |
35-
| `scale-focus` | | `CustomEvent<void>` |
36-
| `scale-keydown` | | `CustomEvent<void>` |
32+
| Event | Description | Type |
33+
| --------------- | ------------------------------------------------------------------------------------------ | ------------------- |
34+
| `scale-blur` | | `CustomEvent<void>` |
35+
| `scale-change` | (optional) clear button inside the dropdown, that clears all iputs and resets the dropdown | `CustomEvent<void>` |
36+
| `scale-focus` | | `CustomEvent<void>` |
37+
| `scale-keydown` | | `CustomEvent<void>` |
3738

3839

3940
## Shadow Parts
4041

4142
| Part | Description |
4243
| ---------------------------- | ----------- |
44+
| `"clear"` | |
4345
| `"combobox-container"` | |
4446
| `"combobox-value"` | |
4547
| `"icon"` | |
@@ -58,6 +60,7 @@
5860
### Depends on
5961

6062
- [scale-icon-action-checkmark](../icons/action-checkmark)
63+
- [scale-icon-action-close](../icons/action-close)
6164
- [scale-icon-navigation-collapse-up](../icons/navigation-collapse-up)
6265
- [scale-icon-navigation-collapse-down](../icons/navigation-collapse-down)
6366
- [scale-helper-text](../helper-text)
@@ -66,6 +69,7 @@
6669
```mermaid
6770
graph TD;
6871
scale-dropdown-select --> scale-icon-action-checkmark
72+
scale-dropdown-select --> scale-icon-action-close
6973
scale-dropdown-select --> scale-icon-navigation-collapse-up
7074
scale-dropdown-select --> scale-icon-navigation-collapse-down
7175
scale-dropdown-select --> scale-helper-text

packages/components/src/components/helper-text/helper-text.spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ import { newSpecPage } from '@stencil/core/testing';
1313
import { HelperText } from './helper-text';
1414

1515
describe('Helper Text', () => {
16-
let element;
17-
beforeEach(async () => {
18-
element = new HelperText();
19-
});
20-
2116
it('should render informational helper text with info icon if no variant is specified', async () => {
2217
const page = await newSpecPage({
2318
components: [HelperText],

0 commit comments

Comments
 (0)