@zealakit/chrono-react 1.0.0-beta.1 → 1.0.0-beta.2

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 (163) hide show
  1. package/README.md +1 -0
  2. package/dist/calendar/components.d.ts +2 -2
  3. package/dist/calendar/components.js +10 -12
  4. package/dist/calendar/mini-calendar.js +6 -5
  5. package/dist/calendar/use-calendar.js +1 -3
  6. package/dist/calendar/use-mini-calendar.js +1 -1
  7. package/dist/date/bind-panel.js +1 -1
  8. package/dist/date/components.js +20 -29
  9. package/dist/date/utilities.d.ts +1 -1
  10. package/dist/date/utilities.js +1 -1
  11. package/dist/datetime/components.js +16 -21
  12. package/dist/datetime/use-datetime-panel.js +1 -1
  13. package/dist/shared/defined-options.d.ts +18 -0
  14. package/dist/shared/defined-options.js +9 -0
  15. package/dist/shared/merge-props.js +1 -3
  16. package/dist/shared/part.d.ts +1 -1
  17. package/dist/shared/slot.js +1 -4
  18. package/dist/shared/style-properties.js +1 -1
  19. package/dist/time/bind-panel.js +2 -2
  20. package/dist/time/components.d.ts +2 -2
  21. package/dist/time/components.js +16 -21
  22. package/dist/time/utilities.d.ts +1 -1
  23. package/dist/time/utilities.js +1 -1
  24. package/dist/vendor/core/calendar/availability.d.ts +2 -2
  25. package/dist/vendor/core/calendar/availability.js +4 -5
  26. package/dist/vendor/core/calendar/controllers/calendar-controller.js +93 -145
  27. package/dist/vendor/core/calendar/controllers/drag-engine.js +15 -34
  28. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.js +3 -2
  29. package/dist/vendor/core/calendar/controllers/shared.d.ts +9 -5
  30. package/dist/vendor/core/calendar/controllers/shared.js +8 -8
  31. package/dist/vendor/core/calendar/events/agenda-layout.js +4 -3
  32. package/dist/vendor/core/calendar/events/all-day-row.d.ts +1 -1
  33. package/dist/vendor/core/calendar/events/all-day-row.js +5 -5
  34. package/dist/vendor/core/calendar/events/background-layout.d.ts +1 -1
  35. package/dist/vendor/core/calendar/events/background-layout.js +6 -7
  36. package/dist/vendor/core/calendar/events/month-layout.js +6 -5
  37. package/dist/vendor/core/calendar/events/normalize.d.ts +2 -2
  38. package/dist/vendor/core/calendar/events/normalize.js +6 -9
  39. package/dist/vendor/core/calendar/events/now-indicator.d.ts +2 -2
  40. package/dist/vendor/core/calendar/events/time-grid-layout.d.ts +4 -4
  41. package/dist/vendor/core/calendar/events/time-grid-layout.js +8 -15
  42. package/dist/vendor/core/calendar/events/types.d.ts +2 -2
  43. package/dist/vendor/core/calendar/index.d.ts +11 -11
  44. package/dist/vendor/core/calendar/index.js +5 -5
  45. package/dist/vendor/core/calendar/interaction/auto-scroll.d.ts +1 -9
  46. package/dist/vendor/core/calendar/interaction/auto-scroll.js +12 -39
  47. package/dist/vendor/core/calendar/interaction/drag-geometry.js +2 -5
  48. package/dist/vendor/core/calendar/interaction/drag-keyboard.js +1 -4
  49. package/dist/vendor/core/calendar/interaction/drag-pointer.d.ts +5 -4
  50. package/dist/vendor/core/calendar/interaction/drag-pointer.js +33 -193
  51. package/dist/vendor/core/calendar/interaction/gesture-handle.d.ts +17 -0
  52. package/dist/vendor/core/calendar/interaction/gesture-handle.js +26 -0
  53. package/dist/vendor/core/calendar/interaction/pointer.d.ts +1 -1
  54. package/dist/vendor/core/calendar/interaction/pointer.js +65 -15
  55. package/dist/vendor/core/calendar/interaction/selection.d.ts +1 -1
  56. package/dist/vendor/core/calendar/navigation/navigate.d.ts +3 -3
  57. package/dist/vendor/core/calendar/navigation/navigate.js +1 -3
  58. package/dist/vendor/core/calendar/navigation/range.js +1 -1
  59. package/dist/vendor/core/calendar/navigation/view-definition.d.ts +1 -1
  60. package/dist/vendor/core/calendar/navigation/view-definition.js +2 -1
  61. package/dist/vendor/core/calendar/recurrence/apply.js +7 -8
  62. package/dist/vendor/core/calendar/recurrence/expand.d.ts +1 -1
  63. package/dist/vendor/core/calendar/recurrence/expand.js +14 -18
  64. package/dist/vendor/core/calendar/recurrence/pack.js +4 -7
  65. package/dist/vendor/core/calendar/recurrence/rrule.js +6 -16
  66. package/dist/vendor/core/calendar/recurrence/series.js +1 -3
  67. package/dist/vendor/core/calendar/recurrence/types.d.ts +1 -1
  68. package/dist/vendor/core/calendar/resources/resource-time-grid.js +1 -2
  69. package/dist/vendor/core/calendar/resources/timeline-layout.js +4 -6
  70. package/dist/vendor/core/calendar/resources/types.d.ts +7 -7
  71. package/dist/vendor/core/calendar/views/day.d.ts +5 -5
  72. package/dist/vendor/core/calendar/views/day.js +2 -5
  73. package/dist/vendor/core/calendar/views/mini-calendar.d.ts +8 -8
  74. package/dist/vendor/core/calendar/views/mini-calendar.js +1 -1
  75. package/dist/vendor/core/calendar/views/month-layout.d.ts +1 -1
  76. package/dist/vendor/core/calendar/views/month-layout.js +1 -1
  77. package/dist/vendor/core/calendar/views/time-grid-layout.js +1 -4
  78. package/dist/vendor/core/date/input/date-input-controller.d.ts +15 -15
  79. package/dist/vendor/core/date/input/date-input-controller.js +9 -21
  80. package/dist/vendor/core/date/input/date-range-input-controller.js +2 -5
  81. package/dist/vendor/core/date/input/parse.d.ts +2 -2
  82. package/dist/vendor/core/date/input/parse.js +3 -9
  83. package/dist/vendor/core/date/input/validity.js +1 -1
  84. package/dist/vendor/core/date/panel/panel-controller.d.ts +11 -11
  85. package/dist/vendor/core/date/panel/panel-controller.js +18 -40
  86. package/dist/vendor/core/date/presets.js +1 -2
  87. package/dist/vendor/core/date/selection/multiple.js +2 -5
  88. package/dist/vendor/core/date/selection/range.d.ts +2 -2
  89. package/dist/vendor/core/date/selection/range.js +2 -6
  90. package/dist/vendor/core/datetime/compose.d.ts +3 -3
  91. package/dist/vendor/core/datetime/constraints.d.ts +9 -9
  92. package/dist/vendor/core/datetime/input/datetime-input-controller.d.ts +2 -2
  93. package/dist/vendor/core/datetime/input/datetime-input-controller.js +12 -27
  94. package/dist/vendor/core/datetime/input/datetime-range-input-controller.js +5 -16
  95. package/dist/vendor/core/datetime/input/parse.d.ts +2 -2
  96. package/dist/vendor/core/datetime/input/parse.js +2 -5
  97. package/dist/vendor/core/datetime/panel/controller.js +4 -10
  98. package/dist/vendor/core/datetime/panel/range-controller.js +4 -16
  99. package/dist/vendor/core/datetime/zone/day-instants.js +1 -3
  100. package/dist/vendor/core/datetime/zone/resolve.js +2 -4
  101. package/dist/vendor/core/dom/auto-scroll.d.ts +37 -0
  102. package/dist/vendor/core/dom/auto-scroll.js +57 -0
  103. package/dist/vendor/core/dom/drag-session.d.ts +25 -0
  104. package/dist/vendor/core/dom/drag-session.js +257 -0
  105. package/dist/vendor/core/foundation/a11y/announcer.d.ts +9 -4
  106. package/dist/vendor/core/foundation/a11y/announcer.js +15 -27
  107. package/dist/vendor/core/foundation/a11y/grid-navigation.d.ts +2 -2
  108. package/dist/vendor/core/foundation/a11y/grid-navigation.js +2 -12
  109. package/dist/vendor/core/foundation/a11y/roving-focus.js +23 -2
  110. package/dist/vendor/core/foundation/constraints/availability-rules.js +2 -4
  111. package/dist/vendor/core/foundation/constraints/availability.d.ts +6 -6
  112. package/dist/vendor/core/foundation/constraints/availability.js +6 -16
  113. package/dist/vendor/core/foundation/constraints/date.d.ts +3 -3
  114. package/dist/vendor/core/foundation/constraints/index.d.ts +1 -1
  115. package/dist/vendor/core/foundation/constraints/range.d.ts +4 -4
  116. package/dist/vendor/core/foundation/constraints/range.js +1 -1
  117. package/dist/vendor/core/foundation/constraints/time.d.ts +5 -5
  118. package/dist/vendor/core/foundation/constraints/time.js +1 -1
  119. package/dist/vendor/core/foundation/grid/index.d.ts +2 -2
  120. package/dist/vendor/core/foundation/grid/month-grid.d.ts +2 -2
  121. package/dist/vendor/core/foundation/grid/time-axis.d.ts +3 -3
  122. package/dist/vendor/core/foundation/grid/time-axis.js +1 -1
  123. package/dist/vendor/core/foundation/input/index.d.ts +1 -1
  124. package/dist/vendor/core/foundation/input/index.js +1 -1
  125. package/dist/vendor/core/foundation/input/segment-engine.js +2 -6
  126. package/dist/vendor/core/foundation/locale/direction.js +1 -13
  127. package/dist/vendor/core/foundation/locale/format.js +1 -3
  128. package/dist/vendor/core/foundation/locale/hour-cycle.js +2 -6
  129. package/dist/vendor/core/foundation/locale/index.d.ts +1 -1
  130. package/dist/vendor/core/foundation/locale/index.js +1 -1
  131. package/dist/vendor/core/foundation/locale/resolve.js +12 -2
  132. package/dist/vendor/core/foundation/locale/week-info.js +1 -2
  133. package/dist/vendor/core/foundation/ranges/index.d.ts +1 -1
  134. package/dist/vendor/core/foundation/ranges/index.js +1 -1
  135. package/dist/vendor/core/foundation/ranges/interval.js +1 -3
  136. package/dist/vendor/core/foundation/store/controllable.d.ts +1 -1
  137. package/dist/vendor/core/foundation/store/ids.d.ts +8 -1
  138. package/dist/vendor/core/foundation/store/ids.js +10 -5
  139. package/dist/vendor/core/foundation/store/index.d.ts +2 -2
  140. package/dist/vendor/core/foundation/store/index.js +2 -2
  141. package/dist/vendor/core/foundation/store/with-optional.d.ts +15 -0
  142. package/dist/vendor/core/foundation/store/with-optional.js +3 -0
  143. package/dist/vendor/core/foundation/values/convert.js +3 -7
  144. package/dist/vendor/core/foundation/values/epoch-day.js +1 -5
  145. package/dist/vendor/core/foundation/values/index.d.ts +1 -1
  146. package/dist/vendor/core/foundation/values/index.js +1 -1
  147. package/dist/vendor/core/foundation/values/iso.js +2 -4
  148. package/dist/vendor/core/foundation/values/plain-time.js +1 -3
  149. package/dist/vendor/core/foundation/values/zoned.js +2 -5
  150. package/dist/vendor/core/time/input/parse.d.ts +1 -1
  151. package/dist/vendor/core/time/input/parse.js +1 -3
  152. package/dist/vendor/core/time/input/time-input-controller.d.ts +18 -18
  153. package/dist/vendor/core/time/input/time-input-controller.js +12 -27
  154. package/dist/vendor/core/time/input/time-range-input-controller.js +3 -10
  155. package/dist/vendor/core/time/input/validity.js +1 -1
  156. package/dist/vendor/core/time/panel/time-panel-controller.d.ts +12 -12
  157. package/dist/vendor/core/time/panel/time-panel-controller.js +19 -49
  158. package/dist/vendor/core/time/selection/range.d.ts +3 -3
  159. package/dist/vendor/core/time/selection/slots.d.ts +9 -9
  160. package/dist/vendor/core/time/selection/slots.js +1 -3
  161. package/package.json +21 -28
  162. package/dist/vendor/core/foundation/store/global-state.d.ts +0 -1
  163. package/dist/vendor/core/foundation/store/global-state.js +0 -21
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { forwardRef, } from "react";
3
+ import { forwardRef } from "react";
4
4
  import { mergeProps } from "../shared/merge-props.js";
