@datum-cloud/datum-ui 0.6.0 → 0.7.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/LICENSE +21 -0
- package/README.md +10 -0
- package/dist/action-row-DnhBhMtt.mjs +22 -0
- package/dist/app-navigation/index.mjs +2 -2
- package/dist/{app-navigation-84ro28PU.mjs → app-navigation-D0EBWUwJ.mjs} +48 -3
- package/dist/autocomplete/index.mjs +1 -1
- package/dist/autocomplete-DdbTQe6u.mjs +141 -0
- package/dist/autosearch/index.mjs +100 -92
- package/dist/avatar-stack/index.mjs +1 -1
- package/dist/{avatar-stack-oVr8tsU7.mjs → avatar-stack-CDhlA1Nm.mjs} +1 -1
- package/dist/calendar/index.mjs +1 -1
- package/dist/{calendar-DEkCw7I1.mjs → calendar-C-Hbf74r.mjs} +4 -4
- package/dist/{calendar-date-picker-CDT-8Ha8.mjs → calendar-date-picker-BaykEs6j.mjs} +324 -240
- package/dist/code-editor/index.mjs +1 -1
- package/dist/components/base/date-picker/index.d.ts +4 -0
- package/dist/components/base/date-picker/index.d.ts.map +1 -0
- package/dist/components/base/date-picker/types.d.ts +7 -0
- package/dist/components/base/date-picker/types.d.ts.map +1 -0
- package/dist/components/base/date-picker/use-date-constraints.d.ts +8 -0
- package/dist/components/base/date-picker/use-date-constraints.d.ts.map +1 -0
- package/dist/components/base/index.d.ts +3 -0
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/base/mobile-sheet/context.d.ts +13 -0
- package/dist/components/base/mobile-sheet/context.d.ts.map +1 -0
- package/dist/components/base/mobile-sheet/index.d.ts +3 -0
- package/dist/components/base/mobile-sheet/index.d.ts.map +1 -0
- package/dist/components/base/mobile-sheet/mobile-sheet.d.ts +14 -0
- package/dist/components/base/mobile-sheet/mobile-sheet.d.ts.map +1 -0
- package/dist/components/base/option-picker/index.d.ts +5 -0
- package/dist/components/base/option-picker/index.d.ts.map +1 -0
- package/dist/components/base/option-picker/option-list.d.ts +3 -0
- package/dist/components/base/option-picker/option-list.d.ts.map +1 -0
- package/dist/components/base/option-picker/types.d.ts +71 -0
- package/dist/components/base/option-picker/types.d.ts.map +1 -0
- package/dist/components/base/option-picker/use-option-picker.d.ts +4 -0
- package/dist/components/base/option-picker/use-option-picker.d.ts.map +1 -0
- package/dist/components/base/responsive-dropdown/index.d.ts +2 -0
- package/dist/components/base/responsive-dropdown/index.d.ts.map +1 -0
- package/dist/components/base/responsive-dropdown/responsive-dropdown.d.ts +25 -0
- package/dist/components/base/responsive-dropdown/responsive-dropdown.d.ts.map +1 -0
- package/dist/components/base/responsive-popover/index.d.ts +2 -0
- package/dist/components/base/responsive-popover/index.d.ts.map +1 -0
- package/dist/components/base/responsive-popover/responsive-popover.d.ts +46 -0
- package/dist/components/base/responsive-popover/responsive-popover.d.ts.map +1 -0
- package/dist/components/base/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/features/app-navigation/app-navigation.d.ts +5 -3
- package/dist/components/features/app-navigation/app-navigation.d.ts.map +1 -1
- package/dist/components/features/autocomplete/autocomplete.d.ts +2 -2
- package/dist/components/features/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/features/autocomplete/autocomplete.types.d.ts +7 -16
- package/dist/components/features/autocomplete/autocomplete.types.d.ts.map +1 -1
- package/dist/components/features/autocomplete/trigger.d.ts +20 -0
- package/dist/components/features/autocomplete/trigger.d.ts.map +1 -0
- package/dist/components/features/autosearch/autosearch.d.ts +1 -1
- package/dist/components/features/autosearch/autosearch.d.ts.map +1 -1
- package/dist/components/features/autosearch/autosearch.types.d.ts +4 -0
- package/dist/components/features/autosearch/autosearch.types.d.ts.map +1 -1
- package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts +3 -37
- package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts.map +1 -1
- package/dist/components/features/calendar-date-picker/calendar-header.d.ts +13 -0
- package/dist/components/features/calendar-date-picker/calendar-header.d.ts.map +1 -0
- package/dist/components/features/calendar-date-picker/calendar-presets.d.ts +9 -0
- package/dist/components/features/calendar-date-picker/calendar-presets.d.ts.map +1 -0
- package/dist/components/features/calendar-date-picker/date-trigger.d.ts +24 -0
- package/dist/components/features/calendar-date-picker/date-trigger.d.ts.map +1 -0
- package/dist/components/features/calendar-date-picker/index.d.ts +2 -1
- package/dist/components/features/calendar-date-picker/index.d.ts.map +1 -1
- package/dist/components/features/calendar-date-picker/types.d.ts +42 -0
- package/dist/components/features/calendar-date-picker/types.d.ts.map +1 -0
- package/dist/components/features/calendar-date-picker/use-calendar-date-picker.d.ts +48 -0
- package/dist/components/features/calendar-date-picker/use-calendar-date-picker.d.ts.map +1 -0
- package/dist/components/features/data-table/components/row-actions.d.ts +1 -1
- package/dist/components/features/data-table/components/row-actions.d.ts.map +1 -1
- package/dist/components/features/data-table/filters/checkbox-filter.d.ts +1 -1
- package/dist/components/features/data-table/filters/checkbox-filter.d.ts.map +1 -1
- package/dist/components/features/data-table/filters/select-filter.d.ts +1 -1
- package/dist/components/features/data-table/filters/select-filter.d.ts.map +1 -1
- package/dist/components/features/data-table/types.d.ts +11 -12
- package/dist/components/features/data-table/types.d.ts.map +1 -1
- package/dist/components/features/date-time-picker/date-time-picker.d.ts +1 -1
- 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 +23 -0
- package/dist/components/features/date-time-picker/types.d.ts.map +1 -1
- package/dist/components/features/form/components/form-combobox.d.ts +7 -44
- package/dist/components/features/form/components/form-combobox.d.ts.map +1 -1
- package/dist/components/features/form/components/form-dialog.d.ts +2 -1
- package/dist/components/features/form/components/form-dialog.d.ts.map +1 -1
- package/dist/components/features/form/components/form-field.d.ts +1 -1
- package/dist/components/features/form/components/form-field.d.ts.map +1 -1
- package/dist/components/features/form/types/index.d.ts +4 -0
- package/dist/components/features/form/types/index.d.ts.map +1 -1
- package/dist/components/features/index.d.ts +2 -0
- package/dist/components/features/index.d.ts.map +1 -1
- package/dist/components/features/more-actions/action-row.d.ts +9 -0
- package/dist/components/features/more-actions/action-row.d.ts.map +1 -0
- package/dist/components/features/more-actions/index.d.ts +3 -1
- package/dist/components/features/more-actions/index.d.ts.map +1 -1
- package/dist/components/features/more-actions/more-actions.d.ts +8 -14
- package/dist/components/features/more-actions/more-actions.d.ts.map +1 -1
- package/dist/components/features/more-actions/types.d.ts +24 -0
- package/dist/components/features/more-actions/types.d.ts.map +1 -0
- package/dist/components/features/multi-select/index.d.ts +3 -0
- package/dist/components/features/multi-select/index.d.ts.map +1 -0
- package/dist/components/features/multi-select/multi-select.d.ts +147 -0
- package/dist/components/features/multi-select/multi-select.d.ts.map +1 -0
- package/dist/components/features/page-title/page-title.d.ts.map +1 -1
- package/dist/components/features/rich-text-editor/index.d.ts +4 -0
- package/dist/components/features/rich-text-editor/index.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/rich-text-content.d.ts +3 -0
- package/dist/components/features/rich-text-editor/rich-text-content.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/rich-text-editor.d.ts +28 -0
- package/dist/components/features/rich-text-editor/rich-text-editor.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/bold-toolbar.d.ts +2 -0
- package/dist/components/features/rich-text-editor/toolbar/bold-toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/italic-toolbar.d.ts +2 -0
- package/dist/components/features/rich-text-editor/toolbar/italic-toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/link-toolbar.d.ts +2 -0
- package/dist/components/features/rich-text-editor/toolbar/link-toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/strike-toolbar.d.ts +2 -0
- package/dist/components/features/rich-text-editor/toolbar/strike-toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/toolbar-button.d.ts +17 -0
- package/dist/components/features/rich-text-editor/toolbar/toolbar-button.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/toolbar.d.ts +6 -0
- package/dist/components/features/rich-text-editor/toolbar/toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/underline-toolbar.d.ts +2 -0
- package/dist/components/features/rich-text-editor/toolbar/underline-toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/types.d.ts +20 -0
- package/dist/components/features/rich-text-editor/types.d.ts.map +1 -0
- package/dist/components/features/tag-input/tag-input.d.ts +12 -1
- package/dist/components/features/tag-input/tag-input.d.ts.map +1 -1
- package/dist/components/features/task-queue/core/task-queue-dropdown.d.ts.map +1 -1
- package/dist/components/features/time-picker/time-picker.d.ts +1 -17
- package/dist/components/features/time-picker/time-picker.d.ts.map +1 -1
- package/dist/components/features/time-picker/types.d.ts +20 -18
- package/dist/components/features/time-picker/types.d.ts.map +1 -1
- package/dist/components/features/time-picker/use-time-slots.d.ts +10 -0
- package/dist/components/features/time-picker/use-time-slots.d.ts.map +1 -0
- package/dist/components/features/time-range-picker/components/absolute-range-panel.d.ts.map +1 -1
- package/dist/components/features/time-range-picker/time-range-picker.d.ts.map +1 -1
- package/dist/data-table/index.mjs +60 -175
- package/dist/date-picker/index.mjs +2 -2
- package/dist/date-time-picker/index.mjs +1 -1
- package/dist/{date-time-picker-BomrW07W.mjs → date-time-picker-DKOxrhmc.mjs} +64 -49
- package/dist/dropdown/index.mjs +109 -1
- package/dist/dropzone/index.mjs +1 -1
- package/dist/empty-content/index.mjs +1 -1
- package/dist/form/adapters/conform/index.mjs +2 -2
- package/dist/form/adapters/rhf/index.mjs +2 -2
- package/dist/form/index.mjs +2 -2
- package/dist/form/stepper/index.mjs +3 -3
- package/dist/{form-B3rQ4CH9.mjs → form-CCNN9VtJ.mjs} +27 -30
- package/dist/grid/index.mjs +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.mjs +4 -3
- package/dist/hooks/use-breakpoint.d.ts +9 -0
- package/dist/hooks/use-breakpoint.d.ts.map +1 -0
- package/dist/index.mjs +48 -41
- package/dist/input-number/index.mjs +1 -1
- package/dist/loader-overlay/index.mjs +1 -1
- package/dist/map/index.mjs +1 -1
- package/dist/{map-CWIQ-eql.mjs → map-DRzZDNtB.mjs} +83 -4
- package/dist/mobile-sheet/index.mjs +2 -0
- package/dist/mobile-sheet-BxMvkzAj.mjs +61 -0
- package/dist/more-actions/index.mjs +3 -2
- package/dist/more-actions-Ca5qqd0H.mjs +49 -0
- package/dist/multi-select/index.mjs +2 -0
- package/dist/multi-select-DM_dxnSV.mjs +235 -0
- package/dist/page-title/index.mjs +1 -1
- package/dist/{page-title-ChsnpBiH.mjs → page-title-ChLiv6gB.mjs} +3 -2
- package/dist/popover/index.mjs +1 -1
- package/dist/radio-group/index.mjs +1 -1
- package/dist/responsive-dropdown/index.mjs +2 -0
- package/dist/responsive-dropdown-IFroDgKn.mjs +53 -0
- package/dist/responsive-popover/index.mjs +2 -0
- package/dist/responsive-popover-D-t9bxSN.mjs +61 -0
- package/dist/rich-text-editor/index.mjs +2 -0
- package/dist/rich-text-editor-CQH_U4T5.mjs +293 -0
- package/dist/select/index.mjs +1 -1
- package/dist/sheet/index.mjs +2 -2
- package/dist/{sheet-BzXksqYY.mjs → sheet-LhUgozvg.mjs} +1 -1
- package/dist/sidebar/index.mjs +1 -1
- package/dist/{sidebar-BnhnjvfO.mjs → sidebar-B8LQJiNI.mjs} +3 -3
- package/dist/skeleton/index.mjs +1 -1
- package/dist/{skeleton-D1MUhAVo.mjs → skeleton-D4HOEiOZ.mjs} +1 -1
- package/dist/spinner/index.mjs +1 -1
- package/dist/stepper/index.mjs +1 -1
- package/dist/styles/canela.css +23 -0
- package/dist/styles/fonts/CanelaText-Regular.ttf +0 -0
- package/dist/styles/tokens/figma-tokens.css +4 -0
- 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-T9cUX9-G.mjs → tag-input-Bf4GMptp.mjs} +29 -14
- package/dist/task-queue/index.mjs +1 -1
- package/dist/{task-queue-dropdown-Wcbj-f0V.mjs → task-queue-dropdown-D-LncEWm.mjs} +39 -39
- package/dist/textarea/index.mjs +1 -1
- package/dist/theme/index.mjs +1 -1
- package/dist/time-picker/index.mjs +1 -1
- package/dist/time-picker-BZF5jbF6.mjs +99 -0
- package/dist/{to-api-format-Bh3c01gr.mjs → to-api-format-CgKcC9SK.mjs} +144 -119
- package/dist/toast/index.mjs +2 -2
- package/dist/{toast-DpxlFNNx.mjs → toast-DDdLgY53.mjs} +1 -1
- package/dist/tooltip/index.mjs +1 -1
- package/dist/{tooltip-Cruvl5F6.mjs → tooltip-a7NTDCWw.mjs} +74 -17
- package/dist/transfer/index.mjs +1 -1
- package/dist/{types-BZNk3q65.mjs → types-CKIe2WlV.mjs} +2 -2
- package/dist/typography/index.mjs +1 -1
- package/dist/use-breakpoint-DGcVmB3c.mjs +36 -0
- package/dist/{use-copy-to-clipboard-uNeeVHC4.mjs → use-copy-to-clipboard-D7KyLIAt.mjs} +1 -1
- package/dist/use-date-constraints-R3H4lIoT.mjs +41 -0
- package/dist/use-option-picker-BXQOfyrK.mjs +215 -0
- package/dist/visually-hidden/index.mjs +1 -1
- package/package.json +63 -8
- package/dist/autocomplete-CkYJueBL.mjs +0 -293
- package/dist/combobox/index.mjs +0 -2
- package/dist/combobox-B-C9lJeD.mjs +0 -97
- package/dist/components/features/combobox/combobox.d.ts +0 -27
- package/dist/components/features/combobox/combobox.d.ts.map +0 -1
- package/dist/components/features/combobox/index.d.ts +0 -3
- package/dist/components/features/combobox/index.d.ts.map +0 -1
- package/dist/components/features/combobox/types.d.ts +0 -84
- package/dist/components/features/combobox/types.d.ts.map +0 -1
- package/dist/dropdown-DZiAt-jS.mjs +0 -110
- package/dist/dropdown-menu-lALvDnab.mjs +0 -85
- package/dist/more-actions-ILnEZq_E.mjs +0 -52
- package/dist/time-picker-BoF7pZZ2.mjs +0 -43
- /package/dist/{adapter-context-rWveHhDd.mjs → adapter-context-NyGTDZYq.mjs} +0 -0
- /package/dist/{col-1T0Q3SlH.mjs → col-DISdGlqY.mjs} +0 -0
- /package/dist/{dropzone-ogtpQ4fy.mjs → dropzone-Bt0plEuw.mjs} +0 -0
- /package/dist/{empty-content-C63GPJ5d.mjs → empty-content-CBh5bbtJ.mjs} +0 -0
- /package/dist/{form-context-Ccxm-wqL.mjs → form-context-CeKyvO-A.mjs} +0 -0
- /package/dist/{hooks-D8r2M2U6.mjs → hooks-DQXVwbrs.mjs} +0 -0
- /package/dist/{input-number-a7uydAsw.mjs → input-number-Diu-C6d5.mjs} +0 -0
- /package/dist/{loader-overlay-BTFdkp7W.mjs → loader-overlay-C2WDla6V.mjs} +0 -0
- /package/dist/{map-leaflet-imports-CRSKA79m.mjs → map-leaflet-imports-BkUrNU37.mjs} +0 -0
- /package/dist/{popover-FJAcbYoH.mjs → popover-JOuXJOZ2.mjs} +0 -0
- /package/dist/{radio-group-CiITR0LO.mjs → radio-group-70UjJBb5.mjs} +0 -0
- /package/dist/{select-CiLR_DiQ.mjs → select-zxwykvQn.mjs} +0 -0
- /package/dist/{sheet-Di3b-oPu.mjs → sheet-DVEToCVY.mjs} +0 -0
- /package/dist/{skeleton-BKl4mfJt.mjs → skeleton-D2xuJdE1.mjs} +0 -0
- /package/dist/{spinner-OyOf9-Yu.mjs → spinner-CgPI3DDi.mjs} +0 -0
- /package/dist/{stepper-DvIOp0hh.mjs → stepper-Beb-zbdL.mjs} +0 -0
- /package/dist/{switch-DQJQhPIQ.mjs → switch-DcSF42Kc.mjs} +0 -0
- /package/dist/{table-Cdsh-39-.mjs → table-DWGT4cqh.mjs} +0 -0
- /package/dist/{textarea-BwD-MmTV.mjs → textarea-BoChBcFz.mjs} +0 -0
- /package/dist/{themes-DG1md8FI.mjs → themes-CAiN4b6G.mjs} +0 -0
- /package/dist/{toast-BWnN5fax.mjs → toast-D5XD7goD.mjs} +0 -0
- /package/dist/{transfer-46C-rFFW.mjs → transfer-CoGPwOc6.mjs} +0 -0
- /package/dist/{typography-ClB8k55E.mjs → typography-TRKP_CLT.mjs} +0 -0
- /package/dist/{use-display-touched-I39aXEBD.mjs → use-display-touched-8VGszCqj.mjs} +0 -0
- /package/dist/{visuallyhidden-BLUsJpYH.mjs → visuallyhidden-BHOPczmW.mjs} +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
|
+
import { t as ResponsivePopover } from "./responsive-popover-D-t9bxSN.mjs";
|
|
3
|
+
import { n as OptionList, t as useOptionPicker } from "./use-option-picker-BXQOfyrK.mjs";
|
|
4
|
+
import { Clock } from "lucide-react";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { useMemo } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/features/time-picker/use-time-slots.ts
|
|
9
|
+
function timeToMinutes(time) {
|
|
10
|
+
const [h, m] = time.split(":").map(Number);
|
|
11
|
+
return h * 60 + m;
|
|
12
|
+
}
|
|
13
|
+
function minutesToTime(totalMinutes) {
|
|
14
|
+
const h = Math.floor(totalMinutes / 60);
|
|
15
|
+
const m = totalMinutes % 60;
|
|
16
|
+
return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
|
|
17
|
+
}
|
|
18
|
+
function formatTimeLabel(time) {
|
|
19
|
+
const [hStr, mStr] = time.split(":");
|
|
20
|
+
let h = Number(hStr);
|
|
21
|
+
const m = mStr;
|
|
22
|
+
const period = h >= 12 ? "PM" : "AM";
|
|
23
|
+
if (h === 0) h = 12;
|
|
24
|
+
else if (h > 12) h -= 12;
|
|
25
|
+
return `${h}:${m} ${period}`;
|
|
26
|
+
}
|
|
27
|
+
function useTimeSlots({ min, max, step = 15 }) {
|
|
28
|
+
return useMemo(() => {
|
|
29
|
+
const minMinutes = min ? timeToMinutes(min) : 0;
|
|
30
|
+
const maxMinutes = max ? timeToMinutes(max) : 1439;
|
|
31
|
+
const slots = [];
|
|
32
|
+
for (let m = minMinutes; m <= maxMinutes; m += step) {
|
|
33
|
+
if (m >= 1440) break;
|
|
34
|
+
const value = minutesToTime(m);
|
|
35
|
+
slots.push({
|
|
36
|
+
value,
|
|
37
|
+
label: formatTimeLabel(value)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return slots;
|
|
41
|
+
}, [
|
|
42
|
+
min,
|
|
43
|
+
max,
|
|
44
|
+
step
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/features/time-picker/time-picker.tsx
|
|
49
|
+
function TimePicker({ value, onChange, min, max, step = 15, placeholder = "Select time", disabled = false, className, id, name, responsive = true, sheetTitle }) {
|
|
50
|
+
const [open, setOpen] = React$1.useState(false);
|
|
51
|
+
const slots = useTimeSlots({
|
|
52
|
+
min,
|
|
53
|
+
max,
|
|
54
|
+
step
|
|
55
|
+
});
|
|
56
|
+
const picker = useOptionPicker({
|
|
57
|
+
multiple: false,
|
|
58
|
+
options: slots,
|
|
59
|
+
value,
|
|
60
|
+
onValueChange: onChange,
|
|
61
|
+
open,
|
|
62
|
+
onOpenChange: setOpen
|
|
63
|
+
});
|
|
64
|
+
const displayValue = value ? formatTimeLabel(value) : void 0;
|
|
65
|
+
const trigger = /* @__PURE__ */ jsxs("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
id,
|
|
68
|
+
role: "combobox",
|
|
69
|
+
"aria-expanded": open,
|
|
70
|
+
disabled,
|
|
71
|
+
className: cn("text-input-foreground placeholder:text-input-placeholder", "border-input-border bg-input-background/50 relative flex h-10 w-full items-center justify-between rounded-lg border px-3 py-2 text-left text-sm transition-all", "focus-visible:border-input-focus-border focus-visible:shadow-(--input-focus-shadow)", "focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:outline-hidden", disabled && "cursor-not-allowed opacity-50", className),
|
|
72
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
73
|
+
className: cn(!displayValue && "text-muted-foreground"),
|
|
74
|
+
children: displayValue ?? placeholder
|
|
75
|
+
}), /* @__PURE__ */ jsx(Clock, { className: "text-muted-foreground ml-2 size-4 shrink-0" })]
|
|
76
|
+
});
|
|
77
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ResponsivePopover, {
|
|
78
|
+
open,
|
|
79
|
+
onOpenChange: setOpen,
|
|
80
|
+
responsive,
|
|
81
|
+
sheetTitle: sheetTitle ?? placeholder,
|
|
82
|
+
trigger,
|
|
83
|
+
align: "start",
|
|
84
|
+
children: /* @__PURE__ */ jsx(OptionList, {
|
|
85
|
+
picker,
|
|
86
|
+
disableSearch: slots.length <= 48,
|
|
87
|
+
searchPlaceholder: "Search time...",
|
|
88
|
+
listClassName: "max-h-[200px]"
|
|
89
|
+
})
|
|
90
|
+
}), name && /* @__PURE__ */ jsx("input", {
|
|
91
|
+
type: "hidden",
|
|
92
|
+
name,
|
|
93
|
+
value: value ?? "",
|
|
94
|
+
readOnly: true
|
|
95
|
+
})] });
|
|
96
|
+
}
|
|
97
|
+
TimePicker.displayName = "TimePicker";
|
|
98
|
+
//#endregion
|
|
99
|
+
export { TimePicker as t };
|
|
@@ -2,13 +2,16 @@ import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
|
2
2
|
import { t as Button } from "./button-BllvE9Lm.mjs";
|
|
3
3
|
import { t as Separator } from "./separator-DXVTncCK.mjs";
|
|
4
4
|
import { t as Icon } from "./icon-wrapper-DuLp3RM1.mjs";
|
|
5
|
-
import { t as Calendar$1 } from "./calendar-
|
|
5
|
+
import { t as Calendar$1 } from "./calendar-C-Hbf74r.mjs";
|
|
6
6
|
import { t as Input } from "./input-FKGqZypx.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { i as
|
|
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
|
+
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-zxwykvQn.mjs";
|
|
9
12
|
import { Calendar, CalendarIcon, Globe, X } from "lucide-react";
|
|
10
13
|
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
11
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
15
|
import { format, isSameDay, isSameYear, parse, subDays, subHours, subMinutes } from "date-fns";
|
|
13
16
|
import { fromZonedTime, toZonedTime } from "date-fns-tz";
|
|
14
17
|
//#region src/components/features/time-range-picker/utils/timezone.ts
|
|
@@ -268,28 +271,31 @@ function CustomRangePanel({ fromUtc, toUtc, timezone, onRangeChange, disableFutu
|
|
|
268
271
|
className: "text-muted-foreground text-xs font-medium",
|
|
269
272
|
children: "Custom Range"
|
|
270
273
|
}), /* @__PURE__ */ jsxs("div", {
|
|
271
|
-
className: "flex
|
|
274
|
+
className: "flex flex-col gap-2 sm:flex-row sm:items-center",
|
|
272
275
|
children: [
|
|
273
276
|
/* @__PURE__ */ jsxs("div", {
|
|
274
277
|
className: "flex items-center gap-1.5",
|
|
275
|
-
children: [
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ jsx("span", {
|
|
280
|
+
className: "text-muted-foreground w-10 shrink-0 text-xs sm:hidden",
|
|
281
|
+
children: "From"
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ jsx(ResponsivePopover, {
|
|
284
|
+
open: startDateOpen,
|
|
285
|
+
onOpenChange: setStartDateOpen,
|
|
286
|
+
sheetTitle: "Select start date",
|
|
287
|
+
align: "start",
|
|
288
|
+
contentClassName: "w-auto",
|
|
289
|
+
trigger: /* @__PURE__ */ jsxs(Button, {
|
|
281
290
|
type: "quaternary",
|
|
282
291
|
theme: "outline",
|
|
283
292
|
id: startDateId,
|
|
284
|
-
className: "h-8 w-
|
|
293
|
+
className: "h-8 min-w-0 flex-1 justify-start gap-1.5 px-2 text-xs font-normal sm:w-full sm:flex-initial",
|
|
285
294
|
children: [/* @__PURE__ */ jsx(CalendarIcon, { className: "h-3.5 w-3.5 shrink-0 opacity-50" }), /* @__PURE__ */ jsx("span", {
|
|
286
295
|
className: "truncate",
|
|
287
296
|
children: format(startDate, "MMM d, yyyy")
|
|
288
297
|
})]
|
|
289
|
-
})
|
|
290
|
-
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
291
|
-
className: "w-auto p-0",
|
|
292
|
-
align: "start",
|
|
298
|
+
}),
|
|
293
299
|
children: /* @__PURE__ */ jsx(Calendar$1, {
|
|
294
300
|
mode: "single",
|
|
295
301
|
selected: startDate,
|
|
@@ -297,39 +303,43 @@ function CustomRangePanel({ fromUtc, toUtc, timezone, onRangeChange, disableFutu
|
|
|
297
303
|
disabled: disableFuture ? (date) => date > /* @__PURE__ */ new Date() : void 0,
|
|
298
304
|
initialFocus: true
|
|
299
305
|
})
|
|
300
|
-
})
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
}),
|
|
307
|
+
/* @__PURE__ */ jsx(Input, {
|
|
308
|
+
type: "time",
|
|
309
|
+
id: startTimeId,
|
|
310
|
+
value: startTime,
|
|
311
|
+
onChange: handleStartTimeChange,
|
|
312
|
+
className: cn("h-8 w-[80px] px-2 text-xs md:text-xs", "appearance-none bg-transparent", "[&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none")
|
|
313
|
+
})
|
|
314
|
+
]
|
|
308
315
|
}),
|
|
309
316
|
/* @__PURE__ */ jsx("span", {
|
|
310
|
-
className: "text-muted-foreground text-sm",
|
|
317
|
+
className: "text-muted-foreground hidden text-sm sm:block",
|
|
311
318
|
children: "—"
|
|
312
319
|
}),
|
|
313
320
|
/* @__PURE__ */ jsxs("div", {
|
|
314
321
|
className: "flex items-center gap-1.5",
|
|
315
|
-
children: [
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
322
|
+
children: [
|
|
323
|
+
/* @__PURE__ */ jsx("span", {
|
|
324
|
+
className: "text-muted-foreground w-10 shrink-0 text-xs sm:hidden",
|
|
325
|
+
children: "To"
|
|
326
|
+
}),
|
|
327
|
+
/* @__PURE__ */ jsx(ResponsivePopover, {
|
|
328
|
+
open: endDateOpen,
|
|
329
|
+
onOpenChange: setEndDateOpen,
|
|
330
|
+
sheetTitle: "Select end date",
|
|
331
|
+
align: "start",
|
|
332
|
+
contentClassName: "w-auto",
|
|
333
|
+
trigger: /* @__PURE__ */ jsxs(Button, {
|
|
321
334
|
type: "quaternary",
|
|
322
335
|
theme: "outline",
|
|
323
336
|
id: endDateId,
|
|
324
|
-
className: "h-8 w-
|
|
337
|
+
className: "h-8 min-w-0 flex-1 justify-start gap-1.5 px-2 text-xs font-normal sm:w-full sm:flex-initial",
|
|
325
338
|
children: [/* @__PURE__ */ jsx(CalendarIcon, { className: "h-3.5 w-3.5 shrink-0 opacity-50" }), /* @__PURE__ */ jsx("span", {
|
|
326
339
|
className: "truncate",
|
|
327
340
|
children: format(endDate, "MMM d, yyyy")
|
|
328
341
|
})]
|
|
329
|
-
})
|
|
330
|
-
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
331
|
-
className: "w-auto p-0",
|
|
332
|
-
align: "start",
|
|
342
|
+
}),
|
|
333
343
|
children: /* @__PURE__ */ jsx(Calendar$1, {
|
|
334
344
|
mode: "single",
|
|
335
345
|
selected: endDate,
|
|
@@ -337,14 +347,15 @@ function CustomRangePanel({ fromUtc, toUtc, timezone, onRangeChange, disableFutu
|
|
|
337
347
|
disabled: disableFuture ? (date) => date > /* @__PURE__ */ new Date() || date < startDate : (date) => date < startDate,
|
|
338
348
|
initialFocus: true
|
|
339
349
|
})
|
|
340
|
-
})
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
350
|
+
}),
|
|
351
|
+
/* @__PURE__ */ jsx(Input, {
|
|
352
|
+
type: "time",
|
|
353
|
+
id: endTimeId,
|
|
354
|
+
value: endTime,
|
|
355
|
+
onChange: handleEndTimeChange,
|
|
356
|
+
className: cn("h-8 w-[80px] px-2 text-xs md:text-xs", "appearance-none bg-transparent", "[&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none")
|
|
357
|
+
})
|
|
358
|
+
]
|
|
348
359
|
})
|
|
349
360
|
]
|
|
350
361
|
})]
|
|
@@ -585,6 +596,7 @@ function formatDateForInput(date) {
|
|
|
585
596
|
//#region src/components/features/time-range-picker/time-range-picker.tsx
|
|
586
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" }) {
|
|
587
598
|
const [open, setOpen] = useState(false);
|
|
599
|
+
const isMobile = useBreakpoint() === "mobile";
|
|
588
600
|
const timezone = timezoneProp ?? getBrowserTimezone();
|
|
589
601
|
const defaultPreset = getDefaultPreset(presets);
|
|
590
602
|
const defaultRange = useMemo(() => getPresetRange(defaultPreset, timezone), [defaultPreset, timezone]);
|
|
@@ -707,6 +719,91 @@ function TimeRangePicker({ value, onChange, onClear, timezone: timezoneProp, pre
|
|
|
707
719
|
onClear?.();
|
|
708
720
|
}, [onClear]);
|
|
709
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
|
+
})] });
|
|
710
807
|
return /* @__PURE__ */ jsxs(Popover, {
|
|
711
808
|
open,
|
|
712
809
|
onOpenChange: setOpen,
|
|
@@ -714,86 +811,14 @@ function TimeRangePicker({ value, onChange, onClear, timezone: timezoneProp, pre
|
|
|
714
811
|
className: "relative inline-flex",
|
|
715
812
|
children: /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
716
813
|
asChild: true,
|
|
717
|
-
children:
|
|
718
|
-
type: "quaternary",
|
|
719
|
-
theme: "outline",
|
|
720
|
-
disabled,
|
|
721
|
-
className: cn("text-foreground min-w-[200px] items-center justify-between gap-2 px-3 font-normal", className),
|
|
722
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
723
|
-
className: "flex flex-1 items-center gap-2",
|
|
724
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
725
|
-
icon: Calendar,
|
|
726
|
-
size: 16
|
|
727
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
728
|
-
className: "truncate text-xs",
|
|
729
|
-
children: displayText
|
|
730
|
-
})]
|
|
731
|
-
}), showClearButton && /* @__PURE__ */ jsx("div", {
|
|
732
|
-
onClick: (e) => {
|
|
733
|
-
e.stopPropagation();
|
|
734
|
-
e.preventDefault();
|
|
735
|
-
handleClear(e);
|
|
736
|
-
},
|
|
737
|
-
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"),
|
|
738
|
-
"aria-label": "Clear time range",
|
|
739
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
740
|
-
icon: X,
|
|
741
|
-
size: 14
|
|
742
|
-
})
|
|
743
|
-
})]
|
|
744
|
-
})
|
|
814
|
+
children: triggerButton
|
|
745
815
|
})
|
|
746
|
-
}), /* @__PURE__ */
|
|
816
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
747
817
|
className: "w-auto rounded-xl p-0",
|
|
748
818
|
align,
|
|
749
819
|
side,
|
|
750
820
|
sideOffset: 4,
|
|
751
|
-
children:
|
|
752
|
-
/* @__PURE__ */ jsxs("div", {
|
|
753
|
-
className: "divide-border flex flex-col divide-x sm:flex-row",
|
|
754
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
755
|
-
className: "flex-1 px-0",
|
|
756
|
-
children: /* @__PURE__ */ jsx(Calendar$1, {
|
|
757
|
-
className: "w-full",
|
|
758
|
-
mode: "range",
|
|
759
|
-
defaultMonth: calendarRange?.from,
|
|
760
|
-
selected: calendarRange,
|
|
761
|
-
onSelect: handleCalendarSelect,
|
|
762
|
-
onDayClick: handleDayClick,
|
|
763
|
-
numberOfMonths: 1,
|
|
764
|
-
disabled: (date) => {
|
|
765
|
-
if (effectiveMaxDate && date > effectiveMaxDate) return true;
|
|
766
|
-
if (minDate && date < minDate) return true;
|
|
767
|
-
return false;
|
|
768
|
-
},
|
|
769
|
-
initialFocus: true
|
|
770
|
-
})
|
|
771
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
772
|
-
className: "p-3",
|
|
773
|
-
children: /* @__PURE__ */ jsx(QuickRangesPanel, {
|
|
774
|
-
presets,
|
|
775
|
-
value: effectiveValue,
|
|
776
|
-
onPresetSelect: handlePresetSelect
|
|
777
|
-
})
|
|
778
|
-
})]
|
|
779
|
-
}),
|
|
780
|
-
/* @__PURE__ */ jsx(Separator, {}),
|
|
781
|
-
/* @__PURE__ */ jsx("div", {
|
|
782
|
-
className: "p-3",
|
|
783
|
-
children: /* @__PURE__ */ jsx(CustomRangePanel, {
|
|
784
|
-
fromUtc: currentFromUtc,
|
|
785
|
-
toUtc: currentToUtc,
|
|
786
|
-
timezone,
|
|
787
|
-
onRangeChange: handleCustomRangeChange,
|
|
788
|
-
disableFuture
|
|
789
|
-
})
|
|
790
|
-
}),
|
|
791
|
-
/* @__PURE__ */ jsx(Separator, {}),
|
|
792
|
-
/* @__PURE__ */ jsxs("div", {
|
|
793
|
-
className: "text-muted-foreground bg-muted/30 flex items-center gap-2 px-3 py-2 text-xs",
|
|
794
|
-
children: [/* @__PURE__ */ jsx(Globe, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ jsxs("span", { children: ["Your timezone:", formatTimezoneLabel(timezone)] })]
|
|
795
|
-
})
|
|
796
|
-
]
|
|
821
|
+
children: pickerContent
|
|
797
822
|
})]
|
|
798
823
|
});
|
|
799
824
|
}
|
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-D5XD7goD.mjs";
|
|
2
|
+
import { n as Toaster, t as useToast } from "../toast-DDdLgY53.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-a7NTDCWw.mjs";
|
|
2
2
|
export { Tooltip };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
2
|
import { t as cn$1 } from "./utils-C8KwMfT_.mjs";
|
|
3
|
-
import "react";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
6
6
|
//#region ../shadcn/ui/tooltip.tsx
|
|
@@ -34,11 +34,13 @@ const TooltipContent$1 = ({ className, sideOffset = 0, children, ...props }) =>
|
|
|
34
34
|
};
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/components/base/tooltip/tooltip.tsx
|
|
37
|
+
const LONG_PRESS_DURATION = 500;
|
|
38
|
+
const AUTO_DISMISS_DURATION = 1500;
|
|
37
39
|
function TooltipContent({ className, arrowClassName, sideOffset = 0, children, ...props }) {
|
|
38
40
|
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(TooltipPrimitive.Content, {
|
|
39
41
|
"data-slot": "tooltip-content",
|
|
40
42
|
sideOffset,
|
|
41
|
-
className: cn("tooltip-content", "bg-secondary text-secondary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance", className),
|
|
43
|
+
className: cn("tooltip-content", "bg-secondary text-secondary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance max-w-[calc(100vw-2rem)]", className),
|
|
42
44
|
...props,
|
|
43
45
|
children: [children, /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, {
|
|
44
46
|
className: cn("fill-secondary -my-px border-none drop-shadow-[0_1px_0_secondary]", arrowClassName),
|
|
@@ -48,22 +50,77 @@ function TooltipContent({ className, arrowClassName, sideOffset = 0, children, .
|
|
|
48
50
|
})]
|
|
49
51
|
}) });
|
|
50
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Touch long-press tooltip — renders a simple positioned tooltip bubble
|
|
55
|
+
* completely independent of Radix. This avoids Radix's internal pointer
|
|
56
|
+
* capture which blocks scrolling after tooltip dismissal.
|
|
57
|
+
*/
|
|
58
|
+
function TouchTooltipBubble({ message, side = "bottom" }) {
|
|
59
|
+
return /* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: cn("animate-in fade-in-0 zoom-in-95 pointer-events-none absolute z-50", "bg-secondary text-secondary-foreground rounded-md px-3 py-1.5 text-xs text-balance", "left-1/2 max-w-[calc(100vw-2rem)] -translate-x-1/2", side === "bottom" ? "top-full mt-1" : side === "left" ? "right-full mr-1 top-1/2 -translate-y-1/2" : side === "right" ? "left-full ml-1 top-1/2 -translate-y-1/2" : "bottom-full mb-1"),
|
|
61
|
+
role: "tooltip",
|
|
62
|
+
children: /* @__PURE__ */ jsx("span", { children: message })
|
|
63
|
+
});
|
|
64
|
+
}
|
|
51
65
|
function Tooltip({ message, children, delayDuration = 200, side, align, sideOffset, hidden, open, onOpenChange, contentClassName, arrowClassName }) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
const [longPressVisible, setLongPressVisible] = useState(false);
|
|
67
|
+
const pressTimerRef = useRef(null);
|
|
68
|
+
const dismissTimerRef = useRef(null);
|
|
69
|
+
const clearTimers = useCallback(() => {
|
|
70
|
+
if (pressTimerRef.current) {
|
|
71
|
+
clearTimeout(pressTimerRef.current);
|
|
72
|
+
pressTimerRef.current = null;
|
|
73
|
+
}
|
|
74
|
+
if (dismissTimerRef.current) {
|
|
75
|
+
clearTimeout(dismissTimerRef.current);
|
|
76
|
+
dismissTimerRef.current = null;
|
|
77
|
+
}
|
|
78
|
+
}, []);
|
|
79
|
+
useEffect(() => () => clearTimers(), [clearTimers]);
|
|
80
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
81
|
+
className: "relative inline-flex",
|
|
82
|
+
onTouchStart: useCallback(() => {
|
|
83
|
+
clearTimers();
|
|
84
|
+
pressTimerRef.current = setTimeout(() => {
|
|
85
|
+
setLongPressVisible(true);
|
|
86
|
+
dismissTimerRef.current = setTimeout(() => {
|
|
87
|
+
setLongPressVisible(false);
|
|
88
|
+
}, AUTO_DISMISS_DURATION);
|
|
89
|
+
}, LONG_PRESS_DURATION);
|
|
90
|
+
}, [clearTimers]),
|
|
91
|
+
onTouchMove: useCallback(() => {
|
|
92
|
+
clearTimers();
|
|
93
|
+
setLongPressVisible(false);
|
|
94
|
+
}, [clearTimers]),
|
|
95
|
+
onTouchEnd: useCallback(() => {
|
|
96
|
+
if (pressTimerRef.current) {
|
|
97
|
+
clearTimeout(pressTimerRef.current);
|
|
98
|
+
pressTimerRef.current = null;
|
|
99
|
+
}
|
|
100
|
+
}, []),
|
|
101
|
+
onTouchCancel: useCallback(() => {
|
|
102
|
+
clearTimers();
|
|
103
|
+
setLongPressVisible(false);
|
|
104
|
+
}, [clearTimers]),
|
|
105
|
+
children: [/* @__PURE__ */ jsxs(Tooltip$1, {
|
|
106
|
+
delayDuration,
|
|
107
|
+
open,
|
|
108
|
+
onOpenChange,
|
|
109
|
+
children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
110
|
+
asChild: true,
|
|
111
|
+
children
|
|
112
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
113
|
+
side,
|
|
114
|
+
align,
|
|
115
|
+
sideOffset,
|
|
116
|
+
hidden,
|
|
117
|
+
className: contentClassName,
|
|
118
|
+
arrowClassName,
|
|
119
|
+
children: /* @__PURE__ */ jsx("span", { children: message })
|
|
120
|
+
})]
|
|
121
|
+
}), longPressVisible && /* @__PURE__ */ jsx(TouchTooltipBubble, {
|
|
122
|
+
message,
|
|
123
|
+
side
|
|
67
124
|
})]
|
|
68
125
|
});
|
|
69
126
|
}
|
package/dist/transfer/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Transfer } from "../transfer-
|
|
1
|
+
import { t as Transfer } from "../transfer-CoGPwOc6.mjs";
|
|
2
2
|
export { Transfer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
2
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./tabs/index.mjs";
|
|
3
|
-
import { n as useTheme } from "./themes-
|
|
4
|
-
import { t as toast } from "./toast-
|
|
3
|
+
import { n as useTheme } from "./themes-CAiN4b6G.mjs";
|
|
4
|
+
import { t as toast } from "./toast-D5XD7goD.mjs";
|
|
5
5
|
import { useEffect, useRef, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import Editor from "@monaco-editor/react";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ListItem, c as Title, d as titleVariants, i as List, l as paragraphVariants, n as Code, o as Paragraph, r as Link, s as Text, t as Blockquote, u as textVariants } from "../typography-
|
|
1
|
+
import { a as ListItem, c as Title, d as titleVariants, i as List, l as paragraphVariants, n as Code, o as Paragraph, r as Link, s as Text, t as Blockquote, u as textVariants } from "../typography-TRKP_CLT.mjs";
|
|
2
2
|
export { Blockquote, Code, Link, List, ListItem, Paragraph, Text, Title, paragraphVariants, textVariants, titleVariants };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
//#region src/hooks/use-breakpoint.ts
|
|
3
|
+
const TABLET_MIN = 768;
|
|
4
|
+
const DESKTOP_MIN = 1024;
|
|
5
|
+
function getBreakpoint() {
|
|
6
|
+
if (typeof window === "undefined") return "desktop";
|
|
7
|
+
const width = window.innerWidth;
|
|
8
|
+
if (width < TABLET_MIN) return "mobile";
|
|
9
|
+
if (width < DESKTOP_MIN) return "tablet";
|
|
10
|
+
return "desktop";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Returns the current viewport breakpoint tier.
|
|
14
|
+
*
|
|
15
|
+
* Breakpoints: mobile <768px, tablet 768–1023px, desktop ≥1024px.
|
|
16
|
+
* SSR-safe: defaults to 'desktop' on server; client corrects on mount.
|
|
17
|
+
*/
|
|
18
|
+
function useBreakpoint() {
|
|
19
|
+
const [breakpoint, setBreakpoint] = useState(getBreakpoint);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const mqTablet = window.matchMedia(`(min-width: ${TABLET_MIN}px)`);
|
|
22
|
+
const mqDesktop = window.matchMedia(`(min-width: ${DESKTOP_MIN}px)`);
|
|
23
|
+
const update = () => {
|
|
24
|
+
setBreakpoint(getBreakpoint());
|
|
25
|
+
};
|
|
26
|
+
mqTablet.addEventListener("change", update);
|
|
27
|
+
mqDesktop.addEventListener("change", update);
|
|
28
|
+
return () => {
|
|
29
|
+
mqTablet.removeEventListener("change", update);
|
|
30
|
+
mqDesktop.removeEventListener("change", update);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
return breakpoint;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { useBreakpoint as t };
|