eidotter 0.15.0 → 0.16.1

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 (37) hide show
  1. package/README.md +10 -5
  2. package/dist/components/Accordion/components/AccordionFill.d.ts +1 -0
  3. package/dist/components/Accordion/components/Section.d.ts +10 -18
  4. package/dist/components/Alert/components/Alert.d.ts +13 -23
  5. package/dist/components/Badge/components/Badge.d.ts +10 -28
  6. package/dist/components/Breadcrumb/components/Breadcrumb.d.ts +13 -35
  7. package/dist/components/Button/components/Button.d.ts +3 -43
  8. package/dist/components/Checkbox/components/Checkbox.d.ts +17 -27
  9. package/dist/components/FilterBar/components/FilterBar.d.ts +3 -13
  10. package/dist/components/Footer/components/Footer.d.ts +1 -5
  11. package/dist/components/Input/components/Input.d.ts +11 -14
  12. package/dist/components/Modal/components/Modal.d.ts +13 -21
  13. package/dist/components/Progress/components/Progress.d.ts +18 -41
  14. package/dist/components/Separator/components/Separator.d.ts +4 -13
  15. package/dist/components/Stat/components/Stat.d.ts +10 -30
  16. package/dist/components/Switch/components/Switch.d.ts +16 -36
  17. package/dist/components/Tabs/components/Tabs.d.ts +14 -45
  18. package/dist/components/Tag/components/Tag.d.ts +8 -18
  19. package/dist/components/TimelineContainer/components/TimelineContainer.d.ts +4 -3
  20. package/dist/components/TimelineContainer/components/TimelineEntryCard.d.ts +9 -5
  21. package/dist/components/TimelineContainer/components/ZoomControls.d.ts +3 -0
  22. package/dist/components/TimelineContainer/components/index.d.ts +1 -0
  23. package/dist/components/TimelineContainer/components/timelineUtils.d.ts +11 -0
  24. package/dist/components/TimelineContainer/components/useDrillDown.d.ts +42 -0
  25. package/dist/components/TimelineContainer/components/useDrillDown.test.d.ts +1 -0
  26. package/dist/eidotter.css +1 -1
  27. package/dist/index.d.ts +2 -5
  28. package/dist/index.es.js +11426 -1821
  29. package/dist/index.umd.js +28 -10
  30. package/package.json +15 -2
  31. package/tailwind.preset.enhanced.cjs +44 -0
  32. package/dist/components/TimelineEntry/components/TimelineEntry.d.ts +0 -21
  33. package/dist/components/TimelineEntry/components/index.d.ts +0 -2
  34. package/dist/components/TimelineEntry/index.d.ts +0 -2
  35. package/dist/components/TimelineList/components/TimelineList.d.ts +0 -18
  36. package/dist/components/TimelineList/components/index.d.ts +0 -2
  37. package/dist/components/TimelineList/index.d.ts +0 -2
@@ -1,51 +1,31 @@
1
1
  import React from 'react';
2
2
  import './Switch.css';
3
3
  export interface SwitchProps {
4
- /**
5
- * Whether the switch is checked
6
- */
4
+ /** Whether the switch is on (controlled) */
7
5
  checked?: boolean;
8
- /**
9
- * Default checked state (uncontrolled)
10
- */
6
+ /** Default state (uncontrolled) */
11
7
  defaultChecked?: boolean;
12
- /**
13
- * Callback when the switch state changes
14
- */
8
+ /** Callback when state changes */
15
9
  onCheckedChange?: (checked: boolean) => void;
16
- /**
17
- * Whether the switch is disabled
18
- */
10
+ /** Whether the switch is disabled */
19
11
  disabled?: boolean;
20
- /**
21
- * Name for form submission
22
- */
12
+ /** Size variant */
13
+ size?: 'sm' | 'md';
14
+ /** Switch type */
15
+ type?: 'default' | 'slim';
16
+ /** Label text */
17
+ label?: string;
18
+ /** Name for form submission */
23
19
  name?: string;
24
- /**
25
- * Value for form submission
26
- */
20
+ /** Value for form submission */
27
21
  value?: string;
28
- /**
29
- * Additional CSS class name
30
- */
22
+ /** Additional CSS class name */
31
23
  className?: string;
32
- /**
33
- * Accessible label for screen readers
34
- */
24
+ /** Accessible label */
35
25
  'aria-label'?: string;
36
- /**
37
- * ID of element that labels this switch
38
- */
39
- 'aria-labelledby'?: string;
40
26
  }
