@televet/kibble-ui 5.0.27-frank.5 → 5.0.27-frank.6
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/chunks/calendar.component-CFBrrBSJ.js +2 -0
- package/dist/chunks/calendar.component-CFBrrBSJ.js.map +1 -0
- package/dist/chunks/calendar.component-Dz_YhuJT.js +62 -0
- package/dist/chunks/calendar.component-Dz_YhuJT.js.map +1 -0
- package/dist/chunks/dateTimePicker.component-BwKD6TeU.js +306 -0
- package/dist/chunks/dateTimePicker.component-BwKD6TeU.js.map +1 -0
- package/dist/chunks/dateTimePicker.component-C7SFD9Py.js +2 -0
- package/dist/chunks/dateTimePicker.component-C7SFD9Py.js.map +1 -0
- package/dist/chunks/endOfMonth-ClO3w4vF.js +2 -0
- package/dist/chunks/endOfMonth-ClO3w4vF.js.map +1 -0
- package/dist/chunks/endOfMonth-D0kCU08_.js +19 -0
- package/dist/chunks/endOfMonth-D0kCU08_.js.map +1 -0
- package/dist/cjs/components/Calendar/index.cjs +1 -1
- package/dist/cjs/components/DateTimePicker/index.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/Calendar/index.js +3 -5
- package/dist/esm/components/Calendar/index.js.map +1 -1
- package/dist/esm/components/DateTimePicker/index.js +4 -5
- package/dist/esm/components/DateTimePicker/index.js.map +1 -1
- package/dist/esm/components/index.js +122 -123
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/index.js +143 -144
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/Calendar/calendarFooterButton.component.d.ts +13 -5
- package/dist/types/components/Calendar/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/chunks/calendar.component-BuannZqN.js +0 -65
- package/dist/chunks/calendar.component-BuannZqN.js.map +0 -1
- package/dist/chunks/calendar.component-IprfPy6e.js +0 -2
- package/dist/chunks/calendar.component-IprfPy6e.js.map +0 -1
- package/dist/chunks/dateTimePicker.component-Dvc84auK.js +0 -2
- package/dist/chunks/dateTimePicker.component-Dvc84auK.js.map +0 -1
- package/dist/chunks/dateTimePicker.component-YnanZ6z4.js +0 -303
- package/dist/chunks/dateTimePicker.component-YnanZ6z4.js.map +0 -1
- package/dist/chunks/endOfMonth-Cdo637cm.js +0 -23
- package/dist/chunks/endOfMonth-Cdo637cm.js.map +0 -1
- package/dist/chunks/endOfMonth-M8F1WVLW.js +0 -2
- package/dist/chunks/endOfMonth-M8F1WVLW.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-BjDatQAs.js"),h=require("./index-BQRnVsAg.js"),o=require("./datePicker.provider-i35-VNAb.js"),D=require("./divider.component-BX3zyB7O.js"),b=require("./button.component-DjdgBXDC.js"),x=require("./format-CK7Imh-5.js"),u=require("./endOfMonth-ClO3w4vF.js"),E={today:"Today",thisWeek:"This Week",thisMonth:"This Month"},k=({footer:e,["data-testid"]:d="kibble-calendar-footer"})=>{const{goToDate:a,onDateSelect:n,onQuickOptionSelect:i,firstDayOfWeek:l}=o.useDatePickerContext(),m=()=>{if(e.type==="custom"){e.onClick();return}const r=new Date;switch(e.value){case"today":{const t=x.startOfDay(r);a(t),n(t);break}case"thisWeek":{const t=l??1,c=x.startOfWeek(r,{weekStartsOn:t}),R=u.endOfWeek(r,{weekStartsOn:t});a(c),i({startDate:c,endDate:R});break}case"thisMonth":{const t=u.startOfMonth(r),c=u.endOfMonth(r);a(t),i({startDate:t,endDate:c});break}}e.onClick?.()},j=e.type==="custom"?e.label:e.label??E[e.value];return s.jsxRuntimeExports.jsx(h.Box,{"data-testid":d,bg:"background.secondaryAlpha",borderRadius:"md",p:2,w:"full",children:s.jsxRuntimeExports.jsx(b.Button,{variant:"secondarySubtle",size:"md",w:"full",onClick:m,children:j})})},y=new Set(["thisWeek","thisMonth"]),p=e=>y.has(e),C=({["data-testid"]:e="kibble-calendar",withDateRange:d=!0,withHeaderTriggers:a=!1,footer:n,...i})=>{const l=d||n?.type==="preset"&&p(n.value);return s.jsxRuntimeExports.jsx(h.Box,{className:"Calendar","data-testid":e,maxW:n?"360px":"340px",children:s.jsxRuntimeExports.jsxs(o.DatePickerProvider,{withDateRange:l,...i,standalone:!0,children:[s.jsxRuntimeExports.jsx(o.DatePickerHeader,{withTriggers:a}),s.jsxRuntimeExports.jsx(D.Divider,{}),s.jsxRuntimeExports.jsx(o.DatePickerCalendar,{}),n&&s.jsxRuntimeExports.jsx(k,{footer:n})]})})};exports.Calendar=C;exports.CalendarFooterButton=k;exports.isRangePreset=p;
|
|
2
|
+
//# sourceMappingURL=calendar.component-CFBrrBSJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.component-CFBrrBSJ.js","sources":["../../src/components/Calendar/calendarFooterButton.component.tsx","../../src/components/Calendar/calendar.utils.ts","../../src/components/Calendar/calendar.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Button } from 'components/Button/button.component';\nimport { useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\nimport startOfDay from 'date-fns/startOfDay';\nimport startOfWeek from 'date-fns/startOfWeek';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport endOfWeek from 'date-fns/endOfWeek';\nimport endOfMonth from 'date-fns/endOfMonth';\n\n/**\n * The built-in preset values for CalendarFooterButton.\n *\n * Intentionally kept as plain string literals rather than re-using\n * DateTimePickerDefaultOptionValue to avoid a duplicate star-export conflict:\n * both Calendar and DateTimePicker barrel-export from components/index.ts,\n * and TypeScript silently drops ambiguous re-exports when two barrels supply\n * the same identifier. Keeping CalendarPreset self-contained prevents that\n * collision and makes the Calendar API standalone.\n */\nexport type CalendarPreset = 'today' | 'thisWeek' | 'thisMonth';\n\nexport interface CalendarFooterPresetConfig {\n type: 'preset';\n /** The built-in preset to apply when the button is clicked. */\n value: CalendarPreset;\n /**\n * Override the button label.\n * Defaults: 'today' → 'Today', 'thisWeek' → 'This Week', 'thisMonth' → 'This Month'.\n */\n label?: string;\n /** Optional callback fired after the preset date is selected. */\n onClick?: () => void;\n}\n\nexport interface CalendarFooterCustomConfig {\n type: 'custom';\n /** Button label — required for custom type. */\n label: string;\n /** Handler called when the button is clicked. Full control — no date selection is performed. */\n onClick: () => void;\n}\n\nexport type CalendarFooterConfig = CalendarFooterPresetConfig | CalendarFooterCustomConfig;\n\nconst PRESET_LABELS: Record<CalendarPreset, string> = {\n today: 'Today',\n thisWeek: 'This Week',\n thisMonth: 'This Month',\n};\n\ninterface CalendarFooterButtonProps {\n footer: CalendarFooterConfig;\n /** Data test id for the footer container.\n * @default kibble-calendar-footer\n */\n 'data-testid'?: string;\n}\n\nexport const CalendarFooterButton = ({\n footer,\n ['data-testid']: dataTestId = 'kibble-calendar-footer',\n}: CalendarFooterButtonProps): React.JSX.Element => {\n const { goToDate, onDateSelect, onQuickOptionSelect, firstDayOfWeek } = useDatePickerContext();\n\n const handleClick = (): void => {\n if (footer.type === 'custom') {\n footer.onClick();\n return;\n }\n\n const today = new Date();\n\n switch (footer.value) {\n case 'today': {\n const date = startOfDay(today);\n goToDate(date);\n onDateSelect(date);\n break;\n }\n case 'thisWeek': {\n const weekStartsOn = (firstDayOfWeek ?? 1) as 0 | 1 | 2 | 3 | 4 | 5 | 6;\n const start = startOfWeek(today, { weekStartsOn });\n const end = endOfWeek(today, { weekStartsOn });\n goToDate(start);\n // onQuickOptionSelect sets both dates atomically, avoiding the two-click range flow\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n case 'thisMonth': {\n const start = startOfMonth(today);\n const end = endOfMonth(today);\n goToDate(start);\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n }\n\n footer.onClick?.();\n };\n\n const label = footer.type === 'custom' ? footer.label : (footer.label ?? PRESET_LABELS[footer.value]);\n\n return (\n <Box data-testid={dataTestId} bg=\"background.secondaryAlpha\" borderRadius=\"md\" p={2} w=\"full\">\n <Button variant=\"secondarySubtle\" size=\"md\" w=\"full\" onClick={handleClick}>\n {label}\n </Button>\n </Box>\n );\n};\n","import { CalendarPreset } from './calendarFooterButton.component';\n\n// Explicit allowlist — new presets default to single-day unless listed here\nconst RANGE_PRESETS = new Set<CalendarPreset>(['thisWeek', 'thisMonth']);\n\n/** Returns true when the preset requires date range selection (week, month). */\nexport const isRangePreset = (value: CalendarPreset): boolean => RANGE_PRESETS.has(value);\n","import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { DatePickerCalendar } from 'components/DatePicker/components/DatePickerCalendar/datePickerCalendar.component';\nimport { DatePickerHeader } from 'components/DatePicker/components/DatePickerHeader/datePickerHeader.component';\nimport { Divider } from 'components/Divider';\nimport { DatePickerProvider } from 'components/DatePicker/context/datePicker.provider';\nimport { DateProps } from 'components/DatePicker/datePicker.types';\nimport { CalendarFooterButton, CalendarFooterConfig } from './calendarFooterButton.component';\nimport { isRangePreset } from './calendar.utils';\n\nexport interface CalendarProps extends DateProps {\n /** Data test id for the calendar.\n * @default kibble-calendar\n */\n 'data-testid'?: string;\n /**\n * If true, the calendar will allow for a date range selection.\n * @default true\n */\n withDateRange?: boolean;\n /**\n * If true, the calendar will show the month and year selectors in the header.\n * @default false\n */\n withHeaderTriggers?: boolean;\n /**\n * Optional footer button configuration. Renders a styled button below the calendar grid.\n *\n * Use `type: 'preset'` for built-in shortcuts ('today' | 'thisWeek' | 'thisMonth') — the\n * component handles the date selection logic automatically.\n *\n * Use `type: 'custom'` to supply your own label and click handler with no built-in date logic.\n *\n * @example\n * // Preset\n * footer={{ type: 'preset', value: 'today', onClick: () => setOpen(false) }}\n *\n * @example\n * // Custom\n * footer={{ type: 'custom', label: 'Reset', onClick: handleReset }}\n */\n footer?: CalendarFooterConfig;\n}\n\nexport const Calendar = ({\n ['data-testid']: dataTestId = 'kibble-calendar',\n withDateRange = true,\n withHeaderTriggers = false,\n footer,\n ...rest\n}: CalendarProps): React.JSX.Element => {\n // Range presets (thisWeek, thisMonth) require date range mode regardless of the withDateRange prop\n const effectiveDateRange = withDateRange || (footer?.type === 'preset' && isRangePreset(footer.value));\n\n return (\n <Box className=\"Calendar\" data-testid={dataTestId} maxW={footer ? '360px' : '340px'}>\n <DatePickerProvider withDateRange={effectiveDateRange} {...rest} standalone>\n <DatePickerHeader withTriggers={withHeaderTriggers} />\n <Divider />\n <DatePickerCalendar />\n {footer && <CalendarFooterButton footer={footer} />}\n </DatePickerProvider>\n </Box>\n );\n};\n"],"names":["PRESET_LABELS","CalendarFooterButton","footer","dataTestId","goToDate","onDateSelect","onQuickOptionSelect","firstDayOfWeek","useDatePickerContext","handleClick","today","date","startOfDay","weekStartsOn","start","startOfWeek","end","endOfWeek","startOfMonth","endOfMonth","label","jsx","Box","Button","RANGE_PRESETS","isRangePreset","value","Calendar","withDateRange","withHeaderTriggers","rest","effectiveDateRange","DatePickerProvider","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":"2SA6CMA,EAAgD,CACpD,MAAO,QACP,SAAU,YACV,UAAW,YACb,EAUaC,EAAuB,CAAC,CACnC,OAAAC,EACA,CAAC,eAAgBC,EAAa,wBAChC,IAAoD,CAClD,KAAM,CAAE,SAAAC,EAAU,aAAAC,EAAc,oBAAAC,EAAqB,eAAAC,CAAA,EAAmBC,EAAAA,qBAAqB,EAEvFC,EAAc,IAAY,CAC1B,GAAAP,EAAO,OAAS,SAAU,CAC5BA,EAAO,QAAQ,EACf,MAAA,CAGI,MAAAQ,MAAY,KAElB,OAAQR,EAAO,MAAO,CACpB,IAAK,QAAS,CACN,MAAAS,EAAOC,aAAWF,CAAK,EAC7BN,EAASO,CAAI,EACbN,EAAaM,CAAI,EACjB,KAAA,CAEF,IAAK,WAAY,CACf,MAAME,EAAgBN,GAAkB,EAClCO,EAAQC,EAAA,YAAYL,EAAO,CAAE,aAAAG,EAAc,EAC3CG,EAAMC,EAAA,UAAUP,EAAO,CAAE,aAAAG,EAAc,EAC7CT,EAASU,CAAK,EAEdR,EAAoB,CAAE,UAAWQ,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}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { j as a } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { B as l } from "./index-9BerxEcw.js";
|
|
3
|
+
import { u, a as p, b as D, c as x } from "./datePicker.provider-C1vLiJEb.js";
|
|
4
|
+
import { D as b } from "./divider.component-CFOh4Nw3.js";
|
|
5
|
+
import { B as y } from "./button.component-BO6oee_V.js";
|
|
6
|
+
import { s as f, a as j } from "./format-dJJ72A--.js";
|
|
7
|
+
import { s as C, e as S, a as g } from "./endOfMonth-D0kCU08_.js";
|
|
8
|
+
const w = {
|
|
9
|
+
today: "Today",
|
|
10
|
+
thisWeek: "This Week",
|
|
11
|
+
thisMonth: "This Month"
|
|
12
|
+
}, O = ({
|
|
13
|
+
footer: t,
|
|
14
|
+
["data-testid"]: o = "kibble-calendar-footer"
|
|
15
|
+
}) => {
|
|
16
|
+
const { goToDate: n, onDateSelect: s, onQuickOptionSelect: i, firstDayOfWeek: d } = u(), h = () => {
|
|
17
|
+
if (t.type === "custom") {
|
|
18
|
+
t.onClick();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const r = /* @__PURE__ */ new Date();
|
|
22
|
+
switch (t.value) {
|
|
23
|
+
case "today": {
|
|
24
|
+
const e = j(r);
|
|
25
|
+
n(e), s(e);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
case "thisWeek": {
|
|
29
|
+
const e = d ?? 1, c = f(r, { weekStartsOn: e }), m = g(r, { weekStartsOn: e });
|
|
30
|
+
n(c), i({ startDate: c, endDate: m });
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case "thisMonth": {
|
|
34
|
+
const e = C(r), c = S(r);
|
|
35
|
+
n(e), i({ startDate: e, endDate: c });
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
t.onClick?.();
|
|
40
|
+
}, k = t.type === "custom" ? t.label : t.label ?? w[t.value];
|
|
41
|
+
return /* @__PURE__ */ a.jsx(l, { "data-testid": o, bg: "background.secondaryAlpha", borderRadius: "md", p: 2, w: "full", children: /* @__PURE__ */ a.jsx(y, { variant: "secondarySubtle", size: "md", w: "full", onClick: h, children: k }) });
|
|
42
|
+
}, P = /* @__PURE__ */ new Set(["thisWeek", "thisMonth"]), R = (t) => P.has(t), L = ({
|
|
43
|
+
["data-testid"]: t = "kibble-calendar",
|
|
44
|
+
withDateRange: o = !0,
|
|
45
|
+
withHeaderTriggers: n = !1,
|
|
46
|
+
footer: s,
|
|
47
|
+
...i
|
|
48
|
+
}) => {
|
|
49
|
+
const d = o || s?.type === "preset" && R(s.value);
|
|
50
|
+
return /* @__PURE__ */ a.jsx(l, { className: "Calendar", "data-testid": t, maxW: s ? "360px" : "340px", children: /* @__PURE__ */ a.jsxs(p, { withDateRange: d, ...i, standalone: !0, children: [
|
|
51
|
+
/* @__PURE__ */ a.jsx(D, { withTriggers: n }),
|
|
52
|
+
/* @__PURE__ */ a.jsx(b, {}),
|
|
53
|
+
/* @__PURE__ */ a.jsx(x, {}),
|
|
54
|
+
s && /* @__PURE__ */ a.jsx(O, { footer: s })
|
|
55
|
+
] }) });
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
L as C,
|
|
59
|
+
O as a,
|
|
60
|
+
R as i
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=calendar.component-Dz_YhuJT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.component-Dz_YhuJT.js","sources":["../../src/components/Calendar/calendarFooterButton.component.tsx","../../src/components/Calendar/calendar.utils.ts","../../src/components/Calendar/calendar.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Button } from 'components/Button/button.component';\nimport { useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\nimport startOfDay from 'date-fns/startOfDay';\nimport startOfWeek from 'date-fns/startOfWeek';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport endOfWeek from 'date-fns/endOfWeek';\nimport endOfMonth from 'date-fns/endOfMonth';\n\n/**\n * The built-in preset values for CalendarFooterButton.\n *\n * Intentionally kept as plain string literals rather than re-using\n * DateTimePickerDefaultOptionValue to avoid a duplicate star-export conflict:\n * both Calendar and DateTimePicker barrel-export from components/index.ts,\n * and TypeScript silently drops ambiguous re-exports when two barrels supply\n * the same identifier. Keeping CalendarPreset self-contained prevents that\n * collision and makes the Calendar API standalone.\n */\nexport type CalendarPreset = 'today' | 'thisWeek' | 'thisMonth';\n\nexport interface CalendarFooterPresetConfig {\n type: 'preset';\n /** The built-in preset to apply when the button is clicked. */\n value: CalendarPreset;\n /**\n * Override the button label.\n * Defaults: 'today' → 'Today', 'thisWeek' → 'This Week', 'thisMonth' → 'This Month'.\n */\n label?: string;\n /** Optional callback fired after the preset date is selected. */\n onClick?: () => void;\n}\n\nexport interface CalendarFooterCustomConfig {\n type: 'custom';\n /** Button label — required for custom type. */\n label: string;\n /** Handler called when the button is clicked. Full control — no date selection is performed. */\n onClick: () => void;\n}\n\nexport type CalendarFooterConfig = CalendarFooterPresetConfig | CalendarFooterCustomConfig;\n\nconst PRESET_LABELS: Record<CalendarPreset, string> = {\n today: 'Today',\n thisWeek: 'This Week',\n thisMonth: 'This Month',\n};\n\ninterface CalendarFooterButtonProps {\n footer: CalendarFooterConfig;\n /** Data test id for the footer container.\n * @default kibble-calendar-footer\n */\n 'data-testid'?: string;\n}\n\nexport const CalendarFooterButton = ({\n footer,\n ['data-testid']: dataTestId = 'kibble-calendar-footer',\n}: CalendarFooterButtonProps): React.JSX.Element => {\n const { goToDate, onDateSelect, onQuickOptionSelect, firstDayOfWeek } = useDatePickerContext();\n\n const handleClick = (): void => {\n if (footer.type === 'custom') {\n footer.onClick();\n return;\n }\n\n const today = new Date();\n\n switch (footer.value) {\n case 'today': {\n const date = startOfDay(today);\n goToDate(date);\n onDateSelect(date);\n break;\n }\n case 'thisWeek': {\n const weekStartsOn = (firstDayOfWeek ?? 1) as 0 | 1 | 2 | 3 | 4 | 5 | 6;\n const start = startOfWeek(today, { weekStartsOn });\n const end = endOfWeek(today, { weekStartsOn });\n goToDate(start);\n // onQuickOptionSelect sets both dates atomically, avoiding the two-click range flow\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n case 'thisMonth': {\n const start = startOfMonth(today);\n const end = endOfMonth(today);\n goToDate(start);\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n }\n\n footer.onClick?.();\n };\n\n const label = footer.type === 'custom' ? footer.label : (footer.label ?? PRESET_LABELS[footer.value]);\n\n return (\n <Box data-testid={dataTestId} bg=\"background.secondaryAlpha\" borderRadius=\"md\" p={2} w=\"full\">\n <Button variant=\"secondarySubtle\" size=\"md\" w=\"full\" onClick={handleClick}>\n {label}\n </Button>\n </Box>\n );\n};\n","import { CalendarPreset } from './calendarFooterButton.component';\n\n// Explicit allowlist — new presets default to single-day unless listed here\nconst RANGE_PRESETS = new Set<CalendarPreset>(['thisWeek', 'thisMonth']);\n\n/** Returns true when the preset requires date range selection (week, month). */\nexport const isRangePreset = (value: CalendarPreset): boolean => RANGE_PRESETS.has(value);\n","import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { DatePickerCalendar } from 'components/DatePicker/components/DatePickerCalendar/datePickerCalendar.component';\nimport { DatePickerHeader } from 'components/DatePicker/components/DatePickerHeader/datePickerHeader.component';\nimport { Divider } from 'components/Divider';\nimport { DatePickerProvider } from 'components/DatePicker/context/datePicker.provider';\nimport { DateProps } from 'components/DatePicker/datePicker.types';\nimport { CalendarFooterButton, CalendarFooterConfig } from './calendarFooterButton.component';\nimport { isRangePreset } from './calendar.utils';\n\nexport interface CalendarProps extends DateProps {\n /** Data test id for the calendar.\n * @default kibble-calendar\n */\n 'data-testid'?: string;\n /**\n * If true, the calendar will allow for a date range selection.\n * @default true\n */\n withDateRange?: boolean;\n /**\n * If true, the calendar will show the month and year selectors in the header.\n * @default false\n */\n withHeaderTriggers?: boolean;\n /**\n * Optional footer button configuration. Renders a styled button below the calendar grid.\n *\n * Use `type: 'preset'` for built-in shortcuts ('today' | 'thisWeek' | 'thisMonth') — the\n * component handles the date selection logic automatically.\n *\n * Use `type: 'custom'` to supply your own label and click handler with no built-in date logic.\n *\n * @example\n * // Preset\n * footer={{ type: 'preset', value: 'today', onClick: () => setOpen(false) }}\n *\n * @example\n * // Custom\n * footer={{ type: 'custom', label: 'Reset', onClick: handleReset }}\n */\n footer?: CalendarFooterConfig;\n}\n\nexport const Calendar = ({\n ['data-testid']: dataTestId = 'kibble-calendar',\n withDateRange = true,\n withHeaderTriggers = false,\n footer,\n ...rest\n}: CalendarProps): React.JSX.Element => {\n // Range presets (thisWeek, thisMonth) require date range mode regardless of the withDateRange prop\n const effectiveDateRange = withDateRange || (footer?.type === 'preset' && isRangePreset(footer.value));\n\n return (\n <Box className=\"Calendar\" data-testid={dataTestId} maxW={footer ? '360px' : '340px'}>\n <DatePickerProvider withDateRange={effectiveDateRange} {...rest} standalone>\n <DatePickerHeader withTriggers={withHeaderTriggers} />\n <Divider />\n <DatePickerCalendar />\n {footer && <CalendarFooterButton footer={footer} />}\n </DatePickerProvider>\n </Box>\n );\n};\n"],"names":["PRESET_LABELS","CalendarFooterButton","footer","dataTestId","goToDate","onDateSelect","onQuickOptionSelect","firstDayOfWeek","useDatePickerContext","handleClick","today","date","startOfDay","weekStartsOn","start","startOfWeek","end","endOfWeek","startOfMonth","endOfMonth","label","jsx","Box","Button","RANGE_PRESETS","isRangePreset","value","Calendar","withDateRange","withHeaderTriggers","rest","effectiveDateRange","DatePickerProvider","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":";;;;;;;AA6CA,MAAMA,IAAgD;AAAA,EACpD,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AACb,GAUaC,IAAuB,CAAC;AAAA,EACnC,QAAAC;AAAA,EACA,CAAC,gBAAgBC,IAAa;AAChC,MAAoD;AAClD,QAAM,EAAE,UAAAC,GAAU,cAAAC,GAAc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CAAC,gBAAgBxB,IAAa;AAAA,EAC9B,eAAAyB,IAAgB;AAAA,EAChB,oBAAAC,IAAqB;AAAA,EACrB,QAAA3B;AAAA,EACA,GAAG4B;AACL,MAAwC;AAEtC,QAAMC,IAAqBH,KAAkB1B,GAAQ,SAAS,YAAYuB,EAAcvB,EAAO,KAAK;AAEpG,+BACGoB,GAAI,EAAA,WAAU,YAAW,eAAanB,GAAY,MAAMD,IAAS,UAAU,SAC1E,iCAAC8B,GAAmB,EAAA,eAAeD,GAAqB,GAAGD,GAAM,YAAU,IACzE,UAAA;AAAA,IAACT,gBAAAA,EAAAA,IAAAY,GAAA,EAAiB,cAAcJ,EAAoB,CAAA;AAAA,0BACnDK,GAAQ,EAAA;AAAA,0BACRC,GAAmB,EAAA;AAAA,IACnBjC,KAAWmB,gBAAAA,EAAA,IAAApB,GAAA,EAAqB,QAAAC,EAAgB,CAAA;AAAA,EAAA,EAAA,CACnD,EACF,CAAA;AAEJ;"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { j as a } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { useMemo as d, useEffect as O, useState as $ } from "react";
|
|
3
|
+
import { B as R } from "./button.component-BO6oee_V.js";
|
|
4
|
+
import { e as L, d as H, f as z, u as T, F as p, b as A, c as G, a as Q } from "./datePicker.provider-C1vLiJEb.js";
|
|
5
|
+
import { u as q } from "./usePortalContentRef-DO_jc4W9.js";
|
|
6
|
+
import { p as V } from "./popover.recipe-DPwwsWLb.js";
|
|
7
|
+
import { a as Y, c as J, t as W, s as M, f as K } from "./format-dJJ72A--.js";
|
|
8
|
+
import { c as j } from "./isToday-Q8lj3mkM.js";
|
|
9
|
+
import { e as S, s as w, a as _ } from "./endOfMonth-D0kCU08_.js";
|
|
10
|
+
import { u as U } from "./popover-root-provider-CFn2dthZ.js";
|
|
11
|
+
import { F as v } from "./flex-CX-8gE9T.js";
|
|
12
|
+
import { useBreakpoint as X } from "../esm/hooks/useBreakpoint/index.js";
|
|
13
|
+
import { B as x } from "./index-9BerxEcw.js";
|
|
14
|
+
import { W as Z } from "./text.component-DhuUgP3j.js";
|
|
15
|
+
import { W as ee } from "./textInput.component-BeiTxTkS.js";
|
|
16
|
+
import { T as te } from "./timePicker.component-CsvyXSRc.js";
|
|
17
|
+
import { G as ae, a as C } from "./grid-item-BmCSQ38y.js";
|
|
18
|
+
import { D as se } from "./divider.component-CFOh4Nw3.js";
|
|
19
|
+
import { u as ne } from "./create-slot-recipe-context-D_FXDJGp.js";
|
|
20
|
+
import { P as re } from "./index-DcmJgLUo.js";
|
|
21
|
+
import { P as oe, a as ie, b as ce, c as de } from "./popover-Gb1fXSR7.js";
|
|
22
|
+
var n = /* @__PURE__ */ ((e) => (e.Today = "Today", e.Yesterday = "Yesterday", e.ThisWeek = "ThisWeek", e.LastWeek = "LastWeek", e.ThisMonth = "ThisMonth", e.LastMonth = "LastMonth", e.Custom = "Custom", e))(n || {});
|
|
23
|
+
const ze = ["single", "double"], le = [
|
|
24
|
+
{
|
|
25
|
+
label: "Today",
|
|
26
|
+
value: n.Today
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: "Yesterday",
|
|
30
|
+
value: n.Yesterday
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: "This Week",
|
|
34
|
+
value: n.ThisWeek
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "Last Week",
|
|
38
|
+
value: n.LastWeek
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: "This Month",
|
|
42
|
+
value: n.ThisMonth
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "Last Month",
|
|
46
|
+
value: n.LastMonth
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: "Custom",
|
|
50
|
+
value: n.Custom,
|
|
51
|
+
iconName: "calendarPen"
|
|
52
|
+
}
|
|
53
|
+
], ue = {
|
|
54
|
+
single: 1,
|
|
55
|
+
double: 2
|
|
56
|
+
};
|
|
57
|
+
function me(e) {
|
|
58
|
+
return Y(Date.now(), e);
|
|
59
|
+
}
|
|
60
|
+
function pe(e) {
|
|
61
|
+
return L(Date.now(), e);
|
|
62
|
+
}
|
|
63
|
+
function he(e) {
|
|
64
|
+
const t = j(e?.in), s = t.getFullYear(), r = t.getMonth(), o = t.getDate(), i = j(e?.in);
|
|
65
|
+
return i.setFullYear(s, r, o - 1), i.setHours(0, 0, 0, 0), i;
|
|
66
|
+
}
|
|
67
|
+
function fe(e) {
|
|
68
|
+
const t = j(e?.in), s = J(e?.in, 0);
|
|
69
|
+
return s.setFullYear(t.getFullYear(), t.getMonth(), t.getDate() - 1), s.setHours(23, 59, 59, 999), s;
|
|
70
|
+
}
|
|
71
|
+
function De(e, t, s) {
|
|
72
|
+
return H(e, t * 7, s);
|
|
73
|
+
}
|
|
74
|
+
function xe(e, t, s) {
|
|
75
|
+
return De(e, -1, s);
|
|
76
|
+
}
|
|
77
|
+
function ke(e, t, s) {
|
|
78
|
+
return z(e, -1, s);
|
|
79
|
+
}
|
|
80
|
+
function N(e, t) {
|
|
81
|
+
return +W(e) == +W(t);
|
|
82
|
+
}
|
|
83
|
+
const I = (e) => {
|
|
84
|
+
const t = /* @__PURE__ */ new Date();
|
|
85
|
+
switch (e) {
|
|
86
|
+
case n.Today:
|
|
87
|
+
return {
|
|
88
|
+
startDate: me(),
|
|
89
|
+
endDate: pe()
|
|
90
|
+
};
|
|
91
|
+
case n.Yesterday:
|
|
92
|
+
return {
|
|
93
|
+
startDate: he(),
|
|
94
|
+
endDate: fe()
|
|
95
|
+
};
|
|
96
|
+
case n.ThisWeek:
|
|
97
|
+
return {
|
|
98
|
+
startDate: M(t, { weekStartsOn: 1 }),
|
|
99
|
+
endDate: _(t, { weekStartsOn: 1 })
|
|
100
|
+
};
|
|
101
|
+
case n.LastWeek: {
|
|
102
|
+
const s = xe(t);
|
|
103
|
+
return {
|
|
104
|
+
startDate: M(s, { weekStartsOn: 1 }),
|
|
105
|
+
endDate: _(s, { weekStartsOn: 1 })
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
case n.ThisMonth:
|
|
109
|
+
return {
|
|
110
|
+
startDate: w(t),
|
|
111
|
+
endDate: S(t)
|
|
112
|
+
};
|
|
113
|
+
case n.LastMonth: {
|
|
114
|
+
const s = ke(t);
|
|
115
|
+
return {
|
|
116
|
+
startDate: w(s),
|
|
117
|
+
endDate: S(s)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
default:
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}, be = (e, t) => {
|
|
124
|
+
if (!e || !t)
|
|
125
|
+
return n.Today;
|
|
126
|
+
const s = [
|
|
127
|
+
n.Today,
|
|
128
|
+
n.Yesterday,
|
|
129
|
+
n.ThisWeek,
|
|
130
|
+
n.LastWeek,
|
|
131
|
+
n.ThisMonth,
|
|
132
|
+
n.LastMonth
|
|
133
|
+
];
|
|
134
|
+
for (const r of s) {
|
|
135
|
+
const o = I(r);
|
|
136
|
+
if (o && N(e, o.startDate) && N(t, o.endDate))
|
|
137
|
+
return r;
|
|
138
|
+
}
|
|
139
|
+
return n.Custom;
|
|
140
|
+
}, ge = ({
|
|
141
|
+
selectedQuickOption: e,
|
|
142
|
+
setSelectedQuickOption: t,
|
|
143
|
+
["data-testid"]: s = "kibble-datetime-picker-quick-options"
|
|
144
|
+
}) => {
|
|
145
|
+
const { setFocusedInput: r, onQuickOptionSelect: o } = T(), { setOpen: i } = U(), u = (c) => {
|
|
146
|
+
if (t(c), c === n.Custom) {
|
|
147
|
+
r(p.StartDate);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const m = I(c);
|
|
151
|
+
m && (o(m), i(!1));
|
|
152
|
+
};
|
|
153
|
+
return /* @__PURE__ */ a.jsx(v, { className: "DateTimePicker__QuickFilters", flexDirection: "column", gap: 2, w: "100%", maxW: "120px", children: le.map((c) => /* @__PURE__ */ a.jsx(
|
|
154
|
+
R,
|
|
155
|
+
{
|
|
156
|
+
className: "DateTimePicker__Option",
|
|
157
|
+
"data-testid": `${s}-option-${c.value}`,
|
|
158
|
+
variant: "secondarySubtle",
|
|
159
|
+
...c.iconName && { iconName: c.iconName, iconPosition: "right" },
|
|
160
|
+
...e === c.value && { active: !0 },
|
|
161
|
+
onClick: () => u(c.value),
|
|
162
|
+
children: c.label
|
|
163
|
+
},
|
|
164
|
+
c.value
|
|
165
|
+
)) });
|
|
166
|
+
}, F = ({
|
|
167
|
+
label: e,
|
|
168
|
+
rangeType: t
|
|
169
|
+
}) => {
|
|
170
|
+
const { startDate: s, endDate: r, dateFormat: o, focusedInput: i, setFocusedInput: u, onTimeChange: c } = T(), m = d(
|
|
171
|
+
() => (t === p.StartDate ? s : r) || /* @__PURE__ */ new Date(),
|
|
172
|
+
[s, r, t]
|
|
173
|
+
), k = d(() => K(m, o), [m, o]), h = (l) => {
|
|
174
|
+
l && c(l, t);
|
|
175
|
+
};
|
|
176
|
+
return /* @__PURE__ */ a.jsxs(
|
|
177
|
+
ae,
|
|
178
|
+
{
|
|
179
|
+
alignItems: "center",
|
|
180
|
+
templateColumns: "repeat(5, 1fr)",
|
|
181
|
+
gap: 1,
|
|
182
|
+
bgColor: "background.secondaryAlpha",
|
|
183
|
+
borderRadius: "md",
|
|
184
|
+
p: 1,
|
|
185
|
+
flex: "0 0 50%",
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ a.jsx(C, { colSpan: 1, children: /* @__PURE__ */ a.jsx(Z, { size: "sm", fontWeight: "semibold", textAlign: "center", children: e }) }),
|
|
188
|
+
/* @__PURE__ */ a.jsx(C, { colSpan: 2, children: /* @__PURE__ */ a.jsx(
|
|
189
|
+
ee,
|
|
190
|
+
{
|
|
191
|
+
readOnly: !0,
|
|
192
|
+
value: k,
|
|
193
|
+
onClick: () => u(t),
|
|
194
|
+
...i === t && {
|
|
195
|
+
"data-focus": !0
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
) }),
|
|
199
|
+
/* @__PURE__ */ a.jsx(C, { colSpan: 2, children: /* @__PURE__ */ a.jsx(
|
|
200
|
+
te,
|
|
201
|
+
{
|
|
202
|
+
minuteInterval: 1,
|
|
203
|
+
initialTime: m,
|
|
204
|
+
onClose: (l) => h(l),
|
|
205
|
+
inputProps: { rightElement: void 0, onClick: () => u(t) }
|
|
206
|
+
}
|
|
207
|
+
) })
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
}, Ce = ({ isSingleView: e }) => {
|
|
212
|
+
const { focusedInput: t, setFocusedInput: s } = T();
|
|
213
|
+
return O(() => {
|
|
214
|
+
t || s(p.StartDate);
|
|
215
|
+
}, [t, s]), /* @__PURE__ */ a.jsxs(x, { className: "DateTimePicker__CustomFilters", mt: -1, children: [
|
|
216
|
+
/* @__PURE__ */ a.jsxs(
|
|
217
|
+
v,
|
|
218
|
+
{
|
|
219
|
+
className: "DateTimePicker__CustomFilters__RangeSelectors",
|
|
220
|
+
flexDirection: e ? "column" : "row",
|
|
221
|
+
alignItems: "center",
|
|
222
|
+
gap: 2,
|
|
223
|
+
justifyContent: "space-between",
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ a.jsx(F, { label: "Start", rangeType: p.StartDate }),
|
|
226
|
+
/* @__PURE__ */ a.jsx(F, { label: "End", rangeType: p.EndDate })
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ a.jsxs(x, { className: "CalendarView", bgColor: "background.secondaryAlpha", borderRadius: "md", p: 1, mt: 5, children: [
|
|
231
|
+
/* @__PURE__ */ a.jsx(x, { className: "CalendarView__Header", bgColor: "background.accent.subtle", borderRadius: "md", children: /* @__PURE__ */ a.jsx(A, { triggerProps: { variant: "ghostNeutral" } }) }),
|
|
232
|
+
/* @__PURE__ */ a.jsx(x, { className: "CalendarView__Body", children: /* @__PURE__ */ a.jsx(G, { showMonthLabels: !0 }) })
|
|
233
|
+
] })
|
|
234
|
+
] });
|
|
235
|
+
}, Ae = ({
|
|
236
|
+
trigger: e,
|
|
237
|
+
calendarView: t = "double",
|
|
238
|
+
portalled: s = !0,
|
|
239
|
+
showQuickOptions: r = !0,
|
|
240
|
+
["data-testid"]: o = "kibble-datetime-picker",
|
|
241
|
+
...i
|
|
242
|
+
}) => {
|
|
243
|
+
const u = d(() => {
|
|
244
|
+
const P = /* @__PURE__ */ new Date();
|
|
245
|
+
return {
|
|
246
|
+
startDate: Y(P),
|
|
247
|
+
endDate: L(P)
|
|
248
|
+
};
|
|
249
|
+
}, []), { contentRef: c } = q(), k = ne({ recipe: V })(), h = X(), l = d(() => r ? be(i.startDate || null, i.endDate || null) : n.Custom, [r, i.startDate, i.endDate]), [f, y] = $(l);
|
|
250
|
+
O(() => {
|
|
251
|
+
y(l);
|
|
252
|
+
}, [l]);
|
|
253
|
+
const D = d(
|
|
254
|
+
() => ["base", "sm"].includes(h) ? "single" : t,
|
|
255
|
+
[t, h]
|
|
256
|
+
), B = d(() => ue[D], [D]), b = d(() => D === "single", [D]), g = d(
|
|
257
|
+
() => f === n.Custom,
|
|
258
|
+
[f]
|
|
259
|
+
), E = d(() => g ? "max-content" : "160px", [g]);
|
|
260
|
+
return /* @__PURE__ */ a.jsxs(
|
|
261
|
+
Q,
|
|
262
|
+
{
|
|
263
|
+
...i,
|
|
264
|
+
startDate: i.startDate || u.startDate,
|
|
265
|
+
endDate: i.endDate || u.endDate,
|
|
266
|
+
withDateRange: !0,
|
|
267
|
+
numberOfMonths: B,
|
|
268
|
+
sameWidth: !0,
|
|
269
|
+
children: [
|
|
270
|
+
/* @__PURE__ */ a.jsx(oe, { asChild: !0, w: "max-content", children: e || /* @__PURE__ */ a.jsx(R, { variant: "secondarySubtle", iconName: "calendarInfo", "data-testid": `${o}-default-trigger`, children: "Date/Time Range" }) }),
|
|
271
|
+
/* @__PURE__ */ a.jsx(re, { container: c || void 0, disabled: !s, children: /* @__PURE__ */ a.jsx(ie, { className: "DateTimePicker", "data-testid": o, children: /* @__PURE__ */ a.jsx(
|
|
272
|
+
ce,
|
|
273
|
+
{
|
|
274
|
+
className: "DateTimePicker__Content",
|
|
275
|
+
"data-testid": `${o}-content`,
|
|
276
|
+
css: {
|
|
277
|
+
...k.content,
|
|
278
|
+
"--popover-size": E,
|
|
279
|
+
maxW: r ? b ? "550px" : "890px" : b ? "390px" : "730px",
|
|
280
|
+
...g && { minW: r ? "550px" : "390px" }
|
|
281
|
+
},
|
|
282
|
+
children: /* @__PURE__ */ a.jsx(de, { css: { "--popover-padding": 0 }, children: /* @__PURE__ */ a.jsxs(v, { className: "DateTimePicker__Container", "data-testid": `${o}-container`, p: 5, children: [
|
|
283
|
+
r && /* @__PURE__ */ a.jsx(
|
|
284
|
+
ge,
|
|
285
|
+
{
|
|
286
|
+
selectedQuickOption: f,
|
|
287
|
+
setSelectedQuickOption: y
|
|
288
|
+
}
|
|
289
|
+
),
|
|
290
|
+
f === n.Custom && /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
291
|
+
r && /* @__PURE__ */ a.jsx(se, { orientation: "vertical", my: -5, mx: 5 }),
|
|
292
|
+
/* @__PURE__ */ a.jsx(Ce, { isSingleView: b })
|
|
293
|
+
] })
|
|
294
|
+
] }) })
|
|
295
|
+
}
|
|
296
|
+
) }) })
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
};
|
|
301
|
+
export {
|
|
302
|
+
Ae as D,
|
|
303
|
+
n as a,
|
|
304
|
+
ze as c
|
|
305
|
+
};
|
|
306
|
+
//# sourceMappingURL=dateTimePicker.component-BwKD6TeU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateTimePicker.component-BwKD6TeU.js","sources":["../../src/components/DateTimePicker/dateTimePicker.types.ts","../../src/components/DateTimePicker/dateTimePicker.records.ts","../../node_modules/date-fns/startOfToday.js","../../node_modules/date-fns/endOfToday.js","../../node_modules/date-fns/startOfYesterday.js","../../node_modules/date-fns/endOfYesterday.js","../../node_modules/date-fns/addWeeks.js","../../node_modules/date-fns/subWeeks.js","../../node_modules/date-fns/subMonths.js","../../node_modules/date-fns/isEqual.js","../../src/components/DateTimePicker/utils/quickOptions.ts","../../src/components/DateTimePicker/components/DateTimePickerQuickOptions/dateTimePickerQuickOptions.component.tsx","../../src/components/DateTimePicker/components/DateTimePickerRangeSelector/dateTimePickerRangeSelector.component.tsx","../../src/components/DateTimePicker/components/DateTimePickerCustomView/dateTimePickerCustomView.component.tsx","../../src/components/DateTimePicker/dateTimePicker.component.tsx"],"sourcesContent":["export enum DateTimePickerDefaultOptionValue {\n Today = 'Today',\n Yesterday = 'Yesterday',\n ThisWeek = 'ThisWeek',\n LastWeek = 'LastWeek',\n ThisMonth = 'ThisMonth',\n LastMonth = 'LastMonth',\n Custom = 'Custom',\n}\n\nexport const calendarViews = ['single', 'double'] as const;\nexport type CalendarView = (typeof calendarViews)[number];\n","import { IconName } from 'components/Icon/icon.types';\nimport { CalendarView, DateTimePickerDefaultOptionValue } from './dateTimePicker.types';\n\nexport const dateTimePickerDefaultOptions: {\n label: string;\n value: DateTimePickerDefaultOptionValue;\n iconName?: IconName;\n}[] = [\n {\n label: 'Today',\n value: DateTimePickerDefaultOptionValue.Today,\n },\n {\n label: 'Yesterday',\n value: DateTimePickerDefaultOptionValue.Yesterday,\n },\n {\n label: 'This Week',\n value: DateTimePickerDefaultOptionValue.ThisWeek,\n },\n {\n label: 'Last Week',\n value: DateTimePickerDefaultOptionValue.LastWeek,\n },\n {\n label: 'This Month',\n value: DateTimePickerDefaultOptionValue.ThisMonth,\n },\n {\n label: 'Last Month',\n value: DateTimePickerDefaultOptionValue.LastMonth,\n },\n {\n label: 'Custom',\n value: DateTimePickerDefaultOptionValue.Custom,\n iconName: 'calendarPen',\n },\n];\n\nexport const CalendarViewToNumberOfMonthsMap: Record<CalendarView, number> = {\n single: 1,\n double: 2,\n};\n","import { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link startOfToday} function options.\n */\n\n/**\n * @name startOfToday\n * @category Day Helpers\n * @summary Return the start of today.\n * @pure false\n *\n * @description\n * Return the start of today.\n *\n * @typeParam ContextDate - The `Date` type of the context function.\n *\n * @param options - An object with options\n *\n * @returns The start of today\n *\n * @example\n * // If today is 6 October 2014:\n * const result = startOfToday()\n * //=> Mon Oct 6 2014 00:00:00\n */\nexport function startOfToday(options) {\n return startOfDay(Date.now(), options);\n}\n\n// Fallback for modularized imports:\nexport default startOfToday;\n","import { endOfDay } from \"./endOfDay.js\";\n\n/**\n * The {@link endOfToday} function options.\n */\n\n/**\n * @name endOfToday\n * @category Day Helpers\n * @summary Return the end of today.\n * @pure false\n *\n * @description\n * Return the end of today.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param options - The options\n *\n * @returns The end of today\n *\n * @example\n * // If today is 6 October 2014:\n * const result = endOfToday()\n * //=> Mon Oct 6 2014 23:59:59.999\n */\nexport function endOfToday(options) {\n return endOfDay(Date.now(), options);\n}\n\n// Fallback for modularized imports:\nexport default endOfToday;\n","import { constructNow } from \"./constructNow.js\";\n\n/**\n * The {@link startOfYesterday} function options.\n */\n\n/**\n * @name startOfYesterday\n * @category Day Helpers\n * @summary Return the start of yesterday.\n * @pure false\n *\n * @typeParam ContextDate - The `Date` type of the context function.\n *\n * @param options - An object with options\n *\n * @description\n * Return the start of yesterday.\n *\n * @returns The start of yesterday\n *\n * @example\n * // If today is 6 October 2014:\n * const result = startOfYesterday()\n * //=> Sun Oct 5 2014 00:00:00\n */\nexport function startOfYesterday(options) {\n const now = constructNow(options?.in);\n const year = now.getFullYear();\n const month = now.getMonth();\n const day = now.getDate();\n\n const date = constructNow(options?.in);\n date.setFullYear(year, month, day - 1);\n date.setHours(0, 0, 0, 0);\n return date;\n}\n\n// Fallback for modularized imports:\nexport default startOfYesterday;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { constructNow } from \"./constructNow.js\";\n\n/**\n * The {@link endOfYesterday} function options.\n */\n\n/**\n * @name endOfYesterday\n * @category Day Helpers\n * @summary Return the end of yesterday.\n * @pure false\n *\n * @description\n * Return the end of yesterday.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @returns The end of yesterday\n *\n * @example\n * // If today is 6 October 2014:\n * const result = endOfYesterday()\n * //=> Sun Oct 5 2014 23:59:59.999\n */\nexport function endOfYesterday(options) {\n const now = constructNow(options?.in);\n const date = constructFrom(options?.in, 0);\n date.setFullYear(now.getFullYear(), now.getMonth(), now.getDate() - 1);\n date.setHours(23, 59, 59, 999);\n return date;\n}\n\n// Fallback for modularized imports:\nexport default endOfYesterday;\n","import { addDays } from \"./addDays.js\";\n\n/**\n * The {@link addWeeks} function options.\n */\n\n/**\n * @name addWeeks\n * @category Week Helpers\n * @summary Add the specified number of weeks to the given date.\n *\n * @description\n * Add the specified number of weeks to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of weeks to be added.\n * @param options - An object with options\n *\n * @returns The new date with the weeks added\n *\n * @example\n * // Add 4 weeks to 1 September 2014:\n * const result = addWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Sep 29 2014 00:00:00\n */\nexport function addWeeks(date, amount, options) {\n return addDays(date, amount * 7, options);\n}\n\n// Fallback for modularized imports:\nexport default addWeeks;\n","import { addWeeks } from \"./addWeeks.js\";\n\n/**\n * The {@link subWeeks} function options.\n */\n\n/**\n * @name subWeeks\n * @category Week Helpers\n * @summary Subtract the specified number of weeks from the given date.\n *\n * @description\n * Subtract the specified number of weeks from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of weeks to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the weeks subtracted\n *\n * @example\n * // Subtract 4 weeks from 1 September 2014:\n * const result = subWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Aug 04 2014 00:00:00\n */\nexport function subWeeks(date, amount, options) {\n return addWeeks(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subWeeks;\n","import { addMonths } from \"./addMonths.js\";\n\n/**\n * The subMonths function options.\n */\n\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the months subtracted\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * const result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function subMonths(date, amount, options) {\n return addMonths(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subMonths;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * @name isEqual\n * @category Common Helpers\n * @summary Are the given dates equal?\n *\n * @description\n * Are the given dates equal?\n *\n * @param dateLeft - The first date to compare\n * @param dateRight - The second date to compare\n *\n * @returns The dates are equal\n *\n * @example\n * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?\n * const result = isEqual(\n * new Date(2014, 6, 2, 6, 30, 45, 0),\n * new Date(2014, 6, 2, 6, 30, 45, 500)\n * )\n * //=> false\n */\nexport function isEqual(leftDate, rightDate) {\n return +toDate(leftDate) === +toDate(rightDate);\n}\n\n// Fallback for modularized imports:\nexport default isEqual;\n","import startOfToday from 'date-fns/startOfToday';\nimport endOfToday from 'date-fns/endOfToday';\nimport startOfYesterday from 'date-fns/startOfYesterday';\nimport endOfYesterday from 'date-fns/endOfYesterday';\nimport startOfWeek from 'date-fns/startOfWeek';\nimport endOfWeek from 'date-fns/endOfWeek';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport endOfMonth from 'date-fns/endOfMonth';\nimport subWeeks from 'date-fns/subWeeks';\nimport subMonths from 'date-fns/subMonths';\nimport isEqual from 'date-fns/isEqual';\nimport { DateTimePickerDefaultOptionValue } from '../dateTimePicker.types';\n\n/**\n * Utility function to get the date range for a given quick option\n */\nexport const getQuickOptionDateRange = (\n option: DateTimePickerDefaultOptionValue,\n): { startDate: Date; endDate: Date } | null => {\n const today = new Date();\n\n switch (option) {\n case DateTimePickerDefaultOptionValue.Today:\n return {\n startDate: startOfToday(),\n endDate: endOfToday(),\n };\n case DateTimePickerDefaultOptionValue.Yesterday:\n return {\n startDate: startOfYesterday(),\n endDate: endOfYesterday(),\n };\n case DateTimePickerDefaultOptionValue.ThisWeek:\n return {\n startDate: startOfWeek(today, { weekStartsOn: 1 }),\n endDate: endOfWeek(today, { weekStartsOn: 1 }),\n };\n case DateTimePickerDefaultOptionValue.LastWeek: {\n const lastWeekDate = subWeeks(today, 1);\n return {\n startDate: startOfWeek(lastWeekDate, { weekStartsOn: 1 }),\n endDate: endOfWeek(lastWeekDate, { weekStartsOn: 1 }),\n };\n }\n case DateTimePickerDefaultOptionValue.ThisMonth:\n return {\n startDate: startOfMonth(today),\n endDate: endOfMonth(today),\n };\n case DateTimePickerDefaultOptionValue.LastMonth: {\n const lastMonthDate = subMonths(today, 1);\n return {\n startDate: startOfMonth(lastMonthDate),\n endDate: endOfMonth(lastMonthDate),\n };\n }\n default:\n return null;\n }\n};\n\n/**\n * Matches provided dates to a quick option\n * Returns the matching option, or Custom if no match, or Today if no dates provided\n */\nexport const matchDatesToQuickOption = (\n startDate: Date | null,\n endDate: Date | null,\n): DateTimePickerDefaultOptionValue => {\n // If no dates provided, default to Today\n if (!startDate || !endDate) {\n return DateTimePickerDefaultOptionValue.Today;\n }\n\n // Try to match against each quick option (excluding Custom)\n const optionsToCheck = [\n DateTimePickerDefaultOptionValue.Today,\n DateTimePickerDefaultOptionValue.Yesterday,\n DateTimePickerDefaultOptionValue.ThisWeek,\n DateTimePickerDefaultOptionValue.LastWeek,\n DateTimePickerDefaultOptionValue.ThisMonth,\n DateTimePickerDefaultOptionValue.LastMonth,\n ];\n\n for (const option of optionsToCheck) {\n const optionRange = getQuickOptionDateRange(option);\n if (optionRange) {\n // Compare dates using isEqual for exact matches\n if (isEqual(startDate, optionRange.startDate) && isEqual(endDate, optionRange.endDate)) {\n return option;\n }\n }\n }\n\n // No match found, return Custom\n return DateTimePickerDefaultOptionValue.Custom;\n};\n","import React from 'react';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { dateTimePickerDefaultOptions } from '../../dateTimePicker.records';\nimport { Button } from 'components/Button';\nimport { DateTimePickerDefaultOptionValue } from '../../dateTimePicker.types';\nimport { usePopoverContext } from '@chakra-ui/react/popover';\nimport { FocusedInput, useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\nimport { getQuickOptionDateRange } from '../../utils/quickOptions';\n\ninterface DateTimePickerQuickOptionsProps {\n /** The currently selected quick option. */\n selectedQuickOption: DateTimePickerDefaultOptionValue;\n /** Callback function to set the selected quick option. */\n setSelectedQuickOption: (option: DateTimePickerDefaultOptionValue) => void;\n /** Data test id for the quick options.\n * @default kibble-datetime-picker-quick-options\n */\n 'data-testid'?: string;\n}\n\nexport const DateTimePickerQuickOptions = ({\n selectedQuickOption,\n setSelectedQuickOption,\n ['data-testid']: dataTestId = 'kibble-datetime-picker-quick-options',\n}: DateTimePickerQuickOptionsProps): React.JSX.Element => {\n const { setFocusedInput, onQuickOptionSelect } = useDatePickerContext();\n const { setOpen } = usePopoverContext();\n\n const handleOptionClick = (option: DateTimePickerDefaultOptionValue): void => {\n setSelectedQuickOption(option);\n\n if (option === DateTimePickerDefaultOptionValue.Custom) {\n setFocusedInput(FocusedInput.StartDate);\n return;\n }\n\n const dates = getQuickOptionDateRange(option);\n if (dates) {\n onQuickOptionSelect(dates);\n setOpen(false);\n }\n };\n\n return (\n <Flex className=\"DateTimePicker__QuickFilters\" flexDirection=\"column\" gap={2} w=\"100%\" maxW=\"120px\">\n {dateTimePickerDefaultOptions.map((option) => (\n <Button\n className=\"DateTimePicker__Option\"\n data-testid={`${dataTestId}-option-${option.value}`}\n key={option.value}\n variant=\"secondarySubtle\"\n {...(option.iconName && { iconName: option.iconName, iconPosition: 'right' })}\n {...(selectedQuickOption === option.value && { active: true })}\n onClick={() => handleOptionClick(option.value)}\n >\n {option.label}\n </Button>\n ))}\n </Flex>\n );\n};\n","import React, { useMemo } from 'react';\nimport { Grid, GridItem } from '@chakra-ui/react/grid';\nimport { FocusedInput, useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\nimport { Text } from 'components/Text/text.component';\nimport { TextInput } from 'components/TextInput/textInput.component';\nimport { TimePicker } from 'components/TimePicker/timePicker.component';\nimport format from 'date-fns/format';\n\ninterface DateTimePickerRangeSelectorProps {\n /** Label for the range selector. */\n label: string;\n /** Type of range selector. */\n rangeType: FocusedInput;\n}\n\nexport const DateTimePickerRangeSelector = ({\n label,\n rangeType,\n}: DateTimePickerRangeSelectorProps): React.JSX.Element => {\n const { startDate, endDate, dateFormat, focusedInput, setFocusedInput, onTimeChange } = useDatePickerContext();\n const _date = useMemo(\n () => (rangeType === FocusedInput.StartDate ? startDate : endDate) || new Date(),\n [startDate, endDate, rangeType],\n );\n const formattedDate = useMemo(() => format(_date, dateFormat), [_date, dateFormat]);\n\n const handleTimeChange = (date?: Date): void => {\n if (!date) return;\n onTimeChange(date, rangeType);\n };\n\n return (\n <Grid\n alignItems=\"center\"\n templateColumns=\"repeat(5, 1fr)\"\n gap={1}\n bgColor=\"background.secondaryAlpha\"\n borderRadius=\"md\"\n p={1}\n flex=\"0 0 50%\"\n >\n <GridItem colSpan={1}>\n <Text size=\"sm\" fontWeight=\"semibold\" textAlign=\"center\">\n {label}\n </Text>\n </GridItem>\n <GridItem colSpan={2}>\n <TextInput\n readOnly\n value={formattedDate}\n onClick={() => setFocusedInput(rangeType)}\n {...(focusedInput === rangeType && {\n 'data-focus': true,\n })}\n />\n </GridItem>\n <GridItem colSpan={2}>\n <TimePicker\n minuteInterval={1}\n initialTime={_date}\n onClose={(time) => handleTimeChange(time)}\n inputProps={{ rightElement: undefined, onClick: () => setFocusedInput(rangeType) }}\n />\n </GridItem>\n </Grid>\n );\n};\n","import React, { useEffect } from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { DateTimePickerRangeSelector } from '../DateTimePickerRangeSelector/dateTimePickerRangeSelector.component';\nimport { DatePickerHeader } from 'components/DatePicker/components/DatePickerHeader/datePickerHeader.component';\nimport { DatePickerCalendar } from 'components/DatePicker/components/DatePickerCalendar/datePickerCalendar.component';\nimport { FocusedInput, useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\n\ninterface DateTimePickerCustomViewProps {\n /** Determines if the calendar view is single. */\n isSingleView: boolean;\n}\n\nexport const DateTimePickerCustomView = ({ isSingleView }: DateTimePickerCustomViewProps): React.JSX.Element => {\n const { focusedInput, setFocusedInput } = useDatePickerContext();\n\n useEffect(() => {\n if (!focusedInput) {\n setFocusedInput(FocusedInput.StartDate);\n }\n }, [focusedInput, setFocusedInput]);\n\n return (\n <Box className=\"DateTimePicker__CustomFilters\" mt={-1}>\n <Flex\n className=\"DateTimePicker__CustomFilters__RangeSelectors\"\n flexDirection={isSingleView ? 'column' : 'row'}\n alignItems=\"center\"\n gap={2}\n justifyContent=\"space-between\"\n >\n <DateTimePickerRangeSelector label=\"Start\" rangeType={FocusedInput.StartDate} />\n <DateTimePickerRangeSelector label=\"End\" rangeType={FocusedInput.EndDate} />\n </Flex>\n <Box className=\"CalendarView\" bgColor=\"background.secondaryAlpha\" borderRadius=\"md\" p={1} mt={5}>\n <Box className=\"CalendarView__Header\" bgColor=\"background.accent.subtle\" borderRadius=\"md\">\n <DatePickerHeader triggerProps={{ variant: 'ghostNeutral' }} />\n </Box>\n <Box className=\"CalendarView__Body\">\n <DatePickerCalendar showMonthLabels />\n </Box>\n </Box>\n </Box>\n );\n};\n","import React, { useEffect, useMemo, useState } from 'react';\nimport { Popover as CPopover } from '@chakra-ui/react/popover';\nimport { Button } from 'components/Button/button.component';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { CalendarViewToNumberOfMonthsMap } from './dateTimePicker.records';\nimport { CalendarView, DateTimePickerDefaultOptionValue } from './dateTimePicker.types';\nimport { DatePickerProvider } from 'components/DatePicker/context/datePicker.provider';\nimport { DateProps } from 'components/DatePicker/datePicker.types';\nimport { Placement } from 'shared/types/placement';\nimport { usePortalContentRef } from 'hooks/usePortalContentRef';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { popoverRecipe } from 'components/Popover/popover.recipe';\nimport { DateTimePickerQuickOptions } from './components/DateTimePickerQuickOptions/dateTimePickerQuickOptions.component';\nimport startOfDay from 'date-fns/startOfDay';\nimport endOfDay from 'date-fns/endOfDay';\nimport { matchDatesToQuickOption } from './utils/quickOptions';\nimport { useBreakpoint } from 'hooks/useBreakpoint';\nimport { DateTimePickerCustomView } from './components/DateTimePickerCustomView/dateTimePickerCustomView.component';\nimport { Divider } from 'components/Divider/divider.component';\n\nexport interface DateTimePickerProps extends DateProps {\n /**\n * Controls the number of months displayed in the calendar.\n * @default double\n */\n calendarView?: CalendarView;\n /** Custom element to trigger the date time picker. If not provided, a button will be rendered. */\n trigger?: React.ReactNode;\n /**\n * Placement of the calendar popover\n * @default bottom\n */\n placement?: Placement;\n /**\n * If true, the date time picker will be rendered in a portal.\n * @default true\n */\n portalled?: boolean;\n /**\n * Whether to show the left side quick options in the calendar.\n * @default true\n */\n showQuickOptions?: boolean;\n /** Data test id for the date time picker.\n * @default kibble-datetime-picker\n */\n 'data-testid'?: string;\n}\n\nexport const DateTimePicker = ({\n trigger,\n calendarView = 'double',\n portalled = true,\n showQuickOptions = true,\n ['data-testid']: dataTestId = 'kibble-datetime-picker',\n ...rest\n}: DateTimePickerProps): React.JSX.Element => {\n const defaultDates = useMemo(() => {\n const today = new Date();\n return {\n startDate: startOfDay(today),\n endDate: endOfDay(today),\n };\n }, []);\n const { contentRef } = usePortalContentRef();\n const recipe = useSlotRecipe({ recipe: popoverRecipe });\n const styles = recipe();\n const breakpoint = useBreakpoint();\n\n // Initialize selected quick option based on provided dates\n const initialQuickOption = useMemo(() => {\n return showQuickOptions\n ? matchDatesToQuickOption(rest.startDate || null, rest.endDate || null)\n : DateTimePickerDefaultOptionValue.Custom;\n }, [showQuickOptions, rest.startDate, rest.endDate]);\n\n const [selectedQuickOption, setSelectedQuickOption] = useState<DateTimePickerDefaultOptionValue>(initialQuickOption);\n\n // Sync selectedQuickOption when props change\n useEffect(() => {\n setSelectedQuickOption(initialQuickOption);\n }, [initialQuickOption]);\n\n const _calendarView = useMemo(\n () => (['base', 'sm'].includes(breakpoint) ? 'single' : calendarView),\n [calendarView, breakpoint],\n );\n const numberOfMonths = useMemo(() => CalendarViewToNumberOfMonthsMap[_calendarView], [_calendarView]);\n const isSingleView = useMemo(() => _calendarView === 'single', [_calendarView]);\n const isCustomSelected = useMemo(\n () => selectedQuickOption === DateTimePickerDefaultOptionValue.Custom,\n [selectedQuickOption],\n );\n const popoverSize = useMemo(() => (isCustomSelected ? 'max-content' : '160px'), [isCustomSelected]);\n\n return (\n <DatePickerProvider\n {...rest}\n startDate={rest.startDate || defaultDates.startDate}\n endDate={rest.endDate || defaultDates.endDate}\n withDateRange\n numberOfMonths={numberOfMonths}\n sameWidth={true}\n >\n <CPopover.Trigger asChild w=\"max-content\">\n {trigger || (\n <Button variant=\"secondarySubtle\" iconName=\"calendarInfo\" data-testid={`${dataTestId}-default-trigger`}>\n Date/Time Range\n </Button>\n )}\n </CPopover.Trigger>\n <Portal container={contentRef || undefined} disabled={!portalled}>\n <CPopover.Positioner className=\"DateTimePicker\" data-testid={dataTestId}>\n <CPopover.Content\n className=\"DateTimePicker__Content\"\n data-testid={`${dataTestId}-content`}\n css={{\n ...styles.content,\n '--popover-size': popoverSize,\n maxW: showQuickOptions ? (isSingleView ? '550px' : '890px') : isSingleView ? '390px' : '730px',\n ...(isCustomSelected && { minW: showQuickOptions ? '550px' : '390px' }),\n }}\n >\n <CPopover.Body css={{ '--popover-padding': 0 }}>\n <Flex className=\"DateTimePicker__Container\" data-testid={`${dataTestId}-container`} p={5}>\n {showQuickOptions && (\n <DateTimePickerQuickOptions\n selectedQuickOption={selectedQuickOption}\n setSelectedQuickOption={setSelectedQuickOption}\n />\n )}\n {selectedQuickOption === DateTimePickerDefaultOptionValue.Custom && (\n <>\n {showQuickOptions && <Divider orientation=\"vertical\" my={-5} mx={5} />}\n <DateTimePickerCustomView isSingleView={isSingleView} />\n </>\n )}\n </Flex>\n </CPopover.Body>\n </CPopover.Content>\n </CPopover.Positioner>\n </Portal>\n </DatePickerProvider>\n );\n};\n"],"names":["DateTimePickerDefaultOptionValue","calendarViews","dateTimePickerDefaultOptions","CalendarViewToNumberOfMonthsMap","startOfToday","options","startOfDay","endOfToday","endOfDay","startOfYesterday","now","constructNow","year","month","day","date","endOfYesterday","constructFrom","addWeeks","amount","addDays","subWeeks","subMonths","addMonths","isEqual","leftDate","rightDate","toDate","getQuickOptionDateRange","option","today","startOfWeek","endOfWeek","lastWeekDate","startOfMonth","endOfMonth","lastMonthDate","matchDatesToQuickOption","startDate","endDate","optionsToCheck","optionRange","DateTimePickerQuickOptions","selectedQuickOption","setSelectedQuickOption","dataTestId","setFocusedInput","onQuickOptionSelect","useDatePickerContext","setOpen","usePopoverContext","handleOptionClick","FocusedInput","dates","jsx","Flex","Button","DateTimePickerRangeSelector","label","rangeType","dateFormat","focusedInput","onTimeChange","_date","useMemo","formattedDate","format","handleTimeChange","jsxs","Grid","GridItem","Text","TextInput","TimePicker","time","DateTimePickerCustomView","isSingleView","useEffect","Box","DatePickerHeader","DatePickerCalendar","DateTimePicker","trigger","calendarView","portalled","showQuickOptions","rest","defaultDates","contentRef","usePortalContentRef","styles","useSlotRecipe","popoverRecipe","breakpoint","useBreakpoint","initialQuickOption","useState","_calendarView","numberOfMonths","isCustomSelected","popoverSize","DatePickerProvider","CPopover.Trigger","Portal","CPopover.Positioner","CPopover.Content","CPopover.Body","Fragment","Divider"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAY,IAAAA,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,YAAY,aACZA,EAAA,WAAW,YACXA,EAAA,WAAW,YACXA,EAAA,YAAY,aACZA,EAAA,YAAY,aACZA,EAAA,SAAS,UAPCA,IAAAA,KAAA,CAAA,CAAA;AAUC,MAAAC,KAAgB,CAAC,UAAU,QAAQ,GCPnCC,KAIP;AAAA,EACJ;AAAA,IACE,OAAO;AAAA,IACP,OAAOF,EAAiC;AAAA,EAC1C;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAOA,EAAiC;AAAA,EAC1C;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAOA,EAAiC;AAAA,EAC1C;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAOA,EAAiC;AAAA,EAC1C;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAOA,EAAiC;AAAA,EAC1C;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAOA,EAAiC;AAAA,EAC1C;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAOA,EAAiC;A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Q,EAAA,aAAY,YAAW,IAAI,IAAI,IAAI,GAAG;AAAA,gBACpEtD,gBAAAA,MAACqB,MAAyB,cAAAC,EAA4B,CAAA;AAAA,cAAA,EACxD,CAAA;AAAA,YAAA,EAAA,CAEJ,EACF,CAAA;AAAA,UAAA;AAAA,WAEJ,EACF,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;","x_google_ignoreList":[2,3,4,5,6,7,8,9]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const n=require("./jsx-runtime-BjDatQAs.js"),d=require("react"),W=require("./button.component-DjdgBXDC.js"),u=require("./datePicker.provider-i35-VNAb.js"),q=require("./usePortalContentRef-CTrvBQ7I.js"),F=require("./popover.recipe-CtptsJg6.js"),m=require("./format-CK7Imh-5.js"),E=require("./isToday-BgNkHh5t.js"),h=require("./endOfMonth-ClO3w4vF.js"),N=require("./popover-root-provider-CZDbUJ2K.js"),M=require("./flex-BOU6tYUd.js"),I=require("../cjs/hooks/useBreakpoint/index.cjs"),f=require("./index-BQRnVsAg.js"),L=require("./text.component-BDDz5KQP.js"),Y=require("./textInput.component-CwTc0h_F.js"),B=require("./timePicker.component-D5hw80VV.js"),R=require("./grid-item-CH3dbZHL.js"),$=require("./divider.component-BX3zyB7O.js"),G=require("./create-slot-recipe-context-HXE1VazG.js"),H=require("./index-Ts8g8jZd.js"),g=require("./popover-C7aj8Iwj.js");var r=(e=>(e.Today="Today",e.Yesterday="Yesterday",e.ThisWeek="ThisWeek",e.LastWeek="LastWeek",e.ThisMonth="ThisMonth",e.LastMonth="LastMonth",e.Custom="Custom",e))(r||{});const z=["single","double"],A=[{label:"Today",value:r.Today},{label:"Yesterday",value:r.Yesterday},{label:"This Week",value:r.ThisWeek},{label:"Last Week",value:r.LastWeek},{label:"This Month",value:r.ThisMonth},{label:"Last Month",value:r.LastMonth},{label:"Custom",value:r.Custom,iconName:"calendarPen"}],Q={single:1,double:2};function V(e){return m.startOfDay(Date.now(),e)}function J(e){return u.endOfDay(Date.now(),e)}function K(e){const t=E.constructNow(e?.in),s=t.getFullYear(),o=t.getMonth(),a=t.getDate(),i=E.constructNow(e?.in);return i.setFullYear(s,o,a-1),i.setHours(0,0,0,0),i}function U(e){const t=E.constructNow(e?.in),s=m.constructFrom(e?.in,0);return s.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()-1),s.setHours(23,59,59,999),s}function X(e,t,s){return u.addDays(e,t*7,s)}function Z(e,t,s){return X(e,-1,s)}function ee(e,t,s){return u.addMonths(e,-1,s)}function P(e,t){return+m.toDate(e)==+m.toDate(t)}const O=e=>{const t=new Date;switch(e){case r.Today:return{startDate:V(),endDate:J()};case r.Yesterday:return{startDate:K(),endDate:U()};case r.ThisWeek:return{startDate:m.startOfWeek(t,{weekStartsOn:1}),endDate:h.endOfWeek(t,{weekStartsOn:1})};case r.LastWeek:{const s=Z(t);return{startDate:m.startOfWeek(s,{weekStartsOn:1}),endDate:h.endOfWeek(s,{weekStartsOn:1})}}case r.ThisMonth:return{startDate:h.startOfMonth(t),endDate:h.endOfMonth(t)};case r.LastMonth:{const s=ee(t);return{startDate:h.startOfMonth(s),endDate:h.endOfMonth(s)}}default:return null}},te=(e,t)=>{if(!e||!t)return r.Today;const s=[r.Today,r.Yesterday,r.ThisWeek,r.LastWeek,r.ThisMonth,r.LastMonth];for(const o of s){const a=O(o);if(a&&P(e,a.startDate)&&P(t,a.endDate))return o}return r.Custom},ne=({selectedQuickOption:e,setSelectedQuickOption:t,["data-testid"]:s="kibble-datetime-picker-quick-options"})=>{const{setFocusedInput:o,onQuickOptionSelect:a}=u.useDatePickerContext(),{setOpen:i}=N.usePopoverContext(),x=c=>{if(t(c),c===r.Custom){o(u.FocusedInput.StartDate);return}const p=O(c);p&&(a(p),i(!1))};return n.jsxRuntimeExports.jsx(M.Flex,{className:"DateTimePicker__QuickFilters",flexDirection:"column",gap:2,w:"100%",maxW:"120px",children:A.map(c=>n.jsxRuntimeExports.jsx(W.Button,{className:"DateTimePicker__Option","data-testid":`${s}-option-${c.value}`,variant:"secondarySubtle",...c.iconName&&{iconName:c.iconName,iconPosition:"right"},...e===c.value&&{active:!0},onClick:()=>x(c.value),children:c.label},c.value))})},_=({label:e,rangeType:t})=>{const{startDate:s,endDate:o,dateFormat:a,focusedInput:i,setFocusedInput:x,onTimeChange:c}=u.useDatePickerContext(),p=d.useMemo(()=>(t===u.FocusedInput.StartDate?s:o)||new Date,[s,o,t]),C=d.useMemo(()=>m.format(p,a),[p,a]),D=l=>{l&&c(l,t)};return n.jsxRuntimeExports.jsxs(R.Grid,{alignItems:"center",templateColumns:"repeat(5, 1fr)",gap:1,bgColor:"background.secondaryAlpha",borderRadius:"md",p:1,flex:"0 0 50%",children:[n.jsxRuntimeExports.jsx(R.GridItem,{colSpan:1,children:n.jsxRuntimeExports.jsx(L.WrappedText,{size:"sm",fontWeight:"semibold",textAlign:"center",children:e})}),n.jsxRuntimeExports.jsx(R.GridItem,{colSpan:2,children:n.jsxRuntimeExports.jsx(Y.WrappedTextInput,{readOnly:!0,value:C,onClick:()=>x(t),...i===t&&{"data-focus":!0}})}),n.jsxRuntimeExports.jsx(R.GridItem,{colSpan:2,children:n.jsxRuntimeExports.jsx(B.TimePicker,{minuteInterval:1,initialTime:p,onClose:l=>D(l),inputProps:{rightElement:void 0,onClick:()=>x(t)}})})]})},se=({isSingleView:e})=>{const{focusedInput:t,setFocusedInput:s}=u.useDatePickerContext();return d.useEffect(()=>{t||s(u.FocusedInput.StartDate)},[t,s]),n.jsxRuntimeExports.jsxs(f.Box,{className:"DateTimePicker__CustomFilters",mt:-1,children:[n.jsxRuntimeExports.jsxs(M.Flex,{className:"DateTimePicker__CustomFilters__RangeSelectors",flexDirection:e?"column":"row",alignItems:"center",gap:2,justifyContent:"space-between",children:[n.jsxRuntimeExports.jsx(_,{label:"Start",rangeType:u.FocusedInput.StartDate}),n.jsxRuntimeExports.jsx(_,{label:"End",rangeType:u.FocusedInput.EndDate})]}),n.jsxRuntimeExports.jsxs(f.Box,{className:"CalendarView",bgColor:"background.secondaryAlpha",borderRadius:"md",p:1,mt:5,children:[n.jsxRuntimeExports.jsx(f.Box,{className:"CalendarView__Header",bgColor:"background.accent.subtle",borderRadius:"md",children:n.jsxRuntimeExports.jsx(u.DatePickerHeader,{triggerProps:{variant:"ghostNeutral"}})}),n.jsxRuntimeExports.jsx(f.Box,{className:"CalendarView__Body",children:n.jsxRuntimeExports.jsx(u.DatePickerCalendar,{showMonthLabels:!0})})]})]})},re=({trigger:e,calendarView:t="double",portalled:s=!0,showQuickOptions:o=!0,["data-testid"]:a="kibble-datetime-picker",...i})=>{const x=d.useMemo(()=>{const y=new Date;return{startDate:m.startOfDay(y),endDate:u.endOfDay(y)}},[]),{contentRef:c}=q.usePortalContentRef(),C=G.useSlotRecipe({recipe:F.popoverRecipe})(),D=I.useBreakpoint(),l=d.useMemo(()=>o?te(i.startDate||null,i.endDate||null):r.Custom,[o,i.startDate,i.endDate]),[j,T]=d.useState(l);d.useEffect(()=>{T(l)},[l]);const k=d.useMemo(()=>["base","sm"].includes(D)?"single":t,[t,D]),w=d.useMemo(()=>Q[k],[k]),b=d.useMemo(()=>k==="single",[k]),v=d.useMemo(()=>j===r.Custom,[j]),S=d.useMemo(()=>v?"max-content":"160px",[v]);return n.jsxRuntimeExports.jsxs(u.DatePickerProvider,{...i,startDate:i.startDate||x.startDate,endDate:i.endDate||x.endDate,withDateRange:!0,numberOfMonths:w,sameWidth:!0,children:[n.jsxRuntimeExports.jsx(g.PopoverTrigger,{asChild:!0,w:"max-content",children:e||n.jsxRuntimeExports.jsx(W.Button,{variant:"secondarySubtle",iconName:"calendarInfo","data-testid":`${a}-default-trigger`,children:"Date/Time Range"})}),n.jsxRuntimeExports.jsx(H.Portal,{container:c||void 0,disabled:!s,children:n.jsxRuntimeExports.jsx(g.PopoverPositioner,{className:"DateTimePicker","data-testid":a,children:n.jsxRuntimeExports.jsx(g.PopoverContent,{className:"DateTimePicker__Content","data-testid":`${a}-content`,css:{...C.content,"--popover-size":S,maxW:o?b?"550px":"890px":b?"390px":"730px",...v&&{minW:o?"550px":"390px"}},children:n.jsxRuntimeExports.jsx(g.PopoverBody,{css:{"--popover-padding":0},children:n.jsxRuntimeExports.jsxs(M.Flex,{className:"DateTimePicker__Container","data-testid":`${a}-container`,p:5,children:[o&&n.jsxRuntimeExports.jsx(ne,{selectedQuickOption:j,setSelectedQuickOption:T}),j===r.Custom&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[o&&n.jsxRuntimeExports.jsx($.Divider,{orientation:"vertical",my:-5,mx:5}),n.jsxRuntimeExports.jsx(se,{isSingleView:b})]})]})})})})})]})};exports.DateTimePicker=re;exports.DateTimePickerDefaultOptionValue=r;exports.calendarViews=z;
|
|
2
|
+
//# sourceMappingURL=dateTimePicker.component-C7SFD9Py.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateTimePicker.component-C7SFD9Py.js","sources":["../../src/components/DateTimePicker/dateTimePicker.types.ts","../../src/components/DateTimePicker/dateTimePicker.records.ts","../../node_modules/date-fns/startOfToday.js","../../node_modules/date-fns/endOfToday.js","../../node_modules/date-fns/startOfYesterday.js","../../node_modules/date-fns/endOfYesterday.js","../../node_modules/date-fns/addWeeks.js","../../node_modules/date-fns/subWeeks.js","../../node_modules/date-fns/subMonths.js","../../node_modules/date-fns/isEqual.js","../../src/components/DateTimePicker/utils/quickOptions.ts","../../src/components/DateTimePicker/components/DateTimePickerQuickOptions/dateTimePickerQuickOptions.component.tsx","../../src/components/DateTimePicker/components/DateTimePickerRangeSelector/dateTimePickerRangeSelector.component.tsx","../../src/components/DateTimePicker/components/DateTimePickerCustomView/dateTimePickerCustomView.component.tsx","../../src/components/DateTimePicker/dateTimePicker.component.tsx"],"sourcesContent":["export enum DateTimePickerDefaultOptionValue {\n Today = 'Today',\n Yesterday = 'Yesterday',\n ThisWeek = 'ThisWeek',\n LastWeek = 'LastWeek',\n ThisMonth = 'ThisMonth',\n LastMonth = 'LastMonth',\n Custom = 'Custom',\n}\n\nexport const calendarViews = ['single', 'double'] as const;\nexport type CalendarView = (typeof calendarViews)[number];\n","import { IconName } from 'components/Icon/icon.types';\nimport { CalendarView, DateTimePickerDefaultOptionValue } from './dateTimePicker.types';\n\nexport const dateTimePickerDefaultOptions: {\n label: string;\n value: DateTimePickerDefaultOptionValue;\n iconName?: IconName;\n}[] = [\n {\n label: 'Today',\n value: DateTimePickerDefaultOptionValue.Today,\n },\n {\n label: 'Yesterday',\n value: DateTimePickerDefaultOptionValue.Yesterday,\n },\n {\n label: 'This Week',\n value: DateTimePickerDefaultOptionValue.ThisWeek,\n },\n {\n label: 'Last Week',\n value: DateTimePickerDefaultOptionValue.LastWeek,\n },\n {\n label: 'This Month',\n value: DateTimePickerDefaultOptionValue.ThisMonth,\n },\n {\n label: 'Last Month',\n value: DateTimePickerDefaultOptionValue.LastMonth,\n },\n {\n label: 'Custom',\n value: DateTimePickerDefaultOptionValue.Custom,\n iconName: 'calendarPen',\n },\n];\n\nexport const CalendarViewToNumberOfMonthsMap: Record<CalendarView, number> = {\n single: 1,\n double: 2,\n};\n","import { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link startOfToday} function options.\n */\n\n/**\n * @name startOfToday\n * @category Day Helpers\n * @summary Return the start of today.\n * @pure false\n *\n * @description\n * Return the start of today.\n *\n * @typeParam ContextDate - The `Date` type of the context function.\n *\n * @param options - An object with options\n *\n * @returns The start of today\n *\n * @example\n * // If today is 6 October 2014:\n * const result = startOfToday()\n * //=> Mon Oct 6 2014 00:00:00\n */\nexport function startOfToday(options) {\n return startOfDay(Date.now(), options);\n}\n\n// Fallback for modularized imports:\nexport default startOfToday;\n","import { endOfDay } from \"./endOfDay.js\";\n\n/**\n * The {@link endOfToday} function options.\n */\n\n/**\n * @name endOfToday\n * @category Day Helpers\n * @summary Return the end of today.\n * @pure false\n *\n * @description\n * Return the end of today.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param options - The options\n *\n * @returns The end of today\n *\n * @example\n * // If today is 6 October 2014:\n * const result = endOfToday()\n * //=> Mon Oct 6 2014 23:59:59.999\n */\nexport function endOfToday(options) {\n return endOfDay(Date.now(), options);\n}\n\n// Fallback for modularized imports:\nexport default endOfToday;\n","import { constructNow } from \"./constructNow.js\";\n\n/**\n * The {@link startOfYesterday} function options.\n */\n\n/**\n * @name startOfYesterday\n * @category Day Helpers\n * @summary Return the start of yesterday.\n * @pure false\n *\n * @typeParam ContextDate - The `Date` type of the context function.\n *\n * @param options - An object with options\n *\n * @description\n * Return the start of yesterday.\n *\n * @returns The start of yesterday\n *\n * @example\n * // If today is 6 October 2014:\n * const result = startOfYesterday()\n * //=> Sun Oct 5 2014 00:00:00\n */\nexport function startOfYesterday(options) {\n const now = constructNow(options?.in);\n const year = now.getFullYear();\n const month = now.getMonth();\n const day = now.getDate();\n\n const date = constructNow(options?.in);\n date.setFullYear(year, month, day - 1);\n date.setHours(0, 0, 0, 0);\n return date;\n}\n\n// Fallback for modularized imports:\nexport default startOfYesterday;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { constructNow } from \"./constructNow.js\";\n\n/**\n * The {@link endOfYesterday} function options.\n */\n\n/**\n * @name endOfYesterday\n * @category Day Helpers\n * @summary Return the end of yesterday.\n * @pure false\n *\n * @description\n * Return the end of yesterday.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @returns The end of yesterday\n *\n * @example\n * // If today is 6 October 2014:\n * const result = endOfYesterday()\n * //=> Sun Oct 5 2014 23:59:59.999\n */\nexport function endOfYesterday(options) {\n const now = constructNow(options?.in);\n const date = constructFrom(options?.in, 0);\n date.setFullYear(now.getFullYear(), now.getMonth(), now.getDate() - 1);\n date.setHours(23, 59, 59, 999);\n return date;\n}\n\n// Fallback for modularized imports:\nexport default endOfYesterday;\n","import { addDays } from \"./addDays.js\";\n\n/**\n * The {@link addWeeks} function options.\n */\n\n/**\n * @name addWeeks\n * @category Week Helpers\n * @summary Add the specified number of weeks to the given date.\n *\n * @description\n * Add the specified number of weeks to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of weeks to be added.\n * @param options - An object with options\n *\n * @returns The new date with the weeks added\n *\n * @example\n * // Add 4 weeks to 1 September 2014:\n * const result = addWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Sep 29 2014 00:00:00\n */\nexport function addWeeks(date, amount, options) {\n return addDays(date, amount * 7, options);\n}\n\n// Fallback for modularized imports:\nexport default addWeeks;\n","import { addWeeks } from \"./addWeeks.js\";\n\n/**\n * The {@link subWeeks} function options.\n */\n\n/**\n * @name subWeeks\n * @category Week Helpers\n * @summary Subtract the specified number of weeks from the given date.\n *\n * @description\n * Subtract the specified number of weeks from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of weeks to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the weeks subtracted\n *\n * @example\n * // Subtract 4 weeks from 1 September 2014:\n * const result = subWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Aug 04 2014 00:00:00\n */\nexport function subWeeks(date, amount, options) {\n return addWeeks(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subWeeks;\n","import { addMonths } from \"./addMonths.js\";\n\n/**\n * The subMonths function options.\n */\n\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the months subtracted\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * const result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function subMonths(date, amount, options) {\n return addMonths(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subMonths;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * @name isEqual\n * @category Common Helpers\n * @summary Are the given dates equal?\n *\n * @description\n * Are the given dates equal?\n *\n * @param dateLeft - The first date to compare\n * @param dateRight - The second date to compare\n *\n * @returns The dates are equal\n *\n * @example\n * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?\n * const result = isEqual(\n * new Date(2014, 6, 2, 6, 30, 45, 0),\n * new Date(2014, 6, 2, 6, 30, 45, 500)\n * )\n * //=> false\n */\nexport function isEqual(leftDate, rightDate) {\n return +toDate(leftDate) === +toDate(rightDate);\n}\n\n// Fallback for modularized imports:\nexport default isEqual;\n","import startOfToday from 'date-fns/startOfToday';\nimport endOfToday from 'date-fns/endOfToday';\nimport startOfYesterday from 'date-fns/startOfYesterday';\nimport endOfYesterday from 'date-fns/endOfYesterday';\nimport startOfWeek from 'date-fns/startOfWeek';\nimport endOfWeek from 'date-fns/endOfWeek';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport endOfMonth from 'date-fns/endOfMonth';\nimport subWeeks from 'date-fns/subWeeks';\nimport subMonths from 'date-fns/subMonths';\nimport isEqual from 'date-fns/isEqual';\nimport { DateTimePickerDefaultOptionValue } from '../dateTimePicker.types';\n\n/**\n * Utility function to get the date range for a given quick option\n */\nexport const getQuickOptionDateRange = (\n option: DateTimePickerDefaultOptionValue,\n): { startDate: Date; endDate: Date } | null => {\n const today = new Date();\n\n switch (option) {\n case DateTimePickerDefaultOptionValue.Today:\n return {\n startDate: startOfToday(),\n endDate: endOfToday(),\n };\n case DateTimePickerDefaultOptionValue.Yesterday:\n return {\n startDate: startOfYesterday(),\n endDate: endOfYesterday(),\n };\n case DateTimePickerDefaultOptionValue.ThisWeek:\n return {\n startDate: startOfWeek(today, { weekStartsOn: 1 }),\n endDate: endOfWeek(today, { weekStartsOn: 1 }),\n };\n case DateTimePickerDefaultOptionValue.LastWeek: {\n const lastWeekDate = subWeeks(today, 1);\n return {\n startDate: startOfWeek(lastWeekDate, { weekStartsOn: 1 }),\n endDate: endOfWeek(lastWeekDate, { weekStartsOn: 1 }),\n };\n }\n case DateTimePickerDefaultOptionValue.ThisMonth:\n return {\n startDate: startOfMonth(today),\n endDate: endOfMonth(today),\n };\n case DateTimePickerDefaultOptionValue.LastMonth: {\n const lastMonthDate = subMonths(today, 1);\n return {\n startDate: startOfMonth(lastMonthDate),\n endDate: endOfMonth(lastMonthDate),\n };\n }\n default:\n return null;\n }\n};\n\n/**\n * Matches provided dates to a quick option\n * Returns the matching option, or Custom if no match, or Today if no dates provided\n */\nexport const matchDatesToQuickOption = (\n startDate: Date | null,\n endDate: Date | null,\n): DateTimePickerDefaultOptionValue => {\n // If no dates provided, default to Today\n if (!startDate || !endDate) {\n return DateTimePickerDefaultOptionValue.Today;\n }\n\n // Try to match against each quick option (excluding Custom)\n const optionsToCheck = [\n DateTimePickerDefaultOptionValue.Today,\n DateTimePickerDefaultOptionValue.Yesterday,\n DateTimePickerDefaultOptionValue.ThisWeek,\n DateTimePickerDefaultOptionValue.LastWeek,\n DateTimePickerDefaultOptionValue.ThisMonth,\n DateTimePickerDefaultOptionValue.LastMonth,\n ];\n\n for (const option of optionsToCheck) {\n const optionRange = getQuickOptionDateRange(option);\n if (optionRange) {\n // Compare dates using isEqual for exact matches\n if (isEqual(startDate, optionRange.startDate) && isEqual(endDate, optionRange.endDate)) {\n return option;\n }\n }\n }\n\n // No match found, return Custom\n return DateTimePickerDefaultOptionValue.Custom;\n};\n","import React from 'react';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { dateTimePickerDefaultOptions } from '../../dateTimePicker.records';\nimport { Button } from 'components/Button';\nimport { DateTimePickerDefaultOptionValue } from '../../dateTimePicker.types';\nimport { usePopoverContext } from '@chakra-ui/react/popover';\nimport { FocusedInput, useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\nimport { getQuickOptionDateRange } from '../../utils/quickOptions';\n\ninterface DateTimePickerQuickOptionsProps {\n /** The currently selected quick option. */\n selectedQuickOption: DateTimePickerDefaultOptionValue;\n /** Callback function to set the selected quick option. */\n setSelectedQuickOption: (option: DateTimePickerDefaultOptionValue) => void;\n /** Data test id for the quick options.\n * @default kibble-datetime-picker-quick-options\n */\n 'data-testid'?: string;\n}\n\nexport const DateTimePickerQuickOptions = ({\n selectedQuickOption,\n setSelectedQuickOption,\n ['data-testid']: dataTestId = 'kibble-datetime-picker-quick-options',\n}: DateTimePickerQuickOptionsProps): React.JSX.Element => {\n const { setFocusedInput, onQuickOptionSelect } = useDatePickerContext();\n const { setOpen } = usePopoverContext();\n\n const handleOptionClick = (option: DateTimePickerDefaultOptionValue): void => {\n setSelectedQuickOption(option);\n\n if (option === DateTimePickerDefaultOptionValue.Custom) {\n setFocusedInput(FocusedInput.StartDate);\n return;\n }\n\n const dates = getQuickOptionDateRange(option);\n if (dates) {\n onQuickOptionSelect(dates);\n setOpen(false);\n }\n };\n\n return (\n <Flex className=\"DateTimePicker__QuickFilters\" flexDirection=\"column\" gap={2} w=\"100%\" maxW=\"120px\">\n {dateTimePickerDefaultOptions.map((option) => (\n <Button\n className=\"DateTimePicker__Option\"\n data-testid={`${dataTestId}-option-${option.value}`}\n key={option.value}\n variant=\"secondarySubtle\"\n {...(option.iconName && { iconName: option.iconName, iconPosition: 'right' })}\n {...(selectedQuickOption === option.value && { active: true })}\n onClick={() => handleOptionClick(option.value)}\n >\n {option.label}\n </Button>\n ))}\n </Flex>\n );\n};\n","import React, { useMemo } from 'react';\nimport { Grid, GridItem } from '@chakra-ui/react/grid';\nimport { FocusedInput, useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\nimport { Text } from 'components/Text/text.component';\nimport { TextInput } from 'components/TextInput/textInput.component';\nimport { TimePicker } from 'components/TimePicker/timePicker.component';\nimport format from 'date-fns/format';\n\ninterface DateTimePickerRangeSelectorProps {\n /** Label for the range selector. */\n label: string;\n /** Type of range selector. */\n rangeType: FocusedInput;\n}\n\nexport const DateTimePickerRangeSelector = ({\n label,\n rangeType,\n}: DateTimePickerRangeSelectorProps): React.JSX.Element => {\n const { startDate, endDate, dateFormat, focusedInput, setFocusedInput, onTimeChange } = useDatePickerContext();\n const _date = useMemo(\n () => (rangeType === FocusedInput.StartDate ? startDate : endDate) || new Date(),\n [startDate, endDate, rangeType],\n );\n const formattedDate = useMemo(() => format(_date, dateFormat), [_date, dateFormat]);\n\n const handleTimeChange = (date?: Date): void => {\n if (!date) return;\n onTimeChange(date, rangeType);\n };\n\n return (\n <Grid\n alignItems=\"center\"\n templateColumns=\"repeat(5, 1fr)\"\n gap={1}\n bgColor=\"background.secondaryAlpha\"\n borderRadius=\"md\"\n p={1}\n flex=\"0 0 50%\"\n >\n <GridItem colSpan={1}>\n <Text size=\"sm\" fontWeight=\"semibold\" textAlign=\"center\">\n {label}\n </Text>\n </GridItem>\n <GridItem colSpan={2}>\n <TextInput\n readOnly\n value={formattedDate}\n onClick={() => setFocusedInput(rangeType)}\n {...(focusedInput === rangeType && {\n 'data-focus': true,\n })}\n />\n </GridItem>\n <GridItem colSpan={2}>\n <TimePicker\n minuteInterval={1}\n initialTime={_date}\n onClose={(time) => handleTimeChange(time)}\n inputProps={{ rightElement: undefined, onClick: () => setFocusedInput(rangeType) }}\n />\n </GridItem>\n </Grid>\n );\n};\n","import React, { useEffect } from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { DateTimePickerRangeSelector } from '../DateTimePickerRangeSelector/dateTimePickerRangeSelector.component';\nimport { DatePickerHeader } from 'components/DatePicker/components/DatePickerHeader/datePickerHeader.component';\nimport { DatePickerCalendar } from 'components/DatePicker/components/DatePickerCalendar/datePickerCalendar.component';\nimport { FocusedInput, useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\n\ninterface DateTimePickerCustomViewProps {\n /** Determines if the calendar view is single. */\n isSingleView: boolean;\n}\n\nexport const DateTimePickerCustomView = ({ isSingleView }: DateTimePickerCustomViewProps): React.JSX.Element => {\n const { focusedInput, setFocusedInput } = useDatePickerContext();\n\n useEffect(() => {\n if (!focusedInput) {\n setFocusedInput(FocusedInput.StartDate);\n }\n }, [focusedInput, setFocusedInput]);\n\n return (\n <Box className=\"DateTimePicker__CustomFilters\" mt={-1}>\n <Flex\n className=\"DateTimePicker__CustomFilters__RangeSelectors\"\n flexDirection={isSingleView ? 'column' : 'row'}\n alignItems=\"center\"\n gap={2}\n justifyContent=\"space-between\"\n >\n <DateTimePickerRangeSelector label=\"Start\" rangeType={FocusedInput.StartDate} />\n <DateTimePickerRangeSelector label=\"End\" rangeType={FocusedInput.EndDate} />\n </Flex>\n <Box className=\"CalendarView\" bgColor=\"background.secondaryAlpha\" borderRadius=\"md\" p={1} mt={5}>\n <Box className=\"CalendarView__Header\" bgColor=\"background.accent.subtle\" borderRadius=\"md\">\n <DatePickerHeader triggerProps={{ variant: 'ghostNeutral' }} />\n </Box>\n <Box className=\"CalendarView__Body\">\n <DatePickerCalendar showMonthLabels />\n </Box>\n </Box>\n </Box>\n );\n};\n","import React, { useEffect, useMemo, useState } from 'react';\nimport { Popover as CPopover } from '@chakra-ui/react/popover';\nimport { Button } from 'components/Button/button.component';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { CalendarViewToNumberOfMonthsMap } from './dateTimePicker.records';\nimport { CalendarView, DateTimePickerDefaultOptionValue } from './dateTimePicker.types';\nimport { DatePickerProvider } from 'components/DatePicker/context/datePicker.provider';\nimport { DateProps } from 'components/DatePicker/datePicker.types';\nimport { Placement } from 'shared/types/placement';\nimport { usePortalContentRef } from 'hooks/usePortalContentRef';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { popoverRecipe } from 'components/Popover/popover.recipe';\nimport { DateTimePickerQuickOptions } from './components/DateTimePickerQuickOptions/dateTimePickerQuickOptions.component';\nimport startOfDay from 'date-fns/startOfDay';\nimport endOfDay from 'date-fns/endOfDay';\nimport { matchDatesToQuickOption } from './utils/quickOptions';\nimport { useBreakpoint } from 'hooks/useBreakpoint';\nimport { DateTimePickerCustomView } from './components/DateTimePickerCustomView/dateTimePickerCustomView.component';\nimport { Divider } from 'components/Divider/divider.component';\n\nexport interface DateTimePickerProps extends DateProps {\n /**\n * Controls the number of months displayed in the calendar.\n * @default double\n */\n calendarView?: CalendarView;\n /** Custom element to trigger the date time picker. If not provided, a button will be rendered. */\n trigger?: React.ReactNode;\n /**\n * Placement of the calendar popover\n * @default bottom\n */\n placement?: Placement;\n /**\n * If true, the date time picker will be rendered in a portal.\n * @default true\n */\n portalled?: boolean;\n /**\n * Whether to show the left side quick options in the calendar.\n * @default true\n */\n showQuickOptions?: boolean;\n /** Data test id for the date time picker.\n * @default kibble-datetime-picker\n */\n 'data-testid'?: string;\n}\n\nexport const DateTimePicker = ({\n trigger,\n calendarView = 'double',\n portalled = true,\n showQuickOptions = true,\n ['data-testid']: dataTestId = 'kibble-datetime-picker',\n ...rest\n}: DateTimePickerProps): React.JSX.Element => {\n const defaultDates = useMemo(() => {\n const today = new Date();\n return {\n startDate: startOfDay(today),\n endDate: endOfDay(today),\n };\n }, []);\n const { contentRef } = usePortalContentRef();\n const recipe = useSlotRecipe({ recipe: popoverRecipe });\n const styles = recipe();\n const breakpoint = useBreakpoint();\n\n // Initialize selected quick option based on provided dates\n const initialQuickOption = useMemo(() => {\n return showQuickOptions\n ? matchDatesToQuickOption(rest.startDate || null, rest.endDate || null)\n : DateTimePickerDefaultOptionValue.Custom;\n }, [showQuickOptions, rest.startDate, rest.endDate]);\n\n const [selectedQuickOption, setSelectedQuickOption] = useState<DateTimePickerDefaultOptionValue>(initialQuickOption);\n\n // Sync selectedQuickOption when props change\n useEffect(() => {\n setSelectedQuickOption(initialQuickOption);\n }, [initialQuickOption]);\n\n const _calendarView = useMemo(\n () => (['base', 'sm'].includes(breakpoint) ? 'single' : calendarView),\n [calendarView, breakpoint],\n );\n const numberOfMonths = useMemo(() => CalendarViewToNumberOfMonthsMap[_calendarView], [_calendarView]);\n const isSingleView = useMemo(() => _calendarView === 'single', [_calendarView]);\n const isCustomSelected = useMemo(\n () => selectedQuickOption === DateTimePickerDefaultOptionValue.Custom,\n [selectedQuickOption],\n );\n const popoverSize = useMemo(() => (isCustomSelected ? 'max-content' : '160px'), [isCustomSelected]);\n\n return (\n <DatePickerProvider\n {...rest}\n startDate={rest.startDate || defaultDates.startDate}\n endDate={rest.endDate || defaultDates.endDate}\n withDateRange\n numberOfMonths={numberOfMonths}\n sameWidth={true}\n >\n <CPopover.Trigger asChild w=\"max-content\">\n {trigger || (\n <Button variant=\"secondarySubtle\" iconName=\"calendarInfo\" data-testid={`${dataTestId}-default-trigger`}>\n Date/Time Range\n </Button>\n )}\n </CPopover.Trigger>\n <Portal container={contentRef || undefined} disabled={!portalled}>\n <CPopover.Positioner className=\"DateTimePicker\" data-testid={dataTestId}>\n <CPopover.Content\n className=\"DateTimePicker__Content\"\n data-testid={`${dataTestId}-content`}\n css={{\n ...styles.content,\n '--popover-size': popoverSize,\n maxW: showQuickOptions ? (isSingleView ? '550px' : '890px') : isSingleView ? '390px' : '730px',\n ...(isCustomSelected && { minW: showQuickOptions ? '550px' : '390px' }),\n }}\n >\n <CPopover.Body css={{ '--popover-padding': 0 }}>\n <Flex className=\"DateTimePicker__Container\" data-testid={`${dataTestId}-container`} p={5}>\n {showQuickOptions && (\n <DateTimePickerQuickOptions\n selectedQuickOption={selectedQuickOption}\n setSelectedQuickOption={setSelectedQuickOption}\n />\n )}\n {selectedQuickOption === DateTimePickerDefaultOptionValue.Custom && (\n <>\n {showQuickOptions && <Divider orientation=\"vertical\" my={-5} mx={5} />}\n <DateTimePickerCustomView isSingleView={isSingleView} />\n </>\n )}\n </Flex>\n </CPopover.Body>\n </CPopover.Content>\n </CPopover.Positioner>\n </Portal>\n </DatePickerProvider>\n );\n};\n"],"names":["DateTimePickerDefaultOptionValue","calendarViews","dateTimePickerDefaultOptions","CalendarViewToNumberOfMonthsMap","startOfToday","options","startOfDay","endOfToday","endOfDay","startOfYesterday","now","constructNow","year","month","day","date","endOfYesterday","constructFrom","addWeeks","amount","addDays","subWeeks","subMonths","addMonths","isEqual","leftDate","rightDate","toDate","getQuickOptionDateRange","option","today","startOfWeek","endOfWeek","lastWeekDate","startOfMonth","endOfMonth","lastMonthDate","matchDatesToQuickOption","startDate","endDate","optionsToCheck","optionRange","DateTimePickerQuickOptions","selectedQuickOption","setSelectedQuickOption","dataTestId","setFocusedInput","onQuickOptionSelect","useDatePickerContext","setOpen","usePopoverContext","handleOptionClick","FocusedInput","dates","jsx","Flex","Button","DateTimePickerRangeSelector","label","rangeType","dateFormat","focusedInput","onTimeChange","_date","useMemo","formattedDate","format","handleTimeChange","jsxs","Grid","GridItem","Text","TextInput","TimePicker","time","DateTimePickerCustomView","isSingleView","useEffect","Box","DatePickerHeader","DatePickerCalendar","DateTimePicker","trigger","calendarView","portalled","showQuickOptions","rest","defaultDates","contentRef","usePortalContentRef","styles","useSlotRecipe","popoverRecipe","breakpoint","useBreakpoint","initialQuickOption","useState","_calendarView","numberOfMonths","isCustomSelected","popoverSize","DatePickerProvider","CPopover.Trigger","Portal","CPopover.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