@juspay/svelte-ui-components 2.2.3 → 2.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.
@@ -1,9 +1,14 @@
1
1
  import type { Snippet } from 'svelte';
2
- export type BannerProperties = {
3
- icon?: string | null;
2
+ export type BannerProperties = MandatoryBannerProperties & OptionalBannerProperties & BannerEventProperties;
3
+ export type MandatoryBannerProperties = {
4
4
  text: string;
5
+ };
6
+ export type OptionalBannerProperties = {
7
+ icon?: string | null;
5
8
  linkText?: string | null;
6
9
  rightContent?: Snippet;
10
+ };
11
+ export type BannerEventProperties = {
7
12
  onclick?: (event: MouseEvent) => void;
8
13
  onkeydown?: (event: KeyboardEvent) => void;
9
14
  };
@@ -31,8 +31,7 @@
31
31
  <div class="button-progress-bar"></div>
32
32
  {/if}
33
33
  <button
34
- style:--opacity={enable ? 1 : 0.4}
35
- style:--cursor={enable ? 'pointer' : 'not-allowed'}
34
+ class:disabled={!enable}
36
35
  onclick={handleButtonClick}
37
36
  {onkeyup}
38
37
  disabled={!(enable && !showLoader)}
@@ -81,6 +80,11 @@
81
80
  box-shadow: var(--button-box-shadow, none);
82
81
  }
83
82
 
83
+ .disabled {
84
+ cursor: var(--disabled-cursor, not-allowed);
85
+ opacity: var(--disabled-opacity, 0.4);
86
+ }
87
+
84
88
  .button-loader {
85
89
  order: var(--button-loader-order, 1);
86
90
  }
