fds-vue-core 2.1.9 → 2.1.11
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 +249 -226
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.es.js +249 -226
- package/dist/fds-vue-core.es.js.map +1 -1
- package/package.json +4 -2
- package/src/components/Blocks/FdsBlockLink/FdsBlockLink.vue +7 -0
- package/src/components/Blocks/FdsBlockLink/types.ts +2 -0
- package/src/components/Buttons/ButtonBaseProps.ts +1 -0
- package/src/components/Buttons/FdsButtonCopy/types.ts +1 -0
- package/src/components/Buttons/FdsButtonDownload/FdsButtonDownload.vue +3 -15
- package/src/components/Buttons/FdsButtonDownload/types.ts +20 -0
- package/src/components/Buttons/FdsButtonIcon/FdsButtonIcon.vue +1 -1
- package/src/components/Buttons/FdsButtonIcon/types.ts +1 -0
- package/src/components/Buttons/FdsButtonMinor/FdsButtonMinor.vue +1 -1
- package/src/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.vue +5 -0
- package/src/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.vue +1 -1
- package/src/components/FdsModal/types.ts +1 -0
- package/src/components/FdsPagination/types.ts +3 -0
- package/src/components/FdsSearchSelect/FdsSearchSelect.vue +7 -30
- package/src/components/FdsSearchSelect/types.ts +7 -0
- package/src/components/FdsTreeView/types.ts +4 -1
- package/src/components/Form/FdsCheckbox/types.ts +2 -0
- package/src/components/Form/FdsInput/types.ts +4 -0
- package/src/components/Form/FdsRadio/types.ts +1 -0
- package/src/index.ts +1 -1
- package/src/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fds-vue-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.11",
|
|
4
4
|
"description": "FDS Vue Core Component Library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/fds-vue-core.cjs.js",
|
|
@@ -57,7 +57,9 @@
|
|
|
57
57
|
"storybook": "STORYBOOK=true storybook dev -p 6006",
|
|
58
58
|
"build-storybook": "STORYBOOK=true storybook build",
|
|
59
59
|
"sync:peers": "node scripts/sync-peers-from-dev.mjs",
|
|
60
|
-
"postinstall": "test -f scripts/sync-peers-from-dev.mjs && node scripts/sync-peers-from-dev.mjs || true"
|
|
60
|
+
"postinstall": "test -f scripts/sync-peers-from-dev.mjs && node scripts/sync-peers-from-dev.mjs || true",
|
|
61
|
+
"yalc:publish": "npm run build && yalc publish",
|
|
62
|
+
"yalc:push": "npm run build && yalc push"
|
|
61
63
|
},
|
|
62
64
|
"peerDependencies": {
|
|
63
65
|
"vue": "^3.5.25"
|
|
@@ -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',
|
|
@@ -89,6 +94,7 @@ const componentType = computed(() => {
|
|
|
89
94
|
<component
|
|
90
95
|
:is="componentType"
|
|
91
96
|
v-bind="componentAttrs"
|
|
97
|
+
:id="blockLinkId"
|
|
92
98
|
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
99
|
:class="innerClasses"
|
|
94
100
|
:target="componentType === 'a' ? target : undefined"
|
|
@@ -98,6 +104,7 @@ const componentType = computed(() => {
|
|
|
98
104
|
:aria-disabled="disabled"
|
|
99
105
|
@click="handleClick"
|
|
100
106
|
@keydown="handleKeydown"
|
|
107
|
+
:data-testid="dataTestid"
|
|
101
108
|
>
|
|
102
109
|
<div class="flex w-full flex-1" :class="contentClasses">
|
|
103
110
|
<FdsIcon
|
|
@@ -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
|
}
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref } 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
|
-
interface DownloadOptions {
|
|
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
|
-
}
|
|
22
|
-
|
|
23
10
|
const props = withDefaults(defineProps<FdsButtonDownloadProps>(), {
|
|
24
11
|
loading: false,
|
|
25
12
|
disabled: false,
|
|
26
13
|
iconPos: 'left',
|
|
27
14
|
href: undefined,
|
|
28
15
|
downloadOptions: undefined,
|
|
16
|
+
text: '',
|
|
29
17
|
})
|
|
30
18
|
|
|
31
19
|
const emit = defineEmits<{
|
|
@@ -146,7 +134,7 @@ async function handleDownload(ev: MouseEvent) {
|
|
|
146
134
|
}
|
|
147
135
|
}
|
|
148
136
|
|
|
149
|
-
|
|
137
|
+
const onClick = (ev: MouseEvent) => {
|
|
150
138
|
if (props.downloadOptions) {
|
|
151
139
|
handleDownload(ev)
|
|
152
140
|
} else {
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
onClick?: ((ev: MouseEvent) => void) | Array<(ev: MouseEvent) => void>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface DownloadOptions {
|
|
14
|
+
token: string
|
|
15
|
+
accept?: string
|
|
16
|
+
headerAuthKey?: string
|
|
17
|
+
headerAuthValuePrefix?: string
|
|
18
|
+
errorHandler?: (error: unknown) => void
|
|
19
|
+
onFinishCallback?: () => void
|
|
20
|
+
}
|
|
@@ -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
|
|
@@ -64,7 +64,7 @@ const buttonClasses = computed(() => [
|
|
|
64
64
|
|
|
65
65
|
const iconFillClass = computed(() => (props.invert ? 'fill-white' : 'fill-blue-500'))
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
const onClick = (ev: MouseEvent) => {
|
|
68
68
|
if (props.disabled || props.loading) {
|
|
69
69
|
ev.preventDefault()
|
|
70
70
|
return
|
|
@@ -60,6 +60,11 @@ 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
|
+
}
|
|
63
68
|
emit('click', ev)
|
|
64
69
|
}
|
|
65
70
|
|
|
@@ -479,15 +479,9 @@ onBeforeUnmount(() => {
|
|
|
479
479
|
</script>
|
|
480
480
|
|
|
481
481
|
<template>
|
|
482
|
-
<div
|
|
483
|
-
ref="componentRef"
|
|
484
|
-
class="fds-search-select block mb-6"
|
|
485
|
-
>
|
|
482
|
+
<div ref="componentRef" class="fds-search-select block mb-6">
|
|
486
483
|
<div class="relative block">
|
|
487
|
-
<div
|
|
488
|
-
v-if="!singleItemName.length"
|
|
489
|
-
class="relative"
|
|
490
|
-
>
|
|
484
|
+
<div v-if="!singleItemName.length" class="relative">
|
|
491
485
|
<div class="relative">
|
|
492
486
|
<FdsInput
|
|
493
487
|
:label="label"
|
|
@@ -530,14 +524,8 @@ onBeforeUnmount(() => {
|
|
|
530
524
|
aria-controls="select-dropdown"
|
|
531
525
|
>
|
|
532
526
|
<!-- Loading -->
|
|
533
|
-
<div
|
|
534
|
-
|
|
535
|
-
class="flex justify-center p-4"
|
|
536
|
-
>
|
|
537
|
-
<FdsSpinner
|
|
538
|
-
color="blue"
|
|
539
|
-
size="48px"
|
|
540
|
-
/>
|
|
527
|
+
<div v-if="loading" class="flex justify-center p-4">
|
|
528
|
+
<FdsSpinner color="blue" size="48px" />
|
|
541
529
|
</div>
|
|
542
530
|
|
|
543
531
|
<!-- Results -->
|
|
@@ -550,20 +538,12 @@ onBeforeUnmount(() => {
|
|
|
550
538
|
{{ displayedItems.length }} {{ searchContext.linkWord }} {{ totalCount }}
|
|
551
539
|
{{ searchContext.context }}
|
|
552
540
|
</div>
|
|
553
|
-
<div
|
|
554
|
-
v-else-if="!searchTerm.length"
|
|
555
|
-
class="block m-0 font-light p-4 border-b border-gray-200 rounded-t-md"
|
|
556
|
-
>
|
|
541
|
+
<div v-else-if="!searchTerm.length" class="block m-0 font-light p-4 border-b border-gray-200 rounded-t-md">
|
|
557
542
|
{{ totalCount }} {{ searchContext.context }}
|
|
558
543
|
</div>
|
|
559
544
|
|
|
560
545
|
<!-- List -->
|
|
561
|
-
<ul
|
|
562
|
-
class="block m-0 list-none p-0"
|
|
563
|
-
role="listbox"
|
|
564
|
-
id="select-dropdown"
|
|
565
|
-
@keydown="handleListKeyDown"
|
|
566
|
-
>
|
|
546
|
+
<ul class="block m-0 list-none p-0" role="listbox" id="select-dropdown" @keydown="handleListKeyDown">
|
|
567
547
|
<li
|
|
568
548
|
v-for="(item, index) in displayedItems"
|
|
569
549
|
:key="index"
|
|
@@ -607,10 +587,7 @@ onBeforeUnmount(() => {
|
|
|
607
587
|
</template>
|
|
608
588
|
|
|
609
589
|
<!-- No Results -->
|
|
610
|
-
<ul
|
|
611
|
-
v-else-if="!loading"
|
|
612
|
-
class="block m-0 list-none p-0"
|
|
613
|
-
>
|
|
590
|
+
<ul v-else-if="!loading" class="block m-0 list-none p-0">
|
|
614
591
|
<li class="p-4">
|
|
615
592
|
{{ noResultPrompt }}
|
|
616
593
|
</li>
|
|
@@ -22,4 +22,11 @@ export interface FdsSearchSelectProps {
|
|
|
22
22
|
maxListHeight?: number | string
|
|
23
23
|
locale?: 'sv' | 'en'
|
|
24
24
|
clearTrigger?: boolean
|
|
25
|
+
onChange?: ((value: string) => void) | Array<(value: string) => void>
|
|
26
|
+
onSearchSelected?:
|
|
27
|
+
| ((value: Record<string, unknown> | null) => void)
|
|
28
|
+
| Array<(value: Record<string, unknown> | null) => void>
|
|
29
|
+
| ((val: Record<string, unknown>) => void)
|
|
30
|
+
onPaginate?: ((value: number) => void) | Array<(value: number) => void>
|
|
31
|
+
onTotal?: ((value: number) => void) | Array<(value: number) => void>
|
|
25
32
|
}
|
|
@@ -115,7 +115,10 @@ export interface FdsTreeViewProps<T = Record<string, unknown>> {
|
|
|
115
115
|
titleTemplate?: string
|
|
116
116
|
|
|
117
117
|
/** Get the height of the search container */
|
|
118
|
-
|
|
118
|
+
onGetSearchContainerHeight?: number
|
|
119
|
+
|
|
120
|
+
/** Array of selected nodes */
|
|
121
|
+
selectedNodes?: FdsNodeShape<T>[]
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
/**
|
|
@@ -22,4 +22,8 @@ export interface FdsInputProps {
|
|
|
22
22
|
placeholderChar?: string
|
|
23
23
|
[key: string]: unknown
|
|
24
24
|
}
|
|
25
|
+
modelValue?: string
|
|
26
|
+
onClearInput?: () => void
|
|
27
|
+
onKeyup?: ((value: KeyboardEvent) => void) | Array<(value: KeyboardEvent) => void>
|
|
28
|
+
onInput?: ((value: string | (Event & { target: HTMLInputElement })) => void) | ((value: Event) => void)
|
|
25
29
|
}
|
|
@@ -6,6 +6,7 @@ export interface FdsRadioProps {
|
|
|
6
6
|
name?: string
|
|
7
7
|
id?: string
|
|
8
8
|
required?: boolean
|
|
9
|
+
modelValue?: string | number | Array<string | number>
|
|
9
10
|
onKeydown?: ((event: KeyboardEvent) => void) | Array<(event: KeyboardEvent) => void>
|
|
10
11
|
onBlur?: ((event: FocusEvent) => void) | Array<(event: FocusEvent) => void>
|
|
11
12
|
onChange?: ((event: Event) => void) | Array<(event: Event) => void>
|
package/src/index.ts
CHANGED
|
@@ -129,6 +129,7 @@ export type { FdsNodeShape, FdsTreeNode, FdsTreeViewProps, FdsTreeViewStyles } f
|
|
|
129
129
|
// Button component types
|
|
130
130
|
export type { FdsButtonBaseProps } from './components/Buttons/ButtonBaseProps'
|
|
131
131
|
export type { FdsCopyButtonProps } from './components/Buttons/FdsButtonCopy/types'
|
|
132
|
+
export type { DownloadOptions, FdsButtonDownloadProps } from './components/Buttons/FdsButtonDownload/types'
|
|
132
133
|
export type { FdsIconButtonProps } from './components/Buttons/FdsButtonIcon/types'
|
|
133
134
|
|
|
134
135
|
// Button components that use FdsButtonBaseProps
|
|
@@ -136,7 +137,6 @@ import type { FdsButtonBaseProps } from './components/Buttons/ButtonBaseProps'
|
|
|
136
137
|
export type FdsButtonPrimaryProps = FdsButtonBaseProps
|
|
137
138
|
export type FdsButtonSecondaryProps = FdsButtonBaseProps
|
|
138
139
|
export type FdsButtonMinorProps = FdsButtonBaseProps
|
|
139
|
-
export type FdsButtonDownloadProps = FdsButtonBaseProps
|
|
140
140
|
|
|
141
141
|
// Form component types
|
|
142
142
|
export type { FdsCheckboxProps } from './components/Form/FdsCheckbox/types'
|
package/src/.DS_Store
DELETED
|
Binary file
|