@itguy614/clean-ui 0.9.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_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.js +7 -0
- package/dist/components/CuiAlert.vue2.js +110 -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.js +7 -0
- package/dist/components/CuiBadge.vue2.js +79 -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.js +7 -0
- package/dist/components/CuiButton.vue2.js +133 -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.js +176 -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.js +7 -0
- package/dist/components/CuiInput.vue2.js +148 -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.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.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.js +57 -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/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,254 @@
|
|
|
1
|
+
import { defineComponent as K, ref as y, computed as q, useTemplateRef as G, withDirectives as H, openBlock as c, createElementBlock as s, toDisplayString as l, createCommentVNode as f, createElementVNode as n, normalizeStyle as z, createVNode as h, createTextVNode as b, withModifiers as J, Fragment as P, renderList as Q, withCtx as k, unref as Z, createBlock as _, vShow as ee } from "vue";
|
|
2
|
+
import C from "./CuiButton.vue.js";
|
|
3
|
+
import p from "./CuiIcon.vue.js";
|
|
4
|
+
import { useMessages as te } from "../composables/useMessages.js";
|
|
5
|
+
const ie = {
|
|
6
|
+
key: 0,
|
|
7
|
+
style: { display: "block", marginBottom: "calc(0.375rem * var(--cui-density-scale, 1))", fontSize: "0.875rem", fontWeight: "500", color: "var(--cui-text-secondary)" }
|
|
8
|
+
}, ae = ["accept", "multiple"], le = { style: { fontSize: "0.875rem", color: "var(--cui-text-secondary)" } }, re = {
|
|
9
|
+
key: 0,
|
|
10
|
+
style: { fontSize: "0.75rem", color: "var(--cui-text-tertiary)", marginTop: "calc(0.375rem * var(--cui-density-scale, 1))" }
|
|
11
|
+
}, ne = { key: 0 }, oe = { key: 1 }, ce = { key: 2 }, se = {
|
|
12
|
+
key: 1,
|
|
13
|
+
style: { marginTop: "calc(0.75rem * var(--cui-density-scale, 1))" }
|
|
14
|
+
}, ue = { style: { flex: "1", minWidth: "0" } }, de = { style: { fontSize: "0.8125rem", fontWeight: "500", color: "var(--cui-text-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, fe = { style: { fontSize: "0.6875rem", color: "var(--cui-text-tertiary)" } }, me = ["onClick"], ve = { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginTop: "calc(0.5rem * var(--cui-density-scale, 1))" } }, he = { style: { fontSize: "0.75rem", color: "var(--cui-text-tertiary)" } }, xe = { style: { display: "flex", gap: "calc(0.375rem * var(--cui-density-scale, 1))" } }, ke = /* @__PURE__ */ K({
|
|
15
|
+
__name: "CuiFileUpload",
|
|
16
|
+
props: {
|
|
17
|
+
accept: {},
|
|
18
|
+
multiple: { type: Boolean, default: !0 },
|
|
19
|
+
maxFileSize: { default: 0 },
|
|
20
|
+
maxFiles: { default: 0 },
|
|
21
|
+
autoUpload: { type: Boolean, default: !0 },
|
|
22
|
+
label: {},
|
|
23
|
+
dragText: { default: "Drag and drop files here, or" },
|
|
24
|
+
browseText: { default: "Browse" },
|
|
25
|
+
uploadText: { default: "Upload" },
|
|
26
|
+
hidden: { type: Boolean, default: !1 },
|
|
27
|
+
color: { default: "primary" },
|
|
28
|
+
disabled: { type: Boolean, default: !1 }
|
|
29
|
+
},
|
|
30
|
+
emits: ["upload", "reject", "change"],
|
|
31
|
+
setup(i, { expose: B, emit: D }) {
|
|
32
|
+
const r = i, u = D, a = y([]), m = y(!1), S = y(null);
|
|
33
|
+
let T = 0;
|
|
34
|
+
function $() {
|
|
35
|
+
return `file-${++T}-${Date.now()}`;
|
|
36
|
+
}
|
|
37
|
+
function x(e) {
|
|
38
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
39
|
+
}
|
|
40
|
+
function W(e) {
|
|
41
|
+
return e.startsWith("image/") ? "image" : e.startsWith("video/") ? "video-camera" : e.startsWith("audio/") ? "music-note" : e.includes("pdf") ? "file-pdf" : e.includes("zip") || e.includes("compressed") || e.includes("archive") ? "file-zip" : e.includes("spreadsheet") || e.includes("csv") || e.includes("excel") ? "file-xls" : e.includes("document") || e.includes("word") ? "file-doc" : e.includes("text") || e.includes("json") || e.includes("xml") ? "file-text" : "file";
|
|
42
|
+
}
|
|
43
|
+
function M(e) {
|
|
44
|
+
var t;
|
|
45
|
+
if (r.maxFileSize > 0 && e.size > r.maxFileSize)
|
|
46
|
+
return `File exceeds maximum size of ${x(r.maxFileSize)}`;
|
|
47
|
+
if (r.accept) {
|
|
48
|
+
const o = r.accept.split(",").map((d) => d.trim().toLowerCase()), v = "." + ((t = e.name.split(".").pop()) == null ? void 0 : t.toLowerCase());
|
|
49
|
+
if (!o.some((d) => d.startsWith(".") ? v === d : d.endsWith("/*") ? e.type.startsWith(d.replace("/*", "/")) : e.type === d)) return "File type not accepted";
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function F(e) {
|
|
54
|
+
if (!r.disabled) {
|
|
55
|
+
for (const t of Array.from(e)) {
|
|
56
|
+
if (r.maxFiles > 0 && a.value.length >= r.maxFiles) {
|
|
57
|
+
u("reject", { file: t, reason: `Maximum ${r.maxFiles} files allowed` });
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const o = M(t);
|
|
61
|
+
if (o) {
|
|
62
|
+
u("reject", { file: t, reason: o });
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
a.value.some((v) => v.name === t.name && v.size === t.size) || a.value.push({
|
|
66
|
+
file: t,
|
|
67
|
+
id: $(),
|
|
68
|
+
name: t.name,
|
|
69
|
+
size: t.size,
|
|
70
|
+
type: t.type
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
u("change", [...a.value]), r.autoUpload && u("upload", a.value.map((t) => t.file));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function R(e) {
|
|
77
|
+
a.value = a.value.filter((t) => t.id !== e), u("change", [...a.value]);
|
|
78
|
+
}
|
|
79
|
+
function j() {
|
|
80
|
+
a.value = [], u("change", []);
|
|
81
|
+
}
|
|
82
|
+
function E() {
|
|
83
|
+
a.value.length !== 0 && u("upload", a.value.map((e) => e.file));
|
|
84
|
+
}
|
|
85
|
+
function w() {
|
|
86
|
+
var e;
|
|
87
|
+
(e = S.value) == null || e.click();
|
|
88
|
+
}
|
|
89
|
+
function I(e) {
|
|
90
|
+
const t = e.target;
|
|
91
|
+
t.files && F(t.files), t.value = "";
|
|
92
|
+
}
|
|
93
|
+
function U(e) {
|
|
94
|
+
e.preventDefault(), r.disabled || (m.value = !0);
|
|
95
|
+
}
|
|
96
|
+
function A(e) {
|
|
97
|
+
e.preventDefault();
|
|
98
|
+
}
|
|
99
|
+
function L(e) {
|
|
100
|
+
const t = e.currentTarget.getBoundingClientRect();
|
|
101
|
+
(e.clientX <= t.left || e.clientX >= t.right || e.clientY <= t.top || e.clientY >= t.bottom) && (m.value = !1);
|
|
102
|
+
}
|
|
103
|
+
function N(e) {
|
|
104
|
+
var t;
|
|
105
|
+
e.preventDefault(), m.value = !1, (t = e.dataTransfer) != null && t.files && F(e.dataTransfer.files);
|
|
106
|
+
}
|
|
107
|
+
const V = q(() => x(a.value.reduce((e, t) => e + t.size, 0))), g = G("rootEl");
|
|
108
|
+
function O(e) {
|
|
109
|
+
var t;
|
|
110
|
+
(t = g.value) == null || t.focus(e);
|
|
111
|
+
}
|
|
112
|
+
function X() {
|
|
113
|
+
var e;
|
|
114
|
+
(e = g.value) == null || e.blur();
|
|
115
|
+
}
|
|
116
|
+
B({ el: g, focus: O, blur: X });
|
|
117
|
+
const Y = te();
|
|
118
|
+
return (e, t) => H((c(), s("div", {
|
|
119
|
+
ref_key: "rootEl",
|
|
120
|
+
ref: g
|
|
121
|
+
}, [
|
|
122
|
+
i.label ? (c(), s("label", ie, l(i.label), 1)) : f("", !0),
|
|
123
|
+
n("input", {
|
|
124
|
+
ref_key: "inputRef",
|
|
125
|
+
ref: S,
|
|
126
|
+
type: "file",
|
|
127
|
+
accept: i.accept,
|
|
128
|
+
multiple: i.multiple,
|
|
129
|
+
style: { display: "none" },
|
|
130
|
+
onChange: I
|
|
131
|
+
}, null, 40, ae),
|
|
132
|
+
n("div", {
|
|
133
|
+
style: z({
|
|
134
|
+
border: `2px dashed ${m.value ? `var(--cui-${i.color})` : "var(--cui-border)"}`,
|
|
135
|
+
borderRadius: "0.625rem",
|
|
136
|
+
padding: "calc(1.5rem * var(--cui-density-scale, 1))",
|
|
137
|
+
textAlign: "center",
|
|
138
|
+
cursor: i.disabled ? "default" : "pointer",
|
|
139
|
+
opacity: i.disabled ? "0.5" : "1",
|
|
140
|
+
background: m.value ? `var(--cui-${i.color}-bg)` : "transparent",
|
|
141
|
+
transition: "border-color 0.15s ease, background 0.15s ease"
|
|
142
|
+
}),
|
|
143
|
+
onClick: w,
|
|
144
|
+
onDragenter: U,
|
|
145
|
+
onDragover: A,
|
|
146
|
+
onDragleave: L,
|
|
147
|
+
onDrop: N
|
|
148
|
+
}, [
|
|
149
|
+
h(p, {
|
|
150
|
+
name: "cloud-arrow-up",
|
|
151
|
+
size: "2rem",
|
|
152
|
+
style: z({ color: m.value ? `var(--cui-${i.color})` : "var(--cui-text-tertiary)", marginBottom: "calc(0.5rem * var(--cui-density-scale, 1))" })
|
|
153
|
+
}, null, 8, ["style"]),
|
|
154
|
+
n("div", le, [
|
|
155
|
+
b(l(i.dragText) + " ", 1),
|
|
156
|
+
n("span", {
|
|
157
|
+
style: z({ color: `var(--cui-${i.color})`, fontWeight: "600", cursor: "pointer" }),
|
|
158
|
+
onClick: J(w, ["stop"])
|
|
159
|
+
}, l(i.browseText), 5)
|
|
160
|
+
]),
|
|
161
|
+
i.accept || i.maxFileSize > 0 ? (c(), s("div", re, [
|
|
162
|
+
i.accept ? (c(), s("span", ne, l(i.accept), 1)) : f("", !0),
|
|
163
|
+
i.accept && i.maxFileSize > 0 ? (c(), s("span", oe, " · ")) : f("", !0),
|
|
164
|
+
i.maxFileSize > 0 ? (c(), s("span", ce, "Max " + l(x(i.maxFileSize)), 1)) : f("", !0)
|
|
165
|
+
])) : f("", !0)
|
|
166
|
+
], 36),
|
|
167
|
+
a.value.length > 0 ? (c(), s("div", se, [
|
|
168
|
+
(c(!0), s(P, null, Q(a.value, (o) => (c(), s("div", {
|
|
169
|
+
key: o.id,
|
|
170
|
+
style: {
|
|
171
|
+
display: "flex",
|
|
172
|
+
alignItems: "center",
|
|
173
|
+
gap: "calc(0.625rem * var(--cui-density-scale, 1))",
|
|
174
|
+
padding: "calc(0.5rem * var(--cui-density-scale, 1)) calc(0.625rem * var(--cui-density-scale, 1))",
|
|
175
|
+
borderRadius: "0.375rem",
|
|
176
|
+
border: "1px solid var(--cui-border)",
|
|
177
|
+
marginBottom: "calc(0.375rem * var(--cui-density-scale, 1))",
|
|
178
|
+
background: "var(--cui-surface-base, white)"
|
|
179
|
+
}
|
|
180
|
+
}, [
|
|
181
|
+
h(p, {
|
|
182
|
+
name: W(o.type),
|
|
183
|
+
size: "1.25rem",
|
|
184
|
+
style: { flexShrink: "0", color: "var(--cui-text-secondary)" }
|
|
185
|
+
}, null, 8, ["name"]),
|
|
186
|
+
n("div", ue, [
|
|
187
|
+
n("div", de, l(o.name), 1),
|
|
188
|
+
n("div", fe, l(x(o.size)), 1)
|
|
189
|
+
]),
|
|
190
|
+
n("button", {
|
|
191
|
+
type: "button",
|
|
192
|
+
style: {
|
|
193
|
+
display: "flex",
|
|
194
|
+
alignItems: "center",
|
|
195
|
+
justifyContent: "center",
|
|
196
|
+
width: "1.5rem",
|
|
197
|
+
height: "1.5rem",
|
|
198
|
+
border: "none",
|
|
199
|
+
background: "none",
|
|
200
|
+
cursor: "pointer",
|
|
201
|
+
color: "var(--cui-text-tertiary)",
|
|
202
|
+
borderRadius: "0.25rem",
|
|
203
|
+
flexShrink: "0"
|
|
204
|
+
},
|
|
205
|
+
onClick: (v) => R(o.id)
|
|
206
|
+
}, [
|
|
207
|
+
h(p, {
|
|
208
|
+
name: "x",
|
|
209
|
+
size: "0.75rem"
|
|
210
|
+
})
|
|
211
|
+
], 8, me)
|
|
212
|
+
]))), 128)),
|
|
213
|
+
n("div", ve, [
|
|
214
|
+
n("span", he, l(a.value.length) + " file" + l(a.value.length === 1 ? "" : "s") + " · " + l(V.value), 1),
|
|
215
|
+
n("div", xe, [
|
|
216
|
+
h(C, {
|
|
217
|
+
variant: "ghost",
|
|
218
|
+
size: "xs",
|
|
219
|
+
onClick: j
|
|
220
|
+
}, {
|
|
221
|
+
default: k(() => [
|
|
222
|
+
b(l(Z(Y).clearAll), 1)
|
|
223
|
+
]),
|
|
224
|
+
_: 1
|
|
225
|
+
}),
|
|
226
|
+
i.autoUpload ? f("", !0) : (c(), _(C, {
|
|
227
|
+
key: 0,
|
|
228
|
+
variant: "solid",
|
|
229
|
+
size: "xs",
|
|
230
|
+
color: i.color,
|
|
231
|
+
onClick: E
|
|
232
|
+
}, {
|
|
233
|
+
prefix: k(() => [
|
|
234
|
+
h(p, {
|
|
235
|
+
name: "upload-simple",
|
|
236
|
+
size: "0.75rem"
|
|
237
|
+
})
|
|
238
|
+
]),
|
|
239
|
+
default: k(() => [
|
|
240
|
+
b(" " + l(i.uploadText), 1)
|
|
241
|
+
]),
|
|
242
|
+
_: 1
|
|
243
|
+
}, 8, ["color"]))
|
|
244
|
+
])
|
|
245
|
+
])
|
|
246
|
+
])) : f("", !0)
|
|
247
|
+
], 512)), [
|
|
248
|
+
[ee, !i.hidden]
|
|
249
|
+
]);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
export {
|
|
253
|
+
ke as default
|
|
254
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { defineComponent as _, watch as C, computed as G, withDirectives as I, openBlock as m, createElementBlock as v, normalizeStyle as w, renderSlot as k, unref as c, createElementVNode as B, toDisplayString as j, createCommentVNode as D, vShow as F } from "vue";
|
|
2
|
+
import { useFlexContext as N } from "../composables/useLayoutContext.js";
|
|
3
|
+
import { useBreakpoint as E } from "../composables/useBreakpoint.js";
|
|
4
|
+
import { resolveResponsive as o, spacingToCss as d } from "../utils/responsive.js";
|
|
5
|
+
const T = { class: "cui-flex__debug-label" }, J = /* @__PURE__ */ _({
|
|
6
|
+
__name: "CuiFlex",
|
|
7
|
+
props: {
|
|
8
|
+
direction: { default: "row" },
|
|
9
|
+
wrap: { default: "wrap" },
|
|
10
|
+
align: {},
|
|
11
|
+
justify: {},
|
|
12
|
+
gap: {},
|
|
13
|
+
rowGap: {},
|
|
14
|
+
colGap: {},
|
|
15
|
+
debug: { type: Boolean, default: !1 },
|
|
16
|
+
hidden: { type: Boolean, default: !1 }
|
|
17
|
+
},
|
|
18
|
+
setup(p) {
|
|
19
|
+
const x = {
|
|
20
|
+
row: "row",
|
|
21
|
+
"row-reverse": "row-reverse",
|
|
22
|
+
col: "column",
|
|
23
|
+
"col-reverse": "column-reverse"
|
|
24
|
+
}, y = {
|
|
25
|
+
start: "flex-start",
|
|
26
|
+
center: "center",
|
|
27
|
+
end: "flex-end",
|
|
28
|
+
stretch: "stretch",
|
|
29
|
+
baseline: "baseline"
|
|
30
|
+
}, g = {
|
|
31
|
+
start: "flex-start",
|
|
32
|
+
center: "center",
|
|
33
|
+
end: "flex-end",
|
|
34
|
+
between: "space-between",
|
|
35
|
+
around: "space-around",
|
|
36
|
+
evenly: "space-evenly"
|
|
37
|
+
}, t = p, { context: r } = N(), { breakpoint: b } = E();
|
|
38
|
+
C(
|
|
39
|
+
() => t.debug,
|
|
40
|
+
(e) => {
|
|
41
|
+
r.value.debug = e;
|
|
42
|
+
},
|
|
43
|
+
{ immediate: !0 }
|
|
44
|
+
);
|
|
45
|
+
const h = G(() => {
|
|
46
|
+
const e = b.value, u = o(t.direction, "row", e), S = o(t.wrap, "wrap", e), s = o(t.align, void 0, e), a = o(t.justify, void 0, e), f = o(t.gap, void 0, e), l = o(t.rowGap, void 0, e), i = o(t.colGap, void 0, e), n = {
|
|
47
|
+
display: "flex",
|
|
48
|
+
flexDirection: x[u] ?? "row",
|
|
49
|
+
flexWrap: S
|
|
50
|
+
};
|
|
51
|
+
return s && (n.alignItems = y[s] ?? s), a && (n.justifyContent = g[a] ?? a), l || i ? (l && (n.rowGap = d(l)), i && (n.columnGap = d(i))) : f && (n.gap = d(f)), n;
|
|
52
|
+
});
|
|
53
|
+
return (e, u) => I((m(), v("div", {
|
|
54
|
+
class: "cui-flex",
|
|
55
|
+
style: w(h.value)
|
|
56
|
+
}, [
|
|
57
|
+
k(e.$slots, "default", {}, void 0, !0),
|
|
58
|
+
c(r).debug ? (m(), v("div", {
|
|
59
|
+
key: 0,
|
|
60
|
+
class: "cui-flex__debug-overlay",
|
|
61
|
+
style: w({ zIndex: 9999 - c(r).depth })
|
|
62
|
+
}, [
|
|
63
|
+
B("div", T, " Flex (depth: " + j(c(r).depth) + ") ", 1)
|
|
64
|
+
], 4)) : D("", !0)
|
|
65
|
+
], 4)), [
|
|
66
|
+
[F, !p.hidden]
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export {
|
|
71
|
+
J as default
|
|
72
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineComponent as d, computed as a, withDirectives as m, openBlock as p, createElementBlock as u, normalizeStyle as v, renderSlot as h, vShow as x } from "vue";
|
|
2
|
+
import { useBreakpoint as k } from "../composables/useBreakpoint.js";
|
|
3
|
+
import { resolveResponsive as i } from "../utils/responsive.js";
|
|
4
|
+
const y = /* @__PURE__ */ d({
|
|
5
|
+
__name: "CuiFlexItem",
|
|
6
|
+
props: {
|
|
7
|
+
grow: {},
|
|
8
|
+
shrink: {},
|
|
9
|
+
flex: {},
|
|
10
|
+
hidden: { type: Boolean, default: !1 }
|
|
11
|
+
},
|
|
12
|
+
setup(n) {
|
|
13
|
+
const t = n, { breakpoint: c } = k(), f = a(() => {
|
|
14
|
+
const e = c.value, o = {}, r = i(t.flex, void 0, e);
|
|
15
|
+
if (r !== void 0)
|
|
16
|
+
o.flex = r;
|
|
17
|
+
else {
|
|
18
|
+
const s = i(t.grow, void 0, e), l = i(t.shrink, void 0, e);
|
|
19
|
+
s !== void 0 && (o.flexGrow = String(s)), l !== void 0 && (o.flexShrink = String(l));
|
|
20
|
+
}
|
|
21
|
+
return o;
|
|
22
|
+
});
|
|
23
|
+
return (e, o) => m((p(), u("div", {
|
|
24
|
+
class: "cui-flex-item",
|
|
25
|
+
style: v(f.value)
|
|
26
|
+
}, [
|
|
27
|
+
h(e.$slots, "default")
|
|
28
|
+
], 4)), [
|
|
29
|
+
[x, !n.hidden]
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
export {
|
|
34
|
+
y as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { defineComponent as _, ref as c, watch as E, provide as P, computed as w, withDirectives as D, openBlock as K, createElementBlock as M, withModifiers as R, renderSlot as $, vShow as z } from "vue";
|
|
2
|
+
import { FormContextKey as A } from "./form-context.js";
|
|
3
|
+
const I = /* @__PURE__ */ _({
|
|
4
|
+
__name: "CuiForm",
|
|
5
|
+
props: {
|
|
6
|
+
modelValue: {},
|
|
7
|
+
resolver: {},
|
|
8
|
+
validateOn: { default: "submit" },
|
|
9
|
+
readonly: { type: Boolean, default: !1 },
|
|
10
|
+
hidden: { type: Boolean, default: !1 },
|
|
11
|
+
disabled: { type: Boolean, default: !1 }
|
|
12
|
+
},
|
|
13
|
+
emits: ["update:modelValue", "submit", "submit-invalid"],
|
|
14
|
+
setup(y, { expose: k, emit: B }) {
|
|
15
|
+
const n = y, f = B;
|
|
16
|
+
function m(e) {
|
|
17
|
+
if (!e) return {};
|
|
18
|
+
try {
|
|
19
|
+
return structuredClone(e);
|
|
20
|
+
} catch {
|
|
21
|
+
return { ...e };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const l = c(m(n.modelValue)), u = c({}), i = c(!1), s = c(!1);
|
|
25
|
+
let d = 0;
|
|
26
|
+
E(
|
|
27
|
+
() => n.modelValue,
|
|
28
|
+
(e) => {
|
|
29
|
+
e && e !== l.value && (l.value = m(e));
|
|
30
|
+
},
|
|
31
|
+
{ deep: !0 }
|
|
32
|
+
);
|
|
33
|
+
function C(e, t) {
|
|
34
|
+
return t.split(".").reduce((o, a) => {
|
|
35
|
+
if (o && typeof o == "object") return o[a];
|
|
36
|
+
}, e);
|
|
37
|
+
}
|
|
38
|
+
function F(e, t, o) {
|
|
39
|
+
const a = t.split(".");
|
|
40
|
+
let r = e;
|
|
41
|
+
for (let p = 0; p < a.length - 1; p++) {
|
|
42
|
+
const v = a[p];
|
|
43
|
+
(typeof r[v] != "object" || r[v] === null) && (r[v] = {}), r = r[v];
|
|
44
|
+
}
|
|
45
|
+
r[a[a.length - 1]] = o;
|
|
46
|
+
}
|
|
47
|
+
async function b() {
|
|
48
|
+
return n.resolver ? await n.resolver(l.value) ?? {} : {};
|
|
49
|
+
}
|
|
50
|
+
async function h() {
|
|
51
|
+
const e = ++d, t = await b();
|
|
52
|
+
return e === d && (u.value = t), t;
|
|
53
|
+
}
|
|
54
|
+
async function g(e) {
|
|
55
|
+
const t = ++d, o = await b();
|
|
56
|
+
if (t !== d) return;
|
|
57
|
+
const a = { ...u.value };
|
|
58
|
+
o[e] ? a[e] = o[e] : delete a[e], u.value = a;
|
|
59
|
+
}
|
|
60
|
+
function S(e) {
|
|
61
|
+
return C(l.value, e);
|
|
62
|
+
}
|
|
63
|
+
function j(e, t) {
|
|
64
|
+
F(l.value, e, t), f("update:modelValue", { ...l.value }), (n.validateOn === "change" || i.value) && g(e);
|
|
65
|
+
}
|
|
66
|
+
function q(e) {
|
|
67
|
+
if (!(e in u.value)) return;
|
|
68
|
+
const t = { ...u.value };
|
|
69
|
+
delete t[e], u.value = t;
|
|
70
|
+
}
|
|
71
|
+
async function V() {
|
|
72
|
+
if (!s.value) {
|
|
73
|
+
s.value = !0, i.value = !0;
|
|
74
|
+
try {
|
|
75
|
+
const e = await h();
|
|
76
|
+
Object.keys(e).length === 0 ? f("submit", l.value) : f("submit-invalid", e);
|
|
77
|
+
} finally {
|
|
78
|
+
s.value = !1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function x(e) {
|
|
83
|
+
l.value = m(e ?? n.modelValue), u.value = {}, i.value = !1, f("update:modelValue", { ...l.value });
|
|
84
|
+
}
|
|
85
|
+
function O(e) {
|
|
86
|
+
d++, u.value = { ...e };
|
|
87
|
+
}
|
|
88
|
+
return P(A, {
|
|
89
|
+
values: l,
|
|
90
|
+
errors: u,
|
|
91
|
+
submitted: i,
|
|
92
|
+
disabled: w(() => n.disabled),
|
|
93
|
+
readonly: w(() => n.readonly),
|
|
94
|
+
getValue: S,
|
|
95
|
+
setValue: j,
|
|
96
|
+
validateField: g,
|
|
97
|
+
unregisterField: q
|
|
98
|
+
}), k({ validate: h, reset: x, submit: V, setErrors: O, values: l, errors: u, submitting: s }), (e, t) => D((K(), M("form", {
|
|
99
|
+
class: "cui-form",
|
|
100
|
+
novalidate: "",
|
|
101
|
+
onSubmit: R(V, ["prevent"])
|
|
102
|
+
}, [
|
|
103
|
+
$(e.$slots, "default", {
|
|
104
|
+
values: l.value,
|
|
105
|
+
errors: u.value,
|
|
106
|
+
submitted: i.value,
|
|
107
|
+
submitting: s.value
|
|
108
|
+
})
|
|
109
|
+
], 544)), [
|
|
110
|
+
[z, !y.hidden]
|
|
111
|
+
]);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
export {
|
|
115
|
+
I as default
|
|
116
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { defineComponent as _, inject as x, computed as a, onBeforeUnmount as g, withDirectives as q, openBlock as t, createElementBlock as i, normalizeClass as B, unref as k, createElementVNode as u, toDisplayString as d, createCommentVNode as c, renderSlot as T, normalizeProps as V, guardReactiveProps as p, vShow as C } from "vue";
|
|
2
|
+
import { FormContextKey as E } from "./form-context.js";
|
|
3
|
+
const F = ["for"], M = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "cui-form-field__required",
|
|
6
|
+
"aria-hidden": "true"
|
|
7
|
+
}, P = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "cui-form-field__required-text"
|
|
10
|
+
}, S = { class: "cui-form-field__body" }, w = { class: "cui-form-field__control" }, D = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "cui-form-field__error"
|
|
13
|
+
}, $ = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "cui-form-field__help"
|
|
16
|
+
}, U = /* @__PURE__ */ _({
|
|
17
|
+
__name: "CuiFormField",
|
|
18
|
+
props: {
|
|
19
|
+
label: {},
|
|
20
|
+
labelPosition: { default: "top" },
|
|
21
|
+
for: {},
|
|
22
|
+
name: {},
|
|
23
|
+
required: { type: Boolean, default: !1 },
|
|
24
|
+
requiredText: {},
|
|
25
|
+
helpText: {},
|
|
26
|
+
error: { type: Boolean, default: !1 },
|
|
27
|
+
errorMessage: {},
|
|
28
|
+
hidden: { type: Boolean, default: !1 },
|
|
29
|
+
disabled: { type: Boolean, default: !1 }
|
|
30
|
+
},
|
|
31
|
+
setup(e) {
|
|
32
|
+
const l = e, o = x(E, null), s = a(() => !!l.name && !!o), n = a(
|
|
33
|
+
() => s.value ? !!o.errors.value[l.name] : !!l.error
|
|
34
|
+
), f = a(
|
|
35
|
+
() => s.value ? o.errors.value[l.name] : l.errorMessage
|
|
36
|
+
), h = a(() => n.value && f.value), b = a(() => l.disabled || ((o == null ? void 0 : o.disabled.value) ?? !1)), m = l.for ?? `cui-field-${Math.random().toString(36).slice(2, 8)}`, y = a(() => {
|
|
37
|
+
const r = {
|
|
38
|
+
id: m,
|
|
39
|
+
error: n.value,
|
|
40
|
+
disabled: b.value
|
|
41
|
+
};
|
|
42
|
+
return s.value && (r.modelValue = o.getValue(l.name), r["onUpdate:modelValue"] = (v) => o.setValue(l.name, v), r.readonly = o.readonly.value), r;
|
|
43
|
+
});
|
|
44
|
+
return g(() => {
|
|
45
|
+
l.name && o && o.unregisterField(l.name);
|
|
46
|
+
}), (r, v) => q((t(), i("div", {
|
|
47
|
+
class: B(["cui-form-field", [
|
|
48
|
+
`cui-form-field--${e.labelPosition}`,
|
|
49
|
+
{ "cui-form-field--error": n.value }
|
|
50
|
+
]])
|
|
51
|
+
}, [
|
|
52
|
+
e.label ? (t(), i("label", {
|
|
53
|
+
key: 0,
|
|
54
|
+
for: k(m),
|
|
55
|
+
class: "cui-form-field__label"
|
|
56
|
+
}, [
|
|
57
|
+
u("span", null, d(e.label), 1),
|
|
58
|
+
e.required && !e.requiredText ? (t(), i("span", M, "*")) : e.required && e.requiredText ? (t(), i("span", P, d(e.requiredText), 1)) : c("", !0)
|
|
59
|
+
], 8, F)) : c("", !0),
|
|
60
|
+
u("div", S, [
|
|
61
|
+
u("div", w, [
|
|
62
|
+
T(r.$slots, "default", V(p(y.value)), void 0, !0)
|
|
63
|
+
]),
|
|
64
|
+
h.value ? (t(), i("div", D, d(f.value), 1)) : e.helpText ? (t(), i("div", $, d(e.helpText), 1)) : c("", !0)
|
|
65
|
+
])
|
|
66
|
+
], 2)), [
|
|
67
|
+
[C, !e.hidden]
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
export {
|
|
72
|
+
U as default
|
|
73
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineComponent as G, watch as h, computed as w, withDirectives as b, openBlock as m, createElementBlock as f, normalizeStyle as g, renderSlot as _, unref as d, createElementVNode as x, toDisplayString as C, createCommentVNode as k, vShow as B } from "vue";
|
|
2
|
+
import { useGridContext as S } from "../composables/useLayoutContext.js";
|
|
3
|
+
import { useBreakpoint as T } from "../composables/useBreakpoint.js";
|
|
4
|
+
import { resolveResponsive as r, spacingToCss as n } from "../utils/responsive.js";
|
|
5
|
+
const $ = { class: "cui-grid__debug-label" }, R = /* @__PURE__ */ G({
|
|
6
|
+
__name: "CuiGrid",
|
|
7
|
+
props: {
|
|
8
|
+
cols: { default: 1 },
|
|
9
|
+
rows: {},
|
|
10
|
+
gap: {},
|
|
11
|
+
rowGap: {},
|
|
12
|
+
colGap: {},
|
|
13
|
+
debug: { type: Boolean, default: !1 },
|
|
14
|
+
hidden: { type: Boolean, default: !1 }
|
|
15
|
+
},
|
|
16
|
+
setup(l) {
|
|
17
|
+
const o = l, { context: i } = S(), { breakpoint: v } = T();
|
|
18
|
+
h(
|
|
19
|
+
() => o.debug,
|
|
20
|
+
(e) => {
|
|
21
|
+
i.value.debug = e;
|
|
22
|
+
},
|
|
23
|
+
{ immediate: !0 }
|
|
24
|
+
);
|
|
25
|
+
const y = w(() => {
|
|
26
|
+
const e = v.value, c = r(o.cols, 1, e), p = r(o.gap, void 0, e), s = r(o.rowGap, void 0, e), a = r(o.colGap, void 0, e), u = r(o.rows, void 0, e), t = {
|
|
27
|
+
display: "grid",
|
|
28
|
+
gridTemplateColumns: `repeat(${c}, minmax(0, 1fr))`
|
|
29
|
+
};
|
|
30
|
+
return u && (t.gridTemplateRows = `repeat(${u}, minmax(0, 1fr))`), s || a ? (s && (t.rowGap = n(s)), a && (t.columnGap = n(a))) : p && (t.gap = n(p)), t;
|
|
31
|
+
});
|
|
32
|
+
return (e, c) => b((m(), f("div", {
|
|
33
|
+
class: "cui-grid",
|
|
34
|
+
style: g(y.value)
|
|
35
|
+
}, [
|
|
36
|
+
_(e.$slots, "default", {}, void 0, !0),
|
|
37
|
+
d(i).debug ? (m(), f("div", {
|
|
38
|
+
key: 0,
|
|
39
|
+
class: "cui-grid__debug-overlay",
|
|
40
|
+
style: g({ zIndex: 9999 - d(i).depth })
|
|
41
|
+
}, [
|
|
42
|
+
x("div", $, " Grid (depth: " + C(d(i).depth) + ") ", 1)
|
|
43
|
+
], 4)) : k("", !0)
|
|
44
|
+
], 4)), [
|
|
45
|
+
[B, !l.hidden]
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
R as default
|
|
51
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineComponent as p, computed as c, withDirectives as d, openBlock as m, createElementBlock as u, normalizeStyle as f, renderSlot as v, vShow as S } from "vue";
|
|
2
|
+
import { useBreakpoint as w } from "../composables/useBreakpoint.js";
|
|
3
|
+
import { resolveResponsive as s } from "../utils/responsive.js";
|
|
4
|
+
const k = /* @__PURE__ */ p({
|
|
5
|
+
__name: "CuiGridItem",
|
|
6
|
+
props: {
|
|
7
|
+
colSpan: {},
|
|
8
|
+
rowSpan: {},
|
|
9
|
+
hidden: { type: Boolean, default: !1 }
|
|
10
|
+
},
|
|
11
|
+
setup(i) {
|
|
12
|
+
const r = i, { breakpoint: l } = w(), a = c(() => {
|
|
13
|
+
const e = l.value, o = {}, t = s(r.colSpan, void 0, e);
|
|
14
|
+
t !== void 0 && (o.gridColumn = t === "full" ? "1 / -1" : `span ${t} / span ${t}`);
|
|
15
|
+
const n = s(r.rowSpan, void 0, e);
|
|
16
|
+
return n !== void 0 && (o.gridRow = n === "full" ? "1 / -1" : `span ${n} / span ${n}`), o;
|
|
17
|
+
});
|
|
18
|
+
return (e, o) => d((m(), u("div", {
|
|
19
|
+
class: "cui-grid-item",
|
|
20
|
+
style: f(a.value)
|
|
21
|
+
}, [
|
|
22
|
+
v(e.$slots, "default")
|
|
23
|
+
], 4)), [
|
|
24
|
+
[S, !i.hidden]
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
k as default
|
|
30
|
+
};
|