@@ -1,14 +1,19 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  export type LoaderType = 'Circular' | 'ProgressBar';
3
- export type ButtonProperties = {
3
+ export type ButtonProperties = OptionalButtonProperties & ButtonEventProperties & MandatoryButtonProperties;
4
+ export type MandatoryButtonProperties = {
4
5
  text: string;
6
+ };
7
+ export type OptionalButtonProperties = {
5
8
  enable?: boolean;
6
9
  showProgressBar?: boolean;
7
10
  showLoader?: boolean;
8
11
  loaderType?: LoaderType;
9
12
  type?: 'submit' | 'reset' | 'button';
10
13
  testId?: string;
14
+ icon?: Snippet;
15
+ };
16
+ export type ButtonEventProperties = {
11
17
  onclick?: (event: MouseEvent) => void;
12
18
  onkeyup?: (event: KeyboardEvent) => void;
13
- icon?: Snippet;
14
19
  };
@@ -3,11 +3,16 @@ export type CarouselView = {
3
3
  properties?: Record<string, unknown>;
4
4
  component: Component<Record<string, unknown>>;
5
5
  };
6
- export type CarouselProperties = {
6
+ export type CarouselProperties = CarouselEventProperties & OptionalCarouselProperties & MandatoryCarouselProperties;
7
+ export type MandatoryCarouselProperties = {
7
8
  views: CarouselView[];
9
+ };
10
+ export type OptionalCarouselProperties = {
8
11
  autoplay?: boolean;
9
12
  autoplayInterval?: number;
10
13
  showDots?: boolean;
11
14
  isScrollableLast?: boolean;
15
+ };
16
+ export type CarouselEventProperties = {
12
17
  onkeydown?: (event: KeyboardEvent) => void;
13
18
  };
@@ -1,7 +1,12 @@
1
1
  import type { Snippet } from 'svelte';
2
- export type CheckListItemProperties = {
2
+ export type CheckListItemProperties = OptionalCheckListItemProperties & CheckListItemEventProperties & MandatoryCheckListItemProperties;
3
+ export type MandatoryCheckListItemProperties = {
3
4
  text: string;
5
+ };
6
+ export type OptionalCheckListItemProperties = {
4
7
  checked?: boolean;
5
8
  checkboxLabel?: Snippet;
9
+ };
10
+ export type CheckListItemEventProperties = {
6
11
  onclick?: (checked: boolean) => void;
7
12
  };
@@ -1,8 +1,13 @@
1
- export type GridItemProperties = {
1
+ export type GridItemProperties = OptionalGridItemProperties & GridItemEventProperties & MandatoryGridItemProperties;
2
+ export type MandatoryGridItemProperties = {
2
3
  icon: string;
3
4
  text: string;
5
+ };
6
+ export type OptionalGridItemProperties = {
4
7
  headerIcon?: string | null;
5
8
  showLoader?: boolean;
9
+ };
10
+ export type GridItemEventProperties = {
6
11
  onclick?: (event: MouseEvent) => void;
7
12
  onkeydown?: (event: KeyboardEvent) => void;
8
13
  };
@@ -1,6 +1,11 @@
1
- export type IconProperties = {
1
+ export type IconProperties = OptionalIconProperties & IconEventProperties & MandatoryIconProperties;
2
+ export type MandatoryIconProperties = {
2
3
  icon: string;
4
+ };
5
+ export type OptionalIconProperties = {
3
6
  text?: string | null;
7
+ };
8
+ export type IconEventProperties = {
4
9
  onclick?: (event: MouseEvent) => void;
5
10
  onkeydown?: (event: KeyboardEvent) => void;
6
11
  };
@@ -1,5 +1,8 @@
1
- export type ImgProperties = {
1
+ export type ImgProperties = OptionalImgProperties & MandatoryImgProperties;
2
+ export type MandatoryImgProperties = {
2
3
  src: string;
3
4
  alt: string;
5
+ };
6
+ export type OptionalImgProperties = {
4
7
  fallback?: string | null;
5
8
  };
@@ -23,6 +23,8 @@
23
23
  name = '',
24
24
  testId = '',
25
25
  textTransformers = [],
26
+ textViewPresentation = [],
27
+ onFocus = () => {},
26
28
  onFocusout = () => {},
27
29
  onInput = () => {},
28
30
  onPaste = () => {},
@@ -60,7 +62,7 @@
60
62
  return valueValidation;
61
63
  });
62
64
 
63
- let showErrorMessage = $derived(validationState === 'Invalid');
65
+ const showErrorMessage = $derived(validationState === 'Invalid');
64
66
 
65
67
  function handleOnInput(event: Event) {
66
68
  if (inputElement === null) {
@@ -81,12 +83,16 @@
81
83
  }
82
84
  if (numberLength > maxLength) {
83
85
  const existingInput = value;
84
- if (existingInput.length == maxLength) {
85
- inputElement.value = value;
86
+ if (existingInput.length === maxLength) {
87
+ inputElement.value = applyTextPresentation(value);
86
88
  return;
87
89
  }
90
+ /**
91
+ * choose last max length number of digits if length is bigger than max length passed in props
92
+ */
88
93
  currentValue = currentValue.substring(numberLength - maxLength);
89
94
  }
95
+ currentValue = applyTextPresentation(currentValue);
90
96
  inputElement.value = currentValue;
91
97
  }
92
98
  value = inputElement.value;
@@ -128,7 +134,9 @@
128
134
  /**
129
135
  * choose last max length number of digits if length is bigger than max length passed in props
130
136
  */
131
- const finalValue = filteredNumber.substring(filteredNumberLength - maxLength);
137
+ const finalValue = applyTextPresentation(
138
+ filteredNumber.substring(filteredNumberLength - maxLength)
139
+ );
132
140
  // Adding reactivity
133
141
  value = finalValue;
134
142
  onPaste(event);
@@ -141,6 +149,13 @@
141
149
  }
142
150
  }
143
151
 
152
+ function applyTextPresentation(currentValue: string): string {
153
+ return textViewPresentation.reduce((prevValue, currIndexFunction) => {
154
+ let newValue = currIndexFunction(prevValue);
155
+ return newValue;
156
+ }, currentValue);
157
+ }
158
+
144
159
  function _onFocusOut(event: FocusEvent) {
145
160
  if (validationState === 'InProgress' && value.length > 0) {
146
161
  validationState = 'Invalid';
@@ -167,6 +182,7 @@
167
182
  {placeholder}
168
183
  autocomplete={autoComplete}
169
184
  {name}
185
+ onfocus={onFocus}
170
186
  onfocusout={_onFocusOut}
171
187
  oninput={handleOnInput}
172
188
  onpaste={handleOnPaste}
@@ -185,9 +201,11 @@
185
201
  {placeholder}
186
202
  autocomplete={autoComplete}
187
203
  {name}
204
+ onfocus={onFocus}
188
205
  onfocusout={_onFocusOut}
189
206
  oninput={handleOnInput}
190
- onpaste={onPaste}
207
+ onpaste={handleOnPaste}
208
+ onclick={onClick}
191
209
  data-pw={testId}
192
210
  class:action-input={actionInput}
193
211
  disabled={disable}
@@ -239,13 +257,19 @@
239
257
  }
240
258
 
241
259
  .input-error {
242
- --input-focus-border: var(--input-error-border, 1px solid var(--input-error-msg-text-color, #fa1405)) !important;
243
- --input-border: var(--input-error-border, 1px solid var(--input-error-msg-text-color, #fa1405)) !important;
260
+ --input-focus-border: var(
261
+ --input-error-border,
262
+ 1px solid var(--input-error-msg-text-color, #fa1405)
263
+ ) !important;
264
+ --input-border: var(
265
+ --input-error-border,
266
+ 1px solid var(--input-error-msg-text-color, #fa1405)
267
+ ) !important;
244
268
  }
245
269
 
246
270
  .action-input {
247
271
  border-radius: var(--input-radius, 4px 0px 0px 4px);
248
- box-shadow: 0px 0px 0px #ffffff;
272
+ box-shadow: var(--input-box-shadow, 0px 0px 0px #ffffff);
249
273
  margin-bottom: 0;
250
274
  }
251
275
 
@@ -1,8 +1,9 @@
1
1
  import type { AutoCompleteType, CustomValidator, InputDataType, TextTransformer, ValidationState } from '../types';
2
- export type InputProperties = OptionalInputProps & {
2
+ export type InputProperties = OptionalInputProperties & InputEventProperties & MandatoryInputProperties;
3
+ export type MandatoryInputProperties = {
3
4
  value: string;
4
5
  };
5
- export type OptionalInputProps = {
6
+ export type OptionalInputProperties = {
6
7
  placeholder?: string | null;
7
8
  dataType?: InputDataType;
8
9
  label?: string | null;
@@ -20,8 +21,12 @@ export type OptionalInputProps = {
20
21
  autoComplete?: AutoCompleteType;
21
22
  name?: string;
22
23
  textTransformers?: TextTransformer[];
24
+ textViewPresentation?: TextTransformer[];
23
25
  testId?: string;
26
+ };
27
+ export type InputEventProperties = {
24
28
  onInput?: (value: string, event: Event) => void;
29
+ onFocus?: (event: FocusEvent) => void;
25
30
  onFocusout?: (event: FocusEvent) => void;
26
31
  onPaste?: (event: ClipboardEvent) => void;
27
32
  onClick?: (event: MouseEvent) => void;
@@ -11,7 +11,12 @@
11
11
  rightButtonProperties,
12
12
  leftButtonProperties,
13
13
  bottomButtonProperties,
14
- leftIcon
14
+ inputEventProperties,
15
+ rightButtonEventProperties,
16
+ leftButtonEventProperties,
17
+ bottomButtonEventProperties,
18
+ leftIcon,
19
+ rightIcon
15
20
  }: InputButtonProperties = $props();
16
21
 
17
22
  let validationState = $state<ValidationState>('InProgress');
@@ -19,29 +24,29 @@
19
24
  let inputRef: SvelteComponent | null = $state(null);
20
25
 
21
26
  // Derive enable state for right button
22
- let isRightButtonEnabled = $derived(validationState === 'Valid');
27
+ const isRightButtonEnabled = $derived(validationState === 'Valid');
23
28
 
24
29
  function rightButtonClick(event: MouseEvent): void {
25
30
  if (validationState === 'Valid') {
26
- rightButtonProperties?.onclick?.(event);
31
+ rightButtonEventProperties?.onclick?.(event);
27
32
  }
28
33
  }
29
34
 
30
35
  function bottomButtonClick(event: MouseEvent): void {
31
36
  if (validationState === 'Valid') {
32
- bottomButtonProperties?.onclick?.(event);
37
+ bottomButtonEventProperties?.onclick?.(event);
33
38
  }
34
39
  }
35
40
 
36
41
  function triggerRightClickIfValid(event: KeyboardEvent): void {
37
42
  if (event?.key === 'Enter' && validationState === 'Valid') {
38
- rightButtonProperties?.onkeyup?.(event);
43
+ rightButtonEventProperties?.onkeyup?.(event);
39
44
  }
40
45
  }
41
46
 
42
47
  function handleStateChange(state: ValidationState): void {
43
48
  validationState = state;
44
- inputProperties.onStateChange?.(state);
49
+ inputEventProperties?.onStateChange?.(state);
45
50
  }
46
51
 
47
52
  export function focus() {
@@ -49,59 +54,59 @@
49
54
  }
50
55
  </script>
51
56
 
52
-
53
57
  <div class="container">
54
- {#if inputProperties.label && inputProperties.label !== ''}
55
- <label class="label" for={inputProperties.name}>
56
- {inputProperties.label}
57
- </label>
58
- {/if}
59
-
60
- <div class="input-button-container">
61
- <div class="input-button {validationState === 'Invalid' ? 'invalid' : 'valid'}">
62
- {#if leftButtonProperties != null}
63
- <div class="left-button">
64
- <Button {...leftButtonProperties} icon={leftIcon} />
58
+ {#if inputProperties.label && inputProperties.label !== ''}
59
+ <label class="label" for={inputProperties.name}>
60
+ {inputProperties.label}
61
+ </label>
62
+ {/if}
63
+
64
+ <div class="input-button-container">
65
+ <div class="input-button {validationState === 'Invalid' ? 'invalid' : 'valid'}">
66
+ {#if leftButtonProperties != null}
67
+ <div class="left-button">
68
+ <Button {...leftButtonProperties} {...leftButtonEventProperties} icon={leftIcon} />
69
+ </div>
70
+ {/if}
71
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
72
+ <div class="input" onkeyup={triggerRightClickIfValid}>
73
+ <Input
74
+ {...inputProperties}
75
+ {...inputEventProperties}
76
+ bind:value
77
+ bind:this={inputRef}
78
+ onStateChange={handleStateChange}
79
+ actionInput={true}
80
+ />
65
81
  </div>
66
- {/if}
67
- <!-- svelte-ignore a11y_no_static_element_interactions -->
68
- <div class="input" onkeyup={triggerRightClickIfValid}>
69
- <Input
70
- {...inputProperties}
71
- bind:value
72
- bind:this={inputRef}
73
- onStateChange={handleStateChange}
74
- actionInput={true}
75
- />
82
+ {#if rightButtonProperties != null}
83
+ <div class="right-button">
84
+ <Button
85
+ {...rightButtonProperties}
86
+ enable={isRightButtonEnabled}
87
+ onclick={rightButtonClick}
88
+ icon={rightIcon}
89
+ />
90
+ </div>
91
+ {/if}
76
92
  </div>
77
- {#if rightButtonProperties != null}
78
- <div class="right-button">
79
- <Button
80
- {...rightButtonProperties}
81
- enable={isRightButtonEnabled}
82
- onclick={rightButtonClick}
83
- />
93
+ {#if bottomButtonProperties != null}
94
+ <div class="bottom-button">
95
+ <Button {...bottomButtonProperties} onclick={bottomButtonClick} />
84
96
  </div>
85
97
  {/if}
86
98
  </div>
87
- {#if bottomButtonProperties != null}
88
- <div class="bottom-button">
89
- <Button {...bottomButtonProperties} onclick={bottomButtonClick} />
99
+ {#if inputProperties.onErrorMessage !== '' && validationState === 'Invalid'}
100
+ <div class="error-message">
101
+ {inputProperties.onErrorMessage}
102
+ </div>
103
+ {/if}
104
+ {#if inputProperties.infoMessage !== ''}
105
+ <div class="info-message">
106
+ {inputProperties.infoMessage}
90
107
  </div>
91
108
  {/if}
92
109
  </div>
93
- {#if inputProperties.onErrorMessage !== '' && validationState === 'Invalid'}
94
- <div class="error-message">
95
- {inputProperties.onErrorMessage}
96
- </div>
97
- {/if}
98
- {#if inputProperties.infoMessage !== ''}
99
- <div class="info-message">
100
- {inputProperties.infoMessage}
101
- </div>
102
- {/if}
103
- </div>
104
-
105
110
 
106
111
  <style>
107
112
  .container {
@@ -161,7 +166,7 @@
161
166
  font-size: var(--input-label-msg-text-size, 12px);
162
167
  color: var(--input-label-msg-text-color, #637c95);
163
168
  line-height: var(--input-label-msg-text-line-height);
164
- margin-bottom: 6px;
169
+ margin: var(--input-label-msg-text-margin, 0px 0px 6px 0px);
165
170
  }
166
171
 
167
172
  .invalid {
@@ -201,6 +206,11 @@
201
206
  flex-direction: row;
202
207
  --button-content-gap: var(--left-button-content-gap);
203
208
  --button-content-flex-direction: var(--left-button-content-flex-direction, row);
209
+ --button-icon-order: var(--left-button-icon-order);
210
+ --button-icon-display: var(--left-button-icon-display);
211
+ --button-text-order: var(--left-button-text-order);
212
+ --disabled-cursor: var(--left-button-disabled-cursor);
213
+ --disabled-opacity: var(--left-button-disabled-opacity);
204
214
  }
205
215
 
206
216
  .right-button {
@@ -225,5 +235,10 @@
225
235
  --button-content-gap: var(--right-button-content-gap);
226
236
  --button-visibility: var(--right-button-visibility, visible);
227
237
  --button-content-flex-direction: var(--right-button-content-flex-direction, row);
238
+ --button-icon-order: var(--right-button-icon-order);
239
+ --button-icon-display: var(--right-button-icon-display);
240
+ --button-text-order: var(--right-button-text-order);
241
+ --disabled-cursor: var(--right-button-disabled-cursor);
242
+ --disabled-opacity: var(--right-button-disabled-opacity);
228
243
  }
229
244
  </style>
@@ -1,13 +1,22 @@
1
- import type { ButtonProperties } from '../Button/properties';
2
- import type { InputProperties } from '../Input/properties';
1
+ import type { ButtonEventProperties, MandatoryButtonProperties, OptionalButtonProperties } from '../Button/properties';
2
+ import type { InputEventProperties, OptionalInputProperties } from '../Input/properties';
3
3
  import type { Snippet } from 'svelte';
4
- export type InputButtonProperties = OptionalInputButtonProperties & {
4
+ export type InputButtonProperties = OptionalInputButtonProperties & InputButtonEventProperties & {
5
5
  value: string;
6
6
  };
7
+ type _ButtonProperties = OptionalButtonProperties & MandatoryButtonProperties;
7
8
  export type OptionalInputButtonProperties = {
8
- inputProperties: Omit<InputProperties, 'value'>;
9
- rightButtonProperties?: ButtonProperties | null;
10
- leftButtonProperties?: ButtonProperties | null;
11
- bottomButtonProperties?: ButtonProperties | null;
9
+ inputProperties: OptionalInputProperties;
10
+ rightButtonProperties?: _ButtonProperties | null;
11
+ leftButtonProperties?: _ButtonProperties | null;
12
+ bottomButtonProperties?: _ButtonProperties | null;
12
13
  leftIcon?: Snippet;
14
+ rightIcon?: Snippet;
13
15
  };
16
+ export type InputButtonEventProperties = {
17
+ inputEventProperties?: InputEventProperties;
18
+ rightButtonEventProperties?: ButtonEventProperties | null;
19
+ leftButtonEventProperties?: ButtonEventProperties | null;
20
+ bottomButtonEventProperties?: ButtonEventProperties | null;
21
+ };
22
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
- export type ListItemProperties = {
2
+ export type ListItemProperties = ListItemEventProperties & {
3
3
  leftImageUrl?: string | null;
4
4
  leftImageFallbackUrl?: string | null;
5
5
  rightImageUrl?: string | null;
@@ -19,6 +19,8 @@ export type ListItemProperties = {
19
19
  centerContent?: Snippet;
20
20
  rightContent?: Snippet;
21
21
  bottomContent?: Snippet;
22
+ };
23
+ export type ListItemEventProperties = {
22
24
  onleftImageClick?: (event: MouseEvent) => void;
23
25
  onrightImageClick?: (event: MouseEvent) => void;
24
26
  oncenterTextClick?: (event: MouseEvent) => void;
@@ -3,7 +3,7 @@ import type { ModalTransition } from '../types';
3
3
  import type { Snippet } from 'svelte';
4
4
  export type ModalSize = 'large' | 'medium' | 'small' | 'fit-content';
5
5
  export type ModalAlign = 'top' | 'center' | 'bottom';
6
- export type ModalProperties = {
6
+ export type ModalProperties = ModalEventProperties & {
7
7
  size?: ModalSize;
8
8
  align?: ModalAlign;
9
9
  showOverlay?: boolean;
@@ -26,6 +26,8 @@ export type ModalProperties = {
26
26
  testId?: string;
27
27
  content?: Snippet;
28
28
  footerSnippet?: Snippet;
29
+ };
30
+ export type ModalEventProperties = {
29
31
  onclose?: () => void;
30
32
  onheaderRightImageClick?: (event: MouseEvent) => void;
31
33
  onheaderLeftImageClick?: (event: MouseEvent) => void;
@@ -1,6 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { ImgProperties } from '../Img/properties';
3
- export type SelectProperties = {
3
+ export type SelectProperties = SelectEventProperties & {
4
4
  dropDownIconAlt?: string;
5
5
  placeholder?: string | null;
6
6
  label?: string | null;
@@ -20,6 +20,8 @@ export type SelectProperties = {
20
20
  itemTestId?: string;
21
21
  leftContent?: Snippet;
22
22
  bottomContent?: Snippet;
23
+ };
24
+ export type SelectEventProperties = {
23
25
  onselect?: (event: {
24
26
  selectedItems: string | string[];
25
27
  }) => void;
@@ -1,8 +1,10 @@
1
1
  import type { ButtonProperties } from '../Button/properties';
2
- export type StatusProperties = {
2
+ export type StatusProperties = StatusEventProperties & {
3
3
  statusIcon: string;
4
4
  statusText: string;
5
5
  statusDescription: string;
6
6
  buttonProperties?: ButtonProperties;
7
+ };
8
+ export type StatusEventProperties = {
7
9
  onbuttonClick?: () => void;
8
10
  };
@@ -9,10 +9,14 @@ export type Step = {
9
9
  label: string;
10
10
  icon?: string;
11
11
  };
12
- export type StepProperties = {
12
+ export type StepProperties = OptionalStepProperties & StepEventProperties & {
13
13
  stepIndex: number;
14
14
  label: string;
15
+ };
16
+ export type OptionalStepProperties = {
15
17
  icon?: string;
18
+ };
19
+ export type StepEventProperties = {
16
20
  onclick?: (event: {
17
21
  selectedIndex: number;
18
22
  }) => void;
@@ -46,7 +46,7 @@
46
46
  */
47
47
  function getAnimationConfig(
48
48
  overlapPage: boolean,
49
- toastDirection?: ToastDirection,
49
+ toastDirection?: ToastDirection
50
50
  ): FlyAnimationConfig {
51
51
  // Initializing variables to store animation offsets
52
52
  let inX: number = 0;
@@ -172,7 +172,9 @@
172
172
  top: var(--toast-top, 10px);
173
173
  left: var(--toast-left, 0);
174
174
  right: var(--toast-right, 0);
175
- background-color: var(--default-background-color, #87ceeb);
175
+ background-color: var(--toast-background-color, #87ceeb);
176
+ opacity: var(--toast-opacity, 1);
177
+ box-sizing: var(--toast-box-sizing);
176
178
  }
177
179
 
178
180
  .no-page-overlap {
@@ -180,14 +182,17 @@
180
182
  }
181
183
 
182
184
  .toast-icon-wrapper {
185
+ display: flex;
183
186
  width: var(--toast-icon-wrapper-width, 20px);
184
187
  height: var(--toast-icon-wrapper-height, 20px);
185
188
  margin: var(--toast-icon-margin, 0px 6px 0px 0px);
186
189
  padding: var(--toast-icon-wrapper-padding, 1px);
190
+ align-items: center;
187
191
  }
188
192
 
189
193
  .toast-icon {
190
194
  height: var(--toast-icon-height, 100%);
195
+ filter: var(--toast-icon-filter);
191
196
  border-radius: var(--toast-icon-border-radius, 50%);
192
197
  }
193
198
 
@@ -219,25 +224,25 @@
219
224
 
220
225
  .success {
221
226
  color: var(--toast-success-text, #fff);
222
- background-color: var(--toast-background-color, #24aa5a);
227
+ background-color: var(--toast-success-background-color, var(--toast-background-color, #24aa5a));
223
228
  --toast-border: var(--toast-success-border);
224
229
  }
225
230
 
226
231
  .info {
227
232
  color: var(--toast-info-text, #fff);
228
- background-color: var(--toast-background-color, #87ceeb);
233
+ background-color: var(--toast-info-background-color, var(--toast-background-color, #87ceeb));
229
234
  --toast-border: var(--toast-info-border);
230
235
  }
231
236
 
232
237
  .warn {
233
238
  color: var(--toast-warn-text, #fff);
234
- background-color: var(--toast-background-color, #f3a42d);
239
+ background-color: var(--toast-warn-background-color, var(--toast-background-color, #f3a42d));
235
240
  --toast-border: var(--toast-warn-border);
236
241
  }
237
242
 
238
243
  .error {
239
244
  color: var(--toast-error-text, #fff);
240
- background-color: var(--toast-background-color, #f04438);
245
+ background-color: var(--toast-error-background-color, var(--toast-background-color, #f04438));
241
246
  --toast-border: var(--toast-error-border);
242
247
  }
243
248
  </style>
@@ -1,7 +1,7 @@
1
- import type { Snippet } from "svelte";
1
+ import type { Snippet } from 'svelte';
2
2
  export type ToastType = 'success' | 'error' | 'info' | 'warn';
3
3
  export type ToastDirection = 'left-to-right' | 'right-to-left' | 'top-to-bottom' | 'bottom-to-top';
4
- export type ToastProperties = {
4
+ export type ToastProperties = ToastEventProperties & {
5
5
  duration?: number;
6
6
  leftIcon?: string | null;
7
7
  message: string;
@@ -19,5 +19,7 @@ export type ToastProperties = {
19
19
  subTextTestId?: string;
20
20
  closeIconTestId?: string;
21
21
  bottomContent?: Snippet;
22
+ };
23
+ export type ToastEventProperties = {
22
24
  onToastHide?: () => void;
23
25
  };
@@ -1,5 +1,7 @@
1
- export type ToggleProperties = {
1
+ export type ToggleProperties = ToggleEventProperties & {
2
2
  checked?: boolean;
3
3
  text: string;
4
+ };
5
+ export type ToggleEventProperties = {
4
6
  onclick?: (checked: boolean) => void;
5
7
  };
@@ -1,5 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
- export type ToolbarProperties = {
2
+ export type ToolbarProperties = ToolbarEventProperties & {
3
3
  showBackButton?: boolean;
4
4
  text?: string | null;
5
5
  backIcon?: string | null;
@@ -7,6 +7,8 @@ export type ToolbarProperties = {
7
7
  centerContent?: Snippet;
8
8
  rightContent?: Snippet;
9
9
  additionalContent?: Snippet;
10
+ };
11
+ export type ToolbarEventProperties = {
10
12
  onbackClick?: () => void;
11
13
  onkeydown?: (event: KeyboardEvent) => void;
12
14
  };
package/dist/index.d.ts CHANGED
@@ -23,26 +23,24 @@ export { default as Step } from './Stepper/Step.svelte';
23
23
  export { default as Toast } from './Toast/Toast.svelte';
24
24
  export { default as GridItem } from './GridItem/GridItem.svelte';
25
25
  export { default as IconStack } from './IconStack/IconStack.svelte';
26
- export type { ButtonProperties } from './Button/properties';
27
- export type { ModalProperties, ModalAlign, ModalSize } from './Modal/properties';
28
- export type { InputProperties, OptionalInputProps } from './Input/properties';
29
- export type { InputButtonProperties, OptionalInputButtonProperties } from './InputButton/properties';
30
- export type { ListItemProperties } from './ListItem/properties';
31
- export type { InputDataType } from './types';
32
- export type { AutoCompleteType } from './types';
33
- export type { CustomValidator } from './types';
34
- export type { ValidationState } from './types';
35
- export type { FlyAnimationConfig } from './types';
36
- export type { IconProperties } from './Icon/properties';
37
- export type { BrandLoaderProperties } from './BrandLoader/properties';
38
- export type { StatusProperties } from './Status/properties';
39
- export type { SelectProperties } from './Select/properties';
40
- export type { ToolbarProperties } from './Toolbar/properties';
41
- export type { CarouselProperties } from './Carousel/properties';
42
- export type { BadgeProperties } from './Badge/properties';
43
- export type { BannerProperties } from './Banner/properties';
44
- export type { TableProperties } from './Table/properties';
45
- export type { StepperProperties } from './Stepper/properties';
46
- export type { ToastProperties } from './Toast/properties';
47
- export type { IconStackProperties } from './IconStack/properties';
26
+ export { default as Img } from './Img/Img.svelte';
27
+ export type * from './Button/properties';
28
+ export type * from './Modal/properties';
29
+ export type * from './Input/properties';
30
+ export type * from './InputButton/properties';
31
+ export type * from './ListItem/properties';
32
+ export type * from './types';
33
+ export type * from './Icon/properties';
34
+ export type * from './BrandLoader/properties';
35
+ export type * from './Status/properties';
36
+ export type * from './Select/properties';
37
+ export type * from './Toolbar/properties';
38
+ export type * from './Carousel/properties';
39
+ export type * from './Badge/properties';
40
+ export type * from './Banner/properties';
41
+ export type * from './Table/properties';
42
+ export type * from './Stepper/properties';
43
+ export type * from './Toast/properties';
44
+ export type * from './IconStack/properties';
45
+ export type * from './Img/properties';
48
46
  export { validateInput } from './utils';
package/dist/index.js CHANGED
@@ -23,4 +23,5 @@ export { default as Step } from './Stepper/Step.svelte';
23
23
  export { default as Toast } from './Toast/Toast.svelte';
24
24
  export { default as GridItem } from './GridItem/GridItem.svelte';
25
25
  export { default as IconStack } from './IconStack/IconStack.svelte';
26
+ export { default as Img } from './Img/Img.svelte';
26
27
  export { validateInput } from './utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "2.2.3",
3
+ "version": "2.7.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev --host",
6
6
  "build": "vite build && npm run package",