dry-ux 1.80.0 → 1.82.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.
@@ -92,7 +92,7 @@ export declare class Element {
92
92
  * @param once Whether the event should only fire once.
93
93
  * @returns A function to remove the event listener, or undefined if the element is not suitable for events.
94
94
  */
95
- addEventListener(type: string, handler: (e: Event) => void, once?: boolean): () => void | undefined;
95
+ addEventListener(type: string, handler: (e: any) => void, once?: boolean): () => void | undefined;
96
96
  /**
97
97
  * Adds a change event listener to the element.
98
98
  * @param handler The event handler function.
@@ -106,21 +106,21 @@ export declare class Element {
106
106
  * @param once Whether the event should only fire once.
107
107
  * @returns A function to remove the event listener.
108
108
  */
109
- click(handler: (e: Event) => void, once?: boolean): () => void | undefined;
109
+ click(handler: (e: MouseEvent) => void, once?: boolean): () => void | undefined;
110
110
  /**
111
111
  * Adds a focus event listener to the element.
112
112
  * @param handler The event handler function.
113
113
  * @param once Whether the event should only fire once.
114
114
  * @returns A function to remove the event listener.
115
115
  */
116
- focus(handler: (e: Event) => void, once?: boolean): () => void | undefined;
116
+ focus(handler: (e: FocusEvent) => void, once?: boolean): () => void | undefined;
117
117
  /**
118
118
  * Adds a blur event listener to the element.
119
119
  * @param handler The event handler function.
120
120
  * @param once Whether the event should only fire once.
121
121
  * @returns A function to remove the event listener.
122
122
  */
123
- blur(handler: (e: Event) => void, once?: boolean): () => void | undefined;
123
+ blur(handler: (e: FocusEvent) => void, once?: boolean): () => void | undefined;
124
124
  /**
125
125
  * Adds a keydown event listener to the element.
126
126
  * @param handler The keyboard event handler function.
@@ -124,14 +124,11 @@ class Element {
124
124
  * @returns A function to remove the event listener, or undefined if the element is not suitable for events.
125
125
  */
126
126
  addEventListener(type, handler, once) {
127
- if ((this.nativeInput instanceof HTMLInputElement ||
128
- this.nativeInput instanceof HTMLSelectElement ||
129
- this.nativeInput instanceof HTMLTextAreaElement) &&
130
- !!type) {
131
- const abortController = new AbortController();
132
- this.nativeInput.addEventListener("change", handler, { once, signal: abortController.signal });
133
- return abortController.abort;
134
- }
127
+ if (!type)
128
+ return;
129
+ const abortController = new AbortController();
130
+ this.native.addEventListener(type, handler, { once, signal: abortController.signal });
131
+ return () => abortController.abort();
135
132
  }
136
133
  /**
137
134
  * Adds a change event listener to the element.
@@ -62,15 +62,13 @@ export declare class UIUtilProvider extends React.PureComponent<{
62
62
  * Default modal utility methods.
63
63
  */
64
64
  get modalDefaults(): {
65
+ instances: {};
65
66
  create: any;
66
67
  show: (options: PopUpOptions) => PopUp;
67
68
  getCurrent: () => PopUp;
68
69
  showAlert: (content: Content, onClose?: PopUpOptions["onClose"]) => PopUp;
69
70
  showConfirm: (options: PopUpOptions, onYes: () => void, onNo?: () => void) => PopUp;
70
71
  showActions: (options: PopUpOptions, actions: PopUpAction[]) => PopUp;
71
- instances: {
72
- [id: string]: PopUpInstance;
73
- };
74
72
  };
75
73
  /**
76
74
  * Default custom loader utility methods.
@@ -91,12 +89,10 @@ export declare class UIUtilProvider extends React.PureComponent<{
91
89
  * Default prompt utility methods.
92
90
  */
93
91
  get promptDefaults(): {
92
+ instances: {};
94
93
  getCurrent: () => PopUp;
95
94
  showConfirm: (options: import("react-bootstrap").Omit<PopUpOptions, "actions">, onYes: () => void, onNo?: () => void) => PopUp;
96
95
  showActions: (options: import("react-bootstrap").Omit<PopUpOptions, "actions">, actions: PopUpAction[]) => PopUp;
97
- instances: {
98
- [id: string]: PopUpInstance;
99
- };
100
96
  };
101
97
  /**
102
98
  * Toggles the visibility of a modal instance.
@@ -122,7 +122,7 @@ class UIUtilProvider extends React.PureComponent {
122
122
  * Default modal utility methods.
123
123
  */
124
124
  get modalDefaults() {
125
- return Object.assign(Object.assign({}, defaultState.modal), { create: this.createModal.bind(this), show: (options) => this.createModal(modalId.modal, options), getCurrent: () => {
125
+ return Object.assign(Object.assign({}, defaultState.modal), { instances: {}, create: this.createModal.bind(this), show: (options) => this.createModal(modalId.modal, options), getCurrent: () => {
126
126
  const { modal: { instances }, } = this.state;
127
127
  const id = Object.keys(instances).find(id => instances[id].shown);
128
128
  return this.getCurrentModal(id);
@@ -174,7 +174,7 @@ class UIUtilProvider extends React.PureComponent {
174
174
  * Default prompt utility methods.
175
175
  */
176
176
  get promptDefaults() {
177
- return Object.assign(Object.assign({}, defaultState.prompt), { getCurrent: () => {
177
+ return Object.assign(Object.assign({}, defaultState.prompt), { instances: {}, getCurrent: () => {
178
178
  const { prompt: { instances }, } = this.state;
179
179
  const id = Object.keys(instances).find(id => instances[id].shown);
180
180
  return this.getCurrentModal(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dry-ux",
3
- "version": "1.80.0",
3
+ "version": "1.82.0",
4
4
  "description": "",
5
5
  "main": "dist/index",
6
6
  "scripts": {