fds-vue-core 2.1.11 → 2.1.16

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 (59) hide show
  1. package/dist/fds-vue-core.cjs.js +372 -284
  2. package/dist/fds-vue-core.cjs.js.map +1 -1
  3. package/dist/fds-vue-core.es.js +373 -285
  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/Blocks/FdsBlockLink/types.ts +1 -0
  16. package/src/components/Buttons/ButtonBaseProps.ts +4 -0
  17. package/src/components/Buttons/FdsButtonCopy/FdsButtonCopy.stories.ts +1 -1
  18. package/src/components/Buttons/FdsButtonDownload/FdsButtonDownload.stories.ts +4 -4
  19. package/src/components/Buttons/FdsButtonDownload/FdsButtonDownload.vue +12 -2
  20. package/src/components/Buttons/FdsButtonDownload/types.ts +2 -0
  21. package/src/components/Buttons/FdsButtonIcon/FdsButtonIcon.stories.ts +2 -2
  22. package/src/components/Buttons/FdsButtonMinor/FdsButtonMinor.stories.ts +2 -2
  23. package/src/components/Buttons/FdsButtonMinor/FdsButtonMinor.vue +3 -0
  24. package/src/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.stories.ts +4 -4
  25. package/src/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.vue +0 -5
  26. package/src/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.stories.ts +2 -2
  27. package/src/components/FdsIcon/FdsIcon.stories.ts +1 -1
  28. package/src/components/FdsModal/FdsModal.stories.ts +7 -7
  29. package/src/components/FdsModal/FdsModal.vue +6 -1
  30. package/src/components/FdsPagination/FdsPagination.stories.ts +5 -5
  31. package/src/components/FdsSearchSelect/FdsSearchSelect.stories.ts +9 -9
  32. package/src/components/FdsSpinner/FdsSpinner.stories.ts +1 -1
  33. package/src/components/FdsSticker/FdsSticker.stories.ts +23 -20
  34. package/src/components/FdsSticker/FdsSticker.vue +8 -6
  35. package/src/components/FdsSticker/types.ts +1 -0
  36. package/src/components/FdsTreeView/FdsTreeView.stories.ts +1 -1
  37. package/src/components/FdsTruncatedText/FdsTruncatedText.stories.ts +4 -4
  38. package/src/components/FdsTruncatedText/FdsTruncatedText.vue +6 -7
  39. package/src/components/Form/FdsCheckbox/FdsCheckbox.stories.ts +4 -4
  40. package/src/components/Form/FdsCheckbox/FdsCheckbox.vue +6 -6
  41. package/src/components/Form/FdsInput/FdsInput.stories.ts +5 -5
  42. package/src/components/Form/FdsInput/FdsInput.vue +14 -19
  43. package/src/components/Form/FdsRadio/FdsRadio.stories.ts +1 -1
  44. package/src/components/Form/FdsRadio/FdsRadio.vue +19 -6
  45. package/src/components/Form/FdsRadio/types.ts +2 -0
  46. package/src/components/Form/FdsSelect/FdsSelect.stories.ts +4 -4
  47. package/src/components/Form/FdsSelect/FdsSelect.vue +5 -1
  48. package/src/components/Form/FdsTextarea/FdsTextarea.stories.ts +2 -2
  49. package/src/components/Table/FdsTable/FdsTable.stories.ts +3 -3
  50. package/src/components/Table/FdsTableHead/FdsTableHead.stories.ts +6 -6
  51. package/src/components/Table/FdsTableHead/FdsTableHead.vue +9 -15
  52. package/src/components/Table/FdsTableHead/types.ts +1 -0
  53. package/src/components/Tabs/FdsTabs/FdsTabs.stories.ts +9 -9
  54. package/src/components/Tabs/FdsTabs/FdsTabs.vue +5 -1
  55. package/src/components/Tabs/FdsTabsItem/FdsTabsItem.vue +28 -2
  56. package/src/components/Tabs/FdsTabsItem/types.ts +4 -0
  57. package/src/components/Typography/FdsText/FdsText.stories.ts +14 -14
  58. package/src/components/Typography/FdsText/FdsText.vue +18 -2
  59. package/src/components/Typography/FdsText/types.ts +1 -0
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, getCurrentInstance, inject, useAttrs } from 'vue'
2
+ import { computed, getCurrentInstance, inject, useAttrs, type Slot } from 'vue'
3
3
  import type { FdsTabsItemProps } from './types'
4
4
 
