@juspay/svelte-ui-components 1.9.0 → 1.10.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.
@@ -27,13 +27,13 @@ function handleButtonClick() {
27
27
  disabled={!(properties.enable && !properties.showLoader)}
28
28
  type={properties.type}
29
29
  >
30
- {#if properties.showLoader && properties.loaderType === 'Circular'}
31
- <Loader />
30
+ {#if properties.showLoader && properties.loaderType === 'Circular'}
31
+ <div class="button-loader"><Loader /></div>
32
+ {/if}
33
+ {#if $$slots.icon}
34
+ <div class="button-icon"><slot name="icon" /></div>
32
35
  {/if}
33
- {#if $$slots.icon}
34
- <slot name="icon" />
35
- {/if}
36
- {properties.text}
36
+ <div class="button-text">{properties.text}</div>
37
37
  </button>
38
38
  </div>
39
39
 
@@ -61,11 +61,23 @@ function handleButtonClick() {
61
61
  display: flex;
62
62
  justify-content: var(--button-justify-content, center);
63
63
  align-items: center;
64
- flex-direction: row;
64
+ flex-direction: var(--button-content-flex-direction, row);;
65
65
  gap: var(--button-content-gap, 16px);
66
66
  visibility: var(--button-visibility, visible);
67
67
  }
68
68
 
69
+ .button-loader {
70
+ order: var(--button-loader-order, 1);
71
+ }
72
+
73
+ .button-icon {
74
+ order: var(--button-icon-order, 2);
75
+ }
76
+
77
+ .button-text {
78
+ order: var(--button-text-order, 3);
79
+ }
80
+
69
81
  button:hover {
70
82
  background: var(--button-hover-color, var(--button-color, #3a4550));
71
83
  color: var(--button-hover-text-color, var(--button-text-color, white));
@@ -69,7 +69,7 @@ function onFocusOut(event) {
69
69
  />
70
70
  </div>
71
71
  {#if properties.rightButtonProperties != null}
72
- <div class="button">
72
+ <div class="right-button">
73
73
  <Button properties={properties.rightButtonProperties} on:click={rightButtonClick} />
74
74
  </div>
75
75
  {/if}
@@ -119,12 +119,6 @@ function onFocusOut(event) {
119
119
  min-width: 0px;
120
120
  }
121
121
 
122
- .button {
123
- flex: 1;
124
- min-width: 0px;
125
- --button-height: 54px;
126
- }
127
-
128
122
  .bottom-button {
129
123
  padding: var(--input-bottom-btn-padding, 10px 0px);
130
124
  --cursor: var(--bottom-button-cursor);
@@ -182,5 +176,30 @@ function onFocusOut(event) {
182
176
  align-items: center;
183
177
  flex-direction: row;
184
178
  --button-content-gap: var(--left-button-content-gap);
179
+ --button-content-flex-direction: var(--left-button-content-flex-direction, row);
180
+ }
181
+
182
+ .right-button {
183
+ flex: var(--right-button-flex, 1);
184
+ display: flex;
185
+ justify-content: center;
186
+ align-items: center;
187
+ flex-direction: row;
188
+ min-width: var(--right-button-min-width, 0px);
189
+ --button-color: var(--right-button-color);
190
+ --button-text-color: var(--right-button-text-color);
191
+ --button-font-family: var(--right-button-font-family);
192
+ --button-font-weight: var(--right-button-font-weight);
193
+ --button-font-size: var(--right-button-font-size);
194
+ --button-height: var(--right-button-height, 54px);
195
+ --button-padding: var(--right-button-padding);
196
+ --button-border-radius: var(--right-button-border-radius);
197
+ --button-width: var(--right-button-width, 100%);
198
+ --cursor: var(--right-button-cursor);
199
+ --opacity: var(--right-button-opacity);
200
+ --button-border: var(--right-button-border);
201
+ --button-content-gap: var(--right-button-content-gap);
202
+ --button-visibility: var(--right-button-visibility, visible);
203
+ --button-content-flex-direction: var(--right-button-content-flex-direction, row);
185
204
  }
186
205
  </style>
@@ -11,7 +11,8 @@ export let properties = {
11
11
  selectedItemLabel: null,
12
12
  showSelectedItemInDropdown: false,
13
13
  selectMultipleItems: false,
14
- leftIcon: null
14
+ leftIcon: null,
15
+ showSelectedItem: true
15
16
  };
16
17
  const dropDownIcon = properties.dropDownIcon ?? "https://sdk.breeze.in/gallery/icons/down-arrow.svg";
17
18
  let applyButtonProps;
@@ -135,17 +136,21 @@ onDestroy(() => {
135
136
  {#if properties.selectMultipleItems && Array.isArray(properties.selectedItemLabel) && Array.isArray(properties.selectedItem)}
136
137
  {#if properties.selectedItem.length === 0}
137
138
  {properties.placeholder}
138
- {:else if properties.selectedItemLabel?.length === 0 || properties.showSelectedItemInDropdown}
139
+ {:else if properties.selectedItemLabel?.length === 0 || properties.showSelectedItemInDropdown && properties.showSelectedItem !== false}
139
140
  {properties.selectedItem.join(', ')}
140
- {:else}
141
+ {:else if properties.showSelectedItem !== false}
141
142
  {properties.selectedItemLabel.join(', ')}
143
+ {:else}
144
+ {properties.placeholder}
142
145
  {/if}
143
146
  {:else if properties.selectedItem === ''}
144
147
  {properties.placeholder}
145
- {:else if properties.selectedItemLabel === null || properties.selectedItemLabel === ''}
148
+ {:else if properties.selectedItemLabel === null || properties.selectedItemLabel === '' && properties.showSelectedItem !== false}
146
149
  {properties.selectedItem}
147
- {:else}
150
+ {:else if properties.showSelectedItem !== false}
148
151
  {properties.selectedItemLabel}
152
+ {:else}
153
+ {properties.placeholder}
149
154
  {/if}
150
155
  </div>
151
156
  <div class="filler" />
@@ -11,4 +11,5 @@ export type SelectProperties = {
11
11
  dropDownIcon?: string;
12
12
  leftIcon: ImgProps | null;
13
13
  showSingleSelectButton?: boolean | null;
14
+ showSelectedItem?: boolean;
14
15
  };
@@ -12,9 +12,9 @@ export let toggleText = "";
12
12
 
13
13
  <style>
14
14
  .toggle-container {
15
- display: flex;
15
+ display: var(--toggle-container-display, flex);
16
16
  align-items: center;
17
- gap: 8px;
17
+ gap: var(--toggle-containter-gap, 8px);
18
18
  }
19
19
 
20
20
  .toggle-text {
@@ -27,8 +27,8 @@ export let toggleText = "";
27
27
  .switch {
28
28
  position: relative;
29
29
  display: inline-block;
30
- width: 46px;
31
- height: 25px;
30
+ width: var(--toggle-switch-width, 46px);
31
+ height: var(--toggle-switch-height, 25px);
32
32
  }
33
33
 
34
34
  .switch .input-checkbox {
@@ -40,10 +40,10 @@ export let toggleText = "";
40
40
  .slider {
41
41
  position: absolute;
42
42
  cursor: pointer;
43
- top: 0;
44
- left: 0;
45
- right: 0;
46
- bottom: 0;
43
+ top: var(--toggle-slider-top, 0);
44
+ left: var(--toggle-slider-left, 0);
45
+ right: var(--toggle-slider-right, 0);
46
+ bottom: var(--toggle-slider-bottom, 0);
47
47
  background-color: var(--slider-unchecked-color, #ccc);
48
48
  -webkit-transition: 0.4s;
49
49
  transition: 0.4s;
@@ -52,12 +52,12 @@ export let toggleText = "";
52
52
  .slider:before {
53
53
  position: absolute;
54
54
  content: '';
55
- height: 23px;
56
- width: 23px;
57
- left: 2px;
58
- bottom: 1px;
59
- top: 1px;
60
- background-color: white;
55
+ height: var(--toggle-slider-before-height, 23px);
56
+ width: var(--toggle-slider-before-width, 23px);
57
+ left: var(--toggle-slider-before-left, 2px);
58
+ bottom: var(--toggle-slider-before-bottom, 1px);
59
+ top: var(--toggle-slider-before-top, 1px);
60
+ background-color: var(--toggle-slider-before-background-color, white);
61
61
  -webkit-transition: 0.4s;
62
62
  transition: 0.4s;
63
63
  }
@@ -77,10 +77,10 @@ export let toggleText = "";
77
77
  }
78
78
 
79
79
  .slider.round {
80
- border-radius: 23px;
80
+ border-radius: var(--slider-round-border-radius, 23px);
81
81
  }
82
82
 
83
83
  .slider.round:before {
84
- border-radius: 50%;
84
+ border-radius: var(--slider-round-before-border-radius, 50%);
85
85
  }
86
86
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",