@juspay/svelte-ui-components 1.4.0 → 1.6.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.
@@ -39,7 +39,8 @@
39
39
  border-radius: var(--badge-img-border-radius, 6px);
40
40
  width: var(--badge-img-width, 64px);
41
41
  height: var(--badge-img-height, 64px);
42
- object-fit: contain;
42
+ object-fit: var(--badge-object-fit, contain);
43
43
  box-shadow: var(--badge-img-icon-shadow, 0 0 0 0.5px #798fa54d);
44
+ background-color: var(--badge-img-background-color);
44
45
  }
45
46
  </style>
@@ -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 {
@@ -12,10 +12,14 @@ function handleCheckboxClick(e) {
12
12
 
13
13
  <div class="container">
14
14
  <input type="checkbox" class="checkbox" bind:checked on:click={handleCheckboxClick} />
15
- <span class="text">
16
- <!-- eslint-disable-next-line -->
17
- {@html text}
18
- </span>
15
+ {#if $$slots.checkboxLabel}
16
+ <slot name="checkboxLabel" />
17
+ {:else}
18
+ <span class="text">
19
+ <!-- eslint-disable-next-line -->
20
+ {@html text}
21
+ </span>
22
+ {/if}
19
23
  </div>
20
24
 
21
25
  <style>
@@ -36,5 +40,9 @@ function handleCheckboxClick(e) {
36
40
  border: 5px solid red;
37
41
  height: var(--checkbox-height, 24px);
38
42
  width: var(--checkbox-width, 24px);
43
+ margin: var(--checkbox-margin);
44
+ padding: var(--checkbox-padding);
45
+ border-radius: var(--checkbox-border-radius);
46
+ visibility: var(--checkbox-visibility);
39
47
  }
40
48
  </style>
@@ -9,7 +9,9 @@ declare const __propDef: {
9
9
  } & {
10
10
  [evt: string]: CustomEvent<any>;
11
11
  };
12
- slots: {};
12
+ slots: {
13
+ checkboxLabel: {};
14
+ };
13
15
  };
14
16
  export type CheckListItemProps = typeof __propDef.props;
15
17
  export type CheckListItemEvents = typeof __propDef.events;
@@ -0,0 +1,5 @@
1
+ export type ImgProps = {
2
+ src: string;
3
+ alt: string;
4
+ fallback: string | null;
5
+ };
@@ -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
- <img
131
- src="https://sdk.breeze.in/gallery/icons/right-arrow.svg"
132
- alt=""
133
- class="arrow {isSelectOpen ? 'active' : ''}"
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.25turn);
212
+ transform: rotate(0.5turn);
199
213
  }
200
214
 
201
215
  .item {
@@ -227,15 +241,17 @@ 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: 4px 4px 4px 4px;
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);
239
255
  }
240
256
 