5
5
  defineOptions({
@@ -8,6 +8,24 @@ defineOptions({
8
8
 
9
9
  const attrs = useAttrs()
10
10
 
11
+ const emit = defineEmits<{
12
+ (e: 'click', ev: MouseEvent): void
13
+ }>()
14
+
15
+ const onClick = (ev: MouseEvent) => {
16
+ if (props.disabled) {
17
+ ev.preventDefault()
18
+ return
19
+ }
20
+ emit('click', ev)
21
+ }
22
+
23
+ const handleClick = (ev: MouseEvent) => {
24
+ if (componentType.value === 'button' && !props.disabled) {
25
+ onClick(ev)
26
+ }
27
+ }
28
+
11
29
  // Try to get route from vue-router if available
12
30
  const instance = getCurrentInstance()
13
31
  const route = computed(() => {
@@ -31,6 +49,7 @@ const props = withDefaults(defineProps<FdsTabsItemProps>(), {
31
49
  exact: false,
32
50
  disabled: false,
33
51
  label: undefined,
52
+ dataTestid: undefined,
34
53
  })
35
54
 
36
55
  const variant = inject<'primary' | 'secondary'>('tabsVariant', 'primary')
@@ -76,6 +95,7 @@ const linkAttrs = computed(() => {
76
95
  const componentAttrs = computed(() => ({
77
96
  ...linkAttrs.value,
78
97
  ...attrs,
98
+ 'data-testid': props.dataTestid,
79
99
  }))
80
100
 
81
101
  const baseClasses = computed(() => {
@@ -109,6 +129,10 @@ const variantClasses = computed(() => {
109
129
  const disabledClasses = computed(() => (props.disabled ? 'cursor-not-allowed pointer-events-none opacity-35' : ''))
110
130
 
111
131
  const buttonClasses = computed(() => [...baseClasses.value, ...variantClasses.value, disabledClasses.value])
132
+
133
+ defineSlots<{
134
+ default?: Slot
135
+ }>()
112
136
  </script>
113
137
 
114
138
  <template>
@@ -119,7 +143,9 @@ const buttonClasses = computed(() => [...baseClasses.value, ...variantClasses.va
119
143
  :disabled="componentType === 'button' ? disabled : undefined"
120
144
  :aria-disabled="disabled"
121
145
  :aria-current="isActive ? 'page' : undefined"
146
+ @click="handleClick"
122
147
  >
123
- <slot>{{ label }}</slot>
148
+ {{ label }}
149
+ <slot></slot>
124
150
  </component>
125
151
  </template>
@@ -13,4 +13,8 @@ export interface FdsTabsItemProps {
13
13
  disabled?: boolean
14
14
  /** Tab label text */
15
15
  label?: string
16
+ /** Click handler */
17
+ onClick?: ((ev: MouseEvent) => void) | Array<(ev: MouseEvent) => void>
18
+ /** Data test ID for testing */
19
+ dataTestid?: string
16
20
  }
@@ -1,10 +1,23 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
2
  import FdsText from './FdsText.vue'
3
3
 
4
+ const textTransform = (_src: string, storyContext: { args?: { type?: string } }) => {
5
+ const args = storyContext?.args || {}
6
+ const attrsStr = args.type && args.type !== 'default' ? ` type="${args.type}"` : ''
7
+ return `<FdsText${attrsStr}>Text content</FdsText>`
8
+ }
9
+
4
10
  const meta: Meta<typeof FdsText> = {
5
11
  title: 'FDS/Typography/FdsText',
6
12
  component: FdsText,
7
13
  tags: ['autodocs'],
14
+ parameters: {
15
+ docs: {
16
+ source: {
17
+ transform: textTransform,
18
+ },
19
+ },
20
+ },
8
21
  argTypes: {
9
22
  type: { control: { type: 'radio' }, options: ['default', 'lead', 'meta'] },
10
23
  },
@@ -16,25 +29,12 @@ const meta: Meta<typeof FdsText> = {
16
29
  export default meta
17
30
  type Story = StoryObj<typeof meta>
18
31
 
19
- const textTransform = (storyContext: { args?: { type?: string } }) => {
20
- const args = storyContext?.args || {}
21
- const attrsStr = args.type && args.type !== 'default' ? ` type="${args.type}"` : ''
22
- return `<FdsText${attrsStr}>Text content</FdsText>`
23
- }
24
-
25
32
  export const Default: Story = {
26
- render: (args) => ({
33
+ render: (args: Story['args']) => ({
27
34
  components: { FdsText },
28
35
  setup: () => ({ args }),
29
36
  template: `<FdsText :type="args.type">Text content</FdsText>`,
30
37
  }),
31
- parameters: {
32
- docs: {
33
- source: {
34
- transform: textTransform,
35
- },
36
- },
37
- },
38
38
  }
39
39
 
40
40
  export const Lead: Story = {
@@ -1,9 +1,16 @@
1
1
  <script setup lang="ts">
2
- import { computed } from 'vue'
2
+ import { computed, useAttrs, type Slot } from 'vue'
3
3
  import type { FdsTextProps } from './types'
4
4
 
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+
9
+ const attrs = useAttrs()
10
+
5
11
  const props = withDefaults(defineProps<FdsTextProps>(), {
6
12
  type: 'default',
13
+ dataTestid: undefined,
7
14
  })
8
15
 
9
16
  const textClasses = computed(() => {
@@ -19,10 +26,19 @@ const textClasses = computed(() => {
19
26
 
20
27
  return baseClasses
21
28
  })
29
+
30
+ const spanAttrs = computed(() => ({
31
+ ...attrs,
32
+ 'data-testid': props.dataTestid,
33
+ }))
34
+
35
+ defineSlots<{
36
+ default?: Slot
37
+ }>()
22
38
  </script>
23
39
 
24
40
  <template>
25
- <span :class="textClasses">
41
+ <span v-bind="spanAttrs" :class="textClasses">
26
42
  <slot />
27
43
  </span>
28
44
  </template>
@@ -1,3 +1,4 @@
1
1
  export interface FdsTextProps {
2
2
  type?: 'default' | 'lead' | 'meta'
3
+ dataTestid?: string
3
4
  }