@juspay/svelte-ui-components 1.6.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/Select/Select.svelte +5 -1
- package/dist/Select/properties.d.ts +1 -1
- 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 +1 -1
|
@@ -139,7 +139,7 @@ onDestroy(() => {
|
|
|
139
139
|
{#if !properties.hideDropDownIcon}
|
|
140
140
|
<img
|
|
141
141
|
src={dropDownIcon}
|
|
142
|
-
alt=
|
|
142
|
+
alt={dropDownIconAlt}
|
|
143
143
|
class="arrow {isSelectOpen ? 'active' : ''}"
|
|
144
144
|
/>
|
|
145
145
|
{/if}
|
|
@@ -252,6 +252,10 @@ onDestroy(() => {
|
|
|
252
252
|
word-wrap: var(--non-selected-word-break, break-word);
|
|
253
253
|
white-space: var(--non-selected-white-space);
|
|
254
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);
|
|
255
259
|
}
|
|
256
260
|
|
|
257
261
|
::-webkit-scrollbar {
|
|
@@ -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';
|