@synergy-design-system/vue 1.22.0 → 1.23.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/dist/components/SynVueDialog.vue.d.ts +87 -0
- package/dist/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/SynVueDialog.vue +183 -0
- package/src/index.js +1 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import '@synergy-design-system/components/components/dialog/dialog.js';
|
|
2
|
+
import type { SynAfterHideEvent, SynAfterShowEvent, SynHideEvent, SynInitialFocusEvent, SynRequestCloseEvent, SynShowEvent } from '@synergy-design-system/components';
|
|
3
|
+
export type { SynShowEvent } from '@synergy-design-system/components';
|
|
4
|
+
export type { SynAfterShowEvent } from '@synergy-design-system/components';
|
|
5
|
+
export type { SynHideEvent } from '@synergy-design-system/components';
|
|
6
|
+
export type { SynAfterHideEvent } from '@synergy-design-system/components';
|
|
7
|
+
export type { SynInitialFocusEvent } from '@synergy-design-system/components';
|
|
8
|
+
export type { SynRequestCloseEvent } from '@synergy-design-system/components';
|
|
9
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
10
|
+
/**
|
|
11
|
+
* Indicates whether or not the dialog is open.
|
|
12
|
+
* You can toggle this attribute to show and hide the dialog, or you can
|
|
13
|
+
use the `show()` and `hide()` methods and this attribute will reflect the dialog's open state.
|
|
14
|
+
*/
|
|
15
|
+
open?: boolean | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The dialog's label as displayed in the header.
|
|
18
|
+
* You should always include a relevant label even when using
|
|
19
|
+
`no-header`, as it is required for proper accessibility.
|
|
20
|
+
* If you need to display HTML, use the `label` slot instead.
|
|
21
|
+
*/
|
|
22
|
+
label?: string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Disables the header.
|
|
25
|
+
* This will also remove the default close button, so please ensure you provide an easy,
|
|
26
|
+
accessible way for users to dismiss the dialog.
|
|
27
|
+
*/
|
|
28
|
+
noHeader?: boolean | undefined;
|
|
29
|
+
}>, {
|
|
30
|
+
callHandleOpenChange: () => Promise<void> | undefined;
|
|
31
|
+
callShow: () => Promise<void> | undefined;
|
|
32
|
+
callHide: () => Promise<void> | undefined;
|
|
33
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
"syn-show": (e: SynShowEvent) => void;
|
|
35
|
+
"syn-after-show": (e: SynAfterShowEvent) => void;
|
|
36
|
+
"syn-hide": (e: SynHideEvent) => void;
|
|
37
|
+
"syn-after-hide": (e: SynAfterHideEvent) => void;
|
|
38
|
+
"syn-initial-focus": (e: SynInitialFocusEvent) => void;
|
|
39
|
+
"syn-request-close": (e: SynRequestCloseEvent) => void;
|
|
40
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
41
|
+
/**
|
|
42
|
+
* Indicates whether or not the dialog is open.
|
|
43
|
+
* You can toggle this attribute to show and hide the dialog, or you can
|
|
44
|
+
use the `show()` and `hide()` methods and this attribute will reflect the dialog's open state.
|
|
45
|
+
*/
|
|
46
|
+
open?: boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The dialog's label as displayed in the header.
|
|
49
|
+
* You should always include a relevant label even when using
|
|
50
|
+
`no-header`, as it is required for proper accessibility.
|
|
51
|
+
* If you need to display HTML, use the `label` slot instead.
|
|
52
|
+
*/
|
|
53
|
+
label?: string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Disables the header.
|
|
56
|
+
* This will also remove the default close button, so please ensure you provide an easy,
|
|
57
|
+
accessible way for users to dismiss the dialog.
|
|
58
|
+
*/
|
|
59
|
+
noHeader?: boolean | undefined;
|
|
60
|
+
}>>> & {
|
|
61
|
+
"onSyn-show"?: ((e: SynShowEvent) => any) | undefined;
|
|
62
|
+
"onSyn-after-show"?: ((e: SynAfterShowEvent) => any) | undefined;
|
|
63
|
+
"onSyn-hide"?: ((e: SynHideEvent) => any) | undefined;
|
|
64
|
+
"onSyn-after-hide"?: ((e: SynAfterHideEvent) => any) | undefined;
|
|
65
|
+
"onSyn-initial-focus"?: ((e: SynInitialFocusEvent) => any) | undefined;
|
|
66
|
+
"onSyn-request-close"?: ((e: SynRequestCloseEvent) => any) | undefined;
|
|
67
|
+
}, {}, {}>, {
|
|
68
|
+
default?(_: {}): any;
|
|
69
|
+
label?(_: {}): any;
|
|
70
|
+
"header-actions"?(_: {}): any;
|
|
71
|
+
footer?(_: {}): any;
|
|
72
|
+
}>;
|
|
73
|
+
export default _default;
|
|
74
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
75
|
+
new (): {
|
|
76
|
+
$slots: S;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
80
|
+
type __VLS_TypePropsToOption<T> = {
|
|
81
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
82
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
83
|
+
} : {
|
|
84
|
+
type: import('vue').PropType<T[K]>;
|
|
85
|
+
required: true;
|
|
86
|
+
};
|
|
87
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { default as SynVueBadge } from "./components/SynVueBadge.vue";
|
|
|
3
3
|
export { default as SynVueButton } from "./components/SynVueButton.vue";
|
|
4
4
|
export { default as SynVueButtonGroup } from "./components/SynVueButtonGroup.vue";
|
|
5
5
|
export { default as SynVueCheckbox } from "./components/SynVueCheckbox.vue";
|
|
6
|
+
export { default as SynVueDialog } from "./components/SynVueDialog.vue";
|
|
6
7
|
export { default as SynVueDivider } from "./components/SynVueDivider.vue";
|
|
7
8
|
export { default as SynVueDrawer } from "./components/SynVueDrawer.vue";
|
|
8
9
|
export { default as SynVueDropdown } from "./components/SynVueDropdown.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": "^1.
|
|
7
|
+
"@synergy-design-system/components": "^1.23.0"
|
|
8
8
|
},
|
|
9
9
|
"description": "Vue3 wrappers for the Synergy Design System",
|
|
10
10
|
"exports": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"directory": "packages/vue"
|
|
41
41
|
},
|
|
42
42
|
"type": "module",
|
|
43
|
-
"version": "1.
|
|
43
|
+
"version": "1.23.0",
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@vue/tsconfig": "^0.5.1",
|
|
46
46
|
"vue": "^3.4.24"
|
|
@@ -0,0 +1,183 @@
|
|
|
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 Dialogs, sometimes called "modals", appear above the page and require the user's immediate attention.
|
|
10
|
+
* @documentation https://synergy.style/components/dialog
|
|
11
|
+
* @status stable
|
|
12
|
+
* @since 2.0
|
|
13
|
+
*
|
|
14
|
+
* @dependency syn-icon-button
|
|
15
|
+
*
|
|
16
|
+
* @slot - The dialog's main content.
|
|
17
|
+
* @slot label - The dialog's label. Alternatively, you can use the `label` attribute.
|
|
18
|
+
* @slot header-actions - Optional actions to add to the header. Works best with `<syn-icon-button>`.
|
|
19
|
+
* @slot footer - The dialog's footer, usually one or more buttons representing various options.
|
|
20
|
+
*
|
|
21
|
+
* @event syn-show - Emitted when the dialog opens.
|
|
22
|
+
* @event syn-after-show - Emitted after the dialog opens and all animations are complete.
|
|
23
|
+
* @event syn-hide - Emitted when the dialog closes.
|
|
24
|
+
* @event syn-after-hide - Emitted after the dialog closes and all animations are complete.
|
|
25
|
+
* @event syn-initial-focus - Emitted when the dialog opens and is ready to receive focus. Calling
|
|
26
|
+
* `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.
|
|
27
|
+
* @event {{ source: 'close-button' | 'keyboard' | 'overlay' }} syn-request-close - Emitted when the user attempts to
|
|
28
|
+
* close the dialog by clicking the close button, clicking the overlay, or pressing escape. Calling
|
|
29
|
+
* `event.preventDefault()` will keep the dialog open. Avoid using this unless closing the dialog will result in
|
|
30
|
+
* destructive behavior such as data loss.
|
|
31
|
+
*
|
|
32
|
+
* @csspart base - The component's base wrapper.
|
|
33
|
+
* @csspart overlay - The overlay that covers the screen behind the dialog.
|
|
34
|
+
* @csspart panel - The dialog's panel (where the dialog and its content are rendered).
|
|
35
|
+
* @csspart header - The dialog's header. This element wraps the title and header actions.
|
|
36
|
+
* @csspart header-actions - Optional actions to add to the header. Works best with `<syn-icon-button>`.
|
|
37
|
+
* @csspart title - The dialog's title.
|
|
38
|
+
* @csspart close-button - The close button, an `<syn-icon-button>`.
|
|
39
|
+
* @csspart close-button__base - The close button's exported `base` part.
|
|
40
|
+
* @csspart body - The dialog's body.
|
|
41
|
+
* @csspart footer - The dialog's footer.
|
|
42
|
+
*
|
|
43
|
+
* @cssproperty --width - The preferred width of the dialog. Note that the dialog will shrink to accommodate smaller screens.
|
|
44
|
+
* @cssproperty --header-spacing - The amount of padding to use for the header.
|
|
45
|
+
* @cssproperty --body-spacing - The amount of padding to use for the body.
|
|
46
|
+
* @cssproperty --footer-spacing - The amount of padding to use for the footer.
|
|
47
|
+
*
|
|
48
|
+
* @animation dialog.show - The animation to use when showing the dialog.
|
|
49
|
+
* @animation dialog.hide - The animation to use when hiding the dialog.
|
|
50
|
+
* @animation dialog.denyClose - The animation to use when a request to close the dialog is denied.
|
|
51
|
+
* @animation dialog.overlay.show - The animation to use when showing the dialog's overlay.
|
|
52
|
+
* @animation dialog.overlay.hide - The animation to use when hiding the dialog's overlay.
|
|
53
|
+
*
|
|
54
|
+
* @property modal - Exposes the internal modal utility that controls focus trapping. To temporarily disable focus
|
|
55
|
+
* trapping and allow third-party modals spawned from an active Synergy modal, call `modal.activateExternal()` when
|
|
56
|
+
* the third-party modal opens. Upon closing, call `modal.deactivateExternal()` to restore Synergy's focus trapping.
|
|
57
|
+
*/
|
|
58
|
+
import { computed, ref } from 'vue';
|
|
59
|
+
import '@synergy-design-system/components/components/dialog/dialog.js';
|
|
60
|
+
|
|
61
|
+
import type {
|
|
62
|
+
SynAfterHideEvent, SynAfterShowEvent, SynDialog, SynHideEvent, SynInitialFocusEvent, SynRequestCloseEvent, SynShowEvent,
|
|
63
|
+
} from '@synergy-design-system/components';
|
|
64
|
+
|
|
65
|
+
// DOM Reference to the element
|
|
66
|
+
const element = ref<SynDialog>();
|
|
67
|
+
|
|
68
|
+
// Map methods
|
|
69
|
+
const callHandleOpenChange = (...args: Parameters<SynDialog['handleOpenChange']>) => element.value?.handleOpenChange(...args);
|
|
70
|
+
/**
|
|
71
|
+
* Shows the dialog.
|
|
72
|
+
*/
|
|
73
|
+
const callShow = (...args: Parameters<SynDialog['show']>) => element.value?.show(...args);
|
|
74
|
+
/**
|
|
75
|
+
* Hides the dialog
|
|
76
|
+
*/
|
|
77
|
+
const callHide = (...args: Parameters<SynDialog['hide']>) => element.value?.hide(...args);
|
|
78
|
+
|
|
79
|
+
defineExpose({
|
|
80
|
+
callHandleOpenChange,
|
|
81
|
+
callShow,
|
|
82
|
+
callHide,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Map attributes
|
|
86
|
+
const props = defineProps<{
|
|
87
|
+
/**
|
|
88
|
+
* Indicates whether or not the dialog is open.
|
|
89
|
+
* You can toggle this attribute to show and hide the dialog, or you can
|
|
90
|
+
use the `show()` and `hide()` methods and this attribute will reflect the dialog's open state.
|
|
91
|
+
*/
|
|
92
|
+
'open'?: SynDialog['open'];
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The dialog's label as displayed in the header.
|
|
96
|
+
* You should always include a relevant label even when using
|
|
97
|
+
`no-header`, as it is required for proper accessibility.
|
|
98
|
+
* If you need to display HTML, use the `label` slot instead.
|
|
99
|
+
*/
|
|
100
|
+
'label'?: SynDialog['label'];
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Disables the header.
|
|
104
|
+
* This will also remove the default close button, so please ensure you provide an easy,
|
|
105
|
+
accessible way for users to dismiss the dialog.
|
|
106
|
+
*/
|
|
107
|
+
'noHeader'?: SynDialog['noHeader'];
|
|
108
|
+
}>();
|
|
109
|
+
|
|
110
|
+
// Make sure prop binding only forwards the props that are actually there.
|
|
111
|
+
// This is needed because :param="param" also adds an empty attribute
|
|
112
|
+
// when using web-components, which breaks optional arguments like size in SynInput
|
|
113
|
+
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
114
|
+
const visibleProps = computed(() => Object.fromEntries(
|
|
115
|
+
Object
|
|
116
|
+
.entries(props)
|
|
117
|
+
.filter(([, value]) => typeof value !== 'undefined'),
|
|
118
|
+
));
|
|
119
|
+
|
|
120
|
+
// Map events
|
|
121
|
+
defineEmits<{
|
|
122
|
+
/**
|
|
123
|
+
* Emitted when the dialog opens.
|
|
124
|
+
*/
|
|
125
|
+
'syn-show': [e: SynShowEvent];
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Emitted after the dialog opens and all animations are complete.
|
|
129
|
+
*/
|
|
130
|
+
'syn-after-show': [e: SynAfterShowEvent];
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Emitted when the dialog closes.
|
|
134
|
+
*/
|
|
135
|
+
'syn-hide': [e: SynHideEvent];
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Emitted after the dialog closes and all animations are complete.
|
|
139
|
+
*/
|
|
140
|
+
'syn-after-hide': [e: SynAfterHideEvent];
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Emitted when the dialog opens and is ready to receive focus.
|
|
144
|
+
* Calling `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.
|
|
145
|
+
*/
|
|
146
|
+
'syn-initial-focus': [e: SynInitialFocusEvent];
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Emitted when the user attempts to close the dialog by clicking the close button, clicking the overlay, or pressing escape.
|
|
150
|
+
* Calling `event.preventDefault()` will keep the dialog open.
|
|
151
|
+
* Avoid using this unless closing the dialog will result in destructive behavior such as data loss.
|
|
152
|
+
*/
|
|
153
|
+
'syn-request-close': [e: SynRequestCloseEvent];
|
|
154
|
+
}>();
|
|
155
|
+
</script>
|
|
156
|
+
|
|
157
|
+
<script lang="ts">
|
|
158
|
+
export type { SynShowEvent } from '@synergy-design-system/components';
|
|
159
|
+
export type { SynAfterShowEvent } from '@synergy-design-system/components';
|
|
160
|
+
export type { SynHideEvent } from '@synergy-design-system/components';
|
|
161
|
+
export type { SynAfterHideEvent } from '@synergy-design-system/components';
|
|
162
|
+
export type { SynInitialFocusEvent } from '@synergy-design-system/components';
|
|
163
|
+
export type { SynRequestCloseEvent } from '@synergy-design-system/components';
|
|
164
|
+
</script>
|
|
165
|
+
|
|
166
|
+
<template>
|
|
167
|
+
<syn-dialog
|
|
168
|
+
v-bind="visibleProps"
|
|
169
|
+
ref="element"
|
|
170
|
+
@syn-show="$emit('syn-show', $event)"
|
|
171
|
+
@syn-after-show="$emit('syn-after-show', $event)"
|
|
172
|
+
@syn-hide="$emit('syn-hide', $event)"
|
|
173
|
+
@syn-after-hide="$emit('syn-after-hide', $event)"
|
|
174
|
+
|
|
175
|
+
@syn-initial-focus="$emit('syn-initial-focus', $event)"
|
|
176
|
+
@syn-request-close="$emit('syn-request-close', $event)"
|
|
177
|
+
>
|
|
178
|
+
<slot />
|
|
179
|
+
<slot name="label" />
|
|
180
|
+
<slot name="header-actions" />
|
|
181
|
+
<slot name="footer" />
|
|
182
|
+
</syn-dialog>
|
|
183
|
+
</template>
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { default as SynVueBadge } from './components/SynVueBadge.vue';
|
|
|
8
8
|
export { default as SynVueButton } from './components/SynVueButton.vue';
|
|
9
9
|
export { default as SynVueButtonGroup } from './components/SynVueButtonGroup.vue';
|
|
10
10
|
export { default as SynVueCheckbox } from './components/SynVueCheckbox.vue';
|
|
11
|
+
export { default as SynVueDialog } from './components/SynVueDialog.vue';
|
|
11
12
|
export { default as SynVueDivider } from './components/SynVueDivider.vue';
|
|
12
13
|
export { default as SynVueDrawer } from './components/SynVueDrawer.vue';
|
|
13
14
|
export { default as SynVueDropdown } from './components/SynVueDropdown.vue';
|