@juspay/svelte-ui-components 1.2.0 → 1.3.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.
@@ -0,0 +1,33 @@
1
+ <script>export let src;
2
+ export let alt;
3
+ export let fallback = null;
4
+ function handleFallback() {
5
+ if (fallback !== null) {
6
+ src = fallback;
7
+ }
8
+ }
9
+ </script>
10
+
11
+ {#if typeof src === 'string' && typeof alt === 'string'}
12
+ <img {src} {alt} on:error|once={handleFallback} />
13
+ {/if}
14
+
15
+ <style>
16
+ img {
17
+ object-fit: var(--image-object-fit);
18
+ height: var(--image-height, 24px);
19
+ width: var(--image-width, 24px);
20
+ padding: var(--image-padding, 0px);
21
+ border-radius: var(--image-border-radius, 0px);
22
+ margin: var(--image-margin, 0px);
23
+ filter: var(--image-filter, none);
24
+ background: var(--image-background);
25
+ border: var(--image-border);
26
+ transition: var(--image-transition);
27
+ }
28
+
29
+ img:hover {
30
+ background: var(--image-hover-background, var(--image-background));
31
+ border: var(--image-hover-border, var(--image-border));
32
+ }
33
+ </style>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ src: string;
5
+ alt: string;
6
+ fallback?: string | null | undefined;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ export type ImgProps = typeof __propDef.props;
14
+ export type ImgEvents = typeof __propDef.events;
15
+ export type ImgSlots = typeof __propDef.slots;
16
+ export default class Img extends SvelteComponent<ImgProps, ImgEvents, ImgSlots> {
17
+ }
18
+ export {};
@@ -175,6 +175,7 @@ $: {
175
175
  resize: none;
176
176
  visibility: var(--input-visibility, visible);
177
177
  text-align: var(--input-text-align, left);
178
+ color: var(--input-text-color);
178
179
  }
179
180
 
180
181
  textarea:focus,
@@ -1,5 +1,6 @@
1
1
  <script>import Accordion from "../Accordion/Accordion.svelte";
2
2
  import Loader from "../Loader/Loader.svelte";
3
+ import Img from "../Img/Img.svelte";
3
4
  import { defaultListItemProperties } from "./properties";
4
5
  import { createEventDispatcher } from "svelte";
5
6
  const dispatch = createEventDispatcher();
@@ -55,7 +56,11 @@ function handleTopSectionClick() {
55
56
  role="button"
56
57
  tabindex="0"
57
58
  >
58
- <img class="left-img" src={properties.leftImageUrl} alt="" />
59
+ <Img
60
+ src={properties.leftImageUrl}
61
+ alt=""
62
+ fallback={properties.leftImageFallbackUrl}
63
+ />
59
64
  </div>
60
65
  {/if}
61
66
  {#if $$slots.leftContent}
@@ -171,12 +176,39 @@ function handleTopSectionClick() {
171
176
 
172
177
  .left-content {
173
178
  display: flex;
179
+ --image-height: var(--list-item-left-image-height, 24px);
180
+ --image-width: var(--list-item-left-image-width, 24px);
181
+ --image-padding: var(--list-item-left-image-padding, 0px);
182
+ --image-border-radius: var(--list-item-left-image-border-radius, 0px);
183
+ --image-margin: var(--list-item-left-image-margin, 0px);
184
+ --image-filter: var(--list-item-left-image-filter, none);
185
+ --image-background: var(--list-item-left-image-background);
186
+ --image-border: var(--list-item-left-image-border);
187
+ --image-transition: var(--list-item-transition);
188
+ --image-object-fit: var(--list-item-left-image-object-fit);
189
+ --image-hover-background: var(
190
+ --list-item-left-image-hover-background,
191
+ var(--list-item-left-image-background)
192
+ );
193
+ --image-hover-border: var(
194
+ --list-item-left-image-hover-border,
195
+ var(--list-item-left-image-border)
196
+ );
174
197
  }
175
198
 
176
199
  .center-text {
177
200
  display: flex;
178
201
  flex-direction: column;
202
+ justify-content: var(--list-item-center-text-justify-content, flex-start);
179
203
  padding: var(--list-item-center-text-padding, 0px 20px);
204
+ color: var(--list-item-center-text-color, #2f3841);
205
+ font-size: var(--list-item-center-text-font-size, 12px);
206
+ font-weight: var(--list-item-center-text-font-weight, 300);
207
+ align-items: var(--list-item-center-text-vertical-align);
208
+ margin: var(--list-item-center-text-margin);
209
+ border: var(--list-item-center-text-border);
210
+ cursor: var(--list-item-center-text-cursor, pointer);
211
+ font-family: var(--list-item-center-text-font-family);
180
212
  }
181
213
 
182
214
  .center-content {
@@ -194,23 +226,6 @@ function handleTopSectionClick() {
194
226
  margin-top: 0;
195
227
  }
196
228
 
197
- .left-img {
198
- height: var(--list-item-left-image-height, 24px);
199
- width: var(--list-item-left-image-width, 24px);
200
- padding: var(--list-item-left-image-padding, 0px);
201
- border-radius: var(--list-item-left-image-border-radius, 0px);
202
- margin: var(--list-item-left-image-margin, 0px);
203
- filter: var(--list-item-left-image-filter, none);
204
- background: var(--list-item-left-image-background);
205
- border: var(--list-item-left-image-border);
206
- transition: var(--list-item-transition);
207
- }
208
-
209
- .left-img:hover {
210
- background: var(--list-item-left-image-hover-background, var(--list-item-left-image-background));
211
- border: var(--list-item-left-image-hover-border, var(--list-item-left-image-border));
212
- }
213
-
214
229
  .right-img {
215
230
  height: var(--list-item-right-image-height, 18px);
216
231
  width: var(--list-item-right-image-width, 18px);
@@ -224,7 +239,10 @@ function handleTopSectionClick() {
224
239
  }
225
240
 
226
241
  .right-img:hover {
227
- background: var(--list-item-right-image-hover-background, var(--list-item-right-image-background));
242
+ background: var(
243
+ --list-item-right-image-hover-background,
244
+ var(--list-item-right-image-background)
245
+ );
228
246
  border: var(--list-item-right-image-hover-border, var(--list-item-right-image-border));
229
247
  }
230
248
 
@@ -1,5 +1,6 @@
1
1
  export type ListItemProperties = {
2
2
  leftImageUrl: string | null;
3
+ leftImageFallbackUrl: string | null;
3
4
  rightImageUrl: string | null;
4
5
  label: string | null;
5
6
  useAccordion: boolean;
@@ -1,5 +1,6 @@
1
1
  export const defaultListItemProperties = {
2
2
  leftImageUrl: null,
3
+ leftImageFallbackUrl: null,
3
4
  rightImageUrl: null,
4
5
  label: null,
5
6
  useAccordion: false,
@@ -175,14 +175,15 @@ onDestroy(() => {
175
175
  .header {
176
176
  display: flex;
177
177
  background-color: var(--modal-header-background-color, #f6f7f9);
178
- padding: 18px 20px;
178
+ padding: var(--modal-header-padding, 18px 20px);
179
+ border-radius: var(--modal-header-border-radius, 0px);
179
180
  }
180
181
 
181
182
  .header-text {
182
183
  display: flex;
183
184
  align-items: center;
184
185
  flex: 1;
185
- font-size: 16px;
186
+ font-size: var(--header-text-size, 16px);
186
187
  }
187
188
 
188
189
  .header-left-img,
@@ -192,7 +193,7 @@ onDestroy(() => {
192
193
  }
193
194
 
194
195
  .header-left-img {
195
- margin-right: 18px;
196
+ margin: var(--header-left-image-margin, 0px 18px 0px 0px);
196
197
  width: var(--header-left-image-width, 25px);
197
198
  height: var(--header-left-image-height, 25px);
198
199
  }
@@ -74,10 +74,15 @@ function handleBackClick() {
74
74
  }
75
75
 
76
76
  .back {
77
- height: 20px;
78
- width: 20px;
79
- padding: 20px 14px;
80
- cursor: pointer;
77
+ height: var(--toolbar-back-button-height, 20px);
78
+ width: var(--toolbar-back-button-width, 20px);
79
+ padding: var(--toolbar-back-button-padding, 20px 14px);
80
+ cursor: var(--toolbar-back-button-cursor, pointer);
81
+ }
82
+
83
+ .back img {
84
+ height: var(--toolbar-back-image-height, 16px);
85
+ width: var(--toolbar-back-image-width, 16px);
81
86
  }
82
87
 
83
88
  .center-content {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",