@itguy614/clean-ui 0.9.0 → 1.0.1
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/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/clean-ui.css +1 -1
- package/dist/components/CuiAccordion.vue.js +7 -0
- package/dist/components/CuiAccordion.vue2.js +55 -0
- package/dist/components/CuiAccordionItem.vue.js +7 -0
- package/dist/components/CuiAccordionItem.vue2.js +91 -0
- package/dist/components/CuiAlert.vue.d.ts.map +1 -1
- package/dist/components/CuiAlert.vue.js +7 -0
- package/dist/components/CuiAlert.vue2.js +113 -0
- package/dist/components/CuiAvatar.vue.js +99 -0
- package/dist/components/CuiAvatar.vue3.js +5 -0
- package/dist/components/CuiAvatarGroup.vue.js +22 -0
- package/dist/components/CuiAvatarGroup.vue3.js +5 -0
- package/dist/components/CuiBackdrop.vue.js +7 -0
- package/dist/components/CuiBackdrop.vue2.js +49 -0
- package/dist/components/CuiBadge.vue.d.ts.map +1 -1
- package/dist/components/CuiBadge.vue.js +7 -0
- package/dist/components/CuiBadge.vue2.js +82 -0
- package/dist/components/CuiBanner.vue.js +81 -0
- package/dist/components/CuiBanner.vue2.js +4 -0
- package/dist/components/CuiBreadcrumb.vue.js +7 -0
- package/dist/components/CuiBreadcrumb.vue2.js +29 -0
- package/dist/components/CuiBreadcrumbItem.vue.js +7 -0
- package/dist/components/CuiBreadcrumbItem.vue2.js +46 -0
- package/dist/components/CuiButton.vue.d.ts.map +1 -1
- package/dist/components/CuiButton.vue.js +7 -0
- package/dist/components/CuiButton.vue2.js +136 -0
- package/dist/components/CuiButtonGroup.vue.js +7 -0
- package/dist/components/CuiButtonGroup.vue2.js +21 -0
- package/dist/components/CuiCard.vue.js +35 -0
- package/dist/components/CuiCard.vue2.js +4 -0
- package/dist/components/CuiCardBody.vue.js +20 -0
- package/dist/components/CuiCardBody.vue2.js +4 -0
- package/dist/components/CuiCardFooter.vue.js +32 -0
- package/dist/components/CuiCardFooter.vue2.js +4 -0
- package/dist/components/CuiCardHeader.vue.js +51 -0
- package/dist/components/CuiCardHeader.vue2.js +4 -0
- package/dist/components/CuiCardMedia.vue.js +7 -0
- package/dist/components/CuiCardMedia.vue2.js +38 -0
- package/dist/components/CuiCheckbox.vue.js +7 -0
- package/dist/components/CuiCheckbox.vue2.js +105 -0
- package/dist/components/CuiCheckboxGroup.vue.js +7 -0
- package/dist/components/CuiCheckboxGroup.vue2.js +59 -0
- package/dist/components/CuiCodeBlock.vue.js +129 -0
- package/dist/components/CuiCodeBlock.vue2.js +4 -0
- package/dist/components/CuiColorPicker.vue.js +348 -0
- package/dist/components/CuiColorPicker.vue2.js +4 -0
- package/dist/components/CuiCombobox.vue.js +332 -0
- package/dist/components/CuiCombobox.vue2.js +4 -0
- package/dist/components/CuiConfigProvider.vue.js +18 -0
- package/dist/components/CuiConfigProvider.vue2.js +4 -0
- package/dist/components/CuiConfirmDialog.vue.js +208 -0
- package/dist/components/CuiConfirmDialog.vue2.js +4 -0
- package/dist/components/CuiContainer.vue.js +35 -0
- package/dist/components/CuiContainer.vue2.js +4 -0
- package/dist/components/CuiContextMenu.vue.js +7 -0
- package/dist/components/CuiContextMenu.vue2.js +136 -0
- package/dist/components/CuiCopyButton.vue.js +63 -0
- package/dist/components/CuiCopyButton.vue2.js +4 -0
- package/dist/components/CuiDataGrid.vue.d.ts +53 -79
- package/dist/components/CuiDataGrid.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGrid.vue.js +178 -0
- package/dist/components/CuiDataGrid.vue3.js +5 -0
- package/dist/components/CuiDataGridActiveFilters.vue.js +47 -0
- package/dist/components/CuiDataGridActiveFilters.vue3.js +5 -0
- package/dist/components/CuiDataGridBulkBar.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridBulkBar.vue.js +70 -0
- package/dist/components/CuiDataGridBulkBar.vue3.js +5 -0
- package/dist/components/CuiDataGridCardView.vue.js +31 -0
- package/dist/components/CuiDataGridCardView.vue2.js +4 -0
- package/dist/components/CuiDataGridColumnManager.vue.js +86 -0
- package/dist/components/CuiDataGridColumnManager.vue2.js +4 -0
- package/dist/components/CuiDataGridFilterPanel.vue.js +181 -0
- package/dist/components/CuiDataGridFilterPanel.vue3.js +5 -0
- package/dist/components/CuiDataGridPagination.vue.js +28 -0
- package/dist/components/CuiDataGridPagination.vue2.js +4 -0
- package/dist/components/CuiDataGridSearch.vue.js +69 -0
- package/dist/components/CuiDataGridSearch.vue2.js +4 -0
- package/dist/components/CuiDataGridTable.vue.js +336 -0
- package/dist/components/CuiDataGridTable.vue2.js +4 -0
- package/dist/components/CuiDataGridToolbar.vue.js +73 -0
- package/dist/components/CuiDataGridToolbar.vue3.js +5 -0
- package/dist/components/CuiDataGridViewManager.vue.js +209 -0
- package/dist/components/CuiDataGridViewManager.vue2.js +4 -0
- package/dist/components/CuiDataGridViewToggle.vue.js +43 -0
- package/dist/components/CuiDataGridViewToggle.vue3.js +5 -0
- package/dist/components/CuiDatePicker.vue.js +382 -0
- package/dist/components/CuiDatePicker.vue2.js +4 -0
- package/dist/components/CuiDateRangePicker.vue.js +376 -0
- package/dist/components/CuiDateRangePicker.vue2.js +4 -0
- package/dist/components/CuiDivider.vue.js +124 -0
- package/dist/components/CuiDivider.vue2.js +4 -0
- package/dist/components/CuiDropdown.vue.js +7 -0
- package/dist/components/CuiDropdown.vue2.js +110 -0
- package/dist/components/CuiDropdownCheckItem.vue.js +7 -0
- package/dist/components/CuiDropdownCheckItem.vue2.js +45 -0
- package/dist/components/CuiDropdownDivider.vue.js +14 -0
- package/dist/components/CuiDropdownHeader.vue.js +16 -0
- package/dist/components/CuiDropdownItem.vue.js +7 -0
- package/dist/components/CuiDropdownItem.vue2.js +55 -0
- package/dist/components/CuiDropdownMenu.vue.js +7 -0
- package/dist/components/CuiDropdownMenu.vue2.js +79 -0
- package/dist/components/CuiDropdownRadioGroup.vue.js +23 -0
- package/dist/components/CuiDropdownRadioGroup.vue2.js +4 -0
- package/dist/components/CuiDropdownRadioItem.vue.js +7 -0
- package/dist/components/CuiDropdownRadioItem.vue2.js +43 -0
- package/dist/components/CuiDropdownSub.vue.js +7 -0
- package/dist/components/CuiDropdownSub.vue2.js +91 -0
- package/dist/components/CuiDropdownTrigger.vue.js +7 -0
- package/dist/components/CuiDropdownTrigger.vue2.js +25 -0
- package/dist/components/CuiEmptyState.vue.js +7 -0
- package/dist/components/CuiEmptyState.vue2.js +70 -0
- package/dist/components/CuiFieldset.vue.js +7 -0
- package/dist/components/CuiFieldset.vue2.js +79 -0
- package/dist/components/CuiFileUpload.vue.js +254 -0
- package/dist/components/CuiFileUpload.vue2.js +4 -0
- package/dist/components/CuiFlex.vue.js +7 -0
- package/dist/components/CuiFlex.vue2.js +72 -0
- package/dist/components/CuiFlexItem.vue.js +35 -0
- package/dist/components/CuiFlexItem.vue2.js +4 -0
- package/dist/components/CuiForm.vue.js +116 -0
- package/dist/components/CuiForm.vue2.js +4 -0
- package/dist/components/CuiFormField.vue.js +7 -0
- package/dist/components/CuiFormField.vue2.js +73 -0
- package/dist/components/CuiGrid.vue.js +7 -0
- package/dist/components/CuiGrid.vue2.js +51 -0
- package/dist/components/CuiGridItem.vue.js +30 -0
- package/dist/components/CuiGridItem.vue2.js +4 -0
- package/dist/components/CuiIcon.vue.js +7 -0
- package/dist/components/CuiIcon.vue2.js +72 -0
- package/dist/components/CuiInput.vue.d.ts +6 -6
- package/dist/components/CuiInput.vue.d.ts.map +1 -1
- package/dist/components/CuiInput.vue.js +7 -0
- package/dist/components/CuiInput.vue2.js +150 -0
- package/dist/components/CuiInputStepper.vue.js +189 -0
- package/dist/components/CuiInputStepper.vue2.js +4 -0
- package/dist/components/CuiKbd.vue.js +44 -0
- package/dist/components/CuiKbd.vue2.js +4 -0
- package/dist/components/CuiMaskedInput.vue.d.ts +8 -8
- package/dist/components/CuiMaskedInput.vue.js +256 -0
- package/dist/components/CuiMaskedInput.vue2.js +4 -0
- package/dist/components/CuiModal.vue.js +7 -0
- package/dist/components/CuiModal.vue2.js +98 -0
- package/dist/components/CuiModalBody.vue.js +50 -0
- package/dist/components/CuiModalBody.vue2.js +4 -0
- package/dist/components/CuiModalFooter.vue.js +36 -0
- package/dist/components/CuiModalFooter.vue2.js +4 -0
- package/dist/components/CuiModalHeader.vue.js +85 -0
- package/dist/components/CuiModalHeader.vue2.js +4 -0
- package/dist/components/CuiPagination.vue.js +7 -0
- package/dist/components/CuiPagination.vue2.js +136 -0
- package/dist/components/CuiPopover.vue.js +227 -0
- package/dist/components/CuiPopover.vue2.js +4 -0
- package/dist/components/CuiProgress.vue.js +7 -0
- package/dist/components/CuiProgress.vue2.js +132 -0
- package/dist/components/CuiRadio.vue.d.ts.map +1 -1
- package/dist/components/CuiRadio.vue.js +7 -0
- package/dist/components/CuiRadio.vue2.js +139 -0
- package/dist/components/CuiRadioGroup.vue.js +7 -0
- package/dist/components/CuiRadioGroup.vue2.js +78 -0
- package/dist/components/CuiRating.vue.js +129 -0
- package/dist/components/CuiRating.vue2.js +4 -0
- package/dist/components/CuiResizablePanels.vue.js +147 -0
- package/dist/components/CuiResizablePanels.vue2.js +4 -0
- package/dist/components/CuiSelect.vue.d.ts.map +1 -1
- package/dist/components/CuiSelect.vue.js +7 -0
- package/dist/components/CuiSelect.vue2.js +359 -0
- package/dist/components/CuiSkeleton.vue.js +7 -0
- package/dist/components/CuiSkeleton.vue2.js +80 -0
- package/dist/components/CuiSlideover.vue.js +109 -0
- package/dist/components/CuiSlideover.vue2.js +4 -0
- package/dist/components/CuiSlider.vue.js +156 -0
- package/dist/components/CuiSlider.vue2.js +4 -0
- package/dist/components/CuiSpacer.vue.js +32 -0
- package/dist/components/CuiSpacer.vue2.js +4 -0
- package/dist/components/CuiSpinner.vue.js +99 -0
- package/dist/components/CuiSpinner.vue3.js +5 -0
- package/dist/components/CuiStack.vue.js +30 -0
- package/dist/components/CuiStack.vue2.js +4 -0
- package/dist/components/CuiStepper.vue.js +153 -0
- package/dist/components/CuiStepper.vue2.js +4 -0
- package/dist/components/CuiTab.vue.js +7 -0
- package/dist/components/CuiTab.vue2.js +73 -0
- package/dist/components/CuiTable.vue.d.ts.map +1 -1
- package/dist/components/CuiTable.vue.js +90 -0
- package/dist/components/CuiTable.vue3.js +5 -0
- package/dist/components/CuiTableBody.vue.js +18 -0
- package/dist/components/CuiTableBody.vue2.js +4 -0
- package/dist/components/CuiTableCell.vue.js +36 -0
- package/dist/components/CuiTableCell.vue2.js +4 -0
- package/dist/components/CuiTableFoot.vue.js +18 -0
- package/dist/components/CuiTableFoot.vue2.js +4 -0
- package/dist/components/CuiTableHead.vue.js +18 -0
- package/dist/components/CuiTableHead.vue2.js +4 -0
- package/dist/components/CuiTableRow.vue.js +23 -0
- package/dist/components/CuiTableRow.vue2.js +4 -0
- package/dist/components/CuiTabs.vue.js +7 -0
- package/dist/components/CuiTabs.vue2.js +124 -0
- package/dist/components/CuiTagInput.vue.js +296 -0
- package/dist/components/CuiTagInput.vue2.js +4 -0
- package/dist/components/CuiTextarea.vue.js +7 -0
- package/dist/components/CuiTextarea.vue2.js +112 -0
- package/dist/components/CuiTimePicker.vue.js +193 -0
- package/dist/components/CuiTimePicker.vue2.js +4 -0
- package/dist/components/CuiTimeline.vue.js +25 -0
- package/dist/components/CuiTimeline.vue2.js +4 -0
- package/dist/components/CuiTimelineItem.vue.js +113 -0
- package/dist/components/CuiTimelineItem.vue2.js +4 -0
- package/dist/components/CuiToast.vue.js +7 -0
- package/dist/components/CuiToast.vue2.js +129 -0
- package/dist/components/CuiToastProvider.vue.js +7 -0
- package/dist/components/CuiToastProvider.vue2.js +87 -0
- package/dist/components/CuiToggle.vue.d.ts.map +1 -1
- package/dist/components/CuiToggle.vue.js +7 -0
- package/dist/components/CuiToggle.vue2.js +116 -0
- package/dist/components/CuiToggleGroup.vue.js +7 -0
- package/dist/components/CuiToggleGroup.vue2.js +59 -0
- package/dist/components/CuiTooltip.vue.js +7 -0
- package/dist/components/CuiTooltip.vue2.js +128 -0
- package/dist/components/CuiTransferList.vue.js +442 -0
- package/dist/components/CuiTransferList.vue2.js +4 -0
- package/dist/components/CuiTreeNode.vue.js +180 -0
- package/dist/components/CuiTreeNode.vue2.js +4 -0
- package/dist/components/CuiTreeView.vue.js +73 -0
- package/dist/components/CuiTreeView.vue2.js +4 -0
- package/dist/components/accordion-context.js +4 -0
- package/dist/components/breadcrumb-context.js +4 -0
- package/dist/components/config-context.js +4 -0
- package/dist/components/data-grid-context.js +4 -0
- package/dist/components/dropdown-context.js +30 -0
- package/dist/components/form-context.js +4 -0
- package/dist/components/multi-select-group-context.js +5 -0
- package/dist/components/radio-context.js +4 -0
- package/dist/components/table-context.js +5 -0
- package/dist/components/tabs-context.js +4 -0
- package/dist/components/toast-context.js +45 -0
- package/dist/composables/useBreakpoint.js +34 -0
- package/dist/composables/useClickOutside.js +14 -0
- package/dist/composables/useCopyToClipboard.js +25 -0
- package/dist/composables/useDataGrid.js +269 -0
- package/dist/composables/useDataGridInertia.js +35 -0
- package/dist/composables/useDataGridViews.js +67 -0
- package/dist/composables/useDensity.js +42 -0
- package/dist/composables/useLayoutContext.js +21 -0
- package/dist/composables/useMessages.js +10 -0
- package/dist/composables/useOverlay.d.ts.map +1 -1
- package/dist/composables/useOverlay.js +59 -0
- package/dist/composables/usePopover.js +53 -0
- package/dist/composables/useScrollShadows.js +56 -0
- package/dist/composables/useTheme.js +57 -0
- package/dist/composables/useToast.js +23 -0
- package/dist/composables/useVirtualScroll.js +69 -0
- package/dist/index.js +290 -0
- package/dist/messages.js +57 -0
- package/dist/ssr-theme-init.js +13 -0
- package/dist/utils/color.js +195 -0
- package/dist/utils/colorIconMap.js +11 -0
- package/dist/utils/date.js +114 -0
- package/dist/utils/devWarn.d.ts +15 -0
- package/dist/utils/devWarn.d.ts.map +1 -0
- package/dist/utils/devWarn.js +20 -0
- package/dist/utils/liveRegion.js +12 -0
- package/dist/utils/resolvers.js +28 -0
- package/dist/utils/responsive.js +68 -0
- package/dist/utils/sizing.js +39 -0
- package/package.json +8 -7
- package/dist/clean-ui.js +0 -11937
- package/dist/clean-ui.umd.cjs +0 -11
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { defineComponent as fe, ref as C, watch as j, onMounted as ye, computed as p, withDirectives as ge, openBlock as c, createElementBlock as d, toDisplayString as v, createCommentVNode as E, createVNode as o, withCtx as f, createElementVNode as u, normalizeStyle as M, Fragment as z, createTextVNode as Y, unref as W, renderList as T, vShow as pe } from "vue";
|
|
2
|
+
import he from "./CuiPopover.vue.js";
|
|
3
|
+
import x from "./CuiButton.vue.js";
|
|
4
|
+
import S from "./CuiIcon.vue.js";
|
|
5
|
+
import { formatToMask as be, formatToRaw as O, formatDate as B, isoToDate as I, daysInMonth as P, firstDayOfMonth as xe, MONTH_NAMES_SHORT as F, DAY_NAMES_SHORT as De, isDateDisabled as ke, isToday as Ce, isSameDay as H, dateToIso as ze } from "../utils/date.js";
|
|
6
|
+
const Se = {
|
|
7
|
+
key: 0,
|
|
8
|
+
style: {
|
|
9
|
+
display: "block",
|
|
10
|
+
marginBottom: "calc(0.25rem * var(--cui-density-scale, 1))",
|
|
11
|
+
fontSize: "0.875rem",
|
|
12
|
+
fontWeight: "500",
|
|
13
|
+
color: "var(--cui-text-secondary)"
|
|
14
|
+
}
|
|
15
|
+
}, we = ["value", "placeholder"], Me = { style: { color: "var(--cui-text-tertiary)", fontSize: "0.75rem", flexShrink: "0" } }, _e = ["value", "placeholder"], Re = { style: { padding: "calc(0.25rem * var(--cui-density-scale, 1))", minWidth: "260px" } }, Te = { style: {
|
|
16
|
+
fontSize: "0.75rem",
|
|
17
|
+
color: "var(--cui-text-secondary)",
|
|
18
|
+
textAlign: "center",
|
|
19
|
+
marginBottom: "calc(0.375rem * var(--cui-density-scale, 1))",
|
|
20
|
+
fontWeight: "500"
|
|
21
|
+
} }, Be = { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "calc(0.5rem * var(--cui-density-scale, 1))" } }, $e = { style: { display: "flex", gap: "calc(0.25rem * var(--cui-density-scale, 1))" } }, Ve = { style: { display: "grid", gridTemplateColumns: "repeat(7, 1fr)", gap: "0", marginBottom: "calc(0.25rem * var(--cui-density-scale, 1))" } }, Ye = { style: { display: "grid", gridTemplateColumns: "repeat(7, 1fr)", gap: "calc(1px * var(--cui-density-scale, 1))" } }, We = ["onClick", "onMouseenter"], Ie = { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "calc(0.5rem * var(--cui-density-scale, 1))" } }, Ae = { style: { display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "calc(4px * var(--cui-density-scale, 1))" } }, Ne = ["onClick"], je = { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "calc(0.5rem * var(--cui-density-scale, 1))" } }, Ee = { style: { fontSize: "0.8125rem", fontWeight: "600", color: "var(--cui-text-body)" } }, Oe = { style: { display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "calc(4px * var(--cui-density-scale, 1))" } }, Pe = ["onClick"], Ge = /* @__PURE__ */ fe({
|
|
22
|
+
__name: "CuiDateRangePicker",
|
|
23
|
+
props: {
|
|
24
|
+
modelValue: {},
|
|
25
|
+
format: { default: "MM/DD/YYYY" },
|
|
26
|
+
valueType: { default: "iso" },
|
|
27
|
+
highlightToday: { type: Boolean, default: !0 },
|
|
28
|
+
minDate: {},
|
|
29
|
+
maxDate: {},
|
|
30
|
+
disabledDate: {},
|
|
31
|
+
disabledDates: {},
|
|
32
|
+
blockSpanningBlackout: { type: Boolean, default: !0 },
|
|
33
|
+
separator: { default: "→" },
|
|
34
|
+
startPlaceholder: {},
|
|
35
|
+
endPlaceholder: {},
|
|
36
|
+
size: { default: "md" },
|
|
37
|
+
label: {},
|
|
38
|
+
hidden: { type: Boolean, default: !1 },
|
|
39
|
+
disabled: { type: Boolean, default: !1 }
|
|
40
|
+
},
|
|
41
|
+
emits: ["update:modelValue"],
|
|
42
|
+
setup(y, { emit: L }) {
|
|
43
|
+
const l = y, U = L, r = C((/* @__PURE__ */ new Date()).getFullYear()), i = C((/* @__PURE__ */ new Date()).getMonth()), _ = C(!1), D = C("start"), n = C(null), g = C(null), w = C(null);
|
|
44
|
+
function A(t) {
|
|
45
|
+
return t ? t instanceof Date ? t : I(t) : null;
|
|
46
|
+
}
|
|
47
|
+
function N() {
|
|
48
|
+
l.modelValue && (n.value = A(l.modelValue.start), g.value = A(l.modelValue.end), n.value && (r.value = n.value.getFullYear(), i.value = n.value.getMonth()));
|
|
49
|
+
}
|
|
50
|
+
j(() => l.modelValue, N, { deep: !0 }), ye(N), p(() => be(l.format)), p(() => n.value ? O(B(n.value, l.format)) : ""), p(() => g.value ? O(B(g.value, l.format)) : "");
|
|
51
|
+
const q = p(() => n.value ? B(n.value, l.format) : ""), G = p(() => g.value ? B(g.value, l.format) : ""), J = p(() => l.minDate ? I(l.minDate) : null), K = p(() => l.maxDate ? I(l.maxDate) : null);
|
|
52
|
+
function R(t) {
|
|
53
|
+
return ke(t, {
|
|
54
|
+
minDate: J.value,
|
|
55
|
+
maxDate: K.value,
|
|
56
|
+
disabledDate: l.disabledDate,
|
|
57
|
+
disabledDates: l.disabledDates
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function Q(t, e) {
|
|
61
|
+
if (!l.blockSpanningBlackout) return !1;
|
|
62
|
+
const a = new Date(t);
|
|
63
|
+
for (; a <= e; ) {
|
|
64
|
+
if (R(a)) return !0;
|
|
65
|
+
a.setDate(a.getDate() + 1);
|
|
66
|
+
}
|
|
67
|
+
return !1;
|
|
68
|
+
}
|
|
69
|
+
function X() {
|
|
70
|
+
const t = (e) => e ? l.valueType === "date" ? e : ze(e) : null;
|
|
71
|
+
U("update:modelValue", { start: t(n.value), end: t(g.value) });
|
|
72
|
+
}
|
|
73
|
+
const Z = p(() => {
|
|
74
|
+
const t = [], e = P(r.value, i.value), a = xe(r.value, i.value), s = i.value === 0 ? 11 : i.value - 1, b = i.value === 0 ? r.value - 1 : r.value, V = P(b, s);
|
|
75
|
+
for (let m = a - 1; m >= 0; m--) {
|
|
76
|
+
const k = new Date(b, s, V - m);
|
|
77
|
+
t.push({ date: k, inMonth: !1, disabled: R(k) });
|
|
78
|
+
}
|
|
79
|
+
for (let m = 1; m <= e; m++) {
|
|
80
|
+
const k = new Date(r.value, i.value, m);
|
|
81
|
+
t.push({ date: k, inMonth: !0, disabled: R(k) });
|
|
82
|
+
}
|
|
83
|
+
const de = 42 - t.length, ve = i.value === 11 ? 0 : i.value + 1, me = i.value === 11 ? r.value + 1 : r.value;
|
|
84
|
+
for (let m = 1; m <= de; m++) {
|
|
85
|
+
const k = new Date(me, ve, m);
|
|
86
|
+
t.push({ date: k, inMonth: !1, disabled: R(k) });
|
|
87
|
+
}
|
|
88
|
+
return t;
|
|
89
|
+
});
|
|
90
|
+
function ee(t) {
|
|
91
|
+
if (!t.disabled)
|
|
92
|
+
if (D.value === "start")
|
|
93
|
+
n.value = t.date, g.value = null, D.value = "end";
|
|
94
|
+
else {
|
|
95
|
+
let e = n.value, a = t.date;
|
|
96
|
+
if (a < e && ([e, a] = [a, e]), Q(e, a)) return;
|
|
97
|
+
n.value = e, g.value = a, D.value = "start", X(), _.value = !1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function te(t) {
|
|
101
|
+
D.value === "end" && (w.value = t);
|
|
102
|
+
}
|
|
103
|
+
function ae(t) {
|
|
104
|
+
if (!n.value) return !1;
|
|
105
|
+
const e = D.value === "end" && w.value ? w.value : g.value;
|
|
106
|
+
if (!e) return !1;
|
|
107
|
+
const a = n.value < e ? n.value : e, s = n.value < e ? e : n.value;
|
|
108
|
+
return t >= a && t <= s;
|
|
109
|
+
}
|
|
110
|
+
function le(t) {
|
|
111
|
+
return !!n.value && H(t, n.value);
|
|
112
|
+
}
|
|
113
|
+
function ne(t) {
|
|
114
|
+
const e = D.value === "end" && w.value ? w.value : g.value;
|
|
115
|
+
return !!e && H(t, e);
|
|
116
|
+
}
|
|
117
|
+
function re() {
|
|
118
|
+
i.value === 0 ? (i.value = 11, r.value--) : i.value--;
|
|
119
|
+
}
|
|
120
|
+
function ie() {
|
|
121
|
+
i.value === 11 ? (i.value = 0, r.value++) : i.value++;
|
|
122
|
+
}
|
|
123
|
+
const h = C("days"), $ = p(() => Math.floor(r.value / 12) * 12), oe = p(() => Array.from({ length: 12 }, (t, e) => $.value + e));
|
|
124
|
+
function se(t) {
|
|
125
|
+
i.value = t, h.value = "days";
|
|
126
|
+
}
|
|
127
|
+
function ue(t) {
|
|
128
|
+
r.value = t, h.value = "months";
|
|
129
|
+
}
|
|
130
|
+
j(_, (t) => {
|
|
131
|
+
t && (h.value = "days", D.value = "start", w.value = null, n.value && (r.value = n.value.getFullYear(), i.value = n.value.getMonth()));
|
|
132
|
+
});
|
|
133
|
+
function ce(t) {
|
|
134
|
+
const e = {
|
|
135
|
+
width: "2rem",
|
|
136
|
+
height: "2rem",
|
|
137
|
+
display: "flex",
|
|
138
|
+
alignItems: "center",
|
|
139
|
+
justifyContent: "center",
|
|
140
|
+
fontSize: "0.8125rem",
|
|
141
|
+
cursor: t.disabled ? "default" : "pointer",
|
|
142
|
+
transition: "background 0.1s ease, color 0.1s ease",
|
|
143
|
+
position: "relative"
|
|
144
|
+
}, a = ae(t.date), s = le(t.date), b = ne(t.date), V = l.highlightToday && Ce(t.date);
|
|
145
|
+
return t.disabled ? (e.color = "var(--cui-text-tertiary)", e.opacity = "0.35") : s || b ? (e.background = "var(--cui-primary)", e.color = "var(--cui-primary-text, white)", e.fontWeight = "600", e.borderRadius = s && !b ? "0.375rem 0 0 0.375rem" : !s && b ? "0 0.375rem 0.375rem 0" : "0.375rem") : a ? (e.background = "var(--cui-primary-bg)", e.color = "var(--cui-primary)", e.borderRadius = "0") : V ? (e.background = "var(--cui-primary-bg)", e.color = "var(--cui-primary)", e.fontWeight = "600", e.borderRadius = "0.375rem") : t.inMonth ? (e.color = "var(--cui-text-body)", e.borderRadius = "0.375rem") : (e.color = "var(--cui-text-tertiary)", e.borderRadius = "0.375rem"), e;
|
|
146
|
+
}
|
|
147
|
+
return (t, e) => ge((c(), d("div", null, [
|
|
148
|
+
y.label ? (c(), d("label", Se, v(y.label), 1)) : E("", !0),
|
|
149
|
+
o(he, {
|
|
150
|
+
visible: _.value,
|
|
151
|
+
"onUpdate:visible": e[7] || (e[7] = (a) => _.value = a),
|
|
152
|
+
placement: "bottom",
|
|
153
|
+
closable: !1,
|
|
154
|
+
"no-arrow": "",
|
|
155
|
+
width: "auto",
|
|
156
|
+
disabled: y.disabled
|
|
157
|
+
}, {
|
|
158
|
+
content: f(() => [
|
|
159
|
+
u("div", Re, [
|
|
160
|
+
u("div", Te, v(D.value === "start" ? "Select start date" : "Select end date"), 1),
|
|
161
|
+
h.value === "days" ? (c(), d(z, { key: 0 }, [
|
|
162
|
+
u("div", Be, [
|
|
163
|
+
o(x, {
|
|
164
|
+
variant: "ghost",
|
|
165
|
+
size: "xs",
|
|
166
|
+
onClick: re
|
|
167
|
+
}, {
|
|
168
|
+
default: f(() => [
|
|
169
|
+
o(S, {
|
|
170
|
+
name: "caret-left",
|
|
171
|
+
size: "0.875rem"
|
|
172
|
+
})
|
|
173
|
+
]),
|
|
174
|
+
_: 1
|
|
175
|
+
}),
|
|
176
|
+
u("div", $e, [
|
|
177
|
+
o(x, {
|
|
178
|
+
variant: "ghost",
|
|
179
|
+
size: "xs",
|
|
180
|
+
style: { fontWeight: "600" },
|
|
181
|
+
onClick: e[0] || (e[0] = (a) => h.value = "months")
|
|
182
|
+
}, {
|
|
183
|
+
default: f(() => [
|
|
184
|
+
Y(v(W(F)[i.value]), 1)
|
|
185
|
+
]),
|
|
186
|
+
_: 1
|
|
187
|
+
}),
|
|
188
|
+
o(x, {
|
|
189
|
+
variant: "ghost",
|
|
190
|
+
size: "xs",
|
|
191
|
+
style: { fontWeight: "600" },
|
|
192
|
+
onClick: e[1] || (e[1] = (a) => h.value = "years")
|
|
193
|
+
}, {
|
|
194
|
+
default: f(() => [
|
|
195
|
+
Y(v(r.value), 1)
|
|
196
|
+
]),
|
|
197
|
+
_: 1
|
|
198
|
+
})
|
|
199
|
+
]),
|
|
200
|
+
o(x, {
|
|
201
|
+
variant: "ghost",
|
|
202
|
+
size: "xs",
|
|
203
|
+
onClick: ie
|
|
204
|
+
}, {
|
|
205
|
+
default: f(() => [
|
|
206
|
+
o(S, {
|
|
207
|
+
name: "caret-right",
|
|
208
|
+
size: "0.875rem"
|
|
209
|
+
})
|
|
210
|
+
]),
|
|
211
|
+
_: 1
|
|
212
|
+
})
|
|
213
|
+
]),
|
|
214
|
+
u("div", Ve, [
|
|
215
|
+
(c(!0), d(z, null, T(W(De), (a) => (c(), d("div", {
|
|
216
|
+
key: a,
|
|
217
|
+
style: { textAlign: "center", fontSize: "0.6875rem", fontWeight: "600", color: "var(--cui-text-tertiary)", padding: "calc(0.25rem * var(--cui-density-scale, 1)) 0", textTransform: "uppercase" }
|
|
218
|
+
}, v(a), 1))), 128))
|
|
219
|
+
]),
|
|
220
|
+
u("div", Ye, [
|
|
221
|
+
(c(!0), d(z, null, T(Z.value, (a, s) => (c(), d("div", {
|
|
222
|
+
key: s,
|
|
223
|
+
style: M(ce(a)),
|
|
224
|
+
onClick: (b) => ee(a),
|
|
225
|
+
onMouseenter: (b) => te(a.date)
|
|
226
|
+
}, v(a.date.getDate()), 45, We))), 128))
|
|
227
|
+
])
|
|
228
|
+
], 64)) : h.value === "months" ? (c(), d(z, { key: 1 }, [
|
|
229
|
+
u("div", Ie, [
|
|
230
|
+
o(x, {
|
|
231
|
+
variant: "ghost",
|
|
232
|
+
size: "xs",
|
|
233
|
+
onClick: e[2] || (e[2] = (a) => r.value--)
|
|
234
|
+
}, {
|
|
235
|
+
default: f(() => [
|
|
236
|
+
o(S, {
|
|
237
|
+
name: "caret-left",
|
|
238
|
+
size: "0.875rem"
|
|
239
|
+
})
|
|
240
|
+
]),
|
|
241
|
+
_: 1
|
|
242
|
+
}),
|
|
243
|
+
o(x, {
|
|
244
|
+
variant: "ghost",
|
|
245
|
+
size: "xs",
|
|
246
|
+
style: { fontWeight: "600" },
|
|
247
|
+
onClick: e[3] || (e[3] = (a) => h.value = "years")
|
|
248
|
+
}, {
|
|
249
|
+
default: f(() => [
|
|
250
|
+
Y(v(r.value), 1)
|
|
251
|
+
]),
|
|
252
|
+
_: 1
|
|
253
|
+
}),
|
|
254
|
+
o(x, {
|
|
255
|
+
variant: "ghost",
|
|
256
|
+
size: "xs",
|
|
257
|
+
onClick: e[4] || (e[4] = (a) => r.value++)
|
|
258
|
+
}, {
|
|
259
|
+
default: f(() => [
|
|
260
|
+
o(S, {
|
|
261
|
+
name: "caret-right",
|
|
262
|
+
size: "0.875rem"
|
|
263
|
+
})
|
|
264
|
+
]),
|
|
265
|
+
_: 1
|
|
266
|
+
})
|
|
267
|
+
]),
|
|
268
|
+
u("div", Ae, [
|
|
269
|
+
(c(!0), d(z, null, T(W(F), (a, s) => (c(), d("div", {
|
|
270
|
+
key: s,
|
|
271
|
+
style: M({ padding: "calc(0.5rem * var(--cui-density-scale, 1))", textAlign: "center", borderRadius: "0.375rem", cursor: "pointer", fontSize: "0.8125rem", color: i.value === s ? "var(--cui-primary)" : "var(--cui-text-body)" }),
|
|
272
|
+
onClick: (b) => se(s)
|
|
273
|
+
}, v(a), 13, Ne))), 128))
|
|
274
|
+
])
|
|
275
|
+
], 64)) : h.value === "years" ? (c(), d(z, { key: 2 }, [
|
|
276
|
+
u("div", je, [
|
|
277
|
+
o(x, {
|
|
278
|
+
variant: "ghost",
|
|
279
|
+
size: "xs",
|
|
280
|
+
onClick: e[5] || (e[5] = (a) => r.value -= 12)
|
|
281
|
+
}, {
|
|
282
|
+
default: f(() => [
|
|
283
|
+
o(S, {
|
|
284
|
+
name: "caret-left",
|
|
285
|
+
size: "0.875rem"
|
|
286
|
+
})
|
|
287
|
+
]),
|
|
288
|
+
_: 1
|
|
289
|
+
}),
|
|
290
|
+
u("span", Ee, v($.value) + " – " + v($.value + 11), 1),
|
|
291
|
+
o(x, {
|
|
292
|
+
variant: "ghost",
|
|
293
|
+
size: "xs",
|
|
294
|
+
onClick: e[6] || (e[6] = (a) => r.value += 12)
|
|
295
|
+
}, {
|
|
296
|
+
default: f(() => [
|
|
297
|
+
o(S, {
|
|
298
|
+
name: "caret-right",
|
|
299
|
+
size: "0.875rem"
|
|
300
|
+
})
|
|
301
|
+
]),
|
|
302
|
+
_: 1
|
|
303
|
+
})
|
|
304
|
+
]),
|
|
305
|
+
u("div", Oe, [
|
|
306
|
+
(c(!0), d(z, null, T(oe.value, (a) => (c(), d("div", {
|
|
307
|
+
key: a,
|
|
308
|
+
style: M({ padding: "calc(0.5rem * var(--cui-density-scale, 1))", textAlign: "center", borderRadius: "0.375rem", cursor: "pointer", fontSize: "0.8125rem", fontWeight: r.value === a ? "600" : "400", color: r.value === a ? "var(--cui-primary)" : "var(--cui-text-body)" }),
|
|
309
|
+
onClick: (s) => ue(a)
|
|
310
|
+
}, v(a), 13, Pe))), 128))
|
|
311
|
+
])
|
|
312
|
+
], 64)) : E("", !0)
|
|
313
|
+
])
|
|
314
|
+
]),
|
|
315
|
+
default: f(() => [
|
|
316
|
+
u("div", {
|
|
317
|
+
style: M({
|
|
318
|
+
display: "flex",
|
|
319
|
+
alignItems: "center",
|
|
320
|
+
gap: "calc(0.375rem * var(--cui-density-scale, 1))",
|
|
321
|
+
border: "1px solid var(--cui-border-strong, var(--cui-border))",
|
|
322
|
+
borderRadius: "var(--cui-button-radius, 0.375rem)",
|
|
323
|
+
padding: "0 calc(0.5rem * var(--cui-density-scale, 1))",
|
|
324
|
+
background: "var(--cui-surface-base, white)",
|
|
325
|
+
opacity: y.disabled ? "0.5" : "1",
|
|
326
|
+
cursor: y.disabled ? "default" : "pointer"
|
|
327
|
+
})
|
|
328
|
+
}, [
|
|
329
|
+
o(S, {
|
|
330
|
+
name: "calendar-blank",
|
|
331
|
+
size: "0.875rem",
|
|
332
|
+
style: { color: "var(--cui-text-tertiary)", "flex-shrink": "0" }
|
|
333
|
+
}),
|
|
334
|
+
u("input", {
|
|
335
|
+
value: q.value,
|
|
336
|
+
placeholder: y.startPlaceholder || l.format.toLowerCase(),
|
|
337
|
+
readonly: "",
|
|
338
|
+
style: M({
|
|
339
|
+
border: "none",
|
|
340
|
+
background: "transparent",
|
|
341
|
+
outline: "none",
|
|
342
|
+
fontSize: "0.875rem",
|
|
343
|
+
color: "var(--cui-text-body)",
|
|
344
|
+
padding: "calc(0.5rem * var(--cui-density-scale, 1)) 0",
|
|
345
|
+
width: `${l.format.length + 1}ch`,
|
|
346
|
+
cursor: "pointer"
|
|
347
|
+
})
|
|
348
|
+
}, null, 12, we),
|
|
349
|
+
u("span", Me, v(y.separator), 1),
|
|
350
|
+
u("input", {
|
|
351
|
+
value: G.value,
|
|
352
|
+
placeholder: y.endPlaceholder || l.format.toLowerCase(),
|
|
353
|
+
readonly: "",
|
|
354
|
+
style: M({
|
|
355
|
+
border: "none",
|
|
356
|
+
background: "transparent",
|
|
357
|
+
outline: "none",
|
|
358
|
+
fontSize: "0.875rem",
|
|
359
|
+
color: "var(--cui-text-body)",
|
|
360
|
+
padding: "calc(0.5rem * var(--cui-density-scale, 1)) 0",
|
|
361
|
+
width: `${l.format.length + 1}ch`,
|
|
362
|
+
cursor: "pointer"
|
|
363
|
+
})
|
|
364
|
+
}, null, 12, _e)
|
|
365
|
+
], 4)
|
|
366
|
+
]),
|
|
367
|
+
_: 1
|
|
368
|
+
}, 8, ["visible", "disabled"])
|
|
369
|
+
], 512)), [
|
|
370
|
+
[pe, !y.hidden]
|
|
371
|
+
]);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
export {
|
|
375
|
+
Ge as default
|
|
376
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { defineComponent as p, useSlots as x, computed as n, withDirectives as s, openBlock as a, createElementBlock as i, normalizeStyle as l, createCommentVNode as d, createElementVNode as f, renderSlot as g, createTextVNode as h, toDisplayString as b, vShow as u } from "vue";
|
|
2
|
+
import { resolveColor as S } from "../utils/color.js";
|
|
3
|
+
const B = /* @__PURE__ */ p({
|
|
4
|
+
__name: "CuiDivider",
|
|
5
|
+
props: {
|
|
6
|
+
orientation: { default: "horizontal" },
|
|
7
|
+
labelPosition: { default: "center" },
|
|
8
|
+
label: {},
|
|
9
|
+
variant: { default: "solid" },
|
|
10
|
+
spacing: { default: "0" },
|
|
11
|
+
color: {},
|
|
12
|
+
hidden: { type: Boolean, default: !1 }
|
|
13
|
+
},
|
|
14
|
+
setup(e) {
|
|
15
|
+
const t = e, k = x(), m = n(() => !!t.label || !!k.default), r = n(() => {
|
|
16
|
+
const c = t.color ? S(t.color) : "var(--cui-border)";
|
|
17
|
+
return `1px ${t.variant} ${c}`;
|
|
18
|
+
}), v = n(() => t.orientation === "vertical" ? {
|
|
19
|
+
display: "inline-flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
alignSelf: "stretch",
|
|
23
|
+
marginLeft: t.spacing,
|
|
24
|
+
marginRight: t.spacing
|
|
25
|
+
} : {
|
|
26
|
+
display: "flex",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
width: "100%",
|
|
29
|
+
marginTop: t.spacing,
|
|
30
|
+
marginBottom: t.spacing
|
|
31
|
+
}), o = n(() => t.orientation === "vertical" ? {
|
|
32
|
+
flex: "1",
|
|
33
|
+
width: "0",
|
|
34
|
+
borderLeft: r.value,
|
|
35
|
+
minHeight: "1rem"
|
|
36
|
+
} : {
|
|
37
|
+
flex: "1",
|
|
38
|
+
height: "0",
|
|
39
|
+
borderTop: r.value
|
|
40
|
+
}), y = n(() => ({
|
|
41
|
+
fontSize: "0.75rem",
|
|
42
|
+
fontWeight: "500",
|
|
43
|
+
color: t.color ? S(t.color) : "var(--cui-text-tertiary)",
|
|
44
|
+
padding: t.orientation === "horizontal" ? "0 calc(0.75rem * var(--cui-density-scale, 1))" : "calc(0.5rem * var(--cui-density-scale, 1)) 0",
|
|
45
|
+
whiteSpace: "nowrap",
|
|
46
|
+
textTransform: "uppercase",
|
|
47
|
+
letterSpacing: "0.04em"
|
|
48
|
+
}));
|
|
49
|
+
return (c, w) => e.orientation === "horizontal" && m.value ? s((a(), i("div", {
|
|
50
|
+
key: 0,
|
|
51
|
+
style: l(v.value),
|
|
52
|
+
role: "separator"
|
|
53
|
+
}, [
|
|
54
|
+
e.labelPosition !== "start" ? (a(), i("div", {
|
|
55
|
+
key: 0,
|
|
56
|
+
style: l(o.value)
|
|
57
|
+
}, null, 4)) : d("", !0),
|
|
58
|
+
f("span", {
|
|
59
|
+
style: l(y.value)
|
|
60
|
+
}, [
|
|
61
|
+
g(c.$slots, "default", {}, () => [
|
|
62
|
+
h(b(e.label), 1)
|
|
63
|
+
])
|
|
64
|
+
], 4),
|
|
65
|
+
e.labelPosition !== "end" ? (a(), i("div", {
|
|
66
|
+
key: 1,
|
|
67
|
+
style: l(o.value)
|
|
68
|
+
}, null, 4)) : d("", !0)
|
|
69
|
+
], 4)), [
|
|
70
|
+
[u, !e.hidden]
|
|
71
|
+
]) : e.orientation === "horizontal" ? s((a(), i("hr", {
|
|
72
|
+
key: 1,
|
|
73
|
+
style: l({
|
|
74
|
+
border: "none",
|
|
75
|
+
borderTop: r.value,
|
|
76
|
+
width: "100%",
|
|
77
|
+
marginTop: e.spacing,
|
|
78
|
+
marginBottom: e.spacing
|
|
79
|
+
}),
|
|
80
|
+
role: "separator"
|
|
81
|
+
}, null, 4)), [
|
|
82
|
+
[u, !e.hidden]
|
|
83
|
+
]) : m.value ? s((a(), i("div", {
|
|
84
|
+
key: 2,
|
|
85
|
+
style: l(v.value),
|
|
86
|
+
role: "separator"
|
|
87
|
+
}, [
|
|
88
|
+
e.labelPosition !== "start" ? (a(), i("div", {
|
|
89
|
+
key: 0,
|
|
90
|
+
style: l(o.value)
|
|
91
|
+
}, null, 4)) : d("", !0),
|
|
92
|
+
f("span", {
|
|
93
|
+
style: l(y.value)
|
|
94
|
+
}, [
|
|
95
|
+
g(c.$slots, "default", {}, () => [
|
|
96
|
+
h(b(e.label), 1)
|
|
97
|
+
])
|
|
98
|
+
], 4),
|
|
99
|
+
e.labelPosition !== "end" ? (a(), i("div", {
|
|
100
|
+
key: 1,
|
|
101
|
+
style: l(o.value)
|
|
102
|
+
}, null, 4)) : d("", !0)
|
|
103
|
+
], 4)), [
|
|
104
|
+
[u, !e.hidden]
|
|
105
|
+
]) : s((a(), i("div", {
|
|
106
|
+
key: 3,
|
|
107
|
+
style: l({
|
|
108
|
+
display: "inline-block",
|
|
109
|
+
width: "0",
|
|
110
|
+
alignSelf: "stretch",
|
|
111
|
+
borderLeft: r.value,
|
|
112
|
+
marginLeft: e.spacing,
|
|
113
|
+
marginRight: e.spacing,
|
|
114
|
+
minHeight: "1rem"
|
|
115
|
+
}),
|
|
116
|
+
role: "separator"
|
|
117
|
+
}, null, 4)), [
|
|
118
|
+
[u, !e.hidden]
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
export {
|
|
123
|
+
B as default
|
|
124
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { defineComponent as x, ref as g, onMounted as A, onUnmounted as D, provide as _, toRef as h, withDirectives as q, openBlock as I, createElementBlock as K, renderSlot as P, vShow as R } from "vue";
|
|
2
|
+
import { DropdownContextKey as U } from "./dropdown-context.js";
|
|
3
|
+
const G = /* @__PURE__ */ x({
|
|
4
|
+
__name: "CuiDropdown",
|
|
5
|
+
props: {
|
|
6
|
+
trigger: { default: "click" },
|
|
7
|
+
placement: { default: "bottom" },
|
|
8
|
+
pinned: { type: Boolean, default: !1 },
|
|
9
|
+
hidden: { type: Boolean, default: !1 },
|
|
10
|
+
disabled: { type: Boolean, default: !1 }
|
|
11
|
+
},
|
|
12
|
+
setup(p, { expose: S }) {
|
|
13
|
+
const o = p, r = g(!1), s = g(!1), M = g(null);
|
|
14
|
+
let u = null, n = null, l = null;
|
|
15
|
+
function c() {
|
|
16
|
+
o.disabled || (n && (clearTimeout(n), n = null), l && (clearTimeout(l), l = null), s.value = !1, r.value = !0);
|
|
17
|
+
}
|
|
18
|
+
function t() {
|
|
19
|
+
u && (clearTimeout(u), u = null), r.value && (s.value = !0, l = setTimeout(() => {
|
|
20
|
+
r.value = !1, s.value = !1;
|
|
21
|
+
}, 150));
|
|
22
|
+
}
|
|
23
|
+
function a() {
|
|
24
|
+
r.value ? t() : c();
|
|
25
|
+
}
|
|
26
|
+
function y() {
|
|
27
|
+
t();
|
|
28
|
+
}
|
|
29
|
+
function E() {
|
|
30
|
+
(o.trigger === "hover" || o.trigger === "hover-focus") && (n && (clearTimeout(n), n = null), u = setTimeout(c, 100));
|
|
31
|
+
}
|
|
32
|
+
function b() {
|
|
33
|
+
(o.trigger === "hover" || o.trigger === "hover-focus") && (u && (clearTimeout(u), u = null), n = setTimeout(t, 150));
|
|
34
|
+
}
|
|
35
|
+
function C() {
|
|
36
|
+
o.trigger === "hover-focus" && c();
|
|
37
|
+
}
|
|
38
|
+
function k(e) {
|
|
39
|
+
if (o.trigger === "hover-focus") {
|
|
40
|
+
const i = e.relatedTarget, m = e.currentTarget;
|
|
41
|
+
if (i && m.contains(i)) return;
|
|
42
|
+
n = setTimeout(t, 150);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function B(e) {
|
|
46
|
+
e.key === "Escape" && r.value && (e.stopPropagation(), t());
|
|
47
|
+
}
|
|
48
|
+
const d = `cui-dd-${Math.random().toString(36).slice(2, 8)}`;
|
|
49
|
+
function v(e) {
|
|
50
|
+
const i = document.querySelector(`[data-cui-dropdown-id="${d}"]`), m = document.querySelectorAll(`[data-cui-dropdown-owner="${d}"]`), T = e.target;
|
|
51
|
+
if (!(i != null && i.contains(T))) {
|
|
52
|
+
for (const $ of m)
|
|
53
|
+
if ($.contains(T)) return;
|
|
54
|
+
t();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function L() {
|
|
58
|
+
}
|
|
59
|
+
function w() {
|
|
60
|
+
r.value && (o.pinned || t());
|
|
61
|
+
}
|
|
62
|
+
A(() => {
|
|
63
|
+
document.addEventListener("mousedown", v), window.addEventListener("scroll", w, !0);
|
|
64
|
+
}), D(() => {
|
|
65
|
+
document.removeEventListener("mousedown", v), window.removeEventListener("scroll", w, !0), u && clearTimeout(u), n && clearTimeout(n), l && clearTimeout(l);
|
|
66
|
+
});
|
|
67
|
+
const f = /* @__PURE__ */ new Set();
|
|
68
|
+
function F(e) {
|
|
69
|
+
return f.add(e), () => f.delete(e);
|
|
70
|
+
}
|
|
71
|
+
function O(e) {
|
|
72
|
+
for (const i of f)
|
|
73
|
+
i !== e && i();
|
|
74
|
+
}
|
|
75
|
+
return _(U, {
|
|
76
|
+
isOpen: r,
|
|
77
|
+
isClosing: s,
|
|
78
|
+
trigger: h(o, "trigger"),
|
|
79
|
+
triggerEl: M,
|
|
80
|
+
placement: h(o, "placement"),
|
|
81
|
+
open: c,
|
|
82
|
+
close: t,
|
|
83
|
+
toggle: a,
|
|
84
|
+
closeAll: y,
|
|
85
|
+
registerSubMenu: F,
|
|
86
|
+
closeSiblingSubMenus: O,
|
|
87
|
+
reposition: L
|
|
88
|
+
}), S({ open: c, close: t, toggle: a, isOpen: r }), (e, i) => q((I(), K("div", {
|
|
89
|
+
class: "cui-dropdown",
|
|
90
|
+
"data-cui-dropdown-id": d,
|
|
91
|
+
onMouseenter: E,
|
|
92
|
+
onMouseleave: b,
|
|
93
|
+
onFocusin: C,
|
|
94
|
+
onFocusout: k,
|
|
95
|
+
onKeydown: B
|
|
96
|
+
}, [
|
|
97
|
+
P(e.$slots, "default", {
|
|
98
|
+
isOpen: r.value,
|
|
99
|
+
toggle: a,
|
|
100
|
+
open: c,
|
|
101
|
+
close: t
|
|
102
|
+
}, void 0, !0)
|
|
103
|
+
], 544)), [
|
|
104
|
+
[R, !p.hidden]
|
|
105
|
+
]);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
export {
|
|
109
|
+
G as default
|
|
110
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineComponent as r, inject as s, openBlock as a, createElementBlock as m, normalizeClass as u, createElementVNode as i, createBlock as k, createCommentVNode as f, renderSlot as h } from "vue";
|
|
2
|
+
import p from "./CuiIcon.vue.js";
|
|
3
|
+
import { DropdownContextKey as b } from "./dropdown-context.js";
|
|
4
|
+
const w = ["aria-checked", "aria-disabled", "tabindex"], C = { class: "cui-dropdown-check-item__check" }, V = { class: "cui-dropdown-check-item__label" }, v = /* @__PURE__ */ r({
|
|
5
|
+
__name: "CuiDropdownCheckItem",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: { type: Boolean, default: !1 },
|
|
8
|
+
disabled: { type: Boolean, default: !1 }
|
|
9
|
+
},
|
|
10
|
+
emits: ["update:modelValue"],
|
|
11
|
+
setup(e, { emit: c }) {
|
|
12
|
+
const t = e, l = c;
|
|
13
|
+
s(b);
|
|
14
|
+
function d() {
|
|
15
|
+
t.disabled || l("update:modelValue", !t.modelValue);
|
|
16
|
+
}
|
|
17
|
+
function n(o) {
|
|
18
|
+
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), d());
|
|
19
|
+
}
|
|
20
|
+
return (o, y) => (a(), m("div", {
|
|
21
|
+
class: u(["cui-dropdown-check-item", { "cui-dropdown-check-item--disabled": e.disabled }]),
|
|
22
|
+
role: "menuitemcheckbox",
|
|
23
|
+
"aria-checked": e.modelValue,
|
|
24
|
+
"aria-disabled": e.disabled || void 0,
|
|
25
|
+
tabindex: e.disabled ? -1 : 0,
|
|
26
|
+
onClick: d,
|
|
27
|
+
onKeydown: n
|
|
28
|
+
}, [
|
|
29
|
+
i("span", C, [
|
|
30
|
+
e.modelValue ? (a(), k(p, {
|
|
31
|
+
key: 0,
|
|
32
|
+
name: "check",
|
|
33
|
+
size: "0.875rem",
|
|
34
|
+
weight: "bold"
|
|
35
|
+
})) : f("", !0)
|
|
36
|
+
]),
|
|
37
|
+
i("span", V, [
|
|
38
|
+
h(o.$slots, "default", {}, void 0, !0)
|
|
39
|
+
])
|
|
40
|
+
], 42, w));
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
v as default
|
|
45
|
+
};
|