241
257
  ::-webkit-scrollbar {
@@ -249,7 +265,7 @@ onDestroy(() => {
249
265
  }
250
266
 
251
267
  .item-selected::after {
252
- content: '✔';
268
+ content: var(--selected-option-icon, '✔');
253
269
  position: absolute;
254
270
  right: 7px;
255
271
  }
@@ -268,4 +284,19 @@ onDestroy(() => {
268
284
  white-space: var(--multipleSelect-btn-white-space, nowrap);
269
285
  padding: var(--multipleSelect-btn-padding, 2px);
270
286
  }
287
+
288
+ .icon-container {
289
+ width: var(--select-icon-container-width, fit-content);
290
+ height: var(--select-icon-container-height, fit-content);
291
+ border-radius: var(--select-icon-container-border-radius);
292
+ opacity: var(--select-icon-container-opacity);
293
+ background: var(--select-icon-container-background);
294
+ display: flex;
295
+ align-items: center;
296
+ justify-content: center;
297
+ margin: var(--select-icon-container-margin, 0px 8px 0px 0px);
298
+ padding: var(--select-icon-container-padding);
299
+ --image-height: var(--select-icon-height);
300
+ --image-width: var(--select-icon-height);
301
+ }
271
302
  </style>
@@ -2,6 +2,7 @@ import { SvelteComponent } from "svelte";
2
2
  import type { SelectProperties } from './properties';
3
3
  declare const __propDef: {
4
4
  props: {
5
+ dropDownIconAlt?: string | undefined;
5
6
  properties?: SelectProperties | undefined;
6
7
  };
7
8
  events: {
@@ -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,73 @@
1
+ <script>import { createEventDispatcher } from "svelte";
2
+ export let stepIndex;
3
+ export let label;
4
+ export let icon;
5
+ const dispatch = createEventDispatcher();
6
+ function handleStepClick() {
7
+ dispatch("handleStepClick", { selectedIndex: stepIndex });
8
+ }
9
+ </script>
10
+
11
+ <div class="step" on:click={handleStepClick} role="button" tabindex="0" on:keydown>
12
+ {#if icon !== null}
13
+ <div class="step-icon-container">
14
+ <img class="step-icon" src={icon} alt="" />
15
+ </div>
16
+ {:else}
17
+ <div class="step-index-container">
18
+ <div class={'step-index-text'}>
19
+ {stepIndex}
20
+ </div>
21
+ </div>
22
+ {/if}
23
+ <div class={'step-text'}>
24
+ {label}
25
+ </div>
26
+ <div class={'separator'} />
27
+ </div>
28
+
29
+ <style>
30
+ .step {
31
+ display: flex;
32
+ flex-direction: var(--step-flex-direction, row);
33
+ align-items: center;
34
+ }
35
+
36
+ .step-index-container {
37
+ display: flex;
38
+ justify-content: center;
39
+ align-items: center;
40
+ height: var(--step-index-container-height, 30px);
41
+ width: var(--step-index-container-width, 30px);
42
+ border-radius: var(--step-index-container-radius, 50%);
43
+ background-color: var(--step-index-container-background-color, #798fa5cc);
44
+ }
45
+
46
+ .separator {
47
+ display: var(--separator-display, block);
48
+ height: var(--separator-height, 1px);
49
+ width: var(--separator-width, 50px);
50
+ margin: var(--separator-margin, 0px 12px 0px 12px);
51
+ background-image: var(
52
+ --separator-background-image,
53
+ repeating-linear-gradient(
54
+ to right,
55
+ var(--separator-background-image-color, #798fa5cc),
56
+ var(--separator-background-image-color, #798fa5cc) 6px,
57
+ transparent 6px,
58
+ transparent 10px
59
+ )
60
+ );
61
+ }
62
+
63
+ .step-text {
64
+ margin: var(--step-text-margin, 0px 0px 0px 12px);
65
+ font-size: var(--step-text-font-size, 12px);
66
+ color: var(--step-text-color, #798fa5cc);
67
+ }
68
+
69
+ .step-index-text {
70
+ font-size: var(--step-index-font-size, 14px);
71
+ color: var(--step-index-color, white);
72
+ }
73
+ </style>
@@ -0,0 +1,21 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ stepIndex: number;
5
+ label: string;
6
+ icon: string | null;
7
+ };
8
+ events: {
9
+ keydown: KeyboardEvent;
10
+ handleStepClick: CustomEvent<any>;
11
+ } & {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {};
15
+ };
16
+ export type StepProps = typeof __propDef.props;
17
+ export type StepEvents = typeof __propDef.events;
18
+ export type StepSlots = typeof __propDef.slots;
19
+ export default class Step extends SvelteComponent<StepProps, StepEvents, StepSlots> {
20
+ }
21
+ export {};
@@ -0,0 +1,55 @@
1
+ <script>import Step from "./Step.svelte";
2
+ export let properties;
3
+ </script>
4
+
5
+ <div class="container">
6
+ {#each properties.steps as currentStep, stepIndex}
7
+ <div
8
+ class:active-step={properties.currentStepIndex === stepIndex}
9
+ class:completed-step={properties.currentStepIndex > stepIndex}
10
+ class="step-container"
11
+ >
12
+ <Step
13
+ on:handleStepClick
14
+ label={currentStep.label}
15
+ icon={currentStep.icon ?? null}
16
+ stepIndex={stepIndex + 1}
17
+ />
18
+ </div>
19
+ {/each}
20
+ </div>
21
+
22
+ <style>
23
+ .container {
24
+ display: flex;
25
+ flex-direction: var(--container-flex-direction, row);
26
+ align-items: center;
27
+ }
28
+
29
+ .step-container:last-child {
30
+ --separator-display: none;
31
+ }
32
+
33
+ .step-container {
34
+ display: flex;
35
+ align-items: center;
36
+ }
37
+
38
+ .active-step {
39
+ --step-text-color: var(--step-text-active-color, #2f3841);
40
+ --separator-background-image-color: var(--separator-background-image-active-color, #2f3841);
41
+ --step-index-container-background-color: var(
42
+ --step-index-container-active-background-color,
43
+ #2f3841
44
+ );
45
+ }
46
+
47
+ .completed-step {
48
+ --step-text-color: var(--step-text-completed-color, #24aa5a);
49
+ --separator-background-image-color: var(--separator-background-image-completed-color, #24aa5a);
50
+ --step-index-container-background-color: var(
51
+ --step-index-container-completed-background-color,
52
+ #24aa5a
53
+ );
54
+ }
55
+ </style>
@@ -0,0 +1,19 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { StepperProperties } from './properties';
3
+ declare const __propDef: {
4
+ props: {
5
+ properties: StepperProperties;
6
+ };
7
+ events: {
8
+ handleStepClick: CustomEvent<any>;
9
+ } & {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {};
13
+ };
14
+ export type StepperProps = typeof __propDef.props;
15
+ export type StepperEvents = typeof __propDef.events;
16
+ export type StepperSlots = typeof __propDef.slots;
17
+ export default class Stepper extends SvelteComponent<StepperProps, StepperEvents, StepperSlots> {
18
+ }
19
+ export {};
@@ -0,0 +1,8 @@
1
+ export type StepperProperties = {
2
+ steps: Array<Step>;
3
+ currentStepIndex: number;
4
+ };
5
+ export type Step = {
6
+ label: string;
7
+ icon?: string;
8
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -18,6 +18,8 @@ export { default as Toggle } from './Toggle/Toggle.svelte';
18
18
  export { default as Accordion } from './Accordion/Accordion.svelte';
19
19
  export { default as CheckListItem } from './CheckListItem/CheckListItem.svelte';
20
20
  export { default as Table } from './Table/Table.svelte';
21
+ export { default as Stepper } from './Stepper/Stepper.svelte';
22
+ export { default as Step } from './Stepper/Step.svelte';
21
23
  export type { ButtonProperties } from './Button/properties';
22
24
  export type { ModalProperties, ModalAlign, ModalSize } from './Modal/properties';
23
25
  export type { InputProperties } from './Input/properties';
@@ -36,6 +38,7 @@ export type { CarouselProperties } from './Carousel/properties';
36
38
  export type { BadgeProperties } from './Badge/properties';
37
39
  export type { BannerProperties } from './Banner/properties';
38
40
  export type { TableProperties } from './Table/properties';
41
+ export type { StepperProperties } from './Stepper/properties';
39
42
  export { defaultIconProperties } from './Icon/properties';
40
43
  export { defaultButtonProperties } from './Button/properties';
41
44
  export { defaultModalProperties } from './Modal/properties';
package/dist/index.js CHANGED
@@ -18,6 +18,8 @@ export { default as Toggle } from './Toggle/Toggle.svelte';
18
18
  export { default as Accordion } from './Accordion/Accordion.svelte';
19
19
  export { default as CheckListItem } from './CheckListItem/CheckListItem.svelte';
20
20
  export { default as Table } from './Table/Table.svelte';
21
+ export { default as Stepper } from './Stepper/Stepper.svelte';
22
+ export { default as Step } from './Stepper/Step.svelte';
21
23
  export { defaultIconProperties } from './Icon/properties';
22
24
  export { defaultButtonProperties } from './Button/properties';
23
25
  export { defaultModalProperties } from './Modal/properties';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "1.4.0",
3
+ "version": "1.6.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.2",
57
+ "vite": "^4.5.3",
58
58
  "vitest": "^0.34.6",
59
59
  "type-decoder": "^1.2.0"
60
60
  },