beez-ui 0.6.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +150 -96
- package/README.md +33 -6
- package/dist/components/account-menu.d.ts +53 -0
- package/dist/components/account-menu.js +405 -0
- package/dist/components/alert.js +1 -1
- package/dist/components/animated-collapse.d.ts +19 -0
- package/dist/components/animated-collapse.js +81 -0
- package/dist/components/animated-count.d.ts +13 -0
- package/dist/components/animated-count.js +105 -0
- package/dist/components/animated-list-item.d.ts +25 -0
- package/dist/components/animated-list-item.js +132 -0
- package/dist/components/avatar.d.ts +2 -1
- package/dist/components/avatar.js +4 -3
- package/dist/components/bouncing-dots-loader.d.ts +19 -0
- package/dist/components/bouncing-dots-loader.js +47 -0
- package/dist/components/calendar.js +102 -0
- package/dist/components/carousel.js +61 -48
- package/dist/components/checkbox.js +1 -1
- package/dist/components/confirm-delete-button.d.ts +29 -0
- package/dist/components/confirm-delete-button.js +254 -0
- package/dist/components/data-table.js +34 -4
- package/dist/components/dropdown-menu.js +5 -2
- package/dist/components/empty-state.d.ts +24 -0
- package/dist/components/empty-state.js +37 -0
- package/dist/components/error-state.d.ts +20 -0
- package/dist/components/error-state.js +145 -0
- package/dist/components/external-browser-handoff.d.ts +27 -0
- package/dist/components/external-browser-handoff.js +306 -0
- package/dist/components/file-upload.d.ts +78 -0
- package/dist/components/file-upload.js +678 -0
- package/dist/components/filter-query-bar.js +11 -6
- package/dist/components/form.d.ts +5 -0
- package/dist/components/form.js +11 -9
- package/dist/components/info-popover.d.ts +23 -0
- package/dist/components/info-popover.js +158 -0
- package/dist/components/input-group.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/month-calendar-header.d.ts +65 -0
- package/dist/components/month-calendar-header.js +337 -0
- package/dist/components/month-grid.d.ts +59 -0
- package/dist/components/month-grid.js +301 -0
- package/dist/components/notification-bell.d.ts +50 -0
- package/dist/components/notification-bell.js +338 -0
- package/dist/components/notification-panel.d.ts +56 -0
- package/dist/components/notification-panel.js +281 -0
- package/dist/components/open-in-browser-cta.d.ts +22 -0
- package/dist/components/open-in-browser-cta.js +61 -0
- package/dist/components/pagination.d.ts +1 -0
- package/dist/components/pagination.js +9 -4
- package/dist/components/presence-swap.d.ts +22 -0
- package/dist/components/presence-swap.js +162 -0
- package/dist/components/progress-ring.d.ts +20 -0
- package/dist/components/progress-ring.js +53 -0
- package/dist/components/pwa-update-control.d.ts +18 -0
- package/dist/components/pwa-update-control.js +119 -0
- package/dist/components/radio-group.js +1 -1
- package/dist/components/reaction-button.d.ts +26 -0
- package/dist/components/reaction-button.js +114 -0
- package/dist/components/rich-link-editor.d.ts +25 -0
- package/dist/components/rich-link-editor.js +320 -0
- package/dist/components/rich-markdown-content.d.ts +10 -0
- package/dist/components/rich-markdown-content.js +56 -0
- package/dist/components/rich-text-content.d.ts +19 -0
- package/dist/components/rich-text-content.js +26 -0
- package/dist/components/select.js +1 -1
- package/dist/components/sheet.js +12 -9
- package/dist/components/sidebar.js +9 -5
- package/dist/components/skeleton.d.ts +6 -0
- package/dist/components/skeleton.js +7 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/typing-animation.js +42 -15
- package/dist/emoji-picker.d.ts +27 -0
- package/dist/emoji-picker.js +283 -0
- package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
- package/dist/hooks/use-horizontal-swipe.js +80 -0
- package/dist/hooks/use-is-hydrated.d.ts +6 -0
- package/dist/hooks/use-is-hydrated.js +20 -0
- package/dist/hooks/use-minute-clock.d.ts +23 -0
- package/dist/hooks/use-minute-clock.js +147 -0
- package/dist/hooks/use-month-transition-direction.d.ts +21 -0
- package/dist/hooks/use-month-transition-direction.js +110 -0
- package/dist/hooks/use-rich-link-editor.d.ts +55 -0
- package/dist/hooks/use-rich-link-editor.js +515 -0
- package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
- package/dist/hooks/use-viewer-time-zone.js +20 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +43 -0
- package/dist/lib/browser-clipboard.d.ts +13 -0
- package/dist/lib/browser-clipboard.js +48 -0
- package/dist/lib/browser-navigation.d.ts +21 -0
- package/dist/lib/browser-navigation.js +42 -0
- package/dist/lib/column-filter-value.d.ts +12 -0
- package/dist/lib/column-filter-value.js +52 -0
- package/dist/lib/file-acceptance.d.ts +43 -0
- package/dist/lib/file-acceptance.js +107 -0
- package/dist/lib/format-file-size.d.ts +16 -0
- package/dist/lib/format-file-size.js +34 -0
- package/dist/lib/fuzzy-search.d.ts +17 -0
- package/dist/lib/fuzzy-search.js +183 -0
- package/dist/lib/horizontal-swipe.d.ts +23 -0
- package/dist/lib/horizontal-swipe.js +29 -0
- package/dist/lib/in-app-browser.d.ts +35 -0
- package/dist/lib/in-app-browser.js +80 -0
- package/dist/lib/month-grid.d.ts +42 -0
- package/dist/lib/month-grid.js +74 -0
- package/dist/lib/name-initials.d.ts +7 -0
- package/dist/lib/name-initials.js +11 -0
- package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
- package/dist/lib/rich-text/link-markdown-constants.js +458 -0
- package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
- package/dist/lib/rich-text/link-markdown-types.js +1 -0
- package/dist/lib/rich-text/link-markdown.d.ts +193 -0
- package/dist/lib/rich-text/link-markdown.js +592 -0
- package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
- package/dist/lib/rich-text/rich-markdown.js +105 -0
- package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
- package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
- package/dist/motion/glide-indicator.d.ts +37 -3
- package/dist/motion/glide-indicator.js +37 -3
- package/dist/motion/motion-slot.js +47 -18
- package/dist/motion/surface-keyframes.js +18 -6
- package/dist/motion/tokens.d.ts +41 -2
- package/dist/motion/tokens.js +40 -1
- package/dist/providers/beez-ui-provider.js +49 -17
- package/dist/styles.css +1 -1
- package/package.json +212 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Month grid of dated items, such as events or deadlines. Wide screens show one pill per item;
|
|
3
|
+
* phones show one dot per item and list the selected day under the grid.
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactNode } from "react";
|
|
6
|
+
import { type CalendarWeekStart } from "../lib/month-grid.js";
|
|
7
|
+
/** Presentation of one dated item, already resolved by the application. */
|
|
8
|
+
export interface MonthGridItem {
|
|
9
|
+
id: string;
|
|
10
|
+
/** `YYYY-MM-DD` day the item belongs to, in the zone the application displays. */
|
|
11
|
+
dateKey: string;
|
|
12
|
+
title: string;
|
|
13
|
+
/** Short start time, such as "18:00". */
|
|
14
|
+
timeLabel?: string;
|
|
15
|
+
/** Past items are muted. */
|
|
16
|
+
isPast?: boolean;
|
|
17
|
+
/** Cancelled items are struck through, muted and labelled. */
|
|
18
|
+
isCancelled?: boolean;
|
|
19
|
+
/** CSS color of the dot and the pill accent. Defaults to the primary color. */
|
|
20
|
+
accentColor?: string;
|
|
21
|
+
/** CSS color of the pill surface. Defaults to the background. */
|
|
22
|
+
surfaceColor?: string;
|
|
23
|
+
/** Leading content of the pill, such as a type badge or icon. */
|
|
24
|
+
leading?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export interface MonthGridLabels {
|
|
27
|
+
table: string;
|
|
28
|
+
today: string;
|
|
29
|
+
cancelled: string;
|
|
30
|
+
/** Accessible name of the phone summary of the selected day. */
|
|
31
|
+
dayItems: string;
|
|
32
|
+
/** Accessible name of a phone day button. */
|
|
33
|
+
dayButton: (dayLabel: string, itemCount: number) => string;
|
|
34
|
+
/** Seven weekday headers, Monday first; rotated when the week starts on Sunday. */
|
|
35
|
+
weekDays: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
export interface MonthGridProps<TItem extends MonthGridItem> {
|
|
38
|
+
/** Visible `YYYY-MM` month. */
|
|
39
|
+
month: string;
|
|
40
|
+
items: readonly TItem[];
|
|
41
|
+
onSelectItem: (item: TItem) => void;
|
|
42
|
+
/** `YYYY-MM-DD` key of today, or null before hydration. */
|
|
43
|
+
todayKey?: string | null;
|
|
44
|
+
weekStartsOn?: CalendarWeekStart;
|
|
45
|
+
/** Day whose items are listed under the grid on phones. */
|
|
46
|
+
activeDayKey?: string | null;
|
|
47
|
+
onSelectDay?: (dayKey: string) => void;
|
|
48
|
+
/** Renders the phone summary of the selected day. Defaults to a list of item buttons. */
|
|
49
|
+
renderDaySummary?: (dayKey: string, dayItems: readonly TItem[]) => ReactNode;
|
|
50
|
+
locale?: string;
|
|
51
|
+
labels?: Partial<MonthGridLabels>;
|
|
52
|
+
className?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Renders the month as an accessible table with today marked (`aria-current="date"`).
|
|
56
|
+
* @param props - Month, items, selection callbacks and optional labels.
|
|
57
|
+
* @returns The month grid and its phone day summary.
|
|
58
|
+
*/
|
|
59
|
+
export declare function MonthGrid<TItem extends MonthGridItem>({ month, items, onSelectItem, todayKey, weekStartsOn, activeDayKey, onSelectDay, renderDaySummary, locale, labels, className, }: MonthGridProps<TItem>): import("react").JSX.Element;
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
import { cn } from "../lib/utils.js";
|
|
4
|
+
import { createMonthGridDays, groupItemsByDateKey, splitCalendarWeeks } from "../lib/month-grid.js";
|
|
5
|
+
import { PresenceSwap } from "./presence-swap.js";
|
|
6
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "./table.js";
|
|
7
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const MONTH_GRID_DEFAULT_LABELS = {
|
|
9
|
+
table: "Calendario mensual",
|
|
10
|
+
today: "Hoy",
|
|
11
|
+
cancelled: "Cancelado",
|
|
12
|
+
dayItems: "Eventos del día",
|
|
13
|
+
dayButton: (dayLabel, itemCount) => `${dayLabel}: ${itemCount} ${itemCount === 1 ? "evento" : "eventos"}`,
|
|
14
|
+
weekDays: [
|
|
15
|
+
"Lun",
|
|
16
|
+
"Mar",
|
|
17
|
+
"Mié",
|
|
18
|
+
"Jue",
|
|
19
|
+
"Vie",
|
|
20
|
+
"Sáb",
|
|
21
|
+
"Dom"
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
/** Dots shown per day on phones before the "+N" overflow indicator. */
|
|
25
|
+
const DAY_DOTS_MAX = 3;
|
|
26
|
+
const DEFAULT_LOCALE = "es-AR";
|
|
27
|
+
const NO_ITEMS = [];
|
|
28
|
+
/** Day keys are formatted at noon UTC so no time zone shifts them to a neighbour day. */
|
|
29
|
+
const DAY_KEY_NOON_SUFFIX = "T12:00:00Z";
|
|
30
|
+
/**
|
|
31
|
+
* Builds the CSS variables carrying an item's colors.
|
|
32
|
+
* @param item - Item with optional colors.
|
|
33
|
+
* @returns Inline style with the defined variables.
|
|
34
|
+
*/
|
|
35
|
+
function buildItemColorStyle(item) {
|
|
36
|
+
return {
|
|
37
|
+
...item.accentColor ? { "--beez-item-accent": item.accentColor } : {},
|
|
38
|
+
...item.surfaceColor ? { "--beez-item-surface": item.surfaceColor } : {}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Formats a day key as a long, readable date.
|
|
43
|
+
* @param dateKey - `YYYY-MM-DD` key.
|
|
44
|
+
* @param locale - BCP 47 locale.
|
|
45
|
+
* @returns For example "miércoles, 6 de mayo".
|
|
46
|
+
*/
|
|
47
|
+
function formatLongDayLabel(dateKey, locale) {
|
|
48
|
+
return new Intl.DateTimeFormat(locale, {
|
|
49
|
+
weekday: "long",
|
|
50
|
+
day: "numeric",
|
|
51
|
+
month: "long",
|
|
52
|
+
timeZone: "UTC"
|
|
53
|
+
}).format(new Date(dateKey + DAY_KEY_NOON_SUFFIX));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Renders the month as an accessible table with today marked (`aria-current="date"`).
|
|
57
|
+
* @param props - Month, items, selection callbacks and optional labels.
|
|
58
|
+
* @returns The month grid and its phone day summary.
|
|
59
|
+
*/
|
|
60
|
+
export function MonthGrid(t0) {
|
|
61
|
+
const $ = _c(53);
|
|
62
|
+
const { month, items, onSelectItem, todayKey: t1, weekStartsOn: t2, activeDayKey: t3, onSelectDay, renderDaySummary, locale: t4, labels, className } = t0;
|
|
63
|
+
const todayKey = t1 === undefined ? null : t1;
|
|
64
|
+
const weekStartsOn = t2 === undefined ? 1 : t2;
|
|
65
|
+
const activeDayKey = t3 === undefined ? null : t3;
|
|
66
|
+
const locale = t4 === undefined ? DEFAULT_LOCALE : t4;
|
|
67
|
+
let T0;
|
|
68
|
+
let T1;
|
|
69
|
+
let activeDayItems;
|
|
70
|
+
let renderItemButton;
|
|
71
|
+
let resolvedLabels;
|
|
72
|
+
let t10;
|
|
73
|
+
let t5;
|
|
74
|
+
let t6;
|
|
75
|
+
let t7;
|
|
76
|
+
let t8;
|
|
77
|
+
let t9;
|
|
78
|
+
if ($[0] !== activeDayKey || $[1] !== className || $[2] !== items || $[3] !== labels || $[4] !== locale || $[5] !== month || $[6] !== onSelectDay || $[7] !== onSelectItem || $[8] !== todayKey || $[9] !== weekStartsOn) {
|
|
79
|
+
resolvedLabels = {
|
|
80
|
+
...MONTH_GRID_DEFAULT_LABELS,
|
|
81
|
+
...labels
|
|
82
|
+
};
|
|
83
|
+
const weekDayLabels = weekStartsOn === 0 ? [...resolvedLabels.weekDays.slice(-1), ...resolvedLabels.weekDays.slice(0, -1)] : resolvedLabels.weekDays;
|
|
84
|
+
let t11;
|
|
85
|
+
if ($[21] !== month || $[22] !== weekStartsOn) {
|
|
86
|
+
t11 = splitCalendarWeeks(createMonthGridDays(month, weekStartsOn));
|
|
87
|
+
$[21] = month;
|
|
88
|
+
$[22] = weekStartsOn;
|
|
89
|
+
$[23] = t11;
|
|
90
|
+
} else {
|
|
91
|
+
t11 = $[23];
|
|
92
|
+
}
|
|
93
|
+
const weeks = t11;
|
|
94
|
+
let t12;
|
|
95
|
+
if ($[24] !== items) {
|
|
96
|
+
t12 = groupItemsByDateKey(items, _temp);
|
|
97
|
+
$[24] = items;
|
|
98
|
+
$[25] = t12;
|
|
99
|
+
} else {
|
|
100
|
+
t12 = $[25];
|
|
101
|
+
}
|
|
102
|
+
const itemsByDay = t12;
|
|
103
|
+
let t13;
|
|
104
|
+
if ($[26] !== activeDayKey || $[27] !== itemsByDay) {
|
|
105
|
+
t13 = activeDayKey ? itemsByDay[activeDayKey] ?? [] : [];
|
|
106
|
+
$[26] = activeDayKey;
|
|
107
|
+
$[27] = itemsByDay;
|
|
108
|
+
$[28] = t13;
|
|
109
|
+
} else {
|
|
110
|
+
t13 = $[28];
|
|
111
|
+
}
|
|
112
|
+
activeDayItems = t13;
|
|
113
|
+
renderItemButton = (item_0, className_0) => /* @__PURE__ */ _jsxs("button", {
|
|
114
|
+
"data-slot": "month-grid-item",
|
|
115
|
+
"data-past": item_0.isPast || undefined,
|
|
116
|
+
"data-cancelled": item_0.isCancelled || undefined,
|
|
117
|
+
className: cn("w-full cursor-pointer rounded-[0.45rem] border border-[color-mix(in_oklab,var(--beez-item-accent,var(--primary))_35%,var(--border))] border-l-[3px] border-l-[var(--beez-item-accent,var(--primary))] bg-[var(--beez-item-surface,var(--background))] p-[0.35rem] text-left text-[0.8rem] font-bold text-foreground [overflow-wrap:anywhere] [-webkit-tap-highlight-color:transparent] transition-[border-color,background-color,scale] hover:border-[color-mix(in_oklab,var(--beez-item-accent,var(--primary))_60%,var(--border))] active:scale-[0.98] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring", "data-cancelled:border-border data-cancelled:bg-muted/60 data-cancelled:font-semibold data-cancelled:text-muted-foreground data-past:border-border data-past:bg-muted/60 data-past:font-semibold data-past:text-muted-foreground", className_0),
|
|
118
|
+
style: buildItemColorStyle(item_0),
|
|
119
|
+
type: "button",
|
|
120
|
+
onClick: () => onSelectItem(item_0),
|
|
121
|
+
children: [
|
|
122
|
+
item_0.leading,
|
|
123
|
+
item_0.timeLabel ? /* @__PURE__ */ _jsxs("span", {
|
|
124
|
+
className: "font-semibold text-muted-foreground tabular-nums",
|
|
125
|
+
children: [" ", item_0.timeLabel]
|
|
126
|
+
}) : null,
|
|
127
|
+
/* @__PURE__ */ _jsxs("span", {
|
|
128
|
+
className: cn(item_0.isCancelled && "line-through"),
|
|
129
|
+
children: [" ", item_0.title]
|
|
130
|
+
}),
|
|
131
|
+
item_0.isCancelled ? /* @__PURE__ */ _jsx("span", {
|
|
132
|
+
className: "block text-[0.72rem] font-bold",
|
|
133
|
+
children: resolvedLabels.cancelled
|
|
134
|
+
}) : null
|
|
135
|
+
]
|
|
136
|
+
}, item_0.id);
|
|
137
|
+
t9 = "month-grid";
|
|
138
|
+
if ($[29] !== className) {
|
|
139
|
+
t10 = cn("grid min-w-0 gap-5", className);
|
|
140
|
+
$[29] = className;
|
|
141
|
+
$[30] = t10;
|
|
142
|
+
} else {
|
|
143
|
+
t10 = $[30];
|
|
144
|
+
}
|
|
145
|
+
T1 = Table;
|
|
146
|
+
t6 = resolvedLabels.table;
|
|
147
|
+
t7 = "w-full table-fixed border border-border md:min-w-[42rem]";
|
|
148
|
+
t8 = /* @__PURE__ */ _jsx(TableHeader, { children: /* @__PURE__ */ _jsx(TableRow, { children: weekDayLabels.map(_temp2) }) });
|
|
149
|
+
T0 = TableBody;
|
|
150
|
+
t5 = weeks.map((week) => /* @__PURE__ */ _jsx(TableRow, { children: week.map((day) => {
|
|
151
|
+
const isToday = day.dateKey === todayKey;
|
|
152
|
+
const dayItems = itemsByDay[day.dateKey] ?? NO_ITEMS;
|
|
153
|
+
return /* @__PURE__ */ _jsxs(TableCell, {
|
|
154
|
+
"aria-current": isToday ? "date" : undefined,
|
|
155
|
+
className: cn("h-32 w-[calc(100%/7)] border-l border-border align-top whitespace-normal max-md:h-auto max-md:min-h-14 max-md:p-[0.2rem]", isToday && "bg-[color-mix(in_oklab,var(--primary)_6%,var(--background))]"),
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ _jsxs("span", {
|
|
158
|
+
className: cn("inline-flex size-7 items-center justify-center rounded-full font-bold tabular-nums max-md:size-6 max-md:text-[0.8rem]", !day.isCurrentMonth && "font-medium text-muted-foreground", isToday && "bg-primary text-primary-foreground"),
|
|
159
|
+
children: [day.dayNumber, isToday ? /* @__PURE__ */ _jsxs("span", {
|
|
160
|
+
className: "sr-only",
|
|
161
|
+
children: [" ", resolvedLabels.today]
|
|
162
|
+
}) : null]
|
|
163
|
+
}),
|
|
164
|
+
dayItems.length > 0 && onSelectDay ? /* @__PURE__ */ _jsxs("button", {
|
|
165
|
+
"aria-label": resolvedLabels.dayButton(formatLongDayLabel(day.dateKey, locale), dayItems.length),
|
|
166
|
+
"aria-pressed": activeDayKey === day.dateKey,
|
|
167
|
+
className: "mt-[0.2rem] hidden min-h-6 w-full cursor-pointer flex-wrap items-center justify-center gap-[0.2rem] rounded-[0.4rem] border-0 bg-transparent py-[0.2rem] text-muted-foreground [-webkit-tap-highlight-color:transparent] transition-[background-color,scale] active:scale-[0.94] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring aria-pressed:bg-[color-mix(in_oklab,var(--primary)_14%,var(--background))] max-md:flex",
|
|
168
|
+
type: "button",
|
|
169
|
+
onClick: () => onSelectDay(day.dateKey),
|
|
170
|
+
children: [dayItems.slice(0, DAY_DOTS_MAX).map(_temp3), dayItems.length > DAY_DOTS_MAX ? /* @__PURE__ */ _jsxs("span", {
|
|
171
|
+
"aria-hidden": true,
|
|
172
|
+
className: "text-[0.65rem] leading-none font-semibold tabular-nums",
|
|
173
|
+
children: ["+", dayItems.length - DAY_DOTS_MAX]
|
|
174
|
+
}) : null]
|
|
175
|
+
}) : null,
|
|
176
|
+
/* @__PURE__ */ _jsx("div", {
|
|
177
|
+
className: cn("mt-[0.35rem] grid gap-[0.35rem]", onSelectDay && "max-md:hidden"),
|
|
178
|
+
children: dayItems.map((item_2) => renderItemButton(item_2, ""))
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
}, day.dateKey);
|
|
182
|
+
}) }, week[0].dateKey));
|
|
183
|
+
$[0] = activeDayKey;
|
|
184
|
+
$[1] = className;
|
|
185
|
+
$[2] = items;
|
|
186
|
+
$[3] = labels;
|
|
187
|
+
$[4] = locale;
|
|
188
|
+
$[5] = month;
|
|
189
|
+
$[6] = onSelectDay;
|
|
190
|
+
$[7] = onSelectItem;
|
|
191
|
+
$[8] = todayKey;
|
|
192
|
+
$[9] = weekStartsOn;
|
|
193
|
+
$[10] = T0;
|
|
194
|
+
$[11] = T1;
|
|
195
|
+
$[12] = activeDayItems;
|
|
196
|
+
$[13] = renderItemButton;
|
|
197
|
+
$[14] = resolvedLabels;
|
|
198
|
+
$[15] = t10;
|
|
199
|
+
$[16] = t5;
|
|
200
|
+
$[17] = t6;
|
|
201
|
+
$[18] = t7;
|
|
202
|
+
$[19] = t8;
|
|
203
|
+
$[20] = t9;
|
|
204
|
+
} else {
|
|
205
|
+
T0 = $[10];
|
|
206
|
+
T1 = $[11];
|
|
207
|
+
activeDayItems = $[12];
|
|
208
|
+
renderItemButton = $[13];
|
|
209
|
+
resolvedLabels = $[14];
|
|
210
|
+
t10 = $[15];
|
|
211
|
+
t5 = $[16];
|
|
212
|
+
t6 = $[17];
|
|
213
|
+
t7 = $[18];
|
|
214
|
+
t8 = $[19];
|
|
215
|
+
t9 = $[20];
|
|
216
|
+
}
|
|
217
|
+
let t11;
|
|
218
|
+
if ($[31] !== T0 || $[32] !== t5) {
|
|
219
|
+
t11 = /* @__PURE__ */ _jsx(T0, { children: t5 });
|
|
220
|
+
$[31] = T0;
|
|
221
|
+
$[32] = t5;
|
|
222
|
+
$[33] = t11;
|
|
223
|
+
} else {
|
|
224
|
+
t11 = $[33];
|
|
225
|
+
}
|
|
226
|
+
let t12;
|
|
227
|
+
if ($[34] !== T1 || $[35] !== t11 || $[36] !== t6 || $[37] !== t7 || $[38] !== t8) {
|
|
228
|
+
t12 = /* @__PURE__ */ _jsxs(T1, {
|
|
229
|
+
"aria-label": t6,
|
|
230
|
+
className: t7,
|
|
231
|
+
children: [t8, t11]
|
|
232
|
+
});
|
|
233
|
+
$[34] = T1;
|
|
234
|
+
$[35] = t11;
|
|
235
|
+
$[36] = t6;
|
|
236
|
+
$[37] = t7;
|
|
237
|
+
$[38] = t8;
|
|
238
|
+
$[39] = t12;
|
|
239
|
+
} else {
|
|
240
|
+
t12 = $[39];
|
|
241
|
+
}
|
|
242
|
+
let t13;
|
|
243
|
+
if ($[40] !== activeDayItems || $[41] !== activeDayKey || $[42] !== locale || $[43] !== onSelectDay || $[44] !== renderDaySummary || $[45] !== renderItemButton || $[46] !== resolvedLabels) {
|
|
244
|
+
t13 = onSelectDay ? /* @__PURE__ */ _jsx("div", {
|
|
245
|
+
className: "hidden min-w-0 empty:hidden max-md:grid",
|
|
246
|
+
children: activeDayKey && activeDayItems.length > 0 ? /* @__PURE__ */ _jsx(PresenceSwap, {
|
|
247
|
+
presenceKey: activeDayKey,
|
|
248
|
+
children: renderDaySummary ? renderDaySummary(activeDayKey, activeDayItems) : /* @__PURE__ */ _jsxs("section", {
|
|
249
|
+
"aria-label": resolvedLabels.dayItems,
|
|
250
|
+
className: "grid gap-2",
|
|
251
|
+
children: [/* @__PURE__ */ _jsx("h3", {
|
|
252
|
+
className: "m-0 text-sm font-semibold first-letter:uppercase",
|
|
253
|
+
children: formatLongDayLabel(activeDayKey, locale)
|
|
254
|
+
}), activeDayItems.map((item_3) => renderItemButton(item_3, "text-sm"))]
|
|
255
|
+
})
|
|
256
|
+
}) : null
|
|
257
|
+
}) : null;
|
|
258
|
+
$[40] = activeDayItems;
|
|
259
|
+
$[41] = activeDayKey;
|
|
260
|
+
$[42] = locale;
|
|
261
|
+
$[43] = onSelectDay;
|
|
262
|
+
$[44] = renderDaySummary;
|
|
263
|
+
$[45] = renderItemButton;
|
|
264
|
+
$[46] = resolvedLabels;
|
|
265
|
+
$[47] = t13;
|
|
266
|
+
} else {
|
|
267
|
+
t13 = $[47];
|
|
268
|
+
}
|
|
269
|
+
let t14;
|
|
270
|
+
if ($[48] !== t10 || $[49] !== t12 || $[50] !== t13 || $[51] !== t9) {
|
|
271
|
+
t14 = /* @__PURE__ */ _jsxs("div", {
|
|
272
|
+
"data-slot": t9,
|
|
273
|
+
className: t10,
|
|
274
|
+
children: [t12, t13]
|
|
275
|
+
});
|
|
276
|
+
$[48] = t10;
|
|
277
|
+
$[49] = t12;
|
|
278
|
+
$[50] = t13;
|
|
279
|
+
$[51] = t9;
|
|
280
|
+
$[52] = t14;
|
|
281
|
+
} else {
|
|
282
|
+
t14 = $[52];
|
|
283
|
+
}
|
|
284
|
+
return t14;
|
|
285
|
+
}
|
|
286
|
+
function _temp3(item_1) {
|
|
287
|
+
return /* @__PURE__ */ _jsx("span", {
|
|
288
|
+
"aria-hidden": true,
|
|
289
|
+
className: cn("size-[0.4rem] rounded-full bg-[var(--beez-item-accent,var(--primary))]", item_1.isPast && "bg-muted-foreground", item_1.isCancelled && "border border-muted-foreground bg-transparent"),
|
|
290
|
+
style: buildItemColorStyle(item_1)
|
|
291
|
+
}, item_1.id);
|
|
292
|
+
}
|
|
293
|
+
function _temp2(dayLabel) {
|
|
294
|
+
return /* @__PURE__ */ _jsx(TableHead, {
|
|
295
|
+
className: "border-l border-border text-center text-[0.8rem] font-semibold text-muted-foreground max-md:px-[0.15rem] max-md:text-[0.7rem]",
|
|
296
|
+
children: dayLabel
|
|
297
|
+
}, dayLabel);
|
|
298
|
+
}
|
|
299
|
+
function _temp(item) {
|
|
300
|
+
return item.dateKey;
|
|
301
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type NotificationPanelProps } from "./notification-panel.js";
|
|
2
|
+
/**
|
|
3
|
+
* Surfaces the bell can render. `responsive` ships both until hydration, so a media query (the
|
|
4
|
+
* 768px breakpoint of `useIsMobile`) shows the right one without a layout shift; once hydrated it
|
|
5
|
+
* keeps only the surface matching the viewport, since both share the open state.
|
|
6
|
+
*/
|
|
7
|
+
export declare const NOTIFICATION_BELL_SURFACE: {
|
|
8
|
+
readonly popover: "popover";
|
|
9
|
+
readonly responsive: "responsive";
|
|
10
|
+
readonly sheet: "sheet";
|
|
11
|
+
};
|
|
12
|
+
export type NotificationBellSurface = (typeof NOTIFICATION_BELL_SURFACE)[keyof typeof NOTIFICATION_BELL_SURFACE];
|
|
13
|
+
/** The badge shows up to this number; above it, "9+". */
|
|
14
|
+
export declare const NOTIFICATION_BADGE_MAX = 9;
|
|
15
|
+
/**
|
|
16
|
+
* Visible badge text.
|
|
17
|
+
* @param unreadCount - Unread notifications.
|
|
18
|
+
* @returns "3" or "9+".
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatUnreadBadge(unreadCount: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* Default accessible name of the bell, announcing the unread count.
|
|
23
|
+
* @param unreadCount - Unread notifications.
|
|
24
|
+
* @returns "Notificaciones" or "Notificaciones, 3 sin leer".
|
|
25
|
+
*/
|
|
26
|
+
export declare function describeUnreadNotifications(unreadCount: number): string;
|
|
27
|
+
export interface NotificationBellLabels {
|
|
28
|
+
title: string;
|
|
29
|
+
/** Visually hidden description of the mobile sheet. */
|
|
30
|
+
sheetDescription: string;
|
|
31
|
+
/** Accessible name of the bell for a given unread count. */
|
|
32
|
+
describeUnread: (unreadCount: number) => string;
|
|
33
|
+
}
|
|
34
|
+
export type NotificationBellProps = Omit<NotificationPanelProps, "titleSlot" | "reservesCloseButtonSpace" | "labels"> & {
|
|
35
|
+
/** Desktop popover, mobile bottom sheet, or both before hydration. */
|
|
36
|
+
surface: NotificationBellSurface;
|
|
37
|
+
isOpen: boolean;
|
|
38
|
+
onOpenChange: (isOpen: boolean) => void;
|
|
39
|
+
labels?: Partial<NotificationBellLabels>;
|
|
40
|
+
panelLabels?: NotificationPanelProps["labels"];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Renders the bell. Its accessible name carries the count and a polite live region announces
|
|
44
|
+
* changes. Both surfaces trap focus while open and return it to the bell on close. Each surface
|
|
45
|
+
* keeps a fixed slot in the tree, so dropping the inactive one after hydration never remounts the
|
|
46
|
+
* active one. The root uses `display: contents`, so the triggers stay direct header items.
|
|
47
|
+
* @param props - Surface, open state, unread count, panel data and optional labels.
|
|
48
|
+
* @returns The bell and its inbox surfaces.
|
|
49
|
+
*/
|
|
50
|
+
export declare function NotificationBell({ isOpen, onOpenChange, surface, unreadCount, labels, panelLabels, className, ...panelProps }: NotificationBellProps): import("react").JSX.Element;
|