@datum-cloud/datum-ui 0.8.1 → 0.10.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/dist/{adapter-context-NyGTDZYq.mjs → adapter-context-DemTWhel.mjs} +3 -3
- package/dist/alert/index.mjs +1 -1
- package/dist/{alert-BDj6od5I.mjs → alert-Cz56SqdN.mjs} +2 -2
- package/dist/app-navigation/index.mjs +2 -2
- package/dist/{app-navigation-rSOfo1KV.mjs → app-navigation-CG0A8Qjz.mjs} +12 -6
- package/dist/autocomplete/index.mjs +1 -1
- package/dist/{autocomplete-DdbTQe6u.mjs → autocomplete-ChuPNldi.mjs} +6 -6
- package/dist/autosearch/index.mjs +12 -12
- package/dist/avatar-stack/index.mjs +1 -1
- package/dist/{avatar-stack-CDhlA1Nm.mjs → avatar-stack-WqoQ3l06.mjs} +1 -1
- package/dist/{button-D3RrsMfQ.mjs → button-Rw1xI-k9.mjs} +2 -2
- package/dist/calendar/index.mjs +1 -1
- package/dist/calendar-D_DriVHT.mjs +77 -0
- package/dist/{calendar-C-Hbf74r.mjs → calendar-Dwvq3Vu_.mjs} +6 -6
- package/dist/calendar-date-picker-CchHKodM.mjs +52 -0
- package/dist/chart/index.mjs +1 -1
- package/dist/{chart-CUa21ynK.mjs → chart-DgcOwkOh.mjs} +5 -5
- package/dist/code-editor/index.mjs +1 -1
- package/dist/{col-DISdGlqY.mjs → col-Q6yazFwL.mjs} +2 -1
- package/dist/components/base/button/button.d.ts.map +1 -1
- package/dist/components/features/app-navigation/app-navigation.d.ts +5 -1
- package/dist/components/features/app-navigation/app-navigation.d.ts.map +1 -1
- package/dist/components/features/app-navigation/nav-menu.d.ts +4 -1
- package/dist/components/features/app-navigation/nav-menu.d.ts.map +1 -1
- package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts +6 -5
- package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts.map +1 -1
- package/dist/components/features/calendar-date-picker/types.d.ts +19 -0
- package/dist/components/features/calendar-date-picker/types.d.ts.map +1 -1
- package/dist/components/features/code-editor/code-editor.d.ts +1 -1
- package/dist/components/features/code-editor/code-editor.d.ts.map +1 -1
- package/dist/components/features/code-editor/index.d.ts +1 -1
- package/dist/components/features/code-editor/index.d.ts.map +1 -1
- package/dist/components/features/code-editor/types.d.ts +25 -2
- package/dist/components/features/code-editor/types.d.ts.map +1 -1
- package/dist/components/features/data-table/core/client-provider.d.ts.map +1 -1
- package/dist/components/features/date-time-picker/date-time-picker.d.ts +12 -4
- package/dist/components/features/date-time-picker/date-time-picker.d.ts.map +1 -1
- package/dist/components/features/date-time-picker/types.d.ts +9 -0
- package/dist/components/features/date-time-picker/types.d.ts.map +1 -1
- package/dist/components/features/grid/components/col.d.ts +1 -1
- package/dist/components/features/grid/components/col.d.ts.map +1 -1
- package/dist/components/features/grid/components/row.d.ts +1 -1
- package/dist/components/features/grid/components/row.d.ts.map +1 -1
- package/dist/components/features/index.d.ts +1 -0
- package/dist/components/features/index.d.ts.map +1 -1
- package/dist/components/features/logo/index.d.ts +7 -0
- package/dist/components/features/logo/index.d.ts.map +1 -0
- package/dist/components/features/logo/logo-flat.d.ts +28 -0
- package/dist/components/features/logo/logo-flat.d.ts.map +1 -0
- package/dist/components/features/logo/logo-icon.d.ts +27 -0
- package/dist/components/features/logo/logo-icon.d.ts.map +1 -0
- package/dist/components/features/logo/logo-stacked.d.ts +24 -0
- package/dist/components/features/logo/logo-stacked.d.ts.map +1 -0
- package/dist/components/features/logo/logo-text.d.ts +27 -0
- package/dist/components/features/logo/logo-text.d.ts.map +1 -0
- package/dist/components/features/logo/logo.d.ts +24 -0
- package/dist/components/features/logo/logo.d.ts.map +1 -0
- package/dist/components/features/logo/logo.styles.d.ts +28 -0
- package/dist/components/features/logo/logo.styles.d.ts.map +1 -0
- package/dist/components/features/logo/themed/index.d.ts +2 -0
- package/dist/components/features/logo/themed/index.d.ts.map +1 -0
- package/dist/components/features/logo/themed/logo-themed.d.ts +54 -0
- package/dist/components/features/logo/themed/logo-themed.d.ts.map +1 -0
- package/dist/components/features/picker/components/calendar.d.ts +14 -0
- package/dist/components/features/picker/components/calendar.d.ts.map +1 -0
- package/dist/components/features/picker/components/content.d.ts +18 -0
- package/dist/components/features/picker/components/content.d.ts.map +1 -0
- package/dist/components/features/picker/components/context.d.ts +57 -0
- package/dist/components/features/picker/components/context.d.ts.map +1 -0
- package/dist/components/features/picker/components/footer.d.ts +35 -0
- package/dist/components/features/picker/components/footer.d.ts.map +1 -0
- package/dist/components/features/picker/components/index.d.ts +36 -0
- package/dist/components/features/picker/components/index.d.ts.map +1 -0
- package/dist/components/features/picker/components/presets.d.ts +9 -0
- package/dist/components/features/picker/components/presets.d.ts.map +1 -0
- package/dist/components/features/picker/components/root.d.ts +40 -0
- package/dist/components/features/picker/components/root.d.ts.map +1 -0
- package/dist/components/features/picker/components/time-input-field.d.ts +13 -0
- package/dist/components/features/picker/components/time-input-field.d.ts.map +1 -0
- package/dist/components/features/picker/components/time-input.d.ts +13 -0
- package/dist/components/features/picker/components/time-input.d.ts.map +1 -0
- package/dist/components/features/picker/components/timezone-indicator.d.ts +14 -0
- package/dist/components/features/picker/components/timezone-indicator.d.ts.map +1 -0
- package/dist/components/features/picker/components/timezone-select.d.ts +16 -0
- package/dist/components/features/picker/components/timezone-select.d.ts.map +1 -0
- package/dist/components/features/picker/components/trigger.d.ts +23 -0
- package/dist/components/features/picker/components/trigger.d.ts.map +1 -0
- package/dist/components/features/picker/hooks/index.d.ts +5 -0
- package/dist/components/features/picker/hooks/index.d.ts.map +1 -0
- package/dist/components/features/picker/hooks/use-keyboard-shortcuts.d.ts +25 -0
- package/dist/components/features/picker/hooks/use-keyboard-shortcuts.d.ts.map +1 -0
- package/dist/components/features/picker/hooks/use-picker-state.d.ts +51 -0
- package/dist/components/features/picker/hooks/use-picker-state.d.ts.map +1 -0
- package/dist/components/features/picker/hooks/use-presets.d.ts +24 -0
- package/dist/components/features/picker/hooks/use-presets.d.ts.map +1 -0
- package/dist/components/features/picker/hooks/use-time-slots.d.ts +21 -0
- package/dist/components/features/picker/hooks/use-time-slots.d.ts.map +1 -0
- package/dist/components/features/picker/index.d.ts +8 -0
- package/dist/components/features/picker/index.d.ts.map +1 -0
- package/dist/components/features/picker/internal/use-deprecation-warning.d.ts +9 -0
- package/dist/components/features/picker/internal/use-deprecation-warning.d.ts.map +1 -0
- package/dist/components/features/picker/presets/defaults.d.ts +16 -0
- package/dist/components/features/picker/presets/defaults.d.ts.map +1 -0
- package/dist/components/features/picker/presets/index.d.ts +2 -0
- package/dist/components/features/picker/presets/index.d.ts.map +1 -0
- package/dist/components/features/picker/types.d.ts +70 -0
- package/dist/components/features/picker/types.d.ts.map +1 -0
- package/dist/components/features/picker/utils/commit.d.ts +16 -0
- package/dist/components/features/picker/utils/commit.d.ts.map +1 -0
- package/dist/components/features/picker/utils/compare.d.ts +12 -0
- package/dist/components/features/picker/utils/compare.d.ts.map +1 -0
- package/dist/components/features/picker/utils/format-value.d.ts +25 -0
- package/dist/components/features/picker/utils/format-value.d.ts.map +1 -0
- package/dist/components/features/picker/utils/format.d.ts +38 -0
- package/dist/components/features/picker/utils/format.d.ts.map +1 -0
- package/dist/components/features/picker/utils/index.d.ts +7 -0
- package/dist/components/features/picker/utils/index.d.ts.map +1 -0
- package/dist/components/features/picker/utils/range.d.ts +26 -0
- package/dist/components/features/picker/utils/range.d.ts.map +1 -0
- package/dist/components/features/picker/utils/timezone.d.ts +38 -0
- package/dist/components/features/picker/utils/timezone.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/date-picker.d.ts +10 -0
- package/dist/components/features/picker/wrappers/date-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/date-range-picker.d.ts +16 -0
- package/dist/components/features/picker/wrappers/date-range-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/date-range-time-picker.d.ts +16 -0
- package/dist/components/features/picker/wrappers/date-range-time-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/date-time-picker.d.ts +20 -0
- package/dist/components/features/picker/wrappers/date-time-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/date-time-range-picker.d.ts +16 -0
- package/dist/components/features/picker/wrappers/date-time-range-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/index.d.ts +16 -0
- package/dist/components/features/picker/wrappers/index.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/internal/default-footer.d.ts +7 -0
- package/dist/components/features/picker/wrappers/internal/default-footer.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/time-picker.d.ts +14 -0
- package/dist/components/features/picker/wrappers/time-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/time-range-picker.d.ts +16 -0
- package/dist/components/features/picker/wrappers/time-range-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/types.d.ts +118 -0
- package/dist/components/features/picker/wrappers/types.d.ts.map +1 -0
- package/dist/components/features/tag-input/tag-input.d.ts +1 -1
- package/dist/components/features/tag-input/tag-input.d.ts.map +1 -1
- package/dist/components/features/time-picker/time-picker.d.ts +5 -0
- package/dist/components/features/time-picker/time-picker.d.ts.map +1 -1
- package/dist/components/features/time-picker/types.d.ts +5 -0
- package/dist/components/features/time-picker/types.d.ts.map +1 -1
- package/dist/components/features/time-range-picker/index.d.ts +5 -0
- package/dist/components/features/time-range-picker/index.d.ts.map +1 -1
- package/dist/components/features/time-range-picker/time-range-picker.d.ts +19 -14
- package/dist/components/features/time-range-picker/time-range-picker.d.ts.map +1 -1
- package/dist/components/features/time-range-picker/types.d.ts +20 -0
- package/dist/components/features/time-range-picker/types.d.ts.map +1 -1
- package/dist/data-table/index.mjs +22 -15
- package/dist/date-picker/index.mjs +2 -2
- package/dist/date-range-picker-DNZh06zo.mjs +77 -0
- package/dist/date-time-picker/index.mjs +1 -1
- package/dist/date-time-picker-BiobghTJ.mjs +43 -0
- package/dist/date-time-picker-C0fF7s_e.mjs +109 -0
- package/dist/date-time-range-picker-BAsH_Wv9.mjs +82 -0
- package/dist/default-footer-DbpemJVl.mjs +1037 -0
- package/dist/dropzone/index.mjs +1 -1
- package/dist/{dropzone-Bt0plEuw.mjs → dropzone-DXH0xHso.mjs} +1 -1
- package/dist/empty-content/index.mjs +1 -1
- package/dist/form/adapters/conform/index.mjs +19 -19
- package/dist/form/adapters/rhf/index.mjs +18 -18
- package/dist/form/index.mjs +2 -2
- package/dist/form/stepper/index.mjs +25 -23
- package/dist/{form-CCNN9VtJ.mjs → form-DvgKb4s4.mjs} +49 -42
- package/dist/{form-context-CeKyvO-A.mjs → form-context-0usxTumz.mjs} +3 -3
- package/dist/grid/index.mjs +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/index.mjs +44 -42
- package/dist/input-group/index.mjs +1 -1
- package/dist/{input-group-DDtz-RT7.mjs → input-group-CeMsDhOk.mjs} +1 -1
- package/dist/input-number/index.mjs +1 -1
- package/dist/{input-number-Diu-C6d5.mjs → input-number-BU4nno8J.mjs} +1 -1
- package/dist/loader-overlay/index.mjs +1 -1
- package/dist/logo/index.mjs +3 -0
- package/dist/logo/themed/index.mjs +106 -0
- package/dist/logo-BQVyMDDx.mjs +23 -0
- package/dist/logo-text-BW31T2dS.mjs +227 -0
- package/dist/map/index.mjs +1 -1
- package/dist/{map-qo7bY_g_.mjs → map-t6n7VaX1.mjs} +24 -27
- package/dist/more-actions/index.mjs +2 -2
- package/dist/{more-actions-Ca5qqd0H.mjs → more-actions-Bp0b_jek.mjs} +2 -2
- package/dist/multi-select/index.mjs +1 -1
- package/dist/{multi-select-DM_dxnSV.mjs → multi-select-7jly2Hcd.mjs} +6 -6
- package/dist/page-title/index.mjs +1 -1
- package/dist/picker/index.mjs +273 -0
- package/dist/rich-text-editor/index.mjs +1 -1
- package/dist/{rich-text-editor-CQH_U4T5.mjs → rich-text-editor-Ddqx_EiO.mjs} +1 -1
- package/dist/select/index.mjs +1 -1
- package/dist/select-By1ZqPgr.mjs +94 -0
- package/dist/select-Ck0szhAH.mjs +73 -0
- package/dist/sidebar/index.mjs +1 -1
- package/dist/{sidebar-B8LQJiNI.mjs → sidebar-CUnFkH7o.mjs} +32 -32
- package/dist/skeleton/index.mjs +1 -1
- package/dist/{skeleton-D4HOEiOZ.mjs → skeleton-CxAhQT6T.mjs} +1 -1
- package/dist/stepper/index.mjs +1 -1
- package/dist/{stepper-Beb-zbdL.mjs → stepper-BMC_QbJK.mjs} +7 -7
- package/dist/styles/root.css +4 -2
- package/dist/styles/shadcn/shadcn.css +212 -213
- package/dist/switch/index.mjs +1 -1
- package/dist/table/index.mjs +1 -1
- package/dist/tag-input/index.mjs +1 -1
- package/dist/{tag-input-Bf4GMptp.mjs → tag-input-CV1JbKTm.mjs} +1 -1
- package/dist/task-queue/index.mjs +1 -1
- package/dist/{task-queue-dropdown-D-LncEWm.mjs → task-queue-dropdown-J1FuQOSr.mjs} +3 -3
- package/dist/textarea/index.mjs +1 -1
- package/dist/theme/index.mjs +1 -1
- package/dist/{themes-CAiN4b6G.mjs → themes-08-znmBI.mjs} +16 -16
- package/dist/time-input-9LdNL0Us.mjs +196 -0
- package/dist/time-picker/index.mjs +1 -1
- package/dist/time-picker-B-vpUClR.mjs +45 -0
- package/dist/time-picker-C840fLl6.mjs +49 -0
- package/dist/timezone-indicator-COoeMKKs.mjs +27 -0
- package/dist/{to-api-format-CgKcC9SK.mjs → to-api-format-CmXTvYka.mjs} +58 -243
- package/dist/toast/index.mjs +2 -2
- package/dist/{toast-DDdLgY53.mjs → toast-Bd5Kk7BB.mjs} +1 -1
- package/dist/tooltip/index.mjs +1 -1
- package/dist/transfer/index.mjs +1 -1
- package/dist/{transfer-CoGPwOc6.mjs → transfer-CuJGL420.mjs} +6 -6
- package/dist/{types-CKIe2WlV.mjs → types-DvMIxilw.mjs} +9 -3
- package/dist/typography/index.mjs +1 -1
- package/dist/{typography-TRKP_CLT.mjs → typography-CBwfg-vz.mjs} +5 -5
- package/dist/{use-copy-to-clipboard-D7KyLIAt.mjs → use-copy-to-clipboard-ZHDvfV3W.mjs} +1 -1
- package/dist/use-deprecation-warning-Dy_DOyLu.mjs +20 -0
- package/dist/{use-display-touched-C-afz17j.mjs → use-display-touched-CiY6ajpy.mjs} +5 -5
- package/dist/{use-option-picker-BXQOfyrK.mjs → use-option-picker-DV5O68eV.mjs} +1 -1
- package/dist/utils/index.mjs +1 -1
- package/dist/visually-hidden/index.mjs +1 -1
- package/package.json +40 -25
- package/dist/calendar-date-picker-BaykEs6j.mjs +0 -749
- package/dist/date-time-picker-DKOxrhmc.mjs +0 -193
- package/dist/select-zxwykvQn.mjs +0 -163
- package/dist/time-picker-BZF5jbF6.mjs +0 -99
- package/dist/use-date-constraints-R3H4lIoT.mjs +0 -41
- /package/dist/{action-row-DnhBhMtt.mjs → action-row-DXw4UnHU.mjs} +0 -0
- /package/dist/{empty-content-CBh5bbtJ.mjs → empty-content-DTk_lwnh.mjs} +0 -0
- /package/dist/{hooks-DQXVwbrs.mjs → hooks-BPxgIHKV.mjs} +0 -0
- /package/dist/{loader-overlay-C2WDla6V.mjs → loader-overlay-B3YEoOFJ.mjs} +0 -0
- /package/dist/{map-leaflet-imports-yWwH4CHB.mjs → map-leaflet-imports-C8l0RTTP.mjs} +0 -0
- /package/dist/{page-title-ChLiv6gB.mjs → page-title-CGW3f4qH.mjs} +0 -0
- /package/dist/{skeleton-D2xuJdE1.mjs → skeleton-B1NOdZGM.mjs} +0 -0
- /package/dist/{switch-DcSF42Kc.mjs → switch-BcQaR1Bp.mjs} +0 -0
- /package/dist/{table-DWGT4cqh.mjs → table-ouGk4Vxe.mjs} +0 -0
- /package/dist/{textarea-BoChBcFz.mjs → textarea-q-k7DYwi.mjs} +0 -0
- /package/dist/{toast-D5XD7goD.mjs → toast-BWol1pyV.mjs} +0 -0
- /package/dist/{tooltip-a7NTDCWw.mjs → tooltip-CHuzXR_O.mjs} +0 -0
- /package/dist/{utils-BwB1mIdZ.mjs → utils-C07H7h7q.mjs} +0 -0
- /package/dist/{visuallyhidden-BHOPczmW.mjs → visuallyhidden-CoIJOJ9z.mjs} +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
|
+
import { t as Button } from "./button-Rw1xI-k9.mjs";
|
|
3
|
+
import { t as ResponsivePopover } from "./responsive-popover-D-t9bxSN.mjs";
|
|
4
|
+
import { n as OptionList, t as useOptionPicker } from "./use-option-picker-DV5O68eV.mjs";
|
|
5
|
+
import { A as zonedDateToIso, _ as formatTimeLabel, h as dateToHHmm, k as isoToZonedDate, w as usePickerContext, y as parseTimeString } from "./default-footer-DbpemJVl.mjs";
|
|
6
|
+
import { Clock } from "lucide-react";
|
|
7
|
+
import { useMemo, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/features/picker/hooks/use-time-slots.ts
|
|
10
|
+
function timeToMinutes(t) {
|
|
11
|
+
const parsed = parseTimeString(t);
|
|
12
|
+
return parsed ? parsed.h * 60 + parsed.m : null;
|
|
13
|
+
}
|
|
14
|
+
function minutesToTime(total) {
|
|
15
|
+
const h = Math.floor(total / 60);
|
|
16
|
+
const m = total % 60;
|
|
17
|
+
return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generate an `OptionPickerOption[]` of HH:mm slots for the slot-dropdown UI.
|
|
21
|
+
*
|
|
22
|
+
* Slots are produced in pure minute arithmetic — DST is not considered (slots
|
|
23
|
+
* are wall-clock times of day, independent of any specific calendar date).
|
|
24
|
+
*/
|
|
25
|
+
function useTimeSlots({ min, max, step = 15, hourCycle = "24" }) {
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
const minMinutes = min ? timeToMinutes(min) ?? 0 : 0;
|
|
28
|
+
const maxMinutes = max ? timeToMinutes(max) ?? 1439 : 1439;
|
|
29
|
+
const slots = [];
|
|
30
|
+
for (let m = minMinutes; m <= maxMinutes; m += step) {
|
|
31
|
+
if (m >= 1440) break;
|
|
32
|
+
const value = minutesToTime(m);
|
|
33
|
+
slots.push({
|
|
34
|
+
value,
|
|
35
|
+
label: formatTimeLabel(value, hourCycle)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return slots;
|
|
39
|
+
}, [
|
|
40
|
+
min,
|
|
41
|
+
max,
|
|
42
|
+
step,
|
|
43
|
+
hourCycle
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/components/features/picker/components/time-input.tsx
|
|
48
|
+
function combineDateAndTime(dateIso, time, timezone) {
|
|
49
|
+
const d = isoToZonedDate(dateIso, timezone);
|
|
50
|
+
const parsed = parseTimeString(time);
|
|
51
|
+
if (!parsed) return dateIso;
|
|
52
|
+
d.setHours(parsed.h, parsed.m, 0, 0);
|
|
53
|
+
return zonedDateToIso(d, timezone);
|
|
54
|
+
}
|
|
55
|
+
function PickerTimeInput({ target, min, max, className }) {
|
|
56
|
+
const { mode, timezone, hourCycle, step, state, actions } = usePickerContext();
|
|
57
|
+
let effectiveMin = min;
|
|
58
|
+
if (target === "range-to" && mode === "time-range") {
|
|
59
|
+
const fromValue = state.pendingValue?.from;
|
|
60
|
+
if (fromValue) effectiveMin = min && min > fromValue ? min : fromValue;
|
|
61
|
+
}
|
|
62
|
+
const slots = useTimeSlots({
|
|
63
|
+
min: effectiveMin,
|
|
64
|
+
max,
|
|
65
|
+
step,
|
|
66
|
+
hourCycle
|
|
67
|
+
});
|
|
68
|
+
let currentValue;
|
|
69
|
+
let embeddedDisabled = false;
|
|
70
|
+
if (target === "single" && mode === "time") currentValue = state.pendingValue ?? void 0;
|
|
71
|
+
else if ((target === "range-from" || target === "range-to") && mode === "time-range") {
|
|
72
|
+
const v = state.pendingValue;
|
|
73
|
+
currentValue = target === "range-from" ? v?.from : v?.to;
|
|
74
|
+
} else if (target === "embedded-from" || target === "embedded-to") {
|
|
75
|
+
if (mode === "datetime-range" || mode === "date-range-time") {
|
|
76
|
+
const v = state.pendingValue;
|
|
77
|
+
const iso = target === "embedded-from" ? v?.from : v?.to;
|
|
78
|
+
currentValue = iso ? dateToHHmm(isoToZonedDate(iso, timezone)) : void 0;
|
|
79
|
+
embeddedDisabled = v === null;
|
|
80
|
+
} else if (mode === "datetime") {
|
|
81
|
+
const iso = state.pendingValue;
|
|
82
|
+
currentValue = iso ? dateToHHmm(isoToZonedDate(iso, timezone)) : void 0;
|
|
83
|
+
embeddedDisabled = iso === null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const handleSelect = (newTime) => {
|
|
87
|
+
if (target === "single" && mode === "time") {
|
|
88
|
+
actions.setSingleTime(newTime);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (mode === "time-range") {
|
|
92
|
+
const v = state.pendingValue ?? {
|
|
93
|
+
from: "00:00",
|
|
94
|
+
to: "23:59"
|
|
95
|
+
};
|
|
96
|
+
const next = target === "range-from" ? {
|
|
97
|
+
from: newTime,
|
|
98
|
+
to: v.to
|
|
99
|
+
} : {
|
|
100
|
+
from: v.from,
|
|
101
|
+
to: newTime
|
|
102
|
+
};
|
|
103
|
+
actions.setTimeRange(next);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (mode === "datetime-range" || mode === "date-range-time") {
|
|
107
|
+
const v = state.pendingValue;
|
|
108
|
+
if (!v) return;
|
|
109
|
+
const next = target === "embedded-from" ? {
|
|
110
|
+
from: combineDateAndTime(v.from, newTime, timezone),
|
|
111
|
+
to: v.to
|
|
112
|
+
} : {
|
|
113
|
+
from: v.from,
|
|
114
|
+
to: combineDateAndTime(v.to, newTime, timezone)
|
|
115
|
+
};
|
|
116
|
+
actions.setDatetimeRange(next);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (mode === "datetime" && (target === "embedded-from" || target === "embedded-to")) {
|
|
120
|
+
const v = state.pendingValue;
|
|
121
|
+
if (!v) return;
|
|
122
|
+
actions.setSingleDatetime(combineDateAndTime(v, newTime, timezone));
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
if (target === "single" || target === "range-from" || target === "range-to") return /* @__PURE__ */ jsx(InlineSlotList, {
|
|
126
|
+
slots,
|
|
127
|
+
value: currentValue,
|
|
128
|
+
onSelect: handleSelect,
|
|
129
|
+
className
|
|
130
|
+
});
|
|
131
|
+
return /* @__PURE__ */ jsx(EmbeddedSlotInput, {
|
|
132
|
+
label: currentValue ? formatTimeLabel(currentValue, hourCycle) : "— : —",
|
|
133
|
+
slots,
|
|
134
|
+
value: currentValue,
|
|
135
|
+
onSelect: handleSelect,
|
|
136
|
+
disabled: embeddedDisabled,
|
|
137
|
+
className
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
PickerTimeInput.displayName = "Picker.TimeInput";
|
|
141
|
+
function InlineSlotList({ slots, value, onSelect, className }) {
|
|
142
|
+
const [open, setOpen] = useState(true);
|
|
143
|
+
return /* @__PURE__ */ jsx(OptionList, {
|
|
144
|
+
picker: useOptionPicker({
|
|
145
|
+
multiple: false,
|
|
146
|
+
options: slots,
|
|
147
|
+
value,
|
|
148
|
+
onValueChange: (next) => {
|
|
149
|
+
if (typeof next === "string") onSelect(next);
|
|
150
|
+
},
|
|
151
|
+
open,
|
|
152
|
+
onOpenChange: setOpen
|
|
153
|
+
}),
|
|
154
|
+
disableSearch: slots.length <= 48,
|
|
155
|
+
searchPlaceholder: "Search time...",
|
|
156
|
+
listClassName: cn("max-h-[240px]", className)
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function EmbeddedSlotInput({ label, slots, value, onSelect, disabled = false, className }) {
|
|
160
|
+
const [open, setOpen] = useState(false);
|
|
161
|
+
const picker = useOptionPicker({
|
|
162
|
+
multiple: false,
|
|
163
|
+
options: slots,
|
|
164
|
+
value,
|
|
165
|
+
onValueChange: (next) => {
|
|
166
|
+
if (typeof next === "string") {
|
|
167
|
+
onSelect(next);
|
|
168
|
+
setOpen(false);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
open,
|
|
172
|
+
onOpenChange: disabled ? () => {} : setOpen
|
|
173
|
+
});
|
|
174
|
+
return /* @__PURE__ */ jsx(ResponsivePopover, {
|
|
175
|
+
open,
|
|
176
|
+
onOpenChange: disabled ? () => {} : setOpen,
|
|
177
|
+
sheetTitle: "Select time",
|
|
178
|
+
trigger: /* @__PURE__ */ jsxs(Button, {
|
|
179
|
+
type: "button",
|
|
180
|
+
variant: "outline",
|
|
181
|
+
disabled,
|
|
182
|
+
className: cn("h-8 gap-1.5 px-2 text-xs font-normal", className),
|
|
183
|
+
children: [/* @__PURE__ */ jsx(Clock, { className: "size-3.5 opacity-60" }), /* @__PURE__ */ jsx("span", { children: label })]
|
|
184
|
+
}),
|
|
185
|
+
align: "start",
|
|
186
|
+
contentClassName: "w-[200px]",
|
|
187
|
+
children: /* @__PURE__ */ jsx(OptionList, {
|
|
188
|
+
picker,
|
|
189
|
+
disableSearch: slots.length <= 48,
|
|
190
|
+
searchPlaceholder: "Search time...",
|
|
191
|
+
listClassName: "max-h-[240px]"
|
|
192
|
+
})
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
export { useTimeSlots as n, PickerTimeInput as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as TimePicker } from "../time-picker-
|
|
1
|
+
import { t as TimePicker } from "../time-picker-C840fLl6.mjs";
|
|
2
2
|
export { TimePicker };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { S as PickerContent, c as PickerTrigger, l as Picker, s as formatPickerValue, t as DefaultFooter } from "./default-footer-DbpemJVl.mjs";
|
|
2
|
+
import { t as PickerTimeInput } from "./time-input-9LdNL0Us.mjs";
|
|
3
|
+
import { Clock } from "lucide-react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/features/picker/wrappers/time-picker.tsx
|
|
6
|
+
const DEFAULT_TIME_ICON = /* @__PURE__ */ jsx(Clock, { className: "text-muted-foreground size-4 shrink-0" });
|
|
7
|
+
function TimePicker({ value, onChange, placeholder = "Pick a time", clearable = true, responsive = true, sheetTitle = "Pick a time", step = 15, hourCycle, minTime, maxTime, timeFormat, triggerLabel, icon, disabled, className, triggerClassName, popoverClassName, id, sheetDescription, modal, commit }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Picker.Root, {
|
|
9
|
+
mode: "time",
|
|
10
|
+
value,
|
|
11
|
+
onChange,
|
|
12
|
+
commit,
|
|
13
|
+
responsive,
|
|
14
|
+
step,
|
|
15
|
+
hourCycle,
|
|
16
|
+
children: /* @__PURE__ */ jsx(PickerContent, {
|
|
17
|
+
trigger: /* @__PURE__ */ jsx(PickerTrigger, {
|
|
18
|
+
placeholder,
|
|
19
|
+
clearable,
|
|
20
|
+
disabled,
|
|
21
|
+
className,
|
|
22
|
+
triggerClassName,
|
|
23
|
+
id,
|
|
24
|
+
icon: icon ?? DEFAULT_TIME_ICON,
|
|
25
|
+
children: (v) => triggerLabel ? triggerLabel(v) : formatPickerValue(v, "time", {
|
|
26
|
+
hourCycle,
|
|
27
|
+
timeFormat
|
|
28
|
+
})
|
|
29
|
+
}),
|
|
30
|
+
sheetTitle,
|
|
31
|
+
sheetDescription,
|
|
32
|
+
modal,
|
|
33
|
+
contentClassName: popoverClassName,
|
|
34
|
+
footer: /* @__PURE__ */ jsx(DefaultFooter, {}),
|
|
35
|
+
children: /* @__PURE__ */ jsx(PickerTimeInput, {
|
|
36
|
+
target: "single",
|
|
37
|
+
min: minTime,
|
|
38
|
+
max: maxTime
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
TimePicker.displayName = "TimePicker";
|
|
44
|
+
//#endregion
|
|
45
|
+
export { TimePicker as t };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { t as useDeprecationWarning } from "./use-deprecation-warning-Dy_DOyLu.mjs";
|
|
2
|
+
import { t as TimePicker$1 } from "./time-picker-B-vpUClR.mjs";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/features/time-picker/time-picker.tsx
|
|
5
|
+
const STEP_VALUES = [
|
|
6
|
+
1,
|
|
7
|
+
5,
|
|
8
|
+
10,
|
|
9
|
+
15,
|
|
10
|
+
30,
|
|
11
|
+
60
|
|
12
|
+
];
|
|
13
|
+
function normalizeStep(step) {
|
|
14
|
+
if (step === void 0) return 15;
|
|
15
|
+
return STEP_VALUES.includes(step) ? step : 15;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use `TimePicker` from `@datum-cloud/datum-ui/picker` instead.
|
|
19
|
+
* This adapter shim ships through 0.10.x and is removed in 1.0.0. See
|
|
20
|
+
* `picker-migration.mdx`.
|
|
21
|
+
*/
|
|
22
|
+
function TimePicker({ value, onChange, min, max, step, placeholder, disabled, className, id, name, responsive = true, sheetTitle }) {
|
|
23
|
+
useDeprecationWarning("TimePicker (legacy)", "TimePicker");
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TimePicker$1, {
|
|
25
|
+
value: value ?? null,
|
|
26
|
+
onChange: (next) => {
|
|
27
|
+
onChange?.(next ?? "");
|
|
28
|
+
},
|
|
29
|
+
placeholder: placeholder ?? "Select time",
|
|
30
|
+
sheetTitle: sheetTitle ?? placeholder ?? "Select time",
|
|
31
|
+
responsive,
|
|
32
|
+
disabled,
|
|
33
|
+
className,
|
|
34
|
+
triggerClassName: className,
|
|
35
|
+
id,
|
|
36
|
+
step: normalizeStep(step),
|
|
37
|
+
hourCycle: "12",
|
|
38
|
+
minTime: min,
|
|
39
|
+
maxTime: max
|
|
40
|
+
}), name && /* @__PURE__ */ jsx("input", {
|
|
41
|
+
type: "hidden",
|
|
42
|
+
name,
|
|
43
|
+
value: value ?? "",
|
|
44
|
+
readOnly: true
|
|
45
|
+
})] });
|
|
46
|
+
}
|
|
47
|
+
TimePicker.displayName = "TimePicker";
|
|
48
|
+
//#endregion
|
|
49
|
+
export { TimePicker as t };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
|
+
import { E as formatTimezoneLabel, L as isTimeBearingMode, w as usePickerContext } from "./default-footer-DbpemJVl.mjs";
|
|
3
|
+
import { Globe } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/features/picker/components/timezone-indicator.tsx
|
|
6
|
+
function PickerTimezoneIndicator({ className, variant = "full" }) {
|
|
7
|
+
const { mode, timezone, hideTimezone } = usePickerContext();
|
|
8
|
+
if (hideTimezone) return null;
|
|
9
|
+
if (!isTimeBearingMode(mode)) return null;
|
|
10
|
+
if (variant === "compact") return /* @__PURE__ */ jsx("span", {
|
|
11
|
+
"data-slot": "picker-tz-indicator",
|
|
12
|
+
className: cn("text-muted-foreground text-xs", className),
|
|
13
|
+
children: timezone
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
16
|
+
"data-slot": "picker-tz-indicator",
|
|
17
|
+
className: cn("text-muted-foreground bg-muted/30 flex items-center gap-2 px-3 py-2 text-xs", className),
|
|
18
|
+
children: [/* @__PURE__ */ jsx(Globe, { className: "size-3.5" }), /* @__PURE__ */ jsxs("span", { children: [
|
|
19
|
+
"Times shown in",
|
|
20
|
+
" ",
|
|
21
|
+
formatTimezoneLabel(timezone)
|
|
22
|
+
] })]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
PickerTimezoneIndicator.displayName = "Picker.TimezoneIndicator";
|
|
26
|
+
//#endregion
|
|
27
|
+
export { PickerTimezoneIndicator as t };
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
2
|
import { t as Button } from "./button-BllvE9Lm.mjs";
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as Icon } from "./icon-wrapper-DuLp3RM1.mjs";
|
|
5
|
-
import { t as Calendar$1 } from "./calendar-C-Hbf74r.mjs";
|
|
3
|
+
import { t as Calendar } from "./calendar-Dwvq3Vu_.mjs";
|
|
6
4
|
import { t as Input } from "./input-FKGqZypx.mjs";
|
|
7
|
-
import { t as MobileSheet } from "./mobile-sheet-BxMvkzAj.mjs";
|
|
8
|
-
import { i as PopoverTrigger, r as PopoverContent, t as Popover } from "./popover-JOuXJOZ2.mjs";
|
|
9
|
-
import { t as useBreakpoint } from "./use-breakpoint-DGcVmB3c.mjs";
|
|
10
5
|
import { t as ResponsivePopover } from "./responsive-popover-D-t9bxSN.mjs";
|
|
11
|
-
import { i as SelectItem, l as SelectTrigger, n as SelectContent, t as Select, u as SelectValue } from "./select-
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
6
|
+
import { i as SelectItem, l as SelectTrigger, n as SelectContent, t as Select, u as SelectValue } from "./select-Ck0szhAH.mjs";
|
|
7
|
+
import { t as useDeprecationWarning } from "./use-deprecation-warning-Dy_DOyLu.mjs";
|
|
8
|
+
import { t as DateTimeRangePicker } from "./date-time-range-picker-BAsH_Wv9.mjs";
|
|
9
|
+
import { CalendarIcon, Globe } from "lucide-react";
|
|
10
|
+
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
12
|
import { format, isSameDay, isSameYear, parse, subDays, subHours, subMinutes } from "date-fns";
|
|
16
13
|
import { fromZonedTime, toZonedTime } from "date-fns-tz";
|
|
17
14
|
//#region src/components/features/time-range-picker/utils/timezone.ts
|
|
@@ -296,7 +293,7 @@ function CustomRangePanel({ fromUtc, toUtc, timezone, onRangeChange, disableFutu
|
|
|
296
293
|
children: format(startDate, "MMM d, yyyy")
|
|
297
294
|
})]
|
|
298
295
|
}),
|
|
299
|
-
children: /* @__PURE__ */ jsx(Calendar
|
|
296
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
300
297
|
mode: "single",
|
|
301
298
|
selected: startDate,
|
|
302
299
|
onSelect: handleStartDateSelect,
|
|
@@ -340,7 +337,7 @@ function CustomRangePanel({ fromUtc, toUtc, timezone, onRangeChange, disableFutu
|
|
|
340
337
|
children: format(endDate, "MMM d, yyyy")
|
|
341
338
|
})]
|
|
342
339
|
}),
|
|
343
|
-
children: /* @__PURE__ */ jsx(Calendar
|
|
340
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
344
341
|
mode: "single",
|
|
345
342
|
selected: endDate,
|
|
346
343
|
onSelect: handleEndDateSelect,
|
|
@@ -550,6 +547,54 @@ function getPresetRange(preset, timezone) {
|
|
|
550
547
|
};
|
|
551
548
|
}
|
|
552
549
|
//#endregion
|
|
550
|
+
//#region src/components/features/time-range-picker/time-range-picker.tsx
|
|
551
|
+
/**
|
|
552
|
+
* @deprecated Use `DateTimeRangePicker` from `@datum-cloud/datum-ui/picker`
|
|
553
|
+
* (or `TimeRangePicker` for time-of-day-only ranges). This adapter shim ships
|
|
554
|
+
* through 0.10.x and is removed in 1.0.0. See `picker-migration.mdx`.
|
|
555
|
+
*
|
|
556
|
+
* Notable diff: legacy `TimeRangeValue` envelope had a `type: 'preset' | 'custom'`
|
|
557
|
+
* discriminator. The shim translates to/from the new wrapper's flatter
|
|
558
|
+
* `{ from, to, preset? }` shape.
|
|
559
|
+
*/
|
|
560
|
+
function TimeRangePicker({ value, onChange, onClear: _onClear, timezone, presets, disableFuture, maxDate, minDate, className, disabled, placeholder = "Select time range", align: _align, side: _side }) {
|
|
561
|
+
useDeprecationWarning("TimeRangePicker (legacy)", "DateTimeRangePicker");
|
|
562
|
+
return /* @__PURE__ */ jsx(DateTimeRangePicker, {
|
|
563
|
+
value: value ? {
|
|
564
|
+
from: value.from,
|
|
565
|
+
to: value.to
|
|
566
|
+
} : null,
|
|
567
|
+
onChange: (next) => {
|
|
568
|
+
if (next === null) {
|
|
569
|
+
onChange({
|
|
570
|
+
type: "custom",
|
|
571
|
+
from: "",
|
|
572
|
+
to: ""
|
|
573
|
+
});
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
const withPreset = next;
|
|
577
|
+
onChange({
|
|
578
|
+
type: withPreset.preset ? "preset" : "custom",
|
|
579
|
+
preset: withPreset.preset,
|
|
580
|
+
from: withPreset.from,
|
|
581
|
+
to: withPreset.to
|
|
582
|
+
});
|
|
583
|
+
},
|
|
584
|
+
placeholder,
|
|
585
|
+
sheetTitle: placeholder,
|
|
586
|
+
timezone,
|
|
587
|
+
presets,
|
|
588
|
+
disableFuture,
|
|
589
|
+
maxDate,
|
|
590
|
+
minDate,
|
|
591
|
+
className,
|
|
592
|
+
disabled,
|
|
593
|
+
numberOfMonths: 2
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
TimeRangePicker.displayName = "TimeRangePicker";
|
|
597
|
+
//#endregion
|
|
553
598
|
//#region src/components/features/time-range-picker/utils/format-display.ts
|
|
554
599
|
/**
|
|
555
600
|
* Format a TimeRangeValue for display in the trigger button
|
|
@@ -593,236 +638,6 @@ function formatDateForInput(date) {
|
|
|
593
638
|
return format(date, "yyyy-MM-dd'T'HH:mm");
|
|
594
639
|
}
|
|
595
640
|
//#endregion
|
|
596
|
-
//#region src/components/features/time-range-picker/time-range-picker.tsx
|
|
597
|
-
function TimeRangePicker({ value, onChange, onClear, timezone: timezoneProp, presets = DEFAULT_PRESETS, disableFuture = false, maxDate, minDate, className, disabled = false, placeholder = "Select time range", align = "start", side = "bottom" }) {
|
|
598
|
-
const [open, setOpen] = useState(false);
|
|
599
|
-
const isMobile = useBreakpoint() === "mobile";
|
|
600
|
-
const timezone = timezoneProp ?? getBrowserTimezone();
|
|
601
|
-
const defaultPreset = getDefaultPreset(presets);
|
|
602
|
-
const defaultRange = useMemo(() => getPresetRange(defaultPreset, timezone), [defaultPreset, timezone]);
|
|
603
|
-
const currentFromUtc = value?.from ?? defaultRange.from;
|
|
604
|
-
const currentToUtc = value?.to ?? defaultRange.to;
|
|
605
|
-
const calendarRange = useMemo(() => {
|
|
606
|
-
try {
|
|
607
|
-
return {
|
|
608
|
-
from: utcStringToZonedDate(currentFromUtc, timezone),
|
|
609
|
-
to: utcStringToZonedDate(currentToUtc, timezone)
|
|
610
|
-
};
|
|
611
|
-
} catch {
|
|
612
|
-
return;
|
|
613
|
-
}
|
|
614
|
-
}, [
|
|
615
|
-
currentFromUtc,
|
|
616
|
-
currentToUtc,
|
|
617
|
-
timezone
|
|
618
|
-
]);
|
|
619
|
-
const effectiveValue = useMemo(() => {
|
|
620
|
-
if (value?.type === "preset" && value?.preset && (!value?.from || !value?.to)) {
|
|
621
|
-
const preset = presets.find((p) => p.key === value.preset) ?? defaultPreset;
|
|
622
|
-
const range = getPresetRange(preset, timezone);
|
|
623
|
-
return {
|
|
624
|
-
type: "preset",
|
|
625
|
-
preset: preset.key,
|
|
626
|
-
from: range.from,
|
|
627
|
-
to: range.to
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
if (value?.from && value?.to) return value;
|
|
631
|
-
return {
|
|
632
|
-
type: "preset",
|
|
633
|
-
preset: defaultPreset.key,
|
|
634
|
-
from: defaultRange.from,
|
|
635
|
-
to: defaultRange.to
|
|
636
|
-
};
|
|
637
|
-
}, [
|
|
638
|
-
value,
|
|
639
|
-
defaultPreset,
|
|
640
|
-
defaultRange.from,
|
|
641
|
-
defaultRange.to,
|
|
642
|
-
presets,
|
|
643
|
-
timezone
|
|
644
|
-
]);
|
|
645
|
-
const displayText = useMemo(() => formatTimeRangeDisplay(effectiveValue, timezone) || placeholder, [
|
|
646
|
-
effectiveValue,
|
|
647
|
-
timezone,
|
|
648
|
-
placeholder
|
|
649
|
-
]);
|
|
650
|
-
const handlePresetSelect = useCallback((preset) => {
|
|
651
|
-
const range = getPresetRange(preset, timezone);
|
|
652
|
-
onChange({
|
|
653
|
-
type: "preset",
|
|
654
|
-
preset: preset.key,
|
|
655
|
-
from: range.from,
|
|
656
|
-
to: range.to
|
|
657
|
-
});
|
|
658
|
-
setOpen(false);
|
|
659
|
-
}, [onChange, timezone]);
|
|
660
|
-
const userClickedCalendarRef = useRef(false);
|
|
661
|
-
const handleDayClick = useCallback(() => {
|
|
662
|
-
userClickedCalendarRef.current = true;
|
|
663
|
-
}, []);
|
|
664
|
-
const handleCalendarSelect = useCallback((range) => {
|
|
665
|
-
if (!userClickedCalendarRef.current) return;
|
|
666
|
-
userClickedCalendarRef.current = false;
|
|
667
|
-
if (range?.from && range?.to) {
|
|
668
|
-
const now = /* @__PURE__ */ new Date();
|
|
669
|
-
const fromStart = new Date(range.from);
|
|
670
|
-
fromStart.setHours(0, 0, 0, 0);
|
|
671
|
-
const toEnd = new Date(range.to);
|
|
672
|
-
toEnd.setHours(23, 59, 59, 999);
|
|
673
|
-
const effectiveToEnd = toEnd > now ? now : toEnd;
|
|
674
|
-
onChange({
|
|
675
|
-
type: "custom",
|
|
676
|
-
from: zonedDateToUtcString(fromStart, timezone),
|
|
677
|
-
to: zonedDateToUtcString(effectiveToEnd, timezone)
|
|
678
|
-
});
|
|
679
|
-
} else if (range?.from) {
|
|
680
|
-
const now = /* @__PURE__ */ new Date();
|
|
681
|
-
const fromStart = new Date(range.from);
|
|
682
|
-
fromStart.setHours(0, 0, 0, 0);
|
|
683
|
-
const toEnd = new Date(range.from);
|
|
684
|
-
toEnd.setHours(23, 59, 59, 999);
|
|
685
|
-
const effectiveToEnd = toEnd > now ? now : toEnd;
|
|
686
|
-
onChange({
|
|
687
|
-
type: "custom",
|
|
688
|
-
from: zonedDateToUtcString(fromStart, timezone),
|
|
689
|
-
to: zonedDateToUtcString(effectiveToEnd, timezone)
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
}, [onChange, timezone]);
|
|
693
|
-
const handleCustomRangeChange = useCallback((fromUtc, toUtc) => {
|
|
694
|
-
onChange({
|
|
695
|
-
type: "custom",
|
|
696
|
-
from: fromUtc,
|
|
697
|
-
to: toUtc
|
|
698
|
-
});
|
|
699
|
-
}, [onChange]);
|
|
700
|
-
useEffect(() => {
|
|
701
|
-
if (!open) return;
|
|
702
|
-
const handleKeyDown = (e) => {
|
|
703
|
-
const preset = getPresetByShortcut(e.key, presets);
|
|
704
|
-
if (preset) {
|
|
705
|
-
e.preventDefault();
|
|
706
|
-
handlePresetSelect(preset);
|
|
707
|
-
}
|
|
708
|
-
};
|
|
709
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
710
|
-
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
711
|
-
}, [
|
|
712
|
-
open,
|
|
713
|
-
presets,
|
|
714
|
-
handlePresetSelect
|
|
715
|
-
]);
|
|
716
|
-
const effectiveMaxDate = disableFuture ? /* @__PURE__ */ new Date() : maxDate;
|
|
717
|
-
const handleClear = useCallback((e) => {
|
|
718
|
-
e.stopPropagation();
|
|
719
|
-
onClear?.();
|
|
720
|
-
}, [onClear]);
|
|
721
|
-
const showClearButton = value && onClear;
|
|
722
|
-
const triggerButton = /* @__PURE__ */ jsxs(Button, {
|
|
723
|
-
type: "quaternary",
|
|
724
|
-
theme: "outline",
|
|
725
|
-
disabled,
|
|
726
|
-
className: cn("text-foreground min-w-[200px] items-center justify-between gap-2 px-3 font-normal", className),
|
|
727
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
728
|
-
className: "flex flex-1 items-center gap-2",
|
|
729
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
730
|
-
icon: Calendar,
|
|
731
|
-
size: 16
|
|
732
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
733
|
-
className: "truncate text-xs",
|
|
734
|
-
children: displayText
|
|
735
|
-
})]
|
|
736
|
-
}), showClearButton && /* @__PURE__ */ jsx("div", {
|
|
737
|
-
onClick: (e) => {
|
|
738
|
-
e.stopPropagation();
|
|
739
|
-
e.preventDefault();
|
|
740
|
-
handleClear(e);
|
|
741
|
-
},
|
|
742
|
-
className: cn("size-[14px] shrink-0 p-0 hover:bg-transparent", "hover:text-destructive text-icon-quaternary hover:bg-transparent dark:text-white", "focus:ring-ring focus:ring-2 focus:ring-offset-1 focus:outline-none", "disabled:pointer-events-none disabled:opacity-50", "transition-colors"),
|
|
743
|
-
"aria-label": "Clear time range",
|
|
744
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
745
|
-
icon: X,
|
|
746
|
-
size: 14
|
|
747
|
-
})
|
|
748
|
-
})]
|
|
749
|
-
});
|
|
750
|
-
const pickerContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
751
|
-
/* @__PURE__ */ jsxs("div", {
|
|
752
|
-
className: "divide-border flex flex-col divide-x sm:flex-row",
|
|
753
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
754
|
-
className: "flex-1 px-0",
|
|
755
|
-
children: /* @__PURE__ */ jsx(Calendar$1, {
|
|
756
|
-
className: "w-full",
|
|
757
|
-
mode: "range",
|
|
758
|
-
defaultMonth: calendarRange?.from,
|
|
759
|
-
selected: calendarRange,
|
|
760
|
-
onSelect: handleCalendarSelect,
|
|
761
|
-
onDayClick: handleDayClick,
|
|
762
|
-
numberOfMonths: 1,
|
|
763
|
-
disabled: (date) => {
|
|
764
|
-
if (effectiveMaxDate && date > effectiveMaxDate) return true;
|
|
765
|
-
if (minDate && date < minDate) return true;
|
|
766
|
-
return false;
|
|
767
|
-
},
|
|
768
|
-
initialFocus: true
|
|
769
|
-
})
|
|
770
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
771
|
-
className: "p-3",
|
|
772
|
-
children: /* @__PURE__ */ jsx(QuickRangesPanel, {
|
|
773
|
-
presets,
|
|
774
|
-
value: effectiveValue,
|
|
775
|
-
onPresetSelect: handlePresetSelect
|
|
776
|
-
})
|
|
777
|
-
})]
|
|
778
|
-
}),
|
|
779
|
-
/* @__PURE__ */ jsx(Separator, {}),
|
|
780
|
-
/* @__PURE__ */ jsx("div", {
|
|
781
|
-
className: "p-3",
|
|
782
|
-
children: /* @__PURE__ */ jsx(CustomRangePanel, {
|
|
783
|
-
fromUtc: currentFromUtc,
|
|
784
|
-
toUtc: currentToUtc,
|
|
785
|
-
timezone,
|
|
786
|
-
onRangeChange: handleCustomRangeChange,
|
|
787
|
-
disableFuture
|
|
788
|
-
})
|
|
789
|
-
}),
|
|
790
|
-
/* @__PURE__ */ jsx(Separator, {}),
|
|
791
|
-
/* @__PURE__ */ jsxs("div", {
|
|
792
|
-
className: "text-muted-foreground bg-muted/30 flex items-center gap-2 px-3 py-2 text-xs",
|
|
793
|
-
children: [/* @__PURE__ */ jsx(Globe, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ jsxs("span", { children: ["Your timezone:", formatTimezoneLabel(timezone)] })]
|
|
794
|
-
})
|
|
795
|
-
] });
|
|
796
|
-
if (isMobile) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
797
|
-
className: "relative inline-flex",
|
|
798
|
-
onClick: () => setOpen(true),
|
|
799
|
-
children: triggerButton
|
|
800
|
-
}), /* @__PURE__ */ jsx(MobileSheet, {
|
|
801
|
-
open,
|
|
802
|
-
onOpenChange: setOpen,
|
|
803
|
-
title: "Select time range",
|
|
804
|
-
description: "Choose a preset or custom date range",
|
|
805
|
-
children: pickerContent
|
|
806
|
-
})] });
|
|
807
|
-
return /* @__PURE__ */ jsxs(Popover, {
|
|
808
|
-
open,
|
|
809
|
-
onOpenChange: setOpen,
|
|
810
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
811
|
-
className: "relative inline-flex",
|
|
812
|
-
children: /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
813
|
-
asChild: true,
|
|
814
|
-
children: triggerButton
|
|
815
|
-
})
|
|
816
|
-
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
817
|
-
className: "w-auto rounded-xl p-0",
|
|
818
|
-
align,
|
|
819
|
-
side,
|
|
820
|
-
sideOffset: 4,
|
|
821
|
-
children: pickerContent
|
|
822
|
-
})]
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
//#endregion
|
|
826
641
|
//#region src/components/features/time-range-picker/utils/to-api-format.ts
|
|
827
642
|
/**
|
|
828
643
|
* Convert a TimeRangeValue to API format (startTime/endTime)
|
|
@@ -864,4 +679,4 @@ function toApiTimeRange(value, timezone, presets = DEFAULT_PRESETS) {
|
|
|
864
679
|
};
|
|
865
680
|
}
|
|
866
681
|
//#endregion
|
|
867
|
-
export { utcToLocalInputString as C, utcStringToZonedDate as S, getBrowserTimezone as _,
|
|
682
|
+
export { utcToLocalInputString as C, utcStringToZonedDate as S, getBrowserTimezone as _, TimeRangePicker as a, getTimezoneOffset as b, getPresetByKey as c, TimezoneSelector as d, QuickRangesPanel as f, formatUtcForDisplay as g, formatTimezoneLabel as h, formatTimeRangeDisplay as i, getPresetByShortcut as l, createTimezoneOption as m, formatDateForInput as n, DEFAULT_PRESETS as o, CustomRangePanel as p, formatSingleTimeDisplay as r, getDefaultPreset as s, toApiTimeRange as t, getPresetRange as u, getDefaultTimezoneOptions as v, zonedDateToUtcString as w, localInputStringToUtc as x, getShortTimezoneDisplay as y };
|
package/dist/toast/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as toast } from "../toast-
|
|
2
|
-
import { n as Toaster, t as useToast } from "../toast-
|
|
1
|
+
import { t as toast } from "../toast-BWol1pyV.mjs";
|
|
2
|
+
import { n as Toaster, t as useToast } from "../toast-Bd5Kk7BB.mjs";
|
|
3
3
|
export { Toaster, toast, useToast };
|
package/dist/tooltip/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Tooltip } from "../tooltip-
|
|
1
|
+
import { t as Tooltip } from "../tooltip-CHuzXR_O.mjs";
|
|
2
2
|
export { Tooltip };
|
package/dist/transfer/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Transfer } from "../transfer-
|
|
1
|
+
import { t as Transfer } from "../transfer-CuJGL420.mjs";
|
|
2
2
|
export { Transfer };
|