@softwareone/spi-sv5-library 1.7.8 → 1.7.10

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.
@@ -70,8 +70,9 @@
70
70
  display: flex;
71
71
  flex-direction: column;
72
72
  gap: 16px;
73
+ width: 100%;
73
74
  }
74
-
75
+
75
76
  p {
76
77
  margin: 0;
77
78
  user-select: none;
@@ -40,10 +40,10 @@
40
40
  const componentId = $props.id();
41
41
  const inputId = id || componentId;
42
42
 
43
- const isInvalid = $derived(!!error);
44
- const isValid = $derived(!isInvalid && (!!value || optional));
43
+ const isInvalid = $derived(!!error && !disabled);
44
+ const isValid = $derived(!isInvalid && (!!value || optional) && !disabled);
45
45
  const hasStatus = $derived(isInvalid || isValid);
46
- const showIcon = $derived(hasStatus || ['password', 'money'].includes(type));
46
+ const showIcon = $derived((hasStatus || ['password', 'money'].includes(type)) && !disabled);
47
47
  const showDatePicker = $derived(type === 'date');
48
48
 
49
49
  const transformationType = $derived<Record<string, string>>({
@@ -176,9 +176,9 @@
176
176
  }
177
177
 
178
178
  .form-input-disabled {
179
- background-color: #f3f4f6;
180
- border-color: #d1d5db;
181
- color: #6b7180;
179
+ background-color: #e0e5e8;
180
+ border-color: #6b7180;
181
+ color: #000;
182
182
  cursor: not-allowed;
183
183
  }
184
184
 
@@ -18,6 +18,7 @@
18
18
  multiple?: boolean;
19
19
  keepOpen?: boolean;
20
20
  disabled?: boolean;
21
+ readonly?: boolean;
21
22
  disableValidationColor?: boolean;
22
23
  value?: string | string[] | null;
23
24
  error?: string | string[];
@@ -40,6 +41,7 @@
40
41
  multiple = false,
41
42
  keepOpen = false,
42
43
  disabled = false,
44
+ readonly = false,
43
45
  disableValidationColor = false,
44
46
  value = $bindable(),
45
47
  error,
@@ -208,15 +210,20 @@
208
210
  {/if}
209
211
 
210
212
  <div
211
- class={['dropdown', disabled ? 'disabled' : [isInvalid && 'invalid', isValid && 'valid']]}
213
+ class={[
214
+ 'dropdown',
215
+ disabled && 'disabled',
216
+ readonly && 'readonly',
217
+ !disabled && [isInvalid && 'invalid', isValid && 'valid']
218
+ ]}
212
219
  bind:this={dropdown}
213
220
  >
214
221
  <section
215
222
  role="button"
216
223
  tabindex="0"
217
224
  class="dropdown-container"
218
- onclick={onToggleListOptions}
219
- onkeypress={onToggleListOptions}
225
+ onclick={readonly ? undefined : onToggleListOptions}
226
+ onkeypress={readonly ? undefined : onToggleListOptions}
220
227
  bind:this={dropdownContainer}
221
228
  >
222
229
  <div class="dropdown-container-selected-options">
@@ -240,12 +247,12 @@
240
247
  {/if}
241
248
  </div>
242
249
 
243
- {#if !hideClearButton && (selectedOption || selectedOptions.length)}
250
+ {#if !hideClearButton && !disabled && !readonly && (selectedOption || selectedOptions.length)}
244
251
  {@render removeButton(onClearAll)}
245
252
  {/if}
246
253
  </section>
247
254
 
248
- {#if showListOptions}
255
+ {#if showListOptions && !readonly}
249
256
  <section
250
257
  class={[
251
258
  'dropdown-list',
@@ -339,12 +346,14 @@
339
346
  --white: #fff;
340
347
  --black: #000;
341
348
  --error: #dc2626;
342
- --success: #10b981;
349
+ --success: #008556;
343
350
  --info-1: #eaecff;
344
351
  --gray-1: #f4f6f8;
345
352
  --gray-2: #e0e5e8;
346
353
  --gray-3: #aeb1b9;
347
354
  --gray-4: #6b7180;
355
+ --readonly-bg: #f9fafb;
356
+ --readonly-border: #d1d5db;
348
357
  --border: 1px solid var(--gray-4);
349
358
 
350
359
  display: flex;
@@ -384,11 +393,21 @@
384
393
  }
385
394
  }
386
395
 
387
- .dropdown:not(.disabled, .invalid, .valid):hover {
396
+ .dropdown.readonly {
397
+ cursor: default;
398
+
399
+ > .dropdown-container {
400
+ cursor: default;
401
+ background: var(--readonly-bg);
402
+ border-color: var(--readonly-border);
403
+ }
404
+ }
405
+
406
+ .dropdown:not(.disabled, .readonly, .invalid, .valid):hover {
388
407
  border: 1px solid var(--primary-color);
389
408
  }
390
409
 
391
- .dropdown:not(.disabled, .invalid, .valid):focus-within {
410
+ .dropdown:not(.disabled, .readonly, .invalid, .valid):focus-within {
392
411
  border: 1px solid var(--primary-color);
393
412
  box-shadow: 0 0 0 3px rgba(149, 155, 255, 0.3);
394
413
  }
@@ -410,6 +429,8 @@
410
429
  }
411
430
 
412
431
  .dropdown > .dropdown-container {
432
+ font-size: 14px;
433
+ line-height: 20px;
413
434
  display: grid;
414
435
  grid-template-columns: 1fr auto;
415
436
  min-height: 36px;
@@ -12,6 +12,7 @@ interface SelectProps {
12
12
  multiple?: boolean;
13
13
  keepOpen?: boolean;
14
14
  disabled?: boolean;
15
+ readonly?: boolean;
15
16
  disableValidationColor?: boolean;
16
17
  value?: string | string[] | null;
17
18
  error?: string | string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwareone/spi-sv5-library",
3
- "version": "1.7.8",
3
+ "version": "1.7.10",
4
4
  "description": "Svelte components",
5
5
  "keywords": [
6
6
  "svelte",