@propriety/court-calendar 1.0.164 → 1.0.165

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 (32) hide show
  1. package/dist/__tests__/helpers/filterLabels.test.d.ts +6 -0
  2. package/dist/__tests__/hooks/UseCalendarEventsUploadMarkers.test.d.ts +13 -0
  3. package/dist/_components/Toolbar/DateTypeFilter.d.ts +7 -1
  4. package/dist/helpers/eventLabel.d.ts +7 -2
  5. package/dist/helpers/filterLabels.d.ts +37 -0
  6. package/dist/helpers/routing.d.ts +1 -1
  7. package/dist/index.mjs +7564 -7510
  8. package/dist/types.d.ts +2 -0
  9. package/package.json +1 -1
  10. package/src/__tests__/collectionsPipeline.test.ts +1 -1
  11. package/src/__tests__/filtering.test.ts +9 -5
  12. package/src/__tests__/fixtures.ts +1 -0
  13. package/src/__tests__/helpers/cases.test.ts +4 -2
  14. package/src/__tests__/helpers/eventLabel.test.ts +7 -7
  15. package/src/__tests__/helpers/filterLabels.test.ts +57 -0
  16. package/src/__tests__/helpers/routing.test.ts +11 -0
  17. package/src/__tests__/hooks/UseCalendarEventsUploadMarkers.test.ts +191 -0
  18. package/src/_components/CCalendar.tsx +19 -6
  19. package/src/_components/Modal/DateDetails/CaseToolbar.tsx +8 -3
  20. package/src/_components/Toolbar/CaseFilter.tsx +17 -19
  21. package/src/_components/Toolbar/DateTypeFilter.tsx +43 -25
  22. package/src/_components/Toolbar/Toolbar.tsx +3 -1
  23. package/src/_components/WeekWidget/WeekWidget.tsx +10 -2
  24. package/src/constants.ts +1 -0
  25. package/src/helpers/cases.ts +6 -1
  26. package/src/helpers/eventLabel.ts +9 -4
  27. package/src/helpers/filterLabels.ts +42 -0
  28. package/src/helpers/routing.ts +6 -1
  29. package/src/hooks/UseCalendarEvents.ts +26 -2
  30. package/src/hooks/UseCaseData.ts +7 -1
  31. package/src/hooks/UseCourtDates.ts +11 -3
  32. package/src/types.ts +4 -0
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The filter labels flip with state, so the pill always names what the next click does.
3
+ * Three surfaces read these strings (toolbar pills, the modal's icon toolbar, the
4
+ * "hidden by filter" snackbar) and they used to be typed out separately in each.
5
+ */
6
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Upload-deadline markers and the case count on hearing chips.
3
+ *
4
+ * Two behaviours meet here, both of which used to read as "the filter is broken":
5
+ *
6
+ * 1. The count on a hearing chip is the *filtered* count — what opening the date shows.
7
+ * It used to be the unsettled count, so toggling "Hide Uploaded" moved nothing on
8
+ * screen even though the bucket underneath had shrunk.
9
+ * 2. An upload marker with nothing left to chase hides itself. "Nothing left" covers
10
+ * both "every case is uploaded or settled" and "this date has no cases at all" —
11
+ * the latter is the 0 open / 0 total marker that sat on the calendar for a full week.
12
+ */
13
+ export {};
@@ -1,5 +1,11 @@
1
1
  import { CalendarFilterCtx } from '../../types';
