@itguy614/clean-ui 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/clean-ui.css +1 -1
- package/dist/components/CuiAccordion.vue.js +2 -2
- package/dist/components/CuiAlert.vue.d.ts +3 -5
- package/dist/components/CuiAlert.vue.d.ts.map +1 -1
- package/dist/components/CuiAlert.vue.js +1 -1
- package/dist/components/CuiAlert.vue2.js +54 -50
- package/dist/components/CuiBadge.vue.js +3 -3
- package/dist/components/CuiBadge.vue2.js +23 -23
- package/dist/components/CuiBanner.vue.d.ts +15 -10
- package/dist/components/CuiBanner.vue.d.ts.map +1 -1
- package/dist/components/CuiBanner.vue.js +5 -80
- package/dist/components/CuiBanner.vue2.js +90 -2
- package/dist/components/CuiButton.vue.d.ts +9 -0
- package/dist/components/CuiButton.vue.d.ts.map +1 -1
- package/dist/components/CuiButton.vue.js +1 -1
- package/dist/components/CuiButton.vue2.js +77 -83
- package/dist/components/CuiButtonGroup.vue.d.ts +4 -2
- package/dist/components/CuiButtonGroup.vue.d.ts.map +1 -1
- package/dist/components/CuiButtonGroup.vue.js +1 -1
- package/dist/components/CuiButtonGroup.vue2.js +18 -9
- package/dist/components/CuiCard.vue.d.ts.map +1 -1
- package/dist/components/CuiCard.vue.js +5 -33
- package/dist/components/CuiCard.vue2.js +32 -2
- package/dist/components/CuiCardBody.vue.d.ts.map +1 -1
- package/dist/components/CuiCardBody.vue.js +5 -18
- package/dist/components/CuiCardBody.vue2.js +18 -2
- package/dist/components/CuiCardFooter.vue.d.ts.map +1 -1
- package/dist/components/CuiCardFooter.vue.js +5 -30
- package/dist/components/CuiCardFooter.vue2.js +25 -2
- package/dist/components/CuiCardHeader.vue.d.ts +5 -4
- package/dist/components/CuiCardHeader.vue.d.ts.map +1 -1
- package/dist/components/CuiCardHeader.vue.js +5 -49
- package/dist/components/CuiCardHeader.vue2.js +40 -2
- package/dist/components/CuiCardMedia.vue.d.ts.map +1 -1
- package/dist/components/CuiCardMedia.vue.js +3 -3
- package/dist/components/CuiCardMedia.vue2.js +6 -6
- package/dist/components/CuiCheckbox.vue.d.ts +2 -2
- package/dist/components/CuiCheckbox.vue.d.ts.map +1 -1
- package/dist/components/CuiCheckbox.vue.js +1 -1
- package/dist/components/CuiCheckbox.vue2.js +46 -34
- package/dist/components/CuiCheckboxGroup.vue.d.ts +2 -2
- package/dist/components/CuiCheckboxGroup.vue.d.ts.map +1 -1
- package/dist/components/CuiCheckboxGroup.vue.js +2 -2
- package/dist/components/CuiCheckboxGroup.vue2.js +45 -35
- package/dist/components/CuiCodeBlock.vue.d.ts.map +1 -1
- package/dist/components/CuiCodeBlock.vue.js +14 -11
- package/dist/components/CuiColorPicker.vue.d.ts +2 -2
- package/dist/components/CuiColorPicker.vue.d.ts.map +1 -1
- package/dist/components/CuiColorPicker.vue.js +117 -104
- package/dist/components/CuiCombobox.vue.d.ts +2 -2
- package/dist/components/CuiCombobox.vue.d.ts.map +1 -1
- package/dist/components/CuiCombobox.vue.js +5 -330
- package/dist/components/CuiCombobox.vue2.js +331 -2
- package/dist/components/CuiConfirmDialog.vue.d.ts +5 -4
- package/dist/components/CuiConfirmDialog.vue.d.ts.map +1 -1
- package/dist/components/CuiConfirmDialog.vue.js +84 -73
- package/dist/components/CuiContextMenu.vue.d.ts +40 -1
- package/dist/components/CuiContextMenu.vue.d.ts.map +1 -1
- package/dist/components/CuiContextMenu.vue.js +1 -1
- package/dist/components/CuiContextMenu.vue2.js +149 -91
- package/dist/components/CuiCopyButton.vue.d.ts.map +1 -1
- package/dist/components/CuiCopyButton.vue.js +5 -61
- package/dist/components/CuiCopyButton.vue2.js +68 -2
- package/dist/components/CuiDataGridCardView.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridCardView.vue.js +10 -9
- package/dist/components/CuiDataGridColumnManager.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridColumnManager.vue.js +12 -11
- package/dist/components/CuiDataGridPagination.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridPagination.vue.js +9 -8
- package/dist/components/CuiDataGridSearch.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridSearch.vue.js +12 -9
- package/dist/components/CuiDataGridTable.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridTable.vue.js +1 -0
- package/dist/components/CuiDataGridViewManager.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridViewManager.vue.js +17 -17
- package/dist/components/CuiDatePicker.vue.d.ts +2 -2
- package/dist/components/CuiDatePicker.vue.d.ts.map +1 -1
- package/dist/components/CuiDatePicker.vue.js +257 -173
- package/dist/components/CuiDateRangePicker.vue.d.ts +2 -2
- package/dist/components/CuiDateRangePicker.vue.d.ts.map +1 -1
- package/dist/components/CuiDateRangePicker.vue.js +262 -179
- package/dist/components/CuiDivider.vue.d.ts.map +1 -1
- package/dist/components/CuiDivider.vue.js +17 -13
- package/dist/components/CuiDropdownMenu.vue.js +2 -2
- package/dist/components/CuiDropdownRadioGroup.vue.d.ts +4 -1
- package/dist/components/CuiDropdownRadioGroup.vue.d.ts.map +1 -1
- package/dist/components/CuiDropdownRadioGroup.vue.js +27 -14
- package/dist/components/CuiDropdownSub.vue.js +2 -2
- package/dist/components/CuiEmptyState.vue.d.ts +5 -4
- package/dist/components/CuiEmptyState.vue.d.ts.map +1 -1
- package/dist/components/CuiEmptyState.vue.js +1 -1
- package/dist/components/CuiEmptyState.vue2.js +30 -24
- package/dist/components/CuiFieldset.vue.d.ts.map +1 -1
- package/dist/components/CuiFieldset.vue.js +1 -1
- package/dist/components/CuiFieldset.vue2.js +21 -21
- package/dist/components/CuiFileUpload.vue.d.ts +2 -2
- package/dist/components/CuiFileUpload.vue.d.ts.map +1 -1
- package/dist/components/CuiFileUpload.vue.js +70 -57
- package/dist/components/CuiFormField.vue.d.ts.map +1 -1
- package/dist/components/CuiFormField.vue.js +2 -2
- package/dist/components/CuiFormField.vue2.js +48 -42
- package/dist/components/CuiInput.vue.d.ts +2 -2
- package/dist/components/CuiInput.vue.d.ts.map +1 -1
- package/dist/components/CuiInput.vue.js +1 -1
- package/dist/components/CuiInput.vue2.js +97 -85
- package/dist/components/CuiInputStepper.vue.d.ts +2 -2
- package/dist/components/CuiInputStepper.vue.d.ts.map +1 -1
- package/dist/components/CuiInputStepper.vue.js +5 -187
- package/dist/components/CuiInputStepper.vue2.js +237 -2
- package/dist/components/CuiKbd.vue.d.ts.map +1 -1
- package/dist/components/CuiKbd.vue.js +6 -5
- package/dist/components/CuiMaskedInput.vue.d.ts +9 -3
- package/dist/components/CuiMaskedInput.vue.d.ts.map +1 -1
- package/dist/components/CuiMaskedInput.vue.js +132 -117
- package/dist/components/CuiModal.vue.d.ts +10 -2
- package/dist/components/CuiModal.vue.d.ts.map +1 -1
- package/dist/components/CuiModal.vue.js +2 -2
- package/dist/components/CuiModal.vue2.js +48 -44
- package/dist/components/CuiModalBody.vue.d.ts.map +1 -1
- package/dist/components/CuiModalBody.vue.js +16 -13
- package/dist/components/CuiModalFooter.vue.d.ts.map +1 -1
- package/dist/components/CuiModalFooter.vue.js +3 -2
- package/dist/components/CuiModalHeader.vue.d.ts +13 -4
- package/dist/components/CuiModalHeader.vue.d.ts.map +1 -1
- package/dist/components/CuiModalHeader.vue.js +54 -42
- package/dist/components/CuiPagination.vue.js +2 -2
- package/dist/components/CuiPopover.vue.d.ts.map +1 -1
- package/dist/components/CuiPopover.vue.js +70 -65
- package/dist/components/CuiRadio.vue.d.ts +2 -4
- package/dist/components/CuiRadio.vue.d.ts.map +1 -1
- package/dist/components/CuiRadio.vue.js +2 -2
- package/dist/components/CuiRadio.vue2.js +88 -74
- package/dist/components/CuiRadioGroup.vue.d.ts +2 -2
- package/dist/components/CuiRadioGroup.vue.d.ts.map +1 -1
- package/dist/components/CuiRadioGroup.vue.js +3 -3
- package/dist/components/CuiRadioGroup.vue2.js +47 -37
- package/dist/components/CuiRating.vue.d.ts.map +1 -1
- package/dist/components/CuiRating.vue.js +15 -14
- package/dist/components/CuiResizablePanels.vue.d.ts.map +1 -1
- package/dist/components/CuiResizablePanels.vue.js +10 -9
- package/dist/components/CuiSelect.vue.d.ts +2 -2
- package/dist/components/CuiSelect.vue.d.ts.map +1 -1
- package/dist/components/CuiSelect.vue.js +2 -2
- package/dist/components/CuiSelect.vue2.js +161 -151
- package/dist/components/CuiSkeleton.vue.js +2 -2
- package/dist/components/CuiSkeleton.vue2.js +10 -10
- package/dist/components/CuiSlideover.vue.d.ts +2 -2
- package/dist/components/CuiSlideover.vue.d.ts.map +1 -1
- package/dist/components/CuiSlideover.vue.js +34 -30
- package/dist/components/CuiSlider.vue.d.ts +2 -2
- package/dist/components/CuiSlider.vue.d.ts.map +1 -1
- package/dist/components/CuiSlider.vue.js +67 -54
- package/dist/components/CuiSpinner.vue.d.ts.map +1 -1
- package/dist/components/CuiSpinner.vue.js +5 -4
- package/dist/components/CuiTable.vue.d.ts.map +1 -1
- package/dist/components/CuiTable.vue.js +4 -1
- package/dist/components/CuiTableBody.vue.d.ts.map +1 -1
- package/dist/components/CuiTableBody.vue.js +6 -6
- package/dist/components/CuiTableCell.vue.d.ts.map +1 -1
- package/dist/components/CuiTableCell.vue.js +11 -10
- package/dist/components/CuiTableFoot.vue.d.ts.map +1 -1
- package/dist/components/CuiTableFoot.vue.js +7 -7
- package/dist/components/CuiTableHead.vue.d.ts.map +1 -1
- package/dist/components/CuiTableHead.vue.js +7 -7
- package/dist/components/CuiTabs.vue.d.ts.map +1 -1
- package/dist/components/CuiTabs.vue.js +1 -1
- package/dist/components/CuiTabs.vue2.js +1 -0
- package/dist/components/CuiTagInput.vue.d.ts +2 -2
- package/dist/components/CuiTagInput.vue.d.ts.map +1 -1
- package/dist/components/CuiTagInput.vue.js +5 -294
- package/dist/components/CuiTagInput.vue2.js +277 -2
- package/dist/components/CuiTextarea.vue.d.ts +2 -2
- package/dist/components/CuiTextarea.vue.d.ts.map +1 -1
- package/dist/components/CuiTextarea.vue.js +4 -4
- package/dist/components/CuiTextarea.vue2.js +73 -59
- package/dist/components/CuiTimePicker.vue.d.ts +2 -2
- package/dist/components/CuiTimePicker.vue.d.ts.map +1 -1
- package/dist/components/CuiTimePicker.vue.js +172 -97
- package/dist/components/CuiTimeline.vue.d.ts.map +1 -1
- package/dist/components/CuiTimeline.vue.js +6 -5
- package/dist/components/CuiTimelineItem.vue.d.ts.map +1 -1
- package/dist/components/CuiTimelineItem.vue.js +11 -10
- package/dist/components/CuiToast.vue.d.ts +8 -10
- package/dist/components/CuiToast.vue.d.ts.map +1 -1
- package/dist/components/CuiToast.vue.js +2 -2
- package/dist/components/CuiToast.vue2.js +69 -67
- package/dist/components/CuiToggle.vue.d.ts +2 -2
- package/dist/components/CuiToggle.vue.d.ts.map +1 -1
- package/dist/components/CuiToggle.vue.js +2 -2
- package/dist/components/CuiToggle.vue2.js +71 -59
- package/dist/components/CuiToggleGroup.vue.d.ts +2 -2
- package/dist/components/CuiToggleGroup.vue.d.ts.map +1 -1
- package/dist/components/CuiToggleGroup.vue.js +2 -2
- package/dist/components/CuiToggleGroup.vue2.js +45 -35
- package/dist/components/CuiTooltip.vue.d.ts.map +1 -1
- package/dist/components/CuiTooltip.vue.js +2 -2
- package/dist/components/CuiTooltip.vue2.js +47 -44
- package/dist/components/CuiTransferList.vue.d.ts.map +1 -1
- package/dist/components/CuiTransferList.vue.js +31 -30
- package/dist/components/CuiTreeNode.vue.d.ts +9 -2
- package/dist/components/CuiTreeNode.vue.d.ts.map +1 -1
- package/dist/components/CuiTreeNode.vue.js +5 -179
- package/dist/components/CuiTreeNode.vue2.js +198 -2
- package/dist/components/CuiTreeView.vue.d.ts +33 -5
- package/dist/components/CuiTreeView.vue.d.ts.map +1 -1
- package/dist/components/CuiTreeView.vue.js +187 -44
- package/dist/composables/useCalendarKeyboard.d.ts +48 -0
- package/dist/composables/useCalendarKeyboard.d.ts.map +1 -0
- package/dist/composables/useCalendarKeyboard.js +91 -0
- package/dist/composables/useFieldDescribedBy.d.ts +30 -0
- package/dist/composables/useFieldDescribedBy.d.ts.map +1 -0
- package/dist/composables/useFieldDescribedBy.js +11 -0
- package/dist/composables/useMessages.d.ts.map +1 -1
- package/dist/composables/useMessages.js +6 -6
- package/dist/composables/usePopover.d.ts.map +1 -1
- package/dist/composables/usePopover.js +10 -0
- package/dist/composables/useScrollShadows.d.ts +3 -0
- package/dist/composables/useScrollShadows.d.ts.map +1 -1
- package/dist/composables/useScrollShadows.js +15 -12
- package/dist/icons/builtin.d.ts.map +1 -1
- package/dist/icons/builtin.js +38 -37
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +185 -182
- package/dist/messages.d.ts +39 -4
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +8 -7
- package/dist/types/common.d.ts +90 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/utils/colorIconMap.d.ts +47 -3
- package/dist/utils/colorIconMap.d.ts.map +1 -1
- package/dist/utils/colorIconMap.js +20 -5
- package/dist/utils/date.d.ts +13 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +46 -40
- package/dist/utils/sizing.d.ts +26 -1
- package/dist/utils/sizing.d.ts.map +1 -1
- package/dist/utils/sizing.js +22 -21
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CuiTagInput.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiTagInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CuiTagInput.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiTagInput.vue"],"names":[],"mappings":"AAihBA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAOzJ,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB;IAC1H,oBAAoB;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,iCAAiC;IACjC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC;IAC1B,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAC3D,0DAA0D;IAC1D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oBAAoB;IACpB,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AA2PD,iBAAS,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,QAGjC;AAED,iBAAS,IAAI,SAEZ;AAkOD,QAAA,IAAI,QAAQ;;CAAY,CAAE;AAC1B,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAmDnD,QAAA,MAAM,eAAe;;;;;;;;;WApiBX,OAAO;YAQN,OAAO;;;aAEN,UAAU;;iBAdN,MAAM;gBAdP,MAAM,EAAE;cAQV,MAAM;cAEN,MAAM;iBARH,SAAS,EAAE;iBAIX,OAAO;aAMX,MAAM;uBAUI,MAAM;gBAEb,MAAM;6EAuiBnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAa1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,296 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import pe from "./CuiSpinner.vue.js";
|
|
6
|
-
/* empty css */
|
|
7
|
-
const ye = {
|
|
8
|
-
key: 0,
|
|
9
|
-
style: { display: "block", marginBottom: "calc(0.25rem * var(--cui-density-scale, 1))", fontSize: "0.875rem", fontWeight: "500", color: "var(--cui-text-secondary)" }
|
|
10
|
-
}, be = ["value", "placeholder", "disabled"], he = {
|
|
11
|
-
key: 1,
|
|
12
|
-
style: { fontSize: "0.75rem", color: "var(--cui-error)", marginTop: "calc(0.25rem * var(--cui-density-scale, 1))" }
|
|
13
|
-
}, xe = {
|
|
14
|
-
key: 0,
|
|
15
|
-
style: { padding: "calc(0.75rem * var(--cui-density-scale, 1))", textAlign: "center" }
|
|
16
|
-
}, we = ["data-index", "onClick", "onMouseenter"], Me = /* @__PURE__ */ le({
|
|
17
|
-
__name: "CuiTagInput",
|
|
18
|
-
props: {
|
|
19
|
-
modelValue: { default: () => [] },
|
|
20
|
-
suggestions: { default: () => [] },
|
|
21
|
-
fetchSuggestions: {},
|
|
22
|
-
allowCreate: { type: Boolean, default: !0 },
|
|
23
|
-
debounce: { default: 300 },
|
|
24
|
-
minChars: { default: 0 },
|
|
25
|
-
maxTags: { default: 0 },
|
|
26
|
-
placeholder: { default: "Add tag..." },
|
|
27
|
-
label: {},
|
|
28
|
-
error: { type: Boolean, default: !1 },
|
|
29
|
-
errorMessage: {},
|
|
30
|
-
noSuggestionsText: { default: "No suggestions" },
|
|
31
|
-
createText: { default: "Create" },
|
|
32
|
-
hidden: { type: Boolean, default: !1 },
|
|
33
|
-
rounded: { default: "md" },
|
|
34
|
-
color: { default: "primary" },
|
|
35
|
-
size: { default: "md" },
|
|
36
|
-
disabled: { type: Boolean, default: !1 }
|
|
37
|
-
},
|
|
38
|
-
emits: ["update:modelValue"],
|
|
39
|
-
setup(r, { expose: K, emit: Y }) {
|
|
40
|
-
const l = r, Z = {
|
|
41
|
-
none: "0",
|
|
42
|
-
sm: "0.25rem",
|
|
43
|
-
md: "var(--cui-button-radius, 0.375rem)",
|
|
44
|
-
lg: "0.5rem",
|
|
45
|
-
full: "9999px"
|
|
46
|
-
}, B = Y, o = v(""), c = v(!1), u = v(-1), V = v(!1), m = v([]), f = v(null), E = v(null), g = v(null), I = v({});
|
|
47
|
-
let S = null;
|
|
48
|
-
const z = h(() => new Set(l.modelValue)), C = h(() => l.maxTags > 0 && l.modelValue.length >= l.maxTags);
|
|
49
|
-
function j(e) {
|
|
50
|
-
const a = [...l.suggestions, ...m.value].find((t) => t.value === e);
|
|
51
|
-
return (a == null ? void 0 : a.label) ?? e;
|
|
52
|
-
}
|
|
53
|
-
function G(e) {
|
|
54
|
-
const a = [...l.suggestions, ...m.value].find((t) => t.value === e);
|
|
55
|
-
return (a == null ? void 0 : a.color) ?? l.color;
|
|
56
|
-
}
|
|
57
|
-
const i = h(() => {
|
|
58
|
-
const a = (l.fetchSuggestions ? m.value : l.suggestions).filter((n) => !z.value.has(n.value));
|
|
59
|
-
if (!o.value || l.fetchSuggestions) return a;
|
|
60
|
-
const t = o.value.toLowerCase();
|
|
61
|
-
return a.filter(
|
|
62
|
-
(n) => n.value.toLowerCase().includes(t) || n.label && n.label.toLowerCase().includes(t)
|
|
63
|
-
);
|
|
64
|
-
}), p = h(() => {
|
|
65
|
-
if (!l.allowCreate || !o.value.trim() || C.value) return !1;
|
|
66
|
-
const e = o.value.trim().toLowerCase();
|
|
67
|
-
return z.value.has(e) || z.value.has(o.value.trim()) ? !1 : ![...l.suggestions, ...m.value].map((t) => t.value.toLowerCase()).includes(e);
|
|
68
|
-
}), D = h(() => V.value), J = ["sm", "md", "lg"], Q = {
|
|
69
|
-
sm: { fontSize: "0.8125rem", padding: "calc(0.25rem * var(--cui-density-scale, 1)) calc(0.5rem * var(--cui-density-scale, 1))", tagSize: "sm", inputHeight: "2rem" },
|
|
70
|
-
md: { fontSize: "0.875rem", padding: "calc(0.3125rem * var(--cui-density-scale, 1)) calc(0.625rem * var(--cui-density-scale, 1))", tagSize: "sm", inputHeight: "2.375rem" },
|
|
71
|
-
lg: { fontSize: "0.9375rem", padding: "calc(0.4375rem * var(--cui-density-scale, 1)) calc(0.75rem * var(--cui-density-scale, 1))", tagSize: "md", inputHeight: "2.75rem" }
|
|
72
|
-
}, y = h(() => Q[fe(l.size, J)]);
|
|
73
|
-
function b() {
|
|
74
|
-
if (!g.value) return;
|
|
75
|
-
const e = g.value.getBoundingClientRect(), a = window.innerHeight, t = a - e.bottom, n = t < 200 && e.top > t, M = Math.min(240, Math.max(t, e.top) - 16), R = {
|
|
76
|
-
position: "fixed",
|
|
77
|
-
zIndex: "9990",
|
|
78
|
-
left: `${e.left}px`,
|
|
79
|
-
width: `${e.width}px`,
|
|
80
|
-
maxHeight: `${M}px`,
|
|
81
|
-
overflowY: "auto",
|
|
82
|
-
background: "var(--cui-surface-base)",
|
|
83
|
-
border: "1px solid var(--cui-border)",
|
|
84
|
-
borderRadius: "0.5rem",
|
|
85
|
-
boxShadow: "0 8px 24px -4px rgba(0,0,0,0.12), 0 2px 8px -2px rgba(0,0,0,0.08)",
|
|
86
|
-
padding: "calc(0.25rem * var(--cui-density-scale, 1))"
|
|
87
|
-
};
|
|
88
|
-
n ? R.bottom = `${a - e.top + 4}px` : R.top = `${e.bottom + 4}px`, I.value = R;
|
|
89
|
-
}
|
|
90
|
-
function X(e) {
|
|
91
|
-
if (o.value = e.target.value, u.value = -1, c.value || (c.value = !0, b()), l.fetchSuggestions) {
|
|
92
|
-
if (o.value.length < l.minChars) {
|
|
93
|
-
m.value = [];
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
S && clearTimeout(S), S = setTimeout(async () => {
|
|
97
|
-
V.value = !0;
|
|
98
|
-
try {
|
|
99
|
-
m.value = await l.fetchSuggestions(o.value);
|
|
100
|
-
} finally {
|
|
101
|
-
V.value = !1;
|
|
102
|
-
}
|
|
103
|
-
}, l.debounce);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function H(e) {
|
|
107
|
-
if (l.disabled || C.value) return;
|
|
108
|
-
const a = e.trim();
|
|
109
|
-
!a || z.value.has(a) || (B("update:modelValue", [...l.modelValue, a]), o.value = "", u.value = -1, L(() => {
|
|
110
|
-
var t;
|
|
111
|
-
return (t = f.value) == null ? void 0 : t.focus();
|
|
112
|
-
}));
|
|
113
|
-
}
|
|
114
|
-
function A(e) {
|
|
115
|
-
H(e.value);
|
|
116
|
-
}
|
|
117
|
-
function T() {
|
|
118
|
-
p.value && H(o.value.trim());
|
|
119
|
-
}
|
|
120
|
-
function N(e) {
|
|
121
|
-
l.disabled || (B("update:modelValue", l.modelValue.filter((a) => a !== e)), L(() => {
|
|
122
|
-
var a;
|
|
123
|
-
return (a = f.value) == null ? void 0 : a.focus();
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
function _(e) {
|
|
127
|
-
const a = i.value.length + (p.value ? 1 : 0);
|
|
128
|
-
if (e.key === "ArrowDown") {
|
|
129
|
-
if (e.preventDefault(), !c.value) {
|
|
130
|
-
c.value = !0, b();
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
u.value = Math.min(u.value + 1, a - 1);
|
|
134
|
-
} else e.key === "ArrowUp" ? (e.preventDefault(), u.value = Math.max(u.value - 1, 0)) : e.key === "Enter" ? (e.preventDefault(), u.value >= 0 && u.value < i.value.length ? A(i.value[u.value]) : (p.value && (u.value === i.value.length || u.value === -1) || p.value && o.value.trim()) && T()) : e.key === "," || e.key === "Tab" ? o.value.trim() && l.allowCreate && (e.preventDefault(), T()) : e.key === "Escape" ? c.value = !1 : e.key === "Backspace" && !o.value && l.modelValue.length > 0 && N(l.modelValue[l.modelValue.length - 1]);
|
|
135
|
-
}
|
|
136
|
-
function W(e) {
|
|
137
|
-
var t, n;
|
|
138
|
-
const a = e.target;
|
|
139
|
-
(t = g.value) != null && t.contains(a) || (n = E.value) != null && n.contains(a) || (c.value = !1);
|
|
140
|
-
}
|
|
141
|
-
function ee() {
|
|
142
|
-
!l.disabled && !C.value && (c.value = !0, b());
|
|
143
|
-
}
|
|
144
|
-
ne(() => {
|
|
145
|
-
document.addEventListener("mousedown", W), window.addEventListener("scroll", () => {
|
|
146
|
-
c.value && b();
|
|
147
|
-
}, !0), window.addEventListener("resize", () => {
|
|
148
|
-
c.value && b();
|
|
149
|
-
});
|
|
150
|
-
}), re(() => {
|
|
151
|
-
document.removeEventListener("mousedown", W), S && clearTimeout(S);
|
|
152
|
-
}), oe(c, (e) => {
|
|
153
|
-
e || (o.value = ""), e && L(b);
|
|
154
|
-
});
|
|
155
|
-
function ae(e) {
|
|
156
|
-
var a;
|
|
157
|
-
f.value ? f.value.focus(e) : (a = g.value) == null || a.focus(e);
|
|
158
|
-
}
|
|
159
|
-
function te() {
|
|
160
|
-
var e;
|
|
161
|
-
(e = f.value) == null || e.blur();
|
|
162
|
-
}
|
|
163
|
-
return K({ el: g, focus: ae, blur: te }), (e, a) => ue((s(), d("div", {
|
|
164
|
-
ref_key: "wrapperRef",
|
|
165
|
-
ref: g,
|
|
166
|
-
style: { position: "relative" }
|
|
167
|
-
}, [
|
|
168
|
-
r.label ? (s(), d("label", ye, x(r.label), 1)) : w("", !0),
|
|
169
|
-
$("div", {
|
|
170
|
-
style: k({
|
|
171
|
-
display: "flex",
|
|
172
|
-
flexWrap: "wrap",
|
|
173
|
-
alignItems: "center",
|
|
174
|
-
gap: "calc(0.25rem * var(--cui-density-scale, 1))",
|
|
175
|
-
padding: y.value.padding,
|
|
176
|
-
border: `1px solid ${r.error ? "var(--cui-error)" : "var(--cui-border-strong, var(--cui-border))"}`,
|
|
177
|
-
borderRadius: Z[r.rounded],
|
|
178
|
-
background: "var(--cui-surface-base, white)",
|
|
179
|
-
cursor: r.disabled ? "default" : "text",
|
|
180
|
-
opacity: r.disabled ? "0.5" : "1",
|
|
181
|
-
minHeight: y.value.inputHeight
|
|
182
|
-
}),
|
|
183
|
-
onClick: a[0] || (a[0] = (t) => {
|
|
184
|
-
var n;
|
|
185
|
-
return (n = f.value) == null ? void 0 : n.focus();
|
|
186
|
-
})
|
|
187
|
-
}, [
|
|
188
|
-
(s(!0), d(q, null, F(r.modelValue, (t) => (s(), O(ge, {
|
|
189
|
-
key: t,
|
|
190
|
-
color: G(t),
|
|
191
|
-
size: y.value.tagSize,
|
|
192
|
-
removable: "",
|
|
193
|
-
onRemove: (n) => N(t)
|
|
194
|
-
}, {
|
|
195
|
-
default: ie(() => [
|
|
196
|
-
se(x(j(t)), 1)
|
|
197
|
-
]),
|
|
198
|
-
_: 2
|
|
199
|
-
}, 1032, ["color", "size", "onRemove"]))), 128)),
|
|
200
|
-
C.value ? w("", !0) : (s(), d("input", {
|
|
201
|
-
key: 0,
|
|
202
|
-
ref_key: "inputRef",
|
|
203
|
-
ref: f,
|
|
204
|
-
value: o.value,
|
|
205
|
-
placeholder: r.modelValue.length > 0 ? "" : r.placeholder,
|
|
206
|
-
disabled: r.disabled,
|
|
207
|
-
style: k({
|
|
208
|
-
flex: "1",
|
|
209
|
-
minWidth: "4rem",
|
|
210
|
-
border: "none",
|
|
211
|
-
outline: "none",
|
|
212
|
-
background: "transparent",
|
|
213
|
-
fontSize: y.value.fontSize,
|
|
214
|
-
color: "var(--cui-text-body)",
|
|
215
|
-
padding: "calc(0.125rem * var(--cui-density-scale, 1)) 0",
|
|
216
|
-
fontFamily: "inherit"
|
|
217
|
-
}),
|
|
218
|
-
onInput: X,
|
|
219
|
-
onFocus: ee,
|
|
220
|
-
onKeydown: _
|
|
221
|
-
}, null, 44, be))
|
|
222
|
-
], 4),
|
|
223
|
-
r.error && r.errorMessage ? (s(), d("div", he, x(r.errorMessage), 1)) : w("", !0),
|
|
224
|
-
(s(), O(ce, { to: "body" }, [
|
|
225
|
-
c.value && (i.value.length > 0 || p.value || D.value) ? (s(), d("div", {
|
|
226
|
-
key: 0,
|
|
227
|
-
ref_key: "dropdownRef",
|
|
228
|
-
ref: E,
|
|
229
|
-
style: k(I.value)
|
|
230
|
-
}, [
|
|
231
|
-
D.value && i.value.length === 0 ? (s(), d("div", xe, [
|
|
232
|
-
P(pe, {
|
|
233
|
-
size: "xs",
|
|
234
|
-
"show-label": "",
|
|
235
|
-
label: "Searching..."
|
|
236
|
-
})
|
|
237
|
-
])) : w("", !0),
|
|
238
|
-
(s(!0), d(q, null, F(i.value, (t, n) => (s(), d("div", {
|
|
239
|
-
key: t.value,
|
|
240
|
-
"data-index": n,
|
|
241
|
-
style: k({
|
|
242
|
-
display: "flex",
|
|
243
|
-
alignItems: "center",
|
|
244
|
-
gap: "calc(0.5rem * var(--cui-density-scale, 1))",
|
|
245
|
-
padding: "calc(0.4375rem * var(--cui-density-scale, 1)) calc(0.625rem * var(--cui-density-scale, 1))",
|
|
246
|
-
cursor: "pointer",
|
|
247
|
-
fontSize: y.value.fontSize,
|
|
248
|
-
borderRadius: "0.25rem",
|
|
249
|
-
background: u.value === n ? "var(--cui-primary-bg)" : "transparent",
|
|
250
|
-
color: "var(--cui-text-body)",
|
|
251
|
-
transition: "background 0.1s ease"
|
|
252
|
-
}),
|
|
253
|
-
onClick: U((M) => A(t), ["stop"]),
|
|
254
|
-
onMouseenter: (M) => u.value = n
|
|
255
|
-
}, [
|
|
256
|
-
de(e.$slots, "suggestion", { suggestion: t }, () => [
|
|
257
|
-
$("span", null, x(t.label || t.value), 1)
|
|
258
|
-
])
|
|
259
|
-
], 44, we))), 128)),
|
|
260
|
-
p.value ? (s(), d("div", {
|
|
261
|
-
key: 1,
|
|
262
|
-
style: k({
|
|
263
|
-
display: "flex",
|
|
264
|
-
alignItems: "center",
|
|
265
|
-
gap: "calc(0.375rem * var(--cui-density-scale, 1))",
|
|
266
|
-
padding: "calc(0.4375rem * var(--cui-density-scale, 1)) calc(0.625rem * var(--cui-density-scale, 1))",
|
|
267
|
-
cursor: "pointer",
|
|
268
|
-
fontSize: y.value.fontSize,
|
|
269
|
-
borderRadius: "0.25rem",
|
|
270
|
-
background: u.value === i.value.length ? "var(--cui-primary-bg)" : "transparent",
|
|
271
|
-
color: "var(--cui-primary)",
|
|
272
|
-
fontWeight: "500",
|
|
273
|
-
transition: "background 0.1s ease",
|
|
274
|
-
borderTop: i.value.length > 0 ? "1px solid color-mix(in srgb, var(--cui-border) 50%, transparent)" : "none",
|
|
275
|
-
marginTop: i.value.length > 0 ? "calc(0.125rem * var(--cui-density-scale, 1))" : "0",
|
|
276
|
-
paddingTop: i.value.length > 0 ? "calc(0.5rem * var(--cui-density-scale, 1))" : void 0
|
|
277
|
-
}),
|
|
278
|
-
onClick: U(T, ["stop"]),
|
|
279
|
-
onMouseenter: a[1] || (a[1] = (t) => u.value = i.value.length)
|
|
280
|
-
}, [
|
|
281
|
-
P(me, {
|
|
282
|
-
name: "plus",
|
|
283
|
-
size: "0.75rem"
|
|
284
|
-
}),
|
|
285
|
-
$("span", null, x(r.createText) + " “" + x(o.value.trim()) + "”", 1)
|
|
286
|
-
], 36)) : w("", !0)
|
|
287
|
-
], 4)) : w("", !0)
|
|
288
|
-
]))
|
|
289
|
-
], 512)), [
|
|
290
|
-
[ve, !r.hidden]
|
|
291
|
-
]);
|
|
292
|
-
}
|
|
293
|
-
});
|
|
1
|
+
import o from "./CuiTagInput.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import t from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ca6016d3"]]);
|
|
294
5
|
export {
|
|
295
|
-
|
|
6
|
+
m as default
|
|
296
7
|
};
|
|
@@ -1,4 +1,279 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent as se, ref as c, computed as b, onMounted as de, onUnmounted as ce, watch as ve, nextTick as B, withDirectives as fe, openBlock as r, createElementBlock as v, normalizeStyle as M, toDisplayString as h, createCommentVNode as y, createElementVNode as R, normalizeClass as $, Fragment as O, renderList as U, createBlock as K, withCtx as me, createTextVNode as ge, unref as W, Teleport as pe, createVNode as Y, withModifiers as Z, renderSlot as be, vShow as he } from "vue";
|
|
2
|
+
import { INPUT_SIZE_SCALE as ye, nestedSize as we, scaleDensity as xe } from "../utils/sizing.js";
|
|
3
|
+
import { useFieldDescribedBy as ke } from "../composables/useFieldDescribedBy.js";
|
|
4
|
+
import Ce from "./CuiIcon.vue.js";
|
|
5
|
+
import Se from "./CuiBadge.vue.js";
|
|
6
|
+
import Te from "./CuiSpinner.vue.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
const Ve = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "cui-tag-input__label"
|
|
11
|
+
}, ze = ["id", "name", "autocomplete", "aria-describedby", "aria-required", "aria-labelledby", "value", "placeholder", "disabled"], Le = ["id"], Be = {
|
|
12
|
+
key: 0,
|
|
13
|
+
style: { padding: "calc(0.75rem * var(--cui-density-scale, 1))", textAlign: "center" }
|
|
14
|
+
}, Me = ["data-index", "onClick", "onMouseenter"], Ae = /* @__PURE__ */ se({
|
|
15
|
+
__name: "CuiTagInput",
|
|
16
|
+
props: {
|
|
17
|
+
modelValue: { default: () => [] },
|
|
18
|
+
suggestions: { default: () => [] },
|
|
19
|
+
fetchSuggestions: {},
|
|
20
|
+
allowCreate: { type: Boolean, default: !0 },
|
|
21
|
+
debounce: { default: 300 },
|
|
22
|
+
minChars: { default: 0 },
|
|
23
|
+
maxTags: { default: 0 },
|
|
24
|
+
placeholder: { default: "Add tag..." },
|
|
25
|
+
label: {},
|
|
26
|
+
error: { type: Boolean, default: !1 },
|
|
27
|
+
errorMessage: {},
|
|
28
|
+
noSuggestionsText: { default: "No suggestions" },
|
|
29
|
+
createText: { default: "Create" },
|
|
30
|
+
hidden: { type: Boolean, default: !1 },
|
|
31
|
+
rounded: { default: "md" },
|
|
32
|
+
name: {},
|
|
33
|
+
autocomplete: {},
|
|
34
|
+
id: {},
|
|
35
|
+
ariaDescribedby: {},
|
|
36
|
+
ariaLabelledby: {},
|
|
37
|
+
ariaRequired: { type: Boolean },
|
|
38
|
+
color: { default: "primary" },
|
|
39
|
+
size: { default: "md" },
|
|
40
|
+
disabled: { type: Boolean, default: !1 }
|
|
41
|
+
},
|
|
42
|
+
emits: ["update:modelValue"],
|
|
43
|
+
setup(u, { expose: j, emit: G }) {
|
|
44
|
+
const l = u, { errorId: J, describedBy: Q } = ke(l), X = {
|
|
45
|
+
none: "0",
|
|
46
|
+
sm: "var(--cui-radius-sm, 0.25rem)",
|
|
47
|
+
md: "var(--cui-button-radius, var(--cui-radius-md, 0.375rem))",
|
|
48
|
+
lg: "var(--cui-radius-lg, 0.5rem)",
|
|
49
|
+
full: "9999px"
|
|
50
|
+
}, D = G, o = c(""), s = c(!1), i = c(-1), V = c(!1), m = c([]), f = c(null), _ = c(null), w = c(null), E = c(null), I = c({});
|
|
51
|
+
let x = null;
|
|
52
|
+
const k = b(() => new Set(l.modelValue)), C = b(() => l.maxTags > 0 && l.modelValue.length >= l.maxTags);
|
|
53
|
+
function ee(e) {
|
|
54
|
+
const t = [...l.suggestions, ...m.value].find((a) => a.value === e);
|
|
55
|
+
return (t == null ? void 0 : t.label) ?? e;
|
|
56
|
+
}
|
|
57
|
+
function te(e) {
|
|
58
|
+
const t = [...l.suggestions, ...m.value].find((a) => a.value === e);
|
|
59
|
+
return (t == null ? void 0 : t.color) ?? l.color;
|
|
60
|
+
}
|
|
61
|
+
const d = b(() => {
|
|
62
|
+
const t = (l.fetchSuggestions ? m.value : l.suggestions).filter((n) => !k.value.has(n.value));
|
|
63
|
+
if (!o.value || l.fetchSuggestions) return t;
|
|
64
|
+
const a = o.value.toLowerCase();
|
|
65
|
+
return t.filter(
|
|
66
|
+
(n) => n.value.toLowerCase().includes(a) || n.label && n.label.toLowerCase().includes(a)
|
|
67
|
+
);
|
|
68
|
+
}), g = b(() => {
|
|
69
|
+
if (!l.allowCreate || !o.value.trim() || C.value) return !1;
|
|
70
|
+
const e = o.value.trim().toLowerCase();
|
|
71
|
+
return k.value.has(e) || k.value.has(o.value.trim()) ? !1 : ![...l.suggestions, ...m.value].map((a) => a.value.toLowerCase()).includes(e);
|
|
72
|
+
}), q = b(() => V.value), ae = xe("0.25rem"), z = b(() => {
|
|
73
|
+
const e = ye[l.size];
|
|
74
|
+
return {
|
|
75
|
+
tagSize: we(l.size),
|
|
76
|
+
style: {
|
|
77
|
+
"--_tag-input-font-size": e.fontSize,
|
|
78
|
+
"--_tag-input-padding": `${ae} ${e.px}`,
|
|
79
|
+
"--_tag-input-min-height": e.height
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
function p() {
|
|
84
|
+
const e = E.value ?? w.value;
|
|
85
|
+
if (!e) return;
|
|
86
|
+
const t = e.getBoundingClientRect(), a = window.innerHeight, n = a - t.bottom, T = t.top, F = n < 200 && T > n, re = Math.max(0, Math.min(240, (F ? T : n) - 16)), L = {
|
|
87
|
+
// The panel is teleported to <body>, so it inherits nothing from the component — it
|
|
88
|
+
// has to carry the size-derived properties itself (#123).
|
|
89
|
+
...z.value.style,
|
|
90
|
+
position: "fixed",
|
|
91
|
+
zIndex: "9990",
|
|
92
|
+
left: `${t.left}px`,
|
|
93
|
+
width: `${t.width}px`,
|
|
94
|
+
maxHeight: `${re}px`
|
|
95
|
+
// Only the geometry the positioner computes stays inline; the panel's paint lives in
|
|
96
|
+
// the stylesheet so it can be themed (#123).
|
|
97
|
+
};
|
|
98
|
+
F ? L.bottom = `${a - t.top + 4}px` : L.top = `${t.bottom + 4}px`, I.value = L;
|
|
99
|
+
}
|
|
100
|
+
function le(e) {
|
|
101
|
+
if (o.value = e.target.value, i.value = -1, s.value || (s.value = !0, p()), l.fetchSuggestions) {
|
|
102
|
+
if (o.value.length < l.minChars) {
|
|
103
|
+
m.value = [];
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
x && clearTimeout(x), x = setTimeout(async () => {
|
|
107
|
+
V.value = !0;
|
|
108
|
+
try {
|
|
109
|
+
m.value = await l.fetchSuggestions(o.value);
|
|
110
|
+
} finally {
|
|
111
|
+
V.value = !1;
|
|
112
|
+
}
|
|
113
|
+
}, l.debounce);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function A(e) {
|
|
117
|
+
if (l.disabled || C.value) return;
|
|
118
|
+
const t = e.trim();
|
|
119
|
+
!t || k.value.has(t) || (D("update:modelValue", [...l.modelValue, t]), o.value = "", i.value = -1, B(() => {
|
|
120
|
+
var a;
|
|
121
|
+
return (a = f.value) == null ? void 0 : a.focus();
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
function N(e) {
|
|
125
|
+
A(e.value);
|
|
126
|
+
}
|
|
127
|
+
function S() {
|
|
128
|
+
g.value && A(o.value.trim());
|
|
129
|
+
}
|
|
130
|
+
function H(e) {
|
|
131
|
+
l.disabled || (D("update:modelValue", l.modelValue.filter((t) => t !== e)), B(() => {
|
|
132
|
+
var t;
|
|
133
|
+
return (t = f.value) == null ? void 0 : t.focus();
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
function ue(e) {
|
|
137
|
+
const t = d.value.length + (g.value ? 1 : 0);
|
|
138
|
+
if (e.key === "ArrowDown") {
|
|
139
|
+
if (e.preventDefault(), !s.value) {
|
|
140
|
+
s.value = !0, p();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
i.value = Math.min(i.value + 1, t - 1);
|
|
144
|
+
} else e.key === "ArrowUp" ? (e.preventDefault(), i.value = Math.max(i.value - 1, 0)) : e.key === "Enter" ? (e.preventDefault(), i.value >= 0 && i.value < d.value.length ? N(d.value[i.value]) : (g.value && (i.value === d.value.length || i.value === -1) || g.value && o.value.trim()) && S()) : e.key === "," || e.key === "Tab" ? o.value.trim() && l.allowCreate && (e.preventDefault(), S()) : e.key === "Escape" ? s.value = !1 : e.key === "Backspace" && !o.value && l.modelValue.length > 0 && H(l.modelValue[l.modelValue.length - 1]);
|
|
145
|
+
}
|
|
146
|
+
function P(e) {
|
|
147
|
+
var a, n;
|
|
148
|
+
const t = e.target;
|
|
149
|
+
(a = w.value) != null && a.contains(t) || (n = _.value) != null && n.contains(t) || (s.value = !1);
|
|
150
|
+
}
|
|
151
|
+
function ne() {
|
|
152
|
+
!l.disabled && !C.value && (s.value = !0, p());
|
|
153
|
+
}
|
|
154
|
+
de(() => {
|
|
155
|
+
document.addEventListener("mousedown", P), window.addEventListener("scroll", () => {
|
|
156
|
+
s.value && p();
|
|
157
|
+
}, !0), window.addEventListener("resize", () => {
|
|
158
|
+
s.value && p();
|
|
159
|
+
});
|
|
160
|
+
}), ce(() => {
|
|
161
|
+
document.removeEventListener("mousedown", P), x && clearTimeout(x);
|
|
162
|
+
}), ve(s, (e) => {
|
|
163
|
+
e || (o.value = ""), e && B(p);
|
|
164
|
+
});
|
|
165
|
+
function oe(e) {
|
|
166
|
+
var t;
|
|
167
|
+
f.value ? f.value.focus(e) : (t = w.value) == null || t.focus(e);
|
|
168
|
+
}
|
|
169
|
+
function ie() {
|
|
170
|
+
var e;
|
|
171
|
+
(e = f.value) == null || e.blur();
|
|
172
|
+
}
|
|
173
|
+
return j({ el: w, focus: oe, blur: ie }), (e, t) => fe((r(), v("div", {
|
|
174
|
+
class: "cui-tag-input",
|
|
175
|
+
ref_key: "wrapperRef",
|
|
176
|
+
ref: w,
|
|
177
|
+
style: M(z.value.style)
|
|
178
|
+
}, [
|
|
179
|
+
u.label ? (r(), v("label", Ve, h(u.label), 1)) : y("", !0),
|
|
180
|
+
R("div", {
|
|
181
|
+
ref_key: "controlRef",
|
|
182
|
+
ref: E,
|
|
183
|
+
class: $(["cui-tag-input__control", { "cui-tag-input__control--disabled": u.disabled }]),
|
|
184
|
+
style: M({
|
|
185
|
+
"--_tag-input-radius": X[u.rounded],
|
|
186
|
+
"--_tag-input-border": u.error ? "var(--cui-error)" : "var(--cui-border-strong, var(--cui-border))"
|
|
187
|
+
}),
|
|
188
|
+
onClick: t[0] || (t[0] = (a) => {
|
|
189
|
+
var n;
|
|
190
|
+
return (n = f.value) == null ? void 0 : n.focus();
|
|
191
|
+
})
|
|
192
|
+
}, [
|
|
193
|
+
(r(!0), v(O, null, U(u.modelValue, (a) => (r(), K(Se, {
|
|
194
|
+
key: a,
|
|
195
|
+
color: te(a),
|
|
196
|
+
size: z.value.tagSize,
|
|
197
|
+
removable: "",
|
|
198
|
+
onRemove: (n) => H(a)
|
|
199
|
+
}, {
|
|
200
|
+
default: me(() => [
|
|
201
|
+
ge(h(ee(a)), 1)
|
|
202
|
+
]),
|
|
203
|
+
_: 2
|
|
204
|
+
}, 1032, ["color", "size", "onRemove"]))), 128)),
|
|
205
|
+
C.value ? y("", !0) : (r(), v("input", {
|
|
206
|
+
key: 0,
|
|
207
|
+
id: u.id,
|
|
208
|
+
name: u.name,
|
|
209
|
+
autocomplete: u.autocomplete,
|
|
210
|
+
"aria-describedby": W(Q),
|
|
211
|
+
"aria-required": u.ariaRequired || void 0,
|
|
212
|
+
"aria-labelledby": u.ariaLabelledby,
|
|
213
|
+
ref_key: "inputRef",
|
|
214
|
+
ref: f,
|
|
215
|
+
value: o.value,
|
|
216
|
+
placeholder: u.modelValue.length > 0 ? "" : u.placeholder,
|
|
217
|
+
disabled: u.disabled,
|
|
218
|
+
class: "cui-tag-input__input",
|
|
219
|
+
onInput: le,
|
|
220
|
+
onFocus: ne,
|
|
221
|
+
onKeydown: ue
|
|
222
|
+
}, null, 40, ze))
|
|
223
|
+
], 6),
|
|
224
|
+
u.error && u.errorMessage ? (r(), v("div", {
|
|
225
|
+
key: 1,
|
|
226
|
+
id: W(J),
|
|
227
|
+
class: "cui-tag-input__error"
|
|
228
|
+
}, h(u.errorMessage), 9, Le)) : y("", !0),
|
|
229
|
+
(r(), K(pe, { to: "body" }, [
|
|
230
|
+
s.value && (d.value.length > 0 || g.value || q.value) ? (r(), v("div", {
|
|
231
|
+
key: 0,
|
|
232
|
+
ref_key: "dropdownRef",
|
|
233
|
+
ref: _,
|
|
234
|
+
class: "cui-tag-input__dropdown",
|
|
235
|
+
style: M(I.value)
|
|
236
|
+
}, [
|
|
237
|
+
q.value && d.value.length === 0 ? (r(), v("div", Be, [
|
|
238
|
+
Y(Te, {
|
|
239
|
+
size: "xs",
|
|
240
|
+
"show-label": "",
|
|
241
|
+
label: "Searching..."
|
|
242
|
+
})
|
|
243
|
+
])) : y("", !0),
|
|
244
|
+
(r(!0), v(O, null, U(d.value, (a, n) => (r(), v("div", {
|
|
245
|
+
key: a.value,
|
|
246
|
+
"data-index": n,
|
|
247
|
+
class: $(["cui-tag-input__suggestion", { "cui-tag-input__suggestion--focused": i.value === n }]),
|
|
248
|
+
onClick: Z((T) => N(a), ["stop"]),
|
|
249
|
+
onMouseenter: (T) => i.value = n
|
|
250
|
+
}, [
|
|
251
|
+
be(e.$slots, "suggestion", { suggestion: a }, () => [
|
|
252
|
+
R("span", null, h(a.label || a.value), 1)
|
|
253
|
+
], !0)
|
|
254
|
+
], 42, Me))), 128)),
|
|
255
|
+
g.value ? (r(), v("div", {
|
|
256
|
+
key: 1,
|
|
257
|
+
class: $(["cui-tag-input__create", {
|
|
258
|
+
"cui-tag-input__suggestion--focused": i.value === d.value.length,
|
|
259
|
+
"cui-tag-input__create--divided": d.value.length > 0
|
|
260
|
+
}]),
|
|
261
|
+
onClick: Z(S, ["stop"]),
|
|
262
|
+
onMouseenter: t[1] || (t[1] = (a) => i.value = d.value.length)
|
|
263
|
+
}, [
|
|
264
|
+
Y(Ce, {
|
|
265
|
+
name: "plus",
|
|
266
|
+
size: "0.75rem"
|
|
267
|
+
}),
|
|
268
|
+
R("span", null, h(u.createText) + " “" + h(o.value.trim()) + "”", 1)
|
|
269
|
+
], 34)) : y("", !0)
|
|
270
|
+
], 4)) : y("", !0)
|
|
271
|
+
]))
|
|
272
|
+
], 4)), [
|
|
273
|
+
[he, !u.hidden]
|
|
274
|
+
]);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
2
277
|
export {
|
|
3
|
-
|
|
278
|
+
Ae as default
|
|
4
279
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HideableProps, ColorableProps, SizeableProps, DisableableProps, CuiRounded } from "../types/common";
|
|
2
|
-
export interface CuiTextareaProps extends HideableProps, ColorableProps, SizeableProps, DisableableProps {
|
|
1
|
+
import type { HideableProps, ColorableProps, SizeableProps, DisableableProps, CuiRounded, NativeControlProps } from "../types/common";
|
|
2
|
+
export interface CuiTextareaProps extends NativeControlProps, HideableProps, ColorableProps, SizeableProps, DisableableProps {
|
|
3
3
|
/** v-model binding */
|
|
4
4
|
modelValue?: string;
|
|
5
5
|
/** Placeholder text */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CuiTextarea.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiTextarea.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CuiTextarea.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiTextarea.vue"],"names":[],"mappings":"AA0RA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAYtI,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB;IAC1H,sBAAsB;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mCAAmC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB;IACpB,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAwFD,iBAAS,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,QAEjC;AAED,iBAAS,IAAI,SAEZ;;;;;;;;;;WArGS,OAAO;cAIJ,OAAO;;;;aAER,UAAU;;UAdb,MAAM;gBAJA,MAAM;gBAMN,OAAO;;AA4PtB,wBASG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "./CuiTextarea.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import t from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c82ce8bc"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
e as default
|
|
7
7
|
};
|