@milktop/react-ui 0.0.0-stage → 0.1.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 (250) hide show
  1. package/README.md +173 -2
  2. package/dist/accordion/Accordion.d.ts +65 -0
  3. package/dist/accordion/Accordion.js +61 -0
  4. package/dist/accordion/accordion.css +17 -0
  5. package/dist/action-bar/ActionBar.d.ts +33 -0
  6. package/dist/action-bar/ActionBar.js +48 -0
  7. package/dist/action-bar/action-bar.css +22 -0
  8. package/dist/alert/Alert.d.ts +28 -0
  9. package/dist/alert/Alert.js +12 -0
  10. package/dist/alert/alert.css +26 -0
  11. package/dist/app-shell/AppShell.d.ts +38 -0
  12. package/dist/app-shell/AppShell.js +92 -0
  13. package/dist/app-shell/Topbar.d.ts +20 -0
  14. package/dist/app-shell/Topbar.js +13 -0
  15. package/dist/app-shell/app-shell.css +41 -0
  16. package/dist/app-shell/shell.d.ts +9 -0
  17. package/dist/app-shell/shell.js +3 -0
  18. package/dist/attachments/Attachments.d.ts +84 -0
  19. package/dist/attachments/Attachments.js +235 -0
  20. package/dist/attachments/attachments.css +86 -0
  21. package/dist/avatar/Avatar.d.ts +31 -0
  22. package/dist/avatar/Avatar.js +41 -0
  23. package/dist/avatar/AvatarGroup.d.ts +41 -0
  24. package/dist/avatar/AvatarGroup.js +17 -0
  25. package/dist/avatar/avatar.css +73 -0
  26. package/dist/badge/Badge.d.ts +26 -0
  27. package/dist/badge/Badge.js +10 -0
  28. package/dist/badge/badge.css +24 -0
  29. package/dist/banner/Banner.d.ts +33 -0
  30. package/dist/banner/Banner.js +14 -0
  31. package/dist/banner/banner.css +25 -0
  32. package/dist/breadcrumbs/Breadcrumbs.d.ts +39 -0
  33. package/dist/breadcrumbs/Breadcrumbs.js +28 -0
  34. package/dist/breadcrumbs/breadcrumbs.css +18 -0
  35. package/dist/button/Button.d.ts +40 -0
  36. package/dist/button/Button.js +19 -0
  37. package/dist/button/button.css +63 -0
  38. package/dist/card/Card.d.ts +355 -0
  39. package/dist/card/Card.js +56 -0
  40. package/dist/card/card.css +43 -0
  41. package/dist/chart/AreaChart.d.ts +19 -0
  42. package/dist/chart/AreaChart.js +61 -0
  43. package/dist/chart/BarChart.d.ts +3 -0
  44. package/dist/chart/BarChart.js +60 -0
  45. package/dist/chart/ChartFrame.d.ts +25 -0
  46. package/dist/chart/ChartFrame.js +22 -0
  47. package/dist/chart/DonutChart.d.ts +20 -0
  48. package/dist/chart/DonutChart.js +41 -0
  49. package/dist/chart/Sparkline.d.ts +26 -0
  50. package/dist/chart/Sparkline.js +36 -0
  51. package/dist/chart/chart.css +51 -0
  52. package/dist/chart/chart.d.ts +23 -0
  53. package/dist/chart/chart.js +19 -0
  54. package/dist/checkbox/Checkbox.d.ts +50 -0
  55. package/dist/checkbox/Checkbox.js +19 -0
  56. package/dist/checkbox/CheckboxGroup.d.ts +44 -0
  57. package/dist/checkbox/CheckboxGroup.js +80 -0
  58. package/dist/checkbox/checkbox.css +49 -0
  59. package/dist/collapsible/Collapsible.d.ts +41 -0
  60. package/dist/collapsible/Collapsible.js +15 -0
  61. package/dist/collapsible/collapsible.css +20 -0
  62. package/dist/color-scheme.d.ts +18 -0
  63. package/dist/color-scheme.js +84 -0
  64. package/dist/command/Command.d.ts +64 -0
  65. package/dist/command/Command.js +162 -0
  66. package/dist/command/command.css +47 -0
  67. package/dist/confirm/confirm.css +5 -0
  68. package/dist/confirm/confirm.d.ts +42 -0
  69. package/dist/confirm/confirm.js +115 -0
  70. package/dist/copy-button/CopyButton.d.ts +30 -0
  71. package/dist/copy-button/CopyButton.js +23 -0
  72. package/dist/copy-button/copy-button.css +12 -0
  73. package/dist/css.d.ts +2 -0
  74. package/dist/data-list/DataList.d.ts +55 -0
  75. package/dist/data-list/DataList.js +43 -0
  76. package/dist/data-list/data-list.css +19 -0
  77. package/dist/date-picker/DatePicker.d.ts +95 -0
  78. package/dist/date-picker/DatePicker.js +237 -0
  79. package/dist/date-picker/date-picker.css +53 -0
  80. package/dist/dialog/Dialog.d.ts +98 -0
  81. package/dist/dialog/Dialog.js +92 -0
  82. package/dist/dialog/dialog.css +31 -0
  83. package/dist/divider/Divider.d.ts +27 -0
  84. package/dist/divider/Divider.js +8 -0
  85. package/dist/divider/divider.css +12 -0
  86. package/dist/editable/Editable.d.ts +47 -0
  87. package/dist/editable/Editable.js +51 -0
  88. package/dist/editable/editable.css +25 -0
  89. package/dist/editor/Editor.d.ts +59 -0
  90. package/dist/editor/Editor.js +220 -0
  91. package/dist/editor/editor.css +42 -0
  92. package/dist/editor/image.d.ts +1 -0
  93. package/dist/editor/image.js +23 -0
  94. package/dist/empty-state/EmptyState.d.ts +22 -0
  95. package/dist/empty-state/EmptyState.js +9 -0
  96. package/dist/empty-state/empty-state.css +14 -0
  97. package/dist/event-calendar/EventCalendar.d.ts +213 -0
  98. package/dist/event-calendar/EventCalendar.js +686 -0
  99. package/dist/event-calendar/dates.d.ts +8 -0
  100. package/dist/event-calendar/dates.js +21 -0
  101. package/dist/event-calendar/event-calendar.css +157 -0
  102. package/dist/field/Field.d.ts +66 -0
  103. package/dist/field/Field.js +23 -0
  104. package/dist/field/field.css +26 -0
  105. package/dist/file-upload/FileUpload.d.ts +60 -0
  106. package/dist/file-upload/FileUpload.js +102 -0
  107. package/dist/file-upload/file-upload.css +32 -0
  108. package/dist/format/FormatNumber.d.ts +42 -0
  109. package/dist/format/FormatNumber.js +59 -0
  110. package/dist/format/LocaleProvider.d.ts +33 -0
  111. package/dist/format/LocaleProvider.js +48 -0
  112. package/dist/format/format.d.ts +37 -0
  113. package/dist/format/format.js +74 -0
  114. package/dist/format/messages.d.ts +211 -0
  115. package/dist/format/messages.js +202 -0
  116. package/dist/highlight/Highlight.d.ts +11 -0
  117. package/dist/highlight/Highlight.js +14 -0
  118. package/dist/highlight/highlight.css +17 -0
  119. package/dist/hover-card/HoverCard.d.ts +47 -0
  120. package/dist/hover-card/HoverCard.js +18 -0
  121. package/dist/hover-card/hover-card.css +19 -0
  122. package/dist/index.d.ts +84 -0
  123. package/dist/index.js +85 -0
  124. package/dist/input/Input.d.ts +41 -0
  125. package/dist/input/Input.js +48 -0
  126. package/dist/input/input.css +25 -0
  127. package/dist/kbd/Kbd.d.ts +19 -0
  128. package/dist/kbd/Kbd.js +20 -0
  129. package/dist/kbd/kbd.css +8 -0
  130. package/dist/menu/Menu.d.ts +223 -0
  131. package/dist/menu/Menu.js +275 -0
  132. package/dist/menu/menu.css +38 -0
  133. package/dist/native-select/NativeSelect.d.ts +36 -0
  134. package/dist/native-select/NativeSelect.js +51 -0
  135. package/dist/native-select/native-select.css +16 -0
  136. package/dist/number-input/NumberInput.d.ts +56 -0
  137. package/dist/number-input/NumberInput.js +67 -0
  138. package/dist/number-input/number-input.css +21 -0
  139. package/dist/page/Page.d.ts +30 -0
  140. package/dist/page/Page.js +9 -0
  141. package/dist/page/page.css +17 -0
  142. package/dist/pagination/Pagination.d.ts +31 -0
  143. package/dist/pagination/Pagination.js +58 -0
  144. package/dist/pagination/pagination.css +15 -0
  145. package/dist/password-input/PasswordInput.d.ts +47 -0
  146. package/dist/password-input/PasswordInput.js +35 -0
  147. package/dist/password-input/password-input.css +18 -0
  148. package/dist/pin-input/PinInput.d.ts +45 -0
  149. package/dist/pin-input/PinInput.js +22 -0
  150. package/dist/pin-input/pin-input.css +13 -0
  151. package/dist/popover/Popover.d.ts +65 -0
  152. package/dist/popover/Popover.js +26 -0
  153. package/dist/popover/popover.css +16 -0
  154. package/dist/progress/Progress.d.ts +56 -0
  155. package/dist/progress/Progress.js +28 -0
  156. package/dist/progress/progress.css +24 -0
  157. package/dist/prose/Prose.d.ts +23 -0
  158. package/dist/prose/Prose.js +10 -0
  159. package/dist/prose/prose.css +29 -0
  160. package/dist/radio-group/RadioGroup.d.ts +59 -0
  161. package/dist/radio-group/RadioGroup.js +37 -0
  162. package/dist/radio-group/radio-group.css +30 -0
  163. package/dist/rolling-number/RollingNumber.d.ts +27 -0
  164. package/dist/rolling-number/RollingNumber.js +18 -0
  165. package/dist/rolling-number/rolling-number.css +10 -0
  166. package/dist/segment-group/Segmented.d.ts +68 -0
  167. package/dist/segment-group/Segmented.js +79 -0
  168. package/dist/segment-group/segment-group.css +25 -0
  169. package/dist/select/ListSelect.d.ts +5 -0
  170. package/dist/select/ListSelect.js +82 -0
  171. package/dist/select/SearchSelect.d.ts +43 -0
  172. package/dist/select/SearchSelect.js +219 -0
  173. package/dist/select/Select.d.ts +147 -0
  174. package/dist/select/Select.js +32 -0
  175. package/dist/select/items.d.ts +17 -0
  176. package/dist/select/items.js +14 -0
  177. package/dist/select/search-select.css +45 -0
  178. package/dist/select/select.css +52 -0
  179. package/dist/sheet/Sheet.d.ts +88 -0
  180. package/dist/sheet/Sheet.js +66 -0
  181. package/dist/sheet/sheet.css +44 -0
  182. package/dist/sidebar/NavGroup.d.ts +29 -0
  183. package/dist/sidebar/NavGroup.js +78 -0
  184. package/dist/sidebar/NavItem.d.ts +33 -0
  185. package/dist/sidebar/NavItem.js +50 -0
  186. package/dist/sidebar/NavSection.d.ts +20 -0
  187. package/dist/sidebar/NavSection.js +44 -0
  188. package/dist/sidebar/Sidebar.d.ts +65 -0
  189. package/dist/sidebar/Sidebar.js +59 -0
  190. package/dist/sidebar/SidebarUser.d.ts +31 -0
  191. package/dist/sidebar/SidebarUser.js +14 -0
  192. package/dist/sidebar/context.d.ts +13 -0
  193. package/dist/sidebar/context.js +6 -0
  194. package/dist/sidebar/sidebar.css +109 -0
  195. package/dist/skeleton/Skeleton.d.ts +25 -0
  196. package/dist/skeleton/Skeleton.js +8 -0
  197. package/dist/skeleton/skeleton.css +13 -0
  198. package/dist/slider/Slider.d.ts +70 -0
  199. package/dist/slider/Slider.js +65 -0
  200. package/dist/slider/slider.css +17 -0
  201. package/dist/sortable-list/SortableList.d.ts +46 -0
  202. package/dist/sortable-list/SortableList.js +85 -0
  203. package/dist/sortable-list/sortable-list.css +25 -0
  204. package/dist/spinner/Spinner.d.ts +18 -0
  205. package/dist/spinner/Spinner.js +11 -0
  206. package/dist/spinner/spinner.css +9 -0
  207. package/dist/stat/Stat.d.ts +42 -0
  208. package/dist/stat/Stat.js +21 -0
  209. package/dist/stat/Stats.d.ts +23 -0
  210. package/dist/stat/Stats.js +8 -0
  211. package/dist/stat/stat.css +34 -0
  212. package/dist/swatch-picker/SwatchPicker.d.ts +45 -0
  213. package/dist/swatch-picker/SwatchPicker.js +54 -0
  214. package/dist/swatch-picker/swatch-picker.css +38 -0
  215. package/dist/switch/Switch.d.ts +39 -0
  216. package/dist/switch/Switch.js +17 -0
  217. package/dist/switch/switch.css +13 -0
  218. package/dist/table/Table.d.ts +90 -0
  219. package/dist/table/Table.js +145 -0
  220. package/dist/table/table.css +44 -0
  221. package/dist/tabs/Tabs.d.ts +87 -0
  222. package/dist/tabs/Tabs.js +90 -0
  223. package/dist/tabs/tabs.css +53 -0
  224. package/dist/tags-input/TagsInput.d.ts +69 -0
  225. package/dist/tags-input/TagsInput.js +95 -0
  226. package/dist/tags-input/tags-input.css +37 -0
  227. package/dist/textarea/Textarea.d.ts +24 -0
  228. package/dist/textarea/Textarea.js +51 -0
  229. package/dist/textarea/textarea.css +14 -0
  230. package/dist/theme-toggle/ThemeToggle.d.ts +49 -0
  231. package/dist/theme-toggle/ThemeToggle.js +71 -0
  232. package/dist/theme-toggle/theme-toggle.css +23 -0
  233. package/dist/theme.css +119 -0
  234. package/dist/time-input/TimeInput.d.ts +25 -0
  235. package/dist/time-input/TimeInput.js +20 -0
  236. package/dist/timeline/Timeline.d.ts +50 -0
  237. package/dist/timeline/Timeline.js +15 -0
  238. package/dist/timeline/timeline.css +29 -0
  239. package/dist/toast/Toaster.d.ts +36 -0
  240. package/dist/toast/Toaster.js +25 -0
  241. package/dist/toast/toast.css +33 -0
  242. package/dist/tooltip/Tooltip.d.ts +55 -0
  243. package/dist/tooltip/Tooltip.js +48 -0
  244. package/dist/tooltip/tooltip.css +18 -0
  245. package/dist/tree-view/TreeView.d.ts +86 -0
  246. package/dist/tree-view/TreeView.js +74 -0
  247. package/dist/tree-view/tree-view.css +29 -0
  248. package/dist/utils.d.ts +19 -0
  249. package/dist/utils.js +59 -0
  250. package/package.json +99 -4