41
27
  /**
42
- * DOS-styled Switch component with authentic terminal aesthetics
43
- *
44
- * Features:
45
- * - Controlled and uncontrolled modes
46
- * - Disabled state
47
- * - Full keyboard accessibility
48
- * - WCAG 2.1 AA compliant
49
- * - DOS-authentic styling with CGA colors
28
+ * DOS-styled Switch with phosphor glow toggle effect.
29
+ * Built on React Aria for accessible toggle behavior.
50
30
  */
51
31
  export declare const Switch: React.FC<SwitchProps>;
@@ -1,64 +1,33 @@
1
1
  import React from 'react';
2
2
  import './Tabs.css';
3
3
  export interface TabItem {
4
- /**
5
- * Unique identifier for the tab
6
- */
4
+ /** Unique identifier for the tab */
7
5
  id: string;
8
- /**
9
- * Display label for the tab
10
- */
6
+ /** Display label for the tab */
11
7
  label: string;
12
- /**
13
- * Whether the tab is disabled
14
- */
8
+ /** Whether the tab is disabled */
15
9
  disabled?: boolean;
16
10
  }
17
11
  export interface TabsProps {
18
- /**
19
- * Array of tab items to display
20
- */
12
+ /** Array of tab items to display */
21
13
  tabs: TabItem[];
22
- /**
23
- * The variant determines the tab styling
24
- */
14
+ /** The variant determines the tab styling */
25
15
  variant?: 'underline' | 'pills';
26
- /**
27
- * The size of the tabs
28
- */
29
- size?: 'small' | 'medium' | 'large';
30
- /**
31
- * Currently active tab ID (controlled mode)
32
- */
16
+ /** The size of the tabs */
17
+ size?: 'sm' | 'md' | 'lg' | 'small' | 'medium' | 'large';
18
+ /** Currently active tab ID (controlled mode) */
33
19
  activeTab?: string;
34
- /**
35
- * Default active tab ID (uncontrolled mode)
36
- */
20
+ /** Default active tab ID (uncontrolled mode) */
37
21
  defaultActiveTab?: string;
38
- /**
39
- * Callback when active tab changes.
40
- * Receives the new tab ID and the previous tab ID,
41
- * enabling agents to observe navigation transitions.
42
- */
22
+ /** Callback when active tab changes */
43
23
  onTabChange?: (tabId: string, previousTabId: string) => void;
44
- /**
45
- * Optional CSS class name
46
- */
24
+ /** Optional CSS class name */
47
25
  className?: string;
48
- /**
49
- * Accessible label for the tab list
50
- */
26
+ /** Accessible label for the tab list */
51
27
  'aria-label'?: string;
52
28
  }
53
29
  /**
54
- * DOS-styled Tabs component for navigation and content switching
55
- *
56
- * Features:
57
- * - Two variants: underline (minimal) and pills (contained)
58
- * - Three sizes (small, medium, large)
59
- * - Controlled and uncontrolled modes
60
- * - Full keyboard navigation (Arrow keys, Home, End)
61
- * - DOS-authentic styling with CGA colors
62
- * - WCAG 2.1 AA compliant
30
+ * DOS-styled Tabs with React Aria keyboard navigation and phosphor indicator.
31
+ * React Aria handles arrow keys, Home, End, roving tabindex, and ARIA roles.
63
32
  */
64
33
  export declare const Tabs: React.FC<TabsProps>;