5
5
  import { Part } from "../shared/part.js";
6
6
  import { composeRefs } from "../shared/slot.js";
@@ -43,15 +43,13 @@ function FieldContent() {
43
43
  /** A time field: segmented (default) or text. Use `TimeInputSegment` parts for custom layouts. */
44
44
  export const TimeInput = forwardRef(function TimeInput({ children, asChild, ...props }, ref) {
45
45
  const [options, rest] = splitTimeInputProps(props);
46
- const input = useTimeInput({
46
+ const input = useTimeInput(definedOptions({
47
47
  ...options,
48
48
  id: props.id,
49
- });
49
+ }));
50
50
  const { ref: rootRef, ...rootProps } = input.getRootProps();
51
51
  const { id: _id, ...elementProps } = rest;
52
- return (_jsx(TimeFieldContext.Provider, { value: input, children: _jsxs(Part, { as: "div", asChild: asChild, ref: composeRefs(ref, rootRef), ...withChrono(elementProps, rootProps), children: [typeof children === "function"
53
- ? children(input.state)
54
- : (children ?? _jsx(FieldContent, {})), _jsx(HiddenInputs, { inputs: input.state.hidden })] }) }));
52
+ return (_jsx(TimeFieldContext.Provider, { value: input, children: _jsxs(Part, { as: "div", asChild: asChild, ref: composeRefs(ref, rootRef), ...withChrono(elementProps, rootProps), children: [typeof children === "function" ? children(input.state) : (children ?? _jsx(FieldContent, {})), _jsx(HiddenInputs, { inputs: input.state.hidden })] }) }));
55
53
  });
56
54
  function RangeField({ side, children, asChild, forwardedRef, ...rest }) {
57
55
  const range = useRangeContext(side === "start" ? "TimeRangeInputStart" : "TimeRangeInputEnd");
@@ -61,11 +59,10 @@ function RangeField({ side, children, asChild, forwardedRef, ...rest }) {
61
59
  ...rootProps,
62
60
  role: "group",
63
61
  "aria-label": field.state.messages[side === "start" ? "startTime" : "endTime"],
64
- }), children: typeof children === "function"
65
- ? children(field.state)
66
- : (children ?? _jsx(FieldContent, {})) }) }));
62
+ }), children: typeof children === "function" ? children(field.state) : (children ?? _jsx(FieldContent, {})) }) }));
67
63
  }
