@ankhorage/zora 28.8.3 → 28.10.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/capabilities/index.js +133 -5
  4. package/dist/capabilities/index.js.map +8 -7
  5. package/dist/constants/authoring.d.ts +4 -3
  6. package/dist/constants/authoring.d.ts.map +1 -1
  7. package/dist/constants/authoring.js +3 -0
  8. package/dist/constants/authoring.js.map +1 -1
  9. package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
  10. package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
  11. package/dist/features/calendar/adapters/inbound/Calendar.d.ts +1 -1
  12. package/dist/features/calendar/adapters/inbound/Calendar.d.ts.map +1 -1
  13. package/dist/features/calendar/adapters/inbound/Calendar.js +207 -75
  14. package/dist/features/calendar/adapters/inbound/Calendar.js.map +1 -1
  15. package/dist/features/calendar/calendarMeta.d.ts +106 -4
  16. package/dist/features/calendar/calendarMeta.d.ts.map +1 -1
  17. package/dist/features/calendar/calendarMeta.js +44 -4
  18. package/dist/features/calendar/calendarMeta.js.map +1 -1
  19. package/dist/features/calendar/public.d.ts +1 -1
  20. package/dist/features/calendar/public.d.ts.map +1 -1
  21. package/dist/features/calendar/public.js.map +1 -1
  22. package/dist/features/card/cardMeta.d.ts +1 -1
  23. package/dist/features/card/mediaCardMeta.d.ts +1 -1
  24. package/dist/features/card/postCardMeta.d.ts +1 -1
  25. package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
  26. package/dist/features/data-table/dataTableMeta.d.ts +10 -0
  27. package/dist/features/data-table/dataTableMeta.d.ts.map +1 -1
  28. package/dist/features/data-table/dataTableMeta.js +7 -0
  29. package/dist/features/data-table/dataTableMeta.js.map +1 -1
  30. package/dist/features/dialog/dialogMeta.d.ts +2 -2
  31. package/dist/features/gradient/gradientMeta.d.ts +1 -1
  32. package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
  33. package/dist/features/layout/gridMeta.d.ts +1 -1
  34. package/dist/features/layout/screenMeta.d.ts +1 -1
  35. package/dist/features/layout/scrollViewMeta.d.ts +1 -1
  36. package/dist/features/layout/viewMeta.d.ts +1 -1
  37. package/dist/features/list/flatListMeta.d.ts +1 -1
  38. package/dist/features/list/sectionListMeta.d.ts +1 -1
  39. package/dist/features/master-detail/masterDetailMeta.d.ts +1 -1
  40. package/dist/features/popover/adapters/inbound/Popover.js +6 -3
  41. package/dist/features/popover/adapters/inbound/Popover.js.map +1 -1
  42. package/dist/features/popover/popoverMeta.d.ts +101 -0
  43. package/dist/features/popover/popoverMeta.d.ts.map +1 -0
  44. package/dist/features/popover/popoverMeta.js +78 -0
  45. package/dist/features/popover/popoverMeta.js.map +1 -0
  46. package/dist/features/reader/meta.d.ts +2 -2
  47. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts.map +1 -1
  48. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js +2 -0
  49. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js.map +1 -1
  50. package/dist/features/registry/bindableComponentMeta.d.ts +2 -2
  51. package/dist/features/registry/componentMeta.d.ts.map +1 -1
  52. package/dist/features/registry/componentMeta.js +2 -0
  53. package/dist/features/registry/componentMeta.js.map +1 -1
  54. package/dist/features/scanner/meta.d.ts +2 -2
  55. package/dist/features/section/screenSectionMeta.d.ts +1 -1
  56. package/dist/features/surface/surfaceMeta.d.ts +1 -1
  57. package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
  58. package/dist/readerFree.d.ts +1 -0
  59. package/dist/readerFree.d.ts.map +1 -1
  60. package/dist/readerFree.js +1 -0
  61. package/dist/readerFree.js.map +1 -1
  62. package/dist/types/calendar.d.ts +40 -19
  63. package/dist/types/calendar.d.ts.map +1 -1
  64. package/dist/types/calendar.js.map +1 -1
  65. package/dist/types/popover.d.ts +4 -1
  66. package/dist/types/popover.d.ts.map +1 -1
  67. package/dist/types/popover.js.map +1 -1
  68. package/package.json +102 -1
  69. package/src/constants/authoring.ts +3 -0
  70. package/src/features/calendar/adapters/inbound/Calendar.interaction.test.tsx +95 -0
  71. package/src/features/calendar/adapters/inbound/Calendar.tsx +425 -135
  72. package/src/features/calendar/calendarMeta.ts +44 -4
  73. package/src/features/calendar/public.test.ts +8 -5
  74. package/src/features/calendar/public.ts +4 -0
  75. package/src/features/data-table/adapters/inbound/DataTable.test.tsx +52 -1
  76. package/src/features/data-table/dataTableMeta.test.ts +8 -1
  77. package/src/features/data-table/dataTableMeta.ts +7 -0
  78. package/src/features/popover/adapters/inbound/Popover.tsx +17 -2
  79. package/src/features/popover/manifest.test.tsx +153 -0
  80. package/src/features/popover/popoverMeta.ts +79 -0
  81. package/src/features/popover/public.test.ts +2 -1
  82. package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +2 -0
  83. package/src/features/registry/componentMeta.test.ts +2 -0
  84. package/src/features/registry/componentMeta.ts +2 -0
  85. package/src/features/registry/featureManifest.test.ts +11 -0
  86. package/src/readerFree.ts +6 -0
  87. package/src/types/calendar.ts +44 -19
  88. package/src/types/popover.ts +5 -1
  89. package/src/webPackageExports.test.ts +1 -0
  90. package/web-dist/chunks/Accordion-59x6e7bs.js +200 -0
  91. package/web-dist/chunks/Accordion-q2yxtdzc.js +426 -0
  92. package/web-dist/components/calendar/Calendar.d.ts +2 -2
  93. package/web-dist/components/calendar/Calendar.dependency-2.d.ts +165 -0
  94. package/web-dist/components/calendar/Calendar.js +2 -1
  95. package/web-dist/components/calendar/Calendar.types-0.d.ts +45 -19
  96. package/web-dist/components/calendar/index.d.ts +1 -1
  97. package/web-dist/components/date-picker/DatePicker.js +2 -1
  98. package/web-dist/components/popover/Popover.js +10 -2
  99. package/web-dist/components/popover/Popover.types-0.d.ts +4 -1
  100. package/web-dist/components/time-grid/TimeGrid.js +4 -198
  101. package/web-dist/manifest.json +6 -2
  102. package/web-dist/chunks/Accordion-v3bmbnfh.js +0 -237
