@propriety/court-calendar 1.0.155 → 1.0.156

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 (31) hide show
  1. package/dist/__tests__/CalendarLegend.test.d.ts +1 -0
  2. package/dist/__tests__/CalendarListLabels.test.d.ts +1 -0
  3. package/dist/__tests__/ReferenceDataLookups.test.d.ts +1 -0
  4. package/dist/__tests__/helpers/eventLabel.test.d.ts +1 -0
  5. package/dist/_components/Shared/CountyDropdown.d.ts +15 -0
  6. package/dist/context/ReferenceDataContext.d.ts +1 -0
  7. package/dist/helpers/api/counties.d.ts +12 -0
  8. package/dist/helpers/eventLabel.d.ts +52 -0
  9. package/dist/helpers/formatter.d.ts +8 -0
  10. package/dist/index.mjs +7616 -7452
  11. package/package.json +1 -1
  12. package/src/__tests__/CalendarLegend.test.tsx +42 -0
  13. package/src/__tests__/CalendarListLabels.test.tsx +111 -0
  14. package/src/__tests__/ReferenceDataLookups.test.tsx +99 -0
  15. package/src/__tests__/WeekWidget.test.tsx +4 -1
  16. package/src/__tests__/collectionsPipeline.test.ts +36 -0
  17. package/src/__tests__/helpers/eventLabel.test.ts +133 -0
  18. package/src/__tests__/helpers/formatter.test.ts +37 -1
  19. package/src/__tests__/hooks/UseModalActions.test.ts +1 -0
  20. package/src/_components/CCalendar.tsx +9 -0
  21. package/src/_components/CalendarLegend.tsx +11 -3
  22. package/src/_components/List/CalendarList.tsx +22 -5
  23. package/src/_components/Modal/DateDetails/DateDetails.tsx +20 -3
  24. package/src/_components/Modal/DateEdit/CreateEditCase.tsx +44 -19
  25. package/src/_components/Shared/CountyDropdown.tsx +73 -0
  26. package/src/_components/WeekWidget/WeekWidget.tsx +24 -14
  27. package/src/context/ReferenceDataContext.tsx +61 -27
  28. package/src/helpers/api/counties.ts +32 -0
  29. package/src/helpers/eventLabel.ts +104 -0
  30. package/src/helpers/formatter.ts +18 -0
  31. package/src/hooks/UseCalendarEvents.ts +34 -14
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * County picker for collections dates, which are scheduled for a whole county rather
3
+ * than one municipality. The selected value is stored in the same MuniCode field every
4
+ * other date type uses, but holds a county code ('N') instead of a muni code ('N2000').
5
+ *
6
+ * Deliberately not part of MuniDropdown: only collections may pick a county, and county
7
+ * entries must never appear in the municipality list.
8
+ */
9
+ export default function CountyDropdown({ selectedCounty, setSelectedCounty, size, onOpen, onClose, }: {
10
+ selectedCounty: string | null;
11
+ setSelectedCounty: (countyCode: string) => void;
12
+ size: 'small' | 'medium';
13
+ onOpen?: () => void;
14
+ onClose?: () => void;
15
+ }): import("react/jsx-runtime").JSX.Element;
@@ -5,6 +5,7 @@ interface ReferenceDataContextType {
5
5
  allUsers: Record<number, User>;
6
6
  allHearingOfficers: Record<number, HearingOfficer>;
7
7
  allMuniNames: Record<string, Muni>;
8
+ allCounties: Record<string, string>;
8
9
  getTownshipName: (muniCode: string) => string;
9
10
  getCountyName: (muniCode: string) => string;
10
11
  isLoading: boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * County code -> county name, e.g. { N: 'Nassau', W: 'Westchester' }.
3
+ *
4
+ * A county code is the single letter every municipality code starts with, so 'N'
5
+ * covers all of Nassau just as 'N2000' covers Hempstead. Collections dates are
6
+ * scheduled per county rather than per municipality and store one of these codes
7
+ * in MuniCode.
8
+ *
9
+ * Deliberately a separate endpoint from /utils/get-muni-names: county codes must
10
+ * not appear in the municipality dropdown.
11
+ */
12
+ export declare function getAllCounties(apiKey: string): Promise<Record<string, string>>;
@@ -0,0 +1,52 @@
1
+ import { DateType } from '../types';
2
+ /**
3
+ * The pieces every surface builds a date's label from.
4
+ *
5
+ * Kept as parts rather than a finished string because the surfaces compose them
6
+ * differently: the calendar wants one line, the week widget stacks two, and the table
7
+ * already has its own Type and County columns and only needs the place.
8
+ */
9
+ export interface DateLabelParts {
10
+ /** 'Collections' | 'Negotiations'. Null for SCAR — a court date is the default. */
11
+ typeWord: string | null;
12
+ /** County for Collections, township/village otherwise. '' when unresolvable. */
13
+ place: string;
14
+ /** ' (3100)' — SCAR only. Non-court types drop the code. */
15
+ codeSuffix: string;
16
+ /**
17
+ * Whether a case count means anything. SCAR only: collections are scheduled
18
+ * without cases, and negotiation dates are never linked to any, so both would
19
+ * show a permanent "x0".
20
+ */
21
+ showCaseCount: boolean;
22
+ }
23
+ /**
24
+ * Resolve a date's label parts.
25
+ *
26
+ * `getTownshipName` and `getCountyName` come from `useReferenceData()` — passed in
27
+ * rather than imported so this stays a pure function that tests can drive directly.
28
+ */
29
+ export declare function dateLabelParts(dateType: DateType | null | undefined, muniCode: string, getTownshipName: (muniCode: string) => string, getCountyName: (muniCode: string) => string): DateLabelParts;
30
+ /**
31
+ * One line naming the date, with no counts or day/adjournment markers.
32
+ * Used by the tooltip, the details modal header and anywhere a plain title is wanted.
33
+ */
34
+ export declare function dateHeadline(parts: DateLabelParts): string;
35
+ export interface EventTitleOptions {
36
+ /** Marks the occurrence as an adjournment: "Greenburgh (A) (3100)". */
37
+ adjourned?: boolean;
38
+ /** 1-based day for a multi-date hearing; omitted for a single-day date. */
39
+ dayNumber?: number;
40
+ /** Open case count, appended as "x4" when the type supports counts. */
41
+ unsettled?: number;
42
+ /** Leading verb for derived events, e.g. 'Upload' or 'Can Preclude'. */
43
+ prefix?: string;
44
+ }
45
+ /**
46
+ * The FullCalendar event title.
47
+ *
48
+ * Carries no time — FullCalendar renders that itself from the event's `start`, using
49
+ * the `eventTimeFormat` set on the calendar, and prepends it. So a collections event
50
+ * reads "1pm Collections Nassau" on screen while this returns "Collections Nassau".
51
+ */
52
+ export declare function formatEventTitle(parts: DateLabelParts, options?: EventTitleOptions): string;
@@ -9,4 +9,12 @@ export declare function formatDisplayDate(date: Date | string | null | undefined
9
9
  export declare function formatDateForAPI(date: Date): string;
10
10
  export declare function formatDateTimeForAPI(date: Date, hearingTime?: string): string;
11
11
  export declare function to24Hour(time: string): string;
12
+ /**
13
+ * A stored hearing time as "1pm" / "9:30am", or "" when there is nothing to show.
14
+ *
15
+ * Matches the `eventTimeFormat` the calendar passes to FullCalendar, so a chip rendered
16
+ * outside FullCalendar reads the same as the event it refers to. Accepts anything
17
+ * `to24Hour` accepts — "13:00:00" from Collections, "2:30 PM" from a picker, "10:30".
18
+ */
19
+ export declare function formatClockTime(time: string | null | undefined): string;
12
20
  export declare function formatEvidence(evidence: Evidence): string;