@juspay/svelte-ui-components 1.0.0 → 1.1.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/Animations/ModalAnimation.svelte +13 -2
- package/dist/Animations/ModalAnimation.svelte.d.ts +2 -0
- package/dist/Button/Button.svelte +8 -2
- package/dist/ListItem/ListItem.svelte +29 -3
- package/dist/ListItem/ListItem.svelte.d.ts +1 -0
- package/dist/Modal/Modal.svelte +5 -1
- package/dist/Modal/properties.d.ts +2 -0
- package/dist/Modal/properties.js +2 -1
- package/dist/types.d.ts +1 -0
- package/package.json +1 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { fly, fade } from "svelte/transition";
|
|
2
2
|
export let enable = true;
|
|
3
3
|
export let align = "bottom";
|
|
4
|
+
export let transitionType = "ALL";
|
|
4
5
|
let flyAnimationProperties = { x: 0, y: 0, duration: 380 };
|
|
5
6
|
let fadeAnimationProperties = { duration: 300 };
|
|
6
7
|
switch (align) {
|
|
@@ -15,11 +16,21 @@ switch (align) {
|
|
|
15
16
|
|
|
16
17
|
{#if enable}
|
|
17
18
|
{#if align === 'top' || align === 'bottom'}
|
|
18
|
-
|
|
19
|
+
{#if transitionType === 'IN'}
|
|
20
|
+
<div in:fly|global={flyAnimationProperties}>
|
|
21
|
+
<slot />
|
|
22
|
+
</div>
|
|
23
|
+
{:else}
|
|
24
|
+
<div in:fly|global={flyAnimationProperties} out:fly|global={flyAnimationProperties}>
|
|
25
|
+
<slot />
|
|
26
|
+
</div>
|
|
27
|
+
{/if}
|
|
28
|
+
{:else if transitionType === 'IN'}
|
|
29
|
+
<div in:fade|global={fadeAnimationProperties}>
|
|
19
30
|
<slot />
|
|
20
31
|
</div>
|
|
21
32
|
{:else}
|
|
22
|
-
<div in:fade={fadeAnimationProperties} out:fade={fadeAnimationProperties}>
|
|
33
|
+
<div in:fade|global={fadeAnimationProperties} out:fade|global={fadeAnimationProperties}>
|
|
23
34
|
<slot />
|
|
24
35
|
</div>
|
|
25
36
|
{/if}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { ModalAlign } from '../Modal/properties';
|
|
3
|
+
import type { ModalTransition } from '../types';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
6
|
enable?: boolean | undefined;
|
|
6
7
|
align?: ModalAlign | undefined;
|
|
8
|
+
transitionType?: ModalTransition | undefined;
|
|
7
9
|
};
|
|
8
10
|
events: {
|
|
9
11
|
[evt: string]: CustomEvent<any>;
|
|
@@ -48,8 +48,8 @@ function handleButtonClick() {
|
|
|
48
48
|
font-family: var(--button-font-family);
|
|
49
49
|
font-weight: var(--button-font-weight, 500);
|
|
50
50
|
font-size: var(--button-font-size, 14px);
|
|
51
|
-
background-color: var(--button-color,
|
|
52
|
-
color: var(--button-text-color,
|
|
51
|
+
background-color: var(--button-color, #3a4550);
|
|
52
|
+
color: var(--button-text-color, white);
|
|
53
53
|
height: var(--button-height, fit-content);
|
|
54
54
|
padding: var(--button-padding, 16px);
|
|
55
55
|
margin: var(--button-margin);
|
|
@@ -66,6 +66,12 @@ function handleButtonClick() {
|
|
|
66
66
|
visibility: var(--button-visibility, visible);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
button:hover {
|
|
70
|
+
background: var(--button-hover-color, var(--button-color, #3a4550));
|
|
71
|
+
color: var(--button-hover-text-color, var(--button-text-color, white));
|
|
72
|
+
border: var(--button-hover-border, var(--button-border, none));
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
.button-progress-bar {
|
|
70
76
|
position: absolute;
|
|
71
77
|
height: 100%;
|
|
@@ -7,6 +7,7 @@ export let properties = defaultListItemProperties;
|
|
|
7
7
|
export let showLoader = false;
|
|
8
8
|
export let showRightContentLoader = false;
|
|
9
9
|
export let expand = false;
|
|
10
|
+
export let preventFocus = false;
|
|
10
11
|
function handleLeftImageClick() {
|
|
11
12
|
dispatch("leftImageClick");
|
|
12
13
|
}
|
|
@@ -29,9 +30,17 @@ function handleTopSectionClick() {
|
|
|
29
30
|
{#if showLoader}
|
|
30
31
|
<div class="item-loader" />
|
|
31
32
|
{/if}
|
|
32
|
-
<div
|
|
33
|
+
<div
|
|
34
|
+
class="item"
|
|
35
|
+
class:prevent-focus={preventFocus}
|
|
36
|
+
on:click={handleItemClick}
|
|
37
|
+
on:keydown
|
|
38
|
+
role="button"
|
|
39
|
+
tabindex="0"
|
|
40
|
+
>
|
|
33
41
|
<div
|
|
34
42
|
class="top-section"
|
|
43
|
+
class:prevent-focus={preventFocus}
|
|
35
44
|
on:click={handleTopSectionClick}
|
|
36
45
|
on:keydown
|
|
37
46
|
role="button"
|
|
@@ -39,7 +48,13 @@ function handleTopSectionClick() {
|
|
|
39
48
|
>
|
|
40
49
|
<div class="left-content">
|
|
41
50
|
{#if properties.leftImageUrl}
|
|
42
|
-
<div
|
|
51
|
+
<div
|
|
52
|
+
class:prevent-focus={preventFocus}
|
|
53
|
+
on:click={handleLeftImageClick}
|
|
54
|
+
on:keydown
|
|
55
|
+
role="button"
|
|
56
|
+
tabindex="0"
|
|
57
|
+
>
|
|
43
58
|
<img class="left-img" src={properties.leftImageUrl} alt="" />
|
|
44
59
|
</div>
|
|
45
60
|
{/if}
|
|
@@ -51,6 +66,7 @@ function handleTopSectionClick() {
|
|
|
51
66
|
{#if properties.label}
|
|
52
67
|
<div
|
|
53
68
|
class="center-text"
|
|
69
|
+
class:prevent-focus={preventFocus}
|
|
54
70
|
on:click={handleCenterTextClick}
|
|
55
71
|
on:keydown
|
|
56
72
|
role="button"
|
|
@@ -69,7 +85,13 @@ function handleTopSectionClick() {
|
|
|
69
85
|
<slot name="rightContent" />
|
|
70
86
|
{/if}
|
|
71
87
|
{#if properties.rightImageUrl}
|
|
72
|
-
<div
|
|
88
|
+
<div
|
|
89
|
+
class:prevent-focus={preventFocus}
|
|
90
|
+
on:click={handleRightImageClick}
|
|
91
|
+
on:keydown
|
|
92
|
+
role="button"
|
|
93
|
+
tabindex="0"
|
|
94
|
+
>
|
|
73
95
|
<img class="right-img" src={properties.rightImageUrl} alt="" />
|
|
74
96
|
</div>
|
|
75
97
|
{/if}
|
|
@@ -193,4 +215,8 @@ function handleTopSectionClick() {
|
|
|
193
215
|
font-family: var(--list-item-right-content-text-font-family);
|
|
194
216
|
justify-content: var(--list-item-right-content-text-justify-content);
|
|
195
217
|
}
|
|
218
|
+
|
|
219
|
+
.prevent-focus:focus {
|
|
220
|
+
outline: none;
|
|
221
|
+
}
|
|
196
222
|
</style>
|
package/dist/Modal/Modal.svelte
CHANGED
|
@@ -61,7 +61,11 @@ onDestroy(() => {
|
|
|
61
61
|
role="button"
|
|
62
62
|
tabindex="0"
|
|
63
63
|
>
|
|
64
|
-
<ModalAnimation
|
|
64
|
+
<ModalAnimation
|
|
65
|
+
enable={properties.enableTransition}
|
|
66
|
+
align={properties.align}
|
|
67
|
+
transitionType={properties.transitionType}
|
|
68
|
+
>
|
|
65
69
|
<div class="modal-content {properties.size}">
|
|
66
70
|
{#if properties.header.leftImage !== null || properties.header.text !== null || properties.header.rightImage !== null}
|
|
67
71
|
<div class="header">
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ModalTransition } from '../types';
|
|
1
2
|
export type ModalSize = 'large' | 'medium' | 'small' | 'fit-content';
|
|
2
3
|
export type ModalAlign = 'top' | 'center' | 'bottom';
|
|
3
4
|
export type ModalProperties = {
|
|
@@ -6,6 +7,7 @@ export type ModalProperties = {
|
|
|
6
7
|
showOverlay: boolean;
|
|
7
8
|
supportHardwareBackPress: boolean;
|
|
8
9
|
enableTransition: boolean;
|
|
10
|
+
transitionType: ModalTransition;
|
|
9
11
|
header: {
|
|
10
12
|
leftImage: string | null;
|
|
11
13
|
rightImage: string | null;
|
package/dist/Modal/properties.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @description Different types of input data which can be passed to the Input Component
|
|
4
4
|
*/
|
|
5
5
|
export type InputDataType = 'text' | 'tel' | 'password' | 'email';
|
|
6
|
+
export type ModalTransition = 'IN' | 'ALL';
|
|
6
7
|
export type AutoCompleteType = 'tel' | 'name' | 'email' | 'one-time-code' | 'postal-code' | 'street-address' | 'on' | 'address-level1';
|
|
7
8
|
/**
|
|
8
9
|
* @name CustomValidator
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/svelte-ui-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run package",
|
|
7
7
|
"preview": "vite preview",
|
|
8
8
|
"package": "svelte-kit sync && svelte-package && publint",
|
|
9
|
-
"publish": "node --experimental-json-modules scripts/publish.js",
|
|
10
9
|
"prepublishOnly": "npm run package",
|
|
11
10
|
"test": "npm run test:integration && npm run test:unit",
|
|
12
11
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
@@ -16,9 +15,6 @@
|
|
|
16
15
|
"test:integration": "playwright test",
|
|
17
16
|
"test:unit": "vitest"
|
|
18
17
|
},
|
|
19
|
-
"author": {
|
|
20
|
-
"name": "Juspay Technologies Pvt Ltd"
|
|
21
|
-
},
|
|
22
18
|
"exports": {
|
|
23
19
|
".": {
|
|
24
20
|
"types": "./dist/index.d.ts",
|