fds-vue-core 2.1.11 → 2.1.15

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.
Files changed (56) hide show
  1. package/dist/fds-vue-core.cjs.js +312 -240
  2. package/dist/fds-vue-core.cjs.js.map +1 -1
  3. package/dist/fds-vue-core.es.js +313 -241
  4. package/dist/fds-vue-core.es.js.map +1 -1
  5. package/package.json +9 -11
  6. package/src/components/Blocks/FdsBlockAlert/FdsBlockAlert.stories.ts +60 -33
  7. package/src/components/Blocks/FdsBlockAlert/FdsBlockAlert.vue +5 -1
  8. package/src/components/Blocks/FdsBlockContent/FdsBlockContent.stories.ts +44 -41
  9. package/src/components/Blocks/FdsBlockExpander/FdsBlockExpander.stories.ts +33 -30
  10. package/src/components/Blocks/FdsBlockExpander/FdsBlockExpander.vue +51 -16
  11. package/src/components/Blocks/FdsBlockExpander/types.ts +2 -0
  12. package/src/components/Blocks/FdsBlockInfo/FdsBlockInfo.stories.ts +42 -39
  13. package/src/components/Blocks/FdsBlockLink/FdsBlockLink.stories.ts +42 -39
  14. package/src/components/Blocks/FdsBlockLink/FdsBlockLink.vue +7 -2
  15. package/src/components/Buttons/ButtonBaseProps.ts +4 -0
  16. package/src/components/Buttons/FdsButtonCopy/FdsButtonCopy.stories.ts +1 -1
  17. package/src/components/Buttons/FdsButtonDownload/FdsButtonDownload.stories.ts +4 -4
  18. package/src/components/Buttons/FdsButtonDownload/FdsButtonDownload.vue +12 -2
  19. package/src/components/Buttons/FdsButtonDownload/types.ts +2 -0
  20. package/src/components/Buttons/FdsButtonIcon/FdsButtonIcon.stories.ts +2 -2
  21. package/src/components/Buttons/FdsButtonMinor/FdsButtonMinor.stories.ts +2 -2
  22. package/src/components/Buttons/FdsButtonMinor/FdsButtonMinor.vue +3 -0
  23. package/src/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.stories.ts +4 -4
  24. package/src/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.vue +0 -5
  25. package/src/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.stories.ts +2 -2
  26. package/src/components/FdsIcon/FdsIcon.stories.ts +1 -1
  27. package/src/components/FdsModal/FdsModal.stories.ts +7 -7
  28. package/src/components/FdsModal/FdsModal.vue +6 -1
  29. package/src/components/FdsPagination/FdsPagination.stories.ts +5 -5
  30. package/src/components/FdsSearchSelect/FdsSearchSelect.stories.ts +9 -9
  31. package/src/components/FdsSpinner/FdsSpinner.stories.ts +1 -1
  32. package/src/components/FdsSticker/FdsSticker.stories.ts +23 -20
  33. package/src/components/FdsSticker/FdsSticker.vue +6 -5
  34. package/src/components/FdsTreeView/FdsTreeView.stories.ts +1 -1
  35. package/src/components/FdsTruncatedText/FdsTruncatedText.stories.ts +4 -4
  36. package/src/components/FdsTruncatedText/FdsTruncatedText.vue +6 -7
  37. package/src/components/Form/FdsCheckbox/FdsCheckbox.stories.ts +4 -4
  38. package/src/components/Form/FdsCheckbox/FdsCheckbox.vue +6 -6
  39. package/src/components/Form/FdsInput/FdsInput.stories.ts +5 -5
  40. package/src/components/Form/FdsInput/FdsInput.vue +14 -19
  41. package/src/components/Form/FdsRadio/FdsRadio.stories.ts +1 -1
  42. package/src/components/Form/FdsRadio/FdsRadio.vue +6 -6
  43. package/src/components/Form/FdsSelect/FdsSelect.stories.ts +4 -4
  44. package/src/components/Form/FdsSelect/FdsSelect.vue +5 -1
  45. package/src/components/Form/FdsTextarea/FdsTextarea.stories.ts +2 -2
  46. package/src/components/Table/FdsTable/FdsTable.stories.ts +3 -3
  47. package/src/components/Table/FdsTableHead/FdsTableHead.stories.ts +6 -6
  48. package/src/components/Table/FdsTableHead/FdsTableHead.vue +9 -15
  49. package/src/components/Table/FdsTableHead/types.ts +1 -0
  50. package/src/components/Tabs/FdsTabs/FdsTabs.stories.ts +9 -9
  51. package/src/components/Tabs/FdsTabs/FdsTabs.vue +5 -1
  52. package/src/components/Tabs/FdsTabsItem/FdsTabsItem.vue +26 -2
  53. package/src/components/Tabs/FdsTabsItem/types.ts +2 -0
  54. package/src/components/Typography/FdsText/FdsText.stories.ts +14 -14
  55. package/src/components/Typography/FdsText/FdsText.vue +18 -2
  56. package/src/components/Typography/FdsText/types.ts +1 -0
