@volverjs/ui-vue 0.0.9-beta.2 → 0.0.9-beta.20
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 +3 -3
- package/auto-imports.d.ts +2 -0
- package/dist/components/VvAccordion/VvAccordion.es.js +7 -0
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +7 -0
- package/dist/components/VvAction/VvAction.es.js +9 -1
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +9 -0
- package/dist/components/VvAction/index.d.ts +4 -0
- package/dist/components/VvAlert/VvAlert.es.js +14 -6
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +6 -6
- package/dist/components/VvAlert/index.d.ts +3 -3
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +14 -6
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +3 -3
- package/dist/components/VvAlertGroup/index.d.ts +1 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +7 -0
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +7 -0
- package/dist/components/VvBadge/VvBadge.es.js +7 -0
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +7 -0
- package/dist/components/VvButton/VvButton.es.js +11 -2
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +9 -0
- package/dist/components/VvButton/index.d.ts +4 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -0
- package/dist/components/VvCard/VvCard.es.js +7 -0
- package/dist/components/VvCheckbox/VvCheckbox.es.js +91 -14
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +97 -15
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +243 -179
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +323 -95
- package/dist/components/VvCombobox/index.d.ts +123 -35
- package/dist/components/VvDialog/VvDialog.es.js +42 -30
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +19 -6
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +291 -84
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +9 -0
- package/dist/components/VvDropdown/index.d.ts +96 -27
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +9 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +7 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +7 -0
- package/dist/components/VvInputText/VvInputText.es.js +271 -109
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +23 -41
- package/dist/components/VvInputText/index.d.ts +25 -35
- package/dist/components/VvNav/VvNav.es.js +10 -2
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/index.d.ts +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +7 -0
- package/dist/components/VvRadio/VvRadio.es.js +91 -14
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +97 -15
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +87 -14
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +5 -5
- package/dist/components/VvTab/VvTab.es.js +10 -2
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +95 -19
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
- package/dist/components/VvTooltip/VvTooltip.es.js +7 -0
- package/dist/components/common/HintSlot.d.ts +4 -3
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.es.js +1199 -614
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useAlert.d.ts +27 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.es.js +81 -0
- package/dist/composables/index.umd.js +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/directives/index.es.js +7 -0
- package/dist/directives/v-tooltip.es.js +7 -0
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +103 -27
- package/dist/resolvers/unplugin.es.js +3 -0
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -2
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +54 -269
- package/dist/stories/Alert/Alert.settings.d.ts +3 -7
- package/dist/stories/AlertGroup/AlertGroupSlots.stories.d.ts +2 -2
- package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +6 -0
- package/dist/stories/Button/Button.settings.d.ts +3 -13
- package/dist/stories/Combobox/Combobox.settings.d.ts +117 -19
- package/dist/stories/InputText/InputText.settings.d.ts +31 -9
- package/dist/stories/InputText/InputText.stories.d.ts +0 -1
- package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
- package/dist/stories/Nav/Nav.settings.d.ts +3 -21
- package/package.json +75 -66
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAction/VvAction.vue +2 -1
- package/src/components/VvAlert/VvAlert.vue +5 -1
- package/src/components/VvAlert/index.ts +3 -3
- package/src/components/VvAlertGroup/VvAlertGroup.vue +2 -0
- package/src/components/VvButton/VvButton.vue +1 -0
- package/src/components/VvCheckbox/VvCheckbox.vue +8 -1
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +8 -1
- package/src/components/VvCombobox/VvCombobox.vue +43 -23
- package/src/components/VvCombobox/index.ts +24 -0
- package/src/components/VvDialog/VvDialog.vue +22 -19
- package/src/components/VvDropdown/VvDropdown.vue +14 -9
- package/src/components/VvInputText/VvInputText.vue +177 -55
- package/src/components/VvInputText/index.ts +32 -34
- package/src/components/VvNav/VvNav.vue +1 -1
- package/src/components/VvNav/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +8 -1
- package/src/components/VvRadioGroup/VvRadioGroup.vue +8 -1
- package/src/components/VvSelect/VvSelect.vue +8 -1
- package/src/components/VvTextarea/VvTextarea.vue +16 -6
- package/src/components/common/HintSlot.ts +26 -13
- package/src/components/index.ts +5 -0
- package/src/composables/alert/useAlert.ts +103 -0
- package/src/composables/index.ts +1 -0
- package/src/constants.ts +21 -0
- package/src/props/index.ts +7 -0
- package/src/resolvers/unplugin.ts +3 -0
- package/src/stories/Alert/Alert.settings.ts +3 -1
- package/src/stories/AlertGroup/AlertGroup.test.ts +13 -0
- package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +3 -3
- package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +118 -0
- package/src/stories/Button/Button.settings.ts +5 -3
- package/src/stories/Combobox/Combobox.settings.ts +119 -2
- package/src/stories/Combobox/Combobox.test.ts +1 -1
- package/src/stories/InputText/InputText.settings.ts +36 -15
- package/src/stories/InputText/InputText.stories.ts +4 -12
- package/src/stories/InputText/InputText.test.ts +31 -15
- package/src/stories/InputText/InputTextMask.stories.ts +122 -0
- package/src/stories/Nav/Nav.settings.ts +3 -1
- package/src/stories/Tab/Tab.stories.ts +3 -3
- package/src/stories/Textarea/TextareaLength.stories.ts +1 -1
- package/src/types/alert.d.ts +20 -0
- /package/dist/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue.d.ts +0 -0
- /package/dist/components/{VvNavSeparator → VvNav}/VvNavSeparator.d.ts +0 -0
- /package/src/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue +0 -0
- /package/src/components/{VvNavSeparator → VvNav}/VvNavSeparator.ts +0 -0
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
+
import type { Option } from '../../types/generic';
|
|
2
3
|
export declare const VvComboboxEvents: string[];
|
|
3
4
|
export declare const VvComboboxProps: {
|
|
5
|
+
/**
|
|
6
|
+
* Dropdown show / hide transition name
|
|
7
|
+
*/
|
|
8
|
+
transitionName: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
4
12
|
/**
|
|
5
13
|
* modelValue can be a string, number, boolean, object or array of string, number, boolean, object
|
|
6
14
|
*/
|
|
@@ -50,6 +58,13 @@ export declare const VvComboboxProps: {
|
|
|
50
58
|
type: StringConstructor;
|
|
51
59
|
default: string;
|
|
52
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Label close button
|
|
63
|
+
*/
|
|
64
|
+
closeLabel: {
|
|
65
|
+
type: StringConstructor;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
53
68
|
/**
|
|
54
69
|
* Select input placeholder
|
|
55
70
|
*/
|
|
@@ -58,6 +73,13 @@ export declare const VvComboboxProps: {
|
|
|
58
73
|
* Use input text to search on options
|
|
59
74
|
*/
|
|
60
75
|
searchable: BooleanConstructor;
|
|
76
|
+
/**
|
|
77
|
+
* Search function to filter options
|
|
78
|
+
*/
|
|
79
|
+
searchFunction: {
|
|
80
|
+
type: PropType<(search: string, options: (Option | string)[]) => (Option | string)[] | Promise<(Option | string)[]>>;
|
|
81
|
+
default: undefined;
|
|
82
|
+
};
|
|
61
83
|
/**
|
|
62
84
|
* On searchable select is the input search placeholder
|
|
63
85
|
*/
|
|
@@ -141,41 +163,99 @@ export declare const VvComboboxProps: {
|
|
|
141
163
|
default: string;
|
|
142
164
|
validator: (value: "fixed" | "absolute") => boolean;
|
|
143
165
|
};
|
|
144
|
-
transitionName: {
|
|
145
|
-
type: StringConstructor;
|
|
146
|
-
};
|
|
147
166
|
offset: {
|
|
148
167
|
type: PropType<string | import("@floating-ui/core").OffsetOptions | undefined>;
|
|
149
168
|
default: number;
|
|
150
169
|
};
|
|
151
170
|
shift: {
|
|
152
|
-
type: PropType<boolean |
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
171
|
+
type: PropType<boolean | {
|
|
172
|
+
mainAxis?: boolean | undefined;
|
|
173
|
+
crossAxis?: boolean | undefined;
|
|
174
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
175
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
176
|
+
altBoundary?: boolean | undefined;
|
|
177
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
178
|
+
limiter?: {
|
|
179
|
+
fn: (state: import("@floating-ui/core").MiddlewareState) => import("@floating-ui/core").Coords;
|
|
180
|
+
options?: any;
|
|
181
|
+
} | undefined;
|
|
182
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
183
|
+
} | import("@floating-ui/dom").Derivable<{
|
|
184
|
+
mainAxis?: boolean | undefined;
|
|
185
|
+
crossAxis?: boolean | undefined;
|
|
186
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
187
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
188
|
+
altBoundary?: boolean | undefined;
|
|
189
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
190
|
+
limiter?: {
|
|
191
|
+
fn: (state: import("@floating-ui/core").MiddlewareState) => import("@floating-ui/core").Coords;
|
|
192
|
+
options?: any;
|
|
193
|
+
} | undefined;
|
|
194
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
158
195
|
}> | undefined>;
|
|
159
196
|
default: boolean;
|
|
160
197
|
};
|
|
161
198
|
flip: {
|
|
162
|
-
type: PropType<boolean |
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
199
|
+
type: PropType<boolean | {
|
|
200
|
+
mainAxis?: boolean | undefined;
|
|
201
|
+
crossAxis?: boolean | undefined;
|
|
202
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
203
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
204
|
+
altBoundary?: boolean | undefined;
|
|
205
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
206
|
+
fallbackPlacements?: import("@floating-ui/core").Placement[] | undefined;
|
|
207
|
+
fallbackStrategy?: "initialPlacement" | "bestFit" | undefined;
|
|
208
|
+
fallbackAxisSideDirection?: "start" | "end" | "none" | undefined;
|
|
209
|
+
flipAlignment?: boolean | undefined;
|
|
210
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
211
|
+
} | import("@floating-ui/dom").Derivable<{
|
|
212
|
+
mainAxis?: boolean | undefined;
|
|
213
|
+
crossAxis?: boolean | undefined;
|
|
214
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
215
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
216
|
+
altBoundary?: boolean | undefined;
|
|
217
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
218
|
+
fallbackPlacements?: import("@floating-ui/core").Placement[] | undefined;
|
|
219
|
+
fallbackStrategy?: "initialPlacement" | "bestFit" | undefined;
|
|
220
|
+
fallbackAxisSideDirection?: "start" | "end" | "none" | undefined;
|
|
221
|
+
flipAlignment?: boolean | undefined;
|
|
222
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
168
223
|
}> | undefined>;
|
|
169
224
|
default: boolean;
|
|
170
225
|
};
|
|
171
226
|
size: {
|
|
172
|
-
type: PropType<boolean |
|
|
173
|
-
|
|
227
|
+
type: PropType<boolean | {
|
|
228
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
229
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
230
|
+
altBoundary?: boolean | undefined;
|
|
231
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
232
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
233
|
+
apply?: ((args: {
|
|
174
234
|
x: number;
|
|
175
235
|
y: number;
|
|
236
|
+
initialPlacement: import("@floating-ui/core").Placement;
|
|
176
237
|
placement: import("@floating-ui/core").Placement;
|
|
177
238
|
strategy: import("@floating-ui/core").Strategy;
|
|
239
|
+
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
240
|
+
rects: import("@floating-ui/core").ElementRects;
|
|
241
|
+
platform: import("@floating-ui/core").Platform;
|
|
242
|
+
elements: import("@floating-ui/dom").Elements;
|
|
243
|
+
} & {
|
|
244
|
+
availableWidth: number;
|
|
245
|
+
availableHeight: number;
|
|
246
|
+
}) => void | Promise<void>) | undefined;
|
|
247
|
+
} | import("@floating-ui/dom").Derivable<{
|
|
248
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
249
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
250
|
+
altBoundary?: boolean | undefined;
|
|
251
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
252
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
253
|
+
apply?: ((args: {
|
|
254
|
+
x: number;
|
|
255
|
+
y: number;
|
|
178
256
|
initialPlacement: import("@floating-ui/core").Placement;
|
|
257
|
+
placement: import("@floating-ui/core").Placement;
|
|
258
|
+
strategy: import("@floating-ui/core").Strategy;
|
|
179
259
|
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
180
260
|
rects: import("@floating-ui/core").ElementRects;
|
|
181
261
|
platform: import("@floating-ui/core").Platform;
|
|
@@ -183,25 +263,33 @@ export declare const VvComboboxProps: {
|
|
|
183
263
|
} & {
|
|
184
264
|
availableWidth: number;
|
|
185
265
|
availableHeight: number;
|
|
186
|
-
}) => void | Promise<void
|
|
187
|
-
} & {
|
|
188
|
-
rootBoundary: import("@floating-ui/core").RootBoundary;
|
|
189
|
-
elementContext: import("@floating-ui/core").ElementContext;
|
|
190
|
-
altBoundary: boolean;
|
|
191
|
-
padding: import("@floating-ui/core").Padding;
|
|
192
|
-
boundary: import("@floating-ui/dom").Boundary;
|
|
266
|
+
}) => void | Promise<void>) | undefined;
|
|
193
267
|
}> | undefined>;
|
|
194
268
|
default: () => {
|
|
195
269
|
padding: number;
|
|
196
270
|
};
|
|
197
271
|
};
|
|
198
272
|
autoPlacement: {
|
|
199
|
-
type: PropType<boolean |
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
273
|
+
type: PropType<boolean | {
|
|
274
|
+
crossAxis?: boolean | undefined;
|
|
275
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
276
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
277
|
+
altBoundary?: boolean | undefined;
|
|
278
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
279
|
+
alignment?: import("@floating-ui/core").Alignment | null | undefined;
|
|
280
|
+
autoAlignment?: boolean | undefined;
|
|
281
|
+
allowedPlacements?: import("@floating-ui/core").Placement[] | undefined;
|
|
282
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
283
|
+
} | import("@floating-ui/dom").Derivable<{
|
|
284
|
+
crossAxis?: boolean | undefined;
|
|
285
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
286
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
287
|
+
altBoundary?: boolean | undefined;
|
|
288
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
289
|
+
alignment?: import("@floating-ui/core").Alignment | null | undefined;
|
|
290
|
+
autoAlignment?: boolean | undefined;
|
|
291
|
+
allowedPlacements?: import("@floating-ui/core").Placement[] | undefined;
|
|
292
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
205
293
|
}> | undefined>;
|
|
206
294
|
default: boolean;
|
|
207
295
|
};
|
|
@@ -227,12 +315,14 @@ export declare const VvComboboxProps: {
|
|
|
227
315
|
validation: (value: import("../../constants").Position) => boolean;
|
|
228
316
|
};
|
|
229
317
|
options: {
|
|
230
|
-
type: PropType<(string |
|
|
318
|
+
type: PropType<(string | Option)[]>;
|
|
231
319
|
default: () => never[];
|
|
232
320
|
};
|
|
233
321
|
labelKey: {
|
|
234
322
|
type: (StringConstructor | FunctionConstructor)[];
|
|
235
|
-
default: string;
|
|
323
|
+
default: string; /**
|
|
324
|
+
* Manage modelValue as string[] or object[]
|
|
325
|
+
*/
|
|
236
326
|
};
|
|
237
327
|
valueKey: {
|
|
238
328
|
type: (StringConstructor | FunctionConstructor)[];
|
|
@@ -243,9 +333,7 @@ export declare const VvComboboxProps: {
|
|
|
243
333
|
default: string;
|
|
244
334
|
};
|
|
245
335
|
modifiers: PropType<string | string[]>;
|
|
246
|
-
readonly: BooleanConstructor;
|
|
247
|
-
* Manage modelValue as string[] or object[]
|
|
248
|
-
*/
|
|
336
|
+
readonly: BooleanConstructor;
|
|
249
337
|
disabled: BooleanConstructor;
|
|
250
338
|
loading: BooleanConstructor;
|
|
251
339
|
loadingLabel: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, Transition, toHandlers, withCtx, withDirectives, createElementVNode, createElementBlock, renderSlot, createTextVNode, toDisplayString, createVNode, vShow } from "vue";
|
|
1
|
+
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, Transition, toHandlers, withCtx, withDirectives, createElementVNode, withModifiers, createElementBlock, renderSlot, createTextVNode, toDisplayString, createVNode, vShow } from "vue";
|
|
2
2
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
|
-
import {
|
|
3
|
+
import { useVModel, onClickOutside } from "@vueuse/core";
|
|
4
4
|
const VvIconProps = {
|
|
5
5
|
/**
|
|
6
6
|
* Color
|
|
@@ -436,6 +436,13 @@ const IdProps = {
|
|
|
436
436
|
type: String,
|
|
437
437
|
default: ButtonType.button,
|
|
438
438
|
validator: (value) => Object.values(ButtonType).includes(value)
|
|
439
|
+
},
|
|
440
|
+
/**
|
|
441
|
+
* Button aria-label
|
|
442
|
+
*/
|
|
443
|
+
ariaLabel: {
|
|
444
|
+
type: String,
|
|
445
|
+
default: void 0
|
|
439
446
|
}
|
|
440
447
|
});
|
|
441
448
|
const VvDialogEvents = [
|
|
@@ -477,12 +484,13 @@ const VvDialogProps = {
|
|
|
477
484
|
*/
|
|
478
485
|
keepOpen: { type: Boolean, default: false }
|
|
479
486
|
};
|
|
480
|
-
const _hoisted_1 =
|
|
487
|
+
const _hoisted_1 = ["onCancel"];
|
|
488
|
+
const _hoisted_2 = {
|
|
481
489
|
key: 0,
|
|
482
490
|
class: "vv-dialog__header"
|
|
483
491
|
};
|
|
484
|
-
const
|
|
485
|
-
const
|
|
492
|
+
const _hoisted_3 = { class: "vv-dialog__content" };
|
|
493
|
+
const _hoisted_4 = {
|
|
486
494
|
key: 1,
|
|
487
495
|
class: "vv-dialog__footer"
|
|
488
496
|
};
|
|
@@ -496,16 +504,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
496
504
|
setup(__props, { expose: __expose, emit }) {
|
|
497
505
|
const props = __props;
|
|
498
506
|
const dialogEl = ref();
|
|
507
|
+
const modelValue = useVModel(props, "modelValue", emit);
|
|
499
508
|
const localModelValue = ref(false);
|
|
500
|
-
const
|
|
501
|
-
get()
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
localModelValue.value = value;
|
|
509
|
+
const isOpened = computed({
|
|
510
|
+
get: () => modelValue.value ?? localModelValue.value,
|
|
511
|
+
set: (newValue) => {
|
|
512
|
+
if (modelValue.value === void 0) {
|
|
513
|
+
localModelValue.value = newValue;
|
|
514
|
+
return;
|
|
507
515
|
}
|
|
508
|
-
|
|
516
|
+
modelValue.value = newValue;
|
|
509
517
|
}
|
|
510
518
|
});
|
|
511
519
|
const modalWrapper = ref(null);
|
|
@@ -524,14 +532,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
524
532
|
const transitioName = computed(() => `vv-dialog--${props.transition}`);
|
|
525
533
|
const dialogTransitionHandlers = {
|
|
526
534
|
"before-enter": () => {
|
|
527
|
-
var _a;
|
|
528
|
-
(_a = dialogEl.value) == null ? void 0 : _a.
|
|
535
|
+
var _a, _b;
|
|
536
|
+
if (!((_a = dialogEl.value) == null ? void 0 : _a.open)) {
|
|
537
|
+
(_b = dialogEl.value) == null ? void 0 : _b.showModal();
|
|
538
|
+
}
|
|
529
539
|
emit("open");
|
|
530
540
|
emit("before-enter");
|
|
531
541
|
},
|
|
532
542
|
"after-leave": () => {
|
|
533
|
-
var _a;
|
|
534
|
-
(_a = dialogEl.value) == null ? void 0 : _a.
|
|
543
|
+
var _a, _b;
|
|
544
|
+
if ((_a = dialogEl.value) == null ? void 0 : _a.open) {
|
|
545
|
+
(_b = dialogEl.value) == null ? void 0 : _b.close();
|
|
546
|
+
}
|
|
535
547
|
emit("close");
|
|
536
548
|
emit("after-leave");
|
|
537
549
|
},
|
|
@@ -556,36 +568,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
556
568
|
};
|
|
557
569
|
onClickOutside(modalWrapper, () => {
|
|
558
570
|
if (!props.keepOpen) {
|
|
559
|
-
|
|
571
|
+
close();
|
|
560
572
|
}
|
|
561
573
|
});
|
|
562
574
|
function close() {
|
|
563
|
-
|
|
575
|
+
isOpened.value = false;
|
|
564
576
|
}
|
|
565
577
|
function open() {
|
|
566
|
-
|
|
578
|
+
isOpened.value = true;
|
|
567
579
|
}
|
|
568
580
|
__expose({ close, open });
|
|
569
|
-
|
|
570
|
-
if (
|
|
571
|
-
e.preventDefault();
|
|
581
|
+
const onCancel = () => {
|
|
582
|
+
if (!props.keepOpen) {
|
|
572
583
|
close();
|
|
573
584
|
}
|
|
574
|
-
}
|
|
585
|
+
};
|
|
575
586
|
return (_ctx, _cache) => {
|
|
576
587
|
return openBlock(), createBlock(Transition, mergeProps({ name: unref(transitioName) }, toHandlers(dialogTransitionHandlers)), {
|
|
577
588
|
default: withCtx(() => [
|
|
578
589
|
withDirectives(createElementVNode("dialog", mergeProps(unref(dialogAttrs), {
|
|
579
590
|
ref_key: "dialogEl",
|
|
580
591
|
ref: dialogEl,
|
|
581
|
-
class: unref(dialogClass)
|
|
592
|
+
class: unref(dialogClass),
|
|
593
|
+
onCancel: withModifiers(onCancel, ["stop", "prevent"])
|
|
582
594
|
}), [
|
|
583
595
|
createElementVNode("article", {
|
|
584
596
|
ref_key: "modalWrapper",
|
|
585
597
|
ref: modalWrapper,
|
|
586
598
|
class: "vv-dialog__wrapper"
|
|
587
599
|
}, [
|
|
588
|
-
_ctx.$slots.header || _ctx.title ? (openBlock(), createElementBlock("header",
|
|
600
|
+
_ctx.$slots.header || _ctx.title ? (openBlock(), createElementBlock("header", _hoisted_2, [
|
|
589
601
|
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
590
602
|
createTextVNode(toDisplayString(_ctx.title) + " ", 1),
|
|
591
603
|
createElementVNode("button", {
|
|
@@ -598,15 +610,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
598
610
|
], 32)
|
|
599
611
|
])
|
|
600
612
|
])) : createCommentVNode("", true),
|
|
601
|
-
createElementVNode("div",
|
|
613
|
+
createElementVNode("div", _hoisted_3, [
|
|
602
614
|
renderSlot(_ctx.$slots, "default")
|
|
603
615
|
]),
|
|
604
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock("footer",
|
|
616
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_4, [
|
|
605
617
|
renderSlot(_ctx.$slots, "footer")
|
|
606
618
|
])) : createCommentVNode("", true)
|
|
607
619
|
], 512)
|
|
608
|
-
], 16), [
|
|
609
|
-
[vShow, unref(
|
|
620
|
+
], 16, _hoisted_1), [
|
|
621
|
+
[vShow, unref(isOpened)]
|
|
610
622
|
])
|
|
611
623
|
]),
|
|
612
624
|
_: 3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("@iconify/vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDialog=o(e.vue,e.vue$1,e.core)}(this,(function(e,o,t){"use strict";const
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("@iconify/vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDialog=o(e.vue,e.vue$1,e.core)}(this,(function(e,o,t){"use strict";const n={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const a=Symbol.for("volver");const c=e.defineComponent({name:"VvIcon",props:n,setup(t){const n=t,r=e.computed((()=>"string"==typeof n.rotate?parseFloat(n.rotate):n.rotate)),l=e.ref(!0),i=e.inject(a),{modifiers:c}=e.toRefs(n),s=function(o,t,n){return e.computed((()=>{const r={[o]:!0},l="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(r[`${o}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((t=>{r[`${o}--${t}`]=e.unref(n.value[t])})),r}))}("vv-icon",c),u=e.computed((()=>n.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=n.name??"",t=`@${u.value}:${n.prefix}:${e}`;if(o.iconExists(t))return t;const r=null==i?void 0:i.iconsCollections.find((t=>{const n=`@${u.value}:${t.prefix}:${e}`;return o.iconExists(n)}));return r?`@${u.value}:${r.prefix}:${e}`:e}));function v(e){const t=function(e){let o;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");o=(new e).window}return(o?new o.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),r=(null==t?void 0:t.innerHTML.trim())||"";t&&r&&o.addIcon(`@${u.value}:${n.prefix}:${n.name}`,{body:r,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&n.src&&!o.iconExists(`@${u.value}:${n.prefix}:${n.name}`)&&(l.value=!1,i.fetchIcon(n.src).then((e=>{e&&(v(e),l.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),n.svg&&v(n.svg),(t,n)=>e.unref(l)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(s)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(r),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}});Boolean,Boolean,Boolean;l.before;const s={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,i.button;const u={...s,title:String,modelValue:{type:Boolean,default:void 0},transition:{type:String,default:"fade-block"},size:String,keepOpen:{type:Boolean,default:!1}},d=["onCancel"],v={key:0,class:"vv-dialog__header"},f={class:"vv-dialog__content"},p={key:1,class:"vv-dialog__footer"};return e.defineComponent({name:"VvDialog",props:u,emits:["open","close","update:modelValue","before-enter","after-leave","enter","after-enter","enter-cancelled","before-leave","leave","leave-cancelled"],setup(o,{expose:n,emit:r}){const l=o,i=e.ref(),a=t.useVModel(l,"modelValue",r),s=e.ref(!1),u=e.computed({get:()=>a.value??s.value,set:e=>{void 0!==a.value?a.value=e:s.value=e}}),m=e.ref(null),g=e.computed((()=>{const{id:e}=l;return{id:e}})),h=e.computed((()=>l.size?["vv-dialog",`vv-dialog--${l.size}`]:"vv-dialog")),b=e.computed((()=>`vv-dialog--${l.transition}`)),y={"before-enter":()=>{var e,o;(null==(e=i.value)?void 0:e.open)||null==(o=i.value)||o.showModal(),r("open"),r("before-enter")},"after-leave":()=>{var e,o;(null==(e=i.value)?void 0:e.open)&&(null==(o=i.value)||o.close()),r("close"),r("after-leave")},enter:()=>{r("enter")},"after-enter":()=>{r("after-enter")},"enter-cancelled":()=>{r("enter-cancelled")},"before-leave":()=>{r("before-leave")},leave:()=>{r("leave")},"leave-cancelled":()=>{r("leave-cancelled")}};function $(){u.value=!1}t.onClickOutside(m,(()=>{l.keepOpen||$()})),n({close:$,open:function(){u.value=!0}});const B=()=>{l.keepOpen||$()};return(o,t)=>(e.openBlock(),e.createBlock(e.Transition,e.mergeProps({name:e.unref(b)},e.toHandlers(y)),{default:e.withCtx((()=>[e.withDirectives(e.createElementVNode("dialog",e.mergeProps(e.unref(g),{ref_key:"dialogEl",ref:i,class:e.unref(h),onCancel:e.withModifiers(B,["stop","prevent"])}),[e.createElementVNode("article",{ref_key:"modalWrapper",ref:m,class:"vv-dialog__wrapper"},[o.$slots.header||o.title?(e.openBlock(),e.createElementBlock("header",v,[e.renderSlot(o.$slots,"header",{},(()=>[e.createTextVNode(e.toDisplayString(o.title)+" ",1),e.createElementVNode("button",{type:"button","aria-label":"Close",class:"vv-dialog__close",onClickPassive:$},[e.createVNode(c,{name:"close"})],32)]))])):e.createCommentVNode("",!0),e.createElementVNode("div",f,[e.renderSlot(o.$slots,"default")]),o.$slots.footer?(e.openBlock(),e.createElementBlock("footer",p,[e.renderSlot(o.$slots,"footer")])):e.createCommentVNode("",!0)],512)],16,d),[[e.vShow,e.unref(u)]])])),_:3},16,["name"]))}})}));
|
|
@@ -243,6 +243,13 @@ const DropdownProps = {
|
|
|
243
243
|
type: String,
|
|
244
244
|
default: ButtonType.button,
|
|
245
245
|
validator: (value) => Object.values(ButtonType).includes(value)
|
|
246
|
+
},
|
|
247
|
+
/**
|
|
248
|
+
* Button aria-label
|
|
249
|
+
*/
|
|
250
|
+
ariaLabel: {
|
|
251
|
+
type: String,
|
|
252
|
+
default: void 0
|
|
246
253
|
}
|
|
247
254
|
});
|
|
248
255
|
const VvDropdownProps = {
|
|
@@ -403,7 +410,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
403
410
|
}
|
|
404
411
|
} else if (props.flip) {
|
|
405
412
|
if (typeof props.flip === "boolean") {
|
|
406
|
-
toReturn.push(flip());
|
|
413
|
+
toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
|
|
407
414
|
} else {
|
|
408
415
|
toReturn.push(flip(props.flip));
|
|
409
416
|
}
|
|
@@ -459,23 +466,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
459
466
|
referenceEl,
|
|
460
467
|
floatingEl,
|
|
461
468
|
{
|
|
462
|
-
whileElementsMounted:
|
|
469
|
+
whileElementsMounted: (...args) => {
|
|
470
|
+
return autoUpdate(...args, {
|
|
471
|
+
animationFrame: props.strategy === "fixed"
|
|
472
|
+
});
|
|
473
|
+
},
|
|
463
474
|
placement: computed(() => props.placement),
|
|
464
475
|
strategy: computed(() => props.strategy),
|
|
465
476
|
middleware
|
|
466
477
|
}
|
|
467
478
|
);
|
|
468
479
|
const dropdownPlacement = computed(() => {
|
|
480
|
+
var _a;
|
|
469
481
|
if (hasCustomPosition.value) {
|
|
470
482
|
return void 0;
|
|
471
483
|
}
|
|
484
|
+
const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
|
|
472
485
|
return {
|
|
473
486
|
position: strategy.value,
|
|
474
487
|
top: `${y.value ?? 0}px`,
|
|
475
488
|
left: `${x.value ?? 0}px`,
|
|
476
|
-
maxWidth: maxWidth.value,
|
|
489
|
+
maxWidth: width ? void 0 : maxWidth.value,
|
|
477
490
|
maxHeight: maxHeight.value,
|
|
478
|
-
width
|
|
491
|
+
width
|
|
479
492
|
};
|
|
480
493
|
});
|
|
481
494
|
const side = computed(
|
|
@@ -546,7 +559,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
546
559
|
onClickOutside(
|
|
547
560
|
floatingEl,
|
|
548
561
|
() => {
|
|
549
|
-
if (!props.keepOpen) {
|
|
562
|
+
if (!props.keepOpen && expanded.value) {
|
|
550
563
|
expanded.value = false;
|
|
551
564
|
}
|
|
552
565
|
},
|
|
@@ -584,7 +597,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
584
597
|
}
|
|
585
598
|
return [
|
|
586
599
|
...element.querySelectorAll(
|
|
587
|
-
'a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
|
|
600
|
+
'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
|
588
601
|
)
|
|
589
602
|
].filter(
|
|
590
603
|
(el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@floating-ui/vue"),require("nanoid"),require("@vueuse/core"),require("mitt")):"function"==typeof define&&define.amd?define(["vue","@floating-ui/vue","nanoid","@vueuse/core","mitt"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdown=t(e.vue,e.vue$1,e.nanoid,e.core,e.mitt)}(this,(function(e,t,o,r,l){"use strict";var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),n=(e=>(e.topStart="top-start",e.topEnd="top-end",e.bottomStart="bottom-start",e.bottomEnd="bottom-end",e.leftStart="left-start",e.leftEnd="left-end",e.rightStart="right-start",e.rightEnd="right-end",e))(n||{}),u=(e=>(e.before="before",e.after="after",e))(u||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),d=(e=>(e.listbox="listbox",e.menu="menu",e))(d||{}),s=(e=>(e.option="option",e.presentation="presentation",e))(s||{});const f=Symbol.for("dropdownTrigger"),p=Symbol.for("dropdownItem"),c=(Boolean,Boolean,Boolean,{modifiers:[String,Array]});u.before;const v={id:[String,Number]},m={placement:{type:String,default:a.bottom,validator:e=>Object.values(a).includes(e)||Object.values(n).includes(e)},strategy:{type:String,default:"absolute",validator:e=>["fixed","absolute"].includes(e)},transitionName:{type:String},offset:{type:[Number,String,Object],default:0},shift:{type:[Boolean,Object],default:!1},flip:{type:[Boolean,Object],default:!0},size:{type:[Boolean,Object],default:()=>({padding:10})},autoPlacement:{type:[Boolean,Object],default:!1},arrow:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},autofocusFirst:{type:Boolean,default:!0},triggerWidth:{type:Boolean}};i.button;const b={...v,...m,...c,modelValue:{type:Boolean,default:void 0},reference:{type:Object,default:null},role:{type:String,default:d.menu,validator:e=>Object.values(d).includes(e)}};const g=["id","tabindex","role","aria-labelledby"];return e.defineComponent({name:"VvDropdown",inheritAttrs:!1,props:b,emits:["update:modelValue","beforeExpand","beforeCollapse","afterExpand","afterCollapse","before-enter","after-leave","enter","after-enter","enter-cancelled","before-leave","leave","leave-cancelled"],setup(a,{expose:n,emit:u}){const i=a,{id:c}=e.toRefs(i),v=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.nanoid()))))(c),m=e.useAttrs(),b=e.ref("auto"),h=e.ref("auto"),y=e.ref(null),x=e.ref(),w=e.ref(null),S=e.ref(null),E=e.computed({get:()=>i.reference??y.value,set:e=>{y.value=e}}),k=e.ref(!1);e.onMounted((()=>{r.useMutationObserver(x.value,(()=>{var e;k.value="true"===(null==(e=window.getComputedStyle(x.value).getPropertyValue("--dropdown-custom-position"))?void 0:e.trim())}),{attributeFilter:["style"],window:window})}));const P=e.computed((()=>{const e=[];if(i.autoPlacement?"boolean"==typeof i.autoPlacement?e.push(t.autoPlacement()):e.push(t.autoPlacement(i.autoPlacement)):i.flip&&("boolean"==typeof i.flip?e.push(t.flip()):e.push(t.flip(i.flip))),i.shift&&("boolean"==typeof i.shift?e.push(t.shift()):e.push(t.shift(i.shift))),i.size){const o=({availableWidth:e,availableHeight:t})=>{b.value=`${e}px`,h.value=`${t}px`};"boolean"==typeof i.size?e.push(t.size({apply:o})):e.push(t.size({...i.size,apply:o}))}return i.offset&&(e.push(t.offset(Number(i.offset))),["string","number"].includes(typeof i.offset)?e.push(t.offset(Number(i.offset))):e.push(t.offset(i.offset))),i.arrow&&e.push(t.arrow({element:w})),e})),{x:$,y:B,strategy:O,middlewareData:z,placement:V}=t.useFloating(E,x,{whileElementsMounted:t.autoUpdate,placement:e.computed((()=>i.placement)),strategy:e.computed((()=>i.strategy)),middleware:P}),C=e.computed((()=>{if(
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@floating-ui/vue"),require("nanoid"),require("@vueuse/core"),require("mitt")):"function"==typeof define&&define.amd?define(["vue","@floating-ui/vue","nanoid","@vueuse/core","mitt"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdown=t(e.vue,e.vue$1,e.nanoid,e.core,e.mitt)}(this,(function(e,t,o,r,l){"use strict";var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),n=(e=>(e.topStart="top-start",e.topEnd="top-end",e.bottomStart="bottom-start",e.bottomEnd="bottom-end",e.leftStart="left-start",e.leftEnd="left-end",e.rightStart="right-start",e.rightEnd="right-end",e))(n||{}),u=(e=>(e.before="before",e.after="after",e))(u||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),d=(e=>(e.listbox="listbox",e.menu="menu",e))(d||{}),s=(e=>(e.option="option",e.presentation="presentation",e))(s||{});const f=Symbol.for("dropdownTrigger"),p=Symbol.for("dropdownItem"),c=(Boolean,Boolean,Boolean,{modifiers:[String,Array]});u.before;const v={id:[String,Number]},m={placement:{type:String,default:a.bottom,validator:e=>Object.values(a).includes(e)||Object.values(n).includes(e)},strategy:{type:String,default:"absolute",validator:e=>["fixed","absolute"].includes(e)},transitionName:{type:String},offset:{type:[Number,String,Object],default:0},shift:{type:[Boolean,Object],default:!1},flip:{type:[Boolean,Object],default:!0},size:{type:[Boolean,Object],default:()=>({padding:10})},autoPlacement:{type:[Boolean,Object],default:!1},arrow:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},autofocusFirst:{type:Boolean,default:!0},triggerWidth:{type:Boolean}};i.button;const b={...v,...m,...c,modelValue:{type:Boolean,default:void 0},reference:{type:Object,default:null},role:{type:String,default:d.menu,validator:e=>Object.values(d).includes(e)}};const g=["id","tabindex","role","aria-labelledby"];return e.defineComponent({name:"VvDropdown",inheritAttrs:!1,props:b,emits:["update:modelValue","beforeExpand","beforeCollapse","afterExpand","afterCollapse","before-enter","after-leave","enter","after-enter","enter-cancelled","before-leave","leave","leave-cancelled"],setup(a,{expose:n,emit:u}){const i=a,{id:c}=e.toRefs(i),v=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.nanoid()))))(c),m=e.useAttrs(),b=e.ref("auto"),h=e.ref("auto"),y=e.ref(null),x=e.ref(),w=e.ref(null),S=e.ref(null),E=e.computed({get:()=>i.reference??y.value,set:e=>{y.value=e}}),k=e.ref(!1);e.onMounted((()=>{r.useMutationObserver(x.value,(()=>{var e;k.value="true"===(null==(e=window.getComputedStyle(x.value).getPropertyValue("--dropdown-custom-position"))?void 0:e.trim())}),{attributeFilter:["style"],window:window})}));const P=e.computed((()=>{const e=[];if(i.autoPlacement?"boolean"==typeof i.autoPlacement?e.push(t.autoPlacement()):e.push(t.autoPlacement(i.autoPlacement)):i.flip&&("boolean"==typeof i.flip?e.push(t.flip({fallbackStrategy:"initialPlacement"})):e.push(t.flip(i.flip))),i.shift&&("boolean"==typeof i.shift?e.push(t.shift()):e.push(t.shift(i.shift))),i.size){const o=({availableWidth:e,availableHeight:t})=>{b.value=`${e}px`,h.value=`${t}px`};"boolean"==typeof i.size?e.push(t.size({apply:o})):e.push(t.size({...i.size,apply:o}))}return i.offset&&(e.push(t.offset(Number(i.offset))),["string","number"].includes(typeof i.offset)?e.push(t.offset(Number(i.offset))):e.push(t.offset(i.offset))),i.arrow&&e.push(t.arrow({element:w})),e})),{x:$,y:B,strategy:O,middlewareData:z,placement:V}=t.useFloating(E,x,{whileElementsMounted:(...e)=>t.autoUpdate(...e,{animationFrame:"fixed"===i.strategy}),placement:e.computed((()=>i.placement)),strategy:e.computed((()=>i.strategy)),middleware:P}),C=e.computed((()=>{var e;if(k.value)return;const t=i.triggerWidth&&E.value?`${null==(e=E.value)?void 0:e.offsetWidth}px`:void 0;return{position:O.value,top:`${B.value??0}px`,left:`${$.value??0}px`,maxWidth:t?void 0:b.value,maxHeight:h.value,width:t}})),j=e.computed((()=>V.value.split("-")[0])),A=e.computed((()=>{var e,t,o,r,l;if(k.value)return;const a={top:"bottom",right:"left",bottom:"top",left:"right"}[j.value];return{left:void 0!==(null==(e=z.value.arrow)?void 0:e.x)?`${null==(t=z.value.arrow)?void 0:t.x}px`:void 0,top:void 0!==(null==(o=z.value.arrow)?void 0:o.y)?`${null==(r=z.value.arrow)?void 0:r.y}px`:void 0,[a]:-((null==(l=w.value)?void 0:l.offsetWidth)??0)/2+"px"}})),N=r.useVModel(i,"modelValue",u),D=e.ref(!1),_=e.computed({get:()=>N.value??D.value,set:e=>{void 0!==N.value?N.value=e:D.value=e}}),F=()=>{_.value=!0},R=()=>{_.value=!1},T=()=>{_.value=!_.value},W=e=>{E.value=e};n({toggle:T,show:F,hide:R,init:W,customPosition:k}),e.watch(_,(t=>{t&&i.autofocusFirst&&e.nextTick((()=>{const e=Q(x.value);e.length>0&&e[0].focus({preventScroll:!0})}))})),r.onClickOutside(x,(()=>{!i.keepOpen&&_.value&&(_.value=!1)}),{ignore:[E]});const q=e.computed((()=>{var e,t;return(null==(t=null==(e=E.value)?void 0:e.getAttribute)?void 0:t.call(e,"id"))??void 0})),K=e.computed((()=>({"aria-controls":v.value,"aria-haspopup":!0,"aria-expanded":_.value}))),{component:M,bus:H}=function({reference:t,id:o,expanded:r,aria:a}){const n=l(),u=e.defineComponent({name:"VvDropdownTriggerProvider",setup(){e.provide(f,{reference:t,id:o,expanded:r,aria:a,bus:n})},render(){var t,o;return e.h(e.Fragment,{},null==(o=(t=this.$slots).default)?void 0:o.call(t))}});return{bus:n,component:u}}({reference:E,id:v,expanded:_,aria:K});H.on("click",T);const{role:U,modifiers:I}=e.toRefs(i),{itemRole:G}=function({role:t,expanded:o}){const r=e.computed((()=>t.value===d.listbox?s.option:s.presentation));return e.provide(p,{role:r,expanded:o}),{itemRole:r}}({role:U,expanded:_}),J=function(t,o,r){return e.computed((()=>{const l={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(l[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{l[`${t}--${o}`]=e.unref(r.value[o])})),l}))}("vv-dropdown",I,e.computed((()=>({arrow:i.arrow})))),{focused:L}=r.useFocusWithin(x);function Q(e){return e?[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden"))):[]}r.onKeyStroke("Escape",(e=>{_.value&&(e.preventDefault(),R())})),r.onKeyStroke("ArrowDown",(t=>{_.value&&L.value&&(t.preventDefault(),e.nextTick((()=>{if(L.value){const e=Q(x.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t<e.length-1?e[t+1].focus({preventScroll:!0}):e[0].focus({preventScroll:!0})}})))})),r.onKeyStroke("ArrowUp",(t=>{_.value&&L.value&&(t.preventDefault(),e.nextTick((()=>{if(L.value){const e=Q(x.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t>0?e[t-1].focus({preventScroll:!0}):e[e.length-1].focus({preventScroll:!0})}})))})),r.onKeyStroke([" ","Enter"],(e=>{const t=e.target;_.value&&L.value&&t&&(null==t||t.click())}));const X={"before-enter":()=>{u(_.value?"beforeExpand":"beforeCollapse"),u("before-enter")},"after-leave":()=>{u(_.value?"afterExpand":"afterCollapse"),u("after-leave")},enter:()=>{u("enter")},"after-enter":()=>{u("after-enter")},"enter-cancelled":()=>{u("enter-cancelled")},"before-leave":()=>{u("before-leave")},leave:()=>{u("leave")},"leave-cancelled":()=>{u("leave-cancelled")}};return(t,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(M),null,{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps({init:W,show:F,hide:R,toggle:T,expanded:e.unref(_),aria:e.unref(K)})))])),_:3}),e.createVNode(e.Transition,e.mergeProps({name:t.transitionName},e.toHandlers(X)),{default:e.withCtx((()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:x,style:e.normalizeStyle(e.unref(C)),class:e.normalizeClass(e.unref(J))},[i.arrow?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"arrowEl",ref:w,style:e.normalizeStyle(e.unref(A)),class:"vv-dropdown__arrow"},null,4)):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(_)}))),e.createElementVNode("div",e.mergeProps(e.unref(m),{id:e.unref(v),ref_key:"listEl",ref:S,tabindex:e.unref(_)?void 0:-1,role:e.unref(U),"aria-labelledby":e.unref(q),class:"vv-dropdown__list"}),[e.renderSlot(t.$slots,"items",e.normalizeProps(e.guardReactiveProps({role:e.unref(G)})))],16,g),e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(_)})))],6),[[e.vShow,e.unref(_)]])])),_:3},16,["name"])],64))}})}));
|