@softwareone/spi-sv5-library 1.7.8 → 1.7.9

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;
@@ -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',
@@ -384,11 +391,21 @@
384
391
  }
385
392
  }
386
393
 
387
- .dropdown:not(.disabled, .invalid, .valid):hover {
394
+ .dropdown.readonly {
395
+ cursor: default;
396
+
397
+ > .dropdown-container {
398
+ cursor: default;
399
+ background: #f9fafb;
400
+ border-color: #d1d5db;
401
+ }
402
+ }
403
+
404
+ .dropdown:not(.disabled, .readonly, .invalid, .valid):hover {
388
405
  border: 1px solid var(--primary-color);
389
406
  }
390
407
 
391
- .dropdown:not(.disabled, .invalid, .valid):focus-within {
408
+ .dropdown:not(.disabled, .readonly, .invalid, .valid):focus-within {
392
409
  border: 1px solid var(--primary-color);
393
410
  box-shadow: 0 0 0 3px rgba(149, 155, 255, 0.3);
394
411
  }
@@ -410,6 +427,8 @@
410
427
  }
411
428
 
412
429
  .dropdown > .dropdown-container {
430
+ font-size: 14px;
431
+ line-height: 20px;
413
432
  display: grid;
414
433
  grid-template-columns: 1fr auto;
415
434
  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.9",
4
4
  "description": "Svelte components",
5
5
  "keywords": [
6
6
  "svelte",