@@ -3,10 +3,51 @@ import icons from '../../../assets/icons'
3
3
  import FdsSticker from '../../FdsSticker/FdsSticker.vue'
4
4
  import FdsBlockLink from './FdsBlockLink.vue'
5
5
 
6
+ const blockLinkTransform = (
7
+ _src: string,
8
+ storyContext: {
9
+ args?: {
10
+ label?: string
11
+ icon?: string
12
+ arrow?: boolean
13
+ disabled?: boolean
14
+ href?: string
15
+ interactive?: boolean
16
+ default?: string
17
+ as?: 'router-link' | 'a' | 'button'
18
+ target?: string
19
+ rel?: string
20
+ download?: string
21
+ }
22
+ },
23
+ ) => {
24
+ const args = storyContext?.args || {}
25
+ const attrs = []
26
+
27
+ if (args.label) attrs.push(`label="${args.label}"`)
28
+ if (args.icon) attrs.push(`icon="${args.icon}"`)
29
+ if (args.arrow) attrs.push(':arrow="true"')
30
+ if (args.disabled) attrs.push(':disabled="true"')
31
+ if (args.href) attrs.push(`href="${args.href}"`)
32
+ if (!args.interactive) attrs.push(':interactive="false"')
33
+ if (args.as && args.as !== 'router-link') attrs.push(`as="${args.as}"`)
34
+
35
+ const attrsStr = attrs.length ? ` ${attrs.join(' ')}` : ''
36
+ const content = args.default ? `\n <p>${args.default}</p>\n` : ''
37
+ return `<FdsBlockLink${attrsStr}>${content}</FdsBlockLink>`
38
+ }
39
+
6
40
  const meta: Meta<typeof FdsBlockLink> = {
7
41
  title: 'FDS/Blocks/FdsBlockLink',
8
42
  component: FdsBlockLink,
9
43
  tags: ['autodocs'],
44
+ parameters: {
45
+ docs: {
46
+ source: {
47
+ transform: blockLinkTransform,
48
+ },
49
+ },
50
+ },
10
51
  argTypes: {
11
52
  label: { control: { type: 'text' } },
12
53
  arrow: { control: { type: 'boolean' } },
@@ -38,50 +79,12 @@ const meta: Meta<typeof FdsBlockLink> = {
38
79
  export default meta
39
80
  type Story = StoryObj<typeof meta>
40
81
 
41
- const blockLinkTransform = (storyContext: {
42
- args?: {
43
- label?: string
44
- icon?: string
45
- arrow?: boolean
46
- disabled?: boolean
47
- href?: string
48
- interactive?: boolean
49
- default?: string
50
- as?: 'router-link' | 'a' | 'button'
51
- target?: string
52
- rel?: string
53
- download?: string
54
- }
55
- }) => {
56
- const args = storyContext?.args || {}
57
- const attrs = []
58
-
59
- if (args.label) attrs.push(`label="${args.label}"`)
60
- if (args.icon) attrs.push(`icon="${args.icon}"`)
61
- if (args.arrow) attrs.push(':arrow="true"')
62
- if (args.disabled) attrs.push(':disabled="true"')
63
- if (args.href) attrs.push(`href="${args.href}"`)
64
- if (!args.interactive) attrs.push(':interactive="false"')
65
- if (args.as && args.as !== 'router-link') attrs.push(`as="${args.as}"`)
66
-
67
- const attrsStr = attrs.length ? ` ${attrs.join(' ')}` : ''
68
- const content = args.default ? `\n <p>${args.default}</p>\n` : ''
69
- return `<FdsBlockLink${attrsStr}>${content}</FdsBlockLink>`
70
- }
71
-
72
82
  export const Default: Story = {
73
- render: (args) => ({
83
+ render: (args: Story['args']) => ({
74
84
  components: { FdsBlockLink },
75
85
  setup: () => ({ args }),
76
86
  template: `<FdsBlockLink v-bind="args">{{ args.default }}</FdsBlockLink>`,
77
87
  }),
78
- parameters: {
79
- docs: {
80
- source: {
81
- transform: blockLinkTransform,
82
- },
83
- },
84
- },
85
88
  args: {
86
89
  label: 'Enter some text',
87
90
  default: 'Nothing will happen',
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, useAttrs } from 'vue'
2
+ import { computed, useAttrs, type Slot } from 'vue'
3
3
  import { useHasSlot } from '../../../composables/useHasSlots'
4
4
  import FdsIcon from '../../FdsIcon/FdsIcon.vue'
5
5
  import type { FdsInteractionBlockProps } from './types'
@@ -82,12 +82,18 @@ const linkAttrs = computed(() => {
82
82
  const componentAttrs = computed(() => ({
83
83
  ...linkAttrs.value,
84
84
  ...attrs,
85
+ 'data-testid': props.dataTestid,
85
86
  }))
86
87
 
87
88
  const componentType = computed(() => {
88
89
  if (props.as) return props.as
89
90
  return props.href ? 'a' : 'button'
90
91
  })
92
+
93
+ defineSlots<{
94
+ default?: Slot
95
+ sticker?: Slot
96
+ }>()
91
97
  </script>
92
98
 
93
99
  <template>
@@ -104,7 +110,6 @@ const componentType = computed(() => {
104
110
  :aria-disabled="disabled"
105
111
  @click="handleClick"
106
112
  @keydown="handleKeydown"
107
- :data-testid="dataTestid"
108
113
  >
109
114
  <div class="flex w-full flex-1" :class="contentClasses">
110
115
  <FdsIcon
@@ -15,5 +15,9 @@ export interface FdsButtonBaseProps {
15
15
  target?: string
16
16
  rel?: string
17
17
  type?: 'button' | 'submit' | 'reset'
18
+ invert?: boolean
19
+ dataTestid?: string
20
+ ariaLabel?: string
21
+ ariaExpanded?: boolean
18
22
  onClick?: ((ev: MouseEvent) => void) | Array<(ev: MouseEvent) => void>
19
23
  }
@@ -45,7 +45,7 @@ export default meta
45
45
  type Story = StoryObj<typeof meta>
46
46
 
47
47
  export const Default: Story = {
48
- render: (args) => ({
48
+ render: (args: Story['args']) => ({
49
49
  components: { FdsButtonCopy },
50
50
  setup: () => ({ args }),
51
51
  template: '<FdsButtonCopy v-bind="args" />',
@@ -53,7 +53,7 @@ export default meta
53
53
  type Story = StoryObj<typeof meta>
54
54
 
55
55
  export const Default: Story = {
56
- render: (args) => ({
56
+ render: (args: Story['args']) => ({
57
57
  components: { FdsButtonDownload },
58
58
  setup() {
59
59
  return { args }
@@ -67,7 +67,7 @@ export const Default: Story = {
67
67
  }
68
68
 
69
69
  export const WithText: Story = {
70
- render: (args) => ({
70
+ render: (args: Story['args']) => ({
71
71
  components: { FdsButtonDownload },
72
72
  setup() {
73
73
  return { args }
@@ -81,7 +81,7 @@ export const WithText: Story = {
81
81
  }
82
82
 
83
83
  export const Loading: Story = {
84
- render: (args) => ({
84
+ render: (args: Story['args']) => ({
85
85
  components: { FdsButtonDownload },
86
86
  setup() {
87
87
  return { args }
@@ -96,7 +96,7 @@ export const Loading: Story = {
96
96
  }
97
97
 
98
98
  export const Disabled: Story = {
99
- render: (args) => ({
99
+ render: (args: Story['args']) => ({
100
100
  components: { FdsButtonDownload },
101
101
  setup() {
102
102
  return { args }
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, ref } from 'vue'
2
+ import { computed, ref, useAttrs } from 'vue'
3
3
  import FdsIcon from '../../FdsIcon/FdsIcon.vue'
4
4
  import type { FdsButtonDownloadProps } from './types'
5
5
 
@@ -7,6 +7,8 @@ defineOptions({
7
7
  inheritAttrs: false,
8
8
  })
9
9
 
10
+ const attrs = useAttrs()
11
+
10
12
  const props = withDefaults(defineProps<FdsButtonDownloadProps>(), {
11
13
  loading: false,
12
14
  disabled: false,
@@ -14,6 +16,8 @@ const props = withDefaults(defineProps<FdsButtonDownloadProps>(), {
14
16
  href: undefined,
15
17
  downloadOptions: undefined,
16
18
  text: '',
19
+ ariaLabel: undefined,
20
+ dataTestid: undefined,
17
21
  })
18
22
 
19
23
  const emit = defineEmits<{
@@ -50,6 +54,12 @@ const buttonClasses = computed(() => [
50
54
 
51
55
  const iconFillClass = computed(() => (isDownloading.value ? 'fill-gray-500' : 'fill-blue-500'))
52
56
 
57
+ const buttonAttrs = computed(() => ({
58
+ ...attrs,
59
+ 'data-testid': props.dataTestid,
60
+ 'aria-label': props.ariaLabel,
61
+ }))
62
+
53
63
  async function handleDownload(ev: MouseEvent) {
54
64
  if (props.disabled || props.loading || isDownloading.value) {
55
65
  ev.preventDefault()
@@ -150,7 +160,7 @@ const onClick = (ev: MouseEvent) => {
150
160
  <template>
151
161
  <div :class="rootClasses" :aria-disabled="disabled ? 'true' : undefined">
152
162
  <button
153
- v-bind="$attrs"
163
+ v-bind="buttonAttrs"
154
164
  :class="buttonClasses"
155
165
  :disabled="disabled || loading || isDownloading"
156
166
  type="button"
@@ -7,6 +7,8 @@ export interface FdsButtonDownloadProps {
7
7
  href?: string
8
8
  downloadOptions?: DownloadOptions | undefined
9
9
  text: string
10
+ ariaLabel?: string
11
+ dataTestid?: string
10
12
  onClick?: ((ev: MouseEvent) => void) | Array<(ev: MouseEvent) => void>
11
13
  }
12
14
 
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
- import FdsButtonIcon from './FdsButtonIcon.vue'
3
2
  import icons from '../../../assets/icons'
3
+ import FdsButtonIcon from './FdsButtonIcon.vue'
4
4
 
5
5
  const meta: Meta<typeof FdsButtonIcon> = {
6
6
  title: 'FDS/Buttons/FdsButtonIcon',
@@ -47,7 +47,7 @@ export default meta
47
47
  type Story = StoryObj<typeof meta>
48
48
 
49
49
  export const Default: Story = {
50
- render: (args) => ({
50
+ render: (args: Story['args']) => ({
51
51
  components: { FdsButtonIcon },
52
52
  setup: () => ({ args }),
53
53
  template: '<FdsButtonIcon v-bind="args" />',
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
- import FdsButtonMinor from './FdsButtonMinor.vue'
3
2
  import icons from '../../../assets/icons'
3
+ import FdsButtonMinor from './FdsButtonMinor.vue'
4
4
 
5
5
  const meta: Meta<typeof FdsButtonMinor> = {
6
6
  title: 'FDS/Buttons/FdsButtonMinor',
@@ -60,7 +60,7 @@ export default meta
60
60
  type Story = StoryObj<typeof meta>
61
61
 
62
62
  export const Default: Story = {
63
- render: (args) => ({
63
+ render: (args: Story['args']) => ({
64
64
  components: { FdsButtonMinor },
65
65
  setup: () => ({ args }),
66
66
  template: '<FdsButtonMinor v-bind="args" />',
@@ -28,6 +28,9 @@ const props = withDefaults(defineProps<FdsButtonMinorProps>(), {
28
28
  rel: undefined,
29
29
  type: 'button',
30
30
  invert: false,
31
+ ariaLabel: undefined,
32
+ dataTestid: undefined,
33
+ ariaExpanded: undefined,
31
34
  })
32
35
 
33
36
  const emit = defineEmits<{
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
- import FdsButtonPrimary from './FdsButtonPrimary.vue'
3
2
  import icons from '../../../assets/icons'
3
+ import FdsButtonPrimary from './FdsButtonPrimary.vue'
4
4
 
5
5
  const meta: Meta<typeof FdsButtonPrimary> = {
6
6
  title: 'FDS/Buttons/FdsButtonPrimary',
@@ -60,7 +60,7 @@ export default meta
60
60
  type Story = StoryObj<typeof meta>
61
61
 
62
62
  export const Default: Story = {
63
- render: (args) => ({
63
+ render: (args: Story['args']) => ({
64
64
  components: { FdsButtonPrimary },
65
65
  setup: () => ({ args }),
66
66
  template: '<FdsButtonPrimary v-bind="args" />',
@@ -69,7 +69,7 @@ export const Default: Story = {
69
69
 
70
70
  export const WithIcon: Story = {
71
71
  args: { icon: 'arrowRight', text: 'With icon' },
72
- render: (args) => ({
72
+ render: (args: Story['args']) => ({
73
73
  components: { FdsButtonPrimary },
74
74
  setup: () => ({ args }),
75
75
  template: '<FdsButtonPrimary v-bind="args" />',
@@ -77,7 +77,7 @@ export const WithIcon: Story = {
77
77
  }
78
78
 
79
79
  export const Sizes: Story = {
80
- render: (args) => ({
80
+ render: (args: Story['args']) => ({
81
81
  components: { FdsButtonPrimary },
82
82
  setup: () => ({ args }),
83
83
  template:
@@ -60,11 +60,6 @@ function onClick(ev: MouseEvent) {
60
60
  ev.preventDefault()
61
61
  return
62
62
  }
63
- // Support both @click event and onClick prop
64
- if (props.onClick) {
65
- const handlers = Array.isArray(props.onClick) ? props.onClick : [props.onClick]
66
- handlers.forEach((handler) => handler(ev))
67
- }
68
63
  emit('click', ev)
69
64
  }
70
65
 
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
- import FdsButtonSecondary from './FdsButtonSecondary.vue'
3
2
  import icons from '../../../assets/icons'
3
+ import FdsButtonSecondary from './FdsButtonSecondary.vue'
4
4
 
5
5
  const meta: Meta<typeof FdsButtonSecondary> = {
6
6
  title: 'FDS/Buttons/FdsButtonSecondary',
@@ -60,7 +60,7 @@ export default meta
60
60
  type Story = StoryObj<typeof meta>
61
61
 
62
62
  export const Default: Story = {
63
- render: (args) => ({
63
+ render: (args: Story['args']) => ({
64
64
  components: { FdsButtonSecondary },
65
65
  setup: () => ({ args }),
66
66
  template: '<FdsButtonSecondary v-bind="args" />',
@@ -24,7 +24,7 @@ export default meta
24
24
  type Story = StoryObj<typeof meta>
25
25
 
26
26
  export const Basic: Story = {
27
- render: (args) => ({
27
+ render: (args: Story['args']) => ({
28
28
  components: { FdsIcon },
29
29
  setup: () => ({ args }),
30
30
  template: '<FdsIcon v-bind="args" />',
@@ -82,7 +82,7 @@ const modalTransform = (storyContext: {
82
82
  }
83
83
 
84
84
  export const Default: Story = {
85
- render: (args) => ({
85
+ render: (args: Story['args']) => ({
86
86
  components: { FdsModal, FdsButtonPrimary, FdsButtonSecondary },
87
87
  setup: () => createModalStory(args),
88
88
  template: `
@@ -108,7 +108,7 @@ export const Default: Story = {
108
108
  }
109
109
 
110
110
  export const WithFooter: Story = {
111
- render: (args) => ({
111
+ render: (args: Story['args']) => ({
112
112
  components: { FdsModal, FdsButtonPrimary, FdsButtonSecondary },
113
113
  setup: () => createModalStory(args),
114
114
  template: `
@@ -127,7 +127,7 @@ export const WithFooter: Story = {
127
127
  }
128
128
 
129
129
  export const Strict: Story = {
130
- render: (args) => ({
130
+ render: (args: Story['args']) => ({
131
131
  components: { FdsModal, FdsButtonPrimary, FdsButtonSecondary },
132
132
  setup: () => createModalStory(args),
133
133
  template: `
@@ -148,7 +148,7 @@ export const Strict: Story = {
148
148
  }
149
149
 
150
150
  export const ValidInfo: Story = {
151
- render: (args) => ({
151
+ render: (args: Story['args']) => ({
152
152
  components: { FdsModal, FdsButtonPrimary },
153
153
  setup: () => createModalStory(args),
154
154
  template: `
@@ -166,7 +166,7 @@ export const ValidInfo: Story = {
166
166
  }
167
167
 
168
168
  export const WarningInfo: Story = {
169
- render: (args) => ({
169
+ render: (args: Story['args']) => ({
170
170
  components: { FdsModal, FdsButtonPrimary, FdsButtonSecondary },
171
171
  setup: () => createModalStory(args),
172
172
  template: `
@@ -188,7 +188,7 @@ export const WarningInfo: Story = {
188
188
  }
189
189
 
190
190
  export const LargeSize: Story = {
191
- render: (args) => ({
191
+ render: (args: Story['args']) => ({
192
192
  components: { FdsModal, FdsButtonPrimary },
193
193
  setup: () => createModalStory(args),
194
194
  template: `
@@ -207,7 +207,7 @@ export const LargeSize: Story = {
207
207
  }
208
208
 
209
209
  export const LongContentWithStickyFooter: Story = {
210
- render: (args) => ({
210
+ render: (args: Story['args']) => ({
211
211
  components: { FdsModal, FdsButtonPrimary, FdsButtonSecondary },
212
212
  setup: () => createModalStory(args),
213
213
  template: `
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
2
+ import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch, type Slot } from 'vue'
3
3
  import { useHasSlot } from '../../composables/useHasSlots'
4
4
  import FdsButtonIcon from '../Buttons/FdsButtonIcon/FdsButtonIcon.vue'
5
5
  import FdsIcon from '../FdsIcon/FdsIcon.vue'
@@ -207,6 +207,11 @@ onBeforeUnmount(() => {
207
207
  cleanupFocusTrap()
208
208
  }
209
209
  })
210
+
211
+ defineSlots<{
212
+ default?: Slot
213
+ 'modal-footer'?: Slot
214
+ }>()
210
215
  </script>
211
216
 
212
217
  <template>
@@ -22,7 +22,7 @@ export default meta
22
22
  type Story = StoryObj<typeof meta>
23
23
 
24
24
  export const Default: Story = {
25
- render: (args) => ({
25
+ render: (args: NonNullable<Story['args']>) => ({
26
26
  components: { FdsPagination },
27
27
  setup: () => {
28
28
  const current = ref((args.current ?? 1) as number)
@@ -36,7 +36,7 @@ export const Default: Story = {
36
36
  }
37
37
 
38
38
  export const MiddlePage: Story = {
39
- render: (args) => ({
39
+ render: (args: NonNullable<Story['args']>) => ({
40
40
  components: { FdsPagination },
41
41
  setup: () => {
42
42
  const current = ref((args.current ?? 1) as number)
@@ -54,7 +54,7 @@ export const MiddlePage: Story = {
54
54
  }
55
55
 
56
56
  export const LastPage: Story = {
57
- render: (args) => ({
57
+ render: (args: NonNullable<Story['args']>) => ({
58
58
  components: { FdsPagination },
59
59
  setup: () => {
60
60
  const current = ref((args.current ?? 1) as number)
@@ -72,7 +72,7 @@ export const LastPage: Story = {
72
72
  }
73
73
 
74
74
  export const LargeMax: Story = {
75
- render: (args) => ({
75
+ render: (args: NonNullable<Story['args']>) => ({
76
76
  components: { FdsPagination },
77
77
  setup: () => {
78
78
  const current = ref((args.current ?? 1) as number)
@@ -90,7 +90,7 @@ export const LargeMax: Story = {
90
90
  }
91
91
 
92
92
  export const WithLoading: Story = {
93
- render: (args) => ({
93
+ render: (args: NonNullable<Story['args']>) => ({
94
94
  components: { FdsPagination },
95
95
  setup: () => {
96
96
  const current = ref((args.current ?? 1) as number)
@@ -158,7 +158,7 @@ const mockItems = [
158
158
  ]
159
159
 
160
160
  export const WithItems: Story = {
161
- render: (args) => ({
161
+ render: (args: Story['args']) => ({
162
162
  components: { FdsSearchSelect },
163
163
  setup: () => {
164
164
  const selected = ref<Record<string, unknown> | null>(null)
@@ -184,7 +184,7 @@ export const WithItems: Story = {
184
184
  }
185
185
 
186
186
  export const WithSelectedEarlier: Story = {
187
- render: (args) => ({
187
+ render: (args: Story['args']) => ({
188
188
  components: { FdsSearchSelect },
189
189
  setup: () => {
190
190
  const selected = ref<Record<string, unknown> | null>(null)
@@ -209,7 +209,7 @@ export const WithSelectedEarlier: Story = {
209
209
  }
210
210
 
211
211
  export const SingleOrganization: Story = {
212
- render: (args) => ({
212
+ render: (args: Story['args']) => ({
213
213
  components: { FdsSearchSelect },
214
214
  setup: () => {
215
215
  const selected = ref<Record<string, unknown> | null>(null)
@@ -240,7 +240,7 @@ export const SingleOrganization: Story = {
240
240
  }
241
241
 
242
242
  export const WithValidation: Story = {
243
- render: (args) => ({
243
+ render: (args: Story['args']) => ({
244
244
  components: { FdsSearchSelect },
245
245
  setup: () => {
246
246
  const selected = ref<Record<string, unknown> | null>(null)
@@ -268,7 +268,7 @@ export const WithValidation: Story = {
268
268
  }
269
269
 
270
270
  export const WithLabelLeft: Story = {
271
- render: (args) => ({
271
+ render: (args: Story['args']) => ({
272
272
  components: { FdsSearchSelect },
273
273
  setup: () => {
274
274
  const selected = ref<Record<string, unknown> | null>(null)
@@ -296,7 +296,7 @@ export const WithLabelLeft: Story = {
296
296
  }
297
297
 
298
298
  export const WithAbsoluteList: Story = {
299
- render: (args) => ({
299
+ render: (args: Story['args']) => ({
300
300
  components: { FdsSearchSelect },
301
301
  setup: () => {
302
302
  const selected = ref<Record<string, unknown> | null>(null)
@@ -323,7 +323,7 @@ export const WithAbsoluteList: Story = {
323
323
  }
324
324
 
325
325
  export const Disabled: Story = {
326
- render: (args) => ({
326
+ render: (args: Story['args']) => ({
327
327
  components: { FdsSearchSelect },
328
328
  setup: () => ({ args }),
329
329
  template: '<FdsSearchSelect v-bind="args" :items="args.items" />',
@@ -336,7 +336,7 @@ export const Disabled: Story = {
336
336
  }
337
337
 
338
338
  export const EnglishLocale: Story = {
339
- render: (args) => ({
339
+ render: (args: Story['args']) => ({
340
340
  components: { FdsSearchSelect },
341
341
  setup: () => {
342
342
  const selected = ref<Record<string, unknown> | null>(null)
@@ -368,7 +368,7 @@ export const EnglishLocale: Story = {
368
368
  }
369
369
 
370
370
  export const WithPagination: Story = {
371
- render: (args) => ({
371
+ render: (args: Story['args']) => ({
372
372
  components: { FdsSearchSelect },
373
373
  setup: () => {
374
374
  const selected = ref<Record<string, unknown> | null>(null)
@@ -23,7 +23,7 @@ export default meta
23
23
  type Story = StoryObj<typeof meta>
24
24
 
25
25
  export const Basic: Story = {
26
- render: (args) => ({
26
+ render: (args: Story['args']) => ({
27
27
  components: { FdsSpinner },
28
28
  setup: () => ({ args }),
29
29
  template: '<FdsSpinner v-bind="args" />',
@@ -1,10 +1,32 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
2
  import FdsSticker from './FdsSticker.vue'
3
3
 
4
+ const stickerTransform = (
5
+ _src: string,
6
+ storyContext: { args?: { variant?: string; bullet?: boolean; default?: string } },
7
+ ) => {
8
+ const args = storyContext?.args || {}
9
+ const attrs = []
10
+
11
+ if (args.variant && args.variant !== 'blue') attrs.push(`variant="${args.variant}"`)
12
+ if (args.bullet) attrs.push(`:bullet="true"`)
13
+
14
+ const attrsStr = attrs.length ? ` ${attrs.join(' ')}` : ''
15
+ const content = args.default || ''
16
+ return `<FdsSticker${attrsStr}>${content}</FdsSticker>`
17
+ }
18
+
4
19
  const meta: Meta<typeof FdsSticker> = {
5
20
  title: 'FDS/FdsSticker',
6
21
  component: FdsSticker,
7
22
  tags: ['autodocs'],
23
+ parameters: {
24
+ docs: {
25
+ source: {
26
+ transform: stickerTransform,
27
+ },
28
+ },
29
+ },
8
30
  argTypes: {
9
31
  variant: {
10
32
  control: { type: 'radio' },
@@ -27,31 +49,12 @@ const meta: Meta<typeof FdsSticker> = {
27
49
  export default meta
28
50
  type Story = StoryObj<typeof meta>
29
51
 
30
- const stickerTransform = (storyContext: { args?: { variant?: string; bullet?: boolean; default?: string } }) => {
31
- const args = storyContext?.args || {}
32
- const attrs = []
33
-
34
- if (args.variant && args.variant !== 'blue') attrs.push(`variant="${args.variant}"`)
35
- if (args.bullet) attrs.push(':bullet="true"')
36
-
37
- const attrsStr = attrs.length ? ` ${attrs.join(' ')}` : ''
38
- const content = args.default || ''
39
- return `<FdsSticker${attrsStr}>${content}</FdsSticker>`
40
- }
41
-
42
52
  export const Default: Story = {
43
- render: (args) => ({
53
+ render: (args: Story['args']) => ({
44
54
  components: { FdsSticker },
45
55
  setup: () => ({ args }),
46
56
  template: `<FdsSticker v-bind="args">{{ args.default }}</FdsSticker>`,
47
57
  }),
48
- parameters: {
49
- docs: {
50
- source: {
51
- transform: stickerTransform,
52
- },
53
- },
54
- },
55
58
  args: {
56
59
  variant: 'blue',
57
60
  default: 'Stick it!',
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed } from 'vue'
2
+ import { computed, type Slot } from 'vue'
3
3
  import type { FdsStickerProps } from './types'
4
4
 
5
5
  const props = withDefaults(defineProps<FdsStickerProps>(), {
@@ -31,14 +31,15 @@ const bulletDotClasses = computed(() => [
31
31
  props.variant === 'gray' && 'bg-gray-400',
32
32
  props.variant === 't_blue' && 'bg-blue-200 border border-blue-300',
33
33
  ])
34
+
35
+ defineSlots<{
36
+ default?: Slot
37
+ }>()
34
38
  </script>
35
39
 
36
40
  <template>
37
41
  <span :class="stickerClasses">
38
- <span
39
- v-if="bullet"
40
- :class="bulletDotClasses"
41
- ></span>
42
+ <span v-if="bullet" :class="bulletDotClasses"></span>
42
43
  <slot />
43
44
  </span>
44
45
  </template>