@api-client/ui 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/md/UiElement.d.ts +5 -0
- package/build/src/md/UiElement.d.ts.map +1 -1
- package/build/src/md/UiElement.js +7 -0
- package/build/src/md/UiElement.js.map +1 -1
- package/build/src/md/button/ui-elevated-button.d.ts +1 -1
- package/build/src/md/button/ui-elevated-button.js +1 -1
- package/build/src/md/button/ui-elevated-button.js.map +1 -1
- package/build/src/md/button/ui-filled-button.d.ts +1 -1
- package/build/src/md/button/ui-filled-button.js +1 -1
- package/build/src/md/button/ui-filled-button.js.map +1 -1
- package/build/src/md/button/ui-filled-tonal-button.d.ts +3 -3
- package/build/src/md/button/ui-filled-tonal-button.d.ts.map +1 -1
- package/build/src/md/button/ui-filled-tonal-button.js +6 -6
- package/build/src/md/button/ui-filled-tonal-button.js.map +1 -1
- package/build/src/md/button/ui-outlined-button.d.ts +1 -1
- package/build/src/md/button/ui-outlined-button.js +1 -1
- package/build/src/md/button/ui-outlined-button.js.map +1 -1
- package/build/src/md/button/ui-text-button.d.ts +1 -1
- package/build/src/md/button/ui-text-button.js +1 -1
- package/build/src/md/button/ui-text-button.js.map +1 -1
- package/build/src/md/checkbox/internals/Checkbox.styles.d.ts.map +1 -1
- package/build/src/md/checkbox/internals/Checkbox.styles.js +55 -216
- package/build/src/md/checkbox/internals/Checkbox.styles.js.map +1 -1
- package/build/src/md/checkbox/internals/CheckboxElement.d.ts +10 -7
- package/build/src/md/checkbox/internals/CheckboxElement.d.ts.map +1 -1
- package/build/src/md/checkbox/internals/CheckboxElement.js +39 -32
- package/build/src/md/checkbox/internals/CheckboxElement.js.map +1 -1
- package/build/src/md/checkbox/internals/CheckedElement.d.ts.map +1 -1
- package/build/src/md/checkbox/internals/CheckedElement.js +1 -0
- package/build/src/md/checkbox/internals/CheckedElement.js.map +1 -1
- package/build/src/md/dropdown-list/internals/UiDropdownList.d.ts +13 -2
- package/build/src/md/dropdown-list/internals/UiDropdownList.d.ts.map +1 -1
- package/build/src/md/dropdown-list/internals/UiDropdownList.js +59 -20
- package/build/src/md/dropdown-list/internals/UiDropdownList.js.map +1 -1
- package/build/src/md/icon-button/internals/IconButton.d.ts +8 -24
- package/build/src/md/icon-button/internals/IconButton.d.ts.map +1 -1
- package/build/src/md/icon-button/internals/IconButton.js +35 -63
- package/build/src/md/icon-button/internals/IconButton.js.map +1 -1
- package/build/src/md/icon-button/internals/{IconButton.styles.d.ts → base.styles.d.ts} +1 -1
- package/build/src/md/icon-button/internals/base.styles.d.ts.map +1 -0
- package/build/src/md/icon-button/internals/base.styles.js +93 -0
- package/build/src/md/icon-button/internals/base.styles.js.map +1 -0
- package/build/src/md/icon-button/internals/filled-tonal.styles.d.ts +3 -0
- package/build/src/md/icon-button/internals/filled-tonal.styles.d.ts.map +1 -0
- package/build/src/md/icon-button/internals/filled-tonal.styles.js +30 -0
- package/build/src/md/icon-button/internals/filled-tonal.styles.js.map +1 -0
- package/build/src/md/icon-button/internals/filled.styles.d.ts +3 -0
- package/build/src/md/icon-button/internals/filled.styles.d.ts.map +1 -0
- package/build/src/md/icon-button/internals/filled.styles.js +36 -0
- package/build/src/md/icon-button/internals/filled.styles.js.map +1 -0
- package/build/src/md/icon-button/internals/outlined.styles.d.ts +3 -0
- package/build/src/md/icon-button/internals/outlined.styles.d.ts.map +1 -0
- package/build/src/md/icon-button/internals/outlined.styles.js +31 -0
- package/build/src/md/icon-button/internals/outlined.styles.js.map +1 -0
- package/build/src/md/icon-button/internals/standard.styles.d.ts +3 -0
- package/build/src/md/icon-button/internals/standard.styles.d.ts.map +1 -0
- package/build/src/md/icon-button/internals/standard.styles.js +18 -0
- package/build/src/md/icon-button/internals/standard.styles.js.map +1 -0
- package/build/src/md/icon-button/ui-filled-icon-button.d.ts +11 -0
- package/build/src/md/icon-button/ui-filled-icon-button.d.ts.map +1 -0
- package/build/src/md/icon-button/ui-filled-icon-button.js +28 -0
- package/build/src/md/icon-button/ui-filled-icon-button.js.map +1 -0
- package/build/src/md/icon-button/ui-filled-tonal-icon-button.d.ts +11 -0
- package/build/src/md/icon-button/ui-filled-tonal-icon-button.d.ts.map +1 -0
- package/build/src/md/icon-button/ui-filled-tonal-icon-button.js +28 -0
- package/build/src/md/icon-button/ui-filled-tonal-icon-button.js.map +1 -0
- package/build/src/md/icon-button/ui-icon-button.d.ts.map +1 -1
- package/build/src/md/icon-button/ui-icon-button.js +3 -2
- package/build/src/md/icon-button/ui-icon-button.js.map +1 -1
- package/build/src/md/icon-button/ui-outlined-icon-button.d.ts +11 -0
- package/build/src/md/icon-button/ui-outlined-icon-button.d.ts.map +1 -0
- package/build/src/md/icon-button/ui-outlined-icon-button.js +28 -0
- package/build/src/md/icon-button/ui-outlined-icon-button.js.map +1 -0
- package/build/src/md/icons/internals/Icon.d.ts +1 -0
- package/build/src/md/icons/internals/Icon.d.ts.map +1 -1
- package/build/src/md/icons/internals/Icon.js +13 -0
- package/build/src/md/icons/internals/Icon.js.map +1 -1
- package/build/src/md/icons/internals/Icon.styles.d.ts.map +1 -1
- package/build/src/md/icons/internals/Icon.styles.js +31 -2
- package/build/src/md/icons/internals/Icon.styles.js.map +1 -1
- package/build/src/md/list/internals/ListItem.d.ts +4 -3
- package/build/src/md/list/internals/ListItem.d.ts.map +1 -1
- package/build/src/md/list/internals/ListItem.js +55 -15
- package/build/src/md/list/internals/ListItem.js.map +1 -1
- package/build/src/md/list/internals/ListItem.styles.d.ts.map +1 -1
- package/build/src/md/list/internals/ListItem.styles.js +6 -2
- package/build/src/md/list/internals/ListItem.styles.js.map +1 -1
- package/build/src/md/ripple/internals/ripple.d.ts +2 -1
- package/build/src/md/ripple/internals/ripple.d.ts.map +1 -1
- package/build/src/md/ripple/internals/ripple.js +42 -12
- package/build/src/md/ripple/internals/ripple.js.map +1 -1
- package/build/src/md/segmented-button/internals/SegmentedButton.d.ts +1 -1
- package/build/src/md/segmented-button/internals/SegmentedButton.d.ts.map +1 -1
- package/build/src/md/segmented-button/internals/SegmentedButton.js +1 -1
- package/build/src/md/segmented-button/internals/SegmentedButton.js.map +1 -1
- package/demo/md/buttons/{button.html → index.html} +1 -1
- package/demo/md/{inputs/checkbox.html → checkbox/index.html} +1 -1
- package/demo/md/{list/dropdown-list.html → dropdown-list/index.html} +1 -1
- package/demo/md/{buttons/icon-button.html → icon-button/index.html} +5 -1
- package/demo/md/icon-button/index.ts +236 -0
- package/demo/md/index.html +36 -29
- package/demo/md/listbox/listbox.html +31 -0
- package/demo/md/listbox/listbox.ts +27 -0
- package/demo/md/{buttons/segmented-buttons.html → segmented-button/index.html} +1 -1
- package/package.json +1 -1
- package/src/md/UiElement.ts +8 -0
- package/src/md/button/ui-elevated-button.ts +1 -1
- package/src/md/button/ui-filled-button.ts +1 -1
- package/src/md/button/ui-filled-tonal-button.ts +3 -3
- package/src/md/button/ui-outlined-button.ts +1 -1
- package/src/md/button/ui-text-button.ts +1 -1
- package/src/md/checkbox/internals/Checkbox.styles.ts +55 -216
- package/src/md/checkbox/internals/CheckboxElement.ts +39 -26
- package/src/md/checkbox/internals/CheckedElement.ts +1 -0
- package/src/md/dropdown-list/internals/UiDropdownList.ts +60 -21
- package/src/md/icon-button/internals/IconButton.ts +29 -46
- package/src/md/icon-button/internals/base.styles.ts +93 -0
- package/src/md/icon-button/internals/filled-tonal.styles.ts +30 -0
- package/src/md/icon-button/internals/filled.styles.ts +36 -0
- package/src/md/icon-button/internals/outlined.styles.ts +31 -0
- package/src/md/icon-button/internals/standard.styles.ts +18 -0
- package/src/md/icon-button/ui-filled-icon-button.ts +16 -0
- package/src/md/icon-button/ui-filled-tonal-icon-button.ts +16 -0
- package/src/md/icon-button/ui-icon-button.ts +3 -2
- package/src/md/icon-button/ui-outlined-icon-button.ts +16 -0
- package/src/md/icons/internals/Icon.styles.ts +31 -2
- package/src/md/icons/internals/Icon.ts +14 -0
- package/src/md/list/internals/ListItem.styles.ts +6 -2
- package/src/md/list/internals/ListItem.ts +51 -18
- package/src/md/ripple/internals/ripple.ts +47 -13
- package/src/md/segmented-button/internals/SegmentedButton.ts +2 -2
- package/test/ui/button/UiIconButton.test.ts +1 -8
- package/build/src/md/icon-button/internals/IconButton.styles.d.ts.map +0 -1
- package/build/src/md/icon-button/internals/IconButton.styles.js +0 -614
- package/build/src/md/icon-button/internals/IconButton.styles.js.map +0 -1
- package/demo/md/buttons/icon-button.ts +0 -184
- package/src/md/icon-button/internals/IconButton.styles.ts +0 -614
- /package/demo/md/buttons/{button.ts → index.ts} +0 -0
- /package/demo/md/{inputs/checkbox.ts → checkbox/index.ts} +0 -0
- /package/demo/md/{list/dropdown-list.ts → dropdown-list/index.ts} +0 -0
- /package/demo/md/{buttons/segmented-buttons.ts → segmented-button/index.ts} +0 -0
|
@@ -6,6 +6,8 @@ import { BeginPressConfig, EndPressConfig } from '../../../controllers/ActionCon
|
|
|
6
6
|
import UiRipple from '../../ripple/internals/ripple.js'
|
|
7
7
|
import { setDisabled } from '../../../lib/disabled.js'
|
|
8
8
|
import { ripple } from '../../effects/rippleDirective.js'
|
|
9
|
+
|
|
10
|
+
import '@material/web/focus/md-focus-ring.js'
|
|
9
11
|
import '../../ripple/ui-ripple.js'
|
|
10
12
|
|
|
11
13
|
export enum ListItemLines {
|
|
@@ -60,6 +62,8 @@ export default class UiListItem extends UiElement {
|
|
|
60
62
|
*/
|
|
61
63
|
@property({ type: Boolean, reflect: true }) accessor static = false
|
|
62
64
|
|
|
65
|
+
@property({ type: Number, reflect: true }) override accessor tabIndex = -1
|
|
66
|
+
|
|
63
67
|
constructor() {
|
|
64
68
|
super()
|
|
65
69
|
|
|
@@ -71,11 +75,17 @@ export default class UiListItem extends UiElement {
|
|
|
71
75
|
this.addEventListener('pointerup', this.handlePointerUp.bind(this))
|
|
72
76
|
this.addEventListener('pointercancel', this.handlePointerCancel.bind(this))
|
|
73
77
|
this.addEventListener('pointerleave', this.handlePointerLeave.bind(this))
|
|
78
|
+
this.addEventListener('pointerenter', this.handlePointerEnter.bind(this))
|
|
74
79
|
this.addEventListener('contextmenu', this.handleContextMenu.bind(this))
|
|
75
80
|
this.addEventListener('keydown', this.handleKeyDown.bind(this))
|
|
76
81
|
this.addEventListener('keyup', this.handleKeyUp.bind(this))
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
protected override updated(changedProperties: PropertyValues<this>): void {
|
|
85
|
+
super.updated(changedProperties)
|
|
86
|
+
if (changedProperties.has('tabIndex') && (this.tabIndex === -1 || this.tabIndex === null)) {
|
|
87
|
+
this.ripple?.endPress()
|
|
88
|
+
}
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
override connectedCallback(): void {
|
|
@@ -92,63 +102,82 @@ export default class UiListItem extends UiElement {
|
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
override handleKeyDown(e: KeyboardEvent): void {
|
|
105
|
+
if (this.disabled || this.static) {
|
|
106
|
+
e.stopPropagation()
|
|
107
|
+
e.preventDefault()
|
|
108
|
+
return
|
|
109
|
+
}
|
|
95
110
|
if (e.key !== ' ' && e.key !== 'Enter') return
|
|
96
|
-
|
|
97
|
-
e.preventDefault()
|
|
111
|
+
// do not prevent default, so that parent elements can handle the key event
|
|
98
112
|
this.beginPress({ positionEvent: e })
|
|
99
113
|
}
|
|
100
114
|
|
|
101
115
|
override handleKeyUp(e: KeyboardEvent): void {
|
|
116
|
+
if (this.disabled || this.static) {
|
|
117
|
+
e.stopPropagation()
|
|
118
|
+
e.preventDefault()
|
|
119
|
+
return
|
|
120
|
+
}
|
|
102
121
|
if (e.key !== ' ' && e.key !== 'Enter') return
|
|
103
122
|
|
|
104
|
-
|
|
123
|
+
// do not prevent default, so that parent elements can handle the key event
|
|
105
124
|
this.endPress({ cancelled: false, actionData: { item: this } })
|
|
106
125
|
}
|
|
107
126
|
|
|
108
127
|
override beginPress(options: BeginPressConfig): void {
|
|
128
|
+
if (this.disabled || this.static) {
|
|
129
|
+
return
|
|
130
|
+
}
|
|
109
131
|
super.beginPress(options)
|
|
110
132
|
this.ripple.beginPress(options.positionEvent)
|
|
111
133
|
}
|
|
112
134
|
|
|
113
135
|
override endPress(options: EndPressConfig): void {
|
|
136
|
+
if (this.disabled || this.static) {
|
|
137
|
+
return
|
|
138
|
+
}
|
|
114
139
|
super.endPress(options)
|
|
115
140
|
this.ripple.endPress()
|
|
116
141
|
}
|
|
117
142
|
|
|
118
|
-
|
|
143
|
+
override handlePointerEnter(e: PointerEvent): void {
|
|
144
|
+
if (this.disabled || this.static) {
|
|
145
|
+
e.stopPropagation()
|
|
146
|
+
e.preventDefault()
|
|
147
|
+
return
|
|
148
|
+
}
|
|
119
149
|
this.ripple.beginHover(e)
|
|
120
150
|
}
|
|
121
151
|
|
|
122
152
|
override handlePointerLeave(e: PointerEvent): void {
|
|
153
|
+
if (this.disabled || this.static) {
|
|
154
|
+
e.stopPropagation()
|
|
155
|
+
e.preventDefault()
|
|
156
|
+
return
|
|
157
|
+
}
|
|
123
158
|
super.handlePointerLeave(e)
|
|
124
159
|
|
|
125
160
|
this.ripple.endHover()
|
|
126
161
|
}
|
|
127
162
|
|
|
128
|
-
protected handleFocus(): void {
|
|
129
|
-
this.ripple.beginFocus()
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
protected handleBlur(): void {
|
|
133
|
-
// if (this.matches(':focus-within')) {
|
|
134
|
-
// return;
|
|
135
|
-
// }
|
|
136
|
-
this.ripple.endFocus()
|
|
137
|
-
}
|
|
138
|
-
|
|
139
163
|
/**
|
|
140
164
|
* Focuses list item and makes list item focusable via keyboard.
|
|
141
165
|
*/
|
|
142
166
|
activate(): void {
|
|
167
|
+
if (this.disabled || this.static) {
|
|
168
|
+
return
|
|
169
|
+
}
|
|
143
170
|
this.setAttribute('tabindex', '0')
|
|
144
171
|
this.focus()
|
|
145
|
-
this.ripple.beginFocus()
|
|
146
172
|
}
|
|
147
173
|
|
|
148
174
|
/**
|
|
149
175
|
* Returns true if list item is currently focused and is focusable.
|
|
150
176
|
*/
|
|
151
177
|
isActive(): boolean {
|
|
178
|
+
if (this.disabled || this.static) {
|
|
179
|
+
return false
|
|
180
|
+
}
|
|
152
181
|
return this.getAttribute('tabindex') === '0'
|
|
153
182
|
}
|
|
154
183
|
|
|
@@ -156,6 +185,9 @@ export default class UiListItem extends UiElement {
|
|
|
156
185
|
* Removes list item from sequential keyboard navigation.
|
|
157
186
|
*/
|
|
158
187
|
deactivate(): void {
|
|
188
|
+
if (this.disabled || this.static) {
|
|
189
|
+
return
|
|
190
|
+
}
|
|
159
191
|
this.removeAttribute('tabindex')
|
|
160
192
|
}
|
|
161
193
|
|
|
@@ -171,6 +203,7 @@ export default class UiListItem extends UiElement {
|
|
|
171
203
|
})
|
|
172
204
|
|
|
173
205
|
return html`
|
|
206
|
+
<md-focus-ring part="focus-ring" .control="${this as HTMLElement}" inward></md-focus-ring>
|
|
174
207
|
<div class="${surfaceClasses}" ${ripple(() => this.ripple)}>
|
|
175
208
|
<div class="container"></div>
|
|
176
209
|
<div class="state"></div>
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
import { html, LitElement, PropertyValues, TemplateResult } from 'lit'
|
|
8
8
|
import { property, query, state } from 'lit/decorators.js'
|
|
9
9
|
import { ClassInfo, classMap } from 'lit/directives/class-map.js'
|
|
10
|
-
import {
|
|
10
|
+
import { Easing } from '../../motion/animation.js'
|
|
11
11
|
|
|
12
12
|
const PRESS_GROW_MS = 450
|
|
13
|
-
const MINIMUM_PRESS_MS =
|
|
13
|
+
const MINIMUM_PRESS_MS = 80
|
|
14
14
|
const INITIAL_ORIGIN_SCALE = 0.2
|
|
15
15
|
const PADDING = 10
|
|
16
16
|
const SOFT_EDGE_MINIMUM_SIZE = 75
|
|
@@ -52,7 +52,9 @@ export default class UiRipple extends LitElement {
|
|
|
52
52
|
|
|
53
53
|
protected initialSize = 0
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
private rippleStartEvent?: Event | null
|
|
56
|
+
|
|
57
|
+
// protected pressAnimationSignal = createAnimationSignal()
|
|
56
58
|
|
|
57
59
|
protected growAnimation: Animation | null = null
|
|
58
60
|
|
|
@@ -147,13 +149,14 @@ export default class UiRipple extends LitElement {
|
|
|
147
149
|
if (!mdRoot) {
|
|
148
150
|
return
|
|
149
151
|
}
|
|
150
|
-
|
|
152
|
+
this.pressed = true
|
|
153
|
+
this.growAnimation?.cancel()
|
|
151
154
|
this.determineRippleSize()
|
|
152
155
|
const { startPoint, endPoint } = this.getTranslationCoordinates(positionEvent)
|
|
153
156
|
const translateStart = `${startPoint.x}px, ${startPoint.y}px`
|
|
154
157
|
const translateEnd = `${endPoint.x}px, ${endPoint.y}px`
|
|
155
158
|
|
|
156
|
-
const signal = this.pressAnimationSignal.start()
|
|
159
|
+
// const signal = this.pressAnimationSignal.start()
|
|
157
160
|
|
|
158
161
|
const growAnimation = mdRoot.animate(
|
|
159
162
|
{
|
|
@@ -171,19 +174,48 @@ export default class UiRipple extends LitElement {
|
|
|
171
174
|
}
|
|
172
175
|
)
|
|
173
176
|
|
|
174
|
-
growAnimation.addEventListener('finish', () => {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
})
|
|
177
|
+
// growAnimation.addEventListener('finish', () => {
|
|
178
|
+
// this.pressAnimationSignal.finish()
|
|
179
|
+
// this.growAnimation = null
|
|
180
|
+
// })
|
|
178
181
|
|
|
179
|
-
signal.addEventListener('abort', () => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
})
|
|
182
|
+
// signal.addEventListener('abort', () => {
|
|
183
|
+
// growAnimation.cancel()
|
|
184
|
+
// this.growAnimation = null
|
|
185
|
+
// })
|
|
183
186
|
|
|
184
187
|
this.growAnimation = growAnimation
|
|
185
188
|
}
|
|
186
189
|
|
|
190
|
+
private async endPressAnimation() {
|
|
191
|
+
this.rippleStartEvent = undefined
|
|
192
|
+
// this.state = State.INACTIVE
|
|
193
|
+
const animation = this.growAnimation
|
|
194
|
+
let pressAnimationPlayState = Infinity
|
|
195
|
+
if (typeof animation?.currentTime === 'number') {
|
|
196
|
+
pressAnimationPlayState = animation.currentTime
|
|
197
|
+
} else if (animation?.currentTime) {
|
|
198
|
+
pressAnimationPlayState = animation.currentTime.to('ms').value
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (pressAnimationPlayState >= MINIMUM_PRESS_MS) {
|
|
202
|
+
this.pressed = false
|
|
203
|
+
return
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
await new Promise((resolve) => {
|
|
207
|
+
setTimeout(resolve, MINIMUM_PRESS_MS - pressAnimationPlayState)
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
if (this.growAnimation !== animation) {
|
|
211
|
+
// A new press animation was started. The old animation was canceled and
|
|
212
|
+
// should not finish the pressed state.
|
|
213
|
+
return
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
this.pressed = false
|
|
217
|
+
}
|
|
218
|
+
|
|
187
219
|
beginHover(hoverEvent?: Event): void {
|
|
188
220
|
if ((hoverEvent as PointerEvent)?.pointerType !== 'touch') {
|
|
189
221
|
this.hovered = true
|
|
@@ -204,6 +236,7 @@ export default class UiRipple extends LitElement {
|
|
|
204
236
|
|
|
205
237
|
beginPress(positionEvent?: Event | null): void {
|
|
206
238
|
this.pressed = true
|
|
239
|
+
this.rippleStartEvent = positionEvent
|
|
207
240
|
if (this.delayedEndPressHandle !== null) {
|
|
208
241
|
clearTimeout(this.delayedEndPressHandle)
|
|
209
242
|
this.delayedEndPressHandle = null
|
|
@@ -221,5 +254,6 @@ export default class UiRipple extends LitElement {
|
|
|
221
254
|
this.delayedEndPressHandle = null
|
|
222
255
|
}, MINIMUM_PRESS_MS - pressAnimationPlayState) as unknown as number
|
|
223
256
|
}
|
|
257
|
+
this.endPressAnimation()
|
|
224
258
|
}
|
|
225
259
|
}
|
|
@@ -42,7 +42,6 @@ export default class SegmentedButton extends UiElement {
|
|
|
42
42
|
|
|
43
43
|
constructor() {
|
|
44
44
|
super()
|
|
45
|
-
this.addEventListener('pointerenter', this.handlePointerEnter.bind(this))
|
|
46
45
|
this.actionController.cancelKeyboardEvents = true
|
|
47
46
|
this.addEventListener('keydown', this.handleKeyDown.bind(this))
|
|
48
47
|
this.addEventListener('keyup', this.handleKeyUp.bind(this))
|
|
@@ -50,6 +49,7 @@ export default class SegmentedButton extends UiElement {
|
|
|
50
49
|
this.addEventListener('pointerdown', this.handlePointerDown.bind(this))
|
|
51
50
|
this.addEventListener('pointerup', this.handlePointerUp.bind(this))
|
|
52
51
|
this.addEventListener('pointercancel', this.handlePointerCancel.bind(this))
|
|
52
|
+
this.addEventListener('pointerenter', this.handlePointerEnter.bind(this))
|
|
53
53
|
this.addEventListener('pointerleave', this.handlePointerLeave.bind(this))
|
|
54
54
|
this.addEventListener('contextmenu', this.handleContextMenu.bind(this))
|
|
55
55
|
}
|
|
@@ -78,7 +78,7 @@ export default class SegmentedButton extends UiElement {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
override handlePointerEnter(e: PointerEvent): void {
|
|
82
82
|
this.ripple.beginHover(e)
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assert, fixture, html, nextFrame, oneEvent } from '@open-wc/testing'
|
|
2
2
|
import sinon from 'sinon'
|
|
3
|
-
import UiIconButton
|
|
3
|
+
import UiIconButton from '../../../src/md/icon-button/internals/IconButton.js'
|
|
4
4
|
import { UiMock } from '../../helpers/UiMock.js'
|
|
5
5
|
import { IconType } from '../../../src/md/icons/Icons.js'
|
|
6
6
|
|
|
@@ -37,13 +37,6 @@ describe('md', () => {
|
|
|
37
37
|
)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
describe('defaults', () => {
|
|
41
|
-
it('sets the default type', async () => {
|
|
42
|
-
const button = await basicFixture('add')
|
|
43
|
-
assert.equal(button.type, IconButtonType.standard)
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
|
|
47
40
|
describe('toggle button', () => {
|
|
48
41
|
it('sets button active when pressing the button with space', async () => {
|
|
49
42
|
const button = await toggleFixture('add')
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/icon-button/internals/IconButton.styles.ts"],"names":[],"mappings":";AAEA,wBAmmBC"}
|