@@ -0,0 +1,165 @@
1
+ /** A calendar date without a time or timezone, represented as `YYYY-MM-DD`. */
2
+ export type TemporalDate = `${number}-${number}-${number}`;
3
+
4
+ /** A UTC ISO-8601 instant, represented as an RFC 3339 string ending in `Z`. */
5
+ export type TemporalInstant = `${string}Z`;
6
+
7
+ /** An IANA timezone identifier such as `Europe/Zurich`. */
8
+ export type TemporalTimeZone = string;
9
+
10
+ /** An ISO-8601 duration string such as `PT30M` or `-PT15M`. */
11
+ export type TemporalDuration = string;
12
+
13
+ /**
14
+ * This contract describes serializable shape, not runtime validation. Consumers must validate
15
+ * RFC 3339 instants, ISO calendar dates and durations, IANA zone identifiers, positive non-zero
16
+ * intervals, ordered ranges, and finite JSON numbers at their input boundary.
17
+ */
18
+ export type TemporalDataValue = boolean | null | number | string | readonly TemporalDataValue[] | {
19
+ readonly [key: string]: TemporalDataValue;
20
+ };
21
+
22
+ /**
23
+ * A timed interval with exactly one exclusive end. Recurring timed events retain the local
24
+ * wall-clock time derived from `start` in `timeZone` across DST transitions; a recurrence engine
25
+ * materializes each occurrence as its corresponding UTC instant.
26
+ */
27
+ export type TemporalTimedRange = {
28
+ readonly allDay: false;
29
+ readonly start: TemporalInstant;
30
+ readonly end: TemporalInstant;
31
+ readonly duration?: never;
32
+ readonly timeZone: TemporalTimeZone;
33
+ } | {
34
+ readonly allDay: false;
35
+ readonly start: TemporalInstant;
36
+ readonly end?: never;
37
+ readonly duration: TemporalDuration;
38
+ readonly timeZone: TemporalTimeZone;
39
+ };
40
+
41
+ /**
42
+ * A timezone-free all-day calendar-date interval with exactly one exclusive end. `end` is the
43
+ * first day not included, so a one-day event from `2026-10-24` ends on `2026-10-25`.
44
+ */
45
+ export type TemporalAllDayRange = {
46
+ readonly allDay: true;
47
+ readonly start: TemporalDate;
48
+ readonly end: TemporalDate;
49
+ readonly duration?: never;
50
+ } | {
51
+ readonly allDay: true;
52
+ readonly start: TemporalDate;
53
+ readonly end?: never;
54
+ readonly duration: TemporalDuration;
55
+ };
56
+
57
+ /** A timed or all-day interval with exactly one way to define its exclusive end. */
58
+ export type TemporalRange = TemporalAllDayRange | TemporalTimedRange;
59
+
60
+ /** The availability an event contributes without disclosing its details. */
61
+ export type TemporalAvailability = 'free' | 'busy' | 'tentative' | 'unavailable';
62
+
63
+ /** A provider-neutral lifecycle state for a scheduled event. */
64
+ export type TemporalEventStatus = 'cancelled' | 'confirmed' | 'draft' | 'tentative';
65
+
66
+ /** A semantic theme treatment that later ZORA renderers resolve through their active theme. */
67
+ export type TemporalTone = 'accent' | 'critical' | 'info' | 'neutral' | 'positive' | 'warning';
68
+
69
+ /** A person or organization participating in an event without provider-specific identity objects. */
70
+ export interface TemporalParticipant {
71
+ readonly id?: string;
72
+ readonly name?: string;
73
+ readonly email?: string;
74
+ readonly role?: 'optional' | 'organizer' | 'required' | 'resource';
75
+ readonly response?: 'accepted' | 'declined' | 'delegated' | 'needs-action' | 'tentative';
76
+ }
77
+
78
+ /**
79
+ * A reminder relative to the event start or exclusive end. A negative ISO duration fires before
80
+ * that reference point; a positive duration fires after it.
81
+ */
82
+ export interface TemporalReminder {
83
+ readonly id: string;
84
+ readonly offset: TemporalDuration;
85
+ readonly reference: 'end' | 'start';
86
+ readonly channel?: 'display' | 'email' | 'push';
87
+ }
88
+
89
+ /**
90
+ * One normalized recurrence rule. `until` has the same value type as DTSTART: a date for all-day
91
+ * series and a UTC instant for timed series. Adapter layers map this to and from RFC 5545 RRULE.
92
+ */
93
+ export interface TemporalRecurrenceRule<TValue extends TemporalDate | TemporalInstant> {
94
+ readonly frequency: 'daily' | 'monthly' | 'weekly' | 'yearly';
95
+ readonly interval?: number;
96
+ readonly count?: number;
97
+ readonly until?: TValue;
98
+ readonly weekdays?: readonly ('friday' | 'monday' | 'saturday' | 'sunday' | 'thursday' | 'tuesday' | 'wednesday')[];
99
+ readonly monthDays?: readonly number[];
100
+ readonly months?: readonly number[];
101
+ }
102
+
103
+ /**
104
+ * Recurrence data retained independently from provider-specific series representations. `dates`
105
+ * and `excludedDates` correspond to RFC 5545 RDATE and EXDATE and use the DTSTART value type.
106
+ */
107
+ export interface TemporalRecurrence<TValue extends TemporalDate | TemporalInstant> {
108
+ readonly rules: readonly TemporalRecurrenceRule<TValue>[];
109
+ readonly dates?: readonly TValue[];
110
+ readonly excludedDates?: readonly TValue[];
111
+ }
112
+
113
+ /**
114
+ * A detached occurrence that replaces or cancels one generated recurrence instance. `recurrenceId`
115
+ * is the original scheduled DTSTART value: for timed DST series, the UTC instant materialized from
116
+ * that occurrence's wall-clock time in the series timezone; for all-day series, its calendar date.
117
+ */
118
+ export interface TemporalRecurrenceException<TValue extends TemporalDate | TemporalInstant, TRange extends TemporalRange> {
119
+ readonly recurrenceId: TValue;
120
+ readonly status: 'cancelled' | 'replacement';
121
+ readonly range?: TRange;
122
+ readonly title?: string;
123
+ }
124
+
125
+ /** Lossless serialized data that an interoperability adapter must round-trip without exposing its runtime. */
126
+ export interface TemporalInteroperabilityData {
127
+ readonly format: 'icalendar' | 'jcal' | 'provider';
128
+ readonly value: TemporalDataValue;
129
+ }
130
+
131
+ interface TemporalEventBase {
132
+ readonly id: string;
133
+ readonly title: string;
134
+ readonly description?: string;
135
+ readonly location?: string;
136
+ readonly conferenceUrl?: string;
137
+ readonly calendarId?: string;
138
+ readonly tone?: TemporalTone;
139
+ readonly availability?: TemporalAvailability;
140
+ readonly status?: TemporalEventStatus;
141
+ readonly resourceIds?: readonly string[];
142
+ readonly organizer?: TemporalParticipant;
143
+ readonly attendees?: readonly TemporalParticipant[];
144
+ readonly reminders?: readonly TemporalReminder[];
145
+ readonly editable?: boolean;
146
+ readonly metadata?: Readonly<Record<string, TemporalDataValue>>;
147
+ readonly interoperability?: readonly TemporalInteroperabilityData[];
148
+ }
149
+
150
+ /** A provider-neutral timed event with instant-based recurrence values. */
151
+ export interface TemporalTimedEvent extends TemporalEventBase {
152
+ readonly range: TemporalTimedRange;
153
+ readonly recurrence?: TemporalRecurrence<TemporalInstant>;
154
+ readonly recurrenceExceptions?: readonly TemporalRecurrenceException<TemporalInstant, TemporalTimedRange>[];
155
+ }
156
+
157
+ /** A provider-neutral all-day event with date-based recurrence values. */
158
+ export interface TemporalAllDayEvent extends TemporalEventBase {
159
+ readonly range: TemporalAllDayRange;
160
+ readonly recurrence?: TemporalRecurrence<TemporalDate>;
161
+ readonly recurrenceExceptions?: readonly TemporalRecurrenceException<TemporalDate, TemporalAllDayRange>[];
162
+ }
163
+
164
+ /** Provider-neutral, serializable event data shared by future Calendar and Scheduler presentations. */
165
+ export type TemporalEvent = TemporalAllDayEvent | TemporalTimedEvent;
@@ -6,10 +6,11 @@ import"../../chunks/Accordion-fkftnxgw.js";
6
6
  import"../../chunks/Accordion-e6ettgh0.js";
