@codesuma/baseline 1.0.14 → 1.0.15
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.
|
@@ -117,8 +117,8 @@ export function Input(placeholder = '', type: InputType = 'text', options: Input
|
|
|
117
117
|
if (options.autofocus) setTimeout(() => inputEl.focus(), 0)
|
|
118
118
|
|
|
119
119
|
// Events - Proxy from inputEl to base emitter
|
|
120
|
-
inputEl.onblur = () => base.emit('blur')
|
|
121
|
-
inputEl.onfocus = () => base.emit('focus')
|
|
120
|
+
inputEl.onblur = (e) => base.emit('blur', e)
|
|
121
|
+
inputEl.onfocus = (e) => base.emit('focus', e)
|
|
122
122
|
|
|
123
123
|
const emitValue = () => {
|
|
124
124
|
const val = isCheckOrRadio && 'checked' in inputEl
|
|
@@ -127,13 +127,13 @@ export function Input(placeholder = '', type: InputType = 'text', options: Input
|
|
|
127
127
|
return val
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
inputEl.oninput = () => base.emit('input', emitValue())
|
|
131
|
-
inputEl.onchange = () => base.emit('change', emitValue())
|
|
130
|
+
inputEl.oninput = (e) => base.emit('input', { value: emitValue(), event: e })
|
|
131
|
+
inputEl.onchange = (e) => base.emit('change', { value: emitValue(), event: e })
|
|
132
132
|
|
|
133
133
|
inputEl.onkeydown = (e: KeyboardEvent) => {
|
|
134
|
-
if (e.key === 'Enter') base.emit('enter', inputEl.value)
|
|
135
|
-
if (e.key === 'Escape') base.emit('escape')
|
|
136
|
-
base.emit('keydown', { key: e.key, value: inputEl.value })
|
|
134
|
+
if (e.key === 'Enter') base.emit('enter', { value: inputEl.value, event: e })
|
|
135
|
+
if (e.key === 'Escape') base.emit('escape', e)
|
|
136
|
+
base.emit('keydown', { key: e.key, value: inputEl.value, event: e })
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
return Object.assign(base, {
|
|
@@ -153,4 +153,4 @@ export function Input(placeholder = '', type: InputType = 'text', options: Input
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}) as any
|
|
156
|
-
}
|
|
156
|
+
}
|
package/package.json
CHANGED