@mirohq/design-system-calendar 2.4.42 → 2.5.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/types.d.ts CHANGED
@@ -32,6 +32,7 @@ type TransformProps<Props, Media> = {
32
32
  declare const StyledCalendar: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, never> & TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {}, {}>;
33
33
  type StyledCalendarProps = ComponentPropsWithRef<typeof StyledCalendar>;
34
34
 
35
+ type CalendarPeriod = 'day' | 'week' | 'month' | 'quarter';
35
36
  interface PredefinedValue<T extends DateRange | DateValue> {
36
37
  id: string;
37
38
  label: string;
@@ -51,6 +52,32 @@ interface CalendarGridBaseProps extends Omit<StyledCalendarProps, 'defaultValue'
51
52
  * Maximum allowed date to select from
52
53
  */
53
54
  maxDate?: DateValue;
55
+ /**
56
+ * When true, the header title becomes clickable and allows navigating
57
+ * between day, month and year views. The quarter view is reached only with
58
+ * `period='quarter'`. Ignored when visibleMonths > 1.
59
+ * @default false
60
+ */
61
+ navigation?: boolean;
62
+ /**
63
+ * Overrides the quarter label shown in the quarter grid. Receives the
64
+ * quarter number (1–4) and returns the display string. When omitted the
65
+ * label comes from `locale`, for example "Q1" in English and "T1" in French.
66
+ */
67
+ formatQuarterLabel?: (quarter: number) => string;
68
+ /**
69
+ * Overrides the accessible label for the header title button that switches
70
+ * between views. Receives the visible title text and the next view name.
71
+ * When omitted the wording comes from `locale`.
72
+ */
73
+ formatSwitchViewLabel?: (title: string, nextView: string) => string;
74
+ /**
75
+ * Label for the "go to current period" button shown at the bottom of a
76
+ * single picker. Pass already-translated text. When omitted, no button is
77
+ * rendered. Range pickers never show it, since a range has no current
78
+ * period to jump to.
79
+ */
80
+ goToCurrentLabel?: string;
54
81
  }
55
82
  interface CalendarPopoverBaseProps {
56
83
  /**
@@ -90,6 +117,19 @@ interface CalendarGridDatePickerProps extends CalendarGridBaseProps {
90
117
  * Type of calendar
91
118
  */
92
119
  picker: 'single';
120
+ /**
121
+ * The granularity at which the calendar operates.
122
+ * - 'day' (default): standard day picker
123
+ * - 'week': day grid where clicking any day selects the whole week,
124
+ * committing the first day of the week as the value
125
+ * - 'month': shows a month grid as the main view; selecting a month commits
126
+ * the first day of that month as the value. Years navigation above.
127
+ * - 'quarter': shows a quarter grid (Q1–Q4) as the main view; selecting a
128
+ * quarter commits the first day of that quarter as the value. Years
129
+ * navigation above.
130
+ * @default 'day'
131
+ */
132
+ period?: CalendarPeriod;
93
133
  /**
94
134
  * Value given for already pre-selected date
95
135
  */
@@ -115,6 +155,11 @@ interface CalendarGridRangePickerProps extends CalendarGridBaseProps {
115
155
  * Type of calendar
116
156
  */
117
157
  picker: 'range';
158
+ /**
159
+ * Periods are a single-picker concept: a range already spans arbitrary days,
160
+ * so there is nothing for the granularity to mean here.
161
+ */
162
+ period?: never;
118
163
  /**
119
164
  * Value given for already pre-selected date
120
165
  */
@@ -306,6 +351,7 @@ type StyledValueProps = ComponentPropsWithRef<typeof StyledValue>;
306
351
  type FormatOptions = Pick<Intl.DateTimeFormatOptions, 'weekday' | 'era' | 'year' | 'month' | 'day' | 'formatMatcher'>;
307
352
  type ValueProps = StyledValueProps & {
308
353
  format?: FormatOptions;
354
+ currentLabel?: string;
309
355
  };
310
356
  declare const Value: react__default.ForwardRefExoticComponent<Omit<ValueProps, "ref"> & react__default.RefAttributes<HTMLSpanElement>>;
311
357
 
@@ -342,7 +388,7 @@ interface Partials {
342
388
  ClearButton: typeof ClearButton;
343
389
  SaveButton: typeof SaveButton;
344
390
  }
345
- declare const CalendarGrid: ({ picker, defaultValue, value, onValueChange, locale, visibleMonths, minDate, maxDate, predefinedValues, }: CalendarGridProps) => JSX.Element;
391
+ declare const CalendarGrid: ({ picker, defaultValue, value, onValueChange, locale, visibleMonths, minDate, maxDate, predefinedValues, navigation, period, formatQuarterLabel, formatSwitchViewLabel, goToCurrentLabel, }: CalendarGridProps) => JSX.Element;
346
392
 
347
393
  export { Calendar, CalendarGrid };
348
- export type { ClearButtonProps as CalendarClearButtonProps, ContentProps as CalendarContentProps, CalendarGridProps, CalendarProps, SaveButtonProps as CalendarSaveButtonProps, TriggerProps as CalendarTriggerProps, ValueProps as CalendarValueProps };
394
+ export type { ClearButtonProps as CalendarClearButtonProps, ContentProps as CalendarContentProps, CalendarGridProps, CalendarPeriod, CalendarProps, SaveButtonProps as CalendarSaveButtonProps, TriggerProps as CalendarTriggerProps, ValueProps as CalendarValueProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirohq/design-system-calendar",
3
- "version": "2.4.42",
3
+ "version": "2.5.0",
4
4
  "description": "",
5
5
  "author": "Miro",
6
6
  "source": "src/index.ts",
@@ -35,19 +35,19 @@
35
35
  "react-aria": "^3.25.0",
36
36
  "react-stately": "^3.23.0",
37
37
  "@mirohq/design-system-base-form": "^2.0.2",
38
- "@mirohq/design-system-base-button": "^1.2.40",
39
38
  "@mirohq/design-system-base-text-field": "^1.3.41",
40
- "@mirohq/design-system-flex": "^3.2.39",
41
39
  "@mirohq/design-system-button": "^5.3.18",
42
40
  "@mirohq/design-system-icons": "^1.47.2",
41
+ "@mirohq/design-system-flex": "^3.2.39",
43
42
  "@mirohq/design-system-icon-button": "^4.2.43",
44
43
  "@mirohq/design-system-primitive": "^2.2.1",
44
+ "@mirohq/design-system-base-button": "^1.2.40",
45
45
  "@mirohq/design-system-styles": "^3.2.35",
46
46
  "@mirohq/design-system-types": "^1.0.3",
47
- "@mirohq/design-system-stitches": "^3.3.35",
48
47
  "@mirohq/design-system-tooltip": "^4.4.38",
48
+ "@mirohq/design-system-utils": "^1.5.0",
49
49
  "@mirohq/design-system-typography": "^1.3.37",
50
- "@mirohq/design-system-utils": "^1.5.0"
50
+ "@mirohq/design-system-stitches": "^3.3.35"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "rollup -c ../../../rollup.config.js",