@@ -5,11 +5,11 @@ export interface TagProps {
5
5
  children: React.ReactNode;
6
6
  /** Visual variant */
7
7
  variant?: 'default' | 'outlined' | 'filled';
8
- /** The size of the tag */
9
- size?: 'small' | 'medium';
10
- /** CGA color token for border and text (e.g. '--color-cga-bright-cyan') */
8
+ /** Size */
9
+ size?: 'sm' | 'md' | 'lg' | 'small' | 'medium';
10
+ /** CGA color token for border and text */
11
11
  color?: string;
12
- /** Whether the tag appears in selected/active state */
12
+ /** Whether the tag is selected/active */
13
13
  selected?: boolean;
14
14
  /** Whether to show a close button */
15
15
  closeable?: boolean;
@@ -17,25 +17,15 @@ export interface TagProps {
17
17
  disabled?: boolean;
18
18
  /** Click handler for the tag body */
19
19
  onClick?: (event: React.MouseEvent<HTMLElement>) => void;
20
- /** Close handler, called after dismiss animation completes */
20
+ /** Close handler, called after dismiss animation */
21
21
  onClose?: () => void;
22
22
  /** Additional CSS class name */
23
23
  className?: string;
24
- /** Accessible label for the tag */
24
+ /** Accessible label */
25
25
  'aria-label'?: string;
26
26
  }
27
27
  /**
28
- * DOS-styled Tag component for interactive labels
29
- *
30
- * Extends Badge's display-only approach with click, close, and selection
31
- * behaviors. Use for content labels, category indicators, and filter chips.
32
- *
33
- * Features:
34
- * - Three visual variants (default, outlined, filled)
35
- * - Optional close button with DOS-authentic [x]
36
- * - Toggle-able selected state
37
- * - Custom CGA color support via CSS custom property
38
- * - Keyboard accessible (Enter/Space to click, Delete/Backspace to close)
39
- * - WCAG 2.1 AA compliant
28
+ * DOS-styled Tag for interactive labels with click, close, and selection.
29
+ * Extends Badge with interaction behaviors. Uses useAnimatedDismiss for phosphor exit.
40
30
  */
41
31
  export declare const Tag: React.FC<TagProps>;
@@ -14,7 +14,7 @@ export interface TimelineContainerProps extends React.HTMLAttributes<HTMLDivElem
14
14
  mode?: 'interactive' | 'static';
15
15
  /**
16
16
  * Controlled zoom level — overrides internal state when provided.
17
- * Use with `onZoomChange` for full control.
17
+ * Use with `onZoomChange` for full control. Disables drill-down navigation.
18
18
  */
19
19
  zoomLevel?: ZoomLevel;
20
20
  /**
@@ -56,9 +56,10 @@ export interface TimelineContainerProps extends React.HTMLAttributes<HTMLDivElem
56
56
  * TimelineContainer - Interactive multi-level zoom timeline
57
57
  *
58
58
  * A composite timeline component with 4 zoom levels (year, month, day, hour),
59
- * entry selection, keyboard shortcuts, and scroll-to-zoom. Uses DOS/CGA
60
- * aesthetic with eidotter primitives (TimelineNode, Card, Badge, Tag).
59
+ * entry selection, keyboard shortcuts, scroll-to-zoom, and drill-down navigation.
60
+ * Uses DOS/CGA aesthetic with eidotter primitives.
61
61
  *
62
62
  * Supports both controlled and uncontrolled patterns for zoom and selection.
63
+ * When zoom is uncontrolled, clicking a bucket drills down into that time period.
63
64
  */
64
65
  export declare const TimelineContainer: React.FC<TimelineContainerProps>;
@@ -1,16 +1,20 @@
1
1
  import React from 'react';
2
2
  import type { TimelineEntryData } from './types';
3
- import '../../TimelineEntry/components/TimelineEntry.css';
3
+ import './TimelineEntryCard.css';
4
4
  export interface TimelineEntryCardProps {
5
5
  entry: TimelineEntryData;
6
6
  isSelected: boolean;
7
+ isExpanded?: boolean;
7
8
  onSelect?: (id: string) => void;
8
9
  footer?: React.ReactNode;
9
- children: React.ReactNode;
10
+ children?: React.ReactNode;
10
11
  }
11
12
  /**
12
- * Selectable entry card for TimelineContainer views.
13
- * Uses TimelineEntry's card CSS for visual consistency with static timelines.
14
- * Adds selection behavior (aria-pressed, glow variant on select).
13
+ * Selectable, expandable entry card for TimelineContainer views.
14
+ *
15
+ * Uses trigger+panel structure: the button handles click-to-toggle,
16
+ * the body is a sibling region (not nested inside the button).
17
+ * This prevents invalid HTML when expanded ReactNode content
18
+ * contains interactive elements (links, buttons).
15
19
  */
16
20
  export declare const TimelineEntryCard: React.NamedExoticComponent<TimelineEntryCardProps>;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import type { DrillDownEntry } from './useDrillDown';
2
3
  import type { ZoomLevel } from './types';
3
4
  import './ZoomControls.css';
4
5
  export interface ZoomControlsProps {
@@ -8,5 +9,7 @@ export interface ZoomControlsProps {
8
9
  onZoomIn: () => void;
9
10
  onZoomOut: () => void;
10
11
  onReset: () => void;
12
+ breadcrumbs?: readonly DrillDownEntry[];
13
+ onBreadcrumbClick?: (index: number) => void;
11
14
  }
12
15
  export declare const ZoomControls: React.FC<ZoomControlsProps>;
@@ -2,3 +2,4 @@ export { TimelineContainer } from './TimelineContainer';
2
2
  export type { TimelineContainerProps } from './TimelineContainer';
3
3
  export { ZOOM_LEVELS } from './types';
4
4
  export type { TimelineEntry, TimelineEntryData, DateBucket, ZoomLevel } from './types';
5
+ export type { DrillDownEntry, UseDrillDownReturn } from './useDrillDown';
@@ -5,6 +5,17 @@
5
5
  import type { TimelineEntry, DateBucket, ZoomLevel } from './types';
6
6
  /** Format a full timestamp: "Mar 15, 2024 at 2:30pm" */
7
7
  export declare function formatTimestamp(iso: string): string;
8
+ /**
9
+ * Filter buckets to only those within a drilled-into period.
10
+ * Uses ISO string prefix matching: a year prefix "2024" matches
11
+ * any periodStart starting with "2024", etc.
12
+ *
13
+ * @param buckets - All buckets at the current zoom level
14
+ * @param periodStart - The parent period's periodStart, or null for no filter
15
+ * @param parentZoomLevel - The zoom level of the parent period
16
+ * @returns Filtered buckets (or all buckets if no filter applies)
17
+ */
18
+ export declare function filterBucketsByPeriod(buckets: readonly DateBucket[], periodStart: string | null, parentZoomLevel: ZoomLevel): readonly DateBucket[];
8
19
  /**
9
20
  * Group timeline entries into DateBuckets based on the current zoom level.
10
21
  */
@@ -0,0 +1,42 @@
1
+ import type { ZoomLevel } from './types';
2
+ export interface DrillDownEntry {
3
+ /** ISO period start for this drill-down level */
4
+ periodStart: string;
5
+ /** Human-readable label for breadcrumb display */
6
+ label: string;
7
+ }
8
+ export interface UseDrillDownOptions {
9
+ /** Controlled zoom level (from parent). When provided, drill-down is disabled. */
10
+ zoomLevel?: ZoomLevel;
11
+ /** Default zoom level for uncontrolled mode */
12
+ defaultZoomLevel?: ZoomLevel;
13
+ /** Callback when zoom level changes */
14
+ onZoomChange?: (level: ZoomLevel) => void;
15
+ }
16
+ export interface UseDrillDownReturn {
17
+ /** Current zoom level */
18
+ zoomLevel: ZoomLevel;
19
+ /** Whether zooming in further is possible */
20
+ canZoomIn: boolean;
21
+ /** Whether zooming out further is possible */
22
+ canZoomOut: boolean;
23
+ /** Breadcrumb stack of drill-down entries */
24
+ breadcrumbs: readonly DrillDownEntry[];
25
+ /** Current drilled-into period start, or null if at root */
26
+ currentPeriod: string | null;
27
+ /** Whether drill-down navigation is active (false when zoom is controlled) */
28
+ isDrillDownEnabled: boolean;
29
+ /** Drill into a specific period */
30
+ drillDown: (periodStart: string, label: string) => void;
31
+ /** Go up one level in the drill-down stack */
32
+ drillUp: () => void;
33
+ /** Reset to root level (year) and clear breadcrumbs */
34
+ reset: () => void;
35
+ }
36
+ /**
37
+ * Manages drill-down navigation with a breadcrumb stack.
38
+ * When zoom is uncontrolled, maintains its own zoom state so that
39
+ * reset() can go directly to 'year' (the outermost level).
40
+ * When zoom is controlled externally, drill-down is disabled.
41
+ */
42
+ export declare function useDrillDown({ zoomLevel: controlledLevel, defaultZoomLevel, onZoomChange, }?: UseDrillDownOptions): UseDrillDownReturn;