@televet/kibble-ui 5.0.18 → 5.0.20-alpha.hunter.1
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/alert.types-BlvzpzTn.js +2 -0
- package/dist/chunks/alert.types-BlvzpzTn.js.map +1 -0
- package/dist/chunks/{alert.types-DWm1TeiF.js → alert.types-C6EN46Ra.js} +39 -38
- package/dist/chunks/alert.types-C6EN46Ra.js.map +1 -0
- package/dist/chunks/{calendar.component-D9LIca6x.js → calendar.component-B0HGQGw3.js} +2 -2
- package/dist/chunks/{calendar.component-D9LIca6x.js.map → calendar.component-B0HGQGw3.js.map} +1 -1
- package/dist/chunks/{calendar.component-D7TVct1c.js → calendar.component-BLTCblkg.js} +2 -2
- package/dist/chunks/{calendar.component-D7TVct1c.js.map → calendar.component-BLTCblkg.js.map} +1 -1
- package/dist/chunks/{datePicker.component-WeEU0Azt.js → datePicker.component-B8ztlVdE.js} +2 -2
- package/dist/chunks/{datePicker.component-WeEU0Azt.js.map → datePicker.component-B8ztlVdE.js.map} +1 -1
- package/dist/chunks/{datePicker.component-CghreQgn.js → datePicker.component-BsXWNm5Q.js} +2 -2
- package/dist/chunks/{datePicker.component-CghreQgn.js.map → datePicker.component-BsXWNm5Q.js.map} +1 -1
- package/dist/chunks/datePicker.provider-Cxvup47n.js +15 -0
- package/dist/chunks/{datePicker.provider-D9VYbH7E.js.map → datePicker.provider-Cxvup47n.js.map} +1 -1
- package/dist/chunks/{datePicker.provider-yBypj_PJ.js → datePicker.provider-Dzj41st3.js} +750 -747
- package/dist/chunks/{datePicker.provider-yBypj_PJ.js.map → datePicker.provider-Dzj41st3.js.map} +1 -1
- package/dist/chunks/{dateTimePicker.component-xTm3GhQr.js → dateTimePicker.component-DIEHmckk.js} +2 -2
- package/dist/chunks/{dateTimePicker.component-xTm3GhQr.js.map → dateTimePicker.component-DIEHmckk.js.map} +1 -1
- package/dist/chunks/{dateTimePicker.component-BYBPNCJQ.js → dateTimePicker.component-DXL7Masq.js} +3 -3
- package/dist/chunks/{dateTimePicker.component-BYBPNCJQ.js.map → dateTimePicker.component-DXL7Masq.js.map} +1 -1
- package/dist/chunks/tab.types-B8hOk0uV.js.map +1 -1
- package/dist/chunks/{tab.types-BH-Fnaz2.js → tab.types-BiDpSKGC.js} +2 -11
- package/dist/chunks/{tab.types-BH-Fnaz2.js.map → tab.types-BiDpSKGC.js.map} +1 -1
- package/dist/chunks/timePicker.component-CKv8DkMc.js +2 -0
- package/dist/chunks/timePicker.component-CKv8DkMc.js.map +1 -0
- package/dist/chunks/timePicker.component-DpiJ26SR.js +222 -0
- package/dist/chunks/timePicker.component-DpiJ26SR.js.map +1 -0
- package/dist/chunks/{timeRange.component-NX1EOY8h.js → timeRange.component-CsB9u0D-.js} +2 -2
- package/dist/chunks/{timeRange.component-NX1EOY8h.js.map → timeRange.component-CsB9u0D-.js.map} +1 -1
- package/dist/chunks/{timeRange.component-B1WKwc-X.js → timeRange.component-DAozGOj9.js} +2 -2
- package/dist/chunks/{timeRange.component-B1WKwc-X.js.map → timeRange.component-DAozGOj9.js.map} +1 -1
- package/dist/cjs/components/Alert/index.cjs +1 -1
- package/dist/cjs/components/Calendar/index.cjs +1 -1
- package/dist/cjs/components/DatePicker/index.cjs +1 -1
- package/dist/cjs/components/DateTimePicker/index.cjs +1 -1
- package/dist/cjs/components/TimePicker/index.cjs +1 -1
- package/dist/cjs/components/TimeRange/index.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/Alert/index.js +1 -1
- package/dist/esm/components/Calendar/index.js +1 -1
- package/dist/esm/components/DatePicker/index.js +2 -2
- package/dist/esm/components/DateTimePicker/index.js +1 -1
- package/dist/esm/components/Tabs/index.js +1 -1
- package/dist/esm/components/TimePicker/index.js +1 -1
- package/dist/esm/components/TimeRange/index.js +1 -1
- package/dist/esm/components/index.js +8 -8
- package/dist/esm/index.js +8 -8
- package/dist/types/components/Alert/alert.component.d.ts +4 -1
- package/dist/types/components/DatePicker/context/datePicker.provider.d.ts +2 -1
- package/dist/types/components/TimePicker/timePicker.component.d.ts +2 -1
- package/package.json +3 -2
- package/dist/chunks/alert.types-Ch8hn5HY.js +0 -2
- package/dist/chunks/alert.types-Ch8hn5HY.js.map +0 -1
- package/dist/chunks/alert.types-DWm1TeiF.js.map +0 -1
- package/dist/chunks/datePicker.provider-D9VYbH7E.js +0 -15
- package/dist/chunks/timePicker.component-CDb67FCr.js +0 -220
- package/dist/chunks/timePicker.component-CDb67FCr.js.map +0 -1
- package/dist/chunks/timePicker.component-CIk5bEyP.js +0 -2
- package/dist/chunks/timePicker.component-CIk5bEyP.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BjDatQAs.js"),j=require("react"),y=require("./heading.component-DnoZOXdz.js"),C=require("./icon.component-B1hr5lLa.js"),q=require("./text.component-BDDz5KQP.js"),g=require("./button.component-DjdgBXDC.js"),A=require("./flex-BOU6tYUd.js"),f=require("../cjs/shared/records/index.cjs"),N=require("./provider-NDo8kOkE.js"),S=require("./create-slot-recipe-context-HXE1VazG.js"),w=require("./factory-a2SJjEvR.js"),l=require("./icons-B6Nwr9di.js"),B=t=>t&&t.__esModule?t:{default:t},k=B(j),[I,W]=N.createContext({name:"AlertStatusContext",hookName:"useAlertStatusContext",providerName:"<Alert />"}),{withProvider:z,withContext:R,useStyles:$}=S.createSlotRecipeContext({key:"alert"}),b=z("div","root",{forwardAsChild:!0,wrapElement(t,s){return e.jsxRuntimeExports.jsx(I,{value:{status:s.status||"info"},children:t})}}),F=R("div","title"),M=R("div","description"),D=R("div","content"),H={info:l.InfoIcon,warning:l.WarningIcon,success:l.CheckCircleIcon,error:l.WarningIcon,neutral:l.InfoIcon},L=j.forwardRef(function(s,a){const i=W(),r=$(),x=typeof i.status=="string"?H[i.status]:j.Fragment,{children:u=e.jsxRuntimeExports.jsx(x,{}),...n}=s;return e.jsxRuntimeExports.jsx(w.chakra.span,{ref:a,...n,css:[r.indicator,s.css],children:u})}),p=({buttonPosition:t="topRight",buttonText:s,status:a,["data-testid"]:i="kibble-alert-button",...r})=>e.jsxRuntimeExports.jsx(A.Flex,{className:"Alert__Button","data-testid":i,...t!=="topRight"&&{pt:2,pb:1},...t==="bottomRight"&&{justifyContent:"flex-end"},children:e.jsxRuntimeExports.jsx(g.Button,{size:"xs",variant:a==="default"?"primary":"secondary",w:"max-content",...r,children:s})}),T=({buttonProps:t,description:s,descriptionProps:a,hideCloseButton:i=!1,hideIcon:r=!1,iconProps:x,onClose:u,onContrast:n=!1,status:o="success",title:d,titleProps:_,closeButtonIcon:E="close",["data-testid"]:c="kibble-alert",...v})=>{t&&!t.buttonPosition&&(t.buttonPosition="topRight");const m=t&&t.buttonPosition==="topRight",h=m?A.Flex:k.default.Fragment;return e.jsxRuntimeExports.jsxs(b,{className:"Alert","data-testid":c,...v,variant:o,hideIcon:r,onContrast:n,children:[!r&&e.jsxRuntimeExports.jsx(L,{className:"Alert__Icon","data-testid":`${c}-icon`,children:e.jsxRuntimeExports.jsx(C.Icon,{variant:n?"onContrast":f.StatusTypographyMap[o],name:x?.name||f.StatusIconMap[o],size:"lg",...x})}),e.jsxRuntimeExports.jsxs(D,{className:"Alert__Content","data-testid":`${c}-content`,children:[d&&e.jsxRuntimeExports.jsxs(h,{...m&&{justifyContent:"space-between",gap:2},children:[e.jsxRuntimeExports.jsx(F,{className:"Alert__Title","data-testid":`${c}-title`,children:e.jsxRuntimeExports.jsx(y.WrappedHeading,{size:"sm",variant:n?"onContrast":"default",..._,children:d})}),t&&t.buttonPosition==="topRight"&&e.jsxRuntimeExports.jsx(p,{status:o,onContrast:n,...t})]}),s&&e.jsxRuntimeExports.jsxs(h,{...m&&{justifyContent:"space-between"},children:[e.jsxRuntimeExports.jsx(M,{className:"Alert__Description","data-testid":`${c}-description`,children:typeof s=="string"?e.jsxRuntimeExports.jsx(q.WrappedText,{size:"md",variant:n?"onContrast":"default",...a,children:s}):s}),t&&t.buttonPosition==="topRight"&&!d&&e.jsxRuntimeExports.jsx(p,{status:o,onContrast:n,...t})]}),t&&t?.buttonPosition!=="topRight"&&e.jsxRuntimeExports.jsx(p,{status:o,onContrast:n,...t})]}),!i&&e.jsxRuntimeExports.jsx(g.Button,{className:"Alert__CloseTrigger","data-testid":`${c}-close-trigger`,iconName:E,size:"xs",variant:"ghostNeutral",onContrast:n,onClick:u})]})},G=["topRight","bottomLeft","bottomRight"];exports.Alert=T;exports.alertButtonPositions=G;
|
|
2
|
+
//# sourceMappingURL=alert.types-BlvzpzTn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.types-BlvzpzTn.js","sources":["../../node_modules/@chakra-ui/react/dist/esm/components/alert/alert.js","../../src/components/Alert/components/AlertButton/alertButton.component.tsx","../../src/components/Alert/alert.component.tsx","../../src/components/Alert/alert.types.ts"],"sourcesContent":["\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { forwardRef, Fragment } from 'react';\nimport { createContext } from '../../create-context.js';\nimport { createSlotRecipeContext } from '../../styled-system/create-slot-recipe-context.js';\nimport { chakra } from '../../styled-system/factory.js';\nimport { InfoIcon, WarningIcon, CheckCircleIcon } from '../icons.js';\n\nconst [AlertStatusProvider, useAlertStatusContext] = createContext({\n name: \"AlertStatusContext\",\n hookName: \"useAlertStatusContext\",\n providerName: \"<Alert />\"\n});\nconst {\n withProvider,\n withContext,\n useStyles: useAlertStyles,\n PropsProvider\n} = createSlotRecipeContext({ key: \"alert\" });\nconst AlertRoot = withProvider(\n \"div\",\n \"root\",\n {\n forwardAsChild: true,\n wrapElement(element, props) {\n return (\n // @ts-ignore fix later\n /* @__PURE__ */ jsx(AlertStatusProvider, { value: { status: props.status || \"info\" }, children: element })\n );\n }\n }\n);\nconst AlertPropsProvider = PropsProvider;\nconst AlertTitle = withContext(\n \"div\",\n \"title\"\n);\nconst AlertDescription = withContext(\"div\", \"description\");\nconst AlertContent = withContext(\n \"div\",\n \"content\"\n);\nconst iconMap = {\n info: InfoIcon,\n warning: WarningIcon,\n success: CheckCircleIcon,\n error: WarningIcon,\n neutral: InfoIcon\n};\nconst AlertIndicator = forwardRef(\n function AlertIndicator2(props, ref) {\n const api = useAlertStatusContext();\n const styles = useAlertStyles();\n const Icon = typeof api.status === \"string\" ? iconMap[api.status] : Fragment;\n const { children = /* @__PURE__ */ jsx(Icon, {}), ...rest } = props;\n return /* @__PURE__ */ jsx(chakra.span, { ref, ...rest, css: [styles.indicator, props.css], children });\n }\n);\n\nexport { AlertContent, AlertDescription, AlertIndicator, AlertPropsProvider, AlertRoot, AlertStatusProvider, AlertTitle, useAlertStatusContext, useAlertStyles };\n","import React from 'react';\nimport { AlertButtonPosition } from 'components/Alert/alert.types';\nimport { Button, ButtonProps } from 'components/Button/button.component';\nimport { Status } from 'shared/types/status';\nimport { Flex } from '@chakra-ui/react/flex';\n\nexport interface AlertButtonProps extends Omit<ButtonProps, 'children'> {\n /** Position of the button.\n * @default topRight\n */\n buttonPosition?: AlertButtonPosition;\n /** Text to display in the button. */\n buttonText: string;\n /** Data test id for the button.\n * @default kibble-alert-button\n */\n 'data-testid'?: string;\n}\n\ninterface InternalAlertButtonProps extends AlertButtonProps {\n /** Status of the alert.\n * @internal\n */\n status: Status;\n}\n\nexport const AlertButton = ({\n buttonPosition = 'topRight',\n buttonText,\n status,\n ['data-testid']: dataTestId = 'kibble-alert-button',\n ...rest\n}: InternalAlertButtonProps): React.JSX.Element => {\n return (\n <Flex\n className=\"Alert__Button\"\n data-testid={dataTestId}\n {...(buttonPosition !== 'topRight' && { pt: 2, pb: 1 })}\n {...(buttonPosition === 'bottomRight' && { justifyContent: 'flex-end' })}\n >\n <Button size=\"xs\" variant={status === 'default' ? 'primary' : 'secondary'} w=\"max-content\" {...rest}>\n {buttonText}\n </Button>\n </Flex>\n );\n};\n","import React from 'react';\nimport { Alert as CAlert } from '@chakra-ui/react/alert';\nimport { Heading, HeadingProps } from 'components/Heading/heading.component';\nimport { Icon, IconProps } from 'components/Icon/icon.component';\nimport { Text, TextProps } from 'components/Text/text.component';\nimport { Status } from 'shared/types/status';\nimport { Button } from 'components/Button/button.component';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { AlertButton, AlertButtonProps } from './components/AlertButton/alertButton.component';\nimport { StatusIconMap, StatusTypographyMap } from 'shared/records/status';\nimport { IconName } from 'components/Icon/icon.types';\n\nexport interface AlertProps extends Omit<CAlert.RootProps, 'title' | 'status' | 'children' | 'variant' | 'size'> {\n /** Props to customize the alert button. */\n buttonProps?: AlertButtonProps;\n /** The body of the alert */\n description?: React.ReactNode;\n /** Props to customize the description when passed as a string. */\n descriptionProps?: TextProps;\n /**\n * If true, the close button will not be displayed.\n * @default false\n */\n hideCloseButton?: boolean;\n /**\n * If true, the icon will not be displayed.\n * @default false\n */\n hideIcon?: boolean;\n /** Props to customize the icon. */\n iconProps?: IconProps;\n /** Callback function to be called when the close button is clicked. */\n onClose?: React.MouseEventHandler<HTMLButtonElement>;\n /**\n * If true, the alert will use a contrasting variant according to the selected status.\n * @default false\n */\n onContrast?: boolean;\n /**\n * The status of the alert. Determines the color of the alert.\n * @default success\n */\n status?: Status;\n /** The title of the alert. */\n title?: React.ReactNode;\n /** Props to customize the title when passed as a string. */\n titleProps?: HeadingProps;\n /** The name of the icon to be used as the close button. */\n closeButtonIcon?: IconName;\n /** Data test id for the alert.\n * @default kibble-alert\n */\n 'data-testid'?: string;\n}\n\nexport const Alert = ({\n buttonProps,\n description,\n descriptionProps,\n hideCloseButton = false,\n hideIcon = false,\n iconProps,\n onClose,\n onContrast = false,\n status = 'success',\n title,\n titleProps,\n closeButtonIcon = 'close',\n ['data-testid']: dataTestId = 'kibble-alert',\n ...rest\n}: AlertProps): React.JSX.Element => {\n if (buttonProps && !buttonProps.buttonPosition) {\n buttonProps.buttonPosition = 'topRight';\n }\n const isTopRightButton = buttonProps && buttonProps.buttonPosition === 'topRight';\n const WithButtonWrapper = isTopRightButton ? Flex : React.Fragment;\n\n return (\n <CAlert.Root\n className=\"Alert\"\n data-testid={dataTestId}\n {...rest}\n variant={status}\n hideIcon={hideIcon}\n onContrast={onContrast}\n >\n {!hideIcon && (\n <CAlert.Indicator className=\"Alert__Icon\" data-testid={`${dataTestId}-icon`}>\n <Icon\n variant={onContrast ? 'onContrast' : StatusTypographyMap[status]}\n name={iconProps?.name || StatusIconMap[status]}\n size=\"lg\"\n {...iconProps}\n />\n </CAlert.Indicator>\n )}\n <CAlert.Content className=\"Alert__Content\" data-testid={`${dataTestId}-content`}>\n {title && (\n <WithButtonWrapper\n {...(isTopRightButton && {\n justifyContent: 'space-between',\n gap: 2,\n })}\n >\n <CAlert.Title className=\"Alert__Title\" data-testid={`${dataTestId}-title`}>\n <Heading size=\"sm\" variant={onContrast ? 'onContrast' : 'default'} {...titleProps}>\n {title}\n </Heading>\n </CAlert.Title>\n {buttonProps && buttonProps.buttonPosition === 'topRight' && (\n <AlertButton status={status} onContrast={onContrast} {...buttonProps} />\n )}\n </WithButtonWrapper>\n )}\n {description && (\n <WithButtonWrapper {...(isTopRightButton && { justifyContent: 'space-between' })}>\n <CAlert.Description className=\"Alert__Description\" data-testid={`${dataTestId}-description`}>\n {typeof description === 'string' ? (\n <Text size=\"md\" variant={onContrast ? 'onContrast' : 'default'} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </CAlert.Description>\n {buttonProps && buttonProps.buttonPosition === 'topRight' && !title && (\n <AlertButton status={status} onContrast={onContrast} {...buttonProps} />\n )}\n </WithButtonWrapper>\n )}\n {buttonProps && buttonProps?.buttonPosition !== 'topRight' && (\n <AlertButton status={status} onContrast={onContrast} {...buttonProps} />\n )}\n </CAlert.Content>\n {!hideCloseButton && (\n <Button\n className=\"Alert__CloseTrigger\"\n data-testid={`${dataTestId}-close-trigger`}\n iconName={closeButtonIcon}\n size=\"xs\"\n variant=\"ghostNeutral\"\n onContrast={onContrast}\n onClick={onClose}\n />\n )}\n </CAlert.Root>\n );\n};\n","export const alertButtonPositions = ['topRight', 'bottomLeft', 'bottomRight'] as const;\nexport type AlertButtonPosition = (typeof alertButtonPositions)[number];\n"],"names":["AlertStatusProvider","useAlertStatusContext","createContext","withProvider","withContext","useAlertStyles","createSlotRecipeContext","AlertRoot","element","props","jsx","AlertTitle","AlertDescription","AlertContent","iconMap","InfoIcon","WarningIcon","CheckCircleIcon","AlertIndicator","forwardRef","ref","api","styles","Icon","Fragment","children","rest","chakra","AlertButton","buttonPosition","buttonText","status","dataTestId","Flex","Button","Alert","buttonProps","description","descriptionProps","hideCloseButton","hideIcon","iconProps","onClose","onContrast","title","titleProps","closeButtonIcon","isTopRightButton","WithButtonWrapper","React","jsxs","CAlert.Root","CAlert.Indicator","StatusTypographyMap","StatusIconMap","CAlert.Content","CAlert.Title","Heading","CAlert.Description","Text","alertButtonPositions"],"mappings":"+gBASM,CAACA,EAAqBC,CAAqB,EAAIC,gBAAc,CACjE,KAAM,qBACN,SAAU,wBACV,aAAc,WAChB,CAAC,EACK,CACJ,aAAAC,EACA,YAAAC,EACA,UAAWC,CAEb,EAAIC,EAAAA,wBAAwB,CAAE,IAAK,OAAO,CAAE,EACtCC,EAAYJ,EAChB,MACA,OACA,CACE,eAAgB,GAChB,YAAYK,EAASC,EAAO,CAC1B,OAEkBC,EAAAA,kBAAAA,IAAIV,EAAqB,CAAE,MAAO,CAAE,OAAQS,EAAM,QAAU,MAAM,EAAI,SAAUD,CAAS,CAAA,CAEjH,CACA,CACA,EAEMG,EAAaP,EACjB,MACA,OACF,EACMQ,EAAmBR,EAAY,MAAO,aAAa,EACnDS,EAAeT,EACnB,MACA,SACF,EACMU,EAAU,CACd,KAAMC,EAAQ,SACd,QAASC,EAAW,YACpB,QAASC,EAAe,gBACxB,MAAOD,EAAW,YAClB,QAASD,EAAAA,QACX,EACMG,EAAiBC,EAAU,WAC/B,SAAyBV,EAAOW,EAAK,CACnC,MAAMC,EAAMpB,EAAuB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B,GAAGP,CAAa,CAAA,CAAA,EAE1E,EAEDA,GAAeA,GAAa,iBAAmB,oCAC7CR,EAAY,CAAA,OAAAG,EAAgB,WAAAY,EAAyB,GAAGP,CAAa,CAAA,CAAA,EAE1E,EACC,CAACG,GACA7B,EAAA,kBAAA,IAACwB,EAAA,OAAA,CACC,UAAU,sBACV,cAAa,GAAGF,CAAU,iBAC1B,SAAUc,EACV,KAAK,KACL,QAAQ,eACR,WAAAH,EACA,QAASD,CAAA,CAAA,CACX,CAAA,CAEJ,CAEJ,ECnJakB,EAAuB,CAAC,WAAY,aAAc,aAAa","x_google_ignoreList":[0]}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
-
import
|
|
3
|
-
import { W as
|
|
4
|
-
import { I as
|
|
5
|
-
import { W
|
|
2
|
+
import y, { forwardRef as C, Fragment as N } from "react";
|
|
3
|
+
import { W as w } from "./heading.component-CpSAN3cv.js";
|
|
4
|
+
import { I as S } from "./icon.component-PV_nHBId.js";
|
|
5
|
+
import { W } from "./text.component-DhuUgP3j.js";
|
|
6
6
|
import { B as j } from "./button.component-BO6oee_V.js";
|
|
7
7
|
import { F as A } from "./flex-CX-8gE9T.js";
|
|
8
|
-
import { StatusIconMap as
|
|
9
|
-
import { c as
|
|
10
|
-
import { c as
|
|
11
|
-
import { c as
|
|
12
|
-
import { I as u, W as g, a as
|
|
13
|
-
const [
|
|
8
|
+
import { StatusIconMap as k, StatusTypographyMap as B } from "../esm/shared/records/index.js";
|
|
9
|
+
import { c as I } from "./provider-ClCAdPxy.js";
|
|
10
|
+
import { c as z } from "./create-slot-recipe-context-D_FXDJGp.js";
|
|
11
|
+
import { c as $ } from "./factory-BQshv7_b.js";
|
|
12
|
+
import { I as u, W as g, a as F } from "./icons-CoSqruIn.js";
|
|
13
|
+
const [b, M] = I({
|
|
14
14
|
name: "AlertStatusContext",
|
|
15
15
|
hookName: "useAlertStatusContext",
|
|
16
16
|
providerName: "<Alert />"
|
|
17
17
|
}), {
|
|
18
|
-
withProvider:
|
|
18
|
+
withProvider: D,
|
|
19
19
|
withContext: h,
|
|
20
|
-
useStyles:
|
|
21
|
-
} =
|
|
20
|
+
useStyles: E
|
|
21
|
+
} = z({ key: "alert" }), H = D(
|
|
22
22
|
"div",
|
|
23
23
|
"root",
|
|
24
24
|
{
|
|
@@ -26,26 +26,26 @@ const [F, b] = B({
|
|
|
26
26
|
wrapElement(t, s) {
|
|
27
27
|
return (
|
|
28
28
|
// @ts-ignore fix later
|
|
29
|
-
/* @__PURE__ */ e.jsx(
|
|
29
|
+
/* @__PURE__ */ e.jsx(b, { value: { status: s.status || "info" }, children: t })
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
),
|
|
33
|
+
), L = h(
|
|
34
34
|
"div",
|
|
35
35
|
"title"
|
|
36
|
-
),
|
|
36
|
+
), T = h("div", "description"), q = h(
|
|
37
37
|
"div",
|
|
38
38
|
"content"
|
|
39
|
-
),
|
|
39
|
+
), G = {
|
|
40
40
|
info: u,
|
|
41
41
|
warning: g,
|
|
42
|
-
success:
|
|
42
|
+
success: F,
|
|
43
43
|
error: g,
|
|
44
44
|
neutral: u
|
|
45
|
-
},
|
|
45
|
+
}, J = C(
|
|
46
46
|
function(s, c) {
|
|
47
|
-
const r =
|
|
48
|
-
return /* @__PURE__ */ e.jsx(
|
|
47
|
+
const r = M(), a = E(), l = typeof r.status == "string" ? G[r.status] : N, { children: m = /* @__PURE__ */ e.jsx(l, {}), ...i } = s;
|
|
48
|
+
return /* @__PURE__ */ e.jsx($.span, { ref: c, ...i, css: [a.indicator, s.css], children: m });
|
|
49
49
|
}
|
|
50
50
|
), x = ({
|
|
51
51
|
buttonPosition: t = "topRight",
|
|
@@ -62,7 +62,7 @@ const [F, b] = B({
|
|
|
62
62
|
...t === "bottomRight" && { justifyContent: "flex-end" },
|
|
63
63
|
children: /* @__PURE__ */ e.jsx(j, { size: "xs", variant: c === "default" ? "primary" : "secondary", w: "max-content", ...a, children: s })
|
|
64
64
|
}
|
|
65
|
-
),
|
|
65
|
+
), it = ({
|
|
66
66
|
buttonProps: t,
|
|
67
67
|
description: s,
|
|
68
68
|
descriptionProps: c,
|
|
@@ -74,31 +74,32 @@ const [F, b] = B({
|
|
|
74
74
|
status: o = "success",
|
|
75
75
|
title: d,
|
|
76
76
|
titleProps: R,
|
|
77
|
+
closeButtonIcon: v = "close",
|
|
77
78
|
["data-testid"]: n = "kibble-alert",
|
|
78
|
-
...
|
|
79
|
+
..._
|
|
79
80
|
}) => {
|
|
80
81
|
t && !t.buttonPosition && (t.buttonPosition = "topRight");
|
|
81
|
-
const f = t && t.buttonPosition === "topRight", p = f ? A :
|
|
82
|
+
const f = t && t.buttonPosition === "topRight", p = f ? A : y.Fragment;
|
|
82
83
|
return /* @__PURE__ */ e.jsxs(
|
|
83
|
-
|
|
84
|
+
H,
|
|
84
85
|
{
|
|
85
86
|
className: "Alert",
|
|
86
87
|
"data-testid": n,
|
|
87
|
-
...
|
|
88
|
+
..._,
|
|
88
89
|
variant: o,
|
|
89
90
|
hideIcon: a,
|
|
90
91
|
onContrast: i,
|
|
91
92
|
children: [
|
|
92
|
-
!a && /* @__PURE__ */ e.jsx(
|
|
93
|
-
|
|
93
|
+
!a && /* @__PURE__ */ e.jsx(J, { className: "Alert__Icon", "data-testid": `${n}-icon`, children: /* @__PURE__ */ e.jsx(
|
|
94
|
+
S,
|
|
94
95
|
{
|
|
95
|
-
variant: i ? "onContrast" :
|
|
96
|
-
name: l?.name ||
|
|
96
|
+
variant: i ? "onContrast" : B[o],
|
|
97
|
+
name: l?.name || k[o],
|
|
97
98
|
size: "lg",
|
|
98
99
|
...l
|
|
99
100
|
}
|
|
100
101
|
) }),
|
|
101
|
-
/* @__PURE__ */ e.jsxs(
|
|
102
|
+
/* @__PURE__ */ e.jsxs(q, { className: "Alert__Content", "data-testid": `${n}-content`, children: [
|
|
102
103
|
d && /* @__PURE__ */ e.jsxs(
|
|
103
104
|
p,
|
|
104
105
|
{
|
|
@@ -107,13 +108,13 @@ const [F, b] = B({
|
|
|
107
108
|
gap: 2
|
|
108
109
|
},
|
|
109
110
|
children: [
|
|
110
|
-
/* @__PURE__ */ e.jsx(
|
|
111
|
+
/* @__PURE__ */ e.jsx(L, { className: "Alert__Title", "data-testid": `${n}-title`, children: /* @__PURE__ */ e.jsx(w, { size: "sm", variant: i ? "onContrast" : "default", ...R, children: d }) }),
|
|
111
112
|
t && t.buttonPosition === "topRight" && /* @__PURE__ */ e.jsx(x, { status: o, onContrast: i, ...t })
|
|
112
113
|
]
|
|
113
114
|
}
|
|
114
115
|
),
|
|
115
116
|
s && /* @__PURE__ */ e.jsxs(p, { ...f && { justifyContent: "space-between" }, children: [
|
|
116
|
-
/* @__PURE__ */ e.jsx(
|
|
117
|
+
/* @__PURE__ */ e.jsx(T, { className: "Alert__Description", "data-testid": `${n}-description`, children: typeof s == "string" ? /* @__PURE__ */ e.jsx(W, { size: "md", variant: i ? "onContrast" : "default", ...c, children: s }) : s }),
|
|
117
118
|
t && t.buttonPosition === "topRight" && !d && /* @__PURE__ */ e.jsx(x, { status: o, onContrast: i, ...t })
|
|
118
119
|
] }),
|
|
119
120
|
t && t?.buttonPosition !== "topRight" && /* @__PURE__ */ e.jsx(x, { status: o, onContrast: i, ...t })
|
|
@@ -123,7 +124,7 @@ const [F, b] = B({
|
|
|
123
124
|
{
|
|
124
125
|
className: "Alert__CloseTrigger",
|
|
125
126
|
"data-testid": `${n}-close-trigger`,
|
|
126
|
-
iconName:
|
|
127
|
+
iconName: v,
|
|
127
128
|
size: "xs",
|
|
128
129
|
variant: "ghostNeutral",
|
|
129
130
|
onContrast: i,
|
|
@@ -133,9 +134,9 @@ const [F, b] = B({
|
|
|
133
134
|
]
|
|
134
135
|
}
|
|
135
136
|
);
|
|
136
|
-
},
|
|
137
|
+
}, rt = ["topRight", "bottomLeft", "bottomRight"];
|
|
137
138
|
export {
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
it as A,
|
|
140
|
+
rt as a
|
|
140
141
|
};
|
|
141
|
-
//# sourceMappingURL=alert.types-
|
|
142
|
+
//# sourceMappingURL=alert.types-C6EN46Ra.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.types-C6EN46Ra.js","sources":["../../node_modules/@chakra-ui/react/dist/esm/components/alert/alert.js","../../src/components/Alert/components/AlertButton/alertButton.component.tsx","../../src/components/Alert/alert.component.tsx","../../src/components/Alert/alert.types.ts"],"sourcesContent":["\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { forwardRef, Fragment } from 'react';\nimport { createContext } from '../../create-context.js';\nimport { createSlotRecipeContext } from '../../styled-system/create-slot-recipe-context.js';\nimport { chakra } from '../../styled-system/factory.js';\nimport { InfoIcon, WarningIcon, CheckCircleIcon } from '../icons.js';\n\nconst [AlertStatusProvider, useAlertStatusContext] = createContext({\n name: \"AlertStatusContext\",\n hookName: \"useAlertStatusContext\",\n providerName: \"<Alert />\"\n});\nconst {\n withProvider,\n withContext,\n useStyles: useAlertStyles,\n PropsProvider\n} = createSlotRecipeContext({ key: \"alert\" });\nconst AlertRoot = withProvider(\n \"div\",\n \"root\",\n {\n forwardAsChild: true,\n wrapElement(element, props) {\n return (\n // @ts-ignore fix later\n /* @__PURE__ */ jsx(AlertStatusProvider, { value: { status: props.status || \"info\" }, children: element })\n );\n }\n }\n);\nconst AlertPropsProvider = PropsProvider;\nconst AlertTitle = withContext(\n \"div\",\n \"title\"\n);\nconst AlertDescription = withContext(\"div\", \"description\");\nconst AlertContent = withContext(\n \"div\",\n \"content\"\n);\nconst iconMap = {\n info: InfoIcon,\n warning: WarningIcon,\n success: CheckCircleIcon,\n error: WarningIcon,\n neutral: InfoIcon\n};\nconst AlertIndicator = forwardRef(\n function AlertIndicator2(props, ref) {\n const api = useAlertStatusContext();\n const styles = useAlertStyles();\n const Icon = typeof api.status === \"string\" ? iconMap[api.status] : Fragment;\n const { children = /* @__PURE__ */ jsx(Icon, {}), ...rest } = props;\n return /* @__PURE__ */ jsx(chakra.span, { ref, ...rest, css: [styles.indicator, props.css], children });\n }\n);\n\nexport { AlertContent, AlertDescription, AlertIndicator, AlertPropsProvider, AlertRoot, AlertStatusProvider, AlertTitle, useAlertStatusContext, useAlertStyles };\n","import React from 'react';\nimport { AlertButtonPosition } from 'components/Alert/alert.types';\nimport { Button, ButtonProps } from 'components/Button/button.component';\nimport { Status } from 'shared/types/status';\nimport { Flex } from '@chakra-ui/react/flex';\n\nexport interface AlertButtonProps extends Omit<ButtonProps, 'children'> {\n /** Position of the button.\n * @default topRight\n */\n buttonPosition?: AlertButtonPosition;\n /** Text to display in the button. */\n buttonText: string;\n /** Data test id for the button.\n * @default kibble-alert-button\n */\n 'data-testid'?: string;\n}\n\ninterface InternalAlertButtonProps extends AlertButtonProps {\n /** Status of the alert.\n * @internal\n */\n status: Status;\n}\n\nexport const AlertButton = ({\n buttonPosition = 'topRight',\n buttonText,\n status,\n ['data-testid']: dataTestId = 'kibble-alert-button',\n ...rest\n}: InternalAlertButtonProps): React.JSX.Element => {\n return (\n <Flex\n className=\"Alert__Button\"\n data-testid={dataTestId}\n {...(buttonPosition !== 'topRight' && { pt: 2, pb: 1 })}\n {...(buttonPosition === 'bottomRight' && { justifyContent: 'flex-end' })}\n >\n <Button size=\"xs\" variant={status === 'default' ? 'primary' : 'secondary'} w=\"max-content\" {...rest}>\n {buttonText}\n </Button>\n </Flex>\n );\n};\n","import React from 'react';\nimport { Alert as CAlert } from '@chakra-ui/react/alert';\nimport { Heading, HeadingProps } from 'components/Heading/heading.component';\nimport { Icon, IconProps } from 'components/Icon/icon.component';\nimport { Text, TextProps } from 'components/Text/text.component';\nimport { Status } from 'shared/types/status';\nimport { Button } from 'components/Button/button.component';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { AlertButton, AlertButtonProps } from './components/AlertButton/alertButton.component';\nimport { StatusIconMap, StatusTypographyMap } from 'shared/records/status';\nimport { IconName } from 'components/Icon/icon.types';\n\nexport interface AlertProps extends Omit<CAlert.RootProps, 'title' | 'status' | 'children' | 'variant' | 'size'> {\n /** Props to customize the alert button. */\n buttonProps?: AlertButtonProps;\n /** The body of the alert */\n description?: React.ReactNode;\n /** Props to customize the description when passed as a string. */\n descriptionProps?: TextProps;\n /**\n * If true, the close button will not be displayed.\n * @default false\n */\n hideCloseButton?: boolean;\n /**\n * If true, the icon will not be displayed.\n * @default false\n */\n hideIcon?: boolean;\n /** Props to customize the icon. */\n iconProps?: IconProps;\n /** Callback function to be called when the close button is clicked. */\n onClose?: React.MouseEventHandler<HTMLButtonElement>;\n /**\n * If true, the alert will use a contrasting variant according to the selected status.\n * @default false\n */\n onContrast?: boolean;\n /**\n * The status of the alert. Determines the color of the alert.\n * @default success\n */\n status?: Status;\n /** The title of the alert. */\n title?: React.ReactNode;\n /** Props to customize the title when passed as a string. */\n titleProps?: HeadingProps;\n /** The name of the icon to be used as the close button. */\n closeButtonIcon?: IconName;\n /** Data test id for the alert.\n * @default kibble-alert\n */\n 'data-testid'?: string;\n}\n\nexport const Alert = ({\n buttonProps,\n description,\n descriptionProps,\n hideCloseButton = false,\n hideIcon = false,\n iconProps,\n onClose,\n onContrast = false,\n status = 'success',\n title,\n titleProps,\n closeButtonIcon = 'close',\n ['data-testid']: dataTestId = 'kibble-alert',\n ...rest\n}: AlertProps): React.JSX.Element => {\n if (buttonProps && !buttonProps.buttonPosition) {\n buttonProps.buttonPosition = 'topRight';\n }\n const isTopRightButton = buttonProps && buttonProps.buttonPosition === 'topRight';\n const WithButtonWrapper = isTopRightButton ? Flex : React.Fragment;\n\n return (\n <CAlert.Root\n className=\"Alert\"\n data-testid={dataTestId}\n {...rest}\n variant={status}\n hideIcon={hideIcon}\n onContrast={onContrast}\n >\n {!hideIcon && (\n <CAlert.Indicator className=\"Alert__Icon\" data-testid={`${dataTestId}-icon`}>\n <Icon\n variant={onContrast ? 'onContrast' : StatusTypographyMap[status]}\n name={iconProps?.name || StatusIconMap[status]}\n size=\"lg\"\n {...iconProps}\n />\n </CAlert.Indicator>\n )}\n <CAlert.Content className=\"Alert__Content\" data-testid={`${dataTestId}-content`}>\n {title && (\n <WithButtonWrapper\n {...(isTopRightButton && {\n justifyContent: 'space-between',\n gap: 2,\n })}\n >\n <CAlert.Title className=\"Alert__Title\" data-testid={`${dataTestId}-title`}>\n <Heading size=\"sm\" variant={onContrast ? 'onContrast' : 'default'} {...titleProps}>\n {title}\n </Heading>\n </CAlert.Title>\n {buttonProps && buttonProps.buttonPosition === 'topRight' && (\n <AlertButton status={status} onContrast={onContrast} {...buttonProps} />\n )}\n </WithButtonWrapper>\n )}\n {description && (\n <WithButtonWrapper {...(isTopRightButton && { justifyContent: 'space-between' })}>\n <CAlert.Description className=\"Alert__Description\" data-testid={`${dataTestId}-description`}>\n {typeof description === 'string' ? (\n <Text size=\"md\" variant={onContrast ? 'onContrast' : 'default'} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </CAlert.Description>\n {buttonProps && buttonProps.buttonPosition === 'topRight' && !title && (\n <AlertButton status={status} onContrast={onContrast} {...buttonProps} />\n )}\n </WithButtonWrapper>\n )}\n {buttonProps && buttonProps?.buttonPosition !== 'topRight' && (\n <AlertButton status={status} onContrast={onContrast} {...buttonProps} />\n )}\n </CAlert.Content>\n {!hideCloseButton && (\n <Button\n className=\"Alert__CloseTrigger\"\n data-testid={`${dataTestId}-close-trigger`}\n iconName={closeButtonIcon}\n size=\"xs\"\n variant=\"ghostNeutral\"\n onContrast={onContrast}\n onClick={onClose}\n />\n )}\n </CAlert.Root>\n );\n};\n","export const alertButtonPositions = ['topRight', 'bottomLeft', 'bottomRight'] as const;\nexport type AlertButtonPosition = (typeof alertButtonPositions)[number];\n"],"names":["AlertStatusProvider","useAlertStatusContext","createContext","withProvider","withContext","useAlertStyles","createSlotRecipeContext","AlertRoot","element","props","jsx","AlertTitle","AlertDescription","AlertContent","iconMap","InfoIcon","WarningIcon","CheckCircleIcon","AlertIndicator","forwardRef","ref","api","styles","Icon","Fragment","children","rest","chakra","AlertButton","buttonPosition","buttonText","status","dataTestId","Flex","Button","Alert","buttonProps","description","descriptionProps","hideCloseButton","hideIcon","iconProps","onClose","onContrast","title","titleProps","closeButtonIcon","isTopRightButton","WithButtonWrapper","React","jsxs","CAlert.Root","CAlert.Indicator","StatusTypographyMap","StatusIconMap","CAlert.Content","CAlert.Title","Heading","CAlert.Description","Text","alertButtonPositions"],"mappings":";;;;;;;;;;;;AASA,MAAM,CAACA,GAAqBC,CAAqB,IAAIC,EAAc;AAAA,EACjE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,cAAc;AAChB,CAAC,GACK;AAAA,EACJ,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAWC;AAEb,IAAIC,EAAwB,EAAE,KAAK,QAAO,CAAE,GACtCC,IAAYJ;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,IACE,gBAAgB;AAAA,IAChB,YAAYK,GAASC,GAAO;AAC1B;AAAA;AAAA,QAEkBC,gBAAAA,EAAAA,IAAIV,GAAqB,EAAE,OAAO,EAAE,QAAQS,EAAM,UAAU,OAAM,GAAI,UAAUD,EAAS,CAAA;AAAA;AAAA,IAEjH;AAAA,EACA;AACA,GAEMG,IAAaP;AAAA,EACjB;AAAA,EACA;AACF,GACMQ,IAAmBR,EAAY,OAAO,aAAa,GACnDS,IAAeT;AAAA,EACnB;AAAA,EACA;AACF,GACMU,IAAU;AAAA,EACd,MAAMC;AAAA,EACN,SAASC;AAAA,EACT,SAASC;AAAA,EACT,OAAOD;AAAA,EACP,SAASD;AACX,GACMG,IAAiBC;AAAA,EACrB,SAAyBV,GAAOW,GAAK;AACnC,UAAMC,IAAMpB,EAAuB,GAC7BqB,IAASjB,EAAgB,GACzBkB,IAAO,OAAOF,EAAI,UAAW,WAAWP,EAAQO,EAAI,MAAM,IAAIG,GAC9D,EAAE,UAAAC,IAA2Bf,gBAAAA,MA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B,iCACrBsB,GAAK,EAAA,MAAK,MAAK,SAAShB,IAAa,eAAe,WAAY,GAAGL,GACjE,UACHD,EAAA,CAAA,IAEAA,EAEJ,CAAA;AAAA,YACCD,KAAeA,EAAY,mBAAmB,cAAc,CAACQ,KAC5DlC,gBAAAA,MAACkB,GAAY,EAAA,QAAAG,GAAgB,YAAAY,GAAyB,GAAGP,EAAa,CAAA;AAAA,UAAA,GAE1E;AAAA,UAEDA,KAAeA,GAAa,mBAAmB,oCAC7CR,GAAY,EAAA,QAAAG,GAAgB,YAAAY,GAAyB,GAAGP,EAAa,CAAA;AAAA,QAAA,GAE1E;AAAA,QACC,CAACG,KACA7B,gBAAAA,EAAA;AAAA,UAACwB;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAa,GAAGF,CAAU;AAAA,YAC1B,UAAUc;AAAA,YACV,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,YAAAH;AAAA,YACA,SAASD;AAAA,UAAA;AAAA,QAAA;AAAA,MACX;AAAA,IAAA;AAAA,EAEJ;AAEJ,GCnJakB,KAAuB,CAAC,YAAY,cAAc,aAAa;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as a } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
2
|
import { B as i } from "./index-9BerxEcw.js";
|
|
3
|
-
import { a as d, b as o, c as m } from "./datePicker.provider-
|
|
3
|
+
import { a as d, b as o, c as m } from "./datePicker.provider-Dzj41st3.js";
|
|
4
4
|
import { D as n } from "./divider.component-CFOh4Nw3.js";
|
|
5
5
|
const p = ({
|
|
6
6
|
["data-testid"]: r = "kibble-calendar",
|
|
@@ -15,4 +15,4 @@ const p = ({
|
|
|
15
15
|
export {
|
|
16
16
|
p as C
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=calendar.component-
|
|
18
|
+
//# sourceMappingURL=calendar.component-B0HGQGw3.js.map
|
package/dist/chunks/{calendar.component-D9LIca6x.js.map → calendar.component-B0HGQGw3.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.component-
|
|
1
|
+
{"version":3,"file":"calendar.component-B0HGQGw3.js","sources":["../../src/components/Calendar/calendar.component.tsx"],"sourcesContent":["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';\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\nexport const Calendar = ({\n ['data-testid']: dataTestId = 'kibble-calendar',\n withDateRange = true,\n withHeaderTriggers = false,\n ...rest\n}: CalendarProps): React.JSX.Element => {\n return (\n <Box className=\"Calendar\" data-testid={dataTestId} maxW=\"340px\">\n <DatePickerProvider withDateRange={withDateRange} {...rest} standalone>\n <DatePickerHeader withTriggers={withHeaderTriggers} />\n <Divider />\n <DatePickerCalendar />\n </DatePickerProvider>\n </Box>\n );\n};\n"],"names":["Calendar","dataTestId","withDateRange","withHeaderTriggers","rest","jsx","Box","jsxs","DatePickerProvider","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":";;;;AAyBO,MAAMA,IAAW,CAAC;AAAA,EACvB,CAAC,gBAAgBC,IAAa;AAAA,EAC9B,eAAAC,IAAgB;AAAA,EAChB,oBAAAC,IAAqB;AAAA,EACrB,GAAGC;AACL,MAEKC,gBAAAA,EAAAA,IAAAC,GAAA,EAAI,WAAU,YAAW,eAAaL,GAAY,MAAK,SACtD,UAAAM,gBAAAA,EAAA,KAACC,GAAmB,EAAA,eAAAN,GAA+B,GAAGE,GAAM,YAAU,IACpE,UAAA;AAAA,EAACC,gBAAAA,EAAAA,IAAAI,GAAA,EAAiB,cAAcN,EAAoB,CAAA;AAAA,wBACnDO,GAAQ,EAAA;AAAA,wBACRC,GAAmB,CAAA,CAAA;AAAA,EAAA,CACtB,EACF,CAAA;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-BjDatQAs.js"),n=require("./index-BQRnVsAg.js"),r=require("./datePicker.provider-
|
|
2
|
-
//# sourceMappingURL=calendar.component-
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BjDatQAs.js"),n=require("./index-BQRnVsAg.js"),r=require("./datePicker.provider-Cxvup47n.js"),d=require("./divider.component-BX3zyB7O.js"),x=({["data-testid"]:t="kibble-calendar",withDateRange:s=!0,withHeaderTriggers:i=!1,...a})=>e.jsxRuntimeExports.jsx(n.Box,{className:"Calendar","data-testid":t,maxW:"340px",children:e.jsxRuntimeExports.jsxs(r.DatePickerProvider,{withDateRange:s,...a,standalone:!0,children:[e.jsxRuntimeExports.jsx(r.DatePickerHeader,{withTriggers:i}),e.jsxRuntimeExports.jsx(d.Divider,{}),e.jsxRuntimeExports.jsx(r.DatePickerCalendar,{})]})});exports.Calendar=x;
|
|
2
|
+
//# sourceMappingURL=calendar.component-BLTCblkg.js.map
|
package/dist/chunks/{calendar.component-D7TVct1c.js.map → calendar.component-BLTCblkg.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.component-
|
|
1
|
+
{"version":3,"file":"calendar.component-BLTCblkg.js","sources":["../../src/components/Calendar/calendar.component.tsx"],"sourcesContent":["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';\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\nexport const Calendar = ({\n ['data-testid']: dataTestId = 'kibble-calendar',\n withDateRange = true,\n withHeaderTriggers = false,\n ...rest\n}: CalendarProps): React.JSX.Element => {\n return (\n <Box className=\"Calendar\" data-testid={dataTestId} maxW=\"340px\">\n <DatePickerProvider withDateRange={withDateRange} {...rest} standalone>\n <DatePickerHeader withTriggers={withHeaderTriggers} />\n <Divider />\n <DatePickerCalendar />\n </DatePickerProvider>\n </Box>\n );\n};\n"],"names":["Calendar","dataTestId","withDateRange","withHeaderTriggers","rest","jsx","Box","jsxs","DatePickerProvider","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":"uLAyBaA,EAAW,CAAC,CACvB,CAAC,eAAgBC,EAAa,kBAC9B,cAAAC,EAAgB,GAChB,mBAAAC,EAAqB,GACrB,GAAGC,CACL,IAEKC,EAAAA,kBAAAA,IAAAC,EAAAA,IAAA,CAAI,UAAU,WAAW,cAAaL,EAAY,KAAK,QACtD,SAAAM,EAAA,kBAAA,KAACC,EAAmB,mBAAA,CAAA,cAAAN,EAA+B,GAAGE,EAAM,WAAU,GACpE,SAAA,CAACC,EAAAA,kBAAAA,IAAAI,EAAA,iBAAA,CAAiB,aAAcN,CAAoB,CAAA,0BACnDO,EAAQ,QAAA,EAAA,0BACRC,EAAmB,mBAAA,CAAA,CAAA,CAAA,CAAA,CACtB,CACF,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
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-Dzj41st3.js";
|
|
3
3
|
import { W as P } from "./textInput.component-C7kdQ8hF.js";
|
|
4
4
|
import { I as C } from "./icon.component-PV_nHBId.js";
|
|
5
5
|
import { W as H } from "./text.component-DhuUgP3j.js";
|
|
@@ -163,4 +163,4 @@ const ge = (t) => {
|
|
|
163
163
|
export {
|
|
164
164
|
ge as D
|
|
165
165
|
};
|
|
166
|
-
//# sourceMappingURL=datePicker.component-
|
|
166
|
+
//# sourceMappingURL=datePicker.component-B8ztlVdE.js.map
|
package/dist/chunks/{datePicker.component-WeEU0Azt.js.map → datePicker.component-B8ztlVdE.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datePicker.component-WeEU0Azt.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,CAACE,EAAOD,CAAa;AAC9C;ACnBa,MAAAE,IAAiB,CAACH,GAAYI,MAA6BA,IAAUC,EAAQL,GAAMI,CAAO,IAAI,IAC9FE,IAAkB,CAACN,GAAYO,MAA6BA,IAAUR,EAASC,GAAMO,CAAO,IAAI;ACkBtG,SAASC,GAAgB;AAAA,EAC9B,YAAAC;AAAA,EACA,CAAC,aAAa,GAAGC,IAAa;AAChC,GAA4C;AACpC,QAAA;AAAA,IACJ,iBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,SAAAZ;AAAA,IACA,SAAAG;AAAA,IACA,cAAAU;AAAA,IACA,cAAAC;AAAA,IACA,SAAAC;AAAA,MACEC,EAAqB,GACnB,EAAE,MAAAC,GAAM,SAAAC,EAAQ,IAAIC,EAAkB,GACtCC,IAAWf,GAAY,QAAQ,MAE/BgB,IAAY,CAACC,MAAiC;AAC9C,IAAAA,EAAE,QAAQ,WAAWL,MACvBC,EAAQ,EAAK,GACLH,EAAA,GACRO,EAAE,eAAe,GACjBA,EAAE,gBAAgB;AAAA,EAEtB,GAEMC,IAAgB,CAACD,MAA2C;AAC1D,UAAAE,IAAYF,EAAE,OAAO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WAAU;AAAA,QACV,eAAa,GAAGzD,CAAU;AAAA,QAC1B,KAAK,EAAE,GAAGkD,EAAO,SAAS,MAAM,QAAQ;AAAA,QAExC,UAAAnB,gBAAAA,EAAAA,KAAC2B,GAAA,EAAc,KAAK,EAAE,qBAAqB,EACzC,GAAA,UAAA;AAAA,UAAAlC,gBAAAA,EAAA,IAACmC,GAAiB,EAAA;AAAA,gCACjBC,GAAQ,EAAA;AAAA,gCACRC,GAAmB,EAAA;AAAA,UACnBvD,KAAiB,CAACwC,KAAetB,gBAAAA,EAAAA,IAAAU,IAAA,EAAkB,GAAGW,EAAa,CAAA;AAAA,QAAA,EACtE,CAAA;AAAA,MAAA;AAAA,OAEJ,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"datePicker.component-B8ztlVdE.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,CAACE,EAAOD,CAAa;AAC9C;ACnBa,MAAAE,IAAiB,CAACH,GAAYI,MAA6BA,IAAUC,EAAQL,GAAMI,CAAO,IAAI,IAC9FE,IAAkB,CAACN,GAAYO,MAA6BA,IAAUR,EAASC,GAAMO,CAAO,IAAI;ACkBtG,SAASC,GAAgB;AAAA,EAC9B,YAAAC;AAAA,EACA,CAAC,aAAa,GAAGC,IAAa;AAChC,GAA4C;AACpC,QAAA;AAAA,IACJ,iBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,SAAAZ;AAAA,IACA,SAAAG;AAAA,IACA,cAAAU;AAAA,IACA,cAAAC;AAAA,IACA,SAAAC;AAAA,MACEC,EAAqB,GACnB,EAAE,MAAAC,GAAM,SAAAC,EAAQ,IAAIC,EAAkB,GACtCC,IAAWf,GAAY,QAAQ,MAE/BgB,IAAY,CAACC,MAAiC;AAC9C,IAAAA,EAAE,QAAQ,WAAWL,MACvBC,EAAQ,EAAK,GACLH,EAAA,GACRO,EAAE,eAAe,GACjBA,EAAE,gBAAgB;AAAA,EAEtB,GAEMC,IAAgB,CAACD,MAA2C;AAC1D,UAAAE,IAAYF,EAAE,OAAO,OACrBG,IAAaC,EAAUF,GAAW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zD,CAAU;AAAA,QAC1B,KAAK,EAAE,GAAGkD,EAAO,SAAS,MAAM,QAAQ;AAAA,QAExC,UAAAnB,gBAAAA,EAAAA,KAAC2B,GAAA,EAAc,KAAK,EAAE,qBAAqB,EACzC,GAAA,UAAA;AAAA,UAAAlC,gBAAAA,EAAA,IAACmC,GAAiB,EAAA;AAAA,gCACjBC,GAAQ,EAAA;AAAA,gCACRC,GAAmB,EAAA;AAAA,UACnBvD,KAAiB,CAACwC,KAAetB,gBAAAA,EAAAA,IAAAU,IAAA,EAAkB,GAAGW,EAAa,CAAA;AAAA,QAAA,EACtE,CAAA;AAAA,MAAA;AAAA,OAEJ,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-BjDatQAs.js"),n=require("./datePicker.provider-
|
|
2
|
-
//# sourceMappingURL=datePicker.component-
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BjDatQAs.js"),n=require("./datePicker.provider-Cxvup47n.js"),k=require("./textInput.component-DzUKTy1w.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-BsXWNm5Q.js.map
|
package/dist/chunks/{datePicker.component-CghreQgn.js.map → datePicker.component-BsXWNm5Q.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datePicker.component-CghreQgn.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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B,EAAA,kBAAA,IAACgC,EAAA,kBAAA,CAAoB,UAAU,aAAa,cAAaxD,EACvD,SAAAwB,EAAA,kBAAA,IAACiC,EAAS,eAAT,CACC,UAAU,sBACV,cAAa,GAAGzD,CAAU,WAC1B,IAAK,CAAE,GAAGkD,EAAO,QAAS,KAAM,OAAQ,EAExC,SAAAnB,EAAAA,kBAAAA,KAAC2B,EAAAA,YAAA,CAAc,IAAK,CAAE,oBAAqB,CACzC,EAAA,SAAA,CAAAlC,EAAA,kBAAA,IAACmC,EAAiB,iBAAA,EAAA,0BACjBC,EAAQ,QAAA,EAAA,0BACRC,EAAmB,mBAAA,EAAA,EACnBvD,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-BsXWNm5Q.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,OAAO,MACrBG,EAAaC,EAAA,GAAUF,EAAWb,EAAYgB,EAAA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