@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,72 @@
|
|
|
1
|
+
import { defineComponent as w, computed as d, ref as C, onMounted as y, watch as g, withDirectives as z, openBlock as r, createElementBlock as m, normalizeStyle as h, normalizeClass as k, createBlock as I, resolveDynamicComponent as S, unref as x, vShow as B } from "vue";
|
|
2
|
+
import { resolveColor as M } from "../utils/color.js";
|
|
3
|
+
const D = /* @__PURE__ */ w({
|
|
4
|
+
__name: "CuiIcon",
|
|
5
|
+
props: {
|
|
6
|
+
name: {},
|
|
7
|
+
weight: { default: "regular" },
|
|
8
|
+
size: { default: "md" },
|
|
9
|
+
color: { default: "currentColor" },
|
|
10
|
+
duotoneColor: {},
|
|
11
|
+
duotoneOpacity: { default: 0.2 },
|
|
12
|
+
hidden: { type: Boolean, default: !1 }
|
|
13
|
+
},
|
|
14
|
+
setup(n) {
|
|
15
|
+
const o = n, p = {
|
|
16
|
+
xs: "0.875rem",
|
|
17
|
+
// 14px
|
|
18
|
+
sm: "1rem",
|
|
19
|
+
// 16px
|
|
20
|
+
md: "1.25rem",
|
|
21
|
+
// 20px
|
|
22
|
+
lg: "1.5rem",
|
|
23
|
+
// 24px
|
|
24
|
+
xl: "2rem"
|
|
25
|
+
// 32px
|
|
26
|
+
}, a = d(() => p[o.size] ?? o.size);
|
|
27
|
+
function f(e) {
|
|
28
|
+
return "Ph" + e.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join("");
|
|
29
|
+
}
|
|
30
|
+
const i = /* @__PURE__ */ new Map(), l = C(null);
|
|
31
|
+
async function s(e) {
|
|
32
|
+
const t = f(e);
|
|
33
|
+
if (i.has(t)) {
|
|
34
|
+
l.value = i.get(t);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const u = await import("@phosphor-icons/vue");
|
|
39
|
+
let c = u[t];
|
|
40
|
+
c || (console.warn(`[CuiIcon] Icon "${e}" (${t}) not found in @phosphor-icons/vue`), c = u.PhQuestion), i.set(t, c), o.name === e && (l.value = c);
|
|
41
|
+
} catch {
|
|
42
|
+
console.warn(`[CuiIcon] Failed to load icon "${e}"`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
y(() => s(o.name)), g(() => o.name, (e) => s(e));
|
|
46
|
+
const v = d(() => {
|
|
47
|
+
const e = {};
|
|
48
|
+
return o.weight === "duotone" && (o.duotoneColor && (e["--_duotone-color"] = o.duotoneColor), e["--_duotone-opacity"] = String(o.duotoneOpacity)), e;
|
|
49
|
+
});
|
|
50
|
+
return (e, t) => z((r(), m("span", {
|
|
51
|
+
class: k(["cui-icon", { "cui-icon--duotone": n.weight === "duotone" }]),
|
|
52
|
+
style: h(v.value)
|
|
53
|
+
}, [
|
|
54
|
+
l.value ? (r(), I(S(l.value), {
|
|
55
|
+
key: 0,
|
|
56
|
+
weight: n.weight,
|
|
57
|
+
size: a.value,
|
|
58
|
+
color: x(M)(n.color)
|
|
59
|
+
}, null, 8, ["weight", "size", "color"])) : (r(), m("span", {
|
|
60
|
+
key: 1,
|
|
61
|
+
class: "cui-icon__placeholder",
|
|
62
|
+
style: h({ width: a.value, height: a.value }),
|
|
63
|
+
"aria-hidden": "true"
|
|
64
|
+
}, null, 4))
|
|
65
|
+
], 6)), [
|
|
66
|
+
[B, !n.hidden]
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export {
|
|
71
|
+
D as default
|
|
72
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { defineComponent as S, ref as _, computed as n, useTemplateRef as E, withDirectives as I, openBlock as i, createElementBlock as u, createElementVNode as m, normalizeStyle as M, normalizeClass as N, renderSlot as d, createCommentVNode as a, unref as v, createVNode as P, createBlock as h, toDisplayString as R, vShow as T } from "vue";
|
|
2
|
+
import b from "./CuiIcon.vue.js";
|
|
3
|
+
import { INPUT_SIZE_SCALE as D } from "../utils/sizing.js";
|
|
4
|
+
import { useMessages as A } from "../composables/useMessages.js";
|
|
5
|
+
const L = { class: "cui-input-wrapper" }, U = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "cui-input__prefix-button"
|
|
8
|
+
}, Z = { class: "cui-input__inner" }, j = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "cui-input__prefix"
|
|
11
|
+
}, q = ["type", "value", "placeholder", "disabled", "readonly", "aria-invalid"], F = ["aria-label"], G = ["aria-label"], H = {
|
|
12
|
+
key: 3,
|
|
13
|
+
class: "cui-input__suffix"
|
|
14
|
+
}, J = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "cui-input__suffix-button"
|
|
17
|
+
}, K = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "cui-input__error"
|
|
20
|
+
}, ee = /* @__PURE__ */ S({
|
|
21
|
+
__name: "CuiInput",
|
|
22
|
+
props: {
|
|
23
|
+
modelValue: { default: "" },
|
|
24
|
+
type: { default: "text" },
|
|
25
|
+
placeholder: {},
|
|
26
|
+
clearable: { type: Boolean, default: !1 },
|
|
27
|
+
error: { type: Boolean, default: !1 },
|
|
28
|
+
errorMessage: {},
|
|
29
|
+
readonly: { type: Boolean, default: !1 },
|
|
30
|
+
rounded: { default: "md" },
|
|
31
|
+
hidden: { type: Boolean, default: !1 },
|
|
32
|
+
color: { default: "primary" },
|
|
33
|
+
size: { default: "md" },
|
|
34
|
+
disabled: { type: Boolean, default: !1 }
|
|
35
|
+
},
|
|
36
|
+
emits: ["update:modelValue", "clear"],
|
|
37
|
+
setup(t, { expose: x, emit: g }) {
|
|
38
|
+
const k = {
|
|
39
|
+
none: "0",
|
|
40
|
+
sm: "0.25rem",
|
|
41
|
+
md: "var(--cui-button-radius, 0.375rem)",
|
|
42
|
+
lg: "0.5rem",
|
|
43
|
+
full: "9999px"
|
|
44
|
+
}, o = t, c = g, l = _(!1), y = n(() => o.type === "password"), $ = n(() => y.value && l.value ? "text" : o.type), w = n(() => o.clearable && o.modelValue && !o.disabled && !o.readonly);
|
|
45
|
+
function V() {
|
|
46
|
+
var e;
|
|
47
|
+
c("update:modelValue", ""), c("clear"), (e = r.value) == null || e.focus();
|
|
48
|
+
}
|
|
49
|
+
function z(e) {
|
|
50
|
+
c("update:modelValue", e.target.value);
|
|
51
|
+
}
|
|
52
|
+
const r = E("inputEl");
|
|
53
|
+
function C(e) {
|
|
54
|
+
var s;
|
|
55
|
+
(s = r.value) == null || s.focus(e);
|
|
56
|
+
}
|
|
57
|
+
function B() {
|
|
58
|
+
var e;
|
|
59
|
+
(e = r.value) == null || e.blur();
|
|
60
|
+
}
|
|
61
|
+
x({ el: r, focus: C, blur: B });
|
|
62
|
+
const f = n(() => D[o.size]), p = A();
|
|
63
|
+
return (e, s) => I((i(), u("div", L, [
|
|
64
|
+
m("div", {
|
|
65
|
+
class: N(["cui-input", {
|
|
66
|
+
"cui-input--error": t.error,
|
|
67
|
+
"cui-input--disabled": t.disabled,
|
|
68
|
+
"cui-input--focused": !1,
|
|
69
|
+
"cui-input--has-prefix-button": e.$slots["prefix-button"],
|
|
70
|
+
"cui-input--has-suffix-button": e.$slots["suffix-button"]
|
|
71
|
+
}]),
|
|
72
|
+
style: M({
|
|
73
|
+
borderRadius: k[t.rounded],
|
|
74
|
+
"--_input-height": f.value.height,
|
|
75
|
+
"--_input-font-size": f.value.fontSize,
|
|
76
|
+
"--_input-px": f.value.px,
|
|
77
|
+
"--_input-color": `var(--cui-${t.color})`,
|
|
78
|
+
"--_input-focus-ring": `var(--cui-${t.color}-focus-ring)`,
|
|
79
|
+
"--_input-border": t.error ? "var(--cui-error)" : "var(--cui-border-strong)",
|
|
80
|
+
"--_input-focus-border": t.error ? "var(--cui-error)" : `var(--cui-${t.color})`
|
|
81
|
+
})
|
|
82
|
+
}, [
|
|
83
|
+
e.$slots["prefix-button"] ? (i(), u("div", U, [
|
|
84
|
+
d(e.$slots, "prefix-button", {}, void 0, !0)
|
|
85
|
+
])) : a("", !0),
|
|
86
|
+
m("div", Z, [
|
|
87
|
+
e.$slots.prefix ? (i(), u("span", j, [
|
|
88
|
+
d(e.$slots, "prefix", {}, void 0, !0)
|
|
89
|
+
])) : a("", !0),
|
|
90
|
+
m("input", {
|
|
91
|
+
ref: "inputEl",
|
|
92
|
+
type: $.value,
|
|
93
|
+
value: t.modelValue,
|
|
94
|
+
placeholder: t.placeholder,
|
|
95
|
+
disabled: t.disabled,
|
|
96
|
+
readonly: t.readonly,
|
|
97
|
+
"aria-invalid": t.error || void 0,
|
|
98
|
+
class: "cui-input__native",
|
|
99
|
+
onInput: z
|
|
100
|
+
}, null, 40, q),
|
|
101
|
+
w.value ? (i(), u("button", {
|
|
102
|
+
key: 1,
|
|
103
|
+
type: "button",
|
|
104
|
+
class: "cui-input__clear",
|
|
105
|
+
tabindex: "-1",
|
|
106
|
+
"aria-label": v(p).input.clear,
|
|
107
|
+
onClick: V
|
|
108
|
+
}, [
|
|
109
|
+
P(b, {
|
|
110
|
+
name: "x",
|
|
111
|
+
size: "0.75rem"
|
|
112
|
+
})
|
|
113
|
+
], 8, F)) : a("", !0),
|
|
114
|
+
y.value ? (i(), u("button", {
|
|
115
|
+
key: 2,
|
|
116
|
+
type: "button",
|
|
117
|
+
class: "cui-input__password-toggle",
|
|
118
|
+
tabindex: "-1",
|
|
119
|
+
"aria-label": l.value ? v(p).input.hidePassword : v(p).input.showPassword,
|
|
120
|
+
onClick: s[0] || (s[0] = (O) => l.value = !l.value)
|
|
121
|
+
}, [
|
|
122
|
+
l.value ? (i(), h(b, {
|
|
123
|
+
key: 1,
|
|
124
|
+
name: "eye-slash",
|
|
125
|
+
size: "1rem"
|
|
126
|
+
})) : (i(), h(b, {
|
|
127
|
+
key: 0,
|
|
128
|
+
name: "eye",
|
|
129
|
+
size: "1rem"
|
|
130
|
+
}))
|
|
131
|
+
], 8, G)) : a("", !0),
|
|
132
|
+
e.$slots.suffix ? (i(), u("span", H, [
|
|
133
|
+
d(e.$slots, "suffix", {}, void 0, !0)
|
|
134
|
+
])) : a("", !0)
|
|
135
|
+
]),
|
|
136
|
+
e.$slots["suffix-button"] ? (i(), u("div", J, [
|
|
137
|
+
d(e.$slots, "suffix-button", {}, void 0, !0)
|
|
138
|
+
])) : a("", !0)
|
|
139
|
+
], 6),
|
|
140
|
+
t.error && t.errorMessage ? (i(), u("div", K, R(t.errorMessage), 1)) : a("", !0)
|
|
141
|
+
], 512)), [
|
|
142
|
+
[T, !t.hidden]
|
|
143
|
+
]);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
export {
|
|
147
|
+
ee as default
|
|
148
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { defineComponent as N, computed as u, useTemplateRef as y, withDirectives as A, openBlock as s, createElementBlock as c, normalizeStyle as r, toDisplayString as F, createCommentVNode as H, createVNode as a, withCtx as m, createElementVNode as W, vShow as T } from "vue";
|
|
2
|
+
import { clampSize as P } from "../utils/sizing.js";
|
|
3
|
+
import v from "./CuiButton.vue.js";
|
|
4
|
+
import b from "./CuiIcon.vue.js";
|
|
5
|
+
const L = ["value", "disabled"], O = ["value", "disabled"], G = /* @__PURE__ */ N({
|
|
6
|
+
__name: "CuiInputStepper",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: { default: 0 },
|
|
9
|
+
min: {},
|
|
10
|
+
max: {},
|
|
11
|
+
step: { default: 1 },
|
|
12
|
+
orientation: { default: "horizontal" },
|
|
13
|
+
label: {},
|
|
14
|
+
pad: {},
|
|
15
|
+
wrap: { type: Boolean, default: !1 },
|
|
16
|
+
hidden: { type: Boolean, default: !1 },
|
|
17
|
+
color: { default: "primary" },
|
|
18
|
+
size: { default: "md" },
|
|
19
|
+
disabled: { type: Boolean, default: !1 }
|
|
20
|
+
},
|
|
21
|
+
emits: ["update:modelValue"],
|
|
22
|
+
setup(t, { expose: R, emit: B }) {
|
|
23
|
+
const e = t, f = B, h = u(() => e.wrap || e.min === void 0 || e.modelValue - e.step >= e.min), p = u(() => e.wrap || e.max === void 0 || e.modelValue + e.step <= e.max);
|
|
24
|
+
function S() {
|
|
25
|
+
if (e.disabled || !h.value) return;
|
|
26
|
+
let i = Math.round((e.modelValue - e.step) * 1e10) / 1e10;
|
|
27
|
+
if (e.wrap && e.min !== void 0 && e.max !== void 0 && i < e.min) {
|
|
28
|
+
const n = e.max - e.min + 1;
|
|
29
|
+
i = e.min + Math.floor((n - 1) / e.step) * e.step;
|
|
30
|
+
} else e.min !== void 0 && (i = Math.max(i, e.min));
|
|
31
|
+
f("update:modelValue", i);
|
|
32
|
+
}
|
|
33
|
+
function V() {
|
|
34
|
+
if (e.disabled || !p.value) return;
|
|
35
|
+
let i = Math.round((e.modelValue + e.step) * 1e10) / 1e10;
|
|
36
|
+
e.wrap && e.min !== void 0 && e.max !== void 0 && i > e.max ? i = e.min : e.max !== void 0 && (i = Math.min(i, e.max)), f("update:modelValue", i);
|
|
37
|
+
}
|
|
38
|
+
const w = u(() => e.pad && e.pad > 0 ? String(e.modelValue).padStart(e.pad, "0") : String(e.modelValue)), k = u(() => e.orientation === "vertical");
|
|
39
|
+
function C(i) {
|
|
40
|
+
const n = i.target.value, l = parseFloat(n);
|
|
41
|
+
if (isNaN(l)) return;
|
|
42
|
+
let d = l;
|
|
43
|
+
e.min !== void 0 && (d = Math.max(d, e.min)), e.max !== void 0 && (d = Math.min(d, e.max)), f("update:modelValue", d);
|
|
44
|
+
}
|
|
45
|
+
const E = ["sm", "md", "lg"], I = {
|
|
46
|
+
sm: { height: "1.75rem", inputWidth: "2.5rem", font: "0.8125rem", buttonSize: "xs", iconSize: "0.75rem" },
|
|
47
|
+
md: { height: "2.25rem", inputWidth: "3rem", font: "0.875rem", buttonSize: "sm", iconSize: "0.875rem" },
|
|
48
|
+
lg: { height: "2.75rem", inputWidth: "3.5rem", font: "1rem", buttonSize: "md", iconSize: "1rem" }
|
|
49
|
+
}, o = u(() => I[P(e.size, E)]), g = y("rootEl"), z = y("inputH"), x = y("inputV");
|
|
50
|
+
function M(i) {
|
|
51
|
+
var l;
|
|
52
|
+
const n = z.value ?? x.value;
|
|
53
|
+
n ? n.focus(i) : (l = g.value) == null || l.focus(i);
|
|
54
|
+
}
|
|
55
|
+
function D() {
|
|
56
|
+
var i;
|
|
57
|
+
(i = z.value ?? x.value) == null || i.blur();
|
|
58
|
+
}
|
|
59
|
+
return R({ el: g, focus: M, blur: D }), (i, n) => A((s(), c("div", {
|
|
60
|
+
ref_key: "rootEl",
|
|
61
|
+
ref: g
|
|
62
|
+
}, [
|
|
63
|
+
t.label ? (s(), c("label", {
|
|
64
|
+
key: 0,
|
|
65
|
+
style: r({
|
|
66
|
+
display: "block",
|
|
67
|
+
marginBottom: "calc(0.25rem * var(--cui-density-scale, 1))",
|
|
68
|
+
fontWeight: "500",
|
|
69
|
+
color: "var(--cui-text-secondary)",
|
|
70
|
+
fontSize: o.value.font,
|
|
71
|
+
textAlign: k.value ? "center" : void 0
|
|
72
|
+
})
|
|
73
|
+
}, F(t.label), 5)) : H("", !0),
|
|
74
|
+
k.value ? (s(), c("div", {
|
|
75
|
+
key: 2,
|
|
76
|
+
style: r({
|
|
77
|
+
display: "inline-flex",
|
|
78
|
+
flexDirection: "column",
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
borderRadius: "var(--cui-button-radius, 0.375rem)",
|
|
81
|
+
border: "1px solid var(--cui-border-strong, var(--cui-border))",
|
|
82
|
+
opacity: t.disabled ? "0.5" : "1",
|
|
83
|
+
overflow: "hidden"
|
|
84
|
+
})
|
|
85
|
+
}, [
|
|
86
|
+
a(v, {
|
|
87
|
+
variant: "ghost",
|
|
88
|
+
size: o.value.buttonSize,
|
|
89
|
+
disabled: t.disabled || !p.value,
|
|
90
|
+
color: t.color,
|
|
91
|
+
style: r({ border: "none", borderRadius: "0", width: "100%", minWidth: o.value.inputWidth }),
|
|
92
|
+
onClick: V
|
|
93
|
+
}, {
|
|
94
|
+
default: m(() => [
|
|
95
|
+
a(b, {
|
|
96
|
+
name: "caret-up",
|
|
97
|
+
size: o.value.iconSize
|
|
98
|
+
}, null, 8, ["size"])
|
|
99
|
+
]),
|
|
100
|
+
_: 1
|
|
101
|
+
}, 8, ["size", "disabled", "color", "style"]),
|
|
102
|
+
W("input", {
|
|
103
|
+
ref_key: "inputV",
|
|
104
|
+
ref: x,
|
|
105
|
+
type: "text",
|
|
106
|
+
inputmode: "numeric",
|
|
107
|
+
value: w.value,
|
|
108
|
+
disabled: t.disabled,
|
|
109
|
+
style: r({ width: o.value.inputWidth, textAlign: "center", border: "none", borderTop: "1px solid var(--cui-border-strong, var(--cui-border))", borderBottom: "1px solid var(--cui-border-strong, var(--cui-border))", background: "var(--cui-surface-base, white)", color: "var(--cui-text-body)", fontSize: o.value.font, fontWeight: "600", outline: "none", padding: "calc(0.25rem * var(--cui-density-scale, 1)) 0", fontFamily: "inherit" }),
|
|
110
|
+
onInput: C
|
|
111
|
+
}, null, 44, O),
|
|
112
|
+
a(v, {
|
|
113
|
+
variant: "ghost",
|
|
114
|
+
size: o.value.buttonSize,
|
|
115
|
+
disabled: t.disabled || !h.value,
|
|
116
|
+
color: t.color,
|
|
117
|
+
style: { border: "none", borderRadius: "0", width: "100%" },
|
|
118
|
+
onClick: S
|
|
119
|
+
}, {
|
|
120
|
+
default: m(() => [
|
|
121
|
+
a(b, {
|
|
122
|
+
name: "caret-down",
|
|
123
|
+
size: o.value.iconSize
|
|
124
|
+
}, null, 8, ["size"])
|
|
125
|
+
]),
|
|
126
|
+
_: 1
|
|
127
|
+
}, 8, ["size", "disabled", "color"])
|
|
128
|
+
], 4)) : (s(), c("div", {
|
|
129
|
+
key: 1,
|
|
130
|
+
style: r({
|
|
131
|
+
display: "inline-flex",
|
|
132
|
+
alignItems: "center",
|
|
133
|
+
borderRadius: "var(--cui-button-radius, 0.375rem)",
|
|
134
|
+
border: "1px solid var(--cui-border-strong, var(--cui-border))",
|
|
135
|
+
opacity: t.disabled ? "0.5" : "1",
|
|
136
|
+
height: o.value.height
|
|
137
|
+
})
|
|
138
|
+
}, [
|
|
139
|
+
a(v, {
|
|
140
|
+
variant: "ghost",
|
|
141
|
+
size: o.value.buttonSize,
|
|
142
|
+
disabled: t.disabled || !h.value,
|
|
143
|
+
color: t.color,
|
|
144
|
+
style: { borderRadius: "var(--cui-button-radius, 0.375rem) 0 0 var(--cui-button-radius, 0.375rem)", border: "none", height: "100%" },
|
|
145
|
+
onClick: S
|
|
146
|
+
}, {
|
|
147
|
+
default: m(() => [
|
|
148
|
+
a(b, {
|
|
149
|
+
name: "minus",
|
|
150
|
+
size: o.value.iconSize
|
|
151
|
+
}, null, 8, ["size"])
|
|
152
|
+
]),
|
|
153
|
+
_: 1
|
|
154
|
+
}, 8, ["size", "disabled", "color"]),
|
|
155
|
+
W("input", {
|
|
156
|
+
ref_key: "inputH",
|
|
157
|
+
ref: z,
|
|
158
|
+
type: "text",
|
|
159
|
+
inputmode: "numeric",
|
|
160
|
+
value: w.value,
|
|
161
|
+
disabled: t.disabled,
|
|
162
|
+
style: r({ width: o.value.inputWidth, height: "100%", textAlign: "center", border: "none", borderLeft: "1px solid var(--cui-border-strong, var(--cui-border))", borderRight: "1px solid var(--cui-border-strong, var(--cui-border))", background: "var(--cui-surface-base, white)", color: "var(--cui-text-body)", fontSize: o.value.font, fontWeight: "600", outline: "none", padding: "0", fontFamily: "inherit" }),
|
|
163
|
+
onInput: C
|
|
164
|
+
}, null, 44, L),
|
|
165
|
+
a(v, {
|
|
166
|
+
variant: "ghost",
|
|
167
|
+
size: o.value.buttonSize,
|
|
168
|
+
disabled: t.disabled || !p.value,
|
|
169
|
+
color: t.color,
|
|
170
|
+
style: { borderRadius: "0 var(--cui-button-radius, 0.375rem) var(--cui-button-radius, 0.375rem) 0", border: "none", height: "100%" },
|
|
171
|
+
onClick: V
|
|
172
|
+
}, {
|
|
173
|
+
default: m(() => [
|
|
174
|
+
a(b, {
|
|
175
|
+
name: "plus",
|
|
176
|
+
size: o.value.iconSize
|
|
177
|
+
}, null, 8, ["size"])
|
|
178
|
+
]),
|
|
179
|
+
_: 1
|
|
180
|
+
}, 8, ["size", "disabled", "color"])
|
|
181
|
+
], 4))
|
|
182
|
+
], 512)), [
|
|
183
|
+
[T, !t.hidden]
|
|
184
|
+
]);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
export {
|
|
188
|
+
G as default
|
|
189
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineComponent as a, computed as m, withDirectives as s, openBlock as l, createElementBlock as c, normalizeStyle as p, renderSlot as u, vShow as f } from "vue";
|
|
2
|
+
import { clampSize as h, scaleDensity as e } from "../utils/sizing.js";
|
|
3
|
+
const b = /* @__PURE__ */ a({
|
|
4
|
+
__name: "CuiKbd",
|
|
5
|
+
props: {
|
|
6
|
+
hidden: { type: Boolean, default: !1 },
|
|
7
|
+
size: { default: "md" }
|
|
8
|
+
},
|
|
9
|
+
setup(r) {
|
|
10
|
+
const n = r, o = ["sm", "md", "lg"], i = {
|
|
11
|
+
sm: { fontSize: "0.6875rem", padding: `${e("0.0625rem")} ${e("0.3125rem")}`, minWidth: "1.125rem" },
|
|
12
|
+
md: { fontSize: "0.75rem", padding: `${e("0.125rem")} ${e("0.375rem")}`, minWidth: "1.375rem" },
|
|
13
|
+
lg: { fontSize: "0.8125rem", padding: `${e("0.1875rem")} ${e("0.4375rem")}`, minWidth: "1.5rem" }
|
|
14
|
+
}, t = m(() => h(n.size, o));
|
|
15
|
+
return (d, S) => s((l(), c("kbd", {
|
|
16
|
+
style: p({
|
|
17
|
+
display: "inline-flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
justifyContent: "center",
|
|
20
|
+
fontSize: i[t.value].fontSize,
|
|
21
|
+
padding: i[t.value].padding,
|
|
22
|
+
minWidth: i[t.value].minWidth,
|
|
23
|
+
fontFamily: "var(--cui-font-sans, system-ui, sans-serif)",
|
|
24
|
+
fontWeight: "500",
|
|
25
|
+
lineHeight: "1.4",
|
|
26
|
+
color: "var(--cui-text-secondary)",
|
|
27
|
+
background: "var(--cui-surface-base, white)",
|
|
28
|
+
border: "1px solid var(--cui-border)",
|
|
29
|
+
borderBottom: "2px solid var(--cui-border)",
|
|
30
|
+
borderRadius: "0.25rem",
|
|
31
|
+
boxShadow: "0 1px 0 var(--cui-border)",
|
|
32
|
+
whiteSpace: "nowrap",
|
|
33
|
+
verticalAlign: "middle"
|
|
34
|
+
})
|
|
35
|
+
}, [
|
|
36
|
+
u(d.$slots, "default")
|
|
37
|
+
], 4)), [
|
|
38
|
+
[f, !r.hidden]
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export {
|
|
43
|
+
b as default
|
|
44
|
+
};
|