@momentum-design/components 0.120.25 → 0.120.26
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/dist/browser/index.js +182 -177
- package/dist/browser/index.js.map +4 -4
- package/dist/components/announcementdialog/announcementdialog.styles.js +1 -1
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.d.ts +15 -0
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.js +38 -4
- package/dist/components/screenreaderannouncer/screenreaderannouncer.constants.d.ts +1 -0
- package/dist/components/screenreaderannouncer/screenreaderannouncer.constants.js +1 -0
- package/dist/components/textarea/index.d.ts +1 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/textarea/textarea.component.d.ts +18 -1
- package/dist/components/textarea/textarea.component.js +42 -1
- package/dist/custom-elements.json +927 -887
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/dist/utils/debounce.d.ts +15 -0
- package/dist/utils/debounce.js +30 -0
- package/package.json +1 -1
package/dist/react/index.d.ts
CHANGED
@@ -72,10 +72,10 @@ export { default as StaticChip } from './staticchip';
|
|
72
72
|
export { default as StaticRadio } from './staticradio';
|
73
73
|
export { default as StaticToggle } from './statictoggle';
|
74
74
|
export { default as Stepper } from './stepper';
|
75
|
+
export { default as StepperConnector } from './stepperconnector';
|
76
|
+
export { default as StepperItem } from './stepperitem';
|
75
77
|
export { default as Tab } from './tab';
|
76
78
|
export { default as TabList } from './tablist';
|
77
|
-
export { default as StepperItem } from './stepperitem';
|
78
|
-
export { default as StepperConnector } from './stepperconnector';
|
79
79
|
export { default as Text } from './text';
|
80
80
|
export { default as Textarea } from './textarea';
|
81
81
|
export { default as ThemeProvider } from './themeprovider';
|
package/dist/react/index.js
CHANGED
@@ -72,10 +72,10 @@ export { default as StaticChip } from './staticchip';
|
|
72
72
|
export { default as StaticRadio } from './staticradio';
|
73
73
|
export { default as StaticToggle } from './statictoggle';
|
74
74
|
export { default as Stepper } from './stepper';
|
75
|
+
export { default as StepperConnector } from './stepperconnector';
|
76
|
+
export { default as StepperItem } from './stepperitem';
|
75
77
|
export { default as Tab } from './tab';
|
76
78
|
export { default as TabList } from './tablist';
|
77
|
-
export { default as StepperItem } from './stepperitem';
|
78
|
-
export { default as StepperConnector } from './stepperconnector';
|
79
79
|
export { default as Text } from './text';
|
80
80
|
export { default as Textarea } from './textarea';
|
81
81
|
export { default as ThemeProvider } from './themeprovider';
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export type Debounced<T extends (...args: any[]) => any> = ((...args: Parameters<T>) => void) & {
|
2
|
+
cancel: () => void;
|
3
|
+
};
|
4
|
+
/**
|
5
|
+
* Returns a debounced version of the provided callback function.
|
6
|
+
* The returned function will delay calling the provided callback function
|
7
|
+
* by the specified timeout (in milliseconds).
|
8
|
+
* If the returned function is called again before the timeout has expired,
|
9
|
+
* the timeout will be reset.
|
10
|
+
*
|
11
|
+
* @param callback - The function to debounce.
|
12
|
+
* @param timeout - The timeout in milliseconds (default 500ms).
|
13
|
+
* @returns - The debounced function & cancel function.
|
14
|
+
*/
|
15
|
+
export declare function debounce<T extends (...args: any[]) => any>(callback: T, timeout?: number): Debounced<T>;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/**
|
2
|
+
* Returns a debounced version of the provided callback function.
|
3
|
+
* The returned function will delay calling the provided callback function
|
4
|
+
* by the specified timeout (in milliseconds).
|
5
|
+
* If the returned function is called again before the timeout has expired,
|
6
|
+
* the timeout will be reset.
|
7
|
+
*
|
8
|
+
* @param callback - The function to debounce.
|
9
|
+
* @param timeout - The timeout in milliseconds (default 500ms).
|
10
|
+
* @returns - The debounced function & cancel function.
|
11
|
+
*/
|
12
|
+
export function debounce(callback, timeout = 500) {
|
13
|
+
let timer;
|
14
|
+
const debounced = ((...args) => {
|
15
|
+
if (timer !== undefined) {
|
16
|
+
window.clearTimeout(timer);
|
17
|
+
}
|
18
|
+
timer = window.setTimeout(() => {
|
19
|
+
timer = undefined;
|
20
|
+
callback(...args);
|
21
|
+
}, timeout);
|
22
|
+
});
|
23
|
+
debounced.cancel = () => {
|
24
|
+
if (timer !== undefined) {
|
25
|
+
window.clearTimeout(timer);
|
26
|
+
timer = undefined;
|
27
|
+
}
|
28
|
+
};
|
29
|
+
return debounced;
|
30
|
+
}
|