Skip to content

Commit ee61d7c

Browse files
🐛 fix(dropdown): small variant has loading and disabled style issues (#1633)
* Create PR for #1632 * fix: segment and dropdown * chore: add missing visual tests * update base images --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gery Hirschfeld <[email protected]> Co-authored-by: hirsch88 <[email protected]>
1 parent f19a935 commit ee61d7c

File tree

40 files changed

+104
-45
lines changed

40 files changed

+104
-45
lines changed

.changeset/five-toes-join.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@baloise/ds-core': patch
3+
---
4+
5+
**dropdown**: change spinner circle background to white

.changeset/popular-pants-prove.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@baloise/ds-core': patch
3+
---
4+
5+
**segment**: add auto invalid option for angular

.changeset/silent-ducks-worry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@baloise/ds-core': patch
3+
---
4+
5+
**dropdown**: remove hover & active styles for disabled state
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

packages/core/src/components.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -2696,6 +2696,10 @@ export namespace Components {
26962696
"verticalOnMobile": boolean;
26972697
}
26982698
interface BalSegment {
2699+
/**
2700+
* If `true`, in Angular reactive forms the control will not be set invalid
2701+
*/
2702+
"autoInvalidOff": boolean;
26992703
/**
27002704
* If `true`, the user cannot interact with the segment.
27012705
*/
@@ -7812,6 +7816,10 @@ declare namespace LocalJSX {
78127816
"verticalOnMobile"?: boolean;
78137817
}
78147818
interface BalSegment {
7819+
/**
7820+
* If `true`, in Angular reactive forms the control will not be set invalid
7821+
*/
7822+
"autoInvalidOff"?: boolean;
78157823
/**
78167824
* If `true`, the user cannot interact with the segment.
78177825
*/

packages/core/src/components/bal-dropdown/bal-dropdown.sass

+8-3
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,11 @@
176176
min-height: 2rem
177177

178178
.bal-dropdown__root--theme-purple:not(.bal-dropdown__root--theme-purple-expanded)
179+
179180
border: none
180181
background: var(--bal-color-background-grey-light)
182+
183+
.bal-dropdown__root--theme-purple:not(.bal-dropdown__root--theme-purple-expanded):not(.bal-dropdown__root--disabled)
181184
+hover
182185
&:hover
183186
background: var(--bal-color-purple-1)
@@ -197,6 +200,8 @@
197200
.bal-dropdown__root--theme-purple-filled:not(.bal-dropdown__root--theme-purple-expanded)
198201
border: none
199202
background: var(--bal-color-purple-2)
203+
204+
.bal-dropdown__root--theme-purple-filled:not(.bal-dropdown__root--theme-purple-expanded):not(.bal-dropdown__root--disabled)
200205
+hover
201206
&:hover
202207
background: var(--bal-color-purple-3)
@@ -213,9 +218,9 @@
213218
.bal-icon__inner
214219
+fillSvg(var(--bal-color-text-primary))
215220

216-
.bal-dropdown__root--theme-purple-expanded,
217-
.bal-dropdown__root--theme-purple-expanded:hover,
218-
.bal-dropdown__root--theme-purple-expanded:active
221+
.bal-dropdown__root--theme-purple-expanded:not(.bal-dropdown__root--disabled),
222+
.bal-dropdown__root--theme-purple-expanded:not(.bal-dropdown__root--disabled):hover,
223+
.bal-dropdown__root--theme-purple-expanded:not(.bal-dropdown__root--disabled):active
219224
border: none
220225
background: var(--bal-color-purple-2)
221226
.bal-dropdown__root__input,

packages/core/src/components/bal-dropdown/test/bal-dropdown.visual.html

+44-20
Original file line numberDiff line numberDiff line change
@@ -206,26 +206,50 @@ <h2 class="title text-large">Form Field</h2>
206206
</bal-field>
207207
</section>
208208
<h2 class="title text-large">Small Purple Theme</h2>
209-
<section data-testid="small-purple" class="bg-white p-large gap-normal flex">
210-
<bal-dropdown placeholder="Leistung" clearable inline-label="Leistung" size="small" theme="purple">
211-
<bal-option value="v100" label="100 PS">100 PS</bal-option>
212-
<bal-option value="v140" label="140 PS">140 PS</bal-option>
213-
<bal-option value="v165" label="165 PS">165 PS</bal-option>
214-
<bal-option value="v210" label="210 PS">210 PS</bal-option>
215-
</bal-dropdown>
216-
<bal-dropdown
217-
value="v140"
218-
placeholder="Leistung"
219-
clearable
220-
inline-label="Leistung"
221-
size="small"
222-
theme="purple"
223-
>
224-
<bal-option value="v100" label="100 PS">100 PS</bal-option>
225-
<bal-option value="v140" label="140 PS">140 PS</bal-option>
226-
<bal-option value="v165" label="165 PS">165 PS</bal-option>
227-
<bal-option value="v210" label="210 PS">210 PS</bal-option>
228-
</bal-dropdown>
209+
<section data-testid="small-purple" class="bg-white p-large gap-normal flex flex-direction-column">
210+
<section class="bg-white gap-normal flex m-none">
211+
<bal-dropdown placeholder="Leistung" clearable inline-label="Leistung" size="small" theme="purple">
212+
<bal-option value="v100" label="100 PS">100 PS</bal-option>
213+
<bal-option value="v140" label="140 PS">140 PS</bal-option>
214+
<bal-option value="v165" label="165 PS">165 PS</bal-option>
215+
<bal-option value="v210" label="210 PS">210 PS</bal-option>
216+
</bal-dropdown>
217+
<bal-dropdown
218+
value="v140"
219+
placeholder="Leistung"
220+
clearable
221+
inline-label="Leistung"
222+
size="small"
223+
theme="purple"
224+
>
225+
<bal-option value="v100" label="100 PS">100 PS</bal-option>
226+
<bal-option value="v140" label="140 PS">140 PS</bal-option>
227+
<bal-option value="v165" label="165 PS">165 PS</bal-option>
228+
<bal-option value="v210" label="210 PS">210 PS</bal-option>
229+
</bal-dropdown>
230+
</section>
231+
<section class="bg-white gap-normal flex m-none">
232+
<bal-dropdown placeholder="Leistung" clearable disabled inline-label="Leistung" size="small" theme="purple">
233+
<bal-option value="v100" label="100 PS">100 PS</bal-option>
234+
<bal-option value="v140" label="140 PS">140 PS</bal-option>
235+
<bal-option value="v165" label="165 PS">165 PS</bal-option>
236+
<bal-option value="v210" label="210 PS">210 PS</bal-option>
237+
</bal-dropdown>
238+
<bal-dropdown
239+
value="v140"
240+
placeholder="Leistung"
241+
clearable
242+
loading
243+
inline-label="Leistung"
244+
size="small"
245+
theme="purple"
246+
>
247+
<bal-option value="v100" label="100 PS">100 PS</bal-option>
248+
<bal-option value="v140" label="140 PS">140 PS</bal-option>
249+
<bal-option value="v165" label="165 PS">165 PS</bal-option>
250+
<bal-option value="v210" label="210 PS">210 PS</bal-option>
251+
</bal-dropdown>
252+
</section>
229253
</section>
230254
</main>
231255
</bal-doc-app>

packages/core/src/components/bal-segment/bal-segment.tsx

+25-20
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
import {
22
Component,
3-
h,
43
ComponentInterface,
5-
Host,
64
Element,
7-
Prop,
85
Event,
96
EventEmitter,
10-
Watch,
11-
State,
12-
writeTask,
7+
h,
8+
Host,
139
Listen,
1410
Method,
11+
Prop,
12+
State,
13+
Watch,
14+
writeTask,
1515
} from '@stencil/core'
16+
import { BalAnimationObserver, ListenToAnimation } from '../../utils/animation'
1617
import { BEM } from '../../utils/bem'
17-
import { SegmentValue } from './bal-segment.types'
18-
import { Logger, LogInstance } from '../../utils/log'
18+
import { BalBreakpointObserver, BalBreakpoints, ListenToBreakpoints } from '../../utils/breakpoints'
19+
import { BalFocusObserver, ListenToFocus } from '../../utils/focus'
20+
import { FOCUS_KEYS } from '../../utils/focus-visible'
21+
import { BalAriaForm, defaultBalAriaForm } from '../../utils/form'
22+
import { stopEventBubbling } from '../../utils/form-input'
23+
import { raf } from '../../utils/helpers'
1924
import {
2025
isArrowDownKey,
21-
isArrowUpKey,
22-
isSpaceKey,
23-
isHomeKey,
24-
isEndKey,
2526
isArrowLeftKey,
2627
isArrowRightKey,
28+
isArrowUpKey,
29+
isEndKey,
2730
isEnterKey,
31+
isHomeKey,
32+
isSpaceKey,
2833
} from '../../utils/keyboard'
29-
import { stopEventBubbling } from '../../utils/form-input'
30-
import { FOCUS_KEYS } from '../../utils/focus-visible'
31-
import { ListenToWindowResize, BalWindowResizeObserver } from '../../utils/resize'
32-
import { isDescendant, raf } from '../../utils/helpers'
33-
import { BalBreakpointObserver, BalBreakpoints, ListenToBreakpoints } from '../../utils/breakpoints'
34-
import { BalFocusObserver, ListenToFocus } from '../../utils/focus'
35-
import { defaultBalAriaForm, BalAriaForm } from '../../utils/form'
34+
import { Logger, LogInstance } from '../../utils/log'
35+
import { BalWindowResizeObserver, ListenToWindowResize } from '../../utils/resize'
3636
import { BalVisibilityObserver, ListenToVisibility } from '../../utils/visibility'
37-
import { BalAnimationObserver, ListenToAnimation } from '../../utils/animation'
37+
import { SegmentValue } from './bal-segment.types'
3838

3939
@Component({
4040
tag: 'bal-segment',
@@ -75,6 +75,11 @@ export class Segment
7575
*/
7676
@Prop() invalid = false
7777

78+
/**
79+
* If `true`, in Angular reactive forms the control will not be set invalid
80+
*/
81+
@Prop({ reflect: true }) autoInvalidOff = false
82+
7883
/**
7984
* If `true`, the user cannot interact with the segment.
8085
*/

packages/core/src/utils/dropdown/icon.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { FunctionalComponent, h } from '@stencil/core'
2-
import { BalLanguage } from '../config'
32
import { BEM } from '../bem'
3+
import { BalLanguage } from '../config'
44
import { i18nBalDropdown } from './dropdown.i18n'
55

66
export interface DropdownIconProps {
@@ -31,7 +31,9 @@ export const DropdownIcon: FunctionalComponent<DropdownIconProps> = ({
3131
const block = BEM.block('dropdown')
3232

3333
if (loading) {
34-
return <bal-spinner class={{ ...block.element('rear').class() }} small variation="circle"></bal-spinner>
34+
return (
35+
<bal-spinner class={{ ...block.element('rear').class() }} small variation="circle" color="white"></bal-spinner>
36+
)
3537
} else if (clearable && filled && !disabled) {
3638
return (
3739
<button

0 commit comments

Comments
 (0)