@nectary/components 5.12.0 → 5.13.0

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/bundle.js CHANGED
@@ -5346,6 +5346,7 @@ class Input extends NectaryElement {
5346
5346
  this.#$iconSlot.addEventListener("slotchange", this.#onIconSlotChange, options);
5347
5347
  this.#$leftSlot.addEventListener("slotchange", this.#onLeftSlotChange, options);
5348
5348
  this.#$rightSlot.addEventListener("slotchange", this.#onRightSlotChange, options);
5349
+ this.addEventListener("-key-down", this.#onKeyDownReactHandler, options);
5349
5350
  this.addEventListener("-change", this.#onChangeReactHandler, options);
5350
5351
  this.addEventListener("-focus", this.#onFocusReactHandler, options);
5351
5352
  this.addEventListener("-blur", this.#onBlurReactHandler, options);
@@ -5437,6 +5438,7 @@ class Input extends NectaryElement {
5437
5438
  }
5438
5439
  }
5439
5440
  }
5441
+ this.dispatchEvent(new CustomEvent("-key-down", e));
5440
5442
  };
5441
5443
  static get observedAttributes() {
5442
5444
  return [
@@ -5998,6 +6000,10 @@ class Input extends NectaryElement {
5998
6000
  const size = this.getAttribute("data-size") ?? DEFAULT_SIZE;
5999
6001
  this.#sizeContext.dispatch(size);
6000
6002
  }
6003
+ #onKeyDownReactHandler = (e) => {
6004
+ getReactEventHandler(this, "on-key-down")?.(e);
6005
+ getReactEventHandler(this, "onKeyDown")?.(e);
6006
+ };
6001
6007
  #onChangeReactHandler = (e) => {
6002
6008
  getReactEventHandler(this, "on-change")?.(e);
6003
6009
  getReactEventHandler(this, "onChange")?.(e);
package/input/index.js CHANGED
@@ -69,6 +69,7 @@ class Input extends NectaryElement {
69
69
  this.#$iconSlot.addEventListener("slotchange", this.#onIconSlotChange, options);
70
70
  this.#$leftSlot.addEventListener("slotchange", this.#onLeftSlotChange, options);
71
71
  this.#$rightSlot.addEventListener("slotchange", this.#onRightSlotChange, options);
72
+ this.addEventListener("-key-down", this.#onKeyDownReactHandler, options);
72
73
  this.addEventListener("-change", this.#onChangeReactHandler, options);
73
74
  this.addEventListener("-focus", this.#onFocusReactHandler, options);
74
75
  this.addEventListener("-blur", this.#onBlurReactHandler, options);
@@ -160,6 +161,7 @@ class Input extends NectaryElement {
160
161
  }
161
162
  }
162
163
  }
164
+ this.dispatchEvent(new CustomEvent("-key-down", e));
163
165
  };
164
166
  static get observedAttributes() {
165
167
  return [
@@ -721,6 +723,10 @@ class Input extends NectaryElement {
721
723
  const size = this.getAttribute("data-size") ?? DEFAULT_SIZE;
722
724
  this.#sizeContext.dispatch(size);
723
725
  }
726
+ #onKeyDownReactHandler = (e) => {
727
+ getReactEventHandler(this, "on-key-down")?.(e);
728
+ getReactEventHandler(this, "onKeyDown")?.(e);
729
+ };
724
730
  #onChangeReactHandler = (e) => {
725
731
  getReactEventHandler(this, "on-change")?.(e);
726
732
  getReactEventHandler(this, "onChange")?.(e);
package/input/types.d.ts CHANGED
@@ -50,6 +50,8 @@ export type TSinchInputMethods = {
50
50
  setSelectionRange(selectionStart: number, selectionEnd: number): void;
51
51
  };
52
52
  export type TSinchInputEvents = {
53
+ /** key-down handler*/
54
+ '-key-down'?: (e: KeyboardEvent) => void;
53
55
  /** Change value handler */
54
56
  '-change'?: (e: CustomEvent<string>) => void;
55
57
  /** Focus handler */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.12.0",
3
+ "version": "5.13.0",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",