@televet/kibble-ui 5.0.27 → 5.0.28-rb.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/calendar.component-BFSyxaB6.js +2 -0
- package/dist/chunks/calendar.component-BFSyxaB6.js.map +1 -0
- package/dist/chunks/calendar.component-CegJR9ey.js +18 -0
- package/dist/chunks/calendar.component-CegJR9ey.js.map +1 -0
- package/dist/chunks/{conversationCard.component-xIYvp6K5.js → conversationCard.component-DByFo4jj.js} +2 -2
- package/dist/chunks/{conversationCard.component-xIYvp6K5.js.map → conversationCard.component-DByFo4jj.js.map} +1 -1
- package/dist/chunks/{datePicker.component-DeK6pPeC.js → datePicker.component-CLTjEX7i.js} +3 -3
- package/dist/chunks/{datePicker.component-DeK6pPeC.js.map → datePicker.component-CLTjEX7i.js.map} +1 -1
- package/dist/chunks/{datePicker.provider-C1vLiJEb.js → datePicker.provider-CttuPiiS.js} +5 -5
- package/dist/chunks/{datePicker.provider-C1vLiJEb.js.map → datePicker.provider-CttuPiiS.js.map} +1 -1
- package/dist/chunks/dateTimePicker.component-BlWhC5aT.js +2 -0
- package/dist/chunks/dateTimePicker.component-BlWhC5aT.js.map +1 -0
- package/dist/chunks/dateTimePicker.component-CLAI_Q6e.js +317 -0
- package/dist/chunks/dateTimePicker.component-CLAI_Q6e.js.map +1 -0
- package/dist/chunks/{format-dJJ72A--.js → format-CqTHHSak.js} +3 -3
- package/dist/chunks/{format-dJJ72A--.js.map → format-CqTHHSak.js.map} +1 -1
- package/dist/chunks/isToday-iCYsPDMT.js +23 -0
- package/dist/chunks/{isToday-Q8lj3mkM.js.map → isToday-iCYsPDMT.js.map} +1 -1
- package/dist/chunks/{semanticTokens.records-Di2_gv9n.js → semanticTokens.records-C_ewkfqj.js} +9 -9
- package/dist/chunks/{semanticTokens.records-Di2_gv9n.js.map → semanticTokens.records-C_ewkfqj.js.map} +1 -1
- package/dist/chunks/{semanticTokens.records-CmeaObFQ.js → semanticTokens.records-YFGbKTL1.js} +2 -2
- package/dist/chunks/{semanticTokens.records-CmeaObFQ.js.map → semanticTokens.records-YFGbKTL1.js.map} +1 -1
- package/dist/chunks/theme-BFbOz0Jj.js.map +1 -1
- package/dist/chunks/theme-BOK659O0.js.map +1 -1
- package/dist/chunks/{theme.provider-CVSsJMOG.js → theme.provider-BeSlhtUQ.js} +2 -2
- package/dist/chunks/{theme.provider-CVSsJMOG.js.map → theme.provider-BeSlhtUQ.js.map} +1 -1
- package/dist/chunks/{theme.provider-C_F9M-W3.js → theme.provider-DYehMUhm.js} +2 -2
- package/dist/chunks/{theme.provider-C_F9M-W3.js.map → theme.provider-DYehMUhm.js.map} +1 -1
- package/dist/chunks/{timePicker.component-CsvyXSRc.js → timePicker.component-BCMX6aqb.js} +2 -2
- package/dist/chunks/{timePicker.component-CsvyXSRc.js.map → timePicker.component-BCMX6aqb.js.map} +1 -1
- package/dist/chunks/{timeRange.component-9Bs6kd18.js → timeRange.component-BZHpZeAX.js} +2 -2
- package/dist/chunks/{timeRange.component-9Bs6kd18.js.map → timeRange.component-BZHpZeAX.js.map} +1 -1
- package/dist/chunks/{timestamp.component-DiZwy6CA.js → timestamp.component-DkLjxUsy.js} +3 -3
- package/dist/chunks/{timestamp.component-DiZwy6CA.js.map → timestamp.component-DkLjxUsy.js.map} +1 -1
- package/dist/cjs/components/Calendar/index.cjs +1 -1
- package/dist/cjs/components/DateTimePicker/index.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/theme/index.cjs +1 -1
- package/dist/cjs/theme/semanticTokens/index.cjs +1 -1
- package/dist/cjs/theme/semanticTokens/index.cjs.map +1 -1
- package/dist/esm/components/Calendar/index.js +2 -4
- 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/TimePicker/index.js +1 -1
- package/dist/esm/components/TimeRange/index.js +1 -1
- package/dist/esm/components/Timestamp/index.js +1 -1
- package/dist/esm/components/index.js +122 -124
- package/dist/esm/index.js +151 -153
- package/dist/esm/theme/index.js +1 -1
- package/dist/esm/theme/semanticTokens/index.js +15 -39
- package/dist/esm/theme/semanticTokens/index.js.map +1 -1
- package/dist/types/components/Calendar/calendar.component.d.ts +1 -19
- package/dist/types/components/Calendar/index.d.ts +0 -2
- package/dist/types/components/Heading/heading.recipe.d.ts +1 -1
- package/dist/types/components/Link/link.recipe.d.ts +1 -1
- package/dist/types/components/Modal/modal.recipe.d.ts +1 -1
- package/dist/types/components/Text/text.recipe.d.ts +1 -1
- package/dist/types/shared/types/theme.d.ts +1 -1
- package/dist/types/theme/semanticTokens/semanticTokens.config.d.ts +37 -37
- package/dist/types/theme/tokens/colors/colors.config.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/calendar.component-CFBrrBSJ.js +0 -2
- package/dist/chunks/calendar.component-CFBrrBSJ.js.map +0 -1
- package/dist/chunks/calendar.component-Dz_YhuJT.js +0 -62
- package/dist/chunks/calendar.component-Dz_YhuJT.js.map +0 -1
- package/dist/chunks/dateTimePicker.component-BwKD6TeU.js +0 -306
- package/dist/chunks/dateTimePicker.component-BwKD6TeU.js.map +0 -1
- package/dist/chunks/dateTimePicker.component-C7SFD9Py.js +0 -2
- package/dist/chunks/dateTimePicker.component-C7SFD9Py.js.map +0 -1
- package/dist/chunks/endOfMonth-ClO3w4vF.js +0 -2
- package/dist/chunks/endOfMonth-ClO3w4vF.js.map +0 -1
- package/dist/chunks/endOfMonth-D0kCU08_.js +0 -19
- package/dist/chunks/endOfMonth-D0kCU08_.js.map +0 -1
- package/dist/chunks/isToday-Q8lj3mkM.js +0 -23
- package/dist/types/components/Calendar/calendar.utils.d.ts +0 -3
- package/dist/types/components/Calendar/calendarFooterButton.component.d.ts +0 -41
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const k = [
|
|
1
|
+
import { c, i as d, d as s, b, e as u, a as g, s as k } from "../../../chunks/semanticTokens.records-C_ewkfqj.js";
|
|
2
|
+
const r = [
|
|
4
3
|
"text",
|
|
5
4
|
"text.accent",
|
|
6
5
|
"text.accentSubtle",
|
|
@@ -23,7 +22,7 @@ const k = [
|
|
|
23
22
|
"text.subtle.contrast",
|
|
24
23
|
"text.success",
|
|
25
24
|
"text.warning"
|
|
26
|
-
],
|
|
25
|
+
], a = [
|
|
27
26
|
"background.accent",
|
|
28
27
|
"background.accentSubtle",
|
|
29
28
|
"background.ai",
|
|
@@ -90,7 +89,7 @@ const k = [
|
|
|
90
89
|
"background.success.contrast",
|
|
91
90
|
"background.warning",
|
|
92
91
|
"background.warning.contrast"
|
|
93
|
-
],
|
|
92
|
+
], o = ["divider", "divider.default"], e = [
|
|
94
93
|
"border",
|
|
95
94
|
"border.accent",
|
|
96
95
|
"border.accentSubtle",
|
|
@@ -109,40 +108,17 @@ const k = [
|
|
|
109
108
|
"border.success",
|
|
110
109
|
"border.warning"
|
|
111
110
|
];
|
|
112
|
-
function o(r, t) {
|
|
113
|
-
if (r !== null && typeof r == "object" && "value" in r && typeof r.value == "object" && r.value !== null && t in r.value)
|
|
114
|
-
return r.value[t];
|
|
115
|
-
if (r !== null && typeof r == "object") {
|
|
116
|
-
const e = {};
|
|
117
|
-
for (const [a, n] of Object.entries(r))
|
|
118
|
-
e[a === "DEFAULT" ? "default" : a] = o(n, t);
|
|
119
|
-
return e;
|
|
120
|
-
}
|
|
121
|
-
return r;
|
|
122
|
-
}
|
|
123
|
-
const c = /* @__PURE__ */ new Map(), h = (r) => {
|
|
124
|
-
const t = c.get(r);
|
|
125
|
-
if (t) return t;
|
|
126
|
-
const e = r === "light" ? "_light" : "_dark", a = {
|
|
127
|
-
background: o(b, e),
|
|
128
|
-
text: o(u, e),
|
|
129
|
-
border: o(d, e),
|
|
130
|
-
divider: o(s, e)
|
|
131
|
-
};
|
|
132
|
-
return c.set(r, a), a;
|
|
133
|
-
};
|
|
134
111
|
export {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
k as semanticTypographyTokens
|
|
112
|
+
c as colorSchemeToCoreColorMap,
|
|
113
|
+
d as invertToken,
|
|
114
|
+
s as semanticBackgroundColorTokens,
|
|
115
|
+
a as semanticBackgroundTokens,
|
|
116
|
+
b as semanticBorderColorTokens,
|
|
117
|
+
e as semanticBorderTokens,
|
|
118
|
+
u as semanticColorTokenRecord,
|
|
119
|
+
g as semanticDividerColorTokens,
|
|
120
|
+
o as semanticDividerTokens,
|
|
121
|
+
k as semanticTextColorTokens,
|
|
122
|
+
r as semanticTypographyTokens
|
|
147
123
|
};
|
|
148
124
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../packages/kibble-primitives/src/semantic/semanticTokens.types.ts"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../packages/kibble-primitives/src/semantic/semanticTokens.types.ts"],"sourcesContent":["export type SemanticProperty = 'text' | 'background' | 'border' | 'divider';\n\nexport type SemanticColorScheme =\n | 'primary'\n | 'secondary'\n | 'danger'\n | 'warning'\n | 'success'\n | 'neutral'\n | 'primaryAlpha'\n | 'secondaryAlpha'\n | 'dangerAlpha'\n | 'neutralAlpha'\n | 'gradientFull'\n | 'gradientPink'\n | 'gradientGreen';\n\nexport type SemanticTokenDefinition = {\n value: {\n _light: string | number;\n _dark: string | number;\n };\n};\n\nexport const semanticTypographyTokens = [\n 'text',\n 'text.accent',\n 'text.accentSubtle',\n 'text.brand',\n 'text.brand.contrast',\n 'text.brand.contrast.hover',\n 'text.brand.hover',\n 'text.contrast',\n 'text.danger',\n 'text.danger.contrast',\n 'text.default',\n 'text.info',\n 'text.interactive',\n 'text.interactive.contrast',\n 'text.interactive.contrast.hover',\n 'text.interactive.hover',\n 'text.placeholder',\n 'text.placeholder.contrast',\n 'text.subtle',\n 'text.subtle.contrast',\n 'text.success',\n 'text.warning',\n] as const;\nexport type SemanticTypographyToken = (typeof semanticTypographyTokens)[number];\n\nexport const semanticBackgroundTokens = [\n 'background.accent',\n 'background.accentSubtle',\n 'background.ai',\n 'background.ai.hover',\n 'background.ai.pressed',\n 'background.alpha',\n 'background.alpha.contrast',\n 'background.alpha.contrast.hover',\n 'background.alpha.contrast.pressed',\n 'background.alpha.hover',\n 'background.alpha.pressed',\n 'background.backdrop',\n 'background.brand',\n 'background.contrast',\n 'background.danger',\n 'background.danger.contrast',\n 'background.default',\n 'background.destructive',\n 'background.destructive.hover',\n 'background.destructive.pressed',\n 'background.destructive.contrast',\n 'background.destructive.contrast.hover',\n 'background.destructive.contrast.pressed',\n 'background.destructiveAlpha',\n 'background.destructiveAlpha.contrast',\n 'background.destructiveAlpha.contrast.hover',\n 'background.destructiveAlpha.contrast.pressed',\n 'background.destructiveAlpha.hover',\n 'background.destructiveAlpha.pressed',\n 'background.info',\n 'background.note',\n 'background.note.hover',\n 'background.overlay',\n 'background.primary',\n 'background.primary.contrast',\n 'background.primary.contrast.hover',\n 'background.primary.contrast.pressed',\n 'background.primary.hover',\n 'background.primary.pressed',\n 'background.primaryAlpha',\n 'background.primaryAlpha.contrast',\n 'background.primaryAlpha.contrast.hover',\n 'background.primaryAlpha.contrast.pressed',\n 'background.primaryAlpha.hover',\n 'background.primaryAlpha.pressed',\n 'background.secondary',\n 'background.secondary.contrast',\n 'background.secondary.contrast.hover',\n 'background.secondary.contrast.pressed',\n 'background.secondary.hover',\n 'background.secondary.pressed',\n 'background.secondaryAlpha',\n 'background.secondaryAlpha.contrast',\n 'background.secondaryAlpha.contrast.hover',\n 'background.secondaryAlpha.contrast.pressed',\n 'background.secondaryAlpha.hover',\n 'background.secondaryAlpha.pressed',\n 'background.subtle',\n 'background.contrast.subtle',\n 'background.subtle.less',\n 'background.contrast.moreSubtle',\n 'background.contrast.mostSubtle',\n 'background.success',\n 'background.success.contrast',\n 'background.warning',\n 'background.warning.contrast',\n] as const;\nexport type SemanticBackgroundColorToken = (typeof semanticBackgroundTokens)[number];\n\nexport const semanticDividerTokens = ['divider', 'divider.default'] as const;\nexport type SemanticDividerColorToken = (typeof semanticDividerTokens)[number];\n\nexport const semanticBorderTokens = [\n 'border',\n 'border.accent',\n 'border.accentSubtle',\n 'border.brand',\n 'border.contrast',\n 'border.danger',\n 'border.danger.contrast',\n 'border.default',\n 'border.focus',\n 'border.focus.contrast',\n 'border.info',\n 'border.strong',\n 'border.strong.contrast',\n 'border.subtle',\n 'border.contrast.subtle',\n 'border.success',\n 'border.warning',\n] as const;\nexport type SemanticBorderColorToken = (typeof semanticBorderTokens)[number];\n\nexport type KibbleSemanticColorToken =\n | SemanticBackgroundColorToken\n | SemanticBorderColorToken\n | SemanticDividerColorToken\n | SemanticTypographyToken;\n"],"names":["semanticTypographyTokens","semanticBackgroundTokens","semanticDividerTokens","semanticBorderTokens"],"mappings":";AAwBO,MAAMA,IAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAGaC,IAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAGaC,IAAwB,CAAC,WAAW,iBAAiB,GAGrDC,IAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { DateProps } from '../DatePicker/datePicker.types';
|
|
3
|
-
import { CalendarFooterConfig } from './calendarFooterButton.component';
|
|
4
3
|
export interface CalendarProps extends DateProps {
|
|
5
4
|
/** Data test id for the calendar.
|
|
6
5
|
* @default kibble-calendar
|
|
@@ -16,22 +15,5 @@ export interface CalendarProps extends DateProps {
|
|
|
16
15
|
* @default false
|
|
17
16
|
*/
|
|
18
17
|
withHeaderTriggers?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Optional footer button configuration. Renders a styled button below the calendar grid.
|
|
21
|
-
*
|
|
22
|
-
* Use `type: 'preset'` for built-in shortcuts ('today' | 'thisWeek' | 'thisMonth') — the
|
|
23
|
-
* component handles the date selection logic automatically.
|
|
24
|
-
*
|
|
25
|
-
* Use `type: 'custom'` to supply your own label and click handler with no built-in date logic.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* // Preset
|
|
29
|
-
* footer={{ type: 'preset', value: 'today', onClick: () => setOpen(false) }}
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* // Custom
|
|
33
|
-
* footer={{ type: 'custom', label: 'Reset', onClick: handleReset }}
|
|
34
|
-
*/
|
|
35
|
-
footer?: CalendarFooterConfig;
|
|
36
18
|
}
|
|
37
|
-
export declare const Calendar: ({ ["data-testid"]: dataTestId, withDateRange, withHeaderTriggers,
|
|
19
|
+
export declare const Calendar: ({ ["data-testid"]: dataTestId, withDateRange, withHeaderTriggers, ...rest }: CalendarProps) => React.JSX.Element;
|
|
@@ -3,5 +3,5 @@ import { HeadingSize } from './heading.types';
|
|
|
3
3
|
export declare const headingRecipe: import('@chakra-ui/react').RecipeDefinition<{
|
|
4
4
|
variant: Record<"accent" | "accentSubtle" | "brand" | "brandOnContrast" | "danger" | "dangerOnContrast" | "default" | "info" | "interactive" | "interactiveOnContrast" | "onContrast" | "placeholder" | "placeholderOnContrast" | "subtle" | "subtleOnContrast" | "success" | "warning", SystemStyleObject>;
|
|
5
5
|
size: Record<HeadingSize, SystemStyleObject>;
|
|
6
|
-
fontWeight: Record<import('../../../packages/kibble-primitives/src/index.ts').FontWeight, SystemStyleObject>;
|
|
6
|
+
fontWeight: Record<import('../../../packages/kibble-primitives/src/core/typography/index.ts').FontWeight, SystemStyleObject>;
|
|
7
7
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const linkRecipe: import('@chakra-ui/react').RecipeDefinition<{
|
|
2
2
|
variant: Record<"accent" | "accentSubtle" | "brand" | "brandOnContrast" | "danger" | "dangerOnContrast" | "default" | "info" | "interactive" | "interactiveOnContrast" | "onContrast" | "placeholder" | "placeholderOnContrast" | "subtle" | "subtleOnContrast" | "success" | "warning", import('@chakra-ui/react').SystemStyleObject>;
|
|
3
3
|
size: Record<import('..').TextSize, import('@chakra-ui/react').SystemStyleObject>;
|
|
4
|
-
fontWeight: Record<import('../../../packages/kibble-primitives/src/index.ts').FontWeight, import('@chakra-ui/react').SystemStyleObject>;
|
|
4
|
+
fontWeight: Record<import('../../../packages/kibble-primitives/src/core/typography/index.ts').FontWeight, import('@chakra-ui/react').SystemStyleObject>;
|
|
5
5
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const modalRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"body" | "content" | "trigger" | "positioner" | "description" | "footer" | "header" | "title" | "
|
|
1
|
+
export declare const modalRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"body" | "content" | "trigger" | "positioner" | "description" | "footer" | "header" | "title" | "closeTrigger" | "backdrop", {
|
|
2
2
|
expanded: {
|
|
3
3
|
true: {
|
|
4
4
|
backdrop: {
|
|
@@ -4,5 +4,5 @@ export declare const textSizeStyles: Record<TextSize, SystemStyleObject>;
|
|
|
4
4
|
export declare const textRecipe: import('@chakra-ui/react').RecipeDefinition<{
|
|
5
5
|
variant: Record<"accent" | "accentSubtle" | "brand" | "brandOnContrast" | "danger" | "dangerOnContrast" | "default" | "info" | "interactive" | "interactiveOnContrast" | "onContrast" | "placeholder" | "placeholderOnContrast" | "subtle" | "subtleOnContrast" | "success" | "warning", SystemStyleObject>;
|
|
6
6
|
size: Record<TextSize, SystemStyleObject>;
|
|
7
|
-
fontWeight: Record<import('../../../packages/kibble-primitives/src/index.ts').FontWeight, SystemStyleObject>;
|
|
7
|
+
fontWeight: Record<import('../../../packages/kibble-primitives/src/core/typography/index.ts').FontWeight, SystemStyleObject>;
|
|
8
8
|
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type ColorMode = 'light' | 'dark';
|
|
2
2
|
export declare const colorModeThemeKey = "kibble-theme";
|
|
@@ -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/index.ts').SemanticTokenDefinition;
|
|
15
|
-
hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
16
|
-
pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
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;
|
|
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/index.ts').SemanticTokenDefinition;
|
|
25
|
-
hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
26
|
-
pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
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;
|
|
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/index.ts').SemanticTokenDefinition;
|
|
69
|
-
hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
70
|
-
pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
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;
|
|
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/index.ts').SemanticTokenDefinition;
|
|
79
|
-
hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
80
|
-
pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
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;
|
|
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/index.ts').SemanticTokenDefinition;
|
|
89
|
-
hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
90
|
-
pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
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;
|
|
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/index.ts').SemanticTokenDefinition;
|
|
99
|
-
hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
100
|
-
pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
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;
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
103
|
overlay: {
|
|
104
104
|
DEFAULT: any;
|
|
105
|
-
contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
105
|
+
contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
|
|
106
106
|
};
|
|
107
107
|
backdrop: any;
|
|
108
108
|
contrast: {
|
|
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;
|
|
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;
|
|
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/index.ts').SemanticTokenDefinition;
|
|
120
|
-
hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
121
|
-
pressed: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
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;
|
|
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/index.ts').SemanticTokenDefinition;
|
|
137
|
+
contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
|
|
138
138
|
};
|
|
139
139
|
focus: {
|
|
140
140
|
DEFAULT: any;
|
|
141
|
-
contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
141
|
+
contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
|
|
142
142
|
};
|
|
143
143
|
brand: {
|
|
144
144
|
DEFAULT: any;
|
|
145
|
-
contrast: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
145
|
+
contrast: import('../../../packages/kibble-primitives/src/semantic/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/index.ts').SemanticTokenDefinition;
|
|
159
|
-
'contrast.subtle': import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
158
|
+
contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
|
|
159
|
+
'contrast.subtle': import('../../../packages/kibble-primitives/src/semantic/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/index.ts').SemanticTokenDefinition;
|
|
170
|
+
contrast: import('../../../packages/kibble-primitives/src/semantic/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/index.ts').SemanticTokenDefinition;
|
|
177
|
-
hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
176
|
+
DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
|
|
177
|
+
hover: import('../../../packages/kibble-primitives/src/semantic/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/index.ts').SemanticTokenDefinition;
|
|
185
|
-
hover: import('../../../packages/kibble-primitives/src/index.ts').SemanticTokenDefinition;
|
|
184
|
+
DEFAULT: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
|
|
185
|
+
hover: import('../../../packages/kibble-primitives/src/semantic/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/index.ts').SemanticTokenDefinition;
|
|
199
|
+
contrast: import('../../../packages/kibble-primitives/src/semantic/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/index.ts').SemanticTokenDefinition;
|
|
205
|
+
contrast: import('../../../packages/kibble-primitives/src/semantic/index.ts').SemanticTokenDefinition;
|
|
206
206
|
};
|
|
207
207
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const colorTokens: Record<import('../../../../packages/kibble-primitives/src/index.ts').CoreColor, Record<import('../../../../packages/kibble-primitives/src/index.ts').ColorValue, {
|
|
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, {
|
|
2
2
|
value: string;
|
|
3
3
|
}>>;
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("./jsx-runtime-BjDatQAs.js"),h=require("./index-BQRnVsAg.js"),o=require("./datePicker.provider-i35-VNAb.js"),D=require("./divider.component-BX3zyB7O.js"),b=require("./button.component-DjdgBXDC.js"),x=require("./format-CK7Imh-5.js"),u=require("./endOfMonth-ClO3w4vF.js"),E={today:"Today",thisWeek:"This Week",thisMonth:"This Month"},k=({footer:e,["data-testid"]:d="kibble-calendar-footer"})=>{const{goToDate:a,onDateSelect:n,onQuickOptionSelect:i,firstDayOfWeek:l}=o.useDatePickerContext(),m=()=>{if(e.type==="custom"){e.onClick();return}const r=new Date;switch(e.value){case"today":{const t=x.startOfDay(r);a(t),n(t);break}case"thisWeek":{const t=l??1,c=x.startOfWeek(r,{weekStartsOn:t}),R=u.endOfWeek(r,{weekStartsOn:t});a(c),i({startDate:c,endDate:R});break}case"thisMonth":{const t=u.startOfMonth(r),c=u.endOfMonth(r);a(t),i({startDate:t,endDate:c});break}}e.onClick?.()},j=e.type==="custom"?e.label:e.label??E[e.value];return s.jsxRuntimeExports.jsx(h.Box,{"data-testid":d,bg:"background.secondaryAlpha",borderRadius:"md",p:2,w:"full",children:s.jsxRuntimeExports.jsx(b.Button,{variant:"secondarySubtle",size:"md",w:"full",onClick:m,children:j})})},y=new Set(["thisWeek","thisMonth"]),p=e=>y.has(e),C=({["data-testid"]:e="kibble-calendar",withDateRange:d=!0,withHeaderTriggers:a=!1,footer:n,...i})=>{const l=d||n?.type==="preset"&&p(n.value);return s.jsxRuntimeExports.jsx(h.Box,{className:"Calendar","data-testid":e,maxW:n?"360px":"340px",children:s.jsxRuntimeExports.jsxs(o.DatePickerProvider,{withDateRange:l,...i,standalone:!0,children:[s.jsxRuntimeExports.jsx(o.DatePickerHeader,{withTriggers:a}),s.jsxRuntimeExports.jsx(D.Divider,{}),s.jsxRuntimeExports.jsx(o.DatePickerCalendar,{}),n&&s.jsxRuntimeExports.jsx(k,{footer:n})]})})};exports.Calendar=C;exports.CalendarFooterButton=k;exports.isRangePreset=p;
|
|
2
|
-
//# sourceMappingURL=calendar.component-CFBrrBSJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.component-CFBrrBSJ.js","sources":["../../src/components/Calendar/calendarFooterButton.component.tsx","../../src/components/Calendar/calendar.utils.ts","../../src/components/Calendar/calendar.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Button } from 'components/Button/button.component';\nimport { useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\nimport startOfDay from 'date-fns/startOfDay';\nimport startOfWeek from 'date-fns/startOfWeek';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport endOfWeek from 'date-fns/endOfWeek';\nimport endOfMonth from 'date-fns/endOfMonth';\n\n/**\n * The built-in preset values for CalendarFooterButton.\n *\n * Intentionally kept as plain string literals rather than re-using\n * DateTimePickerDefaultOptionValue to avoid a duplicate star-export conflict:\n * both Calendar and DateTimePicker barrel-export from components/index.ts,\n * and TypeScript silently drops ambiguous re-exports when two barrels supply\n * the same identifier. Keeping CalendarPreset self-contained prevents that\n * collision and makes the Calendar API standalone.\n */\nexport type CalendarPreset = 'today' | 'thisWeek' | 'thisMonth';\n\nexport interface CalendarFooterPresetConfig {\n type: 'preset';\n /** The built-in preset to apply when the button is clicked. */\n value: CalendarPreset;\n /**\n * Override the button label.\n * Defaults: 'today' → 'Today', 'thisWeek' → 'This Week', 'thisMonth' → 'This Month'.\n */\n label?: string;\n /** Optional callback fired after the preset date is selected. */\n onClick?: () => void;\n}\n\nexport interface CalendarFooterCustomConfig {\n type: 'custom';\n /** Button label — required for custom type. */\n label: string;\n /** Handler called when the button is clicked. Full control — no date selection is performed. */\n onClick: () => void;\n}\n\nexport type CalendarFooterConfig = CalendarFooterPresetConfig | CalendarFooterCustomConfig;\n\nconst PRESET_LABELS: Record<CalendarPreset, string> = {\n today: 'Today',\n thisWeek: 'This Week',\n thisMonth: 'This Month',\n};\n\ninterface CalendarFooterButtonProps {\n footer: CalendarFooterConfig;\n /** Data test id for the footer container.\n * @default kibble-calendar-footer\n */\n 'data-testid'?: string;\n}\n\nexport const CalendarFooterButton = ({\n footer,\n ['data-testid']: dataTestId = 'kibble-calendar-footer',\n}: CalendarFooterButtonProps): React.JSX.Element => {\n const { goToDate, onDateSelect, onQuickOptionSelect, firstDayOfWeek } = useDatePickerContext();\n\n const handleClick = (): void => {\n if (footer.type === 'custom') {\n footer.onClick();\n return;\n }\n\n const today = new Date();\n\n switch (footer.value) {\n case 'today': {\n const date = startOfDay(today);\n goToDate(date);\n onDateSelect(date);\n break;\n }\n case 'thisWeek': {\n const weekStartsOn = (firstDayOfWeek ?? 1) as 0 | 1 | 2 | 3 | 4 | 5 | 6;\n const start = startOfWeek(today, { weekStartsOn });\n const end = endOfWeek(today, { weekStartsOn });\n goToDate(start);\n // onQuickOptionSelect sets both dates atomically, avoiding the two-click range flow\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n case 'thisMonth': {\n const start = startOfMonth(today);\n const end = endOfMonth(today);\n goToDate(start);\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n }\n\n footer.onClick?.();\n };\n\n const label = footer.type === 'custom' ? footer.label : (footer.label ?? PRESET_LABELS[footer.value]);\n\n return (\n <Box data-testid={dataTestId} bg=\"background.secondaryAlpha\" borderRadius=\"md\" p={2} w=\"full\">\n <Button variant=\"secondarySubtle\" size=\"md\" w=\"full\" onClick={handleClick}>\n {label}\n </Button>\n </Box>\n );\n};\n","import { CalendarPreset } from './calendarFooterButton.component';\n\n// Explicit allowlist — new presets default to single-day unless listed here\nconst RANGE_PRESETS = new Set<CalendarPreset>(['thisWeek', 'thisMonth']);\n\n/** Returns true when the preset requires date range selection (week, month). */\nexport const isRangePreset = (value: CalendarPreset): boolean => RANGE_PRESETS.has(value);\n","import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { DatePickerCalendar } from 'components/DatePicker/components/DatePickerCalendar/datePickerCalendar.component';\nimport { DatePickerHeader } from 'components/DatePicker/components/DatePickerHeader/datePickerHeader.component';\nimport { Divider } from 'components/Divider';\nimport { DatePickerProvider } from 'components/DatePicker/context/datePicker.provider';\nimport { DateProps } from 'components/DatePicker/datePicker.types';\nimport { CalendarFooterButton, CalendarFooterConfig } from './calendarFooterButton.component';\nimport { isRangePreset } from './calendar.utils';\n\nexport interface CalendarProps extends DateProps {\n /** Data test id for the calendar.\n * @default kibble-calendar\n */\n 'data-testid'?: string;\n /**\n * If true, the calendar will allow for a date range selection.\n * @default true\n */\n withDateRange?: boolean;\n /**\n * If true, the calendar will show the month and year selectors in the header.\n * @default false\n */\n withHeaderTriggers?: boolean;\n /**\n * Optional footer button configuration. Renders a styled button below the calendar grid.\n *\n * Use `type: 'preset'` for built-in shortcuts ('today' | 'thisWeek' | 'thisMonth') — the\n * component handles the date selection logic automatically.\n *\n * Use `type: 'custom'` to supply your own label and click handler with no built-in date logic.\n *\n * @example\n * // Preset\n * footer={{ type: 'preset', value: 'today', onClick: () => setOpen(false) }}\n *\n * @example\n * // Custom\n * footer={{ type: 'custom', label: 'Reset', onClick: handleReset }}\n */\n footer?: CalendarFooterConfig;\n}\n\nexport const Calendar = ({\n ['data-testid']: dataTestId = 'kibble-calendar',\n withDateRange = true,\n withHeaderTriggers = false,\n footer,\n ...rest\n}: CalendarProps): React.JSX.Element => {\n // Range presets (thisWeek, thisMonth) require date range mode regardless of the withDateRange prop\n const effectiveDateRange = withDateRange || (footer?.type === 'preset' && isRangePreset(footer.value));\n\n return (\n <Box className=\"Calendar\" data-testid={dataTestId} maxW={footer ? '360px' : '340px'}>\n <DatePickerProvider withDateRange={effectiveDateRange} {...rest} standalone>\n <DatePickerHeader withTriggers={withHeaderTriggers} />\n <Divider />\n <DatePickerCalendar />\n {footer && <CalendarFooterButton footer={footer} />}\n </DatePickerProvider>\n </Box>\n );\n};\n"],"names":["PRESET_LABELS","CalendarFooterButton","footer","dataTestId","goToDate","onDateSelect","onQuickOptionSelect","firstDayOfWeek","useDatePickerContext","handleClick","today","date","startOfDay","weekStartsOn","start","startOfWeek","end","endOfWeek","startOfMonth","endOfMonth","label","jsx","Box","Button","RANGE_PRESETS","isRangePreset","value","Calendar","withDateRange","withHeaderTriggers","rest","effectiveDateRange","DatePickerProvider","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":"2SA6CMA,EAAgD,CACpD,MAAO,QACP,SAAU,YACV,UAAW,YACb,EAUaC,EAAuB,CAAC,CACnC,OAAAC,EACA,CAAC,eAAgBC,EAAa,wBAChC,IAAoD,CAClD,KAAM,CAAE,SAAAC,EAAU,aAAAC,EAAc,oBAAAC,EAAqB,eAAAC,CAAA,EAAmBC,EAAAA,qBAAqB,EAEvFC,EAAc,IAAY,CAC1B,GAAAP,EAAO,OAAS,SAAU,CAC5BA,EAAO,QAAQ,EACf,MAAA,CAGI,MAAAQ,MAAY,KAElB,OAAQR,EAAO,MAAO,CACpB,IAAK,QAAS,CACN,MAAAS,EAAOC,aAAWF,CAAK,EAC7BN,EAASO,CAAI,EACbN,EAAaM,CAAI,EACjB,KAAA,CAEF,IAAK,WAAY,CACf,MAAME,EAAgBN,GAAkB,EAClCO,EAAQC,EAAA,YAAYL,EAAO,CAAE,aAAAG,EAAc,EAC3CG,EAAMC,EAAA,UAAUP,EAAO,CAAE,aAAAG,EAAc,EAC7CT,EAASU,CAAK,EAEdR,EAAoB,CAAE,UAAWQ,EAAO,QAASE,EAAK,EACtD,KAAA,CAEF,IAAK,YAAa,CACV,MAAAF,EAAQI,eAAaR,CAAK,EAC1BM,EAAMG,aAAWT,CAAK,EAC5BN,EAASU,CAAK,EACdR,EAAoB,CAAE,UAAWQ,EAAO,QAASE,EAAK,EACtD,KAAA,CACF,CAGFd,EAAO,UAAU,CACnB,EAEMkB,EAAQlB,EAAO,OAAS,SAAWA,EAAO,MAASA,EAAO,OAASF,EAAcE,EAAO,KAAK,EAGjG,OAAAmB,EAAA,kBAAA,IAACC,OAAI,cAAanB,EAAY,GAAG,4BAA4B,aAAa,KAAK,EAAG,EAAG,EAAE,OACrF,SAACkB,EAAA,kBAAA,IAAAE,EAAA,OAAA,CAAO,QAAQ,kBAAkB,KAAK,KAAK,EAAE,OAAO,QAASd,EAC3D,SAAAW,CAAA,CACH,CACF,CAAA,CAEJ,EC3GMI,EAAoB,IAAA,IAAoB,CAAC,WAAY,WAAW,CAAC,EAG1DC,EAAiBC,GAAmCF,EAAc,IAAIE,CAAK,ECsC3EC,EAAW,CAAC,CACvB,CAAC,eAAgBxB,EAAa,kBAC9B,cAAAyB,EAAgB,GAChB,mBAAAC,EAAqB,GACrB,OAAA3B,EACA,GAAG4B,CACL,IAAwC,CAEtC,MAAMC,EAAqBH,GAAkB1B,GAAQ,OAAS,UAAYuB,EAAcvB,EAAO,KAAK,EAEpG,+BACGoB,MAAI,CAAA,UAAU,WAAW,cAAanB,EAAY,KAAMD,EAAS,QAAU,QAC1E,kCAAC8B,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,EACnBjC,GAAWmB,EAAA,kBAAA,IAAApB,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, a as p, b as D, c as x } from "./datePicker.provider-C1vLiJEb.js";
|
|
4
|
-
import { D as b } from "./divider.component-CFOh4Nw3.js";
|
|
5
|
-
import { B as y } from "./button.component-BO6oee_V.js";
|
|
6
|
-
import { s as f, a as j } from "./format-dJJ72A--.js";
|
|
7
|
-
import { s as C, e as S, a as g } from "./endOfMonth-D0kCU08_.js";
|
|
8
|
-
const w = {
|
|
9
|
-
today: "Today",
|
|
10
|
-
thisWeek: "This Week",
|
|
11
|
-
thisMonth: "This Month"
|
|
12
|
-
}, O = ({
|
|
13
|
-
footer: t,
|
|
14
|
-
["data-testid"]: o = "kibble-calendar-footer"
|
|
15
|
-
}) => {
|
|
16
|
-
const { goToDate: n, onDateSelect: s, onQuickOptionSelect: i, firstDayOfWeek: d } = u(), h = () => {
|
|
17
|
-
if (t.type === "custom") {
|
|
18
|
-
t.onClick();
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const r = /* @__PURE__ */ new Date();
|
|
22
|
-
switch (t.value) {
|
|
23
|
-
case "today": {
|
|
24
|
-
const e = j(r);
|
|
25
|
-
n(e), s(e);
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
case "thisWeek": {
|
|
29
|
-
const e = d ?? 1, c = f(r, { weekStartsOn: e }), m = g(r, { weekStartsOn: e });
|
|
30
|
-
n(c), i({ startDate: c, endDate: m });
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
case "thisMonth": {
|
|
34
|
-
const e = C(r), c = S(r);
|
|
35
|
-
n(e), i({ startDate: e, endDate: c });
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
t.onClick?.();
|
|
40
|
-
}, k = t.type === "custom" ? t.label : t.label ?? w[t.value];
|
|
41
|
-
return /* @__PURE__ */ a.jsx(l, { "data-testid": o, bg: "background.secondaryAlpha", borderRadius: "md", p: 2, w: "full", children: /* @__PURE__ */ a.jsx(y, { variant: "secondarySubtle", size: "md", w: "full", onClick: h, children: k }) });
|
|
42
|
-
}, P = /* @__PURE__ */ new Set(["thisWeek", "thisMonth"]), R = (t) => P.has(t), L = ({
|
|
43
|
-
["data-testid"]: t = "kibble-calendar",
|
|
44
|
-
withDateRange: o = !0,
|
|
45
|
-
withHeaderTriggers: n = !1,
|
|
46
|
-
footer: s,
|
|
47
|
-
...i
|
|
48
|
-
}) => {
|
|
49
|
-
const d = o || s?.type === "preset" && R(s.value);
|
|
50
|
-
return /* @__PURE__ */ a.jsx(l, { className: "Calendar", "data-testid": t, maxW: s ? "360px" : "340px", children: /* @__PURE__ */ a.jsxs(p, { withDateRange: d, ...i, standalone: !0, children: [
|
|
51
|
-
/* @__PURE__ */ a.jsx(D, { withTriggers: n }),
|
|
52
|
-
/* @__PURE__ */ a.jsx(b, {}),
|
|
53
|
-
/* @__PURE__ */ a.jsx(x, {}),
|
|
54
|
-
s && /* @__PURE__ */ a.jsx(O, { footer: s })
|
|
55
|
-
] }) });
|
|
56
|
-
};
|
|
57
|
-
export {
|
|
58
|
-
L as C,
|
|
59
|
-
O as a,
|
|
60
|
-
R as i
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=calendar.component-Dz_YhuJT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.component-Dz_YhuJT.js","sources":["../../src/components/Calendar/calendarFooterButton.component.tsx","../../src/components/Calendar/calendar.utils.ts","../../src/components/Calendar/calendar.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Button } from 'components/Button/button.component';\nimport { useDatePickerContext } from 'components/DatePicker/context/datePicker.context';\nimport startOfDay from 'date-fns/startOfDay';\nimport startOfWeek from 'date-fns/startOfWeek';\nimport startOfMonth from 'date-fns/startOfMonth';\nimport endOfWeek from 'date-fns/endOfWeek';\nimport endOfMonth from 'date-fns/endOfMonth';\n\n/**\n * The built-in preset values for CalendarFooterButton.\n *\n * Intentionally kept as plain string literals rather than re-using\n * DateTimePickerDefaultOptionValue to avoid a duplicate star-export conflict:\n * both Calendar and DateTimePicker barrel-export from components/index.ts,\n * and TypeScript silently drops ambiguous re-exports when two barrels supply\n * the same identifier. Keeping CalendarPreset self-contained prevents that\n * collision and makes the Calendar API standalone.\n */\nexport type CalendarPreset = 'today' | 'thisWeek' | 'thisMonth';\n\nexport interface CalendarFooterPresetConfig {\n type: 'preset';\n /** The built-in preset to apply when the button is clicked. */\n value: CalendarPreset;\n /**\n * Override the button label.\n * Defaults: 'today' → 'Today', 'thisWeek' → 'This Week', 'thisMonth' → 'This Month'.\n */\n label?: string;\n /** Optional callback fired after the preset date is selected. */\n onClick?: () => void;\n}\n\nexport interface CalendarFooterCustomConfig {\n type: 'custom';\n /** Button label — required for custom type. */\n label: string;\n /** Handler called when the button is clicked. Full control — no date selection is performed. */\n onClick: () => void;\n}\n\nexport type CalendarFooterConfig = CalendarFooterPresetConfig | CalendarFooterCustomConfig;\n\nconst PRESET_LABELS: Record<CalendarPreset, string> = {\n today: 'Today',\n thisWeek: 'This Week',\n thisMonth: 'This Month',\n};\n\ninterface CalendarFooterButtonProps {\n footer: CalendarFooterConfig;\n /** Data test id for the footer container.\n * @default kibble-calendar-footer\n */\n 'data-testid'?: string;\n}\n\nexport const CalendarFooterButton = ({\n footer,\n ['data-testid']: dataTestId = 'kibble-calendar-footer',\n}: CalendarFooterButtonProps): React.JSX.Element => {\n const { goToDate, onDateSelect, onQuickOptionSelect, firstDayOfWeek } = useDatePickerContext();\n\n const handleClick = (): void => {\n if (footer.type === 'custom') {\n footer.onClick();\n return;\n }\n\n const today = new Date();\n\n switch (footer.value) {\n case 'today': {\n const date = startOfDay(today);\n goToDate(date);\n onDateSelect(date);\n break;\n }\n case 'thisWeek': {\n const weekStartsOn = (firstDayOfWeek ?? 1) as 0 | 1 | 2 | 3 | 4 | 5 | 6;\n const start = startOfWeek(today, { weekStartsOn });\n const end = endOfWeek(today, { weekStartsOn });\n goToDate(start);\n // onQuickOptionSelect sets both dates atomically, avoiding the two-click range flow\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n case 'thisMonth': {\n const start = startOfMonth(today);\n const end = endOfMonth(today);\n goToDate(start);\n onQuickOptionSelect({ startDate: start, endDate: end });\n break;\n }\n }\n\n footer.onClick?.();\n };\n\n const label = footer.type === 'custom' ? footer.label : (footer.label ?? PRESET_LABELS[footer.value]);\n\n return (\n <Box data-testid={dataTestId} bg=\"background.secondaryAlpha\" borderRadius=\"md\" p={2} w=\"full\">\n <Button variant=\"secondarySubtle\" size=\"md\" w=\"full\" onClick={handleClick}>\n {label}\n </Button>\n </Box>\n );\n};\n","import { CalendarPreset } from './calendarFooterButton.component';\n\n// Explicit allowlist — new presets default to single-day unless listed here\nconst RANGE_PRESETS = new Set<CalendarPreset>(['thisWeek', 'thisMonth']);\n\n/** Returns true when the preset requires date range selection (week, month). */\nexport const isRangePreset = (value: CalendarPreset): boolean => RANGE_PRESETS.has(value);\n","import React from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { DatePickerCalendar } from 'components/DatePicker/components/DatePickerCalendar/datePickerCalendar.component';\nimport { DatePickerHeader } from 'components/DatePicker/components/DatePickerHeader/datePickerHeader.component';\nimport { Divider } from 'components/Divider';\nimport { DatePickerProvider } from 'components/DatePicker/context/datePicker.provider';\nimport { DateProps } from 'components/DatePicker/datePicker.types';\nimport { CalendarFooterButton, CalendarFooterConfig } from './calendarFooterButton.component';\nimport { isRangePreset } from './calendar.utils';\n\nexport interface CalendarProps extends DateProps {\n /** Data test id for the calendar.\n * @default kibble-calendar\n */\n 'data-testid'?: string;\n /**\n * If true, the calendar will allow for a date range selection.\n * @default true\n */\n withDateRange?: boolean;\n /**\n * If true, the calendar will show the month and year selectors in the header.\n * @default false\n */\n withHeaderTriggers?: boolean;\n /**\n * Optional footer button configuration. Renders a styled button below the calendar grid.\n *\n * Use `type: 'preset'` for built-in shortcuts ('today' | 'thisWeek' | 'thisMonth') — the\n * component handles the date selection logic automatically.\n *\n * Use `type: 'custom'` to supply your own label and click handler with no built-in date logic.\n *\n * @example\n * // Preset\n * footer={{ type: 'preset', value: 'today', onClick: () => setOpen(false) }}\n *\n * @example\n * // Custom\n * footer={{ type: 'custom', label: 'Reset', onClick: handleReset }}\n */\n footer?: CalendarFooterConfig;\n}\n\nexport const Calendar = ({\n ['data-testid']: dataTestId = 'kibble-calendar',\n withDateRange = true,\n withHeaderTriggers = false,\n footer,\n ...rest\n}: CalendarProps): React.JSX.Element => {\n // Range presets (thisWeek, thisMonth) require date range mode regardless of the withDateRange prop\n const effectiveDateRange = withDateRange || (footer?.type === 'preset' && isRangePreset(footer.value));\n\n return (\n <Box className=\"Calendar\" data-testid={dataTestId} maxW={footer ? '360px' : '340px'}>\n <DatePickerProvider withDateRange={effectiveDateRange} {...rest} standalone>\n <DatePickerHeader withTriggers={withHeaderTriggers} />\n <Divider />\n <DatePickerCalendar />\n {footer && <CalendarFooterButton footer={footer} />}\n </DatePickerProvider>\n </Box>\n );\n};\n"],"names":["PRESET_LABELS","CalendarFooterButton","footer","dataTestId","goToDate","onDateSelect","onQuickOptionSelect","firstDayOfWeek","useDatePickerContext","handleClick","today","date","startOfDay","weekStartsOn","start","startOfWeek","end","endOfWeek","startOfMonth","endOfMonth","label","jsx","Box","Button","RANGE_PRESETS","isRangePreset","value","Calendar","withDateRange","withHeaderTriggers","rest","effectiveDateRange","DatePickerProvider","DatePickerHeader","Divider","DatePickerCalendar"],"mappings":";;;;;;;AA6CA,MAAMA,IAAgD;AAAA,EACpD,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AACb,GAUaC,IAAuB,CAAC;AAAA,EACnC,QAAAC;AAAA,EACA,CAAC,gBAAgBC,IAAa;AAChC,MAAoD;AAClD,QAAM,EAAE,UAAAC,GAAU,cAAAC,GAAc,qBAAAC,GAAqB,gBAAAC,EAAA,IAAmBC,EAAqB,GAEvFC,IAAc,MAAY;AAC1B,QAAAP,EAAO,SAAS,UAAU;AAC5B,MAAAA,EAAO,QAAQ;AACf;AAAA,IAAA;AAGI,UAAAQ,wBAAY,KAAK;AAEvB,YAAQR,EAAO,OAAO;AAAA,MACpB,KAAK,SAAS;AACN,cAAAS,IAAOC,EAAWF,CAAK;AAC7B,QAAAN,EAASO,CAAI,GACbN,EAAaM,CAAI;AACjB;AAAA,MAAA;AAAA,MAEF,KAAK,YAAY;AACf,cAAME,IAAgBN,KAAkB,GAClCO,IAAQC,EAAYL,GAAO,EAAE,cAAAG,GAAc,GAC3CG,IAAMC,EAAUP,GAAO,EAAE,cAAAG,GAAc;AAC7C,QAAAT,EAASU,CAAK,GAEdR,EAAoB,EAAE,WAAWQ,GAAO,SAASE,GAAK;AACtD;AAAA,MAAA;AAAA,MAEF,KAAK,aAAa;AACV,cAAAF,IAAQI,EAAaR,CAAK,GAC1BM,IAAMG,EAAWT,CAAK;AAC5B,QAAAN,EAASU,CAAK,GACdR,EAAoB,EAAE,WAAWQ,GAAO,SAASE,GAAK;AACtD;AAAA,MAAA;AAAA,IACF;AAGF,IAAAd,EAAO,UAAU;AAAA,EACnB,GAEMkB,IAAQlB,EAAO,SAAS,WAAWA,EAAO,QAASA,EAAO,SAASF,EAAcE,EAAO,KAAK;AAGjG,SAAAmB,gBAAAA,EAAA,IAACC,KAAI,eAAanB,GAAY,IAAG,6BAA4B,cAAa,MAAK,GAAG,GAAG,GAAE,QACrF,UAACkB,gBAAAA,EAAA,IAAAE,GAAA,EAAO,SAAQ,mBAAkB,MAAK,MAAK,GAAE,QAAO,SAASd,GAC3D,UAAAW,EAAA,CACH,EACF,CAAA;AAEJ,GC3GMI,IAAoB,oBAAA,IAAoB,CAAC,YAAY,WAAW,CAAC,GAG1DC,IAAgB,CAACC,MAAmCF,EAAc,IAAIE,CAAK,GCsC3EC,IAAW,CAAC;AAAA,EACvB,CAAC,gBAAgBxB,IAAa;AAAA,EAC9B,eAAAyB,IAAgB;AAAA,EAChB,oBAAAC,IAAqB;AAAA,EACrB,QAAA3B;AAAA,EACA,GAAG4B;AACL,MAAwC;AAEtC,QAAMC,IAAqBH,KAAkB1B,GAAQ,SAAS,YAAYuB,EAAcvB,EAAO,KAAK;AAEpG,+BACGoB,GAAI,EAAA,WAAU,YAAW,eAAanB,GAAY,MAAMD,IAAS,UAAU,SAC1E,iCAAC8B,GAAmB,EAAA,eAAeD,GAAqB,GAAGD,GAAM,YAAU,IACzE,UAAA;AAAA,IAACT,gBAAAA,EAAAA,IAAAY,GAAA,EAAiB,cAAcJ,EAAoB,CAAA;AAAA,0BACnDK,GAAQ,EAAA;AAAA,0BACRC,GAAmB,EAAA;AAAA,IACnBjC,KAAWmB,gBAAAA,EAAA,IAAApB,GAAA,EAAqB,QAAAC,EAAgB,CAAA;AAAA,EAAA,EAAA,CACnD,EACF,CAAA;AAEJ;"}
|