68
64
  import { createContext, useContext } from "react";
65
+ import { definedOptions } from "./../shared/defined-options.js";
69
66
  const RangeContext = createContext(null);
70
67
  function useRangeContext(part) {
71
68
  const value = useContext(RangeContext);
@@ -83,10 +80,10 @@ export const TimeRangeInputEnd = forwardRef(function TimeRangeInputEnd(props, re
83
80
  /** Two time fields (start and end) in one group, in both modes. */
84
81
  export const TimeRangeInput = forwardRef(function TimeRangeInput({ children, asChild, ...props }, ref) {
85
82
  const [options, rest] = splitTimeRangeInputProps(props);
86
- const range = useTimeRangeInput({
83
+ const range = useTimeRangeInput(definedOptions({
87
84
  ...options,
88
85
  id: props.id,
89
- });
86
+ }));
90
87
  const { ref: rootRef, ...rootProps } = range.getRootProps();
91
88
  const { id: _id, ...elementProps } = rest;
92
89
  return (_jsx(RangeContext.Provider, { value: range, children: _jsxs(Part, { as: "div", asChild: asChild, ref: composeRefs(ref, rootRef), ...withChrono(elementProps, rootProps), children: [children ?? (_jsxs(_Fragment, { children: [_jsx(TimeRangeInputStart, {}), _jsx("span", { "aria-hidden": "true", children: "\u2013" }), _jsx(TimeRangeInputEnd, {})] })), _jsx(HiddenInputs, { inputs: range.state.hidden })] }) }));
@@ -95,9 +92,7 @@ export const TimeRangeInput = forwardRef(function TimeRangeInput({ children, asC
95
92
  export const TimePanelOption = forwardRef(function TimePanelOption({ option, children, asChild, ...rest }, ref) {
96
93
  const panel = useTimePanelContext("TimePanelOption");
97
94
  const slot = panel.controller.getSlot(option.key);
98
- return (_jsx(Part, { as: "div", asChild: asChild, ref: ref, ...withChrono(rest, panel.getOptionProps(option)), children: typeof children === "function"
99
- ? children(option, slot)
100
- : (children ?? option.text) }));
95
+ return (_jsx(Part, { as: "div", asChild: asChild, ref: ref, ...withChrono(rest, panel.getOptionProps(option)), children: typeof children === "function" ? children(option, slot) : (children ?? option.text) }));
101
96
  });
102
97
  /** One column of the columns layout (hour, minute, second, day period). */
103
98
  export const TimePanelColumn = forwardRef(function TimePanelColumn({ column, children, asChild, ...rest }, ref) {
@@ -105,12 +100,12 @@ export const TimePanelColumn = forwardRef(function TimePanelColumn({ column, chi
105
100
  return (_jsx(Part, { as: "div", asChild: asChild, ref: ref, ...withChrono(rest, panel.getColumnProps(column)), children: typeof children === "function"
106
101
  ? children(column)
107
102
  : (children ??
108
- column.options.map((option) => (_jsx(TimePanelOption, { option: option }, option.key)))) }));
103
+ column.options.map((option) => _jsx(TimePanelOption, { option: option }, option.key))) }));
109
104
  });
110
105
  export const TimePanelGroup = forwardRef(function TimePanelGroup({ group, children, asChild, ...rest }, ref) {
111
106
  const panel = useTimePanelContext("TimePanelGroup");
112
107
  return (_jsx(Part, { as: "div", asChild: asChild, ref: ref, ...withChrono(rest, panel.getGroupProps(group)), children: children ??
113
- group.options.map((option) => (_jsx(TimePanelOption, { option: option }, option.key))) }));
108
+ group.options.map((option) => _jsx(TimePanelOption, { option: option }, option.key)) }));
114
109
  });
115
110
  /** The visible label of a group (hidden from the group's own `aria-label`). */
116
111
  export const TimePanelGroupLabel = forwardRef(function TimePanelGroupLabel({ children, asChild, ...rest }, ref) {
@@ -123,7 +118,7 @@ export const TimePanelList = forwardRef(function TimePanelList({ children, asChi
123
118
  return (_jsx(Part, { as: "div", asChild: asChild, ref: ref, ...withChrono(rest, panel.getListProps()), children: typeof children === "function"
124
119
  ? children(groups)
125
120
  : (children ??
126
- groups.map((group) => (_jsxs(TimePanelGroup, { group: group, children: [group.label ? (_jsx(TimePanelGroupLabel, { children: group.label })) : null, group.options.map((option) => (_jsx(TimePanelOption, { option: option }, option.key)))] }, group.key)))) }));
121
+ groups.map((group) => (_jsxs(TimePanelGroup, { group: group, children: [group.label ? _jsx(TimePanelGroupLabel, { children: group.label }) : null, group.options.map((option) => (_jsx(TimePanelOption, { option: option }, option.key)))] }, group.key)))) }));
127
122
  });
128
123
  function SetContent({ set }) {
129
124
  return (_jsx(_Fragment, { children: set.columns.map((column) => (_jsx(TimePanelColumn, { column: column }, column.key))) }));
@@ -157,18 +152,18 @@ function PanelRoot({ panel, forwardedRef, asChild, children, rest, }) {
157
152
  /** A single-time panel: columns (default) or a list of times or slots. */
158
153
  export const TimePanel = forwardRef(function TimePanel({ children, asChild, ...props }, ref) {
159
154
  const [options, rest] = splitTimePanelProps(props);
160
- const panel = useTimePanel({
155
+ const panel = useTimePanel(definedOptions({
161
156
  ...options,
162
157
  id: props.id,
163
- });
158
+ }));
164
159
  return (_jsx(PanelRoot, { panel: panel, forwardedRef: ref, asChild: asChild, rest: rest, children: children }));
165
160
  });
166
161
  /** A range panel (two picks): a list (default) or two column sets. */
167
162
  export const TimeRangePanel = forwardRef(function TimeRangePanel({ children, asChild, ...props }, ref) {
168
163
  const [options, rest] = splitTimeRangePanelProps(props);
169
- const panel = useTimeRangePanel({
164
+ const panel = useTimeRangePanel(definedOptions({
170
165
  ...options,
171
166
  id: props.id,
172
- });
167
+ }));
173
168
  return (_jsx(PanelRoot, { panel: panel, forwardedRef: ref, asChild: asChild, rest: rest, children: children }));
174
169
  });
@@ -1,4 +1,4 @@
1
- export { checkTimeRangeValue, getBookingSlots, parseTime, } from "../vendor/core/time/index.js";
1
+ export { checkTimeRangeValue, getBookingSlots, parseTime } from "../vendor/core/time/index.js";
2
2
  export { getHourCycle, getTimeStatus, isSameTime, snapTime, toPlainTime, } from "../vendor/core/foundation/index.js";
3
3
  export type { BookingSlot, BookingSlotInput, HourCycle, TimeGranularity, TimeInputOptions, TimeInputState, TimePanelColumnState, TimePanelGroupState, TimePanelOptionState, TimePanelOptions, TimePanelSetState, TimePanelState, TimeParseResult, TimeRangeInputOptions, TimeRangeInputState, TimeRangePanelOptions, TimeRangeValue, TimeSegmentView, TimeValidity, TimeValue, } from "../vendor/core/time/index.js";
4
4
  export type { TimeInput as TimeInputValue } from "../vendor/core/foundation/index.js";
@@ -1,4 +1,4 @@
1
1
  // Pure utilities and value helpers re-exported from core. No "use client":
2
2
  // they stay ordinary functions in Server Components and server actions.
3
- export { checkTimeRangeValue, getBookingSlots, parseTime, } from "../vendor/core/time/index.js";
3
+ export { checkTimeRangeValue, getBookingSlots, parseTime } from "../vendor/core/time/index.js";
4
4
  export { getHourCycle, getTimeStatus, isSameTime, snapTime, toPlainTime, } from "../vendor/core/foundation/index.js";
@@ -7,7 +7,7 @@ import type { EventId } from "./events/types.js";
7
7
  * blocks its own new position.
8
8
  */
9
9
  export type AvailabilityContext = {
10
- excludeEventId?: EventId;
10
+ excludeEventId?: EventId | undefined;
11
11
  };
12
12
  /** What the Calendar `availability` option accepts (plan 11 V4, R6, R7). */
13
13
  export type CalendarAvailabilityInput = AvailabilitySpec | Availability | ((context: AvailabilityContext) => AvailabilitySpec | Availability);
@@ -35,5 +35,5 @@ export declare function wallIso(value: DateTimeInput | DateInput, timeZone?: str
35
35
  export declare function availabilityFromEvents(events: readonly CalendarEventInput[], options?: AvailabilityFromEventsOptions): AvailabilitySpec;
36
36
  export declare function resolveCalendarAvailability(input: CalendarAvailabilityInput | undefined, context: AvailabilityContext, options?: {
37
37
  timeZone?: string;
38
- now?: number;
38
+ now?: number | undefined;
39
39
  }): Availability | undefined;
@@ -1,4 +1,5 @@
1
1
  import { compileAvailability, toPlainDate, toPlainDateTime, } from "../foundation/index.js";
2
+ import { withOptional } from "../foundation/store/with-optional.js";
2
3
  const pad = (value) => String(value).padStart(2, "0");
3
4
  /** The wall-clock ISO form of a date or date-time value, without a zone suffix. */
4
5
  export function wallIso(value, timeZone, allDay) {
@@ -34,9 +35,7 @@ function eventResourceMatch(event, resourceId) {
34
35
  if (value === undefined) {
35
36
  return true;
36
37
  }
37
- return Array.isArray(value)
38
- ? value.includes(resourceId)
39
- : value === resourceId;
38
+ return Array.isArray(value) ? value.includes(resourceId) : value === resourceId;
40
39
  }
41
40
  /**
42
41
  * Turn bookings into `blocked` rules (plan 11 V11). All-day events run
@@ -52,14 +51,14 @@ export function availabilityFromEvents(events, options = {}) {
52
51
  if (!eventResourceMatch(event, options.resourceId)) {
53
52
  continue;
54
53
  }
55
- rules.push({
54
+ rules.push(withOptional({
56
55
  type: "range",
57
56
  start: wallIso(event.start, options.timeZone, event.allDay),
58
57
  end: wallIso(event.end, options.timeZone, event.allDay),
59
58
  id: String(event.id),
60
59
  reason: options.reason?.(event),
61
60
  data: event,
62
- });
61
+ }));
63
62
  }
64
63
  return options.timeZone === undefined
65
64
  ? { blocked: rules }