fds-vue-core 2.3.1 → 2.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fds-vue-core",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "FDS Vue Core Component Library",
5
5
  "type": "module",
6
6
  "main": "./dist/fds-vue-core.cjs.js",
@@ -211,10 +211,8 @@ const icons: IconMap = {
211
211
  </g>
212
212
  </svg>`,
213
213
  edit: () => `
214
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
215
- <g fill-rule="nonzero">
216
- <path d="M2.626 21.997c-.167 0-.323-.065-.441-.182-.181-.18-.235-.449-.136-.684l2.55-6.105L4.61 15c.01-.024.03-.06.056-.096l.026-.034c.014-.018.026-.032.04-.045l8.815-8.81c.007-.01.015-.019.022-.026l.037-.033 2.529-2.529c-.248-.116-.518-.176-.798-.176-.501 0-.97.193-1.323.545L11.36 6.45c-.118.118-.275.183-.441.183-.168 0-.325-.065-.443-.184-.243-.243-.243-.64.001-.884l2.655-2.652C13.719 2.324 14.503 2 15.34 2c.632 0 1.25.192 1.767.546.525-.35 1.149-.54 1.782-.54.634 0 1.25.186 1.78.539.69.49 1.143 1.212 1.284 2.036.14.824-.048 1.652-.531 2.332-.1.142-.214.275-.336.398L9.153 19.244c-.01.01-.024.021-.037.031-.052.045-.104.079-.162.103l-6.084 2.57c-.079.033-.16.049-.244.049zm1.167-1.796l3.82-1.614-2.22-2.219-1.6 3.833zm4.918-2.283l7.955-7.955-2.65-2.65-7.956 7.953 2.651 2.652zM17.55 9.08l2.652-2.652c.073-.074.14-.154.2-.238.6-.843.401-2.016-.442-2.615-.313-.208-.685-.32-1.07-.32-.535 0-1.054.222-1.425.61L14.9 6.429l2.65 2.65z" transform="translate(-257 -3428) translate(257 3428)"/>
217
- </g>
214
+ <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
215
+ <path fill-rule="evenodd" d="M0.687694 22C0.506145 22 0.329181 21.9267 0.200813 21.7983C0.0302677 21.6278 -0.0385007 21.3757 0.0210986 21.142L1.64495 14.8121C1.65045 14.792 1.66329 14.7562 1.67246 14.7379C1.67337 14.7342 1.67979 14.7168 1.68804 14.6994C1.7238 14.6224 1.76598 14.5591 1.81733 14.5059C1.81916 14.5023 15.1428 1.18163 15.1428 1.18163C15.902 0.419851 16.9143 0 17.9926 0C19.0654 0 20.074 0.415267 20.8313 1.17063C20.8341 1.17338 20.8442 1.18438 20.8469 1.18622C22.4048 2.77945 22.3809 5.33706 20.7947 6.8872C20.7947 6.8872 7.50769 20.1712 7.50585 20.173C7.44534 20.2326 7.37657 20.2784 7.29405 20.3151C7.28854 20.3169 7.27662 20.3224 7.27112 20.3243C7.24912 20.3353 7.21978 20.3463 7.18952 20.3536L0.858239 21.9771C0.802308 21.9927 0.744542 22 0.687694 22ZM1.6422 20.3573L5.68578 19.3205L2.67831 16.3201L1.6422 20.3573ZM7.02264 18.7127L17.0417 8.69678L13.3072 4.96304L3.28531 14.9826L7.02264 18.7127ZM18.0137 7.72416L18.9608 6.7772L15.2263 3.04346L14.2791 3.99042L18.0137 7.72416ZM19.9318 5.80274C20.8763 4.77145 20.8616 3.16905 19.8759 2.16067C19.8732 2.15792 19.8631 2.14784 19.8603 2.14509C19.3615 1.64824 18.6977 1.37506 17.9917 1.37506C17.3205 1.37506 16.6887 1.62165 16.1991 2.07175L19.9318 5.80274Z" />
218
216
  </svg>`,
219
217
  email: () => `
220
218
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
@@ -75,7 +75,7 @@ defineSlots<{
75
75
  <div
76
76
  v-if="label"
77
77
  class="font-bold w-full justify-between items-start flex gap-2"
78
- :class="{ 'mb-4': (isExpanded || !collapsable) && hasSlot }"
78
+ :class="{ 'mb-2': (isExpanded || !collapsable) && hasSlot }"
79
79
  >
80
80
  <div class="flex items-start gap-2">
81
81
  <div class="h-7 flex items-center">
@@ -64,7 +64,7 @@ defineSlots<{
64
64
 
65
65
  <!-- Small icon or no icon: icon in header only, content below -->
66
66
  <div v-else>
67
- <div v-if="heading" :class="{ 'mb-4': hasSlot }">
67
+ <div v-if="heading" :class="{ 'mb-2': hasSlot }">
68
68
  <header class="flex items-start justify-between gap-4">
69
69
  <div class="flex items-center gap-3">
70
70
  <FdsIcon v-if="icon && size === 'small'" :name="icon" :size="smallIconSize" class="fill-blue-500" />
@@ -42,7 +42,7 @@ const sizeClasses: Record<string, string> = {
42
42
  }
43
43
 
44
44
  const variantClasses =
45
- 'bg-white border-2 border-blue-500 text-blue-600 hover:border-blue-600 active:bg-blue-600 active:border-blue-600 active:text-white'
45
+ 'bg-white border-2 border-blue-500 text-blue-600 hover:bg-blue_t-100 hover:border-blue-500 hover:text-blue-600 active:bg-blue_t-200 active:border-blue-500 active:text-blue-600'
46
46
 
47
47
  const blockElClasses = computed(() => props.block && 'w-full justify-center')
48
48
 
@@ -55,7 +55,8 @@ const buttonClasses = computed(() => [
55
55
  blockElClasses.value,
56
56
  props.textSelection && 'select-text',
57
57
  (props.icon || props.text) && 'gap-2',
58
- disabled.value ? 'opacity-20 cursor-not-allowed' : 'cursor-pointer',
58
+ props.loading && 'bg-blue_t-200!',
59
+ disabled.value ? 'cursor-not-allowed' : 'cursor-pointer',
59
60
  ])
60
61
 
61
62
  const iconFillClass = 'fill-blue-500'
@@ -2,7 +2,6 @@
2
2
  import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
3
3
  import { useBoldQuery } from '../../composables/useBoldQuery'
4
4
  import { isPidString, useIsPid } from '../../composables/useIsPid'
5
- import FdsIcon from '../FdsIcon/FdsIcon.vue'
6
5
  import FdsPagination from '../FdsPagination/FdsPagination.vue'
7
6
  import FdsSpinner from '../FdsSpinner/FdsSpinner.vue'
8
7
  import FdsInput from '../Form/FdsInput/FdsInput.vue'
@@ -96,7 +95,9 @@ const focusInput = () => {
96
95
 
97
96
  const uncheckAllRadios = () => {
98
97
  if (!dropdownRef.value) return
99
- const checkedRadio = dropdownRef.value.querySelector('input[name="search-select-radio-group"]:checked') as HTMLInputElement
98
+ const checkedRadio = dropdownRef.value.querySelector(
99
+ 'input[name="search-select-radio-group"]:checked',
100
+ ) as HTMLInputElement
100
101
  if (checkedRadio) {
101
102
  checkedRadio.checked = false
102
103
  }
@@ -236,7 +237,6 @@ watch(
236
237
  { immediate: true },
237
238
  )
238
239
 
239
-
240
240
  const formatPidWithDash = (value: string): string => {
241
241
  // Only format if it looks like a personnummer
242
242
  if (!isPidString(value)) {
@@ -481,7 +481,9 @@ const rootAttrs = computed(() => {
481
481
  // Computed property to find the currently checked radio button ID for aria-activedescendant
482
482
  const activeDescendantId = computed(() => {
483
483
  if (!dropdownVisible.value || !dropdownRef.value) return null
484
- const checkedRadio = dropdownRef.value.querySelector('input[name="search-select-radio-group"]:checked') as HTMLInputElement | null
484
+ const checkedRadio = dropdownRef.value.querySelector(
485
+ 'input[name="search-select-radio-group"]:checked',
486
+ ) as HTMLInputElement | null
485
487
  return checkedRadio?.id || null
486
488
  })
487
489
 
@@ -493,15 +495,15 @@ const inputAriaAttrs = computed(() => {
493
495
  'aria-autocomplete': 'list',
494
496
  'aria-haspopup': 'listbox',
495
497
  }
496
-
498
+
497
499
  if (dropdownVisible.value && listboxId) {
498
500
  attrs['aria-controls'] = listboxId
499
501
  }
500
-
502
+
501
503
  if (activeDescendantId.value) {
502
504
  attrs['aria-activedescendant'] = activeDescendantId.value
503
505
  }
504
-
506
+
505
507
  return attrs
506
508
  })
507
509
  </script>
@@ -528,15 +530,10 @@ const inputAriaAttrs = computed(() => {
528
530
  :mask="pidMask"
529
531
  :maskOptions="{ lazy: true }"
530
532
  v-bind="inputAriaAttrs"
533
+ :searchIcon="!disabled && !hasInputValue"
531
534
  @input="handleInput"
532
535
  @clearInput="handleClear"
533
536
  />
534
- <FdsIcon
535
- v-if="!disabled && !hasInputValue"
536
- name="search"
537
- :size="24"
538
- class="absolute right-3 bottom-6 translate-y-1/2 fill-blue-500"
539
- />
540
537
  </div>
541
538
  </div>
542
539
  <div v-else>
@@ -559,16 +556,11 @@ const inputAriaAttrs = computed(() => {
559
556
  <!-- Results -->
560
557
  <template v-else-if="displayedItems && displayedItems.length">
561
558
  <!-- Header -->
562
- <div
563
- v-if="searchTerm && searchTerm.length"
564
- :class="headerClasses"
565
- >
559
+ <div v-if="searchTerm && searchTerm.length" :class="headerClasses">
566
560
  {{ displayedItems.length }} {{ searchContext.linkWord }} {{ totalCount }}
567
561
  {{ searchContext.context }}
568
562
  </div>
569
- <div v-else-if="!searchTerm.length" :class="headerClasses">
570
- {{ totalCount }} {{ searchContext.context }}
571
- </div>
563
+ <div v-else-if="!searchTerm.length" :class="headerClasses">{{ totalCount }} {{ searchContext.context }}</div>
572
564
 
573
565
  <!-- List -->
574
566
  <ul class="block m-0 list-none p-0" role="listbox" :id="listboxId" @keydown="handleListKeyDown">
@@ -101,6 +101,7 @@ const rightIconCount = computed(() => {
101
101
  let count = 0
102
102
  if (showValidationIcon.value) count++
103
103
  if (showClearButton.value) count++
104
+ if (props.searchIcon) count++
104
105
  // Password toggle har text och är bredare, räkna som 2 ikoner
105
106
  if (showPasswordToggle.value) count += 3
106
107
  return count
@@ -302,6 +303,7 @@ watch(
302
303
  :aria-label="props.ariaLabel"
303
304
  :autocomplete="props.autocomplete"
304
305
  :pattern="props.pattern"
306
+ :searchIcon="props.searchIcon"
305
307
  v-bind="inputAttrs"
306
308
  @input="handleInputChange"
307
309
  @change="handleInputChange"
@@ -316,6 +318,7 @@ watch(
316
318
  <div :class="rightIconsContainerClasses">
317
319
  <FdsIcon v-if="isInvalid" name="alert" class="fill-red-600" />
318
320
  <FdsIcon v-if="isValid" name="bigSuccess" />
321
+ <FdsIcon v-if="props.searchIcon" name="search" :size="24" class="fill-blue-500" />
319
322
  <FdsButtonIcon
320
323
  v-if="showClearButton"
321
324
  icon="cross"
@@ -22,6 +22,7 @@ export interface FdsInputProps {
22
22
  readonly?: boolean
23
23
  ariaLabel?: string
24
24
  pattern?: string
25
+ searchIcon?: boolean
25
26
  onClearInput?: () => void
26
27
  maskOptions?: {
27
28
  lazy?: boolean