@televet/kibble-ui 5.0.26-franklin.6 → 5.0.26-franklin.7
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-CSvl4JHD.js +44 -0
- package/dist/chunks/calendar.component-CSvl4JHD.js.map +1 -0
- package/dist/chunks/calendar.component-DMoLaJfB.js +2 -0
- package/dist/chunks/calendar.component-DMoLaJfB.js.map +1 -0
- package/dist/chunks/datePicker.component-BuGpHTzS.js +2 -0
- package/dist/chunks/{datePicker.component-JVmLDTg8.js.map → datePicker.component-BuGpHTzS.js.map} +1 -1
- package/dist/chunks/datePicker.component-DuI1ybKD.js +166 -0
- package/dist/chunks/datePicker.component-DuI1ybKD.js.map +1 -0
- package/dist/cjs/components/Calendar/index.cjs +1 -1
- package/dist/cjs/components/DatePicker/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 +2 -3
- package/dist/esm/components/Calendar/index.js.map +1 -1
- package/dist/esm/components/DatePicker/index.js +1 -1
- package/dist/esm/components/index.js +123 -124
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/index.js +147 -148
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/DatePicker/datePicker.component.d.ts +0 -14
- package/package.json +1 -1
- package/dist/chunks/calendar.component-BuByj_kQ.js +0 -2
- package/dist/chunks/calendar.component-BuByj_kQ.js.map +0 -1
- package/dist/chunks/calendar.component-DXOO8TEd.js +0 -22
- package/dist/chunks/calendar.component-DXOO8TEd.js.map +0 -1
- package/dist/chunks/calendarTodayButton.component-BUWyokw4.js +0 -30
- package/dist/chunks/calendarTodayButton.component-BUWyokw4.js.map +0 -1
- package/dist/chunks/calendarTodayButton.component-CynzgVXX.js +0 -2
- package/dist/chunks/calendarTodayButton.component-CynzgVXX.js.map +0 -1
- package/dist/chunks/datePicker.component-Ccp2rTeh.js +0 -172
- package/dist/chunks/datePicker.component-Ccp2rTeh.js.map +0 -1
- package/dist/chunks/datePicker.component-JVmLDTg8.js +0 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { j as a } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { B as i } from "./index-9BerxEcw.js";
|
|
3
|
+
import { u as n, a as l, b as c, c as m } from "./datePicker.provider-DjDP292O.js";
|
|
4
|
+
import { D as u } from "./divider.component-CFOh4Nw3.js";
|
|
5
|
+
import { B as x } from "./button.component-BO6oee_V.js";
|
|
6
|
+
import { s as b } from "./format-CqTHHSak.js";
|
|
7
|
+
const f = ({
|
|
8
|
+
onTodayClick: t,
|
|
9
|
+
["data-testid"]: r = "kibble-calendar-today-button"
|
|
10
|
+
}) => {
|
|
11
|
+
const { goToDate: s, onDateSelect: o } = n(), d = () => {
|
|
12
|
+
const e = b(/* @__PURE__ */ new Date());
|
|
13
|
+
s(e), o(e), t?.();
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ a.jsx(i, { "data-testid": r, bg: "background.secondaryAlpha", borderRadius: "md", p: 2, w: "full", children: /* @__PURE__ */ a.jsx(
|
|
16
|
+
x,
|
|
17
|
+
{
|
|
18
|
+
variant: "ghostNeutral",
|
|
19
|
+
size: "md",
|
|
20
|
+
w: "full",
|
|
21
|
+
border: "1px solid",
|
|
22
|
+
borderColor: "border.default",
|
|
23
|
+
onClick: d,
|
|
24
|
+
children: "Today"
|
|
25
|
+
}
|
|
26
|
+
) });
|
|
27
|
+
}, g = ({
|
|
28
|
+
["data-testid"]: t = "kibble-calendar",
|
|
29
|
+
withDateRange: r = !0,
|
|
30
|
+
withHeaderTriggers: s = !1,
|
|
31
|
+
showTodayButton: o = !1,
|
|
32
|
+
onTodayClick: d,
|
|
33
|
+
...e
|
|
34
|
+
}) => /* @__PURE__ */ a.jsx(i, { className: "Calendar", "data-testid": t, maxW: "360px", children: /* @__PURE__ */ a.jsxs(l, { withDateRange: r, ...e, standalone: !0, children: [
|
|
35
|
+
/* @__PURE__ */ a.jsx(c, { withTriggers: s }),
|
|
36
|
+
/* @__PURE__ */ a.jsx(u, {}),
|
|
37
|
+
/* @__PURE__ */ a.jsx(m, {}),
|
|
38
|
+
o && /* @__PURE__ */ a.jsx(f, { onTodayClick: d })
|
|
39
|
+
] }) });
|
|
40
|
+
export {
|
|
41
|
+
g as C,
|
|
42
|
+
f as a
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=calendar.component-CSvl4JHD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.component-CSvl4JHD.js","sources":["../../src/components/Calendar/calendarTodayButton.component.tsx","../../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';\n\nexport interface CalendarTodayButtonProps {\n /** Callback fired after today is selected. */\n onTodayClick?: () => void;\n /** Data test id for the today button container.\n * @default kibble-calendar-today-button\n */\n 'data-testid'?: string;\n}\n\nexport const CalendarTodayButton = ({\n onTodayClick,\n ['data-testid']: dataTestId = 'kibble-calendar-today-button',\n}: CalendarTodayButtonProps): React.JSX.Element => {\n const { goToDate, onDateSelect } = useDatePickerContext();\n\n const handleClick = (): void => {\n const today = startOfDay(new Date());\n goToDate(today);\n onDateSelect(today);\n onTodayClick?.();\n };\n\n return (\n <Box data-testid={dataTestId} bg=\"background.secondaryAlpha\" borderRadius=\"md\" p={2} w=\"full\">\n <Button\n variant=\"ghostNeutral\"\n size=\"md\"\n w=\"full\"\n border=\"1px solid\"\n borderColor=\"border.default\"\n onClick={handleClick}\n >\n Today\n </Button>\n </Box>\n );\n};\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 { CalendarTodayButton } from './calendarTodayButton.component';\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 * If true, a \"Today\" button is rendered below the calendar grid.\n * Clicking it selects today's date and navigates to the current month.\n * @default false\n */\n showTodayButton?: boolean;\n /**\n * Callback fired after the \"Today\" button is clicked.\n * Only relevant when showTodayButton is true.\n */\n onTodayClick?: () => void;\n}\n\nexport const Calendar = ({\n ['data-testid']: dataTestId = 'kibble-calendar',\n withDateRange = true,\n withHeaderTriggers = false,\n showTodayButton = false,\n onTodayClick,\n ...rest\n}: CalendarProps): React.JSX.Element => {\n return (\n <Box className=\"Calendar\" data-testid={dataTestId} maxW=\"360px\">\n <DatePickerProvider withDateRange={withDateRange} {...rest} standalone>\n <DatePickerHeader withTriggers={withHeaderTriggers} />\n <Divider />\n <DatePickerCalendar />\n {showTodayButton && <CalendarTodayButton onTodayClick={onTodayClick} />}\n </DatePickerProvider>\n </Box>\n );\n};\n"],"names":["CalendarTodayButton","onTodayClick","dataTestId","goToDate","onDateSelect","useDatePickerContext","handleClick","today","startOfDay","jsx","Box","Button","Calendar","withDateRange","withHeaderTriggers","showTodayButton","rest","jsxs","DatePickerProvider","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":";;;;;;AAeO,MAAMA,IAAsB,CAAC;AAAA,EAClC,cAAAC;AAAA,EACA,CAAC,gBAAgBC,IAAa;AAChC,MAAmD;AACjD,QAAM,EAAE,UAAAC,GAAU,cAAAC,EAAa,IAAIC,EAAqB,GAElDC,IAAc,MAAY;AAC9B,UAAMC,IAAQC,EAAe,oBAAA,MAAM;AACnC,IAAAL,EAASI,CAAK,GACdH,EAAaG,CAAK,GACHN,IAAA;AAAA,EACjB;AAGE,SAAAQ,gBAAAA,EAAAA,IAACC,GAAI,EAAA,eAAaR,GAAY,IAAG,6BAA4B,cAAa,MAAK,GAAG,GAAG,GAAE,QACrF,UAAAO,gBAAAA,EAAA;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,SAASL;AAAA,MACV,UAAA;AAAA,IAAA;AAAA,EAAA,GAGH;AAEJ,GCLaM,IAAW,CAAC;AAAA,EACvB,CAAC,gBAAgBV,IAAa;AAAA,EAC9B,eAAAW,IAAgB;AAAA,EAChB,oBAAAC,IAAqB;AAAA,EACrB,iBAAAC,IAAkB;AAAA,EAClB,cAAAd;AAAA,EACA,GAAGe;AACL,MAEKP,gBAAAA,EAAAA,IAAAC,GAAA,EAAI,WAAU,YAAW,eAAaR,GAAY,MAAK,SACtD,UAAAe,gBAAAA,EAAA,KAACC,GAAmB,EAAA,eAAAL,GAA+B,GAAGG,GAAM,YAAU,IACpE,UAAA;AAAA,EAACP,gBAAAA,EAAAA,IAAAU,GAAA,EAAiB,cAAcL,EAAoB,CAAA;AAAA,wBACnDM,GAAQ,EAAA;AAAA,wBACRC,GAAmB,EAAA;AAAA,EACnBN,KAAoBN,gBAAAA,EAAA,IAAAT,GAAA,EAAoB,cAAAC,EAA4B,CAAA;AAAA,EAAA,CACvE,EACF,CAAA;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BjDatQAs.js"),i=require("./index-BQRnVsAg.js"),r=require("./datePicker.provider-i35-VNAb.js"),x=require("./divider.component-BX3zyB7O.js"),c=require("./button.component-DjdgBXDC.js"),l=require("./format-CK7Imh-5.js"),u=({onTodayClick:a,["data-testid"]:s="kibble-calendar-today-button"})=>{const{goToDate:n,onDateSelect:o}=r.useDatePickerContext(),d=()=>{const t=l.startOfDay(new Date);n(t),o(t),a?.()};return e.jsxRuntimeExports.jsx(i.Box,{"data-testid":s,bg:"background.secondaryAlpha",borderRadius:"md",p:2,w:"full",children:e.jsxRuntimeExports.jsx(c.Button,{variant:"ghostNeutral",size:"md",w:"full",border:"1px solid",borderColor:"border.default",onClick:d,children:"Today"})})},j=({["data-testid"]:a="kibble-calendar",withDateRange:s=!0,withHeaderTriggers:n=!1,showTodayButton:o=!1,onTodayClick:d,...t})=>e.jsxRuntimeExports.jsx(i.Box,{className:"Calendar","data-testid":a,maxW:"360px",children:e.jsxRuntimeExports.jsxs(r.DatePickerProvider,{withDateRange:s,...t,standalone:!0,children:[e.jsxRuntimeExports.jsx(r.DatePickerHeader,{withTriggers:n}),e.jsxRuntimeExports.jsx(x.Divider,{}),e.jsxRuntimeExports.jsx(r.DatePickerCalendar,{}),o&&e.jsxRuntimeExports.jsx(u,{onTodayClick:d})]})});exports.Calendar=j;exports.CalendarTodayButton=u;
|
|
2
|
+
//# sourceMappingURL=calendar.component-DMoLaJfB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.component-DMoLaJfB.js","sources":["../../src/components/Calendar/calendarTodayButton.component.tsx","../../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';\n\nexport interface CalendarTodayButtonProps {\n /** Callback fired after today is selected. */\n onTodayClick?: () => void;\n /** Data test id for the today button container.\n * @default kibble-calendar-today-button\n */\n 'data-testid'?: string;\n}\n\nexport const CalendarTodayButton = ({\n onTodayClick,\n ['data-testid']: dataTestId = 'kibble-calendar-today-button',\n}: CalendarTodayButtonProps): React.JSX.Element => {\n const { goToDate, onDateSelect } = useDatePickerContext();\n\n const handleClick = (): void => {\n const today = startOfDay(new Date());\n goToDate(today);\n onDateSelect(today);\n onTodayClick?.();\n };\n\n return (\n <Box data-testid={dataTestId} bg=\"background.secondaryAlpha\" borderRadius=\"md\" p={2} w=\"full\">\n <Button\n variant=\"ghostNeutral\"\n size=\"md\"\n w=\"full\"\n border=\"1px solid\"\n borderColor=\"border.default\"\n onClick={handleClick}\n >\n Today\n </Button>\n </Box>\n );\n};\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 { CalendarTodayButton } from './calendarTodayButton.component';\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 * If true, a \"Today\" button is rendered below the calendar grid.\n * Clicking it selects today's date and navigates to the current month.\n * @default false\n */\n showTodayButton?: boolean;\n /**\n * Callback fired after the \"Today\" button is clicked.\n * Only relevant when showTodayButton is true.\n */\n onTodayClick?: () => void;\n}\n\nexport const Calendar = ({\n ['data-testid']: dataTestId = 'kibble-calendar',\n withDateRange = true,\n withHeaderTriggers = false,\n showTodayButton = false,\n onTodayClick,\n ...rest\n}: CalendarProps): React.JSX.Element => {\n return (\n <Box className=\"Calendar\" data-testid={dataTestId} maxW=\"360px\">\n <DatePickerProvider withDateRange={withDateRange} {...rest} standalone>\n <DatePickerHeader withTriggers={withHeaderTriggers} />\n <Divider />\n <DatePickerCalendar />\n {showTodayButton && <CalendarTodayButton onTodayClick={onTodayClick} />}\n </DatePickerProvider>\n </Box>\n );\n};\n"],"names":["CalendarTodayButton","onTodayClick","dataTestId","goToDate","onDateSelect","useDatePickerContext","handleClick","today","startOfDay","jsx","Box","Button","Calendar","withDateRange","withHeaderTriggers","showTodayButton","rest","jsxs","DatePickerProvider","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":"qQAeaA,EAAsB,CAAC,CAClC,aAAAC,EACA,CAAC,eAAgBC,EAAa,8BAChC,IAAmD,CACjD,KAAM,CAAE,SAAAC,EAAU,aAAAC,CAAa,EAAIC,uBAAqB,EAElDC,EAAc,IAAY,CAC9B,MAAMC,EAAQC,EAAAA,WAAe,IAAA,IAAM,EACnCL,EAASI,CAAK,EACdH,EAAaG,CAAK,EACHN,IAAA,CACjB,EAGE,OAAAQ,EAAAA,kBAAAA,IAACC,EAAAA,IAAI,CAAA,cAAaR,EAAY,GAAG,4BAA4B,aAAa,KAAK,EAAG,EAAG,EAAE,OACrF,SAAAO,EAAA,kBAAA,IAACE,EAAA,OAAA,CACC,QAAQ,eACR,KAAK,KACL,EAAE,OACF,OAAO,YACP,YAAY,iBACZ,QAASL,EACV,SAAA,OAAA,CAAA,EAGH,CAEJ,ECLaM,EAAW,CAAC,CACvB,CAAC,eAAgBV,EAAa,kBAC9B,cAAAW,EAAgB,GAChB,mBAAAC,EAAqB,GACrB,gBAAAC,EAAkB,GAClB,aAAAd,EACA,GAAGe,CACL,IAEKP,EAAAA,kBAAAA,IAAAC,EAAAA,IAAA,CAAI,UAAU,WAAW,cAAaR,EAAY,KAAK,QACtD,SAAAe,EAAA,kBAAA,KAACC,EAAmB,mBAAA,CAAA,cAAAL,EAA+B,GAAGG,EAAM,WAAU,GACpE,SAAA,CAACP,EAAAA,kBAAAA,IAAAU,EAAA,iBAAA,CAAiB,aAAcL,CAAoB,CAAA,0BACnDM,EAAQ,QAAA,EAAA,0BACRC,EAAmB,mBAAA,EAAA,EACnBN,GAAoBN,EAAA,kBAAA,IAAAT,EAAA,CAAoB,aAAAC,CAA4B,CAAA,CAAA,CAAA,CACvE,CACF,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BjDatQAs.js"),n=require("./datePicker.provider-i35-VNAb.js"),k=require("./textInput.component-CwTc0h_F.js"),g=require("./icon.component-B1hr5lLa.js"),S=require("./text.component-BDDz5KQP.js"),l=require("./format-CK7Imh-5.js"),v=require("./popover-root-provider-CZDbUJ2K.js"),q=require("./h-stack-D4MnHHRc.js"),P=require("./flex-BOU6tYUd.js"),y=require("react"),C=require("./button.component-DjdgBXDC.js"),w=require("./popover.recipe-CtptsJg6.js"),z=require("./usePortalContentRef-CTrvBQ7I.js"),N=require("./divider.component-BX3zyB7O.js"),T=require("./create-slot-recipe-context-HXE1VazG.js"),B=require("./index-Ts8g8jZd.js"),m=require("./popover-C7aj8Iwj.js");function W(t,r){return+l.toDate(t)<+l.toDate(r)}const A=(t,r)=>r?n.isAfter(t,r):!0,H=(t,r)=>r?W(t,r):!0;function O({inputProps:t,["data-testid"]:r="kibble-datepicker-input"}){const{setFocusedInput:o,startDate:a,endDate:i,focusedInput:c,dateFormat:s,withDateRange:u,minDate:d,maxDate:x,onDateChange:R,onDateSelect:I,onClose:F}=n.useDatePickerContext(),{open:_,setOpen:b}=v.usePopoverContext(),f=t?.size||"md",h=p=>{p.key==="Enter"&&_&&(b(!1),F(),p.preventDefault(),p.stopPropagation())},E=p=>{const D=p.target.value,j=n.xt(D,s,n.today);D.length===s.length&&l.isDate(j)&&A(j,d)&&H(j,x)&&I(j),!D.length&&R&&R({startDate:null,endDate:null})};return e.jsxRuntimeExports.jsxs(q.HStack,{w:"100%",className:"DatePicker__Trigger","data-testid":r,children:[e.jsxRuntimeExports.jsx(k.WrappedTextInput,{className:"DatePicker__Input--Start","data-testid":`${r}-start`,autoComplete:"off",rightElement:e.jsxRuntimeExports.jsx(P.Flex,{...!t?.disabled&&{onClick:()=>o(n.FocusedInput.StartDate)},h:"100%",align:"center",children:e.jsxRuntimeExports.jsx(g.Icon,{name:"calendarDate",size:f})}),value:n.Ue(a,s,""),onChange:E,onKeyDown:h,...!t?.disabled&&{onFocus:()=>{o(n.FocusedInput.StartDate)}},placeholder:l.format(n.today,s).toString(),...c===n.FocusedInput.StartDate&&{"data-focus":!0},...t}),u&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(S.WrappedText,{children:" - "}),e.jsxRuntimeExports.jsx(k.WrappedTextInput,{className:"DatePicker__Input--End","data-testid":`${r}-end`,rightElement:e.jsxRuntimeExports.jsx(P.Flex,{...!t?.disabled&&{onClick:()=>o(n.FocusedInput.StartDate)},h:"100%",align:"center",children:e.jsxRuntimeExports.jsx(g.Icon,{name:"calendarDate",size:f})}),value:n.Ue(i,s,""),onChange:E,...!t?.disabled&&{onFocus:()=>o(n.FocusedInput.EndDate)},onKeyDown:h,placeholder:l.format(n.today,s).toString(),...c===n.FocusedInput.EndDate&&{"data-focus":!0},...t})]})]})}function $({buttonText:t="Apply",onSubmit:r,hideResetButton:o}){const{startDate:a,endDate:i,clearDates:c,standalone:s}=n.useDatePickerContext(),{open:u,setOpen:d}=v.usePopoverContext(),x=y.useCallback(()=>{s||d(!1),r&&r({startDate:a,endDate:i})},[s,d,r,a,i]);return e.jsxRuntimeExports.jsxs(q.HStack,{w:"100%",justify:o?"end":"space-between",align:"center",borderTop:"1px",borderColor:"border.default",px:3,py:2,children:[!o&&e.jsxRuntimeExports.jsx(C.Button,{size:"sm",variant:"ghostNeutral",onClick:()=>c({open:u}),children:"Clear Dates"}),e.jsxRuntimeExports.jsx(C.Button,{size:"sm",onClick:x,children:t})]})}const M=t=>{const{footerProps:r,hideFooter:o=!1,inputProps:a,portalled:i=!0,withDateRange:c=!1,["data-testid"]:s="kibble-datepicker"}=t,{contentRef:u}=z.usePortalContentRef(),x=T.useSlotRecipe({recipe:w.popoverRecipe})();return e.jsxRuntimeExports.jsxs(n.DatePickerProvider,{...t,children:[e.jsxRuntimeExports.jsx(m.PopoverTrigger,{w:"100%",children:e.jsxRuntimeExports.jsx(O,{inputProps:{...a,readOnly:!0}})}),e.jsxRuntimeExports.jsx(B.Portal,{container:u||void 0,disabled:!i,children:e.jsxRuntimeExports.jsx(m.PopoverPositioner,{className:"DatePicker","data-testid":s,children:e.jsxRuntimeExports.jsx(m.PopoverContent,{className:"DatePicker__Content","data-testid":`${s}-content`,css:{...x.content,minW:"340px"},children:e.jsxRuntimeExports.jsxs(m.PopoverBody,{css:{"--popover-padding":0},children:[e.jsxRuntimeExports.jsx(n.DatePickerHeader,{}),e.jsxRuntimeExports.jsx(N.Divider,{}),e.jsxRuntimeExports.jsx(n.DatePickerCalendar,{}),c&&!o&&e.jsxRuntimeExports.jsx($,{...r})]})})})})]})};exports.DatePicker=M;
|
|
2
|
+
//# sourceMappingURL=datePicker.component-BuGpHTzS.js.map
|
package/dist/chunks/{datePicker.component-JVmLDTg8.js.map → datePicker.component-BuGpHTzS.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datePicker.component-JVmLDTg8.js","sources":["../../node_modules/date-fns/isBefore.js","../../src/components/DatePicker/components/DatePickerInput/datePickerInput.utils.ts","../../src/components/DatePicker/components/DatePickerInput/datePickerInput.component.tsx","../../src/components/DatePicker/components/DatePickerFooter/datePickerFooter.component.tsx","../../src/components/DatePicker/datePicker.component.tsx"],"sourcesContent":["import { toDate } from \"./toDate.js\";\n\n/**\n * @name isBefore\n * @category Common Helpers\n * @summary Is the first date before the second one?\n *\n * @description\n * Is the first date before the second one?\n *\n * @param date - The date that should be before the other one to return true\n * @param dateToCompare - The date to compare with\n *\n * @returns The first date is before the second date\n *\n * @example\n * // Is 10 July 1989 before 11 February 1987?\n * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> false\n */\nexport function isBefore(date, dateToCompare) {\n return +toDate(date) < +toDate(dateToCompare);\n}\n\n// Fallback for modularized imports:\nexport default isBefore;\n","import isAfter from 'date-fns/isAfter';\nimport isBefore from 'date-fns/isBefore';\n\nexport const isDateAfterMin = (date: Date, minDate?: Date): boolean => (minDate ? isAfter(date, minDate) : true);\nexport const isDateBeforeMax = (date: Date, maxDate?: Date): boolean => (maxDate ? isBefore(date, maxDate) : true);\n","import React, { ChangeEvent } from 'react';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { TextInput, TextInputProps } from 'components/TextInput/textInput.component';\nimport { Icon } from 'components/Icon/icon.component';\nimport { Text } from 'components/Text/text.component';\nimport isDate from 'date-fns/isDate';\nimport { getInputValue, parseDate } from '@datepicker-react/hooks';\nimport { isDateAfterMin, isDateBeforeMax } from './datePickerInput.utils';\nimport { FocusedInput, today, useDatePickerContext } from '../../context/datePicker.context';\nimport format from 'date-fns/format';\nimport { usePopoverContext } from '@chakra-ui/react/popover';\n\ninterface DatePickerInputProps {\n /** Props to customize the input field. See `TextInput` for more information. */\n inputProps?: Omit<TextInputProps, 'onChange' | 'value' | 'isClearable' | 'onClear'>;\n /** Data test id for the input.\n * @default kibble-datepicker-input\n */\n 'data-testid'?: string;\n}\n\nexport function DatePickerInput({\n inputProps,\n ['data-testid']: dataTestId = 'kibble-datepicker-input',\n}: DatePickerInputProps): React.JSX.Element {\n const {\n setFocusedInput,\n startDate,\n endDate,\n focusedInput,\n dateFormat,\n withDateRange,\n minDate,\n maxDate,\n onDateChange,\n onDateSelect,\n onClose,\n } = useDatePickerContext();\n const { open, setOpen } = usePopoverContext();\n const iconSize = inputProps?.size || 'md';\n\n const onKeyDown = (e: React.KeyboardEvent): void => {\n if (e.key === 'Enter' && open) {\n setOpen(false);\n onClose();\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>): void => {\n const dateValue = e.target.value;\n const parsedDate = parseDate(dateValue, dateFormat, today);\n\n if (\n dateValue.length === dateFormat.length &&\n isDate(parsedDate) &&\n isDateAfterMin(parsedDate, minDate) &&\n isDateBeforeMax(parsedDate, maxDate)\n ) {\n onDateSelect(parsedDate);\n }\n\n // Trigger change when input is empty\n if (!dateValue.length && onDateChange) {\n onDateChange({ startDate: null, endDate: null });\n }\n };\n\n return (\n <HStack w=\"100%\" className=\"DatePicker__Trigger\" data-testid={dataTestId}>\n <TextInput\n className=\"DatePicker__Input--Start\"\n data-testid={`${dataTestId}-start`}\n autoComplete=\"off\"\n rightElement={\n <Flex\n {...(!inputProps?.disabled && {\n onClick: (): void => setFocusedInput(FocusedInput.StartDate),\n })}\n h=\"100%\"\n align=\"center\"\n >\n <Icon name=\"calendarDate\" size={iconSize} />\n </Flex>\n }\n value={getInputValue(startDate, dateFormat, '')}\n onChange={onInputChange}\n onKeyDown={onKeyDown}\n {...(!inputProps?.disabled && {\n onFocus: (): void => {\n setFocusedInput(FocusedInput.StartDate);\n },\n })}\n placeholder={format(today, dateFormat).toString()}\n {...(focusedInput === FocusedInput.StartDate && {\n 'data-focus': true,\n })}\n {...inputProps}\n />\n {withDateRange && (\n <>\n <Text> - </Text>\n <TextInput\n className=\"DatePicker__Input--End\"\n data-testid={`${dataTestId}-end`}\n rightElement={\n <Flex\n {...(!inputProps?.disabled && {\n onClick: (): void => setFocusedInput(FocusedInput.StartDate),\n })}\n h=\"100%\"\n align=\"center\"\n >\n <Icon name=\"calendarDate\" size={iconSize} />\n </Flex>\n }\n value={getInputValue(endDate, dateFormat, '')}\n onChange={onInputChange}\n {...(!inputProps?.disabled && {\n onFocus: (): void => setFocusedInput(FocusedInput.EndDate),\n })}\n onKeyDown={onKeyDown}\n placeholder={format(today, dateFormat).toString()}\n {...(focusedInput === FocusedInput.EndDate && {\n 'data-focus': true,\n })}\n {...inputProps}\n />\n </>\n )}\n </HStack>\n );\n}\n","import React, { useCallback } from 'react';\nimport { Button } from 'components/Button/button.component';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { DateRange } from '../../datePicker.types';\nimport { useDatePickerContext } from '../../context/datePicker.context';\nimport { usePopoverContext } from '@chakra-ui/react/popover';\n\nexport interface DatePickerFooterProps {\n /** Text to display in the submit button.\n * @default Apply\n */\n buttonText?: string;\n /** Callback function to be called when the submit button is clicked. */\n onSubmit?: ({ startDate, endDate }: DateRange) => void;\n /** If true, the reset button will be hidden. */\n hideResetButton?: boolean;\n /** Data test id for the footer.\n * @default kibble-datepicker-footer\n */\n 'data-testid'?: string;\n}\n\nexport function DatePickerFooter({\n buttonText = 'Apply',\n onSubmit,\n hideResetButton,\n}: DatePickerFooterProps): React.JSX.Element {\n const { startDate, endDate, clearDates, standalone } = useDatePickerContext();\n const { open, setOpen } = usePopoverContext();\n\n const handleSubmit = useCallback((): void => {\n if (!standalone) {\n setOpen(false);\n }\n\n if (onSubmit) {\n onSubmit({ startDate, endDate });\n }\n }, [standalone, setOpen, onSubmit, startDate, endDate]);\n\n return (\n <HStack\n w=\"100%\"\n justify={hideResetButton ? 'end' : 'space-between'}\n align=\"center\"\n borderTop=\"1px\"\n borderColor=\"border.default\"\n px={3}\n py={2}\n >\n {!hideResetButton && (\n <Button size=\"sm\" variant=\"ghostNeutral\" onClick={() => clearDates({ open })}>\n Clear Dates\n </Button>\n )}\n <Button size=\"sm\" onClick={handleSubmit}>\n {buttonText}\n </Button>\n </HStack>\n );\n}\n","import React from 'react';\nimport { DateProps } from './datePicker.types';\nimport { TextInputProps } from 'components/TextInput/textInput.component';\nimport { Placement } from 'shared/types/placement';\nimport { DatePickerProvider } from './context/datePicker.provider';\nimport { DatePickerInput } from './components/DatePickerInput/datePickerInput.component';\nimport { DatePickerFooter, DatePickerFooterProps } from './components/DatePickerFooter/datePickerFooter.component';\nimport { DatePickerHeader } from './components/DatePickerHeader/datePickerHeader.component';\nimport { DatePickerCalendar } from './components/DatePickerCalendar/datePickerCalendar.component';\nimport { Popover as CPopover } from '@chakra-ui/react/popover';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { popoverRecipe } from 'components/Popover/popover.recipe';\nimport { usePortalContentRef } from 'hooks/usePortalContentRef';\nimport { Divider } from 'components/Divider';\nimport { CalendarTodayButton } from 'components/Calendar/calendarTodayButton.component';\n\nexport interface DatePickerProps extends DateProps {\n /** Props to customize the calendar footer. Only applicable when `withDateRange` is true. */\n footerProps?: DatePickerFooterProps;\n /**\n * Hides the calendar footer with the submit button. Only applicable when `withDateRange` is true.\n * @default false\n */\n hideFooter?: boolean;\n /** Props to customize the input field. See `TextInput` for more information. */\n inputProps?: Omit<TextInputProps, 'onChange' | 'value' | 'isClearable' | 'onClear'>;\n /**\n * Placement of the calendar popover\n * @default bottom\n */\n placement?: Placement;\n /**\n * If true, the date picker will be rendered in a portal.\n * @default true\n */\n portalled?: boolean;\n /**\n * Custom trigger element. When provided, replaces the default text input trigger.\n */\n trigger?: React.ReactNode;\n /**\n * If true, a \"Today\" button is rendered below the calendar grid.\n * @default false\n */\n showTodayButton?: boolean;\n /**\n * Callback fired after the \"Today\" button is clicked.\n * Only relevant when showTodayButton is true.\n */\n onTodayClick?: () => void;\n /**\n * If true, the date picker will render two input fields that control both the start and end date for a range selection.\n * @default false\n */\n withDateRange?: boolean;\n /** Data test id for the date picker.\n * @default kibble-datepicker\n */\n 'data-testid'?: string;\n}\n\nexport const DatePicker = (props: DatePickerProps): React.JSX.Element => {\n const {\n footerProps,\n hideFooter = false,\n inputProps,\n portalled = true,\n showTodayButton = false,\n onTodayClick,\n trigger,\n withDateRange = false,\n ['data-testid']: dataTestId = 'kibble-datepicker',\n ...providerProps\n } = props;\n const { contentRef } = usePortalContentRef();\n const recipe = useSlotRecipe({ recipe: popoverRecipe });\n const styles = recipe();\n\n return (\n <DatePickerProvider {...providerProps} withDateRange={withDateRange}>\n <CPopover.Trigger asChild={!!trigger}>\n {trigger ?? <DatePickerInput inputProps={{ ...inputProps, readOnly: true }} />}\n </CPopover.Trigger>\n <Portal container={contentRef || undefined} disabled={!portalled}>\n <CPopover.Positioner className=\"DatePicker\" data-testid={dataTestId}>\n <CPopover.Content\n className=\"DatePicker__Content\"\n data-testid={`${dataTestId}-content`}\n css={{ ...styles.content, minW: '340px' }}\n >\n <CPopover.Body css={{ '--popover-padding': 0 }}>\n <DatePickerHeader />\n <Divider />\n <DatePickerCalendar />\n {showTodayButton && <CalendarTodayButton onTodayClick={onTodayClick} />}\n {withDateRange && !hideFooter && <DatePickerFooter {...footerProps} />}\n </CPopover.Body>\n </CPopover.Content>\n </CPopover.Positioner>\n </Portal>\n </DatePickerProvider>\n );\n};\n"],"names":["isBefore","date","dateToCompare","toDate","isDateAfterMin","minDate","isAfter","isDateBeforeMax","maxDate","DatePickerInput","inputProps","dataTestId","setFocusedInput","startDate","endDate","focusedInput","dateFormat","withDateRange","onDateChange","onDateSelect","onClose","useDatePickerContext","open","setOpen","usePopoverContext","iconSize","onKeyDown","e","onInputChange","dateValue","parsedDate","parseDate","today","isDate","HStack","jsx","TextInput","Flex","FocusedInput","Icon","getInputValue","format","jsxs","Fragment","Text","DatePickerFooter","buttonText","onSubmit","hideResetButton","clearDates","standalone","handleSubmit","useCallback","Button","DatePicker","props","footerProps","hideFooter","portalled","showTodayButton","onTodayClick","trigger","providerProps","contentRef","usePortalContentRef","styles","useSlotRecipe","popoverRecipe","DatePickerProvider","CPopover.Trigger","Portal","CPopover.Positioner","CPopover.Content","CPopover.Body","DatePickerHeader","Divider","DatePickerCalendar","CalendarTodayButton"],"mappings":"0vBAoBO,SAASA,EAASC,EAAMC,EAAe,CAC5C,MAAO,CAACC,EAAAA,OAAOF,CAAI,EAAI,CAACE,EAAAA,OAAOD,CAAa,CAC9C,CCnBa,MAAAE,EAAiB,CAACH,EAAYI,IAA6BA,EAAUC,EAAAA,QAAQL,EAAMI,CAAO,EAAI,GAC9FE,EAAkB,CAACN,EAAYO,IAA6BA,EAAUR,EAASC,EAAMO,CAAO,EAAI,GCkBtG,SAASC,EAAgB,CAC9B,WAAAC,EACA,CAAC,aAAa,EAAGC,EAAa,yBAChC,EAA4C,CACpC,KAAA,CACJ,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AAA,kBAAA,CAAoB,UAAU,aAAa,cAAa5D,EACvD,SAAAwB,EAAA,kBAAA,IAACqC,EAAS,eAAT,CACC,UAAU,sBACV,cAAa,GAAG7D,CAAU,WAC1B,IAAK,CAAE,GAAGsD,EAAO,QAAS,KAAM,OAAQ,EAExC,SAAAvB,EAAAA,kBAAAA,KAAC+B,EAAAA,YAAA,CAAc,IAAK,CAAE,oBAAqB,CACzC,EAAA,SAAA,CAAAtC,EAAA,kBAAA,IAACuC,EAAiB,iBAAA,EAAA,0BACjBC,EAAQ,QAAA,EAAA,0BACRC,EAAmB,mBAAA,EAAA,EACnBjB,GAAoBxB,EAAA,kBAAA,IAAA0C,sBAAA,CAAoB,aAAAjB,CAA4B,CAAA,EACpE3C,GAAiB,CAACwC,GAAetB,EAAAA,kBAAAA,IAAAU,EAAA,CAAkB,GAAGW,CAAa,CAAA,CAAA,CACtE,CAAA,CAAA,GAEJ,CACF,CAAA,CAAA,EACF,CAEJ","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"datePicker.component-BuGpHTzS.js","sources":["../../node_modules/date-fns/isBefore.js","../../src/components/DatePicker/components/DatePickerInput/datePickerInput.utils.ts","../../src/components/DatePicker/components/DatePickerInput/datePickerInput.component.tsx","../../src/components/DatePicker/components/DatePickerFooter/datePickerFooter.component.tsx","../../src/components/DatePicker/datePicker.component.tsx"],"sourcesContent":["import { toDate } from \"./toDate.js\";\n\n/**\n * @name isBefore\n * @category Common Helpers\n * @summary Is the first date before the second one?\n *\n * @description\n * Is the first date before the second one?\n *\n * @param date - The date that should be before the other one to return true\n * @param dateToCompare - The date to compare with\n *\n * @returns The first date is before the second date\n *\n * @example\n * // Is 10 July 1989 before 11 February 1987?\n * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> false\n */\nexport function isBefore(date, dateToCompare) {\n return +toDate(date) < +toDate(dateToCompare);\n}\n\n// Fallback for modularized imports:\nexport default isBefore;\n","import isAfter from 'date-fns/isAfter';\nimport isBefore from 'date-fns/isBefore';\n\nexport const isDateAfterMin = (date: Date, minDate?: Date): boolean => (minDate ? isAfter(date, minDate) : true);\nexport const isDateBeforeMax = (date: Date, maxDate?: Date): boolean => (maxDate ? isBefore(date, maxDate) : true);\n","import React, { ChangeEvent } from 'react';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { TextInput, TextInputProps } from 'components/TextInput/textInput.component';\nimport { Icon } from 'components/Icon/icon.component';\nimport { Text } from 'components/Text/text.component';\nimport isDate from 'date-fns/isDate';\nimport { getInputValue, parseDate } from '@datepicker-react/hooks';\nimport { isDateAfterMin, isDateBeforeMax } from './datePickerInput.utils';\nimport { FocusedInput, today, useDatePickerContext } from '../../context/datePicker.context';\nimport format from 'date-fns/format';\nimport { usePopoverContext } from '@chakra-ui/react/popover';\n\ninterface DatePickerInputProps {\n /** Props to customize the input field. See `TextInput` for more information. */\n inputProps?: Omit<TextInputProps, 'onChange' | 'value' | 'isClearable' | 'onClear'>;\n /** Data test id for the input.\n * @default kibble-datepicker-input\n */\n 'data-testid'?: string;\n}\n\nexport function DatePickerInput({\n inputProps,\n ['data-testid']: dataTestId = 'kibble-datepicker-input',\n}: DatePickerInputProps): React.JSX.Element {\n const {\n setFocusedInput,\n startDate,\n endDate,\n focusedInput,\n dateFormat,\n withDateRange,\n minDate,\n maxDate,\n onDateChange,\n onDateSelect,\n onClose,\n } = useDatePickerContext();\n const { open, setOpen } = usePopoverContext();\n const iconSize = inputProps?.size || 'md';\n\n const onKeyDown = (e: React.KeyboardEvent): void => {\n if (e.key === 'Enter' && open) {\n setOpen(false);\n onClose();\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>): void => {\n const dateValue = e.target.value;\n const parsedDate = parseDate(dateValue, dateFormat, today);\n\n if (\n dateValue.length === dateFormat.length &&\n isDate(parsedDate) &&\n isDateAfterMin(parsedDate, minDate) &&\n isDateBeforeMax(parsedDate, maxDate)\n ) {\n onDateSelect(parsedDate);\n }\n\n // Trigger change when input is empty\n if (!dateValue.length && onDateChange) {\n onDateChange({ startDate: null, endDate: null });\n }\n };\n\n return (\n <HStack w=\"100%\" className=\"DatePicker__Trigger\" data-testid={dataTestId}>\n <TextInput\n className=\"DatePicker__Input--Start\"\n data-testid={`${dataTestId}-start`}\n autoComplete=\"off\"\n rightElement={\n <Flex\n {...(!inputProps?.disabled && {\n onClick: (): void => setFocusedInput(FocusedInput.StartDate),\n })}\n h=\"100%\"\n align=\"center\"\n >\n <Icon name=\"calendarDate\" size={iconSize} />\n </Flex>\n }\n value={getInputValue(startDate, dateFormat, '')}\n onChange={onInputChange}\n onKeyDown={onKeyDown}\n {...(!inputProps?.disabled && {\n onFocus: (): void => {\n setFocusedInput(FocusedInput.StartDate);\n },\n })}\n placeholder={format(today, dateFormat).toString()}\n {...(focusedInput === FocusedInput.StartDate && {\n 'data-focus': true,\n })}\n {...inputProps}\n />\n {withDateRange && (\n <>\n <Text> - </Text>\n <TextInput\n className=\"DatePicker__Input--End\"\n data-testid={`${dataTestId}-end`}\n rightElement={\n <Flex\n {...(!inputProps?.disabled && {\n onClick: (): void => setFocusedInput(FocusedInput.StartDate),\n })}\n h=\"100%\"\n align=\"center\"\n >\n <Icon name=\"calendarDate\" size={iconSize} />\n </Flex>\n }\n value={getInputValue(endDate, dateFormat, '')}\n onChange={onInputChange}\n {...(!inputProps?.disabled && {\n onFocus: (): void => setFocusedInput(FocusedInput.EndDate),\n })}\n onKeyDown={onKeyDown}\n placeholder={format(today, dateFormat).toString()}\n {...(focusedInput === FocusedInput.EndDate && {\n 'data-focus': true,\n })}\n {...inputProps}\n />\n </>\n )}\n </HStack>\n );\n}\n","import React, { useCallback } from 'react';\nimport { Button } from 'components/Button/button.component';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { DateRange } from '../../datePicker.types';\nimport { useDatePickerContext } from '../../context/datePicker.context';\nimport { usePopoverContext } from '@chakra-ui/react/popover';\n\nexport interface DatePickerFooterProps {\n /** Text to display in the submit button.\n * @default Apply\n */\n buttonText?: string;\n /** Callback function to be called when the submit button is clicked. */\n onSubmit?: ({ startDate, endDate }: DateRange) => void;\n /** If true, the reset button will be hidden. */\n hideResetButton?: boolean;\n /** Data test id for the footer.\n * @default kibble-datepicker-footer\n */\n 'data-testid'?: string;\n}\n\nexport function DatePickerFooter({\n buttonText = 'Apply',\n onSubmit,\n hideResetButton,\n}: DatePickerFooterProps): React.JSX.Element {\n const { startDate, endDate, clearDates, standalone } = useDatePickerContext();\n const { open, setOpen } = usePopoverContext();\n\n const handleSubmit = useCallback((): void => {\n if (!standalone) {\n setOpen(false);\n }\n\n if (onSubmit) {\n onSubmit({ startDate, endDate });\n }\n }, [standalone, setOpen, onSubmit, startDate, endDate]);\n\n return (\n <HStack\n w=\"100%\"\n justify={hideResetButton ? 'end' : 'space-between'}\n align=\"center\"\n borderTop=\"1px\"\n borderColor=\"border.default\"\n px={3}\n py={2}\n >\n {!hideResetButton && (\n <Button size=\"sm\" variant=\"ghostNeutral\" onClick={() => clearDates({ open })}>\n Clear Dates\n </Button>\n )}\n <Button size=\"sm\" onClick={handleSubmit}>\n {buttonText}\n </Button>\n </HStack>\n );\n}\n","import React from 'react';\nimport { DateProps } from './datePicker.types';\nimport { TextInputProps } from 'components/TextInput/textInput.component';\nimport { Placement } from 'shared/types/placement';\nimport { DatePickerProvider } from './context/datePicker.provider';\nimport { DatePickerInput } from './components/DatePickerInput/datePickerInput.component';\nimport { DatePickerFooter, DatePickerFooterProps } from './components/DatePickerFooter/datePickerFooter.component';\nimport { DatePickerHeader } from './components/DatePickerHeader/datePickerHeader.component';\nimport { DatePickerCalendar } from './components/DatePickerCalendar/datePickerCalendar.component';\nimport { Popover as CPopover } from '@chakra-ui/react/popover';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { popoverRecipe } from 'components/Popover/popover.recipe';\nimport { usePortalContentRef } from 'hooks/usePortalContentRef';\nimport { Divider } from 'components/Divider';\n\nexport interface DatePickerProps extends DateProps {\n /** Props to customize the calendar footer. Only applicable when `withDateRange` is true. */\n footerProps?: DatePickerFooterProps;\n /**\n * Hides the calendar footer with the submit button. Only applicable when `withDateRange` is true.\n * @default false\n */\n hideFooter?: boolean;\n /** Props to customize the input field. See `TextInput` for more information. */\n inputProps?: Omit<TextInputProps, 'onChange' | 'value' | 'isClearable' | 'onClear'>;\n /**\n * Placement of the calendar popover\n * @default bottom\n */\n placement?: Placement;\n /**\n * If true, the date picker will be rendered in a portal.\n * @default true\n */\n portalled?: boolean;\n /**\n * If true, the date picker will render two input fields that control both the start and end date for a range selection.\n * @default false\n */\n withDateRange?: boolean;\n /** Data test id for the date picker.\n * @default kibble-datepicker\n */\n 'data-testid'?: string;\n}\n\nexport const DatePicker = (props: DatePickerProps): React.JSX.Element => {\n const {\n footerProps,\n hideFooter = false,\n inputProps,\n portalled = true,\n withDateRange = false,\n ['data-testid']: dataTestId = 'kibble-datepicker',\n } = props;\n const { contentRef } = usePortalContentRef();\n const recipe = useSlotRecipe({ recipe: popoverRecipe });\n const styles = recipe();\n\n return (\n <DatePickerProvider {...props}>\n <CPopover.Trigger w=\"100%\">\n <DatePickerInput inputProps={{ ...inputProps, readOnly: true }} />\n </CPopover.Trigger>\n <Portal container={contentRef || undefined} disabled={!portalled}>\n <CPopover.Positioner className=\"DatePicker\" data-testid={dataTestId}>\n <CPopover.Content\n className=\"DatePicker__Content\"\n data-testid={`${dataTestId}-content`}\n css={{ ...styles.content, minW: '340px' }}\n >\n <CPopover.Body css={{ '--popover-padding': 0 }}>\n <DatePickerHeader />\n <Divider />\n <DatePickerCalendar />\n {withDateRange && !hideFooter && <DatePickerFooter {...footerProps} />}\n </CPopover.Body>\n </CPopover.Content>\n </CPopover.Positioner>\n </Portal>\n </DatePickerProvider>\n );\n};\n"],"names":["isBefore","date","dateToCompare","toDate","isDateAfterMin","minDate","isAfter","isDateBeforeMax","maxDate","DatePickerInput","inputProps","dataTestId","setFocusedInput","startDate","endDate","focusedInput","dateFormat","withDateRange","onDateChange","onDateSelect","onClose","useDatePickerContext","open","setOpen","usePopoverContext","iconSize","onKeyDown","e","onInputChange","dateValue","parsedDate","parseDate","today","isDate","HStack","jsx","TextInput","Flex","FocusedInput","Icon","getInputValue","format","jsxs","Fragment","Text","DatePickerFooter","buttonText","onSubmit","hideResetButton","clearDates","standalone","handleSubmit","useCallback","Button","DatePicker","props","footerProps","hideFooter","portalled","contentRef","usePortalContentRef","styles","useSlotRecipe","popoverRecipe","DatePickerProvider","CPopover.Trigger","Portal","CPopover.Positioner","CPopover.Content","CPopover.Body","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":"isBAoBO,SAASA,EAASC,EAAMC,EAAe,CAC5C,MAAO,CAACC,EAAAA,OAAOF,CAAI,EAAI,CAACE,EAAAA,OAAOD,CAAa,CAC9C,CCnBa,MAAAE,EAAiB,CAACH,EAAYI,IAA6BA,EAAUC,EAAAA,QAAQL,EAAMI,CAAO,EAAI,GAC9FE,EAAkB,CAACN,EAAYO,IAA6BA,EAAUR,EAASC,EAAMO,CAAO,EAAI,GCkBtG,SAASC,EAAgB,CAC9B,WAAAC,EACA,CAAC,aAAa,EAAGC,EAAa,yBAChC,EAA4C,CACpC,KAAA,CACJ,gBAAAC,EACA,UAAAC,EACA,QAAAC,EACA,aAAAC,EACA,WAAAC,EACA,cAAAC,EACA,QAAAZ,EACA,QAAAG,EACA,aAAAU,EACA,aAAAC,EACA,QAAAC,GACEC,uBAAqB,EACnB,CAAE,KAAAC,EAAM,QAAAC,CAAQ,EAAIC,oBAAkB,EACtCC,EAAWf,GAAY,MAAQ,KAE/BgB,EAAaC,GAAiC,CAC9CA,EAAE,MAAQ,SAAWL,IACvBC,EAAQ,EAAK,EACLH,EAAA,EACRO,EAAE,eAAe,EACjBA,EAAE,gBAAgB,EAEtB,EAEMC,EAAiBD,GAA2C,CAC1D,MAAAE,EAAYF,EAAE,OAA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,CAEJ","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { i as R, u as y, U as k, F as c, x as W, t as D, a as B, b as T, c as A } from "./datePicker.provider-DjDP292O.js";
|
|
3
|
+
import { W as P } from "./textInput.component-BeiTxTkS.js";
|
|
4
|
+
import { I as C } from "./icon.component-PV_nHBId.js";
|
|
5
|
+
import { W as H } from "./text.component-DhuUgP3j.js";
|
|
6
|
+
import { t as b, f as v, i as O } from "./format-CqTHHSak.js";
|
|
7
|
+
import { u as I } from "./popover-root-provider-CFn2dthZ.js";
|
|
8
|
+
import { H as _ } from "./h-stack-8q5nAOg0.js";
|
|
9
|
+
import { F } from "./flex-CX-8gE9T.js";
|
|
10
|
+
import { useCallback as $ } from "react";
|
|
11
|
+
import { B as S } from "./button.component-BO6oee_V.js";
|
|
12
|
+
import { p as M } from "./popover.recipe-DPwwsWLb.js";
|
|
13
|
+
import { u as U } from "./usePortalContentRef-DO_jc4W9.js";
|
|
14
|
+
import { D as K } from "./divider.component-CFOh4Nw3.js";
|
|
15
|
+
import { u as V } from "./create-slot-recipe-context-D_FXDJGp.js";
|
|
16
|
+
import { P as q } from "./index-DcmJgLUo.js";
|
|
17
|
+
import { P as G, a as J, b as L, c as Q } from "./popover-Gb1fXSR7.js";
|
|
18
|
+
function X(t, a) {
|
|
19
|
+
return +b(t) < +b(a);
|
|
20
|
+
}
|
|
21
|
+
const Y = (t, a) => a ? R(t, a) : !0, Z = (t, a) => a ? X(t, a) : !0;
|
|
22
|
+
function ee({
|
|
23
|
+
inputProps: t,
|
|
24
|
+
["data-testid"]: a = "kibble-datepicker-input"
|
|
25
|
+
}) {
|
|
26
|
+
const {
|
|
27
|
+
setFocusedInput: s,
|
|
28
|
+
startDate: o,
|
|
29
|
+
endDate: n,
|
|
30
|
+
focusedInput: i,
|
|
31
|
+
dateFormat: r,
|
|
32
|
+
withDateRange: l,
|
|
33
|
+
minDate: d,
|
|
34
|
+
maxDate: p,
|
|
35
|
+
onDateChange: x,
|
|
36
|
+
onDateSelect: w,
|
|
37
|
+
onClose: E
|
|
38
|
+
} = y(), { open: z, setOpen: N } = I(), h = t?.size || "md", j = (m) => {
|
|
39
|
+
m.key === "Enter" && z && (N(!1), E(), m.preventDefault(), m.stopPropagation());
|
|
40
|
+
}, g = (m) => {
|
|
41
|
+
const u = m.target.value, f = W(u, r, D);
|
|
42
|
+
u.length === r.length && O(f) && Y(f, d) && Z(f, p) && w(f), !u.length && x && x({ startDate: null, endDate: null });
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ e.jsxs(_, { w: "100%", className: "DatePicker__Trigger", "data-testid": a, children: [
|
|
45
|
+
/* @__PURE__ */ e.jsx(
|
|
46
|
+
P,
|
|
47
|
+
{
|
|
48
|
+
className: "DatePicker__Input--Start",
|
|
49
|
+
"data-testid": `${a}-start`,
|
|
50
|
+
autoComplete: "off",
|
|
51
|
+
rightElement: /* @__PURE__ */ e.jsx(
|
|
52
|
+
F,
|
|
53
|
+
{
|
|
54
|
+
...!t?.disabled && {
|
|
55
|
+
onClick: () => s(c.StartDate)
|
|
56
|
+
},
|
|
57
|
+
h: "100%",
|
|
58
|
+
align: "center",
|
|
59
|
+
children: /* @__PURE__ */ e.jsx(C, { name: "calendarDate", size: h })
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
value: k(o, r, ""),
|
|
63
|
+
onChange: g,
|
|
64
|
+
onKeyDown: j,
|
|
65
|
+
...!t?.disabled && {
|
|
66
|
+
onFocus: () => {
|
|
67
|
+
s(c.StartDate);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
placeholder: v(D, r).toString(),
|
|
71
|
+
...i === c.StartDate && {
|
|
72
|
+
"data-focus": !0
|
|
73
|
+
},
|
|
74
|
+
...t
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
l && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
78
|
+
/* @__PURE__ */ e.jsx(H, { children: " - " }),
|
|
79
|
+
/* @__PURE__ */ e.jsx(
|
|
80
|
+
P,
|
|
81
|
+
{
|
|
82
|
+
className: "DatePicker__Input--End",
|
|
83
|
+
"data-testid": `${a}-end`,
|
|
84
|
+
rightElement: /* @__PURE__ */ e.jsx(
|
|
85
|
+
F,
|
|
86
|
+
{
|
|
87
|
+
...!t?.disabled && {
|
|
88
|
+
onClick: () => s(c.StartDate)
|
|
89
|
+
},
|
|
90
|
+
h: "100%",
|
|
91
|
+
align: "center",
|
|
92
|
+
children: /* @__PURE__ */ e.jsx(C, { name: "calendarDate", size: h })
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
value: k(n, r, ""),
|
|
96
|
+
onChange: g,
|
|
97
|
+
...!t?.disabled && {
|
|
98
|
+
onFocus: () => s(c.EndDate)
|
|
99
|
+
},
|
|
100
|
+
onKeyDown: j,
|
|
101
|
+
placeholder: v(D, r).toString(),
|
|
102
|
+
...i === c.EndDate && {
|
|
103
|
+
"data-focus": !0
|
|
104
|
+
},
|
|
105
|
+
...t
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] })
|
|
109
|
+
] });
|
|
110
|
+
}
|
|
111
|
+
function te({
|
|
112
|
+
buttonText: t = "Apply",
|
|
113
|
+
onSubmit: a,
|
|
114
|
+
hideResetButton: s
|
|
115
|
+
}) {
|
|
116
|
+
const { startDate: o, endDate: n, clearDates: i, standalone: r } = y(), { open: l, setOpen: d } = I(), p = $(() => {
|
|
117
|
+
r || d(!1), a && a({ startDate: o, endDate: n });
|
|
118
|
+
}, [r, d, a, o, n]);
|
|
119
|
+
return /* @__PURE__ */ e.jsxs(
|
|
120
|
+
_,
|
|
121
|
+
{
|
|
122
|
+
w: "100%",
|
|
123
|
+
justify: s ? "end" : "space-between",
|
|
124
|
+
align: "center",
|
|
125
|
+
borderTop: "1px",
|
|
126
|
+
borderColor: "border.default",
|
|
127
|
+
px: 3,
|
|
128
|
+
py: 2,
|
|
129
|
+
children: [
|
|
130
|
+
!s && /* @__PURE__ */ e.jsx(S, { size: "sm", variant: "ghostNeutral", onClick: () => i({ open: l }), children: "Clear Dates" }),
|
|
131
|
+
/* @__PURE__ */ e.jsx(S, { size: "sm", onClick: p, children: t })
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
const ge = (t) => {
|
|
137
|
+
const {
|
|
138
|
+
footerProps: a,
|
|
139
|
+
hideFooter: s = !1,
|
|
140
|
+
inputProps: o,
|
|
141
|
+
portalled: n = !0,
|
|
142
|
+
withDateRange: i = !1,
|
|
143
|
+
["data-testid"]: r = "kibble-datepicker"
|
|
144
|
+
} = t, { contentRef: l } = U(), p = V({ recipe: M })();
|
|
145
|
+
return /* @__PURE__ */ e.jsxs(B, { ...t, children: [
|
|
146
|
+
/* @__PURE__ */ e.jsx(G, { w: "100%", children: /* @__PURE__ */ e.jsx(ee, { inputProps: { ...o, readOnly: !0 } }) }),
|
|
147
|
+
/* @__PURE__ */ e.jsx(q, { container: l || void 0, disabled: !n, children: /* @__PURE__ */ e.jsx(J, { className: "DatePicker", "data-testid": r, children: /* @__PURE__ */ e.jsx(
|
|
148
|
+
L,
|
|
149
|
+
{
|
|
150
|
+
className: "DatePicker__Content",
|
|
151
|
+
"data-testid": `${r}-content`,
|
|
152
|
+
css: { ...p.content, minW: "340px" },
|
|
153
|
+
children: /* @__PURE__ */ e.jsxs(Q, { css: { "--popover-padding": 0 }, children: [
|
|
154
|
+
/* @__PURE__ */ e.jsx(T, {}),
|
|
155
|
+
/* @__PURE__ */ e.jsx(K, {}),
|
|
156
|
+
/* @__PURE__ */ e.jsx(A, {}),
|
|
157
|
+
i && !s && /* @__PURE__ */ e.jsx(te, { ...a })
|
|
158
|
+
] })
|
|
159
|
+
}
|
|
160
|
+
) }) })
|
|
161
|
+
] });
|
|
162
|
+
};
|
|
163
|
+
export {
|
|
164
|
+
ge as D
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=datePicker.component-DuI1ybKD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datePicker.component-DuI1ybKD.js","sources":["../../node_modules/date-fns/isBefore.js","../../src/components/DatePicker/components/DatePickerInput/datePickerInput.utils.ts","../../src/components/DatePicker/components/DatePickerInput/datePickerInput.component.tsx","../../src/components/DatePicker/components/DatePickerFooter/datePickerFooter.component.tsx","../../src/components/DatePicker/datePicker.component.tsx"],"sourcesContent":["import { toDate } from \"./toDate.js\";\n\n/**\n * @name isBefore\n * @category Common Helpers\n * @summary Is the first date before the second one?\n *\n * @description\n * Is the first date before the second one?\n *\n * @param date - The date that should be before the other one to return true\n * @param dateToCompare - The date to compare with\n *\n * @returns The first date is before the second date\n *\n * @example\n * // Is 10 July 1989 before 11 February 1987?\n * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> false\n */\nexport function isBefore(date, dateToCompare) {\n return +toDate(date) < +toDate(dateToCompare);\n}\n\n// Fallback for modularized imports:\nexport default isBefore;\n","import isAfter from 'date-fns/isAfter';\nimport isBefore from 'date-fns/isBefore';\n\nexport const isDateAfterMin = (date: Date, minDate?: Date): boolean => (minDate ? isAfter(date, minDate) : true);\nexport const isDateBeforeMax = (date: Date, maxDate?: Date): boolean => (maxDate ? isBefore(date, maxDate) : true);\n","import React, { ChangeEvent } from 'react';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { TextInput, TextInputProps } from 'components/TextInput/textInput.component';\nimport { Icon } from 'components/Icon/icon.component';\nimport { Text } from 'components/Text/text.component';\nimport isDate from 'date-fns/isDate';\nimport { getInputValue, parseDate } from '@datepicker-react/hooks';\nimport { isDateAfterMin, isDateBeforeMax } from './datePickerInput.utils';\nimport { FocusedInput, today, useDatePickerContext } from '../../context/datePicker.context';\nimport format from 'date-fns/format';\nimport { usePopoverContext } from '@chakra-ui/react/popover';\n\ninterface DatePickerInputProps {\n /** Props to customize the input field. See `TextInput` for more information. */\n inputProps?: Omit<TextInputProps, 'onChange' | 'value' | 'isClearable' | 'onClear'>;\n /** Data test id for the input.\n * @default kibble-datepicker-input\n */\n 'data-testid'?: string;\n}\n\nexport function DatePickerInput({\n inputProps,\n ['data-testid']: dataTestId = 'kibble-datepicker-input',\n}: DatePickerInputProps): React.JSX.Element {\n const {\n setFocusedInput,\n startDate,\n endDate,\n focusedInput,\n dateFormat,\n withDateRange,\n minDate,\n maxDate,\n onDateChange,\n onDateSelect,\n onClose,\n } = useDatePickerContext();\n const { open, setOpen } = usePopoverContext();\n const iconSize = inputProps?.size || 'md';\n\n const onKeyDown = (e: React.KeyboardEvent): void => {\n if (e.key === 'Enter' && open) {\n setOpen(false);\n onClose();\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>): void => {\n const dateValue = e.target.value;\n const parsedDate = parseDate(dateValue, dateFormat, today);\n\n if (\n dateValue.length === dateFormat.length &&\n isDate(parsedDate) &&\n isDateAfterMin(parsedDate, minDate) &&\n isDateBeforeMax(parsedDate, maxDate)\n ) {\n onDateSelect(parsedDate);\n }\n\n // Trigger change when input is empty\n if (!dateValue.length && onDateChange) {\n onDateChange({ startDate: null, endDate: null });\n }\n };\n\n return (\n <HStack w=\"100%\" className=\"DatePicker__Trigger\" data-testid={dataTestId}>\n <TextInput\n className=\"DatePicker__Input--Start\"\n data-testid={`${dataTestId}-start`}\n autoComplete=\"off\"\n rightElement={\n <Flex\n {...(!inputProps?.disabled && {\n onClick: (): void => setFocusedInput(FocusedInput.StartDate),\n })}\n h=\"100%\"\n align=\"center\"\n >\n <Icon name=\"calendarDate\" size={iconSize} />\n </Flex>\n }\n value={getInputValue(startDate, dateFormat, '')}\n onChange={onInputChange}\n onKeyDown={onKeyDown}\n {...(!inputProps?.disabled && {\n onFocus: (): void => {\n setFocusedInput(FocusedInput.StartDate);\n },\n })}\n placeholder={format(today, dateFormat).toString()}\n {...(focusedInput === FocusedInput.StartDate && {\n 'data-focus': true,\n })}\n {...inputProps}\n />\n {withDateRange && (\n <>\n <Text> - </Text>\n <TextInput\n className=\"DatePicker__Input--End\"\n data-testid={`${dataTestId}-end`}\n rightElement={\n <Flex\n {...(!inputProps?.disabled && {\n onClick: (): void => setFocusedInput(FocusedInput.StartDate),\n })}\n h=\"100%\"\n align=\"center\"\n >\n <Icon name=\"calendarDate\" size={iconSize} />\n </Flex>\n }\n value={getInputValue(endDate, dateFormat, '')}\n onChange={onInputChange}\n {...(!inputProps?.disabled && {\n onFocus: (): void => setFocusedInput(FocusedInput.EndDate),\n })}\n onKeyDown={onKeyDown}\n placeholder={format(today, dateFormat).toString()}\n {...(focusedInput === FocusedInput.EndDate && {\n 'data-focus': true,\n })}\n {...inputProps}\n />\n </>\n )}\n </HStack>\n );\n}\n","import React, { useCallback } from 'react';\nimport { Button } from 'components/Button/button.component';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { DateRange } from '../../datePicker.types';\nimport { useDatePickerContext } from '../../context/datePicker.context';\nimport { usePopoverContext } from '@chakra-ui/react/popover';\n\nexport interface DatePickerFooterProps {\n /** Text to display in the submit button.\n * @default Apply\n */\n buttonText?: string;\n /** Callback function to be called when the submit button is clicked. */\n onSubmit?: ({ startDate, endDate }: DateRange) => void;\n /** If true, the reset button will be hidden. */\n hideResetButton?: boolean;\n /** Data test id for the footer.\n * @default kibble-datepicker-footer\n */\n 'data-testid'?: string;\n}\n\nexport function DatePickerFooter({\n buttonText = 'Apply',\n onSubmit,\n hideResetButton,\n}: DatePickerFooterProps): React.JSX.Element {\n const { startDate, endDate, clearDates, standalone } = useDatePickerContext();\n const { open, setOpen } = usePopoverContext();\n\n const handleSubmit = useCallback((): void => {\n if (!standalone) {\n setOpen(false);\n }\n\n if (onSubmit) {\n onSubmit({ startDate, endDate });\n }\n }, [standalone, setOpen, onSubmit, startDate, endDate]);\n\n return (\n <HStack\n w=\"100%\"\n justify={hideResetButton ? 'end' : 'space-between'}\n align=\"center\"\n borderTop=\"1px\"\n borderColor=\"border.default\"\n px={3}\n py={2}\n >\n {!hideResetButton && (\n <Button size=\"sm\" variant=\"ghostNeutral\" onClick={() => clearDates({ open })}>\n Clear Dates\n </Button>\n )}\n <Button size=\"sm\" onClick={handleSubmit}>\n {buttonText}\n </Button>\n </HStack>\n );\n}\n","import React from 'react';\nimport { DateProps } from './datePicker.types';\nimport { TextInputProps } from 'components/TextInput/textInput.component';\nimport { Placement } from 'shared/types/placement';\nimport { DatePickerProvider } from './context/datePicker.provider';\nimport { DatePickerInput } from './components/DatePickerInput/datePickerInput.component';\nimport { DatePickerFooter, DatePickerFooterProps } from './components/DatePickerFooter/datePickerFooter.component';\nimport { DatePickerHeader } from './components/DatePickerHeader/datePickerHeader.component';\nimport { DatePickerCalendar } from './components/DatePickerCalendar/datePickerCalendar.component';\nimport { Popover as CPopover } from '@chakra-ui/react/popover';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { popoverRecipe } from 'components/Popover/popover.recipe';\nimport { usePortalContentRef } from 'hooks/usePortalContentRef';\nimport { Divider } from 'components/Divider';\n\nexport interface DatePickerProps extends DateProps {\n /** Props to customize the calendar footer. Only applicable when `withDateRange` is true. */\n footerProps?: DatePickerFooterProps;\n /**\n * Hides the calendar footer with the submit button. Only applicable when `withDateRange` is true.\n * @default false\n */\n hideFooter?: boolean;\n /** Props to customize the input field. See `TextInput` for more information. */\n inputProps?: Omit<TextInputProps, 'onChange' | 'value' | 'isClearable' | 'onClear'>;\n /**\n * Placement of the calendar popover\n * @default bottom\n */\n placement?: Placement;\n /**\n * If true, the date picker will be rendered in a portal.\n * @default true\n */\n portalled?: boolean;\n /**\n * If true, the date picker will render two input fields that control both the start and end date for a range selection.\n * @default false\n */\n withDateRange?: boolean;\n /** Data test id for the date picker.\n * @default kibble-datepicker\n */\n 'data-testid'?: string;\n}\n\nexport const DatePicker = (props: DatePickerProps): React.JSX.Element => {\n const {\n footerProps,\n hideFooter = false,\n inputProps,\n portalled = true,\n withDateRange = false,\n ['data-testid']: dataTestId = 'kibble-datepicker',\n } = props;\n const { contentRef } = usePortalContentRef();\n const recipe = useSlotRecipe({ recipe: popoverRecipe });\n const styles = recipe();\n\n return (\n <DatePickerProvider {...props}>\n <CPopover.Trigger w=\"100%\">\n <DatePickerInput inputProps={{ ...inputProps, readOnly: true }} />\n </CPopover.Trigger>\n <Portal container={contentRef || undefined} disabled={!portalled}>\n <CPopover.Positioner className=\"DatePicker\" data-testid={dataTestId}>\n <CPopover.Content\n className=\"DatePicker__Content\"\n data-testid={`${dataTestId}-content`}\n css={{ ...styles.content, minW: '340px' }}\n >\n <CPopover.Body css={{ '--popover-padding': 0 }}>\n <DatePickerHeader />\n <Divider />\n <DatePickerCalendar />\n {withDateRange && !hideFooter && <DatePickerFooter {...footerProps} />}\n </CPopover.Body>\n </CPopover.Content>\n </CPopover.Positioner>\n </Portal>\n </DatePickerProvider>\n );\n};\n"],"names":["isBefore","date","dateToCompare","toDate","isDateAfterMin","minDate","isAfter","isDateBeforeMax","maxDate","DatePickerInput","inputProps","dataTestId","setFocusedInput","startDate","endDate","focusedInput","dateFormat","withDateRange","onDateChange","onDateSelect","onClose","useDatePickerContext","open","setOpen","usePopoverContext","iconSize","onKeyDown","e","onInputChange","dateValue","parsedDate","parseDate","today","isDate","HStack","jsx","TextInput","Flex","FocusedInput","Icon","getInputValue","format","jsxs","Fragment","Text","DatePickerFooter","buttonText","onSubmit","hideResetButton","clearDates","standalone","handleSubmit","useCallback","Button","DatePicker","props","footerProps","hideFooter","portalled","contentRef","usePortalContentRef","styles","useSlotRecipe","popoverRecipe","DatePickerProvider","CPopover.Trigger","Portal","CPopover.Positioner","CPopover.Content","CPopover.Body","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":";;;;;;;;;;;;;;;;;AAoBO,SAASA,EAASC,GAAMC,GAAe;AAC5C,SAAO,CAACC,EAAOF,CAAI,IAAI,C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A;AAAA,EAAA,GACF;AAEJ;","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../chunks/calendar.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../chunks/calendar.component-DMoLaJfB.js");exports.Calendar=e.Calendar;exports.CalendarTodayButton=e.CalendarTodayButton;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../chunks/datePicker.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../chunks/datePicker.component-BuGpHTzS.js"),t=require("../../../chunks/datePicker.provider-i35-VNAb.js");exports.DatePicker=e.DatePicker;exports.DateFormats=t.DateFormats;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../../chunks/alert.component-nhRTQ5KK.js"),y=require("../../chunks/alert.types-8mtsdXr4.js"),g=require("../../chunks/avatar.component-BGgZoVJS.js"),s=require("../../chunks/avatar.types-Bmt5Uhfb.js"),b=require("../../chunks/avatarGroup.component-CJCQSIyr.js"),P=require("../../chunks/button.component-DjdgBXDC.js"),e=require("../../chunks/button.types-DXP4uRV8.js"),C=require("../../chunks/buttonGroup.component-pR0mvmm7.js"),c=require("../../chunks/calendar.component-DMoLaJfB.js"),k=require("../../chunks/card.component-BmBiYbMV.js"),z=require("../../chunks/card.types-MvkQTTZF.js"),h=require("../../chunks/characterCounter.component-BRHLt929.js"),B=require("../../chunks/checkbox.component-C132vkan.js"),D=require("../../chunks/checkboxGroup.component-2U0ZW1TD.js"),I=require("../../chunks/conversationCard.component-CscMIq51.js"),x=require("../../chunks/datePicker.component-BuGpHTzS.js"),V=require("../../chunks/datePicker.provider-i35-VNAb.js"),o=require("../../chunks/dateTimePicker.component-BlWhC5aT.js"),f=require("../../chunks/divider.component-BX3zyB7O.js"),n=require("../../chunks/divider.types-DBNcs0IR.js"),A=require("../../chunks/heading.component-DnoZOXdz.js"),W=require("../../chunks/icon.component-B1hr5lLa.js"),G=require("../../chunks/icon.types-2obj_NKG.js"),M=require("../../chunks/link.component-_YXG8MDq.js"),p=require("../../chunks/logo.types-88a31xCx.js"),u=require("../../chunks/maintenanceBanner.types-BsNjAlXa.js"),R=require("../../chunks/menu.component-D2V9Q1Y5.js"),t=require("../../chunks/modal.types-Bj6PrItn.js"),w=require("../../chunks/notificationCounter.component-CBwi5vXa.js"),d=require("../../chunks/notificationCounter.types-B_-siNfi.js"),L=require("../../chunks/picture.component-BA2hgdZy.js"),m=require("../../chunks/pinInput.types-Can9f1Eu.js"),O=require("../../chunks/popover.component-DTjA1GSd.js"),r=require("../../chunks/popover.types-ChA9ccQ2.js"),i=require("../../chunks/radioGroup.types-U1ep9nrN.js"),N=require("../../chunks/radiomark.component-YJNr68s7.js"),E=require("../../chunks/rating.component-DsHkKmA7.js"),F=require("../../chunks/ratingDots.component-CZ370iI3.js"),H=require("../../chunks/select.component-OrsHXCMz.js"),K=require("../../chunks/sortableList.component-2yX2pXs7.js"),j=require("../../chunks/spinner.component-Dq6u4vVL.js"),J=require("../../chunks/spinner.types-BCLN5-H2.js"),l=require("../../chunks/styledAvatar.types-BG2G_U-W.js"),_=require("../../chunks/swatch.types-AZLB8OWG.js"),Q=require("../../chunks/switch.component-BYEMhBCA.js"),a=require("../../chunks/tab.types-DSPWRVCF.js"),U=require("../../chunks/tag.component-C98Wf07v.js"),q=require("../../chunks/tag.types-BnDFgTvb.js"),v=require("../../chunks/tagBlock.component-B899iqQP.js"),X=require("../../chunks/text.component-BDDz5KQP.js"),Y=require("../../chunks/textInput.component-CwTc0h_F.js"),Z=require("../../chunks/textarea.component-BIg_XX_R.js"),T=require("../../chunks/timePicker.component-D5hw80VV.js"),$=require("../../chunks/timeRange.component-D3Db8lvh.js"),ee=require("../../chunks/timestamp.component-BfmZPfy5.js"),te=require("./Toast/index.cjs"),oe=require("../../chunks/tooltip.component-DBw-hAPU.js"),ne=require("../../chunks/numberInput.component-DGPEz0Fv.js");exports.Alert=S.Alert;exports.alertButtonPositions=y.alertButtonPositions;exports.Avatar=g.Avatar;exports.avatarSizes=s.avatarSizes;exports.avatarVariants=s.avatarVariants;exports.AvatarGroup=b.AvatarGroup;exports.Button=P.Button;exports.buttonConfigVariants=e.buttonConfigVariants;exports.buttonIconPositions=e.buttonIconPositions;exports.buttonSizes=e.buttonSizes;exports.buttonSpinnerPlacements=e.buttonSpinnerPlacements;exports.buttonVariants=e.buttonVariants;exports.ButtonGroup=C.ButtonGroup;exports.Calendar=c.Calendar;exports.CalendarTodayButton=c.CalendarTodayButton;exports.Card=k.Card;exports.cardSizes=z.cardSizes;exports.CharacterCounter=h.CharacterCounter;exports.Checkbox=B.WrappedCheckbox;exports.CheckboxGroup=D.WrappedCheckboxGroup;exports.ConversationCard=I.ConversationCard;exports.DatePicker=x.DatePicker;exports.DateFormats=V.DateFormats;exports.DateTimePicker=o.DateTimePicker;exports.DateTimePickerDefaultOptionValue=o.DateTimePickerDefaultOptionValue;exports.calendarViews=o.calendarViews;exports.Divider=f.Divider;exports.dividerOrientations=n.dividerOrientations;exports.dividerSizes=n.dividerSizes;exports.dividerVariants=n.dividerVariants;exports.Heading=A.WrappedHeading;exports.Icon=W.Icon;exports.iconSizes=G.iconSizes;exports.Link=M.Link;exports.Logo=p.Logo;exports.logoTypes=p.logoTypes;exports.MaintenanceBanner=u.MaintenanceBanner;exports.maintenanceBannerEnvKeys=u.maintenanceBannerEnvKeys;exports.Menu=R.Menu;exports.Modal=t.Modal;exports.modalMotionPresets=t.modalMotionPresets;exports.modalPlacements=t.modalPlacements;exports.modalScrollBehaviors=t.modalScrollBehaviors;exports.modalSizes=t.modalSizes;exports.NotificationCounter=w.NotificationCounter;exports.notificationCounterSizes=d.notificationCounterSizes;exports.notificationCounterVariants=d.notificationCounterVariants;exports.Picture=L.Picture;exports.PinInput=m.WrappedPinInput;exports.pinInputTypes=m.pinInputTypes;exports.Popover=O.Popover;exports.popoverSizes=r.popoverSizes;exports.popoverTriggerTypes=r.popoverTriggerTypes;exports.popoverVariants=r.popoverVariants;exports.RadioGroup=i.WrappedRadioGroup;exports.radioAlignments=i.radioAlignments;exports.radioTypes=i.radioTypes;exports.Radiomark=N.Radiomark;exports.Rating=E.WrappedRating;exports.RatingDots=F.WrappedRatingDots;exports.Select=H.WrappedSelect;exports.SortableList=K.SortableList;exports.Spinner=j.Spinner;exports.spinnerSizes=J.spinnerSizes;exports.StyledAvatar=l.StyledAvatar;exports.styledAvatarTypes=l.styledAvatarTypes;exports.Swatch=_.Swatch;exports.swatchSizes=_.swatchSizes;exports.Switch=Q.WrappedSwitch;exports.Tabs=a.Tabs;exports.tabIconPositions=a.tabIconPositions;exports.tabSizes=a.tabSizes;exports.Tag=U.Tag;exports.closeButtonDisplays=q.closeButtonDisplays;exports.tagSizes=q.tagSizes;exports.TagBlock=v.TagBlock;exports.TagDisabledState=v.TagDisabledState;exports.Text=X.WrappedText;exports.TextInput=Y.WrappedTextInput;exports.Textarea=Z.WrappedTextarea;exports.Meridiem=T.Meridiem;exports.TimePicker=T.TimePicker;exports.TimeRange=$.TimeRange;exports.Timestamp=ee.Timestamp;exports.useToast=te.useToast;exports.Tooltip=oe.Tooltip;exports.NumberInput=ne.WrappedNumberInput;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../chunks/alert.component-nhRTQ5KK.js"),h=require("../chunks/alert.types-8mtsdXr4.js"),S=require("../chunks/avatar.component-BGgZoVJS.js"),p=require("../chunks/avatar.types-Bmt5Uhfb.js"),k=require("../chunks/avatarGroup.component-CJCQSIyr.js"),C=require("../chunks/button.component-DjdgBXDC.js"),e=require("../chunks/button.types-DXP4uRV8.js"),P=require("../chunks/buttonGroup.component-pR0mvmm7.js"),u=require("../chunks/calendar.component-DMoLaJfB.js"),D=require("../chunks/card.component-BmBiYbMV.js"),M=require("../chunks/card.types-MvkQTTZF.js"),z=require("../chunks/characterCounter.component-BRHLt929.js"),x=require("../chunks/checkbox.component-C132vkan.js"),B=require("../chunks/checkboxGroup.component-2U0ZW1TD.js"),V=require("../chunks/conversationCard.component-CscMIq51.js"),f=require("../chunks/datePicker.component-BuGpHTzS.js"),I=require("../chunks/datePicker.provider-i35-VNAb.js"),n=require("../chunks/dateTimePicker.component-BlWhC5aT.js"),w=require("../chunks/divider.component-BX3zyB7O.js"),r=require("../chunks/divider.types-DBNcs0IR.js"),A=require("../chunks/heading.component-DnoZOXdz.js"),W=require("../chunks/icon.component-B1hr5lLa.js"),G=require("../chunks/icon.types-2obj_NKG.js"),R=require("../chunks/link.component-_YXG8MDq.js"),d=require("../chunks/logo.types-88a31xCx.js"),m=require("../chunks/maintenanceBanner.types-BsNjAlXa.js"),L=require("../chunks/menu.component-D2V9Q1Y5.js"),t=require("../chunks/modal.types-Bj6PrItn.js"),K=require("../chunks/notificationCounter.component-CBwi5vXa.js"),l=require("../chunks/notificationCounter.types-B_-siNfi.js"),O=require("../chunks/picture.component-BA2hgdZy.js"),_=require("../chunks/pinInput.types-Can9f1Eu.js"),N=require("../chunks/popover.component-DTjA1GSd.js"),i=require("../chunks/popover.types-ChA9ccQ2.js"),a=require("../chunks/radioGroup.types-U1ep9nrN.js"),E=require("../chunks/radiomark.component-YJNr68s7.js"),F=require("../chunks/rating.component-DsHkKmA7.js"),H=require("../chunks/ratingDots.component-CZ370iI3.js"),j=require("../chunks/select.component-OrsHXCMz.js"),J=require("../chunks/sortableList.component-2yX2pXs7.js"),Q=require("../chunks/spinner.component-Dq6u4vVL.js"),U=require("../chunks/spinner.types-BCLN5-H2.js"),q=require("../chunks/styledAvatar.types-BG2G_U-W.js"),T=require("../chunks/swatch.types-AZLB8OWG.js"),X=require("../chunks/switch.component-BYEMhBCA.js"),s=require("../chunks/tab.types-DSPWRVCF.js"),Y=require("../chunks/tag.component-C98Wf07v.js"),y=require("../chunks/tag.types-BnDFgTvb.js"),v=require("../chunks/tagBlock.component-B899iqQP.js"),Z=require("../chunks/text.component-BDDz5KQP.js"),$=require("../chunks/textInput.component-CwTc0h_F.js"),ee=require("../chunks/textarea.component-BIg_XX_R.js"),g=require("../chunks/timePicker.component-D5hw80VV.js"),te=require("../chunks/timeRange.component-D3Db8lvh.js"),oe=require("../chunks/timestamp.component-BfmZPfy5.js"),ne=require("./components/Toast/index.cjs"),re=require("../chunks/tooltip.component-DBw-hAPU.js"),ie=require("../chunks/numberInput.component-DGPEz0Fv.js"),ae=require("../chunks/withDarkMode-R08khTA6.js"),se=require("../chunks/withLightMode-Crw8xtkD.js"),ce=require("./hooks/useBreakpoint/index.cjs"),pe=require("./hooks/useColorMode/index.cjs"),ue=require("./hooks/useColorModeValue/index.cjs"),de=require("./hooks/useDeviceType/index.cjs"),o=require("./shared/types/index.cjs"),me=require("../chunks/theme-BFbOz0Jj.js"),c=require("../chunks/theme.provider-C_F9M-W3.js");exports.Alert=b.Alert;exports.alertButtonPositions=h.alertButtonPositions;exports.Avatar=S.Avatar;exports.avatarSizes=p.avatarSizes;exports.avatarVariants=p.avatarVariants;exports.AvatarGroup=k.AvatarGroup;exports.Button=C.Button;exports.buttonConfigVariants=e.buttonConfigVariants;exports.buttonIconPositions=e.buttonIconPositions;exports.buttonSizes=e.buttonSizes;exports.buttonSpinnerPlacements=e.buttonSpinnerPlacements;exports.buttonVariants=e.buttonVariants;exports.ButtonGroup=P.ButtonGroup;exports.Calendar=u.Calendar;exports.CalendarTodayButton=u.CalendarTodayButton;exports.Card=D.Card;exports.cardSizes=M.cardSizes;exports.CharacterCounter=z.CharacterCounter;exports.Checkbox=x.WrappedCheckbox;exports.CheckboxGroup=B.WrappedCheckboxGroup;exports.ConversationCard=V.ConversationCard;exports.DatePicker=f.DatePicker;exports.DateFormats=I.DateFormats;exports.DateTimePicker=n.DateTimePicker;exports.DateTimePickerDefaultOptionValue=n.DateTimePickerDefaultOptionValue;exports.calendarViews=n.calendarViews;exports.Divider=w.Divider;exports.dividerOrientations=r.dividerOrientations;exports.dividerSizes=r.dividerSizes;exports.dividerVariants=r.dividerVariants;exports.Heading=A.WrappedHeading;exports.Icon=W.Icon;exports.iconSizes=G.iconSizes;exports.Link=R.Link;exports.Logo=d.Logo;exports.logoTypes=d.logoTypes;exports.MaintenanceBanner=m.MaintenanceBanner;exports.maintenanceBannerEnvKeys=m.maintenanceBannerEnvKeys;exports.Menu=L.Menu;exports.Modal=t.Modal;exports.modalMotionPresets=t.modalMotionPresets;exports.modalPlacements=t.modalPlacements;exports.modalScrollBehaviors=t.modalScrollBehaviors;exports.modalSizes=t.modalSizes;exports.NotificationCounter=K.NotificationCounter;exports.notificationCounterSizes=l.notificationCounterSizes;exports.notificationCounterVariants=l.notificationCounterVariants;exports.Picture=O.Picture;exports.PinInput=_.WrappedPinInput;exports.pinInputTypes=_.pinInputTypes;exports.Popover=N.Popover;exports.popoverSizes=i.popoverSizes;exports.popoverTriggerTypes=i.popoverTriggerTypes;exports.popoverVariants=i.popoverVariants;exports.RadioGroup=a.WrappedRadioGroup;exports.radioAlignments=a.radioAlignments;exports.radioTypes=a.radioTypes;exports.Radiomark=E.Radiomark;exports.Rating=F.WrappedRating;exports.RatingDots=H.WrappedRatingDots;exports.Select=j.WrappedSelect;exports.SortableList=J.SortableList;exports.Spinner=Q.Spinner;exports.spinnerSizes=U.spinnerSizes;exports.StyledAvatar=q.StyledAvatar;exports.styledAvatarTypes=q.styledAvatarTypes;exports.Swatch=T.Swatch;exports.swatchSizes=T.swatchSizes;exports.Switch=X.WrappedSwitch;exports.Tabs=s.Tabs;exports.tabIconPositions=s.tabIconPositions;exports.tabSizes=s.tabSizes;exports.Tag=Y.Tag;exports.closeButtonDisplays=y.closeButtonDisplays;exports.tagSizes=y.tagSizes;exports.TagBlock=v.TagBlock;exports.TagDisabledState=v.TagDisabledState;exports.Text=Z.WrappedText;exports.TextInput=$.WrappedTextInput;exports.Textarea=ee.WrappedTextarea;exports.Meridiem=g.Meridiem;exports.TimePicker=g.TimePicker;exports.TimeRange=te.TimeRange;exports.Timestamp=oe.Timestamp;exports.useToast=ne.useToast;exports.Tooltip=re.Tooltip;exports.NumberInput=ie.WrappedNumberInput;exports.withDarkMode=ae.withDarkMode;exports.withLightMode=se.withLightMode;exports.useBreakpoint=ce.useBreakpoint;exports.useColorMode=pe.useColorMode;exports.useColorModeValue=ue.useColorModeValue;exports.useDeviceType=de.useDeviceType;exports.alignments=o.alignments;exports.flexDirections=o.flexDirections;exports.placements=o.placements;exports.statuses=o.statuses;exports.typographyVariants=o.typographyVariants;exports.colorModeThemeKey=me.colorModeThemeKey;exports.KibbleThemeProvider=c.KibbleThemeProvider;exports.kibbleThemeConfig=c.kibbleThemeConfig;exports.system=c.system;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { C as r } from "../../../chunks/calendar.component-
|
|
2
|
-
import { C as t } from "../../../chunks/calendarTodayButton.component-BUWyokw4.js";
|
|
1
|
+
import { C as r, a as d } from "../../../chunks/calendar.component-CSvl4JHD.js";
|
|
3
2
|
export {
|
|
4
3
|
r as Calendar,
|
|
5
|
-
|
|
4
|
+
d as CalendarTodayButton
|
|
6
5
|
};
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|