@propriety/court-calendar 1.0.141 → 1.0.142

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/dev/App.tsx CHANGED
@@ -1,8 +1,16 @@
1
1
  import { useState } from 'react';
2
- import { CCalendar } from '../src/';
2
+ import { CCalendar, WeekWidget } from '../src/';
3
3
 
4
4
  function App() {
5
5
  const [mode, setMode] = useState<'light' | 'dark'>('dark');
6
+ const [view, setView] = useState<'calendar' | 'widget'>('calendar');
7
+
8
+ const apiKey = import.meta.env.VITE_CALENDAR_API_KEY || '';
9
+ const buttonStyle = {
10
+ height: '2rem',
11
+ backgroundColor: mode === 'dark' ? '#121212' : '#ffffff',
12
+ color: mode === 'dark' ? '#ffffff' : '#212121',
13
+ };
6
14
 
7
15
  return (
8
16
  <div
@@ -13,21 +21,32 @@ function App() {
13
21
  }}
14
22
  >
15
23
  <h1>Court Calendar Demo</h1>
16
- <div style={{ flexDirection: 'column', display: 'flex' }}>
17
- <button
18
- onClick={() => setMode(mode === 'light' ? 'dark' : 'light')}
19
- style={{
20
- marginBottom: '1rem',
21
- height: '2rem',
22
- backgroundColor: mode === 'dark' ? '#121212' : '#ffffff',
23
- color: mode === 'dark' ? '#ffffff' : '#212121',
24
- }}
25
- >
24
+ <div style={{ flexDirection: 'row', display: 'flex', gap: '0.5rem', marginBottom: '1rem' }}>
25
+ <button onClick={() => setMode(mode === 'light' ? 'dark' : 'light')} style={buttonStyle}>
26
26
  Theme toggle
27
27
  </button>
28
+ <button onClick={() => setView(view === 'calendar' ? 'widget' : 'calendar')} style={buttonStyle}>
29
+ {view === 'calendar' ? 'Show week widget' : 'Show full calendar'}
30
+ </button>
28
31
  </div>
29
32
 
30
- <CCalendar apiKey={import.meta.env.VITE_CALENDAR_API_KEY || ''} activeUser={27} mode={mode} />
33
+ {view === 'calendar' ? (
34
+ <CCalendar apiKey={apiKey} activeUser={27} mode={mode} />
35
+ ) : (
36
+ // WeekWidget renders a bare grid — wrap it like a dashboard card so the
37
+ // compact week strip is easy to see against the page background.
38
+ <div
39
+ style={{
40
+ maxWidth: 900,
41
+ padding: '1rem',
42
+ borderRadius: 8,
43
+ border: `1px solid ${mode === 'dark' ? '#333' : '#e0e0e0'}`,
44
+ }}
45
+ >
46
+ <h3 style={{ margin: '0 0 0.75rem' }}>Court Calendar — This Week</h3>
47
+ <WeekWidget apiKey={apiKey} activeUser={27} mode={mode} />
48
+ </div>
49
+ )}
31
50
  </div>
32
51
  );
33
52
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Compact current-week (Mon–Fri) view of the court calendar. Hearing badges,
3
+ * "Can Preclude" (motion-date) markers and "Upload" (deadline) markers all use
4
+ * the full calendar's styling. Powered by the real court-calendar data stack;
5
+ * clicking any item opens the in-package DateDetails modal.
6
+ *
7
+ * Renders a bare 5-column grid — wrap it in your own card/header.
8
+ */
9
+ export default function WeekWidget({ apiKey, activeUser, mode, themeOverrides, }: {
10
+ apiKey: string;
11
+ activeUser: number;
12
+ mode?: 'light' | 'dark';
13
+ themeOverrides?: import('@mui/material/styles').ThemeOptions;
14
+ }): import("react/jsx-runtime").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as CCalendar } from './_components/CCalendar';
2
+ export { default as WeekWidget } from './_components/WeekWidget/WeekWidget';
2
3
  export type { CalendarRouteParams } from './types';
3
4
  export { parseCalendarSearchParams, serializeCalendarParams } from './helpers/routing';