7
7
  import"../../chunks/Accordion-k9n1yse4.js";
8
8
  import"../../chunks/Accordion-0zk0xp73.js";
9
+ import"../../chunks/Accordion-59x6e7bs.js";
9
10
  import"../../chunks/Accordion-6gc0jw1n.js";
10
11
  import {
11
12
  Calendar2
12
- } from "../../chunks/Accordion-v3bmbnfh.js";
13
+ } from "../../chunks/Accordion-q2yxtdzc.js";
13
14
  export {
14
15
  Calendar2 as Calendar
15
16
  };
@@ -1,27 +1,53 @@
1
1
  import type { ZoraBaseProps } from './Calendar.dependency-0.js';
2
2
 
3
+ import type { TemporalDate, TemporalEvent, TemporalTimeZone } from './Calendar.dependency-2.js';
4
+
3
5
  export type CalendarDensity = 'regular' | 'compact';
4
6
 
5
- export type CalendarView = 'month';
7
+ export type CalendarView = 'day' | 'month' | 'week';
6
8
 
7
9
  export type CalendarWeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
8
10
 
9
- /** Public Calendar state uses local calendar dates, never UTC instants. */
10
- export interface CalendarProps extends ZoraBaseProps {
11
- /** The only currently implemented Calendar presentation. */
12
- view?: CalendarView;
13
- density?: CalendarDensity;
14
- /** A local date within the controlled month to display. */
15
- displayedMonth?: Date;
16
- /** Initial local month when displayedMonth is not controlled. */
17
- defaultDisplayedMonth?: Date;
18
- onDisplayedMonthChange?: (month: Date) => void;
19
- selectedDate?: Date | null;
20
- onSelectedDateChange?: (date: Date) => void;
21
- locale?: string;
22
- weekStartsOn?: CalendarWeekStart;
23
- minDate?: Date;
24
- maxDate?: Date;
25
- disabledDates?: readonly Date[];
26
- isDateDisabled?: (date: Date) => boolean;
11
+ /** Serializable payload for a controlled Calendar date. */
12
+ export interface CalendarDateChangeEvent {
13
+ readonly date: TemporalDate;
14
+ }
15
+
16
+ /** Serializable payload for a controlled Calendar view. */
17
+ export interface CalendarViewChangeEvent {
18
+ readonly view: CalendarView;
19
+ }
20
+
21
+ /** Serializable payload emitted when an event is activated. */
22
+ export interface CalendarEventActivateEvent {
23
+ readonly eventId: string;
24
+ }
25
+
26
+ /** Serializable props accepted by a direct Calendar manifest node. */
27
+ export interface CalendarManifestProps {
28
+ readonly view?: CalendarView;
29
+ readonly displayedDate?: TemporalDate;
30
+ readonly defaultDisplayedDate?: TemporalDate;
31
+ readonly events?: readonly TemporalEvent[];
32
+ readonly timeZone?: TemporalTimeZone;
33
+ readonly locale?: string;
34
+ readonly weekStartsOn?: CalendarWeekStart;
35
+ readonly density?: CalendarDensity;
36
+ }
37
+
38
+ /** Code API retaining DatePicker's local-Date compatibility alongside manifest data. */
39
+ export interface CalendarProps extends ZoraBaseProps, CalendarManifestProps {
40
+ readonly displayedMonth?: Date;
41
+ readonly defaultDisplayedMonth?: Date;
42
+ readonly onDisplayedMonthChange?: (month: Date) => void;
43
+ readonly selectedDate?: Date | null;
44
+ readonly onSelectedDateChange?: (date: Date) => void;
45
+ readonly onDateChange?: (event: CalendarDateChangeEvent) => void;
46
+ readonly defaultView?: CalendarView;
47
+ readonly onViewChange?: (event: CalendarViewChangeEvent) => void;
48
+ readonly onEventActivate?: (event: CalendarEventActivateEvent) => void;
49
+ readonly minDate?: Date;
50
+ readonly maxDate?: Date;
51
+ readonly disabledDates?: readonly Date[];
52
+ readonly isDateDisabled?: (date: Date) => boolean;
27
53
  }
@@ -1,2 +1,2 @@
1
1
  export { Calendar } from './Calendar.js';
2
- export type { CalendarDensity, CalendarProps, CalendarView, CalendarWeekStart, TemporalAllDayEvent, TemporalAllDayRange, TemporalAvailability, TemporalDataValue, TemporalDate, TemporalDuration, TemporalEvent, TemporalEventStatus, TemporalInstant, TemporalInteroperabilityData, TemporalParticipant, TemporalRange, TemporalRecurrence, TemporalRecurrenceException, TemporalRecurrenceRule, TemporalReminder, TemporalTimedEvent, TemporalTimedRange, TemporalTimeZone, TemporalTone } from './Calendar.js';
2
+ export type { CalendarDateChangeEvent, CalendarDensity, CalendarEventActivateEvent, CalendarManifestProps, CalendarProps, CalendarView, CalendarViewChangeEvent, CalendarWeekStart, TemporalAllDayEvent, TemporalAllDayRange, TemporalAvailability, TemporalDataValue, TemporalDate, TemporalDuration, TemporalEvent, TemporalEventStatus, TemporalInstant, TemporalInteroperabilityData, TemporalParticipant, TemporalRange, TemporalRecurrence, TemporalRecurrenceException, TemporalRecurrenceRule, TemporalReminder, TemporalTimedEvent, TemporalTimedRange, TemporalTimeZone, TemporalTone } from './Calendar.js';
@@ -15,10 +15,11 @@ import {
15
15
  View2
16
16
  } from "../../chunks/Accordion-k9n1yse4.js";
17
17
  import"../../chunks/Accordion-0zk0xp73.js";
18
+ import"../../chunks/Accordion-59x6e7bs.js";
18
19
  import"../../chunks/Accordion-6gc0jw1n.js";
19
20
  import {
20
21
  Calendar2
21
- } from "../../chunks/Accordion-v3bmbnfh.js";
22
+ } from "../../chunks/Accordion-q2yxtdzc.js";
22
23
  import {
23
24
  PickerHeader,
24
25
  PickerField
@@ -5,17 +5,25 @@ import {
5
5
  } from "../../chunks/Accordion-zhgty1ae.js";
6
6
 
7
7
  // src/features/popover/adapters/inbound/Popover.tsx
8
- import { Popover as SurfacePopover } from "@ankhorage/surface/web";
8
+ import { Button as SurfaceButton, Popover as SurfacePopover } from "@ankhorage/surface/web";
9
9
  import { jsx } from "react/jsx-runtime";
10
10
  var Popover = withZoraThemeScope(PopoverInner);
11
11
  function PopoverInner({
12
12
  inverted: _inverted,
13
13
  mode: _mode,
14
14
  themeId: _themeId,
15
+ anchor,
16
+ disabled,
17
+ triggerLabel,
15
18
  ...props
16
19
  }) {
17
20
  return /* @__PURE__ */ jsx(SurfacePopover, {
18
- ...props
21
+ ...props,
22
+ anchor: anchor ?? (({ toggle }) => /* @__PURE__ */ jsx(SurfaceButton, {
23
+ disabled,
24
+ onPress: toggle,
25
+ children: triggerLabel
26
+ }))
19
27
  });
20
28
  }
21
29
  export {
@@ -6,5 +6,8 @@ export type PopoverAnchorRenderProps = SurfacePopoverAnchorRenderProps;
6
6
 
7
7
  export type PopoverPlacement = SurfacePopoverPlacement;
8
8
 
9
- export interface PopoverProps extends SurfacePopoverProps, ZoraBaseProps {
9
+ export interface PopoverProps extends Omit<SurfacePopoverProps, 'anchor'>, ZoraBaseProps {
10
+ anchor?: SurfacePopoverProps['anchor'];
11
+ disabled?: boolean;
12
+ triggerLabel?: string;
10
13
  }
@@ -1,202 +1,8 @@
1
1
  'use client';
2
+ import"../../chunks/Accordion-0zk0xp73.js";
2
3
  import {
3
- GridView2
4
- } from "../../chunks/Accordion-0zk0xp73.js";
5
- import {
6
- getLaneIntervalPlacement,
7
- getVisibleLaneIntervals
8
- } from "../../chunks/Accordion-tnyqv1xv.js";
9
-
10
- // src/features/time-grid/adapters/inbound/TimeGrid.tsx
11
- import React from "react";
12
- import { Pressable, View } from "react-native-web";
13
-
14
- // src/features/time-grid/application/resolveTimeGridNextFocusId.ts
15
- function resolveTimeGridNextFocusId(placements, focusedId, direction) {
16
- const focused = placements.find((placement) => placement.id === focusedId);
17
- if (!focused)
18
- return;
19
- const candidates = placements.filter((placement) => {
20
- if (direction === "left")
21
- return placement.laneId === focused.laneId && placement.x < focused.x;
22
- if (direction === "right")
23
- return placement.laneId === focused.laneId && placement.x > focused.x;
24
- if (direction === "up")
25
- return placement.laneIndex < focused.laneIndex;
26
- return placement.laneIndex > focused.laneIndex;
27
- });
28
- return candidates.sort((first, second) => resolveFocusDistance(first, focused, direction) - resolveFocusDistance(second, focused, direction)).at(0)?.id;
29
- }
30
- function resolveFocusDistance(candidate, focused, direction) {
31
- const horizontal = direction === "left" || direction === "right";
32
- const primary = horizontal ? Math.abs(candidate.x - focused.x) : Math.abs(candidate.laneIndex - focused.laneIndex);
33
- const secondary = horizontal ? Math.abs(candidate.laneIndex - focused.laneIndex) : Math.abs(candidate.x - focused.x);
34
- return primary * 1e6 + secondary;
35
- }
36
-
37
- // src/features/time-grid/application/resolveTimeGridVisibleIntervals.ts
38
- function resolveTimeGridVisibleIntervals(lanes, intervals, viewport, overscanPixels) {
39
- return getVisibleLaneIntervals(lanes, intervals, viewport, overscanPixels);
40
- }
41
-
42
- // src/features/time-grid/adapters/inbound/TimeGridKeyboardProxy.web.tsx
43
- import { jsx } from "react/jsx-runtime";
44
- function TimeGridKeyboardProxy({ children, onKeyDown }) {
45
- return /* @__PURE__ */ jsx("div", {
46
- onKeyDown: (event) => {
47
- if (onKeyDown(event.key))
48
- event.preventDefault();
49
- },
50
- style: { display: "flex", flex: 1 },
51
- children
52
- });
53
- }
54
-
55
- // src/features/time-grid/adapters/inbound/TimeGrid.tsx
56
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
57
- function TimeGrid({
58
- contentWidth,
59
- focusedIntervalId,
60
- height,
61
- interactionPolicy,
62
- intervals,
63
- lanes,
64
- onFocusedIntervalIdChange,
65
- onIntervalPress,
66
- onViewportChange,
67
- onVisibleIntervalIdsChange,
68
- overscanPixels,
69
- renderInterval,
70
- renderLaneLabel,
71
- revealPaddingPixels,
72
- selectedIntervalIds = [],
73
- testID,
74
- width,
75
- zoom
76
- }) {
77
- const scale = Math.max(0.01, zoom ?? 1);
78
- const [scrollOffsets, setScrollOffsets] = React.useState(() => ({
79
- offsetX: 0,
80
- offsetY: 0
81
- }));
82
- const viewport = React.useMemo(() => ({
83
- ...scrollOffsets,
84
- height,
85
- pixelsPerUnitX: scale,
86
- pixelsPerUnitY: scale,
87
- width
88
- }), [height, scale, scrollOffsets, width]);
89
- const intervalById = React.useMemo(() => new Map(intervals.map((interval) => [interval.id, interval])), [intervals]);
90
- const selectedIds = React.useMemo(() => new Set(selectedIntervalIds), [selectedIntervalIds]);
91
- const contentHeight = React.useMemo(() => lanes.reduce((total, lane) => total + lane.height, 0), [lanes]);
92
- const visibleIntervals = React.useMemo(() => resolveTimeGridVisibleIntervals(lanes, intervals, viewport, overscanPixels), [intervals, lanes, overscanPixels, viewport]);
93
- const focusedPlacement = React.useMemo(() => {
94
- const focusedInterval = intervals.find((interval) => interval.id === focusedIntervalId);
95
- return focusedInterval ? getLaneIntervalPlacement(lanes, focusedInterval) : undefined;
96
- }, [focusedIntervalId, intervals, lanes]);
97
- const gridItems = React.useMemo(() => focusedPlacement && !visibleIntervals.some((interval) => interval.id === focusedPlacement.id) ? [...visibleIntervals, focusedPlacement] : visibleIntervals, [focusedPlacement, visibleIntervals]);
98
- const labelIntervals = React.useMemo(() => lanes.map((lane) => ({
99
- extent: contentWidth,
100
- id: `lane-label-${lane.id}`,
101
- laneId: lane.id,
102
- start: 0
103
- })), [contentWidth, lanes]);
104
- const visibleLabels = React.useMemo(() => resolveTimeGridVisibleIntervals(lanes, labelIntervals, viewport, overscanPixels), [labelIntervals, lanes, overscanPixels, viewport]);
105
- const handleViewportChange = React.useCallback((nextViewport) => {
106
- setScrollOffsets((current) => current.offsetX === nextViewport.offsetX && current.offsetY === nextViewport.offsetY ? current : { offsetX: nextViewport.offsetX, offsetY: nextViewport.offsetY });
107
- onViewportChange?.(nextViewport);
108
- }, [onViewportChange]);
109
- const resolveNextFocusId = React.useCallback((intervalId, direction) => {
110
- const allIntervals = resolveTimeGridVisibleIntervals(lanes, intervals, {
111
- height: contentHeight,
112
- offsetX: 0,
113
- offsetY: 0,
114
- pixelsPerUnitX: 1,
115
- pixelsPerUnitY: 1,
116
- width: contentWidth
117
- });
118
- return resolveTimeGridNextFocusId(allIntervals, intervalId, direction);
119
- }, [contentHeight, contentWidth, intervals, lanes]);
120
- return /* @__PURE__ */ jsxs(View, {
121
- style: { flexDirection: "row", height, width },
122
- testID,
123
- children: [
124
- renderLaneLabel ? /* @__PURE__ */ jsx2(View, {
125
- accessibilityElementsHidden: true,
126
- pointerEvents: "none",
127
- style: { height, overflow: "hidden" },
128
- children: visibleLabels.map((placement) => {
129
- const lane = lanes[placement.laneIndex];
130
- if (!lane)
131
- return null;
132
- return /* @__PURE__ */ jsx2(View, {
133
- style: {
134
- height: placement.height * scale,
135
- position: "absolute",
136
- top: (placement.y - viewport.offsetY) * scale
137
- },
138
- testID: testID === undefined ? undefined : `${testID}-lane-label-${lane.id}`,
139
- children: renderLaneLabel(lane)
140
- }, lane.id);
141
- })
142
- }) : null,
143
- /* @__PURE__ */ jsx2(GridView2, {
144
- contentHeight,
145
- contentWidth,
146
- focusedItemId: focusedIntervalId,
147
- height,
148
- interactionPolicy,
149
- items: gridItems,
150
- onViewportChange: handleViewportChange,
151
- onVisibleItemIdsChange: onVisibleIntervalIdsChange,
152
- overscanPixels,
153
- renderItem: (placement) => {
154
- const interval = intervalById.get(placement.id);
155
- if (!interval)
156
- return null;
157
- const selected = selectedIds.has(interval.id);
158
- return /* @__PURE__ */ jsx2(TimeGridKeyboardProxy, {
159
- onKeyDown: (key) => {
160
- const direction = resolveKeyboardDirection(key);
161
- const nextId = direction === undefined ? undefined : resolveNextFocusId(interval.id, direction);
162
- if (!nextId)
163
- return false;
164
- onFocusedIntervalIdChange?.(nextId);
165
- return true;
166
- },
167
- children: /* @__PURE__ */ jsx2(Pressable, {
168
- accessibilityLabel: `Interval ${interval.id}`,
169
- accessibilityRole: "button",
170
- disabled: interactionPolicy === "passive",
171
- onPress: () => {
172
- onFocusedIntervalIdChange?.(interval.id);
173
- onIntervalPress?.(interval);
174
- },
175
- style: { flex: 1 },
176
- testID: testID === undefined ? undefined : `${testID}-interval-${interval.id}`,
177
- children: renderInterval(interval, selected)
178
- })
179
- });
180
- },
181
- revealPaddingPixels,
182
- testID: testID === undefined ? undefined : `${testID}-viewport`,
183
- width,
184
- zoom
185
- })
186
- ]
187
- });
188
- }
189
- function resolveKeyboardDirection(key) {
190
- if (key === "ArrowDown")
191
- return "down";
192
- if (key === "ArrowLeft")
193
- return "left";
194
- if (key === "ArrowRight")
195
- return "right";
196
- if (key === "ArrowUp")
197
- return "up";
198
- return;
199
- }
4
+ TimeGrid2
5
+ } from "../../chunks/Accordion-59x6e7bs.js";
200
6
  export {
201
- TimeGrid
7
+ TimeGrid2 as TimeGrid
202
8
  };
@@ -483,18 +483,20 @@
483
483
  "components/calendar/Calendar.d.ts",
484
484
  "components/calendar/Calendar.dependency-0.d.ts",
485
485
  "components/calendar/Calendar.dependency-1.d.ts",
486
+ "components/calendar/Calendar.dependency-2.d.ts",
486
487
  "components/calendar/Calendar.types-0.d.ts",
487
488
  "components/calendar/Calendar.types-1.d.ts",
488
489
  "components/calendar/index.js",
489
490
  "components/calendar/index.d.ts",
490
491
  "chunks/Accordion-0zk0xp73.js",
492
+ "chunks/Accordion-59x6e7bs.js",
491
493
  "chunks/Accordion-6gc0jw1n.js",
492
494
  "chunks/Accordion-e6ettgh0.js",
493
495
  "chunks/Accordion-e8tapf5a.js",
494
496
  "chunks/Accordion-fkftnxgw.js",
495
497
  "chunks/Accordion-k9n1yse4.js",
498
+ "chunks/Accordion-q2yxtdzc.js",
496
499
  "chunks/Accordion-tnyqv1xv.js",
497
- "chunks/Accordion-v3bmbnfh.js",
498
500
  "chunks/Accordion-x1ze1wvk.js",
499
501
  "chunks/Accordion-zhgty1ae.js"
500
502
  ],
@@ -1011,6 +1013,7 @@
1011
1013
  "components/date-picker/index.js",
1012
1014
  "components/date-picker/index.d.ts",
1013
1015
  "chunks/Accordion-0zk0xp73.js",
1016
+ "chunks/Accordion-59x6e7bs.js",
1014
1017
  "chunks/Accordion-6gc0jw1n.js",
1015
1018
  "chunks/Accordion-7pgh8q4h.js",
1016
1019
  "chunks/Accordion-e6ettgh0.js",
@@ -1018,8 +1021,8 @@
1018
1021
  "chunks/Accordion-fkftnxgw.js",
1019
1022
  "chunks/Accordion-k9n1yse4.js",
1020
1023
  "chunks/Accordion-pr1tv6jx.js",
1024
+ "chunks/Accordion-q2yxtdzc.js",
1021
1025
  "chunks/Accordion-tnyqv1xv.js",
1022
- "chunks/Accordion-v3bmbnfh.js",
1023
1026
  "chunks/Accordion-x1ze1wvk.js",
1024
1027
  "chunks/Accordion-zhgty1ae.js"
1025
1028
  ],
@@ -3143,6 +3146,7 @@
3143
3146
  "components/time-grid/index.js",
3144
3147
  "components/time-grid/index.d.ts",
3145
3148
  "chunks/Accordion-0zk0xp73.js",
3149
+ "chunks/Accordion-59x6e7bs.js",
3146
3150
  "chunks/Accordion-tnyqv1xv.js"
3147
3151
  ],
3148
3152
  "sourceKind": "public"