@juspay/svelte-ui-components 2.0.0 → 2.1.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/Input/Input.svelte
CHANGED
|
@@ -141,12 +141,19 @@
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
function _onFocusOut(event: FocusEvent) {
|
|
145
|
+
if (validationState === 'InProgress' && value.length > 0) {
|
|
146
|
+
validationState = 'Invalid';
|
|
147
|
+
}
|
|
148
|
+
onFocusout(event);
|
|
149
|
+
}
|
|
150
|
+
|
|
144
151
|
$effect(() => {
|
|
145
152
|
onStateChange(validationState);
|
|
146
153
|
});
|
|
147
154
|
</script>
|
|
148
155
|
|
|
149
|
-
<div class="input-container">
|
|
156
|
+
<div class="input-container" class:input-error={validationState === 'Invalid' && !actionInput}>
|
|
150
157
|
{#if typeof label === 'string' && label !== '' && !actionInput}
|
|
151
158
|
<label class="label" for={name}>
|
|
152
159
|
{label}
|
|
@@ -160,7 +167,7 @@
|
|
|
160
167
|
{placeholder}
|
|
161
168
|
autocomplete={autoComplete}
|
|
162
169
|
{name}
|
|
163
|
-
onfocusout={
|
|
170
|
+
onfocusout={_onFocusOut}
|
|
164
171
|
oninput={handleOnInput}
|
|
165
172
|
onpaste={handleOnPaste}
|
|
166
173
|
onclick={onClick}
|
|
@@ -178,7 +185,7 @@
|
|
|
178
185
|
{placeholder}
|
|
179
186
|
autocomplete={autoComplete}
|
|
180
187
|
{name}
|
|
181
|
-
onfocusout={
|
|
188
|
+
onfocusout={_onFocusOut}
|
|
182
189
|
oninput={handleOnInput}
|
|
183
190
|
onpaste={onPaste}
|
|
184
191
|
data-pw={testId}
|
|
@@ -219,7 +226,7 @@
|
|
|
219
226
|
appearance: none !important;
|
|
220
227
|
-webkit-appearance: none !important; /* For Safari MWeb */
|
|
221
228
|
box-shadow: var(--input-box-shadow, 0px 1px 8px #2f537733);
|
|
222
|
-
border: var(--input-border,
|
|
229
|
+
border: var(--input-border, 1px solid transparent);
|
|
223
230
|
resize: none;
|
|
224
231
|
visibility: var(--input-visibility, visible);
|
|
225
232
|
text-align: var(--input-text-align, left);
|
|
@@ -228,7 +235,12 @@
|
|
|
228
235
|
|
|
229
236
|
textarea:focus,
|
|
230
237
|
input:focus {
|
|
231
|
-
border: var(--input-focus-border);
|
|
238
|
+
border: var(--input-focus-border, 1px solid transparent);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.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;
|
|
232
244
|
}
|
|
233
245
|
|
|
234
246
|
.action-input {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AutoCompleteType, CustomValidator, InputDataType, TextTransformer, ValidationState } from '../types';
|
|
2
|
-
export type InputProperties = {
|
|
2
|
+
export type InputProperties = OptionalInputProps & {
|
|
3
3
|
value: string;
|
|
4
|
+
};
|
|
5
|
+
export type OptionalInputProps = {
|
|
4
6
|
placeholder?: string | null;
|
|
5
7
|
dataType?: InputDataType;
|
|
6
8
|
label?: string | null;
|
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
}
|
|
50
50
|
</script>
|
|
51
51
|
|
|
52
|
+
|
|
53
|
+
<div class="container">
|
|
52
54
|
{#if inputProperties.label && inputProperties.label !== ''}
|
|
53
55
|
<label class="label" for={inputProperties.name}>
|
|
54
56
|
{inputProperties.label}
|
|
@@ -69,7 +71,7 @@
|
|
|
69
71
|
bind:value
|
|
70
72
|
bind:this={inputRef}
|
|
71
73
|
onStateChange={handleStateChange}
|
|
72
|
-
|
|
74
|
+
actionInput={true}
|
|
73
75
|
/>
|
|
74
76
|
</div>
|
|
75
77
|
{#if rightButtonProperties != null}
|
|
@@ -93,17 +95,27 @@
|
|
|
93
95
|
{inputProperties.onErrorMessage}
|
|
94
96
|
</div>
|
|
95
97
|
{/if}
|
|
96
|
-
{#if
|
|
98
|
+
{#if inputProperties.infoMessage !== ''}
|
|
97
99
|
<div class="info-message">
|
|
98
100
|
{inputProperties.infoMessage}
|
|
99
101
|
</div>
|
|
100
102
|
{/if}
|
|
103
|
+
</div>
|
|
104
|
+
|
|
101
105
|
|
|
102
106
|
<style>
|
|
107
|
+
.container {
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
}
|
|
111
|
+
|
|
103
112
|
.input-button-container {
|
|
104
113
|
--button-width: 100%;
|
|
105
114
|
--input-border: none;
|
|
106
115
|
--input-focus-border: none;
|
|
116
|
+
--input-box-shadow: none;
|
|
117
|
+
--input-margin: none;
|
|
118
|
+
--input-width: auto;
|
|
107
119
|
height: var(--input-height, fit-content);
|
|
108
120
|
font-size: var(--input-font-size, 16px) !important;
|
|
109
121
|
font-weight: 500;
|
|
@@ -205,7 +217,7 @@
|
|
|
205
217
|
--button-font-size: var(--right-button-font-size);
|
|
206
218
|
--button-height: var(--right-button-height, 54px);
|
|
207
219
|
--button-padding: var(--right-button-padding);
|
|
208
|
-
--button-border-radius: var(--right-button-border-radius);
|
|
220
|
+
--button-border-radius: var(--right-button-border-radius, 0px 4px 4px 0px);
|
|
209
221
|
--button-width: var(--right-button-width, 100%);
|
|
210
222
|
--cursor: var(--right-button-cursor);
|
|
211
223
|
--opacity: var(--right-button-opacity);
|
package/dist/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export { default as GridItem } from './GridItem/GridItem.svelte';
|
|
|
25
25
|
export { default as IconStack } from './IconStack/IconStack.svelte';
|
|
26
26
|
export type { ButtonProperties } from './Button/properties';
|
|
27
27
|
export type { ModalProperties, ModalAlign, ModalSize } from './Modal/properties';
|
|
28
|
-
export type { InputProperties } from './Input/properties';
|
|
28
|
+
export type { InputProperties, OptionalInputProps } from './Input/properties';
|
|
29
29
|
export type { InputButtonProperties } from './InputButton/properties';
|
|
30
30
|
export type { ListItemProperties } from './ListItem/properties';
|
|
31
31
|
export type { InputDataType } from './types';
|