@televet/kibble-ui 5.0.26 → 5.0.27-frank.2

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.
Files changed (56) hide show
  1. package/dist/chunks/calendar.component-CNkQkkZ5.js +2 -0
  2. package/dist/chunks/calendar.component-CNkQkkZ5.js.map +1 -0
  3. package/dist/chunks/calendar.component-KkAjNHof.js +65 -0
  4. package/dist/chunks/calendar.component-KkAjNHof.js.map +1 -0
  5. package/dist/chunks/dateTimePicker.component-Dvc84auK.js +2 -0
  6. package/dist/chunks/dateTimePicker.component-Dvc84auK.js.map +1 -0
  7. package/dist/chunks/dateTimePicker.component-YnanZ6z4.js +303 -0
  8. package/dist/chunks/dateTimePicker.component-YnanZ6z4.js.map +1 -0
  9. package/dist/chunks/endOfMonth-Cdo637cm.js +23 -0
  10. package/dist/chunks/endOfMonth-Cdo637cm.js.map +1 -0
  11. package/dist/chunks/endOfMonth-M8F1WVLW.js +2 -0
  12. package/dist/chunks/endOfMonth-M8F1WVLW.js.map +1 -0
  13. package/dist/chunks/{semanticTokens.records-CwC7zhMS.js → semanticTokens.records-Di2_gv9n.js} +6 -6
  14. package/dist/chunks/{semanticTokens.records-CwC7zhMS.js.map → semanticTokens.records-Di2_gv9n.js.map} +1 -1
  15. package/dist/chunks/theme-BFbOz0Jj.js.map +1 -1
  16. package/dist/chunks/theme-BOK659O0.js.map +1 -1
  17. package/dist/chunks/{theme.provider-CtbJ04tc.js → theme.provider-CVSsJMOG.js} +2 -2
  18. package/dist/chunks/{theme.provider-CtbJ04tc.js.map → theme.provider-CVSsJMOG.js.map} +1 -1
  19. package/dist/cjs/components/Calendar/index.cjs +1 -1
  20. package/dist/cjs/components/DateTimePicker/index.cjs +1 -1
  21. package/dist/cjs/components/index.cjs +1 -1
  22. package/dist/cjs/index.cjs +1 -1
  23. package/dist/cjs/theme/semanticTokens/index.cjs +1 -1
  24. package/dist/cjs/theme/semanticTokens/index.cjs.map +1 -1
  25. package/dist/esm/components/Calendar/index.js +1 -1
  26. package/dist/esm/components/DateTimePicker/index.js +5 -4
  27. package/dist/esm/components/DateTimePicker/index.js.map +1 -1
  28. package/dist/esm/components/index.js +106 -105
  29. package/dist/esm/components/index.js.map +1 -1
  30. package/dist/esm/index.js +127 -126
  31. package/dist/esm/index.js.map +1 -1
  32. package/dist/esm/theme/index.js +1 -1
  33. package/dist/esm/theme/semanticTokens/index.js +39 -15
  34. package/dist/esm/theme/semanticTokens/index.js.map +1 -1
  35. package/dist/types/components/Calendar/calendarFooterButton.component.d.ts +5 -3
  36. package/dist/types/components/Heading/heading.recipe.d.ts +1 -1
  37. package/dist/types/components/Link/link.recipe.d.ts +1 -1
  38. package/dist/types/components/Modal/modal.recipe.d.ts +1 -1
  39. package/dist/types/components/Text/text.recipe.d.ts +1 -1
  40. package/dist/types/shared/types/theme.d.ts +1 -1
  41. package/dist/types/theme/semanticTokens/semanticTokens.config.d.ts +37 -37
  42. package/dist/types/theme/tokens/colors/colors.config.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/dist/chunks/calendar.component-6Z5lc-eR.js +0 -2
  45. package/dist/chunks/calendar.component-6Z5lc-eR.js.map +0 -1
  46. package/dist/chunks/calendar.component-Dx7c4EIy.js +0 -62
  47. package/dist/chunks/calendar.component-Dx7c4EIy.js.map +0 -1
  48. package/dist/chunks/dateTimePicker.component-BwKD6TeU.js +0 -306
  49. package/dist/chunks/dateTimePicker.component-BwKD6TeU.js.map +0 -1
  50. package/dist/chunks/dateTimePicker.component-C7SFD9Py.js +0 -2
  51. package/dist/chunks/dateTimePicker.component-C7SFD9Py.js.map +0 -1
  52. package/dist/chunks/endOfMonth-ClO3w4vF.js +0 -2
  53. package/dist/chunks/endOfMonth-ClO3w4vF.js.map +0 -1
  54. package/dist/chunks/endOfMonth-D0kCU08_.js +0 -19
  55. package/dist/chunks/endOfMonth-D0kCU08_.js.map +0 -1
  56. package/dist/types/components/Calendar/calendarTodayButton.component.d.ts +0 -10
@@ -11,9 +11,9 @@ export declare const semanticColorTokens: {
11
11
  hover: any;
12
12
  pressed: any;
13
13
  contrast: {
14
- DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
15
- hover: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
16
- pressed: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
14
+ DEFAULT: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
15
+ hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
16
+ pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
17
17
  };
18
18
  };
