@ac-design/design-system 0.0.0-stage → 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/README.md +160 -2
- package/dist/lib/compat.css +4441 -0
- package/dist/lib/components/AcAccordion.js +5 -0
- package/dist/lib/components/AcAccordion.vue.d.ts +35 -0
- package/dist/lib/components/AcAccordion.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/lib/components/AcAccordionItem.js +5 -0
- package/dist/lib/components/AcAccordionItem.vue.d.ts +49 -0
- package/dist/lib/components/AcAccordionItem.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/lib/components/AcAlert.js +5 -0
- package/dist/lib/components/AcAlert.vue.d.ts +52 -0
- package/dist/lib/components/AcAlert.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/lib/components/AcAppSwitcher.js +5 -0
- package/dist/lib/components/AcAppSwitcher.vue.d.ts +83 -0
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +303 -0
- package/dist/lib/components/AcAvatar.js +5 -0
- package/dist/lib/components/AcAvatar.vue.d.ts +27 -0
- package/dist/lib/components/AcAvatar.vue_vue_type_script_setup_true_lang.js +116 -0
- package/dist/lib/components/AcBadge.js +5 -0
- package/dist/lib/components/AcBadge.vue.d.ts +32 -0
- package/dist/lib/components/AcBadge.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/lib/components/AcBanner.js +5 -0
- package/dist/lib/components/AcBanner.vue.d.ts +57 -0
- package/dist/lib/components/AcBanner.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/lib/components/AcBreadcrumb.js +5 -0
- package/dist/lib/components/AcBreadcrumb.vue.d.ts +25 -0
- package/dist/lib/components/AcBreadcrumb.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/lib/components/AcButton.js +5 -0
- package/dist/lib/components/AcButton.vue.d.ts +49 -0
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/lib/components/AcButtons.js +5 -0
- package/dist/lib/components/AcButtons.vue.d.ts +31 -0
- package/dist/lib/components/AcButtons.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/lib/components/AcCard.js +5 -0
- package/dist/lib/components/AcCard.vue.d.ts +27 -0
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/lib/components/AcCellValue.js +5 -0
- package/dist/lib/components/AcCellValue.vue.d.ts +139 -0
- package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +386 -0
- package/dist/lib/components/AcCheckBox.js +5 -0
- package/dist/lib/components/AcCheckBox.vue.d.ts +31 -0
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/lib/components/AcCheckRadio.js +5 -0
- package/dist/lib/components/AcCheckRadio.vue.d.ts +35 -0
- package/dist/lib/components/AcCheckRadio.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/lib/components/AcClusterSwitcher.js +5 -0
- package/dist/lib/components/AcClusterSwitcher.vue.d.ts +95 -0
- package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +416 -0
- package/dist/lib/components/AcCodeEditor.js +5 -0
- package/dist/lib/components/AcCodeEditor.vue.d.ts +88 -0
- package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +375 -0
- package/dist/lib/components/AcContentHeader.js +5 -0
- package/dist/lib/components/AcContentHeader.vue.d.ts +29 -0
- package/dist/lib/components/AcContentHeader.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/lib/components/AcContentLayout.js +5 -0
- package/dist/lib/components/AcContentLayout.vue.d.ts +21 -0
- package/dist/lib/components/AcContentLayout.vue_vue_type_script_setup_true_lang.js +18 -0
- package/dist/lib/components/AcContentTable.js +5 -0
- package/dist/lib/components/AcContentTable.vue.d.ts +54 -0
- package/dist/lib/components/AcContentTable.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/lib/components/AcDatePicker.js +5 -0
- package/dist/lib/components/AcDatePicker.vue.d.ts +88 -0
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +794 -0
- package/dist/lib/components/AcDeleteModal.js +5 -0
- package/dist/lib/components/AcDeleteModal.vue.d.ts +51 -0
- package/dist/lib/components/AcDeleteModal.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/lib/components/AcDivider.js +5 -0
- package/dist/lib/components/AcDivider.vue.d.ts +25 -0
- package/dist/lib/components/AcDivider.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/lib/components/AcDropdown.js +5 -0
- package/dist/lib/components/AcDropdown.vue.d.ts +45 -0
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +152 -0
- package/dist/lib/components/AcDropdownDivider.js +5 -0
- package/dist/lib/components/AcDropdownDivider.vue.d.ts +9 -0
- package/dist/lib/components/AcDropdownDivider.vue_vue_type_script_setup_true_lang.js +20 -0
- package/dist/lib/components/AcDropdownItem.js +5 -0
- package/dist/lib/components/AcDropdownItem.vue.d.ts +50 -0
- package/dist/lib/components/AcDropdownItem.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/lib/components/AcEmptyState.js +5 -0
- package/dist/lib/components/AcEmptyState.vue.d.ts +42 -0
- package/dist/lib/components/AcEmptyState.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/lib/components/AcFeatureCard.js +5 -0
- package/dist/lib/components/AcFeatureCard.vue.d.ts +84 -0
- package/dist/lib/components/AcFeatureCard.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/lib/components/AcFileEditor.js +5 -0
- package/dist/lib/components/AcFileEditor.vue.d.ts +95 -0
- package/dist/lib/components/AcFileEditor.vue_vue_type_script_setup_true_lang.js +556 -0
- package/dist/lib/components/AcFileUpload.js +5 -0
- package/dist/lib/components/AcFileUpload.vue.d.ts +67 -0
- package/dist/lib/components/AcFileUpload.vue_vue_type_script_setup_true_lang.js +274 -0
- package/dist/lib/components/AcFontScale.js +5 -0
- package/dist/lib/components/AcFontScale.vue.d.ts +17 -0
- package/dist/lib/components/AcFontScale.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/lib/components/AcForm.js +5 -0
- package/dist/lib/components/AcForm.vue.d.ts +31 -0
- package/dist/lib/components/AcForm.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/lib/components/AcFormArray.js +5 -0
- package/dist/lib/components/AcFormArray.vue.d.ts +124 -0
- package/dist/lib/components/AcFormArray.vue_vue_type_script_setup_true_lang.js +485 -0
- package/dist/lib/components/AcFormFooter.js +5 -0
- package/dist/lib/components/AcFormFooter.vue.d.ts +48 -0
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/lib/components/AcFormSection.js +5 -0
- package/dist/lib/components/AcFormSection.vue.d.ts +32 -0
- package/dist/lib/components/AcFormSection.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/lib/components/AcHeader.js +5 -0
- package/dist/lib/components/AcHeader.vue.d.ts +46 -0
- package/dist/lib/components/AcHeader.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/lib/components/AcHeaderItem.js +5 -0
- package/dist/lib/components/AcHeaderItem.vue.d.ts +13 -0
- package/dist/lib/components/AcHeaderItem.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/lib/components/AcHeaderItems.js +5 -0
- package/dist/lib/components/AcHeaderItems.vue.d.ts +13 -0
- package/dist/lib/components/AcHeaderItems.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/lib/components/AcInfoTable.js +5 -0
- package/dist/lib/components/AcInfoTable.vue.d.ts +59 -0
- package/dist/lib/components/AcInfoTable.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/lib/components/AcInput.js +5 -0
- package/dist/lib/components/AcInput.vue.d.ts +68 -0
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +143 -0
- package/dist/lib/components/AcKbd.js +5 -0
- package/dist/lib/components/AcKbd.vue.d.ts +25 -0
- package/dist/lib/components/AcKbd.vue_vue_type_script_setup_true_lang.js +134 -0
- package/dist/lib/components/AcLogo.js +5 -0
- package/dist/lib/components/AcLogo.vue.d.ts +18 -0
- package/dist/lib/components/AcLogo.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/lib/components/AcModal.js +5 -0
- package/dist/lib/components/AcModal.vue.d.ts +54 -0
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/lib/components/AcNavbar.js +5 -0
- package/dist/lib/components/AcNavbar.vue.d.ts +41 -0
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/lib/components/AcNavbarItem.js +5 -0
- package/dist/lib/components/AcNavbarItem.vue.d.ts +44 -0
- package/dist/lib/components/AcNavbarItem.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/lib/components/AcNotificationMenu.js +5 -0
- package/dist/lib/components/AcNotificationMenu.vue.d.ts +90 -0
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +345 -0
- package/dist/lib/components/AcPage.js +5 -0
- package/dist/lib/components/AcPage.vue.d.ts +25 -0
- package/dist/lib/components/AcPage.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/lib/components/AcPagination.js +5 -0
- package/dist/lib/components/AcPagination.vue.d.ts +51 -0
- package/dist/lib/components/AcPagination.vue_vue_type_script_setup_true_lang.js +160 -0
- package/dist/lib/components/AcPreloader.js +5 -0
- package/dist/lib/components/AcPreloader.vue.d.ts +28 -0
- package/dist/lib/components/AcPreloader.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/lib/components/AcProgress.js +5 -0
- package/dist/lib/components/AcProgress.vue.d.ts +31 -0
- package/dist/lib/components/AcProgress.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/lib/components/AcResourceCard.js +5 -0
- package/dist/lib/components/AcResourceCard.vue.d.ts +106 -0
- package/dist/lib/components/AcResourceCard.vue_vue_type_script_setup_true_lang.js +203 -0
- package/dist/lib/components/AcSearchBar.js +5 -0
- package/dist/lib/components/AcSearchBar.vue.d.ts +41 -0
- package/dist/lib/components/AcSearchBar.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/lib/components/AcSectionContent.js +5 -0
- package/dist/lib/components/AcSectionContent.vue.d.ts +55 -0
- package/dist/lib/components/AcSectionContent.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/lib/components/AcSegmentedControl.js +5 -0
- package/dist/lib/components/AcSegmentedControl.vue.d.ts +46 -0
- package/dist/lib/components/AcSegmentedControl.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/lib/components/AcSelect.js +5 -0
- package/dist/lib/components/AcSelect.vue.d.ts +78 -0
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +441 -0
- package/dist/lib/components/AcSidePanel.js +5 -0
- package/dist/lib/components/AcSidePanel.vue.d.ts +57 -0
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/lib/components/AcSideTabs.js +5 -0
- package/dist/lib/components/AcSideTabs.vue.d.ts +93 -0
- package/dist/lib/components/AcSideTabs.vue_vue_type_script_setup_true_lang.js +373 -0
- package/dist/lib/components/AcSidebar.js +5 -0
- package/dist/lib/components/AcSidebar.vue.d.ts +63 -0
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +221 -0
- package/dist/lib/components/AcSidebarItem.js +5 -0
- package/dist/lib/components/AcSidebarItem.vue.d.ts +55 -0
- package/dist/lib/components/AcSidebarItem.vue_vue_type_script_setup_true_lang.js +155 -0
- package/dist/lib/components/AcSidebarSection.js +5 -0
- package/dist/lib/components/AcSidebarSection.vue.d.ts +32 -0
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/lib/components/AcSkeleton.js +5 -0
- package/dist/lib/components/AcSkeleton.vue.d.ts +27 -0
- package/dist/lib/components/AcSkeleton.vue_vue_type_script_setup_true_lang.js +142 -0
- package/dist/lib/components/AcSlider.js +5 -0
- package/dist/lib/components/AcSlider.vue.d.ts +72 -0
- package/dist/lib/components/AcSlider.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/lib/components/AcSpinner.js +5 -0
- package/dist/lib/components/AcSpinner.vue.d.ts +12 -0
- package/dist/lib/components/AcSpinner.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/lib/components/AcStatCard.js +5 -0
- package/dist/lib/components/AcStatCard.vue.d.ts +84 -0
- package/dist/lib/components/AcStatCard.vue_vue_type_script_setup_true_lang.js +225 -0
- package/dist/lib/components/AcStatusBar.js +5 -0
- package/dist/lib/components/AcStatusBar.vue.d.ts +66 -0
- package/dist/lib/components/AcStatusBar.vue_vue_type_script_setup_true_lang.js +145 -0
- package/dist/lib/components/AcSteps.js +5 -0
- package/dist/lib/components/AcSteps.vue.d.ts +28 -0
- package/dist/lib/components/AcSteps.vue_vue_type_script_setup_true_lang.js +91 -0
- package/dist/lib/components/AcSwitch.js +5 -0
- package/dist/lib/components/AcSwitch.vue.d.ts +44 -0
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/lib/components/AcTable.js +5 -0
- package/dist/lib/components/AcTable.vue.d.ts +98 -0
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +272 -0
- package/dist/lib/components/AcTabs.js +5 -0
- package/dist/lib/components/AcTabs.vue.d.ts +40 -0
- package/dist/lib/components/AcTabs.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/lib/components/AcTag.js +5 -0
- package/dist/lib/components/AcTag.vue.d.ts +41 -0
- package/dist/lib/components/AcTag.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/lib/components/AcTextarea.js +5 -0
- package/dist/lib/components/AcTextarea.vue.d.ts +53 -0
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/lib/components/AcThemeMode.js +5 -0
- package/dist/lib/components/AcThemeMode.vue.d.ts +17 -0
- package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/lib/components/AcToaster.js +5 -0
- package/dist/lib/components/AcToaster.vue.d.ts +15 -0
- package/dist/lib/components/AcToaster.vue_vue_type_script_setup_true_lang.js +166 -0
- package/dist/lib/components/AcTooltip.js +5 -0
- package/dist/lib/components/AcTooltip.vue.d.ts +30 -0
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +117 -0
- package/dist/lib/components/AcUsageCard.js +5 -0
- package/dist/lib/components/AcUsageCard.vue.d.ts +85 -0
- package/dist/lib/components/AcUsageCard.vue_vue_type_script_setup_true_lang.js +230 -0
- package/dist/lib/components/AcUserMenu.js +5 -0
- package/dist/lib/components/AcUserMenu.vue.d.ts +77 -0
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +258 -0
- package/dist/lib/components/index.d.ts +76 -0
- package/dist/lib/components/types.d.ts +16 -0
- package/dist/lib/composables/useBrandColor.d.ts +53 -0
- package/dist/lib/composables/useBrandColor.js +148 -0
- package/dist/lib/composables/useColorMode.d.ts +12 -0
- package/dist/lib/composables/useColorMode.js +40 -0
- package/dist/lib/composables/useFontScale.d.ts +16 -0
- package/dist/lib/composables/useFontScale.js +43 -0
- package/dist/lib/composables/useToast.d.ts +68 -0
- package/dist/lib/composables/useToast.js +36 -0
- package/dist/lib/editor/index.d.ts +4 -0
- package/dist/lib/editor/index.js +3 -0
- package/dist/lib/editor/theme.d.ts +3 -0
- package/dist/lib/editor/theme.js +309 -0
- package/dist/lib/editor/validate.d.ts +19 -0
- package/dist/lib/editor/validate.js +127 -0
- package/dist/lib/index.d.ts +29 -0
- package/dist/lib/index.js +78 -0
- package/dist/lib/theme.css +556 -0
- package/package.json +82 -4
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import e from "./AcSpinner.js";
|
|
2
|
+
import { Fragment as t, Teleport as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as ee, nextTick as te, normalizeClass as p, normalizeStyle as ne, onBeforeUnmount as re, openBlock as m, ref as h, renderList as g, renderSlot as ie, toDisplayString as _, unref as v, useAttrs as ae, useId as oe, useModel as se, vModelText as ce, watch as le, withCtx as ue, withDirectives as de, withModifiers as y } from "vue";
|
|
3
|
+
import { Check as fe, ChevronDown as pe, CircleAlert as me, Plus as he, RefreshCw as ge, Search as _e, X as ve } from "@lucide/vue";
|
|
4
|
+
//#region src/lib/components/AcSelect.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var ye = { class: "relative" }, be = [
|
|
6
|
+
"id",
|
|
7
|
+
"tabindex",
|
|
8
|
+
"aria-expanded",
|
|
9
|
+
"aria-labelledby",
|
|
10
|
+
"aria-label",
|
|
11
|
+
"aria-disabled",
|
|
12
|
+
"aria-invalid",
|
|
13
|
+
"aria-required",
|
|
14
|
+
"aria-activedescendant"
|
|
15
|
+
], xe = { class: "flex min-w-0 flex-1 flex-wrap items-center gap-1" }, Se = { class: "truncate" }, Ce = [
|
|
16
|
+
"aria-label",
|
|
17
|
+
"disabled",
|
|
18
|
+
"onClick"
|
|
19
|
+
], we = {
|
|
20
|
+
key: 1,
|
|
21
|
+
class: "truncate"
|
|
22
|
+
}, Te = {
|
|
23
|
+
key: 2,
|
|
24
|
+
class: "truncate text-muted"
|
|
25
|
+
}, Ee = { class: "flex shrink-0 items-center gap-0.5 text-muted" }, De = ["disabled"], Oe = ["for"], ke = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "text-danger",
|
|
28
|
+
"aria-hidden": "true"
|
|
29
|
+
}, Ae = {
|
|
30
|
+
key: 0,
|
|
31
|
+
class: "mt-1.5 flex items-center gap-1 text-xs text-red-30"
|
|
32
|
+
}, je = {
|
|
33
|
+
key: 1,
|
|
34
|
+
class: "mt-1.5 text-xs text-muted"
|
|
35
|
+
}, Me = {
|
|
36
|
+
key: 0,
|
|
37
|
+
class: "border-b border-border-light p-1.5"
|
|
38
|
+
}, Ne = { class: "relative" }, Pe = ["aria-activedescendant"], Fe = ["aria-multiselectable", "aria-labelledby"], Ie = {
|
|
39
|
+
key: 0,
|
|
40
|
+
role: "presentation",
|
|
41
|
+
class: "px-2.5 pt-2.5 pb-1 text-[11px] font-medium tracking-wide text-muted uppercase first:pt-1.5"
|
|
42
|
+
}, Le = [
|
|
43
|
+
"id",
|
|
44
|
+
"aria-selected",
|
|
45
|
+
"aria-disabled",
|
|
46
|
+
"onMouseenter",
|
|
47
|
+
"onClick"
|
|
48
|
+
], Re = { class: "min-w-0 flex-1" }, ze = {
|
|
49
|
+
key: 0,
|
|
50
|
+
class: "block truncate text-xs text-muted"
|
|
51
|
+
}, Be = ["id"], Ve = { class: "min-w-0 flex-1 truncate" }, He = {
|
|
52
|
+
key: 1,
|
|
53
|
+
role: "presentation",
|
|
54
|
+
class: "px-3 py-6 text-center text-base text-muted"
|
|
55
|
+
}, Ue = /*@__PURE__*/ d({
|
|
56
|
+
inheritAttrs: !1,
|
|
57
|
+
__name: "AcSelect",
|
|
58
|
+
props: /*@__PURE__*/ f({
|
|
59
|
+
options: {},
|
|
60
|
+
by: {
|
|
61
|
+
type: Function,
|
|
62
|
+
default: void 0
|
|
63
|
+
},
|
|
64
|
+
label: { default: "" },
|
|
65
|
+
placeholder: { default: "Select…" },
|
|
66
|
+
multiple: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: !1
|
|
69
|
+
},
|
|
70
|
+
searchable: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: !1
|
|
73
|
+
},
|
|
74
|
+
creatable: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: !1
|
|
77
|
+
},
|
|
78
|
+
createText: { default: "Add" },
|
|
79
|
+
clearable: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: !1
|
|
82
|
+
},
|
|
83
|
+
loading: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: !1
|
|
86
|
+
},
|
|
87
|
+
refreshable: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: !1
|
|
90
|
+
},
|
|
91
|
+
disabled: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: !1
|
|
94
|
+
},
|
|
95
|
+
required: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: !1
|
|
98
|
+
},
|
|
99
|
+
errorMsg: { default: "" },
|
|
100
|
+
hint: { default: "" },
|
|
101
|
+
size: { default: "small" },
|
|
102
|
+
noResultText: { default: "No results" }
|
|
103
|
+
}, {
|
|
104
|
+
modelValue: { default: null },
|
|
105
|
+
modelModifiers: {}
|
|
106
|
+
}),
|
|
107
|
+
emits: /*@__PURE__*/ f([
|
|
108
|
+
"select",
|
|
109
|
+
"create",
|
|
110
|
+
"remove",
|
|
111
|
+
"search",
|
|
112
|
+
"refresh"
|
|
113
|
+
], ["update:modelValue"]),
|
|
114
|
+
setup(d, { expose: f, emit: Ue }) {
|
|
115
|
+
let b = d, x = Ue, S = se(d, "modelValue"), C = oe(), w = ae(), We = i(() => ({
|
|
116
|
+
class: w.class,
|
|
117
|
+
style: w.style
|
|
118
|
+
})), Ge = i(() => {
|
|
119
|
+
let { class: e, style: t, ...n } = w;
|
|
120
|
+
return n;
|
|
121
|
+
}), T = `${C}-list`, E = `${C}-label`, Ke = h(null), D = h(null), O = h(null), qe = h(null), k = h(!1), A = h(""), j = h(-1), M = h({
|
|
122
|
+
left: 0,
|
|
123
|
+
width: 0,
|
|
124
|
+
maxHeight: 280
|
|
125
|
+
}), N = i(() => {
|
|
126
|
+
let e = S.value;
|
|
127
|
+
return e == null || e === "" ? [] : Array.isArray(e) ? e : [e];
|
|
128
|
+
}), P = (e, t) => {
|
|
129
|
+
let n = b.by;
|
|
130
|
+
return typeof n == "function" ? n(e, t) : n && e && t && typeof e == "object" && typeof t == "object" ? e[n] === t[n] : e === t;
|
|
131
|
+
}, F = (e) => {
|
|
132
|
+
let t = b.by;
|
|
133
|
+
return String(typeof t == "string" && e && typeof e == "object" ? e[t] : e);
|
|
134
|
+
}, Je = (e, t) => {
|
|
135
|
+
let n = b.by;
|
|
136
|
+
return e && typeof e == "object" ? typeof n == "string" ? String(e[n]) : `i${t}` : String(e);
|
|
137
|
+
}, I = (e) => N.value.some((t) => P(t, e.value)), L = i(() => N.value.map((e) => b.options.find((t) => P(t.value, e)) ?? {
|
|
138
|
+
value: e,
|
|
139
|
+
label: F(e)
|
|
140
|
+
})), R = i(() => N.value.length > 0), Ye = (e) => {
|
|
141
|
+
if (!e.some((e) => e.group)) return e;
|
|
142
|
+
let t = [];
|
|
143
|
+
return e.forEach((e) => {
|
|
144
|
+
let n = e.group ?? "";
|
|
145
|
+
t.includes(n) || t.push(n);
|
|
146
|
+
}), [...e].sort((e, n) => t.indexOf(e.group ?? "") - t.indexOf(n.group ?? ""));
|
|
147
|
+
}, z = i(() => {
|
|
148
|
+
let e = A.value.trim().toLowerCase();
|
|
149
|
+
return Ye(e ? b.options.filter((t) => t.label.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e) || t.group?.toLowerCase().includes(e)) : b.options);
|
|
150
|
+
}), Xe = i(() => {
|
|
151
|
+
let e = [];
|
|
152
|
+
return z.value.forEach((t, n) => {
|
|
153
|
+
let r = t.group ?? "", i = e.find((e) => e.name === r);
|
|
154
|
+
i || e.push(i = {
|
|
155
|
+
name: r,
|
|
156
|
+
items: []
|
|
157
|
+
}), i.items.push({
|
|
158
|
+
option: t,
|
|
159
|
+
index: n
|
|
160
|
+
});
|
|
161
|
+
}), e;
|
|
162
|
+
}), B = (e) => `${C}-opt-${e}`, V = i(() => A.value.trim()), H = i(() => {
|
|
163
|
+
let e = V.value.toLowerCase();
|
|
164
|
+
if (!b.creatable || !b.searchable || !e) return !1;
|
|
165
|
+
let t = b.options.some((t) => t.label.toLowerCase() === e || F(t.value).toLowerCase() === e), n = N.value.some((t) => F(t).toLowerCase() === e);
|
|
166
|
+
return !t && !n;
|
|
167
|
+
}), U = i(() => z.value.length + +!!H.value - 1), W = i(() => z.value.length), Ze = () => {
|
|
168
|
+
let e = D.value;
|
|
169
|
+
if (!e) return;
|
|
170
|
+
let t = e.getBoundingClientRect(), n = window.innerHeight - t.bottom - 6 - 8, r = t.top - 6 - 8;
|
|
171
|
+
M.value = n < 180 && r > n ? {
|
|
172
|
+
bottom: window.innerHeight - t.top + 6,
|
|
173
|
+
left: t.left,
|
|
174
|
+
width: t.width,
|
|
175
|
+
maxHeight: Math.min(300, r)
|
|
176
|
+
} : {
|
|
177
|
+
top: t.bottom + 6,
|
|
178
|
+
left: t.left,
|
|
179
|
+
width: t.width,
|
|
180
|
+
maxHeight: Math.min(300, n)
|
|
181
|
+
};
|
|
182
|
+
}, G = (e = 0, t = 1) => {
|
|
183
|
+
for (let n = e; n >= 0 && n <= U.value; n += t) if (!z.value[n]?.disabled) return n;
|
|
184
|
+
return -1;
|
|
185
|
+
}, Qe = async () => {
|
|
186
|
+
if (b.disabled || b.loading || k.value) return;
|
|
187
|
+
k.value = !0, A.value = "", Ze();
|
|
188
|
+
let e = z.value.findIndex((e) => I(e));
|
|
189
|
+
j.value = e >= 0 ? e : G(), await te(), b.searchable && qe.value?.focus(), Y();
|
|
190
|
+
}, K = (e = !0) => {
|
|
191
|
+
k.value && (k.value = !1, j.value = -1, e && D.value?.focus());
|
|
192
|
+
}, $e = () => k.value ? K() : Qe(), et = (e) => {
|
|
193
|
+
if (!e.disabled) {
|
|
194
|
+
if (b.multiple) {
|
|
195
|
+
let t = [...N.value], n = t.findIndex((t) => P(t, e.value));
|
|
196
|
+
n >= 0 ? (t.splice(n, 1), x("remove", e)) : (t.push(e.value), x("select", e)), S.value = t;
|
|
197
|
+
} else S.value = e.value, x("select", e), K();
|
|
198
|
+
}
|
|
199
|
+
}, q = (e) => {
|
|
200
|
+
S.value = b.multiple ? N.value.filter((t) => !P(t, e.value)) : null, x("remove", e);
|
|
201
|
+
}, tt = () => {
|
|
202
|
+
let e = V.value;
|
|
203
|
+
if (!H.value || !e) return;
|
|
204
|
+
let t = e, n = {
|
|
205
|
+
value: t,
|
|
206
|
+
label: e
|
|
207
|
+
};
|
|
208
|
+
b.multiple ? (S.value = [...N.value, t], A.value = "") : (S.value = t, K()), x("select", n), x("create", e);
|
|
209
|
+
}, nt = () => {
|
|
210
|
+
L.value.forEach((e) => x("remove", e)), S.value = b.multiple ? [] : null, D.value?.focus();
|
|
211
|
+
}, J = "", rt, Y = () => te(() => O.value?.querySelector(`#${CSS.escape(B(j.value))}`)?.scrollIntoView({ block: "nearest" })), it = (e) => {
|
|
212
|
+
let t = U.value + 1;
|
|
213
|
+
if (!t) return;
|
|
214
|
+
let n = j.value;
|
|
215
|
+
for (let r = 0; r < t && (n = (n + e + t) % t, z.value[n]?.disabled); r++);
|
|
216
|
+
j.value = n, Y();
|
|
217
|
+
}, at = (e) => {
|
|
218
|
+
if (b.disabled) return;
|
|
219
|
+
let t = e.key;
|
|
220
|
+
if (!k.value) {
|
|
221
|
+
[
|
|
222
|
+
"Enter",
|
|
223
|
+
" ",
|
|
224
|
+
"ArrowDown",
|
|
225
|
+
"ArrowUp"
|
|
226
|
+
].includes(t) ? (e.preventDefault(), Qe()) : t === "Backspace" && b.multiple && R.value && e.target === D.value && q(L.value[L.value.length - 1]);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (t === "ArrowDown") e.preventDefault(), it(1);
|
|
230
|
+
else if (t === "ArrowUp") e.preventDefault(), it(-1);
|
|
231
|
+
else if (t === "Home") e.preventDefault(), j.value = G(), Y();
|
|
232
|
+
else if (t === "End") e.preventDefault(), j.value = G(U.value, -1), Y();
|
|
233
|
+
else if (t === "Enter" || t === " " && !b.searchable) {
|
|
234
|
+
e.preventDefault();
|
|
235
|
+
let t = z.value[j.value];
|
|
236
|
+
t ? et(t) : H.value && tt();
|
|
237
|
+
} else if (t === "Escape") e.preventDefault(), K();
|
|
238
|
+
else if (t === "Tab") K(!1);
|
|
239
|
+
else if (!b.searchable && t.length === 1 && !e.metaKey && !e.ctrlKey) {
|
|
240
|
+
J += t.toLowerCase(), clearTimeout(rt), rt = setTimeout(() => J = "", 500);
|
|
241
|
+
let e = z.value.findIndex((e) => !e.disabled && e.label.toLowerCase().startsWith(J));
|
|
242
|
+
e >= 0 && (j.value = e, Y());
|
|
243
|
+
}
|
|
244
|
+
}, ot = (e) => {
|
|
245
|
+
let t = e.target;
|
|
246
|
+
Ke.value?.contains(t) || O.value?.contains(t) || K(!1);
|
|
247
|
+
}, X = (e) => {
|
|
248
|
+
e && O.value?.contains(e.target) || Ze();
|
|
249
|
+
}, st = () => {
|
|
250
|
+
document.removeEventListener("pointerdown", ot, !0), window.removeEventListener("scroll", X, !0), window.removeEventListener("resize", X);
|
|
251
|
+
};
|
|
252
|
+
le(k, (e) => {
|
|
253
|
+
if (!e) return st();
|
|
254
|
+
document.addEventListener("pointerdown", ot, !0), window.addEventListener("scroll", X, !0), window.addEventListener("resize", X);
|
|
255
|
+
}), le(A, (e) => {
|
|
256
|
+
x("search", e), j.value = G();
|
|
257
|
+
}), re(st);
|
|
258
|
+
let Z = h(!1), Q = i(() => k.value || Z.value), ct = i(() => !!b.label && (R.value || Q.value)), $ = i(() => !b.multiple && L.value[0]?.label || "");
|
|
259
|
+
return f({ focus: () => D.value?.focus() }), (i, f) => (m(), s("div", ee({
|
|
260
|
+
ref_key: "root",
|
|
261
|
+
ref: Ke
|
|
262
|
+
}, We.value, {
|
|
263
|
+
class: ["w-full", d.disabled && "opacity-60"],
|
|
264
|
+
"data-ac-ds": "",
|
|
265
|
+
"data-testid": "ac-select"
|
|
266
|
+
}), [
|
|
267
|
+
c("div", ye, [c("div", ee({
|
|
268
|
+
id: `${v(C)}-trigger`,
|
|
269
|
+
ref_key: "trigger",
|
|
270
|
+
ref: D
|
|
271
|
+
}, Ge.value, {
|
|
272
|
+
role: "combobox",
|
|
273
|
+
tabindex: d.disabled ? -1 : 0,
|
|
274
|
+
"aria-haspopup": "listbox",
|
|
275
|
+
"aria-expanded": k.value,
|
|
276
|
+
"aria-controls": T,
|
|
277
|
+
"aria-labelledby": d.label ? E : void 0,
|
|
278
|
+
"aria-label": d.label ? void 0 : d.placeholder,
|
|
279
|
+
"aria-disabled": d.disabled || void 0,
|
|
280
|
+
"aria-invalid": !!d.errorMsg || void 0,
|
|
281
|
+
"aria-required": d.required || void 0,
|
|
282
|
+
"aria-activedescendant": k.value && !d.searchable && j.value >= 0 ? B(j.value) : void 0,
|
|
283
|
+
class: ["group flex w-full items-center gap-2 rounded-6 border bg-surface pr-2 pl-3 text-left text-base text-heading shadow-xs transition-[border-color,box-shadow] duration-150 outline-none", [
|
|
284
|
+
d.size === "compact" ? "min-h-8" : d.size === "small" ? "min-h-9" : "min-h-10",
|
|
285
|
+
d.multiple && R.value ? "py-1.5" : "",
|
|
286
|
+
d.label && R.value && d.multiple ? "pt-2.5" : "",
|
|
287
|
+
d.disabled || d.loading ? "cursor-not-allowed" : "cursor-pointer",
|
|
288
|
+
d.errorMsg ? ["border-red-60", Q.value && "border-danger shadow-[0_0_0_3px_var(--color-red-90)]"] : Q.value ? "focus-ring" : "border-border hover:border-border-dark"
|
|
289
|
+
]],
|
|
290
|
+
onClick: $e,
|
|
291
|
+
onKeydown: at,
|
|
292
|
+
onFocus: f[1] ||= (e) => Z.value = !0,
|
|
293
|
+
onBlur: f[2] ||= (e) => Z.value = !1
|
|
294
|
+
}), [c("div", xe, [d.multiple && R.value ? (m(!0), s(t, { key: 0 }, g(L.value, (e, t) => (m(), s("span", {
|
|
295
|
+
key: Je(e.value, t),
|
|
296
|
+
class: "inline-flex h-6 max-w-full items-center gap-1 rounded-4 bg-surface-sunken pr-0.5 pl-2 text-xs font-medium text-heading ring-1 ring-border ring-inset"
|
|
297
|
+
}, [c("span", Se, _(e.label), 1), c("button", {
|
|
298
|
+
type: "button",
|
|
299
|
+
class: "inline-flex size-4.5 cursor-pointer items-center justify-center rounded-2 text-muted transition hover:bg-slate-80 hover:text-heading",
|
|
300
|
+
"aria-label": `Remove ${e.label}`,
|
|
301
|
+
disabled: d.disabled,
|
|
302
|
+
onClick: y((t) => q(e), ["stop"])
|
|
303
|
+
}, [u(v(ve), {
|
|
304
|
+
class: "size-2.5",
|
|
305
|
+
"stroke-width": 2.5,
|
|
306
|
+
"aria-hidden": "true"
|
|
307
|
+
})], 8, Ce)]))), 128)) : $.value ? (m(), s("span", we, _($.value), 1)) : d.label ? o("", !0) : (m(), s("span", Te, _(d.placeholder), 1))]), c("span", Ee, [
|
|
308
|
+
d.loading ? (m(), a(e, {
|
|
309
|
+
key: 0,
|
|
310
|
+
class: "text-primary"
|
|
311
|
+
})) : d.refreshable ? (m(), s("button", {
|
|
312
|
+
key: 1,
|
|
313
|
+
type: "button",
|
|
314
|
+
class: "inline-flex size-6 cursor-pointer items-center justify-center rounded-4 transition hover:bg-surface-sunken hover:text-heading",
|
|
315
|
+
"aria-label": "Refresh options",
|
|
316
|
+
disabled: d.disabled,
|
|
317
|
+
onClick: f[0] ||= y((e) => x("refresh"), ["stop"])
|
|
318
|
+
}, [u(v(ge), {
|
|
319
|
+
class: "size-3.5",
|
|
320
|
+
"aria-hidden": "true"
|
|
321
|
+
})], 8, De)) : o("", !0),
|
|
322
|
+
d.clearable && R.value && !d.disabled && !d.loading ? (m(), s("button", {
|
|
323
|
+
key: 2,
|
|
324
|
+
type: "button",
|
|
325
|
+
class: "inline-flex size-6 cursor-pointer items-center justify-center rounded-4 transition hover:bg-surface-sunken hover:text-heading",
|
|
326
|
+
"aria-label": "Clear selection",
|
|
327
|
+
onClick: y(nt, ["stop"])
|
|
328
|
+
}, [u(v(ve), {
|
|
329
|
+
class: "size-3.5",
|
|
330
|
+
"aria-hidden": "true"
|
|
331
|
+
})])) : o("", !0),
|
|
332
|
+
u(v(pe), {
|
|
333
|
+
class: p(["size-4 transition-transform duration-200", k.value && "rotate-180 text-heading"]),
|
|
334
|
+
"aria-hidden": "true"
|
|
335
|
+
}, null, 8, ["class"])
|
|
336
|
+
])], 16, be), d.label ? (m(), s("label", {
|
|
337
|
+
key: 0,
|
|
338
|
+
id: E,
|
|
339
|
+
for: `${v(C)}-trigger`,
|
|
340
|
+
class: p(["pointer-events-none absolute left-2.5 rounded-2 bg-surface px-1 transition-all duration-150 ease-out", [ct.value ? "top-0 -translate-y-1/2 text-xs font-medium" : "top-1/2 -translate-y-1/2 text-base text-muted", ct.value && (d.errorMsg ? "text-red-30" : Q.value ? "text-primary-20" : "text-label")]])
|
|
341
|
+
}, [l(_(d.label), 1), d.required ? (m(), s("span", ke, " *")) : o("", !0)], 10, Oe)) : o("", !0)]),
|
|
342
|
+
d.errorMsg ? (m(), s("p", Ae, [u(v(me), {
|
|
343
|
+
class: "size-3.5 shrink-0",
|
|
344
|
+
"aria-hidden": "true"
|
|
345
|
+
}), l(" " + _(d.errorMsg), 1)])) : d.hint ? (m(), s("p", je, _(d.hint), 1)) : o("", !0),
|
|
346
|
+
(m(), a(n, { to: "body" }, [u(r, {
|
|
347
|
+
"enter-active-class": "transition duration-150 ease-out",
|
|
348
|
+
"enter-from-class": "opacity-0 -translate-y-1 scale-[0.98]",
|
|
349
|
+
"leave-active-class": "transition duration-100 ease-in",
|
|
350
|
+
"leave-to-class": "opacity-0"
|
|
351
|
+
}, {
|
|
352
|
+
default: ue(() => [k.value ? (m(), s("div", {
|
|
353
|
+
key: 0,
|
|
354
|
+
ref_key: "panel",
|
|
355
|
+
ref: O,
|
|
356
|
+
class: "fixed z-[90] flex flex-col overflow-hidden rounded-8 border border-border bg-surface shadow-lg",
|
|
357
|
+
style: ne({
|
|
358
|
+
top: M.value.top === void 0 ? void 0 : `${M.value.top}px`,
|
|
359
|
+
bottom: M.value.bottom === void 0 ? void 0 : `${M.value.bottom}px`,
|
|
360
|
+
left: `${M.value.left}px`,
|
|
361
|
+
width: `${M.value.width}px`,
|
|
362
|
+
maxHeight: `${M.value.maxHeight}px`
|
|
363
|
+
}),
|
|
364
|
+
"data-ac-ds": "",
|
|
365
|
+
"data-testid": "ac-select-panel"
|
|
366
|
+
}, [d.searchable ? (m(), s("div", Me, [c("div", Ne, [u(v(_e), {
|
|
367
|
+
class: "pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted",
|
|
368
|
+
"aria-hidden": "true"
|
|
369
|
+
}), de(c("input", {
|
|
370
|
+
ref_key: "searchInput",
|
|
371
|
+
ref: qe,
|
|
372
|
+
"onUpdate:modelValue": f[3] ||= (e) => A.value = e,
|
|
373
|
+
type: "text",
|
|
374
|
+
placeholder: "Search…",
|
|
375
|
+
"aria-label": "Search options",
|
|
376
|
+
"aria-controls": T,
|
|
377
|
+
"aria-activedescendant": j.value >= 0 ? B(j.value) : void 0,
|
|
378
|
+
class: "h-8 w-full rounded-4 bg-surface-muted pr-2 pl-8 text-base text-heading outline-none placeholder:text-muted focus:bg-surface focus:ring-1 focus:ring-border",
|
|
379
|
+
onKeydown: at
|
|
380
|
+
}, null, 40, Pe), [[ce, A.value]])])])) : o("", !0), c("ul", {
|
|
381
|
+
id: T,
|
|
382
|
+
role: "listbox",
|
|
383
|
+
"aria-multiselectable": d.multiple || void 0,
|
|
384
|
+
"aria-labelledby": d.label ? E : void 0,
|
|
385
|
+
class: "ac-scrollbar min-h-0 flex-1 p-1"
|
|
386
|
+
}, [
|
|
387
|
+
(m(!0), s(t, null, g(Xe.value, (e) => (m(), s(t, { key: e.name }, [e.name ? (m(), s("li", Ie, _(e.name), 1)) : o("", !0), (m(!0), s(t, null, g(e.items, ({ option: e, index: t }) => (m(), s("li", {
|
|
388
|
+
id: B(t),
|
|
389
|
+
key: Je(e.value, t),
|
|
390
|
+
role: "option",
|
|
391
|
+
"aria-selected": I(e),
|
|
392
|
+
"aria-disabled": e.disabled || void 0,
|
|
393
|
+
class: p(["flex cursor-pointer items-start gap-2.5 rounded-6 px-2.5 py-1.5 text-base transition-colors duration-75", [e.disabled ? "cursor-not-allowed opacity-40" : "", t === j.value ? "bg-surface-muted text-heading" : "text-heading"]]),
|
|
394
|
+
onMouseenter: (n) => !e.disabled && (j.value = t),
|
|
395
|
+
onMousedown: f[4] ||= y(() => {}, ["prevent"]),
|
|
396
|
+
onClick: (t) => et(e)
|
|
397
|
+
}, [
|
|
398
|
+
d.multiple ? (m(), s("span", {
|
|
399
|
+
key: 0,
|
|
400
|
+
class: p(["mt-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-4 border transition-colors", I(e) ? "border-primary bg-primary text-white shadow-button" : "border-border-dark bg-surface"]),
|
|
401
|
+
"aria-hidden": "true"
|
|
402
|
+
}, [I(e) ? (m(), a(v(fe), {
|
|
403
|
+
key: 0,
|
|
404
|
+
class: "size-3",
|
|
405
|
+
"stroke-width": 3,
|
|
406
|
+
"aria-hidden": "true"
|
|
407
|
+
})) : o("", !0)], 2)) : o("", !0),
|
|
408
|
+
c("span", Re, [ie(i.$slots, "option", {
|
|
409
|
+
option: e,
|
|
410
|
+
selected: I(e),
|
|
411
|
+
active: t === j.value
|
|
412
|
+
}, () => [c("span", { class: p(["block truncate", I(e) && "font-medium"]) }, _(e.label), 3), e.description ? (m(), s("span", ze, _(e.description), 1)) : o("", !0)])]),
|
|
413
|
+
!d.multiple && I(e) ? (m(), a(v(fe), {
|
|
414
|
+
key: 1,
|
|
415
|
+
class: "mt-0.5 size-4 shrink-0 text-primary",
|
|
416
|
+
"aria-hidden": "true"
|
|
417
|
+
})) : o("", !0)
|
|
418
|
+
], 42, Le))), 128))], 64))), 128)),
|
|
419
|
+
H.value ? (m(), s("li", {
|
|
420
|
+
key: 0,
|
|
421
|
+
id: B(W.value),
|
|
422
|
+
role: "option",
|
|
423
|
+
"aria-selected": "false",
|
|
424
|
+
class: p(["flex cursor-pointer items-center gap-2 rounded-6 px-2.5 py-1.5 text-base text-heading transition-colors duration-75", W.value === j.value && "bg-surface-muted"]),
|
|
425
|
+
"data-testid": "ac-select-create",
|
|
426
|
+
onMouseenter: f[5] ||= (e) => j.value = W.value,
|
|
427
|
+
onMousedown: f[6] ||= y(() => {}, ["prevent"]),
|
|
428
|
+
onClick: tt
|
|
429
|
+
}, [u(v(he), {
|
|
430
|
+
class: "size-4 shrink-0 text-primary",
|
|
431
|
+
"aria-hidden": "true"
|
|
432
|
+
}), c("span", Ve, _(d.createText) + " “" + _(V.value) + "”", 1)], 42, Be)) : o("", !0),
|
|
433
|
+
!z.value.length && !H.value ? (m(), s("li", He, [ie(i.$slots, "empty", { query: A.value }, () => [l(_(A.value ? `${d.noResultText} for “${A.value}”` : "No options"), 1)])])) : o("", !0)
|
|
434
|
+
], 8, Fe)], 4)) : o("", !0)]),
|
|
435
|
+
_: 3
|
|
436
|
+
})]))
|
|
437
|
+
], 16));
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
//#endregion
|
|
441
|
+
export { Ue as default };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface Props {
|
|
2
|
+
/** Heading of the panel. */
|
|
3
|
+
title?: string;
|
|
4
|
+
/** Optional line under the title. */
|
|
5
|
+
description?: string;
|
|
6
|
+
/** Edge the panel slides in from. */
|
|
7
|
+
side?: "right" | "left";
|
|
8
|
+
/** Width: `small` 400px, `normal` 520px, `large` 800px, `full` the whole viewport. Phones always get the full width. */
|
|
9
|
+
size?: "small" | "normal" | "large" | "full";
|
|
10
|
+
/** Shows the close button and allows Escape to close. Turn off while a required action runs. Old `disable-modal-close` inverted. */
|
|
11
|
+
closable?: boolean;
|
|
12
|
+
/** Closes when the backdrop is clicked. Old `ignore-outside-click` inverted. */
|
|
13
|
+
closeOnOutsideClick?: boolean;
|
|
14
|
+
/** Hides the footer bar. Old `hide-action-footer`. */
|
|
15
|
+
hideFooter?: boolean;
|
|
16
|
+
}
|
|
17
|
+
type __VLS_Props = Props;
|
|
18
|
+
type __VLS_Slots = {
|
|
19
|
+
/** Panel body. Scrolls when it's taller than the viewport. Old `#custom-message`. */
|
|
20
|
+
default?: () => unknown;
|
|
21
|
+
/** Replaces the title and description. */
|
|
22
|
+
header?: () => unknown;
|
|
23
|
+
/** Buttons next to the close button, e.g. a docs link. */
|
|
24
|
+
"header-actions"?: () => unknown;
|
|
25
|
+
/** Right-aligned footer buttons: Cancel, then the primary action. Old `#footer-button`. */
|
|
26
|
+
footer?: () => unknown;
|
|
27
|
+
/** Left side of the footer, e.g. a status line. */
|
|
28
|
+
"footer-left"?: () => unknown;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_ModelProps = {
|
|
31
|
+
/** Whether the panel is open. Bind with `v-model:open`. */
|
|
32
|
+
"open"?: boolean;
|
|
33
|
+
};
|
|
34
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
35
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
"update:open": (value: boolean) => any;
|
|
37
|
+
close: () => any;
|
|
38
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
39
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
40
|
+
onClose?: (() => any) | undefined;
|
|
41
|
+
}>, {
|
|
42
|
+
title: string;
|
|
43
|
+
description: string;
|
|
44
|
+
size: "small" | "normal" | "large" | "full";
|
|
45
|
+
closable: boolean;
|
|
46
|
+
closeOnOutsideClick: boolean;
|
|
47
|
+
hideFooter: boolean;
|
|
48
|
+
side: "right" | "left";
|
|
49
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
50
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
51
|
+
declare const _default: typeof __VLS_export;
|
|
52
|
+
export default _default;
|
|
53
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
54
|
+
new (): {
|
|
55
|
+
$slots: S;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Teleport as e, Transition as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, mergeModels as c, nextTick as l, normalizeClass as u, onBeforeUnmount as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, unref as g, useId as _, useModel as v, watch as y, withCtx as b, withModifiers as x } from "vue";
|
|
2
|
+
import { X as S } from "@lucide/vue";
|
|
3
|
+
//#region src/lib/components/AcSidePanel.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var C = ["aria-labelledby", "aria-describedby"], w = { class: "flex shrink-0 items-start gap-4 border-b border-border-light px-5 py-4" }, T = { class: "min-w-0 flex-1" }, E = ["id"], D = ["id"], O = { class: "-mt-0.5 -mr-1.5 flex shrink-0 items-center gap-1" }, k = {
|
|
5
|
+
"data-panel-body": "",
|
|
6
|
+
class: "ac-scrollbar min-h-0 flex-1 px-5 py-5"
|
|
7
|
+
}, A = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-border-light bg-surface-muted px-5 py-3"
|
|
10
|
+
}, j = { class: "flex min-w-0 items-center gap-2" }, M = { class: "ml-auto flex items-center gap-2" }, N = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", P = /*@__PURE__*/ s({
|
|
11
|
+
__name: "AcSidePanel",
|
|
12
|
+
props: /*@__PURE__*/ c({
|
|
13
|
+
title: { default: "" },
|
|
14
|
+
description: { default: "" },
|
|
15
|
+
side: { default: "right" },
|
|
16
|
+
size: { default: "normal" },
|
|
17
|
+
closable: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: !0
|
|
20
|
+
},
|
|
21
|
+
closeOnOutsideClick: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: !0
|
|
24
|
+
},
|
|
25
|
+
hideFooter: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: !1
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
open: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !1
|
|
33
|
+
},
|
|
34
|
+
openModifiers: {}
|
|
35
|
+
}),
|
|
36
|
+
emits: /*@__PURE__*/ c(["close"], ["update:open"]),
|
|
37
|
+
setup(s, { emit: c }) {
|
|
38
|
+
let P = s, F = v(s, "open"), I = c, L = {
|
|
39
|
+
small: "sm:max-w-100",
|
|
40
|
+
normal: "sm:max-w-130",
|
|
41
|
+
large: "sm:max-w-200",
|
|
42
|
+
full: ""
|
|
43
|
+
}, R = _(), z = p(null), B = null;
|
|
44
|
+
function V() {
|
|
45
|
+
P.closable && (F.value = !1, I("close"));
|
|
46
|
+
}
|
|
47
|
+
function H(e) {
|
|
48
|
+
if (e.key === "Escape") {
|
|
49
|
+
if (e.defaultPrevented) return;
|
|
50
|
+
e.stopPropagation(), V();
|
|
51
|
+
} else if (e.key === "Tab" && z.value) {
|
|
52
|
+
let t = [...z.value.querySelectorAll(N)].filter((e) => e.offsetParent !== null);
|
|
53
|
+
if (!t.length) return;
|
|
54
|
+
let n = t[0], r = t[t.length - 1];
|
|
55
|
+
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function U(e) {
|
|
59
|
+
let t = document.body, n = Number(t.dataset.acModals ?? 0) + (e ? 1 : -1);
|
|
60
|
+
if (t.dataset.acModals = String(Math.max(n, 0)), e && n === 1) {
|
|
61
|
+
let e = window.innerWidth - document.documentElement.clientWidth;
|
|
62
|
+
t.style.overflow = "hidden", e > 0 && (t.style.paddingRight = `${e}px`);
|
|
63
|
+
} else !e && n <= 0 && (t.style.overflow = "", t.style.paddingRight = "");
|
|
64
|
+
}
|
|
65
|
+
return y(F, async (e, t) => {
|
|
66
|
+
if (e) {
|
|
67
|
+
B = document.activeElement, U(!0), await l();
|
|
68
|
+
let e = z.value?.querySelector("[autofocus]");
|
|
69
|
+
((e && (e.matches(N) ? e : e.querySelector(N))) ?? z.value?.querySelector(`[data-panel-body] ${N}`) ?? z.value)?.focus();
|
|
70
|
+
} else t && (U(!1), B?.focus?.());
|
|
71
|
+
}, { immediate: !0 }), d(() => {
|
|
72
|
+
F.value && U(!1);
|
|
73
|
+
}), (c, l) => (f(), n(e, { to: "body" }, [o(t, {
|
|
74
|
+
"enter-active-class": "transition-opacity duration-300 ease-out",
|
|
75
|
+
"enter-from-class": s.side === "right" ? "opacity-0 [&_[data-panel]]:translate-x-full" : "opacity-0 [&_[data-panel]]:-translate-x-full",
|
|
76
|
+
"leave-active-class": "transition-opacity duration-200 ease-in",
|
|
77
|
+
"leave-to-class": s.side === "right" ? "opacity-0 [&_[data-panel]]:translate-x-full" : "opacity-0 [&_[data-panel]]:-translate-x-full"
|
|
78
|
+
}, {
|
|
79
|
+
default: b(() => [F.value ? (f(), i("div", {
|
|
80
|
+
key: 0,
|
|
81
|
+
class: "fixed inset-0 z-[80] bg-overlay backdrop-blur-[2px]",
|
|
82
|
+
"data-ac-ds": "",
|
|
83
|
+
"data-testid": "ac-side-panel",
|
|
84
|
+
onKeydown: H,
|
|
85
|
+
onMousedown: l[0] ||= x((e) => s.closeOnOutsideClick && V(), ["self"])
|
|
86
|
+
}, [a("div", {
|
|
87
|
+
ref_key: "panel",
|
|
88
|
+
ref: z,
|
|
89
|
+
"data-panel": "",
|
|
90
|
+
role: "dialog",
|
|
91
|
+
"aria-modal": "true",
|
|
92
|
+
"aria-labelledby": s.title ? `${g(R)}-title` : void 0,
|
|
93
|
+
"aria-describedby": s.description ? `${g(R)}-desc` : void 0,
|
|
94
|
+
tabindex: "-1",
|
|
95
|
+
class: u(["absolute inset-y-0 flex w-full flex-col bg-surface shadow-xl outline-none transition-transform duration-300 ease-out-soft motion-reduce:transition-none", [
|
|
96
|
+
s.side === "right" ? "right-0" : "left-0",
|
|
97
|
+
s.size !== "full" && (s.side === "right" ? "border-border sm:border-l" : "border-border sm:border-r"),
|
|
98
|
+
L[s.size]
|
|
99
|
+
]])
|
|
100
|
+
}, [
|
|
101
|
+
a("header", w, [a("div", T, [m(c.$slots, "header", {}, () => [a("h4", {
|
|
102
|
+
id: `${g(R)}-title`,
|
|
103
|
+
class: "text-[16px] leading-6 tracking-[-0.015em]"
|
|
104
|
+
}, h(s.title), 9, E), s.description ? (f(), i("p", {
|
|
105
|
+
key: 0,
|
|
106
|
+
id: `${g(R)}-desc`,
|
|
107
|
+
class: "mt-0.5 text-base text-muted"
|
|
108
|
+
}, h(s.description), 9, D)) : r("", !0)])]), a("div", O, [m(c.$slots, "header-actions"), s.closable ? (f(), i("button", {
|
|
109
|
+
key: 0,
|
|
110
|
+
type: "button",
|
|
111
|
+
class: "inline-flex size-7 cursor-pointer items-center justify-center rounded-6 text-muted transition hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring",
|
|
112
|
+
"aria-label": "Close",
|
|
113
|
+
"data-ac-ds": "",
|
|
114
|
+
"data-testid": "ac-side-panel-close",
|
|
115
|
+
onClick: V
|
|
116
|
+
}, [o(g(S), {
|
|
117
|
+
class: "size-4",
|
|
118
|
+
"aria-hidden": "true"
|
|
119
|
+
})])) : r("", !0)])]),
|
|
120
|
+
a("div", k, [m(c.$slots, "default")]),
|
|
121
|
+
!s.hideFooter && (c.$slots.footer || c.$slots["footer-left"]) ? (f(), i("footer", A, [a("div", j, [m(c.$slots, "footer-left")]), a("div", M, [m(c.$slots, "footer")])])) : r("", !0)
|
|
122
|
+
], 10, C)], 32)) : r("", !0)]),
|
|
123
|
+
_: 3
|
|
124
|
+
}, 8, ["enter-from-class", "leave-to-class"])]));
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
//#endregion
|
|
128
|
+
export { P as default };
|