mood-ui 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs +6 -6
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs +4 -4
- package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs +3 -3
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/table/Table.cjs +1 -1
- package/dist/components/data-display/table/Table.cjs.map +1 -1
- package/dist/components/data-display/table/Table.mjs +1 -1
- package/dist/components/data-display/table/Table.mjs.map +1 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs +37 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs +38 -2
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.cjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.mjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs +24 -16
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs +24 -16
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs +4 -4
- package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +5 -5
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/EmptyState.cjs.map +1 -1
- package/dist/components/feedback/EmptyState.mjs.map +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +5 -5
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.cjs +369 -0
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.mjs +368 -0
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/feedback/tour/Tour2.cjs +6 -0
- package/dist/components/feedback/tour/Tour2.cjs.map +1 -0
- package/dist/components/feedback/tour/Tour2.mjs +7 -0
- package/dist/components/feedback/tour/Tour2.mjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.cjs +6 -0
- package/dist/components/feedback/tour/TourCard.cjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.mjs +7 -0
- package/dist/components/feedback/tour/TourCard.mjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.cjs +102 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.mjs +101 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/feedback/tour/tourAnchor.cjs +75 -0
- package/dist/components/feedback/tour/tourAnchor.cjs.map +1 -0
- package/dist/components/feedback/tour/tourAnchor.mjs +72 -0
- package/dist/components/feedback/tour/tourAnchor.mjs.map +1 -0
- package/dist/components/feedback/tour/tourPlace.cjs +108 -0
- package/dist/components/feedback/tour/tourPlace.cjs.map +1 -0
- package/dist/components/feedback/tour/tourPlace.mjs +107 -0
- package/dist/components/feedback/tour/tourPlace.mjs.map +1 -0
- package/dist/components/feedback/tour/tourShape.cjs +121 -0
- package/dist/components/feedback/tour/tourShape.cjs.map +1 -0
- package/dist/components/feedback/tour/tourShape.mjs +118 -0
- package/dist/components/feedback/tour/tourShape.mjs.map +1 -0
- package/dist/components/feedback/tour/useTourSpotlight.cjs +60 -0
- package/dist/components/feedback/tour/useTourSpotlight.cjs.map +1 -0
- package/dist/components/feedback/tour/useTourSpotlight.mjs +59 -0
- package/dist/components/feedback/tour/useTourSpotlight.mjs.map +1 -0
- package/dist/components/feedback/tour/useTourSteps.cjs +108 -0
- package/dist/components/feedback/tour/useTourSteps.cjs.map +1 -0
- package/dist/components/feedback/tour/useTourSteps.mjs +107 -0
- package/dist/components/feedback/tour/useTourSteps.mjs.map +1 -0
- package/dist/components/forms/Button.cjs +1 -1
- package/dist/components/forms/Button.cjs.map +1 -1
- package/dist/components/forms/Button.mjs +1 -1
- package/dist/components/forms/Button.mjs.map +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/FileInput.cjs +1 -1
- package/dist/components/forms/FileInput.cjs.map +1 -1
- package/dist/components/forms/FileInput.mjs +1 -1
- package/dist/components/forms/FileInput.mjs.map +1 -1
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs +34 -17
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs +34 -17
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/MultiSelect.cjs +1 -1
- package/dist/components/forms/MultiSelect.cjs.map +1 -1
- package/dist/components/forms/MultiSelect.mjs +1 -1
- package/dist/components/forms/MultiSelect.mjs.map +1 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs +2 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs +2 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/TagInput.cjs.map +1 -1
- package/dist/components/forms/TagInput.mjs.map +1 -1
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.mjs +1 -0
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Textarea.cjs.map +1 -1
- package/dist/components/forms/Textarea.mjs.map +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/Canvas.cjs +1 -1
- package/dist/components/layout/Canvas.cjs.map +1 -1
- package/dist/components/layout/Canvas.mjs +1 -1
- package/dist/components/layout/Canvas.mjs.map +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/PopoverPanel.cjs +1 -1
- package/dist/components/layout/PopoverPanel.cjs.map +1 -1
- package/dist/components/layout/PopoverPanel.mjs +1 -1
- package/dist/components/layout/PopoverPanel.mjs.map +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.cjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.mjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.cjs +1 -1
- package/dist/components/navigation/DropdownMenu.cjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.mjs +1 -1
- package/dist/components/navigation/DropdownMenu.mjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/Switcher.cjs.map +1 -1
- package/dist/components/navigation/Switcher.mjs.map +1 -1
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs +77 -45
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs +77 -45
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.cjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.mjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/composables/useField.cjs +28 -8
- package/dist/composables/useField.cjs.map +1 -1
- package/dist/composables/useField.mjs +28 -8
- package/dist/composables/useField.mjs.map +1 -1
- package/dist/config/ModoLocale.cjs +10 -1
- package/dist/config/ModoLocale.cjs.map +1 -1
- package/dist/config/ModoLocale.mjs +10 -1
- package/dist/config/ModoLocale.mjs.map +1 -1
- package/dist/config/locales/es.cjs +10 -1
- package/dist/config/locales/es.cjs.map +1 -1
- package/dist/config/locales/es.mjs +10 -1
- package/dist/config/locales/es.mjs.map +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.mjs +3 -1
- package/dist/mood-ui.css +293 -117
- package/dist/types/components/data-display/surface-card/SurfaceCardBody.vue.d.ts +1 -1
- package/dist/types/components/data-display/surface-card/SurfaceCardFooter.vue.d.ts +1 -1
- package/dist/types/components/data-display/surface-card/SurfaceCardHeader.vue.d.ts +1 -1
- package/dist/types/components/feedback/dialog/DialogContent.vue.d.ts +1 -1
- package/dist/types/components/feedback/tour/Tour.vue.d.ts +31 -0
- package/dist/types/components/feedback/tour/TourCard.vue.d.ts +25 -0
- package/dist/types/components/feedback/tour/index.d.ts +2 -0
- package/dist/types/components/feedback/tour/tourAnchor.d.ts +12 -0
- package/dist/types/components/feedback/tour/tourPlace.d.ts +60 -0
- package/dist/types/components/feedback/tour/tourShape.d.ts +36 -0
- package/dist/types/components/feedback/tour/useTourSpotlight.d.ts +14 -0
- package/dist/types/components/feedback/tour/useTourSteps.d.ts +31 -0
- package/dist/types/components/layout/Canvas.vue.d.ts +1 -1
- package/dist/types/components/layout/popover/PopoverContent.vue.d.ts +1 -1
- package/dist/types/components/navigation/menu/MenuContent.vue.d.ts +1 -1
- package/dist/types/composables/useField.d.ts +23 -0
- package/dist/types/config/ModoLocale.d.ts +14 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interfaces/feedback/Tour.interface.d.ts +73 -0
- package/dist/types/interfaces/navigation/Switcher.interface.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_sizes = require("../../config/sizes.cjs");
|
|
2
3
|
const require_useModoConfig = require("../../composables/useModoConfig.cjs");
|
|
3
4
|
const require_usePopover = require("../../composables/usePopover.cjs");
|
|
4
5
|
const require_Skeleton = require("../feedback/Skeleton.cjs");
|
|
@@ -12,37 +13,32 @@ var _hoisted_1 = [
|
|
|
12
13
|
"aria-label",
|
|
13
14
|
"disabled"
|
|
14
15
|
];
|
|
15
|
-
var _hoisted_2 = {
|
|
16
|
-
|
|
17
|
-
class: "shrink-0"
|
|
18
|
-
};
|
|
19
|
-
var _hoisted_3 = { class: "flex flex-col min-w-0 flex-1" };
|
|
20
|
-
var _hoisted_4 = { class: "truncate text-body font-medium" };
|
|
21
|
-
var _hoisted_5 = {
|
|
16
|
+
var _hoisted_2 = { class: "flex flex-col min-w-0 flex-1" };
|
|
17
|
+
var _hoisted_3 = {
|
|
22
18
|
key: 0,
|
|
23
19
|
class: "truncate text-caption text-muted-foreground"
|
|
24
20
|
};
|
|
25
|
-
var
|
|
21
|
+
var _hoisted_4 = {
|
|
26
22
|
key: 0,
|
|
27
23
|
class: "px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider"
|
|
28
24
|
};
|
|
29
|
-
var
|
|
25
|
+
var _hoisted_5 = {
|
|
30
26
|
key: 1,
|
|
31
27
|
class: "px-2 pt-2 pb-1"
|
|
32
28
|
};
|
|
33
|
-
var
|
|
29
|
+
var _hoisted_6 = [
|
|
34
30
|
"placeholder",
|
|
35
31
|
"aria-controls",
|
|
36
32
|
"aria-activedescendant"
|
|
37
33
|
];
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
34
|
+
var _hoisted_7 = { class: "p-2 flex flex-col gap-1" };
|
|
35
|
+
var _hoisted_8 = { class: "px-3 py-6 text-center text-muted-foreground text-body" };
|
|
36
|
+
var _hoisted_9 = {
|
|
41
37
|
key: 4,
|
|
42
38
|
class: "px-3 py-6 text-center text-muted-foreground text-body"
|
|
43
39
|
};
|
|
44
|
-
var
|
|
45
|
-
var
|
|
40
|
+
var _hoisted_10 = ["id"];
|
|
41
|
+
var _hoisted_11 = [
|
|
46
42
|
"id",
|
|
47
43
|
"aria-selected",
|
|
48
44
|
"aria-current",
|
|
@@ -51,17 +47,17 @@ var _hoisted_13 = [
|
|
|
51
47
|
"onClick",
|
|
52
48
|
"onMouseenter"
|
|
53
49
|
];
|
|
54
|
-
var
|
|
50
|
+
var _hoisted_12 = {
|
|
55
51
|
key: 0,
|
|
56
52
|
class: "shrink-0"
|
|
57
53
|
};
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
var
|
|
54
|
+
var _hoisted_13 = { class: "flex flex-col min-w-0 flex-1" };
|
|
55
|
+
var _hoisted_14 = { class: "truncate text-body font-medium" };
|
|
56
|
+
var _hoisted_15 = {
|
|
61
57
|
key: 0,
|
|
62
58
|
class: "truncate text-caption text-muted-foreground"
|
|
63
59
|
};
|
|
64
|
-
var
|
|
60
|
+
var _hoisted_16 = { class: "p-1" };
|
|
65
61
|
var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
66
62
|
__name: "Switcher",
|
|
67
63
|
props: {
|
|
@@ -146,6 +142,31 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
146
142
|
default: return "rounded-md";
|
|
147
143
|
}
|
|
148
144
|
});
|
|
145
|
+
const LEADING = {
|
|
146
|
+
xsmall: {
|
|
147
|
+
lead: "w-5 h-5",
|
|
148
|
+
leadIcon: "w-3 h-3",
|
|
149
|
+
leadAvatar: "[&>div>*]:!w-5 [&>div>*]:!h-5"
|
|
150
|
+
},
|
|
151
|
+
small: {
|
|
152
|
+
lead: "w-6 h-6",
|
|
153
|
+
leadIcon: "w-3.5 h-3.5",
|
|
154
|
+
leadAvatar: "[&>div>*]:!w-6 [&>div>*]:!h-6"
|
|
155
|
+
},
|
|
156
|
+
medium: {
|
|
157
|
+
lead: "w-7 h-7",
|
|
158
|
+
leadIcon: "w-4 h-4",
|
|
159
|
+
leadAvatar: "[&>div>*]:!w-7 [&>div>*]:!h-7"
|
|
160
|
+
},
|
|
161
|
+
large: {
|
|
162
|
+
lead: "w-8 h-8",
|
|
163
|
+
leadIcon: "w-5 h-5",
|
|
164
|
+
leadAvatar: "[&>div>*]:!w-8 [&>div>*]:!h-8"
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const sizeTokens = (0, vue.computed)(() => require_sizes.SIZE_TOKENS[require_sizes.normalizeSize(props.size)]);
|
|
168
|
+
const sized = (0, vue.computed)(() => props.size ? LEADING[require_sizes.normalizeSize(props.size)] : null);
|
|
169
|
+
const triggerSizeClass = (0, vue.computed)(() => sized.value ? `${sizeTokens.value.control} ${sizeTokens.value.padX} ${sizeTokens.value.gap}` : "gap-3 px-3 py-2");
|
|
149
170
|
const panelMaxHeightStyle = (0, vue.computed)(() => {
|
|
150
171
|
const v = props.panelMaxHeight;
|
|
151
172
|
return typeof v === "number" ? `${v}px` : v;
|
|
@@ -354,8 +375,9 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
354
375
|
"aria-label": resolvedAriaLabel.value,
|
|
355
376
|
disabled: __props.disabled,
|
|
356
377
|
class: (0, vue.normalizeClass)([
|
|
357
|
-
"inline-flex items-center
|
|
358
|
-
|
|
378
|
+
"inline-flex items-center text-left transition-colors",
|
|
379
|
+
triggerSizeClass.value,
|
|
380
|
+
"border bg-card text-card-foreground border-input hover:border-input-hover",
|
|
359
381
|
"hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
|
|
360
382
|
radiusClass.value,
|
|
361
383
|
__props.fullWidth ? "w-full" : "",
|
|
@@ -364,32 +386,42 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
364
386
|
onClick: onTriggerClick,
|
|
365
387
|
onKeydown: onTriggerKeydown
|
|
366
388
|
}, [
|
|
367
|
-
activeItem.value?.avatar ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span",
|
|
389
|
+
activeItem.value?.avatar ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
390
|
+
key: 0,
|
|
391
|
+
"data-modo-switcher-lead": "",
|
|
392
|
+
class: (0, vue.normalizeClass)(["shrink-0", sized.value ? ["inline-flex items-center justify-center", sized.value.leadAvatar] : ""])
|
|
393
|
+
}, [(0, vue.createVNode)(require_Avatar.default, {
|
|
368
394
|
src: activeItem.value.avatar.src,
|
|
369
395
|
initials: activeItem.value.avatar.initials,
|
|
370
396
|
name: activeItem.value.title,
|
|
371
|
-
size: "small"
|
|
397
|
+
size: sized.value ? "xsmall" : "small"
|
|
372
398
|
}, null, 8, [
|
|
373
399
|
"src",
|
|
374
400
|
"initials",
|
|
375
|
-
"name"
|
|
376
|
-
|
|
401
|
+
"name",
|
|
402
|
+
"size"
|
|
403
|
+
])], 2)) : activeItem.value?.icon ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
377
404
|
key: 1,
|
|
378
|
-
|
|
405
|
+
"data-modo-switcher-lead": "",
|
|
406
|
+
class: (0, vue.normalizeClass)([
|
|
407
|
+
"shrink-0 inline-flex items-center justify-center bg-accent/60 text-foreground",
|
|
408
|
+
sized.value ? sized.value.lead : "w-9 h-9",
|
|
409
|
+
radiusClass.value
|
|
410
|
+
])
|
|
379
411
|
}, [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(activeItem.value.icon), {
|
|
380
|
-
class: "w-5 h-5",
|
|
412
|
+
class: (0, vue.normalizeClass)(sized.value ? sized.value.leadIcon : "w-5 h-5"),
|
|
381
413
|
"aria-hidden": "true"
|
|
382
|
-
}))], 2)) : (0, vue.createCommentVNode)("", true),
|
|
383
|
-
(0, vue.createElementVNode)("span",
|
|
414
|
+
}, null, 8, ["class"]))], 2)) : (0, vue.createCommentVNode)("", true),
|
|
415
|
+
(0, vue.createElementVNode)("span", _hoisted_2, [(0, vue.createElementVNode)("span", { class: (0, vue.normalizeClass)(["truncate font-medium", sized.value ? sizeTokens.value.text : "text-body"]) }, (0, vue.toDisplayString)(activeItem.value ? activeItem.value.title : resolvedPlaceholder.value), 3), !sized.value && !__props.compactTrigger && activeItem.value?.subtitle ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_3, (0, vue.toDisplayString)(activeItem.value.subtitle), 1)) : (0, vue.createCommentVNode)("", true)]),
|
|
384
416
|
__props.chevron === "updown" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_heroicons_vue_24_outline.ChevronUpDownIcon), {
|
|
385
417
|
key: 2,
|
|
386
|
-
class: "
|
|
418
|
+
class: (0, vue.normalizeClass)(["shrink-0 text-muted-foreground", sized.value ? sizeTokens.value.icon : "w-4 h-4"]),
|
|
387
419
|
"aria-hidden": "true"
|
|
388
|
-
})) : __props.chevron === "down" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_heroicons_vue_24_outline.ChevronDownIcon), {
|
|
420
|
+
}, null, 8, ["class"])) : __props.chevron === "down" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_heroicons_vue_24_outline.ChevronDownIcon), {
|
|
389
421
|
key: 3,
|
|
390
|
-
class: "
|
|
422
|
+
class: (0, vue.normalizeClass)(["shrink-0 text-muted-foreground", sized.value ? sizeTokens.value.icon : "w-4 h-4"]),
|
|
391
423
|
"aria-hidden": "true"
|
|
392
|
-
})) : (0, vue.createCommentVNode)("", true)
|
|
424
|
+
}, null, 8, ["class"])) : (0, vue.createCommentVNode)("", true)
|
|
393
425
|
], 42, _hoisted_1)])], 2), (0, vue.createVNode)(require_PopoverPanel.default, {
|
|
394
426
|
open: (0, vue.unref)(isOpen),
|
|
395
427
|
style: (0, vue.normalizeStyle)(mergedPanelStyle.value),
|
|
@@ -403,8 +435,8 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
403
435
|
class: "modo-switcher-panel overflow-y-auto",
|
|
404
436
|
style: (0, vue.normalizeStyle)({ maxHeight: panelMaxHeightStyle.value })
|
|
405
437
|
}, [
|
|
406
|
-
__props.panelTitle ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div",
|
|
407
|
-
__props.searchable ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div",
|
|
438
|
+
__props.panelTitle ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4, (0, vue.toDisplayString)(__props.panelTitle), 1)) : (0, vue.createCommentVNode)("", true),
|
|
439
|
+
__props.searchable ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_5, [(0, vue.withDirectives)((0, vue.createElementVNode)("input", {
|
|
408
440
|
ref_key: "searchInputEl",
|
|
409
441
|
ref: searchInputEl,
|
|
410
442
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
|
|
@@ -413,15 +445,15 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
413
445
|
placeholder: resolvedSearchPlaceholder.value,
|
|
414
446
|
"aria-controls": (0, vue.unref)(listboxId),
|
|
415
447
|
"aria-activedescendant": activeDescendantId.value,
|
|
416
|
-
class: "w-full px-2 py-1.5 text-body bg-background border border-
|
|
448
|
+
class: "w-full px-2 py-1.5 text-body bg-background border border-input rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
|
|
417
449
|
onKeydown: onSearchKeydown
|
|
418
|
-
}, null, 40,
|
|
419
|
-
__props.loading ? (0, vue.renderSlot)(_ctx.$slots, "loading", { key: 2 }, () => [(0, vue.createElementVNode)("div",
|
|
450
|
+
}, null, 40, _hoisted_6), [[vue.vModelText, searchQuery.value]])])) : (0, vue.createCommentVNode)("", true),
|
|
451
|
+
__props.loading ? (0, vue.renderSlot)(_ctx.$slots, "loading", { key: 2 }, () => [(0, vue.createElementVNode)("div", _hoisted_7, [((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(3, (i) => {
|
|
420
452
|
return (0, vue.createElementVNode)("div", {
|
|
421
453
|
key: i,
|
|
422
454
|
"data-modo-switcher-skeleton": ""
|
|
423
455
|
}, [(0, vue.createVNode)(require_Skeleton.default, { height: "44px" })]);
|
|
424
|
-
}), 64))])]) : __props.items.length === 0 ? (0, vue.renderSlot)(_ctx.$slots, "empty", { key: 3 }, () => [(0, vue.createElementVNode)("div",
|
|
456
|
+
}), 64))])]) : __props.items.length === 0 ? (0, vue.renderSlot)(_ctx.$slots, "empty", { key: 3 }, () => [(0, vue.createElementVNode)("div", _hoisted_8, (0, vue.toDisplayString)(resolvedEmptyText.value), 1)]) : displayedItems.value.length === 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_9, (0, vue.toDisplayString)(resolvedNoResults.value), 1)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("ul", {
|
|
425
457
|
key: 5,
|
|
426
458
|
role: "listbox",
|
|
427
459
|
id: (0, vue.unref)(listboxId),
|
|
@@ -447,7 +479,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
447
479
|
onClick: ($event) => selectItem(item),
|
|
448
480
|
onMouseenter: ($event) => __props.searchable ? highlightedIdx.value = idx : null
|
|
449
481
|
}, [
|
|
450
|
-
item.avatar ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span",
|
|
482
|
+
item.avatar ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_12, [(0, vue.createVNode)(require_Avatar.default, {
|
|
451
483
|
src: item.avatar.src,
|
|
452
484
|
initials: item.avatar.initials,
|
|
453
485
|
name: item.title,
|
|
@@ -464,7 +496,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
464
496
|
class: "w-5 h-5",
|
|
465
497
|
"aria-hidden": "true"
|
|
466
498
|
}))], 2)) : (0, vue.createCommentVNode)("", true),
|
|
467
|
-
(0, vue.createElementVNode)("span",
|
|
499
|
+
(0, vue.createElementVNode)("span", _hoisted_13, [(0, vue.createElementVNode)("span", _hoisted_14, (0, vue.toDisplayString)(item.title), 1), item.subtitle ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_15, (0, vue.toDisplayString)(item.subtitle), 1)) : (0, vue.createCommentVNode)("", true)]),
|
|
468
500
|
(0, vue.renderSlot)(_ctx.$slots, "item-trailing", {
|
|
469
501
|
item,
|
|
470
502
|
active: item.value === __props.modelValue,
|
|
@@ -474,13 +506,13 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
474
506
|
class: "w-4 h-4 shrink-0",
|
|
475
507
|
"aria-hidden": "true"
|
|
476
508
|
})) : (0, vue.createCommentVNode)("", true)])
|
|
477
|
-
], 42,
|
|
478
|
-
}), 128))], 40,
|
|
509
|
+
], 42, _hoisted_11);
|
|
510
|
+
}), 128))], 40, _hoisted_10)),
|
|
479
511
|
_ctx.$slots.footer ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 6 }, [_cache[2] || (_cache[2] = (0, vue.createElementVNode)("hr", {
|
|
480
512
|
"data-modo-switcher-footer-sep": "",
|
|
481
513
|
role: "separator",
|
|
482
514
|
class: "my-1 border-t border-border"
|
|
483
|
-
}, null, -1)), (0, vue.createElementVNode)("div",
|
|
515
|
+
}, null, -1)), (0, vue.createElementVNode)("div", _hoisted_16, [(0, vue.renderSlot)(_ctx.$slots, "footer", { close: (0, vue.unref)(close) })])], 64)) : (0, vue.createCommentVNode)("", true)
|
|
484
516
|
], 4)]),
|
|
485
517
|
_: 3
|
|
486
518
|
}, 8, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switcher.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../src/components/navigation/Switcher.vue"],"sourcesContent":["<template>\n <div class=\"modo-switcher inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <span ref=\"triggerWrapEl\" class=\"inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <slot\n name=\"trigger\"\n :activeItem=\"activeItem\"\n :isOpen=\"isOpen\"\n :toggle=\"onTriggerClick\"\n >\n <button\n ref=\"triggerEl\"\n type=\"button\"\n data-modo-switcher-trigger\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"resolvedAriaLabel\"\n :disabled=\"disabled\"\n :class=\"[\n 'inline-flex items-center gap-3 px-3 py-2 text-left transition-colors',\n 'border bg-card text-card-foreground border-border',\n 'hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60',\n radiusClass,\n fullWidth ? 'w-full' : '',\n disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span v-if=\"activeItem?.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"activeItem.avatar.src\"\n :initials=\"activeItem.avatar.initials\"\n :name=\"activeItem.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"activeItem?.icon\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-9 h-9 bg-accent/60 text-foreground',\n radiusClass,\n ]\"\n >\n <component :is=\"activeItem.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">\n {{ activeItem ? activeItem.title : resolvedPlaceholder }}\n </span>\n <span\n v-if=\"!compactTrigger && activeItem?.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >\n {{ activeItem.subtitle }}\n </span>\n </span>\n <ChevronUpDownIcon\n v-if=\"chevron === 'updown'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <ChevronDownIcon\n v-else-if=\"chevron === 'down'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n </button>\n </slot>\n </span>\n\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"resolvedRadius\"\n role=\"dialog\"\n :aria-label=\"resolvedAriaLabel\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div\n data-modo-switcher-panel\n class=\"modo-switcher-panel overflow-y-auto\"\n :style=\"{ maxHeight: panelMaxHeightStyle }\"\n >\n <div\n v-if=\"panelTitle\"\n class=\"px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider\"\n >\n {{ panelTitle }}\n </div>\n\n <div v-if=\"searchable\" class=\"px-2 pt-2 pb-1\">\n <input\n ref=\"searchInputEl\"\n v-model=\"searchQuery\"\n role=\"searchbox\"\n type=\"text\"\n :placeholder=\"resolvedSearchPlaceholder\"\n :aria-controls=\"listboxId\"\n :aria-activedescendant=\"activeDescendantId\"\n class=\"w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60\"\n @keydown=\"onSearchKeydown\"\n />\n </div>\n\n <template v-if=\"loading\">\n <slot name=\"loading\">\n <div class=\"p-2 flex flex-col gap-1\">\n <div\n v-for=\"i in 3\"\n :key=\"i\"\n data-modo-switcher-skeleton\n >\n <Skeleton height=\"44px\" />\n </div>\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"items.length === 0\">\n <slot name=\"empty\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedEmptyText }}\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"displayedItems.length === 0\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedNoResults }}\n </div>\n </template>\n\n <ul\n v-else\n role=\"listbox\"\n :id=\"listboxId\"\n class=\"flex flex-col\"\n @keydown=\"onListKeydown\"\n >\n <li\n v-for=\"(item, idx) in displayedItems\"\n :key=\"item.value\"\n :ref=\"(el) => setOptionRef(el as HTMLElement | null, idx)\"\n role=\"option\"\n :id=\"`${listboxId}-opt-${idx}`\"\n :aria-selected=\"item.value === modelValue\"\n :aria-current=\"item.value === modelValue ? 'true' : undefined\"\n :aria-disabled=\"item.disabled || undefined\"\n :data-active=\"item.value === modelValue || undefined\"\n :tabindex=\"-1\"\n class=\"modo-switcher-item flex items-center gap-3 px-3 py-2 cursor-pointer\"\n :class=\"[\n item.value === modelValue ? 'bg-accent/40' : '',\n searchable && idx === highlightedIdx ? 'bg-accent' : 'hover:bg-accent',\n item.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ]\"\n @click=\"selectItem(item)\"\n @mouseenter=\"searchable ? (highlightedIdx = idx) : null\"\n >\n <span v-if=\"item.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"item.avatar.src\"\n :initials=\"item.avatar.initials\"\n :name=\"item.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"item.icon\"\n data-modo-switcher-iconwrap\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-9 h-9 bg-accent/60 text-foreground',\n radiusClass,\n ]\"\n >\n <component :is=\"item.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">{{ item.title }}</span>\n <span\n v-if=\"item.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >{{ item.subtitle }}</span>\n </span>\n <slot\n name=\"item-trailing\"\n :item=\"item\"\n :active=\"item.value === modelValue\"\n :close=\"close\"\n >\n <CheckIcon\n v-if=\"item.value === modelValue\"\n class=\"w-4 h-4 shrink-0\"\n aria-hidden=\"true\"\n />\n </slot>\n </li>\n </ul>\n\n <template v-if=\"$slots.footer\">\n <hr\n data-modo-switcher-footer-sep\n role=\"separator\"\n class=\"my-1 border-t border-border\"\n />\n <div class=\"p-1\">\n <slot name=\"footer\" :close=\"close\" />\n </div>\n </template>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch, watchEffect } from \"vue\";\nimport { ChevronUpDownIcon, ChevronDownIcon, CheckIcon } from \"@heroicons/vue/24/outline\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Avatar from \"../data-display/avatar/Avatar.vue\";\nimport Skeleton from \"../feedback/Skeleton.vue\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedRadius,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport type {\n Switcher as SwitcherProps,\n SwitcherEmits,\n SwitcherItem,\n SwitcherValue,\n} from \"../../interfaces/navigation/Switcher.interface\";\n\nconst props = withDefaults(defineProps<SwitcherProps>(), {\n modelValue: null,\n chevron: \"updown\",\n triggerVariant: \"outline\",\n compactTrigger: false,\n fullWidth: false,\n panelWidth: \"trigger\",\n panelMinWidth: \"15rem\",\n panelMaxHeight: 320,\n placement: \"bottom-start\",\n searchable: false,\n loading: false,\n disabled: false,\n});\n\nconst emit = defineEmits<SwitcherEmits>();\n\nconst locale = useModoLocale();\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst listboxId = useId();\n\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? locale.value.switcher.placeholder,\n);\nconst resolvedAriaLabel = computed(\n () => props.ariaLabel ?? locale.value.switcher.ariaLabel,\n);\nconst resolvedEmptyText = computed(\n () => props.emptyText ?? locale.value.switcher.empty,\n);\nconst resolvedSearchPlaceholder = computed(\n () => props.searchPlaceholder ?? locale.value.switcher.searchPlaceholder,\n);\nconst resolvedNoResults = computed(\n () => props.noResultsText ?? locale.value.switcher.noResults,\n);\n\nconst searchQuery = ref(\"\");\nconst searchInputEl = ref<HTMLInputElement | null>(null);\n\nconst displayedItems = computed<SwitcherItem[]>(() => {\n if (!props.searchable) return props.items;\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return props.items;\n const fields = props.searchFields ?? [\"title\", \"subtitle\"];\n return props.items.filter((it) =>\n fields.some((f) => {\n const v = it[f];\n return typeof v === \"string\" && v.toLowerCase().includes(q);\n }),\n );\n});\n\nwatch(searchQuery, (q) => {\n emit(\"search\", q);\n});\n\nconst radiusClass = computed(() => {\n switch (resolvedRadius.value) {\n case \"none\": return \"rounded-none\";\n case \"small\": return \"rounded-sm\";\n case \"large\": return \"rounded-lg\";\n case \"full\": return \"rounded-[999px]\";\n default: return \"rounded-md\";\n }\n});\n\nconst panelMaxHeightStyle = computed(() => {\n const v = props.panelMaxHeight;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\nconst panelMinWidthStyle = computed(() => {\n const v = props.panelMinWidth;\n if (v == null) return undefined;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\n// The popover composable sizes the panel to the trigger width when\n// `panelWidth='trigger'`. A narrow trigger (e.g. an avatar-only custom\n// trigger) would otherwise crush the panel — `minWidth` floors it.\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(panelMinWidthStyle.value ? { minWidth: panelMinWidthStyle.value } : {}),\n}));\n\nconst activeItem = computed<SwitcherItem | null>(() => {\n if (props.modelValue == null) return null;\n return props.items.find((i) => i.value === props.modelValue) ?? null;\n});\n\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open,\n close,\n toggle,\n} = usePopover({\n placement: () => props.placement,\n matchTriggerWidth: () => props.panelWidth === \"trigger\",\n closeOnEscape: false,\n onOpen: () => emit(\"open\"),\n onClose: () => {\n searchQuery.value = \"\";\n emit(\"close\");\n },\n});\n\nconst triggerEl = ref<HTMLElement | null>(null);\nconst triggerWrapEl = ref<HTMLElement | null>(null);\nwatch([triggerEl, triggerWrapEl], ([btn, wrap]) => {\n triggerRef.value = (btn as HTMLElement | null) ?? (wrap as HTMLElement | null);\n});\n\nfunction focusTrigger() {\n const el = triggerEl.value ?? triggerWrapEl.value;\n el?.focus?.();\n}\n\nfunction onTriggerClick() {\n if (props.disabled) return;\n toggle();\n}\n\nfunction selectItem(item: SwitcherItem) {\n if (item.disabled || props.disabled) return;\n emit(\"update:modelValue\", item.value);\n emit(\"change\", item.value, item);\n close();\n}\n\nfunction focusableIndices(): number[] {\n return displayedItems.value\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n}\n\nconst optionRefs = new Map<number, HTMLElement>();\nfunction setOptionRef(el: HTMLElement | null, idx: number) {\n if (el) optionRefs.set(idx, el);\n else optionRefs.delete(idx);\n}\n\nfunction focusOptionByIdx(idx: number) {\n optionRefs.get(idx)?.focus();\n}\n\nasync function openAndFocusActive() {\n if (props.disabled) return;\n if (!isOpen.value) open();\n await nextTick();\n if (props.searchable) {\n searchInputEl.value?.focus();\n return;\n }\n const order = focusableIndices();\n if (!order.length) return;\n const activeIdx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue,\n );\n const usable =\n activeIdx >= 0 && !displayedItems.value[activeIdx].disabled\n ? activeIdx\n : order[0];\n focusOptionByIdx(usable);\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if ([\"ArrowDown\", \"ArrowUp\", \"Enter\", \" \"].includes(e.key)) {\n e.preventDefault();\n openAndFocusActive();\n } else if (e.key === \"Escape\" && isOpen.value) {\n e.preventDefault();\n close();\n }\n}\n\nfunction currentFocusedIdx(): number {\n const el = document.activeElement as HTMLElement | null;\n if (!el) return -1;\n for (const [idx, node] of optionRefs.entries()) {\n if (node === el) return idx;\n }\n return -1;\n}\n\nfunction moveFocus(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = currentFocusedIdx();\n let pos = order.indexOf(cur);\n if (pos === -1) {\n focusOptionByIdx(delta > 0 ? order[0] : order[order.length - 1]);\n return;\n }\n pos = (pos + delta + order.length) % order.length;\n focusOptionByIdx(order[pos]);\n}\n\nfunction onListKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveFocus(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveFocus(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[0]);\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[order.length - 1]);\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n const idx = currentFocusedIdx();\n if (idx >= 0) selectItem(displayedItems.value[idx]);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n } else if (\n !props.searchable &&\n e.key.length === 1 &&\n /^[a-zA-Z0-9]$/.test(e.key)\n ) {\n const order = focusableIndices();\n const letter = e.key.toLowerCase();\n const match = order.find((i) =>\n displayedItems.value[i].title.toLowerCase().startsWith(letter),\n );\n if (match !== undefined) focusOptionByIdx(match);\n }\n}\n\nwatch(isOpen, (open) => {\n if (!open) focusTrigger();\n});\n\nconst highlightedIdx = ref<number>(-1);\n\nconst activeDescendantId = computed(() =>\n highlightedIdx.value >= 0\n ? `${listboxId}-opt-${highlightedIdx.value}`\n : undefined,\n);\n\nwatch(displayedItems, () => {\n if (!props.searchable) return;\n const order = focusableIndices();\n highlightedIdx.value = order[0] ?? -1;\n});\n\nwatch(isOpen, (open) => {\n if (!open) {\n highlightedIdx.value = -1;\n return;\n }\n if (!props.searchable) return;\n const idx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue && !it.disabled,\n );\n const order = focusableIndices();\n highlightedIdx.value = idx >= 0 ? idx : order[0] ?? -1;\n});\n\nfunction moveHighlight(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = order.indexOf(highlightedIdx.value);\n if (cur === -1) {\n highlightedIdx.value = delta > 0 ? order[0] : order[order.length - 1];\n return;\n }\n const next = (cur + delta + order.length) % order.length;\n highlightedIdx.value = order[next];\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveHighlight(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveHighlight(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[0];\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[order.length - 1];\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (highlightedIdx.value >= 0) {\n selectItem(displayedItems.value[highlightedIdx.value]);\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n }\n}\n\n// Dev-only: warn once per offending item when both icon and avatar are set.\nif (import.meta.env?.DEV ?? true) {\n const warned = new Set<SwitcherValue>();\n watchEffect(() => {\n for (const item of props.items) {\n if (item.icon && item.avatar && !warned.has(item.value)) {\n warned.add(item.value);\n console.warn(\n `[Switcher] item \"${item.value}\" declares both \\`icon\\` and \\`avatar\\`; \\`avatar\\` wins. Pick one.`,\n );\n }\n }\n });\n}\n\ndefineExpose({ open, close, toggle });\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwOA,MAAM,QAAQ;EAed,MAAM,OAAO;EAEb,MAAM,SAAS,s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FA,OAAM;QACN,eAAY;;;;KAMJA,KAAAA,OAAO,WAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBASZ,IAAA,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,oBAJP,MAAA;MAHA,iCAAA;MACA,MAAK;MACL,OAAM;gDAIF,OAFN,aAEM,EAAA,GAAA,IAAA,YADiC,KAAA,QAAA,UAAA,EAAhB,QAAA,GAAA,IAAA,OAAO,MAAK,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
|
|
1
|
+
{"version":3,"file":"Switcher.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../src/components/navigation/Switcher.vue"],"sourcesContent":["<template>\n <div class=\"modo-switcher inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <span ref=\"triggerWrapEl\" class=\"inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <slot\n name=\"trigger\"\n :activeItem=\"activeItem\"\n :isOpen=\"isOpen\"\n :toggle=\"onTriggerClick\"\n >\n <button\n ref=\"triggerEl\"\n type=\"button\"\n data-modo-switcher-trigger\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"resolvedAriaLabel\"\n :disabled=\"disabled\"\n :class=\"[\n 'inline-flex items-center text-left transition-colors',\n triggerSizeClass,\n 'border bg-card text-card-foreground border-input hover:border-input-hover',\n 'hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60',\n radiusClass,\n fullWidth ? 'w-full' : '',\n disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span\n v-if=\"activeItem?.avatar\"\n data-modo-switcher-lead\n :class=\"['shrink-0', sized ? ['inline-flex items-center justify-center', sized.leadAvatar] : '']\"\n >\n <Avatar\n :src=\"activeItem.avatar.src\"\n :initials=\"activeItem.avatar.initials\"\n :name=\"activeItem.title\"\n :size=\"sized ? 'xsmall' : 'small'\"\n />\n </span>\n <span\n v-else-if=\"activeItem?.icon\"\n data-modo-switcher-lead\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center bg-accent/60 text-foreground',\n sized ? sized.lead : 'w-9 h-9',\n radiusClass,\n ]\"\n >\n <component\n :is=\"activeItem.icon\"\n :class=\"sized ? sized.leadIcon : 'w-5 h-5'\"\n aria-hidden=\"true\"\n />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span :class=\"['truncate font-medium', sized ? sizeTokens.text : 'text-body']\">\n {{ activeItem ? activeItem.title : resolvedPlaceholder }}\n </span>\n <span\n v-if=\"!sized && !compactTrigger && activeItem?.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >\n {{ activeItem.subtitle }}\n </span>\n </span>\n <ChevronUpDownIcon\n v-if=\"chevron === 'updown'\"\n :class=\"['shrink-0 text-muted-foreground', sized ? sizeTokens.icon : 'w-4 h-4']\"\n aria-hidden=\"true\"\n />\n <ChevronDownIcon\n v-else-if=\"chevron === 'down'\"\n :class=\"['shrink-0 text-muted-foreground', sized ? sizeTokens.icon : 'w-4 h-4']\"\n aria-hidden=\"true\"\n />\n </button>\n </slot>\n </span>\n\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"resolvedRadius\"\n role=\"dialog\"\n :aria-label=\"resolvedAriaLabel\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div\n data-modo-switcher-panel\n class=\"modo-switcher-panel overflow-y-auto\"\n :style=\"{ maxHeight: panelMaxHeightStyle }\"\n >\n <div\n v-if=\"panelTitle\"\n class=\"px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider\"\n >\n {{ panelTitle }}\n </div>\n\n <div v-if=\"searchable\" class=\"px-2 pt-2 pb-1\">\n <input\n ref=\"searchInputEl\"\n v-model=\"searchQuery\"\n role=\"searchbox\"\n type=\"text\"\n :placeholder=\"resolvedSearchPlaceholder\"\n :aria-controls=\"listboxId\"\n :aria-activedescendant=\"activeDescendantId\"\n class=\"w-full px-2 py-1.5 text-body bg-background border border-input rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60\"\n @keydown=\"onSearchKeydown\"\n />\n </div>\n\n <template v-if=\"loading\">\n <slot name=\"loading\">\n <div class=\"p-2 flex flex-col gap-1\">\n <div\n v-for=\"i in 3\"\n :key=\"i\"\n data-modo-switcher-skeleton\n >\n <Skeleton height=\"44px\" />\n </div>\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"items.length === 0\">\n <slot name=\"empty\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedEmptyText }}\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"displayedItems.length === 0\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedNoResults }}\n </div>\n </template>\n\n <ul\n v-else\n role=\"listbox\"\n :id=\"listboxId\"\n class=\"flex flex-col\"\n @keydown=\"onListKeydown\"\n >\n <li\n v-for=\"(item, idx) in displayedItems\"\n :key=\"item.value\"\n :ref=\"(el) => setOptionRef(el as HTMLElement | null, idx)\"\n role=\"option\"\n :id=\"`${listboxId}-opt-${idx}`\"\n :aria-selected=\"item.value === modelValue\"\n :aria-current=\"item.value === modelValue ? 'true' : undefined\"\n :aria-disabled=\"item.disabled || undefined\"\n :data-active=\"item.value === modelValue || undefined\"\n :tabindex=\"-1\"\n class=\"modo-switcher-item flex items-center gap-3 px-3 py-2 cursor-pointer\"\n :class=\"[\n item.value === modelValue ? 'bg-accent/40' : '',\n searchable && idx === highlightedIdx ? 'bg-accent' : 'hover:bg-accent',\n item.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ]\"\n @click=\"selectItem(item)\"\n @mouseenter=\"searchable ? (highlightedIdx = idx) : null\"\n >\n <span v-if=\"item.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"item.avatar.src\"\n :initials=\"item.avatar.initials\"\n :name=\"item.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"item.icon\"\n data-modo-switcher-iconwrap\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-9 h-9 bg-accent/60 text-foreground',\n radiusClass,\n ]\"\n >\n <component :is=\"item.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">{{ item.title }}</span>\n <span\n v-if=\"item.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >{{ item.subtitle }}</span>\n </span>\n <slot\n name=\"item-trailing\"\n :item=\"item\"\n :active=\"item.value === modelValue\"\n :close=\"close\"\n >\n <CheckIcon\n v-if=\"item.value === modelValue\"\n class=\"w-4 h-4 shrink-0\"\n aria-hidden=\"true\"\n />\n </slot>\n </li>\n </ul>\n\n <template v-if=\"$slots.footer\">\n <hr\n data-modo-switcher-footer-sep\n role=\"separator\"\n class=\"my-1 border-t border-border\"\n />\n <div class=\"p-1\">\n <slot name=\"footer\" :close=\"close\" />\n </div>\n </template>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch, watchEffect } from \"vue\";\nimport { ChevronUpDownIcon, ChevronDownIcon, CheckIcon } from \"@heroicons/vue/24/outline\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Avatar from \"../data-display/avatar/Avatar.vue\";\nimport Skeleton from \"../feedback/Skeleton.vue\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport { SIZE_TOKENS, normalizeSize } from \"../../config/sizes\";\nimport {\n useResolvedRadius,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport type {\n Switcher as SwitcherProps,\n SwitcherEmits,\n SwitcherItem,\n SwitcherValue,\n} from \"../../interfaces/navigation/Switcher.interface\";\n\nconst props = withDefaults(defineProps<SwitcherProps>(), {\n modelValue: null,\n chevron: \"updown\",\n triggerVariant: \"outline\",\n compactTrigger: false,\n fullWidth: false,\n panelWidth: \"trigger\",\n panelMinWidth: \"15rem\",\n panelMaxHeight: 320,\n placement: \"bottom-start\",\n searchable: false,\n loading: false,\n disabled: false,\n});\n\nconst emit = defineEmits<SwitcherEmits>();\n\nconst locale = useModoLocale();\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst listboxId = useId();\n\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? locale.value.switcher.placeholder,\n);\nconst resolvedAriaLabel = computed(\n () => props.ariaLabel ?? locale.value.switcher.ariaLabel,\n);\nconst resolvedEmptyText = computed(\n () => props.emptyText ?? locale.value.switcher.empty,\n);\nconst resolvedSearchPlaceholder = computed(\n () => props.searchPlaceholder ?? locale.value.switcher.searchPlaceholder,\n);\nconst resolvedNoResults = computed(\n () => props.noResultsText ?? locale.value.switcher.noResults,\n);\n\nconst searchQuery = ref(\"\");\nconst searchInputEl = ref<HTMLInputElement | null>(null);\n\nconst displayedItems = computed<SwitcherItem[]>(() => {\n if (!props.searchable) return props.items;\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return props.items;\n const fields = props.searchFields ?? [\"title\", \"subtitle\"];\n return props.items.filter((it) =>\n fields.some((f) => {\n const v = it[f];\n return typeof v === \"string\" && v.toLowerCase().includes(q);\n }),\n );\n});\n\nwatch(searchQuery, (q) => {\n emit(\"search\", q);\n});\n\nconst radiusClass = computed(() => {\n switch (resolvedRadius.value) {\n case \"none\": return \"rounded-none\";\n case \"small\": return \"rounded-sm\";\n case \"large\": return \"rounded-lg\";\n case \"full\": return \"rounded-[999px]\";\n default: return \"rounded-md\";\n }\n});\n\n// Opt-in sizing: without an explicit `size` the trigger keeps its original\n// two-line look (padding-driven height). With one, it becomes a single-line\n// control that shares height / padding / font / icon tokens with Button, Input\n// and Select, and the subtitle is dropped so the line fits the control height.\nconst LEADING: Record<string, { lead: string; leadIcon: string; leadAvatar: string }> = {\n xsmall: { lead: \"w-5 h-5\", leadIcon: \"w-3 h-3\", leadAvatar: \"[&>div>*]:!w-5 [&>div>*]:!h-5\" },\n small: { lead: \"w-6 h-6\", leadIcon: \"w-3.5 h-3.5\", leadAvatar: \"[&>div>*]:!w-6 [&>div>*]:!h-6\" },\n medium: { lead: \"w-7 h-7\", leadIcon: \"w-4 h-4\", leadAvatar: \"[&>div>*]:!w-7 [&>div>*]:!h-7\" },\n large: { lead: \"w-8 h-8\", leadIcon: \"w-5 h-5\", leadAvatar: \"[&>div>*]:!w-8 [&>div>*]:!h-8\" },\n};\nconst sizeTokens = computed(() => SIZE_TOKENS[normalizeSize(props.size)]);\nconst sized = computed(() =>\n props.size ? LEADING[normalizeSize(props.size)] : null,\n);\nconst triggerSizeClass = computed(() =>\n sized.value\n ? `${sizeTokens.value.control} ${sizeTokens.value.padX} ${sizeTokens.value.gap}`\n : \"gap-3 px-3 py-2\",\n);\n\nconst panelMaxHeightStyle = computed(() => {\n const v = props.panelMaxHeight;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\nconst panelMinWidthStyle = computed(() => {\n const v = props.panelMinWidth;\n if (v == null) return undefined;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\n// The popover composable sizes the panel to the trigger width when\n// `panelWidth='trigger'`. A narrow trigger (e.g. an avatar-only custom\n// trigger) would otherwise crush the panel — `minWidth` floors it.\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(panelMinWidthStyle.value ? { minWidth: panelMinWidthStyle.value } : {}),\n}));\n\nconst activeItem = computed<SwitcherItem | null>(() => {\n if (props.modelValue == null) return null;\n return props.items.find((i) => i.value === props.modelValue) ?? null;\n});\n\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open,\n close,\n toggle,\n} = usePopover({\n placement: () => props.placement,\n matchTriggerWidth: () => props.panelWidth === \"trigger\",\n closeOnEscape: false,\n onOpen: () => emit(\"open\"),\n onClose: () => {\n searchQuery.value = \"\";\n emit(\"close\");\n },\n});\n\nconst triggerEl = ref<HTMLElement | null>(null);\nconst triggerWrapEl = ref<HTMLElement | null>(null);\nwatch([triggerEl, triggerWrapEl], ([btn, wrap]) => {\n triggerRef.value = (btn as HTMLElement | null) ?? (wrap as HTMLElement | null);\n});\n\nfunction focusTrigger() {\n const el = triggerEl.value ?? triggerWrapEl.value;\n el?.focus?.();\n}\n\nfunction onTriggerClick() {\n if (props.disabled) return;\n toggle();\n}\n\nfunction selectItem(item: SwitcherItem) {\n if (item.disabled || props.disabled) return;\n emit(\"update:modelValue\", item.value);\n emit(\"change\", item.value, item);\n close();\n}\n\nfunction focusableIndices(): number[] {\n return displayedItems.value\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n}\n\nconst optionRefs = new Map<number, HTMLElement>();\nfunction setOptionRef(el: HTMLElement | null, idx: number) {\n if (el) optionRefs.set(idx, el);\n else optionRefs.delete(idx);\n}\n\nfunction focusOptionByIdx(idx: number) {\n optionRefs.get(idx)?.focus();\n}\n\nasync function openAndFocusActive() {\n if (props.disabled) return;\n if (!isOpen.value) open();\n await nextTick();\n if (props.searchable) {\n searchInputEl.value?.focus();\n return;\n }\n const order = focusableIndices();\n if (!order.length) return;\n const activeIdx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue,\n );\n const usable =\n activeIdx >= 0 && !displayedItems.value[activeIdx].disabled\n ? activeIdx\n : order[0];\n focusOptionByIdx(usable);\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if ([\"ArrowDown\", \"ArrowUp\", \"Enter\", \" \"].includes(e.key)) {\n e.preventDefault();\n openAndFocusActive();\n } else if (e.key === \"Escape\" && isOpen.value) {\n e.preventDefault();\n close();\n }\n}\n\nfunction currentFocusedIdx(): number {\n const el = document.activeElement as HTMLElement | null;\n if (!el) return -1;\n for (const [idx, node] of optionRefs.entries()) {\n if (node === el) return idx;\n }\n return -1;\n}\n\nfunction moveFocus(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = currentFocusedIdx();\n let pos = order.indexOf(cur);\n if (pos === -1) {\n focusOptionByIdx(delta > 0 ? order[0] : order[order.length - 1]);\n return;\n }\n pos = (pos + delta + order.length) % order.length;\n focusOptionByIdx(order[pos]);\n}\n\nfunction onListKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveFocus(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveFocus(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[0]);\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[order.length - 1]);\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n const idx = currentFocusedIdx();\n if (idx >= 0) selectItem(displayedItems.value[idx]);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n } else if (\n !props.searchable &&\n e.key.length === 1 &&\n /^[a-zA-Z0-9]$/.test(e.key)\n ) {\n const order = focusableIndices();\n const letter = e.key.toLowerCase();\n const match = order.find((i) =>\n displayedItems.value[i].title.toLowerCase().startsWith(letter),\n );\n if (match !== undefined) focusOptionByIdx(match);\n }\n}\n\nwatch(isOpen, (open) => {\n if (!open) focusTrigger();\n});\n\nconst highlightedIdx = ref<number>(-1);\n\nconst activeDescendantId = computed(() =>\n highlightedIdx.value >= 0\n ? `${listboxId}-opt-${highlightedIdx.value}`\n : undefined,\n);\n\nwatch(displayedItems, () => {\n if (!props.searchable) return;\n const order = focusableIndices();\n highlightedIdx.value = order[0] ?? -1;\n});\n\nwatch(isOpen, (open) => {\n if (!open) {\n highlightedIdx.value = -1;\n return;\n }\n if (!props.searchable) return;\n const idx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue && !it.disabled,\n );\n const order = focusableIndices();\n highlightedIdx.value = idx >= 0 ? idx : order[0] ?? -1;\n});\n\nfunction moveHighlight(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = order.indexOf(highlightedIdx.value);\n if (cur === -1) {\n highlightedIdx.value = delta > 0 ? order[0] : order[order.length - 1];\n return;\n }\n const next = (cur + delta + order.length) % order.length;\n highlightedIdx.value = order[next];\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveHighlight(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveHighlight(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[0];\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[order.length - 1];\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (highlightedIdx.value >= 0) {\n selectItem(displayedItems.value[highlightedIdx.value]);\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n }\n}\n\n// Dev-only: warn once per offending item when both icon and avatar are set.\nif (import.meta.env?.DEV ?? true) {\n const warned = new Set<SwitcherValue>();\n watchEffect(() => {\n for (const item of props.items) {\n if (item.icon && item.avatar && !warned.has(item.value)) {\n warned.add(item.value);\n console.warn(\n `[Switcher] item \"${item.value}\" declares both \\`icon\\` and \\`avatar\\`; \\`avatar\\` wins. Pick one.`,\n );\n }\n }\n });\n}\n\ndefineExpose({ open, close, toggle });\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoPA,MAAM,QAAQ;EAed,MAAM,OAAO;EAEb,MAAM,SAAS,sBAAA,eAAe;EAC9B,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,OAAO;EAC5D,MAAM,aAAA,GAAA,IAAA,QAAmB;EAEzB,MAAM,uBAAA,GAAA,IAAA,gBACE,MAAM,eAAe,OAAO,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CAAA,EAAA,GAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SIZE_TOKENS, normalizeSize } from "../../config/sizes.mjs";
|
|
1
2
|
import { useModoLocale, useResolvedRadius } from "../../composables/useModoConfig.mjs";
|
|
2
3
|
import { usePopover } from "../../composables/usePopover.mjs";
|
|
3
4
|
import Skeleton_default from "../feedback/Skeleton.mjs";
|
|
@@ -11,37 +12,32 @@ var _hoisted_1 = [
|
|
|
11
12
|
"aria-label",
|
|
12
13
|
"disabled"
|
|
13
14
|
];
|
|
14
|
-
var _hoisted_2 = {
|
|
15
|
-
|
|
16
|
-
class: "shrink-0"
|
|
17
|
-
};
|
|
18
|
-
var _hoisted_3 = { class: "flex flex-col min-w-0 flex-1" };
|
|
19
|
-
var _hoisted_4 = { class: "truncate text-body font-medium" };
|
|
20
|
-
var _hoisted_5 = {
|
|
15
|
+
var _hoisted_2 = { class: "flex flex-col min-w-0 flex-1" };
|
|
16
|
+
var _hoisted_3 = {
|
|
21
17
|
key: 0,
|
|
22
18
|
class: "truncate text-caption text-muted-foreground"
|
|
23
19
|
};
|
|
24
|
-
var
|
|
20
|
+
var _hoisted_4 = {
|
|
25
21
|
key: 0,
|
|
26
22
|
class: "px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider"
|
|
27
23
|
};
|
|
28
|
-
var
|
|
24
|
+
var _hoisted_5 = {
|
|
29
25
|
key: 1,
|
|
30
26
|
class: "px-2 pt-2 pb-1"
|
|
31
27
|
};
|
|
32
|
-
var
|
|
28
|
+
var _hoisted_6 = [
|
|
33
29
|
"placeholder",
|
|
34
30
|
"aria-controls",
|
|
35
31
|
"aria-activedescendant"
|
|
36
32
|
];
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
33
|
+
var _hoisted_7 = { class: "p-2 flex flex-col gap-1" };
|
|
34
|
+
var _hoisted_8 = { class: "px-3 py-6 text-center text-muted-foreground text-body" };
|
|
35
|
+
var _hoisted_9 = {
|
|
40
36
|
key: 4,
|
|
41
37
|
class: "px-3 py-6 text-center text-muted-foreground text-body"
|
|
42
38
|
};
|
|
43
|
-
var
|
|
44
|
-
var
|
|
39
|
+
var _hoisted_10 = ["id"];
|
|
40
|
+
var _hoisted_11 = [
|
|
45
41
|
"id",
|
|
46
42
|
"aria-selected",
|
|
47
43
|
"aria-current",
|
|
@@ -50,17 +46,17 @@ var _hoisted_13 = [
|
|
|
50
46
|
"onClick",
|
|
51
47
|
"onMouseenter"
|
|
52
48
|
];
|
|
53
|
-
var
|
|
49
|
+
var _hoisted_12 = {
|
|
54
50
|
key: 0,
|
|
55
51
|
class: "shrink-0"
|
|
56
52
|
};
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
53
|
+
var _hoisted_13 = { class: "flex flex-col min-w-0 flex-1" };
|
|
54
|
+
var _hoisted_14 = { class: "truncate text-body font-medium" };
|
|
55
|
+
var _hoisted_15 = {
|
|
60
56
|
key: 0,
|
|
61
57
|
class: "truncate text-caption text-muted-foreground"
|
|
62
58
|
};
|
|
63
|
-
var
|
|
59
|
+
var _hoisted_16 = { class: "p-1" };
|
|
64
60
|
var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
65
61
|
__name: "Switcher",
|
|
66
62
|
props: {
|
|
@@ -145,6 +141,31 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
145
141
|
default: return "rounded-md";
|
|
146
142
|
}
|
|
147
143
|
});
|
|
144
|
+
const LEADING = {
|
|
145
|
+
xsmall: {
|
|
146
|
+
lead: "w-5 h-5",
|
|
147
|
+
leadIcon: "w-3 h-3",
|
|
148
|
+
leadAvatar: "[&>div>*]:!w-5 [&>div>*]:!h-5"
|
|
149
|
+
},
|
|
150
|
+
small: {
|
|
151
|
+
lead: "w-6 h-6",
|
|
152
|
+
leadIcon: "w-3.5 h-3.5",
|
|
153
|
+
leadAvatar: "[&>div>*]:!w-6 [&>div>*]:!h-6"
|
|
154
|
+
},
|
|
155
|
+
medium: {
|
|
156
|
+
lead: "w-7 h-7",
|
|
157
|
+
leadIcon: "w-4 h-4",
|
|
158
|
+
leadAvatar: "[&>div>*]:!w-7 [&>div>*]:!h-7"
|
|
159
|
+
},
|
|
160
|
+
large: {
|
|
161
|
+
lead: "w-8 h-8",
|
|
162
|
+
leadIcon: "w-5 h-5",
|
|
163
|
+
leadAvatar: "[&>div>*]:!w-8 [&>div>*]:!h-8"
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const sizeTokens = computed(() => SIZE_TOKENS[normalizeSize(props.size)]);
|
|
167
|
+
const sized = computed(() => props.size ? LEADING[normalizeSize(props.size)] : null);
|
|
168
|
+
const triggerSizeClass = computed(() => sized.value ? `${sizeTokens.value.control} ${sizeTokens.value.padX} ${sizeTokens.value.gap}` : "gap-3 px-3 py-2");
|
|
148
169
|
const panelMaxHeightStyle = computed(() => {
|
|
149
170
|
const v = props.panelMaxHeight;
|
|
150
171
|
return typeof v === "number" ? `${v}px` : v;
|
|
@@ -353,8 +374,9 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
353
374
|
"aria-label": resolvedAriaLabel.value,
|
|
354
375
|
disabled: __props.disabled,
|
|
355
376
|
class: normalizeClass([
|
|
356
|
-
"inline-flex items-center
|
|
357
|
-
|
|
377
|
+
"inline-flex items-center text-left transition-colors",
|
|
378
|
+
triggerSizeClass.value,
|
|
379
|
+
"border bg-card text-card-foreground border-input hover:border-input-hover",
|
|
358
380
|
"hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
|
|
359
381
|
radiusClass.value,
|
|
360
382
|
__props.fullWidth ? "w-full" : "",
|
|
@@ -363,32 +385,42 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
363
385
|
onClick: onTriggerClick,
|
|
364
386
|
onKeydown: onTriggerKeydown
|
|
365
387
|
}, [
|
|
366
|
-
activeItem.value?.avatar ? (openBlock(), createElementBlock("span",
|
|
388
|
+
activeItem.value?.avatar ? (openBlock(), createElementBlock("span", {
|
|
389
|
+
key: 0,
|
|
390
|
+
"data-modo-switcher-lead": "",
|
|
391
|
+
class: normalizeClass(["shrink-0", sized.value ? ["inline-flex items-center justify-center", sized.value.leadAvatar] : ""])
|
|
392
|
+
}, [createVNode(Avatar_default, {
|
|
367
393
|
src: activeItem.value.avatar.src,
|
|
368
394
|
initials: activeItem.value.avatar.initials,
|
|
369
395
|
name: activeItem.value.title,
|
|
370
|
-
size: "small"
|
|
396
|
+
size: sized.value ? "xsmall" : "small"
|
|
371
397
|
}, null, 8, [
|
|
372
398
|
"src",
|
|
373
399
|
"initials",
|
|
374
|
-
"name"
|
|
375
|
-
|
|
400
|
+
"name",
|
|
401
|
+
"size"
|
|
402
|
+
])], 2)) : activeItem.value?.icon ? (openBlock(), createElementBlock("span", {
|
|
376
403
|
key: 1,
|
|
377
|
-
|
|
404
|
+
"data-modo-switcher-lead": "",
|
|
405
|
+
class: normalizeClass([
|
|
406
|
+
"shrink-0 inline-flex items-center justify-center bg-accent/60 text-foreground",
|
|
407
|
+
sized.value ? sized.value.lead : "w-9 h-9",
|
|
408
|
+
radiusClass.value
|
|
409
|
+
])
|
|
378
410
|
}, [(openBlock(), createBlock(resolveDynamicComponent(activeItem.value.icon), {
|
|
379
|
-
class: "w-5 h-5",
|
|
411
|
+
class: normalizeClass(sized.value ? sized.value.leadIcon : "w-5 h-5"),
|
|
380
412
|
"aria-hidden": "true"
|
|
381
|
-
}))], 2)) : createCommentVNode("", true),
|
|
382
|
-
createElementVNode("span",
|
|
413
|
+
}, null, 8, ["class"]))], 2)) : createCommentVNode("", true),
|
|
414
|
+
createElementVNode("span", _hoisted_2, [createElementVNode("span", { class: normalizeClass(["truncate font-medium", sized.value ? sizeTokens.value.text : "text-body"]) }, toDisplayString(activeItem.value ? activeItem.value.title : resolvedPlaceholder.value), 3), !sized.value && !__props.compactTrigger && activeItem.value?.subtitle ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(activeItem.value.subtitle), 1)) : createCommentVNode("", true)]),
|
|
383
415
|
__props.chevron === "updown" ? (openBlock(), createBlock(unref(ChevronUpDownIcon), {
|
|
384
416
|
key: 2,
|
|
385
|
-
class: "
|
|
417
|
+
class: normalizeClass(["shrink-0 text-muted-foreground", sized.value ? sizeTokens.value.icon : "w-4 h-4"]),
|
|
386
418
|
"aria-hidden": "true"
|
|
387
|
-
})) : __props.chevron === "down" ? (openBlock(), createBlock(unref(ChevronDownIcon), {
|
|
419
|
+
}, null, 8, ["class"])) : __props.chevron === "down" ? (openBlock(), createBlock(unref(ChevronDownIcon), {
|
|
388
420
|
key: 3,
|
|
389
|
-
class: "
|
|
421
|
+
class: normalizeClass(["shrink-0 text-muted-foreground", sized.value ? sizeTokens.value.icon : "w-4 h-4"]),
|
|
390
422
|
"aria-hidden": "true"
|
|
391
|
-
})) : createCommentVNode("", true)
|
|
423
|
+
}, null, 8, ["class"])) : createCommentVNode("", true)
|
|
392
424
|
], 42, _hoisted_1)])], 2), createVNode(PopoverPanel_default, {
|
|
393
425
|
open: unref(isOpen),
|
|
394
426
|
style: normalizeStyle(mergedPanelStyle.value),
|
|
@@ -402,8 +434,8 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
402
434
|
class: "modo-switcher-panel overflow-y-auto",
|
|
403
435
|
style: normalizeStyle({ maxHeight: panelMaxHeightStyle.value })
|
|
404
436
|
}, [
|
|
405
|
-
__props.panelTitle ? (openBlock(), createElementBlock("div",
|
|
406
|
-
__props.searchable ? (openBlock(), createElementBlock("div",
|
|
437
|
+
__props.panelTitle ? (openBlock(), createElementBlock("div", _hoisted_4, toDisplayString(__props.panelTitle), 1)) : createCommentVNode("", true),
|
|
438
|
+
__props.searchable ? (openBlock(), createElementBlock("div", _hoisted_5, [withDirectives(createElementVNode("input", {
|
|
407
439
|
ref_key: "searchInputEl",
|
|
408
440
|
ref: searchInputEl,
|
|
409
441
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
|
|
@@ -412,15 +444,15 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
412
444
|
placeholder: resolvedSearchPlaceholder.value,
|
|
413
445
|
"aria-controls": unref(listboxId),
|
|
414
446
|
"aria-activedescendant": activeDescendantId.value,
|
|
415
|
-
class: "w-full px-2 py-1.5 text-body bg-background border border-
|
|
447
|
+
class: "w-full px-2 py-1.5 text-body bg-background border border-input rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
|
|
416
448
|
onKeydown: onSearchKeydown
|
|
417
|
-
}, null, 40,
|
|
418
|
-
__props.loading ? renderSlot(_ctx.$slots, "loading", { key: 2 }, () => [createElementVNode("div",
|
|
449
|
+
}, null, 40, _hoisted_6), [[vModelText, searchQuery.value]])])) : createCommentVNode("", true),
|
|
450
|
+
__props.loading ? renderSlot(_ctx.$slots, "loading", { key: 2 }, () => [createElementVNode("div", _hoisted_7, [(openBlock(), createElementBlock(Fragment, null, renderList(3, (i) => {
|
|
419
451
|
return createElementVNode("div", {
|
|
420
452
|
key: i,
|
|
421
453
|
"data-modo-switcher-skeleton": ""
|
|
422
454
|
}, [createVNode(Skeleton_default, { height: "44px" })]);
|
|
423
|
-
}), 64))])]) : __props.items.length === 0 ? renderSlot(_ctx.$slots, "empty", { key: 3 }, () => [createElementVNode("div",
|
|
455
|
+
}), 64))])]) : __props.items.length === 0 ? renderSlot(_ctx.$slots, "empty", { key: 3 }, () => [createElementVNode("div", _hoisted_8, toDisplayString(resolvedEmptyText.value), 1)]) : displayedItems.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_9, toDisplayString(resolvedNoResults.value), 1)) : (openBlock(), createElementBlock("ul", {
|
|
424
456
|
key: 5,
|
|
425
457
|
role: "listbox",
|
|
426
458
|
id: unref(listboxId),
|
|
@@ -446,7 +478,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
446
478
|
onClick: ($event) => selectItem(item),
|
|
447
479
|
onMouseenter: ($event) => __props.searchable ? highlightedIdx.value = idx : null
|
|
448
480
|
}, [
|
|
449
|
-
item.avatar ? (openBlock(), createElementBlock("span",
|
|
481
|
+
item.avatar ? (openBlock(), createElementBlock("span", _hoisted_12, [createVNode(Avatar_default, {
|
|
450
482
|
src: item.avatar.src,
|
|
451
483
|
initials: item.avatar.initials,
|
|
452
484
|
name: item.title,
|
|
@@ -463,7 +495,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
463
495
|
class: "w-5 h-5",
|
|
464
496
|
"aria-hidden": "true"
|
|
465
497
|
}))], 2)) : createCommentVNode("", true),
|
|
466
|
-
createElementVNode("span",
|
|
498
|
+
createElementVNode("span", _hoisted_13, [createElementVNode("span", _hoisted_14, toDisplayString(item.title), 1), item.subtitle ? (openBlock(), createElementBlock("span", _hoisted_15, toDisplayString(item.subtitle), 1)) : createCommentVNode("", true)]),
|
|
467
499
|
renderSlot(_ctx.$slots, "item-trailing", {
|
|
468
500
|
item,
|
|
469
501
|
active: item.value === __props.modelValue,
|
|
@@ -473,13 +505,13 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
473
505
|
class: "w-4 h-4 shrink-0",
|
|
474
506
|
"aria-hidden": "true"
|
|
475
507
|
})) : createCommentVNode("", true)])
|
|
476
|
-
], 42,
|
|
477
|
-
}), 128))], 40,
|
|
508
|
+
], 42, _hoisted_11);
|
|
509
|
+
}), 128))], 40, _hoisted_10)),
|
|
478
510
|
_ctx.$slots.footer ? (openBlock(), createElementBlock(Fragment, { key: 6 }, [_cache[2] || (_cache[2] = createElementVNode("hr", {
|
|
479
511
|
"data-modo-switcher-footer-sep": "",
|
|
480
512
|
role: "separator",
|
|
481
513
|
class: "my-1 border-t border-border"
|
|
482
|
-
}, null, -1)), createElementVNode("div",
|
|
514
|
+
}, null, -1)), createElementVNode("div", _hoisted_16, [renderSlot(_ctx.$slots, "footer", { close: unref(close) })])], 64)) : createCommentVNode("", true)
|
|
483
515
|
], 4)]),
|
|
484
516
|
_: 3
|
|
485
517
|
}, 8, [
|