fds-vue-core 2.1.10 → 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.
- package/components.d.ts +5 -3
- package/dist/fds-vue-core.cjs.js +174 -79
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.es.js +175 -80
- package/dist/fds-vue-core.es.js.map +1 -1
- package/package.json +12 -12
- package/src/components/Blocks/FdsBlockAlert/FdsBlockAlert.stories.ts +60 -33
- package/src/components/Blocks/FdsBlockAlert/FdsBlockAlert.vue +5 -1
- package/src/components/Blocks/FdsBlockContent/FdsBlockContent.stories.ts +44 -41
- package/src/components/Blocks/FdsBlockExpander/FdsBlockExpander.stories.ts +33 -30
- package/src/components/Blocks/FdsBlockExpander/FdsBlockExpander.vue +51 -16
- package/src/components/Blocks/FdsBlockExpander/types.ts +2 -0
- package/src/components/Blocks/FdsBlockInfo/FdsBlockInfo.stories.ts +42 -39
- package/src/components/Blocks/FdsBlockLink/FdsBlockLink.stories.ts +42 -39
- package/src/components/Blocks/FdsBlockLink/FdsBlockLink.vue +13 -1
- package/src/components/Blocks/FdsBlockLink/types.ts +2 -0
- package/src/components/Buttons/ButtonBaseProps.ts +5 -0
- package/src/components/Buttons/FdsButtonCopy/FdsButtonCopy.stories.ts +1 -1
- package/src/components/Buttons/FdsButtonCopy/types.ts +1 -0
- package/src/components/Buttons/FdsButtonDownload/FdsButtonDownload.stories.ts +4 -4
- package/src/components/Buttons/FdsButtonDownload/FdsButtonDownload.vue +14 -16
- package/src/components/Buttons/FdsButtonDownload/types.ts +22 -0
- package/src/components/Buttons/FdsButtonIcon/FdsButtonIcon.stories.ts +2 -2
- package/src/components/Buttons/FdsButtonIcon/FdsButtonIcon.vue +1 -1
- package/src/components/Buttons/FdsButtonIcon/types.ts +1 -0
- package/src/components/Buttons/FdsButtonMinor/FdsButtonMinor.stories.ts +2 -2
- package/src/components/Buttons/FdsButtonMinor/FdsButtonMinor.vue +4 -1
- package/src/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.stories.ts +4 -4
- package/src/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.stories.ts +2 -2
- package/src/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.vue +1 -1
- package/src/components/FdsIcon/FdsIcon.stories.ts +1 -1
- package/src/components/FdsModal/FdsModal.stories.ts +7 -7
- package/src/components/FdsModal/FdsModal.vue +6 -1
- package/src/components/FdsModal/types.ts +1 -0
- package/src/components/FdsPagination/FdsPagination.stories.ts +5 -5
- package/src/components/FdsPagination/types.ts +3 -0
- package/src/components/FdsSearchSelect/FdsSearchSelect.stories.ts +9 -9
- package/src/components/FdsSearchSelect/FdsSearchSelect.vue +7 -30
- package/src/components/FdsSearchSelect/types.ts +7 -0
- package/src/components/FdsSpinner/FdsSpinner.stories.ts +1 -1
- package/src/components/FdsSticker/FdsSticker.stories.ts +23 -20
- package/src/components/FdsSticker/FdsSticker.vue +6 -5
- package/src/components/FdsTreeView/FdsTreeView.stories.ts +1 -1
- package/src/components/FdsTreeView/types.ts +4 -1
- package/src/components/FdsTruncatedText/FdsTruncatedText.stories.ts +4 -4
- package/src/components/FdsTruncatedText/FdsTruncatedText.vue +6 -7
- package/src/components/Form/FdsCheckbox/FdsCheckbox.stories.ts +4 -4
- package/src/components/Form/FdsCheckbox/FdsCheckbox.vue +6 -6
- package/src/components/Form/FdsCheckbox/types.ts +2 -0
- package/src/components/Form/FdsInput/FdsInput.stories.ts +5 -5
- package/src/components/Form/FdsInput/FdsInput.vue +14 -19
- package/src/components/Form/FdsInput/types.ts +4 -0
- package/src/components/Form/FdsRadio/FdsRadio.stories.ts +1 -1
- package/src/components/Form/FdsRadio/FdsRadio.vue +6 -6
- package/src/components/Form/FdsRadio/types.ts +1 -0
- package/src/components/Form/FdsSelect/FdsSelect.stories.ts +4 -4
- package/src/components/Form/FdsSelect/FdsSelect.vue +5 -1
- package/src/components/Form/FdsTextarea/FdsTextarea.stories.ts +2 -2
- package/src/components/Table/FdsTable/FdsTable.stories.ts +3 -3
- package/src/components/Table/FdsTableHead/FdsTableHead.stories.ts +6 -6
- package/src/components/Table/FdsTableHead/FdsTableHead.vue +9 -15
- package/src/components/Table/FdsTableHead/types.ts +1 -0
- package/src/components/Tabs/FdsTabs/FdsTabs.stories.ts +9 -9
- package/src/components/Tabs/FdsTabs/FdsTabs.vue +5 -1
- package/src/components/Tabs/FdsTabsItem/FdsTabsItem.vue +26 -2
- package/src/components/Tabs/FdsTabsItem/types.ts +2 -0
- package/src/components/Typography/FdsText/FdsText.stories.ts +14 -14
- package/src/components/Typography/FdsText/FdsText.vue +18 -2
- package/src/components/Typography/FdsText/types.ts +1 -0
- package/src/index.ts +1 -1
- package/src/.DS_Store +0 -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'
|
|
@@ -11,6 +11,7 @@ defineOptions({
|
|
|
11
11
|
const attrs = useAttrs()
|
|
12
12
|
|
|
13
13
|
const props = withDefaults(defineProps<FdsInteractionBlockProps>(), {
|
|
14
|
+
id: undefined,
|
|
14
15
|
arrow: false,
|
|
15
16
|
disabled: false,
|
|
16
17
|
download: undefined,
|
|
@@ -19,6 +20,7 @@ const props = withDefaults(defineProps<FdsInteractionBlockProps>(), {
|
|
|
19
20
|
rel: undefined,
|
|
20
21
|
icon: undefined,
|
|
21
22
|
interactive: true,
|
|
23
|
+
dataTestid: undefined,
|
|
22
24
|
as: 'router-link',
|
|
23
25
|
})
|
|
24
26
|
|
|
@@ -29,6 +31,9 @@ const emit = defineEmits<{
|
|
|
29
31
|
(e: 'click', event: Event): void
|
|
30
32
|
}>()
|
|
31
33
|
|
|
34
|
+
const autoId = `fds-block-link-${Math.random().toString(36).slice(2, 9)}`
|
|
35
|
+
const blockLinkId = computed(() => props.id ?? autoId)
|
|
36
|
+
|
|
32
37
|
const innerClasses = computed(() => [
|
|
33
38
|
props.disabled ? 'cursor-not-allowed shadow-none hover:border-transparent active:bg-transparent' : 'cursor-pointer',
|
|
34
39
|
!props.interactive && 'cursor-auto',
|
|
@@ -77,18 +82,25 @@ const linkAttrs = computed(() => {
|
|
|
77
82
|
const componentAttrs = computed(() => ({
|
|
78
83
|
...linkAttrs.value,
|
|
79
84
|
...attrs,
|
|
85
|
+
'data-testid': props.dataTestid,
|
|
80
86
|
}))
|
|
81
87
|
|
|
82
88
|
const componentType = computed(() => {
|
|
83
89
|
if (props.as) return props.as
|
|
84
90
|
return props.href ? 'a' : 'button'
|
|
85
91
|
})
|
|
92
|
+
|
|
93
|
+
defineSlots<{
|
|
94
|
+
default?: Slot
|
|
95
|
+
sticker?: Slot
|
|
96
|
+
}>()
|
|
86
97
|
</script>
|
|
87
98
|
|
|
88
99
|
<template>
|
|
89
100
|
<component
|
|
90
101
|
:is="componentType"
|
|
91
102
|
v-bind="componentAttrs"
|
|
103
|
+
:id="blockLinkId"
|
|
92
104
|
class="box-border appearance-none text-left w-full flex items-start bg-white p-[calc(1rem-2px)] mb-3 text-blue-600 shadow-lg shadow-blue-200 rounded-2xl no-underline border-2 border-transparent transition-all duration-200 hover:border-blue-600 hover:border-2 active:border-transparent active:shadow-none active:bg-blue_t-100 focus-visible:border-blue-500 focus-visible:border-dashed focus-visible:outline-0"
|
|
93
105
|
:class="innerClasses"
|
|
94
106
|
:target="componentType === 'a' ? target : undefined"
|
|
@@ -2,6 +2,7 @@ import type { FdsIconName } from '../../FdsIcon/types'
|
|
|
2
2
|
|
|
3
3
|
export interface FdsInteractionBlockProps {
|
|
4
4
|
label: string
|
|
5
|
+
id?: string
|
|
5
6
|
arrow?: boolean
|
|
6
7
|
disabled?: boolean
|
|
7
8
|
download?: string
|
|
@@ -10,5 +11,6 @@ export interface FdsInteractionBlockProps {
|
|
|
10
11
|
rel?: string
|
|
11
12
|
icon?: FdsIconName
|
|
12
13
|
interactive?: boolean
|
|
14
|
+
dataTestid?: string
|
|
13
15
|
as?: 'button' | 'a' | 'router-link'
|
|
14
16
|
}
|
|
@@ -15,4 +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
|
|
22
|
+
onClick?: ((ev: MouseEvent) => void) | Array<(ev: MouseEvent) => void>
|
|
18
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,24 +1,13 @@
|
|
|
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
|
-
import type {
|
|
4
|
+
import type { FdsButtonDownloadProps } from './types'
|
|
5
5
|
|
|
6
6
|
defineOptions({
|
|
7
7
|
inheritAttrs: false,
|
|
8
8
|
})
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
token: string
|
|
12
|
-
accept?: string
|
|
13
|
-
headerAuthKey?: string
|
|
14
|
-
headerAuthValuePrefix?: string
|
|
15
|
-
errorHandler?: (error: unknown) => void
|
|
16
|
-
onFinishCallback?: () => void
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
type FdsButtonDownloadProps = Omit<FdsButtonBaseProps, 'as' | 'icon'> & {
|
|
20
|
-
downloadOptions?: DownloadOptions
|
|
21
|
-
}
|
|
10
|
+
const attrs = useAttrs()
|
|
22
11
|
|
|
23
12
|
const props = withDefaults(defineProps<FdsButtonDownloadProps>(), {
|
|
24
13
|
loading: false,
|
|
@@ -26,6 +15,9 @@ const props = withDefaults(defineProps<FdsButtonDownloadProps>(), {
|
|
|
26
15
|
iconPos: 'left',
|
|
27
16
|
href: undefined,
|
|
28
17
|
downloadOptions: undefined,
|
|
18
|
+
text: '',
|
|
19
|
+
ariaLabel: undefined,
|
|
20
|
+
dataTestid: undefined,
|
|
29
21
|
})
|
|
30
22
|
|
|
31
23
|
const emit = defineEmits<{
|
|
@@ -62,6 +54,12 @@ const buttonClasses = computed(() => [
|
|
|
62
54
|
|
|
63
55
|
const iconFillClass = computed(() => (isDownloading.value ? 'fill-gray-500' : 'fill-blue-500'))
|
|
64
56
|
|
|
57
|
+
const buttonAttrs = computed(() => ({
|
|
58
|
+
...attrs,
|
|
59
|
+
'data-testid': props.dataTestid,
|
|
60
|
+
'aria-label': props.ariaLabel,
|
|
61
|
+
}))
|
|
62
|
+
|
|
65
63
|
async function handleDownload(ev: MouseEvent) {
|
|
66
64
|
if (props.disabled || props.loading || isDownloading.value) {
|
|
67
65
|
ev.preventDefault()
|
|
@@ -146,7 +144,7 @@ async function handleDownload(ev: MouseEvent) {
|
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
|
|
149
|
-
|
|
147
|
+
const onClick = (ev: MouseEvent) => {
|
|
150
148
|
if (props.downloadOptions) {
|
|
151
149
|
handleDownload(ev)
|
|
152
150
|
} else {
|
|
@@ -162,7 +160,7 @@ function onClick(ev: MouseEvent) {
|
|
|
162
160
|
<template>
|
|
163
161
|
<div :class="rootClasses" :aria-disabled="disabled ? 'true' : undefined">
|
|
164
162
|
<button
|
|
165
|
-
v-bind="
|
|
163
|
+
v-bind="buttonAttrs"
|
|
166
164
|
:class="buttonClasses"
|
|
167
165
|
:disabled="disabled || loading || isDownloading"
|
|
168
166
|
type="button"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type IconPos = 'left' | 'right'
|
|
2
|
+
|
|
3
|
+
export interface FdsButtonDownloadProps {
|
|
4
|
+
loading?: boolean
|
|
5
|
+
disabled?: boolean
|
|
6
|
+
iconPos?: IconPos
|
|
7
|
+
href?: string
|
|
8
|
+
downloadOptions?: DownloadOptions | undefined
|
|
9
|
+
text: string
|
|
10
|
+
ariaLabel?: string
|
|
11
|
+
dataTestid?: string
|
|
12
|
+
onClick?: ((ev: MouseEvent) => void) | Array<(ev: MouseEvent) => void>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface DownloadOptions {
|
|
16
|
+
token: string
|
|
17
|
+
accept?: string
|
|
18
|
+
headerAuthKey?: string
|
|
19
|
+
headerAuthValuePrefix?: string
|
|
20
|
+
errorHandler?: (error: unknown) => void
|
|
21
|
+
onFinishCallback?: () => void
|
|
22
|
+
}
|
|
@@ -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" />',
|
|
@@ -23,7 +23,7 @@ const buttonClasses = computed(() => [
|
|
|
23
23
|
props.disabled ? 'opacity-20 cursor-not-allowed' : 'cursor-pointer',
|
|
24
24
|
])
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
const onClick = (ev: MouseEvent) => {
|
|
27
27
|
if (props.disabled || props.loading) {
|
|
28
28
|
ev.preventDefault()
|
|
29
29
|
return
|
|
@@ -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<{
|
|
@@ -64,7 +67,7 @@ const buttonClasses = computed(() => [
|
|
|
64
67
|
|
|
65
68
|
const iconFillClass = computed(() => (props.invert ? 'fill-white' : 'fill-blue-500'))
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
const onClick = (ev: MouseEvent) => {
|
|
68
71
|
if (props.disabled || props.loading) {
|
|
69
72
|
ev.preventDefault()
|
|
70
73
|
return
|
|
@@ -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:
|
|
@@ -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" />',
|
|
@@ -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)
|