@televet/kibble-ui 5.0.21-alpha.hunter.9 → 5.0.22
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-C6EN46Ra.js → alert.component-OcRbeRJa.js} +37 -38
- package/dist/chunks/alert.component-OcRbeRJa.js.map +1 -0
- package/dist/chunks/{alert.types-BlvzpzTn.js → alert.component-nhRTQ5KK.js} +2 -2
- package/dist/chunks/alert.component-nhRTQ5KK.js.map +1 -0
- package/dist/chunks/alert.types-8mtsdXr4.js +2 -0
- package/dist/chunks/alert.types-8mtsdXr4.js.map +1 -0
- package/dist/chunks/alert.types-CPfg5SeM.js +5 -0
- package/dist/chunks/alert.types-CPfg5SeM.js.map +1 -0
- package/dist/chunks/{avatarGroup.component-M84HNv2O.js → avatarGroup.component-BPhQpVYM.js} +2 -2
- package/dist/chunks/{avatarGroup.component-M84HNv2O.js.map → avatarGroup.component-BPhQpVYM.js.map} +1 -1
- package/dist/chunks/{buttonGroup.component-HKh7TJ0v.js → buttonGroup.component-CO5lC36l.js} +2 -2
- package/dist/chunks/{buttonGroup.component-HKh7TJ0v.js.map → buttonGroup.component-CO5lC36l.js.map} +1 -1
- package/dist/chunks/{calendar.component-UUc8d3QQ.js → calendar.component-CegJR9ey.js} +2 -2
- package/dist/chunks/{calendar.component-UUc8d3QQ.js.map → calendar.component-CegJR9ey.js.map} +1 -1
- package/dist/chunks/{conversationCard.component-HYxRoILR.js → conversationCard.component-DByFo4jj.js} +3 -3
- package/dist/chunks/{conversationCard.component-HYxRoILR.js.map → conversationCard.component-DByFo4jj.js.map} +1 -1
- package/dist/chunks/{datePicker.component-Dq2vL7Mk.js → datePicker.component-CLTjEX7i.js} +2 -2
- package/dist/chunks/{datePicker.component-Dq2vL7Mk.js.map → datePicker.component-CLTjEX7i.js.map} +1 -1
- package/dist/chunks/{datePicker.provider-CavuOZl4.js → datePicker.provider-CttuPiiS.js} +2 -2
- package/dist/chunks/{datePicker.provider-CavuOZl4.js.map → datePicker.provider-CttuPiiS.js.map} +1 -1
- package/dist/chunks/dateTimePicker.component-BlWhC5aT.js +2 -0
- package/dist/chunks/{dateTimePicker.component-BF2pZ_Rn.js.map → dateTimePicker.component-BlWhC5aT.js.map} +1 -1
- package/dist/chunks/dateTimePicker.component-CLAI_Q6e.js +317 -0
- package/dist/chunks/dateTimePicker.component-CLAI_Q6e.js.map +1 -0
- package/dist/chunks/{icons-CoSqruIn.js → icons-CEVtpQAi.js} +3 -3
- package/dist/chunks/{icons-CoSqruIn.js.map → icons-CEVtpQAi.js.map} +1 -1
- package/dist/chunks/maintenanceBanner.types-BsNjAlXa.js +2 -0
- package/dist/chunks/maintenanceBanner.types-BsNjAlXa.js.map +1 -0
- package/dist/chunks/maintenanceBanner.types-DerZF_8G.js +31 -0
- package/dist/chunks/maintenanceBanner.types-DerZF_8G.js.map +1 -0
- package/dist/chunks/{menu.component-CV8eVKYt.js → menu.component-WHzMw5ZI.js} +2 -2
- package/dist/chunks/{menu.component-CV8eVKYt.js.map → menu.component-WHzMw5ZI.js.map} +1 -1
- package/dist/chunks/{numberInput.component-V6NQs14b.js → numberInput.component-CRDRjrTH.js} +2 -2
- package/dist/chunks/{numberInput.component-V6NQs14b.js.map → numberInput.component-CRDRjrTH.js.map} +1 -1
- package/dist/chunks/{radioGroup.types-BVbxeB22.js → radioGroup.types-DzSpA07h.js} +2 -2
- package/dist/chunks/{radioGroup.types-BVbxeB22.js.map → radioGroup.types-DzSpA07h.js.map} +1 -1
- package/dist/chunks/{rating-group-DRCWuE5-.js → rating-group-vxglWdry.js} +2 -2
- package/dist/chunks/{rating-group-DRCWuE5-.js.map → rating-group-vxglWdry.js.map} +1 -1
- package/dist/chunks/{rating.component-DeJY9G94.js → rating.component-BWBPSEEk.js} +2 -2
- package/dist/chunks/{rating.component-DeJY9G94.js.map → rating.component-BWBPSEEk.js.map} +1 -1
- package/dist/chunks/{select.component-CIjEq1os.js → select.component-DckP-f8y.js} +43 -43
- package/dist/chunks/{select.component-CIjEq1os.js.map → select.component-DckP-f8y.js.map} +1 -1
- package/dist/chunks/{tag.component-B7V76XfM.js → tag.component-CMsZIhN-.js} +5 -5
- package/dist/chunks/{tag.component-B7V76XfM.js.map → tag.component-CMsZIhN-.js.map} +1 -1
- package/dist/chunks/{tagBlock.component-R4FY7ytN.js → tagBlock.component-CT7_RyJ-.js} +3 -3
- package/dist/chunks/{tagBlock.component-R4FY7ytN.js.map → tagBlock.component-CT7_RyJ-.js.map} +1 -1
- package/dist/chunks/{theme.provider-CvuSdLO6.js → theme.provider-BYXTygyb.js} +2 -2
- package/dist/chunks/{theme.provider-CvuSdLO6.js.map → theme.provider-BYXTygyb.js.map} +1 -1
- package/dist/chunks/timePicker.component-BCMX6aqb.js +220 -0
- package/dist/chunks/timePicker.component-BCMX6aqb.js.map +1 -0
- package/dist/chunks/timePicker.component-D5hw80VV.js +2 -0
- package/dist/chunks/timePicker.component-D5hw80VV.js.map +1 -0
- package/dist/chunks/{timeRange.component-9v9d8kQw.js → timeRange.component-BZHpZeAX.js} +2 -2
- package/dist/chunks/{timeRange.component-9v9d8kQw.js.map → timeRange.component-BZHpZeAX.js.map} +1 -1
- package/dist/chunks/{timeRange.component-D3aPwElS.js → timeRange.component-D3Db8lvh.js} +2 -2
- package/dist/chunks/{timeRange.component-D3aPwElS.js.map → timeRange.component-D3Db8lvh.js.map} +1 -1
- package/dist/cjs/components/Alert/index.cjs +1 -1
- package/dist/cjs/components/DateTimePicker/index.cjs +1 -1
- package/dist/cjs/components/Icon/generated/index.cjs +1 -1
- package/dist/cjs/components/Icon/generated/index.cjs.map +1 -1
- package/dist/cjs/components/MaintenanceBanner/index.cjs +2 -0
- package/dist/cjs/components/MaintenanceBanner/index.cjs.map +1 -0
- 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/cjs/theme/tokens/colors/index.cjs +1 -1
- package/dist/cjs/theme/tokens/colors/index.cjs.map +1 -1
- package/dist/esm/chakra/index.js +2 -2
- package/dist/esm/components/Alert/index.js +4 -3
- package/dist/esm/components/Alert/index.js.map +1 -1
- package/dist/esm/components/AvatarGroup/index.js +1 -1
- package/dist/esm/components/ButtonGroup/index.js +1 -1
- package/dist/esm/components/Calendar/index.js +1 -1
- package/dist/esm/components/ConversationCard/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/Icon/generated/index.js +562 -318
- package/dist/esm/components/Icon/generated/index.js.map +1 -1
- package/dist/esm/components/MaintenanceBanner/index.js +6 -0
- package/dist/esm/components/MaintenanceBanner/index.js.map +1 -0
- package/dist/esm/components/Menu/index.js +1 -1
- package/dist/esm/components/NumberInput/index.js +1 -1
- package/dist/esm/components/RadioGroup/index.js +1 -1
- package/dist/esm/components/Rating/index.js +1 -1
- package/dist/esm/components/Select/index.js +1 -1
- package/dist/esm/components/Tag/index.js +1 -1
- package/dist/esm/components/TagBlock/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 +134 -130
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/index.js +157 -153
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/theme/index.js +1 -1
- package/dist/esm/theme/tokens/colors/index.js +10 -10
- package/dist/esm/theme/tokens/colors/index.js.map +1 -1
- package/dist/types/components/DateTimePicker/components/DateTimePickerCustomView/dateTimePickerCustomView.component.d.ts +1 -2
- package/dist/types/components/DateTimePicker/components/DateTimePickerRangeSelector/dateTimePickerRangeSelector.component.d.ts +1 -2
- package/dist/types/components/DateTimePicker/dateTimePicker.component.d.ts +1 -6
- package/dist/types/components/Icon/generated/BarcodeReader.d.ts +10 -0
- package/dist/types/components/Icon/generated/Battery.d.ts +10 -0
- package/dist/types/components/Icon/generated/BatteryCharging.d.ts +10 -0
- package/dist/types/components/Icon/generated/BatteryFull.d.ts +10 -0
- package/dist/types/components/Icon/generated/BatteryLow.d.ts +10 -0
- package/dist/types/components/Icon/generated/Connect.d.ts +10 -0
- package/dist/types/components/Icon/generated/MagicPen.d.ts +10 -0
- package/dist/types/components/Icon/generated/Wifi.d.ts +10 -0
- package/dist/types/components/Icon/generated/WifiOff.d.ts +10 -0
- package/dist/types/components/Icon/generated/WifiWarning.d.ts +10 -0
- package/dist/types/components/Icon/generated/Workflows.d.ts +10 -0
- package/dist/types/components/Icon/generated/index.d.ts +1 -1
- package/dist/types/components/MaintenanceBanner/index.d.ts +2 -0
- package/dist/types/components/MaintenanceBanner/maintenanceBanner.component.d.ts +22 -0
- package/dist/types/components/MaintenanceBanner/maintenanceBanner.types.d.ts +4 -0
- package/dist/types/components/TimePicker/timePicker.component.d.ts +1 -2
- package/dist/types/components/index.d.ts +1 -0
- package/package.json +14 -16
- package/dist/chunks/alert.types-BlvzpzTn.js.map +0 -1
- package/dist/chunks/alert.types-C6EN46Ra.js.map +0 -1
- package/dist/chunks/dateTimePicker.component-BF2pZ_Rn.js +0 -2
- package/dist/chunks/dateTimePicker.component-yelD1jlj.js +0 -331
- package/dist/chunks/dateTimePicker.component-yelD1jlj.js.map +0 -1
- package/dist/chunks/timePicker.component-DBjjLiQi.js +0 -232
- package/dist/chunks/timePicker.component-DBjjLiQi.js.map +0 -1
- package/dist/chunks/timePicker.component-xjn9FtR7.js +0 -2
- package/dist/chunks/timePicker.component-xjn9FtR7.js.map +0 -1
- package/dist/types/shared/utils/localToClinicTimezone.d.ts +0 -5
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AlertProps } from '../Alert/alert.component';
|
|
3
|
+
export interface MaintenanceBannerProps extends Omit<AlertProps, 'title' | 'description' | 'status' | 'hideCloseButton' | 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* The maintenance message to display.
|
|
6
|
+
* When falsy (undefined, null, or empty string), the banner does not render.
|
|
7
|
+
*/
|
|
8
|
+
message?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Optional secondary line of text displayed below the title.
|
|
11
|
+
*/
|
|
12
|
+
description?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Data test id for the banner.
|
|
15
|
+
* @default kibble-maintenance-banner
|
|
16
|
+
*/
|
|
17
|
+
'data-testid'?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const MaintenanceBanner: {
|
|
20
|
+
({ message, description, ["data-testid"]: dataTestId, ...rest }: MaintenanceBannerProps): React.JSX.Element | null;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
@@ -20,11 +20,10 @@ export interface TimePickerProps {
|
|
|
20
20
|
* @default bottom
|
|
21
21
|
*/
|
|
22
22
|
placement?: Placement;
|
|
23
|
-
timezone?: string;
|
|
24
23
|
/**
|
|
25
24
|
* Data test id for the time picker.
|
|
26
25
|
* @default kibble-timepicker
|
|
27
26
|
*/
|
|
28
27
|
'data-testid'?: string;
|
|
29
28
|
}
|
|
30
|
-
export declare const TimePicker: ({ initialTime, inputProps, minuteInterval, onTimeChange, onClose, placement,
|
|
29
|
+
export declare const TimePicker: ({ initialTime, inputProps, minuteInterval, onTimeChange, onClose, placement, ["data-testid"]: dataTestId, }: TimePickerProps) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"packages/*"
|
|
5
5
|
],
|
|
6
6
|
"description": "Kibble Design System by Otto",
|
|
7
|
-
"version": "5.0.
|
|
7
|
+
"version": "5.0.22",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./dist/cjs/index.cjs",
|
|
10
10
|
"module": "./dist/esm/index.js",
|
|
@@ -34,10 +34,9 @@
|
|
|
34
34
|
"predeploy": "npm run build",
|
|
35
35
|
"prepare": "husky",
|
|
36
36
|
"publishBeta": "npm run build && npm publish --tag beta",
|
|
37
|
-
"start": "npm run generate:icons & npm run generate:logos & npm run theme:watch & storybook dev -p 6006",
|
|
37
|
+
"start": "WATCHPACK_POLLING=1 npm run generate:icons & WATCHPACK_POLLING=1 npm run generate:logos & WATCHPACK_POLLING=1 npm run theme:watch & WATCHPACK_POLLING=1 storybook dev -p 6006",
|
|
38
38
|
"test-storybook": "npm run build:preparation && vitest --project=storybook",
|
|
39
|
-
"theme:watch": "chakra typegen ./src/theme/theme.config.ts --watch"
|
|
40
|
-
"makeLocalPackage": "npm run build && npm pack"
|
|
39
|
+
"theme:watch": "chakra typegen ./src/theme/theme.config.ts --watch"
|
|
41
40
|
},
|
|
42
41
|
"engines": {
|
|
43
42
|
"node": ">=20.0.0",
|
|
@@ -134,16 +133,16 @@
|
|
|
134
133
|
},
|
|
135
134
|
"devDependencies": {
|
|
136
135
|
"@chakra-ui/cli": "^3.19.2",
|
|
137
|
-
"@chromatic-com/storybook": "^
|
|
136
|
+
"@chromatic-com/storybook": "^5.1.2",
|
|
138
137
|
"@emotion/react": "^11.14.0",
|
|
139
138
|
"@eslint/js": "^9.21.0",
|
|
140
|
-
"@storybook/addon-a11y": "^10.
|
|
141
|
-
"@storybook/addon-docs": "^10.
|
|
142
|
-
"@storybook/addon-onboarding": "^10.
|
|
143
|
-
"@storybook/addon-themes": "^10.
|
|
144
|
-
"@storybook/addon-vitest": "^10.
|
|
145
|
-
"@storybook/react-vite": "^10.
|
|
146
|
-
"@storybook/test-runner": "^0.24.
|
|
139
|
+
"@storybook/addon-a11y": "^10.3.5",
|
|
140
|
+
"@storybook/addon-docs": "^10.3.5",
|
|
141
|
+
"@storybook/addon-onboarding": "^10.3.5",
|
|
142
|
+
"@storybook/addon-themes": "^10.3.5",
|
|
143
|
+
"@storybook/addon-vitest": "^10.3.5",
|
|
144
|
+
"@storybook/react-vite": "^10.3.5",
|
|
145
|
+
"@storybook/test-runner": "^0.24.3",
|
|
147
146
|
"@types/lodash-es": "^4.17.12",
|
|
148
147
|
"@types/react": "^19.0.10",
|
|
149
148
|
"@vitejs/plugin-react": "^4.3.4",
|
|
@@ -153,7 +152,7 @@
|
|
|
153
152
|
"eslint": "^9.21.0",
|
|
154
153
|
"eslint-plugin-react-hooks": "^5.1.0",
|
|
155
154
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
156
|
-
"eslint-plugin-storybook": "^10.
|
|
155
|
+
"eslint-plugin-storybook": "^10.3.5",
|
|
157
156
|
"gh-pages": "^6.3.0",
|
|
158
157
|
"glob": "^13.0.0",
|
|
159
158
|
"globals": "^15.15.0",
|
|
@@ -163,7 +162,7 @@
|
|
|
163
162
|
"plop": "^4.0.1",
|
|
164
163
|
"prettier": "^3.5.3",
|
|
165
164
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
166
|
-
"storybook": "^10.
|
|
165
|
+
"storybook": "^10.3.5",
|
|
167
166
|
"typescript": "~5.7.2",
|
|
168
167
|
"typescript-eslint": "^8.24.1",
|
|
169
168
|
"vite": "^6.2.0",
|
|
@@ -177,8 +176,7 @@
|
|
|
177
176
|
"@emotion/react": "^11.14.0",
|
|
178
177
|
"date-fns": "^4.1.0",
|
|
179
178
|
"lodash-es": "^4.17.21",
|
|
180
|
-
"react": "^19.0.0"
|
|
181
|
-
"date-fns-tz": "^3.2.0"
|
|
179
|
+
"react": "^19.0.0"
|
|
182
180
|
},
|
|
183
181
|
"dependencies": {
|
|
184
182
|
"@televet/kibble-primitives": "*",
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAY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,CAAA,OAAAG,EAAgB,WAAAY,EAAyB,GAAGP,CAAa,CAAA,CAAA,CAAA,CAE1E,EAEDC,4BACEW,EAAmB,CAAA,GAAID,GAAoB,CAAE,eAAgB,eAC5D,EAAA,SAAA,CAACrC,EAAAA,kBAAAA,IAAAgD,EAAA,CAAmB,UAAU,qBAAqB,cAAa,GAAG1B,CAAU,eAC1E,SAAA,OAAOK,GAAgB,iCACrBsB,EAAK,YAAA,CAAA,KAAK,KAAK,QAAShB,EAAa,aAAe,UAAY,GAAGL,EACjE,SACHD,CAAA,CAAA,EAEAA,CAEJ,CAAA,EACCD,GAAeA,EAAY,iBAAmB,YAAc,CAACQ,GAC5DlC,wBAACkB,EAAY,CAAA,OAAAG,EAAgB,WAAAY,EAAyB,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 +0,0 @@
|
|
|
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,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Uc;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,2 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("./jsx-runtime-BjDatQAs.js"),l=require("react"),F=require("./button.component-DjdgBXDC.js"),c=require("./datePicker.provider-i35-VNAb.js"),L=require("./usePortalContentRef-CTrvBQ7I.js"),B=require("./popover.recipe-CtptsJg6.js"),x=require("./format-CK7Imh-5.js"),v=require("./isToday-BgNkHh5t.js"),H=require("./popover-root-provider-CZDbUJ2K.js"),T=require("./flex-BOU6tYUd.js"),$=require("../cjs/hooks/useBreakpoint/index.cjs"),f=require("./index-BQRnVsAg.js"),q=require("./text.component-BDDz5KQP.js"),G=require("./textInput.component-CwTc0h_F.js"),P=require("./timePicker.component-xjn9FtR7.js"),R=require("./grid-item-CH3dbZHL.js"),A=require("./divider.component-BX3zyB7O.js"),Q=require("./create-slot-recipe-context-HXE1VazG.js"),V=require("./index-Ts8g8jZd.js"),g=require("./popover-C7aj8Iwj.js");var r=(t=>(t.Today="Today",t.Yesterday="Yesterday",t.ThisWeek="ThisWeek",t.LastWeek="LastWeek",t.ThisMonth="ThisMonth",t.LastMonth="LastMonth",t.Custom="Custom",t))(r||{});const J=["single","double"],K=[{label:"Today",value:r.Today},{label:"Yesterday",value:r.Yesterday},{label:"This Week",value:r.ThisWeek},{label:"Last Week",value:r.LastWeek},{label:"This Month",value:r.ThisMonth},{label:"Last Month",value:r.LastMonth},{label:"Custom",value:r.Custom,iconName:"calendarPen"}],U={single:1,double:2};function X(t){return x.startOfDay(Date.now(),t)}function Z(t){return c.endOfDay(Date.now(),t)}function z(t){const e=v.constructNow(t?.in),s=e.getFullYear(),o=e.getMonth(),a=e.getDate(),u=v.constructNow(t?.in);return u.setFullYear(s,o,a-1),u.setHours(0,0,0,0),u}function ee(t){const e=v.constructNow(t?.in),s=x.constructFrom(t?.in,0);return s.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()-1),s.setHours(23,59,59,999),s}function _(t,e){const s=x.getDefaultOptions(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,a=x.toDate(t,e?.in),u=a.getDay(),d=(u<o?-7:0)+6-(u-o);return a.setDate(a.getDate()+d),a.setHours(23,59,59,999),a}function w(t,e){const s=x.toDate(t,e?.in);return s.setDate(1),s.setHours(0,0,0,0),s}function O(t,e){const s=x.toDate(t,e?.in),o=s.getMonth();return s.setFullYear(s.getFullYear(),o+1,0),s.setHours(23,59,59,999),s}function te(t,e,s){return c.addDays(t,e*7,s)}function se(t,e,s){return te(t,-1,s)}function ne(t,e,s){return c.addMonths(t,-1,s)}function S(t,e){return+x.toDate(t)==+x.toDate(e)}const N=t=>{const e=new Date;switch(t){case r.Today:return{startDate:X(),endDate:Z()};case r.Yesterday:return{startDate:z(),endDate:ee()};case r.ThisWeek:return{startDate:x.startOfWeek(e,{weekStartsOn:1}),endDate:_(e,{weekStartsOn:1})};case r.LastWeek:{const s=se(e);return{startDate:x.startOfWeek(s,{weekStartsOn:1}),endDate:_(s,{weekStartsOn:1})}}case r.ThisMonth:return{startDate:w(e),endDate:O(e)};case r.LastMonth:{const s=ne(e);return{startDate:w(s),endDate:O(s)}}default:return null}},re=(t,e)=>{if(!t||!e)return r.Today;const s=[r.Today,r.Yesterday,r.ThisWeek,r.LastWeek,r.ThisMonth,r.LastMonth];for(const o of s){const a=N(o);if(a&&S(t,a.startDate)&&S(e,a.endDate))return o}return r.Custom},oe=({selectedQuickOption:t,setSelectedQuickOption:e,["data-testid"]:s="kibble-datetime-picker-quick-options"})=>{const{setFocusedInput:o,onQuickOptionSelect:a}=c.useDatePickerContext(),{setOpen:u}=H.usePopoverContext(),d=i=>{if(e(i),i===r.Custom){o(c.FocusedInput.StartDate);return}const p=N(i);p&&(a(p),u(!1))};return n.jsxRuntimeExports.jsx(T.Flex,{className:"DateTimePicker__QuickFilters",flexDirection:"column",gap:2,w:"100%",maxW:"120px",children:K.map(i=>n.jsxRuntimeExports.jsx(F.Button,{className:"DateTimePicker__Option","data-testid":`${s}-option-${i.value}`,variant:"secondarySubtle",...i.iconName&&{iconName:i.iconName,iconPosition:"right"},...t===i.value&&{active:!0},onClick:()=>d(i.value),children:i.label},i.value))})},W=({label:t,rangeType:e,timezone:s})=>{const{startDate:o,endDate:a,dateFormat:u,focusedInput:d,setFocusedInput:i,onTimeChange:p}=c.useDatePickerContext(),h=l.useMemo(()=>(e===c.FocusedInput.StartDate?o:a)||new Date,[o,a,e]),b=l.useMemo(()=>x.format(h,u),[h,u]),D=m=>{m&&(s&&(m=P.localToClinicTimezone({date:m,timezone:s})),p(m,e))};return n.jsxRuntimeExports.jsxs(R.Grid,{alignItems:"center",templateColumns:"repeat(5, 1fr)",gap:1,bgColor:"background.secondaryAlpha",borderRadius:"md",p:1,flex:"0 0 50%",children:[n.jsxRuntimeExports.jsx(R.GridItem,{colSpan:1,children:n.jsxRuntimeExports.jsx(q.WrappedText,{size:"sm",fontWeight:"semibold",textAlign:"center",children:t})}),n.jsxRuntimeExports.jsx(R.GridItem,{colSpan:2,children:n.jsxRuntimeExports.jsx(G.WrappedTextInput,{readOnly:!0,value:b,onClick:()=>i(e),...d===e&&{"data-focus":!0}})}),n.jsxRuntimeExports.jsx(R.GridItem,{colSpan:2,children:n.jsxRuntimeExports.jsx(P.TimePicker,{minuteInterval:1,initialTime:h,onClose:m=>D(m),inputProps:{rightElement:void 0,onClick:()=>i(e)},timezone:s})})]})},ae=({isSingleView:t,timezone:e})=>{const{focusedInput:s,setFocusedInput:o}=c.useDatePickerContext();return l.useEffect(()=>{s||o(c.FocusedInput.StartDate)},[s,o]),n.jsxRuntimeExports.jsxs(f.Box,{className:"DateTimePicker__CustomFilters",mt:-1,children:[e&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsxs(q.WrappedText,{color:"text.danger",fontWeight:"bold",children:["Once you select a timing, it'll be converted to ",e," time."]}),n.jsxRuntimeExports.jsx("br",{})]}),n.jsxRuntimeExports.jsxs(T.Flex,{className:"DateTimePicker__CustomFilters__RangeSelectors",flexDirection:t?"column":"row",alignItems:"center",gap:2,justifyContent:"space-between",children:[n.jsxRuntimeExports.jsx(W,{label:"Start",rangeType:c.FocusedInput.StartDate,timezone:e}),n.jsxRuntimeExports.jsx(W,{label:"End",rangeType:c.FocusedInput.EndDate,timezone:e})]}),n.jsxRuntimeExports.jsxs(f.Box,{className:"CalendarView",bgColor:"background.secondaryAlpha",borderRadius:"md",p:1,mt:5,children:[n.jsxRuntimeExports.jsx(f.Box,{className:"CalendarView__Header",bgColor:"background.accent.subtle",borderRadius:"md",children:n.jsxRuntimeExports.jsx(c.DatePickerHeader,{triggerProps:{variant:"ghostNeutral"}})}),n.jsxRuntimeExports.jsx(f.Box,{className:"CalendarView__Body",children:n.jsxRuntimeExports.jsx(c.DatePickerCalendar,{showMonthLabels:!0})})]})]})},ie=({trigger:t,calendarView:e="double",portalled:s=!0,showQuickOptions:o=!0,["data-testid"]:a="kibble-datetime-picker",timezone:u,...d})=>{const i=l.useMemo(()=>{const M=new Date;return{startDate:x.startOfDay(M),endDate:c.endOfDay(M)}},[]),{contentRef:p}=L.usePortalContentRef(),b=Q.useSlotRecipe({recipe:B.popoverRecipe})(),D=$.useBreakpoint(),m=l.useMemo(()=>o?re(d.startDate||null,d.endDate||null):r.Custom,[o,d.startDate,d.endDate]),[j,y]=l.useState(m);l.useEffect(()=>{y(m)},[m]);const k=l.useMemo(()=>["base","sm"].includes(D)?"single":e,[e,D]),I=l.useMemo(()=>U[k],[k]),C=l.useMemo(()=>k==="single",[k]),E=l.useMemo(()=>j===r.Custom,[j]),Y=l.useMemo(()=>E?"max-content":"160px",[E]);return n.jsxRuntimeExports.jsxs(c.DatePickerProvider,{...d,startDate:d.startDate||i.startDate,endDate:d.endDate||i.endDate,withDateRange:!0,numberOfMonths:I,sameWidth:!0,children:[n.jsxRuntimeExports.jsx(g.PopoverTrigger,{asChild:!0,w:"max-content",children:t||n.jsxRuntimeExports.jsx(F.Button,{variant:"secondarySubtle",iconName:"calendarInfo","data-testid":`${a}-default-trigger`,children:"Date/Time Range"})}),n.jsxRuntimeExports.jsx(V.Portal,{container:p||void 0,disabled:!s,children:n.jsxRuntimeExports.jsx(g.PopoverPositioner,{className:"DateTimePicker","data-testid":a,children:n.jsxRuntimeExports.jsx(g.PopoverContent,{className:"DateTimePicker__Content","data-testid":`${a}-content`,css:{...b.content,"--popover-size":Y,maxW:o?C?"550px":"890px":C?"390px":"730px",...E&&{minW:o?"550px":"390px"}},children:n.jsxRuntimeExports.jsx(g.PopoverBody,{css:{"--popover-padding":0},children:n.jsxRuntimeExports.jsxs(T.Flex,{className:"DateTimePicker__Container","data-testid":`${a}-container`,p:5,children:[o&&n.jsxRuntimeExports.jsx(oe,{selectedQuickOption:j,setSelectedQuickOption:y}),j===r.Custom&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[o&&n.jsxRuntimeExports.jsx(A.Divider,{orientation:"vertical",my:-5,mx:5}),n.jsxRuntimeExports.jsx(ae,{isSingleView:C,timezone:u})]})]})})})})})]})};exports.DateTimePicker=ie;exports.DateTimePickerDefaultOptionValue=r;exports.calendarViews=J;
|
|
2
|
-
//# sourceMappingURL=dateTimePicker.component-BF2pZ_Rn.js.map
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import { j as s } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
-
import { useMemo as u, useEffect as R, useState as A } from "react";
|
|
3
|
-
import { B as Y } from "./button.component-BO6oee_V.js";
|
|
4
|
-
import { e as L, d as G, f as Q, u as v, F as p, b as q, c as V, a as J } from "./datePicker.provider-CavuOZl4.js";
|
|
5
|
-
import { u as K } from "./usePortalContentRef-DO_jc4W9.js";
|
|
6
|
-
import { p as U } from "./popover.recipe-DPwwsWLb.js";
|
|
7
|
-
import { s as I, c as X, g as Z, t as f, a as P, f as z } from "./format-CqTHHSak.js";
|
|
8
|
-
import { c as y } from "./isToday-iCYsPDMT.js";
|
|
9
|
-
import { u as ee } from "./popover-root-provider-CFn2dthZ.js";
|
|
10
|
-
import { F as S } from "./flex-CX-8gE9T.js";
|
|
11
|
-
import { useBreakpoint as te } from "../esm/hooks/useBreakpoint/index.js";
|
|
12
|
-
import { B as g } from "./index-9BerxEcw.js";
|
|
13
|
-
import { W as B } from "./text.component-DhuUgP3j.js";
|
|
14
|
-
import { W as ae } from "./textInput.component-BeiTxTkS.js";
|
|
15
|
-
import { T as se, l as ne } from "./timePicker.component-DBjjLiQi.js";
|
|
16
|
-
import { G as re, a as T } from "./grid-item-BmCSQ38y.js";
|
|
17
|
-
import { D as oe } from "./divider.component-CFOh4Nw3.js";
|
|
18
|
-
import { u as ie } from "./create-slot-recipe-context-D_FXDJGp.js";
|
|
19
|
-
import { P as ce } from "./index-DcmJgLUo.js";
|
|
20
|
-
import { P as le, a as de, b as ue, c as me } from "./popover-Gb1fXSR7.js";
|
|
21
|
-
var n = /* @__PURE__ */ ((t) => (t.Today = "Today", t.Yesterday = "Yesterday", t.ThisWeek = "ThisWeek", t.LastWeek = "LastWeek", t.ThisMonth = "ThisMonth", t.LastMonth = "LastMonth", t.Custom = "Custom", t))(n || {});
|
|
22
|
-
const Qe = ["single", "double"], pe = [
|
|
23
|
-
{
|
|
24
|
-
label: "Today",
|
|
25
|
-
value: n.Today
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: "Yesterday",
|
|
29
|
-
value: n.Yesterday
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: "This Week",
|
|
33
|
-
value: n.ThisWeek
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: "Last Week",
|
|
37
|
-
value: n.LastWeek
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: "This Month",
|
|
41
|
-
value: n.ThisMonth
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: "Last Month",
|
|
45
|
-
value: n.LastMonth
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
label: "Custom",
|
|
49
|
-
value: n.Custom,
|
|
50
|
-
iconName: "calendarPen"
|
|
51
|
-
}
|
|
52
|
-
], fe = {
|
|
53
|
-
single: 1,
|
|
54
|
-
double: 2
|
|
55
|
-
};
|
|
56
|
-
function he(t) {
|
|
57
|
-
return I(Date.now(), t);
|
|
58
|
-
}
|
|
59
|
-
function De(t) {
|
|
60
|
-
return L(Date.now(), t);
|
|
61
|
-
}
|
|
62
|
-
function xe(t) {
|
|
63
|
-
const e = y(t?.in), a = e.getFullYear(), r = e.getMonth(), o = e.getDate(), c = y(t?.in);
|
|
64
|
-
return c.setFullYear(a, r, o - 1), c.setHours(0, 0, 0, 0), c;
|
|
65
|
-
}
|
|
66
|
-
function ke(t) {
|
|
67
|
-
const e = y(t?.in), a = X(t?.in, 0);
|
|
68
|
-
return a.setFullYear(e.getFullYear(), e.getMonth(), e.getDate() - 1), a.setHours(23, 59, 59, 999), a;
|
|
69
|
-
}
|
|
70
|
-
function M(t, e) {
|
|
71
|
-
const a = Z(), r = e?.weekStartsOn ?? e?.locale?.options?.weekStartsOn ?? a.weekStartsOn ?? a.locale?.options?.weekStartsOn ?? 0, o = f(t, e?.in), c = o.getDay(), l = (c < r ? -7 : 0) + 6 - (c - r);
|
|
72
|
-
return o.setDate(o.getDate() + l), o.setHours(23, 59, 59, 999), o;
|
|
73
|
-
}
|
|
74
|
-
function O(t, e) {
|
|
75
|
-
const a = f(t, e?.in);
|
|
76
|
-
return a.setDate(1), a.setHours(0, 0, 0, 0), a;
|
|
77
|
-
}
|
|
78
|
-
function _(t, e) {
|
|
79
|
-
const a = f(t, e?.in), r = a.getMonth();
|
|
80
|
-
return a.setFullYear(a.getFullYear(), r + 1, 0), a.setHours(23, 59, 59, 999), a;
|
|
81
|
-
}
|
|
82
|
-
function ge(t, e, a) {
|
|
83
|
-
return G(t, e * 7, a);
|
|
84
|
-
}
|
|
85
|
-
function be(t, e, a) {
|
|
86
|
-
return ge(t, -1, a);
|
|
87
|
-
}
|
|
88
|
-
function Ce(t, e, a) {
|
|
89
|
-
return Q(t, -1, a);
|
|
90
|
-
}
|
|
91
|
-
function F(t, e) {
|
|
92
|
-
return +f(t) == +f(e);
|
|
93
|
-
}
|
|
94
|
-
const H = (t) => {
|
|
95
|
-
const e = /* @__PURE__ */ new Date();
|
|
96
|
-
switch (t) {
|
|
97
|
-
case n.Today:
|
|
98
|
-
return {
|
|
99
|
-
startDate: he(),
|
|
100
|
-
endDate: De()
|
|
101
|
-
};
|
|
102
|
-
case n.Yesterday:
|
|
103
|
-
return {
|
|
104
|
-
startDate: xe(),
|
|
105
|
-
endDate: ke()
|
|
106
|
-
};
|
|
107
|
-
case n.ThisWeek:
|
|
108
|
-
return {
|
|
109
|
-
startDate: P(e, { weekStartsOn: 1 }),
|
|
110
|
-
endDate: M(e, { weekStartsOn: 1 })
|
|
111
|
-
};
|
|
112
|
-
case n.LastWeek: {
|
|
113
|
-
const a = be(e);
|
|
114
|
-
return {
|
|
115
|
-
startDate: P(a, { weekStartsOn: 1 }),
|
|
116
|
-
endDate: M(a, { weekStartsOn: 1 })
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
case n.ThisMonth:
|
|
120
|
-
return {
|
|
121
|
-
startDate: O(e),
|
|
122
|
-
endDate: _(e)
|
|
123
|
-
};
|
|
124
|
-
case n.LastMonth: {
|
|
125
|
-
const a = Ce(e);
|
|
126
|
-
return {
|
|
127
|
-
startDate: O(a),
|
|
128
|
-
endDate: _(a)
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
default:
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
}, je = (t, e) => {
|
|
135
|
-
if (!t || !e)
|
|
136
|
-
return n.Today;
|
|
137
|
-
const a = [
|
|
138
|
-
n.Today,
|
|
139
|
-
n.Yesterday,
|
|
140
|
-
n.ThisWeek,
|
|
141
|
-
n.LastWeek,
|
|
142
|
-
n.ThisMonth,
|
|
143
|
-
n.LastMonth
|
|
144
|
-
];
|
|
145
|
-
for (const r of a) {
|
|
146
|
-
const o = H(r);
|
|
147
|
-
if (o && F(t, o.startDate) && F(e, o.endDate))
|
|
148
|
-
return r;
|
|
149
|
-
}
|
|
150
|
-
return n.Custom;
|
|
151
|
-
}, Te = ({
|
|
152
|
-
selectedQuickOption: t,
|
|
153
|
-
setSelectedQuickOption: e,
|
|
154
|
-
["data-testid"]: a = "kibble-datetime-picker-quick-options"
|
|
155
|
-
}) => {
|
|
156
|
-
const { setFocusedInput: r, onQuickOptionSelect: o } = v(), { setOpen: c } = ee(), l = (i) => {
|
|
157
|
-
if (e(i), i === n.Custom) {
|
|
158
|
-
r(p.StartDate);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const m = H(i);
|
|
162
|
-
m && (o(m), c(!1));
|
|
163
|
-
};
|
|
164
|
-
return /* @__PURE__ */ s.jsx(S, { className: "DateTimePicker__QuickFilters", flexDirection: "column", gap: 2, w: "100%", maxW: "120px", children: pe.map((i) => /* @__PURE__ */ s.jsx(
|
|
165
|
-
Y,
|
|
166
|
-
{
|
|
167
|
-
className: "DateTimePicker__Option",
|
|
168
|
-
"data-testid": `${a}-option-${i.value}`,
|
|
169
|
-
variant: "secondarySubtle",
|
|
170
|
-
...i.iconName && { iconName: i.iconName, iconPosition: "right" },
|
|
171
|
-
...t === i.value && { active: !0 },
|
|
172
|
-
onClick: () => l(i.value),
|
|
173
|
-
children: i.label
|
|
174
|
-
},
|
|
175
|
-
i.value
|
|
176
|
-
)) });
|
|
177
|
-
}, N = ({
|
|
178
|
-
label: t,
|
|
179
|
-
rangeType: e,
|
|
180
|
-
timezone: a
|
|
181
|
-
}) => {
|
|
182
|
-
const { startDate: r, endDate: o, dateFormat: c, focusedInput: l, setFocusedInput: i, onTimeChange: m } = v(), h = u(
|
|
183
|
-
() => (e === p.StartDate ? r : o) || /* @__PURE__ */ new Date(),
|
|
184
|
-
[r, o, e]
|
|
185
|
-
), b = u(() => z(h, c), [h, c]), D = (d) => {
|
|
186
|
-
d && (a && (d = ne({ date: d, timezone: a })), m(d, e));
|
|
187
|
-
};
|
|
188
|
-
return /* @__PURE__ */ s.jsxs(
|
|
189
|
-
re,
|
|
190
|
-
{
|
|
191
|
-
alignItems: "center",
|
|
192
|
-
templateColumns: "repeat(5, 1fr)",
|
|
193
|
-
gap: 1,
|
|
194
|
-
bgColor: "background.secondaryAlpha",
|
|
195
|
-
borderRadius: "md",
|
|
196
|
-
p: 1,
|
|
197
|
-
flex: "0 0 50%",
|
|
198
|
-
children: [
|
|
199
|
-
/* @__PURE__ */ s.jsx(T, { colSpan: 1, children: /* @__PURE__ */ s.jsx(B, { size: "sm", fontWeight: "semibold", textAlign: "center", children: t }) }),
|
|
200
|
-
/* @__PURE__ */ s.jsx(T, { colSpan: 2, children: /* @__PURE__ */ s.jsx(
|
|
201
|
-
ae,
|
|
202
|
-
{
|
|
203
|
-
readOnly: !0,
|
|
204
|
-
value: b,
|
|
205
|
-
onClick: () => i(e),
|
|
206
|
-
...l === e && {
|
|
207
|
-
"data-focus": !0
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
) }),
|
|
211
|
-
/* @__PURE__ */ s.jsx(T, { colSpan: 2, children: /* @__PURE__ */ s.jsx(
|
|
212
|
-
se,
|
|
213
|
-
{
|
|
214
|
-
minuteInterval: 1,
|
|
215
|
-
initialTime: h,
|
|
216
|
-
onClose: (d) => D(d),
|
|
217
|
-
inputProps: { rightElement: void 0, onClick: () => i(e) },
|
|
218
|
-
timezone: a
|
|
219
|
-
}
|
|
220
|
-
) })
|
|
221
|
-
]
|
|
222
|
-
}
|
|
223
|
-
);
|
|
224
|
-
}, ye = ({
|
|
225
|
-
isSingleView: t,
|
|
226
|
-
timezone: e
|
|
227
|
-
}) => {
|
|
228
|
-
const { focusedInput: a, setFocusedInput: r } = v();
|
|
229
|
-
return R(() => {
|
|
230
|
-
a || r(p.StartDate);
|
|
231
|
-
}, [a, r]), /* @__PURE__ */ s.jsxs(g, { className: "DateTimePicker__CustomFilters", mt: -1, children: [
|
|
232
|
-
e && /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
233
|
-
/* @__PURE__ */ s.jsxs(B, { color: "text.danger", fontWeight: "bold", children: [
|
|
234
|
-
"Once you select a timing, it'll be converted to ",
|
|
235
|
-
e,
|
|
236
|
-
" time."
|
|
237
|
-
] }),
|
|
238
|
-
/* @__PURE__ */ s.jsx("br", {})
|
|
239
|
-
] }),
|
|
240
|
-
/* @__PURE__ */ s.jsxs(
|
|
241
|
-
S,
|
|
242
|
-
{
|
|
243
|
-
className: "DateTimePicker__CustomFilters__RangeSelectors",
|
|
244
|
-
flexDirection: t ? "column" : "row",
|
|
245
|
-
alignItems: "center",
|
|
246
|
-
gap: 2,
|
|
247
|
-
justifyContent: "space-between",
|
|
248
|
-
children: [
|
|
249
|
-
/* @__PURE__ */ s.jsx(N, { label: "Start", rangeType: p.StartDate, timezone: e }),
|
|
250
|
-
/* @__PURE__ */ s.jsx(N, { label: "End", rangeType: p.EndDate, timezone: e })
|
|
251
|
-
]
|
|
252
|
-
}
|
|
253
|
-
),
|
|
254
|
-
/* @__PURE__ */ s.jsxs(g, { className: "CalendarView", bgColor: "background.secondaryAlpha", borderRadius: "md", p: 1, mt: 5, children: [
|
|
255
|
-
/* @__PURE__ */ s.jsx(g, { className: "CalendarView__Header", bgColor: "background.accent.subtle", borderRadius: "md", children: /* @__PURE__ */ s.jsx(q, { triggerProps: { variant: "ghostNeutral" } }) }),
|
|
256
|
-
/* @__PURE__ */ s.jsx(g, { className: "CalendarView__Body", children: /* @__PURE__ */ s.jsx(V, { showMonthLabels: !0 }) })
|
|
257
|
-
] })
|
|
258
|
-
] });
|
|
259
|
-
}, qe = ({
|
|
260
|
-
trigger: t,
|
|
261
|
-
calendarView: e = "double",
|
|
262
|
-
portalled: a = !0,
|
|
263
|
-
showQuickOptions: r = !0,
|
|
264
|
-
["data-testid"]: o = "kibble-datetime-picker",
|
|
265
|
-
timezone: c,
|
|
266
|
-
...l
|
|
267
|
-
}) => {
|
|
268
|
-
const i = u(() => {
|
|
269
|
-
const w = /* @__PURE__ */ new Date();
|
|
270
|
-
return {
|
|
271
|
-
startDate: I(w),
|
|
272
|
-
endDate: L(w)
|
|
273
|
-
};
|
|
274
|
-
}, []), { contentRef: m } = K(), b = ie({ recipe: U })(), D = te(), d = u(() => r ? je(l.startDate || null, l.endDate || null) : n.Custom, [r, l.startDate, l.endDate]), [x, W] = A(d);
|
|
275
|
-
R(() => {
|
|
276
|
-
W(d);
|
|
277
|
-
}, [d]);
|
|
278
|
-
const k = u(
|
|
279
|
-
() => ["base", "sm"].includes(D) ? "single" : e,
|
|
280
|
-
[e, D]
|
|
281
|
-
), E = u(() => fe[k], [k]), C = u(() => k === "single", [k]), j = u(
|
|
282
|
-
() => x === n.Custom,
|
|
283
|
-
[x]
|
|
284
|
-
), $ = u(() => j ? "max-content" : "160px", [j]);
|
|
285
|
-
return /* @__PURE__ */ s.jsxs(
|
|
286
|
-
J,
|
|
287
|
-
{
|
|
288
|
-
...l,
|
|
289
|
-
startDate: l.startDate || i.startDate,
|
|
290
|
-
endDate: l.endDate || i.endDate,
|
|
291
|
-
withDateRange: !0,
|
|
292
|
-
numberOfMonths: E,
|
|
293
|
-
sameWidth: !0,
|
|
294
|
-
children: [
|
|
295
|
-
/* @__PURE__ */ s.jsx(le, { asChild: !0, w: "max-content", children: t || /* @__PURE__ */ s.jsx(Y, { variant: "secondarySubtle", iconName: "calendarInfo", "data-testid": `${o}-default-trigger`, children: "Date/Time Range" }) }),
|
|
296
|
-
/* @__PURE__ */ s.jsx(ce, { container: m || void 0, disabled: !a, children: /* @__PURE__ */ s.jsx(de, { className: "DateTimePicker", "data-testid": o, children: /* @__PURE__ */ s.jsx(
|
|
297
|
-
ue,
|
|
298
|
-
{
|
|
299
|
-
className: "DateTimePicker__Content",
|
|
300
|
-
"data-testid": `${o}-content`,
|
|
301
|
-
css: {
|
|
302
|
-
...b.content,
|
|
303
|
-
"--popover-size": $,
|
|
304
|
-
maxW: r ? C ? "550px" : "890px" : C ? "390px" : "730px",
|
|
305
|
-
...j && { minW: r ? "550px" : "390px" }
|
|
306
|
-
},
|
|
307
|
-
children: /* @__PURE__ */ s.jsx(me, { css: { "--popover-padding": 0 }, children: /* @__PURE__ */ s.jsxs(S, { className: "DateTimePicker__Container", "data-testid": `${o}-container`, p: 5, children: [
|
|
308
|
-
r && /* @__PURE__ */ s.jsx(
|
|
309
|
-
Te,
|
|
310
|
-
{
|
|
311
|
-
selectedQuickOption: x,
|
|
312
|
-
setSelectedQuickOption: W
|
|
313
|
-
}
|
|
314
|
-
),
|
|
315
|
-
x === n.Custom && /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
316
|
-
r && /* @__PURE__ */ s.jsx(oe, { orientation: "vertical", my: -5, mx: 5 }),
|
|
317
|
-
/* @__PURE__ */ s.jsx(ye, { isSingleView: C, timezone: c })
|
|
318
|
-
] })
|
|
319
|
-
] }) })
|
|
320
|
-
}
|
|
321
|
-
) }) })
|
|
322
|
-
]
|
|
323
|
-
}
|
|
324
|
-
);
|
|
325
|
-
};
|
|
326
|
-
export {
|
|
327
|
-
qe as D,
|
|
328
|
-
n as a,
|
|
329
|
-
Qe as c
|
|
330
|
-
};
|
|
331
|
-
//# sourceMappingURL=dateTimePicker.component-yelD1jlj.js.map
|