maz-ui 4.7.5 → 4.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/MazAccordion.CKnz73h4.js +1 -0
- package/dist/chunks/MazAlert.B8hE7wet.js +1 -0
- package/dist/chunks/MazAnimatedCounter.GLLYbZAz.js +1 -0
- package/dist/chunks/MazAnimatedElement._8NY8WgC.js +1 -0
- package/dist/chunks/MazAnimatedText.BSZ8FNf-.js +1 -0
- package/dist/chunks/MazAvatar.vO5VNPi8.js +1 -0
- package/dist/chunks/MazBackdrop.Cjbwi8-V.js +1 -0
- package/dist/chunks/MazBadge.BBZJgHXm.js +1 -0
- package/dist/chunks/MazBottomSheet.WgZ6qobx.js +1 -0
- package/dist/chunks/MazBtn.Cc9C1v2l.js +1 -0
- package/dist/chunks/MazBtnGroup.3B1XcqWM.js +1 -0
- package/dist/chunks/MazCard.YYC0LaHY.js +1 -0
- package/dist/chunks/MazCardSpotlight.SpZF61hl.js +1 -0
- package/dist/chunks/MazCarousel.1NT4jcvR.js +1 -0
- package/dist/chunks/MazChart.CDZ2PBTC.js +1 -0
- package/dist/chunks/MazCheckbox.DurIbKdf.js +1 -0
- package/dist/chunks/MazChecklist.D9ezwGpQ.js +1 -0
- package/dist/chunks/MazCircularProgressBar.rATx_hD9.js +1 -0
- package/dist/chunks/MazContainer.zXcfMOs-.js +1 -0
- package/dist/chunks/MazDatePicker.KUP34cbV.js +1 -0
- package/dist/chunks/MazDialog.CtKF3Xzo.js +1 -0
- package/dist/chunks/MazDialogConfirm.CAAHeBPE.js +1 -0
- package/dist/chunks/MazDrawer.Dc_RGG8a.js +1 -0
- package/dist/chunks/MazDropdown.2DUcivzO.js +1 -0
- package/dist/chunks/MazDropzone.CiWiPcFM.js +1 -0
- package/dist/chunks/MazExpandAnimation.CMMwtuQA.js +1 -0
- package/dist/chunks/MazFullscreenLoader.BIVRcZJ8.js +1 -0
- package/dist/chunks/MazGallery.CEmGy0K9.js +1 -0
- package/dist/chunks/MazIcon.ZWAk25ZX.js +1 -0
- package/dist/chunks/MazInput.DJjWLaKg.js +1 -0
- package/dist/chunks/MazInputCode.DKnl3i-X.js +1 -0
- package/dist/chunks/MazInputNumber.B42Mn-9h.js +1 -0
- package/dist/chunks/MazInputPhoneNumber.CLivThtK.js +1 -0
- package/dist/chunks/MazInputPrice.BeL-M944.js +1 -0
- package/dist/chunks/MazInputTags.CIVT9F6Q.js +1 -0
- package/dist/chunks/MazLazyImg.-EMwandx.js +1 -0
- package/dist/chunks/MazLink.BOpxMATj.js +1 -0
- package/dist/chunks/MazLoadingBar.C86AX2Tk.js +1 -0
- package/dist/chunks/MazPagination.CNNKXBsg.js +1 -0
- package/dist/chunks/MazPickerCalendarDays.CSZZbk5Z.js +1 -0
- package/dist/chunks/MazPickerCalendarGrid.DrUHBH6-.js +1 -0
- package/dist/chunks/MazPickerContainer.BZ74M74V.js +1 -0
- package/dist/chunks/MazPopover.Co8BEopX.js +1 -0
- package/dist/chunks/MazPullToRefresh.DMtb6Oa3.js +1 -0
- package/dist/chunks/MazRadio.75ipjTw2.js +1 -0
- package/dist/chunks/MazRadioButtons.DenHCgB3.js +1 -0
- package/dist/chunks/MazReadMore.CDXacQIw.js +1 -0
- package/dist/chunks/MazReadingProgressBar.828Y0mxA.js +1 -0
- package/dist/chunks/MazSelect.yYFAbBb5.js +1 -0
- package/dist/chunks/MazSelectCountry.DvVgk2es.js +1 -0
- package/dist/chunks/MazSkeleton.BewTYJC2.js +1 -0
- package/dist/chunks/MazSlider.BS5QHWK6.js +1 -0
- package/dist/chunks/MazSpinner.D3NN2pow.js +1 -0
- package/dist/chunks/MazStepper.DTu8HG9T.js +1 -0
- package/dist/chunks/MazSwitch.Dvmj-rTW.js +1 -0
- package/dist/chunks/MazTable.DnOehvN6.js +1 -0
- package/dist/chunks/MazTableCell.xbm2NGWL.js +1 -0
- package/dist/chunks/MazTableRow.B5dJiXk1.js +1 -0
- package/dist/chunks/MazTableTitle.DNA_1mCy.js +1 -0
- package/dist/chunks/MazTabs.-0-YP3QQ.js +1 -0
- package/dist/chunks/MazTabsBar.D2JVKMS7.js +1 -0
- package/dist/chunks/MazTabsContent.C9omK25X.js +1 -0
- package/dist/chunks/MazTabsContentItem.mJEAS5R8.js +1 -0
- package/dist/chunks/MazTextarea.BliEP5G5.js +1 -0
- package/dist/chunks/MazUiProvider.BgN8V0lD.js +1 -0
- package/dist/chunks/_plugin-vue_export-helper.ChmETRGw.js +1 -0
- package/dist/chunks/dialog.DexeIC3K.js +1 -0
- package/dist/chunks/dom-events.BPrKJiCz.js +1 -0
- package/dist/chunks/resolveLinkComponent.DAc3sqGH.js +1 -0
- package/dist/chunks/toast.UQ8RRuT9.js +1 -0
- package/dist/chunks/types.DDbvTVqf.js +1 -0
- package/dist/chunks/useMazInputPhoneNumber.B_qQ0ldP.js +1 -0
- package/dist/chunks/utils.B8bfGQxN.js +1 -0
- package/dist/chunks/vFullscreenImg.CZeRh3mw.js +1 -0
- package/dist/chunks/vLazyImg.CXmd3Lp0.js +1 -0
- package/dist/chunks/vZoomImg.CaAHb98S.js +124 -0
- package/dist/components/MazAccordion.js +1 -86
- package/dist/components/MazAlert.js +1 -85
- package/dist/components/MazAnimatedCounter.js +1 -73
- package/dist/components/MazAnimatedElement.js +1 -44
- package/dist/components/MazAnimatedText.js +1 -103
- package/dist/components/MazAvatar.js +1 -125
- package/dist/components/MazBackdrop.js +1 -163
- package/dist/components/MazBadge.js +1 -29
- package/dist/components/MazBottomSheet.js +1 -55
- package/dist/components/MazBtn.js +1 -109
- package/dist/components/MazBtnGroup.js +1 -44
- package/dist/components/MazCard.js +1 -184
- package/dist/components/MazCardSpotlight.js +1 -81
- package/dist/components/MazCarousel.js +1 -104
- package/dist/components/MazChart.js +1 -4
- package/dist/components/MazCheckbox.js +1 -128
- package/dist/components/MazChecklist.js +1 -133
- package/dist/components/MazCircularProgressBar.js +1 -131
- package/dist/components/MazContainer.js +1 -71
- package/dist/components/MazDatePicker/MazPickerCalendar.js +1 -113
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarDays.js +1 -19
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarGrid.js +1 -181
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarMonth.js +1 -75
- package/dist/components/MazDatePicker/MazPickerCalendarSwitcher.js +1 -90
- package/dist/components/MazDatePicker/MazPickerContainer.js +1 -116
- package/dist/components/MazDatePicker/MazPickerHeader.js +1 -126
- package/dist/components/MazDatePicker/MazPickerMonthSwitcher.js +1 -82
- package/dist/components/MazDatePicker/MazPickerShortcuts.js +1 -55
- package/dist/components/MazDatePicker/MazPickerTime.js +1 -178
- package/dist/components/MazDatePicker/MazPickerYearSwitcher.js +1 -95
- package/dist/components/MazDatePicker.js +1 -466
- package/dist/components/MazDatePicker.vue.d.ts +2 -6
- package/dist/components/MazDialog.js +1 -115
- package/dist/components/MazDialog.vue.d.ts +2 -6
- package/dist/components/MazDialogConfirm.js +1 -6
- package/dist/components/MazDialogConfirm.vue.d.ts +2 -6
- package/dist/components/MazDrawer.js +1 -70
- package/dist/components/MazDropdown.js +1 -277
- package/dist/components/MazDropdown.vue.d.ts +2 -6
- package/dist/components/MazDropzone.js +1 -533
- package/dist/components/MazExpandAnimation.js +1 -46
- package/dist/components/MazFullscreenLoader.js +1 -38
- package/dist/components/MazGallery.js +1 -105
- package/dist/components/MazIcon.js +1 -114
- package/dist/components/MazInput.js +1 -256
- package/dist/components/MazInputCode.js +1 -152
- package/dist/components/MazInputNumber.js +1 -152
- package/dist/components/MazInputPhoneNumber/PhoneInput.js +1 -114
- package/dist/components/MazInputPhoneNumber.js +1 -253
- package/dist/components/MazInputPrice.js +1 -4
- package/dist/components/MazInputTags.js +1 -145
- package/dist/components/MazLazyImg.js +1 -62
- package/dist/components/MazLink.js +1 -80
- package/dist/components/MazLoadingBar.js +1 -24
- package/dist/components/MazPagination.js +1 -184
- package/dist/components/MazPopover.js +1 -326
- package/dist/components/MazPullToRefresh.js +1 -145
- package/dist/components/MazRadio.js +1 -103
- package/dist/components/MazRadioButtons.js +1 -135
- package/dist/components/MazReadMore.js +1 -110
- package/dist/components/MazReadingProgressBar.js +1 -68
- package/dist/components/MazSelect.js +1 -413
- package/dist/components/MazSelectCountry.js +1 -192
- package/dist/components/MazSkeleton.js +1 -50
- package/dist/components/MazSlider.js +1 -205
- package/dist/components/MazSpinner.js +1 -27
- package/dist/components/MazStepper.js +1 -170
- package/dist/components/MazSwitch.js +1 -4
- package/dist/components/MazTable.js +1 -8
- package/dist/components/MazTableCell.js +1 -18
- package/dist/components/MazTableRow.js +1 -26
- package/dist/components/MazTableTitle.js +1 -18
- package/dist/components/MazTabs.js +1 -4
- package/dist/components/MazTabsBar.js +1 -138
- package/dist/components/MazTabsContent.js +1 -4
- package/dist/components/MazTabsContentItem.js +1 -37
- package/dist/components/MazTextarea.js +1 -147
- package/dist/components/MazUiProvider.js +1 -4
- package/dist/components/index.js +1 -127
- package/dist/composables/index.js +1 -44
- package/dist/composables/useAos.js +1 -7
- package/dist/composables/useBreakpoints.js +1 -34
- package/dist/composables/useDialog.js +1 -7
- package/dist/composables/useDisplayNames.js +1 -111
- package/dist/composables/useDropzone.js +1 -66
- package/dist/composables/useFormField.js +1 -101
- package/dist/composables/useFormValidator.js +1 -163
- package/dist/composables/useFreezeValue.js +1 -8
- package/dist/composables/useIdleTimeout.js +1 -10
- package/dist/composables/useInjectStrict.js +1 -10
- package/dist/composables/useInstanceUniqId.js +1 -12
- package/dist/composables/useMountComponent.js +1 -16
- package/dist/composables/useMutationObserver.js +1 -37
- package/dist/composables/useReadingTime.js +1 -33
- package/dist/composables/useStringMatching.js +1 -42
- package/dist/composables/useSwipe.js +1 -26
- package/dist/composables/useTimer.js +1 -36
- package/dist/composables/useToast.js +1 -14
- package/dist/composables/useUserVisibility.js +1 -10
- package/dist/composables/useWait.js +1 -7
- package/dist/composables/useWindowSize.js +1 -21
- package/dist/directives/index.js +1 -19
- package/dist/directives/vClickOutside.js +1 -104
- package/dist/directives/vFullscreenImg.js +1 -10
- package/dist/directives/vLazyImg.js +1 -23
- package/dist/directives/vTooltip.js +1 -161
- package/dist/directives/vZoomImg.js +1 -286
- package/dist/index.js +1 -1
- package/dist/plugins/aos.js +1 -89
- package/dist/plugins/dialog.js +1 -61
- package/dist/plugins/index.js +1 -17
- package/dist/plugins/maz-ui.js +1 -11
- package/dist/plugins/toast.js +1 -261
- package/dist/plugins/wait.js +1 -43
- package/dist/resolvers/MazComponentsResolver.js +1 -18
- package/dist/resolvers/MazDirectivesResolver.js +1 -14
- package/dist/resolvers/MazModulesResolver.js +1 -76
- package/dist/resolvers/index.js +1 -8
- package/dist/tailwindcss/index.js +1 -20
- package/dist/tailwindcss/tailwind.config.js +1 -35
- package/dist/tailwindcss/utils/colors.js +1 -25
- package/dist/tailwindcss/variables/breakpoints.js +1 -29
- package/dist/tailwindcss/variables/colors.js +1 -33
- package/dist/tailwindcss/variables/design-tokens.js +1 -42
- package/dist/tailwindcss/variables/utilities.js +1 -20
- package/dist/tailwindcss/variables/z-indexes.js +1 -17
- package/package.json +12 -13
- package/dist/chunks/MazChart.vue_vue_type_script_setup_true_lang.DpG9UYdm.js +0 -50
- package/dist/chunks/MazDialogConfirm.vue_vue_type_script_setup_true_lang.BB2rYkwY.js +0 -215
- package/dist/chunks/MazInputPrice.vue_vue_type_script_setup_true_lang.DcNkyw1C.js +0 -77
- package/dist/chunks/MazSwitch.vue_vue_type_style_index_0_lang.lYfYsI0R.js +0 -84
- package/dist/chunks/MazTable.vue_vue_type_script_setup_true_lang.ycpSYFvJ.js +0 -517
- package/dist/chunks/MazTabs.vue_vue_type_script_setup_true_lang.CiIFxs7J.js +0 -28
- package/dist/chunks/MazTabsContent.vue_vue_type_script_setup_true_lang.MO7zA8LZ.js +0 -26
- package/dist/chunks/MazUiProvider.vue_vue_type_script_setup_true_lang.DtnM1DOn.js +0 -34
- package/dist/chunks/_plugin-vue_export-helper.B--vMWp3.js +0 -9
- package/dist/chunks/dom-events.DTx6Kblx.js +0 -368
- package/dist/chunks/fullscreen-img.directive.BJieSSIt.js +0 -321
- package/dist/chunks/lazy-img.directive.GRfYbidn.js +0 -174
- package/dist/chunks/resolveLinkComponent.CKR2McYy.js +0 -8
- package/dist/chunks/types.D0Bp_UhS.js +0 -6
- package/dist/chunks/useMazInputPhoneNumber.Os-2y9bz.js +0 -157
- package/dist/chunks/utils.D89Q5cCP.js +0 -207
- /package/dist/assets/{fullscreen-img.DFp1SMPU.css → vFullscreenImg.DFp1SMPU.css} +0 -0
|
@@ -1,413 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { MazMagnifyingGlass, MazNoSymbol } from "@maz-ui/icons/lazy";
|
|
3
|
-
import { MazChevronDown } from "@maz-ui/icons/static";
|
|
4
|
-
import { useTranslations } from "@maz-ui/translations/composables/useTranslations";
|
|
5
|
-
import { debounceCallback } from "@maz-ui/utils/helpers/debounceCallback";
|
|
6
|
-
import { isClient } from "@maz-ui/utils/helpers/isClient";
|
|
7
|
-
import { normalizeString } from "@maz-ui/utils/helpers/normalizeString";
|
|
8
|
-
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
9
|
-
import { useStringMatching } from "../composables/useStringMatching.js";
|
|
10
|
-
import MazInput from "./MazInput.js";
|
|
11
|
-
import MazPopover from "./MazPopover.js";
|
|
12
|
-
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
13
|
-
import '../assets/MazSelect.B7S5Yf0F.css';const _hoisted_1 = ["disabled", "aria-label"], _hoisted_2 = ["id"], _hoisted_3 = {
|
|
14
|
-
key: 0,
|
|
15
|
-
class: "m-select-list__search-wrapper"
|
|
16
|
-
}, _hoisted_4 = { class: "m-select-list__no-results" }, _hoisted_5 = {
|
|
17
|
-
key: 2,
|
|
18
|
-
ref: "optionListWrapper",
|
|
19
|
-
class: "m-select-list__scroll-wrapper",
|
|
20
|
-
tabindex: "-1"
|
|
21
|
-
}, _hoisted_6 = { class: "m-select-list-optgroup" }, _hoisted_7 = ["tabindex", "onClick"], _sfc_main = /* @__PURE__ */ defineComponent({
|
|
22
|
-
inheritAttrs: !1,
|
|
23
|
-
__name: "MazSelect",
|
|
24
|
-
props: /* @__PURE__ */ mergeModels({
|
|
25
|
-
style: { type: [Boolean, null, String, Object, Array], default: () => {
|
|
26
|
-
} },
|
|
27
|
-
class: { type: [Boolean, null, String, Object, Array], default: () => {
|
|
28
|
-
} },
|
|
29
|
-
id: { default: () => {
|
|
30
|
-
} },
|
|
31
|
-
label: {},
|
|
32
|
-
placeholder: {},
|
|
33
|
-
modelValue: { default: () => {
|
|
34
|
-
} },
|
|
35
|
-
options: {},
|
|
36
|
-
optionValueKey: { default: "value" },
|
|
37
|
-
optionLabelKey: { default: "label" },
|
|
38
|
-
optionInputValueKey: { default: "label" },
|
|
39
|
-
listPosition: { default: "auto" },
|
|
40
|
-
preferPosition: { default: "bottom-start" },
|
|
41
|
-
fallbackPosition: { default: "top-start" },
|
|
42
|
-
itemHeight: { default: () => {
|
|
43
|
-
} },
|
|
44
|
-
maxListHeight: { default: 240 },
|
|
45
|
-
maxListWidth: { default: () => {
|
|
46
|
-
} },
|
|
47
|
-
minListHeight: { default: () => {
|
|
48
|
-
} },
|
|
49
|
-
minListWidth: { default: () => {
|
|
50
|
-
} },
|
|
51
|
-
size: { default: "md" },
|
|
52
|
-
color: { default: "primary" },
|
|
53
|
-
search: { type: Boolean },
|
|
54
|
-
searchFunction: { type: Function },
|
|
55
|
-
searchThreshold: { default: 0.75 },
|
|
56
|
-
multiple: { type: Boolean, default: !1 },
|
|
57
|
-
required: { type: Boolean },
|
|
58
|
-
disabled: { type: Boolean },
|
|
59
|
-
block: { type: Boolean },
|
|
60
|
-
autocomplete: { default: "off" },
|
|
61
|
-
translations: {},
|
|
62
|
-
formatInputValue: { type: Function },
|
|
63
|
-
transition: { default: "scale-fade" }
|
|
64
|
-
}, {
|
|
65
|
-
open: { default: !1 },
|
|
66
|
-
openModifiers: {}
|
|
67
|
-
}),
|
|
68
|
-
emits: /* @__PURE__ */ mergeModels(["close", "open", "blur", "focus", "change", "input", "update:model-value", "selected-option"], ["update:open"]),
|
|
69
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
70
|
-
const emits = __emit, MazCheckbox = defineAsyncComponent(() => import("./MazCheckbox.js")), popoverComponent = useTemplateRef("popover"), inputRef = useTemplateRef("input"), searchInputRef = useTemplateRef("searchInput"), optionListElement = useTemplateRef("optionListRef"), optionListWrapperRef = useTemplateRef("optionListWrapper"), selectedTextColor = computed(() => `hsl(var(--maz-${__props.color}))`), selectedBgColor = computed(() => `hsl(var(--maz-${__props.color}-500) / 0.1)`), { t } = useTranslations(), messages = computed(() => ({
|
|
71
|
-
searchPlaceholder: __props.translations?.searchPlaceholder || t("select.searchPlaceholder")
|
|
72
|
-
})), isOpen = useModel(__props, "open"), instanceId = useInstanceUniqId({
|
|
73
|
-
componentName: "MazSelect",
|
|
74
|
-
providedId: __props.id
|
|
75
|
-
});
|
|
76
|
-
function getOptionPayload(option) {
|
|
77
|
-
return {
|
|
78
|
-
[__props.optionValueKey]: option,
|
|
79
|
-
[__props.optionLabelKey]: option,
|
|
80
|
-
[__props.optionInputValueKey]: option
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function getNormalizedOptionPayload(option) {
|
|
84
|
-
return {
|
|
85
|
-
...option,
|
|
86
|
-
[__props.optionValueKey]: option[__props.optionValueKey],
|
|
87
|
-
[__props.optionLabelKey]: option[__props.optionLabelKey],
|
|
88
|
-
[__props.optionInputValueKey]: option[__props.optionInputValueKey]
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function getNormalizedOptions(options) {
|
|
92
|
-
const normalizedOptions = [];
|
|
93
|
-
if (!options?.length)
|
|
94
|
-
return [];
|
|
95
|
-
for (const option of options)
|
|
96
|
-
typeof option == "string" || typeof option == "number" || typeof option == "boolean" ? normalizedOptions.push(getOptionPayload(option)) : typeof option == "object" && "options" in option && Array.isArray(option.options) ? normalizedOptions.push(
|
|
97
|
-
{ label: option.label, isOptGroup: !0 },
|
|
98
|
-
...option.options.map(
|
|
99
|
-
(opt) => typeof opt == "string" || typeof opt == "number" || typeof opt == "boolean" ? getOptionPayload(opt) : getNormalizedOptionPayload(opt)
|
|
100
|
-
)
|
|
101
|
-
) : normalizedOptions.push(getNormalizedOptionPayload(option));
|
|
102
|
-
return normalizedOptions;
|
|
103
|
-
}
|
|
104
|
-
const optionsNormalized = computed(() => getNormalizedOptions(__props.options ?? []));
|
|
105
|
-
function isOptionInSelection(option) {
|
|
106
|
-
return isNullOrUndefined(option[__props.optionValueKey]) ? !1 : __props.multiple ? Array.isArray(__props.modelValue) && __props.modelValue.includes(option[__props.optionValueKey]) : __props.modelValue === option[__props.optionValueKey];
|
|
107
|
-
}
|
|
108
|
-
const selectedOptions = computed(
|
|
109
|
-
() => optionsNormalized.value?.filter(isOptionInSelection) ?? []
|
|
110
|
-
);
|
|
111
|
-
function isNullOrUndefined(value) {
|
|
112
|
-
return value == null;
|
|
113
|
-
}
|
|
114
|
-
function isSelectedOption(option) {
|
|
115
|
-
return (selectedOptions.value?.some(
|
|
116
|
-
(selectedOption) => selectedOption[__props.optionValueKey] === option[__props.optionValueKey]
|
|
117
|
-
) ?? !1) && !isNullOrUndefined(option[__props.optionValueKey]);
|
|
118
|
-
}
|
|
119
|
-
const inputValue = computed(() => {
|
|
120
|
-
if (__props.multiple && __props.modelValue && Array.isArray(__props.modelValue)) {
|
|
121
|
-
const values = __props.modelValue.map(
|
|
122
|
-
(value2) => optionsNormalized.value?.find((option) => option[__props.optionValueKey] === value2)?.[__props.optionInputValueKey]
|
|
123
|
-
);
|
|
124
|
-
return __props.formatInputValue ? __props.formatInputValue(values) : values.join(", ");
|
|
125
|
-
}
|
|
126
|
-
const selectedOption = optionsNormalized.value?.find(
|
|
127
|
-
(option) => option[__props.optionValueKey] === __props.modelValue
|
|
128
|
-
), value = isNullOrUndefined(__props.modelValue) ? void 0 : selectedOption?.[__props.optionInputValueKey];
|
|
129
|
-
return __props.formatInputValue ? __props.formatInputValue(value) : value;
|
|
130
|
-
}), searchQuery = ref(), query = ref("");
|
|
131
|
-
function searchInValue(value, query2) {
|
|
132
|
-
return query2 && value && normalizeString(value).includes(normalizeString(query2));
|
|
133
|
-
}
|
|
134
|
-
function getFilteredOptionWithQuery(query2) {
|
|
135
|
-
return query2 ? optionsNormalized.value?.filter((option) => {
|
|
136
|
-
const searchValue = option[__props.optionLabelKey], searchValue3 = option[__props.optionValueKey], searchValue2 = option[__props.optionInputValueKey], threshold = __props.searchThreshold;
|
|
137
|
-
return searchInValue(searchValue, query2) || searchInValue(searchValue2, query2) || searchInValue(searchValue3, query2) || typeof searchValue == "string" && useStringMatching(searchValue, query2, threshold).isMatching.value || typeof searchValue2 == "string" && useStringMatching(searchValue2, query2, threshold).isMatching.value || typeof searchValue3 == "string" && useStringMatching(searchValue3, query2, threshold).isMatching.value;
|
|
138
|
-
}) : optionsNormalized.value;
|
|
139
|
-
}
|
|
140
|
-
const optionList = computed(() => __props.searchFunction && __props.search && searchQuery.value ? getNormalizedOptions(__props.searchFunction(searchQuery.value, __props.options ?? []) ?? []) : getFilteredOptionWithQuery(searchQuery.value));
|
|
141
|
-
async function onOpenList() {
|
|
142
|
-
const selectedIndex = optionList.value?.findIndex(
|
|
143
|
-
(option) => isSelectedOption(option)
|
|
144
|
-
);
|
|
145
|
-
await scrollToOptionIndex(selectedIndex), emits("open");
|
|
146
|
-
}
|
|
147
|
-
function focusMainInput() {
|
|
148
|
-
inputRef.value?.$el?.querySelector("input")?.focus();
|
|
149
|
-
}
|
|
150
|
-
function emitInputMainInput() {
|
|
151
|
-
inputRef.value?.$el?.querySelector("input")?.dispatchEvent(new Event("input"));
|
|
152
|
-
}
|
|
153
|
-
function focusSearchInputAndSetQuery(q) {
|
|
154
|
-
searchQuery.value = q, searchInputRef.value?.$el?.querySelector("input")?.focus();
|
|
155
|
-
}
|
|
156
|
-
function searchOptionWithQuery(keyPressed) {
|
|
157
|
-
keyPressed === "Backspace" && query.value && query.value.length > 0 ? query.value = query.value.slice(0, -1) : query.value += keyPressed;
|
|
158
|
-
const filteredOptions = getFilteredOptionWithQuery(query.value);
|
|
159
|
-
if (!filteredOptions?.length)
|
|
160
|
-
return;
|
|
161
|
-
const optionIndex = optionList.value?.findIndex(
|
|
162
|
-
(option) => option[__props.optionValueKey] === filteredOptions[0][__props.optionValueKey]
|
|
163
|
-
);
|
|
164
|
-
typeof optionIndex != "number" || optionIndex === -1 || (scrollToOptionIndex(optionIndex), debounceCallback(() => {
|
|
165
|
-
query.value = "";
|
|
166
|
-
}, 1e3));
|
|
167
|
-
}
|
|
168
|
-
const isLetterOrNumberRegex = /^([\dA-Za-z\u0400-\u04FF])$/;
|
|
169
|
-
function mainInputKeyboardHandler(event) {
|
|
170
|
-
if (event.ctrlKey || event.metaKey || event.altKey)
|
|
171
|
-
return;
|
|
172
|
-
const keyPressed = event.key;
|
|
173
|
-
(keyPressed === "ArrowDown" || keyPressed === "ArrowUp" || isLetterOrNumberRegex.test(keyPressed)) && !isOpen.value && (event.preventDefault(), popoverComponent.value?.open()), isLetterOrNumberRegex.test(keyPressed) && __props.search && (event.preventDefault(), event.stopPropagation(), focusSearchInputAndSetQuery(keyPressed));
|
|
174
|
-
}
|
|
175
|
-
async function scrollToOptionIndex(index) {
|
|
176
|
-
if (await nextTick(), typeof index != "number" || index < 0)
|
|
177
|
-
return;
|
|
178
|
-
const item = optionListElement.value?.querySelector(`.m-select-list-item:nth-child(${index + 1})`);
|
|
179
|
-
if (item && optionListWrapperRef.value) {
|
|
180
|
-
const wrapperRect = optionListWrapperRef.value.getBoundingClientRect(), itemRect = item.getBoundingClientRect(), scrollTop = item.offsetTop - wrapperRect.height / 2 - itemRect.height;
|
|
181
|
-
optionListWrapperRef.value.scrollTo?.({
|
|
182
|
-
top: scrollTop,
|
|
183
|
-
behavior: "auto"
|
|
184
|
-
}), setTimeout(() => {
|
|
185
|
-
item.focus({ preventScroll: !0 });
|
|
186
|
-
}, 100);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
function updateValue(inputOption, mustCloseList = !0) {
|
|
190
|
-
mustCloseList && !__props.multiple && nextTick(() => {
|
|
191
|
-
popoverComponent.value?.close();
|
|
192
|
-
}), searchQuery.value = "";
|
|
193
|
-
const isAlreadySelected = selectedOptions.value?.some(
|
|
194
|
-
(option) => option[__props.optionValueKey] === inputOption[__props.optionValueKey]
|
|
195
|
-
);
|
|
196
|
-
let newValue = selectedOptions.value;
|
|
197
|
-
isAlreadySelected && __props.multiple ? newValue = newValue?.filter(
|
|
198
|
-
(option) => option[__props.optionValueKey] !== inputOption[__props.optionValueKey]
|
|
199
|
-
) : __props.multiple ? newValue.push(inputOption) : newValue = [inputOption];
|
|
200
|
-
const selectedValues = newValue.map((option) => option[__props.optionValueKey]);
|
|
201
|
-
emits("update:model-value", __props.multiple ? selectedValues : selectedValues[0]), emits("selected-option", inputOption), emitInputMainInput(), focusMainInput();
|
|
202
|
-
}
|
|
203
|
-
function keydownHandler(event) {
|
|
204
|
-
const keyPressed = event.key;
|
|
205
|
-
if (keyPressed === "ArrowDown" || keyPressed === "ArrowUp") {
|
|
206
|
-
event.preventDefault();
|
|
207
|
-
const itemLength = optionList.value?.length;
|
|
208
|
-
if (!itemLength)
|
|
209
|
-
return;
|
|
210
|
-
const currentElement = document.activeElement, itemsElements = document.querySelectorAll(`#${instanceId.value}-option-list .m-select-list-item`), currentIndex = [...itemsElements].indexOf(currentElement);
|
|
211
|
-
if (currentIndex === -1) {
|
|
212
|
-
itemsElements[0]?.focus({ preventScroll: !0 });
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
const nextIndex = keyPressed === "ArrowDown" ? (currentIndex + 1) % itemLength : (currentIndex - 1 + itemLength) % itemLength;
|
|
216
|
-
itemsElements[nextIndex]?.focus();
|
|
217
|
-
} else !__props.search && isLetterOrNumberRegex.test(keyPressed) && searchOptionWithQuery(keyPressed);
|
|
218
|
-
}
|
|
219
|
-
function updateListPosition() {
|
|
220
|
-
nextTick(() => {
|
|
221
|
-
popoverComponent.value?.updatePosition();
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
return watch(
|
|
225
|
-
isOpen,
|
|
226
|
-
(value) => {
|
|
227
|
-
isClient() && (value ? document.addEventListener("keydown", keydownHandler) : document.removeEventListener("keydown", keydownHandler));
|
|
228
|
-
},
|
|
229
|
-
{ immediate: !0 }
|
|
230
|
-
), __expose({
|
|
231
|
-
/**
|
|
232
|
-
* Open the select
|
|
233
|
-
* @description This is used to open the list options
|
|
234
|
-
*/
|
|
235
|
-
open: () => {
|
|
236
|
-
popoverComponent.value?.open();
|
|
237
|
-
},
|
|
238
|
-
/**
|
|
239
|
-
* Close the select
|
|
240
|
-
* @description This is used to close the list options
|
|
241
|
-
*/
|
|
242
|
-
close: () => {
|
|
243
|
-
popoverComponent.value?.close();
|
|
244
|
-
}
|
|
245
|
-
}), (_ctx, _cache) => (openBlock(), createBlock(MazPopover, {
|
|
246
|
-
id: `${unref(instanceId)}-popover`,
|
|
247
|
-
ref: "popover",
|
|
248
|
-
modelValue: isOpen.value,
|
|
249
|
-
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isOpen.value = $event),
|
|
250
|
-
class: normalizeClass(["m-select m-reset-css", [
|
|
251
|
-
{
|
|
252
|
-
"--is-open": isOpen.value,
|
|
253
|
-
"--disabled": __props.disabled
|
|
254
|
-
},
|
|
255
|
-
__props.class,
|
|
256
|
-
`--${__props.size}`
|
|
257
|
-
]]),
|
|
258
|
-
style: normalizeStyle(__props.style),
|
|
259
|
-
trigger: "click",
|
|
260
|
-
block: __props.block,
|
|
261
|
-
transition: __props.transition,
|
|
262
|
-
offset: 0,
|
|
263
|
-
position: __props.listPosition,
|
|
264
|
-
disabled: __props.disabled,
|
|
265
|
-
"prefer-position": __props.preferPosition,
|
|
266
|
-
"fallback-position": __props.fallbackPosition,
|
|
267
|
-
"position-reference": `#${unref(instanceId)}-popover .m-input-wrapper`,
|
|
268
|
-
onClose: _cache[6] || (_cache[6] = ($event) => emits("close")),
|
|
269
|
-
onOpen: onOpenList
|
|
270
|
-
}, {
|
|
271
|
-
trigger: withCtx(({ close, open: openPicker, toggle: togglePopover }) => [
|
|
272
|
-
createVNode(MazInput, mergeProps({
|
|
273
|
-
id: unref(instanceId),
|
|
274
|
-
ref: "input",
|
|
275
|
-
class: "m-select-input"
|
|
276
|
-
}, _ctx.$attrs, {
|
|
277
|
-
required: __props.required,
|
|
278
|
-
"border-active": isOpen.value,
|
|
279
|
-
color: __props.color,
|
|
280
|
-
"model-value": inputValue.value,
|
|
281
|
-
size: __props.size,
|
|
282
|
-
block: __props.block,
|
|
283
|
-
placeholder: __props.placeholder,
|
|
284
|
-
label: __props.label,
|
|
285
|
-
autocomplete: __props.autocomplete,
|
|
286
|
-
disabled: __props.disabled,
|
|
287
|
-
readonly: "",
|
|
288
|
-
onChange: _cache[0] || (_cache[0] = ($event) => emits("change", $event)),
|
|
289
|
-
onInput: _cache[1] || (_cache[1] = ($event) => emits("input", $event)),
|
|
290
|
-
onFocus: _cache[2] || (_cache[2] = ($event) => emits("focus", $event)),
|
|
291
|
-
onBlur: _cache[3] || (_cache[3] = ($event) => emits("blur", $event)),
|
|
292
|
-
onKeydown: mainInputKeyboardHandler
|
|
293
|
-
}), createSlots({
|
|
294
|
-
"right-icon": withCtx(() => [
|
|
295
|
-
renderSlot(_ctx.$slots, "right-icon", {
|
|
296
|
-
isOpen: isOpen.value,
|
|
297
|
-
close,
|
|
298
|
-
open: openPicker,
|
|
299
|
-
toggle: togglePopover
|
|
300
|
-
}, () => [
|
|
301
|
-
createElementVNode("button", {
|
|
302
|
-
tabindex: "-1",
|
|
303
|
-
disabled: __props.disabled,
|
|
304
|
-
type: "button",
|
|
305
|
-
class: "m-select-input__toggle-button maz-custom",
|
|
306
|
-
"aria-label": `${isOpen.value ? "collapse" : "expand"} list of options`
|
|
307
|
-
}, [
|
|
308
|
-
createVNode(unref(MazChevronDown), { class: "m-select-chevron" })
|
|
309
|
-
], 8, _hoisted_1)
|
|
310
|
-
], !0)
|
|
311
|
-
]),
|
|
312
|
-
_: 2
|
|
313
|
-
}, [
|
|
314
|
-
_ctx.$slots["left-icon"] ? {
|
|
315
|
-
name: "left-icon",
|
|
316
|
-
fn: withCtx(() => [
|
|
317
|
-
renderSlot(_ctx.$slots, "left-icon", {
|
|
318
|
-
isOpen: isOpen.value,
|
|
319
|
-
close,
|
|
320
|
-
open: openPicker,
|
|
321
|
-
toggle: togglePopover
|
|
322
|
-
}, void 0, !0)
|
|
323
|
-
]),
|
|
324
|
-
key: "0"
|
|
325
|
-
} : void 0
|
|
326
|
-
]), 1040, ["id", "required", "border-active", "color", "model-value", "size", "block", "placeholder", "label", "autocomplete", "disabled"])
|
|
327
|
-
]),
|
|
328
|
-
default: withCtx(({ close, open: openPicker, toggle: togglePopover }) => [
|
|
329
|
-
createElementVNode("div", {
|
|
330
|
-
id: `${unref(instanceId)}-option-list`,
|
|
331
|
-
ref: "optionListRef",
|
|
332
|
-
class: normalizeClass(["m-select-list", `--${__props.size}`]),
|
|
333
|
-
style: normalizeStyle([{
|
|
334
|
-
maxHeight: `${__props.maxListHeight}px`,
|
|
335
|
-
maxWidth: `${__props.maxListWidth}px`,
|
|
336
|
-
minHeight: `${__props.minListHeight}px`,
|
|
337
|
-
minWidth: `${__props.minListWidth}px`,
|
|
338
|
-
"--selected-bg-color": selectedBgColor.value,
|
|
339
|
-
"--selected-text-color": selectedTextColor.value
|
|
340
|
-
}])
|
|
341
|
-
}, [
|
|
342
|
-
__props.search ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
343
|
-
createVNode(MazInput, {
|
|
344
|
-
ref: "searchInput",
|
|
345
|
-
modelValue: searchQuery.value,
|
|
346
|
-
"onUpdate:modelValue": [
|
|
347
|
-
_cache[4] || (_cache[4] = ($event) => searchQuery.value = $event),
|
|
348
|
-
updateListPosition
|
|
349
|
-
],
|
|
350
|
-
size: "sm",
|
|
351
|
-
disabled: __props.disabled,
|
|
352
|
-
color: __props.color,
|
|
353
|
-
placeholder: messages.value.searchPlaceholder,
|
|
354
|
-
name: "search",
|
|
355
|
-
inputmode: "search",
|
|
356
|
-
autocomplete: "off",
|
|
357
|
-
block: "",
|
|
358
|
-
class: "m-select-list__search-input maz-flex-none",
|
|
359
|
-
"left-icon": unref(MazMagnifyingGlass)
|
|
360
|
-
}, null, 8, ["modelValue", "disabled", "color", "placeholder", "left-icon"])
|
|
361
|
-
])) : createCommentVNode("", !0),
|
|
362
|
-
!optionList.value || optionList.value.length <= 0 ? renderSlot(_ctx.$slots, "no-results", { key: 1 }, () => [
|
|
363
|
-
createElementVNode("span", _hoisted_4, [
|
|
364
|
-
createVNode(unref(MazNoSymbol), { class: "maz-size-6 maz-text-foreground" })
|
|
365
|
-
])
|
|
366
|
-
], !0) : (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
367
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(optionList.value, (option, i) => (openBlock(), createElementBlock(Fragment, { key: i }, [
|
|
368
|
-
option.label && option.isOptGroup ? renderSlot(_ctx.$slots, "optgroup", {
|
|
369
|
-
key: 0,
|
|
370
|
-
label: option.label
|
|
371
|
-
}, () => [
|
|
372
|
-
createElementVNode("span", _hoisted_6, toDisplayString(option.label), 1)
|
|
373
|
-
], !0) : (openBlock(), createElementBlock("button", {
|
|
374
|
-
key: 1,
|
|
375
|
-
type: "button",
|
|
376
|
-
tabindex: __props.multiple ? -1 : 0,
|
|
377
|
-
class: normalizeClass(["m-select-list-item maz-custom maz-flex-none", [
|
|
378
|
-
{
|
|
379
|
-
"--is-selected": isSelectedOption(option),
|
|
380
|
-
"--is-none-value": isNullOrUndefined(option[__props.optionValueKey])
|
|
381
|
-
}
|
|
382
|
-
]]),
|
|
383
|
-
style: normalizeStyle(__props.itemHeight ? { height: `${__props.itemHeight}px` } : void 0),
|
|
384
|
-
onClick: withModifiers(($event) => updateValue(option, !0), ["prevent", "stop"])
|
|
385
|
-
}, [
|
|
386
|
-
__props.multiple ? (openBlock(), createBlock(unref(MazCheckbox), {
|
|
387
|
-
key: 0,
|
|
388
|
-
"model-value": isSelectedOption(option),
|
|
389
|
-
size: "sm",
|
|
390
|
-
color: __props.color
|
|
391
|
-
}, null, 8, ["model-value", "color"])) : createCommentVNode("", !0),
|
|
392
|
-
renderSlot(_ctx.$slots, "default", {
|
|
393
|
-
option,
|
|
394
|
-
isSelected: isSelectedOption(option),
|
|
395
|
-
isOpen: isOpen.value,
|
|
396
|
-
close,
|
|
397
|
-
open: openPicker,
|
|
398
|
-
toggle: togglePopover
|
|
399
|
-
}, () => [
|
|
400
|
-
createElementVNode("span", null, toDisplayString(option[__props.optionLabelKey]), 1)
|
|
401
|
-
], !0)
|
|
402
|
-
], 14, _hoisted_7))
|
|
403
|
-
], 64))), 128))
|
|
404
|
-
], 512))
|
|
405
|
-
], 14, _hoisted_2)
|
|
406
|
-
]),
|
|
407
|
-
_: 3
|
|
408
|
-
}, 8, ["id", "modelValue", "class", "style", "block", "transition", "position", "disabled", "prefer-position", "fallback-position", "position-reference"]));
|
|
409
|
-
}
|
|
410
|
-
}), MazSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-badad462"]]);
|
|
411
|
-
export {
|
|
412
|
-
MazSelect as default
|
|
413
|
-
};
|
|
1
|
+
import"../chunks/MazInput.DJjWLaKg.js";import"../chunks/MazPopover.Co8BEopX.js";import{t as MazSelect_default}from"../chunks/MazSelect.yYFAbBb5.js";export{MazSelect_default as default};
|
|
@@ -1,192 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useTranslations } from "@maz-ui/translations/composables/useTranslations";
|
|
3
|
-
import { getBrowserLocale } from "@maz-ui/utils/helpers/getBrowserLocale";
|
|
4
|
-
import { getCountryFlagUrl } from "@maz-ui/utils/helpers/getCountryFlagUrl";
|
|
5
|
-
import { useDisplayNames } from "../composables/useDisplayNames.js";
|
|
6
|
-
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
7
|
-
import MazSelect from "./MazSelect.js";
|
|
8
|
-
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
9
|
-
import '../assets/MazSelectCountry.kRB-iu5_.css';const _hoisted_1 = {
|
|
10
|
-
key: 0,
|
|
11
|
-
class: "m-select-country__select__item__flag-container"
|
|
12
|
-
}, _hoisted_2 = {
|
|
13
|
-
key: 1,
|
|
14
|
-
class: "m-select-country__select__item__list-flag"
|
|
15
|
-
}, _hoisted_3 = { class: "maz-text-muted" }, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
|
-
inheritAttrs: !1,
|
|
17
|
-
__name: "MazSelectCountry",
|
|
18
|
-
props: {
|
|
19
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
20
|
-
class: { type: [Boolean, null, String, Object, Array] },
|
|
21
|
-
id: {},
|
|
22
|
-
color: { default: "primary" },
|
|
23
|
-
size: { default: "md" },
|
|
24
|
-
preferredCodes: {},
|
|
25
|
-
ignoredCodes: {},
|
|
26
|
-
onlyCodes: {},
|
|
27
|
-
listPosition: {},
|
|
28
|
-
hideFlags: { type: Boolean },
|
|
29
|
-
search: { type: Boolean, default: !0 },
|
|
30
|
-
showCodeInList: { type: Boolean, default: !1 },
|
|
31
|
-
locale: {},
|
|
32
|
-
success: { type: Boolean },
|
|
33
|
-
error: { type: Boolean },
|
|
34
|
-
warning: { type: Boolean },
|
|
35
|
-
displayCode: { type: Boolean },
|
|
36
|
-
searchThreshold: {},
|
|
37
|
-
translations: {},
|
|
38
|
-
hint: {},
|
|
39
|
-
options: {},
|
|
40
|
-
displayNamesOptions: { default: () => ({ type: "region", languageDisplay: "standard", fallback: "code", style: "long" }) },
|
|
41
|
-
codesType: {},
|
|
42
|
-
open: { type: Boolean },
|
|
43
|
-
label: {},
|
|
44
|
-
placeholder: {},
|
|
45
|
-
modelValue: {},
|
|
46
|
-
optionValueKey: { default: "code" },
|
|
47
|
-
optionLabelKey: { default: "name" },
|
|
48
|
-
optionInputValueKey: { default: "name" },
|
|
49
|
-
preferPosition: {},
|
|
50
|
-
fallbackPosition: {},
|
|
51
|
-
itemHeight: {},
|
|
52
|
-
maxListHeight: {},
|
|
53
|
-
maxListWidth: { default: 250 },
|
|
54
|
-
minListHeight: {},
|
|
55
|
-
minListWidth: { default: 200 },
|
|
56
|
-
searchFunction: { type: Function },
|
|
57
|
-
required: { type: Boolean },
|
|
58
|
-
disabled: { type: Boolean },
|
|
59
|
-
block: { type: Boolean },
|
|
60
|
-
autocomplete: {},
|
|
61
|
-
formatInputValue: { type: Function },
|
|
62
|
-
transition: {}
|
|
63
|
-
},
|
|
64
|
-
emits: ["update:model-value"],
|
|
65
|
-
setup(__props) {
|
|
66
|
-
const instanceId = useInstanceUniqId({
|
|
67
|
-
componentName: "MazSelectCountry",
|
|
68
|
-
providedId: __props.id
|
|
69
|
-
}), { t, locale: mazLocale } = useTranslations(), locale = computed(() => __props.locale ?? mazLocale.value ?? getBrowserLocale()), MazLazyImg = defineAsyncComponent(() => import("./MazLazyImg.js")), { getAllDisplayNames } = useDisplayNames(locale), _codesType = computed(() => __props.codesType ? __props.codesType : __props.displayNamesOptions.type === "region" ? "country" : "iso"), displayNames = getAllDisplayNames({
|
|
70
|
-
type: () => __props.displayNamesOptions.type,
|
|
71
|
-
languageDisplay: () => __props.displayNamesOptions.languageDisplay,
|
|
72
|
-
fallback: () => __props.displayNamesOptions.fallback,
|
|
73
|
-
style: () => __props.displayNamesOptions.style,
|
|
74
|
-
onlyCodes: () => __props.onlyCodes,
|
|
75
|
-
excludedCodes: () => __props.ignoredCodes,
|
|
76
|
-
preferredCodes: () => __props.preferredCodes,
|
|
77
|
-
codesType: _codesType
|
|
78
|
-
}), countriesOptions = computed(() => __props.options ? __props.options : displayNames?.value ?? []), messages = computed(() => ({
|
|
79
|
-
searchPlaceholder: __props.translations?.searchPlaceholder ?? t("selectCountry.searchPlaceholder")
|
|
80
|
-
}));
|
|
81
|
-
function getFlagUrl(code, size = "h20") {
|
|
82
|
-
return getCountryFlagUrl(code.slice(0, 2), size) || getCountryFlagUrl(code.slice(3, 5), size) || getCountryFlagUrl(code, size);
|
|
83
|
-
}
|
|
84
|
-
const flagUrl = computed(() => {
|
|
85
|
-
if (__props.modelValue)
|
|
86
|
-
return getFlagUrl(__props.modelValue);
|
|
87
|
-
});
|
|
88
|
-
return (_ctx, _cache) => (openBlock(), createElementBlock("div", {
|
|
89
|
-
class: normalizeClass(["m-select-country m-reset-css", [__props.class, { "--no-flags": __props.hideFlags }]]),
|
|
90
|
-
style: normalizeStyle(__props.style)
|
|
91
|
-
}, [
|
|
92
|
-
createVNode(MazSelect, mergeProps({
|
|
93
|
-
id: unref(instanceId),
|
|
94
|
-
"model-value": __props.modelValue
|
|
95
|
-
}, _ctx.$attrs, {
|
|
96
|
-
class: "m-select-country__select",
|
|
97
|
-
"option-value-key": __props.optionValueKey,
|
|
98
|
-
"option-label-key": __props.optionLabelKey,
|
|
99
|
-
"option-input-value-key": __props.displayCode ? "code" : __props.optionInputValueKey,
|
|
100
|
-
"max-list-width": __props.maxListWidth,
|
|
101
|
-
"min-list-width": __props.minListWidth,
|
|
102
|
-
disabled: __props.disabled,
|
|
103
|
-
color: __props.color,
|
|
104
|
-
placeholder: __props.placeholder,
|
|
105
|
-
label: __props.label,
|
|
106
|
-
size: __props.size,
|
|
107
|
-
multiple: !1,
|
|
108
|
-
"list-position": __props.listPosition,
|
|
109
|
-
error: __props.error,
|
|
110
|
-
warning: __props.warning,
|
|
111
|
-
success: __props.success,
|
|
112
|
-
search: __props.search,
|
|
113
|
-
block: __props.block,
|
|
114
|
-
autocomplete: __props.autocomplete,
|
|
115
|
-
"item-height": __props.itemHeight,
|
|
116
|
-
"max-list-height": __props.maxListHeight,
|
|
117
|
-
"min-list-height": __props.minListHeight,
|
|
118
|
-
required: __props.required,
|
|
119
|
-
"search-function": __props.searchFunction,
|
|
120
|
-
"format-input-value": __props.formatInputValue,
|
|
121
|
-
translations: messages.value,
|
|
122
|
-
"search-threshold": __props.searchThreshold,
|
|
123
|
-
options: countriesOptions.value,
|
|
124
|
-
hint: __props.hint,
|
|
125
|
-
open: __props.open,
|
|
126
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:model-value", $event))
|
|
127
|
-
}), {
|
|
128
|
-
"left-icon": withCtx(() => [
|
|
129
|
-
renderSlot(_ctx.$slots, "selector-flag", { countryCode: __props.modelValue }, () => [
|
|
130
|
-
flagUrl.value && !__props.hideFlags ? (openBlock(), createBlock(unref(MazLazyImg), {
|
|
131
|
-
key: 0,
|
|
132
|
-
src: flagUrl.value,
|
|
133
|
-
alt: __props.modelValue,
|
|
134
|
-
width: "20",
|
|
135
|
-
height: "20",
|
|
136
|
-
class: "maz-size-5 maz-rounded",
|
|
137
|
-
"img-class": "maz-size-5 maz-rounded"
|
|
138
|
-
}, null, 8, ["src", "alt"])) : createCommentVNode("", !0)
|
|
139
|
-
], !0)
|
|
140
|
-
]),
|
|
141
|
-
"no-results": withCtx(() => [
|
|
142
|
-
renderSlot(_ctx.$slots, "no-results", {}, void 0, !0)
|
|
143
|
-
]),
|
|
144
|
-
default: withCtx(({ option, isSelected }) => [
|
|
145
|
-
createElementVNode("div", {
|
|
146
|
-
class: normalizeClass(["m-select-country__select__item", {
|
|
147
|
-
"m-select-country__select__item--selected": isSelected
|
|
148
|
-
}])
|
|
149
|
-
}, [
|
|
150
|
-
!__props.hideFlags && typeof option.code == "string" ? (openBlock(), createElementBlock("span", _hoisted_1, [
|
|
151
|
-
renderSlot(_ctx.$slots, "country-list-flag", {
|
|
152
|
-
option,
|
|
153
|
-
isSelected
|
|
154
|
-
}, () => [
|
|
155
|
-
option.code && getFlagUrl(option.code) ? (openBlock(), createBlock(unref(MazLazyImg), {
|
|
156
|
-
key: 0,
|
|
157
|
-
src: getFlagUrl(option.code),
|
|
158
|
-
alt: `${option.name} flag`,
|
|
159
|
-
width: "20",
|
|
160
|
-
height: "20",
|
|
161
|
-
class: "maz-size-5 maz-rounded",
|
|
162
|
-
"img-class": "maz-rounded maz-h-5 maz-w-5"
|
|
163
|
-
}, null, 8, ["src", "alt"])) : (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(option.code), 1))
|
|
164
|
-
], !0)
|
|
165
|
-
])) : createCommentVNode("", !0),
|
|
166
|
-
createElementVNode("div", {
|
|
167
|
-
class: normalizeClass(["maz-flex maz-flex-1 maz-gap-2 maz-truncate", { "maz-font-semibold": isSelected }])
|
|
168
|
-
}, [
|
|
169
|
-
__props.showCodeInList ? renderSlot(_ctx.$slots, "country-list-code", {
|
|
170
|
-
key: 0,
|
|
171
|
-
option,
|
|
172
|
-
isSelected
|
|
173
|
-
}, () => [
|
|
174
|
-
createElementVNode("span", _hoisted_3, toDisplayString(option.code), 1)
|
|
175
|
-
], !0) : createCommentVNode("", !0),
|
|
176
|
-
renderSlot(_ctx.$slots, "country-list-name", {
|
|
177
|
-
option,
|
|
178
|
-
isSelected
|
|
179
|
-
}, () => [
|
|
180
|
-
createElementVNode("span", null, toDisplayString(option.name), 1)
|
|
181
|
-
], !0)
|
|
182
|
-
], 2)
|
|
183
|
-
], 2)
|
|
184
|
-
]),
|
|
185
|
-
_: 3
|
|
186
|
-
}, 16, ["id", "model-value", "option-value-key", "option-label-key", "option-input-value-key", "max-list-width", "min-list-width", "disabled", "color", "placeholder", "label", "size", "list-position", "error", "warning", "success", "search", "block", "autocomplete", "item-height", "max-list-height", "min-list-height", "required", "search-function", "format-input-value", "translations", "search-threshold", "options", "hint", "open"])
|
|
187
|
-
], 6));
|
|
188
|
-
}
|
|
189
|
-
}), MazSelectCountry = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-49632158"]]);
|
|
190
|
-
export {
|
|
191
|
-
MazSelectCountry as default
|
|
192
|
-
};
|
|
1
|
+
import"../chunks/MazInput.DJjWLaKg.js";import"../chunks/MazPopover.Co8BEopX.js";import"../chunks/MazSelect.yYFAbBb5.js";import{t as MazSelectCountry_default}from"../chunks/MazSelectCountry.DvVgk2es.js";export{MazSelectCountry_default as default};
|
|
@@ -1,50 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useTranslations } from "@maz-ui/translations/composables/useTranslations";
|
|
3
|
-
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
4
|
-
import '../assets/MazSkeleton.D20FGW_l.css';const _hoisted_1 = ["aria-label"], _hoisted_2 = { class: "maz-sr-only" }, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
-
__name: "MazSkeleton",
|
|
6
|
-
props: {
|
|
7
|
-
shape: { default: "rectangle" },
|
|
8
|
-
size: { default: "1rem" },
|
|
9
|
-
width: {},
|
|
10
|
-
height: {},
|
|
11
|
-
animated: { type: Boolean, default: !0 },
|
|
12
|
-
roundedSize: { default: "md" },
|
|
13
|
-
ariaLabel: {},
|
|
14
|
-
loadingText: {}
|
|
15
|
-
},
|
|
16
|
-
setup(__props) {
|
|
17
|
-
const { t } = useTranslations(), ariaLabelValue = computed(() => __props.ariaLabel || t("skeleton.ariaLabel")), loadingTextValue = computed(() => __props.loadingText || t("skeleton.loadingText")), customStyles = computed(() => {
|
|
18
|
-
const styles = {};
|
|
19
|
-
if (__props.shape)
|
|
20
|
-
switch (__props.shape) {
|
|
21
|
-
case "circle":
|
|
22
|
-
case "square":
|
|
23
|
-
styles.width = __props.size ?? __props.width, styles.height = __props.size ?? __props.height;
|
|
24
|
-
break;
|
|
25
|
-
case "rectangle":
|
|
26
|
-
styles.height = __props.height ?? __props.size, styles.width = __props.width ?? "100%";
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
return styles;
|
|
30
|
-
});
|
|
31
|
-
return (_ctx, _cache) => (openBlock(), createElementBlock("div", {
|
|
32
|
-
class: normalizeClass(["m-skeleton m-reset-css", [
|
|
33
|
-
__props.shape && `m-skeleton--${__props.shape}`,
|
|
34
|
-
`m-skeleton--rounded-${__props.roundedSize}`,
|
|
35
|
-
{
|
|
36
|
-
"m-skeleton--animated": __props.animated
|
|
37
|
-
}
|
|
38
|
-
]]),
|
|
39
|
-
style: normalizeStyle(customStyles.value),
|
|
40
|
-
"aria-label": ariaLabelValue.value,
|
|
41
|
-
role: "status",
|
|
42
|
-
"aria-live": "polite"
|
|
43
|
-
}, [
|
|
44
|
-
createElementVNode("span", _hoisted_2, toDisplayString(loadingTextValue.value), 1)
|
|
45
|
-
], 14, _hoisted_1));
|
|
46
|
-
}
|
|
47
|
-
}), MazSkeleton = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7e7826a1"]]);
|
|
48
|
-
export {
|
|
49
|
-
MazSkeleton as default
|
|
50
|
-
};
|
|
1
|
+
import{t as MazSkeleton_default}from"../chunks/MazSkeleton.BewTYJC2.js";export{MazSkeleton_default as default};
|