@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
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
2
|
import { t as Button } from "./button-D3RrsMfQ.mjs";
|
|
3
|
-
import { t as Calendar$1 } from "./calendar-
|
|
4
|
-
import {
|
|
5
|
-
import { i as SelectItem, l as SelectTrigger, n as SelectContent, t as Select, u as SelectValue } from "./select-
|
|
3
|
+
import { t as Calendar$1 } from "./calendar-C-Hbf74r.mjs";
|
|
4
|
+
import { t as ResponsivePopover } from "./responsive-popover-D-t9bxSN.mjs";
|
|
5
|
+
import { i as SelectItem, l as SelectTrigger, n as SelectContent, t as Select, u as SelectValue } from "./select-zxwykvQn.mjs";
|
|
6
|
+
import { t as useDateConstraints } from "./use-date-constraints-R3H4lIoT.mjs";
|
|
6
7
|
import { cva } from "class-variance-authority";
|
|
7
8
|
import { CalendarIcon, X } from "lucide-react";
|
|
8
9
|
import * as React$1 from "react";
|
|
9
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
import { endOfDay, endOfMonth, endOfWeek, endOfYear, startOfDay, startOfMonth, startOfWeek, startOfYear, subDays } from "date-fns";
|
|
11
12
|
import { formatInTimeZone, toDate } from "date-fns-tz";
|
|
12
|
-
//#region src/components/features/calendar-date-picker/
|
|
13
|
+
//#region src/components/features/calendar-date-picker/types.ts
|
|
13
14
|
const months = [
|
|
14
15
|
"January",
|
|
15
16
|
"February",
|
|
@@ -35,7 +36,196 @@ const multiSelectVariants = cva("flex font-normal shadow-none items-center justi
|
|
|
35
36
|
} },
|
|
36
37
|
defaultVariants: { variant: "default" }
|
|
37
38
|
});
|
|
38
|
-
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/components/features/calendar-date-picker/calendar-header.tsx
|
|
41
|
+
function CalendarHeader({ monthFrom, yearFrom, monthTo, yearTo, years, numberOfMonths, onMonthChange, onYearChange }) {
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
className: "flex items-center gap-4 px-3 py-2 sm:px-4 sm:py-3",
|
|
44
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
45
|
+
className: "flex gap-2",
|
|
46
|
+
children: [/* @__PURE__ */ jsxs(Select, {
|
|
47
|
+
onValueChange: (value) => {
|
|
48
|
+
onMonthChange(months.indexOf(value), "from");
|
|
49
|
+
},
|
|
50
|
+
value: monthFrom ? months[monthFrom.getMonth()] : void 0,
|
|
51
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
52
|
+
className: "hover:bg-accent hover:text-accent-foreground hidden w-[122px] font-medium focus:ring-0 focus:ring-offset-0 sm:flex",
|
|
53
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Month" })
|
|
54
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: months.map((month, idx) => /* @__PURE__ */ jsx(SelectItem, {
|
|
55
|
+
value: month,
|
|
56
|
+
children: month
|
|
57
|
+
}, idx)) })]
|
|
58
|
+
}), /* @__PURE__ */ jsxs(Select, {
|
|
59
|
+
onValueChange: (value) => {
|
|
60
|
+
onYearChange(Number(value), "from");
|
|
61
|
+
},
|
|
62
|
+
value: yearFrom ? yearFrom.toString() : void 0,
|
|
63
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
64
|
+
className: "hover:bg-accent hover:text-accent-foreground hidden w-[122px] font-medium focus:ring-0 focus:ring-offset-0 sm:flex",
|
|
65
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Year" })
|
|
66
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: years.map((year, idx) => /* @__PURE__ */ jsx(SelectItem, {
|
|
67
|
+
value: year.toString(),
|
|
68
|
+
children: year
|
|
69
|
+
}, idx)) })]
|
|
70
|
+
})]
|
|
71
|
+
}), numberOfMonths === 2 && /* @__PURE__ */ jsxs("div", {
|
|
72
|
+
className: "flex gap-2",
|
|
73
|
+
children: [/* @__PURE__ */ jsxs(Select, {
|
|
74
|
+
onValueChange: (value) => {
|
|
75
|
+
onMonthChange(months.indexOf(value), "to");
|
|
76
|
+
},
|
|
77
|
+
value: monthTo ? months[monthTo.getMonth()] : void 0,
|
|
78
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
79
|
+
className: "hover:bg-accent hover:text-accent-foreground hidden w-[122px] font-medium focus:ring-0 focus:ring-offset-0 sm:flex",
|
|
80
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Month" })
|
|
81
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: months.map((month, idx) => /* @__PURE__ */ jsx(SelectItem, {
|
|
82
|
+
value: month,
|
|
83
|
+
children: month
|
|
84
|
+
}, idx)) })]
|
|
85
|
+
}), /* @__PURE__ */ jsxs(Select, {
|
|
86
|
+
onValueChange: (value) => {
|
|
87
|
+
onYearChange(Number(value), "to");
|
|
88
|
+
},
|
|
89
|
+
value: yearTo ? yearTo.toString() : void 0,
|
|
90
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
91
|
+
className: "hover:bg-accent hover:text-accent-foreground hidden w-[122px] font-medium focus:ring-0 focus:ring-offset-0 sm:flex",
|
|
92
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Year" })
|
|
93
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: years.map((year, idx) => /* @__PURE__ */ jsx(SelectItem, {
|
|
94
|
+
value: year.toString(),
|
|
95
|
+
children: year
|
|
96
|
+
}, idx)) })]
|
|
97
|
+
})]
|
|
98
|
+
})]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/components/features/calendar-date-picker/calendar-presets.tsx
|
|
103
|
+
function CalendarPresets({ dateRanges, selectedRange, onSelect }) {
|
|
104
|
+
return /* @__PURE__ */ jsx("div", {
|
|
105
|
+
className: "border-foreground/10 hidden flex-col gap-1 border-r pr-4 text-left md:flex",
|
|
106
|
+
children: dateRanges.map(({ key, label, start, end }) => /* @__PURE__ */ jsx(Button, {
|
|
107
|
+
variant: "ghost",
|
|
108
|
+
size: "sm",
|
|
109
|
+
className: cn("hover:bg-primary/90 hover:text-background justify-start", selectedRange === label && "bg-primary text-background hover:bg-primary/90 hover:text-background"),
|
|
110
|
+
onClick: () => onSelect(start, end, label),
|
|
111
|
+
children: label
|
|
112
|
+
}, key))
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/components/features/calendar-date-picker/date-trigger.tsx
|
|
117
|
+
function DateTrigger({ ref, id, date, placeholder, disabled, numberOfMonths, highlightedPart, handleMouseOver, handleMouseLeave, handleClear, handleTogglePopover, formatWithTz, variant, className, triggerClassName, ...props }) {
|
|
118
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
119
|
+
id: "date",
|
|
120
|
+
ref,
|
|
121
|
+
...props,
|
|
122
|
+
disabled,
|
|
123
|
+
className: cn("w-full", triggerClassName, multiSelectVariants({
|
|
124
|
+
variant,
|
|
125
|
+
className
|
|
126
|
+
})),
|
|
127
|
+
onClick: handleTogglePopover,
|
|
128
|
+
suppressHydrationWarning: true,
|
|
129
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
130
|
+
className: "flex w-full items-center justify-between gap-2",
|
|
131
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
132
|
+
className: "flex items-center gap-2",
|
|
133
|
+
children: [/* @__PURE__ */ jsx(CalendarIcon, { className: "text-muted-foreground h-4 w-4" }), /* @__PURE__ */ jsx("span", { children: date?.from ? date.to ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
134
|
+
/* @__PURE__ */ jsx("span", {
|
|
135
|
+
id: `firstDay-${id}`,
|
|
136
|
+
className: cn("date-part", highlightedPart === "firstDay" && "font-bold underline"),
|
|
137
|
+
onMouseOver: () => handleMouseOver("firstDay"),
|
|
138
|
+
onMouseLeave: handleMouseLeave,
|
|
139
|
+
children: formatWithTz(date.from, "dd")
|
|
140
|
+
}),
|
|
141
|
+
" ",
|
|
142
|
+
/* @__PURE__ */ jsx("span", {
|
|
143
|
+
id: `firstMonth-${id}`,
|
|
144
|
+
className: cn("date-part", highlightedPart === "firstMonth" && "font-bold underline"),
|
|
145
|
+
onMouseOver: () => handleMouseOver("firstMonth"),
|
|
146
|
+
onMouseLeave: handleMouseLeave,
|
|
147
|
+
children: formatWithTz(date.from, "LLL")
|
|
148
|
+
}),
|
|
149
|
+
",",
|
|
150
|
+
" ",
|
|
151
|
+
/* @__PURE__ */ jsx("span", {
|
|
152
|
+
id: `firstYear-${id}`,
|
|
153
|
+
className: cn("date-part", highlightedPart === "firstYear" && "font-bold underline"),
|
|
154
|
+
onMouseOver: () => handleMouseOver("firstYear"),
|
|
155
|
+
onMouseLeave: handleMouseLeave,
|
|
156
|
+
children: formatWithTz(date.from, "y")
|
|
157
|
+
}),
|
|
158
|
+
numberOfMonths === 2 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
159
|
+
" - ",
|
|
160
|
+
/* @__PURE__ */ jsx("span", {
|
|
161
|
+
id: `secondDay-${id}`,
|
|
162
|
+
className: cn("date-part", highlightedPart === "secondDay" && "font-bold underline"),
|
|
163
|
+
onMouseOver: () => handleMouseOver("secondDay"),
|
|
164
|
+
onMouseLeave: handleMouseLeave,
|
|
165
|
+
children: formatWithTz(date.to, "dd")
|
|
166
|
+
}),
|
|
167
|
+
" ",
|
|
168
|
+
/* @__PURE__ */ jsx("span", {
|
|
169
|
+
id: `secondMonth-${id}`,
|
|
170
|
+
className: cn("date-part", highlightedPart === "secondMonth" && "font-bold underline"),
|
|
171
|
+
onMouseOver: () => handleMouseOver("secondMonth"),
|
|
172
|
+
onMouseLeave: handleMouseLeave,
|
|
173
|
+
children: formatWithTz(date.to, "LLL")
|
|
174
|
+
}),
|
|
175
|
+
",",
|
|
176
|
+
" ",
|
|
177
|
+
/* @__PURE__ */ jsx("span", {
|
|
178
|
+
id: `secondYear-${id}`,
|
|
179
|
+
className: cn("date-part", highlightedPart === "secondYear" && "font-bold underline"),
|
|
180
|
+
onMouseOver: () => handleMouseOver("secondYear"),
|
|
181
|
+
onMouseLeave: handleMouseLeave,
|
|
182
|
+
children: formatWithTz(date.to, "y")
|
|
183
|
+
})
|
|
184
|
+
] })
|
|
185
|
+
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
186
|
+
/* @__PURE__ */ jsx("span", {
|
|
187
|
+
id: "day",
|
|
188
|
+
className: cn("date-part", highlightedPart === "day" && "font-bold underline"),
|
|
189
|
+
onMouseOver: () => handleMouseOver("day"),
|
|
190
|
+
onMouseLeave: handleMouseLeave,
|
|
191
|
+
children: formatWithTz(date.from, "dd")
|
|
192
|
+
}),
|
|
193
|
+
" ",
|
|
194
|
+
/* @__PURE__ */ jsx("span", {
|
|
195
|
+
id: "month",
|
|
196
|
+
className: cn("date-part", highlightedPart === "month" && "font-bold underline"),
|
|
197
|
+
onMouseOver: () => handleMouseOver("month"),
|
|
198
|
+
onMouseLeave: handleMouseLeave,
|
|
199
|
+
children: formatWithTz(date.from, "LLL")
|
|
200
|
+
}),
|
|
201
|
+
",",
|
|
202
|
+
" ",
|
|
203
|
+
/* @__PURE__ */ jsx("span", {
|
|
204
|
+
id: "year",
|
|
205
|
+
className: cn("date-part", highlightedPart === "year" && "font-bold underline"),
|
|
206
|
+
onMouseOver: () => handleMouseOver("year"),
|
|
207
|
+
onMouseLeave: handleMouseLeave,
|
|
208
|
+
children: formatWithTz(date.from, "y")
|
|
209
|
+
})
|
|
210
|
+
] }) : /* @__PURE__ */ jsx("span", {
|
|
211
|
+
className: "text-muted-foreground",
|
|
212
|
+
children: placeholder || "Pick a date"
|
|
213
|
+
}) })]
|
|
214
|
+
}), date?.from && /* @__PURE__ */ jsxs("div", {
|
|
215
|
+
onClick: handleClear,
|
|
216
|
+
className: "text-muted-foreground hover:text-primary size-4 p-0 hover:bg-transparent",
|
|
217
|
+
children: [/* @__PURE__ */ jsx(X, { size: 14 }), /* @__PURE__ */ jsx("span", {
|
|
218
|
+
className: "sr-only",
|
|
219
|
+
children: "Clear date"
|
|
220
|
+
})]
|
|
221
|
+
})]
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/components/features/calendar-date-picker/use-calendar-date-picker.ts
|
|
227
|
+
function useCalendarDatePicker(props) {
|
|
228
|
+
const { id = "calendar-date-picker", date, closeOnSelect = false, numberOfMonths = 2, yearsRange = 10, onDateSelect, excludePresets, customPresets, minDate, maxDate, disableFuture = false, disablePast = false, maxRange } = props;
|
|
39
229
|
const [isPopoverOpen, setIsPopoverOpen] = React$1.useState(false);
|
|
40
230
|
const [selectedRange, setSelectedRange] = React$1.useState(numberOfMonths === 2 ? "This Year" : "Today");
|
|
41
231
|
const [monthFrom, setMonthFrom] = React$1.useState(date?.from);
|
|
@@ -46,35 +236,12 @@ function CalendarDatePicker({ ref, id = "calendar-date-picker", className, trigg
|
|
|
46
236
|
const [pendingDate, setPendingDate] = React$1.useState(date);
|
|
47
237
|
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
48
238
|
const today = /* @__PURE__ */ new Date();
|
|
49
|
-
const effectiveMinDate =
|
|
50
|
-
let min = minDate;
|
|
51
|
-
if (disablePast) {
|
|
52
|
-
const todayStart = startOfDay(today);
|
|
53
|
-
min = min ? min > todayStart ? min : todayStart : todayStart;
|
|
54
|
-
}
|
|
55
|
-
return min;
|
|
56
|
-
}, [
|
|
239
|
+
const { effectiveMinDate, effectiveMaxDate, isDateDisabled } = useDateConstraints({
|
|
57
240
|
minDate,
|
|
58
|
-
disablePast,
|
|
59
|
-
today
|
|
60
|
-
]);
|
|
61
|
-
const effectiveMaxDate = React$1.useMemo(() => {
|
|
62
|
-
let max = maxDate;
|
|
63
|
-
if (disableFuture) {
|
|
64
|
-
const todayEnd = endOfDay(today);
|
|
65
|
-
max = max ? max < todayEnd ? max : todayEnd : todayEnd;
|
|
66
|
-
}
|
|
67
|
-
return max;
|
|
68
|
-
}, [
|
|
69
241
|
maxDate,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const isDateDisabled = React$1.useCallback((date) => {
|
|
74
|
-
if (effectiveMinDate && date < effectiveMinDate) return true;
|
|
75
|
-
if (effectiveMaxDate && date > effectiveMaxDate) return true;
|
|
76
|
-
return false;
|
|
77
|
-
}, [effectiveMinDate, effectiveMaxDate]);
|
|
242
|
+
disablePast,
|
|
243
|
+
disableFuture
|
|
244
|
+
});
|
|
78
245
|
const getDaysDifference = React$1.useCallback((from, to) => {
|
|
79
246
|
const timeDiff = Math.abs(to.getTime() - from.getTime());
|
|
80
247
|
return Math.ceil(timeDiff / (1e3 * 60 * 60 * 24));
|
|
@@ -123,7 +290,6 @@ function CalendarDatePicker({ ref, id = "calendar-date-picker", className, trigg
|
|
|
123
290
|
React$1.useEffect(() => {
|
|
124
291
|
setPendingDate(date);
|
|
125
292
|
}, [date]);
|
|
126
|
-
const handleClose = () => setIsPopoverOpen(false);
|
|
127
293
|
const handleTogglePopover = () => setIsPopoverOpen((prev) => !prev);
|
|
128
294
|
const handleClear = (e) => {
|
|
129
295
|
e.stopPropagation();
|
|
@@ -414,229 +580,147 @@ function CalendarDatePicker({ ref, id = "calendar-date-picker", className, trigg
|
|
|
414
580
|
};
|
|
415
581
|
}, [highlightedPart, pendingDate]);
|
|
416
582
|
const formatWithTz = (date, fmt) => formatInTimeZone(date, timeZone, fmt);
|
|
583
|
+
return {
|
|
584
|
+
isPopoverOpen,
|
|
585
|
+
setIsPopoverOpen,
|
|
586
|
+
selectedRange,
|
|
587
|
+
setSelectedRange,
|
|
588
|
+
monthFrom,
|
|
589
|
+
setMonthFrom,
|
|
590
|
+
yearFrom,
|
|
591
|
+
setYearFrom,
|
|
592
|
+
monthTo,
|
|
593
|
+
setMonthTo,
|
|
594
|
+
yearTo,
|
|
595
|
+
setYearTo,
|
|
596
|
+
highlightedPart,
|
|
597
|
+
pendingDate,
|
|
598
|
+
timeZone,
|
|
599
|
+
today,
|
|
600
|
+
effectiveMinDate,
|
|
601
|
+
effectiveMaxDate,
|
|
602
|
+
years,
|
|
603
|
+
dateRanges,
|
|
604
|
+
isDateDisabled,
|
|
605
|
+
getDaysDifference,
|
|
606
|
+
isRangeValid,
|
|
607
|
+
adjustRangeToMaxRange,
|
|
608
|
+
handleTogglePopover,
|
|
609
|
+
handleClear,
|
|
610
|
+
handleApply,
|
|
611
|
+
handleReset,
|
|
612
|
+
selectDateRange,
|
|
613
|
+
handleDateSelect,
|
|
614
|
+
handleMonthChange,
|
|
615
|
+
handleYearChange,
|
|
616
|
+
handleMouseOver,
|
|
617
|
+
handleMouseLeave,
|
|
618
|
+
handleWheel,
|
|
619
|
+
formatWithTz
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/components/features/calendar-date-picker/calendar-date-picker.tsx
|
|
624
|
+
function CalendarDatePicker({ ref, id = "calendar-date-picker", className, triggerClassName, date, closeOnSelect = false, numberOfMonths = 2, yearsRange = 10, onDateSelect, variant, placeholder, excludePresets, customPresets, minDate, maxDate, disableFuture = false, disablePast = false, maxRange, popoverClassName, disabled, modal = false, responsive, sheetTitle, ...props }) {
|
|
625
|
+
const picker = useCalendarDatePicker({
|
|
626
|
+
id,
|
|
627
|
+
date,
|
|
628
|
+
closeOnSelect,
|
|
629
|
+
numberOfMonths,
|
|
630
|
+
yearsRange,
|
|
631
|
+
onDateSelect,
|
|
632
|
+
excludePresets,
|
|
633
|
+
customPresets,
|
|
634
|
+
minDate,
|
|
635
|
+
maxDate,
|
|
636
|
+
disableFuture,
|
|
637
|
+
disablePast,
|
|
638
|
+
maxRange
|
|
639
|
+
});
|
|
417
640
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("style", { children: `
|
|
418
641
|
.date-part {
|
|
419
642
|
touch-action: none;
|
|
420
643
|
}
|
|
421
|
-
` }), /* @__PURE__ */
|
|
422
|
-
open: isPopoverOpen,
|
|
423
|
-
onOpenChange: setIsPopoverOpen,
|
|
644
|
+
` }), /* @__PURE__ */ jsx(ResponsivePopover, {
|
|
645
|
+
open: picker.isPopoverOpen,
|
|
646
|
+
onOpenChange: picker.setIsPopoverOpen,
|
|
647
|
+
responsive,
|
|
648
|
+
sheetTitle: sheetTitle ?? placeholder ?? "Pick a date",
|
|
649
|
+
align: "center",
|
|
650
|
+
avoidCollisions: false,
|
|
651
|
+
contentClassName: cn("w-full sm:w-auto popover-content-width-full", popoverClassName),
|
|
424
652
|
modal,
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
onMouseOver: () => handleMouseOver("firstDay"),
|
|
447
|
-
onMouseLeave: handleMouseLeave,
|
|
448
|
-
children: formatWithTz(date.from, "dd")
|
|
449
|
-
}),
|
|
450
|
-
" ",
|
|
451
|
-
/* @__PURE__ */ jsx("span", {
|
|
452
|
-
id: `firstMonth-${id}`,
|
|
453
|
-
className: cn("date-part", highlightedPart === "firstMonth" && "font-bold underline"),
|
|
454
|
-
onMouseOver: () => handleMouseOver("firstMonth"),
|
|
455
|
-
onMouseLeave: handleMouseLeave,
|
|
456
|
-
children: formatWithTz(date.from, "LLL")
|
|
457
|
-
}),
|
|
458
|
-
",",
|
|
459
|
-
" ",
|
|
460
|
-
/* @__PURE__ */ jsx("span", {
|
|
461
|
-
id: `firstYear-${id}`,
|
|
462
|
-
className: cn("date-part", highlightedPart === "firstYear" && "font-bold underline"),
|
|
463
|
-
onMouseOver: () => handleMouseOver("firstYear"),
|
|
464
|
-
onMouseLeave: handleMouseLeave,
|
|
465
|
-
children: formatWithTz(date.from, "y")
|
|
466
|
-
}),
|
|
467
|
-
numberOfMonths === 2 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
468
|
-
" - ",
|
|
469
|
-
/* @__PURE__ */ jsx("span", {
|
|
470
|
-
id: `secondDay-${id}`,
|
|
471
|
-
className: cn("date-part", highlightedPart === "secondDay" && "font-bold underline"),
|
|
472
|
-
onMouseOver: () => handleMouseOver("secondDay"),
|
|
473
|
-
onMouseLeave: handleMouseLeave,
|
|
474
|
-
children: formatWithTz(date.to, "dd")
|
|
475
|
-
}),
|
|
476
|
-
" ",
|
|
477
|
-
/* @__PURE__ */ jsx("span", {
|
|
478
|
-
id: `secondMonth-${id}`,
|
|
479
|
-
className: cn("date-part", highlightedPart === "secondMonth" && "font-bold underline"),
|
|
480
|
-
onMouseOver: () => handleMouseOver("secondMonth"),
|
|
481
|
-
onMouseLeave: handleMouseLeave,
|
|
482
|
-
children: formatWithTz(date.to, "LLL")
|
|
483
|
-
}),
|
|
484
|
-
",",
|
|
485
|
-
" ",
|
|
486
|
-
/* @__PURE__ */ jsx("span", {
|
|
487
|
-
id: `secondYear-${id}`,
|
|
488
|
-
className: cn("date-part", highlightedPart === "secondYear" && "font-bold underline"),
|
|
489
|
-
onMouseOver: () => handleMouseOver("secondYear"),
|
|
490
|
-
onMouseLeave: handleMouseLeave,
|
|
491
|
-
children: formatWithTz(date.to, "y")
|
|
492
|
-
})
|
|
493
|
-
] })
|
|
494
|
-
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
495
|
-
/* @__PURE__ */ jsx("span", {
|
|
496
|
-
id: "day",
|
|
497
|
-
className: cn("date-part", highlightedPart === "day" && "font-bold underline"),
|
|
498
|
-
onMouseOver: () => handleMouseOver("day"),
|
|
499
|
-
onMouseLeave: handleMouseLeave,
|
|
500
|
-
children: formatWithTz(date.from, "dd")
|
|
501
|
-
}),
|
|
502
|
-
" ",
|
|
503
|
-
/* @__PURE__ */ jsx("span", {
|
|
504
|
-
id: "month",
|
|
505
|
-
className: cn("date-part", highlightedPart === "month" && "font-bold underline"),
|
|
506
|
-
onMouseOver: () => handleMouseOver("month"),
|
|
507
|
-
onMouseLeave: handleMouseLeave,
|
|
508
|
-
children: formatWithTz(date.from, "LLL")
|
|
509
|
-
}),
|
|
510
|
-
",",
|
|
511
|
-
" ",
|
|
512
|
-
/* @__PURE__ */ jsx("span", {
|
|
513
|
-
id: "year",
|
|
514
|
-
className: cn("date-part", highlightedPart === "year" && "font-bold underline"),
|
|
515
|
-
onMouseOver: () => handleMouseOver("year"),
|
|
516
|
-
onMouseLeave: handleMouseLeave,
|
|
517
|
-
children: formatWithTz(date.from, "y")
|
|
518
|
-
})
|
|
519
|
-
] }) : /* @__PURE__ */ jsx("span", {
|
|
520
|
-
className: "text-muted-foreground",
|
|
521
|
-
children: placeholder || "Pick a date"
|
|
522
|
-
}) })]
|
|
523
|
-
}), date?.from && /* @__PURE__ */ jsxs("div", {
|
|
524
|
-
onClick: handleClear,
|
|
525
|
-
className: "text-muted-foreground hover:text-primary size-4 p-0 hover:bg-transparent",
|
|
526
|
-
children: [/* @__PURE__ */ jsx(X, { size: 14 }), /* @__PURE__ */ jsx("span", {
|
|
527
|
-
className: "sr-only",
|
|
528
|
-
children: "Clear date"
|
|
529
|
-
})]
|
|
530
|
-
})]
|
|
531
|
-
})
|
|
532
|
-
})
|
|
533
|
-
}), isPopoverOpen && /* @__PURE__ */ jsx(PopoverContent, {
|
|
534
|
-
className: cn("w-auto popover-content-width-full", popoverClassName),
|
|
535
|
-
align: "center",
|
|
536
|
-
avoidCollisions: false,
|
|
537
|
-
onInteractOutside: handleClose,
|
|
538
|
-
onEscapeKeyDown: handleClose,
|
|
653
|
+
onInteractOutside: () => picker.setIsPopoverOpen(false),
|
|
654
|
+
onEscapeKeyDown: () => picker.setIsPopoverOpen(false),
|
|
655
|
+
trigger: /* @__PURE__ */ jsx(DateTrigger, {
|
|
656
|
+
ref,
|
|
657
|
+
id,
|
|
658
|
+
date,
|
|
659
|
+
placeholder,
|
|
660
|
+
disabled,
|
|
661
|
+
numberOfMonths,
|
|
662
|
+
highlightedPart: picker.highlightedPart,
|
|
663
|
+
handleMouseOver: picker.handleMouseOver,
|
|
664
|
+
handleMouseLeave: picker.handleMouseLeave,
|
|
665
|
+
handleClear: picker.handleClear,
|
|
666
|
+
handleTogglePopover: picker.handleTogglePopover,
|
|
667
|
+
formatWithTz: picker.formatWithTz,
|
|
668
|
+
variant,
|
|
669
|
+
className,
|
|
670
|
+
triggerClassName,
|
|
671
|
+
...props
|
|
672
|
+
}),
|
|
673
|
+
children: picker.isPopoverOpen && /* @__PURE__ */ jsx("div", {
|
|
539
674
|
style: {
|
|
540
675
|
maxHeight: "var(--radix-popover-content-available-height)",
|
|
541
676
|
overflowY: "auto"
|
|
542
677
|
},
|
|
543
678
|
children: /* @__PURE__ */ jsxs("div", {
|
|
544
679
|
className: "flex",
|
|
545
|
-
children: [numberOfMonths === 2 && /* @__PURE__ */ jsx(
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
setMonthTo(end);
|
|
556
|
-
setYearTo(end.getFullYear());
|
|
557
|
-
},
|
|
558
|
-
children: label
|
|
559
|
-
}, key))
|
|
680
|
+
children: [numberOfMonths === 2 && /* @__PURE__ */ jsx(CalendarPresets, {
|
|
681
|
+
dateRanges: picker.dateRanges,
|
|
682
|
+
selectedRange: picker.selectedRange,
|
|
683
|
+
onSelect: (start, end, label) => {
|
|
684
|
+
picker.selectDateRange(start, end, label);
|
|
685
|
+
picker.setMonthFrom(start);
|
|
686
|
+
picker.setYearFrom(start.getFullYear());
|
|
687
|
+
picker.setMonthTo(end);
|
|
688
|
+
picker.setYearTo(end.getFullYear());
|
|
689
|
+
}
|
|
560
690
|
}), /* @__PURE__ */ jsxs("div", {
|
|
561
|
-
className: "flex flex-col",
|
|
691
|
+
className: "flex w-full flex-col",
|
|
562
692
|
children: [
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
children: month
|
|
579
|
-
}, idx)) })]
|
|
580
|
-
}), /* @__PURE__ */ jsxs(Select, {
|
|
581
|
-
onValueChange: (value) => {
|
|
582
|
-
handleYearChange(Number(value), "from");
|
|
583
|
-
setSelectedRange(null);
|
|
584
|
-
},
|
|
585
|
-
value: yearFrom ? yearFrom.toString() : void 0,
|
|
586
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
587
|
-
className: "hover:bg-accent hover:text-accent-foreground hidden w-[122px] font-medium focus:ring-0 focus:ring-offset-0 sm:flex",
|
|
588
|
-
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Year" })
|
|
589
|
-
}), /* @__PURE__ */ jsx(SelectContent, { children: years.map((year, idx) => /* @__PURE__ */ jsx(SelectItem, {
|
|
590
|
-
value: year.toString(),
|
|
591
|
-
children: year
|
|
592
|
-
}, idx)) })]
|
|
593
|
-
})]
|
|
594
|
-
}), numberOfMonths === 2 && /* @__PURE__ */ jsxs("div", {
|
|
595
|
-
className: "flex gap-2",
|
|
596
|
-
children: [/* @__PURE__ */ jsxs(Select, {
|
|
597
|
-
onValueChange: (value) => {
|
|
598
|
-
handleMonthChange(months.indexOf(value), "to");
|
|
599
|
-
setSelectedRange(null);
|
|
600
|
-
},
|
|
601
|
-
value: monthTo ? months[monthTo.getMonth()] : void 0,
|
|
602
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
603
|
-
className: "hover:bg-accent hover:text-accent-foreground hidden w-[122px] font-medium focus:ring-0 focus:ring-offset-0 sm:flex",
|
|
604
|
-
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Month" })
|
|
605
|
-
}), /* @__PURE__ */ jsx(SelectContent, { children: months.map((month, idx) => /* @__PURE__ */ jsx(SelectItem, {
|
|
606
|
-
value: month,
|
|
607
|
-
children: month
|
|
608
|
-
}, idx)) })]
|
|
609
|
-
}), /* @__PURE__ */ jsxs(Select, {
|
|
610
|
-
onValueChange: (value) => {
|
|
611
|
-
handleYearChange(Number(value), "to");
|
|
612
|
-
setSelectedRange(null);
|
|
613
|
-
},
|
|
614
|
-
value: yearTo ? yearTo.toString() : void 0,
|
|
615
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
616
|
-
className: "hover:bg-accent hover:text-accent-foreground hidden w-[122px] font-medium focus:ring-0 focus:ring-offset-0 sm:flex",
|
|
617
|
-
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Year" })
|
|
618
|
-
}), /* @__PURE__ */ jsx(SelectContent, { children: years.map((year, idx) => /* @__PURE__ */ jsx(SelectItem, {
|
|
619
|
-
value: year.toString(),
|
|
620
|
-
children: year
|
|
621
|
-
}, idx)) })]
|
|
622
|
-
})]
|
|
623
|
-
})]
|
|
693
|
+
/* @__PURE__ */ jsx(CalendarHeader, {
|
|
694
|
+
monthFrom: picker.monthFrom,
|
|
695
|
+
yearFrom: picker.yearFrom,
|
|
696
|
+
monthTo: picker.monthTo,
|
|
697
|
+
yearTo: picker.yearTo,
|
|
698
|
+
years: picker.years,
|
|
699
|
+
numberOfMonths,
|
|
700
|
+
onMonthChange: (month, target) => {
|
|
701
|
+
picker.handleMonthChange(month, target);
|
|
702
|
+
picker.setSelectedRange(null);
|
|
703
|
+
},
|
|
704
|
+
onYearChange: (year, target) => {
|
|
705
|
+
picker.handleYearChange(year, target);
|
|
706
|
+
picker.setSelectedRange(null);
|
|
707
|
+
}
|
|
624
708
|
}),
|
|
625
709
|
/* @__PURE__ */ jsx("div", {
|
|
626
|
-
className: "flex",
|
|
710
|
+
className: "flex w-full justify-center",
|
|
627
711
|
children: /* @__PURE__ */ jsx(Calendar$1, {
|
|
628
712
|
mode: "range",
|
|
629
|
-
defaultMonth: monthFrom,
|
|
630
|
-
month: monthFrom,
|
|
631
|
-
onMonthChange: setMonthFrom,
|
|
632
|
-
selected: pendingDate,
|
|
633
|
-
onSelect: handleDateSelect,
|
|
713
|
+
defaultMonth: picker.monthFrom,
|
|
714
|
+
month: picker.monthFrom,
|
|
715
|
+
onMonthChange: picker.setMonthFrom,
|
|
716
|
+
selected: picker.pendingDate,
|
|
717
|
+
onSelect: picker.handleDateSelect,
|
|
634
718
|
numberOfMonths,
|
|
635
719
|
showOutsideDays: false,
|
|
636
|
-
disabled: isDateDisabled,
|
|
637
|
-
fromDate: effectiveMinDate,
|
|
638
|
-
toDate: effectiveMaxDate,
|
|
639
|
-
className
|
|
720
|
+
disabled: picker.isDateDisabled,
|
|
721
|
+
fromDate: picker.effectiveMinDate,
|
|
722
|
+
toDate: picker.effectiveMaxDate,
|
|
723
|
+
className: cn("w-full sm:w-auto", className)
|
|
640
724
|
})
|
|
641
725
|
}),
|
|
642
726
|
!closeOnSelect && /* @__PURE__ */ jsxs("div", {
|
|
@@ -644,12 +728,12 @@ function CalendarDatePicker({ ref, id = "calendar-date-picker", className, trigg
|
|
|
644
728
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
645
729
|
variant: "outline",
|
|
646
730
|
size: "sm",
|
|
647
|
-
onClick: handleReset,
|
|
731
|
+
onClick: picker.handleReset,
|
|
648
732
|
type: "button",
|
|
649
733
|
children: "Reset"
|
|
650
734
|
}), /* @__PURE__ */ jsx(Button, {
|
|
651
735
|
size: "sm",
|
|
652
|
-
onClick: handleApply,
|
|
736
|
+
onClick: picker.handleApply,
|
|
653
737
|
type: "button",
|
|
654
738
|
children: "Apply"
|
|
655
739
|
})]
|
|
@@ -657,7 +741,7 @@ function CalendarDatePicker({ ref, id = "calendar-date-picker", className, trigg
|
|
|
657
741
|
]
|
|
658
742
|
})]
|
|
659
743
|
})
|
|
660
|
-
})
|
|
744
|
+
})
|
|
661
745
|
})] });
|
|
662
746
|
}
|
|
663
747
|
CalendarDatePicker.displayName = "CalendarDatePicker";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as formatJson, c as isValidYaml, d as CodeEditor, i as CodeEditorTabs, l as jsonToYaml, n as jsonSchema, o as formatYaml, r as yamlSchema, s as isValidJson, t as createCodeEditorSchema, u as yamlToJson } from "../types-
|
|
1
|
+
import { a as formatJson, c as isValidYaml, d as CodeEditor, i as CodeEditorTabs, l as jsonToYaml, n as jsonSchema, o as formatYaml, r as yamlSchema, s as isValidJson, t as createCodeEditorSchema, u as yamlToJson } from "../types-CKIe2WlV.mjs";
|
|
2
2
|
export { CodeEditor, CodeEditorTabs, createCodeEditorSchema, formatJson, formatYaml, isValidJson, isValidYaml, jsonSchema, jsonToYaml, yamlSchema, yamlToJson };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/date-picker/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/date-picker/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB"}
|