19
19
  secondary: {
@@ -21,9 +21,9 @@ export declare const semanticColorTokens: {
21
21
  hover: any;
22
22
  pressed: any;
23
23
  contrast: {
24
- DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
25
- hover: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
26
- pressed: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
24
+ DEFAULT: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
25
+ hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
26
+ pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
27
27
  };
28
28
  };
29
29
  brand: any;
@@ -65,9 +65,9 @@ export declare const semanticColorTokens: {
65
65
  hover: any;
66
66
  pressed: any;
67
67
  contrast: {
68
- DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
69
- hover: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
70
- pressed: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
68
+ DEFAULT: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
69
+ hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
70
+ pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
71
71
  };
72
72
  };
73
73
  primaryAlpha: {
@@ -75,9 +75,9 @@ export declare const semanticColorTokens: {
75
75
  hover: any;
76
76
  pressed: any;
77
77
  contrast: {
78
- DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
79
- hover: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
80
- pressed: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
78
+ DEFAULT: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
79
+ hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
80
+ pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
81
81
  };
82
82
  };
83
83
  secondaryAlpha: {
@@ -85,9 +85,9 @@ export declare const semanticColorTokens: {
85
85
  hover: any;
86
86
  pressed: any;
87
87
  contrast: {
88
- DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
89
- hover: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
90
- pressed: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
88
+ DEFAULT: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
89
+ hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
90
+ pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
91
91
  };
92
92
  };
93
93
  destructiveAlpha: {
@@ -95,20 +95,20 @@ export declare const semanticColorTokens: {
95
95
  hover: any;
96
96
  pressed: any;
97
97
  contrast: {
98
- DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
99
- hover: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
100
- pressed: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
98
+ DEFAULT: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
99
+ hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
100
+ pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
101
101
  };
102
102
  };
103
103
  overlay: {
104
104
  DEFAULT: any;
105
- contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
105
+ contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
106
106
  };
107
107
  backdrop: any;
108
108
  contrast: {
109
- DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
110
- subtle: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
111
- moreSubtle: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
109
+ DEFAULT: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
110
+ subtle: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
111
+ moreSubtle: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
112
112
  mostSubtle: any;
113
113
  };
114
114
  gradientFull: {
@@ -116,9 +116,9 @@ export declare const semanticColorTokens: {
116
116
  hover: any;
117
117
  pressed: any;
118
118
  contrast: {
119
- DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
120
- hover: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
121
- pressed: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
119
+ DEFAULT: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
120
+ hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
121
+ pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
122
122
  };
123
123
  };
124
124
  gradientPink: {
@@ -134,15 +134,15 @@ export declare const semanticColorTokens: {
134
134
  subtle: any;
135
135
  strong: {
136
136
  DEFAULT: any;
137
- contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
137
+ contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
138
138
  };
139
139
  focus: {
140
140
  DEFAULT: any;
141
- contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
141
+ contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
142
142
  };
143
143
  brand: {
144
144
  DEFAULT: any;
145
- contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
145
+ contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
146
146
  };
147
147
  info: any;
148
148
  success: any;
@@ -155,8 +155,8 @@ export declare const semanticColorTokens: {
155
155
  DEFAULT: any;
156
156
  subtle: any;
157
157
  };
158
- contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
159
- 'contrast.subtle': import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
158
+ contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
159
+ 'contrast.subtle': import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
160
160
  };
161
161
  divider: {
162
162
  DEFAULT: any;
@@ -167,22 +167,22 @@ export declare const semanticColorTokens: {
167
167
  default: any;
168
168
  subtle: {
169
169
  DEFAULT: any;
170
- contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
170
+ contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
171
171
  };
172
172
  interactive: {
173
173
  DEFAULT: any;
174
174
  hover: any;
175
175
  contrast: {
176
- DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
177
- hover: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
176
+ DEFAULT: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
177
+ hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
178
178
  };
179
179
  };
180
180
  brand: {
181
181
  DEFAULT: any;
182
182
  hover: any;
183
183
  contrast: {
184
- DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
185
- hover: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
184
+ DEFAULT: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
185
+ hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
186
186
  };
187
187
  };
188
188
  info: any;
@@ -196,12 +196,12 @@ export declare const semanticColorTokens: {
196
196
  };
197
197
  placeholder: {
198
198
  DEFAULT: any;
199
- contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
199
+ contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
200
200
  };
201
201
  accent: {
202
202
  DEFAULT: any;
203
203
  subtle: any;
204
204
  };
205
- contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
205
+ contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
206
206
  };
207
207
  };
@@ -1,3 +1,3 @@
1
- export declare const colorTokens: Record<import('../../../../packages/kibble-primitives/src/core/colors/index.ts').CoreColor, Record<import('../../../../packages/kibble-primitives/src/core/colors/index.ts').ColorValue, {
1
+ export declare const colorTokens: Record<import('../../../../packages/kibble-primitives/src/index.ts').CoreColor, Record<import('../../../../packages/kibble-primitives/src/index.ts').ColorValue, {
2
2
  value: string;
3
3
  }>>;
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.26",
7
+ "version": "5.0.27-frank.2",
8
8
  "type": "module",
9
9
  "main": "./dist/cjs/index.cjs",
10
10
  "module": "./dist/esm/index.js",
@@ -1,2 +0,0 @@
1
- "use strict";const s=require("./jsx-runtime-BjDatQAs.js"),k=require("./index-BQRnVsAg.js"),c=require("./datePicker.provider-i35-VNAb.js"),j=require("./divider.component-BX3zyB7O.js"),b=require("./button.component-DjdgBXDC.js"),x=require("./format-CK7Imh-5.js"),u=require("./endOfMonth-ClO3w4vF.js"),R={today:"Today",thisWeek:"This Week",thisMonth:"This Month"},h=({footer:e,["data-testid"]:o="kibble-calendar-footer"})=>{const{goToDate:a,onDateSelect:n,onQuickOptionSelect:i}=c.useDatePickerContext(),d=()=>{if(e.type==="custom"){e.onClick();return}const r=new Date;switch(e.value){case"today":{const t=x.startOfDay(r);a(t),n(t);break}case"thisWeek":{const t=x.startOfWeek(r,{weekStartsOn:1}),l=u.endOfWeek(r,{weekStartsOn:1});a(t),i({startDate:t,endDate:l});break}case"thisMonth":{const t=u.startOfMonth(r),l=u.endOfMonth(r);a(t),i({startDate:t,endDate:l});break}}e.onClick?.()},m=e.type==="custom"?e.label:e.label??R[e.value];return s.jsxRuntimeExports.jsx(k.Box,{"data-testid":o,bg:"background.secondarySubtle",borderRadius:"md",p:2,w:"full",children:s.jsxRuntimeExports.jsx(b.Button,{variant:"secondarySubtle",size:"md",w:"full",onClick:d,children:m})})},D=["today"],p=e=>!D.includes(e),E=({["data-testid"]:e="kibble-calendar",withDateRange:o=!0,withHeaderTriggers:a=!1,footer:n,...i})=>{const d=o||n?.type==="preset"&&p(n.value);return s.jsxRuntimeExports.jsx(k.Box,{className:"Calendar","data-testid":e,maxW:n?"360px":"340px",children:s.jsxRuntimeExports.jsxs(c.DatePickerProvider,{withDateRange:d,...i,standalone:!0,children:[s.jsxRuntimeExports.jsx(c.DatePickerHeader,{withTriggers:a}),s.jsxRuntimeExports.jsx(j.Divider,{}),s.jsxRuntimeExports.jsx(c.DatePickerCalendar,{}),n&&s.jsxRuntimeExports.jsx(h,{footer:n})]})})};exports.Calendar=E;exports.CalendarFooterButton=h;exports.isRangePreset=p;
2
- //# sourceMappingURL=calendar.component-6Z5lc-eR.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"calendar.component-6Z5lc-eR.js","sources":["../../src/components/Calendar/calendarFooterButton.component.tsx","../../src/components/Calendar/calendar.utils.ts","../../src/components/Calendar/calendar.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Button } from 'components/Button/button.component';\nimport { useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\nimport startOfDay from 'date-fns/startOfDay';\nimport startOfWeek from 'date-fns/startOfWeek';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport endOfWeek from 'date-fns/endOfWeek';\nimport endOfMonth from 'date-fns/endOfMonth';\n\nexport type CalendarPreset = 'today' | 'thisWeek' | 'thisMonth';\n\nexport interface CalendarFooterPresetConfig {\n type: 'preset';\n /** The built-in preset to apply when the button is clicked. */\n value: CalendarPreset;\n /**\n * Override the button label.\n * Defaults: 'today' → 'Today', 'thisWeek' → 'This Week', 'thisMonth' → 'This Month'.\n */\n label?: string;\n /** Optional callback fired after the preset date is selected. */\n onClick?: () => void;\n}\n\nexport interface CalendarFooterCustomConfig {\n type: 'custom';\n /** Button label — required for custom type. */\n label: string;\n /** Handler called when the button is clicked. Full control — no date selection is performed. */\n onClick: () => void;\n}\n\nexport type CalendarFooterConfig = CalendarFooterPresetConfig | CalendarFooterCustomConfig;\n\nconst PRESET_LABELS: Record<CalendarPreset, string> = {\n today: 'Today',\n thisWeek: 'This Week',\n thisMonth: 'This Month',\n};\n\ninterface CalendarFooterButtonProps {\n footer: CalendarFooterConfig;\n /** Data test id for the footer container.\n * @default kibble-calendar-footer\n */\n 'data-testid'?: string;\n}\n\nexport const CalendarFooterButton = ({\n footer,\n ['data-testid']: dataTestId = 'kibble-calendar-footer',\n}: CalendarFooterButtonProps): React.JSX.Element => {\n const { goToDate, onDateSelect, onQuickOptionSelect } = useDatePickerContext();\n\n const handleClick = (): void => {\n if (footer.type === 'custom') {\n footer.onClick();\n return;\n }\n\n const today = new Date();\n\n switch (footer.value) {\n case 'today': {\n const date = startOfDay(today);\n goToDate(date);\n onDateSelect(date);\n break;\n }\n case 'thisWeek': {\n const start = startOfWeek(today, { weekStartsOn: 1 });\n const end = endOfWeek(today, { weekStartsOn: 1 });\n goToDate(start);\n // onQuickOptionSelect sets both dates atomically, avoiding the two-click range flow\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n case 'thisMonth': {\n const start = startOfMonth(today);\n const end = endOfMonth(today);\n goToDate(start);\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n }\n\n footer.onClick?.();\n };\n\n const label =\n footer.type === 'custom'\n ? footer.label\n : (footer.label ?? PRESET_LABELS[footer.value]);\n\n return (\n <Box data-testid={dataTestId} bg=\"background.secondarySubtle\" borderRadius=\"md\" p={2} w=\"full\">\n <Button variant=\"secondarySubtle\" size=\"md\" w=\"full\" onClick={handleClick}>\n {label}\n </Button>\n </Box>\n );\n};\n","import { CalendarPreset } from './calendarFooterButton.component';\n\nconst SINGLE_PRESETS: CalendarPreset[] = ['today'];\n\n/** Returns true when the preset requires date range selection (week, month). */\nexport const isRangePreset = (value: CalendarPreset): boolean =>\n !SINGLE_PRESETS.includes(value);\n","import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { DatePickerCalendar } from 'components/DatePicker/components/DatePickerCalendar/datePickerCalendar.component';\nimport { DatePickerHeader } from 'components/DatePicker/components/DatePickerHeader/datePickerHeader.component';\nimport { Divider } from 'components/Divider';\nimport { DatePickerProvider } from 'components/DatePicker/context/datePicker.provider';\nimport { DateProps } from 'components/DatePicker/datePicker.types';\nimport { CalendarFooterButton, CalendarFooterConfig } from './calendarFooterButton.component';\nimport { isRangePreset } from './calendar.utils';\n\nexport interface CalendarProps extends DateProps {\n /** Data test id for the calendar.\n * @default kibble-calendar\n */\n 'data-testid'?: string;\n /**\n * If true, the calendar will allow for a date range selection.\n * @default true\n */\n withDateRange?: boolean;\n /**\n * If true, the calendar will show the month and year selectors in the header.\n * @default false\n */\n withHeaderTriggers?: boolean;\n /**\n * Optional footer button configuration. Renders a styled button below the calendar grid.\n *\n * Use `type: 'preset'` for built-in shortcuts ('today' | 'thisWeek' | 'thisMonth') — the\n * component handles the date selection logic automatically.\n *\n * Use `type: 'custom'` to supply your own label and click handler with no built-in date logic.\n *\n * @example\n * // Preset\n * footer={{ type: 'preset', value: 'today', onClick: () => setOpen(false) }}\n *\n * @example\n * // Custom\n * footer={{ type: 'custom', label: 'Reset', onClick: handleReset }}\n */\n footer?: CalendarFooterConfig;\n}\n\nexport const Calendar = ({\n ['data-testid']: dataTestId = 'kibble-calendar',\n withDateRange = true,\n withHeaderTriggers = false,\n footer,\n ...rest\n}: CalendarProps): React.JSX.Element => {\n // Range presets (thisWeek, thisMonth) require date range mode regardless of the withDateRange prop\n const effectiveDateRange =\n withDateRange ||\n (footer?.type === 'preset' && isRangePreset(footer.value));\n\n return (\n <Box className=\"Calendar\" data-testid={dataTestId} maxW={footer ? '360px' : '340px'}>\n <DatePickerProvider withDateRange={effectiveDateRange} {...rest} standalone>\n <DatePickerHeader withTriggers={withHeaderTriggers} />\n <Divider />\n <DatePickerCalendar />\n {footer && <CalendarFooterButton footer={footer} />}\n </DatePickerProvider>\n </Box>\n );\n};\n"],"names":["PRESET_LABELS","CalendarFooterButton","footer","dataTestId","goToDate","onDateSelect","onQuickOptionSelect","useDatePickerContext","handleClick","today","date","startOfDay","start","startOfWeek","end","endOfWeek","startOfMonth","endOfMonth","label","jsx","Box","Button","SINGLE_PRESETS","isRangePreset","value","Calendar","withDateRange","withHeaderTriggers","rest","effectiveDateRange","DatePickerProvider","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":"2SAmCMA,EAAgD,CACpD,MAAO,QACP,SAAU,YACV,UAAW,YACb,EAUaC,EAAuB,CAAC,CACnC,OAAAC,EACA,CAAC,eAAgBC,EAAa,wBAChC,IAAoD,CAClD,KAAM,CAAE,SAAAC,EAAU,aAAAC,EAAc,oBAAAC,CAAA,EAAwBC,EAAAA,qBAAqB,EAEvEC,EAAc,IAAY,CAC1B,GAAAN,EAAO,OAAS,SAAU,CAC5BA,EAAO,QAAQ,EACf,MAAA,CAGI,MAAAO,MAAY,KAElB,OAAQP,EAAO,MAAO,CACpB,IAAK,QAAS,CACN,MAAAQ,EAAOC,aAAWF,CAAK,EAC7BL,EAASM,CAAI,EACbL,EAAaK,CAAI,EACjB,KAAA,CAEF,IAAK,WAAY,CACf,MAAME,EAAQC,EAAAA,YAAYJ,EAAO,CAAE,aAAc,EAAG,EAC9CK,EAAMC,EAAAA,UAAUN,EAAO,CAAE,aAAc,EAAG,EAChDL,EAASQ,CAAK,EAEdN,EAAoB,CAAE,UAAWM,EAAO,QAASE,EAAK,EACtD,KAAA,CAEF,IAAK,YAAa,CACV,MAAAF,EAAQI,eAAaP,CAAK,EAC1BK,EAAMG,aAAWR,CAAK,EAC5BL,EAASQ,CAAK,EACdN,EAAoB,CAAE,UAAWM,EAAO,QAASE,EAAK,EACtD,KAAA,CACF,CAGFZ,EAAO,UAAU,CACnB,EAEMgB,EACJhB,EAAO,OAAS,SACZA,EAAO,MACNA,EAAO,OAASF,EAAcE,EAAO,KAAK,EAG/C,OAAAiB,EAAA,kBAAA,IAACC,OAAI,cAAajB,EAAY,GAAG,6BAA6B,aAAa,KAAK,EAAG,EAAG,EAAE,OACtF,SAACgB,EAAA,kBAAA,IAAAE,EAAA,OAAA,CAAO,QAAQ,kBAAkB,KAAK,KAAK,EAAE,OAAO,QAASb,EAC3D,SAAAU,CAAA,CACH,CACF,CAAA,CAEJ,ECpGMI,EAAmC,CAAC,OAAO,EAGpCC,EAAiBC,GAC5B,CAACF,EAAe,SAASE,CAAK,ECsCnBC,EAAW,CAAC,CACvB,CAAC,eAAgBtB,EAAa,kBAC9B,cAAAuB,EAAgB,GAChB,mBAAAC,EAAqB,GACrB,OAAAzB,EACA,GAAG0B,CACL,IAAwC,CAEtC,MAAMC,EACJH,GACCxB,GAAQ,OAAS,UAAYqB,EAAcrB,EAAO,KAAK,EAE1D,+BACGkB,MAAI,CAAA,UAAU,WAAW,cAAajB,EAAY,KAAMD,EAAS,QAAU,QAC1E,kCAAC4B,EAAmB,mBAAA,CAAA,cAAeD,EAAqB,GAAGD,EAAM,WAAU,GACzE,SAAA,CAACT,EAAAA,kBAAAA,IAAAY,EAAA,iBAAA,CAAiB,aAAcJ,CAAoB,CAAA,0BACnDK,EAAQ,QAAA,EAAA,0BACRC,EAAmB,mBAAA,EAAA,EACnB/B,GAAWiB,EAAA,kBAAA,IAAAlB,EAAA,CAAqB,OAAAC,CAAgB,CAAA,CAAA,CAAA,CACnD,CACF,CAAA,CAEJ"}
@@ -1,62 +0,0 @@
1
- import { j as a } from "./jsx-runtime-C5mzlN2N.js";
2
- import { B as l } from "./index-9BerxEcw.js";
3
- import { u as k, a as m, b as h, c as p } from "./datePicker.provider-C1vLiJEb.js";
4
- import { D as b } from "./divider.component-CFOh4Nw3.js";
5
- import { B as x } from "./button.component-BO6oee_V.js";
6
- import { s as D, a as y } from "./format-dJJ72A--.js";
7
- import { s as S, e as j, a as C } from "./endOfMonth-D0kCU08_.js";
8
- const f = {
9
- today: "Today",
10
- thisWeek: "This Week",
11
- thisMonth: "This Month"
12
- }, g = ({
13
- footer: t,
14
- ["data-testid"]: c = "kibble-calendar-footer"
15
- }) => {
16
- const { goToDate: n, onDateSelect: s, onQuickOptionSelect: i } = k(), d = () => {
17
- if (t.type === "custom") {
18
- t.onClick();
19
- return;
20
- }
21
- const r = /* @__PURE__ */ new Date();
22
- switch (t.value) {
23
- case "today": {
24
- const e = y(r);
25
- n(e), s(e);
26
- break;
27
- }
28
- case "thisWeek": {
29
- const e = D(r, { weekStartsOn: 1 }), o = C(r, { weekStartsOn: 1 });
30
- n(e), i({ startDate: e, endDate: o });
31
- break;
32
- }
33
- case "thisMonth": {
34
- const e = S(r), o = j(r);
35
- n(e), i({ startDate: e, endDate: o });
36
- break;
37
- }
38
- }
39
- t.onClick?.();
40
- }, u = t.type === "custom" ? t.label : t.label ?? f[t.value];
41
- return /* @__PURE__ */ a.jsx(l, { "data-testid": c, bg: "background.secondarySubtle", borderRadius: "md", p: 2, w: "full", children: /* @__PURE__ */ a.jsx(x, { variant: "secondarySubtle", size: "md", w: "full", onClick: d, children: u }) });
42
- }, w = ["today"], O = (t) => !w.includes(t), M = ({
43
- ["data-testid"]: t = "kibble-calendar",
44
- withDateRange: c = !0,
45
- withHeaderTriggers: n = !1,
46
- footer: s,
47
- ...i
48
- }) => {
49
- const d = c || s?.type === "preset" && O(s.value);
50
- return /* @__PURE__ */ a.jsx(l, { className: "Calendar", "data-testid": t, maxW: s ? "360px" : "340px", children: /* @__PURE__ */ a.jsxs(m, { withDateRange: d, ...i, standalone: !0, children: [
51
- /* @__PURE__ */ a.jsx(h, { withTriggers: n }),
52
- /* @__PURE__ */ a.jsx(b, {}),
53
- /* @__PURE__ */ a.jsx(p, {}),
54
- s && /* @__PURE__ */ a.jsx(g, { footer: s })
55
- ] }) });
56
- };
57
- export {
58
- M as C,
59
- g as a,
60
- O as i
61
- };
62
- //# sourceMappingURL=calendar.component-Dx7c4EIy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"calendar.component-Dx7c4EIy.js","sources":["../../src/components/Calendar/calendarFooterButton.component.tsx","../../src/components/Calendar/calendar.utils.ts","../../src/components/Calendar/calendar.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Button } from 'components/Button/button.component';\nimport { useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\nimport startOfDay from 'date-fns/startOfDay';\nimport startOfWeek from 'date-fns/startOfWeek';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport endOfWeek from 'date-fns/endOfWeek';\nimport endOfMonth from 'date-fns/endOfMonth';\n\nexport type CalendarPreset = 'today' | 'thisWeek' | 'thisMonth';\n\nexport interface CalendarFooterPresetConfig {\n type: 'preset';\n /** The built-in preset to apply when the button is clicked. */\n value: CalendarPreset;\n /**\n * Override the button label.\n * Defaults: 'today' → 'Today', 'thisWeek' → 'This Week', 'thisMonth' → 'This Month'.\n */\n label?: string;\n /** Optional callback fired after the preset date is selected. */\n onClick?: () => void;\n}\n\nexport interface CalendarFooterCustomConfig {\n type: 'custom';\n /** Button label — required for custom type. */\n label: string;\n /** Handler called when the button is clicked. Full control — no date selection is performed. */\n onClick: () => void;\n}\n\nexport type CalendarFooterConfig = CalendarFooterPresetConfig | CalendarFooterCustomConfig;\n\nconst PRESET_LABELS: Record<CalendarPreset, string> = {\n today: 'Today',\n thisWeek: 'This Week',\n thisMonth: 'This Month',\n};\n\ninterface CalendarFooterButtonProps {\n footer: CalendarFooterConfig;\n /** Data test id for the footer container.\n * @default kibble-calendar-footer\n */\n 'data-testid'?: string;\n}\n\nexport const CalendarFooterButton = ({\n footer,\n ['data-testid']: dataTestId = 'kibble-calendar-footer',\n}: CalendarFooterButtonProps): React.JSX.Element => {\n const { goToDate, onDateSelect, onQuickOptionSelect } = useDatePickerContext();\n\n const handleClick = (): void => {\n if (footer.type === 'custom') {\n footer.onClick();\n return;\n }\n\n const today = new Date();\n\n switch (footer.value) {\n case 'today': {\n const date = startOfDay(today);\n goToDate(date);\n onDateSelect(date);\n break;\n }\n case 'thisWeek': {\n const start = startOfWeek(today, { weekStartsOn: 1 });\n const end = endOfWeek(today, { weekStartsOn: 1 });\n goToDate(start);\n // onQuickOptionSelect sets both dates atomically, avoiding the two-click range flow\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n case 'thisMonth': {\n const start = startOfMonth(today);\n const end = endOfMonth(today);\n goToDate(start);\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n }\n\n footer.onClick?.();\n };\n\n const label =\n footer.type === 'custom'\n ? footer.label\n : (footer.label ?? PRESET_LABELS[footer.value]);\n\n return (\n <Box data-testid={dataTestId} bg=\"background.secondarySubtle\" borderRadius=\"md\" p={2} w=\"full\">\n <Button variant=\"secondarySubtle\" size=\"md\" w=\"full\" onClick={handleClick}>\n {label}\n </Button>\n </Box>\n );\n};\n","import { CalendarPreset } from './calendarFooterButton.component';\n\nconst SINGLE_PRESETS: CalendarPreset[] = ['today'];\n\n/** Returns true when the preset requires date range selection (week, month). */\nexport const isRangePreset = (value: CalendarPreset): boolean =>\n !SINGLE_PRESETS.includes(value);\n","import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { DatePickerCalendar } from 'components/DatePicker/components/DatePickerCalendar/datePickerCalendar.component';\nimport { DatePickerHeader } from 'components/DatePicker/components/DatePickerHeader/datePickerHeader.component';\nimport { Divider } from 'components/Divider';\nimport { DatePickerProvider } from 'components/DatePicker/context/datePicker.provider';\nimport { DateProps } from 'components/DatePicker/datePicker.types';\nimport { CalendarFooterButton, CalendarFooterConfig } from './calendarFooterButton.component';\nimport { isRangePreset } from './calendar.utils';\n\nexport interface CalendarProps extends DateProps {\n /** Data test id for the calendar.\n * @default kibble-calendar\n */\n 'data-testid'?: string;\n /**\n * If true, the calendar will allow for a date range selection.\n * @default true\n */\n withDateRange?: boolean;\n /**\n * If true, the calendar will show the month and year selectors in the header.\n * @default false\n */\n withHeaderTriggers?: boolean;\n /**\n * Optional footer button configuration. Renders a styled button below the calendar grid.\n *\n * Use `type: 'preset'` for built-in shortcuts ('today' | 'thisWeek' | 'thisMonth') — the\n * component handles the date selection logic automatically.\n *\n * Use `type: 'custom'` to supply your own label and click handler with no built-in date logic.\n *\n * @example\n * // Preset\n * footer={{ type: 'preset', value: 'today', onClick: () => setOpen(false) }}\n *\n * @example\n * // Custom\n * footer={{ type: 'custom', label: 'Reset', onClick: handleReset }}\n */\n footer?: CalendarFooterConfig;\n}\n\nexport const Calendar = ({\n ['data-testid']: dataTestId = 'kibble-calendar',\n withDateRange = true,\n withHeaderTriggers = false,\n footer,\n ...rest\n}: CalendarProps): React.JSX.Element => {\n // Range presets (thisWeek, thisMonth) require date range mode regardless of the withDateRange prop\n const effectiveDateRange =\n withDateRange ||\n (footer?.type === 'preset' && isRangePreset(footer.value));\n\n return (\n <Box className=\"Calendar\" data-testid={dataTestId} maxW={footer ? '360px' : '340px'}>\n <DatePickerProvider withDateRange={effectiveDateRange} {...rest} standalone>\n <DatePickerHeader withTriggers={withHeaderTriggers} />\n <Divider />\n <DatePickerCalendar />\n {footer && <CalendarFooterButton footer={footer} />}\n </DatePickerProvider>\n </Box>\n );\n};\n"],"names":["PRESET_LABELS","CalendarFooterButton","footer","dataTestId","goToDate","onDateSelect","onQuickOptionSelect","useDatePickerContext","handleClick","today","date","startOfDay","start","startOfWeek","end","endOfWeek","startOfMonth","endOfMonth","label","jsx","Box","Button","SINGLE_PRESETS","isRangePreset","value","Calendar","withDateRange","withHeaderTriggers","rest","effectiveDateRange","DatePickerProvider","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":";;;;;;;AAmCA,MAAMA,IAAgD;AAAA,EACpD,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AACb,GAUaC,IAAuB,CAAC;AAAA,EACnC,QAAAC;AAAA,EACA,CAAC,gBAAgBC,IAAa;AAChC,MAAoD;AAClD,QAAM,EAAE,UAAAC,GAAU,cAAAC,GAAc,qBAAAC,EAAA,IAAwBC,EAAqB,GAEvEC,IAAc,MAAY;AAC1B,QAAAN,EAAO,SAAS,UAAU;AAC5B,MAAAA,EAAO,QAAQ;AACf;AAAA,IAAA;AAGI,UAAAO,wBAAY,KAAK;AAEvB,YAAQP,EAAO,OAAO;AAAA,MACpB,KAAK,SAAS;AACN,cAAAQ,IAAOC,EAAWF,CAAK;AAC7B,QAAAL,EAASM,CAAI,GACbL,EAAaK,CAAI;AACjB;AAAA,MAAA;AAAA,MAEF,KAAK,YAAY;AACf,cAAME,IAAQC,EAAYJ,GAAO,EAAE,cAAc,GAAG,GAC9CK,IAAMC,EAAUN,GAAO,EAAE,cAAc,GAAG;AAChD,QAAAL,EAASQ,CAAK,GAEdN,EAAoB,EAAE,WAAWM,GAAO,SAASE,GAAK;AACtD;AAAA,MAAA;AAAA,MAEF,KAAK,aAAa;AACV,cAAAF,IAAQI,EAAaP,CAAK,GAC1BK,IAAMG,EAAWR,CAAK;AAC5B,QAAAL,EAASQ,CAAK,GACdN,EAAoB,EAAE,WAAWM,GAAO,SAASE,GAAK;AACtD;AAAA,MAAA;AAAA,IACF;AAGF,IAAAZ,EAAO,UAAU;AAAA,EACnB,GAEMgB,IACJhB,EAAO,SAAS,WACZA,EAAO,QACNA,EAAO,SAASF,EAAcE,EAAO,KAAK;AAG/C,SAAAiB,gBAAAA,EAAA,IAACC,KAAI,eAAajB,GAAY,IAAG,8BAA6B,cAAa,MAAK,GAAG,GAAG,GAAE,QACtF,UAACgB,gBAAAA,EAAA,IAAAE,GAAA,EAAO,SAAQ,mBAAkB,MAAK,MAAK,GAAE,QAAO,SAASb,GAC3D,UAAAU,EAAA,CACH,EACF,CAAA;AAEJ,GCpGMI,IAAmC,CAAC,OAAO,GAGpCC,IAAgB,CAACC,MAC5B,CAACF,EAAe,SAASE,CAAK,GCsCnBC,IAAW,CAAC;AAAA,EACvB,CAAC,gBAAgBtB,IAAa;AAAA,EAC9B,eAAAuB,IAAgB;AAAA,EAChB,oBAAAC,IAAqB;AAAA,EACrB,QAAAzB;AAAA,EACA,GAAG0B;AACL,MAAwC;AAEtC,QAAMC,IACJH,KACCxB,GAAQ,SAAS,YAAYqB,EAAcrB,EAAO,KAAK;AAE1D,+BACGkB,GAAI,EAAA,WAAU,YAAW,eAAajB,GAAY,MAAMD,IAAS,UAAU,SAC1E,iCAAC4B,GAAmB,EAAA,eAAeD,GAAqB,GAAGD,GAAM,YAAU,IACzE,UAAA;AAAA,IAACT,gBAAAA,EAAAA,IAAAY,GAAA,EAAiB,cAAcJ,EAAoB,CAAA;AAAA,0BACnDK,GAAQ,EAAA;AAAA,0BACRC,GAAmB,EAAA;AAAA,IACnB/B,KAAWiB,gBAAAA,EAAA,IAAAlB,GAAA,EAAqB,QAAAC,EAAgB,CAAA;AAAA,EAAA,EAAA,CACnD,EACF,CAAA;AAEJ;"}
@@ -1,306 +0,0 @@
1
- import { j as a } from "./jsx-runtime-C5mzlN2N.js";
2
- import { useMemo as d, useEffect as O, useState as $ } from "react";
3
- import { B as R } from "./button.component-BO6oee_V.js";
4
- import { e as L, d as H, f as z, u as T, F as p, b as A, c as G, a as Q } from "./datePicker.provider-C1vLiJEb.js";
5
- import { u as q } from "./usePortalContentRef-DO_jc4W9.js";
6
- import { p as V } from "./popover.recipe-DPwwsWLb.js";
7
- import { a as Y, c as J, t as W, s as M, f as K } from "./format-dJJ72A--.js";
8
- import { c as j } from "./isToday-Q8lj3mkM.js";
9
- import { e as S, s as w, a as _ } from "./endOfMonth-D0kCU08_.js";
10
- import { u as U } from "./popover-root-provider-CFn2dthZ.js";
11
- import { F as v } from "./flex-CX-8gE9T.js";
12
- import { useBreakpoint as X } from "../esm/hooks/useBreakpoint/index.js";
13
- import { B as x } from "./index-9BerxEcw.js";
14
- import { W as Z } from "./text.component-DhuUgP3j.js";
15
- import { W as ee } from "./textInput.component-BeiTxTkS.js";
16
- import { T as te } from "./timePicker.component-CsvyXSRc.js";
17
- import { G as ae, a as C } from "./grid-item-BmCSQ38y.js";
18
- import { D as se } from "./divider.component-CFOh4Nw3.js";
19
- import { u as ne } from "./create-slot-recipe-context-D_FXDJGp.js";
20
- import { P as re } from "./index-DcmJgLUo.js";
21
- import { P as oe, a as ie, b as ce, c as de } from "./popover-Gb1fXSR7.js";
22
- var n = /* @__PURE__ */ ((e) => (e.Today = "Today", e.Yesterday = "Yesterday", e.ThisWeek = "ThisWeek", e.LastWeek = "LastWeek", e.ThisMonth = "ThisMonth", e.LastMonth = "LastMonth", e.Custom = "Custom", e))(n || {});
23
- const ze = ["single", "double"], le = [
24
- {
25
- label: "Today",
26
- value: n.Today
27
- },
28
- {
29
- label: "Yesterday",
30
- value: n.Yesterday
31
- },
32
- {
33
- label: "This Week",
34
- value: n.ThisWeek
35
- },
36
- {
37
- label: "Last Week",
38
- value: n.LastWeek
39
- },
40
- {
41
- label: "This Month",
42
- value: n.ThisMonth
43
- },
44
- {
45
- label: "Last Month",
46
- value: n.LastMonth
47
- },
48
- {
49
- label: "Custom",
50
- value: n.Custom,
51
- iconName: "calendarPen"
52
- }
53
- ], ue = {
54
- single: 1,
55
- double: 2
56
- };
57
- function me(e) {
58
- return Y(Date.now(), e);
59
- }
60
- function pe(e) {
61
- return L(Date.now(), e);
62
- }
63
- function he(e) {
64
- const t = j(e?.in), s = t.getFullYear(), r = t.getMonth(), o = t.getDate(), i = j(e?.in);
65
- return i.setFullYear(s, r, o - 1), i.setHours(0, 0, 0, 0), i;
66
- }
67
- function fe(e) {
68
- const t = j(e?.in), s = J(e?.in, 0);
69
- return s.setFullYear(t.getFullYear(), t.getMonth(), t.getDate() - 1), s.setHours(23, 59, 59, 999), s;
70
- }
71
- function De(e, t, s) {
72
- return H(e, t * 7, s);
73
- }
74
- function xe(e, t, s) {
75
- return De(e, -1, s);
76
- }
77
- function ke(e, t, s) {
78
- return z(e, -1, s);
79
- }
80
- function N(e, t) {
81
- return +W(e) == +W(t);
82
- }
83
- const I = (e) => {
84
- const t = /* @__PURE__ */ new Date();
85
- switch (e) {
86
- case n.Today:
87
- return {
88
- startDate: me(),
89
- endDate: pe()
90
- };
91
- case n.Yesterday:
92
- return {
93
- startDate: he(),
94
- endDate: fe()
95
- };
96
- case n.ThisWeek:
97
- return {
98
- startDate: M(t, { weekStartsOn: 1 }),
99
- endDate: _(t, { weekStartsOn: 1 })
100
- };
101
- case n.LastWeek: {
102
- const s = xe(t);
103
- return {
104
- startDate: M(s, { weekStartsOn: 1 }),
105
- endDate: _(s, { weekStartsOn: 1 })
106
- };
107
- }
108
- case n.ThisMonth:
109
- return {
110
- startDate: w(t),
111
- endDate: S(t)
112
- };
113
- case n.LastMonth: {
114
- const s = ke(t);
115
- return {
116
- startDate: w(s),
117
- endDate: S(s)
118
- };
119
- }
120
- default:
121
- return null;
122
- }
123
- }, be = (e, t) => {
124
- if (!e || !t)
125
- return n.Today;
126
- const s = [
127
- n.Today,
128
- n.Yesterday,
129
- n.ThisWeek,
130
- n.LastWeek,
131
- n.ThisMonth,
132
- n.LastMonth
133
- ];
134
- for (const r of s) {
135
- const o = I(r);
136
- if (o && N(e, o.startDate) && N(t, o.endDate))
137
- return r;
138
- }
139
- return n.Custom;
140
- }, ge = ({
141
- selectedQuickOption: e,
142
- setSelectedQuickOption: t,
143
- ["data-testid"]: s = "kibble-datetime-picker-quick-options"
144
- }) => {
145
- const { setFocusedInput: r, onQuickOptionSelect: o } = T(), { setOpen: i } = U(), u = (c) => {
146
- if (t(c), c === n.Custom) {
147
- r(p.StartDate);
148
- return;
149
- }
150
- const m = I(c);
151
- m && (o(m), i(!1));
152
- };
153
- return /* @__PURE__ */ a.jsx(v, { className: "DateTimePicker__QuickFilters", flexDirection: "column", gap: 2, w: "100%", maxW: "120px", children: le.map((c) => /* @__PURE__ */ a.jsx(
154
- R,
155
- {
156
- className: "DateTimePicker__Option",
157
- "data-testid": `${s}-option-${c.value}`,
158
- variant: "secondarySubtle",
159
- ...c.iconName && { iconName: c.iconName, iconPosition: "right" },
160
- ...e === c.value && { active: !0 },
161
- onClick: () => u(c.value),
162
- children: c.label
163
- },
164
- c.value
165
- )) });
166
- }, F = ({
167
- label: e,
168
- rangeType: t
169
- }) => {
170
- const { startDate: s, endDate: r, dateFormat: o, focusedInput: i, setFocusedInput: u, onTimeChange: c } = T(), m = d(
171
- () => (t === p.StartDate ? s : r) || /* @__PURE__ */ new Date(),
172
- [s, r, t]
173
- ), k = d(() => K(m, o), [m, o]), h = (l) => {
174
- l && c(l, t);
175
- };
176
- return /* @__PURE__ */ a.jsxs(
177
- ae,
178
- {
179
- alignItems: "center",
180
- templateColumns: "repeat(5, 1fr)",
181
- gap: 1,
182
- bgColor: "background.secondaryAlpha",
183
- borderRadius: "md",
184
- p: 1,
185
- flex: "0 0 50%",
186
- children: [
187
- /* @__PURE__ */ a.jsx(C, { colSpan: 1, children: /* @__PURE__ */ a.jsx(Z, { size: "sm", fontWeight: "semibold", textAlign: "center", children: e }) }),
188
- /* @__PURE__ */ a.jsx(C, { colSpan: 2, children: /* @__PURE__ */ a.jsx(
189
- ee,
190
- {
191
- readOnly: !0,
192
- value: k,
193
- onClick: () => u(t),
194
- ...i === t && {
195
- "data-focus": !0
196
- }
197
- }
198
- ) }),
199
- /* @__PURE__ */ a.jsx(C, { colSpan: 2, children: /* @__PURE__ */ a.jsx(
200
- te,
201
- {
202
- minuteInterval: 1,
203
- initialTime: m,
204
- onClose: (l) => h(l),
205
- inputProps: { rightElement: void 0, onClick: () => u(t) }
206
- }
207
- ) })
208
- ]
209
- }
210
- );
211
- }, Ce = ({ isSingleView: e }) => {
212
- const { focusedInput: t, setFocusedInput: s } = T();
213
- return O(() => {
214
- t || s(p.StartDate);
215
- }, [t, s]), /* @__PURE__ */ a.jsxs(x, { className: "DateTimePicker__CustomFilters", mt: -1, children: [
216
- /* @__PURE__ */ a.jsxs(
217
- v,
218
- {
219
- className: "DateTimePicker__CustomFilters__RangeSelectors",
220
- flexDirection: e ? "column" : "row",
221
- alignItems: "center",
222
- gap: 2,
223
- justifyContent: "space-between",
224
- children: [
225
- /* @__PURE__ */ a.jsx(F, { label: "Start", rangeType: p.StartDate }),
226
- /* @__PURE__ */ a.jsx(F, { label: "End", rangeType: p.EndDate })
227
- ]
228
- }
229
- ),
230
- /* @__PURE__ */ a.jsxs(x, { className: "CalendarView", bgColor: "background.secondaryAlpha", borderRadius: "md", p: 1, mt: 5, children: [
231
- /* @__PURE__ */ a.jsx(x, { className: "CalendarView__Header", bgColor: "background.accent.subtle", borderRadius: "md", children: /* @__PURE__ */ a.jsx(A, { triggerProps: { variant: "ghostNeutral" } }) }),
232
- /* @__PURE__ */ a.jsx(x, { className: "CalendarView__Body", children: /* @__PURE__ */ a.jsx(G, { showMonthLabels: !0 }) })
233
- ] })
234
- ] });
235
- }, Ae = ({
236
- trigger: e,
237
- calendarView: t = "double",
238
- portalled: s = !0,
239
- showQuickOptions: r = !0,
240
- ["data-testid"]: o = "kibble-datetime-picker",
241
- ...i
242
- }) => {
243
- const u = d(() => {
244
- const P = /* @__PURE__ */ new Date();
245
- return {
246
- startDate: Y(P),
247
- endDate: L(P)
248
- };
249
- }, []), { contentRef: c } = q(), k = ne({ recipe: V })(), h = X(), l = d(() => r ? be(i.startDate || null, i.endDate || null) : n.Custom, [r, i.startDate, i.endDate]), [f, y] = $(l);
250
- O(() => {
251
- y(l);
252
- }, [l]);
253
- const D = d(
254
- () => ["base", "sm"].includes(h) ? "single" : t,
255
- [t, h]
256
- ), B = d(() => ue[D], [D]), b = d(() => D === "single", [D]), g = d(
257
- () => f === n.Custom,
258
- [f]
259
- ), E = d(() => g ? "max-content" : "160px", [g]);
260
- return /* @__PURE__ */ a.jsxs(
261
- Q,
262
- {
263
- ...i,
264
- startDate: i.startDate || u.startDate,
265
- endDate: i.endDate || u.endDate,
266
- withDateRange: !0,
267
- numberOfMonths: B,
268
- sameWidth: !0,
269
- children: [
270
- /* @__PURE__ */ a.jsx(oe, { asChild: !0, w: "max-content", children: e || /* @__PURE__ */ a.jsx(R, { variant: "secondarySubtle", iconName: "calendarInfo", "data-testid": `${o}-default-trigger`, children: "Date/Time Range" }) }),
271
- /* @__PURE__ */ a.jsx(re, { container: c || void 0, disabled: !s, children: /* @__PURE__ */ a.jsx(ie, { className: "DateTimePicker", "data-testid": o, children: /* @__PURE__ */ a.jsx(
272
- ce,
273
- {
274
- className: "DateTimePicker__Content",
275
- "data-testid": `${o}-content`,
276
- css: {
277
- ...k.content,
278
- "--popover-size": E,
279
- maxW: r ? b ? "550px" : "890px" : b ? "390px" : "730px",
280
- ...g && { minW: r ? "550px" : "390px" }
281
- },
282
- children: /* @__PURE__ */ a.jsx(de, { css: { "--popover-padding": 0 }, children: /* @__PURE__ */ a.jsxs(v, { className: "DateTimePicker__Container", "data-testid": `${o}-container`, p: 5, children: [
283
- r && /* @__PURE__ */ a.jsx(
284
- ge,
285
- {
286
- selectedQuickOption: f,
287
- setSelectedQuickOption: y
288
- }
289
- ),
290
- f === n.Custom && /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
291
- r && /* @__PURE__ */ a.jsx(se, { orientation: "vertical", my: -5, mx: 5 }),
292
- /* @__PURE__ */ a.jsx(Ce, { isSingleView: b })
293
- ] })
294
- ] }) })
295
- }
296
- ) }) })
297
- ]
298
- }
299
- );
300
- };
301
- export {
302
- Ae as D,
303
- n as a,
304
- ze as c
305
- };
306
- //# sourceMappingURL=dateTimePicker.component-BwKD6TeU.js.map