fds-vue-core 7.1.2 → 7.1.4

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": "7.1.2",
3
+ "version": "7.1.4",
4
4
  "description": "FDS Vue Core Component Library",
5
5
  "type": "module",
6
6
  "main": "./dist/fds-vue-core.cjs.js",
@@ -66,7 +66,7 @@
66
66
  "@vitest/browser": "3.2.4",
67
67
  "dotenv": "16.4.5",
68
68
  "eslint-plugin-storybook": "10.1.10",
69
- "fg-devkit": "1.7.6",
69
+ "fg-devkit": "1.7.7",
70
70
  "storybook": "10.2.12",
71
71
  "tsx": "4.21.0",
72
72
  "vite": "7.3.2",
@@ -46,6 +46,18 @@ const weekToRender = computed(() => getDaysInWeek(currentWeek.value))
46
46
  const visibleWeekDays = computed(() => weekToRender.value.filter((day) => getISODay(day) <= 5))
47
47
  const lastWeek = computed(() => getDaysOfLastWeek(subWeeks(currentWeek.value, 1)))
48
48
 
49
+ const onHandleSelectedDay = (weekDay: Date | null) => {
50
+ selectedDay.value = weekDay
51
+ emit('select-date', weekDay)
52
+ }
53
+
54
+ const onHandleSetCurrentWeek = (week: Date) => {
55
+ if (selectedDay.value && !isSameWeek(selectedDay.value, week, { weekStartsOn: 1 })) {
56
+ onHandleSelectedDay(null)
57
+ }
58
+ currentWeek.value = week
59
+ }
60
+
49
61
  const weekText = computed(
50
62
  () =>
51
63
  `${getOverlappingMonths(currentWeek.value, locale.value)} (${t('FdsWeekCalendar.week')} ${getISOWeek(currentWeek.value)})`,
@@ -132,18 +144,6 @@ watch(
132
144
  { immediate: true },
133
145
  )
134
146
 
135
- const onHandleSelectedDay = (weekDay: Date | null) => {
136
- selectedDay.value = weekDay
137
- emit('select-date', weekDay)
138
- }
139
-
140
- const onHandleSetCurrentWeek = (week: Date) => {
141
- if (selectedDay.value && !isSameWeek(selectedDay.value, week, { weekStartsOn: 1 })) {
142
- onHandleSelectedDay(null)
143
- }
144
- currentWeek.value = week
145
- }
146
-
147
147
  const navigateToWeek = (week: Date) => {
148
148
  const normalizedWeek = startOfISOWeek(week)
149
149
  if (isSameWeek(normalizedWeek, currentWeek.value, { weekStartsOn: 1 })) return
@@ -9,13 +9,11 @@ const meta: Meta<typeof FdsTableHead> = {
9
9
  heading: { control: { type: 'text' } },
10
10
  align: { control: { type: 'radio' }, options: ['left', 'center', 'right'] },
11
11
  icon: { control: { type: 'select' }, options: ['sort', 'ascending', 'descending'] },
12
- isSortActive: { control: { type: 'boolean' } },
13
12
  },
14
13
  args: {
15
14
  heading: 'Namn',
16
15
  align: 'left',
17
16
  icon: 'sort',
18
- isSortActive: false,
19
17
  },
20
18
  }
21
19
 
@@ -65,7 +63,7 @@ export const Sortable: Story = {
65
63
  }
66
64
 
67
65
  export const SortedAsc: Story = {
68
- args: { icon: 'ascending', isSortActive: true },
66
+ args: { icon: 'ascending' },
69
67
  render: (args: Story['args']) => ({
70
68
  components: { FdsTableHead },
71
69
  setup: () => ({ args }),
@@ -87,7 +85,7 @@ export const SortedAsc: Story = {
87
85
  }
88
86
 
89
87
  export const SortedDesc: Story = {
90
- args: { icon: 'descending', isSortActive: true },
88
+ args: { icon: 'descending' },
91
89
  render: (args: Story['args']) => ({
92
90
  components: { FdsTableHead },
93
91
  setup: () => ({ args }),
@@ -9,7 +9,6 @@ const props = withDefaults(defineProps<FdsTableHeadProps>(), {
9
9
  icon: undefined,
10
10
  heading: undefined,
11
11
  dataTestid: undefined,
12
- isSortActive: false,
13
12
  })
14
13
 
15
14
  const hasSlot = useHasSlot()
@@ -22,11 +21,6 @@ const headerClasses = computed(() => [
22
21
  'text-blue-600! hover:bg-blue_t-200 cursor-pointer focus-visible:outline-dashed focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-blue-500 active:bg-blue_t-300',
23
22
  ])
24
23
 
25
- const iconClasses = computed(() => [
26
- 'fill-blue-500 ml-1 transition-opacity',
27
- iconName.value && !props.isSortActive && 'opacity-20',
28
- ])
29
-
30
24
  /* Sending an icon makes the th sortable */
31
25
  const iconName = computed(() => props.icon)
32
26
 
@@ -62,7 +56,7 @@ defineSlots<{
62
56
  >
63
57
  <span v-if="hasSlot"><slot /></span>
64
58
  <span v-else>{{ heading }}</span>
65
- <FdsIcon :name="iconName" size="24px" :class="iconClasses" />
59
+ <FdsIcon :name="iconName" size="24px" class="fill-blue-500 ml-1" />
66
60
  </button>
67
61
  <div v-else :class="headerClasses">
68
62
  <span v-if="hasSlot"><slot /></span>
@@ -5,5 +5,4 @@ export interface FdsTableHeadProps extends /* @vue-ignore */ HTMLAttributes {
5
5
  align?: 'left' | 'center' | 'right'
6
6
  icon?: 'sort' | 'ascending' | 'descending'
7
7
  dataTestid?: string
8
- isSortActive?: boolean
9
8
  }