@resee-movies/nuxt-ux 0.4.0 → 0.5.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/module.json +1 -1
- package/dist/module.mjs +20 -3
- package/dist/runtime/components/Button.vue +15 -9
- package/dist/runtime/components/Button.vue.d.ts +2 -12
- package/dist/runtime/components/Card.vue.d.ts +1 -4
- package/dist/runtime/components/Dialog.vue.d.ts +1 -13
- package/dist/runtime/components/Drawer.vue.d.ts +1 -4
- package/dist/runtime/components/Heading.vue.d.ts +1 -4
- package/dist/runtime/components/Icon.vue +27 -15
- package/dist/runtime/components/Icon.vue.d.ts +4 -6
- package/dist/runtime/components/IconTextPair.vue +22 -19
- package/dist/runtime/components/IconTextPair.vue.d.ts +5 -12
- package/dist/runtime/components/Image.vue +1 -1
- package/dist/runtime/components/Image.vue.d.ts +1 -17
- package/dist/runtime/components/LayoutPageColumn.vue.d.ts +1 -4
- package/dist/runtime/components/LayoutPageContainer.vue +12 -2
- package/dist/runtime/components/LayoutPageContainer.vue.d.ts +4 -5
- package/dist/runtime/components/Lorem.vue.d.ts +1 -11
- package/dist/runtime/components/Menu.vue +28 -20
- package/dist/runtime/components/Menu.vue.d.ts +4 -7
- package/dist/runtime/components/Message.vue.d.ts +2 -2
- package/dist/runtime/components/NotificationContainer.vue +10 -3
- package/dist/runtime/components/ProgressBar.vue.d.ts +1 -5
- package/dist/runtime/components/ProgressSpinner.vue.d.ts +1 -3
- package/dist/runtime/components/Tag.vue.d.ts +1 -7
- package/dist/runtime/components/form/Form.vue +52 -0
- package/dist/runtime/components/form/Form.vue.d.ts +27 -0
- package/dist/runtime/components/form/FormField.vue +91 -0
- package/dist/runtime/components/form/FormField.vue.d.ts +37 -0
- package/dist/runtime/components/form/FormFieldCheckbox.vue +51 -0
- package/dist/runtime/components/form/FormFieldCheckbox.vue.d.ts +17 -0
- package/dist/runtime/components/form/FormFieldSelect.vue +76 -0
- package/dist/runtime/components/form/FormFieldSelect.vue.d.ts +26 -0
- package/dist/runtime/components/form/FormFieldText.vue +56 -0
- package/dist/runtime/components/form/FormFieldText.vue.d.ts +16 -0
- package/dist/runtime/components/form/FormFieldToggleSwitch.vue +47 -0
- package/dist/runtime/components/form/FormFieldToggleSwitch.vue.d.ts +15 -0
- package/dist/runtime/components/form/FormLabelInputPair.vue +42 -0
- package/dist/runtime/components/form/FormLabelInputPair.vue.d.ts +22 -0
- package/dist/runtime/components/form/FormSubmitButton.vue +39 -0
- package/dist/runtime/components/form/FormSubmitButton.vue.d.ts +6 -0
- package/dist/runtime/components/form/FormValidationMessage.vue +24 -0
- package/dist/runtime/components/form/FormValidationMessage.vue.d.ts +15 -0
- package/dist/runtime/components/form/element/FormElementSelectOptions.vue +250 -0
- package/dist/runtime/components/form/element/FormElementSelectOptions.vue.d.ts +13 -0
- package/dist/runtime/composables/use-load-image.js +1 -0
- package/dist/runtime/composables/use-notification.d.ts +18 -11
- package/dist/runtime/composables/use-notification.js +27 -27
- package/dist/runtime/composables/use-resee-ux.d.ts +24 -0
- package/dist/runtime/composables/use-resee-ux.js +22 -0
- package/dist/runtime/constants.d.ts +3 -0
- package/dist/runtime/constants.js +3 -0
- package/dist/runtime/server/plugins/teleport-targets.d.ts +3 -0
- package/dist/runtime/server/plugins/teleport-targets.js +6 -0
- package/dist/runtime/theme/css/brand/form.css +1 -0
- package/dist/runtime/theme/css/brand/menu.css +1 -0
- package/dist/runtime/theme/css/brand/mobile.css +1 -0
- package/dist/runtime/theme/css/brand/transition.css +1 -1
- package/dist/runtime/theme/css/brand/utilities.css +1 -1
- package/dist/runtime/theme/css/styles.css +1 -1
- package/dist/runtime/types/form.d.ts +23 -0
- package/dist/runtime/types/form.js +0 -0
- package/dist/runtime/utils/dom.d.ts +9 -0
- package/dist/runtime/utils/dom.js +25 -0
- package/dist/runtime/utils/form.d.ts +34 -0
- package/dist/runtime/utils/form.js +34 -0
- package/dist/runtime/utils/string.d.ts +6 -0
- package/dist/runtime/utils/string.js +3 -0
- package/dist/runtime/utils/validation.d.ts +21 -0
- package/dist/runtime/utils/validation.js +56 -0
- package/package.json +26 -24
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Button
|
|
3
|
+
v-bind = "props"
|
|
4
|
+
type = "submit"
|
|
5
|
+
:loading = "formState.isSubmitting.value"
|
|
6
|
+
icon-transition-name = "grow-x"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script setup>
|
|
15
|
+
import { injectFormInstance } from "../../utils/form";
|
|
16
|
+
import Button from "../Button.vue";
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
is: { type: null, required: false },
|
|
19
|
+
severity: { type: String, required: false },
|
|
20
|
+
bordered: { type: Boolean, required: false, default: true },
|
|
21
|
+
responsive: { type: [Boolean, String], required: false },
|
|
22
|
+
variant: { type: String, required: false },
|
|
23
|
+
size: { type: String, required: false },
|
|
24
|
+
disabled: { type: Boolean, required: false },
|
|
25
|
+
tooltip: { type: String, required: false },
|
|
26
|
+
disabledTooltip: { type: String, required: false },
|
|
27
|
+
type: { type: String, required: false },
|
|
28
|
+
text: { type: String, required: false, default: "Submit" },
|
|
29
|
+
icon: { type: String, required: false },
|
|
30
|
+
trailingIcon: { type: String, required: false },
|
|
31
|
+
iconSize: { type: String, required: false },
|
|
32
|
+
trailingIconSize: { type: String, required: false },
|
|
33
|
+
spacing: { type: String, required: false },
|
|
34
|
+
iconTransitionName: { type: String, required: false },
|
|
35
|
+
iconTransitionMode: { type: String, required: false },
|
|
36
|
+
iconTransitionOnAppear: { type: Boolean, required: false }
|
|
37
|
+
});
|
|
38
|
+
const formState = injectFormInstance();
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ButtonProps } from '../Button.vue.js';
|
|
2
|
+
export interface FormSubmitButtonProps extends Omit<ButtonProps, 'onClick' | 'loading'> {
|
|
3
|
+
}
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<FormSubmitButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormSubmitButtonProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:id = "props.id"
|
|
4
|
+
aria-atomic = "true"
|
|
5
|
+
aria-live = "polite"
|
|
6
|
+
:class = "['input-validation', props.visible ? 'visible' : 'invisible']"
|
|
7
|
+
>
|
|
8
|
+
<slot name="default">
|
|
9
|
+
{{ props.message }}
|
|
10
|
+
</slot>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script setup>
|
|
19
|
+
const props = defineProps({
|
|
20
|
+
id: { type: String, required: false, default: void 0 },
|
|
21
|
+
visible: { type: Boolean, required: false, default: false },
|
|
22
|
+
message: { type: String, required: false, default: void 0 }
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface FormValidationMessageProps {
|
|
2
|
+
id?: string;
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
message?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<FormValidationMessageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormValidationMessageProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
7
|
+
default?: (props: {}) => any;
|
|
8
|
+
}>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Component
|
|
3
|
+
:is = "props.multiple ? PrimeMultiSelect : PrimeSelect"
|
|
4
|
+
:name = "props.name"
|
|
5
|
+
:input-id = "props.inputId"
|
|
6
|
+
:disabled = "props.disabled || props.readonly"
|
|
7
|
+
:class = "['input-group']"
|
|
8
|
+
:options = "props.options"
|
|
9
|
+
:option-label = "props.optionLabel"
|
|
10
|
+
:option-value = "props.optionValue"
|
|
11
|
+
:option-disabled = "props.optionDisabled"
|
|
12
|
+
:placeholder = "props.placeholder"
|
|
13
|
+
:selection-limit = "props.multiple ? props.selectionLimit : void 0"
|
|
14
|
+
:show-clear = "props.showClear"
|
|
15
|
+
:show-toggle-all = "showSelectAllCheckbox"
|
|
16
|
+
:filter = "showFilter"
|
|
17
|
+
:filter-placeholder = "props.filterPlaceholder ?? locale.form.filterPlaceholder"
|
|
18
|
+
:loading = "props.loading"
|
|
19
|
+
:pt = "props.multiple ? multiSelectPassthroughProps : selectPassthroughProps"
|
|
20
|
+
:append-to = "TeleportId"
|
|
21
|
+
>
|
|
22
|
+
<template #value="{ value, placeholder }">
|
|
23
|
+
<template v-if="value">
|
|
24
|
+
{{ toLabel(value) }}
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<span v-else class="placeholder">
|
|
28
|
+
{{ placeholder || "\u200B" }}
|
|
29
|
+
</span>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<template #loadingicon>
|
|
33
|
+
<ProgressSpinner />
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<template #dropdownicon>
|
|
37
|
+
<Icon name="i-ph-caret-down-bold" />
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<template #clearicon="{ clearCallback }">
|
|
41
|
+
<Button
|
|
42
|
+
severity = "unset"
|
|
43
|
+
icon = "i-ph-x"
|
|
44
|
+
class = "input-group-addon"
|
|
45
|
+
@click = "clearCallback"
|
|
46
|
+
:data-pc-section = "
|
|
47
|
+
'clearicon'
|
|
48
|
+
/* used internally by Primevue. No idea why they offer the slot like this. */
|
|
49
|
+
"
|
|
50
|
+
/>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<template #filtericon>
|
|
54
|
+
<Icon name="i-ph-magnifying-glass" />
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<template #emptyfilter>
|
|
58
|
+
<span>{{ locale.form.filterNoResults }}</span>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<template #empty>
|
|
62
|
+
<span>{{ locale.form.noOptionsAvailable }}</span>
|
|
63
|
+
</template>
|
|
64
|
+
</Component>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script>
|
|
68
|
+
import {} from "primevue/select";
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<script setup>
|
|
72
|
+
import { equals, resolveFieldData } from "@primeuix/utils/object";
|
|
73
|
+
import { useBreakpoints, breakpointsTailwind } from "@vueuse/core";
|
|
74
|
+
import PrimeMultiSelect from "primevue/multiselect";
|
|
75
|
+
import PrimeSelect from "primevue/select";
|
|
76
|
+
import { computed } from "vue";
|
|
77
|
+
import { useReseeUx } from "../../../composables/use-resee-ux";
|
|
78
|
+
import { TeleportId } from "../../../constants";
|
|
79
|
+
import { blockBodyScroll, unblockBodyScroll } from "../../../utils/dom";
|
|
80
|
+
import { swapStringPlaceholders } from "../../../utils/string";
|
|
81
|
+
import Button from "../../Button.vue";
|
|
82
|
+
import Icon from "../../Icon.vue";
|
|
83
|
+
import ProgressSpinner from "../../ProgressSpinner.vue";
|
|
84
|
+
const props = defineProps({
|
|
85
|
+
inputId: { type: String, required: false },
|
|
86
|
+
labelId: { type: String, required: false },
|
|
87
|
+
multiple: { type: Boolean, required: false, default: false },
|
|
88
|
+
readonly: { type: Boolean, required: false, default: false },
|
|
89
|
+
showOptionFilter: { type: Boolean, required: false, default: void 0 },
|
|
90
|
+
ariaDescribedby: { type: String, required: false },
|
|
91
|
+
selectionLimit: { type: [String, Number], required: false, default: void 0 },
|
|
92
|
+
modelValue: { type: null, required: false },
|
|
93
|
+
defaultValue: { type: null, required: false },
|
|
94
|
+
name: { type: null, required: false },
|
|
95
|
+
options: { type: Array, required: false },
|
|
96
|
+
optionLabel: { type: [String, Function], required: false, skipCheck: true },
|
|
97
|
+
optionValue: { type: [String, Function], required: false, skipCheck: true },
|
|
98
|
+
optionDisabled: { type: [String, Function], required: false, skipCheck: true },
|
|
99
|
+
scrollHeight: { type: null, required: false },
|
|
100
|
+
filter: { type: Boolean, required: false, skipCheck: true },
|
|
101
|
+
filterPlaceholder: { type: null, required: false },
|
|
102
|
+
filterLocale: { type: null, required: false },
|
|
103
|
+
filterMatchMode: { type: null, required: false },
|
|
104
|
+
filterFields: { type: null, required: false },
|
|
105
|
+
editable: { type: Boolean, required: false, skipCheck: true },
|
|
106
|
+
placeholder: { type: null, required: false },
|
|
107
|
+
size: { type: null, required: false },
|
|
108
|
+
invalid: { type: Boolean, required: false, skipCheck: true },
|
|
109
|
+
disabled: { type: Boolean, required: false, skipCheck: true },
|
|
110
|
+
variant: { type: null, required: false },
|
|
111
|
+
dataKey: { type: null, required: false },
|
|
112
|
+
showClear: { type: Boolean, required: false, skipCheck: true, default: true },
|
|
113
|
+
fluid: { type: Boolean, required: false, skipCheck: true },
|
|
114
|
+
inputStyle: { type: null, required: false },
|
|
115
|
+
inputClass: { type: null, required: false },
|
|
116
|
+
labelStyle: { type: null, required: false },
|
|
117
|
+
labelClass: { type: null, required: false },
|
|
118
|
+
panelStyle: { type: null, required: false },
|
|
119
|
+
panelClass: { type: null, required: false },
|
|
120
|
+
overlayStyle: { type: null, required: false },
|
|
121
|
+
overlayClass: { type: null, required: false },
|
|
122
|
+
appendTo: { type: null, required: false },
|
|
123
|
+
loading: { type: Boolean, required: false, skipCheck: true },
|
|
124
|
+
clearIcon: { type: null, required: false },
|
|
125
|
+
dropdownIcon: { type: null, required: false },
|
|
126
|
+
filterIcon: { type: null, required: false },
|
|
127
|
+
loadingIcon: { type: null, required: false },
|
|
128
|
+
resetFilterOnHide: { type: Boolean, required: false },
|
|
129
|
+
resetFilterOnClear: { type: Boolean, required: false },
|
|
130
|
+
virtualScrollerOptions: { type: Object, required: false },
|
|
131
|
+
autoOptionFocus: { type: Boolean, required: false, skipCheck: true },
|
|
132
|
+
autoFilterFocus: { type: Boolean, required: false, skipCheck: true },
|
|
133
|
+
selectOnFocus: { type: Boolean, required: false, skipCheck: true },
|
|
134
|
+
focusOnHover: { type: Boolean, required: false, skipCheck: true },
|
|
135
|
+
highlightOnSelect: { type: Boolean, required: false, skipCheck: true },
|
|
136
|
+
checkmark: { type: Boolean, required: false, skipCheck: true },
|
|
137
|
+
filterMessage: { type: null, required: false },
|
|
138
|
+
selectionMessage: { type: null, required: false },
|
|
139
|
+
emptySelectionMessage: { type: null, required: false },
|
|
140
|
+
emptyFilterMessage: { type: null, required: false },
|
|
141
|
+
emptyMessage: { type: null, required: false },
|
|
142
|
+
tabindex: { type: null, required: false },
|
|
143
|
+
ariaLabel: { type: null, required: false },
|
|
144
|
+
ariaLabelledby: { type: null, required: false },
|
|
145
|
+
formControl: { type: null, required: false },
|
|
146
|
+
dt: { type: null, required: false },
|
|
147
|
+
pt: { type: null, required: false },
|
|
148
|
+
ptOptions: { type: Object, required: false },
|
|
149
|
+
unstyled: { type: Boolean, required: false }
|
|
150
|
+
});
|
|
151
|
+
const { locale } = useReseeUx();
|
|
152
|
+
const isSmall = useBreakpoints(breakpointsTailwind).smallerOrEqual("sm");
|
|
153
|
+
const showFilter = computed(() => {
|
|
154
|
+
return props.showOptionFilter ?? (props.options?.length ?? 0) > 20;
|
|
155
|
+
});
|
|
156
|
+
const showSelectAllCheckbox = computed(() => {
|
|
157
|
+
return props.multiple ? showFilter.value : void 0;
|
|
158
|
+
});
|
|
159
|
+
let unblockScroll = void 0;
|
|
160
|
+
const sharedPassthroughProps = computed(() => {
|
|
161
|
+
return {
|
|
162
|
+
header: { class: "menu-prefix input-menu-header" },
|
|
163
|
+
overlay: { class: "menu input-menu" },
|
|
164
|
+
dropdown: { class: "input-group-addon" },
|
|
165
|
+
listContainer: { class: "menu-list" },
|
|
166
|
+
pcFilterContainer: { root: { class: "input-menu-filter" } },
|
|
167
|
+
pcFilterIconContainer: { root: { class: "input-group-addon" } },
|
|
168
|
+
emptyMessage: { "aria-disabled": "true" },
|
|
169
|
+
transition: {
|
|
170
|
+
name: isSmall.value ? "slide-in-bottom" : "fade",
|
|
171
|
+
onBeforeEnter() {
|
|
172
|
+
if (isSmall.value) {
|
|
173
|
+
unblockScroll = blockBodyScroll();
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
onAfterLeave() {
|
|
177
|
+
unblockScroll?.();
|
|
178
|
+
unblockScroll = void 0;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
const selectPassthroughProps = computed(() => {
|
|
184
|
+
return {
|
|
185
|
+
...sharedPassthroughProps.value,
|
|
186
|
+
label: {
|
|
187
|
+
"class": "input-control min-w-0 select-none truncate",
|
|
188
|
+
"aria-describedby": props.ariaDescribedby,
|
|
189
|
+
"aria-labelledby": props.labelId,
|
|
190
|
+
"aria-readonly": props.readonly
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
const multiSelectPassthroughProps = computed(() => {
|
|
195
|
+
return {
|
|
196
|
+
...sharedPassthroughProps.value,
|
|
197
|
+
labelContainer: {
|
|
198
|
+
class: "input-control min-w-0"
|
|
199
|
+
},
|
|
200
|
+
label: {
|
|
201
|
+
class: "select-none truncate"
|
|
202
|
+
},
|
|
203
|
+
hiddenInput: {
|
|
204
|
+
"aria-describedby": props.ariaDescribedby,
|
|
205
|
+
"aria-labelledby": props.labelId,
|
|
206
|
+
"aria-readonly": props.readonly
|
|
207
|
+
},
|
|
208
|
+
pcHeaderCheckbox: {
|
|
209
|
+
root: {
|
|
210
|
+
class: "input-group"
|
|
211
|
+
},
|
|
212
|
+
input: {
|
|
213
|
+
"id": `${props.inputId}_select_all`,
|
|
214
|
+
"aria-label": locale.form.selectAllOptions
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
pcOptionCheckbox: {
|
|
218
|
+
root: {
|
|
219
|
+
class: "input-group"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
function getOptionValue(option) {
|
|
225
|
+
return props.optionValue ? resolveFieldData(option, props.optionValue) : option;
|
|
226
|
+
}
|
|
227
|
+
function getOptionLabel(option) {
|
|
228
|
+
return props.optionLabel ? resolveFieldData(option, props.optionLabel) : option;
|
|
229
|
+
}
|
|
230
|
+
function findOptionByValue(value) {
|
|
231
|
+
return props.options?.find(
|
|
232
|
+
(option) => equals(getOptionValue(option), value, props.optionValue ? void 0 : props.dataKey)
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function toLabel(value) {
|
|
236
|
+
if (!value) {
|
|
237
|
+
return void 0;
|
|
238
|
+
}
|
|
239
|
+
if (!Array.isArray(value)) {
|
|
240
|
+
return getOptionLabel(findOptionByValue(value));
|
|
241
|
+
}
|
|
242
|
+
if (value.length === 0) {
|
|
243
|
+
return void 0;
|
|
244
|
+
}
|
|
245
|
+
if (value.length === 1) {
|
|
246
|
+
return getOptionLabel(findOptionByValue(value[0]));
|
|
247
|
+
}
|
|
248
|
+
return swapStringPlaceholders(locale.form.numOptionsSelected, { count: value.length });
|
|
249
|
+
}
|
|
250
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SelectProps as PrimeSelectProps } from 'primevue/select';
|
|
2
|
+
export interface FormElementSelectOptionsProps extends Omit<PrimeSelectProps, 'inputId' | 'labelId' | 'optionGroupLabel' | 'optionGroupChildren'> {
|
|
3
|
+
inputId?: string;
|
|
4
|
+
labelId?: string;
|
|
5
|
+
multiple?: boolean;
|
|
6
|
+
readonly?: boolean;
|
|
7
|
+
showOptionFilter?: boolean;
|
|
8
|
+
ariaDescribedby?: string;
|
|
9
|
+
selectionLimit?: string | number;
|
|
10
|
+
}
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<FormElementSelectOptionsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormElementSelectOptionsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ToastServiceMethods } from 'primevue/toastservice';
|
|
2
|
+
import type { StatusLevel } from '../types/index.js';
|
|
3
|
+
export interface NotificationOptions {
|
|
2
4
|
headline?: string;
|
|
3
5
|
closable?: boolean;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
icon?: string;
|
|
7
|
+
lifetime?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class NotificationService {
|
|
10
|
+
readonly notify: (message: string, options?: NotificationOptions & {
|
|
11
|
+
severity?: StatusLevel;
|
|
12
|
+
}) => void;
|
|
13
|
+
readonly notifyInfo: (message: string, options?: NotificationOptions) => void;
|
|
14
|
+
readonly notifyHelp: (message: string, options?: NotificationOptions) => void;
|
|
15
|
+
readonly notifySuccess: (message: string, options?: NotificationOptions) => void;
|
|
16
|
+
readonly notifyWarning: (message: string, options?: NotificationOptions) => void;
|
|
17
|
+
readonly notifyError: (message: string, options?: NotificationOptions) => void;
|
|
18
|
+
constructor(toast: ToastServiceMethods);
|
|
19
|
+
}
|
|
13
20
|
/**
|
|
14
21
|
* Returns a collection of methods for providing user feedback via popup
|
|
15
22
|
* notifications (a.k.a. toast notifications / snackbar notifications).
|
|
16
23
|
*/
|
|
17
|
-
export declare function useNotification():
|
|
24
|
+
export declare function useNotification(): NotificationService;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
+
import { isNumber } from "@resee-movies/utilities/numbers/is-number";
|
|
1
2
|
import { useToast } from "primevue/usetoast";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
export class NotificationService {
|
|
4
|
+
notify;
|
|
5
|
+
notifyInfo;
|
|
6
|
+
notifyHelp;
|
|
7
|
+
notifySuccess;
|
|
8
|
+
notifyWarning;
|
|
9
|
+
notifyError;
|
|
10
|
+
constructor(toast) {
|
|
11
|
+
this.notify = (message, options) => {
|
|
12
|
+
toast.add({
|
|
13
|
+
detail: message,
|
|
14
|
+
severity: options?.severity,
|
|
15
|
+
summary: options?.headline,
|
|
16
|
+
closable: options?.closable === true,
|
|
17
|
+
life: isNumber(options?.lifetime) ? options?.lifetime : 5e3,
|
|
18
|
+
/* @ts-expect-error - adding custom props to extend functionality */
|
|
19
|
+
icon: options?.icon
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
this.notifyInfo = (message, options) => this.notify(message, { severity: "info", ...options });
|
|
23
|
+
this.notifyHelp = (message, options) => this.notify(message, { severity: "help", ...options });
|
|
24
|
+
this.notifySuccess = (message, options) => this.notify(message, { severity: "success", ...options });
|
|
25
|
+
this.notifyWarning = (message, options) => this.notify(message, { severity: "warn", ...options });
|
|
26
|
+
this.notifyError = (message, options) => this.notify(message, { severity: "error", ...options });
|
|
27
|
+
}
|
|
20
28
|
}
|
|
21
29
|
export function useNotification() {
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
notify: createToastMessageClosure(toast, void 0),
|
|
25
|
-
notifyInfo: createToastMessageClosure(toast, "info"),
|
|
26
|
-
notifyHelp: createToastMessageClosure(toast, "help"),
|
|
27
|
-
notifySuccess: createToastMessageClosure(toast, "success"),
|
|
28
|
-
notifyWarning: createToastMessageClosure(toast, "warn"),
|
|
29
|
-
notifyError: createToastMessageClosure(toast, "error")
|
|
30
|
-
};
|
|
30
|
+
return new NotificationService(useToast());
|
|
31
31
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides the ability to manage runtime configuration of the ReSee UX
|
|
3
|
+
* module.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useReseeUx(): {
|
|
6
|
+
locale: {
|
|
7
|
+
validation: {
|
|
8
|
+
required: string;
|
|
9
|
+
invalidEmail: string;
|
|
10
|
+
invalidUrl: string;
|
|
11
|
+
tooFewChars: string;
|
|
12
|
+
tooManyChars: string;
|
|
13
|
+
tooFewOptions: string;
|
|
14
|
+
tooManyOptions: string;
|
|
15
|
+
};
|
|
16
|
+
form: {
|
|
17
|
+
filterPlaceholder: string;
|
|
18
|
+
filterNoResults: string;
|
|
19
|
+
noOptionsAvailable: string;
|
|
20
|
+
selectAllOptions: string;
|
|
21
|
+
numOptionsSelected: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
const Localization = reactive({
|
|
3
|
+
validation: {
|
|
4
|
+
required: "Required",
|
|
5
|
+
invalidEmail: "A valid email address is required",
|
|
6
|
+
invalidUrl: "A valid URL (https://...) is required",
|
|
7
|
+
tooFewChars: "Must have at least {count} character(s)",
|
|
8
|
+
tooManyChars: "Cannot have more than {count} character(s)",
|
|
9
|
+
tooFewOptions: "Must select at least {count} option(s)",
|
|
10
|
+
tooManyOptions: "Cannot select more than {count} option(s)"
|
|
11
|
+
},
|
|
12
|
+
form: {
|
|
13
|
+
filterPlaceholder: "Search",
|
|
14
|
+
filterNoResults: "No Results Found",
|
|
15
|
+
noOptionsAvailable: "No Options Available",
|
|
16
|
+
selectAllOptions: "Select All",
|
|
17
|
+
numOptionsSelected: "{count} Item(s) Selected"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export function useReseeUx() {
|
|
21
|
+
return { locale: Localization };
|
|
22
|
+
}
|
|
@@ -4,3 +4,6 @@ import type { HintedString, StyleStatusLevel } from './types/index.js';
|
|
|
4
4
|
* the application.
|
|
5
5
|
*/
|
|
6
6
|
export declare const StatusLevelIcons: Record<HintedString<StyleStatusLevel>, string>;
|
|
7
|
+
export declare const TeleportId = "#resee-ux-teleport";
|
|
8
|
+
export declare const OverflowHiddenClass = "p-overflow-hidden";
|
|
9
|
+
export declare const ScrollbarWidthPropName = "--p-scrollbar-width";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.input-label{display:block;-webkit-user-select:none;-moz-user-select:none;user-select:none}.input-label.required:after{color:var(--color-danger);content:"*";display:inline-block;margin-inline-start:--spacing(1)}.input-label.disabled{cursor:not-allowed;opacity:.6}.input-label-pair{display:flex;flex-direction:column;gap:--spacing(1);margin-block-end:--spacing(1)}.input-label-pair.label-after,.input-label-pair.label-before{align-items:center;flex-direction:row;gap:--spacing(3)}.input-label-pair.label-after .input-label,.input-label-pair.label-below .input-label{order:2}.input-validation{color:var(--color-danger);font-size:var(--text-sm);height:0;line-clamp:2}.input-field{display:flex;flex-direction:column}.input-control{flex-grow:1;padding:--spacing(2) --spacing(3)}.input-control::-moz-placeholder{color:var(--color-global-foreground-accent)}.input-control .placeholder,.input-control::placeholder{color:var(--color-global-foreground-accent)}.input-group{align-items:center;display:flex}.input-group.input-group-loading{cursor:wait}.input-group .input-group-addon{color:var(--color-global-foreground-accent);padding:0 --spacing(2)}.input-group button.input-group-addon{cursor:pointer}.input-group .input-control{outline:none}.input-control:where(:not(.input-group .input-control)),.input-group{background-color:var(--color-global-background);border-radius:--spacing(1);cursor:pointer;outline:solid 2px var(--color-background-scale-e);overflow:clip;transition:color,background-color,outline-color,box-shadow;transition-duration:calc(var(--default-transition-duration)*2);width:100%}.input-control:where(:not(.input-group .input-control)):has(input[readonly]:where(:not(.p-hidden-accessible input)),[aria-readonly=true]),.input-control:where(:not(.input-group .input-control)):is(input[readonly]),.input-group:has(input[readonly]:where(:not(.p-hidden-accessible input)),[aria-readonly=true]),.input-group:is(input[readonly]){cursor:default}.input-control:where(:not(.input-group .input-control)):not(:is(input[readonly]),:has(input[readonly]:where(:not(.p-hidden-accessible input)),[aria-readonly=true])):is(:disabled,:has(:disabled,[aria-disabled=true])),.input-group:not(:is(input[readonly]),:has(input[readonly]:where(:not(.p-hidden-accessible input)),[aria-readonly=true])):is(:disabled,:has(:disabled,[aria-disabled=true])){cursor:not-allowed;opacity:.6}.input-control:where(:not(.input-group .input-control)):not(:is(input[readonly]),:has(input[readonly]:where(:not(.p-hidden-accessible input)),[aria-readonly=true])):not(:disabled,:has(:disabled,[aria-disabled=true])):focus-within,.input-control:where(:not(.input-group .input-control)):not(:is(input[readonly]),:has(input[readonly]:where(:not(.p-hidden-accessible input)),[aria-readonly=true])):not(:disabled,:has(:disabled,[aria-disabled=true])):hover,.input-group:not(:is(input[readonly]),:has(input[readonly]:where(:not(.p-hidden-accessible input)),[aria-readonly=true])):not(:disabled,:has(:disabled,[aria-disabled=true])):focus-within,.input-group:not(:is(input[readonly]),:has(input[readonly]:where(:not(.p-hidden-accessible input)),[aria-readonly=true])):not(:disabled,:has(:disabled,[aria-disabled=true])):hover{outline-color:var(--color-global-foreground-accent)}.input-control:where(:not(.input-group .input-control)):not(:is(input[readonly]),:has(input[readonly]:where(:not(.p-hidden-accessible input)),[aria-readonly=true])):not(:disabled,:has(:disabled,[aria-disabled=true])):not(:has(>input[type=checkbox])):focus-within,.input-group:not(:is(input[readonly]),:has(input[readonly]:where(:not(.p-hidden-accessible input)),[aria-readonly=true])):not(:disabled,:has(:disabled,[aria-disabled=true])):not(:has(>input[type=checkbox])):focus-within{background-color:var(--color-background-scale-b);box-shadow:var(--shadow-heavy)}.input-group:where(:has(input[type=checkbox])){flex-shrink:0;height:1.5rem;position:relative;transform:translateY(-1px);-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1.5rem}.input-group:where(:has(input[type=checkbox])) svg{font-size:1rem;height:1rem;line-height:1;margin-left:.25rem;width:1rem}.input-group:where(:has(input[type=checkbox])) input{-webkit-appearance:none;-moz-appearance:none;appearance:none;height:100%;inset:0;opacity:0;position:absolute;z-index:10}.input-group:where(:has(input[type=checkbox])) input:not(:disabled,[readonly]){cursor:pointer}.input-group:where(:has(input[type=checkbox])).toggle-switch{border-radius:1rem;width:2.5rem}.input-group:where(:has(input[type=checkbox])).toggle-switch:has(:checked) .slider:before{background-color:var(--color-global-foreground);transform:translateX(1rem)}.input-group:where(:has(input[type=checkbox])).toggle-switch .slider{border-radius:1rem;inset:0;position:absolute}.input-group:where(:has(input[type=checkbox])).toggle-switch .slider:before{background-color:var(--color-background-scale-d);border-radius:var(--radius-full);box-shadow:var(--shadow-md);content:"";height:1rem;left:.25rem;position:absolute;top:.25rem;transition:transform,background-color;transition-duration:var(--default-transition-duration);width:1rem}.input-menu .input-control,.input-menu .input-group{background-color:transparent}.input-menu .input-group:where(:has(input[type=checkbox])){height:1.2rem;width:1.2rem}.input-menu .input-group:where(:has(input[type=checkbox])) svg{margin-left:.125rem}[aria-disabled=true] .input-menu .input-group:where(:has(input[type=checkbox])):focus-within,[aria-disabled=true] .input-menu .input-group:where(:has(input[type=checkbox])):hover{outline-color:var(--color-background-scale-e)!important}[aria-disabled=true] .input-menu .input-group:where(:has(input[type=checkbox])):focus-within input,[aria-disabled=true] .input-menu .input-group:where(:has(input[type=checkbox])):hover input{cursor:not-allowed!important}.input-menu-header{align-items:center;display:flex;gap:--spacing(2)}.input-menu-header .input-menu-filter{align-items:center;color:var(--color-global-foreground-accent);display:flex;flex-grow:1;transition:color var(--default-transition-duration) var(--default-transition-timing-function)}.input-menu-header .input-menu-filter input{flex-grow:1;outline:none;padding:--spacing(.5) 0}.input-menu-header .input-menu-filter input::-moz-placeholder{color:var(--color-global-foreground-accent)}.input-menu-header .input-menu-filter input::placeholder{color:var(--color-global-foreground-accent)}.input-menu-header .input-menu-filter:focus-within{color:var(--color-global-foreground)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.menu{background-color:var(--color-background-scale-a);border:1px solid var(--color-global-background-accent);border-radius:var(--radius-md);box-shadow:var(--shadow-heavy);display:flex;flex-direction:column;margin-block:--spacing(1);max-width:--spacing(80);padding:--spacing(1)}.menu .menu-list{max-height:14rem;overflow-y:auto;@apply styled-scroll}.menu li[role=separator]{border-bottom:1px solid var(--color-global-background-accent);margin-block:--spacing(1)}.menu li[role=none]{font-weight:var(--font-weight-semibold);padding:--spacing(1) --spacing(2);-webkit-user-select:none;-moz-user-select:none;user-select:none}.menu li[role=menuitem],.menu li[role=option]{border-radius:var(--radius-md);cursor:pointer;transition:background-color;transition-duration:var(--default-transition-duration);-webkit-user-select:none;-moz-user-select:none;user-select:none}.menu li[role=menuitem]>:only-child:not(:has(>a:only-child)),.menu li[role=option]>:only-child:not(:has(>a:only-child)){display:block;padding:--spacing(1) --spacing(2)}.menu li[role=menuitem]>:only-child:has(>a:only-child)>a,.menu li[role=option]>:only-child:has(>a:only-child)>a{display:block;padding:--spacing(1) --spacing(2)}.menu li[role=menuitem]:has(>:nth-child(2)),.menu li[role=option]:has(>:nth-child(2)){align-items:center;display:flex;gap:--spacing(2);padding:--spacing(1) --spacing(2)}.menu li[role=menuitem][aria-disabled=true],.menu li[role=option][aria-disabled=true]{color:var(--color-global-foreground-accent);cursor:not-allowed}.menu li:is([role=menuitem],[role=option])[data-p-focused=true]:not([aria-disabled=true]),.menu ul:not(:focus) li:is([role=menuitem],[role=option]):not([aria-disabled=true]):hover{background-color:var(--color-background-scale-c)}.menu .menu-prefix{border-bottom:1px solid var(--color-global-background-accent);margin-bottom:--spacing(1);padding:0 --spacing(2) --spacing(1)}.menu .menu-suffix{border-top:1px solid var(--color-global-background-accent);margin-top:--spacing(1);padding:--spacing(1) --spacing(2) 0}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer utilities{#resee-ux-teleport:has(:first-child:not(script,link)){@variant max-sm{inset:0;position:fixed;z-index:1100;@apply occlude-background}}@variant max-sm{.menu{border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-width:0;border-left-width:0;border-right-width:0;bottom:0;box-shadow:var(--shadow-heavy-top);font-size:var(--text-lg);inset-inline-start:0!important;left:0;margin-block:0;margin-top:0!important;max-height:70vh;max-width:unset;min-width:0!important;right:0;top:unset!important}.menu .menu-list{max-height:unset!important}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer base{.fade-enter-active,.fade-leave-active,.grow-x-enter-active,.grow-x-leave-active,.grow-y-enter-active,.grow-y-leave-active{transition:opacity;transition-duration:
|
|
1
|
+
@layer base{:root{--fade-transition-duration:calc(var(--default-transition-duration)*2);--grow-transition-duration:calc(var(--default-transition-duration)*2);--slide-transition-duration:calc(var(--default-transition-duration)*3);--scale-transition-duration:calc(var(--default-transition-duration)*2)}.fade-enter-active,.fade-leave-active,.grow-x-enter-active,.grow-x-leave-active,.grow-y-enter-active,.grow-y-leave-active{transition:opacity;transition-duration:var(--fade-transition-duration);transition-timing-function:var(--default-transition-timing-function)}.fade-enter-from,.fade-leave-to,.grow-x-enter-from,.grow-x-leave-to,.grow-y-enter-from,.grow-y-leave-to{opacity:0}@supports (interpolate-size:allow-keywords){.grow-y-enter-active,.grow-y-leave-active{interpolate-size:allow-keywords;height:-moz-max-content;height:max-content;overflow-y:clip;transition:opacity,height;transition-duration:var(--grow-transition-duration);transition-timing-function:var(--default-transition-timing-function)}.grow-y-enter-from,.grow-y-leave-to{height:0!important}.grow-x-enter-active,.grow-x-leave-active{interpolate-size:allow-keywords;overflow-x:clip;transition:opacity,width;transition-duration:var(--grow-transition-duration);transition-timing-function:var(--default-transition-timing-function);width:-moz-fit-content;width:fit-content}.grow-x-enter-from,.grow-x-leave-to{width:0!important}}.slide-in-bottom-enter-active,.slide-in-bottom-leave-active,.slide-in-left-enter-active,.slide-in-left-leave-active,.slide-in-right-enter-active,.slide-in-right-leave-active,.slide-in-top-enter-active,.slide-in-top-leave-active{transition-duration:var(--slide-transition-duration);transition-property:transform;transition-timing-function:var(--default-transition-timing-function)}.slide-in-left-enter-from,.slide-in-left-leave-to{transform:translateX(-100%)}.slide-in-right-enter-from,.slide-in-right-leave-to{transform:translateX(100%)}.slide-in-top-enter-from,.slide-in-top-leave-to{transform:translateY(-100%)}.slide-in-bottom-enter-from,.slide-in-bottom-leave-to{transform:translateY(100%)}.scale-enter-active,.scale-leave-active{transition-duration:var(--scale-transition-duration);transition-property:opacity,transform;transition-timing-function:var(--default-transition-timing-function)}.scale-enter-from,.scale-leave-to{opacity:0;transform:scale(.85)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@utility content-zero-width{content:var(--zero-width-space)}@utility occlude-background{backdrop-filter:blur(var(--blur-xs));background-color:--alpha(var(--color-black)/60%);transition-duration:calc(var(--default-transition-duration)*3);transition-property:background-color,backdrop-filter;&:has(>[class*=-enter-from],>[class*=-leave-active],>[class*=-leave-to]){backdrop-filter:blur(0);background-color:transparent}}
|
|
1
|
+
@utility content-zero-width{content:var(--zero-width-space)}@utility occlude-background{backdrop-filter:blur(var(--blur-xs));background-color:--alpha(var(--color-black)/60%);transition-duration:calc(var(--default-transition-duration)*3);transition-property:background-color,backdrop-filter;&:has(>[class*=-enter-from],>[class*=-leave-active],>[class*=-leave-to]){backdrop-filter:blur(0);background-color:transparent}}@utility styled-scroll{scrollbar-color:color-mix(in srgb-linear,transparent 75%,var(--color-global-foreground-accent)) transparent;scrollbar-width:thin;transition:scrollbar-color .4s ease-out;&:focus-visible,&:focus-within,&:hover{scrollbar-color:var(--color-global-foreground-accent) transparent;transition-delay:0s}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "./brand/anchor.css";@import "./brand/application.css";@import "./brand/button.css";@import "./brand/gradient.css";@import "./brand/status.css";@import "./brand/theme.css";@import "./brand/tooltip.css";@import "./brand/transition.css";@import "./brand/typography.css";@import "./brand/utilities.css";
|
|
1
|
+
@import "./brand/anchor.css";@import "./brand/application.css";@import "./brand/button.css";@import "./brand/form.css";@import "./brand/gradient.css";@import "./brand/menu.css";@import "./brand/mobile.css";@import "./brand/status.css";@import "./brand/theme.css";@import "./brand/tooltip.css";@import "./brand/transition.css";@import "./brand/typography.css";@import "./brand/utilities.css";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FormSubmitEvent as PrimeFormSubmitEvent } from '@primevue/forms/form';
|
|
2
|
+
import type { Ref } from 'vue';
|
|
3
|
+
/**
|
|
4
|
+
* An object which carries the current values of a form's input fields.
|
|
5
|
+
*/
|
|
6
|
+
export type FormValues = Record<string, any>;
|
|
7
|
+
/**
|
|
8
|
+
* The object provided by a form, conveying stateful information, that can be
|
|
9
|
+
* injected into descendent components.
|
|
10
|
+
*/
|
|
11
|
+
export interface FormInstance {
|
|
12
|
+
hasSubmitted: Ref<boolean>;
|
|
13
|
+
isSubmitting: Ref<boolean>;
|
|
14
|
+
isDisabled: Ref<boolean>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The event argument of a Form's `onsubmit` callback.
|
|
18
|
+
*/
|
|
19
|
+
export type FormSubmitEvent<T extends FormValues = FormValues> = PrimeFormSubmitEvent<T>;
|
|
20
|
+
/**
|
|
21
|
+
* The `onsubmit` callback method of a Form.
|
|
22
|
+
*/
|
|
23
|
+
export type FormSubmitHandler<T extends FormValues = FormValues> = (event: FormSubmitEvent<T>) => void | Promise<void>;
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blocks the body from being able to scroll in the same way that Primevue does
|
|
3
|
+
* internally, but with the added functionality of returning the method that can
|
|
4
|
+
* be used to perform the unblock. If the body has already been scroll-blocked by
|
|
5
|
+
* something else (say, this is being trigger by a menu that is being used inside
|
|
6
|
+
* a drawer), then the returned method is a noop.
|
|
7
|
+
*/
|
|
8
|
+
export declare function blockBodyScroll(): () => void;
|
|
9
|
+
export declare function unblockBodyScroll(): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { blockBodyScroll as block, unblockBodyScroll as unblock } from "@primeuix/utils/dom";
|
|
2
|
+
import { OverflowHiddenClass, ScrollbarWidthPropName } from "../constants.js";
|
|
3
|
+
export function blockBodyScroll() {
|
|
4
|
+
try {
|
|
5
|
+
if (!document.body.classList.contains(OverflowHiddenClass)) {
|
|
6
|
+
block({
|
|
7
|
+
className: OverflowHiddenClass,
|
|
8
|
+
variableName: ScrollbarWidthPropName
|
|
9
|
+
});
|
|
10
|
+
return () => unblockBodyScroll();
|
|
11
|
+
}
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
return () => {
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function unblockBodyScroll() {
|
|
18
|
+
try {
|
|
19
|
+
unblock({
|
|
20
|
+
className: OverflowHiddenClass,
|
|
21
|
+
variableName: ScrollbarWidthPropName
|
|
22
|
+
});
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
}
|