@kodffe/ui 0.0.0-stage → 0.10.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.
- package/dist/_virtual/_rolldown/runtime.js +11 -0
- package/dist/accordion/accordion.d.ts +44 -0
- package/dist/accordion/accordion.js +84 -0
- package/dist/accordion/accordion.js.map +1 -0
- package/dist/alert/alert.d.ts +17 -0
- package/dist/alert/alert.js +59 -0
- package/dist/alert/alert.js.map +1 -0
- package/dist/app-shell/app-footer.d.ts +29 -0
- package/dist/app-shell/app-footer.js +39 -0
- package/dist/app-shell/app-footer.js.map +1 -0
- package/dist/app-shell/app-shell-context.d.ts +10 -0
- package/dist/app-shell/app-shell-context.js +12 -0
- package/dist/app-shell/app-shell-context.js.map +1 -0
- package/dist/app-shell/app-shell.d.ts +42 -0
- package/dist/app-shell/app-shell.js +191 -0
- package/dist/app-shell/app-shell.js.map +1 -0
- package/dist/app-shell/floating-actions.d.ts +19 -0
- package/dist/app-shell/floating-actions.js +59 -0
- package/dist/app-shell/floating-actions.js.map +1 -0
- package/dist/app-shell/workspace-switcher.d.ts +25 -0
- package/dist/app-shell/workspace-switcher.js +82 -0
- package/dist/app-shell/workspace-switcher.js.map +1 -0
- package/dist/badge/badge.d.ts +19 -0
- package/dist/badge/badge.js +59 -0
- package/dist/badge/badge.js.map +1 -0
- package/dist/banner/banner.d.ts +22 -0
- package/dist/banner/banner.js +80 -0
- package/dist/banner/banner.js.map +1 -0
- package/dist/breadcrumbs/breadcrumbs.d.ts +18 -0
- package/dist/breadcrumbs/breadcrumbs.js +45 -0
- package/dist/breadcrumbs/breadcrumbs.js.map +1 -0
- package/dist/button/button.d.ts +38 -0
- package/dist/button/button.js +83 -0
- package/dist/button/button.js.map +1 -0
- package/dist/card/card.d.ts +159 -0
- package/dist/card/card.js +390 -0
- package/dist/card/card.js.map +1 -0
- package/dist/card/insight-card.d.ts +19 -0
- package/dist/card/insight-card.js +51 -0
- package/dist/card/insight-card.js.map +1 -0
- package/dist/card/integration-card.d.ts +19 -0
- package/dist/card/integration-card.js +70 -0
- package/dist/card/integration-card.js.map +1 -0
- package/dist/charts/charts.d.ts +75 -0
- package/dist/charts/charts.js +453 -0
- package/dist/charts/charts.js.map +1 -0
- package/dist/choice/choice.d.ts +39 -0
- package/dist/choice/choice.js +143 -0
- package/dist/choice/choice.js.map +1 -0
- package/dist/combobox/combobox.d.ts +46 -0
- package/dist/combobox/combobox.js +196 -0
- package/dist/combobox/combobox.js.map +1 -0
- package/dist/command-palette/command-palette.d.ts +35 -0
- package/dist/command-palette/command-palette.js +164 -0
- package/dist/command-palette/command-palette.js.map +1 -0
- package/dist/confirm-dialog/confirm-dialog.d.ts +37 -0
- package/dist/confirm-dialog/confirm-dialog.js +106 -0
- package/dist/confirm-dialog/confirm-dialog.js.map +1 -0
- package/dist/content/assistant.d.ts +86 -0
- package/dist/content/assistant.js +213 -0
- package/dist/content/assistant.js.map +1 -0
- package/dist/content/content.d.ts +45 -0
- package/dist/content/content.js +136 -0
- package/dist/content/content.js.map +1 -0
- package/dist/data-display/avatar-sizes.d.ts +8 -0
- package/dist/data-display/avatar-sizes.js +12 -0
- package/dist/data-display/avatar-sizes.js.map +1 -0
- package/dist/data-display/avatar.d.ts +21 -0
- package/dist/data-display/avatar.js +53 -0
- package/dist/data-display/avatar.js.map +1 -0
- package/dist/data-display/chip.d.ts +20 -0
- package/dist/data-display/chip.js +64 -0
- package/dist/data-display/chip.js.map +1 -0
- package/dist/data-display/code-block.d.ts +14 -0
- package/dist/data-display/code-block.js +50 -0
- package/dist/data-display/code-block.js.map +1 -0
- package/dist/data-display/data-display.d.ts +73 -0
- package/dist/data-display/data-display.js +227 -0
- package/dist/data-display/data-display.js.map +1 -0
- package/dist/data-display/insights.d.ts +120 -0
- package/dist/data-display/insights.js +220 -0
- package/dist/data-display/insights.js.map +1 -0
- package/dist/data-table/cells.d.ts +86 -0
- package/dist/data-table/cells.js +163 -0
- package/dist/data-table/cells.js.map +1 -0
- package/dist/data-table/data-table.d.ts +112 -0
- package/dist/data-table/data-table.js +558 -0
- package/dist/data-table/data-table.js.map +1 -0
- package/dist/date-picker/date-picker.d.ts +61 -0
- package/dist/date-picker/date-picker.js +309 -0
- package/dist/date-picker/date-picker.js.map +1 -0
- package/dist/drawer/drawer.d.ts +32 -0
- package/dist/drawer/drawer.js +72 -0
- package/dist/drawer/drawer.js.map +1 -0
- package/dist/empty-state/empty-state.d.ts +25 -0
- package/dist/empty-state/empty-state.js +78 -0
- package/dist/empty-state/empty-state.js.map +1 -0
- package/dist/error-state/error-state.d.ts +19 -0
- package/dist/error-state/error-state.js +56 -0
- package/dist/error-state/error-state.js.map +1 -0
- package/dist/event-calendar/calendar-logic.test.d.ts +1 -0
- package/dist/event-calendar/dates.d.ts +35 -0
- package/dist/event-calendar/dates.js +55 -0
- package/dist/event-calendar/dates.js.map +1 -0
- package/dist/event-calendar/event-calendar.d.ts +125 -0
- package/dist/event-calendar/event-calendar.js +795 -0
- package/dist/event-calendar/event-calendar.js.map +1 -0
- package/dist/event-calendar/event-details.d.ts +50 -0
- package/dist/event-calendar/event-details.js +124 -0
- package/dist/event-calendar/event-details.js.map +1 -0
- package/dist/event-calendar/layout.d.ts +48 -0
- package/dist/event-calendar/layout.js +55 -0
- package/dist/event-calendar/layout.js.map +1 -0
- package/dist/file-upload/file-upload.d.ts +70 -0
- package/dist/file-upload/file-upload.js +307 -0
- package/dist/file-upload/file-upload.js.map +1 -0
- package/dist/filters/filters.d.ts +48 -0
- package/dist/filters/filters.js +103 -0
- package/dist/filters/filters.js.map +1 -0
- package/dist/form-field/form-field.d.ts +39 -0
- package/dist/form-field/form-field.js +88 -0
- package/dist/form-field/form-field.js.map +1 -0
- package/dist/hover-card/hover-card.d.ts +15 -0
- package/dist/hover-card/hover-card.js +27 -0
- package/dist/hover-card/hover-card.js.map +1 -0
- package/dist/hover-card/person-hover-card.d.ts +26 -0
- package/dist/hover-card/person-hover-card.js +85 -0
- package/dist/hover-card/person-hover-card.js.map +1 -0
- package/dist/icon/icon-tile.d.ts +20 -0
- package/dist/icon/icon-tile.js +55 -0
- package/dist/icon/icon-tile.js.map +1 -0
- package/dist/icon/icon.d.ts +14 -0
- package/dist/icon/icon.js +28 -0
- package/dist/icon/icon.js.map +1 -0
- package/dist/icon/icons.generated.d.ts +358 -0
- package/dist/icon/icons.generated.js +362 -0
- package/dist/icon/icons.generated.js.map +1 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +88 -0
- package/dist/input/extra-inputs.d.ts +122 -0
- package/dist/input/extra-inputs.js +351 -0
- package/dist/input/extra-inputs.js.map +1 -0
- package/dist/input/field-styles.d.ts +5 -0
- package/dist/input/field-styles.js +14 -0
- package/dist/input/field-styles.js.map +1 -0
- package/dist/input/input.d.ts +50 -0
- package/dist/input/input.js +107 -0
- package/dist/input/input.js.map +1 -0
- package/dist/layout/layout.d.ts +41 -0
- package/dist/layout/layout.js +90 -0
- package/dist/layout/layout.js.map +1 -0
- package/dist/lib/control-styles.d.ts +9 -0
- package/dist/lib/control-styles.js +16 -0
- package/dist/lib/control-styles.js.map +1 -0
- package/dist/lib/cx.d.ts +2 -0
- package/dist/lib/cx.js +8 -0
- package/dist/lib/cx.js.map +1 -0
- package/dist/lib/glyphs.d.ts +13 -0
- package/dist/lib/glyphs.js +67 -0
- package/dist/lib/glyphs.js.map +1 -0
- package/dist/lib/segmented-styles.d.ts +8 -0
- package/dist/lib/segmented-styles.js +12 -0
- package/dist/lib/segmented-styles.js.map +1 -0
- package/dist/lib/select-on-arrow.d.ts +7 -0
- package/dist/lib/select-on-arrow.js +21 -0
- package/dist/lib/select-on-arrow.js.map +1 -0
- package/dist/lib/skip-link.d.ts +5 -0
- package/dist/lib/skip-link.js +13 -0
- package/dist/lib/skip-link.js.map +1 -0
- package/dist/lib/use-media-query.d.ts +4 -0
- package/dist/lib/use-media-query.js +15 -0
- package/dist/lib/use-media-query.js.map +1 -0
- package/dist/lists/lists.d.ts +76 -0
- package/dist/lists/lists.js +133 -0
- package/dist/lists/lists.js.map +1 -0
- package/dist/locale-switch/locale-switch.d.ts +29 -0
- package/dist/locale-switch/locale-switch.js +62 -0
- package/dist/locale-switch/locale-switch.js.map +1 -0
- package/dist/logo/logo.d.ts +31 -0
- package/dist/logo/logo.js +157 -0
- package/dist/logo/logo.js.map +1 -0
- package/dist/logo/product-logo.d.ts +19 -0
- package/dist/logo/product-logo.js +46 -0
- package/dist/logo/product-logo.js.map +1 -0
- package/dist/marketing/marketing.d.ts +176 -0
- package/dist/marketing/marketing.js +451 -0
- package/dist/marketing/marketing.js.map +1 -0
- package/dist/marketing/newsletter-form.d.ts +21 -0
- package/dist/marketing/newsletter-form.js +100 -0
- package/dist/marketing/newsletter-form.js.map +1 -0
- package/dist/mascot/mascot.d.ts +28 -0
- package/dist/mascot/mascot.js +28 -0
- package/dist/mascot/mascot.js.map +1 -0
- package/dist/mascot/mascots.generated.d.ts +284 -0
- package/dist/mascot/mascots.generated.js +287 -0
- package/dist/mascot/mascots.generated.js.map +1 -0
- package/dist/master-detail/master-detail.d.ts +30 -0
- package/dist/master-detail/master-detail.js +71 -0
- package/dist/master-detail/master-detail.js.map +1 -0
- package/dist/menu/account-menu.d.ts +44 -0
- package/dist/menu/account-menu.js +78 -0
- package/dist/menu/account-menu.js.map +1 -0
- package/dist/menu/context-menu.d.ts +31 -0
- package/dist/menu/context-menu.js +111 -0
- package/dist/menu/context-menu.js.map +1 -0
- package/dist/menu/dropdown-menu.d.ts +49 -0
- package/dist/menu/dropdown-menu.js +152 -0
- package/dist/menu/dropdown-menu.js.map +1 -0
- package/dist/menu/menu-styles.d.ts +8 -0
- package/dist/menu/menu-styles.js +6 -0
- package/dist/menu/menu-styles.js.map +1 -0
- package/dist/menu/menubar.d.ts +31 -0
- package/dist/menu/menubar.js +125 -0
- package/dist/menu/menubar.js.map +1 -0
- package/dist/modal/modal.d.ts +34 -0
- package/dist/modal/modal.js +58 -0
- package/dist/modal/modal.js.map +1 -0
- package/dist/notification-center/notification-center.d.ts +51 -0
- package/dist/notification-center/notification-center.js +244 -0
- package/dist/notification-center/notification-center.js.map +1 -0
- package/dist/otp-input/otp-input.d.ts +23 -0
- package/dist/otp-input/otp-input.js +61 -0
- package/dist/otp-input/otp-input.js.map +1 -0
- package/dist/overlay/overlay.d.ts +53 -0
- package/dist/overlay/overlay.js +103 -0
- package/dist/overlay/overlay.js.map +1 -0
- package/dist/page-header/page-header.d.ts +55 -0
- package/dist/page-header/page-header.js +114 -0
- package/dist/page-header/page-header.js.map +1 -0
- package/dist/page-header/record-headers.d.ts +51 -0
- package/dist/page-header/record-headers.js +134 -0
- package/dist/page-header/record-headers.js.map +1 -0
- package/dist/page-header/section-header.d.ts +21 -0
- package/dist/page-header/section-header.js +44 -0
- package/dist/page-header/section-header.js.map +1 -0
- package/dist/page-navigation/page-navigation.d.ts +59 -0
- package/dist/page-navigation/page-navigation.js +136 -0
- package/dist/page-navigation/page-navigation.js.map +1 -0
- package/dist/pagination/pagination.d.ts +28 -0
- package/dist/pagination/pagination.js +102 -0
- package/dist/pagination/pagination.js.map +1 -0
- package/dist/phone-input/phone-input.d.ts +34 -0
- package/dist/phone-input/phone-input.js +171 -0
- package/dist/phone-input/phone-input.js.map +1 -0
- package/dist/popover/popover.d.ts +23 -0
- package/dist/popover/popover.js +40 -0
- package/dist/popover/popover.js.map +1 -0
- package/dist/progress/progress.d.ts +21 -0
- package/dist/progress/progress.js +49 -0
- package/dist/progress/progress.js.map +1 -0
- package/dist/segmented-control/segmented-control.d.ts +32 -0
- package/dist/segmented-control/segmented-control.js +29 -0
- package/dist/segmented-control/segmented-control.js.map +1 -0
- package/dist/select/select.d.ts +48 -0
- package/dist/select/select.js +136 -0
- package/dist/select/select.js.map +1 -0
- package/dist/settings/permission-matrix.d.ts +29 -0
- package/dist/settings/permission-matrix.js +101 -0
- package/dist/settings/permission-matrix.js.map +1 -0
- package/dist/settings/settings-row.d.ts +32 -0
- package/dist/settings/settings-row.js +63 -0
- package/dist/settings/settings-row.js.map +1 -0
- package/dist/side-nav/side-nav.d.ts +36 -0
- package/dist/side-nav/side-nav.js +123 -0
- package/dist/side-nav/side-nav.js.map +1 -0
- package/dist/site-header/site-header.d.ts +32 -0
- package/dist/site-header/site-header.js +99 -0
- package/dist/site-header/site-header.js.map +1 -0
- package/dist/skeleton/skeleton.d.ts +16 -0
- package/dist/skeleton/skeleton.js +19 -0
- package/dist/skeleton/skeleton.js.map +1 -0
- package/dist/slider/slider.d.ts +15 -0
- package/dist/slider/slider.js +48 -0
- package/dist/slider/slider.js.map +1 -0
- package/dist/spinner/spinner.d.ts +15 -0
- package/dist/spinner/spinner.js +42 -0
- package/dist/spinner/spinner.js.map +1 -0
- package/dist/stepper/step-dots.d.ts +16 -0
- package/dist/stepper/step-dots.js +26 -0
- package/dist/stepper/step-dots.js.map +1 -0
- package/dist/stepper/stepper.d.ts +26 -0
- package/dist/stepper/stepper.js +113 -0
- package/dist/stepper/stepper.js.map +1 -0
- package/dist/tabs/tabs.d.ts +31 -0
- package/dist/tabs/tabs.js +66 -0
- package/dist/tabs/tabs.js.map +1 -0
- package/dist/templates/app-templates.d.ts +126 -0
- package/dist/templates/app-templates.js +153 -0
- package/dist/templates/app-templates.js.map +1 -0
- package/dist/templates/site-templates.d.ts +49 -0
- package/dist/templates/site-templates.js +110 -0
- package/dist/templates/site-templates.js.map +1 -0
- package/dist/toast/toast-store.d.ts +54 -0
- package/dist/toast/toast-store.js +49 -0
- package/dist/toast/toast-store.js.map +1 -0
- package/dist/toast/toaster.d.ts +15 -0
- package/dist/toast/toaster.js +124 -0
- package/dist/toast/toaster.js.map +1 -0
- package/dist/tooltip/tooltip.d.ts +29 -0
- package/dist/tooltip/tooltip.js +54 -0
- package/dist/tooltip/tooltip.js.map +1 -0
- package/package.json +88 -3
- package/styles.css +521 -0
- package/README.md +0 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../lib/cx.js";
|
|
3
|
+
import { OverlayBackdrop as t, PanelBody as n, PanelFooter as r, PanelHeader as i, SheetHandle as a, useSwipeDismiss as o } from "../overlay/overlay.js";
|
|
4
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
import { createContext as l, useContext as u, useState as d } from "react";
|
|
6
|
+
import * as f from "@radix-ui/react-dialog";
|
|
7
|
+
//#region src/drawer/drawer.tsx
|
|
8
|
+
var p = {
|
|
9
|
+
right: "kf-drawer--right touch-pan-y inset-y-0 right-0 h-dvh w-[88vw] rounded-l-xl pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]",
|
|
10
|
+
left: "kf-drawer--left touch-pan-y inset-y-0 left-0 h-dvh w-[88vw] rounded-r-xl pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]",
|
|
11
|
+
bottom: "kf-drawer--bottom inset-x-0 bottom-0 rounded-t-xl pb-[env(safe-area-inset-bottom)]"
|
|
12
|
+
}, m = {
|
|
13
|
+
right: {
|
|
14
|
+
sm: "max-w-sm",
|
|
15
|
+
md: "max-w-md",
|
|
16
|
+
lg: "max-w-2xl"
|
|
17
|
+
},
|
|
18
|
+
left: {
|
|
19
|
+
sm: "max-w-sm",
|
|
20
|
+
md: "max-w-md",
|
|
21
|
+
lg: "max-w-2xl"
|
|
22
|
+
},
|
|
23
|
+
bottom: {
|
|
24
|
+
sm: "max-h-[40dvh]",
|
|
25
|
+
md: "max-h-[70dvh]",
|
|
26
|
+
lg: "max-h-[92dvh]"
|
|
27
|
+
}
|
|
28
|
+
}, h = l(() => {});
|
|
29
|
+
function g({ open: e, defaultOpen: t = !1, onOpenChange: n, children: r }) {
|
|
30
|
+
let [i, a] = d(t), o = e ?? i, c = (t) => {
|
|
31
|
+
e === void 0 && a(t), n?.(t);
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ s(f.Root, {
|
|
34
|
+
open: o,
|
|
35
|
+
onOpenChange: c,
|
|
36
|
+
children: /* @__PURE__ */ s(h.Provider, {
|
|
37
|
+
value: () => c(!1),
|
|
38
|
+
children: r
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var _ = f.Trigger, v = f.Close;
|
|
43
|
+
function y({ title: l, description: d, side: g = "right", size: _ = "md", footer: v, hideTitle: y, hideClose: b, closeLabel: x = "Close", headerTone: S = "default", bodyClassName: C, className: w, children: T, ...E }) {
|
|
44
|
+
let D = u(h), O = g === "bottom", { panelRef: k, handlers: A } = o(O ? "down" : g, D, { touchOnly: !O });
|
|
45
|
+
return /* @__PURE__ */ c(f.Portal, { children: [/* @__PURE__ */ s(t, {}), /* @__PURE__ */ c(f.Content, {
|
|
46
|
+
ref: k,
|
|
47
|
+
...d ? {} : { "aria-describedby": void 0 },
|
|
48
|
+
className: e("kf-drawer fixed z-50 flex flex-col bg-surface font-sans text-fg shadow-overlay focus:outline-none", p[g], m[g][_], S === "brand" && "overflow-hidden", w),
|
|
49
|
+
...E,
|
|
50
|
+
...O ? {} : A,
|
|
51
|
+
children: [
|
|
52
|
+
O && /* @__PURE__ */ s(a, { ...A }),
|
|
53
|
+
/* @__PURE__ */ s(i, {
|
|
54
|
+
title: l,
|
|
55
|
+
description: d,
|
|
56
|
+
hideTitle: y,
|
|
57
|
+
hideClose: b,
|
|
58
|
+
closeLabel: x,
|
|
59
|
+
tone: S
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ s(n, {
|
|
62
|
+
className: C,
|
|
63
|
+
children: T
|
|
64
|
+
}),
|
|
65
|
+
v && /* @__PURE__ */ s(r, { children: v })
|
|
66
|
+
]
|
|
67
|
+
})] });
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { g as Drawer, v as DrawerClose, y as DrawerContent, _ as DrawerTrigger };
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.js","names":["Dialog","SIDES","SIZES","CloseContext","createContext","Drawer","openProp","uncontrolled","setUncontrolled","useState","defaultOpen","open","setOpen","next","onOpenChange","DrawerTrigger","DrawerClose","DrawerContent","rest","close","useContext","isBottom","side","useSwipeDismiss","OverlayBackdrop","panelRef","description","cx","size","headerTone","className","handlers","SheetHandle","PanelHeader","PanelBody","bodyClassName","footer","PanelFooter"],"sources":["../../src/drawer/drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as Dialog from '@radix-ui/react-dialog';\nimport { createContext, useContext, useState, type ComponentPropsWithoutRef, type ReactNode } from 'react';\nimport { cx } from '../lib/cx';\nimport { OverlayBackdrop, PanelBody, PanelFooter, PanelHeader, SheetHandle, useSwipeDismiss } from '../overlay/overlay';\n\nexport type DrawerSide = 'left' | 'right' | 'bottom';\nexport type DrawerSize = 'sm' | 'md' | 'lg';\n\nconst SIDES: Record<DrawerSide, string> = {\n right: 'kf-drawer--right touch-pan-y inset-y-0 right-0 h-dvh w-[88vw] rounded-l-xl pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]',\n left: 'kf-drawer--left touch-pan-y inset-y-0 left-0 h-dvh w-[88vw] rounded-r-xl pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]',\n bottom: 'kf-drawer--bottom inset-x-0 bottom-0 rounded-t-xl pb-[env(safe-area-inset-bottom)]',\n};\n\n/** Width for side drawers, height for bottom drawers. */\nconst SIZES: Record<DrawerSide, Record<DrawerSize, string>> = {\n right: { sm: 'max-w-sm', md: 'max-w-md', lg: 'max-w-2xl' },\n left: { sm: 'max-w-sm', md: 'max-w-md', lg: 'max-w-2xl' },\n bottom: { sm: 'max-h-[40dvh]', md: 'max-h-[70dvh]', lg: 'max-h-[92dvh]' },\n};\n\nconst CloseContext = createContext<() => void>(() => {});\n\nexport interface DrawerProps {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: ReactNode;\n}\n\n/**\n * Panel that slides in from an edge while keeping the page context: navigation on mobile,\n * filters, record details, settings. Swipe toward its edge to dismiss on touch screens.\n */\nexport function Drawer({ open: openProp, defaultOpen = false, onOpenChange, children }: DrawerProps) {\n const [uncontrolled, setUncontrolled] = useState(defaultOpen);\n const open = openProp ?? uncontrolled;\n const setOpen = (next: boolean) => {\n if (openProp === undefined) setUncontrolled(next);\n onOpenChange?.(next);\n };\n return (\n <Dialog.Root open={open} onOpenChange={setOpen}>\n <CloseContext.Provider value={() => setOpen(false)}>{children}</CloseContext.Provider>\n </Dialog.Root>\n );\n}\n\nexport const DrawerTrigger = Dialog.Trigger;\nexport const DrawerClose = Dialog.Close;\n\nexport interface DrawerContentProps extends Omit<ComponentPropsWithoutRef<typeof Dialog.Content>, 'title' | 'asChild'> {\n title: ReactNode;\n description?: ReactNode;\n side?: DrawerSide;\n size?: DrawerSize;\n footer?: ReactNode;\n hideTitle?: boolean;\n hideClose?: boolean;\n closeLabel?: string;\n /** `brand`: the header is a solid brand band (record and edit drawers in product dashboards). */\n headerTone?: 'default' | 'brand';\n /** Extra classes for the scrollable body. To override its padding use the important modifier (`px-0!`). */\n bodyClassName?: string;\n}\n\nexport function DrawerContent({\n title,\n description,\n side = 'right',\n size = 'md',\n footer,\n hideTitle,\n hideClose,\n closeLabel = 'Close',\n headerTone = 'default',\n bodyClassName,\n className,\n children,\n ...rest\n}: DrawerContentProps) {\n const close = useContext(CloseContext);\n const isBottom = side === 'bottom';\n const { panelRef, handlers } = useSwipeDismiss(isBottom ? 'down' : side, close, { touchOnly: !isBottom });\n return (\n <Dialog.Portal>\n <OverlayBackdrop />\n <Dialog.Content\n ref={panelRef}\n {...(description ? {} : { 'aria-describedby': undefined })}\n className={cx(\n 'kf-drawer fixed z-50 flex flex-col bg-surface font-sans text-fg shadow-overlay focus:outline-none',\n SIDES[side],\n SIZES[side][size],\n // The band reaches the panel's rounded corners.\n headerTone === 'brand' && 'overflow-hidden',\n className,\n )}\n {...rest}\n {...(isBottom ? {} : handlers)}\n >\n {isBottom && <SheetHandle {...handlers} />}\n <PanelHeader\n title={title}\n description={description}\n hideTitle={hideTitle}\n hideClose={hideClose}\n closeLabel={closeLabel}\n tone={headerTone}\n />\n <PanelBody className={bodyClassName}>{children}</PanelBody>\n {footer && <PanelFooter>{footer}</PanelFooter>}\n </Dialog.Content>\n </Dialog.Portal>\n );\n}\n"],"mappings":";;;;;;;AAUA,IAAMC,IAAoC;CACxC,OAAO;CACP,MAAM;CACN,QAAQ;AACV,GAGMC,IAAwD;CAC5D,OAAO;EAAE,IAAI;EAAY,IAAI;EAAY,IAAI;CAAY;CACzD,MAAM;EAAE,IAAI;EAAY,IAAI;EAAY,IAAI;CAAY;CACxD,QAAQ;EAAE,IAAI;EAAiB,IAAI;EAAiB,IAAI;CAAgB;AAC1E,GAEMC,IAAeC,QAAgC,CAAC,CAAC;AAavD,SAAgBC,EAAO,EAAE,MAAMC,GAAU,iBAAc,IAAO,iBAAc,eAAyB;CACnG,IAAM,CAACC,GAAcC,KAAmBC,EAASC,CAAW,GACtDC,IAAOL,KAAYC,GACnBK,KAAW,MAAkB;EAEjC,AADIN,MAAa,KAAA,KAAWE,EAAgBK,CAAI,GAChDC,IAAeD,CAAI;CACrB;CACA,OACE,kBAACb,EAAO,MAAR;EAAmB;EAAM,cAAcY;EACrC,UAAA,kBAACT,EAAa,UAAd;GAAuB,aAAaS,EAAQ,EAAK;GAAI;EAAgC,CAAA;CAC1E,CAAA;AAEjB;AAEA,IAAaG,IAAgBf,EAAO,SACvBgB,IAAchB,EAAO;AAiBlC,SAAgBiB,EAAc,EAC5B,UACA,gBACA,UAAO,SACP,UAAO,MACP,WACA,cACA,cACA,gBAAa,SACb,gBAAa,WACb,kBACA,cACA,aACA,GAAGC,KACkB;CACrB,IAAMC,IAAQC,EAAWjB,CAAY,GAC/BkB,IAAWC,MAAS,UACpB,EAAE,aAAU,gBAAaC,EAAgBF,IAAW,SAASC,GAAMH,GAAO,EAAE,WAAW,CAACE,EAAS,CAAC;CACxG,OACE,kBAACrB,EAAO,QAAR,EAAA,UAAA,CACE,kBAACwB,GAAD,CAAkB,CAAA,GAClB,kBAACxB,EAAO,SAAR;EACE,KAAKyB;EACL,GAAKC,IAAc,CAAC,IAAI,EAAE,oBAAoB,KAAA,EAAU;EACxD,WAAWC,EACT,qGACA1B,EAAMqB,IACNpB,EAAMoB,EAAK,CAACM,IAEZC,MAAe,WAAW,mBAC1BC,CACF;EACA,GAAIZ;EACJ,GAAKG,IAAW,CAAC,IAAIU;EAZvB,UAAA;GAcGV,KAAY,kBAACW,GAAD,EAAa,GAAID,EAAW,CAAA;GACzC,kBAACE,GAAD;IACS;IACM;IACF;IACA;IACC;IACZ,MAAMJ;GACP,CAAA;GACD,kBAACK,GAAD;IAAW,WAAWC;IAAgB;GAAoB,CAAA;GACzDC,KAAU,kBAACC,GAAD,EAAA,UAAcD,EAAoB,CAAA;EAC/B;CACH,CAAA,CAAA,EAAA,CAAA;AAEnB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { type MascotStandingState } from '../mascot/mascot';
|
|
3
|
+
import { type IconName } from '../icon/icon';
|
|
4
|
+
/** `inline`: an icon and one line, no mascot, for empty tables and dashboard cards. */
|
|
5
|
+
export type EmptyStateSize = 'inline' | 'sm' | 'md' | 'lg';
|
|
6
|
+
export interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** Mascot expression. `idle` for first use, `happy` for "all done", `lost` for no results, `sad` for errors. */
|
|
10
|
+
mascot?: MascotStandingState | false;
|
|
11
|
+
/** Primary and secondary actions (Buttons). */
|
|
12
|
+
actions?: ReactNode;
|
|
13
|
+
size?: EmptyStateSize;
|
|
14
|
+
/** Icon of the `inline` size (default `inbox`). */
|
|
15
|
+
icon?: IconName;
|
|
16
|
+
/** Heading level of the title, to fit the page outline. `1` when the state is the whole page (404). */
|
|
17
|
+
headingLevel?: 1 | 2 | 3 | 4;
|
|
18
|
+
/** Extra content below the actions (e.g. a help link or error details). */
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* What a view shows when there is nothing to show: first use, no results, all done.
|
|
23
|
+
* Always explain why and offer the next step.
|
|
24
|
+
*/
|
|
25
|
+
export declare function EmptyState({ title, description, mascot, actions, size, headingLevel, icon, className, children, ...rest }: EmptyStateProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { cx as e } from "../lib/cx.js";
|
|
2
|
+
import { Icon as t } from "../icon/icon.js";
|
|
3
|
+
import { Mascot as n } from "../mascot/mascot.js";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/empty-state/empty-state.tsx
|
|
6
|
+
var a = {
|
|
7
|
+
sm: {
|
|
8
|
+
wrap: "gap-2 px-4 py-8",
|
|
9
|
+
mascot: 48,
|
|
10
|
+
title: "text-base"
|
|
11
|
+
},
|
|
12
|
+
md: {
|
|
13
|
+
wrap: "gap-3 px-6 py-12",
|
|
14
|
+
mascot: 72,
|
|
15
|
+
title: "text-xl"
|
|
16
|
+
},
|
|
17
|
+
lg: {
|
|
18
|
+
wrap: "gap-4 px-6 py-20",
|
|
19
|
+
mascot: 104,
|
|
20
|
+
title: "text-3xl"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function o({ title: o, description: s, mascot: c = "idle", actions: l, size: u = "md", headingLevel: d = 2, icon: f = "inbox", className: p, children: m, ...h }) {
|
|
24
|
+
if (u === "inline") return /* @__PURE__ */ i("div", {
|
|
25
|
+
className: e("grid justify-items-center gap-2 px-4 py-8 text-center font-sans", p),
|
|
26
|
+
...h,
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ r(t, {
|
|
29
|
+
name: f,
|
|
30
|
+
size: 32,
|
|
31
|
+
className: "text-fg-muted"
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ r("p", {
|
|
34
|
+
className: "m-0 text-[15px] text-fg",
|
|
35
|
+
children: o
|
|
36
|
+
}),
|
|
37
|
+
s && /* @__PURE__ */ r("p", {
|
|
38
|
+
className: "m-0 max-w-[28rem] text-sm text-pretty text-fg-muted",
|
|
39
|
+
children: s
|
|
40
|
+
}),
|
|
41
|
+
l && /* @__PURE__ */ r("div", {
|
|
42
|
+
className: "mt-1 flex flex-wrap justify-center gap-3",
|
|
43
|
+
children: l
|
|
44
|
+
}),
|
|
45
|
+
m
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
let g = a[u], _ = `h${d}`;
|
|
49
|
+
return /* @__PURE__ */ i("div", {
|
|
50
|
+
className: e("grid justify-items-center text-center font-sans", g.wrap, p),
|
|
51
|
+
...h,
|
|
52
|
+
children: [
|
|
53
|
+
c && /* @__PURE__ */ r(n, {
|
|
54
|
+
state: c,
|
|
55
|
+
size: g.mascot,
|
|
56
|
+
title: "",
|
|
57
|
+
className: "mb-1 text-primary"
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ r(_, {
|
|
60
|
+
className: e("m-0 font-display font-bold tracking-tight text-balance text-fg", g.title),
|
|
61
|
+
children: o
|
|
62
|
+
}),
|
|
63
|
+
s && /* @__PURE__ */ r("p", {
|
|
64
|
+
className: "m-0 max-w-[28rem] text-[15px] text-pretty text-fg-muted",
|
|
65
|
+
children: s
|
|
66
|
+
}),
|
|
67
|
+
l && /* @__PURE__ */ r("div", {
|
|
68
|
+
className: "mt-2 flex flex-wrap justify-center gap-3",
|
|
69
|
+
children: l
|
|
70
|
+
}),
|
|
71
|
+
m
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { o as EmptyState };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=empty-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-state.js","names":["SIZES","EmptyState","rest","size","cx","className","Icon","icon","title","description","actions","children","s","Heading","headingLevel","mascot","Mascot"],"sources":["../../src/empty-state/empty-state.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\nimport { cx } from '../lib/cx';\nimport { Mascot, type MascotStandingState } from '../mascot/mascot';\nimport { Icon, type IconName } from '../icon/icon';\n\n/** `inline`: an icon and one line, no mascot, for empty tables and dashboard cards. */\nexport type EmptyStateSize = 'inline' | 'sm' | 'md' | 'lg';\n\nconst SIZES: Record<Exclude<EmptyStateSize, 'inline'>, { wrap: string; mascot: number; title: string }> = {\n sm: { wrap: 'gap-2 px-4 py-8', mascot: 48, title: 'text-base' },\n md: { wrap: 'gap-3 px-6 py-12', mascot: 72, title: 'text-xl' },\n lg: { wrap: 'gap-4 px-6 py-20', mascot: 104, title: 'text-3xl' },\n};\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n title: ReactNode;\n description?: ReactNode;\n /** Mascot expression. `idle` for first use, `happy` for \"all done\", `lost` for no results, `sad` for errors. */\n mascot?: MascotStandingState | false;\n /** Primary and secondary actions (Buttons). */\n actions?: ReactNode;\n size?: EmptyStateSize;\n /** Icon of the `inline` size (default `inbox`). */\n icon?: IconName;\n /** Heading level of the title, to fit the page outline. `1` when the state is the whole page (404). */\n headingLevel?: 1 | 2 | 3 | 4;\n /** Extra content below the actions (e.g. a help link or error details). */\n children?: ReactNode;\n}\n\n/**\n * What a view shows when there is nothing to show: first use, no results, all done.\n * Always explain why and offer the next step.\n */\nexport function EmptyState({\n title,\n description,\n mascot = 'idle',\n actions,\n size = 'md',\n headingLevel = 2,\n icon = 'inbox',\n className,\n children,\n ...rest\n}: EmptyStateProps) {\n if (size === 'inline') {\n // A line of text, not a heading: inline states sit inside a card or table that already has one.\n return (\n <div className={cx('grid justify-items-center gap-2 px-4 py-8 text-center font-sans', className)} {...rest}>\n <Icon name={icon} size={32} className=\"text-fg-muted\" />\n <p className=\"m-0 text-[15px] text-fg\">{title}</p>\n {description && <p className=\"m-0 max-w-[28rem] text-sm text-pretty text-fg-muted\">{description}</p>}\n {actions && <div className=\"mt-1 flex flex-wrap justify-center gap-3\">{actions}</div>}\n {children}\n </div>\n );\n }\n const s = SIZES[size];\n const Heading = `h${headingLevel}` as const;\n return (\n <div className={cx('grid justify-items-center text-center font-sans', s.wrap, className)} {...rest}>\n {mascot && <Mascot state={mascot} size={s.mascot} title=\"\" className=\"mb-1 text-primary\" />}\n <Heading className={cx('m-0 font-display font-bold tracking-tight text-balance text-fg', s.title)}>\n {title}\n </Heading>\n {description && <p className=\"m-0 max-w-[28rem] text-[15px] text-pretty text-fg-muted\">{description}</p>}\n {actions && <div className=\"mt-2 flex flex-wrap justify-center gap-3\">{actions}</div>}\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;AAQA,IAAMA,IAAoG;CACxG,IAAI;EAAE,MAAM;EAAmB,QAAQ;EAAI,OAAO;CAAY;CAC9D,IAAI;EAAE,MAAM;EAAoB,QAAQ;EAAI,OAAO;CAAU;CAC7D,IAAI;EAAE,MAAM;EAAoB,QAAQ;EAAK,OAAO;CAAW;AACjE;AAsBA,SAAgBC,EAAW,EACzB,UACA,gBACA,YAAS,QACT,YACA,UAAO,MACP,kBAAe,GACf,UAAO,SACP,cACA,aACA,GAAGC,KACe;CAClB,IAAIC,MAAS,UAEX,OACE,kBAAC,OAAD;EAAK,WAAWC,EAAG,mEAAmEC,CAAS;EAAG,GAAIH;EAAtG,UAAA;GACE,kBAACI,GAAD;IAAM,MAAMC;IAAM,MAAM;IAAI,WAAU;GAAiB,CAAA;GACvD,kBAAC,KAAD;IAAG,WAAU;IAA2B,UAAAC;GAAS,CAAA;GAChDC,KAAe,kBAAC,KAAD;IAAG,WAAU;IAAuD,UAAAA;GAAe,CAAA;GAClGC,KAAW,kBAAC,OAAD;IAAK,WAAU;IAA4C,UAAAA;GAAa,CAAA;GACnFC;EACE;;CAGT,IAAMC,IAAIZ,EAAMG,IACVU,IAAU,IAAIC;CACpB,OACE,kBAAC,OAAD;EAAK,WAAWV,EAAG,mDAAmDQ,EAAE,MAAMP,CAAS;EAAG,GAAIH;EAA9F,UAAA;GACGa,KAAU,kBAACC,GAAD;IAAQ,OAAOD;IAAQ,MAAMH,EAAE;IAAQ,OAAM;IAAG,WAAU;GAAqB,CAAA;GAC1F,kBAACC,GAAD;IAAS,WAAWT,EAAG,kEAAkEQ,EAAE,KAAK;IAC7F,UAAAJ;GACM,CAAA;GACRC,KAAe,kBAAC,KAAD;IAAG,WAAU;IAA2D,UAAAA;GAAe,CAAA;GACtGC,KAAW,kBAAC,OAAD;IAAK,WAAU;IAA4C,UAAAA;GAAa,CAAA;GACnFC;EACE;;AAET"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type EmptyStateProps } from '../empty-state/empty-state';
|
|
3
|
+
export type ErrorKind = 'generic' | 'offline' | 'not-found' | 'forbidden';
|
|
4
|
+
export interface ErrorStateProps extends Omit<EmptyStateProps, 'title' | 'mascot'> {
|
|
5
|
+
kind?: ErrorKind;
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
/** Shows a "Try again" button. Set `retrying` while the retry runs. */
|
|
8
|
+
onRetry?: () => void;
|
|
9
|
+
retryLabel?: string;
|
|
10
|
+
retrying?: boolean;
|
|
11
|
+
/** Technical details (error code, request id) for support, collapsed by default. */
|
|
12
|
+
details?: ReactNode;
|
|
13
|
+
detailsLabel?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A view, section or page failed to load. Says what happened in plain words, offers a retry,
|
|
17
|
+
* and keeps technical details one click away. Announced to screen readers (`role="alert"`).
|
|
18
|
+
*/
|
|
19
|
+
export declare function ErrorState({ kind, title, description, onRetry, retryLabel, retrying, actions, details, detailsLabel, ...rest }: ErrorStateProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Button as e } from "../button/button.js";
|
|
2
|
+
import { EmptyState as t } from "../empty-state/empty-state.js";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
//#region src/error-state/error-state.tsx
|
|
5
|
+
var a = {
|
|
6
|
+
generic: {
|
|
7
|
+
mascot: "error",
|
|
8
|
+
title: "Something went wrong",
|
|
9
|
+
description: "We could not load this. Try again; if it keeps happening, contact support."
|
|
10
|
+
},
|
|
11
|
+
offline: {
|
|
12
|
+
mascot: "sad",
|
|
13
|
+
title: "You are offline",
|
|
14
|
+
description: "Check your connection. We will retry when you are back online."
|
|
15
|
+
},
|
|
16
|
+
"not-found": {
|
|
17
|
+
mascot: "lost",
|
|
18
|
+
title: "We could not find that",
|
|
19
|
+
description: "It may have been moved or deleted, or the link is incomplete."
|
|
20
|
+
},
|
|
21
|
+
forbidden: {
|
|
22
|
+
mascot: "sad",
|
|
23
|
+
title: "You do not have access",
|
|
24
|
+
description: "Ask a workspace admin to give you access."
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
function o({ kind: o = "generic", title: s, description: c, onRetry: l, retryLabel: u = "Try again", retrying: d = !1, actions: f, details: p, detailsLabel: m = "Technical details", ...h }) {
|
|
28
|
+
let g = a[o];
|
|
29
|
+
return /* @__PURE__ */ r(t, {
|
|
30
|
+
role: "alert",
|
|
31
|
+
mascot: g.mascot,
|
|
32
|
+
title: s ?? g.title,
|
|
33
|
+
description: c ?? g.description,
|
|
34
|
+
actions: (l || f) && /* @__PURE__ */ i(n, { children: [l && /* @__PURE__ */ r(e, {
|
|
35
|
+
iconStart: "sync",
|
|
36
|
+
loading: d,
|
|
37
|
+
onClick: l,
|
|
38
|
+
children: u
|
|
39
|
+
}), f] }),
|
|
40
|
+
...h,
|
|
41
|
+
children: p && /* @__PURE__ */ i("details", {
|
|
42
|
+
className: "mt-3 max-w-[28rem] text-left text-sm text-fg-muted",
|
|
43
|
+
children: [/* @__PURE__ */ r("summary", {
|
|
44
|
+
className: "cursor-pointer rounded-xs text-center font-medium focus-visible:outline-3 focus-visible:outline-focus",
|
|
45
|
+
children: m
|
|
46
|
+
}), /* @__PURE__ */ r("pre", {
|
|
47
|
+
className: "mt-2 overflow-x-auto rounded-sm bg-surface-muted p-3 font-mono text-xs whitespace-pre-wrap",
|
|
48
|
+
children: p
|
|
49
|
+
})]
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { o as ErrorState };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=error-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-state.js","names":["_Fragment","PRESETS","ErrorState","rest","preset","kind","EmptyState","title","description","onRetry","actions","Fragment","Button","retrying","retryLabel","details","detailsLabel"],"sources":["../../src/error-state/error-state.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { Button } from '../button/button';\nimport { EmptyState, type EmptyStateProps } from '../empty-state/empty-state';\n\nexport type ErrorKind = 'generic' | 'offline' | 'not-found' | 'forbidden';\n\nconst PRESETS: Record<ErrorKind, { mascot: 'error' | 'sad' | 'lost'; title: string; description: string }> = {\n generic: { mascot: 'error', title: 'Something went wrong', description: 'We could not load this. Try again; if it keeps happening, contact support.' },\n offline: { mascot: 'sad', title: 'You are offline', description: 'Check your connection. We will retry when you are back online.' },\n 'not-found': { mascot: 'lost', title: 'We could not find that', description: 'It may have been moved or deleted, or the link is incomplete.' },\n forbidden: { mascot: 'sad', title: 'You do not have access', description: 'Ask a workspace admin to give you access.' },\n};\n\nexport interface ErrorStateProps extends Omit<EmptyStateProps, 'title' | 'mascot'> {\n kind?: ErrorKind;\n title?: ReactNode;\n /** Shows a \"Try again\" button. Set `retrying` while the retry runs. */\n onRetry?: () => void;\n retryLabel?: string;\n retrying?: boolean;\n /** Technical details (error code, request id) for support, collapsed by default. */\n details?: ReactNode;\n detailsLabel?: string;\n}\n\n/**\n * A view, section or page failed to load. Says what happened in plain words, offers a retry,\n * and keeps technical details one click away. Announced to screen readers (`role=\"alert\"`).\n */\nexport function ErrorState({\n kind = 'generic',\n title,\n description,\n onRetry,\n retryLabel = 'Try again',\n retrying = false,\n actions,\n details,\n detailsLabel = 'Technical details',\n ...rest\n}: ErrorStateProps) {\n const preset = PRESETS[kind];\n return (\n <EmptyState\n role=\"alert\"\n mascot={preset.mascot}\n title={title ?? preset.title}\n description={description ?? preset.description}\n actions={\n (onRetry || actions) && (\n <>\n {onRetry && (\n <Button iconStart=\"sync\" loading={retrying} onClick={onRetry}>\n {retryLabel}\n </Button>\n )}\n {actions}\n </>\n )\n }\n {...rest}\n >\n {details && (\n <details className=\"mt-3 max-w-[28rem] text-left text-sm text-fg-muted\">\n <summary className=\"cursor-pointer rounded-xs text-center font-medium focus-visible:outline-3 focus-visible:outline-focus\">\n {detailsLabel}\n </summary>\n <pre className=\"mt-2 overflow-x-auto rounded-sm bg-surface-muted p-3 font-mono text-xs whitespace-pre-wrap\">{details}</pre>\n </details>\n )}\n </EmptyState>\n );\n}\n"],"mappings":";;;;AAMA,IAAMC,IAAuG;CAC3G,SAAS;EAAE,QAAQ;EAAS,OAAO;EAAwB,aAAa;CAA6E;CACrJ,SAAS;EAAE,QAAQ;EAAO,OAAO;EAAmB,aAAa;CAAiE;CAClI,aAAa;EAAE,QAAQ;EAAQ,OAAO;EAA0B,aAAa;CAAgE;CAC7I,WAAW;EAAE,QAAQ;EAAO,OAAO;EAA0B,aAAa;CAA4C;AACxH;AAkBA,SAAgBC,EAAW,EACzB,UAAO,WACP,UACA,gBACA,YACA,gBAAa,aACb,cAAW,IACX,YACA,YACA,kBAAe,qBACf,GAAGC,KACe;CAClB,IAAMC,IAASH,EAAQI;CACvB,OACE,kBAACC,GAAD;EACE,MAAK;EACL,QAAQF,EAAO;EACf,OAAOG,KAASH,EAAO;EACvB,aAAaI,KAAeJ,EAAO;EACnC,UACGK,KAAWC,MACV,kBAAAV,GAAA,EAAA,UAAA,CACGS,KACC,kBAACG,GAAD;GAAQ,WAAU;GAAO,SAASC;GAAU,SAASJ;GAClD,UAAAK;EACK,CAAA,GAETJ,CACD,EAAA,CAAA;EAGN,GAAIP;EAEH,UAAAY,KACC,kBAAC,WAAD;GAAS,WAAU;GAAnB,UAAA,CACE,kBAAC,WAAD;IAAS,WAAU;IAChB,UAAAC;GACM,CAAA,GACT,kBAAC,OAAD;IAAK,WAAU;IAA8F,UAAAD;GAAa,CAAA,CACnH;;CAED,CAAA;AAEhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar-day helpers (ADR-0016). Days are `YYYY-MM-DD` strings with no time zone and times are `HH:mm` wall-clock
|
|
3
|
+
* strings. Compare days as strings; do arithmetic on UTC midnight so the browser's time zone never shifts a day.
|
|
4
|
+
*/
|
|
5
|
+
/** A calendar day, `YYYY-MM-DD`. */
|
|
6
|
+
export type IsoDate = string;
|
|
7
|
+
/** ISO weekday: 1 = Monday … 7 = Sunday. */
|
|
8
|
+
export type Weekday = 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
9
|
+
export type CalendarView = 'day' | 'week' | 'month';
|
|
10
|
+
export declare const toDate: (iso: IsoDate) => Date;
|
|
11
|
+
export declare const isoOf: (date: Date) => IsoDate;
|
|
12
|
+
export declare const addDays: (iso: IsoDate, n: number) => IsoDate;
|
|
13
|
+
export declare const weekday: (iso: IsoDate) => Weekday;
|
|
14
|
+
export declare const daysBetween: (from: IsoDate, to: IsoDate) => number;
|
|
15
|
+
export declare const range: (from: IsoDate, count: number) => IsoDate[];
|
|
16
|
+
/** The first day of the week that contains `iso`. */
|
|
17
|
+
export declare const startOfWeek: (iso: IsoDate, weekStartsOn?: Weekday) => string;
|
|
18
|
+
export declare const startOfMonth: (iso: IsoDate) => IsoDate;
|
|
19
|
+
/** The first day of the month `n` months from `iso`'s month. */
|
|
20
|
+
export declare function addMonths(iso: IsoDate, n: number): IsoDate;
|
|
21
|
+
/** 42 days (6 weeks) from the start of the week that contains the first of the month. */
|
|
22
|
+
export declare const monthGrid: (iso: IsoDate, weekStartsOn?: Weekday) => string[];
|
|
23
|
+
export declare function visibleDays(view: CalendarView, anchor: IsoDate, weekStartsOn?: Weekday): IsoDate[];
|
|
24
|
+
/** Moves the anchor one step: a day, a week or a month (to the 1st). */
|
|
25
|
+
export declare function shiftAnchor(view: CalendarView, anchor: IsoDate, delta: number): IsoDate;
|
|
26
|
+
/** `HH:mm` → minutes since midnight. */
|
|
27
|
+
export declare const minutesOf: (time: string) => number;
|
|
28
|
+
/** Minutes since midnight → `HH:mm` (24:00 for the end of the day). */
|
|
29
|
+
export declare const timeOf: (minutes: number) => string;
|
|
30
|
+
export declare const monthName: (iso: IsoDate, locale: string, month?: "long" | "short") => string;
|
|
31
|
+
export declare const weekdayName: (iso: IsoDate, locale: string, style?: "long" | "short" | "narrow") => string;
|
|
32
|
+
/** "Thursday, November 13" (long date without the year). */
|
|
33
|
+
export declare const dayLabel: (iso: IsoDate, locale: string) => string;
|
|
34
|
+
/** "Nov 13 – Nov 15" or a single day. */
|
|
35
|
+
export declare function rangeLabel(start: IsoDate, end: IsoDate, locale: string): string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { __exportAll as e } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region src/event-calendar/dates.ts
|
|
3
|
+
var t = /* @__PURE__ */ e({
|
|
4
|
+
addDays: () => a,
|
|
5
|
+
addMonths: () => d,
|
|
6
|
+
dayLabel: () => b,
|
|
7
|
+
daysBetween: () => s,
|
|
8
|
+
isoOf: () => i,
|
|
9
|
+
minutesOf: () => h,
|
|
10
|
+
monthGrid: () => f,
|
|
11
|
+
monthName: () => v,
|
|
12
|
+
range: () => c,
|
|
13
|
+
rangeLabel: () => x,
|
|
14
|
+
shiftAnchor: () => m,
|
|
15
|
+
startOfMonth: () => u,
|
|
16
|
+
startOfWeek: () => l,
|
|
17
|
+
timeOf: () => g,
|
|
18
|
+
toDate: () => r,
|
|
19
|
+
visibleDays: () => p,
|
|
20
|
+
weekday: () => o,
|
|
21
|
+
weekdayName: () => y
|
|
22
|
+
}), n = 864e5, r = (e) => /* @__PURE__ */ new Date(`${e}T00:00:00Z`), i = (e) => e.toISOString().slice(0, 10), a = (e, t) => i(new Date(r(e).getTime() + t * n)), o = (e) => r(e).getUTCDay() || 7, s = (e, t) => Math.round((r(t).getTime() - r(e).getTime()) / n), c = (e, t) => Array.from({ length: t }, (t, n) => a(e, n)), l = (e, t = 1) => a(e, -((o(e) - t + 7) % 7)), u = (e) => `${e.slice(0, 7)}-01`;
|
|
23
|
+
function d(e, t) {
|
|
24
|
+
let n = r(e);
|
|
25
|
+
return i(new Date(Date.UTC(n.getUTCFullYear(), n.getUTCMonth() + t, 1)));
|
|
26
|
+
}
|
|
27
|
+
var f = (e, t = 1) => c(l(u(e), t), 42);
|
|
28
|
+
function p(e, t, n = 1) {
|
|
29
|
+
return e === "day" ? [t] : e === "week" ? c(l(t, n), 7) : f(t, n);
|
|
30
|
+
}
|
|
31
|
+
function m(e, t, n) {
|
|
32
|
+
return e === "day" ? a(t, n) : e === "week" ? a(t, 7 * n) : d(t, n);
|
|
33
|
+
}
|
|
34
|
+
var h = (e) => {
|
|
35
|
+
let [t = 0, n = 0] = e.split(":").map(Number);
|
|
36
|
+
return t * 60 + n;
|
|
37
|
+
}, g = (e) => `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`, _ = (e, t) => new Intl.DateTimeFormat(e, {
|
|
38
|
+
timeZone: "UTC",
|
|
39
|
+
...t
|
|
40
|
+
}), v = (e, t, n = "long") => _(t, { month: n }).format(r(e)), y = (e, t, n = "short") => _(t, { weekday: n }).format(r(e)), b = (e, t) => _(t, {
|
|
41
|
+
weekday: "long",
|
|
42
|
+
month: "long",
|
|
43
|
+
day: "numeric"
|
|
44
|
+
}).format(r(e));
|
|
45
|
+
function x(e, t, n) {
|
|
46
|
+
let i = _(n, {
|
|
47
|
+
month: "short",
|
|
48
|
+
day: "numeric"
|
|
49
|
+
});
|
|
50
|
+
return e === t ? b(e, n) : `${i.format(r(e))} – ${i.format(r(t))}`;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { a as addDays, d as addMonths, t as dates_exports, b as dayLabel, s as daysBetween, i as isoOf, h as minutesOf, f as monthGrid, v as monthName, c as range, x as rangeLabel, m as shiftAnchor, u as startOfMonth, l as startOfWeek, g as timeOf, r as toDate, p as visibleDays, o as weekday, y as weekdayName };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=dates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates.js","names":["dates_exports","addDays","addMonths","dayLabel","daysBetween","isoOf","minutesOf","monthGrid","monthName","range","rangeLabel","shiftAnchor","startOfMonth","startOfWeek","timeOf","toDate","visibleDays","weekday","weekdayName","DAY_MS","iso","date","n","to","from","count","i","weekStartsOn","d","view","anchor","delta","h","m","time","minutes","fmt","locale","options","style","short","start","end"],"sources":["../../src/event-calendar/dates.ts"],"sourcesContent":["/**\n * Calendar-day helpers (ADR-0016). Days are `YYYY-MM-DD` strings with no time zone and times are `HH:mm` wall-clock\n * strings. Compare days as strings; do arithmetic on UTC midnight so the browser's time zone never shifts a day.\n */\n\n/** A calendar day, `YYYY-MM-DD`. */\nexport type IsoDate = string;\n/** ISO weekday: 1 = Monday … 7 = Sunday. */\nexport type Weekday = 1 | 2 | 3 | 4 | 5 | 6 | 7;\nexport type CalendarView = 'day' | 'week' | 'month';\n\nconst DAY_MS = 86_400_000;\n\nexport const toDate = (iso: IsoDate) => new Date(`${iso}T00:00:00Z`);\nexport const isoOf = (date: Date): IsoDate => date.toISOString().slice(0, 10);\nexport const addDays = (iso: IsoDate, n: number): IsoDate => isoOf(new Date(toDate(iso).getTime() + n * DAY_MS));\nexport const weekday = (iso: IsoDate): Weekday => (toDate(iso).getUTCDay() || 7) as Weekday;\nexport const daysBetween = (from: IsoDate, to: IsoDate) =>\n Math.round((toDate(to).getTime() - toDate(from).getTime()) / DAY_MS);\nexport const range = (from: IsoDate, count: number): IsoDate[] =>\n Array.from({ length: count }, (_, i) => addDays(from, i));\n\n/** The first day of the week that contains `iso`. */\nexport const startOfWeek = (iso: IsoDate, weekStartsOn: Weekday = 1) =>\n addDays(iso, -((weekday(iso) - weekStartsOn + 7) % 7));\nexport const startOfMonth = (iso: IsoDate): IsoDate => `${iso.slice(0, 7)}-01`;\n\n/** The first day of the month `n` months from `iso`'s month. */\nexport function addMonths(iso: IsoDate, n: number): IsoDate {\n const d = toDate(iso);\n return isoOf(new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth() + n, 1)));\n}\n\n/** 42 days (6 weeks) from the start of the week that contains the first of the month. */\nexport const monthGrid = (iso: IsoDate, weekStartsOn: Weekday = 1) =>\n range(startOfWeek(startOfMonth(iso), weekStartsOn), 42);\n\nexport function visibleDays(view: CalendarView, anchor: IsoDate, weekStartsOn: Weekday = 1): IsoDate[] {\n if (view === 'day') return [anchor];\n if (view === 'week') return range(startOfWeek(anchor, weekStartsOn), 7);\n return monthGrid(anchor, weekStartsOn);\n}\n\n/** Moves the anchor one step: a day, a week or a month (to the 1st). */\nexport function shiftAnchor(view: CalendarView, anchor: IsoDate, delta: number): IsoDate {\n if (view === 'day') return addDays(anchor, delta);\n if (view === 'week') return addDays(anchor, 7 * delta);\n return addMonths(anchor, delta);\n}\n\n/** `HH:mm` → minutes since midnight. */\nexport const minutesOf = (time: string) => {\n const [h = 0, m = 0] = time.split(':').map(Number);\n return h * 60 + m;\n};\n/** Minutes since midnight → `HH:mm` (24:00 for the end of the day). */\nexport const timeOf = (minutes: number) =>\n `${String(Math.floor(minutes / 60)).padStart(2, '0')}:${String(minutes % 60).padStart(2, '0')}`;\n\nconst fmt = (locale: string, options: Intl.DateTimeFormatOptions) =>\n new Intl.DateTimeFormat(locale, { timeZone: 'UTC', ...options });\n\nexport const monthName = (iso: IsoDate, locale: string, month: 'long' | 'short' = 'long') =>\n fmt(locale, { month }).format(toDate(iso));\nexport const weekdayName = (iso: IsoDate, locale: string, style: 'long' | 'short' | 'narrow' = 'short') =>\n fmt(locale, { weekday: style }).format(toDate(iso));\n/** \"Thursday, November 13\" (long date without the year). */\nexport const dayLabel = (iso: IsoDate, locale: string) =>\n fmt(locale, { weekday: 'long', month: 'long', day: 'numeric' }).format(toDate(iso));\n/** \"Nov 13 – Nov 15\" or a single day. */\nexport function rangeLabel(start: IsoDate, end: IsoDate, locale: string) {\n const short = fmt(locale, { month: 'short', day: 'numeric' });\n return start === end ? dayLabel(start, locale) : `${short.format(toDate(start))} – ${short.format(toDate(end))}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;A,IAWMmB,IAAS,OAEFJ,KAAU,sBAAiB,IAAI,KAAK,GAAGK,EAAI,WAAW,GACtDf,KAAS,MAAwBgB,EAAK,YAAY,CAAC,CAAC,MAAM,GAAG,EAAE,GAC/DpB,KAAW,GAAc,MAAuBI,EAAM,IAAI,KAAKU,EAAOK,CAAG,CAAC,CAAC,QAAQ,IAAIE,IAAIH,CAAM,CAAC,GAClGF,KAAW,MAA2BF,EAAOK,CAAG,CAAC,CAAC,UAAU,KAAK,GACjEhB,KAAe,GAAe,MACzC,KAAK,OAAOW,EAAOQ,CAAE,CAAC,CAAC,QAAQ,IAAIR,EAAOS,CAAI,CAAC,CAAC,QAAQ,KAAKL,CAAM,GACxDV,KAAS,GAAe,MACnC,MAAM,KAAK,EAAE,QAAQgB,EAAM,IAAI,GAAG,MAAMxB,EAAQuB,GAAME,CAAC,CAAC,GAG7Cb,KAAe,GAAc,IAAwB,MAChEZ,EAAQmB,GAAK,GAAGH,EAAQG,CAAG,IAAIO,IAAe,KAAK,EAAE,GAC1Cf,KAAgB,MAA0B,GAAGQ,EAAI,MAAM,GAAG,CAAC,EAAE;AAG1E,SAAgBlB,EAAU,GAAc,GAAoB;CAC1D,IAAM0B,IAAIb,EAAOK,CAAG;CACpB,OAAOf,EAAM,IAAI,KAAK,KAAK,IAAIuB,EAAE,eAAe,GAAGA,EAAE,YAAY,IAAIN,GAAG,CAAC,CAAC,CAAC;AAC7E;AAGA,IAAaf,KAAa,GAAc,IAAwB,MAC9DE,EAAMI,EAAYD,EAAaQ,CAAG,GAAGO,CAAY,GAAG,EAAE;AAExD,SAAgBX,EAAY,GAAoB,GAAiB,IAAwB,GAAc;CAGrG,OAFIa,MAAS,QAAc,CAACC,CAAM,IAC9BD,MAAS,SAAepB,EAAMI,EAAYiB,GAAQH,CAAY,GAAG,CAAC,IAC/DpB,EAAUuB,GAAQH,CAAY;AACvC;AAGA,SAAgBhB,EAAY,GAAoB,GAAiB,GAAwB;CAGvF,OAFIkB,MAAS,QAAc5B,EAAQ6B,GAAQC,CAAK,IAC5CF,MAAS,SAAe5B,EAAQ6B,GAAQ,IAAIC,CAAK,IAC9C7B,EAAU4B,GAAQC,CAAK;AAChC;AAGA,IAAazB,KAAa,MAAiB;CACzC,IAAM,CAAC0B,IAAI,GAAGC,IAAI,KAAKC,EAAK,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACjD,OAAOF,IAAI,KAAKC;AAClB,GAEanB,KAAU,MACrB,GAAG,OAAO,KAAK,MAAMqB,IAAU,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAOA,IAAU,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,KAExFC,KAAO,GAAgB,MAC3B,IAAI,KAAK,eAAeC,GAAQ;CAAE,UAAU;CAAO,GAAGC;AAAQ,CAAC,GAEpD9B,KAAa,GAAc,GAAgB,IAA0B,WAChF4B,EAAIC,GAAQ,EAAE,SAAM,CAAC,CAAC,CAAC,OAAOtB,EAAOK,CAAG,CAAC,GAC9BF,KAAe,GAAc,GAAgB,IAAqC,YAC7FkB,EAAIC,GAAQ,EAAE,SAASE,EAAM,CAAC,CAAC,CAAC,OAAOxB,EAAOK,CAAG,CAAC,GAEvCjB,KAAY,GAAc,MACrCiC,EAAIC,GAAQ;CAAE,SAAS;CAAQ,OAAO;CAAQ,KAAK;AAAU,CAAC,CAAC,CAAC,OAAOtB,EAAOK,CAAG,CAAC;AAEpF,SAAgBV,EAAW,GAAgB,GAAc,GAAgB;CACvE,IAAM8B,IAAQJ,EAAIC,GAAQ;EAAE,OAAO;EAAS,KAAK;CAAU,CAAC;CAC5D,OAAOI,MAAUC,IAAMvC,EAASsC,GAAOJ,CAAM,IAAI,GAAGG,EAAM,OAAOzB,EAAO0B,CAAK,CAAC,EAAE,KAAKD,EAAM,OAAOzB,EAAO2B,CAAG,CAAC;AAC/G"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type IconName } from '../icon/icon';
|
|
3
|
+
import { type CalendarView, type IsoDate, type Weekday } from './dates';
|
|
4
|
+
import { type LayoutItem } from './layout';
|
|
5
|
+
export type { CalendarView, IsoDate, Weekday };
|
|
6
|
+
export interface CalendarItem<M = unknown> extends LayoutItem {
|
|
7
|
+
/** Category color 1–12 (`--kf-category-N`). Defaults to the brand color. */
|
|
8
|
+
color?: number;
|
|
9
|
+
icon?: IconName;
|
|
10
|
+
/** `pending` is drawn with a dashed edge, in italics, and named "Pending". */
|
|
11
|
+
status?: 'confirmed' | 'pending';
|
|
12
|
+
/** Someone else's event shown only as busy time: neutral color and a lock. */
|
|
13
|
+
busy?: boolean;
|
|
14
|
+
location?: string;
|
|
15
|
+
/** Product data, passed back untouched in callbacks. */
|
|
16
|
+
meta?: M;
|
|
17
|
+
}
|
|
18
|
+
/** A selection: days (inclusive) and, from the hour grid, times. */
|
|
19
|
+
export interface CalendarRange {
|
|
20
|
+
start: IsoDate;
|
|
21
|
+
end: IsoDate;
|
|
22
|
+
startTime?: string;
|
|
23
|
+
endTime?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CalendarQuickAction {
|
|
26
|
+
key: string;
|
|
27
|
+
label: string;
|
|
28
|
+
icon?: IconName;
|
|
29
|
+
/** Grey second line ("09:00 – 10:00", "Opens the form with this day"). */
|
|
30
|
+
hint?: string;
|
|
31
|
+
onSelect: () => void;
|
|
32
|
+
}
|
|
33
|
+
export interface EventCalendarLabels {
|
|
34
|
+
today: string;
|
|
35
|
+
previous: string;
|
|
36
|
+
next: string;
|
|
37
|
+
views: Record<CalendarView, string>;
|
|
38
|
+
viewsLabel: string;
|
|
39
|
+
allDay: string;
|
|
40
|
+
pending: string;
|
|
41
|
+
busy: string;
|
|
42
|
+
/** Visible text of the "+N more" button. */
|
|
43
|
+
more: (count: number) => string;
|
|
44
|
+
togglePanel: string;
|
|
45
|
+
/** Accessible name of the day grid. */
|
|
46
|
+
grid: string;
|
|
47
|
+
help: string;
|
|
48
|
+
helpTouch: string;
|
|
49
|
+
empty: string;
|
|
50
|
+
todaySuffix: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const DEFAULT_CALENDAR_LABELS: EventCalendarLabels;
|
|
53
|
+
export declare function itemColor(item: Pick<CalendarItem, 'busy' | 'color'>): string;
|
|
54
|
+
export interface CalendarAgendaProps {
|
|
55
|
+
days: IsoDate[];
|
|
56
|
+
today: IsoDate;
|
|
57
|
+
items: CalendarItem[];
|
|
58
|
+
locale?: string;
|
|
59
|
+
labels?: Partial<EventCalendarLabels>;
|
|
60
|
+
onOpenItem?: (item: CalendarItem, el: HTMLElement) => void;
|
|
61
|
+
/** Double-tap (or double-click) on a day. */
|
|
62
|
+
onSelectRange?: (range: CalendarRange, rect: DOMRect) => void;
|
|
63
|
+
/** Days without items are hidden (except today). */
|
|
64
|
+
className?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The calendar as a list of days that have something (today always shows). `EventCalendar` uses it below 768 px; on
|
|
68
|
+
* its own it is the read-only "Today" card of a dashboard (`days={[today]}`).
|
|
69
|
+
*/
|
|
70
|
+
export declare function CalendarAgenda({ days, today, items, locale, labels: labelsProp, onOpenItem, onSelectRange, className, }: CalendarAgendaProps): import("react").JSX.Element;
|
|
71
|
+
export interface EventCalendarProps {
|
|
72
|
+
items: CalendarItem[];
|
|
73
|
+
/** Today in the organization's time zone (from the server). */
|
|
74
|
+
today: IsoDate;
|
|
75
|
+
/**
|
|
76
|
+
* Current time `HH:mm` for the time line. Omit it to use the browser's clock (set after mounting, refreshed every
|
|
77
|
+
* minute).
|
|
78
|
+
*/
|
|
79
|
+
now?: string;
|
|
80
|
+
view?: CalendarView;
|
|
81
|
+
defaultView?: CalendarView;
|
|
82
|
+
onViewChange?: (view: CalendarView) => void;
|
|
83
|
+
/** The day the view is built around. Defaults to `today`. */
|
|
84
|
+
anchor?: IsoDate;
|
|
85
|
+
onAnchorChange?: (anchor: IsoDate) => void;
|
|
86
|
+
/** Working weekdays (others are shaded). Defaults to Monday–Friday. */
|
|
87
|
+
workDays?: readonly Weekday[];
|
|
88
|
+
/** 1 = Monday (default) … 7 = Sunday. */
|
|
89
|
+
weekStartsOn?: Weekday;
|
|
90
|
+
/** BCP 47 locale for day and month names. Defaults to `en-US`. */
|
|
91
|
+
locale?: string;
|
|
92
|
+
labels?: Partial<EventCalendarLabels>;
|
|
93
|
+
/** A range kept highlighted (e.g. while the product's create drawer is open). */
|
|
94
|
+
selection?: CalendarRange | null;
|
|
95
|
+
/** Keeps the current days on screen, dimmed, while the next range loads. */
|
|
96
|
+
loading?: boolean;
|
|
97
|
+
/** Called when the user selects days or times (drag, double-click, `Enter` on a day). */
|
|
98
|
+
onSelectRange?: (range: CalendarRange) => void;
|
|
99
|
+
/** Actions for a selection, shown as a menu next to it. Return `[]` to show nothing. */
|
|
100
|
+
quickActions?: (range: CalendarRange) => CalendarQuickAction[];
|
|
101
|
+
onOpenItem?: (item: CalendarItem) => void;
|
|
102
|
+
/** Content of the popover opened next to an item (usually `EventDetails`). */
|
|
103
|
+
renderItemPopover?: (item: CalendarItem, close: () => void) => ReactNode;
|
|
104
|
+
/** Extra toolbar actions (a "+" button, "Ask AI"). */
|
|
105
|
+
toolbarEnd?: ReactNode;
|
|
106
|
+
/** Side panel (mini calendar, upcoming, filters); shown at 1024 px and wider. */
|
|
107
|
+
aside?: ReactNode;
|
|
108
|
+
asideOpen?: boolean;
|
|
109
|
+
defaultAsideOpen?: boolean;
|
|
110
|
+
onAsideOpenChange?: (open: boolean) => void;
|
|
111
|
+
/** First hour shown in week and day views. Default 8. */
|
|
112
|
+
startHour?: number;
|
|
113
|
+
/** Lanes of bars per day in month view before "+N more". Default 3. */
|
|
114
|
+
monthLanes?: number;
|
|
115
|
+
/** Keyboard shortcuts while focus is inside the calendar. Default `true`. */
|
|
116
|
+
shortcuts?: boolean;
|
|
117
|
+
showHelp?: boolean;
|
|
118
|
+
headingLevel?: 2 | 3;
|
|
119
|
+
className?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Day, week and month calendar (ADR-0016). Controlled and presentational: the product loads `items` for the visible
|
|
123
|
+
* range, expands recurring events, and decides what the quick actions and the item popover do.
|
|
124
|
+
*/
|
|
125
|
+
export declare function EventCalendar({ items, today, now: nowProp, view: viewProp, defaultView, onViewChange, anchor: anchorProp, onAnchorChange, workDays, weekStartsOn, locale, labels: labelsProp, selection, loading, onSelectRange, quickActions, onOpenItem, renderItemPopover, toolbarEnd, aside, asideOpen: asideOpenProp, defaultAsideOpen, onAsideOpenChange, startHour, monthLanes, shortcuts, showHelp, headingLevel, className, }: EventCalendarProps): import("react").JSX.Element;
|