@@ -0,0 +1,23 @@
1
+ // TipTap's image node, keeping any data-* attributes (e.g. an id or signed
2
+ // id your server resolves later) through parsing, editing and getHTML().
3
+ // A method, not an arrow: TipTap's extend() needs `this.parent`.
4
+ import Image from '@tiptap/extension-image';
5
+ export const RichImage = Image.extend({
6
+ addAttributes() {
7
+ return {
8
+ ...this.parent?.(),
9
+ data: {
10
+ default: null,
11
+ parseHTML: (element) => {
12
+ const out = {};
13
+ for (const { name, value } of Array.from(element.attributes)) {
14
+ if (name.startsWith('data-'))
15
+ out[name] = value;
16
+ }
17
+ return Object.keys(out).length ? out : null;
18
+ },
19
+ renderHTML: (attributes) => attributes.data || {},
20
+ },
21
+ };
22
+ },
23
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * What to show where a list or page has nothing yet.
3
+ *
4
+ * <EmptyState icon="lucide:users" heading="No students yet" description="Add one to start booking lessons.">
5
+ * <Button variant="primary">Add student</Button>
6
+ * </EmptyState>
7
+ *
8
+ * - `icon`: an Iconify name; `heading`, `description`
9
+ * - the content: actions, e.g. a button to create the first item
10
+ */
11
+ import type { ComponentProps, ReactNode } from 'react';
12
+ import 'iconify-icon';
13
+ import { type Classes } from '../utils.js';
14
+ import '../theme.css';
15
+ import './empty-state.css';
16
+ export type EmptyStateProps = Omit<ComponentProps<'div'>, 'title'> & {
17
+ icon?: string | null;
18
+ heading?: ReactNode;
19
+ description?: ReactNode;
20
+ classes?: Classes<'root' | 'iconWrap' | 'icon' | 'heading' | 'description' | 'actions'>;
21
+ };
22
+ export declare function EmptyState({ icon, heading, description, className, classes, children, ...rest }: EmptyStateProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import 'iconify-icon';
3
+ import { cx, partsOf } from '../utils.js';
4
+ import '../theme.css';
5
+ import './empty-state.css';
6
+ export function EmptyState({ icon = null, heading = null, description = null, className, classes, children, ...rest }) {
7
+ const part = partsOf('empty-state', classes);
8
+ return (_jsxs("div", { ...rest, ...part('root'), className: cx(className, classes?.root), children: [icon && _jsx("span", { ...part('icon-wrap'), children: _jsx("iconify-icon", { ...part('icon'), icon: icon, "aria-hidden": "true" }) }), heading && _jsx("h3", { ...part('heading'), children: heading }), description && _jsx("p", { ...part('description'), children: description }), children != null && _jsx("div", { ...part('actions'), children: children })] }));
9
+ }
@@ -0,0 +1,14 @@
1
+ @layer ui {
2
+ [data-scope=empty-state][data-part=root] {
3
+ display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; box-sizing: border-box;
4
+ padding: 2.5rem 1.5rem; color: var(--ui-text); font-family: var(--ui-font); font-size: 14px;
5
+ }
6
+ [data-scope=empty-state][data-part=icon-wrap] {
7
+ display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 1rem; border-radius: 9999px;
8
+ background: var(--ui-hover); color: var(--ui-muted);
9
+ }
10
+ [data-scope=empty-state][data-part=icon] { display: block; font-size: 24px; }
11
+ [data-scope=empty-state][data-part=heading] { margin: 0; font-size: 16px; font-weight: 600; }
12
+ [data-scope=empty-state][data-part=description] { margin: 0.25rem 0 0; max-width: 28rem; color: var(--ui-muted); }
13
+ [data-scope=empty-state][data-part=actions] { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1.25rem; }
14
+ }
@@ -0,0 +1,213 @@
1
+ /**
2
+ * A calendar of events by the hour: a day, a few days or a week across,
3
+ * hours down, and optionally a column per resource (a vet, a tutor, a room)
4
+ * within each day. Events sit by their times, side by side where they
5
+ * overlap; all-day and multi-day events sit in a strip along the top.
6
+ *
7
+ * <EventCalendar events={lessons} onSelect={book} onEventClick={open} onEventChange={update} />
8
+ * <EventCalendar view="day" resources={vets} slotMinutes={15} events={appointments} … />
9
+ *
10
+ * Times are local ISO strings ('2025-10-09T16:00'), as DatePicker's dates are;
11
+ * an all-day event has dates only ('2025-10-09', its `end` the last day).
12
+ *
13
+ * Events and resources
14
+ * - `events`: `{ id, title, start, end, allDay, resourceId, description,
15
+ * color, editable, blocked, pending }`; `color` is 'accent' (default),
16
+ * 'success', 'warning', 'danger', 'neutral' or any CSS colour;
17
+ * `editable: false` fixes one; `blocked` draws it hatched (time taken out,
18
+ * not an appointment); `pending` faded and fixed (saving)
19
+ * - `resources`: `{ id, title, color, hours, offLabel }` (and anything for
20
+ * `renderResource`): a column each, per day; events go in their
21
+ * `resourceId`'s column. Change the list to add or remove one (a vet
22
+ * present that day). `color` ('accent', 'success', 'warning', 'danger',
23
+ * 'neutral' or any CSS colour) tints its header, its hover, selections and
24
+ * drops, and is its events' colour unless they set their own. `hours`:
25
+ * when it's available on each day shown, as `[{ start: '08:00', end: '13:00' }]`
26
+ * (a morning; two for a lunch break; `[]` for not at all): the rest is
27
+ * shaded and refused, with `offLabel` as the reason
28
+ *
29
+ * What's shown
30
+ * - `view`, `defaultView`: 'day', 'week' (default), 'workweek', or a number
31
+ * of days from `date`; `onViewChange`. `views`: the toolbar's choices
32
+ * (['day', 'week']; [] for none). On a narrow screen it shows a day
33
+ * - `date`, `defaultDate`: a day in the range shown (today's by default);
34
+ * `onDateChange`, from the toolbar (its title opens a calendar)
35
+ * - `weekStartsOn`: 1 (Monday, default) or 0; `startHour`, `endHour` (7, 21);
36
+ * `slotMinutes`: what selecting, moving and resizing snap to (30);
37
+ * `hourHeight`: a CSS length ('3rem')
38
+ * - `height`: a CSS length: the hours scroll inside it under the headers;
39
+ * `scrollToTime`: where it opens scrolled to ('08:00', or 'now'), once
40
+ * - `rows`: extra rows above the all-day strip, a cell per day (or per
41
+ * column with `perColumn`), e.g. the day's messages:
42
+ * `[{ key, label, render: (date, resource) => …, onClick: (date, resource) => … }]`
43
+ * - `allDayMax`: all-day lanes shown before a "+2 more" (3)
44
+ *
45
+ * Changing things
46
+ * - `onSelect({ start, end, resourceId, allDay }, keys)`: an empty slot was
47
+ * clicked or a time dragged out, or (`allDay`) days in the all-day strip,
48
+ * e.g. to book it. `keys` says which of Shift, Alt, Ctrl and ⌘ were held
49
+ * (say, Shift to block time instead of booking it)
50
+ * - `onEventClick(event)`: an event was clicked (not dragged), e.g. to open it
51
+ * - `onDayClick(date)`: a day's header was clicked (an ISO date), e.g. to show
52
+ * that day; `onResourceClick(resource, date)`: a resource's header
53
+ * - `onRangeChange({ start, end, view })`: the days shown, as ISO dates (the
54
+ * last one included), when it first shows and whenever they change: load
55
+ * that range's events from your server
56
+ * - `onEventChange(event, { start, end, resourceId }, { kind })`: makes
57
+ * events movable and resizable: drag one to another time, day or resource,
58
+ * or its bottom edge to change its length; or focus it and use ↑↓ (a slot),
59
+ * ←→ (a column), Shift+↑↓ (its length). The change spreads straight into
60
+ * the event (`{ ...event, ...change }`); `kind` is 'move' or 'resize', and
61
+ * comparing `resourceId` with the event's shows a change of resource.
62
+ * Update your events in response (or don't, and it stays where it was)
63
+ * - `isAvailable({ start, end, resourceId, allDay, event })`: true, or false
64
+ * or the reason it isn't ('Dr Patel is away'): unavailable time is shaded
65
+ * (the reason on hover) and selecting, moving or resizing into it is
66
+ * refused, calling `onUnavailable(reason, attempt)` (to show a toast).
67
+ * `event` is the one being moved, so it doesn't clash with itself;
68
+ * `shading` is true when it's only asking what to shade (so clashes with
69
+ * other events, which show anyway, can be left to bookings and drops)
70
+ * - `pinned`: an event being placed (it can be from another week): while
71
+ * set, a click on a time moves it there (through `onEventChange`, keeping
72
+ * its length); Escape or the bar's Cancel call `onPinnedChange(null)`.
73
+ * Clear it once you've moved it
74
+ *
75
+ * - `eventMenu(event)`, `slotMenu(slot)`: items for a menu on right-click
76
+ * (or the Menu key, or Shift+F10, on a focused event): of an event, or of
77
+ * an empty time or all-day day (`slot` is `{ start, end, resourceId, allDay }`).
78
+ * Items are `{ label, icon, shortcut, danger, disabled, onSelect }`, or
79
+ * `{ separator: true }`, or `{ group: 'Heading' }`; return nothing for no menu
80
+ *
81
+ * Drawing and words
82
+ * - `renderEvent(event, { start, end, resource, compact })`, `renderResource(resource)`,
83
+ * `renderDayHeader(date)`: draw those yourself
84
+ * - `eventLabel(event)`: what screen readers call an event (its title, if text)
85
+ * - `translations`: its words (Today, All day, the views, the announcements…),
86
+ * over the LocaleProvider's (English and French are built in);
87
+ * `locale`: for the dates and times (the LocaleProvider's by default)
88
+ * - `actions`: in the toolbar; `toolbar`: false hides it
89
+ */
90
+ import { type HTMLAttributes, type ReactNode } from 'react';
91
+ import 'iconify-icon';
92
+ import type { CalendarMessages } from '../format/messages.js';
93
+ import { type Classes } from '../utils.js';
94
+ import '../theme.css';
95
+ import './event-calendar.css';
96
+ type Id = string | number;
97
+ export type CalendarEvent = {
98
+ id: Id;
99
+ title: ReactNode;
100
+ start: string;
101
+ end: string;
102
+ allDay?: boolean;
103
+ resourceId?: Id;
104
+ description?: ReactNode;
105
+ color?: 'accent' | 'success' | 'warning' | 'danger' | 'neutral' | (string & {});
106
+ editable?: boolean;
107
+ blocked?: boolean;
108
+ pending?: boolean;
109
+ };
110
+ export type CalendarResource = {
111
+ id: Id;
112
+ title: ReactNode;
113
+ color?: string;
114
+ hours?: {
115
+ start: string;
116
+ end: string;
117
+ }[] | null;
118
+ offLabel?: string;
119
+ };
120
+ export type CalendarView = 'day' | 'week' | 'workweek' | number;
121
+ export type CalendarChange = {
122
+ start: string;
123
+ end: string;
124
+ resourceId?: Id;
125
+ };
126
+ export type CalendarSelection = {
127
+ start: string;
128
+ end: string;
129
+ resourceId?: Id;
130
+ allDay: boolean;
131
+ };
132
+ export type CalendarKeys = {
133
+ shiftKey: boolean;
134
+ altKey: boolean;
135
+ ctrlKey: boolean;
136
+ metaKey: boolean;
137
+ };
138
+ export type CalendarQuery<E extends CalendarEvent = CalendarEvent> = CalendarSelection & {
139
+ event?: E;
140
+ shading?: boolean;
141
+ };
142
+ export type CalendarRow<R extends CalendarResource = CalendarResource> = {
143
+ key: string;
144
+ label: ReactNode;
145
+ render?: (date: Date, resource: R | null) => ReactNode;
146
+ onClick?: (date: Date, resource: R | null) => void;
147
+ perColumn?: boolean;
148
+ };
149
+ export type CalendarMenuItem = {
150
+ label?: ReactNode;
151
+ icon?: string;
152
+ shortcut?: string;
153
+ danger?: boolean;
154
+ disabled?: boolean;
155
+ separator?: boolean;
156
+ group?: ReactNode;
157
+ onSelect?: () => void;
158
+ };
159
+ export type CalendarTranslations = CalendarMessages;
160
+ export type EventCalendarProps<E extends CalendarEvent = CalendarEvent, R extends CalendarResource = CalendarResource> = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onSelect'> & {
161
+ events?: E[];
162
+ resources?: R[] | null;
163
+ view?: CalendarView;
164
+ defaultView?: CalendarView;
165
+ onViewChange?: (view: CalendarView) => void;
166
+ views?: CalendarView[];
167
+ date?: string;
168
+ defaultDate?: string;
169
+ onDateChange?: (date: string) => void;
170
+ weekStartsOn?: 0 | 1;
171
+ startHour?: number;
172
+ endHour?: number;
173
+ slotMinutes?: number;
174
+ hourHeight?: string;
175
+ height?: string | null;
176
+ scrollToTime?: string | null;
177
+ rows?: CalendarRow<R>[];
178
+ allDayMax?: number;
179
+ onSelect?: (selection: CalendarSelection, keys: CalendarKeys) => void;
180
+ onEventClick?: (event: E) => void;
181
+ onDayClick?: (date: string) => void;
182
+ onResourceClick?: (resource: R, date: string) => void;
183
+ onRangeChange?: (range: {
184
+ start: string;
185
+ end: string;
186
+ view: CalendarView;
187
+ }) => void;
188
+ onEventChange?: (event: E, change: CalendarChange, how: {
189
+ kind: 'move' | 'resize';
190
+ }) => void;
191
+ isAvailable?: (query: CalendarQuery<E>) => boolean | string;
192
+ onUnavailable?: (reason: string, attempt: CalendarQuery<E>) => void;
193
+ pinned?: E | null;
194
+ eventMenu?: (event: E) => CalendarMenuItem[] | null | undefined;
195
+ slotMenu?: (slot: CalendarSelection) => CalendarMenuItem[] | null | undefined;
196
+ onPinnedChange?: (event: E | null) => void;
197
+ renderEvent?: (event: E, state: {
198
+ start: Date;
199
+ end: Date;
200
+ resource: R | null;
201
+ compact: boolean;
202
+ }) => ReactNode;
203
+ renderResource?: (resource: R) => ReactNode;
204
+ renderDayHeader?: (date: Date) => ReactNode;
205
+ eventLabel?: (event: E) => string;
206
+ translations?: Partial<CalendarTranslations>;
207
+ actions?: ReactNode;
208
+ toolbar?: boolean;
209
+ locale?: string;
210
+ classes?: Classes<'root' | 'toolbar' | 'nav' | 'title' | 'actions' | 'pinned' | 'grid' | 'corner' | 'dayHeader' | 'resourceHeader' | 'rowLabel' | 'rowCell' | 'allDayLabel' | 'allDay' | 'allDayEvent' | 'more' | 'gutter' | 'hour' | 'day' | 'unavailable' | 'event' | 'eventTitle' | 'headerButton' | 'hover' | 'eventTime' | 'resize' | 'ghost' | 'selection' | 'now' | 'status'>;
211
+ };
212
+ export declare function EventCalendar<E extends CalendarEvent = CalendarEvent, R extends CalendarResource = CalendarResource>({ events, resources, view: viewProp, defaultView, onViewChange, views, date: dateProp, defaultDate, onDateChange, weekStartsOn, startHour, endHour, slotMinutes, hourHeight, height, scrollToTime, rows, allDayMax, onSelect, onEventClick, onDayClick, onResourceClick, onRangeChange, onEventChange, isAvailable, onUnavailable, pinned, onPinnedChange, eventMenu, slotMenu, renderEvent, renderResource, renderDayHeader, eventLabel, translations, actions, toolbar, locale: localeProp, className, classes, style, ...rest }: EventCalendarProps<E, R>): import("react").JSX.Element;
213
+ export {};