@ac-design/design-system 1.0.3 → 2.1.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 +27 -18
- package/dist/lib/charts/ChartFrame.js +5 -0
- package/dist/lib/charts/ChartFrame.vue.d.ts +71 -0
- package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +173 -0
- package/dist/lib/charts/cartesian.d.ts +324 -0
- package/dist/lib/charts/cartesian.js +137 -0
- package/dist/lib/charts/echarts.d.ts +86 -0
- package/dist/lib/charts/echarts.js +173 -0
- package/dist/lib/charts/graph.d.ts +77 -0
- package/dist/lib/charts/graph.js +155 -0
- package/dist/lib/charts/index.d.ts +11 -0
- package/dist/lib/charts/index.js +7 -0
- package/dist/lib/charts/shared.d.ts +53 -0
- package/dist/lib/charts/shared.js +96 -0
- package/dist/lib/charts/xy.d.ts +69 -0
- package/dist/lib/charts/xy.js +73 -0
- package/dist/lib/compat.css +2770 -1061
- package/dist/lib/components/AcAccordion.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcAccordionItem.vue.d.ts +1 -1
- package/dist/lib/components/AcAccordionItem.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/lib/components/AcAlert.vue.d.ts +10 -1
- package/dist/lib/components/AcAlert.vue_vue_type_script_setup_true_lang.js +139 -45
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +19 -19
- package/dist/lib/components/AcAreaChart.js +5 -0
- package/dist/lib/components/AcAreaChart.vue.d.ts +47 -0
- package/dist/lib/components/AcAreaChart.vue_vue_type_script_setup_true_lang.js +205 -0
- package/dist/lib/components/AcAvatar.vue.d.ts +7 -4
- package/dist/lib/components/AcAvatar.vue_vue_type_script_setup_true_lang.js +66 -61
- package/dist/lib/components/AcBadge.vue.d.ts +20 -7
- package/dist/lib/components/AcBadge.vue_vue_type_script_setup_true_lang.js +67 -44
- package/dist/lib/components/AcBanner.vue.d.ts +1 -1
- package/dist/lib/components/AcBanner.vue_vue_type_script_setup_true_lang.js +30 -30
- package/dist/lib/components/AcBarChart.js +5 -0
- package/dist/lib/components/AcBarChart.vue.d.ts +46 -0
- package/dist/lib/components/AcBarChart.vue_vue_type_script_setup_true_lang.js +213 -0
- package/dist/lib/components/AcBreadcrumb.vue.d.ts +4 -1
- package/dist/lib/components/AcBreadcrumb.vue_vue_type_script_setup_true_lang.js +36 -34
- package/dist/lib/components/AcBulkActionBar.js +5 -0
- package/dist/lib/components/AcBulkActionBar.vue.d.ts +45 -0
- package/dist/lib/components/AcBulkActionBar.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/lib/components/AcButton.vue.d.ts +13 -7
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +93 -47
- package/dist/lib/components/AcButtons.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcCard.vue.d.ts +42 -3
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +175 -14
- package/dist/lib/components/AcCellValue.vue.d.ts +6 -3
- package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +219 -178
- package/dist/lib/components/AcCheckBox.vue.d.ts +17 -3
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +113 -30
- package/dist/lib/components/AcCheckList.js +5 -0
- package/dist/lib/components/AcCheckList.vue.d.ts +45 -0
- package/dist/lib/components/AcCheckList.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/lib/components/AcCheckRadio.vue.d.ts +30 -5
- package/dist/lib/components/AcCheckRadio.vue_vue_type_script_setup_true_lang.js +102 -26
- package/dist/lib/components/AcCircularProgress.js +5 -0
- package/dist/lib/components/AcCircularProgress.vue.d.ts +44 -0
- package/dist/lib/components/AcCircularProgress.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +142 -167
- package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/lib/components/AcColorInput.js +5 -0
- package/dist/lib/components/AcColorInput.vue.d.ts +57 -0
- package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +217 -0
- package/dist/lib/components/AcCommandBlock.js +5 -0
- package/dist/lib/components/AcCommandBlock.vue.d.ts +34 -0
- package/dist/lib/components/AcCommandBlock.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/lib/components/AcConfirmModal.js +5 -0
- package/dist/lib/components/AcConfirmModal.vue.d.ts +56 -0
- package/dist/lib/components/AcConfirmModal.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/lib/components/AcContentHeader.vue.d.ts +1 -1
- package/dist/lib/components/AcContentHeader.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/lib/components/AcContentLayout.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcCopyButton.js +5 -0
- package/dist/lib/components/AcCopyButton.vue.d.ts +43 -0
- package/dist/lib/components/AcCopyButton.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/lib/components/AcCostSummary.js +5 -0
- package/dist/lib/components/AcCostSummary.vue.d.ts +102 -0
- package/dist/lib/components/AcCostSummary.vue_vue_type_script_setup_true_lang.js +179 -0
- package/dist/lib/components/AcDatePicker.vue.d.ts +8 -8
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +634 -417
- package/dist/lib/components/AcDeleteModal.vue.d.ts +4 -4
- package/dist/lib/components/AcDeleteModal.vue_vue_type_script_setup_true_lang.js +57 -60
- package/dist/lib/components/AcDonutChart.js +5 -0
- package/dist/lib/components/AcDonutChart.vue.d.ts +83 -0
- package/dist/lib/components/AcDonutChart.vue_vue_type_script_setup_true_lang.js +237 -0
- package/dist/lib/components/AcDropdown.vue.d.ts +5 -2
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +91 -78
- package/dist/lib/components/AcDropdownDivider.vue_vue_type_script_setup_true_lang.js +11 -10
- package/dist/lib/components/AcDropdownItem.vue.d.ts +2 -2
- package/dist/lib/components/AcDropdownItem.vue_vue_type_script_setup_true_lang.js +18 -18
- package/dist/lib/components/AcEmptyState.vue.d.ts +4 -1
- package/dist/lib/components/AcEmptyState.vue_vue_type_script_setup_true_lang.js +50 -39
- package/dist/lib/components/AcErrorState.js +5 -0
- package/dist/lib/components/AcErrorState.vue.d.ts +46 -0
- package/dist/lib/components/AcErrorState.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/lib/components/AcFeatureCard.vue.d.ts +6 -0
- package/dist/lib/components/AcFeatureCard.vue_vue_type_script_setup_true_lang.js +139 -116
- package/dist/lib/components/AcFileEditor.vue_vue_type_script_setup_true_lang.js +16 -16
- package/dist/lib/components/AcFileUpload.vue.d.ts +2 -2
- package/dist/lib/components/AcFileUpload.vue_vue_type_script_setup_true_lang.js +55 -53
- package/dist/lib/components/AcFontScale.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcFooter.js +5 -0
- package/dist/lib/components/AcFooter.vue.d.ts +37 -0
- package/dist/lib/components/AcFooter.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/lib/components/AcForm.vue.d.ts +3 -0
- package/dist/lib/components/AcForm.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/lib/components/AcFormArray.vue.d.ts +2 -2
- package/dist/lib/components/AcFormArray.vue_vue_type_script_setup_true_lang.js +149 -147
- package/dist/lib/components/AcFormFooter.vue.d.ts +3 -3
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcFormSection.vue.d.ts +8 -1
- package/dist/lib/components/AcFormSection.vue_vue_type_script_setup_true_lang.js +31 -21
- package/dist/lib/components/AcGraphChart.js +5 -0
- package/dist/lib/components/AcGraphChart.vue.d.ts +124 -0
- package/dist/lib/components/AcGraphChart.vue_vue_type_script_setup_true_lang.js +578 -0
- package/dist/lib/components/AcHeader.vue.d.ts +20 -5
- package/dist/lib/components/AcHeader.vue_vue_type_script_setup_true_lang.js +82 -28
- package/dist/lib/components/AcInfoTable.vue.d.ts +1 -1
- package/dist/lib/components/AcInfoTable.vue_vue_type_script_setup_true_lang.js +17 -13
- package/dist/lib/components/AcInput.vue.d.ts +4 -4
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +99 -91
- package/dist/lib/components/AcKbd.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcKeyValueInput.js +5 -0
- package/dist/lib/components/AcKeyValueInput.vue.d.ts +114 -0
- package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +336 -0
- package/dist/lib/components/AcLineChart.js +5 -0
- package/dist/lib/components/AcLineChart.vue.d.ts +44 -0
- package/dist/lib/components/AcLineChart.vue_vue_type_script_setup_true_lang.js +175 -0
- package/dist/lib/components/AcLoader.js +5 -0
- package/dist/lib/components/AcLoader.vue.d.ts +15 -0
- package/dist/lib/components/AcLoader.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/lib/components/AcLocaleSwitcher.js +5 -0
- package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +48 -0
- package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +111 -0
- package/dist/lib/components/AcMapChart.js +5 -0
- package/dist/lib/components/AcMapChart.vue.d.ts +136 -0
- package/dist/lib/components/AcMapChart.vue_vue_type_script_setup_true_lang.js +518 -0
- package/dist/lib/components/AcModal.vue.d.ts +6 -3
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +88 -64
- package/dist/lib/components/AcNavbar.vue.d.ts +8 -5
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +29 -21
- package/dist/lib/components/AcNavbarItem.vue.d.ts +2 -2
- package/dist/lib/components/AcNavbarItem.vue_vue_type_script_setup_true_lang.js +23 -24
- package/dist/lib/components/AcNotificationMenu.vue.d.ts +3 -3
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +139 -174
- package/dist/lib/components/AcNumberInput.js +5 -0
- package/dist/lib/components/AcNumberInput.vue.d.ts +79 -0
- package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +241 -0
- package/dist/lib/components/AcPage.vue.d.ts +2 -2
- package/dist/lib/components/AcPage.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcPagination.vue.d.ts +22 -5
- package/dist/lib/components/AcPagination.vue_vue_type_script_setup_true_lang.js +87 -56
- package/dist/lib/components/AcPreloader.vue.d.ts +3 -3
- package/dist/lib/components/AcPreloader.vue_vue_type_script_setup_true_lang.js +15 -16
- package/dist/lib/components/AcProductHero.js +5 -0
- package/dist/lib/components/AcProductHero.vue.d.ts +56 -0
- package/dist/lib/components/AcProductHero.vue_vue_type_script_setup_true_lang.js +95 -0
- package/dist/lib/components/AcProgress.vue.d.ts +19 -4
- package/dist/lib/components/AcProgress.vue_vue_type_script_setup_true_lang.js +85 -31
- package/dist/lib/components/AcResourceCard.vue.d.ts +3 -3
- package/dist/lib/components/AcResourceCard.vue_vue_type_script_setup_true_lang.js +17 -17
- package/dist/lib/components/AcSearchBar.vue.d.ts +1 -1
- package/dist/lib/components/AcSearchBar.vue_vue_type_script_setup_true_lang.js +14 -9
- package/dist/lib/components/AcSectionContent.vue.d.ts +2 -2
- package/dist/lib/components/AcSectionContent.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcSegmentedControl.vue.d.ts +1 -1
- package/dist/lib/components/AcSegmentedControl.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/lib/components/AcSelect.vue.d.ts +6 -6
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +246 -254
- package/dist/lib/components/AcSettingsRow.js +5 -0
- package/dist/lib/components/AcSettingsRow.vue.d.ts +29 -0
- package/dist/lib/components/AcSettingsRow.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +32 -32
- package/dist/lib/components/AcSideTabs.vue.d.ts +2 -2
- package/dist/lib/components/AcSideTabs.vue_vue_type_script_setup_true_lang.js +37 -37
- package/dist/lib/components/AcSidebar.vue.d.ts +6 -3
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +67 -57
- package/dist/lib/components/AcSidebarItem.vue.d.ts +1 -1
- package/dist/lib/components/AcSidebarItem.vue_vue_type_script_setup_true_lang.js +46 -45
- package/dist/lib/components/AcSidebarSection.vue.d.ts +2 -2
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +23 -18
- package/dist/lib/components/AcSkeleton.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcSlider.vue.d.ts +1 -1
- package/dist/lib/components/AcSlider.vue_vue_type_script_setup_true_lang.js +174 -172
- package/dist/lib/components/AcStatCard.vue.d.ts +3 -3
- package/dist/lib/components/AcStatCard.vue_vue_type_script_setup_true_lang.js +90 -85
- package/dist/lib/components/AcStatusBar.vue.d.ts +1 -1
- package/dist/lib/components/AcStatusBar.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/lib/components/AcSteps.vue_vue_type_script_setup_true_lang.js +28 -28
- package/dist/lib/components/AcSwitch.vue.d.ts +3 -0
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +31 -19
- package/dist/lib/components/AcSwitchCard.js +5 -0
- package/dist/lib/components/AcSwitchCard.vue.d.ts +59 -0
- package/dist/lib/components/AcSwitchCard.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +97 -97
- package/dist/lib/components/AcTabs.vue.d.ts +9 -2
- package/dist/lib/components/AcTabs.vue_vue_type_script_setup_true_lang.js +43 -28
- package/dist/lib/components/AcTag.vue.d.ts +2 -2
- package/dist/lib/components/AcTag.vue_vue_type_script_setup_true_lang.js +22 -22
- package/dist/lib/components/AcTagInput.js +5 -0
- package/dist/lib/components/AcTagInput.vue.d.ts +74 -0
- package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +289 -0
- package/dist/lib/components/AcTextarea.vue.d.ts +4 -4
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +85 -63
- package/dist/lib/components/AcThemeMode.vue.d.ts +3 -3
- package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +56 -24
- package/dist/lib/components/AcTimePicker.js +5 -0
- package/dist/lib/components/AcTimePicker.vue.d.ts +65 -0
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +455 -0
- package/dist/lib/components/AcToaster.vue.d.ts +6 -3
- package/dist/lib/components/AcToaster.vue_vue_type_script_setup_true_lang.js +115 -82
- package/dist/lib/components/AcTooltip.vue.d.ts +34 -14
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +203 -79
- package/dist/lib/components/AcUsageCard.vue_vue_type_script_setup_true_lang.js +27 -27
- package/dist/lib/components/AcUserMenu.vue.d.ts +23 -1
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +166 -115
- package/dist/lib/components/index.d.ts +21 -2
- package/dist/lib/components/status.d.ts +28 -0
- package/dist/lib/components/status.js +125 -0
- package/dist/lib/composables/copyText.d.ts +2 -1
- package/dist/lib/composables/copyText.js +2 -2
- package/dist/lib/composables/useApiPagination.d.ts +55 -0
- package/dist/lib/composables/useApiPagination.js +58 -0
- package/dist/lib/composables/useBulkSelection.d.ts +44 -0
- package/dist/lib/composables/useBulkSelection.js +41 -0
- package/dist/lib/composables/useFormValidation.d.ts +65 -0
- package/dist/lib/composables/useFormValidation.js +148 -0
- package/dist/lib/composables/useTablePagination.d.ts +49 -0
- package/dist/lib/composables/useTablePagination.js +41 -0
- package/dist/lib/composables/useToast.d.ts +17 -1
- package/dist/lib/composables/useToast.js +10 -2
- package/dist/lib/editor/theme.js +65 -62
- package/dist/lib/index.d.ts +21 -3
- package/dist/lib/index.js +99 -75
- package/dist/lib/theme.css +377 -273
- package/package.json +20 -4
|
@@ -29,49 +29,49 @@ var m = {
|
|
|
29
29
|
setup(s, { emit: b }) {
|
|
30
30
|
let x = s, S = b, C = {
|
|
31
31
|
neutral: {
|
|
32
|
-
box: "bg-surface text-
|
|
33
|
-
value: "
|
|
32
|
+
box: "bg-surface-sunken text-heading border-border",
|
|
33
|
+
value: "text-heading",
|
|
34
34
|
divider: "border-border"
|
|
35
35
|
},
|
|
36
36
|
primary: {
|
|
37
|
-
box: "bg-primary
|
|
38
|
-
value: "bg-primary
|
|
39
|
-
divider: "border-primary
|
|
37
|
+
box: "bg-primary/10 text-primary-strong border-primary/25",
|
|
38
|
+
value: "bg-primary/10 text-primary-strong",
|
|
39
|
+
divider: "border-primary/25"
|
|
40
40
|
},
|
|
41
41
|
info: {
|
|
42
|
-
box: "bg-
|
|
43
|
-
value: "bg-
|
|
44
|
-
divider: "border-
|
|
42
|
+
box: "bg-info/10 text-info-strong border-info/25",
|
|
43
|
+
value: "bg-info/10 text-info-strong",
|
|
44
|
+
divider: "border-info/25"
|
|
45
45
|
},
|
|
46
46
|
success: {
|
|
47
|
-
box: "bg-
|
|
48
|
-
value: "bg-
|
|
49
|
-
divider: "border-
|
|
47
|
+
box: "bg-success/10 text-success-strong border-success/25",
|
|
48
|
+
value: "bg-success/10 text-success-strong",
|
|
49
|
+
divider: "border-success/25"
|
|
50
50
|
},
|
|
51
51
|
warning: {
|
|
52
|
-
box: "bg-
|
|
53
|
-
value: "bg-
|
|
54
|
-
divider: "border-
|
|
52
|
+
box: "bg-warning/10 text-warning-strong border-warning/30",
|
|
53
|
+
value: "bg-warning/10 text-warning-strong",
|
|
54
|
+
divider: "border-warning/30"
|
|
55
55
|
},
|
|
56
56
|
danger: {
|
|
57
|
-
box: "bg-
|
|
58
|
-
value: "bg-
|
|
59
|
-
divider: "border-
|
|
57
|
+
box: "bg-danger/10 text-danger-strong border-danger/25",
|
|
58
|
+
value: "bg-danger/10 text-danger-strong",
|
|
59
|
+
divider: "border-danger/25"
|
|
60
60
|
}
|
|
61
|
-
}, w = t(() => !!x.keyLabel), T = t(() => C[x.color]), E = t(() => w.value ? `${x.keyLabel}=${x.valueLabel}` : x.label), D = t(() => w.value ? ["bg-surface text-
|
|
61
|
+
}, w = t(() => !!x.keyLabel), T = t(() => C[x.color]), E = t(() => w.value ? `${x.keyLabel}=${x.valueLabel}` : x.label), D = t(() => w.value ? ["bg-surface-sunken text-muted", T.value.divider] : T.value.box);
|
|
62
62
|
function O() {
|
|
63
63
|
S("remove");
|
|
64
64
|
}
|
|
65
65
|
return (t, b) => (l(), r("span", {
|
|
66
|
-
class: c(["inline-flex h-6 max-w-full items-stretch overflow-hidden border text-xs leading-none whitespace-nowrap", [
|
|
66
|
+
class: c(["inline-flex h-6 max-w-full items-stretch overflow-hidden border text-xs leading-none font-medium whitespace-nowrap", [
|
|
67
67
|
D.value,
|
|
68
|
-
s.rounded ? "rounded-
|
|
69
|
-
w.value && "font-mono
|
|
68
|
+
s.rounded ? "rounded-full" : "rounded-6",
|
|
69
|
+
w.value && "font-mono"
|
|
70
70
|
]]),
|
|
71
71
|
"data-ac-ds": "",
|
|
72
72
|
"data-testid": "ac-tag"
|
|
73
73
|
}, [w.value ? (l(), r(e, { key: 0 }, [
|
|
74
|
-
i("span", { class: c(["inline-flex min-w-0 items-center gap-1.5
|
|
74
|
+
i("span", { class: c(["inline-flex min-w-0 items-center gap-1.5 pr-1.5 text-muted", s.rounded ? "pl-2.5" : "pl-2"]) }, [t.$slots.icon ? (l(), r("span", m, [u(t.$slots, "icon")])) : n("", !0), i("span", h, d(s.keyLabel), 1)], 2),
|
|
75
75
|
b[0] ||= i("span", { class: "sr-only" }, "=", -1),
|
|
76
76
|
i("span", { class: c(["inline-flex min-w-0 shrink-[0.25] items-center border-l pl-1.5", [
|
|
77
77
|
T.value.value,
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export interface Props {
|
|
2
|
+
/** Label above the field. Also the accessible name of the input and of the list of values. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** Native `name` attribute of the text input. */
|
|
5
|
+
name?: string;
|
|
6
|
+
/** Example value shown in the empty input, e.g. "e.g. 10.0.0.0/16". Defaults to "Add item and press Enter". */
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/** Help text between the label and the field. */
|
|
9
|
+
hint?: string;
|
|
10
|
+
/** Error text under the field. Turns the border red and sets `aria-invalid`. A rejected value's own message shows first. */
|
|
11
|
+
errorMsg?: string;
|
|
12
|
+
/** Field height: `small` 36px or `normal` 42px. Values show as chips under it. */
|
|
13
|
+
size?: "small" | "normal";
|
|
14
|
+
/** Most values allowed. A “N / max items” count shows under the values, amber from 80% and red at the limit; adding more shows an error. */
|
|
15
|
+
maxItems?: number;
|
|
16
|
+
/** Lets the same value be added twice. Off by default: a repeat shows “… is already added”. */
|
|
17
|
+
allowDuplicates?: boolean;
|
|
18
|
+
/** Checks a value before it's added. Return a message to reject it; the text stays in the input with the message. */
|
|
19
|
+
validate?: (value: string, values: string[]) => string | void | null | undefined;
|
|
20
|
+
/** Cleans typed text before it's checked and added, e.g. `(v) => v.trim().toLowerCase()`. Defaults to trimming. */
|
|
21
|
+
transform?: (value: string) => string;
|
|
22
|
+
/** Shows a button that removes every value. Was `show-all-clear` in cloud-ui. */
|
|
23
|
+
showClear?: boolean;
|
|
24
|
+
/** Adds the typed text when the input loses focus, so a value isn't lost when people click Save. */
|
|
25
|
+
addOnBlur?: boolean;
|
|
26
|
+
/** Shows the chips and the input in the monospace font, for IPs, CIDRs and resource names. */
|
|
27
|
+
mono?: boolean;
|
|
28
|
+
/** Marks the field required and adds a red asterisk. Pass `error-msg` when the list is empty on submit. Was `is-required` in cloud-ui. */
|
|
29
|
+
required?: boolean;
|
|
30
|
+
/** Disables the field. Was `is-disabled` in cloud-ui. */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Shows the input on a muted fill and the chips without remove buttons. Was `is-read-only` in cloud-ui. */
|
|
33
|
+
readonly?: boolean;
|
|
34
|
+
}
|
|
35
|
+
type __VLS_Props = Props;
|
|
36
|
+
type __VLS_ModelProps = {
|
|
37
|
+
/** The values, in the order they were added. Replaced with a new array on every change. */
|
|
38
|
+
modelValue?: string[];
|
|
39
|
+
};
|
|
40
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
41
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
42
|
+
/** Moves focus to the text input. */
|
|
43
|
+
focus: () => void | undefined;
|
|
44
|
+
/** Adds the typed text now, e.g. before submitting. Returns `false` when text was rejected and is still in the input. */
|
|
45
|
+
commit: () => boolean;
|
|
46
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
47
|
+
"update:modelValue": (value: string[]) => any;
|
|
48
|
+
clear: () => any;
|
|
49
|
+
add: (value: string) => any;
|
|
50
|
+
remove: (value: string, index: number) => any;
|
|
51
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
52
|
+
"onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
|
|
53
|
+
onClear?: (() => any) | undefined;
|
|
54
|
+
onAdd?: ((value: string) => any) | undefined;
|
|
55
|
+
onRemove?: ((value: string, index: number) => any) | undefined;
|
|
56
|
+
}>, {
|
|
57
|
+
required: boolean;
|
|
58
|
+
disabled: boolean;
|
|
59
|
+
name: string;
|
|
60
|
+
transform: (value: string) => string;
|
|
61
|
+
size: "small" | "normal";
|
|
62
|
+
maxItems: number;
|
|
63
|
+
readonly: boolean;
|
|
64
|
+
hint: string;
|
|
65
|
+
validate: (value: string, values: string[]) => string | void | null | undefined;
|
|
66
|
+
placeholder: string;
|
|
67
|
+
errorMsg: string;
|
|
68
|
+
mono: boolean;
|
|
69
|
+
allowDuplicates: boolean;
|
|
70
|
+
showClear: boolean;
|
|
71
|
+
addOnBlur: boolean;
|
|
72
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
73
|
+
declare const _default: typeof __VLS_export;
|
|
74
|
+
export default _default;
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createVNode as a, defineComponent as o, mergeModels as s, mergeProps as c, nextTick as l, normalizeClass as u, openBlock as d, ref as f, renderList as p, toDisplayString as m, unref as h, useAttrs as g, useId as _, useModel as v, vModelText as y, watch as ee, withDirectives as te, withModifiers as ne } from "vue";
|
|
2
|
+
import { Plus as re, X as b } from "@lucide/vue";
|
|
3
|
+
//#region src/lib/components/AcTagInput.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var ie = ["for"], x = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "font-normal text-muted"
|
|
7
|
+
}, ae = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "text-danger",
|
|
10
|
+
"aria-hidden": "true"
|
|
11
|
+
}, S = [
|
|
12
|
+
"id",
|
|
13
|
+
"name",
|
|
14
|
+
"placeholder",
|
|
15
|
+
"disabled",
|
|
16
|
+
"readonly",
|
|
17
|
+
"aria-invalid",
|
|
18
|
+
"aria-required",
|
|
19
|
+
"aria-describedby"
|
|
20
|
+
], C = [
|
|
21
|
+
"disabled",
|
|
22
|
+
"aria-label",
|
|
23
|
+
"title"
|
|
24
|
+
], oe = ["aria-label"], se = ["title"], ce = [
|
|
25
|
+
"aria-label",
|
|
26
|
+
"title",
|
|
27
|
+
"onClick",
|
|
28
|
+
"onKeydown"
|
|
29
|
+
], le = {
|
|
30
|
+
key: 3,
|
|
31
|
+
class: "mt-2 flex items-center justify-between gap-3 text-xs text-muted tabular-nums"
|
|
32
|
+
}, w = { key: 0 }, T = {
|
|
33
|
+
class: "sr-only",
|
|
34
|
+
"aria-live": "polite"
|
|
35
|
+
}, E = /*@__PURE__*/ o({
|
|
36
|
+
inheritAttrs: !1,
|
|
37
|
+
__name: "AcTagInput",
|
|
38
|
+
props: /*@__PURE__*/ s({
|
|
39
|
+
label: {},
|
|
40
|
+
name: { default: "" },
|
|
41
|
+
placeholder: { default: "" },
|
|
42
|
+
hint: { default: "" },
|
|
43
|
+
errorMsg: { default: "" },
|
|
44
|
+
size: { default: "normal" },
|
|
45
|
+
maxItems: { default: void 0 },
|
|
46
|
+
allowDuplicates: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !1
|
|
49
|
+
},
|
|
50
|
+
validate: {
|
|
51
|
+
type: Function,
|
|
52
|
+
default: void 0
|
|
53
|
+
},
|
|
54
|
+
transform: {
|
|
55
|
+
type: Function,
|
|
56
|
+
default: (e) => e.trim()
|
|
57
|
+
},
|
|
58
|
+
showClear: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: !1
|
|
61
|
+
},
|
|
62
|
+
addOnBlur: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: !1
|
|
65
|
+
},
|
|
66
|
+
mono: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: !1
|
|
69
|
+
},
|
|
70
|
+
required: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: !1
|
|
73
|
+
},
|
|
74
|
+
disabled: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: !1
|
|
77
|
+
},
|
|
78
|
+
readonly: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: !1
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
modelValue: { default: () => [] },
|
|
84
|
+
modelModifiers: {}
|
|
85
|
+
}),
|
|
86
|
+
emits: /*@__PURE__*/ s([
|
|
87
|
+
"add",
|
|
88
|
+
"remove",
|
|
89
|
+
"clear"
|
|
90
|
+
], ["update:modelValue"]),
|
|
91
|
+
setup(o, { expose: s, emit: E }) {
|
|
92
|
+
let D = o, O = v(o, "modelValue"), k = E, A = /[\s,;]+/, ue = /[,\n]+/, j = _(), M = `${j}-hint`, N = `${j}-msg`, P = `${j}-count`, F = `${j}-help`, I = g(), L = t(() => ({
|
|
93
|
+
class: I.class,
|
|
94
|
+
style: I.style
|
|
95
|
+
})), R = t(() => {
|
|
96
|
+
let { class: e, style: t, ...n } = I;
|
|
97
|
+
return n;
|
|
98
|
+
}), z = f(null), B = f(null), V = f(""), H = f(""), U = f(!1), W = f(""), G = t(() => O.value ?? []), K = t(() => !D.disabled && !D.readonly), q = t(() => D.maxItems !== void 0 && G.value.length >= D.maxItems), de = t(() => D.maxItems !== void 0 && G.value.length >= D.maxItems * .8), J = t(() => H.value || D.errorMsg), fe = t(() => [
|
|
99
|
+
D.hint && M,
|
|
100
|
+
J.value && N,
|
|
101
|
+
D.maxItems !== void 0 && P,
|
|
102
|
+
K.value && F
|
|
103
|
+
].filter(Boolean).join(" ") || void 0), pe = t(() => K.value ? q.value ? `Maximum ${D.maxItems} items reached` : D.placeholder || "Add item and press Enter" : ""), me = t(() => K.value && !q.value && !!V.value.trim());
|
|
104
|
+
function Y(e) {
|
|
105
|
+
W.value = "", l(() => W.value = e);
|
|
106
|
+
}
|
|
107
|
+
function he(e, t) {
|
|
108
|
+
return D.maxItems !== void 0 && t.length >= D.maxItems ? `You can add up to ${D.maxItems} ${D.maxItems === 1 ? "value" : "values"}. Remove one first.` : !D.allowDuplicates && t.includes(e) ? `“${e}” is already added.` : D.validate?.(e, t) || "";
|
|
109
|
+
}
|
|
110
|
+
function X(e, t) {
|
|
111
|
+
let n = [...G.value], r = [], i = [], a = "";
|
|
112
|
+
for (let o of e.split(t)) {
|
|
113
|
+
let e = D.transform(o);
|
|
114
|
+
if (!e) continue;
|
|
115
|
+
let t = he(e, n);
|
|
116
|
+
if (t) {
|
|
117
|
+
i.push(o.trim()), a ||= t;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
n.push(e), r.push(e);
|
|
121
|
+
}
|
|
122
|
+
return r.length && (O.value = n, r.forEach((e) => k("add", e)), Y(r.length === 1 ? `Added ${r[0]}.` : `Added ${r.length} values.`)), V.value = i.join(", "), l(() => H.value = a), i.length > 0;
|
|
123
|
+
}
|
|
124
|
+
function Z() {
|
|
125
|
+
return !K.value || !V.value.trim() ? !1 : X(V.value, ue);
|
|
126
|
+
}
|
|
127
|
+
function Q(e, t = !0) {
|
|
128
|
+
if (!K.value) return;
|
|
129
|
+
let n = G.value[e];
|
|
130
|
+
if (n === void 0) return;
|
|
131
|
+
let r = G.value.filter((t, n) => n !== e);
|
|
132
|
+
O.value = r, U.value = !1, H.value = "", k("remove", n, e), Y(`Removed ${n}.`), t && l(() => {
|
|
133
|
+
let t = $();
|
|
134
|
+
(t[Math.min(e, t.length - 1)] ?? z.value)?.focus();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function ge() {
|
|
138
|
+
K.value && G.value.length && (O.value = [], U.value = !1, k("clear"), Y("Removed every value."), z.value?.focus());
|
|
139
|
+
}
|
|
140
|
+
function $() {
|
|
141
|
+
return Array.from(B.value?.querySelectorAll("[data-remove]") ?? []);
|
|
142
|
+
}
|
|
143
|
+
function _e(e) {
|
|
144
|
+
if (!K.value || e.isComposing) return;
|
|
145
|
+
let t = e.target, n = t.selectionStart === 0 && t.selectionEnd === 0;
|
|
146
|
+
e.key === "Enter" || e.key === "," ? (e.preventDefault(), Z()) : e.key === "Tab" && !e.shiftKey && V.value.trim() ? Z() : e.key === "Backspace" && !V.value && G.value.length ? (e.preventDefault(), U.value ? Q(G.value.length - 1, !1) : (U.value = !0, Y(`${G.value[G.value.length - 1]} selected. Press Backspace again to remove it.`))) : e.key === "ArrowLeft" && n && G.value.length ? (e.preventDefault(), U.value = !1, $().at(-1)?.focus()) : e.key === "Escape" && (V.value || H.value) ? (e.preventDefault(), V.value = "", H.value = "") : U.value = !1;
|
|
147
|
+
}
|
|
148
|
+
function ve(e, t) {
|
|
149
|
+
let n = $();
|
|
150
|
+
e.key === "Backspace" || e.key === "Delete" ? (e.preventDefault(), Q(t)) : e.key === "ArrowLeft" ? (e.preventDefault(), n[Math.max(t - 1, 0)]?.focus()) : e.key === "ArrowRight" ? (e.preventDefault(), (n[t + 1] ?? z.value)?.focus()) : e.key === "Home" ? (e.preventDefault(), n[0]?.focus()) : e.key === "End" && (e.preventDefault(), z.value?.focus());
|
|
151
|
+
}
|
|
152
|
+
function ye(e) {
|
|
153
|
+
if (!K.value) return;
|
|
154
|
+
let t = e.clipboardData?.getData("text") ?? "";
|
|
155
|
+
if (!A.test(t.trim())) return;
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
let n = z.value, r = n?.selectionStart ?? V.value.length, i = n?.selectionEnd ?? V.value.length;
|
|
158
|
+
X(V.value.slice(0, r) + t + V.value.slice(i), A);
|
|
159
|
+
}
|
|
160
|
+
function be() {
|
|
161
|
+
U.value = !1, D.addOnBlur && Z();
|
|
162
|
+
}
|
|
163
|
+
function xe(e) {
|
|
164
|
+
D.disabled || e.target.closest("button") || z.value?.focus();
|
|
165
|
+
}
|
|
166
|
+
return ee(V, () => {
|
|
167
|
+
H.value = "", U.value = !1;
|
|
168
|
+
}), s({
|
|
169
|
+
focus: () => z.value?.focus(),
|
|
170
|
+
commit: () => !Z()
|
|
171
|
+
}), (t, s) => (d(), r("div", c(L.value, {
|
|
172
|
+
class: ["w-full", o.disabled && "opacity-50"],
|
|
173
|
+
"data-ac-ds": "",
|
|
174
|
+
"data-testid": "ac-tag-input"
|
|
175
|
+
}), [
|
|
176
|
+
i("label", {
|
|
177
|
+
for: h(j),
|
|
178
|
+
class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
|
|
179
|
+
}, [
|
|
180
|
+
i("span", null, m(o.label), 1),
|
|
181
|
+
o.readonly ? (d(), r("span", x, "(read only)")) : n("", !0),
|
|
182
|
+
o.required ? (d(), r("span", ae, "*")) : n("", !0)
|
|
183
|
+
], 8, ie),
|
|
184
|
+
o.hint ? (d(), r("p", {
|
|
185
|
+
key: 0,
|
|
186
|
+
id: M,
|
|
187
|
+
class: "mb-2 text-base text-muted"
|
|
188
|
+
}, m(o.hint), 1)) : n("", !0),
|
|
189
|
+
i("div", {
|
|
190
|
+
class: u(["flex w-full items-center rounded-10 border transition-[border-color,box-shadow,background-color] duration-200", [
|
|
191
|
+
o.size === "small" ? "h-9" : "h-10.5",
|
|
192
|
+
o.readonly ? "bg-surface-muted" : "bg-background",
|
|
193
|
+
o.disabled ? "cursor-not-allowed" : "cursor-text",
|
|
194
|
+
J.value ? "border-danger/50 focus-within:border-danger focus-within:shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]" : ["border-border focus-within:focus-ring", !o.disabled && "hover:border-accent-active"]
|
|
195
|
+
]]),
|
|
196
|
+
onClick: xe
|
|
197
|
+
}, [te(i("input", c({
|
|
198
|
+
id: h(j),
|
|
199
|
+
ref_key: "input",
|
|
200
|
+
ref: z
|
|
201
|
+
}, R.value, {
|
|
202
|
+
"onUpdate:modelValue": s[0] ||= (e) => V.value = e,
|
|
203
|
+
type: "text",
|
|
204
|
+
name: o.name,
|
|
205
|
+
placeholder: pe.value,
|
|
206
|
+
disabled: o.disabled,
|
|
207
|
+
readonly: o.readonly,
|
|
208
|
+
"aria-invalid": !!J.value || void 0,
|
|
209
|
+
"aria-required": o.required || void 0,
|
|
210
|
+
"aria-describedby": fe.value,
|
|
211
|
+
autocomplete: "off",
|
|
212
|
+
autocapitalize: "off",
|
|
213
|
+
spellcheck: "false",
|
|
214
|
+
class: ["h-full min-w-0 flex-1 rounded-10 bg-transparent pr-2 text-base font-normal text-heading outline-none placeholder:text-muted/80 disabled:cursor-not-allowed", [o.mono && "font-mono", o.size === "small" ? "pl-4" : "pl-5"]],
|
|
215
|
+
onKeydown: _e,
|
|
216
|
+
onPaste: ye,
|
|
217
|
+
onBlur: be
|
|
218
|
+
}), null, 16, S), [[y, V.value]]), i("span", { class: u(["flex shrink-0 items-center text-heading", o.size === "small" ? "mr-1" : "mr-3"]) }, [K.value && o.showClear && G.value.length ? (d(), r("button", {
|
|
219
|
+
key: 0,
|
|
220
|
+
type: "button",
|
|
221
|
+
class: u(["inline-flex cursor-pointer items-center justify-center rounded-full transition-colors hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", o.size === "small" ? "size-7" : "size-8"]),
|
|
222
|
+
"aria-label": "Clear all values",
|
|
223
|
+
title: "Clear all items",
|
|
224
|
+
onClick: ge
|
|
225
|
+
}, [a(h(b), {
|
|
226
|
+
class: "size-4",
|
|
227
|
+
"aria-hidden": "true"
|
|
228
|
+
})], 2)) : n("", !0), i("button", {
|
|
229
|
+
type: "button",
|
|
230
|
+
class: u(["inline-flex items-center justify-center rounded-full transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none enabled:cursor-pointer enabled:hover:bg-surface-sunken disabled:cursor-not-allowed disabled:opacity-40", o.size === "small" ? "size-7" : "size-8"]),
|
|
231
|
+
disabled: !me.value,
|
|
232
|
+
"aria-label": V.value.trim() ? `Add ${V.value.trim()}` : "Add item",
|
|
233
|
+
title: V.value.trim() ? `Add “${V.value.trim()}”` : "Add item",
|
|
234
|
+
tabindex: "-1",
|
|
235
|
+
onMousedown: s[1] ||= ne(() => {}, ["prevent"]),
|
|
236
|
+
onClick: Z
|
|
237
|
+
}, [a(h(re), {
|
|
238
|
+
class: "size-4",
|
|
239
|
+
"aria-hidden": "true"
|
|
240
|
+
})], 42, C)], 2)], 2),
|
|
241
|
+
J.value ? (d(), r("p", {
|
|
242
|
+
key: 1,
|
|
243
|
+
id: N,
|
|
244
|
+
class: "mt-1 text-base text-danger-strong",
|
|
245
|
+
role: "alert"
|
|
246
|
+
}, m(J.value), 1)) : n("", !0),
|
|
247
|
+
G.value.length ? (d(), r("ul", {
|
|
248
|
+
key: 2,
|
|
249
|
+
ref_key: "list",
|
|
250
|
+
ref: B,
|
|
251
|
+
role: "list",
|
|
252
|
+
"aria-label": o.label,
|
|
253
|
+
class: "mt-3 flex w-full flex-wrap gap-2"
|
|
254
|
+
}, [(d(!0), r(e, null, p(G.value, (e, t) => (d(), r("li", {
|
|
255
|
+
key: `${t}-${e}`,
|
|
256
|
+
class: u(["inline-flex h-8 max-w-full min-w-0 items-center justify-between gap-2 rounded-10 border px-3 text-base text-heading transition-all duration-300 hover:shadow-sm motion-reduce:transition-none", [o.mono && "font-mono", U.value && t === G.value.length - 1 ? "border-primary bg-accent-active ring-2 ring-ring" : "border-border bg-background"]]),
|
|
257
|
+
"data-testid": "ac-tag-input-chip"
|
|
258
|
+
}, [i("span", {
|
|
259
|
+
class: "truncate",
|
|
260
|
+
title: e
|
|
261
|
+
}, m(e), 9, se), K.value ? (d(), r("button", {
|
|
262
|
+
key: 0,
|
|
263
|
+
type: "button",
|
|
264
|
+
"data-remove": "",
|
|
265
|
+
class: "inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
266
|
+
"aria-label": `Remove ${e}`,
|
|
267
|
+
title: `Remove ${e}`,
|
|
268
|
+
onClick: (e) => Q(t),
|
|
269
|
+
onKeydown: (e) => ve(e, t)
|
|
270
|
+
}, [a(h(b), {
|
|
271
|
+
class: "size-4",
|
|
272
|
+
"aria-hidden": "true"
|
|
273
|
+
})], 40, ce)) : n("", !0)], 2))), 128))], 8, oe)) : n("", !0),
|
|
274
|
+
G.value.length || o.maxItems !== void 0 ? (d(), r("div", le, [G.value.length ? (d(), r("span", w, m(G.value.length) + " " + m(G.value.length === 1 ? "item" : "items"), 1)) : n("", !0), o.maxItems === void 0 ? n("", !0) : (d(), r("span", {
|
|
275
|
+
key: 1,
|
|
276
|
+
id: P,
|
|
277
|
+
class: u(["ml-auto", q.value ? "text-danger-strong" : de.value && "text-warning-strong"])
|
|
278
|
+
}, m(G.value.length) + " / " + m(o.maxItems) + " items ", 3))])) : n("", !0),
|
|
279
|
+
K.value ? (d(), r("p", {
|
|
280
|
+
key: 4,
|
|
281
|
+
id: F,
|
|
282
|
+
class: "sr-only"
|
|
283
|
+
}, "Press Enter or comma to add a value. Backspace in the empty input removes the last one.")) : n("", !0),
|
|
284
|
+
i("p", T, m(W.value), 1)
|
|
285
|
+
], 16));
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
//#endregion
|
|
289
|
+
export { E as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export interface Props {
|
|
2
|
-
/**
|
|
2
|
+
/** Label above the field. Pass `placeholder` for an example value inside it. */
|
|
3
3
|
label: string;
|
|
4
4
|
/** Native `name` attribute. */
|
|
5
5
|
name?: string;
|
|
6
|
-
/** Visible height in lines. With `autoResize` it's the starting (minimum) height. */
|
|
6
|
+
/** Visible height in lines. Unset, the field is 160px tall (about 6 lines). With `autoResize` it's the starting (minimum) height. */
|
|
7
7
|
rows?: number;
|
|
8
8
|
/** Grows the field with its content instead of showing a scrollbar. */
|
|
9
9
|
autoResize?: boolean;
|
|
@@ -17,11 +17,11 @@ export interface Props {
|
|
|
17
17
|
required?: boolean;
|
|
18
18
|
/** Disables the field. */
|
|
19
19
|
disabled?: boolean;
|
|
20
|
-
/** Read-only field
|
|
20
|
+
/** Read-only field: a muted fill, and "(read only)" after the label. */
|
|
21
21
|
readonly?: boolean;
|
|
22
22
|
/** Error text under the field. Turns the border and label red and sets `aria-invalid`. */
|
|
23
23
|
errorMsg?: string;
|
|
24
|
-
/**
|
|
24
|
+
/** Help text between the label and the field. */
|
|
25
25
|
hint?: string;
|
|
26
26
|
}
|
|
27
27
|
type __VLS_Props = Props;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, createTextVNode as i,
|
|
2
|
-
import { CircleAlert as b } from "@lucide/vue";
|
|
1
|
+
import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, defineComponent as a, mergeModels as o, mergeProps as s, nextTick as c, normalizeClass as l, onMounted as u, openBlock as d, ref as f, toDisplayString as p, unref as m, useAttrs as h, useId as g, useModel as _, vModelText as v, watch as y, withDirectives as b } from "vue";
|
|
3
2
|
//#region src/lib/components/AcTextarea.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var x =
|
|
3
|
+
var x = ["for"], S = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "text-muted"
|
|
6
|
+
}, C = {
|
|
7
|
+
key: 1,
|
|
8
|
+
class: "text-danger",
|
|
9
|
+
"aria-hidden": "true"
|
|
10
|
+
}, w = ["id"], T = [
|
|
5
11
|
"id",
|
|
6
12
|
"name",
|
|
7
13
|
"rows",
|
|
@@ -11,22 +17,19 @@ var x = { class: "relative" }, S = [
|
|
|
11
17
|
"required",
|
|
12
18
|
"aria-invalid",
|
|
13
19
|
"aria-describedby"
|
|
14
|
-
],
|
|
15
|
-
key:
|
|
16
|
-
class: "
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
key: 0,
|
|
20
|
-
class: "mt-1.5 flex items-start gap-3"
|
|
21
|
-
}, E = ["id"], D = ["id"], O = {
|
|
22
|
-
key: 2,
|
|
20
|
+
], E = {
|
|
21
|
+
key: 1,
|
|
22
|
+
class: "mt-1 flex items-start gap-3"
|
|
23
|
+
}, D = ["id"], O = {
|
|
24
|
+
key: 1,
|
|
23
25
|
class: "flex-1"
|
|
24
|
-
}, k = ["id"], A = /*@__PURE__*/
|
|
26
|
+
}, k = ["id"], A = /*@__PURE__*/ a({
|
|
27
|
+
inheritAttrs: !1,
|
|
25
28
|
__name: "AcTextarea",
|
|
26
|
-
props: /*@__PURE__*/
|
|
29
|
+
props: /*@__PURE__*/ o({
|
|
27
30
|
label: {},
|
|
28
31
|
name: { default: "" },
|
|
29
|
-
rows: { default:
|
|
32
|
+
rows: { default: void 0 },
|
|
30
33
|
autoResize: {
|
|
31
34
|
type: Boolean,
|
|
32
35
|
default: !1
|
|
@@ -56,64 +59,83 @@ var x = { class: "relative" }, S = [
|
|
|
56
59
|
modelModifiers: {}
|
|
57
60
|
}),
|
|
58
61
|
emits: ["update:modelValue"],
|
|
59
|
-
setup(
|
|
60
|
-
let A =
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
setup(a, { expose: o }) {
|
|
63
|
+
let A = a, j = _(a, "modelValue"), M = g(), N = h(), P = e(() => ({
|
|
64
|
+
class: N.class,
|
|
65
|
+
style: N.style
|
|
66
|
+
})), F = e(() => {
|
|
67
|
+
let { class: e, style: t, ...n } = N;
|
|
68
|
+
return n;
|
|
69
|
+
}), I = f(null), L = f(!1), R = e(() => A.rows ?? 4), z = e(() => (j.value ?? "").length), B = e(() => A.maxlength !== void 0 && z.value >= A.maxlength), V = e(() => [
|
|
70
|
+
A.hint && `${M}-hint`,
|
|
71
|
+
A.errorMsg && `${M}-msg`,
|
|
72
|
+
A.maxlength !== void 0 && `${M}-count`
|
|
73
|
+
].filter(Boolean).join(" ") || void 0);
|
|
74
|
+
function H() {
|
|
75
|
+
let e = I.value;
|
|
63
76
|
if (!e || !A.autoResize) return;
|
|
64
|
-
let t = getComputedStyle(e), n = parseFloat(t.lineHeight) || 20, r = parseFloat(t.paddingTop) + parseFloat(t.paddingBottom) + parseFloat(t.borderTopWidth) + parseFloat(t.borderBottomWidth), i =
|
|
77
|
+
let t = getComputedStyle(e), n = parseFloat(t.lineHeight) || 20, r = parseFloat(t.paddingTop) + parseFloat(t.paddingBottom) + parseFloat(t.borderTopWidth) + parseFloat(t.borderBottomWidth), i = R.value * n + r, a = A.maxRows > 0 ? A.maxRows * n + r : Infinity;
|
|
65
78
|
e.style.height = "auto";
|
|
66
79
|
let o = e.scrollHeight + parseFloat(t.borderTopWidth) + parseFloat(t.borderBottomWidth);
|
|
67
|
-
e.style.height = `${Math.min(Math.max(o, i), a)}px`,
|
|
80
|
+
e.style.height = `${Math.min(Math.max(o, i), a)}px`, L.value = o > a;
|
|
68
81
|
}
|
|
69
|
-
return
|
|
82
|
+
return y(j, () => c(H)), y(() => [
|
|
70
83
|
A.autoResize,
|
|
71
84
|
A.rows,
|
|
72
85
|
A.maxRows
|
|
73
86
|
], () => {
|
|
74
|
-
!A.autoResize &&
|
|
75
|
-
}), u(
|
|
76
|
-
class:
|
|
87
|
+
!A.autoResize && I.value && (I.value.style.height = ""), c(H);
|
|
88
|
+
}), u(H), o({ focus: () => I.value?.focus() }), (e, o) => (d(), n("div", s(P.value, {
|
|
89
|
+
class: ["w-full", a.disabled && "opacity-50"],
|
|
77
90
|
"data-ac-ds": "",
|
|
78
91
|
"data-testid": "ac-textarea"
|
|
79
|
-
}, [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
92
|
+
}), [
|
|
93
|
+
r("label", {
|
|
94
|
+
for: m(M),
|
|
95
|
+
class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
|
|
96
|
+
}, [
|
|
97
|
+
r("span", null, p(a.label), 1),
|
|
98
|
+
a.readonly ? (d(), n("span", S, "(read only)")) : t("", !0),
|
|
99
|
+
a.required ? (d(), n("span", C, "*")) : t("", !0)
|
|
100
|
+
], 8, x),
|
|
101
|
+
a.hint ? (d(), n("p", {
|
|
102
|
+
key: 0,
|
|
103
|
+
id: `${m(M)}-hint`,
|
|
104
|
+
class: "mb-2 text-base text-muted"
|
|
105
|
+
}, p(a.hint), 9, w)) : t("", !0),
|
|
106
|
+
b(r("textarea", s({
|
|
107
|
+
id: m(M),
|
|
108
|
+
ref_key: "field",
|
|
109
|
+
ref: I
|
|
110
|
+
}, F.value, {
|
|
111
|
+
"onUpdate:modelValue": o[0] ||= (e) => j.value = e,
|
|
112
|
+
name: a.name,
|
|
113
|
+
rows: R.value,
|
|
114
|
+
maxlength: a.maxlength,
|
|
115
|
+
disabled: a.disabled,
|
|
116
|
+
readonly: a.readonly,
|
|
117
|
+
required: a.required,
|
|
118
|
+
"aria-invalid": !!a.errorMsg || void 0,
|
|
119
|
+
"aria-describedby": V.value,
|
|
120
|
+
class: ["block w-full rounded-10 border px-5 py-2.5 text-base text-heading transition-[color,background-color,border-color,box-shadow] duration-200 outline-none placeholder:text-muted/80 disabled:cursor-not-allowed", [
|
|
121
|
+
a.readonly ? "bg-surface-muted" : "bg-background",
|
|
122
|
+
a.rows === void 0 && "min-h-40",
|
|
123
|
+
a.mono ? "font-mono text-xs leading-5 font-normal" : "font-medium",
|
|
124
|
+
a.autoResize ? L.value ? "ac-scrollbar resize-none" : "resize-none overflow-hidden" : "ac-scrollbar resize-y",
|
|
125
|
+
a.errorMsg ? "border-danger/50 focus:border-danger focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]" : ["border-border focus:focus-ring", !a.disabled && "hover:border-accent-active"]
|
|
126
|
+
]]
|
|
127
|
+
}), null, 16, T), [[v, j.value]]),
|
|
128
|
+
a.errorMsg || a.maxlength !== void 0 ? (d(), n("div", E, [a.errorMsg ? (d(), n("p", {
|
|
129
|
+
key: 0,
|
|
130
|
+
id: `${m(M)}-msg`,
|
|
131
|
+
class: "min-w-0 flex-1 text-base text-danger-strong",
|
|
132
|
+
role: "alert"
|
|
133
|
+
}, p(a.errorMsg), 9, D)) : (d(), n("span", O)), a.maxlength === void 0 ? t("", !0) : (d(), n("p", {
|
|
134
|
+
key: 2,
|
|
135
|
+
id: `${m(M)}-count`,
|
|
136
|
+
class: l(["shrink-0 text-xs tabular-nums", B.value ? "font-medium text-danger-strong" : "text-muted"])
|
|
137
|
+
}, [o[1] ||= r("span", { class: "sr-only" }, "Characters used: ", -1), i(p(z.value) + " / " + p(a.maxlength), 1)], 10, k))])) : t("", !0)
|
|
138
|
+
], 16));
|
|
117
139
|
}
|
|
118
140
|
});
|
|
119
141
|
//#endregion
|