@synergy-design-system/vue 2.0.0 → 2.2.0
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/README.md +7 -0
- package/dist/components/SynVueTab.vue.d.ts +63 -0
- package/dist/components/SynVueTabGroup.vue.d.ts +78 -0
- package/dist/components/SynVueTabPanel.vue.d.ts +40 -0
- package/dist/index.d.ts +3 -0
- package/package.json +5 -2
- package/src/components/SynVueTab.vue +92 -0
- package/src/components/SynVueTabGroup.vue +121 -0
- package/src/components/SynVueTabPanel.vue +69 -0
- package/src/index.js +3 -0
package/README.md
CHANGED
|
@@ -18,6 +18,9 @@ Run the following steps to install the required packages.
|
|
|
18
18
|
# Install the base library and required css files
|
|
19
19
|
npm install --save @synergy-design-system/vue @synergy-design-system/tokens
|
|
20
20
|
|
|
21
|
+
# Optional: Install the styles utility package
|
|
22
|
+
npm install --save @synergy-design-system/styles
|
|
23
|
+
|
|
21
24
|
# Optional: if icons shall be used, install the assets package
|
|
22
25
|
npm install --save @synergy-design-system/assets
|
|
23
26
|
```
|
|
@@ -33,6 +36,10 @@ The components will not display correctly without the needed theme. Please inclu
|
|
|
33
36
|
// src/main.ts
|
|
34
37
|
// Add this line to enable the light theme for your application
|
|
35
38
|
import "@synergy-design-system/tokens/themes/light.css";
|
|
39
|
+
import "@synergy-design-system/components/index.css";
|
|
40
|
+
|
|
41
|
+
// Optional: Import the styles package
|
|
42
|
+
import "@synergy-design-system/styles/index.css";
|
|
36
43
|
|
|
37
44
|
import { createApp } from "vue";
|
|
38
45
|
import App from "./App.vue";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import '@synergy-design-system/components/components/tab/tab.js';
|
|
2
|
+
import type { SynCloseEvent, SynTab } from '@synergy-design-system/components';
|
|
3
|
+
export type { SynCloseEvent } from '@synergy-design-system/components';
|
|
4
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
5
|
+
/**
|
|
6
|
+
* The name of the tab panel this tab is associated with.
|
|
7
|
+
* The panel must be located in the same tab group.
|
|
8
|
+
*/
|
|
9
|
+
panel?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Draws the tab in an active state.
|
|
12
|
+
*/
|
|
13
|
+
active?: boolean | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Makes the tab closable and shows a close button.
|
|
16
|
+
*/
|
|
17
|
+
closable?: boolean | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Disables the tab and prevents selection.
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
nativeElement: import("vue").Ref<SynTab | undefined>;
|
|
24
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
"syn-close": (e: SynCloseEvent) => void;
|
|
26
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
27
|
+
/**
|
|
28
|
+
* The name of the tab panel this tab is associated with.
|
|
29
|
+
* The panel must be located in the same tab group.
|
|
30
|
+
*/
|
|
31
|
+
panel?: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Draws the tab in an active state.
|
|
34
|
+
*/
|
|
35
|
+
active?: boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Makes the tab closable and shows a close button.
|
|
38
|
+
*/
|
|
39
|
+
closable?: boolean | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Disables the tab and prevents selection.
|
|
42
|
+
*/
|
|
43
|
+
disabled?: boolean | undefined;
|
|
44
|
+
}>>> & {
|
|
45
|
+
"onSyn-close"?: ((e: SynCloseEvent) => any) | undefined;
|
|
46
|
+
}, {}, {}>, {
|
|
47
|
+
default?(_: {}): any;
|
|
48
|
+
}>;
|
|
49
|
+
export default _default;
|
|
50
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
51
|
+
new (): {
|
|
52
|
+
$slots: S;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
56
|
+
type __VLS_TypePropsToOption<T> = {
|
|
57
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
58
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
59
|
+
} : {
|
|
60
|
+
type: import('vue').PropType<T[K]>;
|
|
61
|
+
required: true;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import '@synergy-design-system/components/components/tab-group/tab-group.js';
|
|
2
|
+
import type { SynTabGroup, SynTabHideEvent, SynTabShowEvent } from '@synergy-design-system/components';
|
|
3
|
+
export type { SynTabShowEvent } from '@synergy-design-system/components';
|
|
4
|
+
export type { SynTabHideEvent } from '@synergy-design-system/components';
|
|
5
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
6
|
+
/**
|
|
7
|
+
* The placement of the tabs.
|
|
8
|
+
*/
|
|
9
|
+
placement?: "top" | "end" | "start" | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* When set to auto, navigating tabs with the arrow keys will instantly show the corresponding tab panel.
|
|
12
|
+
* When set to
|
|
13
|
+
manual, the tab will receive focus but will not show until the user presses spacebar or enter.
|
|
14
|
+
*/
|
|
15
|
+
activation?: "auto" | "manual" | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Disables the scroll arrows that appear when tabs overflow.
|
|
18
|
+
*/
|
|
19
|
+
noScrollControls?: boolean | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Draws the tab group as a contained element.
|
|
22
|
+
*/
|
|
23
|
+
contained?: boolean | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Draws the tab group with edges instead of roundings.
|
|
26
|
+
* Takes only effect if used with the 'contained' property
|
|
27
|
+
*/
|
|
28
|
+
sharp?: boolean | undefined;
|
|
29
|
+
}>, {
|
|
30
|
+
nativeElement: import("vue").Ref<SynTabGroup | undefined>;
|
|
31
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
32
|
+
"syn-tab-show": (e: SynTabShowEvent) => void;
|
|
33
|
+
"syn-tab-hide": (e: SynTabHideEvent) => void;
|
|
34
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
35
|
+
/**
|
|
36
|
+
* The placement of the tabs.
|
|
37
|
+
*/
|
|
38
|
+
placement?: "top" | "end" | "start" | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* When set to auto, navigating tabs with the arrow keys will instantly show the corresponding tab panel.
|
|
41
|
+
* When set to
|
|
42
|
+
manual, the tab will receive focus but will not show until the user presses spacebar or enter.
|
|
43
|
+
*/
|
|
44
|
+
activation?: "auto" | "manual" | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Disables the scroll arrows that appear when tabs overflow.
|
|
47
|
+
*/
|
|
48
|
+
noScrollControls?: boolean | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Draws the tab group as a contained element.
|
|
51
|
+
*/
|
|
52
|
+
contained?: boolean | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Draws the tab group with edges instead of roundings.
|
|
55
|
+
* Takes only effect if used with the 'contained' property
|
|
56
|
+
*/
|
|
57
|
+
sharp?: boolean | undefined;
|
|
58
|
+
}>>> & {
|
|
59
|
+
"onSyn-tab-show"?: ((e: SynTabShowEvent) => any) | undefined;
|
|
60
|
+
"onSyn-tab-hide"?: ((e: SynTabHideEvent) => any) | undefined;
|
|
61
|
+
}, {}, {}>, {
|
|
62
|
+
default?(_: {}): any;
|
|
63
|
+
}>;
|
|
64
|
+
export default _default;
|
|
65
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
66
|
+
new (): {
|
|
67
|
+
$slots: S;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
71
|
+
type __VLS_TypePropsToOption<T> = {
|
|
72
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
73
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
74
|
+
} : {
|
|
75
|
+
type: import('vue').PropType<T[K]>;
|
|
76
|
+
required: true;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import '@synergy-design-system/components/components/tab-panel/tab-panel.js';
|
|
2
|
+
import type { SynTabPanel } from '@synergy-design-system/components';
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
4
|
+
/**
|
|
5
|
+
* The tab panel's name.
|
|
6
|
+
*/
|
|
7
|
+
name?: string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* When true, the tab panel will be shown.
|
|
10
|
+
*/
|
|
11
|
+
active?: boolean | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
nativeElement: import("vue").Ref<SynTabPanel | undefined>;
|
|
14
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
15
|
+
/**
|
|
16
|
+
* The tab panel's name.
|
|
17
|
+
*/
|
|
18
|
+
name?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* When true, the tab panel will be shown.
|
|
21
|
+
*/
|
|
22
|
+
active?: boolean | undefined;
|
|
23
|
+
}>>>, {}, {}>, {
|
|
24
|
+
default?(_: {}): any;
|
|
25
|
+
}>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
33
|
+
type __VLS_TypePropsToOption<T> = {
|
|
34
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
35
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
36
|
+
} : {
|
|
37
|
+
type: import('vue').PropType<T[K]>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,9 @@ export { default as SynVueSelect } from "./components/SynVueSelect.vue";
|
|
|
31
31
|
export { default as SynVueSideNav } from "./components/SynVueSideNav.vue";
|
|
32
32
|
export { default as SynVueSpinner } from "./components/SynVueSpinner.vue";
|
|
33
33
|
export { default as SynVueSwitch } from "./components/SynVueSwitch.vue";
|
|
34
|
+
export { default as SynVueTab } from "./components/SynVueTab.vue";
|
|
35
|
+
export { default as SynVueTabGroup } from "./components/SynVueTabGroup.vue";
|
|
36
|
+
export { default as SynVueTabPanel } from "./components/SynVueTabPanel.vue";
|
|
34
37
|
export { default as SynVueTag } from "./components/SynVueTag.vue";
|
|
35
38
|
export { default as SynVueTextarea } from "./components/SynVueTextarea.vue";
|
|
36
39
|
export { default as SynVueTooltip } from "./components/SynVueTooltip.vue";
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://www.sick.com"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@synergy-design-system/components": "^2.
|
|
7
|
+
"@synergy-design-system/components": "^2.2.0"
|
|
8
8
|
},
|
|
9
9
|
"description": "Vue3 wrappers for the Synergy Design System",
|
|
10
10
|
"exports": {
|
|
@@ -40,9 +40,12 @@
|
|
|
40
40
|
"directory": "packages/vue"
|
|
41
41
|
},
|
|
42
42
|
"type": "module",
|
|
43
|
-
"version": "2.
|
|
43
|
+
"version": "2.2.0",
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@vue/tsconfig": "^0.5.1",
|
|
46
46
|
"vue": "^3.4.24"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@synergy-design-system/tokens": "^2.2.0"
|
|
47
50
|
}
|
|
48
51
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// ---------------------------------------------------------------------
|
|
3
|
+
// 🔒 AUTOGENERATED @synergy-design-system/vue wrappers for @synergy-design-system/components
|
|
4
|
+
// Please do not edit this file directly!
|
|
5
|
+
// It will get recreated when running pnpm build.
|
|
6
|
+
// ---------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @summary Tabs are used inside [tab groups](/components/tab-group) to represent and activate [tab panels](/components/tab-panel).
|
|
10
|
+
* @documentation https://synergy.style/components/tab
|
|
11
|
+
* @status stable
|
|
12
|
+
* @since 2.0
|
|
13
|
+
*
|
|
14
|
+
* @dependency syn-icon-button
|
|
15
|
+
*
|
|
16
|
+
* @slot - The tab's label.
|
|
17
|
+
*
|
|
18
|
+
* @event syn-close - Emitted when the tab is closable and the close button is activated.
|
|
19
|
+
*
|
|
20
|
+
* @csspart base - The component's base wrapper.
|
|
21
|
+
* @csspart close-button - The close button, an `<syn-icon-button>`.
|
|
22
|
+
* @csspart close-button__base - The close button's exported `base` part.
|
|
23
|
+
*/
|
|
24
|
+
import { computed, ref } from 'vue';
|
|
25
|
+
import '@synergy-design-system/components/components/tab/tab.js';
|
|
26
|
+
|
|
27
|
+
import type { SynCloseEvent, SynTab } from '@synergy-design-system/components';
|
|
28
|
+
|
|
29
|
+
// DOM Reference to the element
|
|
30
|
+
const nativeElement = ref<SynTab>();
|
|
31
|
+
|
|
32
|
+
defineExpose({
|
|
33
|
+
nativeElement,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Map attributes
|
|
37
|
+
const props = defineProps<{
|
|
38
|
+
/**
|
|
39
|
+
* The name of the tab panel this tab is associated with.
|
|
40
|
+
* The panel must be located in the same tab group.
|
|
41
|
+
*/
|
|
42
|
+
'panel'?: SynTab['panel'];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Draws the tab in an active state.
|
|
46
|
+
*/
|
|
47
|
+
'active'?: SynTab['active'];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Makes the tab closable and shows a close button.
|
|
51
|
+
*/
|
|
52
|
+
'closable'?: SynTab['closable'];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Disables the tab and prevents selection.
|
|
56
|
+
*/
|
|
57
|
+
'disabled'?: SynTab['disabled'];
|
|
58
|
+
}>();
|
|
59
|
+
|
|
60
|
+
// Make sure prop binding only forwards the props that are actually there.
|
|
61
|
+
// This is needed because :param="param" also adds an empty attribute
|
|
62
|
+
// when using web-components, which breaks optional arguments like size in SynInput
|
|
63
|
+
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
64
|
+
const visibleProps = computed(() => Object.fromEntries(
|
|
65
|
+
Object
|
|
66
|
+
.entries(props)
|
|
67
|
+
.filter(([, value]) => typeof value !== 'undefined'),
|
|
68
|
+
));
|
|
69
|
+
|
|
70
|
+
// Map events
|
|
71
|
+
defineEmits<{
|
|
72
|
+
/**
|
|
73
|
+
* Emitted when the tab is closable and the close button is activated.
|
|
74
|
+
*/
|
|
75
|
+
'syn-close': [e: SynCloseEvent];
|
|
76
|
+
}>();
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<script lang="ts">
|
|
80
|
+
export type { SynCloseEvent } from '@synergy-design-system/components';
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<template>
|
|
84
|
+
<syn-tab
|
|
85
|
+
v-bind="visibleProps"
|
|
86
|
+
|
|
87
|
+
ref="nativeElement"
|
|
88
|
+
@syn-close="$emit('syn-close', $event)"
|
|
89
|
+
>
|
|
90
|
+
<slot />
|
|
91
|
+
</syn-tab>
|
|
92
|
+
</template>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// ---------------------------------------------------------------------
|
|
3
|
+
// 🔒 AUTOGENERATED @synergy-design-system/vue wrappers for @synergy-design-system/components
|
|
4
|
+
// Please do not edit this file directly!
|
|
5
|
+
// It will get recreated when running pnpm build.
|
|
6
|
+
// ---------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @summary Tab groups organize content into a container that shows one section at a time.
|
|
10
|
+
* @documentation https://synergy.style/components/tab-group
|
|
11
|
+
* @status stable
|
|
12
|
+
* @since 2.0
|
|
13
|
+
*
|
|
14
|
+
* @dependency syn-icon-button
|
|
15
|
+
*
|
|
16
|
+
* @slot - Used for grouping tab panels in the tab group. Must be `<syn-tab-panel>` elements.
|
|
17
|
+
* @slot nav - Used for grouping tabs in the tab group. Must be `<syn-tab>` elements.
|
|
18
|
+
*
|
|
19
|
+
* @event {{ name: String }} syn-tab-show - Emitted when a tab is shown. The payload of the event returns the "panel" attribute of the shown tab.
|
|
20
|
+
* @event {{ name: String }} syn-tab-hide - Emitted when a tab is hidden. The payload of the event returns the "panel" attribute of the hidden tab.
|
|
21
|
+
*
|
|
22
|
+
* @csspart base - The component's base wrapper.
|
|
23
|
+
* @csspart nav - The tab group's navigation container where tabs are slotted in.
|
|
24
|
+
* @csspart tabs - The container that wraps the tabs.
|
|
25
|
+
* @csspart active-tab-indicator - The line that highlights the currently selected tab.
|
|
26
|
+
* @csspart body - The tab group's body where tab panels are slotted in.
|
|
27
|
+
* @csspart scroll-button - The previous/next scroll buttons that show when tabs are scrollable, an `<syn-icon-button>`.
|
|
28
|
+
* @csspart scroll-button--start - The starting scroll button.
|
|
29
|
+
* @csspart scroll-button--end - The ending scroll button.
|
|
30
|
+
* @csspart scroll-button__base - The scroll button's exported `base` part.
|
|
31
|
+
*
|
|
32
|
+
* @cssproperty --indicator-color - The color of the active tab indicator.
|
|
33
|
+
* @cssproperty --indicator-width - The width of the active tab indicator.
|
|
34
|
+
* @cssproperty --track-color - The color of the indicator's track (the line that separates tabs from panels).
|
|
35
|
+
* @cssproperty --track-width - The width of the indicator's track (the line that separates tabs from panels).
|
|
36
|
+
*/
|
|
37
|
+
import { computed, ref } from 'vue';
|
|
38
|
+
import '@synergy-design-system/components/components/tab-group/tab-group.js';
|
|
39
|
+
|
|
40
|
+
import type { SynTabGroup, SynTabHideEvent, SynTabShowEvent } from '@synergy-design-system/components';
|
|
41
|
+
|
|
42
|
+
// DOM Reference to the element
|
|
43
|
+
const nativeElement = ref<SynTabGroup>();
|
|
44
|
+
|
|
45
|
+
defineExpose({
|
|
46
|
+
nativeElement,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Map attributes
|
|
50
|
+
const props = defineProps<{
|
|
51
|
+
/**
|
|
52
|
+
* The placement of the tabs.
|
|
53
|
+
*/
|
|
54
|
+
'placement'?: SynTabGroup['placement'];
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* When set to auto, navigating tabs with the arrow keys will instantly show the corresponding tab panel.
|
|
58
|
+
* When set to
|
|
59
|
+
manual, the tab will receive focus but will not show until the user presses spacebar or enter.
|
|
60
|
+
*/
|
|
61
|
+
'activation'?: SynTabGroup['activation'];
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Disables the scroll arrows that appear when tabs overflow.
|
|
65
|
+
*/
|
|
66
|
+
'noScrollControls'?: SynTabGroup['noScrollControls'];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Draws the tab group as a contained element.
|
|
70
|
+
*/
|
|
71
|
+
'contained'?: SynTabGroup['contained'];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Draws the tab group with edges instead of roundings.
|
|
75
|
+
* Takes only effect if used with the 'contained' property
|
|
76
|
+
*/
|
|
77
|
+
'sharp'?: SynTabGroup['sharp'];
|
|
78
|
+
}>();
|
|
79
|
+
|
|
80
|
+
// Make sure prop binding only forwards the props that are actually there.
|
|
81
|
+
// This is needed because :param="param" also adds an empty attribute
|
|
82
|
+
// when using web-components, which breaks optional arguments like size in SynInput
|
|
83
|
+
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
84
|
+
const visibleProps = computed(() => Object.fromEntries(
|
|
85
|
+
Object
|
|
86
|
+
.entries(props)
|
|
87
|
+
.filter(([, value]) => typeof value !== 'undefined'),
|
|
88
|
+
));
|
|
89
|
+
|
|
90
|
+
// Map events
|
|
91
|
+
defineEmits<{
|
|
92
|
+
/**
|
|
93
|
+
* Emitted when a tab is shown.
|
|
94
|
+
* The payload of the event returns the "panel" attribute of the shown tab.
|
|
95
|
+
*/
|
|
96
|
+
'syn-tab-show': [e: SynTabShowEvent];
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Emitted when a tab is hidden.
|
|
100
|
+
* The payload of the event returns the "panel" attribute of the hidden tab.
|
|
101
|
+
*/
|
|
102
|
+
'syn-tab-hide': [e: SynTabHideEvent];
|
|
103
|
+
}>();
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<script lang="ts">
|
|
107
|
+
export type { SynTabShowEvent } from '@synergy-design-system/components';
|
|
108
|
+
export type { SynTabHideEvent } from '@synergy-design-system/components';
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<template>
|
|
112
|
+
<syn-tab-group
|
|
113
|
+
v-bind="visibleProps"
|
|
114
|
+
ref="nativeElement"
|
|
115
|
+
|
|
116
|
+
@syn-tab-show="$emit('syn-tab-show', $event)"
|
|
117
|
+
@syn-tab-hide="$emit('syn-tab-hide', $event)"
|
|
118
|
+
>
|
|
119
|
+
<slot />
|
|
120
|
+
</syn-tab-group>
|
|
121
|
+
</template>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// ---------------------------------------------------------------------
|
|
3
|
+
// 🔒 AUTOGENERATED @synergy-design-system/vue wrappers for @synergy-design-system/components
|
|
4
|
+
// Please do not edit this file directly!
|
|
5
|
+
// It will get recreated when running pnpm build.
|
|
6
|
+
// ---------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @summary Tab panels are used inside [tab groups](/components/tab-group) to display tabbed content.
|
|
10
|
+
* @documentation https://synergy.style/components/tab-panel
|
|
11
|
+
* @status stable
|
|
12
|
+
* @since 2.0
|
|
13
|
+
*
|
|
14
|
+
* @slot - The tab panel's content.
|
|
15
|
+
*
|
|
16
|
+
* @csspart base - The component's base wrapper.
|
|
17
|
+
*
|
|
18
|
+
* @cssproperty --padding - The tab panel's padding.
|
|
19
|
+
*/
|
|
20
|
+
import { computed, ref } from 'vue';
|
|
21
|
+
import '@synergy-design-system/components/components/tab-panel/tab-panel.js';
|
|
22
|
+
|
|
23
|
+
import type { SynTabPanel } from '@synergy-design-system/components';
|
|
24
|
+
|
|
25
|
+
// DOM Reference to the element
|
|
26
|
+
const nativeElement = ref<SynTabPanel>();
|
|
27
|
+
|
|
28
|
+
defineExpose({
|
|
29
|
+
nativeElement,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Map attributes
|
|
33
|
+
const props = defineProps<{
|
|
34
|
+
/**
|
|
35
|
+
* The tab panel's name.
|
|
36
|
+
*/
|
|
37
|
+
'name'?: SynTabPanel['name'];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* When true, the tab panel will be shown.
|
|
41
|
+
*/
|
|
42
|
+
'active'?: SynTabPanel['active'];
|
|
43
|
+
}>();
|
|
44
|
+
|
|
45
|
+
// Make sure prop binding only forwards the props that are actually there.
|
|
46
|
+
// This is needed because :param="param" also adds an empty attribute
|
|
47
|
+
// when using web-components, which breaks optional arguments like size in SynInput
|
|
48
|
+
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
49
|
+
const visibleProps = computed(() => Object.fromEntries(
|
|
50
|
+
Object
|
|
51
|
+
.entries(props)
|
|
52
|
+
.filter(([, value]) => typeof value !== 'undefined'),
|
|
53
|
+
));
|
|
54
|
+
|
|
55
|
+
// Map events
|
|
56
|
+
defineEmits<{
|
|
57
|
+
|
|
58
|
+
}>();
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<syn-tab-panel
|
|
63
|
+
|
|
64
|
+
v-bind="visibleProps"
|
|
65
|
+
ref="nativeElement"
|
|
66
|
+
>
|
|
67
|
+
<slot />
|
|
68
|
+
</syn-tab-panel>
|
|
69
|
+
</template>
|
package/src/index.js
CHANGED
|
@@ -36,6 +36,9 @@ export { default as SynVueSelect } from './components/SynVueSelect.vue';
|
|
|
36
36
|
export { default as SynVueSideNav } from './components/SynVueSideNav.vue';
|
|
37
37
|
export { default as SynVueSpinner } from './components/SynVueSpinner.vue';
|
|
38
38
|
export { default as SynVueSwitch } from './components/SynVueSwitch.vue';
|
|
39
|
+
export { default as SynVueTab } from './components/SynVueTab.vue';
|
|
40
|
+
export { default as SynVueTabGroup } from './components/SynVueTabGroup.vue';
|
|
41
|
+
export { default as SynVueTabPanel } from './components/SynVueTabPanel.vue';
|
|
39
42
|
export { default as SynVueTag } from './components/SynVueTag.vue';
|
|
40
43
|
export { default as SynVueTextarea } from './components/SynVueTextarea.vue';
|
|
41
44
|
export { default as SynVueTooltip } from './components/SynVueTooltip.vue';
|