@ac-design/design-system 1.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -18
- package/dist/lib/charts/ChartFrame.js +5 -0
- package/dist/lib/charts/ChartFrame.vue.d.ts +71 -0
- package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +173 -0
- package/dist/lib/charts/cartesian.d.ts +324 -0
- package/dist/lib/charts/cartesian.js +137 -0
- package/dist/lib/charts/echarts.d.ts +86 -0
- package/dist/lib/charts/echarts.js +173 -0
- package/dist/lib/charts/graph.d.ts +77 -0
- package/dist/lib/charts/graph.js +155 -0
- package/dist/lib/charts/index.d.ts +11 -0
- package/dist/lib/charts/index.js +7 -0
- package/dist/lib/charts/shared.d.ts +53 -0
- package/dist/lib/charts/shared.js +96 -0
- package/dist/lib/charts/xy.d.ts +69 -0
- package/dist/lib/charts/xy.js +73 -0
- package/dist/lib/compat.css +2770 -1061
- package/dist/lib/components/AcAccordion.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcAccordionItem.vue.d.ts +1 -1
- package/dist/lib/components/AcAccordionItem.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/lib/components/AcAlert.vue.d.ts +10 -1
- package/dist/lib/components/AcAlert.vue_vue_type_script_setup_true_lang.js +139 -45
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +19 -19
- package/dist/lib/components/AcAreaChart.js +5 -0
- package/dist/lib/components/AcAreaChart.vue.d.ts +47 -0
- package/dist/lib/components/AcAreaChart.vue_vue_type_script_setup_true_lang.js +205 -0
- package/dist/lib/components/AcAvatar.vue.d.ts +7 -4
- package/dist/lib/components/AcAvatar.vue_vue_type_script_setup_true_lang.js +66 -61
- package/dist/lib/components/AcBadge.vue.d.ts +20 -7
- package/dist/lib/components/AcBadge.vue_vue_type_script_setup_true_lang.js +67 -44
- package/dist/lib/components/AcBanner.vue.d.ts +1 -1
- package/dist/lib/components/AcBanner.vue_vue_type_script_setup_true_lang.js +30 -30
- package/dist/lib/components/AcBarChart.js +5 -0
- package/dist/lib/components/AcBarChart.vue.d.ts +46 -0
- package/dist/lib/components/AcBarChart.vue_vue_type_script_setup_true_lang.js +213 -0
- package/dist/lib/components/AcBreadcrumb.vue.d.ts +4 -1
- package/dist/lib/components/AcBreadcrumb.vue_vue_type_script_setup_true_lang.js +36 -34
- package/dist/lib/components/AcBulkActionBar.js +5 -0
- package/dist/lib/components/AcBulkActionBar.vue.d.ts +45 -0
- package/dist/lib/components/AcBulkActionBar.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/lib/components/AcButton.vue.d.ts +13 -7
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +93 -47
- package/dist/lib/components/AcButtons.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcCard.vue.d.ts +42 -3
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +175 -14
- package/dist/lib/components/AcCellValue.vue.d.ts +6 -3
- package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +219 -178
- package/dist/lib/components/AcCheckBox.vue.d.ts +17 -3
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +113 -30
- package/dist/lib/components/AcCheckList.js +5 -0
- package/dist/lib/components/AcCheckList.vue.d.ts +45 -0
- package/dist/lib/components/AcCheckList.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/lib/components/AcCheckRadio.vue.d.ts +30 -5
- package/dist/lib/components/AcCheckRadio.vue_vue_type_script_setup_true_lang.js +102 -26
- package/dist/lib/components/AcCircularProgress.js +5 -0
- package/dist/lib/components/AcCircularProgress.vue.d.ts +44 -0
- package/dist/lib/components/AcCircularProgress.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +142 -167
- package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/lib/components/AcColorInput.js +5 -0
- package/dist/lib/components/AcColorInput.vue.d.ts +57 -0
- package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +217 -0
- package/dist/lib/components/AcCommandBlock.js +5 -0
- package/dist/lib/components/AcCommandBlock.vue.d.ts +34 -0
- package/dist/lib/components/AcCommandBlock.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/lib/components/AcConfirmModal.js +5 -0
- package/dist/lib/components/AcConfirmModal.vue.d.ts +56 -0
- package/dist/lib/components/AcConfirmModal.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/lib/components/AcContentHeader.vue.d.ts +1 -1
- package/dist/lib/components/AcContentHeader.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/lib/components/AcContentLayout.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcCopyButton.js +5 -0
- package/dist/lib/components/AcCopyButton.vue.d.ts +43 -0
- package/dist/lib/components/AcCopyButton.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/lib/components/AcCostSummary.js +5 -0
- package/dist/lib/components/AcCostSummary.vue.d.ts +102 -0
- package/dist/lib/components/AcCostSummary.vue_vue_type_script_setup_true_lang.js +179 -0
- package/dist/lib/components/AcDatePicker.vue.d.ts +8 -8
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +634 -417
- package/dist/lib/components/AcDeleteModal.vue.d.ts +4 -4
- package/dist/lib/components/AcDeleteModal.vue_vue_type_script_setup_true_lang.js +57 -60
- package/dist/lib/components/AcDonutChart.js +5 -0
- package/dist/lib/components/AcDonutChart.vue.d.ts +83 -0
- package/dist/lib/components/AcDonutChart.vue_vue_type_script_setup_true_lang.js +237 -0
- package/dist/lib/components/AcDropdown.vue.d.ts +5 -2
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +91 -78
- package/dist/lib/components/AcDropdownDivider.vue_vue_type_script_setup_true_lang.js +11 -10
- package/dist/lib/components/AcDropdownItem.vue.d.ts +2 -2
- package/dist/lib/components/AcDropdownItem.vue_vue_type_script_setup_true_lang.js +18 -18
- package/dist/lib/components/AcEmptyState.vue.d.ts +4 -1
- package/dist/lib/components/AcEmptyState.vue_vue_type_script_setup_true_lang.js +50 -39
- package/dist/lib/components/AcErrorState.js +5 -0
- package/dist/lib/components/AcErrorState.vue.d.ts +46 -0
- package/dist/lib/components/AcErrorState.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/lib/components/AcFeatureCard.vue.d.ts +6 -0
- package/dist/lib/components/AcFeatureCard.vue_vue_type_script_setup_true_lang.js +139 -116
- package/dist/lib/components/AcFileEditor.vue_vue_type_script_setup_true_lang.js +16 -16
- package/dist/lib/components/AcFileUpload.vue.d.ts +2 -2
- package/dist/lib/components/AcFileUpload.vue_vue_type_script_setup_true_lang.js +55 -53
- package/dist/lib/components/AcFontScale.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcFooter.js +5 -0
- package/dist/lib/components/AcFooter.vue.d.ts +37 -0
- package/dist/lib/components/AcFooter.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/lib/components/AcForm.vue.d.ts +3 -0
- package/dist/lib/components/AcForm.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/lib/components/AcFormArray.vue.d.ts +2 -2
- package/dist/lib/components/AcFormArray.vue_vue_type_script_setup_true_lang.js +149 -147
- package/dist/lib/components/AcFormFooter.vue.d.ts +3 -3
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcFormSection.vue.d.ts +8 -1
- package/dist/lib/components/AcFormSection.vue_vue_type_script_setup_true_lang.js +31 -21
- package/dist/lib/components/AcGraphChart.js +5 -0
- package/dist/lib/components/AcGraphChart.vue.d.ts +124 -0
- package/dist/lib/components/AcGraphChart.vue_vue_type_script_setup_true_lang.js +578 -0
- package/dist/lib/components/AcHeader.vue.d.ts +20 -5
- package/dist/lib/components/AcHeader.vue_vue_type_script_setup_true_lang.js +82 -28
- package/dist/lib/components/AcInfoTable.vue.d.ts +1 -1
- package/dist/lib/components/AcInfoTable.vue_vue_type_script_setup_true_lang.js +17 -13
- package/dist/lib/components/AcInput.vue.d.ts +4 -4
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +99 -91
- package/dist/lib/components/AcKbd.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcKeyValueInput.js +5 -0
- package/dist/lib/components/AcKeyValueInput.vue.d.ts +114 -0
- package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +336 -0
- package/dist/lib/components/AcLineChart.js +5 -0
- package/dist/lib/components/AcLineChart.vue.d.ts +44 -0
- package/dist/lib/components/AcLineChart.vue_vue_type_script_setup_true_lang.js +175 -0
- package/dist/lib/components/AcLoader.js +5 -0
- package/dist/lib/components/AcLoader.vue.d.ts +15 -0
- package/dist/lib/components/AcLoader.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/lib/components/AcLocaleSwitcher.js +5 -0
- package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +48 -0
- package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +111 -0
- package/dist/lib/components/AcMapChart.js +5 -0
- package/dist/lib/components/AcMapChart.vue.d.ts +136 -0
- package/dist/lib/components/AcMapChart.vue_vue_type_script_setup_true_lang.js +518 -0
- package/dist/lib/components/AcModal.vue.d.ts +6 -3
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +88 -64
- package/dist/lib/components/AcNavbar.vue.d.ts +8 -5
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +29 -21
- package/dist/lib/components/AcNavbarItem.vue.d.ts +2 -2
- package/dist/lib/components/AcNavbarItem.vue_vue_type_script_setup_true_lang.js +23 -24
- package/dist/lib/components/AcNotificationMenu.vue.d.ts +3 -3
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +139 -174
- package/dist/lib/components/AcNumberInput.js +5 -0
- package/dist/lib/components/AcNumberInput.vue.d.ts +79 -0
- package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +241 -0
- package/dist/lib/components/AcPage.vue.d.ts +2 -2
- package/dist/lib/components/AcPage.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcPagination.vue.d.ts +22 -5
- package/dist/lib/components/AcPagination.vue_vue_type_script_setup_true_lang.js +87 -56
- package/dist/lib/components/AcPreloader.vue.d.ts +3 -3
- package/dist/lib/components/AcPreloader.vue_vue_type_script_setup_true_lang.js +15 -16
- package/dist/lib/components/AcProductHero.js +5 -0
- package/dist/lib/components/AcProductHero.vue.d.ts +56 -0
- package/dist/lib/components/AcProductHero.vue_vue_type_script_setup_true_lang.js +95 -0
- package/dist/lib/components/AcProgress.vue.d.ts +19 -4
- package/dist/lib/components/AcProgress.vue_vue_type_script_setup_true_lang.js +85 -31
- package/dist/lib/components/AcResourceCard.vue.d.ts +3 -3
- package/dist/lib/components/AcResourceCard.vue_vue_type_script_setup_true_lang.js +17 -17
- package/dist/lib/components/AcSearchBar.vue.d.ts +1 -1
- package/dist/lib/components/AcSearchBar.vue_vue_type_script_setup_true_lang.js +14 -9
- package/dist/lib/components/AcSectionContent.vue.d.ts +2 -2
- package/dist/lib/components/AcSectionContent.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcSegmentedControl.vue.d.ts +1 -1
- package/dist/lib/components/AcSegmentedControl.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/lib/components/AcSelect.vue.d.ts +6 -6
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +246 -254
- package/dist/lib/components/AcSettingsRow.js +5 -0
- package/dist/lib/components/AcSettingsRow.vue.d.ts +29 -0
- package/dist/lib/components/AcSettingsRow.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +32 -32
- package/dist/lib/components/AcSideTabs.vue.d.ts +2 -2
- package/dist/lib/components/AcSideTabs.vue_vue_type_script_setup_true_lang.js +37 -37
- package/dist/lib/components/AcSidebar.vue.d.ts +6 -3
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +67 -57
- package/dist/lib/components/AcSidebarItem.vue.d.ts +1 -1
- package/dist/lib/components/AcSidebarItem.vue_vue_type_script_setup_true_lang.js +46 -45
- package/dist/lib/components/AcSidebarSection.vue.d.ts +2 -2
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +23 -18
- package/dist/lib/components/AcSkeleton.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcSlider.vue.d.ts +1 -1
- package/dist/lib/components/AcSlider.vue_vue_type_script_setup_true_lang.js +174 -172
- package/dist/lib/components/AcStatCard.vue.d.ts +3 -3
- package/dist/lib/components/AcStatCard.vue_vue_type_script_setup_true_lang.js +90 -85
- package/dist/lib/components/AcStatusBar.vue.d.ts +1 -1
- package/dist/lib/components/AcStatusBar.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/lib/components/AcSteps.vue_vue_type_script_setup_true_lang.js +28 -28
- package/dist/lib/components/AcSwitch.vue.d.ts +3 -0
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +31 -19
- package/dist/lib/components/AcSwitchCard.js +5 -0
- package/dist/lib/components/AcSwitchCard.vue.d.ts +59 -0
- package/dist/lib/components/AcSwitchCard.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +97 -97
- package/dist/lib/components/AcTabs.vue.d.ts +9 -2
- package/dist/lib/components/AcTabs.vue_vue_type_script_setup_true_lang.js +43 -28
- package/dist/lib/components/AcTag.vue.d.ts +2 -2
- package/dist/lib/components/AcTag.vue_vue_type_script_setup_true_lang.js +22 -22
- package/dist/lib/components/AcTagInput.js +5 -0
- package/dist/lib/components/AcTagInput.vue.d.ts +74 -0
- package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +289 -0
- package/dist/lib/components/AcTextarea.vue.d.ts +4 -4
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +85 -63
- package/dist/lib/components/AcThemeMode.vue.d.ts +3 -3
- package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +56 -24
- package/dist/lib/components/AcTimePicker.js +5 -0
- package/dist/lib/components/AcTimePicker.vue.d.ts +65 -0
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +455 -0
- package/dist/lib/components/AcToaster.vue.d.ts +6 -3
- package/dist/lib/components/AcToaster.vue_vue_type_script_setup_true_lang.js +115 -82
- package/dist/lib/components/AcTooltip.vue.d.ts +34 -14
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +203 -79
- package/dist/lib/components/AcUsageCard.vue_vue_type_script_setup_true_lang.js +27 -27
- package/dist/lib/components/AcUserMenu.vue.d.ts +23 -1
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +166 -115
- package/dist/lib/components/index.d.ts +21 -2
- package/dist/lib/components/status.d.ts +28 -0
- package/dist/lib/components/status.js +125 -0
- package/dist/lib/composables/copyText.d.ts +2 -1
- package/dist/lib/composables/copyText.js +2 -2
- package/dist/lib/composables/useApiPagination.d.ts +55 -0
- package/dist/lib/composables/useApiPagination.js +58 -0
- package/dist/lib/composables/useBulkSelection.d.ts +44 -0
- package/dist/lib/composables/useBulkSelection.js +41 -0
- package/dist/lib/composables/useFormValidation.d.ts +65 -0
- package/dist/lib/composables/useFormValidation.js +148 -0
- package/dist/lib/composables/useTablePagination.d.ts +49 -0
- package/dist/lib/composables/useTablePagination.js +41 -0
- package/dist/lib/composables/useToast.d.ts +17 -1
- package/dist/lib/composables/useToast.js +10 -2
- package/dist/lib/editor/theme.js +65 -62
- package/dist/lib/index.d.ts +21 -3
- package/dist/lib/index.js +99 -75
- package/dist/lib/theme.css +377 -273
- package/package.json +20 -4
|
@@ -2,15 +2,15 @@ import type { ColorMode } from "../composables/useColorMode";
|
|
|
2
2
|
export interface Props {
|
|
3
3
|
/** Used until the viewer picks a mode. */
|
|
4
4
|
defaultMode?: ColorMode;
|
|
5
|
-
/** `icons` is a compact 3-icon switch; `labels` adds the words, for menus and settings pages. */
|
|
6
|
-
display?: "icons" | "labels";
|
|
5
|
+
/** `icons` is a compact 3-icon switch; `labels` adds the words, for menus and settings pages; `toggle` is cloud-ui's sun/moon switch for the navbar (64×32px), light or dark only. */
|
|
6
|
+
display?: "icons" | "labels" | "toggle";
|
|
7
7
|
}
|
|
8
8
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
9
|
"set:theme": (theme: "light" | "dark") => any;
|
|
10
10
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
11
11
|
"onSet:theme"?: ((theme: "light" | "dark") => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
|
-
display: "icons" | "labels";
|
|
13
|
+
display: "icons" | "labels" | "toggle";
|
|
14
14
|
defaultMode: ColorMode;
|
|
15
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
16
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,60 +1,92 @@
|
|
|
1
1
|
import { useColorMode as e } from "../composables/useColorMode.js";
|
|
2
|
-
import { Fragment as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a,
|
|
3
|
-
import { Monitor as
|
|
2
|
+
import { Fragment as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, normalizeClass as c, onBeforeUnmount as l, openBlock as u, ref as d, renderList as f, resolveDynamicComponent as p, toDisplayString as m, unref as h, watch as g } from "vue";
|
|
3
|
+
import { Monitor as _, Moon as v, Sun as y } from "@lucide/vue";
|
|
4
4
|
//#region src/lib/components/AcThemeMode.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
5
|
+
var b = ["aria-checked", "title"], x = {
|
|
6
|
+
key: 1,
|
|
6
7
|
role: "radiogroup",
|
|
7
8
|
"aria-label": "Theme",
|
|
8
|
-
class: "inline-flex items-center gap-
|
|
9
|
+
class: "inline-flex items-center gap-1 rounded-10 bg-surface-sunken p-1",
|
|
9
10
|
"data-ac-ds": "",
|
|
10
11
|
"data-testid": "ac-theme-mode"
|
|
11
|
-
},
|
|
12
|
+
}, S = [
|
|
12
13
|
"aria-checked",
|
|
13
14
|
"aria-label",
|
|
14
15
|
"title",
|
|
15
16
|
"onClick"
|
|
16
|
-
],
|
|
17
|
+
], C = { key: 0 }, w = /*@__PURE__*/ s({
|
|
17
18
|
__name: "AcThemeMode",
|
|
18
19
|
props: {
|
|
19
20
|
defaultMode: { default: "light" },
|
|
20
21
|
display: { default: "icons" }
|
|
21
22
|
},
|
|
22
23
|
emits: ["set:theme"],
|
|
23
|
-
setup(
|
|
24
|
-
let
|
|
24
|
+
setup(s, { emit: w }) {
|
|
25
|
+
let T = s, E = w, D = [
|
|
25
26
|
{
|
|
26
27
|
value: "light",
|
|
27
28
|
label: "Light",
|
|
28
|
-
icon:
|
|
29
|
+
icon: y
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
32
|
value: "dark",
|
|
32
33
|
label: "Dark",
|
|
33
|
-
icon:
|
|
34
|
+
icon: v
|
|
34
35
|
},
|
|
35
36
|
{
|
|
36
37
|
value: "system",
|
|
37
38
|
label: "System",
|
|
38
|
-
icon:
|
|
39
|
+
icon: _
|
|
39
40
|
}
|
|
40
|
-
], { mode:
|
|
41
|
-
function
|
|
42
|
-
|
|
41
|
+
], { mode: O, isDark: k, setMode: A } = e({ defaultMode: T.defaultMode }), j = d(k.value), M;
|
|
42
|
+
function N(e) {
|
|
43
|
+
A(e), E("set:theme", k.value ? "dark" : "light");
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
function P() {
|
|
46
|
+
j.value = !j.value, clearTimeout(M), M = setTimeout(() => {
|
|
47
|
+
M = void 0, N(j.value ? "dark" : "light");
|
|
48
|
+
}, 200);
|
|
49
|
+
}
|
|
50
|
+
return g(k, (e) => {
|
|
51
|
+
M === void 0 && (j.value = e);
|
|
52
|
+
}), l(() => clearTimeout(M)), (e, l) => s.display === "toggle" ? (u(), i("button", {
|
|
53
|
+
key: 0,
|
|
54
|
+
type: "button",
|
|
55
|
+
role: "switch",
|
|
56
|
+
"aria-checked": j.value,
|
|
57
|
+
"aria-label": "Dark mode",
|
|
58
|
+
title: j.value ? "Switch to light mode" : "Switch to dark mode",
|
|
59
|
+
class: "relative inline-flex h-8 w-16 shrink-0 cursor-pointer items-center justify-center rounded-full border border-border focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface focus-visible:outline-none",
|
|
60
|
+
"data-ac-ds": "",
|
|
61
|
+
"data-testid": "ac-theme-mode",
|
|
62
|
+
onClick: P
|
|
63
|
+
}, [
|
|
64
|
+
a("span", {
|
|
65
|
+
class: c(["inline-flex transition-[translate,rotate,opacity] duration-500 ease-[cubic-bezier(0.26,2,0.46,0.71)] motion-reduce:transition-none", j.value ? "translate-x-[10px] rotate-0 opacity-0" : "translate-x-[3px] rotate-[15deg] opacity-100"]),
|
|
66
|
+
"aria-hidden": "true"
|
|
67
|
+
}, [o(h(y), { class: "size-[19px] text-theme-sun" })], 2),
|
|
68
|
+
a("span", {
|
|
69
|
+
class: c(["size-[21px] shrink-0 rounded-full inset-ring-2 transition-[translate,background-color] duration-500 ease-[cubic-bezier(0.26,2,0.46,0.71)] motion-reduce:transition-none", j.value ? "-translate-x-[14px] bg-theme-moon inset-ring-white" : "translate-x-4 bg-theme-sun-soft inset-ring-theme-sun"]),
|
|
70
|
+
"aria-hidden": "true"
|
|
71
|
+
}, null, 2),
|
|
72
|
+
a("span", {
|
|
73
|
+
class: c(["inline-flex transition-[translate,rotate,opacity] duration-500 ease-[cubic-bezier(0.26,2.5,0.46,0.71)] motion-reduce:transition-none", j.value ? "-translate-x-[3px] -rotate-[15deg] opacity-100" : "-translate-x-2 rotate-0 opacity-0"]),
|
|
74
|
+
"aria-hidden": "true"
|
|
75
|
+
}, [o(h(v), { class: "size-[21px] text-heading" })], 2)
|
|
76
|
+
], 8, b)) : (u(), i("div", x, [(u(), i(t, null, f(D, (e) => a("button", {
|
|
45
77
|
key: e.value,
|
|
46
78
|
type: "button",
|
|
47
79
|
role: "radio",
|
|
48
|
-
"aria-checked":
|
|
49
|
-
"aria-label":
|
|
50
|
-
title:
|
|
51
|
-
class:
|
|
52
|
-
onClick: (t) =>
|
|
53
|
-
}, [(
|
|
54
|
-
class: "size-
|
|
80
|
+
"aria-checked": h(O) === e.value,
|
|
81
|
+
"aria-label": s.display === "icons" ? `${e.label} theme` : void 0,
|
|
82
|
+
title: s.display === "icons" ? `${e.label} theme` : void 0,
|
|
83
|
+
class: c(["inline-flex h-7 cursor-pointer items-center justify-center gap-1.5 rounded-8 text-base font-medium transition-[background-color,color,box-shadow] duration-200 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset focus-visible:outline-none", [s.display === "icons" ? "w-7" : "px-3", h(O) === e.value ? "bg-surface text-heading shadow-sm" : "text-muted hover:text-heading"]]),
|
|
84
|
+
onClick: (t) => N(e.value)
|
|
85
|
+
}, [(u(), n(p(e.icon), {
|
|
86
|
+
class: "size-4",
|
|
55
87
|
"aria-hidden": "true"
|
|
56
|
-
})),
|
|
88
|
+
})), s.display === "labels" ? (u(), i("span", C, m(e.label), 1)) : r("", !0)], 10, S)), 64))]));
|
|
57
89
|
}
|
|
58
90
|
});
|
|
59
91
|
//#endregion
|
|
60
|
-
export {
|
|
92
|
+
export { w as default };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface Props {
|
|
2
|
+
/** Label above the field. Doubles as the accessible name of the trigger and the popover. */
|
|
3
|
+
label?: string;
|
|
4
|
+
/** Text shown in the field while there's no value. */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** `24` shows 00–23; `12` shows 1–12 with an AM/PM column. `v-model` is always 24-hour. Cloud `hour12`. */
|
|
7
|
+
hourCycle?: 12 | 24;
|
|
8
|
+
/** Gap between the minutes on offer, e.g. `5` or `15`. */
|
|
9
|
+
minuteStep?: number;
|
|
10
|
+
/** Adds a seconds column; `v-model` becomes `HH:mm:ss`. */
|
|
11
|
+
showSeconds?: boolean;
|
|
12
|
+
/** Earliest choosable time, `HH:mm` or `HH:mm:ss`. Earlier hours and minutes are greyed out. */
|
|
13
|
+
min?: string;
|
|
14
|
+
/** Latest choosable time, `HH:mm` or `HH:mm:ss`. Must be after `min`; windows across midnight aren't supported. */
|
|
15
|
+
max?: string;
|
|
16
|
+
/** Shows a clear button when there is a value. */
|
|
17
|
+
clearable?: boolean;
|
|
18
|
+
/** Disables the field. */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Marks the field required and adds a red asterisk. */
|
|
21
|
+
required?: boolean;
|
|
22
|
+
/** Error text under the field. Turns the border red and sets `aria-invalid`. */
|
|
23
|
+
errorMsg?: string;
|
|
24
|
+
/** Help text between the label and the field. */
|
|
25
|
+
hint?: string;
|
|
26
|
+
/** `small` 36px or `normal` 42px tall, the same as `AcInput`. */
|
|
27
|
+
size?: "small" | "normal";
|
|
28
|
+
/** Adds a hidden input with this name so plain form posts include the value. */
|
|
29
|
+
name?: string;
|
|
30
|
+
}
|
|
31
|
+
type __VLS_Props = Props;
|
|
32
|
+
type __VLS_ModelProps = {
|
|
33
|
+
/** `"14:05"`, or `"14:05:30"` with `show-seconds`, always 24-hour. `null` when empty. */
|
|
34
|
+
modelValue?: string | null;
|
|
35
|
+
/** Whether the popover is open. */
|
|
36
|
+
"open"?: boolean;
|
|
37
|
+
};
|
|
38
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
39
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
40
|
+
/** Moves focus to the field. */
|
|
41
|
+
focus: () => void | undefined;
|
|
42
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
43
|
+
"update:modelValue": (value: string | null) => any;
|
|
44
|
+
"update:open": (value: boolean) => any;
|
|
45
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
46
|
+
"onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
|
|
47
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
48
|
+
}>, {
|
|
49
|
+
required: boolean;
|
|
50
|
+
label: string;
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
max: string;
|
|
53
|
+
min: string;
|
|
54
|
+
name: string;
|
|
55
|
+
size: "small" | "normal";
|
|
56
|
+
hint: string;
|
|
57
|
+
placeholder: string;
|
|
58
|
+
clearable: boolean;
|
|
59
|
+
errorMsg: string;
|
|
60
|
+
showSeconds: boolean;
|
|
61
|
+
hourCycle: 12 | 24;
|
|
62
|
+
minuteStep: number;
|
|
63
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
64
|
+
declare const _default: typeof __VLS_export;
|
|
65
|
+
export default _default;
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, mergeModels as u, mergeProps as d, nextTick as f, normalizeClass as p, normalizeStyle as ee, onBeforeUnmount as te, onMounted as ne, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v, useAttrs as re, useId as ie, useModel as y, watch as ae, withCtx as oe } from "vue";
|
|
2
|
+
import { Clock as se, X as ce } from "@lucide/vue";
|
|
3
|
+
//#region src/lib/components/AcTimePicker.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var le = ["for"], ue = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "text-danger",
|
|
7
|
+
"aria-hidden": "true"
|
|
8
|
+
}, de = { class: "relative" }, fe = [
|
|
9
|
+
"id",
|
|
10
|
+
"disabled",
|
|
11
|
+
"aria-expanded",
|
|
12
|
+
"aria-labelledby",
|
|
13
|
+
"aria-describedby",
|
|
14
|
+
"aria-invalid",
|
|
15
|
+
"aria-required"
|
|
16
|
+
], pe = ["aria-label"], me = ["name", "value"], he = ["aria-label"], ge = { class: "flex h-48 min-h-0 shrink-0 items-stretch justify-center gap-1" }, _e = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "mx-2 mt-6 h-32 w-px shrink-0 self-center bg-border",
|
|
19
|
+
"aria-hidden": "true"
|
|
20
|
+
}, ve = {
|
|
21
|
+
key: 1,
|
|
22
|
+
class: "mt-6 self-center font-bold text-heading/50",
|
|
23
|
+
"aria-hidden": "true"
|
|
24
|
+
}, ye = ["data-col"], be = {
|
|
25
|
+
class: "mb-2 text-xm font-bold tracking-wider text-heading/50 uppercase",
|
|
26
|
+
"aria-hidden": "true"
|
|
27
|
+
}, xe = ["aria-label", "onKeydown"], Se = { class: "flex w-full flex-col items-center py-20" }, Ce = [
|
|
28
|
+
"data-value",
|
|
29
|
+
"tabindex",
|
|
30
|
+
"aria-selected",
|
|
31
|
+
"aria-disabled",
|
|
32
|
+
"onClick"
|
|
33
|
+
], we = { class: "mt-4 flex shrink-0 justify-center gap-2 border-t border-border pt-4" }, Te = ["disabled"], b = 86399, x = /*@__PURE__*/ l({
|
|
34
|
+
inheritAttrs: !1,
|
|
35
|
+
__name: "AcTimePicker",
|
|
36
|
+
props: /*@__PURE__*/ u({
|
|
37
|
+
label: { default: "" },
|
|
38
|
+
placeholder: { default: "Choose time" },
|
|
39
|
+
hourCycle: { default: 24 },
|
|
40
|
+
minuteStep: { default: 1 },
|
|
41
|
+
showSeconds: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !1
|
|
44
|
+
},
|
|
45
|
+
min: { default: "" },
|
|
46
|
+
max: { default: "" },
|
|
47
|
+
clearable: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: !1
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: !1
|
|
54
|
+
},
|
|
55
|
+
required: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: !1
|
|
58
|
+
},
|
|
59
|
+
errorMsg: { default: "" },
|
|
60
|
+
hint: { default: "" },
|
|
61
|
+
size: { default: "normal" },
|
|
62
|
+
name: { default: "" }
|
|
63
|
+
}, {
|
|
64
|
+
modelValue: { default: null },
|
|
65
|
+
modelModifiers: {},
|
|
66
|
+
open: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: !1
|
|
69
|
+
},
|
|
70
|
+
openModifiers: {}
|
|
71
|
+
}),
|
|
72
|
+
emits: ["update:modelValue", "update:open"],
|
|
73
|
+
setup(l, { expose: u }) {
|
|
74
|
+
let x = l, S = y(l, "modelValue"), C = y(l, "open"), Ee = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/, w = ie(), T = re(), De = r(() => ({
|
|
75
|
+
class: T.class,
|
|
76
|
+
style: T.style
|
|
77
|
+
})), Oe = r(() => {
|
|
78
|
+
let { class: e, style: t, ...n } = T;
|
|
79
|
+
return n;
|
|
80
|
+
}), E = `${w}-label`, D = `${w}-value`, O = `${w}-msg`, k = `${w}-hint`, A = h(null), j = h(null), M = h(null), N = h({
|
|
81
|
+
left: 0,
|
|
82
|
+
maxHeight: 400,
|
|
83
|
+
minWidth: 0
|
|
84
|
+
}), P = h(!1), F = r(() => C.value || P.value), I = r(() => G(S.value)), L = r(() => G(x.min) ?? 0), R = r(() => G(x.max) ?? b), z = r(() => I.value === null ? null : K(I.value)), B = r(() => x.hourCycle === 12), V = r(() => I.value === null ? "" : Ne(I.value)), ke = r(() => [x.hint && k, x.errorMsg && O].filter(Boolean).join(" ") || void 0), Ae = r(() => x.label ? `${x.label}: choose time` : "Choose time"), je = r(() => q(Fe())), H = r(() => {
|
|
85
|
+
let e = z.value, t = e?.h ?? null, n = e?.m ?? null, r = t === null ? 0 : t >= 12 ? 12 : 0, i = [], a = B.value ? [
|
|
86
|
+
0,
|
|
87
|
+
1,
|
|
88
|
+
2,
|
|
89
|
+
3,
|
|
90
|
+
4,
|
|
91
|
+
5,
|
|
92
|
+
6,
|
|
93
|
+
7,
|
|
94
|
+
8,
|
|
95
|
+
9,
|
|
96
|
+
10,
|
|
97
|
+
11
|
|
98
|
+
].map((e) => e + r) : W(0, 23, 1);
|
|
99
|
+
i.push({
|
|
100
|
+
unit: "h",
|
|
101
|
+
heading: "Hrs",
|
|
102
|
+
name: "Hours",
|
|
103
|
+
selected: t,
|
|
104
|
+
cells: a.map((e) => ({
|
|
105
|
+
value: e,
|
|
106
|
+
text: U(B.value ? e % 12 || 12 : e),
|
|
107
|
+
disabled: !J(e * 3600, e * 3600 + 3599)
|
|
108
|
+
}))
|
|
109
|
+
});
|
|
110
|
+
let o = t ?? Pe();
|
|
111
|
+
if (i.push({
|
|
112
|
+
unit: "m",
|
|
113
|
+
heading: "Min",
|
|
114
|
+
name: "Minutes",
|
|
115
|
+
selected: n,
|
|
116
|
+
cells: W(0, 59, Math.max(1, x.minuteStep)).map((e) => {
|
|
117
|
+
let t = o * 3600 + e * 60;
|
|
118
|
+
return {
|
|
119
|
+
value: e,
|
|
120
|
+
text: U(e),
|
|
121
|
+
disabled: !J(t, x.showSeconds ? t + 59 : t)
|
|
122
|
+
};
|
|
123
|
+
})
|
|
124
|
+
}), x.showSeconds) {
|
|
125
|
+
let t = n ?? 0;
|
|
126
|
+
i.push({
|
|
127
|
+
unit: "s",
|
|
128
|
+
heading: "Sec",
|
|
129
|
+
name: "Seconds",
|
|
130
|
+
selected: e?.s ?? null,
|
|
131
|
+
cells: W(0, 59, 1).map((e) => ({
|
|
132
|
+
value: e,
|
|
133
|
+
text: U(e),
|
|
134
|
+
disabled: !q(o * 3600 + t * 60 + e)
|
|
135
|
+
}))
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return B.value && i.push({
|
|
139
|
+
unit: "p",
|
|
140
|
+
heading: "AM/PM",
|
|
141
|
+
name: "AM or PM",
|
|
142
|
+
selected: t === null ? null : r,
|
|
143
|
+
cells: [{
|
|
144
|
+
value: 0,
|
|
145
|
+
text: "AM",
|
|
146
|
+
disabled: !J(0, 43199)
|
|
147
|
+
}, {
|
|
148
|
+
value: 12,
|
|
149
|
+
text: "PM",
|
|
150
|
+
disabled: !J(43200, b)
|
|
151
|
+
}]
|
|
152
|
+
}), i;
|
|
153
|
+
});
|
|
154
|
+
function U(e) {
|
|
155
|
+
return String(e).padStart(2, "0");
|
|
156
|
+
}
|
|
157
|
+
function W(e, t, n) {
|
|
158
|
+
let r = [];
|
|
159
|
+
for (let i = e; i <= t; i += n) r.push(i);
|
|
160
|
+
return r;
|
|
161
|
+
}
|
|
162
|
+
function G(e) {
|
|
163
|
+
let t = e ? Ee.exec(e.trim()) : null;
|
|
164
|
+
if (!t) return null;
|
|
165
|
+
let [n, r, i] = [
|
|
166
|
+
Number(t[1]),
|
|
167
|
+
Number(t[2]),
|
|
168
|
+
Number(t[3] ?? 0)
|
|
169
|
+
];
|
|
170
|
+
return n > 23 || r > 59 || i > 59 ? null : n * 3600 + r * 60 + i;
|
|
171
|
+
}
|
|
172
|
+
function K(e) {
|
|
173
|
+
return {
|
|
174
|
+
h: Math.floor(e / 3600),
|
|
175
|
+
m: Math.floor(e % 3600 / 60),
|
|
176
|
+
s: e % 60
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function Me(e) {
|
|
180
|
+
let { h: t, m: n, s: r } = K(e);
|
|
181
|
+
return x.showSeconds ? `${U(t)}:${U(n)}:${U(r)}` : `${U(t)}:${U(n)}`;
|
|
182
|
+
}
|
|
183
|
+
function Ne(e) {
|
|
184
|
+
let { h: t, m: n, s: r } = K(e), i = x.showSeconds ? `${U(n)}:${U(r)}` : U(n);
|
|
185
|
+
return B.value ? `${U(t % 12 || 12)}:${i} ${t >= 12 ? "PM" : "AM"}` : `${U(t)}:${i}`;
|
|
186
|
+
}
|
|
187
|
+
function q(e) {
|
|
188
|
+
return e >= L.value && e <= R.value;
|
|
189
|
+
}
|
|
190
|
+
function J(e, t) {
|
|
191
|
+
return t >= L.value && e <= R.value;
|
|
192
|
+
}
|
|
193
|
+
function Pe() {
|
|
194
|
+
return Math.floor(L.value / 3600);
|
|
195
|
+
}
|
|
196
|
+
function Fe() {
|
|
197
|
+
let e = /* @__PURE__ */ new Date(), t = Math.max(1, x.minuteStep), n = Math.floor(e.getMinutes() / t) * t;
|
|
198
|
+
return e.getHours() * 3600 + n * 60 + (x.showSeconds ? e.getSeconds() : 0);
|
|
199
|
+
}
|
|
200
|
+
function Ie(e) {
|
|
201
|
+
if (q(e) && Le(e)) return e;
|
|
202
|
+
let { h: t } = K(e), n = Math.max(1, x.minuteStep) * 60, r = [];
|
|
203
|
+
for (let e = t * 3600; e < (t + 1) * 3600; e += n) if (x.showSeconds) for (let t = 0; t < 60; t++) r.push(e + t);
|
|
204
|
+
else r.push(e);
|
|
205
|
+
let i = r.filter(q);
|
|
206
|
+
return i.length ? i.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t) : null;
|
|
207
|
+
}
|
|
208
|
+
function Le(e) {
|
|
209
|
+
let { m: t, s: n } = K(e);
|
|
210
|
+
return t % Math.max(1, x.minuteStep) === 0 && (x.showSeconds || n === 0);
|
|
211
|
+
}
|
|
212
|
+
function Re(e, t) {
|
|
213
|
+
let { h: n, m: r, s: i } = z.value ?? K(Ie(L.value) ?? L.value);
|
|
214
|
+
e === "h" ? n = t : e === "m" ? r = t : e === "s" ? i = t : n = n % 12 + t;
|
|
215
|
+
let a = Ie(n * 3600 + r * 60 + (x.showSeconds ? i : 0));
|
|
216
|
+
a !== null && (S.value = Me(a));
|
|
217
|
+
}
|
|
218
|
+
function ze() {
|
|
219
|
+
S.value = Me(Fe()), f(() => Z("smooth"));
|
|
220
|
+
}
|
|
221
|
+
function Be() {
|
|
222
|
+
S.value = null, j.value?.focus();
|
|
223
|
+
}
|
|
224
|
+
function Y() {
|
|
225
|
+
let e = j.value;
|
|
226
|
+
if (!e) return;
|
|
227
|
+
let t = e.getBoundingClientRect(), n = M.value?.offsetWidth ?? 240, r = M.value?.offsetHeight ?? 320, 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)), c = Math.min(t.width, 448);
|
|
228
|
+
N.value = o ? {
|
|
229
|
+
bottom: window.innerHeight - t.top + 6,
|
|
230
|
+
left: s,
|
|
231
|
+
maxHeight: Math.max(200, a),
|
|
232
|
+
minWidth: c
|
|
233
|
+
} : {
|
|
234
|
+
top: t.bottom + 6,
|
|
235
|
+
left: s,
|
|
236
|
+
maxHeight: Math.max(200, i),
|
|
237
|
+
minWidth: c
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function Ve() {
|
|
241
|
+
x.disabled || C.value || (C.value = !0);
|
|
242
|
+
}
|
|
243
|
+
function X(e = !0) {
|
|
244
|
+
C.value && (C.value = !1, e && j.value?.focus());
|
|
245
|
+
}
|
|
246
|
+
async function He() {
|
|
247
|
+
Y(), Ze(), await f(), Y(), Z("instant"), We(0);
|
|
248
|
+
}
|
|
249
|
+
function Z(e) {
|
|
250
|
+
let t = e === "smooth" && !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
251
|
+
M.value?.querySelectorAll("[role=listbox]").forEach((e) => {
|
|
252
|
+
let n = e.querySelector("[aria-selected=true]") ?? e.querySelector("[aria-disabled=false]");
|
|
253
|
+
n && e.scrollTo({
|
|
254
|
+
top: n.offsetTop - (e.clientHeight - n.offsetHeight) / 2,
|
|
255
|
+
behavior: t ? "smooth" : "instant"
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function Ue(e) {
|
|
260
|
+
return [...M.value?.querySelectorAll(`[data-col="${e}"] [role=option]`) ?? []];
|
|
261
|
+
}
|
|
262
|
+
function We(e) {
|
|
263
|
+
let t = Ue(e);
|
|
264
|
+
(t.find((e) => e.tabIndex === 0) ?? t[0])?.focus({ preventScroll: !0 });
|
|
265
|
+
}
|
|
266
|
+
function Ge(e, t) {
|
|
267
|
+
return (e.cells.find((t) => t.value === e.selected) ?? e.cells.find((e) => !e.disabled)) === t ? 0 : -1;
|
|
268
|
+
}
|
|
269
|
+
function Ke(e, t, n) {
|
|
270
|
+
n.disabled || (Re(t.unit, n.value), f(() => {
|
|
271
|
+
Z("smooth"), Ue(e).find((e) => e.tabIndex === 0)?.focus({ preventScroll: !0 });
|
|
272
|
+
}));
|
|
273
|
+
}
|
|
274
|
+
function qe(e, t, n) {
|
|
275
|
+
let r = n.cells.filter((e) => !e.disabled);
|
|
276
|
+
if (!r.length) return;
|
|
277
|
+
let i = r.findIndex((e) => e.value === n.selected), a = {
|
|
278
|
+
ArrowDown: i + 1,
|
|
279
|
+
ArrowUp: i < 0 ? r.length - 1 : i - 1,
|
|
280
|
+
PageDown: i + 5,
|
|
281
|
+
PageUp: i < 0 ? 0 : i - 5,
|
|
282
|
+
Home: 0,
|
|
283
|
+
End: r.length - 1
|
|
284
|
+
};
|
|
285
|
+
if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
|
|
286
|
+
e.preventDefault();
|
|
287
|
+
let n = t + (e.key === "ArrowRight" ? 1 : -1);
|
|
288
|
+
n >= 0 && n < H.value.length && We(n);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (e.key === "Enter") {
|
|
292
|
+
e.preventDefault();
|
|
293
|
+
let t = n.cells.find((t) => String(t.value) === e.target.dataset.value);
|
|
294
|
+
t && !t.disabled && Re(n.unit, t.value), X();
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (!(e.key in a)) return;
|
|
298
|
+
e.preventDefault();
|
|
299
|
+
let o = r[Math.max(0, Math.min(r.length - 1, a[e.key]))];
|
|
300
|
+
Ke(t, n, o);
|
|
301
|
+
}
|
|
302
|
+
function Je(e) {
|
|
303
|
+
if (e.key === "Escape") {
|
|
304
|
+
e.preventDefault(), e.stopPropagation(), X();
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (e.key !== "Tab" || !M.value) return;
|
|
308
|
+
let t = [...M.value.querySelectorAll("button:not([disabled])")].filter((e) => e.tabIndex >= 0);
|
|
309
|
+
if (!t.length) return;
|
|
310
|
+
let n = t[0], r = t[t.length - 1];
|
|
311
|
+
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
312
|
+
}
|
|
313
|
+
function Ye(e) {
|
|
314
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(), Ve());
|
|
315
|
+
}
|
|
316
|
+
function Xe(e) {
|
|
317
|
+
let t = e.target;
|
|
318
|
+
A.value?.contains(t) || M.value?.contains(t) || X(!1);
|
|
319
|
+
}
|
|
320
|
+
function Q(e) {
|
|
321
|
+
e?.target instanceof Node && M.value?.contains(e.target) || Y();
|
|
322
|
+
}
|
|
323
|
+
function Ze() {
|
|
324
|
+
document.addEventListener("pointerdown", Xe, !0), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q);
|
|
325
|
+
}
|
|
326
|
+
function $() {
|
|
327
|
+
document.removeEventListener("pointerdown", Xe, !0), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
|
|
328
|
+
}
|
|
329
|
+
return ae(C, (e) => e ? He() : $()), ne(() => {
|
|
330
|
+
C.value && He();
|
|
331
|
+
}), te($), u({ focus: () => j.value?.focus() }), (r, u) => (m(), o("div", d({
|
|
332
|
+
ref_key: "root",
|
|
333
|
+
ref: A
|
|
334
|
+
}, De.value, {
|
|
335
|
+
class: ["w-full", l.disabled && "opacity-50"],
|
|
336
|
+
"data-ac-ds": "",
|
|
337
|
+
"data-testid": "ac-time-picker"
|
|
338
|
+
}), [
|
|
339
|
+
l.label ? (m(), o("label", {
|
|
340
|
+
key: 0,
|
|
341
|
+
id: E,
|
|
342
|
+
for: `${v(w)}-trigger`,
|
|
343
|
+
class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
|
|
344
|
+
}, [s("span", null, _(l.label), 1), l.required ? (m(), o("span", ue, "*")) : a("", !0)], 8, le)) : a("", !0),
|
|
345
|
+
l.hint ? (m(), o("p", {
|
|
346
|
+
key: 1,
|
|
347
|
+
id: k,
|
|
348
|
+
class: "mb-2 text-base text-muted"
|
|
349
|
+
}, _(l.hint), 1)) : a("", !0),
|
|
350
|
+
s("div", de, [s("button", d({
|
|
351
|
+
id: `${v(w)}-trigger`,
|
|
352
|
+
ref_key: "trigger",
|
|
353
|
+
ref: j
|
|
354
|
+
}, Oe.value, {
|
|
355
|
+
type: "button",
|
|
356
|
+
disabled: l.disabled,
|
|
357
|
+
"aria-haspopup": "dialog",
|
|
358
|
+
"aria-expanded": C.value,
|
|
359
|
+
"aria-labelledby": l.label ? `${E} ${D}` : D,
|
|
360
|
+
"aria-describedby": ke.value,
|
|
361
|
+
"aria-invalid": !!l.errorMsg || void 0,
|
|
362
|
+
"aria-required": l.required || void 0,
|
|
363
|
+
class: ["flex w-full items-center rounded-10 border bg-background text-left text-base font-normal text-heading transition-[color,background-color,border-color,box-shadow] duration-200 outline-none disabled:cursor-not-allowed", [
|
|
364
|
+
l.size === "small" ? "h-9 pl-3" : "h-10.5 pl-4",
|
|
365
|
+
l.clearable && S.value ? "pr-20" : "pr-10",
|
|
366
|
+
l.disabled ? "" : "cursor-pointer hover:bg-accent-hover",
|
|
367
|
+
l.errorMsg ? ["border-danger/60", F.value && "border-danger shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]"] : F.value ? "focus-ring" : ["border-border", !l.disabled && "hover:border-accent-active"]
|
|
368
|
+
]],
|
|
369
|
+
onClick: u[0] ||= (e) => C.value ? X() : Ve(),
|
|
370
|
+
onKeydown: Ye,
|
|
371
|
+
onFocus: u[1] ||= (e) => P.value = !0,
|
|
372
|
+
onBlur: u[2] ||= (e) => P.value = !1
|
|
373
|
+
}), [s("span", {
|
|
374
|
+
id: D,
|
|
375
|
+
class: p(["truncate tabular-nums", !V.value && "text-muted/80"])
|
|
376
|
+
}, _(V.value || S.value || l.placeholder), 3)], 16, fe), s("span", { class: p(["pointer-events-none absolute inset-y-0 flex items-center gap-4 text-muted", l.size === "small" ? "right-3" : "right-4"]) }, [l.clearable && S.value && !l.disabled ? (m(), o("button", {
|
|
377
|
+
key: 0,
|
|
378
|
+
type: "button",
|
|
379
|
+
class: "pointer-events-auto inline-flex cursor-pointer items-center justify-center rounded-full p-1 transition-colors duration-200 hover:bg-accent-hover hover:text-primary active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
380
|
+
"aria-label": l.label ? `Clear ${l.label}` : "Clear",
|
|
381
|
+
onClick: Be
|
|
382
|
+
}, [c(v(ce), {
|
|
383
|
+
class: "size-4",
|
|
384
|
+
"aria-hidden": "true"
|
|
385
|
+
})], 8, pe)) : a("", !0), c(v(se), {
|
|
386
|
+
class: p(["size-4", C.value && "text-heading"]),
|
|
387
|
+
"aria-hidden": "true"
|
|
388
|
+
}, null, 8, ["class"])], 2)]),
|
|
389
|
+
l.errorMsg ? (m(), o("p", {
|
|
390
|
+
key: 2,
|
|
391
|
+
id: O,
|
|
392
|
+
class: "mt-1 text-base text-danger-strong",
|
|
393
|
+
role: "alert"
|
|
394
|
+
}, _(l.errorMsg), 1)) : a("", !0),
|
|
395
|
+
l.name ? (m(), o("input", {
|
|
396
|
+
key: 3,
|
|
397
|
+
type: "hidden",
|
|
398
|
+
name: l.name,
|
|
399
|
+
value: S.value ?? ""
|
|
400
|
+
}, null, 8, me)) : a("", !0),
|
|
401
|
+
(m(), i(t, { to: "body" }, [c(n, {
|
|
402
|
+
"enter-active-class": "transition duration-150 ease-out motion-reduce:transition-opacity",
|
|
403
|
+
"enter-from-class": "opacity-0 scale-95",
|
|
404
|
+
"leave-active-class": "transition duration-100 ease-in",
|
|
405
|
+
"leave-to-class": "opacity-0"
|
|
406
|
+
}, {
|
|
407
|
+
default: oe(() => [C.value ? (m(), o("div", {
|
|
408
|
+
key: 0,
|
|
409
|
+
ref_key: "panel",
|
|
410
|
+
ref: M,
|
|
411
|
+
role: "dialog",
|
|
412
|
+
"aria-modal": "true",
|
|
413
|
+
"aria-label": Ae.value,
|
|
414
|
+
class: "fixed z-[90] flex max-w-[calc(100vw-16px)] flex-col overflow-hidden rounded-10 border border-border bg-surface p-3 shadow-sm",
|
|
415
|
+
style: ee({
|
|
416
|
+
top: N.value.top === void 0 ? void 0 : `${N.value.top}px`,
|
|
417
|
+
bottom: N.value.bottom === void 0 ? void 0 : `${N.value.bottom}px`,
|
|
418
|
+
left: `${N.value.left}px`,
|
|
419
|
+
maxHeight: `${N.value.maxHeight}px`,
|
|
420
|
+
minWidth: `${N.value.minWidth}px`
|
|
421
|
+
}),
|
|
422
|
+
"data-ac-ds": "",
|
|
423
|
+
"data-testid": "ac-time-picker-panel",
|
|
424
|
+
onKeydown: Je
|
|
425
|
+
}, [s("div", ge, [(m(!0), o(e, null, g(H.value, (t, n) => (m(), o(e, { key: t.unit }, [t.unit === "p" ? (m(), o("span", _e)) : n > 0 ? (m(), o("span", ve, ":")) : a("", !0), s("div", {
|
|
426
|
+
class: "flex h-full min-w-14 flex-1 flex-col items-center",
|
|
427
|
+
"data-col": n
|
|
428
|
+
}, [s("span", be, _(t.heading), 1), s("div", {
|
|
429
|
+
role: "listbox",
|
|
430
|
+
"aria-label": t.name,
|
|
431
|
+
class: "relative min-h-0 w-full flex-1 scroll-smooth overflow-y-auto [scrollbar-width:none] motion-reduce:scroll-auto [&::-webkit-scrollbar]:hidden",
|
|
432
|
+
onKeydown: (e) => qe(e, n, t)
|
|
433
|
+
}, [s("div", Se, [(m(!0), o(e, null, g(t.cells, (e) => (m(), o("button", {
|
|
434
|
+
key: e.value,
|
|
435
|
+
type: "button",
|
|
436
|
+
"data-value": e.value,
|
|
437
|
+
role: "option",
|
|
438
|
+
tabindex: Ge(t, e),
|
|
439
|
+
"aria-selected": e.value === t.selected,
|
|
440
|
+
"aria-disabled": e.disabled,
|
|
441
|
+
class: p(["inline-flex h-10 shrink-0 items-center justify-center rounded-8 tabular-nums transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset motion-reduce:transition-none", [t.unit === "p" ? "w-12 text-xs font-bold" : "w-10 text-base", e.disabled ? "cursor-not-allowed text-muted/50 line-through" : e.value === t.selected ? ["cursor-pointer bg-primary text-white", t.unit !== "p" && "scale-110 font-bold"] : "cursor-pointer text-heading hover:bg-accent-hover hover:font-bold active:bg-accent-active"]]),
|
|
442
|
+
onClick: (r) => Ke(n, t, e)
|
|
443
|
+
}, _(e.text), 11, Ce))), 128))])], 40, xe)], 8, ye)], 64))), 128))]), s("div", we, [s("button", {
|
|
444
|
+
type: "button",
|
|
445
|
+
class: "cursor-pointer rounded-8 bg-accent px-3 py-1.5 text-xs font-medium text-heading transition-colors duration-200 hover:bg-accent-hover active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
446
|
+
disabled: !je.value,
|
|
447
|
+
onClick: ze
|
|
448
|
+
}, " Current time ", 8, Te)])], 44, he)) : a("", !0)]),
|
|
449
|
+
_: 1
|
|
450
|
+
})]))
|
|
451
|
+
], 16));
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
//#endregion
|
|
455
|
+
export { x as default };
|