@ac-design/design-system 0.0.0-stage → 1.0.1
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 +381 -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 +127 -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/copyText.d.ts +6 -0
- package/dist/lib/composables/copyText.js +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,794 @@
|
|
|
1
|
+
import e from "./AcButton.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, onMounted as ie, openBlock as m, reactive as ae, ref as h, renderList as g, resolveDynamicComponent as oe, toDisplayString as _, unref as v, useAttrs as se, useId as ce, useModel as le, watch as ue, withCtx as de } from "vue";
|
|
3
|
+
import { Calendar as fe, CalendarRange as pe, ChevronLeft as me, ChevronRight as he, CircleAlert as ge, Timer as _e, X as ve } from "@lucide/vue";
|
|
4
|
+
//#region src/lib/components/AcDatePicker.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var ye = { class: "relative" }, be = [
|
|
6
|
+
"id",
|
|
7
|
+
"disabled",
|
|
8
|
+
"aria-expanded",
|
|
9
|
+
"aria-labelledby",
|
|
10
|
+
"aria-describedby",
|
|
11
|
+
"aria-invalid",
|
|
12
|
+
"aria-required"
|
|
13
|
+
], xe = ["for"], Se = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "text-danger",
|
|
16
|
+
"aria-hidden": "true"
|
|
17
|
+
}, Ce = { class: "pointer-events-none absolute inset-y-0 right-2 flex items-center gap-0.5 text-muted" }, we = ["aria-label"], Te = ["name", "value"], Ee = ["aria-label"], De = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "flex shrink-0 flex-wrap gap-1 border-b border-border-light p-2 sm:w-40 sm:flex-col sm:flex-nowrap sm:border-r sm:border-b-0",
|
|
20
|
+
role: "group",
|
|
21
|
+
"aria-label": "Presets"
|
|
22
|
+
}, Oe = ["onClick"], ke = {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: "p-4"
|
|
25
|
+
}, Ae = { class: "text-base font-medium text-heading" }, je = {
|
|
26
|
+
class: "text-xs text-muted tabular-nums",
|
|
27
|
+
"aria-live": "polite"
|
|
28
|
+
}, Me = { class: "mt-3 grid grid-cols-3 gap-2" }, Ne = { class: "mb-1 block text-xs font-medium text-label" }, Pe = [
|
|
29
|
+
"value",
|
|
30
|
+
"aria-valuenow",
|
|
31
|
+
"aria-valuemin",
|
|
32
|
+
"aria-valuemax",
|
|
33
|
+
"onKeydown",
|
|
34
|
+
"onInput",
|
|
35
|
+
"onBlur"
|
|
36
|
+
], Fe = {
|
|
37
|
+
key: 1,
|
|
38
|
+
class: "p-3"
|
|
39
|
+
}, Ie = { class: "mb-2 flex items-center justify-between gap-2" }, Le = ["abbr"], Re = ["aria-selected"], ze = [
|
|
40
|
+
"data-day",
|
|
41
|
+
"tabindex",
|
|
42
|
+
"aria-label",
|
|
43
|
+
"aria-disabled",
|
|
44
|
+
"aria-current",
|
|
45
|
+
"onClick",
|
|
46
|
+
"onMouseenter"
|
|
47
|
+
], Be = {
|
|
48
|
+
key: 0,
|
|
49
|
+
class: "absolute bottom-1 left-1/2 size-1 -translate-x-1/2 rounded-full bg-primary",
|
|
50
|
+
"aria-hidden": "true"
|
|
51
|
+
}, Ve = {
|
|
52
|
+
key: 0,
|
|
53
|
+
class: "mt-2 space-y-2 border-t border-border-light pt-3"
|
|
54
|
+
}, He = ["aria-label"], Ue = { class: "text-xs font-medium text-label" }, We = { class: "flex items-center gap-1" }, Ge = {
|
|
55
|
+
key: 0,
|
|
56
|
+
class: "text-muted",
|
|
57
|
+
"aria-hidden": "true"
|
|
58
|
+
}, Ke = [
|
|
59
|
+
"value",
|
|
60
|
+
"aria-label",
|
|
61
|
+
"aria-valuenow",
|
|
62
|
+
"aria-valuemin",
|
|
63
|
+
"aria-valuemax",
|
|
64
|
+
"onKeydown",
|
|
65
|
+
"onInput",
|
|
66
|
+
"onBlur"
|
|
67
|
+
], qe = { class: "text-xs text-muted" }, Je = {
|
|
68
|
+
key: 2,
|
|
69
|
+
class: "flex flex-wrap items-center gap-2 border-t border-border-light px-3 py-2.5"
|
|
70
|
+
}, Ye = ["disabled"], Xe = {
|
|
71
|
+
key: 1,
|
|
72
|
+
class: "basis-full text-xs text-red-30",
|
|
73
|
+
role: "alert"
|
|
74
|
+
}, y = /*@__PURE__*/ d({
|
|
75
|
+
inheritAttrs: !1,
|
|
76
|
+
__name: "AcDatePicker",
|
|
77
|
+
props: /*@__PURE__*/ f({
|
|
78
|
+
label: { default: "" },
|
|
79
|
+
placeholder: { default: "" },
|
|
80
|
+
mode: { default: "date" },
|
|
81
|
+
range: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: !1
|
|
84
|
+
},
|
|
85
|
+
minDate: { default: "" },
|
|
86
|
+
maxDate: { default: "" },
|
|
87
|
+
isDateDisabled: {
|
|
88
|
+
type: Function,
|
|
89
|
+
default: void 0
|
|
90
|
+
},
|
|
91
|
+
presets: { default: () => [] },
|
|
92
|
+
timeZone: { default: "" },
|
|
93
|
+
locale: { default: void 0 },
|
|
94
|
+
weekStartsOn: { default: void 0 },
|
|
95
|
+
showSeconds: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: !1
|
|
98
|
+
},
|
|
99
|
+
clearable: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: !1
|
|
102
|
+
},
|
|
103
|
+
disabled: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: !1
|
|
106
|
+
},
|
|
107
|
+
required: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
default: !1
|
|
110
|
+
},
|
|
111
|
+
errorMsg: { default: "" },
|
|
112
|
+
hint: { default: "" },
|
|
113
|
+
size: { default: "small" },
|
|
114
|
+
name: { default: "" }
|
|
115
|
+
}, {
|
|
116
|
+
modelValue: { default: null },
|
|
117
|
+
modelModifiers: {},
|
|
118
|
+
open: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: !1
|
|
121
|
+
},
|
|
122
|
+
openModifiers: {}
|
|
123
|
+
}),
|
|
124
|
+
emits: ["update:modelValue", "update:open"],
|
|
125
|
+
setup(d, { expose: f }) {
|
|
126
|
+
let y = d, Ze = le(d, "modelValue"), b = le(d, "open"), Qe = /^\d{4}-\d{2}-\d{2}$/, $e = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?$/, et = {
|
|
127
|
+
w: 604800,
|
|
128
|
+
d: 86400,
|
|
129
|
+
h: 3600,
|
|
130
|
+
m: 60,
|
|
131
|
+
s: 1,
|
|
132
|
+
ms: .001,
|
|
133
|
+
us: 1e-6,
|
|
134
|
+
µs: 1e-6,
|
|
135
|
+
ns: 1e-9
|
|
136
|
+
}, tt = Date.UTC(2023, 0, 1), x = ce(), nt = se(), rt = i(() => ({
|
|
137
|
+
class: nt.class,
|
|
138
|
+
style: nt.style
|
|
139
|
+
})), it = i(() => {
|
|
140
|
+
let { class: e, style: t, ...n } = nt;
|
|
141
|
+
return n;
|
|
142
|
+
}), at = `${x}-label`, ot = `${x}-value`, st = `${x}-month`, ct = `${x}-msg`, lt = /* @__PURE__ */ new Map(), ut = h(null), S = h(null), C = h(null), w = h({
|
|
143
|
+
left: 0,
|
|
144
|
+
maxHeight: 480
|
|
145
|
+
}), T = h("2026-01-01"), E = h("2026-01-01"), D = h(null), O = h(null), k = h(null), A = ae({
|
|
146
|
+
h: 0,
|
|
147
|
+
m: 0,
|
|
148
|
+
s: 0
|
|
149
|
+
}), j = ae({
|
|
150
|
+
h: 23,
|
|
151
|
+
m: 59,
|
|
152
|
+
s: 59
|
|
153
|
+
}), M = ae({
|
|
154
|
+
d: 0,
|
|
155
|
+
h: 0,
|
|
156
|
+
m: 0
|
|
157
|
+
}), N = i(() => y.timeZone || Intl.DateTimeFormat().resolvedOptions().timeZone), P = i(() => y.range && y.mode !== "duration"), F = i(() => y.mode === "datetime"), dt = i(() => y.weekStartsOn ?? Vt()), ft = i(() => new Intl.DateTimeFormat(y.locale, {
|
|
158
|
+
year: "numeric",
|
|
159
|
+
month: "short",
|
|
160
|
+
day: "numeric",
|
|
161
|
+
timeZone: "UTC"
|
|
162
|
+
})), I = i(() => new Intl.DateTimeFormat(y.locale, {
|
|
163
|
+
year: "numeric",
|
|
164
|
+
month: "short",
|
|
165
|
+
day: "numeric",
|
|
166
|
+
hour: "2-digit",
|
|
167
|
+
minute: "2-digit",
|
|
168
|
+
second: y.showSeconds ? "2-digit" : void 0,
|
|
169
|
+
hourCycle: "h23",
|
|
170
|
+
timeZone: N.value,
|
|
171
|
+
timeZoneName: "short"
|
|
172
|
+
})), pt = i(() => new Intl.DateTimeFormat(y.locale, {
|
|
173
|
+
month: "long",
|
|
174
|
+
year: "numeric",
|
|
175
|
+
timeZone: "UTC"
|
|
176
|
+
})), mt = i(() => new Intl.DateTimeFormat(y.locale, {
|
|
177
|
+
weekday: "long",
|
|
178
|
+
year: "numeric",
|
|
179
|
+
month: "long",
|
|
180
|
+
day: "numeric",
|
|
181
|
+
timeZone: "UTC"
|
|
182
|
+
})), ht = i(() => new Intl.DateTimeFormat(y.locale, {
|
|
183
|
+
day: "numeric",
|
|
184
|
+
timeZone: "UTC"
|
|
185
|
+
})), gt = i(() => {
|
|
186
|
+
let e = new Intl.DateTimeFormat(y.locale, {
|
|
187
|
+
weekday: "short",
|
|
188
|
+
timeZone: "UTC"
|
|
189
|
+
}), t = new Intl.DateTimeFormat(y.locale, {
|
|
190
|
+
weekday: "long",
|
|
191
|
+
timeZone: "UTC"
|
|
192
|
+
});
|
|
193
|
+
return Array.from({ length: 7 }, (n, r) => {
|
|
194
|
+
let i = new Date(tt + (dt.value + r) % 7 * 864e5);
|
|
195
|
+
return {
|
|
196
|
+
short: e.format(i),
|
|
197
|
+
long: t.format(i)
|
|
198
|
+
};
|
|
199
|
+
});
|
|
200
|
+
}), _t = i(() => new Intl.DateTimeFormat(y.locale, {
|
|
201
|
+
timeZone: N.value,
|
|
202
|
+
timeZoneName: "short"
|
|
203
|
+
}).formatToParts(Date.now()).find((e) => e.type === "timeZoneName")?.value ?? N.value), L = i(() => K(Date.now()).day), R = i(() => y.minDate ? Y(y.minDate) : null), z = i(() => y.maxDate ? Y(y.maxDate) : null), vt = i(() => y.minDate ? J(y.minDate) : null), yt = i(() => y.maxDate ? Qe.test(y.maxDate) ? q(W(y.maxDate, 1), 0, 0, 0) - 1e3 : J(y.maxDate) : null), B = i(() => {
|
|
204
|
+
let e = Ze.value;
|
|
205
|
+
return P.value ? Array.isArray(e) ? [e[0] || null, e[1] || null] : [null, null] : [typeof e == "string" && e ? e : null];
|
|
206
|
+
}), bt = i(() => B.value.some(Boolean)), xt = i(() => {
|
|
207
|
+
let [e, t] = B.value;
|
|
208
|
+
if (!e) return "";
|
|
209
|
+
if (y.mode === "duration") {
|
|
210
|
+
let t = Ut(e);
|
|
211
|
+
return t === null ? e : Gt(t);
|
|
212
|
+
}
|
|
213
|
+
if (y.mode === "date") {
|
|
214
|
+
let n = Y(e), r = t ? Y(t) : null;
|
|
215
|
+
return n ? P.value ? r ? ft.value.formatRange(U(n), U(r)) : `${ft.value.format(U(n))} –` : ft.value.format(U(n)) : e;
|
|
216
|
+
}
|
|
217
|
+
let n = J(e), r = t ? J(t) : null;
|
|
218
|
+
return n === null ? e : P.value ? r === null ? `${I.value.format(n)} –` : I.value.formatRange(n, r) : I.value.format(n);
|
|
219
|
+
}), St = i(() => B.value.filter(Boolean).join("/")), Ct = i(() => {
|
|
220
|
+
let e = (Bt(T.value) - dt.value + 7) % 7, t = W(T.value, -e);
|
|
221
|
+
return Array.from({ length: 6 }, (e, n) => Array.from({ length: 7 }, (e, r) => W(t, n * 7 + r)));
|
|
222
|
+
}), wt = i(() => !P.value || !O.value ? null : k.value ?? D.value ?? null), V = i(() => O.value ? q(O.value, A.h, A.m, A.s) : null), Tt = i(() => k.value ? q(k.value, j.h, j.m, j.s) : null), Et = i(() => {
|
|
223
|
+
if (!F.value) return "";
|
|
224
|
+
let e = P.value ? [V.value, Tt.value] : [V.value];
|
|
225
|
+
for (let t of e) if (t !== null) {
|
|
226
|
+
if (vt.value !== null && t < vt.value) return `Choose a time from ${I.value.format(vt.value)}`;
|
|
227
|
+
if (yt.value !== null && t > yt.value) return `Choose a time up to ${I.value.format(yt.value)}`;
|
|
228
|
+
}
|
|
229
|
+
return P.value && V.value !== null && Tt.value !== null && Tt.value < V.value ? "The end must be after the start" : "";
|
|
230
|
+
}), Dt = i(() => y.mode === "duration" ? !0 : !O.value || P.value && !k.value ? !1 : !Et.value), Ot = i(() => M.d * 86400 + M.h * 3600 + M.m * 60), kt = i(() => {
|
|
231
|
+
let e = [{
|
|
232
|
+
key: "start",
|
|
233
|
+
label: P.value ? "Start" : "Time",
|
|
234
|
+
clock: A
|
|
235
|
+
}];
|
|
236
|
+
return P.value && e.push({
|
|
237
|
+
key: "end",
|
|
238
|
+
label: "End",
|
|
239
|
+
clock: j
|
|
240
|
+
}), e.map((e) => ({
|
|
241
|
+
...e,
|
|
242
|
+
spinners: Xt(e.clock, e.label)
|
|
243
|
+
}));
|
|
244
|
+
}), At = i(() => [
|
|
245
|
+
Z("d", "Days", 0, 999, !1, !1, () => M.d, (e) => M.d = e),
|
|
246
|
+
Z("h", "Hours", 0, 23, !1, !1, () => M.h, (e) => M.h = e),
|
|
247
|
+
Z("m", "Minutes", 0, 59, !1, !1, () => M.m, (e) => M.m = e)
|
|
248
|
+
]), jt = h(!1), Mt = i(() => b.value || jt.value), Nt = i(() => !!y.label && (bt.value || Mt.value)), Pt = i(() => y.errorMsg || y.hint ? ct : void 0), Ft = i(() => {
|
|
249
|
+
if (y.mode === "duration") return y.label || "Choose duration";
|
|
250
|
+
let e = P.value ? "date range" : F.value ? "date and time" : "date";
|
|
251
|
+
return y.label ? `${y.label}: choose ${e}` : `Choose ${e}`;
|
|
252
|
+
}), It = i(() => y.mode === "duration" ? _e : P.value ? pe : fe);
|
|
253
|
+
function Lt(e) {
|
|
254
|
+
return String(e).padStart(2, "0");
|
|
255
|
+
}
|
|
256
|
+
function Rt(e, t, n) {
|
|
257
|
+
let r = new Date(Date.UTC(e, t - 1, n));
|
|
258
|
+
return `${r.getUTCFullYear()}-${Lt(r.getUTCMonth() + 1)}-${Lt(r.getUTCDate())}`;
|
|
259
|
+
}
|
|
260
|
+
function H(e) {
|
|
261
|
+
let [t, n, r] = e.split("-").map(Number);
|
|
262
|
+
return {
|
|
263
|
+
y: t,
|
|
264
|
+
m: n,
|
|
265
|
+
d: r
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function U(e) {
|
|
269
|
+
let { y: t, m: n, d: r } = H(e);
|
|
270
|
+
return new Date(Date.UTC(t, n - 1, r));
|
|
271
|
+
}
|
|
272
|
+
function W(e, t) {
|
|
273
|
+
let { y: n, m: r, d: i } = H(e);
|
|
274
|
+
return Rt(n, r, i + t);
|
|
275
|
+
}
|
|
276
|
+
function zt(e, t) {
|
|
277
|
+
let { y: n, m: r, d: i } = H(e), a = new Date(Date.UTC(n, r - 1 + t + 1, 0)).getUTCDate();
|
|
278
|
+
return Rt(n, r + t, Math.min(i, a));
|
|
279
|
+
}
|
|
280
|
+
function G(e) {
|
|
281
|
+
return `${e.slice(0, 7)}-01`;
|
|
282
|
+
}
|
|
283
|
+
function Bt(e) {
|
|
284
|
+
return U(e).getUTCDay();
|
|
285
|
+
}
|
|
286
|
+
function Vt() {
|
|
287
|
+
try {
|
|
288
|
+
let e = new Intl.Locale(y.locale ?? navigator.language), t = (e.getWeekInfo?.() ?? e.weekInfo)?.firstDay;
|
|
289
|
+
if (t) return t % 7;
|
|
290
|
+
} catch {}
|
|
291
|
+
return 0;
|
|
292
|
+
}
|
|
293
|
+
function K(e) {
|
|
294
|
+
let t = lt.get(N.value);
|
|
295
|
+
t || (t = new Intl.DateTimeFormat("en-US", {
|
|
296
|
+
timeZone: N.value,
|
|
297
|
+
hourCycle: "h23",
|
|
298
|
+
year: "numeric",
|
|
299
|
+
month: "2-digit",
|
|
300
|
+
day: "2-digit",
|
|
301
|
+
hour: "2-digit",
|
|
302
|
+
minute: "2-digit",
|
|
303
|
+
second: "2-digit"
|
|
304
|
+
}), lt.set(N.value, t));
|
|
305
|
+
let n = {};
|
|
306
|
+
for (let { type: r, value: i } of t.formatToParts(e)) r !== "literal" && (n[r] = Number(i));
|
|
307
|
+
return {
|
|
308
|
+
day: Rt(n.year, n.month, n.day),
|
|
309
|
+
h: n.hour % 24,
|
|
310
|
+
m: n.minute,
|
|
311
|
+
s: n.second
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function Ht(e) {
|
|
315
|
+
let t = K(e), { y: n, m: r, d: i } = H(t.day);
|
|
316
|
+
return Date.UTC(n, r - 1, i, t.h, t.m, t.s) - Math.floor(e / 1e3) * 1e3;
|
|
317
|
+
}
|
|
318
|
+
function q(e, t, n, r) {
|
|
319
|
+
let { y: i, m: a, d: o } = H(e), s = Date.UTC(i, a - 1, o, t, n, r), c = Ht(s), l = s - c, u = Ht(l);
|
|
320
|
+
return u === c ? l : s - u;
|
|
321
|
+
}
|
|
322
|
+
function J(e) {
|
|
323
|
+
let t = $e.exec(e);
|
|
324
|
+
if (t) return q(t[1], Number(t[2]), Number(t[3]), Number(t[4] ?? 0));
|
|
325
|
+
if (Qe.test(e)) return q(e, 0, 0, 0);
|
|
326
|
+
let n = Date.parse(e);
|
|
327
|
+
return Number.isNaN(n) ? null : n;
|
|
328
|
+
}
|
|
329
|
+
function Y(e) {
|
|
330
|
+
if (Qe.test(e)) return e;
|
|
331
|
+
let t = J(e);
|
|
332
|
+
return t === null ? null : K(t).day;
|
|
333
|
+
}
|
|
334
|
+
function X(e) {
|
|
335
|
+
return new Date(e).toISOString().replace(/\.000Z$/, "Z");
|
|
336
|
+
}
|
|
337
|
+
function Ut(e) {
|
|
338
|
+
let t = e.replace(/\s+/g, "");
|
|
339
|
+
if (!t) return null;
|
|
340
|
+
if (t === "0") return 0;
|
|
341
|
+
let n = /(\d+(?:\.\d+)?)(ns|us|µs|ms|w|d|h|m|s)/y, r = 0, i = 0, a;
|
|
342
|
+
for (; a = n.exec(t);) r += Number(a[1]) * et[a[2]], i = n.lastIndex;
|
|
343
|
+
return i === t.length ? r : null;
|
|
344
|
+
}
|
|
345
|
+
function Wt(e) {
|
|
346
|
+
if (e <= 0) return null;
|
|
347
|
+
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.round(e % 60);
|
|
348
|
+
return `${t ? `${t}h` : ""}${n ? `${n}m` : ""}${r ? `${r}s` : ""}` || null;
|
|
349
|
+
}
|
|
350
|
+
function Gt(e) {
|
|
351
|
+
let t = Math.floor(e / 86400), n = Math.floor(e % 86400 / 3600), r = Math.floor(e % 3600 / 60), i = Math.round(e % 60);
|
|
352
|
+
return [
|
|
353
|
+
t && `${t}d`,
|
|
354
|
+
n && `${n}h`,
|
|
355
|
+
r && `${r}m`,
|
|
356
|
+
i && `${i}s`
|
|
357
|
+
].filter(Boolean).join(" ") || "0m";
|
|
358
|
+
}
|
|
359
|
+
function Kt(e) {
|
|
360
|
+
return R.value && e < R.value || z.value && e > z.value ? !0 : y.isDateDisabled?.(e) ?? !1;
|
|
361
|
+
}
|
|
362
|
+
function qt(e) {
|
|
363
|
+
return e === O.value || P.value && e === (k.value ?? wt.value);
|
|
364
|
+
}
|
|
365
|
+
function Jt(e) {
|
|
366
|
+
let t = O.value, n = wt.value;
|
|
367
|
+
if (!t || !n) return !1;
|
|
368
|
+
let [r, i] = t <= n ? [t, n] : [n, t];
|
|
369
|
+
return e >= r && e <= i;
|
|
370
|
+
}
|
|
371
|
+
function Yt(e) {
|
|
372
|
+
let t = O.value, n = wt.value, [r, i] = t <= n ? [t, n] : [n, t];
|
|
373
|
+
return [e === r && "rounded-l-6", e === i && "rounded-r-6"];
|
|
374
|
+
}
|
|
375
|
+
function Z(e, t, n, r, i, a, o, s) {
|
|
376
|
+
return {
|
|
377
|
+
key: e,
|
|
378
|
+
label: t,
|
|
379
|
+
min: n,
|
|
380
|
+
max: r,
|
|
381
|
+
wrap: i,
|
|
382
|
+
padded: a,
|
|
383
|
+
get: o,
|
|
384
|
+
set: s
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
function Xt(e, t) {
|
|
388
|
+
let n = [Z("h", `${t} hours`, 0, 23, !0, !0, () => e.h, (t) => e.h = t), Z("m", `${t} minutes`, 0, 59, !0, !0, () => e.m, (t) => e.m = t)];
|
|
389
|
+
return y.showSeconds && n.push(Z("s", `${t} seconds`, 0, 59, !0, !0, () => e.s, (t) => e.s = t)), n;
|
|
390
|
+
}
|
|
391
|
+
function Zt(e) {
|
|
392
|
+
return e.padded ? Lt(e.get()) : String(e.get());
|
|
393
|
+
}
|
|
394
|
+
function Qt(e, t) {
|
|
395
|
+
let n = t.get(), r = t.max - t.min + 1, i = null;
|
|
396
|
+
e.key === "ArrowUp" ? i = n + 1 : e.key === "ArrowDown" ? i = n - 1 : e.key === "PageUp" ? i = n + 10 : e.key === "PageDown" ? i = n - 10 : e.key === "Home" ? i = t.min : e.key === "End" && (i = t.max), i !== null && (e.preventDefault(), i = t.wrap ? ((i - t.min) % r + r) % r + t.min : Math.min(t.max, Math.max(t.min, i)), t.set(i), e.target.value = Zt(t));
|
|
397
|
+
}
|
|
398
|
+
function $t(e, t) {
|
|
399
|
+
let n = e.target, r = n.value.replace(/\D/g, "").slice(0, String(t.max).length);
|
|
400
|
+
if (n.value = r, !r) return;
|
|
401
|
+
let i = Number(r);
|
|
402
|
+
i > t.max && (i = Number(r.slice(-1))), t.set(Math.max(t.min, i));
|
|
403
|
+
}
|
|
404
|
+
function en(e, t) {
|
|
405
|
+
e.target.value = Zt(t);
|
|
406
|
+
}
|
|
407
|
+
function tn() {
|
|
408
|
+
if (D.value = null, y.mode === "duration") {
|
|
409
|
+
let e = B.value[0] ? Ut(B.value[0]) ?? 0 : 0;
|
|
410
|
+
M.d = Math.floor(e / 86400), M.h = Math.floor(e % 86400 / 3600), M.m = Math.floor(e % 3600 / 60);
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
let [e, t] = B.value;
|
|
414
|
+
if (O.value = null, k.value = null, Object.assign(A, {
|
|
415
|
+
h: 0,
|
|
416
|
+
m: 0,
|
|
417
|
+
s: 0
|
|
418
|
+
}), Object.assign(j, {
|
|
419
|
+
h: 23,
|
|
420
|
+
m: 59,
|
|
421
|
+
s: y.showSeconds ? 59 : 0
|
|
422
|
+
}), F.value) {
|
|
423
|
+
let n = e ? J(e) : null, r = t ? J(t) : null;
|
|
424
|
+
if (n !== null) {
|
|
425
|
+
let e = K(n);
|
|
426
|
+
O.value = e.day, Object.assign(A, {
|
|
427
|
+
h: e.h,
|
|
428
|
+
m: e.m,
|
|
429
|
+
s: e.s
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
if (r !== null) {
|
|
433
|
+
let e = K(r);
|
|
434
|
+
k.value = e.day, Object.assign(j, {
|
|
435
|
+
h: e.h,
|
|
436
|
+
m: e.m,
|
|
437
|
+
s: e.s
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
} else O.value = e ? Y(e) : null, k.value = t ? Y(t) : null;
|
|
441
|
+
let n = O.value ?? L.value;
|
|
442
|
+
!O.value && R.value && n < R.value && (n = R.value), !O.value && z.value && n > z.value && (n = z.value), E.value = n, T.value = G(n);
|
|
443
|
+
}
|
|
444
|
+
function nn() {
|
|
445
|
+
let e = S.value;
|
|
446
|
+
if (!e) return;
|
|
447
|
+
let t = e.getBoundingClientRect(), n = C.value?.offsetWidth ?? 300, r = C.value?.offsetHeight ?? 380, i = window.innerHeight - t.bottom - 6 - 8, a = t.top - 6 - 8, o = i < r && a > i, s = Math.max(8, Math.min(t.left, window.innerWidth - n - 8));
|
|
448
|
+
w.value = o ? {
|
|
449
|
+
bottom: window.innerHeight - t.top + 6,
|
|
450
|
+
left: s,
|
|
451
|
+
maxHeight: Math.max(200, a)
|
|
452
|
+
} : {
|
|
453
|
+
top: t.bottom + 6,
|
|
454
|
+
left: s,
|
|
455
|
+
maxHeight: Math.max(200, i)
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function rn() {
|
|
459
|
+
y.disabled || b.value || (b.value = !0);
|
|
460
|
+
}
|
|
461
|
+
function Q(e = !0) {
|
|
462
|
+
b.value && (b.value = !1, e && S.value?.focus());
|
|
463
|
+
}
|
|
464
|
+
async function an() {
|
|
465
|
+
tn(), nn(), yn(), await te(), nn(), y.mode === "duration" ? C.value?.querySelector("input")?.focus() : on();
|
|
466
|
+
}
|
|
467
|
+
function on() {
|
|
468
|
+
te(() => C.value?.querySelector(`[data-day="${E.value}"]`)?.focus());
|
|
469
|
+
}
|
|
470
|
+
function $(e) {
|
|
471
|
+
Ze.value = e, Q();
|
|
472
|
+
}
|
|
473
|
+
function sn(e) {
|
|
474
|
+
if (!Kt(e)) {
|
|
475
|
+
if (E.value = e, G(e) !== T.value && (T.value = G(e), on()), !P.value) {
|
|
476
|
+
O.value = e, F.value || $(e);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
if (!O.value || k.value) {
|
|
480
|
+
O.value = e, k.value = null;
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
e < O.value ? (k.value = O.value, O.value = e) : k.value = e, D.value = null, F.value || $([O.value, k.value]);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function cn() {
|
|
487
|
+
if (Dt.value) {
|
|
488
|
+
if (y.mode === "duration") return $(Wt(Ot.value));
|
|
489
|
+
if (!F.value) return $(P.value ? [O.value, k.value] : O.value);
|
|
490
|
+
$(P.value ? [X(V.value), X(Tt.value)] : X(V.value));
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
function ln() {
|
|
494
|
+
let e = K(Date.now());
|
|
495
|
+
O.value = e.day, Object.assign(A, {
|
|
496
|
+
h: e.h,
|
|
497
|
+
m: e.m,
|
|
498
|
+
s: y.showSeconds ? e.s : 0
|
|
499
|
+
}), E.value = e.day, T.value = G(e.day);
|
|
500
|
+
}
|
|
501
|
+
function un() {
|
|
502
|
+
sn(L.value);
|
|
503
|
+
}
|
|
504
|
+
function dn(e) {
|
|
505
|
+
if (e.value) return $(e.value());
|
|
506
|
+
if (!e.duration) return;
|
|
507
|
+
if (y.mode === "duration") return $(Wt(Ut(e.duration) ?? 0));
|
|
508
|
+
let t = Math.floor(Date.now() / 1e3) * 1e3, n = t - (Ut(e.duration) ?? 0) * 1e3;
|
|
509
|
+
if (y.mode === "date") return $(P.value ? [K(n).day, K(t).day] : K(n).day);
|
|
510
|
+
$(P.value ? [X(n), X(t)] : X(n));
|
|
511
|
+
}
|
|
512
|
+
function fn() {
|
|
513
|
+
Ze.value = null, S.value?.focus();
|
|
514
|
+
}
|
|
515
|
+
function pn(e) {
|
|
516
|
+
T.value = zt(T.value, e), E.value = zt(E.value, e);
|
|
517
|
+
}
|
|
518
|
+
function mn(e) {
|
|
519
|
+
let t = E.value, n = (Bt(t) - dt.value + 7) % 7, r = {
|
|
520
|
+
ArrowLeft: () => W(t, -1),
|
|
521
|
+
ArrowRight: () => W(t, 1),
|
|
522
|
+
ArrowUp: () => W(t, -7),
|
|
523
|
+
ArrowDown: () => W(t, 7),
|
|
524
|
+
Home: () => W(t, -n),
|
|
525
|
+
End: () => W(t, 6 - n),
|
|
526
|
+
PageUp: () => zt(t, e.shiftKey ? -12 : -1),
|
|
527
|
+
PageDown: () => zt(t, e.shiftKey ? 12 : 1)
|
|
528
|
+
};
|
|
529
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
530
|
+
e.preventDefault(), sn(t);
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
let i = r[e.key];
|
|
534
|
+
i && (e.preventDefault(), E.value = i(), T.value = G(E.value), P.value && O.value && !k.value && (D.value = E.value), on());
|
|
535
|
+
}
|
|
536
|
+
function hn(e) {
|
|
537
|
+
if (e.key === "Escape") {
|
|
538
|
+
e.preventDefault(), e.stopPropagation(), Q();
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
if (e.key !== "Tab" || !C.value) return;
|
|
542
|
+
let t = [...C.value.querySelectorAll("button:not([disabled]), input:not([disabled])")].filter((e) => e.tabIndex >= 0);
|
|
543
|
+
if (!t.length) return;
|
|
544
|
+
let n = t[0], r = t[t.length - 1];
|
|
545
|
+
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
546
|
+
}
|
|
547
|
+
function gn(e) {
|
|
548
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(), rn());
|
|
549
|
+
}
|
|
550
|
+
function _n(e) {
|
|
551
|
+
let t = e.target;
|
|
552
|
+
ut.value?.contains(t) || C.value?.contains(t) || Q(!1);
|
|
553
|
+
}
|
|
554
|
+
function vn(e) {
|
|
555
|
+
e && C.value?.contains(e.target) || nn();
|
|
556
|
+
}
|
|
557
|
+
function yn() {
|
|
558
|
+
document.addEventListener("pointerdown", _n, !0), window.addEventListener("scroll", vn, !0), window.addEventListener("resize", vn);
|
|
559
|
+
}
|
|
560
|
+
function bn() {
|
|
561
|
+
document.removeEventListener("pointerdown", _n, !0), window.removeEventListener("scroll", vn, !0), window.removeEventListener("resize", vn);
|
|
562
|
+
}
|
|
563
|
+
return ue(b, (e) => e ? an() : bn()), ie(() => {
|
|
564
|
+
b.value && an();
|
|
565
|
+
}), re(bn), f({ focus: () => S.value?.focus() }), (i, f) => (m(), s("div", ee({
|
|
566
|
+
ref_key: "root",
|
|
567
|
+
ref: ut
|
|
568
|
+
}, rt.value, {
|
|
569
|
+
class: ["w-full", d.disabled && "opacity-60"],
|
|
570
|
+
"data-ac-ds": "",
|
|
571
|
+
"data-testid": "ac-date-picker"
|
|
572
|
+
}), [
|
|
573
|
+
c("div", ye, [
|
|
574
|
+
c("button", ee({
|
|
575
|
+
id: `${v(x)}-trigger`,
|
|
576
|
+
ref_key: "trigger",
|
|
577
|
+
ref: S
|
|
578
|
+
}, it.value, {
|
|
579
|
+
type: "button",
|
|
580
|
+
disabled: d.disabled,
|
|
581
|
+
"aria-haspopup": "dialog",
|
|
582
|
+
"aria-expanded": b.value,
|
|
583
|
+
"aria-labelledby": d.label ? `${at} ${ot}` : ot,
|
|
584
|
+
"aria-describedby": Pt.value,
|
|
585
|
+
"aria-invalid": !!d.errorMsg || void 0,
|
|
586
|
+
"aria-required": d.required || void 0,
|
|
587
|
+
class: ["flex w-full items-center rounded-6 border bg-surface pr-16 pl-3 text-left text-base text-heading shadow-xs transition-[border-color,box-shadow] duration-150 outline-none disabled:cursor-not-allowed disabled:bg-surface-muted", [
|
|
588
|
+
d.size === "small" ? "h-9" : "h-10",
|
|
589
|
+
d.disabled ? "" : "cursor-pointer",
|
|
590
|
+
d.errorMsg ? ["border-red-60", Mt.value && "border-danger shadow-[0_0_0_3px_var(--color-red-90)]"] : Mt.value ? "focus-ring" : "border-border hover:border-border-dark"
|
|
591
|
+
]],
|
|
592
|
+
onClick: f[0] ||= (e) => b.value ? Q() : rn(),
|
|
593
|
+
onKeydown: gn,
|
|
594
|
+
onFocus: f[1] ||= (e) => jt.value = !0,
|
|
595
|
+
onBlur: f[2] ||= (e) => jt.value = !1
|
|
596
|
+
}), [c("span", {
|
|
597
|
+
id: ot,
|
|
598
|
+
class: p(["truncate tabular-nums", !xt.value && "text-muted"])
|
|
599
|
+
}, _(xt.value || (d.label ? "" : d.placeholder || (d.mode === "duration" ? "Choose duration" : "Choose date"))), 3)], 16, be),
|
|
600
|
+
d.label ? (m(), s("label", {
|
|
601
|
+
key: 0,
|
|
602
|
+
id: at,
|
|
603
|
+
for: `${v(x)}-trigger`,
|
|
604
|
+
class: p(["pointer-events-none absolute left-2.5 rounded-2 px-1 transition-all duration-150 ease-out", [
|
|
605
|
+
d.disabled ? "bg-linear-to-b from-surface from-50% to-surface-muted to-50%" : "bg-surface",
|
|
606
|
+
Nt.value ? "top-0 -translate-y-1/2 text-xs font-medium" : "top-1/2 -translate-y-1/2 text-base text-muted",
|
|
607
|
+
Nt.value && (d.errorMsg ? "text-red-30" : Mt.value ? "text-primary-20" : "text-label")
|
|
608
|
+
]])
|
|
609
|
+
}, [l(_(d.label), 1), d.required ? (m(), s("span", Se, " *")) : o("", !0)], 10, xe)) : o("", !0),
|
|
610
|
+
c("span", Ce, [d.clearable && bt.value && !d.disabled ? (m(), s("button", {
|
|
611
|
+
key: 0,
|
|
612
|
+
type: "button",
|
|
613
|
+
class: "pointer-events-auto inline-flex size-6 cursor-pointer items-center justify-center rounded-4 transition hover:bg-surface-sunken hover:text-heading focus-visible:ring-[3px] focus-visible:ring-ring focus-visible:outline-none",
|
|
614
|
+
"aria-label": d.label ? `Clear ${d.label}` : "Clear",
|
|
615
|
+
onClick: fn
|
|
616
|
+
}, [u(v(ve), {
|
|
617
|
+
class: "size-3.5",
|
|
618
|
+
"aria-hidden": "true"
|
|
619
|
+
})], 8, we)) : o("", !0), (m(), a(oe(It.value), {
|
|
620
|
+
class: p(["mx-1 size-4", b.value && "text-heading"]),
|
|
621
|
+
"aria-hidden": "true"
|
|
622
|
+
}, null, 8, ["class"]))])
|
|
623
|
+
]),
|
|
624
|
+
d.errorMsg ? (m(), s("p", {
|
|
625
|
+
key: 0,
|
|
626
|
+
id: ct,
|
|
627
|
+
class: "mt-1.5 flex items-center gap-1 text-xs text-red-30"
|
|
628
|
+
}, [u(v(ge), {
|
|
629
|
+
class: "size-3.5 shrink-0",
|
|
630
|
+
"aria-hidden": "true"
|
|
631
|
+
}), l(" " + _(d.errorMsg), 1)])) : d.hint ? (m(), s("p", {
|
|
632
|
+
key: 1,
|
|
633
|
+
id: ct,
|
|
634
|
+
class: "mt-1.5 text-xs text-muted"
|
|
635
|
+
}, _(d.hint), 1)) : o("", !0),
|
|
636
|
+
d.name ? (m(), s("input", {
|
|
637
|
+
key: 2,
|
|
638
|
+
type: "hidden",
|
|
639
|
+
name: d.name,
|
|
640
|
+
value: St.value
|
|
641
|
+
}, null, 8, Te)) : o("", !0),
|
|
642
|
+
(m(), a(n, { to: "body" }, [u(r, {
|
|
643
|
+
"enter-active-class": "transition duration-150 ease-out motion-reduce:transition-opacity",
|
|
644
|
+
"enter-from-class": "opacity-0 -translate-y-1 scale-[0.98]",
|
|
645
|
+
"leave-active-class": "transition duration-100 ease-in",
|
|
646
|
+
"leave-to-class": "opacity-0"
|
|
647
|
+
}, {
|
|
648
|
+
default: de(() => [b.value ? (m(), s("div", {
|
|
649
|
+
key: 0,
|
|
650
|
+
ref_key: "panel",
|
|
651
|
+
ref: C,
|
|
652
|
+
role: "dialog",
|
|
653
|
+
"aria-modal": "true",
|
|
654
|
+
"aria-label": Ft.value,
|
|
655
|
+
class: "ac-scrollbar fixed z-[90] flex max-w-[calc(100vw-16px)] flex-col rounded-10 border border-border bg-surface shadow-lg sm:flex-row",
|
|
656
|
+
style: ne({
|
|
657
|
+
top: w.value.top === void 0 ? void 0 : `${w.value.top}px`,
|
|
658
|
+
bottom: w.value.bottom === void 0 ? void 0 : `${w.value.bottom}px`,
|
|
659
|
+
left: `${w.value.left}px`,
|
|
660
|
+
maxHeight: `${w.value.maxHeight}px`
|
|
661
|
+
}),
|
|
662
|
+
"data-ac-ds": "",
|
|
663
|
+
"data-testid": "ac-date-picker-panel",
|
|
664
|
+
onKeydown: hn
|
|
665
|
+
}, [d.presets.length ? (m(), s("div", De, [(m(!0), s(t, null, g(d.presets, (e) => (m(), s("button", {
|
|
666
|
+
key: e.label,
|
|
667
|
+
type: "button",
|
|
668
|
+
class: "cursor-pointer rounded-6 px-2.5 py-1.5 text-left text-base text-heading transition-colors hover:bg-surface-muted focus-visible:ring-[3px] focus-visible:ring-ring focus-visible:outline-none max-sm:border max-sm:border-border max-sm:py-1 max-sm:text-xs",
|
|
669
|
+
onClick: (t) => dn(e)
|
|
670
|
+
}, _(e.label), 9, Oe))), 128))])) : o("", !0), c("div", { class: p(["max-w-full min-w-0", d.mode === "duration" ? "w-72" : "w-[calc(276px*var(--ac-scale))]"]) }, [d.mode === "duration" ? (m(), s("div", ke, [
|
|
671
|
+
c("p", Ae, _(d.label || "Duration"), 1),
|
|
672
|
+
c("p", je, _(Gt(Ot.value)), 1),
|
|
673
|
+
c("div", Me, [(m(!0), s(t, null, g(At.value, (e) => (m(), s("label", {
|
|
674
|
+
key: e.key,
|
|
675
|
+
class: "block"
|
|
676
|
+
}, [c("span", Ne, _(e.label), 1), c("input", {
|
|
677
|
+
type: "text",
|
|
678
|
+
inputmode: "numeric",
|
|
679
|
+
role: "spinbutton",
|
|
680
|
+
autocomplete: "off",
|
|
681
|
+
value: Zt(e),
|
|
682
|
+
"aria-valuenow": e.get(),
|
|
683
|
+
"aria-valuemin": e.min,
|
|
684
|
+
"aria-valuemax": e.max,
|
|
685
|
+
class: "h-9 w-full rounded-6 border border-border bg-surface px-2.5 text-center text-base text-heading tabular-nums shadow-xs transition-[border-color,box-shadow] outline-none hover:border-border-dark focus:focus-ring",
|
|
686
|
+
onKeydown: (t) => Qt(t, e),
|
|
687
|
+
onInput: (t) => $t(t, e),
|
|
688
|
+
onBlur: (t) => en(t, e),
|
|
689
|
+
onFocus: f[3] ||= (e) => e.target.select()
|
|
690
|
+
}, null, 40, Pe)]))), 128))]),
|
|
691
|
+
f[10] ||= c("p", { class: "mt-2 text-xs text-muted" }, "↑ ↓ to adjust, or type a number.", -1)
|
|
692
|
+
])) : (m(), s("div", Fe, [
|
|
693
|
+
c("div", Ie, [
|
|
694
|
+
c("button", {
|
|
695
|
+
type: "button",
|
|
696
|
+
class: "inline-flex size-8 cursor-pointer items-center justify-center rounded-6 text-muted transition hover:bg-surface-muted hover:text-heading focus-visible:ring-[3px] focus-visible:ring-ring focus-visible:outline-none",
|
|
697
|
+
"aria-label": "Previous month",
|
|
698
|
+
onClick: f[4] ||= (e) => pn(-1)
|
|
699
|
+
}, [u(v(me), {
|
|
700
|
+
class: "size-4",
|
|
701
|
+
"aria-hidden": "true"
|
|
702
|
+
})]),
|
|
703
|
+
c("p", {
|
|
704
|
+
id: st,
|
|
705
|
+
class: "text-base font-semibold text-heading",
|
|
706
|
+
"aria-live": "polite"
|
|
707
|
+
}, _(pt.value.format(U(T.value))), 1),
|
|
708
|
+
c("button", {
|
|
709
|
+
type: "button",
|
|
710
|
+
class: "inline-flex size-8 cursor-pointer items-center justify-center rounded-6 text-muted transition hover:bg-surface-muted hover:text-heading focus-visible:ring-[3px] focus-visible:ring-ring focus-visible:outline-none",
|
|
711
|
+
"aria-label": "Next month",
|
|
712
|
+
onClick: f[5] ||= (e) => pn(1)
|
|
713
|
+
}, [u(v(he), {
|
|
714
|
+
class: "size-4",
|
|
715
|
+
"aria-hidden": "true"
|
|
716
|
+
})])
|
|
717
|
+
]),
|
|
718
|
+
c("table", {
|
|
719
|
+
role: "grid",
|
|
720
|
+
"aria-labelledby": st,
|
|
721
|
+
class: "border-collapse",
|
|
722
|
+
onKeydown: mn
|
|
723
|
+
}, [c("thead", null, [c("tr", null, [(m(!0), s(t, null, g(gt.value, (e) => (m(), s("th", {
|
|
724
|
+
key: e.long,
|
|
725
|
+
scope: "col",
|
|
726
|
+
abbr: e.long,
|
|
727
|
+
class: "h-8 w-9 text-center text-xs font-medium text-muted"
|
|
728
|
+
}, _(e.short.slice(0, 2)), 9, Le))), 128))])]), c("tbody", { onMouseleave: f[6] ||= (e) => D.value = null }, [(m(!0), s(t, null, g(Ct.value, (e, n) => (m(), s("tr", { key: n }, [(m(!0), s(t, null, g(e, (e) => (m(), s("td", {
|
|
729
|
+
key: e,
|
|
730
|
+
role: "gridcell",
|
|
731
|
+
"aria-selected": qt(e) || Jt(e),
|
|
732
|
+
class: "p-0 py-0.5"
|
|
733
|
+
}, [c("div", { class: p(Jt(e) && ["bg-primary-95", ...Yt(e)]) }, [c("button", {
|
|
734
|
+
type: "button",
|
|
735
|
+
"data-day": e,
|
|
736
|
+
tabindex: e === E.value ? 0 : -1,
|
|
737
|
+
"aria-label": mt.value.format(U(e)),
|
|
738
|
+
"aria-disabled": Kt(e) || void 0,
|
|
739
|
+
"aria-current": e === L.value ? "date" : void 0,
|
|
740
|
+
class: p(["relative inline-flex size-9 items-center justify-center rounded-6 text-base tabular-nums transition-colors outline-none focus-visible:ring-[3px] focus-visible:ring-ring", [Kt(e) ? "cursor-not-allowed text-slate-70 line-through" : qt(e) ? "cursor-pointer bg-primary font-semibold text-white shadow-button" : ["cursor-pointer hover:bg-surface-sunken", G(e) === T.value ? e === L.value ? "font-semibold text-primary-20" : "text-heading" : "text-muted"]]]),
|
|
741
|
+
onClick: (t) => sn(e),
|
|
742
|
+
onMouseenter: (t) => P.value && O.value && !k.value && (D.value = e)
|
|
743
|
+
}, [l(_(ht.value.format(U(e))) + " ", 1), e === L.value && !qt(e) ? (m(), s("span", Be)) : o("", !0)], 42, ze)], 2)], 8, Re))), 128))]))), 128))], 32)], 32),
|
|
744
|
+
F.value ? (m(), s("div", Ve, [(m(!0), s(t, null, g(kt.value, (e) => (m(), s("div", {
|
|
745
|
+
key: e.key,
|
|
746
|
+
class: "flex items-center justify-between gap-3",
|
|
747
|
+
role: "group",
|
|
748
|
+
"aria-label": `${e.label} time`
|
|
749
|
+
}, [c("span", Ue, _(e.label), 1), c("span", We, [(m(!0), s(t, null, g(e.spinners, (e, n) => (m(), s(t, { key: e.key }, [n > 0 ? (m(), s("span", Ge, ":")) : o("", !0), c("input", {
|
|
750
|
+
type: "text",
|
|
751
|
+
inputmode: "numeric",
|
|
752
|
+
role: "spinbutton",
|
|
753
|
+
autocomplete: "off",
|
|
754
|
+
maxlength: "2",
|
|
755
|
+
value: Zt(e),
|
|
756
|
+
"aria-label": e.label,
|
|
757
|
+
"aria-valuenow": e.get(),
|
|
758
|
+
"aria-valuemin": e.min,
|
|
759
|
+
"aria-valuemax": e.max,
|
|
760
|
+
class: "h-8 w-10 rounded-6 border border-border bg-surface text-center text-base text-heading tabular-nums shadow-xs transition-[border-color,box-shadow] outline-none hover:border-border-dark focus:focus-ring",
|
|
761
|
+
onKeydown: (t) => Qt(t, e),
|
|
762
|
+
onInput: (t) => $t(t, e),
|
|
763
|
+
onBlur: (t) => en(t, e),
|
|
764
|
+
onFocus: f[7] ||= (e) => e.target.select()
|
|
765
|
+
}, null, 40, Ke)], 64))), 128))])], 8, He))), 128)), c("p", qe, [l("Times in " + _(_t.value), 1), _t.value === N.value ? o("", !0) : (m(), s(t, { key: 0 }, [l(" (" + _(N.value) + ")", 1)], 64))])])) : o("", !0)
|
|
766
|
+
])), F.value || d.mode === "duration" || !P.value ? (m(), s("div", Je, [
|
|
767
|
+
d.mode !== "duration" && !P.value ? (m(), s("button", {
|
|
768
|
+
key: 0,
|
|
769
|
+
type: "button",
|
|
770
|
+
class: "cursor-pointer rounded-4 text-xs font-medium text-primary-20 hover:underline focus-visible:ring-[3px] focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
771
|
+
disabled: Kt(L.value),
|
|
772
|
+
onClick: f[8] ||= (e) => F.value ? ln() : un()
|
|
773
|
+
}, _(F.value ? "Now" : "Today"), 9, Ye)) : o("", !0),
|
|
774
|
+
Et.value ? (m(), s("p", Xe, _(Et.value), 1)) : o("", !0),
|
|
775
|
+
f[11] ||= c("span", { class: "flex-1" }, null, -1),
|
|
776
|
+
F.value || d.mode === "duration" ? (m(), s(t, { key: 2 }, [u(e, {
|
|
777
|
+
title: "Cancel",
|
|
778
|
+
color: "white",
|
|
779
|
+
size: "small",
|
|
780
|
+
onClick: f[9] ||= (e) => Q()
|
|
781
|
+
}), u(e, {
|
|
782
|
+
title: "Apply",
|
|
783
|
+
size: "small",
|
|
784
|
+
disabled: !Dt.value,
|
|
785
|
+
onClick: cn
|
|
786
|
+
}, null, 8, ["disabled"])], 64)) : o("", !0)
|
|
787
|
+
])) : o("", !0)], 2)], 44, Ee)) : o("", !0)]),
|
|
788
|
+
_: 1
|
|
789
|
+
})]))
|
|
790
|
+
], 16));
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
//#endregion
|
|
794
|
+
export { y as default };
|