@juspay/svelte-ui-components 1.11.0 → 1.12.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/dist/Button/Button.svelte +3 -1
- package/dist/CheckListItem/CheckListItem.svelte +7 -2
- package/dist/ListItem/ListItem.svelte +7 -1
- package/dist/Modal/Modal.svelte +8 -4
- package/dist/Modal/properties.d.ts +1 -0
- package/dist/Modal/properties.js +2 -1
- package/dist/Select/Select.svelte +0 -1
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +15 -0
- package/package.json +1 -1
|
@@ -33,7 +33,9 @@ function handleButtonClick() {
|
|
|
33
33
|
{#if $$slots.icon}
|
|
34
34
|
<div class="button-icon"><slot name="icon" /></div>
|
|
35
35
|
{/if}
|
|
36
|
-
|
|
36
|
+
{#if properties.text !== null && properties.text.length > 0}
|
|
37
|
+
<div class="button-text">{properties.text}</div>
|
|
38
|
+
{/if}
|
|
37
39
|
</button>
|
|
38
40
|
</div>
|
|
39
41
|
|
|
@@ -6,7 +6,7 @@ function handleCheckboxClick(e) {
|
|
|
6
6
|
if (e.target instanceof HTMLInputElement && typeof e.target.checked === "boolean") {
|
|
7
7
|
checked = e.target.checked;
|
|
8
8
|
}
|
|
9
|
-
dispatch("click");
|
|
9
|
+
dispatch("click", checked);
|
|
10
10
|
}
|
|
11
11
|
</script>
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ function handleCheckboxClick(e) {
|
|
|
15
15
|
{#if $$slots.checkboxLabel}
|
|
16
16
|
<slot name="checkboxLabel" />
|
|
17
17
|
{:else}
|
|
18
|
-
<span class="text">
|
|
18
|
+
<span class="text" class:checked={checked}>
|
|
19
19
|
<!-- eslint-disable-next-line -->
|
|
20
20
|
{@html text}
|
|
21
21
|
</span>
|
|
@@ -35,6 +35,11 @@ function handleCheckboxClick(e) {
|
|
|
35
35
|
color: var(--check-list-item-text-color);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
.text.checked {
|
|
39
|
+
color: var(--check-list-item-checked-text-color);
|
|
40
|
+
font-weight: var(--check-list-item-checked-font-weight);
|
|
41
|
+
}
|
|
42
|
+
|
|
38
43
|
input.checkbox {
|
|
39
44
|
accent-color: var(--checkbox-accent-color, #000);
|
|
40
45
|
border: 5px solid red;
|
|
@@ -101,7 +101,9 @@ function handleTopSectionClick() {
|
|
|
101
101
|
</div>
|
|
102
102
|
{/if}
|
|
103
103
|
{#if showRightContentLoader}
|
|
104
|
-
<
|
|
104
|
+
<div class="right-content-loader">
|
|
105
|
+
<Loader />
|
|
106
|
+
</div>
|
|
105
107
|
{/if}
|
|
106
108
|
{#if properties.rightContentText && properties.rightContentText !== ''}
|
|
107
109
|
<span class="right-content-text">{properties.rightContentText}</span>
|
|
@@ -221,6 +223,10 @@ function handleTopSectionClick() {
|
|
|
221
223
|
display: var(--list-item-right-content-display, flex);
|
|
222
224
|
}
|
|
223
225
|
|
|
226
|
+
.right-content-loader {
|
|
227
|
+
margin: var(--list-item-right-content-loader-margin);
|
|
228
|
+
}
|
|
229
|
+
|
|
224
230
|
.bottom-section {
|
|
225
231
|
flex-direction: row;
|
|
226
232
|
margin-top: 0;
|
package/dist/Modal/Modal.svelte
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import ModalAnimation from "../Animations/ModalAnimation.svelte";
|
|
3
3
|
import OverlayAnimation from "../Animations/OverlayAnimation.svelte";
|
|
4
4
|
import { defaultModalProperties } from "./properties";
|
|
5
|
+
import { createDebouncer } from "../utils";
|
|
5
6
|
const dispatch = createEventDispatcher();
|
|
6
7
|
let overlayDiv;
|
|
7
8
|
let backPressed = false;
|
|
8
9
|
export let properties = defaultModalProperties;
|
|
10
|
+
const debounce = createDebouncer(properties.debounceTime);
|
|
9
11
|
function handlePopstate() {
|
|
10
12
|
backPressed = true;
|
|
11
13
|
dispatch("close");
|
|
@@ -18,7 +20,9 @@ function handleLeftImageClick() {
|
|
|
18
20
|
}
|
|
19
21
|
function handleOverlayClick(event) {
|
|
20
22
|
if (event.target && event.target === overlayDiv) {
|
|
21
|
-
|
|
23
|
+
debounce(() => {
|
|
24
|
+
dispatch("overlayClick");
|
|
25
|
+
});
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
28
|
function handleKeyDown(event) {
|
|
@@ -130,9 +134,9 @@ onDestroy(() => {
|
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
.slot-content {
|
|
133
|
-
display: flex;
|
|
134
|
-
overflow-y: scroll;
|
|
135
|
-
scrollbar-width: none;
|
|
137
|
+
display: var(--modal-display, flex);
|
|
138
|
+
overflow-y: var(--modal-overflow-y, scroll);
|
|
139
|
+
scrollbar-width: var(--modal-scrollbar-width, none);
|
|
136
140
|
}
|
|
137
141
|
|
|
138
142
|
.slot-content::-webkit-scrollbar {
|
package/dist/Modal/properties.js
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -9,3 +9,9 @@ import type { CustomValidator, InputDataType, ValidationState } from './types';
|
|
|
9
9
|
* @returns ValidationState : InProgress | Valid | Invalid
|
|
10
10
|
*/
|
|
11
11
|
export declare function validateInput(inputValue: string, dataType: InputDataType, validPattern: RegExp | null, inProgressPattern: RegExp | null, customValidators: CustomValidator[]): ValidationState;
|
|
12
|
+
/**
|
|
13
|
+
* @description Creates a debouncer function that delays invoking the provided callback until a specified delay period has elapsed since the last invocation.
|
|
14
|
+
* @param delay The delay period in milliseconds before invoking the callback.
|
|
15
|
+
* @returns A debouncer function that accepts a callback and delays its invocation based on the specified delay.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createDebouncer(delay: number): (callback: Function, ...args: any[]) => void;
|
package/dist/utils.js
CHANGED
|
@@ -145,3 +145,18 @@ function validatePhoneNumber(phoneNumber) {
|
|
|
145
145
|
}
|
|
146
146
|
return phoneNumber.length === 10 ? 'Valid' : phoneNumber.length > 10 ? 'InProgress' : 'Invalid';
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* @description Creates a debouncer function that delays invoking the provided callback until a specified delay period has elapsed since the last invocation.
|
|
150
|
+
* @param delay The delay period in milliseconds before invoking the callback.
|
|
151
|
+
* @returns A debouncer function that accepts a callback and delays its invocation based on the specified delay.
|
|
152
|
+
*/
|
|
153
|
+
export function createDebouncer(delay) {
|
|
154
|
+
let lastCallTime = 0;
|
|
155
|
+
return function (callback, ...args) {
|
|
156
|
+
const now = Date.now();
|
|
157
|
+
if (now - lastCallTime > delay) {
|
|
158
|
+
lastCallTime = now;
|
|
159
|
+
callback(...args);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|