@juspay/svelte-ui-components 1.5.0 → 1.7.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/Banner/Banner.svelte +8 -8
- package/dist/Img/properties.d.ts +5 -0
- package/dist/Img/properties.js +1 -0
- package/dist/ListItem/ListItem.svelte +2 -2
- package/dist/Select/Select.svelte +49 -14
- package/dist/Select/Select.svelte.d.ts +1 -0
- package/dist/Select/properties.d.ts +4 -0
- package/dist/Toast/Toast.svelte +116 -0
- package/dist/Toast/Toast.svelte.d.ts +20 -0
- package/dist/Toast/properties.d.ts +9 -0
- package/dist/Toast/properties.js +4 -0
- package/dist/Toolbar/Toolbar.svelte +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/package.json +2 -2
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
position: var(--banner-position, sticky);
|
|
24
24
|
top: var(--banner-top, 0px);
|
|
25
25
|
display: var(--banner-display, flex);
|
|
26
|
-
align-items: center;
|
|
26
|
+
align-items: var(--banner-align-items, center);
|
|
27
27
|
background-color: var(--banner-bg-color, #637c9529);
|
|
28
28
|
width: var(--banner-width, 100%);
|
|
29
29
|
height: var(--banner-height, 37px);
|
|
30
30
|
padding: var(--banner-padding, 10px 12px, 10px, 12px);
|
|
31
31
|
gap: var(--banner-gap, 8px);
|
|
32
|
-
justify-content: center;
|
|
33
|
-
cursor: pointer;
|
|
32
|
+
justify-content: var(--banner-justify-content, center);
|
|
33
|
+
cursor: var(--banner-cursor, pointer);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.banner-image {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
width: var(--banner-img-width, 18px);
|
|
39
39
|
height: var(--banner-img-height, 11.69px);
|
|
40
40
|
margin-bottom: var(--banner-img-margin-bottom, 6px);
|
|
41
|
-
align-items: center;
|
|
41
|
+
align-items: var(--banner-image-align-items, center);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.banner-text {
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
font-size: var(--banner-font-size, 14px);
|
|
50
50
|
line-height: var(--banner-line-height, 17.75px);
|
|
51
51
|
font-weight: var(--banner-font-weight, 500);
|
|
52
|
-
overflow: hidden;
|
|
53
|
-
text-overflow: ellipsis;
|
|
54
|
-
white-space: nowrap;
|
|
55
|
-
align-items: center;
|
|
52
|
+
overflow: var(--banner-overflow, hidden);
|
|
53
|
+
text-overflow: var(--banner-text-overflow, ellipsis);
|
|
54
|
+
white-space: var(--banner-text-white-space, nowrap);
|
|
55
|
+
align-items: var(--banner-text-align-items, center);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.link-text {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -175,7 +175,7 @@ function handleTopSectionClick() {
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
.left-content {
|
|
178
|
-
display: flex;
|
|
178
|
+
display: var(--list-item-left-content-display, flex);
|
|
179
179
|
--image-height: var(--list-item-left-image-height, 24px);
|
|
180
180
|
--image-width: var(--list-item-left-image-width, 24px);
|
|
181
181
|
--image-padding: var(--list-item-left-image-padding, 0px);
|
|
@@ -218,7 +218,7 @@ function handleTopSectionClick() {
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
.right-content {
|
|
221
|
-
display: flex;
|
|
221
|
+
display: var(--list-item-right-content-display, flex);
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
.bottom-section {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script>import { createEventDispatcher, onDestroy, onMount } from "svelte";
|
|
2
|
+
import Img from "../Img/Img.svelte";
|
|
2
3
|
import Button from "../Button/Button.svelte";
|
|
3
4
|
let selectedElementDiv = null;
|
|
5
|
+
export let dropDownIconAlt = "";
|
|
4
6
|
export let properties = {
|
|
5
7
|
placeholder: "",
|
|
6
8
|
label: "",
|
|
@@ -8,8 +10,10 @@ export let properties = {
|
|
|
8
10
|
selectedItem: "",
|
|
9
11
|
selectedItemLabel: null,
|
|
10
12
|
showSelectedItemInDropdown: false,
|
|
11
|
-
selectMultipleItems: false
|
|
13
|
+
selectMultipleItems: false,
|
|
14
|
+
leftIcon: null
|
|
12
15
|
};
|
|
16
|
+
const dropDownIcon = properties.dropDownIcon ?? "https://sdk.breeze.in/gallery/icons/down-arrow.svg";
|
|
13
17
|
const applyButtonProps = {
|
|
14
18
|
text: "Apply",
|
|
15
19
|
enable: true,
|
|
@@ -111,6 +115,11 @@ onDestroy(() => {
|
|
|
111
115
|
role="button"
|
|
112
116
|
tabindex="0"
|
|
113
117
|
>
|
|
118
|
+
{#if properties.leftIcon !== null}
|
|
119
|
+
<div class="icon-container">
|
|
120
|
+
<Img {...properties.leftIcon} />
|
|
121
|
+
</div>
|
|
122
|
+
{/if}
|
|
114
123
|
{#if properties.selectMultipleItems && Array.isArray(properties.selectedItemLabel) && Array.isArray(properties.selectedItem)}
|
|
115
124
|
{#if properties.selectedItem.length === 0}
|
|
116
125
|
{properties.placeholder}
|
|
@@ -127,11 +136,13 @@ onDestroy(() => {
|
|
|
127
136
|
{properties.selectedItemLabel}
|
|
128
137
|
{/if}
|
|
129
138
|
<div class="filler" />
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
139
|
+
{#if !properties.hideDropDownIcon}
|
|
140
|
+
<img
|
|
141
|
+
src={dropDownIcon}
|
|
142
|
+
alt={dropDownIconAlt}
|
|
143
|
+
class="arrow {isSelectOpen ? 'active' : ''}"
|
|
144
|
+
/>
|
|
145
|
+
{/if}
|
|
135
146
|
</div>
|
|
136
147
|
<div
|
|
137
148
|
class="non-selected-items"
|
|
@@ -173,7 +184,7 @@ onDestroy(() => {
|
|
|
173
184
|
font-weight: var(--select-font-weight, 400);
|
|
174
185
|
width: var(--select-width, 100%);
|
|
175
186
|
min-width: var(--select-min-width);
|
|
176
|
-
box-shadow: 0px 1px 8px #2f537733;
|
|
187
|
+
box-shadow: var(--select-box-shadow, 0px 1px 8px #2f537733);
|
|
177
188
|
-webkit-appearance: none !important; /* For Safari MWeb */
|
|
178
189
|
outline: none;
|
|
179
190
|
cursor: pointer;
|
|
@@ -187,15 +198,18 @@ onDestroy(() => {
|
|
|
187
198
|
--button-border-radius: 2px;
|
|
188
199
|
}
|
|
189
200
|
|
|
201
|
+
.select:hover {
|
|
202
|
+
background-color: var(--select-hover-bgcolor, #ffffff);
|
|
203
|
+
}
|
|
204
|
+
|
|
190
205
|
.arrow {
|
|
191
|
-
height: 16px;
|
|
192
|
-
width: 16px;
|
|
193
|
-
transform: rotate(-0.25turn);
|
|
206
|
+
height: var(--dropdown-arrow-icon-height, 16px);
|
|
207
|
+
width: var(--dropdown-arrow-icon-width, 16px);
|
|
194
208
|
transition: transform 0.1s;
|
|
195
209
|
}
|
|
196
210
|
|
|
197
211
|
.active {
|
|
198
|
-
transform: rotate(0.
|
|
212
|
+
transform: rotate(0.5turn);
|
|
199
213
|
}
|
|
200
214
|
|
|
201
215
|
.item {
|
|
@@ -227,15 +241,21 @@ onDestroy(() => {
|
|
|
227
241
|
.non-selected-items {
|
|
228
242
|
display: var(--non-selected-display);
|
|
229
243
|
background-color: var(--non-selected-item-bgcolor, #ffffff);
|
|
244
|
+
color: var(--non-selected-item-color);
|
|
230
245
|
box-shadow: 0px 1px 8px #2f537733;
|
|
231
246
|
width: var(--non-selected-width, fit-content);
|
|
232
247
|
min-width: var(--non-selected-min-width, 100%);
|
|
233
248
|
position: absolute;
|
|
234
|
-
border-radius:
|
|
235
|
-
margin: 4px 0px 0px 0px;
|
|
249
|
+
border-radius: var(--non-selected-border-radius, 4px);
|
|
250
|
+
margin: var(--non-selected-margin, 4px 0px 0px 0px);
|
|
236
251
|
z-index: 10;
|
|
237
252
|
word-wrap: var(--non-selected-word-break, break-word);
|
|
238
253
|
white-space: var(--non-selected-white-space);
|
|
254
|
+
font-weight: var(--non-select-font-weight, 500);
|
|
255
|
+
left: var(--non-selected-left);
|
|
256
|
+
right: var(--non-selected-right);
|
|
257
|
+
top: var(--non-selected-top);
|
|
258
|
+
bottom: var(--non-selected-bottom);
|
|
239
259
|
}
|
|
240
260
|
|
|
241
261
|
::-webkit-scrollbar {
|
|
@@ -249,7 +269,7 @@ onDestroy(() => {
|
|
|
249
269
|
}
|
|
250
270
|
|
|
251
271
|
.item-selected::after {
|
|
252
|
-
content: '✔';
|
|
272
|
+
content: var(--selected-option-icon, '✔');
|
|
253
273
|
position: absolute;
|
|
254
274
|
right: 7px;
|
|
255
275
|
}
|
|
@@ -268,4 +288,19 @@ onDestroy(() => {
|
|
|
268
288
|
white-space: var(--multipleSelect-btn-white-space, nowrap);
|
|
269
289
|
padding: var(--multipleSelect-btn-padding, 2px);
|
|
270
290
|
}
|
|
291
|
+
|
|
292
|
+
.icon-container {
|
|
293
|
+
width: var(--select-icon-container-width, fit-content);
|
|
294
|
+
height: var(--select-icon-container-height, fit-content);
|
|
295
|
+
border-radius: var(--select-icon-container-border-radius);
|
|
296
|
+
opacity: var(--select-icon-container-opacity);
|
|
297
|
+
background: var(--select-icon-container-background);
|
|
298
|
+
display: flex;
|
|
299
|
+
align-items: center;
|
|
300
|
+
justify-content: center;
|
|
301
|
+
margin: var(--select-icon-container-margin, 0px 8px 0px 0px);
|
|
302
|
+
padding: var(--select-icon-container-padding);
|
|
303
|
+
--image-height: var(--select-icon-height);
|
|
304
|
+
--image-width: var(--select-icon-height);
|
|
305
|
+
}
|
|
271
306
|
</style>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ImgProps } from '../Img/properties';
|
|
1
2
|
export type SelectProperties = {
|
|
2
3
|
placeholder: string;
|
|
3
4
|
label: string;
|
|
@@ -6,4 +7,7 @@ export type SelectProperties = {
|
|
|
6
7
|
selectedItemLabel: string | string[] | null;
|
|
7
8
|
showSelectedItemInDropdown: boolean;
|
|
8
9
|
selectMultipleItems: boolean;
|
|
10
|
+
hideDropDownIcon?: boolean;
|
|
11
|
+
dropDownIcon?: string;
|
|
12
|
+
leftIcon: ImgProps | null;
|
|
9
13
|
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<script>import { createEventDispatcher, onDestroy, onMount } from "svelte";
|
|
2
|
+
import { fly } from "svelte/transition";
|
|
3
|
+
import { defaultToastProperties } from "./properties";
|
|
4
|
+
export let properties = defaultToastProperties;
|
|
5
|
+
const dispatch = createEventDispatcher();
|
|
6
|
+
let showToast = false;
|
|
7
|
+
let timeoutId = null;
|
|
8
|
+
function hideToast() {
|
|
9
|
+
showToast = false;
|
|
10
|
+
}
|
|
11
|
+
function handleAnimationEnd() {
|
|
12
|
+
dispatch("onToastHide");
|
|
13
|
+
}
|
|
14
|
+
onMount(() => {
|
|
15
|
+
showToast = true;
|
|
16
|
+
timeoutId = setTimeout(hideToast, properties.duration);
|
|
17
|
+
});
|
|
18
|
+
onDestroy(() => {
|
|
19
|
+
if (timeoutId !== null) {
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if showToast}
|
|
26
|
+
<div
|
|
27
|
+
class="toast {properties.type ?? ''}"
|
|
28
|
+
in:fly={{ x: 500, y: 0, duration: 400 }}
|
|
29
|
+
out:fly={{ x: 500, y: 0, duration: 800 }}
|
|
30
|
+
on:outroend={handleAnimationEnd}
|
|
31
|
+
>
|
|
32
|
+
{#if properties.leftIcon}
|
|
33
|
+
<div class="toast-icon-wrapper">
|
|
34
|
+
<img class="toast-icon" src={properties.leftIcon} alt="toast-icon" />
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
37
|
+
|
|
38
|
+
<div class="toast-message">
|
|
39
|
+
{properties.message}
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
{#if properties.rightIcon}
|
|
43
|
+
<div class="close-button" tabindex="0" role="button" on:click={hideToast} on:keypress>
|
|
44
|
+
<img class="toast-icon" src={properties.rightIcon} alt="close-icon" />
|
|
45
|
+
</div>
|
|
46
|
+
{/if}
|
|
47
|
+
</div>
|
|
48
|
+
{/if}
|
|
49
|
+
|
|
50
|
+
<style>
|
|
51
|
+
.toast {
|
|
52
|
+
padding: var(--toast-padding, 10px);
|
|
53
|
+
font-size: var(--toast-font-size, 14px);
|
|
54
|
+
height: var(--toast-height, auto);
|
|
55
|
+
border-radius: var(--toast-border-radius, 0px);
|
|
56
|
+
width: var(--toast-width, auto);
|
|
57
|
+
align-items: var(--toast-align-items, center);
|
|
58
|
+
margin: var(--toast-margin, 0px 10px 10px 10px);
|
|
59
|
+
justify-content: var(--toast-justify-content, space-between);
|
|
60
|
+
z-index: var(--toast-z-index, 1000);
|
|
61
|
+
display: var(--taost-dispay, flex);
|
|
62
|
+
position: var(--toast-position, absolute);
|
|
63
|
+
left: var(--toast-left, 0);
|
|
64
|
+
right: var(--toast-right, 0);
|
|
65
|
+
background-color: var(--default-background-color, #87ceeb);
|
|
66
|
+
}
|
|
67
|
+
.toast-icon-wrapper {
|
|
68
|
+
width: var(--toast-icon-wrapper-width, 20px);
|
|
69
|
+
height: var(--toast-icon-wrapper-height, 20px);
|
|
70
|
+
margin: var(--toast-icon-margin, 0 6px 0 0);
|
|
71
|
+
padding: var(--toast-icon-wrapper-padding, 1px);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.toast-icon {
|
|
75
|
+
height: var(--toast-icon-height, 100%);
|
|
76
|
+
border-radius: var(--toast-icon-border-radius, 50%);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.toast-message {
|
|
80
|
+
display: var(--toast-message-display, flex);
|
|
81
|
+
flex: var(--taost-message-flex, 1);
|
|
82
|
+
padding: var(--toast-message-padding, 1px);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.close-button {
|
|
86
|
+
width: var(--toast-close-button-width, 20px);
|
|
87
|
+
height: var(--toast-close-button-height, 20px);
|
|
88
|
+
cursor: var(--toast-close-button-cursor, pointer);
|
|
89
|
+
gap: var(--toast-close-button-gap, 6px);
|
|
90
|
+
margin: var(--toast-close-button-margin, 0 0 0 10px);
|
|
91
|
+
display: var(--toast-close-button-display, flex);
|
|
92
|
+
align-items: var(--toast-close-button-align-items, center);
|
|
93
|
+
justify-content: var(--toast-close-button-justify-content, center);
|
|
94
|
+
padding: var(--toast-close-button-padding, 1px);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.success {
|
|
98
|
+
color: var(--toast-success-text, #fff);
|
|
99
|
+
background-color: var(--toast-background-color, #24aa5a);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.info {
|
|
103
|
+
color: var(--toast-info-text, #fff);
|
|
104
|
+
background-color: var(--toast-background-color, #87ceeb);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.warn {
|
|
108
|
+
color: var(--toast-warn-text, #fff);
|
|
109
|
+
background-color: var(--toast-background-color, #f3a42d);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.error {
|
|
113
|
+
color: var(--toast-error-text, #fff);
|
|
114
|
+
background-color: var(--toast-background-color, #f04438);
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type ToastProperties } from './properties';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
properties?: ToastProperties | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
keypress: KeyboardEvent;
|
|
9
|
+
onToastHide: CustomEvent<any>;
|
|
10
|
+
} & {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export type ToastProps = typeof __propDef.props;
|
|
16
|
+
export type ToastEvents = typeof __propDef.events;
|
|
17
|
+
export type ToastSlots = typeof __propDef.slots;
|
|
18
|
+
export default class Toast extends SvelteComponent<ToastProps, ToastEvents, ToastSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ToastType = 'success' | 'error' | 'info' | 'warn';
|
|
2
|
+
export type ToastProperties = {
|
|
3
|
+
duration: number;
|
|
4
|
+
leftIcon?: string;
|
|
5
|
+
message: string;
|
|
6
|
+
rightIcon?: string;
|
|
7
|
+
type?: ToastType;
|
|
8
|
+
};
|
|
9
|
+
export declare const defaultToastProperties: ToastProperties;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { default as CheckListItem } from './CheckListItem/CheckListItem.svelte';
|
|
|
20
20
|
export { default as Table } from './Table/Table.svelte';
|
|
21
21
|
export { default as Stepper } from './Stepper/Stepper.svelte';
|
|
22
22
|
export { default as Step } from './Stepper/Step.svelte';
|
|
23
|
+
export { default as Toast } from './Toast/Toast.svelte';
|
|
23
24
|
export type { ButtonProperties } from './Button/properties';
|
|
24
25
|
export type { ModalProperties, ModalAlign, ModalSize } from './Modal/properties';
|
|
25
26
|
export type { InputProperties } from './Input/properties';
|
|
@@ -39,6 +40,7 @@ export type { BadgeProperties } from './Badge/properties';
|
|
|
39
40
|
export type { BannerProperties } from './Banner/properties';
|
|
40
41
|
export type { TableProperties } from './Table/properties';
|
|
41
42
|
export type { StepperProperties } from './Stepper/properties';
|
|
43
|
+
export type { ToastProperties } from './Toast/properties';
|
|
42
44
|
export { defaultIconProperties } from './Icon/properties';
|
|
43
45
|
export { defaultButtonProperties } from './Button/properties';
|
|
44
46
|
export { defaultModalProperties } from './Modal/properties';
|
|
@@ -49,4 +51,5 @@ export { defaultStatusProperties } from './Status/properties';
|
|
|
49
51
|
export { defaultListItemProperties } from './ListItem/properties';
|
|
50
52
|
export { defaultToolbarProperties } from './Toolbar/properties';
|
|
51
53
|
export { defaultCarouselProperties } from './Carousel/properties';
|
|
54
|
+
export { defaultToastProperties } from './Toast/properties';
|
|
52
55
|
export { validateInput } from './utils';
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export { default as CheckListItem } from './CheckListItem/CheckListItem.svelte';
|
|
|
20
20
|
export { default as Table } from './Table/Table.svelte';
|
|
21
21
|
export { default as Stepper } from './Stepper/Stepper.svelte';
|
|
22
22
|
export { default as Step } from './Stepper/Step.svelte';
|
|
23
|
+
export { default as Toast } from './Toast/Toast.svelte';
|
|
23
24
|
export { defaultIconProperties } from './Icon/properties';
|
|
24
25
|
export { defaultButtonProperties } from './Button/properties';
|
|
25
26
|
export { defaultModalProperties } from './Modal/properties';
|
|
@@ -30,4 +31,5 @@ export { defaultStatusProperties } from './Status/properties';
|
|
|
30
31
|
export { defaultListItemProperties } from './ListItem/properties';
|
|
31
32
|
export { defaultToolbarProperties } from './Toolbar/properties';
|
|
32
33
|
export { defaultCarouselProperties } from './Carousel/properties';
|
|
34
|
+
export { defaultToastProperties } from './Toast/properties';
|
|
33
35
|
export { validateInput } from './utils';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/svelte-ui-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run package",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"svelte-check": "^3.6.0",
|
|
55
55
|
"tslib": "^2.6.2",
|
|
56
56
|
"typescript": "^5.2.2",
|
|
57
|
-
"vite": "^4.5.
|
|
57
|
+
"vite": "^4.5.3",
|
|
58
58
|
"vitest": "^0.34.6",
|
|
59
59
|
"type-decoder": "^1.2.0"
|
|
60
60
|
},
|