2
- export default function DateTypeFilter({ filterCtx, setFilterCtx, }: {
2
+ /**
3
+ * `mode` mirrors CaseFilter's: the window-widening "Deadlines" / "Can Preclude" pills are
4
+ * primary-row controls, while "Completed" lives in the More list — it is a rarely-wanted
5
+ * escape hatch for markers the calendar has deliberately finished with.
6
+ */
7
+ export default function DateTypeFilter({ filterCtx, setFilterCtx, mode, }: {
3
8
  filterCtx: CalendarFilterCtx;
4
9
  setFilterCtx: (ctx: CalendarFilterCtx) => void;
10
+ mode?: 'all' | 'primary' | 'secondary';
5
11
  }): import("react/jsx-runtime").JSX.Element;
@@ -37,8 +37,13 @@ export interface EventTitleOptions {
37
37
  adjourned?: boolean;
38
38
  /** 1-based day for a multi-date hearing; omitted for a single-day date. */
39
39
  dayNumber?: number;
40
- /** Open case count, appended as "x4" when the type supports counts. */
41
- unsettled?: number;
40
+ /**
41
+ * Case count, appended as "x4" when the type supports counts. This is the number of
42
+ * cases that survive the *active filters* — i.e. exactly what opening the date shows.
43
+ * Passing the unsettled count here instead made "Hide Uploaded" look broken: the
44
+ * filter ran, the bucket shrank, and the label never moved.
45
+ */
46
+ caseCount?: number;
42
47
  /** Leading verb for derived events, e.g. 'Upload' or 'Can Preclude'. */
43
48
  prefix?: string;
44
49
  /** This occurrence sits past the day's SCAR limit — see helpers/dayLoad.ts. */
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Labels for the three case-level filter toggles, in one place.
3
+ *
4
+ * The pills, the modal's icon-only toolbar and the "hidden by filter" snackbar all name
5
+ * these filters, and the strings used to be typed out separately in each — which is how
6
+ * the snackbar ended up quoting button labels it could no longer keep in step.
7
+ *
8
+ * The pill label names the action the *next* click performs, so it flips with state:
9
+ * unlit reads "Hide Settled", lit reads "Show Settled". ("Hide" and "Show" are the same
10
+ * width, so a flipping label never reflows the toolbar.) The snackbar wants the state
11
+ * instead of the action — quoting a lit "Show Settled" as the reason something is hidden
12
+ * reads backwards — so it uses `subject` on its own.
13
+ */
14
+ export declare const CASE_FILTER_LABELS: {
15
+ readonly showOnlyUnsettled: {
16
+ readonly noun: "Settled";
17
+ readonly subject: "settled cases";
18
+ };
19
+ readonly showOnlyWithoutEvidence: {
20
+ readonly noun: "Uploaded";
21
+ readonly subject: "cases with uploaded evidence";
22
+ };
23
+ readonly showOnlyUnreviewed: {
24
+ readonly noun: "Reviewed";
25
+ readonly subject: "reviewed cases";
26
+ };
27
+ };
28
+ export type CaseFilterKey = keyof typeof CASE_FILTER_LABELS;
29
+ /** Pill text: "Hide Settled" when settled are showing, "Show Settled" once they are hidden. */
30
+ export declare function caseFilterLabel(key: CaseFilterKey, active: boolean): string;
31
+ /** Tooltip for the same toggle, spelled out: "Hide cases with uploaded evidence". */
32
+ export declare function caseFilterTooltip(key: CaseFilterKey, active: boolean): string;
33
+ /**
34
+ * The "…are hidden" clause for the search snackbar, listing every active case filter.
35
+ * Returns '' when none are active.
36
+ */
37
+ export declare function activeCaseFilterSubjects(active: Record<CaseFilterKey, boolean>): string;
@@ -1,6 +1,6 @@
1
1
  import { DateType, CalendarFilterCtx, CalendarRouteParams } from '../types';
2
2
  import { DEFAULT_FILTER_CTX } from '../constants';
3
- export declare const CALENDAR_PARAM_KEYS: readonly ["view", "date", "cdId", "cdType", "ci", "ht", "user", "dl", "md", "adj", "dt", "muni", "settled", "noEvid", "unrev", "q"];
3
+ export declare const CALENDAR_PARAM_KEYS: readonly ["view", "date", "cdId", "cdType", "ci", "ht", "user", "dl", "md", "adj", "done", "dt", "muni", "settled", "noEvid", "unrev", "q"];
4
4
  export declare function serializeCalendarParams(params: CalendarRouteParams): URLSearchParams;
5
5
  export declare function parseCalendarSearchParams(params: URLSearchParams | Record<string, string | undefined>): CalendarRouteParams;
6
6
  export declare function buildCalendarRouteParams(view: string, date: Date, courtDateId: number | null, caseIdx: string | null, filterCtx: CalendarFilterCtx, courtDateType?: DateType | null): CalendarRouteParams;