@snksergio/design-system 0.54.0 → 0.56.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/dist-lib/chunks/{avatar-DAmZ7fBZ.cjs → avatar-CMWPg3A3.cjs} +157 -70
- package/dist-lib/chunks/avatar-CMWPg3A3.cjs.map +1 -0
- package/dist-lib/chunks/{avatar-FPbG1TRy.mjs → avatar-CZRLkTxt.mjs} +214 -127
- package/dist-lib/chunks/avatar-CZRLkTxt.mjs.map +1 -0
- package/dist-lib/chunks/{input-tjIT8HNE.mjs → input-BQABJR2N.mjs} +2 -2
- package/dist-lib/chunks/{input-tjIT8HNE.mjs.map → input-BQABJR2N.mjs.map} +1 -1
- package/dist-lib/chunks/{input-Ci_2-5Te.cjs → input-DqaLFxER.cjs} +2 -2
- package/dist-lib/chunks/{input-Ci_2-5Te.cjs.map → input-DqaLFxER.cjs.map} +1 -1
- package/dist-lib/chunks/{kpi-delta-BRTgTaO1.mjs → kpi-delta-Bfs_oVpq.mjs} +3 -3
- package/dist-lib/chunks/{kpi-delta-BRTgTaO1.mjs.map → kpi-delta-Bfs_oVpq.mjs.map} +1 -1
- package/dist-lib/chunks/{kpi-delta-1-gsPFvU.cjs → kpi-delta-wEzw5zSu.cjs} +3 -3
- package/dist-lib/chunks/{kpi-delta-1-gsPFvU.cjs.map → kpi-delta-wEzw5zSu.cjs.map} +1 -1
- package/dist-lib/chunks/{page-header-DrKDiVFN.cjs → page-header-sValhWca.cjs} +2 -2
- package/dist-lib/chunks/{page-header-DrKDiVFN.cjs.map → page-header-sValhWca.cjs.map} +1 -1
- package/dist-lib/chunks/{page-header-DdWp9c-r.mjs → page-header-t5hFIp7o.mjs} +2 -2
- package/dist-lib/chunks/{page-header-DdWp9c-r.mjs.map → page-header-t5hFIp7o.mjs.map} +1 -1
- package/dist-lib/chunks/{panel-DsOKm4Im.mjs → panel-C3puLY_V.mjs} +5 -5
- package/dist-lib/chunks/{panel-DsOKm4Im.mjs.map → panel-C3puLY_V.mjs.map} +1 -1
- package/dist-lib/chunks/{panel-CTbiCa0_.cjs → panel-DmnK2n5_.cjs} +5 -5
- package/dist-lib/chunks/{panel-CTbiCa0_.cjs.map → panel-DmnK2n5_.cjs.map} +1 -1
- package/dist-lib/chunks/{sheet-DIpYkRYS.mjs → sheet-Bjjo4ZaT.mjs} +2 -2
- package/dist-lib/chunks/{sheet-DIpYkRYS.mjs.map → sheet-Bjjo4ZaT.mjs.map} +1 -1
- package/dist-lib/chunks/{sheet-rg6uupt1.cjs → sheet-BrYriaDN.cjs} +2 -2
- package/dist-lib/chunks/{sheet-rg6uupt1.cjs.map → sheet-BrYriaDN.cjs.map} +1 -1
- package/dist-lib/chunks/{toggle-group-BTnqY_nt.cjs → toggle-group-DeoBmogo.cjs} +2 -89
- package/dist-lib/chunks/toggle-group-DeoBmogo.cjs.map +1 -0
- package/dist-lib/chunks/{toggle-group-BYmj8142.mjs → toggle-group-XMgZgL-H.mjs} +90 -177
- package/dist-lib/chunks/toggle-group-XMgZgL-H.mjs.map +1 -0
- package/dist-lib/chunks/{useTheme-Dh3POjCr.cjs → useTheme-BTjHuaT2.cjs} +225 -84
- package/dist-lib/chunks/useTheme-BTjHuaT2.cjs.map +1 -0
- package/dist-lib/chunks/{useTheme-Bk8AYqLr.mjs → useTheme-caPM-I73.mjs} +267 -126
- package/dist-lib/chunks/useTheme-caPM-I73.mjs.map +1 -0
- package/dist-lib/index.cjs +2535 -11
- package/dist-lib/index.cjs.map +1 -1
- package/dist-lib/index.mjs +2956 -432
- package/dist-lib/index.mjs.map +1 -1
- package/dist-lib/preview/chat.cjs +3 -3
- package/dist-lib/preview/chat.mjs +3 -3
- package/dist-lib/preview/clientes.cjs +6 -6
- package/dist-lib/preview/clientes.mjs +6 -6
- package/dist-lib/preview/dashboard.cjs +4 -4
- package/dist-lib/preview/dashboard.mjs +4 -4
- package/dist-lib/shadcn.cjs +11 -11
- package/dist-lib/shadcn.mjs +153 -153
- package/dist-lib/src/components/index.d.ts +2 -0
- package/dist-lib/src/components/index.d.ts.map +1 -1
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb-switcher.d.ts +35 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb-switcher.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb-switcher.styles.d.ts +94 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb-switcher.styles.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb-switcher.types.d.ts +50 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb-switcher.types.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb.d.ts +32 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb.styles.d.ts +111 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb.styles.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb.types.d.ts +40 -0
- package/dist-lib/src/components/ui/Breadcrumb/breadcrumb.types.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Breadcrumb/index.d.ts +21 -0
- package/dist-lib/src/components/ui/Breadcrumb/index.d.ts.map +1 -0
- package/dist-lib/src/components/ui/DataTable/parts/data-table-cell-addons.styles.d.ts +3 -3
- package/dist-lib/src/components/ui/Header/header-breadcrumb.d.ts +13 -3
- package/dist-lib/src/components/ui/Header/header-breadcrumb.d.ts.map +1 -1
- package/dist-lib/src/components/ui/Header/header.styles.d.ts +12 -33
- package/dist-lib/src/components/ui/Header/header.styles.d.ts.map +1 -1
- package/dist-lib/src/components/ui/Header/header.types.d.ts +17 -0
- package/dist-lib/src/components/ui/Header/header.types.d.ts.map +1 -1
- package/dist-lib/src/components/ui/Scheduler/hooks/layout.d.ts +165 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/layout.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/use-media-query.d.ts +21 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/use-media-query.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/use-scheduler-dnd.d.ts +41 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/use-scheduler-dnd.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/use-scheduler-filter.d.ts +35 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/use-scheduler-filter.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/use-scheduler-keyboard.d.ts +47 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/use-scheduler-keyboard.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/use-scheduler-state.d.ts +44 -0
- package/dist-lib/src/components/ui/Scheduler/hooks/use-scheduler-state.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/index.d.ts +14 -0
- package/dist-lib/src/components/ui/Scheduler/index.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/parts/draggable-event.d.ts +30 -0
- package/dist-lib/src/components/ui/Scheduler/parts/draggable-event.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/parts/mini-month.d.ts +28 -0
- package/dist-lib/src/components/ui/Scheduler/parts/mini-month.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/parts/scheduler-event.d.ts +53 -0
- package/dist-lib/src/components/ui/Scheduler/parts/scheduler-event.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/parts/scheduler-filter-panel.d.ts +41 -0
- package/dist-lib/src/components/ui/Scheduler/parts/scheduler-filter-panel.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/parts/scheduler-toolbar.d.ts +31 -0
- package/dist-lib/src/components/ui/Scheduler/parts/scheduler-toolbar.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/scheduler.d.ts +44 -0
- package/dist-lib/src/components/ui/Scheduler/scheduler.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/scheduler.styles.d.ts +820 -0
- package/dist-lib/src/components/ui/Scheduler/scheduler.styles.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/scheduler.types.d.ts +285 -0
- package/dist-lib/src/components/ui/Scheduler/scheduler.types.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/views/list.d.ts +33 -0
- package/dist-lib/src/components/ui/Scheduler/views/list.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/views/month.d.ts +47 -0
- package/dist-lib/src/components/ui/Scheduler/views/month.d.ts.map +1 -0
- package/dist-lib/src/components/ui/Scheduler/views/time-grid.d.ts +48 -0
- package/dist-lib/src/components/ui/Scheduler/views/time-grid.d.ts.map +1 -0
- package/package.json +210 -210
- package/dist-lib/chunks/avatar-DAmZ7fBZ.cjs.map +0 -1
- package/dist-lib/chunks/avatar-FPbG1TRy.mjs.map +0 -1
- package/dist-lib/chunks/toggle-group-BTnqY_nt.cjs.map +0 -1
- package/dist-lib/chunks/toggle-group-BYmj8142.mjs.map +0 -1
- package/dist-lib/chunks/useTheme-Bk8AYqLr.mjs.map +0 -1
- package/dist-lib/chunks/useTheme-Dh3POjCr.cjs.map +0 -1
package/dist-lib/index.mjs
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { g as getContrastTextColor, a as FormField, e as Avatar, i as isFilterEntryActive, f as FilterPopover, T as ToolbarToolButton, h as ButtonGroup, j as ToolbarSimpleFilterDrawer, k as TableToolbar, l as ToolbarActions, m as ToolbarFilterButton, n as ToolbarSearch, o as ToolbarApplied, q as ToolbarTabs, r as columnTypeRegistry, L as ListItem, s as List } from "./chunks/panel-
|
|
2
|
-
import { t, A, u, B, v, C, w, x, y, D, z, E, G, H, I, J, K, M, N, d, O, Q, R, S, U, F, b, V, c, W, X, P, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, p, al, am, an, ao, ap } from "./chunks/panel-
|
|
3
|
-
import { C as Chip } from "./chunks/useTheme-
|
|
4
|
-
import { A as A2, a, b as b2, H as H2,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { g as getContrastTextColor, a as FormField, e as Avatar, i as isFilterEntryActive, f as FilterPopover, T as ToolbarToolButton, h as ButtonGroup, j as ToolbarSimpleFilterDrawer, k as TableToolbar, l as ToolbarActions, m as ToolbarFilterButton, n as ToolbarSearch, o as ToolbarApplied, q as ToolbarTabs, r as columnTypeRegistry, L as ListItem, s as List$1 } from "./chunks/panel-C3puLY_V.mjs";
|
|
2
|
+
import { t, A, u, B, v, C, w, x, y, D, z, E, G, H, I, J, K, M, N, d, O, Q, R, S, U, F, b, V, c, W, X, P, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, p, al, am, an, ao, ap } from "./chunks/panel-C3puLY_V.mjs";
|
|
3
|
+
import { C as Chip } from "./chunks/useTheme-caPM-I73.mjs";
|
|
4
|
+
import { A as A2, B as B2, c as c2, a, b as b2, H as H2, d as d2, e, f, g, h, M as M2, S as S2, i, j, k, l, m, n, o, U as U2, p as p2, q, r, s, t as t2, v as v2, w as w2, x as x2, y as y2, z as z2, u as u2 } from "./chunks/useTheme-caPM-I73.mjs";
|
|
5
|
+
import { af as tv, c as cn, a0 as Popover, a4 as PopoverTrigger, a3 as PopoverContent, ae as Button, D as Dialog, G as DialogTrigger, v as DialogContent, F as DialogTitle, a1 as PopoverAnchor, u as DialogClose, w as DialogDescription, H as DropdownMenu, V as DropdownMenuTrigger, J as DropdownMenuContent, O as DropdownMenuRadioGroup, P as DropdownMenuRadioItem, M as DropdownMenuLabel, Q as DropdownMenuSeparator, L as DropdownMenuItem } from "./chunks/avatar-CZRLkTxt.mjs";
|
|
6
|
+
import { d as d3, e as e2, f as f2, g as g2, h as h2, i as i2, W as W2, X as X2, Y as Y2, Z as Z2, _ as _2, $ as $2, I as I2, ag as ag2, ad as ad2 } from "./chunks/avatar-CZRLkTxt.mjs";
|
|
7
7
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import { createContext, forwardRef, useContext, useId, useState, Fragment as Fragment$1, isValidElement, useCallback, useMemo, createElement, useRef, useEffect, useLayoutEffect, Children } from "react";
|
|
10
|
-
import { Q as Switch, l as Checkbox, C as Calendar, T as Textarea } from "./chunks/sheet-
|
|
11
|
-
import { G as G2, H as
|
|
12
|
-
import {
|
|
13
|
-
import { B as
|
|
14
|
-
import { Check, MoreHorizontal, SlidersHorizontal, Calendar as Calendar$1, AlertCircle, CheckCheck, Clock, MoreVertical, Ban, X as
|
|
9
|
+
import { createContext, forwardRef, useContext, useId, useState, Fragment as Fragment$1, isValidElement, useCallback, useMemo, createElement, useRef, useEffect, useLayoutEffect, useImperativeHandle, Children } from "react";
|
|
10
|
+
import { Q as Switch, l as Checkbox, C as Calendar, T as Textarea } from "./chunks/sheet-Bjjo4ZaT.mjs";
|
|
11
|
+
import { G as G2, H as H3, F as F2, O as O2 } from "./chunks/sheet-Bjjo4ZaT.mjs";
|
|
12
|
+
import { ao as RadioGroup, ap as RadioGroupItem, as as Separator, at as Skeleton, T as HoverCard, V as HoverCardTrigger, U as HoverCardContent } from "./chunks/toggle-group-XMgZgL-H.mjs";
|
|
13
|
+
import { B as B3, aC } from "./chunks/toggle-group-XMgZgL-H.mjs";
|
|
14
|
+
import { Check, MoreHorizontal, SlidersHorizontal, Calendar as Calendar$1, AlertCircle, CheckCheck, Clock, MoreVertical, Ban, X as X3, CalendarDays, ChevronDown, ChevronLeft, ChevronRight, Search, ListFilter, Columns3, Square, List, Plus, CalendarSearch, Circle, RefreshCw, OctagonX, TriangleAlert, CircleCheck, Info, Bell } from "lucide-react";
|
|
15
15
|
import { Reply } from "lucide-react";
|
|
16
|
-
import { I as Input } from "./chunks/input-
|
|
17
|
-
import { i as
|
|
18
|
-
import { a as a10, b as b3, K as K2 } from "./chunks/kpi-delta-
|
|
19
|
-
import { P as
|
|
16
|
+
import { I as Input } from "./chunks/input-BQABJR2N.mjs";
|
|
17
|
+
import { i as i3 } from "./chunks/input-BQABJR2N.mjs";
|
|
18
|
+
import { a as a10, b as b3, K as K2 } from "./chunks/kpi-delta-Bfs_oVpq.mjs";
|
|
19
|
+
import { P as P2, p as p3 } from "./chunks/page-header-t5hFIp7o.mjs";
|
|
20
|
+
import { useSensors, useSensor, PointerSensor, useDroppable, useDraggable, DndContext, DragOverlay } from "@dnd-kit/core";
|
|
21
|
+
import { addMinutes, differenceInCalendarDays, startOfDay, addDays, startOfMonth, startOfWeek, addHours, endOfDay, addMonths, format, isSameDay, isSameMonth, endOfMonth, addWeeks, endOfWeek } from "date-fns";
|
|
20
22
|
import * as RechartsPrimitive from "recharts";
|
|
21
23
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
22
24
|
import "@hello-pangea/dnd";
|
|
@@ -434,12 +436,12 @@ const DEFAULT_COLOR_PRESETS = [
|
|
|
434
436
|
"#111827"
|
|
435
437
|
];
|
|
436
438
|
function normalizeHex(raw) {
|
|
437
|
-
let
|
|
438
|
-
if (/^[0-9a-fA-F]{3}$/.test(
|
|
439
|
-
|
|
439
|
+
let h3 = raw.trim().replace(/^#/, "");
|
|
440
|
+
if (/^[0-9a-fA-F]{3}$/.test(h3)) {
|
|
441
|
+
h3 = h3.split("").map((c3) => c3 + c3).join("");
|
|
440
442
|
}
|
|
441
|
-
if (/^[0-9a-fA-F]{6}$/.test(
|
|
442
|
-
return `#${
|
|
443
|
+
if (/^[0-9a-fA-F]{6}$/.test(h3)) {
|
|
444
|
+
return `#${h3.toUpperCase()}`;
|
|
443
445
|
}
|
|
444
446
|
return null;
|
|
445
447
|
}
|
|
@@ -530,11 +532,11 @@ const ColorPicker = forwardRef(
|
|
|
530
532
|
"aria-label": "Cor hexadecimal",
|
|
531
533
|
className: styles2.hexInput(),
|
|
532
534
|
value: inlineDraft,
|
|
533
|
-
onChange: (
|
|
535
|
+
onChange: (e3) => setInlineDraft(e3.target.value),
|
|
534
536
|
onBlur: handleInlineCommit,
|
|
535
|
-
onKeyDown: (
|
|
536
|
-
if (
|
|
537
|
-
|
|
537
|
+
onKeyDown: (e3) => {
|
|
538
|
+
if (e3.key === "Enter") {
|
|
539
|
+
e3.preventDefault();
|
|
538
540
|
handleInlineCommit();
|
|
539
541
|
}
|
|
540
542
|
}
|
|
@@ -595,10 +597,10 @@ const ColorPicker = forwardRef(
|
|
|
595
597
|
placeholder,
|
|
596
598
|
"aria-label": "Cor hexadecimal",
|
|
597
599
|
value: customDraft,
|
|
598
|
-
onChange: (
|
|
599
|
-
onKeyDown: (
|
|
600
|
-
if (
|
|
601
|
-
|
|
600
|
+
onChange: (e3) => setCustomDraft(e3.target.value),
|
|
601
|
+
onKeyDown: (e3) => {
|
|
602
|
+
if (e3.key === "Enter") {
|
|
603
|
+
e3.preventDefault();
|
|
602
604
|
handleCustomConfirm();
|
|
603
605
|
}
|
|
604
606
|
}
|
|
@@ -705,12 +707,12 @@ function parseInline(text, s2, prefix) {
|
|
|
705
707
|
function parseLinksAndInline(text, s2, prefix) {
|
|
706
708
|
const out = [];
|
|
707
709
|
let last = 0;
|
|
708
|
-
let
|
|
710
|
+
let i4 = 0;
|
|
709
711
|
URL_RE.lastIndex = 0;
|
|
710
712
|
let m2;
|
|
711
713
|
while ((m2 = URL_RE.exec(text)) !== null) {
|
|
712
714
|
if (m2.index > last) {
|
|
713
|
-
pushAll(out, parseInline(text.slice(last, m2.index), s2, `${prefix}-${
|
|
715
|
+
pushAll(out, parseInline(text.slice(last, m2.index), s2, `${prefix}-${i4}t`));
|
|
714
716
|
}
|
|
715
717
|
const raw = m2[0];
|
|
716
718
|
const href = raw.startsWith("www.") ? `https://${raw}` : raw;
|
|
@@ -724,36 +726,36 @@ function parseLinksAndInline(text, s2, prefix) {
|
|
|
724
726
|
className: s2.link(),
|
|
725
727
|
children: raw
|
|
726
728
|
},
|
|
727
|
-
`${prefix}-${
|
|
729
|
+
`${prefix}-${i4}link`
|
|
728
730
|
)
|
|
729
731
|
);
|
|
730
732
|
last = m2.index + raw.length;
|
|
731
|
-
|
|
733
|
+
i4 += 1;
|
|
732
734
|
}
|
|
733
735
|
if (last < text.length) {
|
|
734
|
-
pushAll(out, parseInline(text.slice(last), s2, `${prefix}-${
|
|
736
|
+
pushAll(out, parseInline(text.slice(last), s2, `${prefix}-${i4}t`));
|
|
735
737
|
}
|
|
736
738
|
return out;
|
|
737
739
|
}
|
|
738
740
|
function parseMarkdown(source, s2) {
|
|
739
741
|
const out = [];
|
|
740
742
|
let last = 0;
|
|
741
|
-
let
|
|
743
|
+
let i4 = 0;
|
|
742
744
|
CODE_RE.lastIndex = 0;
|
|
743
745
|
let m2;
|
|
744
746
|
while ((m2 = CODE_RE.exec(source)) !== null) {
|
|
745
747
|
if (m2.index > last) {
|
|
746
|
-
pushAll(out, parseLinksAndInline(source.slice(last, m2.index), s2, `${
|
|
748
|
+
pushAll(out, parseLinksAndInline(source.slice(last, m2.index), s2, `${i4}t`));
|
|
747
749
|
}
|
|
748
750
|
const codeContent = m2[1] ?? m2[2] ?? "";
|
|
749
751
|
out.push(
|
|
750
|
-
/* @__PURE__ */ jsx("code", { className: s2.code(), children: codeContent }, `${
|
|
752
|
+
/* @__PURE__ */ jsx("code", { className: s2.code(), children: codeContent }, `${i4}code`)
|
|
751
753
|
);
|
|
752
754
|
last = m2.index + m2[0].length;
|
|
753
|
-
|
|
755
|
+
i4 += 1;
|
|
754
756
|
}
|
|
755
757
|
if (last < source.length) {
|
|
756
|
-
pushAll(out, parseLinksAndInline(source.slice(last), s2, `${
|
|
758
|
+
pushAll(out, parseLinksAndInline(source.slice(last), s2, `${i4}t`));
|
|
757
759
|
}
|
|
758
760
|
return out;
|
|
759
761
|
}
|
|
@@ -765,7 +767,7 @@ function MarkdownText({
|
|
|
765
767
|
const styles2 = markdownTextStyles({ inline });
|
|
766
768
|
const source = inline ? children.replace(/\s+/g, " ").trim() : children;
|
|
767
769
|
const nodes = parseMarkdown(source, styles2);
|
|
768
|
-
const content = nodes.map((node,
|
|
770
|
+
const content = nodes.map((node, i4) => /* @__PURE__ */ jsx(Fragment$1, { children: node }, i4));
|
|
769
771
|
if (inline) {
|
|
770
772
|
return /* @__PURE__ */ jsx("span", { className: styles2.root({ className }), children: content });
|
|
771
773
|
}
|
|
@@ -888,14 +890,14 @@ const ConversationListItem = forwardRef(function ConversationListItem2({
|
|
|
888
890
|
disabled
|
|
889
891
|
});
|
|
890
892
|
const interactive = !disabled && typeof onClick === "function";
|
|
891
|
-
const handleKeyDown = (
|
|
893
|
+
const handleKeyDown = (e3) => {
|
|
892
894
|
if (!interactive) return;
|
|
893
|
-
if (
|
|
894
|
-
|
|
895
|
+
if (e3.key === "Enter" || e3.key === " ") {
|
|
896
|
+
e3.preventDefault();
|
|
895
897
|
onClick?.();
|
|
896
898
|
}
|
|
897
899
|
};
|
|
898
|
-
const stopActions = (
|
|
900
|
+
const stopActions = (e3) => e3.stopPropagation();
|
|
899
901
|
let avatarNode = null;
|
|
900
902
|
if (avatar != null) {
|
|
901
903
|
if (isAvatarData(avatar)) {
|
|
@@ -1025,20 +1027,20 @@ function useToolbarFilters(options) {
|
|
|
1025
1027
|
[generateId]
|
|
1026
1028
|
);
|
|
1027
1029
|
const remove = useCallback((id) => {
|
|
1028
|
-
setList((prev) => prev.filter((
|
|
1030
|
+
setList((prev) => prev.filter((f3) => f3.id !== id));
|
|
1029
1031
|
}, []);
|
|
1030
1032
|
const update = useCallback((id, patch) => {
|
|
1031
1033
|
setList(
|
|
1032
|
-
(prev) => prev.map((
|
|
1034
|
+
(prev) => prev.map((f3) => f3.id === id ? { ...f3, ...patch } : f3)
|
|
1033
1035
|
);
|
|
1034
1036
|
}, []);
|
|
1035
1037
|
const clear = useCallback(() => setList([]), []);
|
|
1036
1038
|
const replaceAll = useCallback((next) => setList(next), []);
|
|
1037
1039
|
const count = useMemo(
|
|
1038
|
-
() => list.filter((
|
|
1039
|
-
if (
|
|
1040
|
-
if (typeof
|
|
1041
|
-
if (Array.isArray(
|
|
1040
|
+
() => list.filter((f3) => {
|
|
1041
|
+
if (f3.value === null || f3.value === void 0) return false;
|
|
1042
|
+
if (typeof f3.value === "string") return f3.value.length > 0;
|
|
1043
|
+
if (Array.isArray(f3.value)) return f3.value.length > 0;
|
|
1042
1044
|
return true;
|
|
1043
1045
|
}).length,
|
|
1044
1046
|
[list]
|
|
@@ -1063,7 +1065,7 @@ function useToolbarSort(options) {
|
|
|
1063
1065
|
next[idx] = { ...current, direction: "desc" };
|
|
1064
1066
|
return next;
|
|
1065
1067
|
}
|
|
1066
|
-
return prev.filter((
|
|
1068
|
+
return prev.filter((_3, i4) => i4 !== idx);
|
|
1067
1069
|
});
|
|
1068
1070
|
},
|
|
1069
1071
|
[maxColumns]
|
|
@@ -3861,7 +3863,7 @@ const Icon = forwardRef(
|
|
|
3861
3863
|
...props,
|
|
3862
3864
|
children: [
|
|
3863
3865
|
title2 ? /* @__PURE__ */ jsx("title", { children: title2 }) : null,
|
|
3864
|
-
paths.map((
|
|
3866
|
+
paths.map((d4, i4) => /* @__PURE__ */ jsx("path", { d: d4 }, i4))
|
|
3865
3867
|
]
|
|
3866
3868
|
}
|
|
3867
3869
|
);
|
|
@@ -4132,7 +4134,7 @@ function FileUploadField({
|
|
|
4132
4134
|
accept,
|
|
4133
4135
|
disabled,
|
|
4134
4136
|
className: "hidden",
|
|
4135
|
-
onChange: (
|
|
4137
|
+
onChange: (e3) => handleFiles(e3.target.files?.[0])
|
|
4136
4138
|
}
|
|
4137
4139
|
),
|
|
4138
4140
|
value == null ? /* @__PURE__ */ jsxs(
|
|
@@ -4352,7 +4354,7 @@ function MessageMediaRenderer({
|
|
|
4352
4354
|
role: onMediaClick ? "button" : void 0,
|
|
4353
4355
|
tabIndex: onMediaClick ? 0 : void 0,
|
|
4354
4356
|
onClick: onMediaClick,
|
|
4355
|
-
onKeyDown: (
|
|
4357
|
+
onKeyDown: (e3) => handleMediaKeyDown(e3, onMediaClick)
|
|
4356
4358
|
}
|
|
4357
4359
|
) : null });
|
|
4358
4360
|
case "audio":
|
|
@@ -4372,7 +4374,7 @@ function MessageMediaRenderer({
|
|
|
4372
4374
|
role: onMediaClick ? "button" : void 0,
|
|
4373
4375
|
tabIndex: onMediaClick ? 0 : void 0,
|
|
4374
4376
|
onClick: onMediaClick,
|
|
4375
|
-
onKeyDown: (
|
|
4377
|
+
onKeyDown: (e3) => handleMediaKeyDown(e3, onMediaClick)
|
|
4376
4378
|
}
|
|
4377
4379
|
)
|
|
4378
4380
|
) : null });
|
|
@@ -4686,7 +4688,7 @@ const MessageComposer = forwardRef(function MessageComposer2({
|
|
|
4686
4688
|
placeholder,
|
|
4687
4689
|
"aria-label": placeholder ?? "Mensagem",
|
|
4688
4690
|
className: styles2.textarea(),
|
|
4689
|
-
onChange: (
|
|
4691
|
+
onChange: (e3) => onChange(e3.target.value),
|
|
4690
4692
|
onKeyDown: handleKeyDown
|
|
4691
4693
|
}
|
|
4692
4694
|
) }),
|
|
@@ -4804,7 +4806,7 @@ function MessageVariablesPicker({
|
|
|
4804
4806
|
size: "sm",
|
|
4805
4807
|
asButton: true,
|
|
4806
4808
|
"aria-label": `Inserir ${variable.label}`,
|
|
4807
|
-
onMouseDown: (
|
|
4809
|
+
onMouseDown: (e3) => e3.preventDefault(),
|
|
4808
4810
|
onClick: () => handleSelect(variable.token),
|
|
4809
4811
|
children: variable.label
|
|
4810
4812
|
},
|
|
@@ -4958,7 +4960,7 @@ function Modal({
|
|
|
4958
4960
|
...description$1 ? {} : { "aria-describedby": void 0 },
|
|
4959
4961
|
children: [
|
|
4960
4962
|
!title$1 && /* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: "Diálogo" }),
|
|
4961
|
-
!hideClose && /* @__PURE__ */ jsx(DialogClose, { className: closeBtn(), "aria-label": "Fechar", children: /* @__PURE__ */ jsx(
|
|
4963
|
+
!hideClose && /* @__PURE__ */ jsx(DialogClose, { className: closeBtn(), "aria-label": "Fechar", children: /* @__PURE__ */ jsx(X3, { className: "size-icon-sm" }) }),
|
|
4962
4964
|
hasHeader && /* @__PURE__ */ jsxs("header", { className: head(), children: [
|
|
4963
4965
|
icon && /* @__PURE__ */ jsx("span", { className: headIcon(), "aria-hidden": "true", children: icon }),
|
|
4964
4966
|
(title$1 || description$1) && /* @__PURE__ */ jsxs("div", { className: headTitleWrap(), children: [
|
|
@@ -5146,7 +5148,7 @@ const MonthYearPicker = forwardRef(function MonthYearPicker2({
|
|
|
5146
5148
|
const fmt = new Intl.DateTimeFormat(locale, { month: "short" });
|
|
5147
5149
|
return Array.from(
|
|
5148
5150
|
{ length: 12 },
|
|
5149
|
-
(
|
|
5151
|
+
(_3, i4) => capitalizeFirst(fmt.format(new Date(2020, i4, 1)).replace(/\.$/, ""))
|
|
5150
5152
|
);
|
|
5151
5153
|
}, [locale]);
|
|
5152
5154
|
const triggerLabel = useMemo(() => {
|
|
@@ -5228,9 +5230,9 @@ const MonthYearPicker = forwardRef(function MonthYearPicker2({
|
|
|
5228
5230
|
}
|
|
5229
5231
|
)
|
|
5230
5232
|
] }),
|
|
5231
|
-
/* @__PURE__ */ jsx("div", { className: styles2.grid(), role: "grid", children: monthLabels.map((label,
|
|
5232
|
-
const monthDisabled = isMonthDisabled(
|
|
5233
|
-
const isSelected = parsed?.year === viewYear && parsed?.month ===
|
|
5233
|
+
/* @__PURE__ */ jsx("div", { className: styles2.grid(), role: "grid", children: monthLabels.map((label, i4) => {
|
|
5234
|
+
const monthDisabled = isMonthDisabled(i4);
|
|
5235
|
+
const isSelected = parsed?.year === viewYear && parsed?.month === i4 + 1;
|
|
5234
5236
|
return /* @__PURE__ */ jsx(
|
|
5235
5237
|
"button",
|
|
5236
5238
|
{
|
|
@@ -5238,7 +5240,7 @@ const MonthYearPicker = forwardRef(function MonthYearPicker2({
|
|
|
5238
5240
|
role: "gridcell",
|
|
5239
5241
|
"aria-pressed": isSelected,
|
|
5240
5242
|
disabled: monthDisabled,
|
|
5241
|
-
onClick: () => selectMonth(
|
|
5243
|
+
onClick: () => selectMonth(i4),
|
|
5242
5244
|
className: monthYearMonthButton({
|
|
5243
5245
|
selected: isSelected,
|
|
5244
5246
|
disabled: monthDisabled
|
|
@@ -5254,6 +5256,2516 @@ const MonthYearPicker = forwardRef(function MonthYearPicker2({
|
|
|
5254
5256
|
] });
|
|
5255
5257
|
});
|
|
5256
5258
|
MonthYearPicker.displayName = "MonthYearPicker";
|
|
5259
|
+
const schedulerRoot = tv({
|
|
5260
|
+
base: [
|
|
5261
|
+
"flex h-full min-h-0 w-full flex-col gap-gp-2xl",
|
|
5262
|
+
"text-fg-default"
|
|
5263
|
+
]
|
|
5264
|
+
});
|
|
5265
|
+
const schedulerToolbar = tv({
|
|
5266
|
+
base: [
|
|
5267
|
+
"flex flex-wrap items-center justify-between gap-gp-xl"
|
|
5268
|
+
]
|
|
5269
|
+
});
|
|
5270
|
+
const schedulerToolbarSide = tv({
|
|
5271
|
+
base: "flex min-w-0 flex-wrap items-center gap-gp-md"
|
|
5272
|
+
});
|
|
5273
|
+
const schedulerTitle = tv({
|
|
5274
|
+
base: [
|
|
5275
|
+
"min-w-0 truncate text-title-sm font-semibold text-fg-default",
|
|
5276
|
+
"first-letter:uppercase"
|
|
5277
|
+
]
|
|
5278
|
+
});
|
|
5279
|
+
const schedulerNavGroup = tv({
|
|
5280
|
+
base: [
|
|
5281
|
+
"inline-flex shrink-0 items-center",
|
|
5282
|
+
"[&>*:not(:first-child)]:-ml-px",
|
|
5283
|
+
// O segmento com foco sobe pra que o anel não seja cortado pelo vizinho.
|
|
5284
|
+
"[&>*:focus-visible]:relative [&>*:focus-visible]:z-[1]",
|
|
5285
|
+
"[&>*:first-child]:!rounded-r-none",
|
|
5286
|
+
"[&>*:last-child]:!rounded-l-none",
|
|
5287
|
+
"[&>*:not(:first-child):not(:last-child)]:!rounded-none"
|
|
5288
|
+
]
|
|
5289
|
+
});
|
|
5290
|
+
tv({
|
|
5291
|
+
base: "tabular-nums"
|
|
5292
|
+
});
|
|
5293
|
+
const schedulerViewMenuItem = tv({
|
|
5294
|
+
base: "flex items-center justify-between gap-gp-xl"
|
|
5295
|
+
});
|
|
5296
|
+
const schedulerFilterDot = tv({
|
|
5297
|
+
base: [
|
|
5298
|
+
"pointer-events-none absolute -right-[4px] -top-[4px] z-[2]",
|
|
5299
|
+
"size-[13px] rounded-radius-full",
|
|
5300
|
+
"bg-bg-brand border-2 border-bg-canvas"
|
|
5301
|
+
]
|
|
5302
|
+
});
|
|
5303
|
+
const schedulerSearch = tv({
|
|
5304
|
+
base: [
|
|
5305
|
+
"relative flex cursor-text items-center gap-gp-md",
|
|
5306
|
+
"h-form-lg rounded-radius-lg px-pad-lg",
|
|
5307
|
+
"bg-bg-surface dark:bg-bg-muted",
|
|
5308
|
+
"border border-border-subtle dark:border-border-input",
|
|
5309
|
+
"shadow-sh-sm dark:shadow-sh-none",
|
|
5310
|
+
"text-fg-default",
|
|
5311
|
+
"min-w-0 flex-1 md:flex-initial",
|
|
5312
|
+
"md:w-[200px] md:focus-within:w-[300px]",
|
|
5313
|
+
"transition-[width,border-color,background-color,box-shadow] duration-200",
|
|
5314
|
+
"focus-within:border-border-brand focus-within:shadow-sh-ring",
|
|
5315
|
+
"[&_svg]:size-icon-sm [&_svg]:shrink-0 [&_svg]:text-fg-muted"
|
|
5316
|
+
],
|
|
5317
|
+
variants: {
|
|
5318
|
+
/** Mantém expandido mesmo sem foco quando já há termo digitado. */
|
|
5319
|
+
expanded: { true: "md:w-[300px]", false: "" }
|
|
5320
|
+
},
|
|
5321
|
+
defaultVariants: { expanded: false }
|
|
5322
|
+
});
|
|
5323
|
+
const schedulerSearchInput = tv({
|
|
5324
|
+
base: [
|
|
5325
|
+
"min-w-0 flex-1 border-0 bg-transparent outline-none",
|
|
5326
|
+
"text-body-sm font-normal text-fg-default",
|
|
5327
|
+
"placeholder:text-fg-muted"
|
|
5328
|
+
]
|
|
5329
|
+
});
|
|
5330
|
+
const schedulerFilterRow = tv({
|
|
5331
|
+
base: [
|
|
5332
|
+
"flex items-center gap-gp-md",
|
|
5333
|
+
"flex-nowrap overflow-x-auto sm:flex-wrap sm:overflow-x-visible",
|
|
5334
|
+
"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
5335
|
+
]
|
|
5336
|
+
});
|
|
5337
|
+
const schedulerFilterChip = tv({
|
|
5338
|
+
base: [
|
|
5339
|
+
"inline-flex shrink-0 cursor-pointer items-center gap-gp-sm",
|
|
5340
|
+
"h-form-md rounded-radius-lg pl-pad-lg pr-pad-md",
|
|
5341
|
+
"bg-bg-surface dark:bg-bg-muted",
|
|
5342
|
+
"border text-body-xs font-normal text-fg-default",
|
|
5343
|
+
"transition-[background-color,border-color] duration-150",
|
|
5344
|
+
"hover:bg-bg-muted-hover hover:border-border-default dark:hover:bg-bg-accent",
|
|
5345
|
+
"focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand",
|
|
5346
|
+
"[&_svg]:size-icon-xs [&_svg]:shrink-0 [&_svg]:text-fg-subtle"
|
|
5347
|
+
],
|
|
5348
|
+
variants: {
|
|
5349
|
+
applied: {
|
|
5350
|
+
true: "border-solid border-border-brand bg-bg-brand-subtle dark:bg-bg-brand-subtle",
|
|
5351
|
+
false: "border-dashed border-border-input"
|
|
5352
|
+
}
|
|
5353
|
+
},
|
|
5354
|
+
defaultVariants: { applied: false }
|
|
5355
|
+
});
|
|
5356
|
+
const schedulerFilterChipName = tv({
|
|
5357
|
+
base: "font-semibold text-fg-default"
|
|
5358
|
+
});
|
|
5359
|
+
const schedulerFilterChipValue = tv({
|
|
5360
|
+
base: [
|
|
5361
|
+
"inline-flex h-comp-2xs items-center px-pad-md",
|
|
5362
|
+
"rounded-radius-sm bg-bg-muted dark:bg-bg-accent",
|
|
5363
|
+
"text-body-xs font-medium text-fg-default"
|
|
5364
|
+
]
|
|
5365
|
+
});
|
|
5366
|
+
const schedulerClearLink = tv({
|
|
5367
|
+
base: [
|
|
5368
|
+
"ml-pad-sm cursor-pointer border-0 bg-transparent p-0",
|
|
5369
|
+
"text-body-xs font-medium text-fg-brand outline-none",
|
|
5370
|
+
"underline-offset-2 transition-opacity duration-150",
|
|
5371
|
+
"hover:underline focus-visible:underline"
|
|
5372
|
+
]
|
|
5373
|
+
});
|
|
5374
|
+
const schedulerBody = tv({
|
|
5375
|
+
base: "flex min-h-0 flex-1 gap-gp-2xl"
|
|
5376
|
+
});
|
|
5377
|
+
const schedulerMain = tv({
|
|
5378
|
+
base: "flex min-h-0 min-w-0 flex-1 flex-col"
|
|
5379
|
+
});
|
|
5380
|
+
const schedulerFilterAside = tv({
|
|
5381
|
+
base: [
|
|
5382
|
+
"flex w-[280px] min-h-0 shrink-0 flex-col overflow-y-auto",
|
|
5383
|
+
// `scrollbar-thin` é a barra do DS (26 usos no repo contra 2 do
|
|
5384
|
+
// `scrollbar-default`) — trilho transparente + thumb tokenizado.
|
|
5385
|
+
// ⚠️ É `@utility` do tema GERADO, não do globals.css: existe nos 4 canais.
|
|
5386
|
+
"scrollbar-thin",
|
|
5387
|
+
"rounded-radius-xl border border-border-default bg-bg-surface"
|
|
5388
|
+
]
|
|
5389
|
+
});
|
|
5390
|
+
const schedulerAsideSection = tv({
|
|
5391
|
+
base: [
|
|
5392
|
+
"flex shrink-0 flex-col gap-gp-md",
|
|
5393
|
+
"border-b border-border-default p-sp-xl last:border-b-0"
|
|
5394
|
+
],
|
|
5395
|
+
variants: {
|
|
5396
|
+
/** O cabeçalho é mais raso: só uma linha de título + ações. */
|
|
5397
|
+
compact: { true: "py-pad-lg", false: "" },
|
|
5398
|
+
/**
|
|
5399
|
+
* Cabeçalho fixo no topo enquanto o resto rola.
|
|
5400
|
+
*
|
|
5401
|
+
* `bg-bg-surface` é **obrigatório** e não decoração: `sticky` não cria
|
|
5402
|
+
* fundo, então sem ele o mini-calendário passaria por baixo do título. E
|
|
5403
|
+
* `z-[1]` porque as caixas e o `Checkbox` do Radix criam contexto próprio
|
|
5404
|
+
* de empilhamento — sem o z, o conteúdo que rola sobrepõe o cabeçalho.
|
|
5405
|
+
*/
|
|
5406
|
+
sticky: { true: "sticky top-0 z-[1] bg-bg-surface", false: "" }
|
|
5407
|
+
},
|
|
5408
|
+
defaultVariants: { compact: false, sticky: false }
|
|
5409
|
+
});
|
|
5410
|
+
const schedulerAsideHead = tv({
|
|
5411
|
+
base: "flex items-center justify-between gap-gp-md"
|
|
5412
|
+
});
|
|
5413
|
+
const schedulerAsideTitle = tv({
|
|
5414
|
+
base: "text-body-sm font-semibold text-fg-default"
|
|
5415
|
+
});
|
|
5416
|
+
const schedulerMiniHead = tv({
|
|
5417
|
+
base: "flex items-center justify-between gap-gp-sm"
|
|
5418
|
+
});
|
|
5419
|
+
const schedulerMiniTitle = tv({
|
|
5420
|
+
base: "min-w-0 truncate text-body-sm font-semibold text-fg-default first-letter:uppercase"
|
|
5421
|
+
});
|
|
5422
|
+
const schedulerMiniGrid = tv({
|
|
5423
|
+
base: "grid grid-cols-7 gap-gp-2xs"
|
|
5424
|
+
});
|
|
5425
|
+
const schedulerMiniWeekday = tv({
|
|
5426
|
+
base: [
|
|
5427
|
+
"grid size-comp-xs place-items-center",
|
|
5428
|
+
"text-caption-xs font-medium uppercase text-fg-subtle"
|
|
5429
|
+
]
|
|
5430
|
+
});
|
|
5431
|
+
const schedulerMiniDay = tv({
|
|
5432
|
+
base: [
|
|
5433
|
+
"grid size-comp-xs cursor-pointer place-items-center rounded-radius-full",
|
|
5434
|
+
"border-0 bg-transparent outline-none",
|
|
5435
|
+
"text-caption-md tabular-nums",
|
|
5436
|
+
"transition-[background-color,color,box-shadow] duration-150",
|
|
5437
|
+
"hover:bg-bg-muted",
|
|
5438
|
+
"focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand"
|
|
5439
|
+
],
|
|
5440
|
+
variants: {
|
|
5441
|
+
outside: { true: "text-fg-subtle", false: "text-fg-default" },
|
|
5442
|
+
hasEvents: { true: "font-semibold", false: "" },
|
|
5443
|
+
today: { true: "ring-1 ring-border-brand", false: "" },
|
|
5444
|
+
selected: {
|
|
5445
|
+
true: "bg-bg-brand font-semibold text-fg-on-brand hover:bg-bg-brand-hover",
|
|
5446
|
+
false: ""
|
|
5447
|
+
}
|
|
5448
|
+
},
|
|
5449
|
+
compoundVariants: [
|
|
5450
|
+
// Selecionado vence "hoje": um anel em volta do disco cheio não informa
|
|
5451
|
+
// nada e adiciona 2px de ruído.
|
|
5452
|
+
{ selected: true, today: true, class: "ring-0" },
|
|
5453
|
+
{ selected: true, outside: true, class: "text-fg-on-brand" }
|
|
5454
|
+
],
|
|
5455
|
+
defaultVariants: {
|
|
5456
|
+
outside: false,
|
|
5457
|
+
hasEvents: false,
|
|
5458
|
+
today: false,
|
|
5459
|
+
selected: false
|
|
5460
|
+
}
|
|
5461
|
+
});
|
|
5462
|
+
const schedulerGroup = tv({
|
|
5463
|
+
base: "flex flex-col gap-gp-sm"
|
|
5464
|
+
});
|
|
5465
|
+
const schedulerGroupHead = tv({
|
|
5466
|
+
base: [
|
|
5467
|
+
"flex w-full cursor-pointer items-center justify-between gap-gp-md",
|
|
5468
|
+
"min-h-form-sm rounded-radius-sm border-0 bg-transparent -mx-pad-sm px-pad-sm outline-none",
|
|
5469
|
+
"text-body-sm font-semibold text-fg-default",
|
|
5470
|
+
"transition-colors duration-150",
|
|
5471
|
+
"hover:bg-bg-muted",
|
|
5472
|
+
"focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand",
|
|
5473
|
+
"[&_svg]:size-icon-sm [&_svg]:shrink-0 [&_svg]:text-fg-subtle"
|
|
5474
|
+
]
|
|
5475
|
+
});
|
|
5476
|
+
const schedulerGroupChevron = tv({
|
|
5477
|
+
base: "transition-transform duration-150",
|
|
5478
|
+
variants: { open: { true: "", false: "-rotate-90" } },
|
|
5479
|
+
defaultVariants: { open: true }
|
|
5480
|
+
});
|
|
5481
|
+
const schedulerOption = tv({
|
|
5482
|
+
base: [
|
|
5483
|
+
"flex cursor-pointer items-center gap-gp-md",
|
|
5484
|
+
"min-h-form-sm rounded-radius-sm -mx-pad-sm px-pad-sm",
|
|
5485
|
+
"text-body-sm text-fg-default",
|
|
5486
|
+
"transition-colors duration-150",
|
|
5487
|
+
"hover:bg-bg-muted",
|
|
5488
|
+
"has-[:focus-visible]:ring-4 has-[:focus-visible]:ring-ring-brand"
|
|
5489
|
+
]
|
|
5490
|
+
});
|
|
5491
|
+
const schedulerOptionLabel = tv({
|
|
5492
|
+
base: "min-w-0 flex-1 truncate"
|
|
5493
|
+
});
|
|
5494
|
+
const schedulerOptionCount = tv({
|
|
5495
|
+
base: "shrink-0 text-caption-sm tabular-nums text-fg-subtle"
|
|
5496
|
+
});
|
|
5497
|
+
const schedulerOptionBox = tv({
|
|
5498
|
+
base: "shrink-0",
|
|
5499
|
+
variants: {
|
|
5500
|
+
color: {
|
|
5501
|
+
brand: "data-[state=checked]:bg-bg-brand data-[state=checked]:border-border-brand [&_svg]:text-fg-on-brand",
|
|
5502
|
+
info: "data-[state=checked]:bg-bg-info data-[state=checked]:border-bg-info [&_svg]:text-fg-on-info",
|
|
5503
|
+
success: "data-[state=checked]:bg-bg-success data-[state=checked]:border-bg-success [&_svg]:text-fg-on-success",
|
|
5504
|
+
warning: "data-[state=checked]:bg-bg-warning data-[state=checked]:border-bg-warning [&_svg]:text-fg-on-warning",
|
|
5505
|
+
danger: "data-[state=checked]:bg-bg-danger data-[state=checked]:border-bg-danger [&_svg]:text-fg-on-danger",
|
|
5506
|
+
neutral: "data-[state=checked]:bg-fg-subtle data-[state=checked]:border-fg-subtle [&_svg]:text-bg-surface"
|
|
5507
|
+
}
|
|
5508
|
+
},
|
|
5509
|
+
defaultVariants: { color: "brand" }
|
|
5510
|
+
});
|
|
5511
|
+
const schedulerMonthFrame = tv({
|
|
5512
|
+
base: [
|
|
5513
|
+
"flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
5514
|
+
"rounded-radius-xl border border-border-default bg-bg-surface"
|
|
5515
|
+
]
|
|
5516
|
+
});
|
|
5517
|
+
const schedulerWeekdayRow = tv({
|
|
5518
|
+
base: [
|
|
5519
|
+
"grid grid-cols-7 border-b border-border-default bg-bg-subtle dark:bg-bg-canvas"
|
|
5520
|
+
]
|
|
5521
|
+
});
|
|
5522
|
+
const schedulerWeekdayCell = tv({
|
|
5523
|
+
base: [
|
|
5524
|
+
"flex min-h-form-md items-center justify-center",
|
|
5525
|
+
"text-caption-md font-medium text-fg-muted",
|
|
5526
|
+
"first-letter:uppercase"
|
|
5527
|
+
]
|
|
5528
|
+
});
|
|
5529
|
+
const schedulerMonthGrid = tv({
|
|
5530
|
+
base: "grid min-h-0 flex-1 grid-cols-7 grid-rows-6"
|
|
5531
|
+
});
|
|
5532
|
+
const schedulerMonthCell = tv({
|
|
5533
|
+
base: [
|
|
5534
|
+
"group/cell relative flex min-h-comp-4xl min-w-0 flex-col gap-gp-2xs",
|
|
5535
|
+
"border-b border-r border-border-subtle p-sp-2xs",
|
|
5536
|
+
"[&:nth-child(7n)]:border-r-0",
|
|
5537
|
+
"transition-colors duration-150"
|
|
5538
|
+
],
|
|
5539
|
+
variants: {
|
|
5540
|
+
/** Dia de mês vizinho — recuado, não escondido: a grade é sempre 6×7. */
|
|
5541
|
+
outside: {
|
|
5542
|
+
true: "bg-bg-subtle/40 dark:bg-bg-canvas",
|
|
5543
|
+
false: "bg-bg-surface"
|
|
5544
|
+
},
|
|
5545
|
+
/** Última linha da grade não desenha borda inferior (o frame já fecha). */
|
|
5546
|
+
lastRow: { true: "border-b-0", false: "" },
|
|
5547
|
+
interactive: { true: "hover:bg-bg-table-row-hover", false: "" }
|
|
5548
|
+
},
|
|
5549
|
+
defaultVariants: { outside: false, lastRow: false, interactive: false }
|
|
5550
|
+
});
|
|
5551
|
+
const schedulerDayHead = tv({
|
|
5552
|
+
base: "flex shrink-0 items-center justify-between gap-gp-sm"
|
|
5553
|
+
});
|
|
5554
|
+
const schedulerDayNumber = tv({
|
|
5555
|
+
base: [
|
|
5556
|
+
"grid size-comp-xs shrink-0 place-items-center rounded-radius-full",
|
|
5557
|
+
"text-body-xs font-medium tabular-nums",
|
|
5558
|
+
"transition-colors duration-150"
|
|
5559
|
+
],
|
|
5560
|
+
variants: {
|
|
5561
|
+
today: {
|
|
5562
|
+
true: "bg-bg-brand font-semibold text-fg-on-brand",
|
|
5563
|
+
false: "text-fg-default"
|
|
5564
|
+
},
|
|
5565
|
+
outside: { true: "text-fg-subtle", false: "" }
|
|
5566
|
+
},
|
|
5567
|
+
compoundVariants: [
|
|
5568
|
+
// `today` vence `outside`: o dia de hoje continua marcado mesmo quando
|
|
5569
|
+
// aparece como dia vizinho na grade de outro mês.
|
|
5570
|
+
{ today: true, outside: true, class: "text-fg-on-brand" }
|
|
5571
|
+
],
|
|
5572
|
+
defaultVariants: { today: false, outside: false }
|
|
5573
|
+
});
|
|
5574
|
+
const schedulerSlotAdd = tv({
|
|
5575
|
+
base: [
|
|
5576
|
+
"grid size-comp-3xs shrink-0 place-items-center rounded-radius-sm",
|
|
5577
|
+
"cursor-pointer border-0 bg-transparent text-fg-subtle outline-none",
|
|
5578
|
+
"opacity-0 transition-[opacity,background-color,color] duration-150",
|
|
5579
|
+
"group-hover/cell:opacity-100 focus-visible:opacity-100",
|
|
5580
|
+
"hover:bg-bg-muted hover:text-fg-default",
|
|
5581
|
+
"focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand",
|
|
5582
|
+
"[&_svg]:size-icon-xs"
|
|
5583
|
+
]
|
|
5584
|
+
});
|
|
5585
|
+
const schedulerCellEvents = tv({
|
|
5586
|
+
base: "flex min-h-0 flex-col gap-gp-2xs overflow-hidden"
|
|
5587
|
+
});
|
|
5588
|
+
const schedulerOverflowButton = tv({
|
|
5589
|
+
base: [
|
|
5590
|
+
"flex min-h-comp-2xs w-full cursor-pointer items-center",
|
|
5591
|
+
"rounded-radius-sm border-0 bg-transparent px-pad-md",
|
|
5592
|
+
"text-caption-sm font-medium text-fg-muted outline-none",
|
|
5593
|
+
"transition-colors duration-150",
|
|
5594
|
+
"hover:bg-bg-muted hover:text-fg-default",
|
|
5595
|
+
"focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand"
|
|
5596
|
+
]
|
|
5597
|
+
});
|
|
5598
|
+
const schedulerOverflowPanel = tv({
|
|
5599
|
+
base: "flex max-h-[320px] min-w-[240px] flex-col gap-gp-2xs overflow-y-auto p-sp-xs"
|
|
5600
|
+
});
|
|
5601
|
+
const schedulerOverflowPanelTitle = tv({
|
|
5602
|
+
base: "px-pad-md pb-pad-sm text-caption-sm font-semibold text-fg-muted first-letter:uppercase"
|
|
5603
|
+
});
|
|
5604
|
+
const schedulerTimeFrame = tv({
|
|
5605
|
+
base: [
|
|
5606
|
+
"flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
5607
|
+
"rounded-radius-xl border border-border-default bg-bg-surface"
|
|
5608
|
+
]
|
|
5609
|
+
});
|
|
5610
|
+
const schedulerTimeHead = tv({
|
|
5611
|
+
base: "flex shrink-0 border-b border-border-default bg-bg-subtle dark:bg-bg-canvas"
|
|
5612
|
+
});
|
|
5613
|
+
const schedulerTimeGutter = tv({
|
|
5614
|
+
base: "w-comp-4xl shrink-0"
|
|
5615
|
+
});
|
|
5616
|
+
const schedulerTimeHeadDay = tv({
|
|
5617
|
+
base: [
|
|
5618
|
+
"flex min-w-0 flex-1 flex-col items-center justify-center gap-gp-2xs",
|
|
5619
|
+
"border-l border-border-subtle py-pad-md"
|
|
5620
|
+
],
|
|
5621
|
+
variants: {
|
|
5622
|
+
/** Sábado/domingo recuados — mesma leitura da grade do mês. */
|
|
5623
|
+
weekend: { true: "bg-bg-subtle/40 dark:bg-bg-canvas", false: "" }
|
|
5624
|
+
},
|
|
5625
|
+
defaultVariants: { weekend: false }
|
|
5626
|
+
});
|
|
5627
|
+
const schedulerTimeHeadWeekday = tv({
|
|
5628
|
+
base: "text-caption-md font-medium uppercase text-fg-muted"
|
|
5629
|
+
});
|
|
5630
|
+
const schedulerAllDayRow = tv({
|
|
5631
|
+
base: "flex shrink-0 border-b border-border-default"
|
|
5632
|
+
});
|
|
5633
|
+
const schedulerAllDayLabel = tv({
|
|
5634
|
+
base: [
|
|
5635
|
+
"flex w-comp-4xl shrink-0 items-start justify-end",
|
|
5636
|
+
"px-pad-md py-pad-sm text-caption-sm text-fg-subtle"
|
|
5637
|
+
]
|
|
5638
|
+
});
|
|
5639
|
+
const schedulerAllDayCell = tv({
|
|
5640
|
+
base: [
|
|
5641
|
+
"flex min-w-0 flex-1 flex-col gap-gp-2xs",
|
|
5642
|
+
"border-l border-border-subtle p-sp-2xs"
|
|
5643
|
+
]
|
|
5644
|
+
});
|
|
5645
|
+
const schedulerTimeBody = tv({
|
|
5646
|
+
base: "min-h-0 flex-1 overflow-y-auto overscroll-contain scrollbar-thin"
|
|
5647
|
+
});
|
|
5648
|
+
const schedulerTimeCanvas = tv({
|
|
5649
|
+
base: "relative flex"
|
|
5650
|
+
});
|
|
5651
|
+
const schedulerHourLabel = tv({
|
|
5652
|
+
base: [
|
|
5653
|
+
"relative flex h-comp-3xl items-start justify-end pr-pad-md",
|
|
5654
|
+
"text-caption-sm tabular-nums text-fg-subtle",
|
|
5655
|
+
"first:opacity-0"
|
|
5656
|
+
]
|
|
5657
|
+
});
|
|
5658
|
+
const schedulerHourLabelText = tv({
|
|
5659
|
+
base: "-translate-y-1/2"
|
|
5660
|
+
});
|
|
5661
|
+
const schedulerTimeColumn = tv({
|
|
5662
|
+
base: "relative min-w-0 flex-1 border-l border-border-subtle",
|
|
5663
|
+
variants: {
|
|
5664
|
+
weekend: { true: "bg-bg-subtle/40 dark:bg-bg-canvas", false: "" }
|
|
5665
|
+
},
|
|
5666
|
+
defaultVariants: { weekend: false }
|
|
5667
|
+
});
|
|
5668
|
+
const schedulerHourSlot = tv({
|
|
5669
|
+
base: [
|
|
5670
|
+
"block h-comp-3xl w-full cursor-pointer",
|
|
5671
|
+
"border-b border-border-subtle bg-transparent p-0 outline-none",
|
|
5672
|
+
"transition-colors duration-150",
|
|
5673
|
+
"hover:bg-bg-table-row-hover",
|
|
5674
|
+
"focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand",
|
|
5675
|
+
"last:border-b-0"
|
|
5676
|
+
]
|
|
5677
|
+
});
|
|
5678
|
+
const schedulerNowLine = tv({
|
|
5679
|
+
base: "pointer-events-none absolute left-0 right-0 z-[2] flex items-center"
|
|
5680
|
+
});
|
|
5681
|
+
const schedulerNowDot = tv({
|
|
5682
|
+
base: "-ml-[4px] size-[8px] shrink-0 rounded-radius-full bg-bg-brand"
|
|
5683
|
+
});
|
|
5684
|
+
const schedulerNowStroke = tv({
|
|
5685
|
+
base: "h-px flex-1 bg-bg-brand"
|
|
5686
|
+
});
|
|
5687
|
+
const schedulerNowLabel = tv({
|
|
5688
|
+
base: [
|
|
5689
|
+
"pointer-events-none absolute right-pad-md z-[2] -translate-y-1/2",
|
|
5690
|
+
"rounded-radius-xs bg-bg-brand px-pad-sm",
|
|
5691
|
+
"text-caption-xs font-semibold tabular-nums text-fg-on-brand"
|
|
5692
|
+
]
|
|
5693
|
+
});
|
|
5694
|
+
const schedulerListFrame = tv({
|
|
5695
|
+
base: [
|
|
5696
|
+
"flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain scrollbar-thin",
|
|
5697
|
+
"rounded-radius-xl border border-border-default bg-bg-surface"
|
|
5698
|
+
]
|
|
5699
|
+
});
|
|
5700
|
+
const schedulerListDay = tv({
|
|
5701
|
+
base: "flex flex-col gap-gp-md border-b border-border-subtle p-sp-xl last:border-b-0"
|
|
5702
|
+
});
|
|
5703
|
+
const schedulerListDayHead = tv({
|
|
5704
|
+
base: [
|
|
5705
|
+
"sticky top-0 z-[1] -mx-sp-xl -mt-sp-xl px-sp-xl pb-pad-md pt-sp-xl",
|
|
5706
|
+
"flex items-baseline gap-gp-md bg-bg-surface"
|
|
5707
|
+
]
|
|
5708
|
+
});
|
|
5709
|
+
const schedulerListDayNumber = tv({
|
|
5710
|
+
base: "text-title-sm font-semibold tabular-nums",
|
|
5711
|
+
variants: {
|
|
5712
|
+
today: { true: "text-fg-brand", false: "text-fg-default" }
|
|
5713
|
+
},
|
|
5714
|
+
defaultVariants: { today: false }
|
|
5715
|
+
});
|
|
5716
|
+
const schedulerListDayName = tv({
|
|
5717
|
+
base: "text-body-sm text-fg-muted first-letter:uppercase"
|
|
5718
|
+
});
|
|
5719
|
+
const schedulerListEvents = tv({
|
|
5720
|
+
base: "flex flex-col gap-gp-sm"
|
|
5721
|
+
});
|
|
5722
|
+
const schedulerEvent = tv({
|
|
5723
|
+
base: [
|
|
5724
|
+
"group/event relative flex min-w-0 cursor-pointer items-center gap-gp-sm",
|
|
5725
|
+
"border text-left outline-none",
|
|
5726
|
+
"transition-[background-color,border-color,box-shadow] duration-150",
|
|
5727
|
+
"focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand"
|
|
5728
|
+
],
|
|
5729
|
+
variants: {
|
|
5730
|
+
color: {
|
|
5731
|
+
brand: "border-border-brand-subtle bg-bg-brand-subtle hover:bg-bg-brand-subtle-hover",
|
|
5732
|
+
info: "border-border-info-muted bg-bg-info-muted hover:bg-bg-info-muted-hover",
|
|
5733
|
+
success: "border-border-success-muted bg-bg-success-muted hover:bg-bg-success-muted-hover",
|
|
5734
|
+
warning: "border-border-warning-muted bg-bg-warning-muted hover:bg-bg-warning-muted-hover",
|
|
5735
|
+
danger: "border-border-danger-muted bg-bg-danger-muted hover:bg-bg-danger-muted-hover",
|
|
5736
|
+
neutral: "border-border-default bg-bg-muted hover:bg-bg-muted-hover"
|
|
5737
|
+
},
|
|
5738
|
+
variant: {
|
|
5739
|
+
/** Mês: linha de 20px, uma só, sem quebra. */
|
|
5740
|
+
pill: "min-h-comp-2xs rounded-radius-sm px-pad-md text-caption-sm",
|
|
5741
|
+
/** Week/day: bloco absoluto que ocupa a duração. */
|
|
5742
|
+
block: "absolute min-h-comp-3xs flex-col items-start gap-0 rounded-radius-md px-pad-md py-pad-sm text-caption-sm",
|
|
5743
|
+
/** List/agenda: linha larga com descrição. */
|
|
5744
|
+
row: "min-h-form-lg w-full rounded-radius-lg px-pad-xl py-pad-md text-body-sm"
|
|
5745
|
+
},
|
|
5746
|
+
/** Continuação de evento multi-dia: perde o canto do lado truncado. */
|
|
5747
|
+
truncateStart: { true: "rounded-l-none border-l-0", false: "" },
|
|
5748
|
+
truncateEnd: { true: "rounded-r-none border-r-0", false: "" },
|
|
5749
|
+
/**
|
|
5750
|
+
* Enquanto arrasta: sombra alta pra o bloco "sair da superfície", z acima
|
|
5751
|
+
* dos vizinhos, e `cursor-grabbing`.
|
|
5752
|
+
*
|
|
5753
|
+
* ⚠️ **Sem `transition` neste estado.** O `transform` do dnd-kit é atualizado
|
|
5754
|
+
* a cada movimento do ponteiro; uma transição em cima dele faz o bloco
|
|
5755
|
+
* perseguir o cursor com atraso — o gesto fica elástico e impreciso. A
|
|
5756
|
+
* transição vive no estado NÃO-arrastando (`movable`), que é onde ela serve:
|
|
5757
|
+
* o assentamento depois do soltar.
|
|
5758
|
+
*/
|
|
5759
|
+
dragging: {
|
|
5760
|
+
true: "z-[3] cursor-grabbing shadow-sh-lg opacity-90 transition-none",
|
|
5761
|
+
false: ""
|
|
5762
|
+
},
|
|
5763
|
+
/** Arrastável e em repouso: mão aberta + transição de assentamento. */
|
|
5764
|
+
movable: {
|
|
5765
|
+
true: "cursor-grab transition-[top,left,height,width,background-color,border-color,box-shadow] duration-200 ease-out",
|
|
5766
|
+
false: ""
|
|
5767
|
+
},
|
|
5768
|
+
disabled: { true: "pointer-events-none opacity-50", false: "" }
|
|
5769
|
+
},
|
|
5770
|
+
defaultVariants: {
|
|
5771
|
+
color: "brand",
|
|
5772
|
+
variant: "pill",
|
|
5773
|
+
truncateStart: false,
|
|
5774
|
+
truncateEnd: false,
|
|
5775
|
+
dragging: false,
|
|
5776
|
+
movable: false,
|
|
5777
|
+
disabled: false
|
|
5778
|
+
}
|
|
5779
|
+
});
|
|
5780
|
+
const schedulerResizeHandle = tv({
|
|
5781
|
+
base: [
|
|
5782
|
+
"absolute inset-x-0 z-[1] h-[6px] cursor-ns-resize",
|
|
5783
|
+
"opacity-0 transition-opacity duration-150",
|
|
5784
|
+
"group-hover/event:opacity-100 focus-visible:opacity-100",
|
|
5785
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring-brand",
|
|
5786
|
+
// A barrinha só aparece no hover; o alvo de 6px existe sempre.
|
|
5787
|
+
"after:absolute after:inset-x-[25%] after:top-[2px] after:h-[2px]",
|
|
5788
|
+
"after:rounded-radius-full after:bg-fg-default/40"
|
|
5789
|
+
],
|
|
5790
|
+
variants: {
|
|
5791
|
+
edge: {
|
|
5792
|
+
start: "-top-[3px]",
|
|
5793
|
+
end: "-bottom-[3px]"
|
|
5794
|
+
}
|
|
5795
|
+
},
|
|
5796
|
+
defaultVariants: { edge: "end" }
|
|
5797
|
+
});
|
|
5798
|
+
const schedulerDropTarget = tv({
|
|
5799
|
+
base: "bg-bg-brand-subtle shadow-[inset_0_0_0_2px_var(--color-border-brand)]"
|
|
5800
|
+
});
|
|
5801
|
+
const schedulerEventDot = tv({
|
|
5802
|
+
base: "shrink-0 rounded-radius-full",
|
|
5803
|
+
variants: {
|
|
5804
|
+
color: {
|
|
5805
|
+
brand: "bg-bg-brand",
|
|
5806
|
+
info: "bg-bg-info",
|
|
5807
|
+
success: "bg-bg-success",
|
|
5808
|
+
warning: "bg-bg-warning",
|
|
5809
|
+
danger: "bg-bg-danger",
|
|
5810
|
+
neutral: "bg-fg-subtle"
|
|
5811
|
+
},
|
|
5812
|
+
size: {
|
|
5813
|
+
sm: "size-icon-2xs",
|
|
5814
|
+
md: "size-icon-xs"
|
|
5815
|
+
}
|
|
5816
|
+
},
|
|
5817
|
+
defaultVariants: { color: "brand", size: "sm" }
|
|
5818
|
+
});
|
|
5819
|
+
const schedulerEventTitle = tv({
|
|
5820
|
+
base: "min-w-0 flex-1 truncate font-medium text-fg-default"
|
|
5821
|
+
});
|
|
5822
|
+
const schedulerEventTime = tv({
|
|
5823
|
+
base: "shrink-0 tabular-nums text-fg-muted"
|
|
5824
|
+
});
|
|
5825
|
+
const schedulerEventDescription = tv({
|
|
5826
|
+
base: "min-w-0 truncate text-caption-sm text-fg-muted"
|
|
5827
|
+
});
|
|
5828
|
+
const schedulerPlaceholder = tv({
|
|
5829
|
+
base: [
|
|
5830
|
+
"flex min-h-[320px] flex-1 flex-col items-center justify-center gap-gp-md",
|
|
5831
|
+
"rounded-radius-xl border border-dashed border-border-input bg-bg-subtle dark:bg-bg-canvas",
|
|
5832
|
+
"p-sp-3xl text-center"
|
|
5833
|
+
]
|
|
5834
|
+
});
|
|
5835
|
+
const VIEW_ITEMS = [
|
|
5836
|
+
{ value: "month", label: "Mês", icon: /* @__PURE__ */ jsx(CalendarDays, {}) },
|
|
5837
|
+
{ value: "week", label: "Semana", icon: /* @__PURE__ */ jsx(Columns3, {}) },
|
|
5838
|
+
{ value: "day", label: "Dia", icon: /* @__PURE__ */ jsx(Square, {}) },
|
|
5839
|
+
{ value: "list", label: "Lista", icon: /* @__PURE__ */ jsx(List, {}) }
|
|
5840
|
+
];
|
|
5841
|
+
function SchedulerToolbar({
|
|
5842
|
+
title: title2,
|
|
5843
|
+
view,
|
|
5844
|
+
onViewChange,
|
|
5845
|
+
onPrev,
|
|
5846
|
+
onNext,
|
|
5847
|
+
onToday,
|
|
5848
|
+
searchable,
|
|
5849
|
+
search,
|
|
5850
|
+
onSearchChange,
|
|
5851
|
+
filterFields,
|
|
5852
|
+
filterModel,
|
|
5853
|
+
onClearField,
|
|
5854
|
+
onClearAll,
|
|
5855
|
+
appliedCount,
|
|
5856
|
+
filterPanelOpen,
|
|
5857
|
+
onToggleFilterPanel,
|
|
5858
|
+
filterPanelAvailable,
|
|
5859
|
+
toolbarActions,
|
|
5860
|
+
primaryAction
|
|
5861
|
+
}) {
|
|
5862
|
+
const hasFilters = (filterFields?.length ?? 0) > 0;
|
|
5863
|
+
const activeView = VIEW_ITEMS.find((v3) => v3.value === view) ?? VIEW_ITEMS[0];
|
|
5864
|
+
const filterEngaged = filterPanelOpen || appliedCount > 0;
|
|
5865
|
+
const appliedFields = (filterFields ?? []).filter(
|
|
5866
|
+
(field) => (filterModel[field.id] ?? []).length > 0
|
|
5867
|
+
);
|
|
5868
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-gp-xl", children: [
|
|
5869
|
+
/* @__PURE__ */ jsxs("div", { className: schedulerToolbar(), children: [
|
|
5870
|
+
/* @__PURE__ */ jsxs("div", { className: schedulerToolbarSide(), children: [
|
|
5871
|
+
/* @__PURE__ */ jsx("span", { className: schedulerTitle(), children: title2 }),
|
|
5872
|
+
/* @__PURE__ */ jsxs("div", { role: "group", "aria-label": "Navegação de período", className: schedulerNavGroup(), children: [
|
|
5873
|
+
/* @__PURE__ */ jsx(
|
|
5874
|
+
Button,
|
|
5875
|
+
{
|
|
5876
|
+
variant: "outline",
|
|
5877
|
+
color: "secondary",
|
|
5878
|
+
size: "icon-sm",
|
|
5879
|
+
onClick: onPrev,
|
|
5880
|
+
"aria-label": "Período anterior",
|
|
5881
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, {})
|
|
5882
|
+
}
|
|
5883
|
+
),
|
|
5884
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", color: "secondary", size: "sm", onClick: onToday, children: "Hoje" }),
|
|
5885
|
+
/* @__PURE__ */ jsx(
|
|
5886
|
+
Button,
|
|
5887
|
+
{
|
|
5888
|
+
variant: "outline",
|
|
5889
|
+
color: "secondary",
|
|
5890
|
+
size: "icon-sm",
|
|
5891
|
+
onClick: onNext,
|
|
5892
|
+
"aria-label": "Próximo período",
|
|
5893
|
+
children: /* @__PURE__ */ jsx(ChevronRight, {})
|
|
5894
|
+
}
|
|
5895
|
+
)
|
|
5896
|
+
] })
|
|
5897
|
+
] }),
|
|
5898
|
+
/* @__PURE__ */ jsxs("div", { className: schedulerToolbarSide(), children: [
|
|
5899
|
+
searchable ? /* @__PURE__ */ jsxs("label", { className: schedulerSearch({ expanded: search !== "" }), children: [
|
|
5900
|
+
/* @__PURE__ */ jsx(Search, { "aria-hidden": "true" }),
|
|
5901
|
+
/* @__PURE__ */ jsx(
|
|
5902
|
+
"input",
|
|
5903
|
+
{
|
|
5904
|
+
type: "search",
|
|
5905
|
+
value: search,
|
|
5906
|
+
onChange: (e3) => onSearchChange(e3.target.value),
|
|
5907
|
+
placeholder: "Buscar evento…",
|
|
5908
|
+
"aria-label": "Buscar evento",
|
|
5909
|
+
className: schedulerSearchInput()
|
|
5910
|
+
}
|
|
5911
|
+
)
|
|
5912
|
+
] }) : null,
|
|
5913
|
+
toolbarActions,
|
|
5914
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
5915
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
5916
|
+
Button,
|
|
5917
|
+
{
|
|
5918
|
+
variant: "outline",
|
|
5919
|
+
color: "secondary",
|
|
5920
|
+
size: "sm",
|
|
5921
|
+
iconLeft: activeView.icon,
|
|
5922
|
+
iconRight: /* @__PURE__ */ jsx(ChevronDown, {}),
|
|
5923
|
+
"aria-label": `Visualização: ${activeView.label}`,
|
|
5924
|
+
className: "shrink-0",
|
|
5925
|
+
children: activeView.label
|
|
5926
|
+
}
|
|
5927
|
+
) }),
|
|
5928
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", className: "min-w-[168px]", children: /* @__PURE__ */ jsx(
|
|
5929
|
+
DropdownMenuRadioGroup,
|
|
5930
|
+
{
|
|
5931
|
+
value: view,
|
|
5932
|
+
onValueChange: (v3) => onViewChange(v3),
|
|
5933
|
+
children: VIEW_ITEMS.map((item) => /* @__PURE__ */ jsx(DropdownMenuRadioItem, { value: item.value, children: /* @__PURE__ */ jsx("span", { className: schedulerViewMenuItem(), children: item.label }) }, item.value))
|
|
5934
|
+
}
|
|
5935
|
+
) })
|
|
5936
|
+
] }),
|
|
5937
|
+
hasFilters ? (
|
|
5938
|
+
/* `relative` no wrapper e não no Button: o ponto é posicionado
|
|
5939
|
+
contra a caixa do botão, e o Button não expõe `position`. */
|
|
5940
|
+
/* @__PURE__ */ jsxs("span", { className: "relative shrink-0", children: [
|
|
5941
|
+
/* @__PURE__ */ jsx(
|
|
5942
|
+
Button,
|
|
5943
|
+
{
|
|
5944
|
+
variant: filterEngaged ? "soft" : "outline",
|
|
5945
|
+
color: filterEngaged ? "primary" : "secondary",
|
|
5946
|
+
size: "sm",
|
|
5947
|
+
iconLeft: /* @__PURE__ */ jsx(ListFilter, {}),
|
|
5948
|
+
onClick: onToggleFilterPanel,
|
|
5949
|
+
disabled: !filterPanelAvailable,
|
|
5950
|
+
"aria-expanded": filterPanelOpen,
|
|
5951
|
+
className: cn(
|
|
5952
|
+
filterEngaged && "border-border-brand hover:border-border-brand"
|
|
5953
|
+
),
|
|
5954
|
+
title: filterPanelAvailable ? void 0 : "O painel de filtros precisa de uma tela mais larga (1024px+)",
|
|
5955
|
+
children: "Filtro"
|
|
5956
|
+
}
|
|
5957
|
+
),
|
|
5958
|
+
appliedCount > 0 ? /* @__PURE__ */ jsx("span", { className: schedulerFilterDot(), "aria-hidden": "true" }) : null
|
|
5959
|
+
] })
|
|
5960
|
+
) : null,
|
|
5961
|
+
primaryAction
|
|
5962
|
+
] })
|
|
5963
|
+
] }),
|
|
5964
|
+
appliedFields.length > 0 ? /* @__PURE__ */ jsxs("div", { className: schedulerFilterRow(), children: [
|
|
5965
|
+
appliedFields.map((field) => {
|
|
5966
|
+
const selected = filterModel[field.id] ?? [];
|
|
5967
|
+
const selectedLabels = field.options.filter((o2) => selected.includes(o2.value)).map((o2) => o2.label);
|
|
5968
|
+
return /* @__PURE__ */ jsxs("span", { className: schedulerFilterChip({ applied: true }), children: [
|
|
5969
|
+
/* @__PURE__ */ jsx("span", { className: schedulerFilterChipName(), children: field.label }),
|
|
5970
|
+
/* @__PURE__ */ jsx("span", { className: schedulerFilterChipValue(), children: selectedLabels.length === 1 ? selectedLabels[0] : `${selectedLabels.length} selecionados` }),
|
|
5971
|
+
/* @__PURE__ */ jsx(
|
|
5972
|
+
"button",
|
|
5973
|
+
{
|
|
5974
|
+
type: "button",
|
|
5975
|
+
"aria-label": `Limpar filtro ${field.label}`,
|
|
5976
|
+
onClick: () => onClearField(field.id),
|
|
5977
|
+
className: "grid size-icon-sm shrink-0 place-items-center rounded-radius-full text-fg-subtle transition-colors duration-150 hover:text-fg-default focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand",
|
|
5978
|
+
children: /* @__PURE__ */ jsx(X3, { "aria-hidden": "true" })
|
|
5979
|
+
}
|
|
5980
|
+
)
|
|
5981
|
+
] }, field.id);
|
|
5982
|
+
}),
|
|
5983
|
+
/* @__PURE__ */ jsx(
|
|
5984
|
+
"button",
|
|
5985
|
+
{
|
|
5986
|
+
type: "button",
|
|
5987
|
+
onClick: onClearAll,
|
|
5988
|
+
className: cn(schedulerClearLink(), "shrink-0"),
|
|
5989
|
+
children: "Limpar tudo"
|
|
5990
|
+
}
|
|
5991
|
+
)
|
|
5992
|
+
] }) : null
|
|
5993
|
+
] });
|
|
5994
|
+
}
|
|
5995
|
+
function buildMonthMatrix(date, weekStartsOn, locale) {
|
|
5996
|
+
const monthStart = startOfMonth(date);
|
|
5997
|
+
const gridStart = startOfWeek(monthStart, { weekStartsOn, locale });
|
|
5998
|
+
const days = [];
|
|
5999
|
+
for (let i4 = 0; i4 < 42; i4++) {
|
|
6000
|
+
days.push(startOfDay(addDays(gridStart, i4)));
|
|
6001
|
+
}
|
|
6002
|
+
const weeks = [];
|
|
6003
|
+
for (let row = 0; row < 6; row++) {
|
|
6004
|
+
weeks.push(days.slice(row * 7, row * 7 + 7));
|
|
6005
|
+
}
|
|
6006
|
+
return weeks;
|
|
6007
|
+
}
|
|
6008
|
+
function segmentMultiDay(events, weekRows) {
|
|
6009
|
+
const segments = [];
|
|
6010
|
+
for (const event of events) {
|
|
6011
|
+
const dayStart = startOfDay(event.start);
|
|
6012
|
+
const dayEnd = startOfDay(event.end);
|
|
6013
|
+
weekRows.forEach((row, weekIndex) => {
|
|
6014
|
+
if (row.length === 0) return;
|
|
6015
|
+
const rowStart = row[0];
|
|
6016
|
+
const rowEnd = row[row.length - 1];
|
|
6017
|
+
if (dayEnd.getTime() < rowStart.getTime() || dayStart.getTime() > rowEnd.getTime()) {
|
|
6018
|
+
return;
|
|
6019
|
+
}
|
|
6020
|
+
const segStart = dayStart.getTime() > rowStart.getTime() ? dayStart : rowStart;
|
|
6021
|
+
const segEnd = dayEnd.getTime() < rowEnd.getTime() ? dayEnd : rowEnd;
|
|
6022
|
+
const colStart = differenceInCalendarDays(segStart, rowStart);
|
|
6023
|
+
const colSpan = differenceInCalendarDays(segEnd, segStart) + 1;
|
|
6024
|
+
segments.push({
|
|
6025
|
+
event,
|
|
6026
|
+
weekIndex,
|
|
6027
|
+
colStart,
|
|
6028
|
+
colSpan,
|
|
6029
|
+
isStart: segStart.getTime() === dayStart.getTime(),
|
|
6030
|
+
isEnd: segEnd.getTime() === dayEnd.getTime()
|
|
6031
|
+
});
|
|
6032
|
+
});
|
|
6033
|
+
}
|
|
6034
|
+
return segments;
|
|
6035
|
+
}
|
|
6036
|
+
function effectiveEndMs(event, snapMinutes) {
|
|
6037
|
+
return event.start.getTime() === event.end.getTime() ? event.end.getTime() + snapMinutes * 6e4 : event.end.getTime();
|
|
6038
|
+
}
|
|
6039
|
+
function packLanes(events, snapMinutes) {
|
|
6040
|
+
if (events.length === 0) return [];
|
|
6041
|
+
const sorted = [...events].sort((a11, b4) => {
|
|
6042
|
+
const startDiff = a11.start.getTime() - b4.start.getTime();
|
|
6043
|
+
if (startDiff !== 0) return startDiff;
|
|
6044
|
+
return effectiveEndMs(b4, snapMinutes) - effectiveEndMs(a11, snapMinutes);
|
|
6045
|
+
});
|
|
6046
|
+
const result = [];
|
|
6047
|
+
let group = [];
|
|
6048
|
+
let groupMaxEnd = -Infinity;
|
|
6049
|
+
const flushGroup = () => {
|
|
6050
|
+
if (group.length === 0) return;
|
|
6051
|
+
const laneEnds = [];
|
|
6052
|
+
const laneOf = /* @__PURE__ */ new Map();
|
|
6053
|
+
for (const ev of group) {
|
|
6054
|
+
const evEnd = effectiveEndMs(ev, snapMinutes);
|
|
6055
|
+
const freeLane = laneEnds.findIndex((end) => end <= ev.start.getTime());
|
|
6056
|
+
if (freeLane === -1) {
|
|
6057
|
+
laneOf.set(ev, laneEnds.length);
|
|
6058
|
+
laneEnds.push(evEnd);
|
|
6059
|
+
} else {
|
|
6060
|
+
laneOf.set(ev, freeLane);
|
|
6061
|
+
laneEnds[freeLane] = evEnd;
|
|
6062
|
+
}
|
|
6063
|
+
}
|
|
6064
|
+
const laneCount = laneEnds.length;
|
|
6065
|
+
for (const ev of group) {
|
|
6066
|
+
result.push({ event: ev, laneIndex: laneOf.get(ev), laneCount });
|
|
6067
|
+
}
|
|
6068
|
+
group = [];
|
|
6069
|
+
groupMaxEnd = -Infinity;
|
|
6070
|
+
};
|
|
6071
|
+
for (const ev of sorted) {
|
|
6072
|
+
const evStart = ev.start.getTime();
|
|
6073
|
+
if (group.length > 0 && evStart >= groupMaxEnd) {
|
|
6074
|
+
flushGroup();
|
|
6075
|
+
}
|
|
6076
|
+
group.push(ev);
|
|
6077
|
+
groupMaxEnd = Math.max(groupMaxEnd, effectiveEndMs(ev, snapMinutes));
|
|
6078
|
+
}
|
|
6079
|
+
flushGroup();
|
|
6080
|
+
return result;
|
|
6081
|
+
}
|
|
6082
|
+
const MONTH_PILL_HEIGHT_PX = 20;
|
|
6083
|
+
const MONTH_PILL_GAP_PX = 2;
|
|
6084
|
+
function computeOverflow(dayEvents, availableHeight) {
|
|
6085
|
+
if (dayEvents.length === 0) {
|
|
6086
|
+
return { visible: [], overflowCount: 0 };
|
|
6087
|
+
}
|
|
6088
|
+
const rawFit = Math.max(
|
|
6089
|
+
0,
|
|
6090
|
+
Math.floor(
|
|
6091
|
+
(availableHeight + MONTH_PILL_GAP_PX) / (MONTH_PILL_HEIGHT_PX + MONTH_PILL_GAP_PX)
|
|
6092
|
+
)
|
|
6093
|
+
);
|
|
6094
|
+
if (rawFit >= dayEvents.length) {
|
|
6095
|
+
return { visible: dayEvents, overflowCount: 0 };
|
|
6096
|
+
}
|
|
6097
|
+
const visibleCount = Math.max(0, rawFit - 1);
|
|
6098
|
+
return {
|
|
6099
|
+
visible: dayEvents.slice(0, visibleCount),
|
|
6100
|
+
overflowCount: dayEvents.length - visibleCount
|
|
6101
|
+
};
|
|
6102
|
+
}
|
|
6103
|
+
function snapToGrid(date, snapMinutes, dayRange) {
|
|
6104
|
+
const dayStart = startOfDay(date);
|
|
6105
|
+
const minutesSinceMidnight = (date.getTime() - dayStart.getTime()) / 6e4;
|
|
6106
|
+
const snappedMinutes = Math.round(minutesSinceMidnight / snapMinutes) * snapMinutes;
|
|
6107
|
+
const [rangeStartHour, rangeEndHour] = dayRange;
|
|
6108
|
+
const rangeStartMin = rangeStartHour * 60;
|
|
6109
|
+
const rangeEndMin = Math.min(rangeEndHour * 60, 24 * 60);
|
|
6110
|
+
const clampedMinutes = Math.min(
|
|
6111
|
+
Math.max(snappedMinutes, rangeStartMin),
|
|
6112
|
+
rangeEndMin
|
|
6113
|
+
);
|
|
6114
|
+
const snapped = addMinutes(dayStart, clampedMinutes);
|
|
6115
|
+
const dayEnd = endOfDay(date);
|
|
6116
|
+
return snapped.getTime() > dayEnd.getTime() ? dayEnd : snapped;
|
|
6117
|
+
}
|
|
6118
|
+
function resolveResize(event, edge, deltaMin, snapMinutes) {
|
|
6119
|
+
const snappedDelta = Math.round(deltaMin / snapMinutes) * snapMinutes;
|
|
6120
|
+
if (edge === "start") {
|
|
6121
|
+
const proposedStart = addMinutes(event.start, snappedDelta);
|
|
6122
|
+
const maxStart = addMinutes(event.end, -snapMinutes);
|
|
6123
|
+
const start = proposedStart.getTime() > maxStart.getTime() ? maxStart : proposedStart;
|
|
6124
|
+
return { start, end: event.end };
|
|
6125
|
+
}
|
|
6126
|
+
const proposedEnd = addMinutes(event.end, snappedDelta);
|
|
6127
|
+
const minEnd = addMinutes(event.start, snapMinutes);
|
|
6128
|
+
const end = proposedEnd.getTime() < minEnd.getTime() ? minEnd : proposedEnd;
|
|
6129
|
+
return { start: event.start, end };
|
|
6130
|
+
}
|
|
6131
|
+
function pixelsToMinutes(px, hourHeight) {
|
|
6132
|
+
return px / hourHeight * 60;
|
|
6133
|
+
}
|
|
6134
|
+
function resolveMonthDrop(event, targetDay) {
|
|
6135
|
+
const diasDeslocados = differenceInCalendarDays(
|
|
6136
|
+
startOfDay(targetDay),
|
|
6137
|
+
startOfDay(event.start)
|
|
6138
|
+
);
|
|
6139
|
+
if (diasDeslocados === 0) {
|
|
6140
|
+
return { start: event.start, end: event.end };
|
|
6141
|
+
}
|
|
6142
|
+
return {
|
|
6143
|
+
start: addDays(event.start, diasDeslocados),
|
|
6144
|
+
end: addDays(event.end, diasDeslocados)
|
|
6145
|
+
};
|
|
6146
|
+
}
|
|
6147
|
+
function resolveTimeGridMove(event, dayDelta, minuteDelta, snapMinutes, dayRange) {
|
|
6148
|
+
const duracaoMs = event.end.getTime() - event.start.getTime();
|
|
6149
|
+
const bruto = addMinutes(addDays(event.start, dayDelta), minuteDelta);
|
|
6150
|
+
const start = snapToGrid(bruto, snapMinutes, dayRange);
|
|
6151
|
+
return { start, end: new Date(start.getTime() + duracaoMs) };
|
|
6152
|
+
}
|
|
6153
|
+
function minutesToOffset(date, dayRange, hourHeight) {
|
|
6154
|
+
const gridStart = addHours(startOfDay(date), dayRange[0]);
|
|
6155
|
+
const elapsedMinutes = (date.getTime() - gridStart.getTime()) / 6e4;
|
|
6156
|
+
return elapsedMinutes / 60 * hourHeight;
|
|
6157
|
+
}
|
|
6158
|
+
function MiniMonth({
|
|
6159
|
+
selected,
|
|
6160
|
+
now,
|
|
6161
|
+
locale,
|
|
6162
|
+
weekStartsOn,
|
|
6163
|
+
events,
|
|
6164
|
+
onSelect
|
|
6165
|
+
}) {
|
|
6166
|
+
const [offset, setOffset] = useState(0);
|
|
6167
|
+
const cursor = useMemo(
|
|
6168
|
+
() => addMonths(startOfDay(selected), offset),
|
|
6169
|
+
[selected, offset]
|
|
6170
|
+
);
|
|
6171
|
+
const weeks = useMemo(
|
|
6172
|
+
() => buildMonthMatrix(cursor, weekStartsOn, locale),
|
|
6173
|
+
[cursor, weekStartsOn, locale]
|
|
6174
|
+
);
|
|
6175
|
+
const daysWithEvents = useMemo(() => {
|
|
6176
|
+
const set = /* @__PURE__ */ new Set();
|
|
6177
|
+
for (const ev of events) {
|
|
6178
|
+
let cur = startOfDay(ev.start);
|
|
6179
|
+
const last = startOfDay(ev.end);
|
|
6180
|
+
let guard = 0;
|
|
6181
|
+
while (cur.getTime() <= last.getTime() && guard < 400) {
|
|
6182
|
+
set.add(cur.getTime());
|
|
6183
|
+
cur = new Date(cur.getFullYear(), cur.getMonth(), cur.getDate() + 1);
|
|
6184
|
+
guard++;
|
|
6185
|
+
}
|
|
6186
|
+
}
|
|
6187
|
+
return set;
|
|
6188
|
+
}, [events]);
|
|
6189
|
+
const weekdayLabels = useMemo(
|
|
6190
|
+
() => weeks[0].map((day) => format(day, "EEEEE", { locale })),
|
|
6191
|
+
[weeks, locale]
|
|
6192
|
+
);
|
|
6193
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-gp-md", children: [
|
|
6194
|
+
/* @__PURE__ */ jsxs("div", { className: schedulerMiniHead(), children: [
|
|
6195
|
+
/* @__PURE__ */ jsx("span", { className: schedulerMiniTitle(), children: format(cursor, "MMMM yyyy", { locale }) }),
|
|
6196
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center", children: [
|
|
6197
|
+
/* @__PURE__ */ jsx(
|
|
6198
|
+
Button,
|
|
6199
|
+
{
|
|
6200
|
+
variant: "ghost",
|
|
6201
|
+
color: "secondary",
|
|
6202
|
+
size: "icon-2xs",
|
|
6203
|
+
"aria-label": "Mês anterior",
|
|
6204
|
+
onClick: () => setOffset((o2) => o2 - 1),
|
|
6205
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, {})
|
|
6206
|
+
}
|
|
6207
|
+
),
|
|
6208
|
+
/* @__PURE__ */ jsx(
|
|
6209
|
+
Button,
|
|
6210
|
+
{
|
|
6211
|
+
variant: "ghost",
|
|
6212
|
+
color: "secondary",
|
|
6213
|
+
size: "icon-2xs",
|
|
6214
|
+
"aria-label": "Próximo mês",
|
|
6215
|
+
onClick: () => setOffset((o2) => o2 + 1),
|
|
6216
|
+
children: /* @__PURE__ */ jsx(ChevronRight, {})
|
|
6217
|
+
}
|
|
6218
|
+
)
|
|
6219
|
+
] })
|
|
6220
|
+
] }),
|
|
6221
|
+
/* @__PURE__ */ jsxs("div", { className: schedulerMiniGrid(), children: [
|
|
6222
|
+
weekdayLabels.map((label, i4) => /* @__PURE__ */ jsx("span", { className: schedulerMiniWeekday(), children: label }, `${label}-${i4}`)),
|
|
6223
|
+
weeks.flat().map((day) => /* @__PURE__ */ jsx(
|
|
6224
|
+
"button",
|
|
6225
|
+
{
|
|
6226
|
+
type: "button",
|
|
6227
|
+
onClick: () => {
|
|
6228
|
+
onSelect(day);
|
|
6229
|
+
setOffset(0);
|
|
6230
|
+
},
|
|
6231
|
+
"aria-label": format(day, "PPPP", { locale }),
|
|
6232
|
+
"aria-current": isSameDay(day, selected) ? "date" : void 0,
|
|
6233
|
+
className: schedulerMiniDay({
|
|
6234
|
+
outside: !isSameMonth(day, cursor),
|
|
6235
|
+
hasEvents: daysWithEvents.has(day.getTime()),
|
|
6236
|
+
today: isSameDay(day, now),
|
|
6237
|
+
selected: isSameDay(day, selected)
|
|
6238
|
+
}),
|
|
6239
|
+
children: format(day, "d", { locale })
|
|
6240
|
+
},
|
|
6241
|
+
day.getTime()
|
|
6242
|
+
))
|
|
6243
|
+
] })
|
|
6244
|
+
] });
|
|
6245
|
+
}
|
|
6246
|
+
function SchedulerFilterPanel({
|
|
6247
|
+
filterFields,
|
|
6248
|
+
filterModel,
|
|
6249
|
+
onToggleValue,
|
|
6250
|
+
onClearAll,
|
|
6251
|
+
appliedCount,
|
|
6252
|
+
onClose,
|
|
6253
|
+
counts,
|
|
6254
|
+
date,
|
|
6255
|
+
now,
|
|
6256
|
+
locale,
|
|
6257
|
+
weekStartsOn,
|
|
6258
|
+
events,
|
|
6259
|
+
onDateSelect
|
|
6260
|
+
}) {
|
|
6261
|
+
const [collapsed, setCollapsed] = useState(() => /* @__PURE__ */ new Set());
|
|
6262
|
+
const toggleGroup = (id) => setCollapsed((prev) => {
|
|
6263
|
+
const next = new Set(prev);
|
|
6264
|
+
if (next.has(id)) next.delete(id);
|
|
6265
|
+
else next.add(id);
|
|
6266
|
+
return next;
|
|
6267
|
+
});
|
|
6268
|
+
return /* @__PURE__ */ jsxs("aside", { className: schedulerFilterAside(), "aria-label": "Filtros do calendário", children: [
|
|
6269
|
+
/* @__PURE__ */ jsx("div", { className: schedulerAsideSection({ compact: true, sticky: true }), children: /* @__PURE__ */ jsxs("div", { className: schedulerAsideHead(), children: [
|
|
6270
|
+
/* @__PURE__ */ jsx("span", { className: schedulerAsideTitle(), children: "Filtros" }),
|
|
6271
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-gp-sm", children: [
|
|
6272
|
+
appliedCount > 0 ? /* @__PURE__ */ jsx("button", { type: "button", onClick: onClearAll, className: schedulerClearLink(), children: "Limpar" }) : null,
|
|
6273
|
+
/* @__PURE__ */ jsx(
|
|
6274
|
+
Button,
|
|
6275
|
+
{
|
|
6276
|
+
variant: "ghost",
|
|
6277
|
+
color: "secondary",
|
|
6278
|
+
size: "icon-2xs",
|
|
6279
|
+
"aria-label": "Fechar painel de filtros",
|
|
6280
|
+
onClick: onClose,
|
|
6281
|
+
children: /* @__PURE__ */ jsx(X3, {})
|
|
6282
|
+
}
|
|
6283
|
+
)
|
|
6284
|
+
] })
|
|
6285
|
+
] }) }),
|
|
6286
|
+
/* @__PURE__ */ jsx("div", { className: schedulerAsideSection(), children: /* @__PURE__ */ jsx(
|
|
6287
|
+
MiniMonth,
|
|
6288
|
+
{
|
|
6289
|
+
selected: date,
|
|
6290
|
+
now,
|
|
6291
|
+
locale,
|
|
6292
|
+
weekStartsOn,
|
|
6293
|
+
events,
|
|
6294
|
+
onSelect: onDateSelect
|
|
6295
|
+
}
|
|
6296
|
+
) }),
|
|
6297
|
+
filterFields.map((field) => {
|
|
6298
|
+
const selected = filterModel[field.id] ?? [];
|
|
6299
|
+
const isOpen = !collapsed.has(field.id);
|
|
6300
|
+
const fieldCounts = counts[field.id] ?? {};
|
|
6301
|
+
return /* @__PURE__ */ jsxs(
|
|
6302
|
+
"div",
|
|
6303
|
+
{
|
|
6304
|
+
className: cn(schedulerAsideSection(), schedulerGroup()),
|
|
6305
|
+
children: [
|
|
6306
|
+
/* @__PURE__ */ jsxs(
|
|
6307
|
+
"button",
|
|
6308
|
+
{
|
|
6309
|
+
type: "button",
|
|
6310
|
+
"aria-expanded": isOpen,
|
|
6311
|
+
onClick: () => toggleGroup(field.id),
|
|
6312
|
+
className: schedulerGroupHead(),
|
|
6313
|
+
children: [
|
|
6314
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-baseline gap-gp-sm", children: [
|
|
6315
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: field.label }),
|
|
6316
|
+
/* @__PURE__ */ jsx("span", { className: schedulerOptionCount(), children: selected.length === 0 ? "Todas" : selected.length })
|
|
6317
|
+
] }),
|
|
6318
|
+
/* @__PURE__ */ jsx(
|
|
6319
|
+
ChevronDown,
|
|
6320
|
+
{
|
|
6321
|
+
className: schedulerGroupChevron({ open: isOpen }),
|
|
6322
|
+
"aria-hidden": "true"
|
|
6323
|
+
}
|
|
6324
|
+
)
|
|
6325
|
+
]
|
|
6326
|
+
}
|
|
6327
|
+
),
|
|
6328
|
+
isOpen ? /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: field.options.map((option) => {
|
|
6329
|
+
const id = `scheduler-filter-${field.id}-${option.value}`;
|
|
6330
|
+
const isOn = selected.includes(option.value);
|
|
6331
|
+
const count = fieldCounts[option.value];
|
|
6332
|
+
return /* @__PURE__ */ jsxs("label", { htmlFor: id, className: schedulerOption(), children: [
|
|
6333
|
+
/* @__PURE__ */ jsx(
|
|
6334
|
+
Checkbox,
|
|
6335
|
+
{
|
|
6336
|
+
id,
|
|
6337
|
+
checked: isOn,
|
|
6338
|
+
onCheckedChange: () => onToggleValue(field.id, option.value),
|
|
6339
|
+
className: schedulerOptionBox({
|
|
6340
|
+
color: option.color ?? "brand"
|
|
6341
|
+
})
|
|
6342
|
+
}
|
|
6343
|
+
),
|
|
6344
|
+
/* @__PURE__ */ jsx("span", { className: schedulerOptionLabel(), children: option.label }),
|
|
6345
|
+
count !== void 0 ? /* @__PURE__ */ jsx("span", { className: schedulerOptionCount(), children: count }) : null
|
|
6346
|
+
] }, option.value);
|
|
6347
|
+
}) }) : null
|
|
6348
|
+
]
|
|
6349
|
+
},
|
|
6350
|
+
field.id
|
|
6351
|
+
);
|
|
6352
|
+
})
|
|
6353
|
+
] });
|
|
6354
|
+
}
|
|
6355
|
+
const SchedulerEventItem = forwardRef(function SchedulerEventItem2({
|
|
6356
|
+
event,
|
|
6357
|
+
view,
|
|
6358
|
+
variant,
|
|
6359
|
+
truncateStart = false,
|
|
6360
|
+
truncateEnd = false,
|
|
6361
|
+
dragging = false,
|
|
6362
|
+
disabled = false,
|
|
6363
|
+
timeLabel,
|
|
6364
|
+
style,
|
|
6365
|
+
renderContent,
|
|
6366
|
+
onClick,
|
|
6367
|
+
className,
|
|
6368
|
+
dragAttributes,
|
|
6369
|
+
dragListeners,
|
|
6370
|
+
setDragNodeRef,
|
|
6371
|
+
dragTransform,
|
|
6372
|
+
movable = false,
|
|
6373
|
+
resizeHandles
|
|
6374
|
+
}, ref) {
|
|
6375
|
+
const color = event.color ?? "brand";
|
|
6376
|
+
const mergeRefs = (el) => {
|
|
6377
|
+
setDragNodeRef?.(el);
|
|
6378
|
+
if (typeof ref === "function") ref(el);
|
|
6379
|
+
else if (ref) {
|
|
6380
|
+
ref.current = el;
|
|
6381
|
+
}
|
|
6382
|
+
};
|
|
6383
|
+
const estilo = {
|
|
6384
|
+
...style,
|
|
6385
|
+
...dragTransform ? { transform: `translate3d(${dragTransform.x}px, ${dragTransform.y}px, 0)` } : null
|
|
6386
|
+
};
|
|
6387
|
+
const ariaLabel = [
|
|
6388
|
+
typeof event.title === "string" ? event.title : event.searchText,
|
|
6389
|
+
timeLabel
|
|
6390
|
+
].filter(Boolean).join(", ");
|
|
6391
|
+
return /* @__PURE__ */ jsxs(
|
|
6392
|
+
"button",
|
|
6393
|
+
{
|
|
6394
|
+
ref: mergeRefs,
|
|
6395
|
+
type: "button",
|
|
6396
|
+
disabled,
|
|
6397
|
+
style: estilo,
|
|
6398
|
+
"aria-label": ariaLabel || void 0,
|
|
6399
|
+
onClick: (evt) => onClick?.(evt),
|
|
6400
|
+
...dragAttributes,
|
|
6401
|
+
...dragListeners,
|
|
6402
|
+
className: cn(
|
|
6403
|
+
schedulerEvent({
|
|
6404
|
+
color,
|
|
6405
|
+
variant,
|
|
6406
|
+
truncateStart,
|
|
6407
|
+
truncateEnd,
|
|
6408
|
+
dragging,
|
|
6409
|
+
// `movable` só pinta em REPOUSO: durante o arraste o `dragging` manda,
|
|
6410
|
+
// e ele desliga a transição de propósito (ver nota no styles).
|
|
6411
|
+
movable: movable && !dragging,
|
|
6412
|
+
disabled
|
|
6413
|
+
}),
|
|
6414
|
+
className
|
|
6415
|
+
),
|
|
6416
|
+
children: [
|
|
6417
|
+
renderContent ? renderContent() : variant === "row" ? (
|
|
6418
|
+
/* `row` é a única forma com espaço pra 2 linhas — a descrição só
|
|
6419
|
+
aparece aqui. No pill de 20px ela não caberia, e no block ela
|
|
6420
|
+
competiria com o título quando a duração é curta. */
|
|
6421
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6422
|
+
/* @__PURE__ */ jsx(
|
|
6423
|
+
"span",
|
|
6424
|
+
{
|
|
6425
|
+
className: schedulerEventDot({ color, size: "md" }),
|
|
6426
|
+
"aria-hidden": "true"
|
|
6427
|
+
}
|
|
6428
|
+
),
|
|
6429
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
6430
|
+
/* @__PURE__ */ jsx("span", { className: schedulerEventTitle(), children: event.title }),
|
|
6431
|
+
event.description ? /* @__PURE__ */ jsx("span", { className: schedulerEventDescription(), children: event.description }) : null
|
|
6432
|
+
] }),
|
|
6433
|
+
timeLabel ? /* @__PURE__ */ jsx("span", { className: schedulerEventTime(), children: timeLabel }) : null
|
|
6434
|
+
] })
|
|
6435
|
+
) : variant === "block" ? (
|
|
6436
|
+
/* No block o horário vem ANTES do título e em linha própria: o bloco
|
|
6437
|
+
tem altura proporcional à duração, e num evento longo o título
|
|
6438
|
+
sozinho no topo deixaria o horário fora do campo de leitura. */
|
|
6439
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6440
|
+
timeLabel ? /* @__PURE__ */ jsx("span", { className: cn(schedulerEventTime(), "text-caption-xs"), children: timeLabel }) : null,
|
|
6441
|
+
/* @__PURE__ */ jsx("span", { className: cn(schedulerEventTitle(), "w-full"), children: event.title })
|
|
6442
|
+
] })
|
|
6443
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6444
|
+
!truncateStart ? /* @__PURE__ */ jsx(
|
|
6445
|
+
"span",
|
|
6446
|
+
{
|
|
6447
|
+
className: schedulerEventDot({ color, size: "sm" }),
|
|
6448
|
+
"aria-hidden": "true"
|
|
6449
|
+
}
|
|
6450
|
+
) : null,
|
|
6451
|
+
/* @__PURE__ */ jsx("span", { className: schedulerEventTitle(), children: event.title }),
|
|
6452
|
+
timeLabel && view === "month" ? /* @__PURE__ */ jsx("span", { className: schedulerEventTime(), children: timeLabel }) : null
|
|
6453
|
+
] }),
|
|
6454
|
+
resizeHandles
|
|
6455
|
+
]
|
|
6456
|
+
}
|
|
6457
|
+
);
|
|
6458
|
+
});
|
|
6459
|
+
const MOVE_PREFIX = "move:";
|
|
6460
|
+
const RESIZE_PREFIX = "resize:";
|
|
6461
|
+
const DAY_PREFIX = "day:";
|
|
6462
|
+
const draggableIdForMove = (eventId) => `${MOVE_PREFIX}${eventId}`;
|
|
6463
|
+
const draggableIdForResize = (eventId, edge) => `${RESIZE_PREFIX}${eventId}:${edge}`;
|
|
6464
|
+
const droppableIdForDay = (day) => `${DAY_PREFIX}${startOfDay(day).getTime()}`;
|
|
6465
|
+
function parseDayDroppable(overId) {
|
|
6466
|
+
if (!overId || !overId.startsWith(DAY_PREFIX)) return null;
|
|
6467
|
+
const ms = Number(overId.slice(DAY_PREFIX.length));
|
|
6468
|
+
return Number.isFinite(ms) ? new Date(ms) : null;
|
|
6469
|
+
}
|
|
6470
|
+
function parseDraggable(activeId) {
|
|
6471
|
+
if (activeId.startsWith(MOVE_PREFIX)) {
|
|
6472
|
+
return { kind: "move", eventId: activeId.slice(MOVE_PREFIX.length) };
|
|
6473
|
+
}
|
|
6474
|
+
if (activeId.startsWith(RESIZE_PREFIX)) {
|
|
6475
|
+
const resto = activeId.slice(RESIZE_PREFIX.length);
|
|
6476
|
+
const corte = resto.lastIndexOf(":");
|
|
6477
|
+
if (corte < 0) return null;
|
|
6478
|
+
const edge = resto.slice(corte + 1);
|
|
6479
|
+
if (edge !== "start" && edge !== "end") return null;
|
|
6480
|
+
return { kind: "resize", eventId: resto.slice(0, corte), edge };
|
|
6481
|
+
}
|
|
6482
|
+
return null;
|
|
6483
|
+
}
|
|
6484
|
+
function useSchedulerDnd({
|
|
6485
|
+
enabled,
|
|
6486
|
+
view,
|
|
6487
|
+
events,
|
|
6488
|
+
snapMinutes,
|
|
6489
|
+
dayRange,
|
|
6490
|
+
hourHeight,
|
|
6491
|
+
draggable,
|
|
6492
|
+
resizable,
|
|
6493
|
+
onEventMove,
|
|
6494
|
+
onEventResize
|
|
6495
|
+
}) {
|
|
6496
|
+
const [ativo, setAtivo] = useState(null);
|
|
6497
|
+
const [diaSobreposto, setDiaSobreposto] = useState(null);
|
|
6498
|
+
const sensors = useSensors(
|
|
6499
|
+
useSensor(PointerSensor, { activationConstraint: { distance: 6 } })
|
|
6500
|
+
);
|
|
6501
|
+
const porId = useMemo(() => {
|
|
6502
|
+
const m2 = /* @__PURE__ */ new Map();
|
|
6503
|
+
for (const e3 of events) m2.set(e3.id, e3);
|
|
6504
|
+
return m2;
|
|
6505
|
+
}, [events]);
|
|
6506
|
+
const podeMover = useCallback(
|
|
6507
|
+
(e3) => enabled && (e3.draggable ?? draggable),
|
|
6508
|
+
[enabled, draggable]
|
|
6509
|
+
);
|
|
6510
|
+
const podeRedimensionar = useCallback(
|
|
6511
|
+
(e3) => (
|
|
6512
|
+
// Resize só existe onde há eixo de tempo. No mês a altura da pílula não
|
|
6513
|
+
// representa duração, então arrastar a borda não teria o que significar.
|
|
6514
|
+
enabled && view !== "month" && view !== "list" && (e3.resizable ?? resizable) && !e3.allDay
|
|
6515
|
+
),
|
|
6516
|
+
[enabled, view, resizable]
|
|
6517
|
+
);
|
|
6518
|
+
const handleDragStart = useCallback((evt) => {
|
|
6519
|
+
const parsed = parseDraggable(String(evt.active.id));
|
|
6520
|
+
if (parsed) setAtivo(parsed);
|
|
6521
|
+
}, []);
|
|
6522
|
+
const handleDragOver = useCallback((evt) => {
|
|
6523
|
+
const dia = parseDayDroppable(evt.over ? String(evt.over.id) : null);
|
|
6524
|
+
setDiaSobreposto(dia ? dia.getTime() : null);
|
|
6525
|
+
}, []);
|
|
6526
|
+
const handleDragCancel = useCallback(() => {
|
|
6527
|
+
setAtivo(null);
|
|
6528
|
+
setDiaSobreposto(null);
|
|
6529
|
+
}, []);
|
|
6530
|
+
const handleDragEnd = useCallback(
|
|
6531
|
+
(evt) => {
|
|
6532
|
+
setAtivo(null);
|
|
6533
|
+
setDiaSobreposto(null);
|
|
6534
|
+
const atual = parseDraggable(String(evt.active.id));
|
|
6535
|
+
if (!atual) return;
|
|
6536
|
+
if (!enabled) return;
|
|
6537
|
+
const evento = porId.get(atual.eventId);
|
|
6538
|
+
if (!evento) return;
|
|
6539
|
+
if (atual.kind === "resize") {
|
|
6540
|
+
if (!podeRedimensionar(evento)) return;
|
|
6541
|
+
const minutos = pixelsToMinutes(evt.delta.y, hourHeight);
|
|
6542
|
+
if (Math.abs(minutos) < 1) return;
|
|
6543
|
+
const r2 = resolveResize(evento, atual.edge, minutos, snapMinutes);
|
|
6544
|
+
if (r2.start.getTime() === evento.start.getTime() && r2.end.getTime() === evento.end.getTime()) {
|
|
6545
|
+
return;
|
|
6546
|
+
}
|
|
6547
|
+
onEventResize?.({ id: evento.id, start: r2.start, end: r2.end });
|
|
6548
|
+
return;
|
|
6549
|
+
}
|
|
6550
|
+
if (!podeMover(evento)) return;
|
|
6551
|
+
const diaAlvo = parseDayDroppable(evt.over ? String(evt.over.id) : null);
|
|
6552
|
+
if (view === "month") {
|
|
6553
|
+
if (!diaAlvo) return;
|
|
6554
|
+
const r2 = resolveMonthDrop(evento, diaAlvo);
|
|
6555
|
+
if (r2.start.getTime() === evento.start.getTime()) return;
|
|
6556
|
+
onEventMove?.({ id: evento.id, start: r2.start, end: r2.end });
|
|
6557
|
+
return;
|
|
6558
|
+
}
|
|
6559
|
+
if (view === "week" || view === "day") {
|
|
6560
|
+
const deslocamentoDeDias = diaAlvo ? differenceInCalendarDays(diaAlvo, startOfDay(evento.start)) : 0;
|
|
6561
|
+
const minutos = evento.allDay ? 0 : pixelsToMinutes(evt.delta.y, hourHeight);
|
|
6562
|
+
if (deslocamentoDeDias === 0 && Math.abs(minutos) < 1) return;
|
|
6563
|
+
const r2 = resolveTimeGridMove(
|
|
6564
|
+
evento,
|
|
6565
|
+
deslocamentoDeDias,
|
|
6566
|
+
minutos,
|
|
6567
|
+
snapMinutes,
|
|
6568
|
+
dayRange
|
|
6569
|
+
);
|
|
6570
|
+
if (r2.start.getTime() === evento.start.getTime() && r2.end.getTime() === evento.end.getTime()) {
|
|
6571
|
+
return;
|
|
6572
|
+
}
|
|
6573
|
+
onEventMove?.({ id: evento.id, start: r2.start, end: r2.end });
|
|
6574
|
+
}
|
|
6575
|
+
},
|
|
6576
|
+
[
|
|
6577
|
+
enabled,
|
|
6578
|
+
porId,
|
|
6579
|
+
view,
|
|
6580
|
+
hourHeight,
|
|
6581
|
+
snapMinutes,
|
|
6582
|
+
dayRange,
|
|
6583
|
+
podeMover,
|
|
6584
|
+
podeRedimensionar,
|
|
6585
|
+
onEventMove,
|
|
6586
|
+
onEventResize
|
|
6587
|
+
]
|
|
6588
|
+
);
|
|
6589
|
+
return {
|
|
6590
|
+
sensors,
|
|
6591
|
+
/** `move:<id>` ou `resize:<id>:<edge>` em andamento, pra pintar o estado. */
|
|
6592
|
+
dragAtivo: ativo,
|
|
6593
|
+
/** `getTime()` do dia sob o cursor — a célula/coluna se pinta com isso. */
|
|
6594
|
+
diaSobreposto,
|
|
6595
|
+
podeMover,
|
|
6596
|
+
podeRedimensionar,
|
|
6597
|
+
handleDragStart,
|
|
6598
|
+
handleDragOver,
|
|
6599
|
+
handleDragEnd,
|
|
6600
|
+
handleDragCancel
|
|
6601
|
+
};
|
|
6602
|
+
}
|
|
6603
|
+
function ResizeHandle({
|
|
6604
|
+
eventId,
|
|
6605
|
+
edge,
|
|
6606
|
+
label
|
|
6607
|
+
}) {
|
|
6608
|
+
const { attributes, listeners, setNodeRef } = useDraggable({
|
|
6609
|
+
id: draggableIdForResize(eventId, edge)
|
|
6610
|
+
});
|
|
6611
|
+
return (
|
|
6612
|
+
/* `<span role="button">` e não `<button>`: a alça vive DENTRO do botão do
|
|
6613
|
+
evento, e botão dentro de botão é HTML inválido — o navegador quebra a
|
|
6614
|
+
árvore e o clique do evento para de funcionar. */
|
|
6615
|
+
/* @__PURE__ */ jsx(
|
|
6616
|
+
"span",
|
|
6617
|
+
{
|
|
6618
|
+
ref: setNodeRef,
|
|
6619
|
+
...attributes,
|
|
6620
|
+
...listeners,
|
|
6621
|
+
role: "button",
|
|
6622
|
+
tabIndex: -1,
|
|
6623
|
+
"aria-label": label,
|
|
6624
|
+
className: schedulerResizeHandle({ edge }),
|
|
6625
|
+
onClick: (e3) => e3.stopPropagation(),
|
|
6626
|
+
onPointerDown: (e3) => {
|
|
6627
|
+
e3.stopPropagation();
|
|
6628
|
+
listeners?.onPointerDown?.(e3);
|
|
6629
|
+
}
|
|
6630
|
+
}
|
|
6631
|
+
)
|
|
6632
|
+
);
|
|
6633
|
+
}
|
|
6634
|
+
function DraggableEvent({
|
|
6635
|
+
movable = false,
|
|
6636
|
+
resizable = false,
|
|
6637
|
+
...rest
|
|
6638
|
+
}) {
|
|
6639
|
+
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
|
|
6640
|
+
id: draggableIdForMove(rest.event.id),
|
|
6641
|
+
disabled: !movable
|
|
6642
|
+
});
|
|
6643
|
+
return /* @__PURE__ */ jsx(
|
|
6644
|
+
SchedulerEventItem,
|
|
6645
|
+
{
|
|
6646
|
+
...rest,
|
|
6647
|
+
movable,
|
|
6648
|
+
dragging: isDragging,
|
|
6649
|
+
setDragNodeRef: setNodeRef,
|
|
6650
|
+
dragTransform: null,
|
|
6651
|
+
dragAttributes: movable ? { ...attributes } : void 0,
|
|
6652
|
+
dragListeners: movable ? { ...listeners } : void 0,
|
|
6653
|
+
resizeHandles: resizable && !isDragging ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6654
|
+
/* @__PURE__ */ jsx(
|
|
6655
|
+
ResizeHandle,
|
|
6656
|
+
{
|
|
6657
|
+
eventId: rest.event.id,
|
|
6658
|
+
edge: "start",
|
|
6659
|
+
label: "Ajustar início"
|
|
6660
|
+
}
|
|
6661
|
+
),
|
|
6662
|
+
/* @__PURE__ */ jsx(
|
|
6663
|
+
ResizeHandle,
|
|
6664
|
+
{
|
|
6665
|
+
eventId: rest.event.id,
|
|
6666
|
+
edge: "end",
|
|
6667
|
+
label: "Ajustar fim"
|
|
6668
|
+
}
|
|
6669
|
+
)
|
|
6670
|
+
] }) : null
|
|
6671
|
+
}
|
|
6672
|
+
);
|
|
6673
|
+
}
|
|
6674
|
+
function DroppableDay({
|
|
6675
|
+
day,
|
|
6676
|
+
disabled,
|
|
6677
|
+
className,
|
|
6678
|
+
overClassName,
|
|
6679
|
+
children,
|
|
6680
|
+
cellRef,
|
|
6681
|
+
...rest
|
|
6682
|
+
}) {
|
|
6683
|
+
const { setNodeRef, isOver } = useDroppable({
|
|
6684
|
+
id: droppableIdForDay(day),
|
|
6685
|
+
disabled
|
|
6686
|
+
});
|
|
6687
|
+
return /* @__PURE__ */ jsx(
|
|
6688
|
+
"div",
|
|
6689
|
+
{
|
|
6690
|
+
ref: (el) => {
|
|
6691
|
+
setNodeRef(el);
|
|
6692
|
+
cellRef?.(el);
|
|
6693
|
+
},
|
|
6694
|
+
className: cn(className, isOver && !disabled && overClassName),
|
|
6695
|
+
...rest,
|
|
6696
|
+
children
|
|
6697
|
+
}
|
|
6698
|
+
);
|
|
6699
|
+
}
|
|
6700
|
+
function useSchedulerKeyboard({
|
|
6701
|
+
count,
|
|
6702
|
+
columns,
|
|
6703
|
+
onActivate,
|
|
6704
|
+
enabled = true
|
|
6705
|
+
}) {
|
|
6706
|
+
const [ativo, setAtivo] = useState(0);
|
|
6707
|
+
const [moveuPorTeclado, setMoveuPorTeclado] = useState(false);
|
|
6708
|
+
const refs = useRef([]);
|
|
6709
|
+
useEffect(() => {
|
|
6710
|
+
if (ativo > count - 1) setAtivo(Math.max(0, count - 1));
|
|
6711
|
+
}, [count, ativo]);
|
|
6712
|
+
useEffect(() => {
|
|
6713
|
+
if (!moveuPorTeclado) return;
|
|
6714
|
+
refs.current[ativo]?.focus();
|
|
6715
|
+
setMoveuPorTeclado(false);
|
|
6716
|
+
}, [ativo, moveuPorTeclado]);
|
|
6717
|
+
const registrarRef = useCallback(
|
|
6718
|
+
(index) => (el) => {
|
|
6719
|
+
refs.current[index] = el;
|
|
6720
|
+
},
|
|
6721
|
+
[]
|
|
6722
|
+
);
|
|
6723
|
+
const handleKeyDown = useCallback(
|
|
6724
|
+
(index) => (e3) => {
|
|
6725
|
+
if (!enabled) return;
|
|
6726
|
+
const irPara = (proximo) => {
|
|
6727
|
+
e3.preventDefault();
|
|
6728
|
+
setAtivo(Math.min(count - 1, Math.max(0, proximo)));
|
|
6729
|
+
setMoveuPorTeclado(true);
|
|
6730
|
+
};
|
|
6731
|
+
switch (e3.key) {
|
|
6732
|
+
case "ArrowRight":
|
|
6733
|
+
return irPara(index + 1);
|
|
6734
|
+
case "ArrowLeft":
|
|
6735
|
+
return irPara(index - 1);
|
|
6736
|
+
case "ArrowDown":
|
|
6737
|
+
return irPara(index + columns);
|
|
6738
|
+
case "ArrowUp":
|
|
6739
|
+
return irPara(index - columns);
|
|
6740
|
+
case "Home":
|
|
6741
|
+
return irPara(index - index % columns);
|
|
6742
|
+
case "End":
|
|
6743
|
+
return irPara(index - index % columns + (columns - 1));
|
|
6744
|
+
case "PageUp":
|
|
6745
|
+
return irPara(0);
|
|
6746
|
+
case "PageDown":
|
|
6747
|
+
return irPara(count - 1);
|
|
6748
|
+
case "Enter":
|
|
6749
|
+
case " ":
|
|
6750
|
+
e3.preventDefault();
|
|
6751
|
+
onActivate?.(index);
|
|
6752
|
+
return;
|
|
6753
|
+
default:
|
|
6754
|
+
return;
|
|
6755
|
+
}
|
|
6756
|
+
},
|
|
6757
|
+
[enabled, count, columns, onActivate]
|
|
6758
|
+
);
|
|
6759
|
+
const getCellProps = useCallback(
|
|
6760
|
+
(index) => ({
|
|
6761
|
+
tabIndex: enabled && index === ativo ? 0 : -1,
|
|
6762
|
+
onKeyDown: handleKeyDown(index),
|
|
6763
|
+
onFocus: () => setAtivo(index)
|
|
6764
|
+
}),
|
|
6765
|
+
[enabled, ativo, handleKeyDown]
|
|
6766
|
+
);
|
|
6767
|
+
const getCellRef = useCallback(
|
|
6768
|
+
(index) => registrarRef(index),
|
|
6769
|
+
[registrarRef]
|
|
6770
|
+
);
|
|
6771
|
+
return { activeIndex: ativo, getCellProps, getCellRef };
|
|
6772
|
+
}
|
|
6773
|
+
const CELL_CHROME_PX = 24 + 4 + 2;
|
|
6774
|
+
const FALLBACK_ROW_HEIGHT_PX = 96;
|
|
6775
|
+
function SchedulerMonthView({
|
|
6776
|
+
date,
|
|
6777
|
+
events,
|
|
6778
|
+
locale,
|
|
6779
|
+
weekStartsOn,
|
|
6780
|
+
hourFormat,
|
|
6781
|
+
now,
|
|
6782
|
+
maxPerCell,
|
|
6783
|
+
onEventClick,
|
|
6784
|
+
onSlotClick,
|
|
6785
|
+
renderEvent,
|
|
6786
|
+
dndAtivo = false,
|
|
6787
|
+
podeMover
|
|
6788
|
+
}) {
|
|
6789
|
+
const weeks = useMemo(
|
|
6790
|
+
() => buildMonthMatrix(date, weekStartsOn, locale),
|
|
6791
|
+
[date, weekStartsOn, locale]
|
|
6792
|
+
);
|
|
6793
|
+
const teclado = useSchedulerKeyboard({
|
|
6794
|
+
count: weeks.length * 7,
|
|
6795
|
+
columns: 7,
|
|
6796
|
+
onActivate: (index) => {
|
|
6797
|
+
const dia = weeks[Math.floor(index / 7)]?.[index % 7];
|
|
6798
|
+
if (dia) onSlotClick?.(startOfDay(dia), startOfDay(dia));
|
|
6799
|
+
}
|
|
6800
|
+
});
|
|
6801
|
+
const gridRef = useRef(null);
|
|
6802
|
+
const [rowHeight, setRowHeight] = useState(FALLBACK_ROW_HEIGHT_PX);
|
|
6803
|
+
useLayoutEffect(() => {
|
|
6804
|
+
const el = gridRef.current;
|
|
6805
|
+
if (!el) return;
|
|
6806
|
+
const medir = () => {
|
|
6807
|
+
const altura = el.getBoundingClientRect().height;
|
|
6808
|
+
if (altura > 0) setRowHeight(altura / weeks.length);
|
|
6809
|
+
};
|
|
6810
|
+
medir();
|
|
6811
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
6812
|
+
const ro = new ResizeObserver(medir);
|
|
6813
|
+
ro.observe(el);
|
|
6814
|
+
return () => ro.disconnect();
|
|
6815
|
+
}, [weeks.length]);
|
|
6816
|
+
const alturaDisponivel = Math.max(0, rowHeight - CELL_CHROME_PX);
|
|
6817
|
+
const segments = useMemo(
|
|
6818
|
+
() => segmentMultiDay(events, weeks),
|
|
6819
|
+
[events, weeks]
|
|
6820
|
+
);
|
|
6821
|
+
const byDay = useMemo(() => {
|
|
6822
|
+
const map = /* @__PURE__ */ new Map();
|
|
6823
|
+
for (const seg of segments) {
|
|
6824
|
+
const row = weeks[seg.weekIndex];
|
|
6825
|
+
for (let i4 = 0; i4 < seg.colSpan; i4++) {
|
|
6826
|
+
const day = row[seg.colStart + i4];
|
|
6827
|
+
if (!day) continue;
|
|
6828
|
+
const key = day.getTime();
|
|
6829
|
+
const isFirstOfSegment = i4 === 0;
|
|
6830
|
+
const isLastOfSegment = i4 === seg.colSpan - 1;
|
|
6831
|
+
const list = map.get(key) ?? [];
|
|
6832
|
+
list.push({
|
|
6833
|
+
event: seg.event,
|
|
6834
|
+
// A ponta só é "de verdade" quando é a ponta do segmento E a ponta
|
|
6835
|
+
// do evento: um evento que vem da semana anterior chega com
|
|
6836
|
+
// `isStart: false` e nunca ganha canto arredondado à esquerda.
|
|
6837
|
+
truncateStart: !(isFirstOfSegment && seg.isStart),
|
|
6838
|
+
truncateEnd: !(isLastOfSegment && seg.isEnd)
|
|
6839
|
+
});
|
|
6840
|
+
map.set(key, list);
|
|
6841
|
+
}
|
|
6842
|
+
}
|
|
6843
|
+
for (const list of map.values()) {
|
|
6844
|
+
list.sort((a11, b4) => a11.event.start.getTime() - b4.event.start.getTime());
|
|
6845
|
+
}
|
|
6846
|
+
return map;
|
|
6847
|
+
}, [segments, weeks]);
|
|
6848
|
+
const weekdayLabels = useMemo(
|
|
6849
|
+
() => weeks[0].map((day) => format(day, "EEEEEE", { locale })),
|
|
6850
|
+
[weeks, locale]
|
|
6851
|
+
);
|
|
6852
|
+
const timeLabelOf = (event) => {
|
|
6853
|
+
if (event.allDay) return void 0;
|
|
6854
|
+
return format(event.start, hourFormat === "12h" ? "h:mm a" : "HH:mm", {
|
|
6855
|
+
locale
|
|
6856
|
+
});
|
|
6857
|
+
};
|
|
6858
|
+
return /* @__PURE__ */ jsxs("div", { className: schedulerMonthFrame(), children: [
|
|
6859
|
+
/* @__PURE__ */ jsx("div", { className: schedulerWeekdayRow(), children: weekdayLabels.map((label, i4) => /* @__PURE__ */ jsx("span", { className: schedulerWeekdayCell(), children: label }, `${label}-${i4}`)) }),
|
|
6860
|
+
/* @__PURE__ */ jsx("div", { ref: gridRef, role: "grid", className: schedulerMonthGrid(), children: weeks.map(
|
|
6861
|
+
(week, weekIndex) => week.map((day) => {
|
|
6862
|
+
const dayEvents = byDay.get(day.getTime()) ?? [];
|
|
6863
|
+
const todos = dayEvents.map((d4) => d4.event);
|
|
6864
|
+
const { visible, overflowCount } = maxPerCell !== void 0 ? {
|
|
6865
|
+
visible: todos.slice(
|
|
6866
|
+
0,
|
|
6867
|
+
todos.length <= maxPerCell ? maxPerCell : Math.max(0, maxPerCell - 1)
|
|
6868
|
+
),
|
|
6869
|
+
overflowCount: todos.length <= maxPerCell ? 0 : todos.length - Math.max(0, maxPerCell - 1)
|
|
6870
|
+
} : computeOverflow(todos, alturaDisponivel);
|
|
6871
|
+
const outside = !isSameMonth(day, date);
|
|
6872
|
+
const today = isSameDay(day, now);
|
|
6873
|
+
const indiceDaCelula = weekIndex * 7 + week.indexOf(day);
|
|
6874
|
+
return /* @__PURE__ */ jsxs(
|
|
6875
|
+
DroppableDay,
|
|
6876
|
+
{
|
|
6877
|
+
day,
|
|
6878
|
+
disabled: !dndAtivo,
|
|
6879
|
+
className: schedulerMonthCell({
|
|
6880
|
+
outside,
|
|
6881
|
+
lastRow: weekIndex === weeks.length - 1,
|
|
6882
|
+
interactive: Boolean(onSlotClick)
|
|
6883
|
+
}),
|
|
6884
|
+
overClassName: schedulerDropTarget(),
|
|
6885
|
+
role: "gridcell",
|
|
6886
|
+
"aria-label": format(day, "PPPP", { locale }),
|
|
6887
|
+
...teclado.getCellProps(indiceDaCelula),
|
|
6888
|
+
cellRef: teclado.getCellRef(indiceDaCelula),
|
|
6889
|
+
children: [
|
|
6890
|
+
/* @__PURE__ */ jsxs("div", { className: schedulerDayHead(), children: [
|
|
6891
|
+
/* @__PURE__ */ jsx("span", { className: schedulerDayNumber({ today, outside }), children: format(day, "d", { locale }) }),
|
|
6892
|
+
onSlotClick ? /* @__PURE__ */ jsx(
|
|
6893
|
+
"button",
|
|
6894
|
+
{
|
|
6895
|
+
type: "button",
|
|
6896
|
+
className: schedulerSlotAdd(),
|
|
6897
|
+
"aria-label": `Criar evento em ${format(day, "PPP", { locale })}`,
|
|
6898
|
+
tabIndex: -1,
|
|
6899
|
+
onClick: () => (
|
|
6900
|
+
// Dia inteiro: quem cria decide a hora no formulário.
|
|
6901
|
+
// Emitir 00:00–23:59 seria inventar uma duração que o
|
|
6902
|
+
// usuário não pediu.
|
|
6903
|
+
onSlotClick(startOfDay(day), startOfDay(day))
|
|
6904
|
+
),
|
|
6905
|
+
children: /* @__PURE__ */ jsx(Plus, { "aria-hidden": "true" })
|
|
6906
|
+
}
|
|
6907
|
+
) : null
|
|
6908
|
+
] }),
|
|
6909
|
+
/* @__PURE__ */ jsxs("div", { className: schedulerCellEvents(), children: [
|
|
6910
|
+
visible.map((event) => {
|
|
6911
|
+
const meta = dayEvents.find((d4) => d4.event.id === event.id);
|
|
6912
|
+
return /* @__PURE__ */ jsx(
|
|
6913
|
+
DraggableEvent,
|
|
6914
|
+
{
|
|
6915
|
+
event,
|
|
6916
|
+
view: "month",
|
|
6917
|
+
variant: "pill",
|
|
6918
|
+
movable: podeMover?.(event) ?? false,
|
|
6919
|
+
truncateStart: meta?.truncateStart,
|
|
6920
|
+
truncateEnd: meta?.truncateEnd,
|
|
6921
|
+
timeLabel: timeLabelOf(event),
|
|
6922
|
+
onClick: (evt) => onEventClick?.(event, evt),
|
|
6923
|
+
renderContent: renderEvent ? () => renderEvent({
|
|
6924
|
+
event,
|
|
6925
|
+
view: "month",
|
|
6926
|
+
selected: false
|
|
6927
|
+
}) : void 0
|
|
6928
|
+
},
|
|
6929
|
+
`${event.id}-${day.getTime()}`
|
|
6930
|
+
);
|
|
6931
|
+
}),
|
|
6932
|
+
overflowCount > 0 ? /* @__PURE__ */ jsxs(Popover, { children: [
|
|
6933
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("button", { type: "button", className: schedulerOverflowButton(), children: [
|
|
6934
|
+
"+",
|
|
6935
|
+
overflowCount,
|
|
6936
|
+
" mais"
|
|
6937
|
+
] }) }),
|
|
6938
|
+
/* @__PURE__ */ jsx(PopoverContent, { align: "start", className: "p-0", children: /* @__PURE__ */ jsxs("div", { className: schedulerOverflowPanel(), children: [
|
|
6939
|
+
/* @__PURE__ */ jsx("span", { className: schedulerOverflowPanelTitle(), children: format(day, "EEEE, d 'de' MMMM", { locale }) }),
|
|
6940
|
+
dayEvents.map((d4) => /* @__PURE__ */ jsx(
|
|
6941
|
+
SchedulerEventItem,
|
|
6942
|
+
{
|
|
6943
|
+
event: d4.event,
|
|
6944
|
+
view: "month",
|
|
6945
|
+
variant: "row",
|
|
6946
|
+
timeLabel: timeLabelOf(d4.event),
|
|
6947
|
+
onClick: (evt) => onEventClick?.(d4.event, evt)
|
|
6948
|
+
},
|
|
6949
|
+
`overflow-${d4.event.id}`
|
|
6950
|
+
))
|
|
6951
|
+
] }) })
|
|
6952
|
+
] }) : null
|
|
6953
|
+
] })
|
|
6954
|
+
]
|
|
6955
|
+
},
|
|
6956
|
+
day.getTime()
|
|
6957
|
+
);
|
|
6958
|
+
})
|
|
6959
|
+
) })
|
|
6960
|
+
] });
|
|
6961
|
+
}
|
|
6962
|
+
const HOUR_HEIGHT_PX = 48;
|
|
6963
|
+
const MIN_BLOCK_PX = 22;
|
|
6964
|
+
function SchedulerTimeGrid({
|
|
6965
|
+
date,
|
|
6966
|
+
view,
|
|
6967
|
+
events,
|
|
6968
|
+
locale,
|
|
6969
|
+
weekStartsOn,
|
|
6970
|
+
hourFormat,
|
|
6971
|
+
dayRange,
|
|
6972
|
+
scrollToHour,
|
|
6973
|
+
nowIndicator,
|
|
6974
|
+
now,
|
|
6975
|
+
snapMinutes,
|
|
6976
|
+
onEventClick,
|
|
6977
|
+
onSlotClick,
|
|
6978
|
+
renderEvent,
|
|
6979
|
+
dndAtivo = false,
|
|
6980
|
+
podeMover,
|
|
6981
|
+
podeRedimensionar
|
|
6982
|
+
}) {
|
|
6983
|
+
const bodyRef = useRef(null);
|
|
6984
|
+
const days = useMemo(() => {
|
|
6985
|
+
if (view === "day") return [startOfDay(date)];
|
|
6986
|
+
const first = startOfWeek(date, { weekStartsOn, locale });
|
|
6987
|
+
return Array.from({ length: 7 }, (_3, i4) => startOfDay(addDays(first, i4)));
|
|
6988
|
+
}, [date, view, weekStartsOn, locale]);
|
|
6989
|
+
const [rangeStart, rangeEnd] = dayRange;
|
|
6990
|
+
const hours = useMemo(
|
|
6991
|
+
() => Array.from({ length: Math.max(1, rangeEnd - rangeStart) }, (_3, i4) => rangeStart + i4),
|
|
6992
|
+
[rangeStart, rangeEnd]
|
|
6993
|
+
);
|
|
6994
|
+
const teclado = useSchedulerKeyboard({
|
|
6995
|
+
count: hours.length * days.length,
|
|
6996
|
+
columns: days.length,
|
|
6997
|
+
onActivate: (index) => {
|
|
6998
|
+
const hora = hours[Math.floor(index / days.length)];
|
|
6999
|
+
const dia = days[index % days.length];
|
|
7000
|
+
if (hora === void 0 || !dia) return;
|
|
7001
|
+
const start = new Date(dia);
|
|
7002
|
+
start.setHours(hora, 0, 0, 0);
|
|
7003
|
+
const end = new Date(start);
|
|
7004
|
+
end.setHours(hora + 1, 0, 0, 0);
|
|
7005
|
+
onSlotClick?.(start, end);
|
|
7006
|
+
},
|
|
7007
|
+
enabled: Boolean(onSlotClick)
|
|
7008
|
+
});
|
|
7009
|
+
useEffect(() => {
|
|
7010
|
+
const el = bodyRef.current;
|
|
7011
|
+
if (!el) return;
|
|
7012
|
+
const target = (scrollToHour - rangeStart) * HOUR_HEIGHT_PX;
|
|
7013
|
+
el.scrollTop = Math.max(0, target);
|
|
7014
|
+
}, [scrollToHour, rangeStart]);
|
|
7015
|
+
const fmtHour = (hour) => {
|
|
7016
|
+
const d4 = new Date(2e3, 0, 1, hour % 24, 0);
|
|
7017
|
+
return format(d4, hourFormat === "12h" ? "h a" : "HH:mm", { locale });
|
|
7018
|
+
};
|
|
7019
|
+
const fmtTime = (d4) => format(d4, hourFormat === "12h" ? "h:mm a" : "HH:mm", { locale });
|
|
7020
|
+
const allDayByDay = useMemo(() => {
|
|
7021
|
+
const map = /* @__PURE__ */ new Map();
|
|
7022
|
+
for (const day of days) map.set(day.getTime(), []);
|
|
7023
|
+
for (const ev of events) {
|
|
7024
|
+
if (!ev.allDay) continue;
|
|
7025
|
+
for (const day of days) {
|
|
7026
|
+
if (startOfDay(ev.start).getTime() <= day.getTime() && startOfDay(ev.end).getTime() >= day.getTime()) {
|
|
7027
|
+
map.get(day.getTime())?.push(ev);
|
|
7028
|
+
}
|
|
7029
|
+
}
|
|
7030
|
+
}
|
|
7031
|
+
return map;
|
|
7032
|
+
}, [events, days]);
|
|
7033
|
+
const hasAllDay = useMemo(
|
|
7034
|
+
() => [...allDayByDay.values()].some((list) => list.length > 0),
|
|
7035
|
+
[allDayByDay]
|
|
7036
|
+
);
|
|
7037
|
+
const blocksByDay = useMemo(() => {
|
|
7038
|
+
const map = /* @__PURE__ */ new Map();
|
|
7039
|
+
for (const day of days) {
|
|
7040
|
+
const dayStart = startOfDay(day);
|
|
7041
|
+
const dayEnd = endOfDay(day);
|
|
7042
|
+
const gridTop = new Date(dayStart.getTime() + rangeStart * 36e5);
|
|
7043
|
+
const gridBottom = new Date(dayStart.getTime() + rangeEnd * 36e5);
|
|
7044
|
+
const doDia = events.filter(
|
|
7045
|
+
(ev) => !ev.allDay && ev.start.getTime() < gridBottom.getTime() && ev.end.getTime() > gridTop.getTime() && ev.start.getTime() <= dayEnd.getTime() && ev.end.getTime() >= dayStart.getTime()
|
|
7046
|
+
);
|
|
7047
|
+
const recortados = doDia.map((ev) => ({
|
|
7048
|
+
original: ev,
|
|
7049
|
+
clamped: {
|
|
7050
|
+
...ev,
|
|
7051
|
+
start: ev.start.getTime() < gridTop.getTime() ? gridTop : ev.start,
|
|
7052
|
+
end: ev.end.getTime() > gridBottom.getTime() ? gridBottom : ev.end
|
|
7053
|
+
}
|
|
7054
|
+
}));
|
|
7055
|
+
const lanes = packLanes(
|
|
7056
|
+
recortados.map((r2) => r2.clamped),
|
|
7057
|
+
snapMinutes
|
|
7058
|
+
);
|
|
7059
|
+
map.set(
|
|
7060
|
+
day.getTime(),
|
|
7061
|
+
lanes.map((box) => {
|
|
7062
|
+
const original = recortados.find((r2) => r2.clamped.id === box.event.id)?.original ?? box.event;
|
|
7063
|
+
const top = minutesToOffset(box.event.start, dayRange, HOUR_HEIGHT_PX);
|
|
7064
|
+
const rawHeight = (box.event.end.getTime() - box.event.start.getTime()) / 36e5 * HOUR_HEIGHT_PX;
|
|
7065
|
+
return {
|
|
7066
|
+
event: original,
|
|
7067
|
+
top,
|
|
7068
|
+
height: Math.max(MIN_BLOCK_PX, rawHeight),
|
|
7069
|
+
left: `${box.laneIndex / box.laneCount * 100}%`,
|
|
7070
|
+
width: `${1 / box.laneCount * 100}%`,
|
|
7071
|
+
// O rótulo mostra o horário REAL do evento, não o recortado — quem
|
|
7072
|
+
// vê "22:00" num bloco que começa no topo da grade entende que ele
|
|
7073
|
+
// vem de antes; ver "00:00" seria mentira.
|
|
7074
|
+
label: `${fmtTime(original.start)}`
|
|
7075
|
+
};
|
|
7076
|
+
})
|
|
7077
|
+
);
|
|
7078
|
+
}
|
|
7079
|
+
return map;
|
|
7080
|
+
}, [events, days, dayRange, rangeStart, rangeEnd, snapMinutes, hourFormat, locale]);
|
|
7081
|
+
const nowOffset = useMemo(() => {
|
|
7082
|
+
if (!nowIndicator) return null;
|
|
7083
|
+
const visivel = days.some((d4) => isSameDay(d4, now));
|
|
7084
|
+
if (!visivel) return null;
|
|
7085
|
+
const offset = minutesToOffset(now, dayRange, HOUR_HEIGHT_PX);
|
|
7086
|
+
const total = hours.length * HOUR_HEIGHT_PX;
|
|
7087
|
+
if (offset < 0 || offset > total) return null;
|
|
7088
|
+
return offset;
|
|
7089
|
+
}, [nowIndicator, days, now, dayRange, hours.length]);
|
|
7090
|
+
const isWeekend = (d4) => d4.getDay() === 0 || d4.getDay() === 6;
|
|
7091
|
+
return /* @__PURE__ */ jsxs("div", { className: schedulerTimeFrame(), children: [
|
|
7092
|
+
/* @__PURE__ */ jsxs("div", { className: schedulerTimeHead(), children: [
|
|
7093
|
+
/* @__PURE__ */ jsx("div", { className: schedulerTimeGutter() }),
|
|
7094
|
+
days.map((day) => /* @__PURE__ */ jsxs(
|
|
7095
|
+
"div",
|
|
7096
|
+
{
|
|
7097
|
+
className: schedulerTimeHeadDay({ weekend: isWeekend(day) }),
|
|
7098
|
+
children: [
|
|
7099
|
+
/* @__PURE__ */ jsx("span", { className: schedulerTimeHeadWeekday(), children: format(day, view === "day" ? "EEEE" : "EEEEEE", { locale }) }),
|
|
7100
|
+
/* @__PURE__ */ jsx(
|
|
7101
|
+
"span",
|
|
7102
|
+
{
|
|
7103
|
+
className: schedulerDayNumber({ today: isSameDay(day, now) }),
|
|
7104
|
+
children: format(day, "d", { locale })
|
|
7105
|
+
}
|
|
7106
|
+
)
|
|
7107
|
+
]
|
|
7108
|
+
},
|
|
7109
|
+
day.getTime()
|
|
7110
|
+
))
|
|
7111
|
+
] }),
|
|
7112
|
+
hasAllDay ? /* @__PURE__ */ jsxs("div", { className: schedulerAllDayRow(), children: [
|
|
7113
|
+
/* @__PURE__ */ jsx("span", { className: schedulerAllDayLabel(), children: "Dia inteiro" }),
|
|
7114
|
+
days.map((day) => /* @__PURE__ */ jsx("div", { className: schedulerAllDayCell(), children: (allDayByDay.get(day.getTime()) ?? []).map((ev) => /* @__PURE__ */ jsx(
|
|
7115
|
+
DraggableEvent,
|
|
7116
|
+
{
|
|
7117
|
+
event: ev,
|
|
7118
|
+
view,
|
|
7119
|
+
variant: "pill",
|
|
7120
|
+
movable: podeMover?.(ev) ?? false,
|
|
7121
|
+
truncateStart: startOfDay(ev.start).getTime() < day.getTime(),
|
|
7122
|
+
truncateEnd: startOfDay(ev.end).getTime() > day.getTime(),
|
|
7123
|
+
onClick: (evt) => onEventClick?.(ev, evt),
|
|
7124
|
+
renderContent: renderEvent ? () => renderEvent({ event: ev, view, selected: false }) : void 0
|
|
7125
|
+
},
|
|
7126
|
+
`${ev.id}-${day.getTime()}`
|
|
7127
|
+
)) }, day.getTime()))
|
|
7128
|
+
] }) : null,
|
|
7129
|
+
/* @__PURE__ */ jsx("div", { ref: bodyRef, className: schedulerTimeBody(), children: /* @__PURE__ */ jsxs("div", { className: schedulerTimeCanvas(), children: [
|
|
7130
|
+
/* @__PURE__ */ jsxs("div", { className: `${schedulerTimeGutter()} relative`, children: [
|
|
7131
|
+
hours.map((h3) => /* @__PURE__ */ jsx("div", { className: schedulerHourLabel(), children: /* @__PURE__ */ jsx("span", { className: schedulerHourLabelText(), children: fmtHour(h3) }) }, h3)),
|
|
7132
|
+
nowOffset !== null ? /* @__PURE__ */ jsx("span", { className: schedulerNowLabel(), style: { top: nowOffset }, children: fmtTime(now) }) : null
|
|
7133
|
+
] }),
|
|
7134
|
+
days.map((day, indiceDaColuna) => /* @__PURE__ */ jsxs(
|
|
7135
|
+
DroppableDay,
|
|
7136
|
+
{
|
|
7137
|
+
day,
|
|
7138
|
+
disabled: !dndAtivo,
|
|
7139
|
+
className: schedulerTimeColumn({ weekend: isWeekend(day) }),
|
|
7140
|
+
overClassName: schedulerDropTarget(),
|
|
7141
|
+
children: [
|
|
7142
|
+
hours.map((h3, indiceHora) => /* @__PURE__ */ jsx(
|
|
7143
|
+
"button",
|
|
7144
|
+
{
|
|
7145
|
+
type: "button",
|
|
7146
|
+
className: schedulerHourSlot(),
|
|
7147
|
+
"aria-label": `Criar evento em ${format(day, "PPP", { locale })} às ${fmtHour(h3)}`,
|
|
7148
|
+
onClick: () => {
|
|
7149
|
+
const start = new Date(day);
|
|
7150
|
+
start.setHours(h3, 0, 0, 0);
|
|
7151
|
+
const end = new Date(start);
|
|
7152
|
+
end.setHours(h3 + 1, 0, 0, 0);
|
|
7153
|
+
onSlotClick?.(start, end);
|
|
7154
|
+
},
|
|
7155
|
+
disabled: !onSlotClick,
|
|
7156
|
+
ref: teclado.getCellRef(
|
|
7157
|
+
indiceHora * days.length + indiceDaColuna
|
|
7158
|
+
),
|
|
7159
|
+
...teclado.getCellProps(
|
|
7160
|
+
indiceHora * days.length + indiceDaColuna
|
|
7161
|
+
)
|
|
7162
|
+
},
|
|
7163
|
+
h3
|
|
7164
|
+
)),
|
|
7165
|
+
(blocksByDay.get(day.getTime()) ?? []).map((b4) => /* @__PURE__ */ jsx(
|
|
7166
|
+
DraggableEvent,
|
|
7167
|
+
{
|
|
7168
|
+
event: b4.event,
|
|
7169
|
+
view,
|
|
7170
|
+
variant: "block",
|
|
7171
|
+
movable: podeMover?.(b4.event) ?? false,
|
|
7172
|
+
resizable: podeRedimensionar?.(b4.event) ?? false,
|
|
7173
|
+
timeLabel: b4.label,
|
|
7174
|
+
style: {
|
|
7175
|
+
top: b4.top,
|
|
7176
|
+
height: b4.height,
|
|
7177
|
+
left: b4.left,
|
|
7178
|
+
width: b4.width,
|
|
7179
|
+
// 2px de folga à direita pra dois blocos vizinhos não
|
|
7180
|
+
// encostarem; `width` já é a fração da lane.
|
|
7181
|
+
paddingRight: void 0
|
|
7182
|
+
},
|
|
7183
|
+
className: "mr-[2px]",
|
|
7184
|
+
onClick: (evt) => onEventClick?.(b4.event, evt),
|
|
7185
|
+
renderContent: renderEvent ? () => renderEvent({ event: b4.event, view, selected: false }) : void 0
|
|
7186
|
+
},
|
|
7187
|
+
b4.event.id
|
|
7188
|
+
)),
|
|
7189
|
+
nowOffset !== null && isSameDay(day, now) ? /* @__PURE__ */ jsxs("span", { className: schedulerNowLine(), style: { top: nowOffset }, children: [
|
|
7190
|
+
/* @__PURE__ */ jsx("span", { className: schedulerNowDot(), "aria-hidden": "true" }),
|
|
7191
|
+
/* @__PURE__ */ jsx("span", { className: schedulerNowStroke(), "aria-hidden": "true" })
|
|
7192
|
+
] }) : null
|
|
7193
|
+
]
|
|
7194
|
+
},
|
|
7195
|
+
day.getTime()
|
|
7196
|
+
))
|
|
7197
|
+
] }) })
|
|
7198
|
+
] });
|
|
7199
|
+
}
|
|
7200
|
+
function SchedulerListView({
|
|
7201
|
+
date,
|
|
7202
|
+
events,
|
|
7203
|
+
locale,
|
|
7204
|
+
hourFormat,
|
|
7205
|
+
now,
|
|
7206
|
+
onEventClick,
|
|
7207
|
+
renderEvent,
|
|
7208
|
+
emptyState
|
|
7209
|
+
}) {
|
|
7210
|
+
const grupos = useMemo(() => {
|
|
7211
|
+
const inicio = startOfMonth(date).getTime();
|
|
7212
|
+
const fim = endOfMonth(date).getTime();
|
|
7213
|
+
const map = /* @__PURE__ */ new Map();
|
|
7214
|
+
for (const ev of events) {
|
|
7215
|
+
let cursor = startOfDay(ev.start);
|
|
7216
|
+
const ultimo = startOfDay(ev.end);
|
|
7217
|
+
let guard = 0;
|
|
7218
|
+
while (cursor.getTime() <= ultimo.getTime() && guard < 400) {
|
|
7219
|
+
const t3 = cursor.getTime();
|
|
7220
|
+
if (t3 >= inicio && t3 <= fim) {
|
|
7221
|
+
const lista = map.get(t3) ?? [];
|
|
7222
|
+
lista.push(ev);
|
|
7223
|
+
map.set(t3, lista);
|
|
7224
|
+
}
|
|
7225
|
+
cursor = new Date(
|
|
7226
|
+
cursor.getFullYear(),
|
|
7227
|
+
cursor.getMonth(),
|
|
7228
|
+
cursor.getDate() + 1
|
|
7229
|
+
);
|
|
7230
|
+
guard++;
|
|
7231
|
+
}
|
|
7232
|
+
}
|
|
7233
|
+
return [...map.entries()].sort(([a11], [b4]) => a11 - b4).map(([t3, lista]) => ({
|
|
7234
|
+
dia: new Date(t3),
|
|
7235
|
+
// Dia inteiro primeiro, depois por horário — é a ordem em que o dia
|
|
7236
|
+
// acontece: o que vale pro dia todo emoldura o resto.
|
|
7237
|
+
eventos: lista.sort((x3, y3) => {
|
|
7238
|
+
if (!!x3.allDay !== !!y3.allDay) return x3.allDay ? -1 : 1;
|
|
7239
|
+
return x3.start.getTime() - y3.start.getTime();
|
|
7240
|
+
})
|
|
7241
|
+
}));
|
|
7242
|
+
}, [events, date]);
|
|
7243
|
+
const fmtTime = (d4) => format(d4, hourFormat === "12h" ? "h:mm a" : "HH:mm", { locale });
|
|
7244
|
+
const rotuloHorario = (ev) => {
|
|
7245
|
+
if (ev.allDay) return "Dia inteiro";
|
|
7246
|
+
if (ev.start.getTime() === ev.end.getTime()) return fmtTime(ev.start);
|
|
7247
|
+
return `${fmtTime(ev.start)} – ${fmtTime(ev.end)}`;
|
|
7248
|
+
};
|
|
7249
|
+
if (grupos.length === 0) {
|
|
7250
|
+
return /* @__PURE__ */ jsx("div", { className: schedulerPlaceholder(), children: emptyState ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7251
|
+
/* @__PURE__ */ jsx(
|
|
7252
|
+
CalendarSearch,
|
|
7253
|
+
{
|
|
7254
|
+
className: "size-icon-xl text-fg-subtle",
|
|
7255
|
+
"aria-hidden": "true"
|
|
7256
|
+
}
|
|
7257
|
+
),
|
|
7258
|
+
/* @__PURE__ */ jsxs("span", { className: "text-body-md font-semibold text-fg-default", children: [
|
|
7259
|
+
"Nenhum evento em ",
|
|
7260
|
+
format(date, "MMMM 'de' yyyy", { locale })
|
|
7261
|
+
] }),
|
|
7262
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[42ch] text-body-sm text-fg-muted", children: "Ajuste a busca ou os filtros, ou navegue pra outro mês." })
|
|
7263
|
+
] }) });
|
|
7264
|
+
}
|
|
7265
|
+
return /* @__PURE__ */ jsx("div", { className: schedulerListFrame(), children: grupos.map(({ dia, eventos }) => /* @__PURE__ */ jsxs("div", { className: schedulerListDay(), children: [
|
|
7266
|
+
/* @__PURE__ */ jsxs("div", { className: schedulerListDayHead(), children: [
|
|
7267
|
+
/* @__PURE__ */ jsx("span", { className: schedulerListDayNumber({ today: isSameDay(dia, now) }), children: format(dia, "d", { locale }) }),
|
|
7268
|
+
/* @__PURE__ */ jsx("span", { className: schedulerListDayName(), children: format(dia, "EEEE, MMMM", { locale }) })
|
|
7269
|
+
] }),
|
|
7270
|
+
/* @__PURE__ */ jsx("div", { className: schedulerListEvents(), children: eventos.map((ev) => /* @__PURE__ */ jsx(
|
|
7271
|
+
SchedulerEventItem,
|
|
7272
|
+
{
|
|
7273
|
+
event: ev,
|
|
7274
|
+
view: "list",
|
|
7275
|
+
variant: "row",
|
|
7276
|
+
timeLabel: rotuloHorario(ev),
|
|
7277
|
+
onClick: (evt) => onEventClick?.(ev, evt),
|
|
7278
|
+
renderContent: renderEvent ? () => renderEvent({ event: ev, view: "list", selected: false }) : void 0
|
|
7279
|
+
},
|
|
7280
|
+
`${ev.id}-${dia.getTime()}`
|
|
7281
|
+
)) })
|
|
7282
|
+
] }, dia.getTime())) });
|
|
7283
|
+
}
|
|
7284
|
+
function matchesField(event, fieldId, values) {
|
|
7285
|
+
if (values.length === 0) return true;
|
|
7286
|
+
switch (fieldId) {
|
|
7287
|
+
case "categoryId":
|
|
7288
|
+
return event.categoryId !== void 0 && values.includes(event.categoryId);
|
|
7289
|
+
case "tagIds":
|
|
7290
|
+
return (event.tagIds ?? []).some((tag) => values.includes(tag));
|
|
7291
|
+
case "color":
|
|
7292
|
+
return values.includes(event.color ?? "brand");
|
|
7293
|
+
default:
|
|
7294
|
+
return true;
|
|
7295
|
+
}
|
|
7296
|
+
}
|
|
7297
|
+
function matchesSearch(event, term) {
|
|
7298
|
+
if (term === "") return true;
|
|
7299
|
+
const haystack = [];
|
|
7300
|
+
if (event.searchText) haystack.push(event.searchText);
|
|
7301
|
+
if (typeof event.title === "string") haystack.push(event.title);
|
|
7302
|
+
if (typeof event.description === "string") haystack.push(event.description);
|
|
7303
|
+
if (event.tagIds?.length) haystack.push(...event.tagIds);
|
|
7304
|
+
return haystack.some((piece) => piece.toLowerCase().includes(term));
|
|
7305
|
+
}
|
|
7306
|
+
function useSchedulerFilter({
|
|
7307
|
+
events,
|
|
7308
|
+
searchable,
|
|
7309
|
+
search: searchProp,
|
|
7310
|
+
onSearchChange,
|
|
7311
|
+
filterFields,
|
|
7312
|
+
filterModel: modelProp,
|
|
7313
|
+
onFilterModelChange,
|
|
7314
|
+
filterMode
|
|
7315
|
+
}) {
|
|
7316
|
+
const isSearchControlled = searchProp !== void 0;
|
|
7317
|
+
const isModelControlled = modelProp !== void 0;
|
|
7318
|
+
const [searchState, setSearchState] = useState("");
|
|
7319
|
+
const [modelState, setModelState] = useState({});
|
|
7320
|
+
const search = isSearchControlled ? searchProp : searchState;
|
|
7321
|
+
const filterModel = isModelControlled ? modelProp : modelState;
|
|
7322
|
+
useRef(false);
|
|
7323
|
+
useEffect(() => {
|
|
7324
|
+
return;
|
|
7325
|
+
}, [filterFields, filterMode]);
|
|
7326
|
+
const commitSearch = useCallback(
|
|
7327
|
+
(next) => {
|
|
7328
|
+
if (!isSearchControlled) setSearchState(next);
|
|
7329
|
+
onSearchChange?.(next);
|
|
7330
|
+
},
|
|
7331
|
+
[isSearchControlled, onSearchChange]
|
|
7332
|
+
);
|
|
7333
|
+
const commitModel = useCallback(
|
|
7334
|
+
(next) => {
|
|
7335
|
+
if (!isModelControlled) setModelState(next);
|
|
7336
|
+
onFilterModelChange?.(next);
|
|
7337
|
+
},
|
|
7338
|
+
[isModelControlled, onFilterModelChange]
|
|
7339
|
+
);
|
|
7340
|
+
const toggleValue = useCallback(
|
|
7341
|
+
(fieldId, value) => {
|
|
7342
|
+
const current = filterModel[fieldId] ?? [];
|
|
7343
|
+
const nextValues = current.includes(value) ? current.filter((v3) => v3 !== value) : [...current, value];
|
|
7344
|
+
const next = { ...filterModel };
|
|
7345
|
+
if (nextValues.length === 0) {
|
|
7346
|
+
delete next[fieldId];
|
|
7347
|
+
} else {
|
|
7348
|
+
next[fieldId] = nextValues;
|
|
7349
|
+
}
|
|
7350
|
+
commitModel(next);
|
|
7351
|
+
},
|
|
7352
|
+
[commitModel, filterModel]
|
|
7353
|
+
);
|
|
7354
|
+
const clearField = useCallback(
|
|
7355
|
+
(fieldId) => {
|
|
7356
|
+
const next = { ...filterModel };
|
|
7357
|
+
delete next[fieldId];
|
|
7358
|
+
commitModel(next);
|
|
7359
|
+
},
|
|
7360
|
+
[commitModel, filterModel]
|
|
7361
|
+
);
|
|
7362
|
+
const clearAll = useCallback(() => {
|
|
7363
|
+
commitModel({});
|
|
7364
|
+
commitSearch("");
|
|
7365
|
+
}, [commitModel, commitSearch]);
|
|
7366
|
+
const appliedCount = useMemo(
|
|
7367
|
+
() => Object.values(filterModel).reduce(
|
|
7368
|
+
(total, values) => total + values.length,
|
|
7369
|
+
0
|
|
7370
|
+
),
|
|
7371
|
+
[filterModel]
|
|
7372
|
+
);
|
|
7373
|
+
const optionCounts = useMemo(() => {
|
|
7374
|
+
const term = searchable ? search.trim().toLowerCase() : "";
|
|
7375
|
+
const base = events.filter((e3) => matchesSearch(e3, term));
|
|
7376
|
+
const out = {};
|
|
7377
|
+
for (const field of filterFields ?? []) {
|
|
7378
|
+
const perValue = {};
|
|
7379
|
+
for (const option of field.options) {
|
|
7380
|
+
perValue[option.value] = base.filter(
|
|
7381
|
+
(e3) => matchesField(e3, field.id, [option.value])
|
|
7382
|
+
).length;
|
|
7383
|
+
}
|
|
7384
|
+
out[field.id] = perValue;
|
|
7385
|
+
}
|
|
7386
|
+
return out;
|
|
7387
|
+
}, [events, filterFields, search, searchable]);
|
|
7388
|
+
const filteredEvents = useMemo(() => {
|
|
7389
|
+
if (filterMode === "server") return events;
|
|
7390
|
+
const term = searchable ? search.trim().toLowerCase() : "";
|
|
7391
|
+
const activeFields = Object.entries(filterModel).filter(
|
|
7392
|
+
([, values]) => values.length > 0
|
|
7393
|
+
);
|
|
7394
|
+
if (term === "" && activeFields.length === 0) return events;
|
|
7395
|
+
return events.filter((event) => {
|
|
7396
|
+
if (!matchesSearch(event, term)) return false;
|
|
7397
|
+
return activeFields.every(
|
|
7398
|
+
([fieldId, values]) => matchesField(event, fieldId, values)
|
|
7399
|
+
);
|
|
7400
|
+
});
|
|
7401
|
+
}, [events, filterMode, filterModel, search, searchable]);
|
|
7402
|
+
return {
|
|
7403
|
+
search,
|
|
7404
|
+
setSearch: commitSearch,
|
|
7405
|
+
filterModel,
|
|
7406
|
+
toggleValue,
|
|
7407
|
+
clearField,
|
|
7408
|
+
clearAll,
|
|
7409
|
+
appliedCount,
|
|
7410
|
+
optionCounts,
|
|
7411
|
+
filteredEvents
|
|
7412
|
+
};
|
|
7413
|
+
}
|
|
7414
|
+
function useSchedulerState({
|
|
7415
|
+
defaultDate,
|
|
7416
|
+
date: dateProp,
|
|
7417
|
+
onDateChange,
|
|
7418
|
+
defaultView,
|
|
7419
|
+
view: viewProp,
|
|
7420
|
+
onViewChange,
|
|
7421
|
+
weekStartsOn,
|
|
7422
|
+
locale,
|
|
7423
|
+
now
|
|
7424
|
+
}) {
|
|
7425
|
+
const isDateControlled = dateProp !== void 0;
|
|
7426
|
+
const isViewControlled = viewProp !== void 0;
|
|
7427
|
+
const [dateState, setDateState] = useState(
|
|
7428
|
+
() => defaultDate ?? startOfDay(now)
|
|
7429
|
+
);
|
|
7430
|
+
const [viewState, setViewState] = useState(
|
|
7431
|
+
() => defaultView ?? "month"
|
|
7432
|
+
);
|
|
7433
|
+
const date = isDateControlled ? dateProp : dateState;
|
|
7434
|
+
const view = isViewControlled ? viewProp : viewState;
|
|
7435
|
+
useRef(false);
|
|
7436
|
+
useEffect(() => {
|
|
7437
|
+
return;
|
|
7438
|
+
}, [dateProp, defaultDate, viewProp, defaultView, onDateChange, onViewChange]);
|
|
7439
|
+
const commitDate = useCallback(
|
|
7440
|
+
(next2) => {
|
|
7441
|
+
if (!isDateControlled) setDateState(next2);
|
|
7442
|
+
onDateChange?.(next2);
|
|
7443
|
+
},
|
|
7444
|
+
[isDateControlled, onDateChange]
|
|
7445
|
+
);
|
|
7446
|
+
const commitView = useCallback(
|
|
7447
|
+
(next2) => {
|
|
7448
|
+
if (!isViewControlled) setViewState(next2);
|
|
7449
|
+
onViewChange?.(next2);
|
|
7450
|
+
},
|
|
7451
|
+
[isViewControlled, onViewChange]
|
|
7452
|
+
);
|
|
7453
|
+
const shift = useCallback(
|
|
7454
|
+
(direction) => {
|
|
7455
|
+
const step = view === "month" ? addMonths(date, direction) : view === "week" ? addWeeks(date, direction) : addDays(date, direction);
|
|
7456
|
+
commitDate(startOfDay(step));
|
|
7457
|
+
},
|
|
7458
|
+
[commitDate, date, view]
|
|
7459
|
+
);
|
|
7460
|
+
const next = useCallback(() => shift(1), [shift]);
|
|
7461
|
+
const prev = useCallback(() => shift(-1), [shift]);
|
|
7462
|
+
const goToToday = useCallback(
|
|
7463
|
+
() => commitDate(startOfDay(now)),
|
|
7464
|
+
[commitDate, now]
|
|
7465
|
+
);
|
|
7466
|
+
const goToDate = useCallback(
|
|
7467
|
+
(target) => commitDate(startOfDay(target)),
|
|
7468
|
+
[commitDate]
|
|
7469
|
+
);
|
|
7470
|
+
const visibleRange = useMemo(() => {
|
|
7471
|
+
switch (view) {
|
|
7472
|
+
case "month": {
|
|
7473
|
+
const gridStart = startOfWeek(startOfMonth(date), {
|
|
7474
|
+
weekStartsOn,
|
|
7475
|
+
locale
|
|
7476
|
+
});
|
|
7477
|
+
return { start: gridStart, end: endOfDay(addDays(gridStart, 41)) };
|
|
7478
|
+
}
|
|
7479
|
+
case "week":
|
|
7480
|
+
return {
|
|
7481
|
+
start: startOfWeek(date, { weekStartsOn, locale }),
|
|
7482
|
+
end: endOfWeek(date, { weekStartsOn, locale })
|
|
7483
|
+
};
|
|
7484
|
+
case "day":
|
|
7485
|
+
return { start: startOfDay(date), end: endOfDay(date) };
|
|
7486
|
+
case "list":
|
|
7487
|
+
default:
|
|
7488
|
+
return { start: startOfMonth(date), end: endOfMonth(date) };
|
|
7489
|
+
}
|
|
7490
|
+
}, [date, view, weekStartsOn, locale]);
|
|
7491
|
+
return {
|
|
7492
|
+
date,
|
|
7493
|
+
view,
|
|
7494
|
+
setDate: commitDate,
|
|
7495
|
+
setView: commitView,
|
|
7496
|
+
next,
|
|
7497
|
+
prev,
|
|
7498
|
+
goToToday,
|
|
7499
|
+
goToDate,
|
|
7500
|
+
visibleRange
|
|
7501
|
+
};
|
|
7502
|
+
}
|
|
7503
|
+
function useMediaQuery(query) {
|
|
7504
|
+
const [matches, setMatches] = useState(() => {
|
|
7505
|
+
if (typeof window === "undefined") return false;
|
|
7506
|
+
return window.matchMedia(query).matches;
|
|
7507
|
+
});
|
|
7508
|
+
useEffect(() => {
|
|
7509
|
+
if (typeof window === "undefined") return;
|
|
7510
|
+
const mql = window.matchMedia(query);
|
|
7511
|
+
const handler = (e3) => setMatches(e3.matches);
|
|
7512
|
+
setMatches(mql.matches);
|
|
7513
|
+
mql.addEventListener("change", handler);
|
|
7514
|
+
return () => mql.removeEventListener("change", handler);
|
|
7515
|
+
}, [query]);
|
|
7516
|
+
return matches;
|
|
7517
|
+
}
|
|
7518
|
+
const Scheduler = forwardRef(
|
|
7519
|
+
function Scheduler2({
|
|
7520
|
+
events,
|
|
7521
|
+
locale,
|
|
7522
|
+
weekStartsOn = 0,
|
|
7523
|
+
hourFormat = "24h",
|
|
7524
|
+
nowIndicator = true,
|
|
7525
|
+
dayRange = [0, 24],
|
|
7526
|
+
scrollToHour = 8,
|
|
7527
|
+
snapMinutes = 15,
|
|
7528
|
+
defaultDate,
|
|
7529
|
+
date,
|
|
7530
|
+
onDateChange,
|
|
7531
|
+
defaultView,
|
|
7532
|
+
view,
|
|
7533
|
+
onViewChange,
|
|
7534
|
+
onEventClick,
|
|
7535
|
+
onSlotClick,
|
|
7536
|
+
onEventMove,
|
|
7537
|
+
onEventResize,
|
|
7538
|
+
draggable = false,
|
|
7539
|
+
resizable = false,
|
|
7540
|
+
searchable = true,
|
|
7541
|
+
search,
|
|
7542
|
+
onSearchChange,
|
|
7543
|
+
filterFields,
|
|
7544
|
+
filterModel,
|
|
7545
|
+
onFilterModelChange,
|
|
7546
|
+
filterMode = "client",
|
|
7547
|
+
defaultFilterPanelOpen = false,
|
|
7548
|
+
toolbarActions,
|
|
7549
|
+
primaryAction,
|
|
7550
|
+
title: title2,
|
|
7551
|
+
renderEvent,
|
|
7552
|
+
emptyState,
|
|
7553
|
+
className,
|
|
7554
|
+
...rest
|
|
7555
|
+
}, ref) {
|
|
7556
|
+
const nowRef = useRef(/* @__PURE__ */ new Date());
|
|
7557
|
+
const now = nowRef.current;
|
|
7558
|
+
const state = useSchedulerState({
|
|
7559
|
+
defaultDate,
|
|
7560
|
+
date,
|
|
7561
|
+
onDateChange,
|
|
7562
|
+
defaultView,
|
|
7563
|
+
view,
|
|
7564
|
+
onViewChange,
|
|
7565
|
+
weekStartsOn,
|
|
7566
|
+
locale,
|
|
7567
|
+
now
|
|
7568
|
+
});
|
|
7569
|
+
const filter = useSchedulerFilter({
|
|
7570
|
+
events,
|
|
7571
|
+
searchable,
|
|
7572
|
+
search,
|
|
7573
|
+
onSearchChange,
|
|
7574
|
+
filterFields,
|
|
7575
|
+
filterModel,
|
|
7576
|
+
onFilterModelChange,
|
|
7577
|
+
filterMode
|
|
7578
|
+
});
|
|
7579
|
+
const dndAtivo = Boolean(
|
|
7580
|
+
(draggable || resizable || events.some((e3) => e3.draggable || e3.resizable)) && (onEventMove || onEventResize)
|
|
7581
|
+
);
|
|
7582
|
+
const dnd = useSchedulerDnd({
|
|
7583
|
+
enabled: dndAtivo,
|
|
7584
|
+
view: state.view,
|
|
7585
|
+
events: filter.filteredEvents,
|
|
7586
|
+
snapMinutes,
|
|
7587
|
+
dayRange,
|
|
7588
|
+
hourHeight: HOUR_HEIGHT_PX,
|
|
7589
|
+
draggable,
|
|
7590
|
+
resizable,
|
|
7591
|
+
onEventMove,
|
|
7592
|
+
onEventResize
|
|
7593
|
+
});
|
|
7594
|
+
useRef(false);
|
|
7595
|
+
useEffect(() => {
|
|
7596
|
+
return;
|
|
7597
|
+
}, [draggable, resizable, onEventMove, onEventResize]);
|
|
7598
|
+
const eventoArrastado = dnd.dragAtivo?.kind === "move" ? filter.filteredEvents.find((e3) => e3.id === dnd.dragAtivo?.eventId) ?? null : null;
|
|
7599
|
+
const filterPanelAvailable = useMediaQuery("(min-width: 1024px)");
|
|
7600
|
+
const [filterPanelOpen, setFilterPanelOpen] = useState(defaultFilterPanelOpen);
|
|
7601
|
+
const showFilterPanel = filterPanelOpen && filterPanelAvailable && (filterFields?.length ?? 0) > 0;
|
|
7602
|
+
useImperativeHandle(
|
|
7603
|
+
ref,
|
|
7604
|
+
() => ({
|
|
7605
|
+
goToDate: state.goToDate,
|
|
7606
|
+
goToToday: state.goToToday,
|
|
7607
|
+
next: state.next,
|
|
7608
|
+
prev: state.prev,
|
|
7609
|
+
getVisibleRange: () => state.visibleRange
|
|
7610
|
+
}),
|
|
7611
|
+
[state]
|
|
7612
|
+
);
|
|
7613
|
+
const periodTitle = useMemo(() => {
|
|
7614
|
+
if (title2 !== void 0) return title2;
|
|
7615
|
+
const { start, end } = state.visibleRange;
|
|
7616
|
+
switch (state.view) {
|
|
7617
|
+
case "week": {
|
|
7618
|
+
const sameMonth = start.getMonth() === end.getMonth();
|
|
7619
|
+
return sameMonth ? `${format(start, "d", { locale })}–${format(end, "d 'de' MMMM yyyy", { locale })}` : `${format(start, "d MMM", { locale })} – ${format(end, "d MMM yyyy", { locale })}`;
|
|
7620
|
+
}
|
|
7621
|
+
case "day":
|
|
7622
|
+
return format(state.date, "EEEE, d 'de' MMMM yyyy", { locale });
|
|
7623
|
+
case "month":
|
|
7624
|
+
case "list":
|
|
7625
|
+
default:
|
|
7626
|
+
return format(state.date, "MMMM yyyy", { locale });
|
|
7627
|
+
}
|
|
7628
|
+
}, [title2, state.view, state.date, state.visibleRange, locale]);
|
|
7629
|
+
return (
|
|
7630
|
+
/* `role="region"` + `aria-label` com o período: é o que dá ao leitor de
|
|
7631
|
+
tela um ponto de navegação ("Calendário, setembro 2026") sem que o
|
|
7632
|
+
título do período precise se declarar `<h2>` e entrar no outline da
|
|
7633
|
+
página. O rótulo só é montado quando o título é string — com um
|
|
7634
|
+
`ReactNode` custom não dá pra derivar texto sem varrer a árvore. */
|
|
7635
|
+
/* @__PURE__ */ jsx(
|
|
7636
|
+
"div",
|
|
7637
|
+
{
|
|
7638
|
+
role: "region",
|
|
7639
|
+
"aria-label": typeof periodTitle === "string" ? `Calendário, ${periodTitle}` : "Calendário",
|
|
7640
|
+
className: cn(schedulerRoot(), className),
|
|
7641
|
+
...rest,
|
|
7642
|
+
children: /* @__PURE__ */ jsxs(
|
|
7643
|
+
DndContext,
|
|
7644
|
+
{
|
|
7645
|
+
sensors: dnd.sensors,
|
|
7646
|
+
onDragStart: dnd.handleDragStart,
|
|
7647
|
+
onDragOver: dnd.handleDragOver,
|
|
7648
|
+
onDragEnd: dnd.handleDragEnd,
|
|
7649
|
+
onDragCancel: dnd.handleDragCancel,
|
|
7650
|
+
children: [
|
|
7651
|
+
/* @__PURE__ */ jsx(
|
|
7652
|
+
SchedulerToolbar,
|
|
7653
|
+
{
|
|
7654
|
+
title: periodTitle,
|
|
7655
|
+
view: state.view,
|
|
7656
|
+
onViewChange: state.setView,
|
|
7657
|
+
onPrev: state.prev,
|
|
7658
|
+
onNext: state.next,
|
|
7659
|
+
onToday: state.goToToday,
|
|
7660
|
+
searchable,
|
|
7661
|
+
search: filter.search,
|
|
7662
|
+
onSearchChange: filter.setSearch,
|
|
7663
|
+
filterFields,
|
|
7664
|
+
filterModel: filter.filterModel,
|
|
7665
|
+
onClearField: filter.clearField,
|
|
7666
|
+
onClearAll: filter.clearAll,
|
|
7667
|
+
appliedCount: filter.appliedCount,
|
|
7668
|
+
filterPanelOpen: showFilterPanel,
|
|
7669
|
+
onToggleFilterPanel: () => setFilterPanelOpen((o2) => !o2),
|
|
7670
|
+
filterPanelAvailable,
|
|
7671
|
+
toolbarActions,
|
|
7672
|
+
primaryAction
|
|
7673
|
+
}
|
|
7674
|
+
),
|
|
7675
|
+
/* @__PURE__ */ jsxs("div", { className: schedulerBody(), children: [
|
|
7676
|
+
/* @__PURE__ */ jsx("div", { className: schedulerMain(), children: state.view === "month" ? /* @__PURE__ */ jsx(
|
|
7677
|
+
SchedulerMonthView,
|
|
7678
|
+
{
|
|
7679
|
+
date: state.date,
|
|
7680
|
+
events: filter.filteredEvents,
|
|
7681
|
+
locale,
|
|
7682
|
+
weekStartsOn,
|
|
7683
|
+
hourFormat,
|
|
7684
|
+
now,
|
|
7685
|
+
onEventClick,
|
|
7686
|
+
onSlotClick,
|
|
7687
|
+
renderEvent,
|
|
7688
|
+
dndAtivo,
|
|
7689
|
+
podeMover: dnd.podeMover
|
|
7690
|
+
}
|
|
7691
|
+
) : state.view === "list" ? /* @__PURE__ */ jsx(
|
|
7692
|
+
SchedulerListView,
|
|
7693
|
+
{
|
|
7694
|
+
date: state.date,
|
|
7695
|
+
events: filter.filteredEvents,
|
|
7696
|
+
locale,
|
|
7697
|
+
hourFormat,
|
|
7698
|
+
now,
|
|
7699
|
+
onEventClick,
|
|
7700
|
+
renderEvent,
|
|
7701
|
+
emptyState
|
|
7702
|
+
}
|
|
7703
|
+
) : (
|
|
7704
|
+
/* `week` e `day` são a MESMA view, com 7 ou 1 coluna. */
|
|
7705
|
+
/* @__PURE__ */ jsx(
|
|
7706
|
+
SchedulerTimeGrid,
|
|
7707
|
+
{
|
|
7708
|
+
date: state.date,
|
|
7709
|
+
view: state.view,
|
|
7710
|
+
events: filter.filteredEvents,
|
|
7711
|
+
locale,
|
|
7712
|
+
weekStartsOn,
|
|
7713
|
+
hourFormat,
|
|
7714
|
+
dayRange,
|
|
7715
|
+
scrollToHour,
|
|
7716
|
+
nowIndicator,
|
|
7717
|
+
now,
|
|
7718
|
+
snapMinutes,
|
|
7719
|
+
onEventClick,
|
|
7720
|
+
onSlotClick,
|
|
7721
|
+
renderEvent,
|
|
7722
|
+
dndAtivo,
|
|
7723
|
+
podeMover: dnd.podeMover,
|
|
7724
|
+
podeRedimensionar: dnd.podeRedimensionar
|
|
7725
|
+
}
|
|
7726
|
+
)
|
|
7727
|
+
) }),
|
|
7728
|
+
showFilterPanel && filterFields ? /* @__PURE__ */ jsx(
|
|
7729
|
+
SchedulerFilterPanel,
|
|
7730
|
+
{
|
|
7731
|
+
filterFields,
|
|
7732
|
+
filterModel: filter.filterModel,
|
|
7733
|
+
onToggleValue: filter.toggleValue,
|
|
7734
|
+
onClearAll: filter.clearAll,
|
|
7735
|
+
appliedCount: filter.appliedCount,
|
|
7736
|
+
onClose: () => setFilterPanelOpen(false),
|
|
7737
|
+
counts: filter.optionCounts,
|
|
7738
|
+
date: state.date,
|
|
7739
|
+
now,
|
|
7740
|
+
locale,
|
|
7741
|
+
weekStartsOn,
|
|
7742
|
+
events: filter.filteredEvents,
|
|
7743
|
+
onDateSelect: state.goToDate
|
|
7744
|
+
}
|
|
7745
|
+
) : null
|
|
7746
|
+
] }),
|
|
7747
|
+
/* @__PURE__ */ jsx(DragOverlay, { dropAnimation: null, children: eventoArrastado ? /* @__PURE__ */ jsx(
|
|
7748
|
+
SchedulerEventItem,
|
|
7749
|
+
{
|
|
7750
|
+
event: eventoArrastado,
|
|
7751
|
+
view: state.view,
|
|
7752
|
+
variant: state.view === "month" ? "pill" : "block",
|
|
7753
|
+
dragging: true,
|
|
7754
|
+
timeLabel: eventoArrastado.allDay ? void 0 : format(
|
|
7755
|
+
eventoArrastado.start,
|
|
7756
|
+
hourFormat === "12h" ? "h:mm a" : "HH:mm",
|
|
7757
|
+
{ locale }
|
|
7758
|
+
)
|
|
7759
|
+
}
|
|
7760
|
+
) : null })
|
|
7761
|
+
]
|
|
7762
|
+
}
|
|
7763
|
+
)
|
|
7764
|
+
}
|
|
7765
|
+
)
|
|
7766
|
+
);
|
|
7767
|
+
}
|
|
7768
|
+
);
|
|
5257
7769
|
const spinnerStyles = tv({
|
|
5258
7770
|
base: ["inline-block shrink-0", "animate-spin motion-reduce:animate-none"],
|
|
5259
7771
|
variants: {
|
|
@@ -5392,7 +7904,7 @@ const ScreenLoader = forwardRef(
|
|
|
5392
7904
|
] }),
|
|
5393
7905
|
/* @__PURE__ */ jsx(Skeleton, { className: "min-h-form-md w-[120px] shrink-0" })
|
|
5394
7906
|
] }),
|
|
5395
|
-
skeletonLayout !== "page" && /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: styles2.skeletonKpis(), children: Array.from({ length: 4 }, (
|
|
7907
|
+
skeletonLayout !== "page" && /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: styles2.skeletonKpis(), children: Array.from({ length: 4 }, (_3, i4) => /* @__PURE__ */ jsx(Skeleton, { className: styles2.skeletonKpiCard() }, i4)) }),
|
|
5396
7908
|
/* @__PURE__ */ jsx(Skeleton, { "aria-hidden": "true", className: styles2.skeletonBody() })
|
|
5397
7909
|
] })
|
|
5398
7910
|
}
|
|
@@ -5416,38 +7928,38 @@ function useArrastarParaRolar(trilho, ativo = true, limiarPx = 6) {
|
|
|
5416
7928
|
const ehInterativo = (alvo) => alvo instanceof Element && !!alvo.closest(
|
|
5417
7929
|
'button, a, input, select, textarea, [role="button"], [role="menuitem"], [data-radix-popper-content-wrapper], [role="dialog"], [role="menu"], [role="tooltip"]'
|
|
5418
7930
|
);
|
|
5419
|
-
const onPointerDown = (
|
|
5420
|
-
if (
|
|
7931
|
+
const onPointerDown = (e3) => {
|
|
7932
|
+
if (e3.button !== 0 || ehInterativo(e3.target)) return;
|
|
5421
7933
|
arrastando = true;
|
|
5422
7934
|
passouLimiar = false;
|
|
5423
|
-
xInicial =
|
|
7935
|
+
xInicial = e3.clientX;
|
|
5424
7936
|
scrollInicial = el.scrollLeft;
|
|
5425
7937
|
};
|
|
5426
|
-
const onPointerMove = (
|
|
7938
|
+
const onPointerMove = (e3) => {
|
|
5427
7939
|
if (!arrastando) return;
|
|
5428
|
-
const delta =
|
|
7940
|
+
const delta = e3.clientX - xInicial;
|
|
5429
7941
|
if (!passouLimiar) {
|
|
5430
7942
|
if (Math.abs(delta) < limiarPx) return;
|
|
5431
7943
|
passouLimiar = true;
|
|
5432
7944
|
engolirClique.current = true;
|
|
5433
|
-
el.setPointerCapture?.(
|
|
7945
|
+
el.setPointerCapture?.(e3.pointerId);
|
|
5434
7946
|
el.style.cursor = "grabbing";
|
|
5435
7947
|
el.style.userSelect = "none";
|
|
5436
7948
|
}
|
|
5437
7949
|
el.scrollLeft = scrollInicial - delta;
|
|
5438
7950
|
};
|
|
5439
|
-
const encerrar = (
|
|
7951
|
+
const encerrar = (e3) => {
|
|
5440
7952
|
if (!arrastando) return;
|
|
5441
7953
|
arrastando = false;
|
|
5442
|
-
el.releasePointerCapture?.(
|
|
7954
|
+
el.releasePointerCapture?.(e3.pointerId);
|
|
5443
7955
|
el.style.cursor = "";
|
|
5444
7956
|
el.style.userSelect = "";
|
|
5445
7957
|
};
|
|
5446
|
-
const onClickCapture = (
|
|
7958
|
+
const onClickCapture = (e3) => {
|
|
5447
7959
|
if (!engolirClique.current) return;
|
|
5448
7960
|
engolirClique.current = false;
|
|
5449
|
-
|
|
5450
|
-
|
|
7961
|
+
e3.stopPropagation();
|
|
7962
|
+
e3.preventDefault();
|
|
5451
7963
|
};
|
|
5452
7964
|
el.addEventListener("pointerdown", onPointerDown);
|
|
5453
7965
|
el.addEventListener("pointermove", onPointerMove);
|
|
@@ -5680,9 +8192,9 @@ const TabsNavigationAction = forwardRef(function TabsNavigationAction2({ tom = "
|
|
|
5680
8192
|
ref,
|
|
5681
8193
|
type: "button",
|
|
5682
8194
|
className: tabsNavigationAcao({ tom, className }),
|
|
5683
|
-
onClick: (
|
|
5684
|
-
|
|
5685
|
-
onClick?.(
|
|
8195
|
+
onClick: (e3) => {
|
|
8196
|
+
e3.stopPropagation();
|
|
8197
|
+
onClick?.(e3);
|
|
5686
8198
|
},
|
|
5687
8199
|
...rest
|
|
5688
8200
|
}
|
|
@@ -5740,9 +8252,9 @@ const TabsNavigationTab = forwardRef(function TabsNavigationTab2({
|
|
|
5740
8252
|
"aria-controls": panelId,
|
|
5741
8253
|
tabIndex: ativa ? 0 : -1,
|
|
5742
8254
|
onClick: () => ctx.onValueChange(value),
|
|
5743
|
-
onKeyDown: (
|
|
5744
|
-
if (
|
|
5745
|
-
|
|
8255
|
+
onKeyDown: (e3) => {
|
|
8256
|
+
if (e3.key === "Enter" || e3.key === " ") {
|
|
8257
|
+
e3.preventDefault();
|
|
5746
8258
|
ctx.onValueChange(value);
|
|
5747
8259
|
}
|
|
5748
8260
|
},
|
|
@@ -5800,14 +8312,14 @@ function AcoesPadrao({ onClose, menu }) {
|
|
|
5800
8312
|
onSelect: onClose,
|
|
5801
8313
|
className: "text-fg-danger focus:bg-bg-danger-muted focus:text-fg-danger",
|
|
5802
8314
|
children: [
|
|
5803
|
-
/* @__PURE__ */ jsx(
|
|
8315
|
+
/* @__PURE__ */ jsx(X3, { className: "size-icon-sm" }),
|
|
5804
8316
|
" Fechar aba"
|
|
5805
8317
|
]
|
|
5806
8318
|
}
|
|
5807
8319
|
)
|
|
5808
8320
|
] })
|
|
5809
8321
|
] }),
|
|
5810
|
-
/* @__PURE__ */ jsx(TabsNavigationAction, { "aria-label": "Fechar aba", onClick: onClose, children: /* @__PURE__ */ jsx(
|
|
8322
|
+
/* @__PURE__ */ jsx(TabsNavigationAction, { "aria-label": "Fechar aba", onClick: onClose, children: /* @__PURE__ */ jsx(X3, { className: "size-icon-sm" }) })
|
|
5811
8323
|
] });
|
|
5812
8324
|
}
|
|
5813
8325
|
const TabsNavigationRoot = forwardRef(function TabsNavigation2({
|
|
@@ -5873,13 +8385,13 @@ const TabsNavigationRoot = forwardRef(function TabsNavigation2({
|
|
|
5873
8385
|
}, [value]);
|
|
5874
8386
|
useArrastarParaRolar(trilho);
|
|
5875
8387
|
const rolar = (dir) => trilho.current?.scrollBy({ left: dir * 240, behavior: "smooth" });
|
|
5876
|
-
const onKeyDown = (
|
|
8388
|
+
const onKeyDown = (e3) => {
|
|
5877
8389
|
const valores = abas.map((a11) => a11.props.value);
|
|
5878
|
-
const
|
|
5879
|
-
if (
|
|
5880
|
-
const proximo =
|
|
8390
|
+
const i4 = valores.indexOf(value);
|
|
8391
|
+
if (i4 < 0) return;
|
|
8392
|
+
const proximo = e3.key === "ArrowRight" ? valores[(i4 + 1) % valores.length] : e3.key === "ArrowLeft" ? valores[(i4 - 1 + valores.length) % valores.length] : e3.key === "Home" ? valores[0] : e3.key === "End" ? valores[valores.length - 1] : null;
|
|
5881
8393
|
if (!proximo) return;
|
|
5882
|
-
|
|
8394
|
+
e3.preventDefault();
|
|
5883
8395
|
onValueChange(proximo);
|
|
5884
8396
|
};
|
|
5885
8397
|
const controles = tabsNavigationControles({ fill, density });
|
|
@@ -5914,15 +8426,15 @@ const TabsNavigationRoot = forwardRef(function TabsNavigation2({
|
|
|
5914
8426
|
),
|
|
5915
8427
|
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: tabsNavigationDivisoria({ fill }) })
|
|
5916
8428
|
] }) : null,
|
|
5917
|
-
/* @__PURE__ */ jsx("div", { ref: trilho, onScroll: medir, className: tabsNavigationTrilho({ fill }), children: abas.map((aba,
|
|
5918
|
-
const vizinhaDaAtiva = aba.props.value === value || abas[
|
|
8429
|
+
/* @__PURE__ */ jsx("div", { ref: trilho, onScroll: medir, className: tabsNavigationTrilho({ fill }), children: abas.map((aba, i4) => {
|
|
8430
|
+
const vizinhaDaAtiva = aba.props.value === value || abas[i4 + 1]?.props.value === value;
|
|
5919
8431
|
return /* @__PURE__ */ jsxs(
|
|
5920
8432
|
"div",
|
|
5921
8433
|
{
|
|
5922
8434
|
className: ["flex shrink-0", fill ? "items-stretch" : "items-end"].join(" "),
|
|
5923
8435
|
children: [
|
|
5924
8436
|
aba,
|
|
5925
|
-
|
|
8437
|
+
i4 < abas.length - 1 ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: tabsNavigationDivisoria({ fill, oculta: vizinhaDaAtiva }) }) : null
|
|
5926
8438
|
]
|
|
5927
8439
|
},
|
|
5928
8440
|
aba.props.value
|
|
@@ -6017,34 +8529,34 @@ class Adder {
|
|
|
6017
8529
|
this._partials = new Float64Array(32);
|
|
6018
8530
|
this._n = 0;
|
|
6019
8531
|
}
|
|
6020
|
-
add(
|
|
8532
|
+
add(x3) {
|
|
6021
8533
|
const p4 = this._partials;
|
|
6022
|
-
let
|
|
8534
|
+
let i4 = 0;
|
|
6023
8535
|
for (let j2 = 0; j2 < this._n && j2 < 32; j2++) {
|
|
6024
|
-
const y3 = p4[j2], hi =
|
|
6025
|
-
if (lo) p4[
|
|
6026
|
-
|
|
8536
|
+
const y3 = p4[j2], hi = x3 + y3, lo = Math.abs(x3) < Math.abs(y3) ? x3 - (hi - y3) : y3 - (hi - x3);
|
|
8537
|
+
if (lo) p4[i4++] = lo;
|
|
8538
|
+
x3 = hi;
|
|
6027
8539
|
}
|
|
6028
|
-
p4[
|
|
6029
|
-
this._n =
|
|
8540
|
+
p4[i4] = x3;
|
|
8541
|
+
this._n = i4 + 1;
|
|
6030
8542
|
return this;
|
|
6031
8543
|
}
|
|
6032
8544
|
valueOf() {
|
|
6033
8545
|
const p4 = this._partials;
|
|
6034
|
-
let n2 = this._n,
|
|
8546
|
+
let n2 = this._n, x3, y3, lo, hi = 0;
|
|
6035
8547
|
if (n2 > 0) {
|
|
6036
8548
|
hi = p4[--n2];
|
|
6037
8549
|
while (n2 > 0) {
|
|
6038
|
-
|
|
8550
|
+
x3 = hi;
|
|
6039
8551
|
y3 = p4[--n2];
|
|
6040
|
-
hi =
|
|
6041
|
-
lo = y3 - (hi -
|
|
8552
|
+
hi = x3 + y3;
|
|
8553
|
+
lo = y3 - (hi - x3);
|
|
6042
8554
|
if (lo) break;
|
|
6043
8555
|
}
|
|
6044
8556
|
if (n2 > 0 && (lo < 0 && p4[n2 - 1] < 0 || lo > 0 && p4[n2 - 1] > 0)) {
|
|
6045
8557
|
y3 = lo * 2;
|
|
6046
|
-
|
|
6047
|
-
if (y3 ==
|
|
8558
|
+
x3 = hi + y3;
|
|
8559
|
+
if (y3 == x3 - hi) hi = x3;
|
|
6048
8560
|
}
|
|
6049
8561
|
}
|
|
6050
8562
|
return hi;
|
|
@@ -6072,16 +8584,16 @@ var cos = Math.cos;
|
|
|
6072
8584
|
var exp = Math.exp;
|
|
6073
8585
|
var log = Math.log;
|
|
6074
8586
|
var sin = Math.sin;
|
|
6075
|
-
var sign = Math.sign || function(
|
|
6076
|
-
return
|
|
8587
|
+
var sign = Math.sign || function(x3) {
|
|
8588
|
+
return x3 > 0 ? 1 : x3 < 0 ? -1 : 0;
|
|
6077
8589
|
};
|
|
6078
8590
|
var sqrt = Math.sqrt;
|
|
6079
8591
|
var tan = Math.tan;
|
|
6080
|
-
function acos(
|
|
6081
|
-
return
|
|
8592
|
+
function acos(x3) {
|
|
8593
|
+
return x3 > 1 ? 0 : x3 < -1 ? pi : Math.acos(x3);
|
|
6082
8594
|
}
|
|
6083
|
-
function asin(
|
|
6084
|
-
return
|
|
8595
|
+
function asin(x3) {
|
|
8596
|
+
return x3 > 1 ? halfPi : x3 < -1 ? -halfPi : Math.asin(x3);
|
|
6085
8597
|
}
|
|
6086
8598
|
function noop() {
|
|
6087
8599
|
}
|
|
@@ -6095,8 +8607,8 @@ var streamObjectType = {
|
|
|
6095
8607
|
streamGeometry(object2.geometry, stream);
|
|
6096
8608
|
},
|
|
6097
8609
|
FeatureCollection: function(object2, stream) {
|
|
6098
|
-
var features = object2.features,
|
|
6099
|
-
while (++
|
|
8610
|
+
var features = object2.features, i4 = -1, n2 = features.length;
|
|
8611
|
+
while (++i4 < n2) streamGeometry(features[i4].geometry, stream);
|
|
6100
8612
|
}
|
|
6101
8613
|
};
|
|
6102
8614
|
var streamGeometryType = {
|
|
@@ -6108,38 +8620,38 @@ var streamGeometryType = {
|
|
|
6108
8620
|
stream.point(object2[0], object2[1], object2[2]);
|
|
6109
8621
|
},
|
|
6110
8622
|
MultiPoint: function(object2, stream) {
|
|
6111
|
-
var coordinates = object2.coordinates,
|
|
6112
|
-
while (++
|
|
8623
|
+
var coordinates = object2.coordinates, i4 = -1, n2 = coordinates.length;
|
|
8624
|
+
while (++i4 < n2) object2 = coordinates[i4], stream.point(object2[0], object2[1], object2[2]);
|
|
6113
8625
|
},
|
|
6114
8626
|
LineString: function(object2, stream) {
|
|
6115
8627
|
streamLine(object2.coordinates, stream, 0);
|
|
6116
8628
|
},
|
|
6117
8629
|
MultiLineString: function(object2, stream) {
|
|
6118
|
-
var coordinates = object2.coordinates,
|
|
6119
|
-
while (++
|
|
8630
|
+
var coordinates = object2.coordinates, i4 = -1, n2 = coordinates.length;
|
|
8631
|
+
while (++i4 < n2) streamLine(coordinates[i4], stream, 0);
|
|
6120
8632
|
},
|
|
6121
8633
|
Polygon: function(object2, stream) {
|
|
6122
8634
|
streamPolygon(object2.coordinates, stream);
|
|
6123
8635
|
},
|
|
6124
8636
|
MultiPolygon: function(object2, stream) {
|
|
6125
|
-
var coordinates = object2.coordinates,
|
|
6126
|
-
while (++
|
|
8637
|
+
var coordinates = object2.coordinates, i4 = -1, n2 = coordinates.length;
|
|
8638
|
+
while (++i4 < n2) streamPolygon(coordinates[i4], stream);
|
|
6127
8639
|
},
|
|
6128
8640
|
GeometryCollection: function(object2, stream) {
|
|
6129
|
-
var geometries = object2.geometries,
|
|
6130
|
-
while (++
|
|
8641
|
+
var geometries = object2.geometries, i4 = -1, n2 = geometries.length;
|
|
8642
|
+
while (++i4 < n2) streamGeometry(geometries[i4], stream);
|
|
6131
8643
|
}
|
|
6132
8644
|
};
|
|
6133
8645
|
function streamLine(coordinates, stream, closed) {
|
|
6134
|
-
var
|
|
8646
|
+
var i4 = -1, n2 = coordinates.length - closed, coordinate;
|
|
6135
8647
|
stream.lineStart();
|
|
6136
|
-
while (++
|
|
8648
|
+
while (++i4 < n2) coordinate = coordinates[i4], stream.point(coordinate[0], coordinate[1], coordinate[2]);
|
|
6137
8649
|
stream.lineEnd();
|
|
6138
8650
|
}
|
|
6139
8651
|
function streamPolygon(coordinates, stream) {
|
|
6140
|
-
var
|
|
8652
|
+
var i4 = -1, n2 = coordinates.length;
|
|
6141
8653
|
stream.polygonStart();
|
|
6142
|
-
while (++
|
|
8654
|
+
while (++i4 < n2) streamLine(coordinates[i4], stream, 1);
|
|
6143
8655
|
stream.polygonEnd();
|
|
6144
8656
|
}
|
|
6145
8657
|
function geoStream(object2, stream) {
|
|
@@ -6168,16 +8680,16 @@ function cartesianAddInPlace(a11, b4) {
|
|
|
6168
8680
|
function cartesianScale(vector, k2) {
|
|
6169
8681
|
return [vector[0] * k2, vector[1] * k2, vector[2] * k2];
|
|
6170
8682
|
}
|
|
6171
|
-
function cartesianNormalizeInPlace(
|
|
6172
|
-
var l2 = sqrt(
|
|
6173
|
-
|
|
8683
|
+
function cartesianNormalizeInPlace(d4) {
|
|
8684
|
+
var l2 = sqrt(d4[0] * d4[0] + d4[1] * d4[1] + d4[2] * d4[2]);
|
|
8685
|
+
d4[0] /= l2, d4[1] /= l2, d4[2] /= l2;
|
|
6174
8686
|
}
|
|
6175
8687
|
function compose(a11, b4) {
|
|
6176
|
-
function compose2(
|
|
6177
|
-
return
|
|
8688
|
+
function compose2(x3, y3) {
|
|
8689
|
+
return x3 = a11(x3, y3), b4(x3[0], x3[1]);
|
|
6178
8690
|
}
|
|
6179
|
-
if (a11.invert && b4.invert) compose2.invert = function(
|
|
6180
|
-
return
|
|
8691
|
+
if (a11.invert && b4.invert) compose2.invert = function(x3, y3) {
|
|
8692
|
+
return x3 = b4.invert(x3, y3), x3 && a11.invert(x3[0], x3[1]);
|
|
6181
8693
|
};
|
|
6182
8694
|
return compose2;
|
|
6183
8695
|
}
|
|
@@ -6204,17 +8716,17 @@ function rotationLambda(deltaLambda) {
|
|
|
6204
8716
|
function rotationPhiGamma(deltaPhi, deltaGamma) {
|
|
6205
8717
|
var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
|
|
6206
8718
|
function rotation2(lambda, phi) {
|
|
6207
|
-
var cosPhi = cos(phi),
|
|
8719
|
+
var cosPhi = cos(phi), x3 = cos(lambda) * cosPhi, y3 = sin(lambda) * cosPhi, z3 = sin(phi), k2 = z3 * cosDeltaPhi + x3 * sinDeltaPhi;
|
|
6208
8720
|
return [
|
|
6209
|
-
atan2(y3 * cosDeltaGamma - k2 * sinDeltaGamma,
|
|
8721
|
+
atan2(y3 * cosDeltaGamma - k2 * sinDeltaGamma, x3 * cosDeltaPhi - z3 * sinDeltaPhi),
|
|
6210
8722
|
asin(k2 * cosDeltaGamma + y3 * sinDeltaGamma)
|
|
6211
8723
|
];
|
|
6212
8724
|
}
|
|
6213
8725
|
rotation2.invert = function(lambda, phi) {
|
|
6214
|
-
var cosPhi = cos(phi),
|
|
8726
|
+
var cosPhi = cos(phi), x3 = cos(lambda) * cosPhi, y3 = sin(lambda) * cosPhi, z3 = sin(phi), k2 = z3 * cosDeltaGamma - y3 * sinDeltaGamma;
|
|
6215
8727
|
return [
|
|
6216
|
-
atan2(y3 * cosDeltaGamma +
|
|
6217
|
-
asin(k2 * cosDeltaPhi -
|
|
8728
|
+
atan2(y3 * cosDeltaGamma + z3 * sinDeltaGamma, x3 * cosDeltaPhi + k2 * sinDeltaPhi),
|
|
8729
|
+
asin(k2 * cosDeltaPhi - x3 * sinDeltaPhi)
|
|
6218
8730
|
];
|
|
6219
8731
|
};
|
|
6220
8732
|
return rotation2;
|
|
@@ -6256,8 +8768,8 @@ function circleRadius(cosRadius, point) {
|
|
|
6256
8768
|
function clipBuffer() {
|
|
6257
8769
|
var lines = [], line;
|
|
6258
8770
|
return {
|
|
6259
|
-
point: function(
|
|
6260
|
-
line.push([
|
|
8771
|
+
point: function(x3, y3, m2) {
|
|
8772
|
+
line.push([x3, y3, m2]);
|
|
6261
8773
|
},
|
|
6262
8774
|
lineStart: function() {
|
|
6263
8775
|
lines.push(line = []);
|
|
@@ -6286,30 +8798,30 @@ function Intersection(point, points, other, entry) {
|
|
|
6286
8798
|
this.n = this.p = null;
|
|
6287
8799
|
}
|
|
6288
8800
|
function clipRejoin(segments, compareIntersection2, startInside, interpolate, stream) {
|
|
6289
|
-
var subject = [], clip2 = [],
|
|
8801
|
+
var subject = [], clip2 = [], i4, n2;
|
|
6290
8802
|
segments.forEach(function(segment) {
|
|
6291
8803
|
if ((n3 = segment.length - 1) <= 0) return;
|
|
6292
|
-
var n3, p0 = segment[0], p1 = segment[n3],
|
|
8804
|
+
var n3, p0 = segment[0], p1 = segment[n3], x3;
|
|
6293
8805
|
if (pointEqual(p0, p1)) {
|
|
6294
8806
|
if (!p0[2] && !p1[2]) {
|
|
6295
8807
|
stream.lineStart();
|
|
6296
|
-
for (
|
|
8808
|
+
for (i4 = 0; i4 < n3; ++i4) stream.point((p0 = segment[i4])[0], p0[1]);
|
|
6297
8809
|
stream.lineEnd();
|
|
6298
8810
|
return;
|
|
6299
8811
|
}
|
|
6300
8812
|
p1[0] += 2 * epsilon;
|
|
6301
8813
|
}
|
|
6302
|
-
subject.push(
|
|
6303
|
-
clip2.push(
|
|
6304
|
-
subject.push(
|
|
6305
|
-
clip2.push(
|
|
8814
|
+
subject.push(x3 = new Intersection(p0, segment, null, true));
|
|
8815
|
+
clip2.push(x3.o = new Intersection(p0, null, x3, false));
|
|
8816
|
+
subject.push(x3 = new Intersection(p1, segment, null, false));
|
|
8817
|
+
clip2.push(x3.o = new Intersection(p1, null, x3, true));
|
|
6306
8818
|
});
|
|
6307
8819
|
if (!subject.length) return;
|
|
6308
8820
|
clip2.sort(compareIntersection2);
|
|
6309
8821
|
link(subject);
|
|
6310
8822
|
link(clip2);
|
|
6311
|
-
for (
|
|
6312
|
-
clip2[
|
|
8823
|
+
for (i4 = 0, n2 = clip2.length; i4 < n2; ++i4) {
|
|
8824
|
+
clip2[i4].e = startInside = !startInside;
|
|
6313
8825
|
}
|
|
6314
8826
|
var start = subject[0], points, point;
|
|
6315
8827
|
while (1) {
|
|
@@ -6321,7 +8833,7 @@ function clipRejoin(segments, compareIntersection2, startInside, interpolate, st
|
|
|
6321
8833
|
current.v = current.o.v = true;
|
|
6322
8834
|
if (current.e) {
|
|
6323
8835
|
if (isSubject) {
|
|
6324
|
-
for (
|
|
8836
|
+
for (i4 = 0, n2 = points.length; i4 < n2; ++i4) stream.point((point = points[i4])[0], point[1]);
|
|
6325
8837
|
} else {
|
|
6326
8838
|
interpolate(current.x, current.n.x, 1, stream);
|
|
6327
8839
|
}
|
|
@@ -6329,7 +8841,7 @@ function clipRejoin(segments, compareIntersection2, startInside, interpolate, st
|
|
|
6329
8841
|
} else {
|
|
6330
8842
|
if (isSubject) {
|
|
6331
8843
|
points = current.p.z;
|
|
6332
|
-
for (
|
|
8844
|
+
for (i4 = points.length - 1; i4 >= 0; --i4) stream.point((point = points[i4])[0], point[1]);
|
|
6333
8845
|
} else {
|
|
6334
8846
|
interpolate(current.x, current.p.x, -1, stream);
|
|
6335
8847
|
}
|
|
@@ -6344,9 +8856,9 @@ function clipRejoin(segments, compareIntersection2, startInside, interpolate, st
|
|
|
6344
8856
|
}
|
|
6345
8857
|
function link(array) {
|
|
6346
8858
|
if (!(n2 = array.length)) return;
|
|
6347
|
-
var n2,
|
|
6348
|
-
while (++
|
|
6349
|
-
a11.n = b4 = array[
|
|
8859
|
+
var n2, i4 = 0, a11 = array[0], b4;
|
|
8860
|
+
while (++i4 < n2) {
|
|
8861
|
+
a11.n = b4 = array[i4];
|
|
6350
8862
|
b4.p = a11;
|
|
6351
8863
|
a11 = b4;
|
|
6352
8864
|
}
|
|
@@ -6361,8 +8873,8 @@ function polygonContains(polygon, point) {
|
|
|
6361
8873
|
var sum = new Adder();
|
|
6362
8874
|
if (sinPhi === 1) phi = halfPi + epsilon;
|
|
6363
8875
|
else if (sinPhi === -1) phi = -halfPi - epsilon;
|
|
6364
|
-
for (var
|
|
6365
|
-
if (!(m2 = (ring = polygon[
|
|
8876
|
+
for (var i4 = 0, n2 = polygon.length; i4 < n2; ++i4) {
|
|
8877
|
+
if (!(m2 = (ring = polygon[i4]).length)) continue;
|
|
6366
8878
|
var ring, m2, point0 = ring[m2 - 1], lambda0 = longitude(point0), phi0 = point0[1] / 2 + quarterPi, sinPhi0 = sin(phi0), cosPhi0 = cos(phi0);
|
|
6367
8879
|
for (var j2 = 0; j2 < m2; ++j2, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
|
|
6368
8880
|
var point1 = ring[j2], lambda1 = longitude(point1), phi1 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi1), cosPhi1 = cos(phi1), delta = lambda1 - lambda0, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k2 = sinPhi0 * sinPhi1;
|
|
@@ -6447,7 +8959,7 @@ function clip(pointVisible, clipLine2, interpolate, start) {
|
|
|
6447
8959
|
function ringEnd() {
|
|
6448
8960
|
pointRing(ring[0][0], ring[0][1]);
|
|
6449
8961
|
ringSink.lineEnd();
|
|
6450
|
-
var clean = ringSink.clean(), ringSegments = ringBuffer.result(),
|
|
8962
|
+
var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i4, n2 = ringSegments.length, m2, segment, point2;
|
|
6451
8963
|
ring.pop();
|
|
6452
8964
|
polygon.push(ring);
|
|
6453
8965
|
ring = null;
|
|
@@ -6457,7 +8969,7 @@ function clip(pointVisible, clipLine2, interpolate, start) {
|
|
|
6457
8969
|
if ((m2 = segment.length - 1) > 0) {
|
|
6458
8970
|
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
|
|
6459
8971
|
sink.lineStart();
|
|
6460
|
-
for (
|
|
8972
|
+
for (i4 = 0; i4 < m2; ++i4) sink.point((point2 = segment[i4])[0], point2[1]);
|
|
6461
8973
|
sink.lineEnd();
|
|
6462
8974
|
}
|
|
6463
8975
|
return;
|
|
@@ -6620,18 +9132,18 @@ function clipCircle(radius) {
|
|
|
6620
9132
|
var pa = cartesian(a11), pb = cartesian(b4);
|
|
6621
9133
|
var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
|
|
6622
9134
|
if (!determinant) return !two && a11;
|
|
6623
|
-
var c1 = cr * n2n2 / determinant, c22 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A3 = cartesianScale(n1, c1),
|
|
6624
|
-
cartesianAddInPlace(A3,
|
|
9135
|
+
var c1 = cr * n2n2 / determinant, c22 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A3 = cartesianScale(n1, c1), B4 = cartesianScale(n2, c22);
|
|
9136
|
+
cartesianAddInPlace(A3, B4);
|
|
6625
9137
|
var u3 = n1xn2, w3 = cartesianDot(A3, u3), uu = cartesianDot(u3, u3), t22 = w3 * w3 - uu * (cartesianDot(A3, A3) - 1);
|
|
6626
9138
|
if (t22 < 0) return;
|
|
6627
9139
|
var t3 = sqrt(t22), q2 = cartesianScale(u3, (-w3 - t3) / uu);
|
|
6628
9140
|
cartesianAddInPlace(q2, A3);
|
|
6629
9141
|
q2 = spherical(q2);
|
|
6630
9142
|
if (!two) return q2;
|
|
6631
|
-
var lambda0 = a11[0], lambda1 = b4[0], phi0 = a11[1], phi1 = b4[1],
|
|
6632
|
-
if (lambda1 < lambda0)
|
|
9143
|
+
var lambda0 = a11[0], lambda1 = b4[0], phi0 = a11[1], phi1 = b4[1], z3;
|
|
9144
|
+
if (lambda1 < lambda0) z3 = lambda0, lambda0 = lambda1, lambda1 = z3;
|
|
6633
9145
|
var delta2 = lambda1 - lambda0, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
|
|
6634
|
-
if (!polar && phi1 < phi0)
|
|
9146
|
+
if (!polar && phi1 < phi0) z3 = phi0, phi0 = phi1, phi1 = z3;
|
|
6635
9147
|
if (meridian ? polar ? phi0 + phi1 > 0 ^ q2[1] < (abs(q2[0] - lambda0) < epsilon ? phi0 : phi1) : phi0 <= q2[1] && q2[1] <= phi1 : delta2 > pi ^ (lambda0 <= q2[0] && q2[0] <= lambda1)) {
|
|
6636
9148
|
var q1 = cartesianScale(u3, (-w3 + t3) / uu);
|
|
6637
9149
|
cartesianAddInPlace(q1, A3);
|
|
@@ -6696,8 +9208,8 @@ function clipLine(a11, b4, x02, y02, x12, y12) {
|
|
|
6696
9208
|
}
|
|
6697
9209
|
var clipMax = 1e9, clipMin = -clipMax;
|
|
6698
9210
|
function clipRectangle(x02, y02, x12, y12) {
|
|
6699
|
-
function visible(
|
|
6700
|
-
return x02 <=
|
|
9211
|
+
function visible(x3, y3) {
|
|
9212
|
+
return x02 <= x3 && x3 <= x12 && y02 <= y3 && y3 <= y12;
|
|
6701
9213
|
}
|
|
6702
9214
|
function interpolate(from, to, direction, stream) {
|
|
6703
9215
|
var a11 = 0, a12 = 0;
|
|
@@ -6728,13 +9240,13 @@ function clipRectangle(x02, y02, x12, y12) {
|
|
|
6728
9240
|
polygonStart,
|
|
6729
9241
|
polygonEnd
|
|
6730
9242
|
};
|
|
6731
|
-
function point(
|
|
6732
|
-
if (visible(
|
|
9243
|
+
function point(x3, y3) {
|
|
9244
|
+
if (visible(x3, y3)) activeStream.point(x3, y3);
|
|
6733
9245
|
}
|
|
6734
9246
|
function polygonInside() {
|
|
6735
9247
|
var winding = 0;
|
|
6736
|
-
for (var
|
|
6737
|
-
for (var ring2 = polygon[
|
|
9248
|
+
for (var i4 = 0, n2 = polygon.length; i4 < n2; ++i4) {
|
|
9249
|
+
for (var ring2 = polygon[i4], j2 = 1, m2 = ring2.length, point2 = ring2[0], a02, a12, b0 = point2[0], b1 = point2[1]; j2 < m2; ++j2) {
|
|
6738
9250
|
a02 = b0, a12 = b1, point2 = ring2[j2], b0 = point2[0], b1 = point2[1];
|
|
6739
9251
|
if (a12 <= y12) {
|
|
6740
9252
|
if (b1 > y12 && (b0 - a02) * (y12 - a12) > (b1 - a12) * (x02 - a02)) ++winding;
|
|
@@ -6780,20 +9292,20 @@ function clipRectangle(x02, y02, x12, y12) {
|
|
|
6780
9292
|
clipStream.point = point;
|
|
6781
9293
|
if (v_) activeStream.lineEnd();
|
|
6782
9294
|
}
|
|
6783
|
-
function linePoint(
|
|
6784
|
-
var v3 = visible(
|
|
6785
|
-
if (polygon) ring.push([
|
|
9295
|
+
function linePoint(x3, y3) {
|
|
9296
|
+
var v3 = visible(x3, y3);
|
|
9297
|
+
if (polygon) ring.push([x3, y3]);
|
|
6786
9298
|
if (first) {
|
|
6787
|
-
x__ =
|
|
9299
|
+
x__ = x3, y__ = y3, v__ = v3;
|
|
6788
9300
|
first = false;
|
|
6789
9301
|
if (v3) {
|
|
6790
9302
|
activeStream.lineStart();
|
|
6791
|
-
activeStream.point(
|
|
9303
|
+
activeStream.point(x3, y3);
|
|
6792
9304
|
}
|
|
6793
9305
|
} else {
|
|
6794
|
-
if (v3 && v_) activeStream.point(
|
|
9306
|
+
if (v3 && v_) activeStream.point(x3, y3);
|
|
6795
9307
|
else {
|
|
6796
|
-
var a11 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b4 = [
|
|
9308
|
+
var a11 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b4 = [x3 = Math.max(clipMin, Math.min(clipMax, x3)), y3 = Math.max(clipMin, Math.min(clipMax, y3))];
|
|
6797
9309
|
if (clipLine(a11, b4, x02, y02, x12, y12)) {
|
|
6798
9310
|
if (!v_) {
|
|
6799
9311
|
activeStream.lineStart();
|
|
@@ -6804,17 +9316,17 @@ function clipRectangle(x02, y02, x12, y12) {
|
|
|
6804
9316
|
clean = false;
|
|
6805
9317
|
} else if (v3) {
|
|
6806
9318
|
activeStream.lineStart();
|
|
6807
|
-
activeStream.point(
|
|
9319
|
+
activeStream.point(x3, y3);
|
|
6808
9320
|
clean = false;
|
|
6809
9321
|
}
|
|
6810
9322
|
}
|
|
6811
9323
|
}
|
|
6812
|
-
x_ =
|
|
9324
|
+
x_ = x3, y_ = y3, v_ = v3;
|
|
6813
9325
|
}
|
|
6814
9326
|
return clipStream;
|
|
6815
9327
|
};
|
|
6816
9328
|
}
|
|
6817
|
-
const identity$1 = (
|
|
9329
|
+
const identity$1 = (x3) => x3;
|
|
6818
9330
|
var areaSum = new Adder(), areaRingSum = new Adder(), x00$2, y00$2, x0$3, y0$3;
|
|
6819
9331
|
var areaStream = {
|
|
6820
9332
|
point: noop,
|
|
@@ -6838,13 +9350,13 @@ var areaStream = {
|
|
|
6838
9350
|
function areaRingStart() {
|
|
6839
9351
|
areaStream.point = areaPointFirst;
|
|
6840
9352
|
}
|
|
6841
|
-
function areaPointFirst(
|
|
9353
|
+
function areaPointFirst(x3, y3) {
|
|
6842
9354
|
areaStream.point = areaPoint;
|
|
6843
|
-
x00$2 = x0$3 =
|
|
9355
|
+
x00$2 = x0$3 = x3, y00$2 = y0$3 = y3;
|
|
6844
9356
|
}
|
|
6845
|
-
function areaPoint(
|
|
6846
|
-
areaRingSum.add(y0$3 *
|
|
6847
|
-
x0$3 =
|
|
9357
|
+
function areaPoint(x3, y3) {
|
|
9358
|
+
areaRingSum.add(y0$3 * x3 - x0$3 * y3);
|
|
9359
|
+
x0$3 = x3, y0$3 = y3;
|
|
6848
9360
|
}
|
|
6849
9361
|
function areaRingEnd() {
|
|
6850
9362
|
areaPoint(x00$2, y00$2);
|
|
@@ -6862,13 +9374,13 @@ var boundsStream = {
|
|
|
6862
9374
|
return bounds;
|
|
6863
9375
|
}
|
|
6864
9376
|
};
|
|
6865
|
-
function boundsPoint(
|
|
6866
|
-
if (
|
|
6867
|
-
if (
|
|
9377
|
+
function boundsPoint(x3, y3) {
|
|
9378
|
+
if (x3 < x0$2) x0$2 = x3;
|
|
9379
|
+
if (x3 > x1) x1 = x3;
|
|
6868
9380
|
if (y3 < y0$2) y0$2 = y3;
|
|
6869
9381
|
if (y3 > y1) y1 = y3;
|
|
6870
9382
|
}
|
|
6871
|
-
var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X22 = 0,
|
|
9383
|
+
var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X22 = 0, Y22 = 0, Z22 = 0, x00$1, y00$1, x0$1, y0$1;
|
|
6872
9384
|
var centroidStream = {
|
|
6873
9385
|
point: centroidPoint,
|
|
6874
9386
|
lineStart: centroidLineStart,
|
|
@@ -6883,29 +9395,29 @@ var centroidStream = {
|
|
|
6883
9395
|
centroidStream.lineEnd = centroidLineEnd;
|
|
6884
9396
|
},
|
|
6885
9397
|
result: function() {
|
|
6886
|
-
var centroid =
|
|
6887
|
-
X0 = Y0 = Z0 = X1 = Y1 = Z1 = X22 =
|
|
9398
|
+
var centroid = Z22 ? [X22 / Z22, Y22 / Z22] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
|
|
9399
|
+
X0 = Y0 = Z0 = X1 = Y1 = Z1 = X22 = Y22 = Z22 = 0;
|
|
6888
9400
|
return centroid;
|
|
6889
9401
|
}
|
|
6890
9402
|
};
|
|
6891
|
-
function centroidPoint(
|
|
6892
|
-
X0 +=
|
|
9403
|
+
function centroidPoint(x3, y3) {
|
|
9404
|
+
X0 += x3;
|
|
6893
9405
|
Y0 += y3;
|
|
6894
9406
|
++Z0;
|
|
6895
9407
|
}
|
|
6896
9408
|
function centroidLineStart() {
|
|
6897
9409
|
centroidStream.point = centroidPointFirstLine;
|
|
6898
9410
|
}
|
|
6899
|
-
function centroidPointFirstLine(
|
|
9411
|
+
function centroidPointFirstLine(x3, y3) {
|
|
6900
9412
|
centroidStream.point = centroidPointLine;
|
|
6901
|
-
centroidPoint(x0$1 =
|
|
9413
|
+
centroidPoint(x0$1 = x3, y0$1 = y3);
|
|
6902
9414
|
}
|
|
6903
|
-
function centroidPointLine(
|
|
6904
|
-
var dx =
|
|
6905
|
-
X1 +=
|
|
6906
|
-
Y1 +=
|
|
6907
|
-
Z1 +=
|
|
6908
|
-
centroidPoint(x0$1 =
|
|
9415
|
+
function centroidPointLine(x3, y3) {
|
|
9416
|
+
var dx = x3 - x0$1, dy = y3 - y0$1, z3 = sqrt(dx * dx + dy * dy);
|
|
9417
|
+
X1 += z3 * (x0$1 + x3) / 2;
|
|
9418
|
+
Y1 += z3 * (y0$1 + y3) / 2;
|
|
9419
|
+
Z1 += z3;
|
|
9420
|
+
centroidPoint(x0$1 = x3, y0$1 = y3);
|
|
6909
9421
|
}
|
|
6910
9422
|
function centroidLineEnd() {
|
|
6911
9423
|
centroidStream.point = centroidPoint;
|
|
@@ -6916,28 +9428,28 @@ function centroidRingStart() {
|
|
|
6916
9428
|
function centroidRingEnd() {
|
|
6917
9429
|
centroidPointRing(x00$1, y00$1);
|
|
6918
9430
|
}
|
|
6919
|
-
function centroidPointFirstRing(
|
|
9431
|
+
function centroidPointFirstRing(x3, y3) {
|
|
6920
9432
|
centroidStream.point = centroidPointRing;
|
|
6921
|
-
centroidPoint(x00$1 = x0$1 =
|
|
6922
|
-
}
|
|
6923
|
-
function centroidPointRing(
|
|
6924
|
-
var dx =
|
|
6925
|
-
X1 +=
|
|
6926
|
-
Y1 +=
|
|
6927
|
-
Z1 +=
|
|
6928
|
-
|
|
6929
|
-
X22 +=
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
centroidPoint(x0$1 =
|
|
9433
|
+
centroidPoint(x00$1 = x0$1 = x3, y00$1 = y0$1 = y3);
|
|
9434
|
+
}
|
|
9435
|
+
function centroidPointRing(x3, y3) {
|
|
9436
|
+
var dx = x3 - x0$1, dy = y3 - y0$1, z3 = sqrt(dx * dx + dy * dy);
|
|
9437
|
+
X1 += z3 * (x0$1 + x3) / 2;
|
|
9438
|
+
Y1 += z3 * (y0$1 + y3) / 2;
|
|
9439
|
+
Z1 += z3;
|
|
9440
|
+
z3 = y0$1 * x3 - x0$1 * y3;
|
|
9441
|
+
X22 += z3 * (x0$1 + x3);
|
|
9442
|
+
Y22 += z3 * (y0$1 + y3);
|
|
9443
|
+
Z22 += z3 * 3;
|
|
9444
|
+
centroidPoint(x0$1 = x3, y0$1 = y3);
|
|
6933
9445
|
}
|
|
6934
9446
|
function PathContext(context) {
|
|
6935
9447
|
this._context = context;
|
|
6936
9448
|
}
|
|
6937
9449
|
PathContext.prototype = {
|
|
6938
9450
|
_radius: 4.5,
|
|
6939
|
-
pointRadius: function(
|
|
6940
|
-
return this._radius =
|
|
9451
|
+
pointRadius: function(_3) {
|
|
9452
|
+
return this._radius = _3, this;
|
|
6941
9453
|
},
|
|
6942
9454
|
polygonStart: function() {
|
|
6943
9455
|
this._line = 0;
|
|
@@ -6952,20 +9464,20 @@ PathContext.prototype = {
|
|
|
6952
9464
|
if (this._line === 0) this._context.closePath();
|
|
6953
9465
|
this._point = NaN;
|
|
6954
9466
|
},
|
|
6955
|
-
point: function(
|
|
9467
|
+
point: function(x3, y3) {
|
|
6956
9468
|
switch (this._point) {
|
|
6957
9469
|
case 0: {
|
|
6958
|
-
this._context.moveTo(
|
|
9470
|
+
this._context.moveTo(x3, y3);
|
|
6959
9471
|
this._point = 1;
|
|
6960
9472
|
break;
|
|
6961
9473
|
}
|
|
6962
9474
|
case 1: {
|
|
6963
|
-
this._context.lineTo(
|
|
9475
|
+
this._context.lineTo(x3, y3);
|
|
6964
9476
|
break;
|
|
6965
9477
|
}
|
|
6966
9478
|
default: {
|
|
6967
|
-
this._context.moveTo(
|
|
6968
|
-
this._context.arc(
|
|
9479
|
+
this._context.moveTo(x3 + this._radius, y3);
|
|
9480
|
+
this._context.arc(x3, y3, this._radius, 0, tau);
|
|
6969
9481
|
break;
|
|
6970
9482
|
}
|
|
6971
9483
|
}
|
|
@@ -6994,14 +9506,14 @@ var lengthStream = {
|
|
|
6994
9506
|
return length;
|
|
6995
9507
|
}
|
|
6996
9508
|
};
|
|
6997
|
-
function lengthPointFirst(
|
|
9509
|
+
function lengthPointFirst(x3, y3) {
|
|
6998
9510
|
lengthStream.point = lengthPoint;
|
|
6999
|
-
x00 = x0 =
|
|
9511
|
+
x00 = x0 = x3, y00 = y0 = y3;
|
|
7000
9512
|
}
|
|
7001
|
-
function lengthPoint(
|
|
7002
|
-
x0 -=
|
|
9513
|
+
function lengthPoint(x3, y3) {
|
|
9514
|
+
x0 -= x3, y0 -= y3;
|
|
7003
9515
|
lengthSum.add(sqrt(x0 * x0 + y0 * y0));
|
|
7004
|
-
x0 =
|
|
9516
|
+
x0 = x3, y0 = y3;
|
|
7005
9517
|
}
|
|
7006
9518
|
let cacheDigits, cacheAppend, cacheRadius, cacheCircle;
|
|
7007
9519
|
class PathString {
|
|
@@ -7010,8 +9522,8 @@ class PathString {
|
|
|
7010
9522
|
this._radius = 4.5;
|
|
7011
9523
|
this._ = "";
|
|
7012
9524
|
}
|
|
7013
|
-
pointRadius(
|
|
7014
|
-
this._radius = +
|
|
9525
|
+
pointRadius(_3) {
|
|
9526
|
+
this._radius = +_3;
|
|
7015
9527
|
return this;
|
|
7016
9528
|
}
|
|
7017
9529
|
polygonStart() {
|
|
@@ -7027,19 +9539,19 @@ class PathString {
|
|
|
7027
9539
|
if (this._line === 0) this._ += "Z";
|
|
7028
9540
|
this._point = NaN;
|
|
7029
9541
|
}
|
|
7030
|
-
point(
|
|
9542
|
+
point(x3, y3) {
|
|
7031
9543
|
switch (this._point) {
|
|
7032
9544
|
case 0: {
|
|
7033
|
-
this._append`M${
|
|
9545
|
+
this._append`M${x3},${y3}`;
|
|
7034
9546
|
this._point = 1;
|
|
7035
9547
|
break;
|
|
7036
9548
|
}
|
|
7037
9549
|
case 1: {
|
|
7038
|
-
this._append`L${
|
|
9550
|
+
this._append`L${x3},${y3}`;
|
|
7039
9551
|
break;
|
|
7040
9552
|
}
|
|
7041
9553
|
default: {
|
|
7042
|
-
this._append`M${
|
|
9554
|
+
this._append`M${x3},${y3}`;
|
|
7043
9555
|
if (this._radius !== cacheRadius || this._append !== cacheAppend) {
|
|
7044
9556
|
const r2 = this._radius;
|
|
7045
9557
|
const s2 = this._;
|
|
@@ -7062,24 +9574,24 @@ class PathString {
|
|
|
7062
9574
|
}
|
|
7063
9575
|
}
|
|
7064
9576
|
function append(strings) {
|
|
7065
|
-
let
|
|
9577
|
+
let i4 = 1;
|
|
7066
9578
|
this._ += strings[0];
|
|
7067
|
-
for (const j2 = strings.length;
|
|
7068
|
-
this._ += arguments[
|
|
9579
|
+
for (const j2 = strings.length; i4 < j2; ++i4) {
|
|
9580
|
+
this._ += arguments[i4] + strings[i4];
|
|
7069
9581
|
}
|
|
7070
9582
|
}
|
|
7071
9583
|
function appendRound(digits) {
|
|
7072
|
-
const
|
|
7073
|
-
if (!(
|
|
7074
|
-
if (
|
|
7075
|
-
if (
|
|
7076
|
-
const k2 = 10 **
|
|
7077
|
-
cacheDigits =
|
|
9584
|
+
const d4 = Math.floor(digits);
|
|
9585
|
+
if (!(d4 >= 0)) throw new RangeError(`invalid digits: ${digits}`);
|
|
9586
|
+
if (d4 > 15) return append;
|
|
9587
|
+
if (d4 !== cacheDigits) {
|
|
9588
|
+
const k2 = 10 ** d4;
|
|
9589
|
+
cacheDigits = d4;
|
|
7078
9590
|
cacheAppend = function append2(strings) {
|
|
7079
|
-
let
|
|
9591
|
+
let i4 = 1;
|
|
7080
9592
|
this._ += strings[0];
|
|
7081
|
-
for (const j2 = strings.length;
|
|
7082
|
-
this._ += Math.round(arguments[
|
|
9593
|
+
for (const j2 = strings.length; i4 < j2; ++i4) {
|
|
9594
|
+
this._ += Math.round(arguments[i4] * k2) / k2 + strings[i4];
|
|
7083
9595
|
}
|
|
7084
9596
|
};
|
|
7085
9597
|
}
|
|
@@ -7110,29 +9622,29 @@ function geoPath(projection2, context) {
|
|
|
7110
9622
|
geoStream(object2, projectionStream(centroidStream));
|
|
7111
9623
|
return centroidStream.result();
|
|
7112
9624
|
};
|
|
7113
|
-
path.projection = function(
|
|
9625
|
+
path.projection = function(_3) {
|
|
7114
9626
|
if (!arguments.length) return projection2;
|
|
7115
|
-
projectionStream =
|
|
9627
|
+
projectionStream = _3 == null ? (projection2 = null, identity$1) : (projection2 = _3).stream;
|
|
7116
9628
|
return path;
|
|
7117
9629
|
};
|
|
7118
|
-
path.context = function(
|
|
9630
|
+
path.context = function(_3) {
|
|
7119
9631
|
if (!arguments.length) return context;
|
|
7120
|
-
contextStream =
|
|
9632
|
+
contextStream = _3 == null ? (context = null, new PathString(digits)) : new PathContext(context = _3);
|
|
7121
9633
|
if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
|
|
7122
9634
|
return path;
|
|
7123
9635
|
};
|
|
7124
|
-
path.pointRadius = function(
|
|
9636
|
+
path.pointRadius = function(_3) {
|
|
7125
9637
|
if (!arguments.length) return pointRadius;
|
|
7126
|
-
pointRadius = typeof
|
|
9638
|
+
pointRadius = typeof _3 === "function" ? _3 : (contextStream.pointRadius(+_3), +_3);
|
|
7127
9639
|
return path;
|
|
7128
9640
|
};
|
|
7129
|
-
path.digits = function(
|
|
9641
|
+
path.digits = function(_3) {
|
|
7130
9642
|
if (!arguments.length) return digits;
|
|
7131
|
-
if (
|
|
9643
|
+
if (_3 == null) digits = null;
|
|
7132
9644
|
else {
|
|
7133
|
-
const
|
|
7134
|
-
if (!(
|
|
7135
|
-
digits =
|
|
9645
|
+
const d4 = Math.floor(_3);
|
|
9646
|
+
if (!(d4 >= 0)) throw new RangeError(`invalid digits: ${_3}`);
|
|
9647
|
+
digits = d4;
|
|
7136
9648
|
}
|
|
7137
9649
|
if (context === null) contextStream = new PathString(digits);
|
|
7138
9650
|
return path;
|
|
@@ -7151,8 +9663,8 @@ function TransformStream() {
|
|
|
7151
9663
|
}
|
|
7152
9664
|
TransformStream.prototype = {
|
|
7153
9665
|
constructor: TransformStream,
|
|
7154
|
-
point: function(
|
|
7155
|
-
this.stream.point(
|
|
9666
|
+
point: function(x3, y3) {
|
|
9667
|
+
this.stream.point(x3, y3);
|
|
7156
9668
|
},
|
|
7157
9669
|
sphere: function() {
|
|
7158
9670
|
this.stream.sphere();
|
|
@@ -7181,8 +9693,8 @@ function fit(projection2, fitBounds, object2) {
|
|
|
7181
9693
|
}
|
|
7182
9694
|
function fitExtent(projection2, extent, object2) {
|
|
7183
9695
|
return fit(projection2, function(b4) {
|
|
7184
|
-
var w3 = extent[1][0] - extent[0][0],
|
|
7185
|
-
projection2.scale(150 * k2).translate([
|
|
9696
|
+
var w3 = extent[1][0] - extent[0][0], h3 = extent[1][1] - extent[0][1], k2 = Math.min(w3 / (b4[1][0] - b4[0][0]), h3 / (b4[1][1] - b4[0][1])), x3 = +extent[0][0] + (w3 - k2 * (b4[1][0] + b4[0][0])) / 2, y3 = +extent[0][1] + (h3 - k2 * (b4[1][1] + b4[0][1])) / 2;
|
|
9697
|
+
projection2.scale(150 * k2).translate([x3, y3]);
|
|
7186
9698
|
}, object2);
|
|
7187
9699
|
}
|
|
7188
9700
|
function fitSize(projection2, size, object2) {
|
|
@@ -7190,14 +9702,14 @@ function fitSize(projection2, size, object2) {
|
|
|
7190
9702
|
}
|
|
7191
9703
|
function fitWidth(projection2, width, object2) {
|
|
7192
9704
|
return fit(projection2, function(b4) {
|
|
7193
|
-
var w3 = +width, k2 = w3 / (b4[1][0] - b4[0][0]),
|
|
7194
|
-
projection2.scale(150 * k2).translate([
|
|
9705
|
+
var w3 = +width, k2 = w3 / (b4[1][0] - b4[0][0]), x3 = (w3 - k2 * (b4[1][0] + b4[0][0])) / 2, y3 = -k2 * b4[0][1];
|
|
9706
|
+
projection2.scale(150 * k2).translate([x3, y3]);
|
|
7195
9707
|
}, object2);
|
|
7196
9708
|
}
|
|
7197
9709
|
function fitHeight(projection2, height, object2) {
|
|
7198
9710
|
return fit(projection2, function(b4) {
|
|
7199
|
-
var
|
|
7200
|
-
projection2.scale(150 * k2).translate([
|
|
9711
|
+
var h3 = +height, k2 = h3 / (b4[1][1] - b4[0][1]), x3 = -k2 * b4[0][0], y3 = (h3 - k2 * (b4[1][1] + b4[0][1])) / 2;
|
|
9712
|
+
projection2.scale(150 * k2).translate([x3, y3]);
|
|
7201
9713
|
}, object2);
|
|
7202
9714
|
}
|
|
7203
9715
|
var maxDepth = 16, cosMinDistance = cos(30 * radians);
|
|
@@ -7206,9 +9718,9 @@ function resample(project, delta2) {
|
|
|
7206
9718
|
}
|
|
7207
9719
|
function resampleNone(project) {
|
|
7208
9720
|
return transformer({
|
|
7209
|
-
point: function(
|
|
7210
|
-
|
|
7211
|
-
this.stream.point(
|
|
9721
|
+
point: function(x3, y3) {
|
|
9722
|
+
x3 = project(x3, y3);
|
|
9723
|
+
this.stream.point(x3[0], x3[1]);
|
|
7212
9724
|
}
|
|
7213
9725
|
});
|
|
7214
9726
|
}
|
|
@@ -7216,11 +9728,11 @@ function resample$1(project, delta2) {
|
|
|
7216
9728
|
function resampleLineTo(x02, y02, lambda0, a02, b0, c0, x12, y12, lambda1, a12, b1, c1, depth, stream) {
|
|
7217
9729
|
var dx = x12 - x02, dy = y12 - y02, d22 = dx * dx + dy * dy;
|
|
7218
9730
|
if (d22 > 4 * delta2 && depth--) {
|
|
7219
|
-
var a11 = a02 + a12, b4 = b0 + b1, c3 = c0 + c1, m2 = sqrt(a11 * a11 + b4 * b4 + c3 * c3), phi2 = asin(c3 /= m2), lambda2 = abs(abs(c3) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b4, a11), p4 = project(lambda2, phi2),
|
|
9731
|
+
var a11 = a02 + a12, b4 = b0 + b1, c3 = c0 + c1, m2 = sqrt(a11 * a11 + b4 * b4 + c3 * c3), phi2 = asin(c3 /= m2), lambda2 = abs(abs(c3) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b4, a11), p4 = project(lambda2, phi2), x22 = p4[0], y22 = p4[1], dx2 = x22 - x02, dy2 = y22 - y02, dz = dy * dx2 - dx * dy2;
|
|
7220
9732
|
if (dz * dz / d22 > delta2 || abs((dx * dx2 + dy * dy2) / d22 - 0.5) > 0.3 || a02 * a12 + b0 * b1 + c0 * c1 < cosMinDistance) {
|
|
7221
|
-
resampleLineTo(x02, y02, lambda0, a02, b0, c0,
|
|
7222
|
-
stream.point(
|
|
7223
|
-
resampleLineTo(
|
|
9733
|
+
resampleLineTo(x02, y02, lambda0, a02, b0, c0, x22, y22, lambda2, a11 /= m2, b4 /= m2, c3, depth, stream);
|
|
9734
|
+
stream.point(x22, y22);
|
|
9735
|
+
resampleLineTo(x22, y22, lambda2, a11, b4, c3, x12, y12, lambda1, a12, b1, c1, depth, stream);
|
|
7224
9736
|
}
|
|
7225
9737
|
}
|
|
7226
9738
|
}
|
|
@@ -7239,9 +9751,9 @@ function resample$1(project, delta2) {
|
|
|
7239
9751
|
resampleStream.lineStart = lineStart;
|
|
7240
9752
|
}
|
|
7241
9753
|
};
|
|
7242
|
-
function point(
|
|
7243
|
-
|
|
7244
|
-
stream.point(
|
|
9754
|
+
function point(x3, y3) {
|
|
9755
|
+
x3 = project(x3, y3);
|
|
9756
|
+
stream.point(x3[0], x3[1]);
|
|
7245
9757
|
}
|
|
7246
9758
|
function lineStart() {
|
|
7247
9759
|
x02 = NaN;
|
|
@@ -7275,39 +9787,39 @@ function resample$1(project, delta2) {
|
|
|
7275
9787
|
};
|
|
7276
9788
|
}
|
|
7277
9789
|
var transformRadians = transformer({
|
|
7278
|
-
point: function(
|
|
7279
|
-
this.stream.point(
|
|
9790
|
+
point: function(x3, y3) {
|
|
9791
|
+
this.stream.point(x3 * radians, y3 * radians);
|
|
7280
9792
|
}
|
|
7281
9793
|
});
|
|
7282
9794
|
function transformRotate(rotate) {
|
|
7283
9795
|
return transformer({
|
|
7284
|
-
point: function(
|
|
7285
|
-
var r2 = rotate(
|
|
9796
|
+
point: function(x3, y3) {
|
|
9797
|
+
var r2 = rotate(x3, y3);
|
|
7286
9798
|
return this.stream.point(r2[0], r2[1]);
|
|
7287
9799
|
}
|
|
7288
9800
|
});
|
|
7289
9801
|
}
|
|
7290
9802
|
function scaleTranslate(k2, dx, dy, sx, sy) {
|
|
7291
|
-
function transform2(
|
|
7292
|
-
|
|
9803
|
+
function transform2(x3, y3) {
|
|
9804
|
+
x3 *= sx;
|
|
7293
9805
|
y3 *= sy;
|
|
7294
|
-
return [dx + k2 *
|
|
9806
|
+
return [dx + k2 * x3, dy - k2 * y3];
|
|
7295
9807
|
}
|
|
7296
|
-
transform2.invert = function(
|
|
7297
|
-
return [(
|
|
9808
|
+
transform2.invert = function(x3, y3) {
|
|
9809
|
+
return [(x3 - dx) / k2 * sx, (dy - y3) / k2 * sy];
|
|
7298
9810
|
};
|
|
7299
9811
|
return transform2;
|
|
7300
9812
|
}
|
|
7301
9813
|
function scaleTranslateRotate(k2, dx, dy, sx, sy, alpha) {
|
|
7302
9814
|
if (!alpha) return scaleTranslate(k2, dx, dy, sx, sy);
|
|
7303
9815
|
var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a11 = cosAlpha * k2, b4 = sinAlpha * k2, ai2 = cosAlpha / k2, bi = sinAlpha / k2, ci = (sinAlpha * dy - cosAlpha * dx) / k2, fi = (sinAlpha * dx + cosAlpha * dy) / k2;
|
|
7304
|
-
function transform2(
|
|
7305
|
-
|
|
9816
|
+
function transform2(x3, y3) {
|
|
9817
|
+
x3 *= sx;
|
|
7306
9818
|
y3 *= sy;
|
|
7307
|
-
return [a11 *
|
|
9819
|
+
return [a11 * x3 - b4 * y3 + dx, dy - b4 * x3 - a11 * y3];
|
|
7308
9820
|
}
|
|
7309
|
-
transform2.invert = function(
|
|
7310
|
-
return [sx * (ai2 *
|
|
9821
|
+
transform2.invert = function(x3, y3) {
|
|
9822
|
+
return [sx * (ai2 * x3 - bi * y3 + ci), sy * (fi - bi * x3 - ai2 * y3)];
|
|
7311
9823
|
};
|
|
7312
9824
|
return transform2;
|
|
7313
9825
|
}
|
|
@@ -7317,7 +9829,7 @@ function projection(project) {
|
|
|
7317
9829
|
})();
|
|
7318
9830
|
}
|
|
7319
9831
|
function projectionMutator(projectAt) {
|
|
7320
|
-
var project, k2 = 150,
|
|
9832
|
+
var project, k2 = 150, x3 = 480, y3 = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = clipAntimeridian, x02 = null, y02, x12, y12, postclip = identity$1, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream;
|
|
7321
9833
|
function projection2(point) {
|
|
7322
9834
|
return projectRotateTransform(point[0] * radians, point[1] * radians);
|
|
7323
9835
|
}
|
|
@@ -7328,41 +9840,41 @@ function projectionMutator(projectAt) {
|
|
|
7328
9840
|
projection2.stream = function(stream) {
|
|
7329
9841
|
return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
|
|
7330
9842
|
};
|
|
7331
|
-
projection2.preclip = function(
|
|
7332
|
-
return arguments.length ? (preclip =
|
|
9843
|
+
projection2.preclip = function(_3) {
|
|
9844
|
+
return arguments.length ? (preclip = _3, theta = void 0, reset()) : preclip;
|
|
7333
9845
|
};
|
|
7334
|
-
projection2.postclip = function(
|
|
7335
|
-
return arguments.length ? (postclip =
|
|
9846
|
+
projection2.postclip = function(_3) {
|
|
9847
|
+
return arguments.length ? (postclip = _3, x02 = y02 = x12 = y12 = null, reset()) : postclip;
|
|
7336
9848
|
};
|
|
7337
|
-
projection2.clipAngle = function(
|
|
7338
|
-
return arguments.length ? (preclip = +
|
|
9849
|
+
projection2.clipAngle = function(_3) {
|
|
9850
|
+
return arguments.length ? (preclip = +_3 ? clipCircle(theta = _3 * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees;
|
|
7339
9851
|
};
|
|
7340
|
-
projection2.clipExtent = function(
|
|
7341
|
-
return arguments.length ? (postclip =
|
|
9852
|
+
projection2.clipExtent = function(_3) {
|
|
9853
|
+
return arguments.length ? (postclip = _3 == null ? (x02 = y02 = x12 = y12 = null, identity$1) : clipRectangle(x02 = +_3[0][0], y02 = +_3[0][1], x12 = +_3[1][0], y12 = +_3[1][1]), reset()) : x02 == null ? null : [[x02, y02], [x12, y12]];
|
|
7342
9854
|
};
|
|
7343
|
-
projection2.scale = function(
|
|
7344
|
-
return arguments.length ? (k2 = +
|
|
9855
|
+
projection2.scale = function(_3) {
|
|
9856
|
+
return arguments.length ? (k2 = +_3, recenter()) : k2;
|
|
7345
9857
|
};
|
|
7346
|
-
projection2.translate = function(
|
|
7347
|
-
return arguments.length ? (
|
|
9858
|
+
projection2.translate = function(_3) {
|
|
9859
|
+
return arguments.length ? (x3 = +_3[0], y3 = +_3[1], recenter()) : [x3, y3];
|
|
7348
9860
|
};
|
|
7349
|
-
projection2.center = function(
|
|
7350
|
-
return arguments.length ? (lambda =
|
|
9861
|
+
projection2.center = function(_3) {
|
|
9862
|
+
return arguments.length ? (lambda = _3[0] % 360 * radians, phi = _3[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
|
|
7351
9863
|
};
|
|
7352
|
-
projection2.rotate = function(
|
|
7353
|
-
return arguments.length ? (deltaLambda =
|
|
9864
|
+
projection2.rotate = function(_3) {
|
|
9865
|
+
return arguments.length ? (deltaLambda = _3[0] % 360 * radians, deltaPhi = _3[1] % 360 * radians, deltaGamma = _3.length > 2 ? _3[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
|
|
7354
9866
|
};
|
|
7355
|
-
projection2.angle = function(
|
|
7356
|
-
return arguments.length ? (alpha =
|
|
9867
|
+
projection2.angle = function(_3) {
|
|
9868
|
+
return arguments.length ? (alpha = _3 % 360 * radians, recenter()) : alpha * degrees;
|
|
7357
9869
|
};
|
|
7358
|
-
projection2.reflectX = function(
|
|
7359
|
-
return arguments.length ? (sx =
|
|
9870
|
+
projection2.reflectX = function(_3) {
|
|
9871
|
+
return arguments.length ? (sx = _3 ? -1 : 1, recenter()) : sx < 0;
|
|
7360
9872
|
};
|
|
7361
|
-
projection2.reflectY = function(
|
|
7362
|
-
return arguments.length ? (sy =
|
|
9873
|
+
projection2.reflectY = function(_3) {
|
|
9874
|
+
return arguments.length ? (sy = _3 ? -1 : 1, recenter()) : sy < 0;
|
|
7363
9875
|
};
|
|
7364
|
-
projection2.precision = function(
|
|
7365
|
-
return arguments.length ? (projectResample = resample(projectTransform, delta2 =
|
|
9876
|
+
projection2.precision = function(_3) {
|
|
9877
|
+
return arguments.length ? (projectResample = resample(projectTransform, delta2 = _3 * _3), reset()) : sqrt(delta2);
|
|
7366
9878
|
};
|
|
7367
9879
|
projection2.fitExtent = function(extent, object2) {
|
|
7368
9880
|
return fitExtent(projection2, extent, object2);
|
|
@@ -7377,7 +9889,7 @@ function projectionMutator(projectAt) {
|
|
|
7377
9889
|
return fitHeight(projection2, height, object2);
|
|
7378
9890
|
};
|
|
7379
9891
|
function recenter() {
|
|
7380
|
-
var center = scaleTranslateRotate(k2, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k2,
|
|
9892
|
+
var center = scaleTranslateRotate(k2, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k2, x3 - center[0], y3 - center[1], sx, sy, alpha);
|
|
7381
9893
|
rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
|
|
7382
9894
|
projectTransform = compose(project, transform2);
|
|
7383
9895
|
projectRotateTransform = compose(rotate, projectTransform);
|
|
@@ -7397,25 +9909,25 @@ function projectionMutator(projectAt) {
|
|
|
7397
9909
|
function mercatorRaw(lambda, phi) {
|
|
7398
9910
|
return [lambda, log(tan((halfPi + phi) / 2))];
|
|
7399
9911
|
}
|
|
7400
|
-
mercatorRaw.invert = function(
|
|
7401
|
-
return [
|
|
9912
|
+
mercatorRaw.invert = function(x3, y3) {
|
|
9913
|
+
return [x3, 2 * atan(exp(y3)) - halfPi];
|
|
7402
9914
|
};
|
|
7403
9915
|
function geoMercator() {
|
|
7404
9916
|
return mercatorProjection(mercatorRaw).scale(961 / tau);
|
|
7405
9917
|
}
|
|
7406
9918
|
function mercatorProjection(project) {
|
|
7407
9919
|
var m2 = projection(project), center = m2.center, scale = m2.scale, translate = m2.translate, clipExtent = m2.clipExtent, x02 = null, y02, x12, y12;
|
|
7408
|
-
m2.scale = function(
|
|
7409
|
-
return arguments.length ? (scale(
|
|
9920
|
+
m2.scale = function(_3) {
|
|
9921
|
+
return arguments.length ? (scale(_3), reclip()) : scale();
|
|
7410
9922
|
};
|
|
7411
|
-
m2.translate = function(
|
|
7412
|
-
return arguments.length ? (translate(
|
|
9923
|
+
m2.translate = function(_3) {
|
|
9924
|
+
return arguments.length ? (translate(_3), reclip()) : translate();
|
|
7413
9925
|
};
|
|
7414
|
-
m2.center = function(
|
|
7415
|
-
return arguments.length ? (center(
|
|
9926
|
+
m2.center = function(_3) {
|
|
9927
|
+
return arguments.length ? (center(_3), reclip()) : center();
|
|
7416
9928
|
};
|
|
7417
|
-
m2.clipExtent = function(
|
|
7418
|
-
return arguments.length ? (
|
|
9929
|
+
m2.clipExtent = function(_3) {
|
|
9930
|
+
return arguments.length ? (_3 == null ? x02 = y02 = x12 = y12 = null : (x02 = +_3[0][0], y02 = +_3[0][1], x12 = +_3[1][0], y12 = +_3[1][1]), reclip()) : x02 == null ? null : [[x02, y02], [x12, y12]];
|
|
7419
9931
|
};
|
|
7420
9932
|
function reclip() {
|
|
7421
9933
|
var k2 = pi * scale(), t3 = m2(rotation(m2.rotate()).invert([0, 0]));
|
|
@@ -7423,14 +9935,14 @@ function mercatorProjection(project) {
|
|
|
7423
9935
|
}
|
|
7424
9936
|
return reclip();
|
|
7425
9937
|
}
|
|
7426
|
-
function identity(
|
|
7427
|
-
return
|
|
9938
|
+
function identity(x3) {
|
|
9939
|
+
return x3;
|
|
7428
9940
|
}
|
|
7429
9941
|
function transform(transform2) {
|
|
7430
9942
|
if (transform2 == null) return identity;
|
|
7431
9943
|
var x02, y02, kx = transform2.scale[0], ky = transform2.scale[1], dx = transform2.translate[0], dy = transform2.translate[1];
|
|
7432
|
-
return function(input,
|
|
7433
|
-
if (!
|
|
9944
|
+
return function(input, i4) {
|
|
9945
|
+
if (!i4) x02 = y02 = 0;
|
|
7434
9946
|
var j2 = 2, n2 = input.length, output = new Array(n2);
|
|
7435
9947
|
output[0] = (x02 += input[0]) * kx + dx;
|
|
7436
9948
|
output[1] = (y02 += input[1]) * ky + dy;
|
|
@@ -7439,8 +9951,8 @@ function transform(transform2) {
|
|
|
7439
9951
|
};
|
|
7440
9952
|
}
|
|
7441
9953
|
function reverse(array, n2) {
|
|
7442
|
-
var t3, j2 = array.length,
|
|
7443
|
-
while (
|
|
9954
|
+
var t3, j2 = array.length, i4 = j2 - n2;
|
|
9955
|
+
while (i4 < --j2) t3 = array[i4], array[i4++] = array[j2], array[j2] = t3;
|
|
7444
9956
|
}
|
|
7445
9957
|
function topojsonFeature(topology, o2) {
|
|
7446
9958
|
if (typeof o2 === "string") o2 = topology.objects[o2];
|
|
@@ -7454,19 +9966,19 @@ function feature(topology, o2) {
|
|
|
7454
9966
|
}
|
|
7455
9967
|
function object(topology, o2) {
|
|
7456
9968
|
var transformPoint = transform(topology.transform), arcs = topology.arcs;
|
|
7457
|
-
function arc(
|
|
9969
|
+
function arc(i4, points) {
|
|
7458
9970
|
if (points.length) points.pop();
|
|
7459
|
-
for (var a11 = arcs[
|
|
9971
|
+
for (var a11 = arcs[i4 < 0 ? ~i4 : i4], k2 = 0, n2 = a11.length; k2 < n2; ++k2) {
|
|
7460
9972
|
points.push(transformPoint(a11[k2], k2));
|
|
7461
9973
|
}
|
|
7462
|
-
if (
|
|
9974
|
+
if (i4 < 0) reverse(points, n2);
|
|
7463
9975
|
}
|
|
7464
9976
|
function point(p4) {
|
|
7465
9977
|
return transformPoint(p4);
|
|
7466
9978
|
}
|
|
7467
9979
|
function line(arcs2) {
|
|
7468
9980
|
var points = [];
|
|
7469
|
-
for (var
|
|
9981
|
+
for (var i4 = 0, n2 = arcs2.length; i4 < n2; ++i4) arc(arcs2[i4], points);
|
|
7470
9982
|
if (points.length < 2) points.push(points[0]);
|
|
7471
9983
|
return points;
|
|
7472
9984
|
}
|
|
@@ -7555,11 +10067,11 @@ const choroplethStyles = tv({
|
|
|
7555
10067
|
legendScale: "flex items-center justify-between text-caption-xs text-fg-muted tabular-nums"
|
|
7556
10068
|
}
|
|
7557
10069
|
});
|
|
7558
|
-
function isTopology(
|
|
7559
|
-
return !Array.isArray(
|
|
10070
|
+
function isTopology(g3) {
|
|
10071
|
+
return !Array.isArray(g3) && g3.type === "Topology";
|
|
7560
10072
|
}
|
|
7561
|
-
function isFeatureCollection(
|
|
7562
|
-
return !Array.isArray(
|
|
10073
|
+
function isFeatureCollection(g3) {
|
|
10074
|
+
return !Array.isArray(g3) && g3.type === "FeatureCollection";
|
|
7563
10075
|
}
|
|
7564
10076
|
function normalizeFeatures(geography, topologyObject) {
|
|
7565
10077
|
if (Array.isArray(geography)) return geography;
|
|
@@ -7613,21 +10125,21 @@ const ChoroplethMap = forwardRef(
|
|
|
7613
10125
|
}
|
|
7614
10126
|
);
|
|
7615
10127
|
const pathGen = geoPath(proj);
|
|
7616
|
-
return features.map((
|
|
7617
|
-
feature:
|
|
7618
|
-
d: pathGen(
|
|
10128
|
+
return features.map((f3) => ({
|
|
10129
|
+
feature: f3,
|
|
10130
|
+
d: pathGen(f3) ?? ""
|
|
7619
10131
|
}));
|
|
7620
10132
|
}, [features, projection2, width, height]);
|
|
7621
|
-
const getId = (
|
|
7622
|
-
if (getFeatureId) return getFeatureId(
|
|
7623
|
-
if (
|
|
7624
|
-
const p4 =
|
|
10133
|
+
const getId = (f3) => {
|
|
10134
|
+
if (getFeatureId) return getFeatureId(f3);
|
|
10135
|
+
if (f3.id != null) return f3.id;
|
|
10136
|
+
const p4 = f3.properties ?? {};
|
|
7625
10137
|
return p4.id ?? p4.ID ?? "";
|
|
7626
10138
|
};
|
|
7627
|
-
const getName = (
|
|
7628
|
-
if (getFeatureName) return getFeatureName(
|
|
7629
|
-
const p4 =
|
|
7630
|
-
return String(p4.name ?? p4.nome ?? p4.NOME ?? p4.Name ?? getId(
|
|
10139
|
+
const getName = (f3) => {
|
|
10140
|
+
if (getFeatureName) return getFeatureName(f3);
|
|
10141
|
+
const p4 = f3.properties ?? {};
|
|
10142
|
+
return String(p4.name ?? p4.nome ?? p4.NOME ?? p4.Name ?? getId(f3));
|
|
7631
10143
|
};
|
|
7632
10144
|
const numeric = Object.values(values).filter(
|
|
7633
10145
|
(v3) => typeof v3 === "number" && Number.isFinite(v3)
|
|
@@ -7661,26 +10173,26 @@ const ChoroplethMap = forwardRef(
|
|
|
7661
10173
|
role: "img",
|
|
7662
10174
|
"aria-label": ariaLabel,
|
|
7663
10175
|
onMouseLeave: () => setHover(null),
|
|
7664
|
-
onMouseMove: (
|
|
7665
|
-
const r2 =
|
|
10176
|
+
onMouseMove: (e3) => {
|
|
10177
|
+
const r2 = e3.currentTarget.getBoundingClientRect();
|
|
7666
10178
|
setPos({
|
|
7667
|
-
ax: (
|
|
7668
|
-
ay: (
|
|
10179
|
+
ax: (e3.clientX - r2.left) / r2.width * 100,
|
|
10180
|
+
ay: (e3.clientY - r2.top) / r2.height * 100
|
|
7669
10181
|
});
|
|
7670
10182
|
},
|
|
7671
10183
|
children: [
|
|
7672
|
-
geometry.map(({ feature: feature2, d:
|
|
10184
|
+
geometry.map(({ feature: feature2, d: d4 }, index) => {
|
|
7673
10185
|
const id = getId(feature2);
|
|
7674
10186
|
const value = values[id];
|
|
7675
10187
|
return /* @__PURE__ */ jsx(
|
|
7676
10188
|
"path",
|
|
7677
10189
|
{
|
|
7678
|
-
d:
|
|
10190
|
+
d: d4,
|
|
7679
10191
|
fill: fillFor(value),
|
|
7680
10192
|
strokeWidth,
|
|
7681
10193
|
className: styles2.path(),
|
|
7682
10194
|
style: onFeatureClick ? { cursor: "pointer" } : void 0,
|
|
7683
|
-
onMouseEnter: () => setHover({ id, name: getName(feature2), value, feature: feature2, d:
|
|
10195
|
+
onMouseEnter: () => setHover({ id, name: getName(feature2), value, feature: feature2, d: d4 }),
|
|
7684
10196
|
onClick: onFeatureClick ? () => onFeatureClick({
|
|
7685
10197
|
id,
|
|
7686
10198
|
name: getName(feature2),
|
|
@@ -7693,7 +10205,7 @@ const ChoroplethMap = forwardRef(
|
|
|
7693
10205
|
}),
|
|
7694
10206
|
selectedId != null && (() => {
|
|
7695
10207
|
const sel = geometry.find(
|
|
7696
|
-
(
|
|
10208
|
+
(g3) => getId(g3.feature) === selectedId
|
|
7697
10209
|
);
|
|
7698
10210
|
return sel ? /* @__PURE__ */ jsx(
|
|
7699
10211
|
"path",
|
|
@@ -8031,13 +10543,13 @@ function applyFilterModel(items, model, fieldsById) {
|
|
|
8031
10543
|
const field = fieldsById.get(fieldId);
|
|
8032
10544
|
if (!field) return true;
|
|
8033
10545
|
const val = field.accessor(item);
|
|
8034
|
-
const anyOf = group.filter((
|
|
8035
|
-
const noneOf = group.filter((
|
|
8036
|
-
const scalar = group.filter((
|
|
10546
|
+
const anyOf = group.filter((g3) => g3.operator === "isAnyOf").map((g3) => g3.value);
|
|
10547
|
+
const noneOf = group.filter((g3) => g3.operator === "isNoneOf").map((g3) => g3.value);
|
|
10548
|
+
const scalar = group.filter((g3) => g3.operator !== "isAnyOf" && g3.operator !== "isNoneOf");
|
|
8037
10549
|
if (anyOf.length && !anyOf.some((v3) => matchOp("equals", val, v3))) return false;
|
|
8038
10550
|
if (noneOf.length && noneOf.some((v3) => matchOp("equals", val, v3))) return false;
|
|
8039
|
-
for (const
|
|
8040
|
-
if (!matchOp(
|
|
10551
|
+
for (const g3 of scalar) {
|
|
10552
|
+
if (!matchOp(g3.operator, val, g3.value)) return false;
|
|
8041
10553
|
}
|
|
8042
10554
|
return true;
|
|
8043
10555
|
};
|
|
@@ -8145,10 +10657,10 @@ function useDataList({
|
|
|
8145
10657
|
}, []);
|
|
8146
10658
|
const fieldsById = useMemo(() => {
|
|
8147
10659
|
const m2 = /* @__PURE__ */ new Map();
|
|
8148
|
-
for (const
|
|
10660
|
+
for (const f3 of filterFields ?? []) m2.set(f3.id, f3);
|
|
8149
10661
|
return m2;
|
|
8150
10662
|
}, [filterFields]);
|
|
8151
|
-
const
|
|
10663
|
+
const matchesSearch2 = useCallback(
|
|
8152
10664
|
(item) => {
|
|
8153
10665
|
const s2 = query.search.trim().toLowerCase();
|
|
8154
10666
|
if (!s2) return true;
|
|
@@ -8156,7 +10668,7 @@ function useDataList({
|
|
|
8156
10668
|
asText(item.title),
|
|
8157
10669
|
asText(item.subtitle),
|
|
8158
10670
|
asText(item.description),
|
|
8159
|
-
...(filterFields ?? []).map((
|
|
10671
|
+
...(filterFields ?? []).map((f3) => asText(f3.accessor(item)))
|
|
8160
10672
|
].join(" ").toLowerCase();
|
|
8161
10673
|
return hay.includes(s2);
|
|
8162
10674
|
},
|
|
@@ -8164,9 +10676,9 @@ function useDataList({
|
|
|
8164
10676
|
);
|
|
8165
10677
|
const processedItems = useMemo(() => {
|
|
8166
10678
|
if (mode === "server") return items;
|
|
8167
|
-
const searched = query.search ? items.filter(
|
|
10679
|
+
const searched = query.search ? items.filter(matchesSearch2) : items;
|
|
8168
10680
|
return applyFilterModel(searched, query.filterModel, fieldsById);
|
|
8169
|
-
}, [mode, items, query.search, query.filterModel,
|
|
10681
|
+
}, [mode, items, query.search, query.filterModel, matchesSearch2, fieldsById]);
|
|
8170
10682
|
return {
|
|
8171
10683
|
query,
|
|
8172
10684
|
activeViewId,
|
|
@@ -8186,12 +10698,12 @@ function useDataList({
|
|
|
8186
10698
|
}
|
|
8187
10699
|
const ALL_VIEW_ID = "__all__";
|
|
8188
10700
|
function toColumns(fields) {
|
|
8189
|
-
return fields.map((
|
|
8190
|
-
key:
|
|
8191
|
-
label:
|
|
8192
|
-
filterType:
|
|
8193
|
-
type:
|
|
8194
|
-
options:
|
|
10701
|
+
return fields.map((f3) => ({
|
|
10702
|
+
key: f3.id,
|
|
10703
|
+
label: f3.label,
|
|
10704
|
+
filterType: f3.type,
|
|
10705
|
+
type: f3.type === "select" ? "select" : f3.type === "number" ? "number" : "text",
|
|
10706
|
+
options: f3.options
|
|
8195
10707
|
}));
|
|
8196
10708
|
}
|
|
8197
10709
|
function toAppliedFilters(model, fieldsById) {
|
|
@@ -8254,7 +10766,7 @@ function DataListToolbar({
|
|
|
8254
10766
|
const columns = useMemo(() => toColumns(filterFields ?? []), [filterFields]);
|
|
8255
10767
|
const fieldsById = useMemo(() => {
|
|
8256
10768
|
const m2 = /* @__PURE__ */ new Map();
|
|
8257
|
-
for (const
|
|
10769
|
+
for (const f3 of filterFields ?? []) m2.set(f3.id, f3);
|
|
8258
10770
|
return m2;
|
|
8259
10771
|
}, [filterFields]);
|
|
8260
10772
|
const appliedFilters = useMemo(
|
|
@@ -8266,7 +10778,7 @@ function DataListToolbar({
|
|
|
8266
10778
|
const isEmptyVal2 = (v3) => v3 == null || v3 === "" || Array.isArray(v3) && v3.length === 0;
|
|
8267
10779
|
const setGroupValue = (field, operator, value) => {
|
|
8268
10780
|
const rest = filterModel.items.filter(
|
|
8269
|
-
(
|
|
10781
|
+
(i4) => !(i4.field === field && i4.operator === operator)
|
|
8270
10782
|
);
|
|
8271
10783
|
const next = isEmptyVal2(value) ? rest : [
|
|
8272
10784
|
...rest,
|
|
@@ -8279,8 +10791,8 @@ function DataListToolbar({
|
|
|
8279
10791
|
];
|
|
8280
10792
|
onFilterModelChange({ ...filterModel, items: next });
|
|
8281
10793
|
};
|
|
8282
|
-
const renderEditableChip = (
|
|
8283
|
-
const [field, operator] =
|
|
10794
|
+
const renderEditableChip = (f3, defaultChip) => {
|
|
10795
|
+
const [field, operator] = f3.id.split("|");
|
|
8284
10796
|
const fieldDef = fieldsById.get(field);
|
|
8285
10797
|
if (!fieldDef) return defaultChip;
|
|
8286
10798
|
const isMulti = operator === "isAnyOf" || operator === "isNoneOf";
|
|
@@ -8288,16 +10800,16 @@ function DataListToolbar({
|
|
|
8288
10800
|
const regType = isMulti ? "multiSelect" : fieldDef.type;
|
|
8289
10801
|
const def = columnTypeRegistry.get(regType);
|
|
8290
10802
|
const groupItems = filterModel.items.filter(
|
|
8291
|
-
(
|
|
10803
|
+
(i4) => i4.field === field && i4.operator === operator
|
|
8292
10804
|
);
|
|
8293
10805
|
const currentValue = isTuple ? groupItems[0]?.value : isMulti ? groupItems.flatMap(
|
|
8294
|
-
(
|
|
10806
|
+
(i4) => Array.isArray(i4.value) ? i4.value : i4.value != null ? [i4.value] : []
|
|
8295
10807
|
) : groupItems[0]?.value;
|
|
8296
10808
|
return /* @__PURE__ */ jsxs(
|
|
8297
10809
|
Popover,
|
|
8298
10810
|
{
|
|
8299
|
-
open: openChipKey ===
|
|
8300
|
-
onOpenChange: (o2) => setOpenChipKey(o2 ?
|
|
10811
|
+
open: openChipKey === f3.id,
|
|
10812
|
+
onOpenChange: (o2) => setOpenChipKey(o2 ? f3.id : null),
|
|
8301
10813
|
children: [
|
|
8302
10814
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: defaultChip }),
|
|
8303
10815
|
/* @__PURE__ */ jsx(PopoverContent, { align: "start", className: "p-0", children: def.renderFastFilterInput({
|
|
@@ -8333,7 +10845,7 @@ function DataListToolbar({
|
|
|
8333
10845
|
onFilterModelChange({
|
|
8334
10846
|
...filterModel,
|
|
8335
10847
|
items: filterModel.items.filter(
|
|
8336
|
-
(
|
|
10848
|
+
(i4) => !(i4.field === field && i4.operator === operator)
|
|
8337
10849
|
)
|
|
8338
10850
|
});
|
|
8339
10851
|
};
|
|
@@ -8356,7 +10868,7 @@ function DataListToolbar({
|
|
|
8356
10868
|
{
|
|
8357
10869
|
value: search,
|
|
8358
10870
|
placeholder: searchPlaceholder ?? "Buscar...",
|
|
8359
|
-
onChange: (
|
|
10871
|
+
onChange: (e3) => onSearch(e3.target.value)
|
|
8360
10872
|
}
|
|
8361
10873
|
) : void 0,
|
|
8362
10874
|
filter: filterFields && filterFields.length > 0 ? /* @__PURE__ */ jsx(
|
|
@@ -8378,7 +10890,7 @@ function DataListToolbar({
|
|
|
8378
10890
|
}
|
|
8379
10891
|
) }),
|
|
8380
10892
|
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", sideOffset: 4, children: moreActions.map(
|
|
8381
|
-
(a11,
|
|
10893
|
+
(a11, i4) => a11.separator ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, `s${i4}`) : /* @__PURE__ */ jsxs(
|
|
8382
10894
|
DropdownMenuItem,
|
|
8383
10895
|
{
|
|
8384
10896
|
variant: a11.destructive ? "destructive" : "default",
|
|
@@ -8389,7 +10901,7 @@ function DataListToolbar({
|
|
|
8389
10901
|
a11.label
|
|
8390
10902
|
]
|
|
8391
10903
|
},
|
|
8392
|
-
a11.label?.toString() ??
|
|
10904
|
+
a11.label?.toString() ?? i4
|
|
8393
10905
|
)
|
|
8394
10906
|
) })
|
|
8395
10907
|
] }) : void 0
|
|
@@ -8402,7 +10914,7 @@ function DataListToolbar({
|
|
|
8402
10914
|
onRemove: removeFilter,
|
|
8403
10915
|
onClearAll: () => onFilterModelChange({ ...filterModel, items: [] }),
|
|
8404
10916
|
separator: false,
|
|
8405
|
-
renderChip: (
|
|
10917
|
+
renderChip: (f3, defaultChip) => renderEditableChip(f3, defaultChip)
|
|
8406
10918
|
}
|
|
8407
10919
|
),
|
|
8408
10920
|
filterFields && filterFields.length > 0 && /* @__PURE__ */ jsx(
|
|
@@ -8480,7 +10992,7 @@ function DataListVirtualized({
|
|
|
8480
10992
|
}) }) });
|
|
8481
10993
|
}
|
|
8482
10994
|
function DataListSkeleton({ count = 3 }) {
|
|
8483
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-gp-lg", "aria-hidden": "true", children: Array.from({ length: count }).map((
|
|
10995
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-gp-lg", "aria-hidden": "true", children: Array.from({ length: count }).map((_3, i4) => /* @__PURE__ */ jsxs(
|
|
8484
10996
|
"div",
|
|
8485
10997
|
{
|
|
8486
10998
|
className: "w-full p-pad-xl bg-bg-surface border border-border-subtle dark:border-border-default rounded-radius-lg",
|
|
@@ -8489,7 +11001,7 @@ function DataListSkeleton({ count = 3 }) {
|
|
|
8489
11001
|
/* @__PURE__ */ jsx("div", { className: cn("h-[12px] rounded-radius-full bg-bg-muted animate-pulse", "w-2/3") })
|
|
8490
11002
|
]
|
|
8491
11003
|
},
|
|
8492
|
-
|
|
11004
|
+
i4
|
|
8493
11005
|
)) });
|
|
8494
11006
|
}
|
|
8495
11007
|
function DataListInfinite({
|
|
@@ -8610,7 +11122,7 @@ function DataList(props) {
|
|
|
8610
11122
|
getMenuItems
|
|
8611
11123
|
}
|
|
8612
11124
|
) : /* @__PURE__ */ jsx(
|
|
8613
|
-
List,
|
|
11125
|
+
List$1,
|
|
8614
11126
|
{
|
|
8615
11127
|
layout,
|
|
8616
11128
|
items: ctrl.processedItems,
|
|
@@ -8683,7 +11195,7 @@ function DataList(props) {
|
|
|
8683
11195
|
" selecionado(s)"
|
|
8684
11196
|
] }),
|
|
8685
11197
|
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-gp-sm", children: [
|
|
8686
|
-
bulkActions.map((a11,
|
|
11198
|
+
bulkActions.map((a11, i4) => /* @__PURE__ */ jsx(
|
|
8687
11199
|
Button,
|
|
8688
11200
|
{
|
|
8689
11201
|
size: "sm",
|
|
@@ -8693,7 +11205,7 @@ function DataList(props) {
|
|
|
8693
11205
|
onClick: () => a11.onClick(ctrl.selected),
|
|
8694
11206
|
children: a11.label
|
|
8695
11207
|
},
|
|
8696
|
-
|
|
11208
|
+
i4
|
|
8697
11209
|
)),
|
|
8698
11210
|
/* @__PURE__ */ jsx(
|
|
8699
11211
|
Button,
|
|
@@ -8799,7 +11311,7 @@ function ToastCard({
|
|
|
8799
11311
|
variant: "ghost",
|
|
8800
11312
|
size: "icon-2xs",
|
|
8801
11313
|
"aria-label": "Fechar",
|
|
8802
|
-
iconLeft: /* @__PURE__ */ jsx(
|
|
11314
|
+
iconLeft: /* @__PURE__ */ jsx(X3, {}),
|
|
8803
11315
|
onClick: handleClose
|
|
8804
11316
|
}
|
|
8805
11317
|
)
|
|
@@ -8876,13 +11388,13 @@ function useBrand(options) {
|
|
|
8876
11388
|
useEffect(() => {
|
|
8877
11389
|
if (typeof window === "undefined") return;
|
|
8878
11390
|
const valido = (v3) => typeof v3 === "string" && ids.split(",").includes(v3);
|
|
8879
|
-
const onCustom = (
|
|
8880
|
-
const next =
|
|
11391
|
+
const onCustom = (e3) => {
|
|
11392
|
+
const next = e3.detail;
|
|
8881
11393
|
if (valido(next)) setBrandState(next);
|
|
8882
11394
|
};
|
|
8883
|
-
const onStorage = (
|
|
8884
|
-
if (
|
|
8885
|
-
if (valido(
|
|
11395
|
+
const onStorage = (e3) => {
|
|
11396
|
+
if (e3.key !== STORAGE_KEY) return;
|
|
11397
|
+
if (valido(e3.newValue)) setBrandState(e3.newValue);
|
|
8886
11398
|
};
|
|
8887
11399
|
window.addEventListener(CHANGE_EVENT, onCustom);
|
|
8888
11400
|
window.addEventListener("storage", onStorage);
|
|
@@ -8893,8 +11405,8 @@ function useBrand(options) {
|
|
|
8893
11405
|
}, [ids]);
|
|
8894
11406
|
const toggle = useCallback(() => {
|
|
8895
11407
|
const lista = ids.split(",");
|
|
8896
|
-
const
|
|
8897
|
-
setBrand(lista[(
|
|
11408
|
+
const i4 = lista.indexOf(brand);
|
|
11409
|
+
setBrand(lista[(i4 + 1) % lista.length] ?? fallback);
|
|
8898
11410
|
}, [brand, ids, setBrand, fallback]);
|
|
8899
11411
|
const current = useMemo(
|
|
8900
11412
|
() => brands.find((b4) => b4.id === brand) ?? brands[0],
|
|
@@ -8909,7 +11421,15 @@ export {
|
|
|
8909
11421
|
Avatar,
|
|
8910
11422
|
u as AvatarGroup,
|
|
8911
11423
|
BRANDS,
|
|
8912
|
-
|
|
11424
|
+
B3 as Badge,
|
|
11425
|
+
B2 as Breadcrumb,
|
|
11426
|
+
d3 as BreadcrumbEllipsis,
|
|
11427
|
+
e2 as BreadcrumbItem,
|
|
11428
|
+
f2 as BreadcrumbLink,
|
|
11429
|
+
g2 as BreadcrumbList,
|
|
11430
|
+
h2 as BreadcrumbPage,
|
|
11431
|
+
i2 as BreadcrumbSeparator,
|
|
11432
|
+
c2 as BreadcrumbSwitcher,
|
|
8913
11433
|
B as BulkActionButton,
|
|
8914
11434
|
v as BulkActionsBar,
|
|
8915
11435
|
Button,
|
|
@@ -8963,24 +11483,24 @@ export {
|
|
|
8963
11483
|
V as FormFieldSwitch,
|
|
8964
11484
|
c as FormFieldTextarea,
|
|
8965
11485
|
H2 as Header,
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
11486
|
+
d2 as HeaderBreadcrumb,
|
|
11487
|
+
e as HeaderMessages,
|
|
11488
|
+
f as HeaderNotifications,
|
|
11489
|
+
g as HeaderSearch,
|
|
11490
|
+
h as HeaderThemeSwitcher,
|
|
8971
11491
|
Icon,
|
|
8972
11492
|
Input,
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
11493
|
+
W2 as InputGroup,
|
|
11494
|
+
X2 as InputGroupAddon,
|
|
11495
|
+
Y2 as InputGroupButton,
|
|
11496
|
+
Z2 as InputGroupInput,
|
|
11497
|
+
_2 as InputGroupText,
|
|
11498
|
+
$2 as InputGroupTextarea,
|
|
8979
11499
|
W as Kanban,
|
|
8980
11500
|
a10 as Kpi,
|
|
8981
11501
|
b3 as KpiDelta,
|
|
8982
11502
|
K2 as KpiGroup,
|
|
8983
|
-
List,
|
|
11503
|
+
List$1 as List,
|
|
8984
11504
|
ListItem,
|
|
8985
11505
|
MarkdownText,
|
|
8986
11506
|
M2 as MenuSidebar,
|
|
@@ -8992,31 +11512,33 @@ export {
|
|
|
8992
11512
|
Modal,
|
|
8993
11513
|
MonthYearPicker,
|
|
8994
11514
|
X as MoreMenu,
|
|
8995
|
-
|
|
11515
|
+
I2 as MoreMenuCheckboxItem,
|
|
8996
11516
|
DropdownMenuItem as MoreMenuItem,
|
|
8997
11517
|
DropdownMenuLabel as MoreMenuLabel,
|
|
8998
|
-
|
|
8999
|
-
|
|
11518
|
+
DropdownMenuRadioGroup as MoreMenuRadioGroup,
|
|
11519
|
+
DropdownMenuRadioItem as MoreMenuRadioItem,
|
|
9000
11520
|
DropdownMenuSeparator as MoreMenuSeparator,
|
|
9001
|
-
|
|
11521
|
+
P2 as PageHeader,
|
|
9002
11522
|
P as Panel,
|
|
9003
11523
|
Y as PanelBody,
|
|
9004
11524
|
G2 as PanelCloseAction,
|
|
9005
|
-
|
|
11525
|
+
H3 as PanelContent,
|
|
9006
11526
|
Z as PanelFooter,
|
|
9007
11527
|
_ as PanelHeader,
|
|
9008
11528
|
F2 as PanelRoot,
|
|
9009
11529
|
O2 as PanelTrigger,
|
|
9010
11530
|
$ as SELECTION_COLUMN_WIDTH,
|
|
11531
|
+
Scheduler,
|
|
11532
|
+
SchedulerFilterPanel,
|
|
9011
11533
|
ScreenLoader,
|
|
9012
11534
|
S2 as SidebarBrandIcon,
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
11535
|
+
i as SidebarItem,
|
|
11536
|
+
j as SidebarPanel,
|
|
11537
|
+
k as SidebarPill,
|
|
11538
|
+
l as SidebarRail,
|
|
11539
|
+
m as SidebarSection,
|
|
11540
|
+
n as SidebarSubgroup,
|
|
11541
|
+
o as SingleMenuSidebar,
|
|
9020
11542
|
a0 as SortPanel,
|
|
9021
11543
|
a1 as SortPopover,
|
|
9022
11544
|
Spinner,
|
|
@@ -9059,13 +11581,15 @@ export {
|
|
|
9059
11581
|
ag as avatarGroupItem,
|
|
9060
11582
|
ah as avatarGroupRoot,
|
|
9061
11583
|
ai as avatarVariants,
|
|
9062
|
-
|
|
9063
|
-
|
|
11584
|
+
aC as badgeVariants,
|
|
11585
|
+
p2 as breadcrumbCaminho,
|
|
11586
|
+
q as breadcrumbSwitcher,
|
|
11587
|
+
ag2 as buttonVariants,
|
|
9064
11588
|
cardCheckbox,
|
|
9065
11589
|
cardOption,
|
|
9066
11590
|
cardOptionGroup,
|
|
9067
|
-
|
|
9068
|
-
|
|
11591
|
+
r as chipCount,
|
|
11592
|
+
s as chipVariants,
|
|
9069
11593
|
colorPickerStyles,
|
|
9070
11594
|
columnTypeRegistry,
|
|
9071
11595
|
conversationListItemStyles,
|
|
@@ -9078,12 +11602,12 @@ export {
|
|
|
9078
11602
|
aj as floatingPanelStyles,
|
|
9079
11603
|
iconStyles,
|
|
9080
11604
|
icons,
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
11605
|
+
ad2 as inputGroupVariants,
|
|
11606
|
+
i3 as inputVariants,
|
|
11607
|
+
t2 as isExternalHref,
|
|
9084
11608
|
isFilterEntryActive,
|
|
9085
|
-
|
|
9086
|
-
|
|
11609
|
+
v2 as isHashHref,
|
|
11610
|
+
w2 as isModifiedClick,
|
|
9087
11611
|
markdownTextStyles,
|
|
9088
11612
|
messageAckStyles,
|
|
9089
11613
|
messageBubbleStyles,
|
|
@@ -9095,7 +11619,7 @@ export {
|
|
|
9095
11619
|
phoneColumn,
|
|
9096
11620
|
p as presetView,
|
|
9097
11621
|
al as savedViewsMockService,
|
|
9098
|
-
|
|
11622
|
+
x2 as shouldPreventNavigation,
|
|
9099
11623
|
statusColumn,
|
|
9100
11624
|
tabsNavigationAcao,
|
|
9101
11625
|
tabsNavigationAcoes,
|
|
@@ -9112,10 +11636,10 @@ export {
|
|
|
9112
11636
|
useChart,
|
|
9113
11637
|
am as useColumnResize,
|
|
9114
11638
|
an as useColumnWidths,
|
|
9115
|
-
|
|
11639
|
+
y2 as useControllable,
|
|
9116
11640
|
ao as useDataTableContext,
|
|
9117
11641
|
ap as useFloatingPanelResize,
|
|
9118
|
-
|
|
11642
|
+
z2 as useMediaQuery,
|
|
9119
11643
|
u2 as useTheme,
|
|
9120
11644
|
useToolbarFilterControl,
|
|
9121
11645
|
useToolbarFilters,
|