@snksergio/design-system 0.35.0 → 0.37.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/README.md +58 -12
- package/dist-lib/chunks/avatar-CIHTveDJ.mjs +1177 -0
- package/dist-lib/chunks/avatar-CIHTveDJ.mjs.map +1 -0
- package/dist-lib/chunks/avatar-YpqQgJnh.cjs +1196 -0
- package/dist-lib/chunks/avatar-YpqQgJnh.cjs.map +1 -0
- package/dist-lib/chunks/{input-CizzMZ20.cjs → input-CJnonz-G.cjs} +3 -3
- package/dist-lib/chunks/{input-CizzMZ20.cjs.map → input-CJnonz-G.cjs.map} +1 -1
- package/dist-lib/chunks/{input-Cym0k4ZI.mjs → input-jLoO8t0I.mjs} +2 -2
- package/dist-lib/chunks/{input-Cym0k4ZI.mjs.map → input-jLoO8t0I.mjs.map} +1 -1
- package/dist-lib/chunks/{kpi-delta-FhfuIg27.mjs → kpi-delta-D0g2YzDy.mjs} +3 -2
- package/dist-lib/chunks/{kpi-delta-FhfuIg27.mjs.map → kpi-delta-D0g2YzDy.mjs.map} +1 -1
- package/dist-lib/chunks/{kpi-delta-DrSJPMCY.cjs → kpi-delta-D6cLnCqW.cjs} +8 -7
- package/dist-lib/chunks/{kpi-delta-DrSJPMCY.cjs.map → kpi-delta-D6cLnCqW.cjs.map} +1 -1
- package/dist-lib/chunks/{page-header-BMzUloFi.cjs → page-header-DSTprenz.cjs} +4 -4
- package/dist-lib/chunks/{page-header-BMzUloFi.cjs.map → page-header-DSTprenz.cjs.map} +1 -1
- package/dist-lib/chunks/{page-header-Buh6YlQM.mjs → page-header-Deb1excS.mjs} +2 -2
- package/dist-lib/chunks/{page-header-Buh6YlQM.mjs.map → page-header-Deb1excS.mjs.map} +1 -1
- package/dist-lib/chunks/{panel-Cdl0GPVE.mjs → panel-Cid3m9zb.mjs} +370 -9823
- package/dist-lib/chunks/panel-Cid3m9zb.mjs.map +1 -0
- package/dist-lib/chunks/{panel-DlyaLunw.cjs → panel-DLcD8LhW.cjs} +595 -10052
- package/dist-lib/chunks/panel-DLcD8LhW.cjs.map +1 -0
- package/dist-lib/chunks/textarea-BDJRaL5h.mjs +781 -0
- package/dist-lib/chunks/textarea-BDJRaL5h.mjs.map +1 -0
- package/dist-lib/chunks/textarea-Bxl9Voe8.cjs +802 -0
- package/dist-lib/chunks/textarea-Bxl9Voe8.cjs.map +1 -0
- package/dist-lib/chunks/tooltip-DGI3hDFM.mjs +1452 -0
- package/dist-lib/chunks/tooltip-DGI3hDFM.mjs.map +1 -0
- package/dist-lib/chunks/tooltip-vLUyJ0h5.cjs +1484 -0
- package/dist-lib/chunks/tooltip-vLUyJ0h5.cjs.map +1 -0
- package/dist-lib/chunks/{useTheme-D4alxxGV.cjs → useTheme-DQ7FaHdv.cjs} +170 -1282
- package/dist-lib/chunks/useTheme-DQ7FaHdv.cjs.map +1 -0
- package/dist-lib/chunks/{useTheme-DF2xbSdI.mjs → useTheme-UrerJ3i-.mjs} +26 -1134
- package/dist-lib/chunks/useTheme-UrerJ3i-.mjs.map +1 -0
- package/dist-lib/index.cjs +1258 -311
- package/dist-lib/index.cjs.map +1 -1
- package/dist-lib/index.mjs +1631 -679
- package/dist-lib/index.mjs.map +1 -1
- package/dist-lib/preview/chat.cjs +45 -44
- package/dist-lib/preview/chat.cjs.map +1 -1
- package/dist-lib/preview/chat.mjs +3 -2
- package/dist-lib/preview/chat.mjs.map +1 -1
- package/dist-lib/preview/clientes.cjs +22 -20
- package/dist-lib/preview/clientes.cjs.map +1 -1
- package/dist-lib/preview/clientes.mjs +6 -4
- package/dist-lib/preview/clientes.mjs.map +1 -1
- package/dist-lib/preview/dashboard.cjs +40 -39
- package/dist-lib/preview/dashboard.cjs.map +1 -1
- package/dist-lib/preview/dashboard.mjs +4 -3
- package/dist-lib/preview/dashboard.mjs.map +1 -1
- package/dist-lib/shadcn.cjs +293 -0
- package/dist-lib/shadcn.cjs.map +1 -0
- package/dist-lib/shadcn.d.ts +2 -0
- package/dist-lib/shadcn.mjs +276 -0
- package/dist-lib/shadcn.mjs.map +1 -0
- package/dist-lib/src/components/index.d.ts +10 -0
- package/dist-lib/src/components/index.d.ts.map +1 -1
- package/dist-lib/src/components/shadcn/command.d.ts.map +1 -1
- package/dist-lib/src/components/shadcn/index.d.ts +60 -6
- package/dist-lib/src/components/shadcn/index.d.ts.map +1 -1
- package/dist-lib/src/hooks/useBrand.d.ts +1 -1
- package/dist-lib/theme/brand-blue.css +110 -110
- package/dist-lib/theme/brand-green.css +110 -110
- package/dist-lib/theme/brand-pay.css +189 -189
- package/dist-lib/theme/brand-vibrant.css +148 -148
- package/dist-lib/theme.css +10 -6
- package/dist-lib/tokens/brands/blue/semantic/color-dark.d.ts +4 -0
- package/dist-lib/tokens/brands/blue/semantic/color-dark.d.ts.map +1 -1
- package/dist-lib/tokens/brands/blue/semantic/color-light.d.ts +4 -0
- package/dist-lib/tokens/brands/blue/semantic/color-light.d.ts.map +1 -1
- package/dist-lib/tokens/brands/default/semantic/color-dark.d.ts +4 -0
- package/dist-lib/tokens/brands/default/semantic/color-dark.d.ts.map +1 -1
- package/dist-lib/tokens/brands/default/semantic/color-light.d.ts +4 -0
- package/dist-lib/tokens/brands/default/semantic/color-light.d.ts.map +1 -1
- package/dist-lib/tokens/brands/green/semantic/color-dark.d.ts +4 -0
- package/dist-lib/tokens/brands/green/semantic/color-dark.d.ts.map +1 -1
- package/dist-lib/tokens/brands/green/semantic/color-light.d.ts +4 -0
- package/dist-lib/tokens/brands/green/semantic/color-light.d.ts.map +1 -1
- package/dist-lib/tokens/brands/pay/semantic/color-dark.d.ts +4 -0
- package/dist-lib/tokens/brands/pay/semantic/color-dark.d.ts.map +1 -1
- package/dist-lib/tokens/brands/pay/semantic/color-light.d.ts +4 -0
- package/dist-lib/tokens/brands/pay/semantic/color-light.d.ts.map +1 -1
- package/dist-lib/tokens/brands/vibrant/semantic/color-dark.d.ts +4 -0
- package/dist-lib/tokens/brands/vibrant/semantic/color-dark.d.ts.map +1 -1
- package/dist-lib/tokens/brands/vibrant/semantic/color-light.d.ts +4 -0
- package/dist-lib/tokens/brands/vibrant/semantic/color-light.d.ts.map +1 -1
- package/dist-lib/tokens.cjs +12 -0
- package/dist-lib/tokens.cjs.map +1 -1
- package/dist-lib/tokens.mjs +12 -0
- package/dist-lib/tokens.mjs.map +1 -1
- package/package.json +11 -3
- package/dist-lib/chunks/panel-Cdl0GPVE.mjs.map +0 -1
- package/dist-lib/chunks/panel-DlyaLunw.cjs.map +0 -1
- package/dist-lib/chunks/useTheme-D4alxxGV.cjs.map +0 -1
- package/dist-lib/chunks/useTheme-DF2xbSdI.mjs.map +0 -1
package/dist-lib/index.mjs
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { A as A2,
|
|
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 ACTIONS_COLUMN_WIDTH, l as TableToolbar, m as ToolbarActions, n as ToolbarFilterButton, o as ToolbarSearch, q as ToolbarApplied, r as ToolbarTabs, s as columnTypeRegistry, L as ListItem, t as List } from "./chunks/panel-Cid3m9zb.mjs";
|
|
2
|
+
import { u, A, 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, p, aj, ak, al, am, an } from "./chunks/panel-Cid3m9zb.mjs";
|
|
3
|
+
import { C as Chip } from "./chunks/useTheme-UrerJ3i-.mjs";
|
|
4
|
+
import { A as A2, a, b as b2, H as H2, c as c2, d as d2, e, f, g, M as M2, S as S2, h, i, j, k, l, m, U as U2, n, o, p as p2, q, u as u2 } from "./chunks/useTheme-UrerJ3i-.mjs";
|
|
5
|
+
import { t as tv, U as Popover, Y as PopoverTrigger, X as PopoverContent, B as Button, D as Dialog, u as DialogTrigger, c as cn, m as DialogContent, s as DialogTitle, V as PopoverAnchor, l as DialogClose, n as DialogDescription, v as DropdownMenu, N as DropdownMenuTrigger, x as DropdownMenuContent, z as DropdownMenuItem, d as CommandDialog, g as CommandInput, i as CommandList, e as CommandEmpty, f as CommandGroup, h as CommandItem, y as DropdownMenuGroup, E as DropdownMenuLabel, I as DropdownMenuSeparator } from "./chunks/avatar-CIHTveDJ.mjs";
|
|
6
|
+
import { O as O2, P as P2, Q as Q2, R as R2, S as S3, T, w as w2, G as G2, H as H3, a2 as a22, a1 as a12 } from "./chunks/avatar-CIHTveDJ.mjs";
|
|
5
7
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
6
8
|
import * as React from "react";
|
|
7
9
|
import { forwardRef, useId, useState, Fragment as Fragment$1, isValidElement, useCallback, useMemo, createElement, useRef, useEffect, useLayoutEffect, createContext, useContext } from "react";
|
|
8
|
-
import {
|
|
10
|
+
import { l as Checkbox, C as Calendar, T as Textarea } from "./chunks/textarea-BDJRaL5h.mjs";
|
|
11
|
+
import { G as G3, H as H4, F as F2, O as O3 } from "./chunks/textarea-BDJRaL5h.mjs";
|
|
12
|
+
import { Check, MoreHorizontal, SlidersHorizontal, Calendar as Calendar$1, AlertCircle, CheckCheck, Clock, MoreVertical, Ban, X as X2, CalendarDays, ChevronDown, ChevronLeft, ChevronRight, PanelLeftClose, ChevronsUpDown, Search, User, RefreshCw, OctagonX, TriangleAlert, CircleCheck, Info, Bell } from "lucide-react";
|
|
9
13
|
import { Reply } from "lucide-react";
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
14
|
+
import { aB as Separator, aK as Tooltip, aN as TooltipTrigger, aL as TooltipContent, x as Collapsible, z as CollapsibleTrigger, y as CollapsibleContent, aM as TooltipProvider } from "./chunks/tooltip-DGI3hDFM.mjs";
|
|
15
|
+
import { B as B2, aO } from "./chunks/tooltip-DGI3hDFM.mjs";
|
|
16
|
+
import "@radix-ui/react-aspect-ratio";
|
|
17
|
+
import "react-day-picker";
|
|
18
|
+
import "@radix-ui/react-collapsible";
|
|
19
|
+
import { I as Input } from "./chunks/input-jLoO8t0I.mjs";
|
|
20
|
+
import { i as i2 } from "./chunks/input-jLoO8t0I.mjs";
|
|
21
|
+
import { toast as toast$1 } from "sonner";
|
|
22
|
+
import { a as a10, b as b3, K as K2 } from "./chunks/kpi-delta-D0g2YzDy.mjs";
|
|
23
|
+
import { P as P3, p as p3 } from "./chunks/page-header-Deb1excS.mjs";
|
|
24
|
+
import * as RechartsPrimitive from "recharts";
|
|
25
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
26
|
+
import "@hello-pangea/dnd";
|
|
17
27
|
const cardCheckbox = tv({
|
|
18
28
|
slots: {
|
|
19
29
|
root: [
|
|
@@ -84,110 +94,6 @@ const CardCheckbox = forwardRef(
|
|
|
84
94
|
}
|
|
85
95
|
);
|
|
86
96
|
CardCheckbox.displayName = "CardCheckbox";
|
|
87
|
-
const Separator = React.forwardRef(
|
|
88
|
-
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
89
|
-
SeparatorPrimitive.Root,
|
|
90
|
-
{
|
|
91
|
-
ref,
|
|
92
|
-
decorative,
|
|
93
|
-
orientation,
|
|
94
|
-
className: cn(
|
|
95
|
-
"shrink-0 bg-border",
|
|
96
|
-
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
97
|
-
className
|
|
98
|
-
),
|
|
99
|
-
...props
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
);
|
|
103
|
-
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
104
|
-
const badgeVariants = tv({
|
|
105
|
-
base: [
|
|
106
|
-
"inline-flex items-center justify-center",
|
|
107
|
-
"border border-transparent",
|
|
108
|
-
"font-semibold leading-none whitespace-nowrap",
|
|
109
|
-
"transition-colors",
|
|
110
|
-
"focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-secondary",
|
|
111
|
-
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
112
|
-
],
|
|
113
|
-
variants: {
|
|
114
|
-
color: {
|
|
115
|
-
primary: "",
|
|
116
|
-
secondary: "",
|
|
117
|
-
critical: "",
|
|
118
|
-
success: "",
|
|
119
|
-
warning: "",
|
|
120
|
-
info: ""
|
|
121
|
-
},
|
|
122
|
-
variant: {
|
|
123
|
-
solid: "",
|
|
124
|
-
soft: "",
|
|
125
|
-
outline: "bg-transparent",
|
|
126
|
-
ghost: "bg-transparent border-transparent"
|
|
127
|
-
},
|
|
128
|
-
size: {
|
|
129
|
-
sm: "h-comp-2xs px-pad-sm text-caption-xs gap-gp-2xs [&_svg]:size-3",
|
|
130
|
-
// 20px / 6 / 10
|
|
131
|
-
md: "h-comp-xs px-pad-md text-body-xs gap-gp-xs [&_svg]:size-3.5",
|
|
132
|
-
// 24px / 8 / 12 (default)
|
|
133
|
-
lg: "h-comp-sm px-pad-lg text-body-sm font-normal gap-gp-sm [&_svg]:size-4"
|
|
134
|
-
// 28px / 10 / 13
|
|
135
|
-
},
|
|
136
|
-
shape: {
|
|
137
|
-
default: "rounded-radius-sm",
|
|
138
|
-
// 6px — counter, value tags
|
|
139
|
-
pill: "rounded-radius-full"
|
|
140
|
-
// pill — status chips
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
compoundVariants: [
|
|
144
|
-
/* ── Primary (brand) ─────────────────────────────────────────────── */
|
|
145
|
-
{ color: "primary", variant: "solid", class: "bg-bg-brand text-fg-on-brand" },
|
|
146
|
-
{ color: "primary", variant: "soft", class: "bg-bg-brand-subtle text-fg-brand" },
|
|
147
|
-
{ color: "primary", variant: "outline", class: "border-border-brand text-fg-brand" },
|
|
148
|
-
{ color: "primary", variant: "ghost", class: "text-fg-brand" },
|
|
149
|
-
/* ── Secondary (neutral) ─────────────────────────────────────────── */
|
|
150
|
-
{ color: "secondary", variant: "solid", class: "bg-bg-emphasis text-fg-default" },
|
|
151
|
-
{ color: "secondary", variant: "soft", class: "bg-bg-muted text-fg-muted" },
|
|
152
|
-
{ color: "secondary", variant: "outline", class: "border-border-default text-fg-default" },
|
|
153
|
-
{ color: "secondary", variant: "ghost", class: "text-fg-muted" },
|
|
154
|
-
/* ── Critical (danger) ───────────────────────────────────────────── */
|
|
155
|
-
{ color: "critical", variant: "solid", class: "bg-bg-danger text-fg-on-danger" },
|
|
156
|
-
{ color: "critical", variant: "soft", class: "bg-bg-danger-muted text-fg-danger" },
|
|
157
|
-
{ color: "critical", variant: "outline", class: "border-border-danger-muted text-fg-danger" },
|
|
158
|
-
{ color: "critical", variant: "ghost", class: "text-fg-danger" },
|
|
159
|
-
/* ── Success ─────────────────────────────────────────────────────── */
|
|
160
|
-
{ color: "success", variant: "solid", class: "bg-bg-success text-fg-on-success" },
|
|
161
|
-
{ color: "success", variant: "soft", class: "bg-bg-success-muted text-fg-success" },
|
|
162
|
-
{ color: "success", variant: "outline", class: "border-border-success-muted text-fg-success" },
|
|
163
|
-
{ color: "success", variant: "ghost", class: "text-fg-success" },
|
|
164
|
-
/* ── Warning ─────────────────────────────────────────────────────── */
|
|
165
|
-
{ color: "warning", variant: "solid", class: "bg-bg-warning text-fg-on-warning" },
|
|
166
|
-
{ color: "warning", variant: "soft", class: "bg-bg-warning-muted text-fg-warning" },
|
|
167
|
-
{ color: "warning", variant: "outline", class: "border-border-warning-muted text-fg-warning" },
|
|
168
|
-
{ color: "warning", variant: "ghost", class: "text-fg-warning" },
|
|
169
|
-
/* ── Info ────────────────────────────────────────────────────────── */
|
|
170
|
-
{ color: "info", variant: "solid", class: "bg-bg-info text-fg-on-info" },
|
|
171
|
-
{ color: "info", variant: "soft", class: "bg-bg-info-muted text-fg-info" },
|
|
172
|
-
{ color: "info", variant: "outline", class: "border-border-info-muted text-fg-info" },
|
|
173
|
-
{ color: "info", variant: "ghost", class: "text-fg-info" }
|
|
174
|
-
],
|
|
175
|
-
defaultVariants: {
|
|
176
|
-
color: "secondary",
|
|
177
|
-
variant: "soft",
|
|
178
|
-
size: "md",
|
|
179
|
-
shape: "default"
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
function Badge({ className, color, variant, size, shape, ...props }) {
|
|
183
|
-
return /* @__PURE__ */ jsx(
|
|
184
|
-
"span",
|
|
185
|
-
{
|
|
186
|
-
className: badgeVariants({ color, variant, size, shape, className }),
|
|
187
|
-
...props
|
|
188
|
-
}
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
97
|
const colorPickerStyles = tv({
|
|
192
98
|
slots: {
|
|
193
99
|
root: "inline-flex w-full items-center gap-gp-md",
|
|
@@ -274,18 +180,18 @@ const DEFAULT_COLOR_PRESETS = [
|
|
|
274
180
|
"#111827"
|
|
275
181
|
];
|
|
276
182
|
function normalizeHex(raw) {
|
|
277
|
-
let
|
|
278
|
-
if (/^[0-9a-fA-F]{3}$/.test(
|
|
279
|
-
|
|
183
|
+
let h2 = raw.trim().replace(/^#/, "");
|
|
184
|
+
if (/^[0-9a-fA-F]{3}$/.test(h2)) {
|
|
185
|
+
h2 = h2.split("").map((c3) => c3 + c3).join("");
|
|
280
186
|
}
|
|
281
|
-
if (/^[0-9a-fA-F]{6}$/.test(
|
|
282
|
-
return `#${
|
|
187
|
+
if (/^[0-9a-fA-F]{6}$/.test(h2)) {
|
|
188
|
+
return `#${h2.toUpperCase()}`;
|
|
283
189
|
}
|
|
284
190
|
return null;
|
|
285
191
|
}
|
|
286
|
-
function sameHex(
|
|
287
|
-
const na = normalizeHex(
|
|
288
|
-
const nb = normalizeHex(
|
|
192
|
+
function sameHex(a11, b4) {
|
|
193
|
+
const na = normalizeHex(a11);
|
|
194
|
+
const nb = normalizeHex(b4);
|
|
289
195
|
return na !== null && nb !== null && na === nb;
|
|
290
196
|
}
|
|
291
197
|
const ColorPicker = forwardRef(
|
|
@@ -484,39 +390,39 @@ const markdownTextStyles = tv({
|
|
|
484
390
|
});
|
|
485
391
|
const CODE_RE = /```([\s\S]+?)```|`([^`]+?)`/g;
|
|
486
392
|
const URL_RE = /((?:https?:\/\/|www\.)[^\s<>()]+[^\s<>().,!?;:'"])/g;
|
|
487
|
-
function parseInline(text,
|
|
393
|
+
function parseInline(text, s, prefix) {
|
|
488
394
|
const markers = [
|
|
489
395
|
{ re: /\*([^*\n]+?)\*/, slot: "strong", el: "strong" },
|
|
490
396
|
{ re: /_([^_\n]+?)_/, slot: "em", el: "em" },
|
|
491
397
|
{ re: /~([^~\n]+?)~/, slot: "strike", el: "span" }
|
|
492
398
|
];
|
|
493
399
|
for (const { re, slot, el } of markers) {
|
|
494
|
-
const
|
|
495
|
-
if (!
|
|
496
|
-
const before = text.slice(0,
|
|
497
|
-
const inner =
|
|
498
|
-
const after = text.slice(
|
|
400
|
+
const m2 = re.exec(text);
|
|
401
|
+
if (!m2 || m2.index === void 0) continue;
|
|
402
|
+
const before = text.slice(0, m2.index);
|
|
403
|
+
const inner = m2[1];
|
|
404
|
+
const after = text.slice(m2.index + m2[0].length);
|
|
499
405
|
const Tag = el;
|
|
500
|
-
const className = slot === "strong" ?
|
|
406
|
+
const className = slot === "strong" ? s.strong() : slot === "em" ? s.em() : s.strike();
|
|
501
407
|
return [
|
|
502
|
-
...parseInline(before,
|
|
503
|
-
/* @__PURE__ */ jsx(Tag, { className, children: parseInline(inner,
|
|
504
|
-
...parseInline(after,
|
|
408
|
+
...parseInline(before, s, `${prefix}-b`),
|
|
409
|
+
/* @__PURE__ */ jsx(Tag, { className, children: parseInline(inner, s, `${prefix}-i`) }, `${prefix}-${slot}`),
|
|
410
|
+
...parseInline(after, s, `${prefix}-a`)
|
|
505
411
|
];
|
|
506
412
|
}
|
|
507
413
|
return text ? [text] : [];
|
|
508
414
|
}
|
|
509
|
-
function parseLinksAndInline(text,
|
|
415
|
+
function parseLinksAndInline(text, s, prefix) {
|
|
510
416
|
const out = [];
|
|
511
417
|
let last = 0;
|
|
512
|
-
let
|
|
418
|
+
let i3 = 0;
|
|
513
419
|
URL_RE.lastIndex = 0;
|
|
514
|
-
let
|
|
515
|
-
while ((
|
|
516
|
-
if (
|
|
517
|
-
out.push(...parseInline(text.slice(last,
|
|
420
|
+
let m2;
|
|
421
|
+
while ((m2 = URL_RE.exec(text)) !== null) {
|
|
422
|
+
if (m2.index > last) {
|
|
423
|
+
out.push(...parseInline(text.slice(last, m2.index), s, `${prefix}-${i3}t`));
|
|
518
424
|
}
|
|
519
|
-
const raw =
|
|
425
|
+
const raw = m2[0];
|
|
520
426
|
const href = raw.startsWith("www.") ? `https://${raw}` : raw;
|
|
521
427
|
out.push(
|
|
522
428
|
/* @__PURE__ */ jsx(
|
|
@@ -525,39 +431,39 @@ function parseLinksAndInline(text, s2, prefix) {
|
|
|
525
431
|
href,
|
|
526
432
|
target: "_blank",
|
|
527
433
|
rel: "noopener noreferrer",
|
|
528
|
-
className:
|
|
434
|
+
className: s.link(),
|
|
529
435
|
children: raw
|
|
530
436
|
},
|
|
531
|
-
`${prefix}-${
|
|
437
|
+
`${prefix}-${i3}link`
|
|
532
438
|
)
|
|
533
439
|
);
|
|
534
|
-
last =
|
|
535
|
-
|
|
440
|
+
last = m2.index + raw.length;
|
|
441
|
+
i3 += 1;
|
|
536
442
|
}
|
|
537
443
|
if (last < text.length) {
|
|
538
|
-
out.push(...parseInline(text.slice(last),
|
|
444
|
+
out.push(...parseInline(text.slice(last), s, `${prefix}-${i3}t`));
|
|
539
445
|
}
|
|
540
446
|
return out;
|
|
541
447
|
}
|
|
542
|
-
function parseMarkdown(source,
|
|
448
|
+
function parseMarkdown(source, s) {
|
|
543
449
|
const out = [];
|
|
544
450
|
let last = 0;
|
|
545
|
-
let
|
|
451
|
+
let i3 = 0;
|
|
546
452
|
CODE_RE.lastIndex = 0;
|
|
547
|
-
let
|
|
548
|
-
while ((
|
|
549
|
-
if (
|
|
550
|
-
out.push(...parseLinksAndInline(source.slice(last,
|
|
453
|
+
let m2;
|
|
454
|
+
while ((m2 = CODE_RE.exec(source)) !== null) {
|
|
455
|
+
if (m2.index > last) {
|
|
456
|
+
out.push(...parseLinksAndInline(source.slice(last, m2.index), s, `${i3}t`));
|
|
551
457
|
}
|
|
552
|
-
const codeContent =
|
|
458
|
+
const codeContent = m2[1] ?? m2[2] ?? "";
|
|
553
459
|
out.push(
|
|
554
|
-
/* @__PURE__ */ jsx("code", { className:
|
|
460
|
+
/* @__PURE__ */ jsx("code", { className: s.code(), children: codeContent }, `${i3}code`)
|
|
555
461
|
);
|
|
556
|
-
last =
|
|
557
|
-
|
|
462
|
+
last = m2.index + m2[0].length;
|
|
463
|
+
i3 += 1;
|
|
558
464
|
}
|
|
559
465
|
if (last < source.length) {
|
|
560
|
-
out.push(...parseLinksAndInline(source.slice(last),
|
|
466
|
+
out.push(...parseLinksAndInline(source.slice(last), s, `${i3}t`));
|
|
561
467
|
}
|
|
562
468
|
return out;
|
|
563
469
|
}
|
|
@@ -569,7 +475,7 @@ function MarkdownText({
|
|
|
569
475
|
const styles2 = markdownTextStyles({ inline });
|
|
570
476
|
const source = inline ? children.replace(/\s+/g, " ").trim() : children;
|
|
571
477
|
const nodes = parseMarkdown(source, styles2);
|
|
572
|
-
const content = nodes.map((node,
|
|
478
|
+
const content = nodes.map((node, i3) => /* @__PURE__ */ jsx(Fragment$1, { children: node }, i3));
|
|
573
479
|
if (inline) {
|
|
574
480
|
return /* @__PURE__ */ jsx("span", { className: styles2.root({ className }), children: content });
|
|
575
481
|
}
|
|
@@ -829,20 +735,20 @@ function useToolbarFilters(options) {
|
|
|
829
735
|
[generateId]
|
|
830
736
|
);
|
|
831
737
|
const remove = useCallback((id) => {
|
|
832
|
-
setList((prev) => prev.filter((
|
|
738
|
+
setList((prev) => prev.filter((f2) => f2.id !== id));
|
|
833
739
|
}, []);
|
|
834
740
|
const update = useCallback((id, patch) => {
|
|
835
741
|
setList(
|
|
836
|
-
(prev) => prev.map((
|
|
742
|
+
(prev) => prev.map((f2) => f2.id === id ? { ...f2, ...patch } : f2)
|
|
837
743
|
);
|
|
838
744
|
}, []);
|
|
839
745
|
const clear = useCallback(() => setList([]), []);
|
|
840
746
|
const replaceAll = useCallback((next) => setList(next), []);
|
|
841
747
|
const count = useMemo(
|
|
842
|
-
() => list.filter((
|
|
843
|
-
if (
|
|
844
|
-
if (typeof
|
|
845
|
-
if (Array.isArray(
|
|
748
|
+
() => list.filter((f2) => {
|
|
749
|
+
if (f2.value === null || f2.value === void 0) return false;
|
|
750
|
+
if (typeof f2.value === "string") return f2.value.length > 0;
|
|
751
|
+
if (Array.isArray(f2.value)) return f2.value.length > 0;
|
|
846
752
|
return true;
|
|
847
753
|
}).length,
|
|
848
754
|
[list]
|
|
@@ -855,7 +761,7 @@ function useToolbarSort(options) {
|
|
|
855
761
|
const toggle = useCallback(
|
|
856
762
|
(columnKey) => {
|
|
857
763
|
setList((prev) => {
|
|
858
|
-
const idx = prev.findIndex((
|
|
764
|
+
const idx = prev.findIndex((s) => s.columnKey === columnKey);
|
|
859
765
|
if (idx === -1) {
|
|
860
766
|
const next = [...prev, { columnKey, direction: "asc" }];
|
|
861
767
|
if (next.length > maxColumns) next.shift();
|
|
@@ -867,7 +773,7 @@ function useToolbarSort(options) {
|
|
|
867
773
|
next[idx] = { ...current, direction: "desc" };
|
|
868
774
|
return next;
|
|
869
775
|
}
|
|
870
|
-
return prev.filter((
|
|
776
|
+
return prev.filter((_2, i3) => i3 !== idx);
|
|
871
777
|
});
|
|
872
778
|
},
|
|
873
779
|
[maxColumns]
|
|
@@ -875,7 +781,7 @@ function useToolbarSort(options) {
|
|
|
875
781
|
const set = useCallback(
|
|
876
782
|
(columnKey, direction) => {
|
|
877
783
|
setList((prev) => {
|
|
878
|
-
const idx = prev.findIndex((
|
|
784
|
+
const idx = prev.findIndex((s) => s.columnKey === columnKey);
|
|
879
785
|
if (idx === -1) {
|
|
880
786
|
const next2 = [...prev, { columnKey, direction }];
|
|
881
787
|
if (next2.length > maxColumns) next2.shift();
|
|
@@ -889,7 +795,7 @@ function useToolbarSort(options) {
|
|
|
889
795
|
[maxColumns]
|
|
890
796
|
);
|
|
891
797
|
const remove = useCallback((columnKey) => {
|
|
892
|
-
setList((prev) => prev.filter((
|
|
798
|
+
setList((prev) => prev.filter((s) => s.columnKey !== columnKey));
|
|
893
799
|
}, []);
|
|
894
800
|
const clear = useCallback(() => setList([]), []);
|
|
895
801
|
const replaceAll = useCallback(
|
|
@@ -897,7 +803,7 @@ function useToolbarSort(options) {
|
|
|
897
803
|
[]
|
|
898
804
|
);
|
|
899
805
|
const directionOf = useCallback(
|
|
900
|
-
(columnKey) => list.find((
|
|
806
|
+
(columnKey) => list.find((s) => s.columnKey === columnKey)?.direction,
|
|
901
807
|
[list]
|
|
902
808
|
);
|
|
903
809
|
return {
|
|
@@ -3616,7 +3522,7 @@ const iconStyles = tv({
|
|
|
3616
3522
|
}
|
|
3617
3523
|
});
|
|
3618
3524
|
const PRESETS = ["xs", "sm", "md", "lg", "xl"];
|
|
3619
|
-
const isPresetSize = (
|
|
3525
|
+
const isPresetSize = (s) => typeof s === "string" && PRESETS.includes(s);
|
|
3620
3526
|
const VIEWBOX_18 = /* @__PURE__ */ new Set([
|
|
3621
3527
|
"line-outline",
|
|
3622
3528
|
"line-close",
|
|
@@ -3665,7 +3571,7 @@ const Icon = forwardRef(
|
|
|
3665
3571
|
...props,
|
|
3666
3572
|
children: [
|
|
3667
3573
|
title2 ? /* @__PURE__ */ jsx("title", { children: title2 }) : null,
|
|
3668
|
-
paths.map((d3,
|
|
3574
|
+
paths.map((d3, i3) => /* @__PURE__ */ jsx("path", { d: d3 }, i3))
|
|
3669
3575
|
]
|
|
3670
3576
|
}
|
|
3671
3577
|
);
|
|
@@ -3832,7 +3738,7 @@ function resolveIsImage(value, preview, accept) {
|
|
|
3832
3738
|
}
|
|
3833
3739
|
function matchesAccept(file, accept) {
|
|
3834
3740
|
if (!accept) return true;
|
|
3835
|
-
const tokens = accept.split(",").map((
|
|
3741
|
+
const tokens = accept.split(",").map((t) => t.trim().toLowerCase());
|
|
3836
3742
|
const name = file.name.toLowerCase();
|
|
3837
3743
|
const mime = file.type.toLowerCase();
|
|
3838
3744
|
return tokens.some((token) => {
|
|
@@ -4261,13 +4167,13 @@ function MessageBubble({
|
|
|
4261
4167
|
className
|
|
4262
4168
|
}) {
|
|
4263
4169
|
const [actionsOpen, setActionsOpen] = useState(false);
|
|
4264
|
-
const
|
|
4170
|
+
const s = messageBubbleStyles({ side, tail });
|
|
4265
4171
|
const time = formatTime(createdAt);
|
|
4266
4172
|
const hasMedia = !isDeleted && mediaType !== "text";
|
|
4267
4173
|
const showAck = side === "sent" && ack !== void 0 && !isDeleted;
|
|
4268
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
4269
|
-
avatar ? /* @__PURE__ */ jsx("div", { className:
|
|
4270
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
4174
|
+
return /* @__PURE__ */ jsxs("div", { className: s.row({ className }), children: [
|
|
4175
|
+
avatar ? /* @__PURE__ */ jsx("div", { className: s.avatarSlot(), children: avatar }) : null,
|
|
4176
|
+
/* @__PURE__ */ jsx("div", { className: s.column(), children: /* @__PURE__ */ jsxs("div", { className: s.bubble(), children: [
|
|
4271
4177
|
actions && !isDeleted ? /* @__PURE__ */ jsxs(
|
|
4272
4178
|
Popover,
|
|
4273
4179
|
{
|
|
@@ -4285,7 +4191,7 @@ function MessageBubble({
|
|
|
4285
4191
|
"aria-label": "Ações da mensagem",
|
|
4286
4192
|
"aria-haspopup": "menu",
|
|
4287
4193
|
"aria-expanded": actionsOpen,
|
|
4288
|
-
className:
|
|
4194
|
+
className: s.actionsTrigger(),
|
|
4289
4195
|
onClick: () => setActionsOpen((o2) => !o2),
|
|
4290
4196
|
children: /* @__PURE__ */ jsx(MoreVertical, { "aria-hidden": "true" })
|
|
4291
4197
|
}
|
|
@@ -4295,30 +4201,30 @@ function MessageBubble({
|
|
|
4295
4201
|
{
|
|
4296
4202
|
align: side === "sent" ? "end" : "start",
|
|
4297
4203
|
role: "menu",
|
|
4298
|
-
className:
|
|
4204
|
+
className: s.actionsContent(),
|
|
4299
4205
|
children: actions
|
|
4300
4206
|
}
|
|
4301
4207
|
)
|
|
4302
4208
|
]
|
|
4303
4209
|
}
|
|
4304
4210
|
) : null,
|
|
4305
|
-
authorName && !isDeleted ? /* @__PURE__ */ jsx("span", { className:
|
|
4306
|
-
quotedMessage && !isDeleted ? /* @__PURE__ */ jsxs("div", { className:
|
|
4307
|
-
quotedMessage.authorName ? /* @__PURE__ */ jsx("span", { className:
|
|
4308
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
4211
|
+
authorName && !isDeleted ? /* @__PURE__ */ jsx("span", { className: s.author(), children: authorName }) : null,
|
|
4212
|
+
quotedMessage && !isDeleted ? /* @__PURE__ */ jsxs("div", { className: s.quoted(), children: [
|
|
4213
|
+
quotedMessage.authorName ? /* @__PURE__ */ jsx("span", { className: s.quotedAuthor(), children: quotedMessage.fromMe ? "Você" : quotedMessage.authorName }) : null,
|
|
4214
|
+
/* @__PURE__ */ jsxs("div", { className: s.quotedPreview(), children: [
|
|
4309
4215
|
quotedMessage.mediaType === "image" && quotedMessage.mediaUrl ? /* @__PURE__ */ jsx(
|
|
4310
4216
|
"img",
|
|
4311
4217
|
{
|
|
4312
4218
|
src: quotedMessage.mediaUrl,
|
|
4313
4219
|
alt: "",
|
|
4314
|
-
className:
|
|
4220
|
+
className: s.quotedThumb()
|
|
4315
4221
|
}
|
|
4316
4222
|
) : null,
|
|
4317
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
4223
|
+
/* @__PURE__ */ jsx("span", { className: s.quotedPreviewText(), children: quotedMessage.body ? /* @__PURE__ */ jsx(MarkdownText, { inline: true, children: quotedMessage.body }) : MEDIA_LABEL[quotedMessage.mediaType ?? "text"] || "Mensagem" })
|
|
4318
4224
|
] })
|
|
4319
4225
|
] }) : null,
|
|
4320
|
-
isDeleted ? /* @__PURE__ */ jsxs("span", { className:
|
|
4321
|
-
/* @__PURE__ */ jsx(Ban, { className:
|
|
4226
|
+
isDeleted ? /* @__PURE__ */ jsxs("span", { className: s.deleted(), children: [
|
|
4227
|
+
/* @__PURE__ */ jsx(Ban, { className: s.deletedIcon(), "aria-hidden": "true" }),
|
|
4322
4228
|
"Mensagem apagada"
|
|
4323
4229
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4324
4230
|
hasMedia ? media ?? /* @__PURE__ */ jsx(
|
|
@@ -4330,11 +4236,11 @@ function MessageBubble({
|
|
|
4330
4236
|
onMediaClick
|
|
4331
4237
|
}
|
|
4332
4238
|
) : null,
|
|
4333
|
-
body2 && (mediaType === "text" || !hasMedia) ? /* @__PURE__ */ jsx(MarkdownText, { className:
|
|
4239
|
+
body2 && (mediaType === "text" || !hasMedia) ? /* @__PURE__ */ jsx(MarkdownText, { className: s.body(), children: body2 }) : null
|
|
4334
4240
|
] }),
|
|
4335
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
4336
|
-
isEdited && !isDeleted ? /* @__PURE__ */ jsx("span", { className:
|
|
4337
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
4241
|
+
/* @__PURE__ */ jsxs("div", { className: s.meta(), children: [
|
|
4242
|
+
isEdited && !isDeleted ? /* @__PURE__ */ jsx("span", { className: s.metaEdited(), children: "editada" }) : null,
|
|
4243
|
+
/* @__PURE__ */ jsx("span", { className: s.metaTime(), children: time }),
|
|
4338
4244
|
showAck ? /* @__PURE__ */ jsx(MessageAck, { ack, error: ackError }) : null
|
|
4339
4245
|
] })
|
|
4340
4246
|
] }) })
|
|
@@ -4733,7 +4639,7 @@ function Modal({
|
|
|
4733
4639
|
...description$1 ? {} : { "aria-describedby": void 0 },
|
|
4734
4640
|
children: [
|
|
4735
4641
|
!title$1 && /* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: "Diálogo" }),
|
|
4736
|
-
!hideClose && /* @__PURE__ */ jsx(DialogClose, { className: closeBtn(), "aria-label": "Fechar", children: /* @__PURE__ */ jsx(
|
|
4642
|
+
!hideClose && /* @__PURE__ */ jsx(DialogClose, { className: closeBtn(), "aria-label": "Fechar", children: /* @__PURE__ */ jsx(X2, { className: "size-icon-sm" }) }),
|
|
4737
4643
|
hasHeader && /* @__PURE__ */ jsxs("header", { className: head(), children: [
|
|
4738
4644
|
icon && /* @__PURE__ */ jsx("span", { className: headIcon(), "aria-hidden": "true", children: icon }),
|
|
4739
4645
|
(title$1 || description$1) && /* @__PURE__ */ jsxs("div", { className: headTitleWrap(), children: [
|
|
@@ -4921,7 +4827,7 @@ const MonthYearPicker = forwardRef(function MonthYearPicker2({
|
|
|
4921
4827
|
const fmt = new Intl.DateTimeFormat(locale, { month: "short" });
|
|
4922
4828
|
return Array.from(
|
|
4923
4829
|
{ length: 12 },
|
|
4924
|
-
(
|
|
4830
|
+
(_2, i3) => capitalizeFirst(fmt.format(new Date(2020, i3, 1)).replace(/\.$/, ""))
|
|
4925
4831
|
);
|
|
4926
4832
|
}, [locale]);
|
|
4927
4833
|
const triggerLabel = useMemo(() => {
|
|
@@ -5003,9 +4909,9 @@ const MonthYearPicker = forwardRef(function MonthYearPicker2({
|
|
|
5003
4909
|
}
|
|
5004
4910
|
)
|
|
5005
4911
|
] }),
|
|
5006
|
-
/* @__PURE__ */ jsx("div", { className: styles2.grid(), role: "grid", children: monthLabels.map((label,
|
|
5007
|
-
const monthDisabled = isMonthDisabled(
|
|
5008
|
-
const isSelected = parsed?.year === viewYear && parsed?.month ===
|
|
4912
|
+
/* @__PURE__ */ jsx("div", { className: styles2.grid(), role: "grid", children: monthLabels.map((label, i3) => {
|
|
4913
|
+
const monthDisabled = isMonthDisabled(i3);
|
|
4914
|
+
const isSelected = parsed?.year === viewYear && parsed?.month === i3 + 1;
|
|
5009
4915
|
return /* @__PURE__ */ jsx(
|
|
5010
4916
|
"button",
|
|
5011
4917
|
{
|
|
@@ -5013,7 +4919,7 @@ const MonthYearPicker = forwardRef(function MonthYearPicker2({
|
|
|
5013
4919
|
role: "gridcell",
|
|
5014
4920
|
"aria-pressed": isSelected,
|
|
5015
4921
|
disabled: monthDisabled,
|
|
5016
|
-
onClick: () => selectMonth(
|
|
4922
|
+
onClick: () => selectMonth(i3),
|
|
5017
4923
|
className: monthYearMonthButton({
|
|
5018
4924
|
selected: isSelected,
|
|
5019
4925
|
disabled: monthDisabled
|
|
@@ -5029,44 +4935,6 @@ const MonthYearPicker = forwardRef(function MonthYearPicker2({
|
|
|
5029
4935
|
] });
|
|
5030
4936
|
});
|
|
5031
4937
|
MonthYearPicker.displayName = "MonthYearPicker";
|
|
5032
|
-
const TooltipProvider = TooltipPrimitive.Provider;
|
|
5033
|
-
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
5034
|
-
const Tooltip = ({ children, ...props }) => /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { ...props, children }) });
|
|
5035
|
-
Tooltip.displayName = "Tooltip";
|
|
5036
|
-
const TooltipContent = React.forwardRef(({ className, sideOffset = 6, showArrow = true, children, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
5037
|
-
TooltipPrimitive.Content,
|
|
5038
|
-
{
|
|
5039
|
-
ref,
|
|
5040
|
-
sideOffset,
|
|
5041
|
-
className: cn(
|
|
5042
|
-
"z-50 max-w-[16rem] select-none",
|
|
5043
|
-
"bg-bg-emphasis text-fg-default",
|
|
5044
|
-
"rounded-radius-md px-pad-lg py-pad-xs",
|
|
5045
|
-
"text-caption-sm",
|
|
5046
|
-
"shadow-sh-md",
|
|
5047
|
-
"origin-[--radix-tooltip-content-transform-origin]",
|
|
5048
|
-
"data-[state=delayed-open]:animate-in data-[state=instant-open]:animate-in data-[state=closed]:animate-out",
|
|
5049
|
-
"data-[state=closed]:fade-out-0 data-[state=delayed-open]:fade-in-0 data-[state=instant-open]:fade-in-0",
|
|
5050
|
-
"data-[state=closed]:zoom-out-95 data-[state=delayed-open]:zoom-in-95 data-[state=instant-open]:zoom-in-95",
|
|
5051
|
-
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
5052
|
-
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
5053
|
-
className
|
|
5054
|
-
),
|
|
5055
|
-
...props,
|
|
5056
|
-
children: [
|
|
5057
|
-
children,
|
|
5058
|
-
showArrow && /* @__PURE__ */ jsx(
|
|
5059
|
-
TooltipPrimitive.Arrow,
|
|
5060
|
-
{
|
|
5061
|
-
width: 11,
|
|
5062
|
-
height: 5,
|
|
5063
|
-
className: "fill-bg-emphasis"
|
|
5064
|
-
}
|
|
5065
|
-
)
|
|
5066
|
-
]
|
|
5067
|
-
}
|
|
5068
|
-
) }));
|
|
5069
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
5070
4938
|
const SingleMenuSidebarContext = createContext({
|
|
5071
4939
|
expanded: true,
|
|
5072
4940
|
isHoverExpand: false,
|
|
@@ -5350,34 +5218,34 @@ function SingleMenuModuleSelector({
|
|
|
5350
5218
|
options,
|
|
5351
5219
|
onModuleChange
|
|
5352
5220
|
}) {
|
|
5353
|
-
const
|
|
5221
|
+
const s = styles.module;
|
|
5354
5222
|
const triggerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5355
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
5356
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
5357
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5358
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5223
|
+
/* @__PURE__ */ jsx("div", { className: s.iconContainer, children: icon }),
|
|
5224
|
+
/* @__PURE__ */ jsxs("div", { className: s.textContainer, children: [
|
|
5225
|
+
/* @__PURE__ */ jsx("span", { className: s.title, children: title2 }),
|
|
5226
|
+
/* @__PURE__ */ jsx("span", { className: s.subtitle, children: subtitle })
|
|
5359
5227
|
] }),
|
|
5360
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className:
|
|
5228
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: s.chevron })
|
|
5361
5229
|
] });
|
|
5362
5230
|
if (!options || options.length === 0) {
|
|
5363
|
-
return /* @__PURE__ */ jsx("div", { className:
|
|
5231
|
+
return /* @__PURE__ */ jsx("div", { className: s.trigger, children: triggerContent });
|
|
5364
5232
|
}
|
|
5365
5233
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
5366
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { className:
|
|
5234
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { className: s.trigger, children: triggerContent }),
|
|
5367
5235
|
/* @__PURE__ */ jsx(DropdownMenuContent, { side: "bottom", sideOffset: 4, align: "start", children: options.map((option) => {
|
|
5368
5236
|
const isSelected = option.label === title2;
|
|
5369
5237
|
return /* @__PURE__ */ jsxs(
|
|
5370
5238
|
DropdownMenuItem,
|
|
5371
5239
|
{
|
|
5372
5240
|
className: cn(
|
|
5373
|
-
|
|
5374
|
-
isSelected &&
|
|
5241
|
+
s.dropdownItem,
|
|
5242
|
+
isSelected && s.dropdownItemSelected
|
|
5375
5243
|
),
|
|
5376
5244
|
onClick: () => onModuleChange?.(option.id),
|
|
5377
5245
|
children: [
|
|
5378
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
5379
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5380
|
-
isSelected && /* @__PURE__ */ jsx(Check, { className:
|
|
5246
|
+
/* @__PURE__ */ jsx("div", { className: s.dropdownItemIcon, children: option.icon }),
|
|
5247
|
+
/* @__PURE__ */ jsx("span", { className: s.dropdownItemLabel, children: option.label }),
|
|
5248
|
+
isSelected && /* @__PURE__ */ jsx(Check, { className: s.dropdownItemCheck })
|
|
5381
5249
|
]
|
|
5382
5250
|
},
|
|
5383
5251
|
option.id
|
|
@@ -5390,13 +5258,13 @@ function SingleMenuSearch({
|
|
|
5390
5258
|
placeholder = "Buscar",
|
|
5391
5259
|
onOpen
|
|
5392
5260
|
}) {
|
|
5393
|
-
const
|
|
5394
|
-
return /* @__PURE__ */ jsxs("button", { type: "button", onClick: onOpen, className:
|
|
5395
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
5396
|
-
/* @__PURE__ */ jsx(Search, { className:
|
|
5397
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5261
|
+
const s = styles.search;
|
|
5262
|
+
return /* @__PURE__ */ jsxs("button", { type: "button", onClick: onOpen, className: s.wrapper, children: [
|
|
5263
|
+
/* @__PURE__ */ jsxs("div", { className: s.inner, children: [
|
|
5264
|
+
/* @__PURE__ */ jsx(Search, { className: s.icon }),
|
|
5265
|
+
/* @__PURE__ */ jsx("span", { className: s.text, children: placeholder })
|
|
5398
5266
|
] }),
|
|
5399
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
5267
|
+
/* @__PURE__ */ jsx("div", { className: s.shortcutBadge, children: /* @__PURE__ */ jsx("span", { className: s.shortcutText, children: "⌘K" }) })
|
|
5400
5268
|
] });
|
|
5401
5269
|
}
|
|
5402
5270
|
SingleMenuSearch.displayName = "SingleMenuSearch";
|
|
@@ -5408,8 +5276,8 @@ function SingleMenuCommand({
|
|
|
5408
5276
|
onSelect,
|
|
5409
5277
|
custom
|
|
5410
5278
|
}) {
|
|
5411
|
-
const leaves = categories.filter((
|
|
5412
|
-
const groups = categories.filter((
|
|
5279
|
+
const leaves = categories.filter((c3) => !c3.items?.length);
|
|
5280
|
+
const groups = categories.filter((c3) => c3.items?.length);
|
|
5413
5281
|
const handle = (id, parentId) => {
|
|
5414
5282
|
onSelect(id, parentId);
|
|
5415
5283
|
onOpenChange(false);
|
|
@@ -5419,17 +5287,17 @@ function SingleMenuCommand({
|
|
|
5419
5287
|
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
5420
5288
|
/* @__PURE__ */ jsx(CommandEmpty, { children: "Nenhum resultado." }),
|
|
5421
5289
|
custom ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5422
|
-
leaves.length > 0 && /* @__PURE__ */ jsx(CommandGroup, { heading: "Menu", children: leaves.map((
|
|
5290
|
+
leaves.length > 0 && /* @__PURE__ */ jsx(CommandGroup, { heading: "Menu", children: leaves.map((c3) => /* @__PURE__ */ jsxs(
|
|
5423
5291
|
CommandItem,
|
|
5424
5292
|
{
|
|
5425
|
-
value:
|
|
5426
|
-
onSelect: () => handle(
|
|
5293
|
+
value: c3.label,
|
|
5294
|
+
onSelect: () => handle(c3.id),
|
|
5427
5295
|
children: [
|
|
5428
|
-
|
|
5429
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
5296
|
+
c3.icon,
|
|
5297
|
+
/* @__PURE__ */ jsx("span", { children: c3.label })
|
|
5430
5298
|
]
|
|
5431
5299
|
},
|
|
5432
|
-
|
|
5300
|
+
c3.id
|
|
5433
5301
|
)) }),
|
|
5434
5302
|
groups.map((cat) => /* @__PURE__ */ jsx(CommandGroup, { heading: cat.label, children: cat.items.map((item) => /* @__PURE__ */ jsx(
|
|
5435
5303
|
CommandItem,
|
|
@@ -5445,18 +5313,15 @@ function SingleMenuCommand({
|
|
|
5445
5313
|
] });
|
|
5446
5314
|
}
|
|
5447
5315
|
SingleMenuCommand.displayName = "SingleMenuCommand";
|
|
5448
|
-
const Collapsible = CollapsiblePrimitive.Root;
|
|
5449
|
-
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
5450
|
-
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
5451
5316
|
function SingleMenuItem({
|
|
5452
5317
|
label,
|
|
5453
5318
|
selected = false,
|
|
5454
5319
|
onClick
|
|
5455
5320
|
}) {
|
|
5456
|
-
const
|
|
5457
|
-
return /* @__PURE__ */ jsxs("button", { type: "button", onClick, className:
|
|
5458
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
5459
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5321
|
+
const s = menuItem({ selected });
|
|
5322
|
+
return /* @__PURE__ */ jsxs("button", { type: "button", onClick, className: s.root(), children: [
|
|
5323
|
+
/* @__PURE__ */ jsx("div", { className: s.border() }),
|
|
5324
|
+
/* @__PURE__ */ jsx("span", { className: s.text(), children: label })
|
|
5460
5325
|
] });
|
|
5461
5326
|
}
|
|
5462
5327
|
SingleMenuItem.displayName = "SingleMenuItem";
|
|
@@ -5477,7 +5342,7 @@ function SingleMenuCategory({
|
|
|
5477
5342
|
const containsActive = hasItems && items.some((item) => item.id === activeItemId);
|
|
5478
5343
|
const selected = !expanded ? hasItems ? isOpen || containsActive : isLeafActive : hasItems ? isOpen : isLeafActive && openCategoryId == null;
|
|
5479
5344
|
const state = selected ? "selected" : "default";
|
|
5480
|
-
const
|
|
5345
|
+
const s = category({ state, collapsed: !expanded });
|
|
5481
5346
|
const handleToggle = () => {
|
|
5482
5347
|
if (hasItems) {
|
|
5483
5348
|
setOpenCategoryId(isOpen ? null : id);
|
|
@@ -5502,17 +5367,17 @@ function SingleMenuCategory({
|
|
|
5502
5367
|
handleToggle();
|
|
5503
5368
|
}
|
|
5504
5369
|
},
|
|
5505
|
-
className:
|
|
5506
|
-
children: /* @__PURE__ */ jsx("span", { className:
|
|
5370
|
+
className: s.root(),
|
|
5371
|
+
children: /* @__PURE__ */ jsx("span", { className: s.icon(), children: icon })
|
|
5507
5372
|
}
|
|
5508
5373
|
),
|
|
5509
5374
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", sideOffset: 8, children: label })
|
|
5510
5375
|
] });
|
|
5511
5376
|
}
|
|
5512
5377
|
if (!hasItems) {
|
|
5513
|
-
return /* @__PURE__ */ jsxs("button", { type: "button", onClick: handleToggle, className:
|
|
5514
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5515
|
-
/* @__PURE__ */ jsx("span", { className: cn(
|
|
5378
|
+
return /* @__PURE__ */ jsxs("button", { type: "button", onClick: handleToggle, className: s.root(), children: [
|
|
5379
|
+
/* @__PURE__ */ jsx("span", { className: s.icon(), children: icon }),
|
|
5380
|
+
/* @__PURE__ */ jsx("span", { className: cn(s.text(), styles.textFadeIn), children: label })
|
|
5516
5381
|
] });
|
|
5517
5382
|
}
|
|
5518
5383
|
return /* @__PURE__ */ jsxs(
|
|
@@ -5524,10 +5389,10 @@ function SingleMenuCategory({
|
|
|
5524
5389
|
onCategoryClick?.();
|
|
5525
5390
|
},
|
|
5526
5391
|
children: [
|
|
5527
|
-
/* @__PURE__ */ jsxs(CollapsibleTrigger, { className:
|
|
5528
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5529
|
-
/* @__PURE__ */ jsx("span", { className: cn(
|
|
5530
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: cn(
|
|
5392
|
+
/* @__PURE__ */ jsxs(CollapsibleTrigger, { className: s.root(), children: [
|
|
5393
|
+
/* @__PURE__ */ jsx("span", { className: s.icon(), children: icon }),
|
|
5394
|
+
/* @__PURE__ */ jsx("span", { className: cn(s.text(), styles.textFadeIn), children: label }),
|
|
5395
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn(s.chevron(), isOpen && "rotate-180") })
|
|
5531
5396
|
] }),
|
|
5532
5397
|
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: styles.subItemList, children: items.map((item) => /* @__PURE__ */ jsx(
|
|
5533
5398
|
SingleMenuItem,
|
|
@@ -5551,25 +5416,25 @@ function SingleMenuFooter({
|
|
|
5551
5416
|
onAction
|
|
5552
5417
|
}) {
|
|
5553
5418
|
const { expanded } = useSingleMenuSidebar();
|
|
5554
|
-
const
|
|
5419
|
+
const s = styles.footer;
|
|
5555
5420
|
const triggerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5556
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
5421
|
+
/* @__PURE__ */ jsx("div", { className: s.avatar, children: avatar ?? /* @__PURE__ */ jsx(User, { className: s.avatarIcon }) }),
|
|
5557
5422
|
expanded && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5558
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
5559
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5560
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5423
|
+
/* @__PURE__ */ jsxs("div", { className: s.textContainer, children: [
|
|
5424
|
+
/* @__PURE__ */ jsx("span", { className: s.name, children: name }),
|
|
5425
|
+
/* @__PURE__ */ jsx("span", { className: s.email, children: email })
|
|
5561
5426
|
] }),
|
|
5562
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className:
|
|
5427
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: s.chevron })
|
|
5563
5428
|
] })
|
|
5564
5429
|
] });
|
|
5565
5430
|
if (!actions || actions.length === 0) {
|
|
5566
|
-
return /* @__PURE__ */ jsx("div", { className:
|
|
5431
|
+
return /* @__PURE__ */ jsx("div", { className: s.wrapper, children: /* @__PURE__ */ jsx("div", { className: cn(s.button, !expanded && "justify-center px-0"), children: triggerContent }) });
|
|
5567
5432
|
}
|
|
5568
|
-
return /* @__PURE__ */ jsx("div", { className:
|
|
5433
|
+
return /* @__PURE__ */ jsx("div", { className: s.wrapper, children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
5569
5434
|
/* @__PURE__ */ jsx(
|
|
5570
5435
|
DropdownMenuTrigger,
|
|
5571
5436
|
{
|
|
5572
|
-
className: cn(
|
|
5437
|
+
className: cn(s.button, !expanded && "justify-center px-0"),
|
|
5573
5438
|
children: triggerContent
|
|
5574
5439
|
}
|
|
5575
5440
|
),
|
|
@@ -5580,9 +5445,9 @@ function SingleMenuFooter({
|
|
|
5580
5445
|
sideOffset: 8,
|
|
5581
5446
|
align: expanded ? "end" : "start",
|
|
5582
5447
|
children: [
|
|
5583
|
-
/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsxs(DropdownMenuLabel, { className:
|
|
5584
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5585
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
5448
|
+
/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsxs(DropdownMenuLabel, { className: s.dropdownLabel, children: [
|
|
5449
|
+
/* @__PURE__ */ jsx("span", { className: s.dropdownLabelName, children: name }),
|
|
5450
|
+
/* @__PURE__ */ jsx("span", { className: s.dropdownLabelEmail, children: email })
|
|
5586
5451
|
] }) }),
|
|
5587
5452
|
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
5588
5453
|
actions.map((action) => /* @__PURE__ */ jsxs(
|
|
@@ -5590,9 +5455,9 @@ function SingleMenuFooter({
|
|
|
5590
5455
|
{
|
|
5591
5456
|
variant: action.variant === "destructive" ? "destructive" : "default",
|
|
5592
5457
|
onClick: () => onAction?.(action.id),
|
|
5593
|
-
className:
|
|
5458
|
+
className: s.dropdownItem,
|
|
5594
5459
|
children: [
|
|
5595
|
-
action.icon && /* @__PURE__ */ jsx("span", { className:
|
|
5460
|
+
action.icon && /* @__PURE__ */ jsx("span", { className: s.dropdownItemIcon, children: action.icon }),
|
|
5596
5461
|
/* @__PURE__ */ jsx("span", { children: action.label })
|
|
5597
5462
|
]
|
|
5598
5463
|
},
|
|
@@ -5644,7 +5509,7 @@ function SingleMenuSidebar({
|
|
|
5644
5509
|
defaultModuleId ?? modules?.[0]?.id
|
|
5645
5510
|
);
|
|
5646
5511
|
const currentModuleId = activeModuleId ?? internalModuleId;
|
|
5647
|
-
const activeModule = hasModules ? modules.find((
|
|
5512
|
+
const activeModule = hasModules ? modules.find((m2) => m2.id === currentModuleId) ?? modules[0] : void 0;
|
|
5648
5513
|
const handleModuleChange = (id) => {
|
|
5649
5514
|
if (activeModuleId === void 0) setInternalModuleId(id);
|
|
5650
5515
|
onModuleChange?.(id);
|
|
@@ -5653,10 +5518,10 @@ function SingleMenuSidebar({
|
|
|
5653
5518
|
icon: activeModule.icon,
|
|
5654
5519
|
title: activeModule.title,
|
|
5655
5520
|
subtitle: activeModule.subtitle ?? "",
|
|
5656
|
-
options: modules.map((
|
|
5657
|
-
id:
|
|
5658
|
-
label:
|
|
5659
|
-
icon:
|
|
5521
|
+
options: modules.map((m2) => ({
|
|
5522
|
+
id: m2.id,
|
|
5523
|
+
label: m2.title,
|
|
5524
|
+
icon: m2.icon
|
|
5660
5525
|
})),
|
|
5661
5526
|
onModuleChange: handleModuleChange
|
|
5662
5527
|
} : module;
|
|
@@ -5827,30 +5692,30 @@ class Adder {
|
|
|
5827
5692
|
this._n = 0;
|
|
5828
5693
|
}
|
|
5829
5694
|
add(x2) {
|
|
5830
|
-
const
|
|
5831
|
-
let
|
|
5832
|
-
for (let
|
|
5833
|
-
const y2 =
|
|
5834
|
-
if (lo)
|
|
5695
|
+
const p4 = this._partials;
|
|
5696
|
+
let i3 = 0;
|
|
5697
|
+
for (let j2 = 0; j2 < this._n && j2 < 32; j2++) {
|
|
5698
|
+
const y2 = p4[j2], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2);
|
|
5699
|
+
if (lo) p4[i3++] = lo;
|
|
5835
5700
|
x2 = hi;
|
|
5836
5701
|
}
|
|
5837
|
-
|
|
5838
|
-
this._n =
|
|
5702
|
+
p4[i3] = x2;
|
|
5703
|
+
this._n = i3 + 1;
|
|
5839
5704
|
return this;
|
|
5840
5705
|
}
|
|
5841
5706
|
valueOf() {
|
|
5842
|
-
const
|
|
5707
|
+
const p4 = this._partials;
|
|
5843
5708
|
let n2 = this._n, x2, y2, lo, hi = 0;
|
|
5844
5709
|
if (n2 > 0) {
|
|
5845
|
-
hi =
|
|
5710
|
+
hi = p4[--n2];
|
|
5846
5711
|
while (n2 > 0) {
|
|
5847
5712
|
x2 = hi;
|
|
5848
|
-
y2 =
|
|
5713
|
+
y2 = p4[--n2];
|
|
5849
5714
|
hi = x2 + y2;
|
|
5850
5715
|
lo = y2 - (hi - x2);
|
|
5851
5716
|
if (lo) break;
|
|
5852
5717
|
}
|
|
5853
|
-
if (n2 > 0 && (lo < 0 &&
|
|
5718
|
+
if (n2 > 0 && (lo < 0 && p4[n2 - 1] < 0 || lo > 0 && p4[n2 - 1] > 0)) {
|
|
5854
5719
|
y2 = lo * 2;
|
|
5855
5720
|
x2 = hi + y2;
|
|
5856
5721
|
if (y2 == x2 - hi) hi = x2;
|
|
@@ -5904,8 +5769,8 @@ var streamObjectType = {
|
|
|
5904
5769
|
streamGeometry(object2.geometry, stream);
|
|
5905
5770
|
},
|
|
5906
5771
|
FeatureCollection: function(object2, stream) {
|
|
5907
|
-
var features = object2.features,
|
|
5908
|
-
while (++
|
|
5772
|
+
var features = object2.features, i3 = -1, n2 = features.length;
|
|
5773
|
+
while (++i3 < n2) streamGeometry(features[i3].geometry, stream);
|
|
5909
5774
|
}
|
|
5910
5775
|
};
|
|
5911
5776
|
var streamGeometryType = {
|
|
@@ -5917,38 +5782,38 @@ var streamGeometryType = {
|
|
|
5917
5782
|
stream.point(object2[0], object2[1], object2[2]);
|
|
5918
5783
|
},
|
|
5919
5784
|
MultiPoint: function(object2, stream) {
|
|
5920
|
-
var coordinates = object2.coordinates,
|
|
5921
|
-
while (++
|
|
5785
|
+
var coordinates = object2.coordinates, i3 = -1, n2 = coordinates.length;
|
|
5786
|
+
while (++i3 < n2) object2 = coordinates[i3], stream.point(object2[0], object2[1], object2[2]);
|
|
5922
5787
|
},
|
|
5923
5788
|
LineString: function(object2, stream) {
|
|
5924
5789
|
streamLine(object2.coordinates, stream, 0);
|
|
5925
5790
|
},
|
|
5926
5791
|
MultiLineString: function(object2, stream) {
|
|
5927
|
-
var coordinates = object2.coordinates,
|
|
5928
|
-
while (++
|
|
5792
|
+
var coordinates = object2.coordinates, i3 = -1, n2 = coordinates.length;
|
|
5793
|
+
while (++i3 < n2) streamLine(coordinates[i3], stream, 0);
|
|
5929
5794
|
},
|
|
5930
5795
|
Polygon: function(object2, stream) {
|
|
5931
5796
|
streamPolygon(object2.coordinates, stream);
|
|
5932
5797
|
},
|
|
5933
5798
|
MultiPolygon: function(object2, stream) {
|
|
5934
|
-
var coordinates = object2.coordinates,
|
|
5935
|
-
while (++
|
|
5799
|
+
var coordinates = object2.coordinates, i3 = -1, n2 = coordinates.length;
|
|
5800
|
+
while (++i3 < n2) streamPolygon(coordinates[i3], stream);
|
|
5936
5801
|
},
|
|
5937
5802
|
GeometryCollection: function(object2, stream) {
|
|
5938
|
-
var geometries = object2.geometries,
|
|
5939
|
-
while (++
|
|
5803
|
+
var geometries = object2.geometries, i3 = -1, n2 = geometries.length;
|
|
5804
|
+
while (++i3 < n2) streamGeometry(geometries[i3], stream);
|
|
5940
5805
|
}
|
|
5941
5806
|
};
|
|
5942
5807
|
function streamLine(coordinates, stream, closed) {
|
|
5943
|
-
var
|
|
5808
|
+
var i3 = -1, n2 = coordinates.length - closed, coordinate;
|
|
5944
5809
|
stream.lineStart();
|
|
5945
|
-
while (++
|
|
5810
|
+
while (++i3 < n2) coordinate = coordinates[i3], stream.point(coordinate[0], coordinate[1], coordinate[2]);
|
|
5946
5811
|
stream.lineEnd();
|
|
5947
5812
|
}
|
|
5948
5813
|
function streamPolygon(coordinates, stream) {
|
|
5949
|
-
var
|
|
5814
|
+
var i3 = -1, n2 = coordinates.length;
|
|
5950
5815
|
stream.polygonStart();
|
|
5951
|
-
while (++
|
|
5816
|
+
while (++i3 < n2) streamLine(coordinates[i3], stream, 1);
|
|
5952
5817
|
stream.polygonEnd();
|
|
5953
5818
|
}
|
|
5954
5819
|
function geoStream(object2, stream) {
|
|
@@ -5965,28 +5830,28 @@ function cartesian(spherical2) {
|
|
|
5965
5830
|
var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
|
|
5966
5831
|
return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
|
|
5967
5832
|
}
|
|
5968
|
-
function cartesianDot(
|
|
5969
|
-
return
|
|
5833
|
+
function cartesianDot(a11, b4) {
|
|
5834
|
+
return a11[0] * b4[0] + a11[1] * b4[1] + a11[2] * b4[2];
|
|
5970
5835
|
}
|
|
5971
|
-
function cartesianCross(
|
|
5972
|
-
return [
|
|
5836
|
+
function cartesianCross(a11, b4) {
|
|
5837
|
+
return [a11[1] * b4[2] - a11[2] * b4[1], a11[2] * b4[0] - a11[0] * b4[2], a11[0] * b4[1] - a11[1] * b4[0]];
|
|
5973
5838
|
}
|
|
5974
|
-
function cartesianAddInPlace(
|
|
5975
|
-
|
|
5839
|
+
function cartesianAddInPlace(a11, b4) {
|
|
5840
|
+
a11[0] += b4[0], a11[1] += b4[1], a11[2] += b4[2];
|
|
5976
5841
|
}
|
|
5977
|
-
function cartesianScale(vector,
|
|
5978
|
-
return [vector[0] *
|
|
5842
|
+
function cartesianScale(vector, k2) {
|
|
5843
|
+
return [vector[0] * k2, vector[1] * k2, vector[2] * k2];
|
|
5979
5844
|
}
|
|
5980
5845
|
function cartesianNormalizeInPlace(d3) {
|
|
5981
|
-
var
|
|
5982
|
-
d3[0] /=
|
|
5846
|
+
var l2 = sqrt(d3[0] * d3[0] + d3[1] * d3[1] + d3[2] * d3[2]);
|
|
5847
|
+
d3[0] /= l2, d3[1] /= l2, d3[2] /= l2;
|
|
5983
5848
|
}
|
|
5984
|
-
function compose(
|
|
5849
|
+
function compose(a11, b4) {
|
|
5985
5850
|
function compose2(x2, y2) {
|
|
5986
|
-
return x2 =
|
|
5851
|
+
return x2 = a11(x2, y2), b4(x2[0], x2[1]);
|
|
5987
5852
|
}
|
|
5988
|
-
if (
|
|
5989
|
-
return x2 =
|
|
5853
|
+
if (a11.invert && b4.invert) compose2.invert = function(x2, y2) {
|
|
5854
|
+
return x2 = b4.invert(x2, y2), x2 && a11.invert(x2[0], x2[1]);
|
|
5990
5855
|
};
|
|
5991
5856
|
return compose2;
|
|
5992
5857
|
}
|
|
@@ -6013,17 +5878,17 @@ function rotationLambda(deltaLambda) {
|
|
|
6013
5878
|
function rotationPhiGamma(deltaPhi, deltaGamma) {
|
|
6014
5879
|
var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
|
|
6015
5880
|
function rotation2(lambda, phi) {
|
|
6016
|
-
var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi),
|
|
5881
|
+
var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaPhi + x2 * sinDeltaPhi;
|
|
6017
5882
|
return [
|
|
6018
|
-
atan2(y2 * cosDeltaGamma -
|
|
6019
|
-
asin(
|
|
5883
|
+
atan2(y2 * cosDeltaGamma - k2 * sinDeltaGamma, x2 * cosDeltaPhi - z2 * sinDeltaPhi),
|
|
5884
|
+
asin(k2 * cosDeltaGamma + y2 * sinDeltaGamma)
|
|
6020
5885
|
];
|
|
6021
5886
|
}
|
|
6022
5887
|
rotation2.invert = function(lambda, phi) {
|
|
6023
|
-
var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi),
|
|
5888
|
+
var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaGamma - y2 * sinDeltaGamma;
|
|
6024
5889
|
return [
|
|
6025
|
-
atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi +
|
|
6026
|
-
asin(
|
|
5890
|
+
atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi + k2 * sinDeltaPhi),
|
|
5891
|
+
asin(k2 * cosDeltaPhi - x2 * sinDeltaPhi)
|
|
6027
5892
|
];
|
|
6028
5893
|
};
|
|
6029
5894
|
return rotation2;
|
|
@@ -6051,8 +5916,8 @@ function circleStream(stream, radius, delta, direction, t0, t1) {
|
|
|
6051
5916
|
t1 = circleRadius(cosRadius, t1);
|
|
6052
5917
|
if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau;
|
|
6053
5918
|
}
|
|
6054
|
-
for (var point,
|
|
6055
|
-
point = spherical([cosRadius, -sinRadius * cos(
|
|
5919
|
+
for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {
|
|
5920
|
+
point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);
|
|
6056
5921
|
stream.point(point[0], point[1]);
|
|
6057
5922
|
}
|
|
6058
5923
|
}
|
|
@@ -6065,8 +5930,8 @@ function circleRadius(cosRadius, point) {
|
|
|
6065
5930
|
function clipBuffer() {
|
|
6066
5931
|
var lines = [], line;
|
|
6067
5932
|
return {
|
|
6068
|
-
point: function(x2, y2,
|
|
6069
|
-
line.push([x2, y2,
|
|
5933
|
+
point: function(x2, y2, m2) {
|
|
5934
|
+
line.push([x2, y2, m2]);
|
|
6070
5935
|
},
|
|
6071
5936
|
lineStart: function() {
|
|
6072
5937
|
lines.push(line = []);
|
|
@@ -6083,8 +5948,8 @@ function clipBuffer() {
|
|
|
6083
5948
|
}
|
|
6084
5949
|
};
|
|
6085
5950
|
}
|
|
6086
|
-
function pointEqual(
|
|
6087
|
-
return abs(
|
|
5951
|
+
function pointEqual(a11, b4) {
|
|
5952
|
+
return abs(a11[0] - b4[0]) < epsilon && abs(a11[1] - b4[1]) < epsilon;
|
|
6088
5953
|
}
|
|
6089
5954
|
function Intersection(point, points, other, entry) {
|
|
6090
5955
|
this.x = point;
|
|
@@ -6095,14 +5960,14 @@ function Intersection(point, points, other, entry) {
|
|
|
6095
5960
|
this.n = this.p = null;
|
|
6096
5961
|
}
|
|
6097
5962
|
function clipRejoin(segments, compareIntersection2, startInside, interpolate, stream) {
|
|
6098
|
-
var subject = [], clip2 = [],
|
|
5963
|
+
var subject = [], clip2 = [], i3, n2;
|
|
6099
5964
|
segments.forEach(function(segment) {
|
|
6100
5965
|
if ((n3 = segment.length - 1) <= 0) return;
|
|
6101
5966
|
var n3, p0 = segment[0], p1 = segment[n3], x2;
|
|
6102
5967
|
if (pointEqual(p0, p1)) {
|
|
6103
5968
|
if (!p0[2] && !p1[2]) {
|
|
6104
5969
|
stream.lineStart();
|
|
6105
|
-
for (
|
|
5970
|
+
for (i3 = 0; i3 < n3; ++i3) stream.point((p0 = segment[i3])[0], p0[1]);
|
|
6106
5971
|
stream.lineEnd();
|
|
6107
5972
|
return;
|
|
6108
5973
|
}
|
|
@@ -6117,8 +5982,8 @@ function clipRejoin(segments, compareIntersection2, startInside, interpolate, st
|
|
|
6117
5982
|
clip2.sort(compareIntersection2);
|
|
6118
5983
|
link(subject);
|
|
6119
5984
|
link(clip2);
|
|
6120
|
-
for (
|
|
6121
|
-
clip2[
|
|
5985
|
+
for (i3 = 0, n2 = clip2.length; i3 < n2; ++i3) {
|
|
5986
|
+
clip2[i3].e = startInside = !startInside;
|
|
6122
5987
|
}
|
|
6123
5988
|
var start = subject[0], points, point;
|
|
6124
5989
|
while (1) {
|
|
@@ -6130,7 +5995,7 @@ function clipRejoin(segments, compareIntersection2, startInside, interpolate, st
|
|
|
6130
5995
|
current.v = current.o.v = true;
|
|
6131
5996
|
if (current.e) {
|
|
6132
5997
|
if (isSubject) {
|
|
6133
|
-
for (
|
|
5998
|
+
for (i3 = 0, n2 = points.length; i3 < n2; ++i3) stream.point((point = points[i3])[0], point[1]);
|
|
6134
5999
|
} else {
|
|
6135
6000
|
interpolate(current.x, current.n.x, 1, stream);
|
|
6136
6001
|
}
|
|
@@ -6138,7 +6003,7 @@ function clipRejoin(segments, compareIntersection2, startInside, interpolate, st
|
|
|
6138
6003
|
} else {
|
|
6139
6004
|
if (isSubject) {
|
|
6140
6005
|
points = current.p.z;
|
|
6141
|
-
for (
|
|
6006
|
+
for (i3 = points.length - 1; i3 >= 0; --i3) stream.point((point = points[i3])[0], point[1]);
|
|
6142
6007
|
} else {
|
|
6143
6008
|
interpolate(current.x, current.p.x, -1, stream);
|
|
6144
6009
|
}
|
|
@@ -6153,14 +6018,14 @@ function clipRejoin(segments, compareIntersection2, startInside, interpolate, st
|
|
|
6153
6018
|
}
|
|
6154
6019
|
function link(array) {
|
|
6155
6020
|
if (!(n2 = array.length)) return;
|
|
6156
|
-
var n2,
|
|
6157
|
-
while (++
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6021
|
+
var n2, i3 = 0, a11 = array[0], b4;
|
|
6022
|
+
while (++i3 < n2) {
|
|
6023
|
+
a11.n = b4 = array[i3];
|
|
6024
|
+
b4.p = a11;
|
|
6025
|
+
a11 = b4;
|
|
6161
6026
|
}
|
|
6162
|
-
|
|
6163
|
-
|
|
6027
|
+
a11.n = b4 = array[0];
|
|
6028
|
+
b4.p = a11;
|
|
6164
6029
|
}
|
|
6165
6030
|
function longitude(point) {
|
|
6166
6031
|
return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);
|
|
@@ -6170,12 +6035,12 @@ function polygonContains(polygon, point) {
|
|
|
6170
6035
|
var sum = new Adder();
|
|
6171
6036
|
if (sinPhi === 1) phi = halfPi + epsilon;
|
|
6172
6037
|
else if (sinPhi === -1) phi = -halfPi - epsilon;
|
|
6173
|
-
for (var
|
|
6174
|
-
if (!(
|
|
6175
|
-
var ring,
|
|
6176
|
-
for (var
|
|
6177
|
-
var point1 = ring[
|
|
6178
|
-
sum.add(atan2(
|
|
6038
|
+
for (var i3 = 0, n2 = polygon.length; i3 < n2; ++i3) {
|
|
6039
|
+
if (!(m2 = (ring = polygon[i3]).length)) continue;
|
|
6040
|
+
var ring, m2, point0 = ring[m2 - 1], lambda0 = longitude(point0), phi0 = point0[1] / 2 + quarterPi, sinPhi0 = sin(phi0), cosPhi0 = cos(phi0);
|
|
6041
|
+
for (var j2 = 0; j2 < m2; ++j2, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
|
|
6042
|
+
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;
|
|
6043
|
+
sum.add(atan2(k2 * sign2 * sin(absDelta), cosPhi0 * cosPhi1 + k2 * cos(absDelta)));
|
|
6179
6044
|
angle += antimeridian ? delta + sign2 * tau : delta;
|
|
6180
6045
|
if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {
|
|
6181
6046
|
var arc = cartesianCross(cartesian(point0), cartesian(point1));
|
|
@@ -6256,17 +6121,17 @@ function clip(pointVisible, clipLine2, interpolate, start) {
|
|
|
6256
6121
|
function ringEnd() {
|
|
6257
6122
|
pointRing(ring[0][0], ring[0][1]);
|
|
6258
6123
|
ringSink.lineEnd();
|
|
6259
|
-
var clean = ringSink.clean(), ringSegments = ringBuffer.result(),
|
|
6124
|
+
var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i3, n2 = ringSegments.length, m2, segment, point2;
|
|
6260
6125
|
ring.pop();
|
|
6261
6126
|
polygon.push(ring);
|
|
6262
6127
|
ring = null;
|
|
6263
6128
|
if (!n2) return;
|
|
6264
6129
|
if (clean & 1) {
|
|
6265
6130
|
segment = ringSegments[0];
|
|
6266
|
-
if ((
|
|
6131
|
+
if ((m2 = segment.length - 1) > 0) {
|
|
6267
6132
|
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
|
|
6268
6133
|
sink.lineStart();
|
|
6269
|
-
for (
|
|
6134
|
+
for (i3 = 0; i3 < m2; ++i3) sink.point((point2 = segment[i3])[0], point2[1]);
|
|
6270
6135
|
sink.lineEnd();
|
|
6271
6136
|
}
|
|
6272
6137
|
return;
|
|
@@ -6280,8 +6145,8 @@ function clip(pointVisible, clipLine2, interpolate, start) {
|
|
|
6280
6145
|
function validSegment(segment) {
|
|
6281
6146
|
return segment.length > 1;
|
|
6282
6147
|
}
|
|
6283
|
-
function compareIntersection(
|
|
6284
|
-
return ((
|
|
6148
|
+
function compareIntersection(a11, b4) {
|
|
6149
|
+
return ((a11 = a11.x)[0] < 0 ? a11[1] - halfPi - epsilon : halfPi - a11[1]) - ((b4 = b4.x)[0] < 0 ? b4[1] - halfPi - epsilon : halfPi - b4[1]);
|
|
6285
6150
|
}
|
|
6286
6151
|
const clipAntimeridian = clip(
|
|
6287
6152
|
function() {
|
|
@@ -6373,7 +6238,7 @@ function clipCircle(radius) {
|
|
|
6373
6238
|
clean = 1;
|
|
6374
6239
|
},
|
|
6375
6240
|
point: function(lambda, phi) {
|
|
6376
|
-
var point1 = [lambda, phi], point2, v2 = visible(lambda, phi),
|
|
6241
|
+
var point1 = [lambda, phi], point2, v2 = visible(lambda, phi), c3 = smallRadius ? v2 ? 0 : code(lambda, phi) : v2 ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
|
|
6377
6242
|
if (!point0 && (v00 = v0 = v2)) stream.lineStart();
|
|
6378
6243
|
if (v2 !== v0) {
|
|
6379
6244
|
point2 = intersect(point0, point1);
|
|
@@ -6393,26 +6258,26 @@ function clipCircle(radius) {
|
|
|
6393
6258
|
}
|
|
6394
6259
|
point0 = point2;
|
|
6395
6260
|
} else if (notHemisphere && point0 && smallRadius ^ v2) {
|
|
6396
|
-
var
|
|
6397
|
-
if (!(
|
|
6261
|
+
var t;
|
|
6262
|
+
if (!(c3 & c0) && (t = intersect(point1, point0, true))) {
|
|
6398
6263
|
clean = 0;
|
|
6399
6264
|
if (smallRadius) {
|
|
6400
6265
|
stream.lineStart();
|
|
6401
|
-
stream.point(
|
|
6402
|
-
stream.point(
|
|
6266
|
+
stream.point(t[0][0], t[0][1]);
|
|
6267
|
+
stream.point(t[1][0], t[1][1]);
|
|
6403
6268
|
stream.lineEnd();
|
|
6404
6269
|
} else {
|
|
6405
|
-
stream.point(
|
|
6270
|
+
stream.point(t[1][0], t[1][1]);
|
|
6406
6271
|
stream.lineEnd();
|
|
6407
6272
|
stream.lineStart();
|
|
6408
|
-
stream.point(
|
|
6273
|
+
stream.point(t[0][0], t[0][1], 3);
|
|
6409
6274
|
}
|
|
6410
6275
|
}
|
|
6411
6276
|
}
|
|
6412
6277
|
if (v2 && (!point0 || !pointEqual(point0, point1))) {
|
|
6413
6278
|
stream.point(point1[0], point1[1]);
|
|
6414
6279
|
}
|
|
6415
|
-
point0 = point1, v0 = v2, c0 =
|
|
6280
|
+
point0 = point1, v0 = v2, c0 = c3;
|
|
6416
6281
|
},
|
|
6417
6282
|
lineEnd: function() {
|
|
6418
6283
|
if (v0) stream.lineEnd();
|
|
@@ -6425,82 +6290,82 @@ function clipCircle(radius) {
|
|
|
6425
6290
|
}
|
|
6426
6291
|
};
|
|
6427
6292
|
}
|
|
6428
|
-
function intersect(
|
|
6429
|
-
var pa = cartesian(
|
|
6293
|
+
function intersect(a11, b4, two) {
|
|
6294
|
+
var pa = cartesian(a11), pb = cartesian(b4);
|
|
6430
6295
|
var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
|
|
6431
|
-
if (!determinant) return !two &&
|
|
6432
|
-
var c1 = cr * n2n2 / determinant,
|
|
6433
|
-
cartesianAddInPlace(A3,
|
|
6434
|
-
var u3 = n1xn2,
|
|
6296
|
+
if (!determinant) return !two && a11;
|
|
6297
|
+
var c1 = cr * n2n2 / determinant, c22 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A3 = cartesianScale(n1, c1), B3 = cartesianScale(n2, c22);
|
|
6298
|
+
cartesianAddInPlace(A3, B3);
|
|
6299
|
+
var u3 = n1xn2, w3 = cartesianDot(A3, u3), uu = cartesianDot(u3, u3), t2 = w3 * w3 - uu * (cartesianDot(A3, A3) - 1);
|
|
6435
6300
|
if (t2 < 0) return;
|
|
6436
|
-
var
|
|
6301
|
+
var t = sqrt(t2), q2 = cartesianScale(u3, (-w3 - t) / uu);
|
|
6437
6302
|
cartesianAddInPlace(q2, A3);
|
|
6438
6303
|
q2 = spherical(q2);
|
|
6439
6304
|
if (!two) return q2;
|
|
6440
|
-
var lambda0 =
|
|
6305
|
+
var lambda0 = a11[0], lambda1 = b4[0], phi0 = a11[1], phi1 = b4[1], z2;
|
|
6441
6306
|
if (lambda1 < lambda0) z2 = lambda0, lambda0 = lambda1, lambda1 = z2;
|
|
6442
6307
|
var delta2 = lambda1 - lambda0, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
|
|
6443
6308
|
if (!polar && phi1 < phi0) z2 = phi0, phi0 = phi1, phi1 = z2;
|
|
6444
6309
|
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)) {
|
|
6445
|
-
var q1 = cartesianScale(u3, (-
|
|
6310
|
+
var q1 = cartesianScale(u3, (-w3 + t) / uu);
|
|
6446
6311
|
cartesianAddInPlace(q1, A3);
|
|
6447
6312
|
return [q2, spherical(q1)];
|
|
6448
6313
|
}
|
|
6449
6314
|
}
|
|
6450
6315
|
function code(lambda, phi) {
|
|
6451
|
-
var
|
|
6452
|
-
if (lambda < -
|
|
6453
|
-
else if (lambda >
|
|
6454
|
-
if (phi < -
|
|
6455
|
-
else if (phi >
|
|
6316
|
+
var r = smallRadius ? radius : pi - radius, code2 = 0;
|
|
6317
|
+
if (lambda < -r) code2 |= 1;
|
|
6318
|
+
else if (lambda > r) code2 |= 2;
|
|
6319
|
+
if (phi < -r) code2 |= 4;
|
|
6320
|
+
else if (phi > r) code2 |= 8;
|
|
6456
6321
|
return code2;
|
|
6457
6322
|
}
|
|
6458
6323
|
return clip(visible, clipLine2, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
|
|
6459
6324
|
}
|
|
6460
|
-
function clipLine(
|
|
6461
|
-
var ax =
|
|
6462
|
-
|
|
6463
|
-
if (!dx &&
|
|
6464
|
-
|
|
6325
|
+
function clipLine(a11, b4, x02, y02, x12, y12) {
|
|
6326
|
+
var ax = a11[0], ay = a11[1], bx = b4[0], by = b4[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
|
|
6327
|
+
r = x02 - ax;
|
|
6328
|
+
if (!dx && r > 0) return;
|
|
6329
|
+
r /= dx;
|
|
6465
6330
|
if (dx < 0) {
|
|
6466
|
-
if (
|
|
6467
|
-
if (
|
|
6331
|
+
if (r < t0) return;
|
|
6332
|
+
if (r < t1) t1 = r;
|
|
6468
6333
|
} else if (dx > 0) {
|
|
6469
|
-
if (
|
|
6470
|
-
if (
|
|
6334
|
+
if (r > t1) return;
|
|
6335
|
+
if (r > t0) t0 = r;
|
|
6471
6336
|
}
|
|
6472
|
-
|
|
6473
|
-
if (!dx &&
|
|
6474
|
-
|
|
6337
|
+
r = x12 - ax;
|
|
6338
|
+
if (!dx && r < 0) return;
|
|
6339
|
+
r /= dx;
|
|
6475
6340
|
if (dx < 0) {
|
|
6476
|
-
if (
|
|
6477
|
-
if (
|
|
6341
|
+
if (r > t1) return;
|
|
6342
|
+
if (r > t0) t0 = r;
|
|
6478
6343
|
} else if (dx > 0) {
|
|
6479
|
-
if (
|
|
6480
|
-
if (
|
|
6344
|
+
if (r < t0) return;
|
|
6345
|
+
if (r < t1) t1 = r;
|
|
6481
6346
|
}
|
|
6482
|
-
|
|
6483
|
-
if (!dy &&
|
|
6484
|
-
|
|
6347
|
+
r = y02 - ay;
|
|
6348
|
+
if (!dy && r > 0) return;
|
|
6349
|
+
r /= dy;
|
|
6485
6350
|
if (dy < 0) {
|
|
6486
|
-
if (
|
|
6487
|
-
if (
|
|
6351
|
+
if (r < t0) return;
|
|
6352
|
+
if (r < t1) t1 = r;
|
|
6488
6353
|
} else if (dy > 0) {
|
|
6489
|
-
if (
|
|
6490
|
-
if (
|
|
6354
|
+
if (r > t1) return;
|
|
6355
|
+
if (r > t0) t0 = r;
|
|
6491
6356
|
}
|
|
6492
|
-
|
|
6493
|
-
if (!dy &&
|
|
6494
|
-
|
|
6357
|
+
r = y12 - ay;
|
|
6358
|
+
if (!dy && r < 0) return;
|
|
6359
|
+
r /= dy;
|
|
6495
6360
|
if (dy < 0) {
|
|
6496
|
-
if (
|
|
6497
|
-
if (
|
|
6361
|
+
if (r > t1) return;
|
|
6362
|
+
if (r > t0) t0 = r;
|
|
6498
6363
|
} else if (dy > 0) {
|
|
6499
|
-
if (
|
|
6500
|
-
if (
|
|
6364
|
+
if (r < t0) return;
|
|
6365
|
+
if (r < t1) t1 = r;
|
|
6501
6366
|
}
|
|
6502
|
-
if (t0 > 0)
|
|
6503
|
-
if (t1 < 1)
|
|
6367
|
+
if (t0 > 0) a11[0] = ax + t0 * dx, a11[1] = ay + t0 * dy;
|
|
6368
|
+
if (t1 < 1) b4[0] = ax + t1 * dx, b4[1] = ay + t1 * dy;
|
|
6504
6369
|
return true;
|
|
6505
6370
|
}
|
|
6506
6371
|
var clipMax = 1e9, clipMin = -clipMax;
|
|
@@ -6509,24 +6374,24 @@ function clipRectangle(x02, y02, x12, y12) {
|
|
|
6509
6374
|
return x02 <= x2 && x2 <= x12 && y02 <= y2 && y2 <= y12;
|
|
6510
6375
|
}
|
|
6511
6376
|
function interpolate(from, to, direction, stream) {
|
|
6512
|
-
var
|
|
6513
|
-
if (from == null || (
|
|
6377
|
+
var a11 = 0, a13 = 0;
|
|
6378
|
+
if (from == null || (a11 = corner(from, direction)) !== (a13 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
|
|
6514
6379
|
do
|
|
6515
|
-
stream.point(
|
|
6516
|
-
while ((
|
|
6380
|
+
stream.point(a11 === 0 || a11 === 3 ? x02 : x12, a11 > 1 ? y12 : y02);
|
|
6381
|
+
while ((a11 = (a11 + direction + 4) % 4) !== a13);
|
|
6517
6382
|
} else {
|
|
6518
6383
|
stream.point(to[0], to[1]);
|
|
6519
6384
|
}
|
|
6520
6385
|
}
|
|
6521
|
-
function corner(
|
|
6522
|
-
return abs(
|
|
6386
|
+
function corner(p4, direction) {
|
|
6387
|
+
return abs(p4[0] - x02) < epsilon ? direction > 0 ? 0 : 3 : abs(p4[0] - x12) < epsilon ? direction > 0 ? 2 : 1 : abs(p4[1] - y02) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
|
|
6523
6388
|
}
|
|
6524
|
-
function compareIntersection2(
|
|
6525
|
-
return comparePoint(
|
|
6389
|
+
function compareIntersection2(a11, b4) {
|
|
6390
|
+
return comparePoint(a11.x, b4.x);
|
|
6526
6391
|
}
|
|
6527
|
-
function comparePoint(
|
|
6528
|
-
var ca = corner(
|
|
6529
|
-
return ca !== cb ? ca - cb : ca === 0 ?
|
|
6392
|
+
function comparePoint(a11, b4) {
|
|
6393
|
+
var ca = corner(a11, 1), cb = corner(b4, 1);
|
|
6394
|
+
return ca !== cb ? ca - cb : ca === 0 ? b4[1] - a11[1] : ca === 1 ? a11[0] - b4[0] : ca === 2 ? a11[1] - b4[1] : b4[0] - a11[0];
|
|
6530
6395
|
}
|
|
6531
6396
|
return function(stream) {
|
|
6532
6397
|
var activeStream = stream, bufferStream = clipBuffer(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean;
|
|
@@ -6542,13 +6407,13 @@ function clipRectangle(x02, y02, x12, y12) {
|
|
|
6542
6407
|
}
|
|
6543
6408
|
function polygonInside() {
|
|
6544
6409
|
var winding = 0;
|
|
6545
|
-
for (var
|
|
6546
|
-
for (var ring2 = polygon[
|
|
6547
|
-
|
|
6410
|
+
for (var i3 = 0, n2 = polygon.length; i3 < n2; ++i3) {
|
|
6411
|
+
for (var ring2 = polygon[i3], j2 = 1, m2 = ring2.length, point2 = ring2[0], a02, a13, b0 = point2[0], b1 = point2[1]; j2 < m2; ++j2) {
|
|
6412
|
+
a02 = b0, a13 = b1, point2 = ring2[j2], b0 = point2[0], b1 = point2[1];
|
|
6548
6413
|
if (a13 <= y12) {
|
|
6549
|
-
if (b1 > y12 && (b0 -
|
|
6414
|
+
if (b1 > y12 && (b0 - a02) * (y12 - a13) > (b1 - a13) * (x02 - a02)) ++winding;
|
|
6550
6415
|
} else {
|
|
6551
|
-
if (b1 <= y12 && (b0 -
|
|
6416
|
+
if (b1 <= y12 && (b0 - a02) * (y12 - a13) < (b1 - a13) * (x02 - a02)) --winding;
|
|
6552
6417
|
}
|
|
6553
6418
|
}
|
|
6554
6419
|
}
|
|
@@ -6602,13 +6467,13 @@ function clipRectangle(x02, y02, x12, y12) {
|
|
|
6602
6467
|
} else {
|
|
6603
6468
|
if (v2 && v_) activeStream.point(x2, y2);
|
|
6604
6469
|
else {
|
|
6605
|
-
var
|
|
6606
|
-
if (clipLine(
|
|
6470
|
+
var a11 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b4 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))];
|
|
6471
|
+
if (clipLine(a11, b4, x02, y02, x12, y12)) {
|
|
6607
6472
|
if (!v_) {
|
|
6608
6473
|
activeStream.lineStart();
|
|
6609
|
-
activeStream.point(
|
|
6474
|
+
activeStream.point(a11[0], a11[1]);
|
|
6610
6475
|
}
|
|
6611
|
-
activeStream.point(
|
|
6476
|
+
activeStream.point(b4[0], b4[1]);
|
|
6612
6477
|
if (!v2) activeStream.lineEnd();
|
|
6613
6478
|
clean = false;
|
|
6614
6479
|
} else if (v2) {
|
|
@@ -6677,7 +6542,7 @@ function boundsPoint(x2, y2) {
|
|
|
6677
6542
|
if (y2 < y0$2) y0$2 = y2;
|
|
6678
6543
|
if (y2 > y1) y1 = y2;
|
|
6679
6544
|
}
|
|
6680
|
-
var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X22 = 0,
|
|
6545
|
+
var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X22 = 0, Y2 = 0, Z2 = 0, x00$1, y00$1, x0$1, y0$1;
|
|
6681
6546
|
var centroidStream = {
|
|
6682
6547
|
point: centroidPoint,
|
|
6683
6548
|
lineStart: centroidLineStart,
|
|
@@ -6692,8 +6557,8 @@ var centroidStream = {
|
|
|
6692
6557
|
centroidStream.lineEnd = centroidLineEnd;
|
|
6693
6558
|
},
|
|
6694
6559
|
result: function() {
|
|
6695
|
-
var centroid =
|
|
6696
|
-
X0 = Y0 = Z0 = X1 = Y1 = Z1 = X22 =
|
|
6560
|
+
var centroid = Z2 ? [X22 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
|
|
6561
|
+
X0 = Y0 = Z0 = X1 = Y1 = Z1 = X22 = Y2 = Z2 = 0;
|
|
6697
6562
|
return centroid;
|
|
6698
6563
|
}
|
|
6699
6564
|
};
|
|
@@ -6736,8 +6601,8 @@ function centroidPointRing(x2, y2) {
|
|
|
6736
6601
|
Z1 += z2;
|
|
6737
6602
|
z2 = y0$1 * x2 - x0$1 * y2;
|
|
6738
6603
|
X22 += z2 * (x0$1 + x2);
|
|
6739
|
-
|
|
6740
|
-
|
|
6604
|
+
Y2 += z2 * (y0$1 + y2);
|
|
6605
|
+
Z2 += z2 * 3;
|
|
6741
6606
|
centroidPoint(x0$1 = x2, y0$1 = y2);
|
|
6742
6607
|
}
|
|
6743
6608
|
function PathContext(context) {
|
|
@@ -6745,8 +6610,8 @@ function PathContext(context) {
|
|
|
6745
6610
|
}
|
|
6746
6611
|
PathContext.prototype = {
|
|
6747
6612
|
_radius: 4.5,
|
|
6748
|
-
pointRadius: function(
|
|
6749
|
-
return this._radius =
|
|
6613
|
+
pointRadius: function(_2) {
|
|
6614
|
+
return this._radius = _2, this;
|
|
6750
6615
|
},
|
|
6751
6616
|
polygonStart: function() {
|
|
6752
6617
|
this._line = 0;
|
|
@@ -6819,8 +6684,8 @@ class PathString {
|
|
|
6819
6684
|
this._radius = 4.5;
|
|
6820
6685
|
this._ = "";
|
|
6821
6686
|
}
|
|
6822
|
-
pointRadius(
|
|
6823
|
-
this._radius = +
|
|
6687
|
+
pointRadius(_2) {
|
|
6688
|
+
this._radius = +_2;
|
|
6824
6689
|
return this;
|
|
6825
6690
|
}
|
|
6826
6691
|
polygonStart() {
|
|
@@ -6850,14 +6715,14 @@ class PathString {
|
|
|
6850
6715
|
default: {
|
|
6851
6716
|
this._append`M${x2},${y2}`;
|
|
6852
6717
|
if (this._radius !== cacheRadius || this._append !== cacheAppend) {
|
|
6853
|
-
const
|
|
6854
|
-
const
|
|
6718
|
+
const r = this._radius;
|
|
6719
|
+
const s = this._;
|
|
6855
6720
|
this._ = "";
|
|
6856
|
-
this._append`m0,${
|
|
6857
|
-
cacheRadius =
|
|
6721
|
+
this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;
|
|
6722
|
+
cacheRadius = r;
|
|
6858
6723
|
cacheAppend = this._append;
|
|
6859
6724
|
cacheCircle = this._;
|
|
6860
|
-
this._ =
|
|
6725
|
+
this._ = s;
|
|
6861
6726
|
}
|
|
6862
6727
|
this._ += cacheCircle;
|
|
6863
6728
|
break;
|
|
@@ -6871,10 +6736,10 @@ class PathString {
|
|
|
6871
6736
|
}
|
|
6872
6737
|
}
|
|
6873
6738
|
function append(strings) {
|
|
6874
|
-
let
|
|
6739
|
+
let i3 = 1;
|
|
6875
6740
|
this._ += strings[0];
|
|
6876
|
-
for (const
|
|
6877
|
-
this._ += arguments[
|
|
6741
|
+
for (const j2 = strings.length; i3 < j2; ++i3) {
|
|
6742
|
+
this._ += arguments[i3] + strings[i3];
|
|
6878
6743
|
}
|
|
6879
6744
|
}
|
|
6880
6745
|
function appendRound(digits) {
|
|
@@ -6882,13 +6747,13 @@ function appendRound(digits) {
|
|
|
6882
6747
|
if (!(d3 >= 0)) throw new RangeError(`invalid digits: ${digits}`);
|
|
6883
6748
|
if (d3 > 15) return append;
|
|
6884
6749
|
if (d3 !== cacheDigits) {
|
|
6885
|
-
const
|
|
6750
|
+
const k2 = 10 ** d3;
|
|
6886
6751
|
cacheDigits = d3;
|
|
6887
6752
|
cacheAppend = function append2(strings) {
|
|
6888
|
-
let
|
|
6753
|
+
let i3 = 1;
|
|
6889
6754
|
this._ += strings[0];
|
|
6890
|
-
for (const
|
|
6891
|
-
this._ += Math.round(arguments[
|
|
6755
|
+
for (const j2 = strings.length; i3 < j2; ++i3) {
|
|
6756
|
+
this._ += Math.round(arguments[i3] * k2) / k2 + strings[i3];
|
|
6892
6757
|
}
|
|
6893
6758
|
};
|
|
6894
6759
|
}
|
|
@@ -6919,28 +6784,28 @@ function geoPath(projection2, context) {
|
|
|
6919
6784
|
geoStream(object2, projectionStream(centroidStream));
|
|
6920
6785
|
return centroidStream.result();
|
|
6921
6786
|
};
|
|
6922
|
-
path.projection = function(
|
|
6787
|
+
path.projection = function(_2) {
|
|
6923
6788
|
if (!arguments.length) return projection2;
|
|
6924
|
-
projectionStream =
|
|
6789
|
+
projectionStream = _2 == null ? (projection2 = null, identity$1) : (projection2 = _2).stream;
|
|
6925
6790
|
return path;
|
|
6926
6791
|
};
|
|
6927
|
-
path.context = function(
|
|
6792
|
+
path.context = function(_2) {
|
|
6928
6793
|
if (!arguments.length) return context;
|
|
6929
|
-
contextStream =
|
|
6794
|
+
contextStream = _2 == null ? (context = null, new PathString(digits)) : new PathContext(context = _2);
|
|
6930
6795
|
if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
|
|
6931
6796
|
return path;
|
|
6932
6797
|
};
|
|
6933
|
-
path.pointRadius = function(
|
|
6798
|
+
path.pointRadius = function(_2) {
|
|
6934
6799
|
if (!arguments.length) return pointRadius;
|
|
6935
|
-
pointRadius = typeof
|
|
6800
|
+
pointRadius = typeof _2 === "function" ? _2 : (contextStream.pointRadius(+_2), +_2);
|
|
6936
6801
|
return path;
|
|
6937
6802
|
};
|
|
6938
|
-
path.digits = function(
|
|
6803
|
+
path.digits = function(_2) {
|
|
6939
6804
|
if (!arguments.length) return digits;
|
|
6940
|
-
if (
|
|
6805
|
+
if (_2 == null) digits = null;
|
|
6941
6806
|
else {
|
|
6942
|
-
const d3 = Math.floor(
|
|
6943
|
-
if (!(d3 >= 0)) throw new RangeError(`invalid digits: ${
|
|
6807
|
+
const d3 = Math.floor(_2);
|
|
6808
|
+
if (!(d3 >= 0)) throw new RangeError(`invalid digits: ${_2}`);
|
|
6944
6809
|
digits = d3;
|
|
6945
6810
|
}
|
|
6946
6811
|
if (context === null) contextStream = new PathString(digits);
|
|
@@ -6950,10 +6815,10 @@ function geoPath(projection2, context) {
|
|
|
6950
6815
|
}
|
|
6951
6816
|
function transformer(methods) {
|
|
6952
6817
|
return function(stream) {
|
|
6953
|
-
var
|
|
6954
|
-
for (var key in methods)
|
|
6955
|
-
|
|
6956
|
-
return
|
|
6818
|
+
var s = new TransformStream();
|
|
6819
|
+
for (var key in methods) s[key] = methods[key];
|
|
6820
|
+
s.stream = stream;
|
|
6821
|
+
return s;
|
|
6957
6822
|
};
|
|
6958
6823
|
}
|
|
6959
6824
|
function TransformStream() {
|
|
@@ -6989,24 +6854,24 @@ function fit(projection2, fitBounds, object2) {
|
|
|
6989
6854
|
return projection2;
|
|
6990
6855
|
}
|
|
6991
6856
|
function fitExtent(projection2, extent, object2) {
|
|
6992
|
-
return fit(projection2, function(
|
|
6993
|
-
var
|
|
6994
|
-
projection2.scale(150 *
|
|
6857
|
+
return fit(projection2, function(b4) {
|
|
6858
|
+
var w3 = extent[1][0] - extent[0][0], h2 = extent[1][1] - extent[0][1], k2 = Math.min(w3 / (b4[1][0] - b4[0][0]), h2 / (b4[1][1] - b4[0][1])), x2 = +extent[0][0] + (w3 - k2 * (b4[1][0] + b4[0][0])) / 2, y2 = +extent[0][1] + (h2 - k2 * (b4[1][1] + b4[0][1])) / 2;
|
|
6859
|
+
projection2.scale(150 * k2).translate([x2, y2]);
|
|
6995
6860
|
}, object2);
|
|
6996
6861
|
}
|
|
6997
6862
|
function fitSize(projection2, size, object2) {
|
|
6998
6863
|
return fitExtent(projection2, [[0, 0], size], object2);
|
|
6999
6864
|
}
|
|
7000
6865
|
function fitWidth(projection2, width, object2) {
|
|
7001
|
-
return fit(projection2, function(
|
|
7002
|
-
var
|
|
7003
|
-
projection2.scale(150 *
|
|
6866
|
+
return fit(projection2, function(b4) {
|
|
6867
|
+
var w3 = +width, k2 = w3 / (b4[1][0] - b4[0][0]), x2 = (w3 - k2 * (b4[1][0] + b4[0][0])) / 2, y2 = -k2 * b4[0][1];
|
|
6868
|
+
projection2.scale(150 * k2).translate([x2, y2]);
|
|
7004
6869
|
}, object2);
|
|
7005
6870
|
}
|
|
7006
6871
|
function fitHeight(projection2, height, object2) {
|
|
7007
|
-
return fit(projection2, function(
|
|
7008
|
-
var
|
|
7009
|
-
projection2.scale(150 *
|
|
6872
|
+
return fit(projection2, function(b4) {
|
|
6873
|
+
var h2 = +height, k2 = h2 / (b4[1][1] - b4[0][1]), x2 = -k2 * b4[0][0], y2 = (h2 - k2 * (b4[1][1] + b4[0][1])) / 2;
|
|
6874
|
+
projection2.scale(150 * k2).translate([x2, y2]);
|
|
7010
6875
|
}, object2);
|
|
7011
6876
|
}
|
|
7012
6877
|
var maxDepth = 16, cosMinDistance = cos(30 * radians);
|
|
@@ -7022,19 +6887,19 @@ function resampleNone(project) {
|
|
|
7022
6887
|
});
|
|
7023
6888
|
}
|
|
7024
6889
|
function resample$1(project, delta2) {
|
|
7025
|
-
function resampleLineTo(x02, y02, lambda0,
|
|
6890
|
+
function resampleLineTo(x02, y02, lambda0, a02, b0, c0, x12, y12, lambda1, a13, b1, c1, depth, stream) {
|
|
7026
6891
|
var dx = x12 - x02, dy = y12 - y02, d22 = dx * dx + dy * dy;
|
|
7027
6892
|
if (d22 > 4 * delta2 && depth--) {
|
|
7028
|
-
var
|
|
7029
|
-
if (dz * dz / d22 > delta2 || abs((dx * dx2 + dy * dy2) / d22 - 0.5) > 0.3 ||
|
|
7030
|
-
resampleLineTo(x02, y02, lambda0,
|
|
6893
|
+
var a11 = a02 + a13, 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), x2 = p4[0], y2 = p4[1], dx2 = x2 - x02, dy2 = y2 - y02, dz = dy * dx2 - dx * dy2;
|
|
6894
|
+
if (dz * dz / d22 > delta2 || abs((dx * dx2 + dy * dy2) / d22 - 0.5) > 0.3 || a02 * a13 + b0 * b1 + c0 * c1 < cosMinDistance) {
|
|
6895
|
+
resampleLineTo(x02, y02, lambda0, a02, b0, c0, x2, y2, lambda2, a11 /= m2, b4 /= m2, c3, depth, stream);
|
|
7031
6896
|
stream.point(x2, y2);
|
|
7032
|
-
resampleLineTo(x2, y2, lambda2,
|
|
6897
|
+
resampleLineTo(x2, y2, lambda2, a11, b4, c3, x12, y12, lambda1, a13, b1, c1, depth, stream);
|
|
7033
6898
|
}
|
|
7034
6899
|
}
|
|
7035
6900
|
}
|
|
7036
6901
|
return function(stream) {
|
|
7037
|
-
var lambda00, x002, y002, a00, b00, c00, lambda0, x02, y02,
|
|
6902
|
+
var lambda00, x002, y002, a00, b00, c00, lambda0, x02, y02, a02, b0, c0;
|
|
7038
6903
|
var resampleStream = {
|
|
7039
6904
|
point,
|
|
7040
6905
|
lineStart,
|
|
@@ -7058,8 +6923,8 @@ function resample$1(project, delta2) {
|
|
|
7058
6923
|
stream.lineStart();
|
|
7059
6924
|
}
|
|
7060
6925
|
function linePoint(lambda, phi) {
|
|
7061
|
-
var
|
|
7062
|
-
resampleLineTo(x02, y02, lambda0,
|
|
6926
|
+
var c3 = cartesian([lambda, phi]), p4 = project(lambda, phi);
|
|
6927
|
+
resampleLineTo(x02, y02, lambda0, a02, b0, c0, x02 = p4[0], y02 = p4[1], lambda0 = lambda, a02 = c3[0], b0 = c3[1], c0 = c3[2], maxDepth, stream);
|
|
7063
6928
|
stream.point(x02, y02);
|
|
7064
6929
|
}
|
|
7065
6930
|
function lineEnd() {
|
|
@@ -7072,11 +6937,11 @@ function resample$1(project, delta2) {
|
|
|
7072
6937
|
resampleStream.lineEnd = ringEnd;
|
|
7073
6938
|
}
|
|
7074
6939
|
function ringPoint(lambda, phi) {
|
|
7075
|
-
linePoint(lambda00 = lambda, phi), x002 = x02, y002 = y02, a00 =
|
|
6940
|
+
linePoint(lambda00 = lambda, phi), x002 = x02, y002 = y02, a00 = a02, b00 = b0, c00 = c0;
|
|
7076
6941
|
resampleStream.point = linePoint;
|
|
7077
6942
|
}
|
|
7078
6943
|
function ringEnd() {
|
|
7079
|
-
resampleLineTo(x02, y02, lambda0,
|
|
6944
|
+
resampleLineTo(x02, y02, lambda0, a02, b0, c0, x002, y002, lambda00, a00, b00, c00, maxDepth, stream);
|
|
7080
6945
|
resampleStream.lineEnd = lineEnd;
|
|
7081
6946
|
lineEnd();
|
|
7082
6947
|
}
|
|
@@ -7091,29 +6956,29 @@ var transformRadians = transformer({
|
|
|
7091
6956
|
function transformRotate(rotate) {
|
|
7092
6957
|
return transformer({
|
|
7093
6958
|
point: function(x2, y2) {
|
|
7094
|
-
var
|
|
7095
|
-
return this.stream.point(
|
|
6959
|
+
var r = rotate(x2, y2);
|
|
6960
|
+
return this.stream.point(r[0], r[1]);
|
|
7096
6961
|
}
|
|
7097
6962
|
});
|
|
7098
6963
|
}
|
|
7099
|
-
function scaleTranslate(
|
|
6964
|
+
function scaleTranslate(k2, dx, dy, sx, sy) {
|
|
7100
6965
|
function transform2(x2, y2) {
|
|
7101
6966
|
x2 *= sx;
|
|
7102
6967
|
y2 *= sy;
|
|
7103
|
-
return [dx +
|
|
6968
|
+
return [dx + k2 * x2, dy - k2 * y2];
|
|
7104
6969
|
}
|
|
7105
6970
|
transform2.invert = function(x2, y2) {
|
|
7106
|
-
return [(x2 - dx) /
|
|
6971
|
+
return [(x2 - dx) / k2 * sx, (dy - y2) / k2 * sy];
|
|
7107
6972
|
};
|
|
7108
6973
|
return transform2;
|
|
7109
6974
|
}
|
|
7110
|
-
function scaleTranslateRotate(
|
|
7111
|
-
if (!alpha) return scaleTranslate(
|
|
7112
|
-
var cosAlpha = cos(alpha), sinAlpha = sin(alpha),
|
|
6975
|
+
function scaleTranslateRotate(k2, dx, dy, sx, sy, alpha) {
|
|
6976
|
+
if (!alpha) return scaleTranslate(k2, dx, dy, sx, sy);
|
|
6977
|
+
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;
|
|
7113
6978
|
function transform2(x2, y2) {
|
|
7114
6979
|
x2 *= sx;
|
|
7115
6980
|
y2 *= sy;
|
|
7116
|
-
return [
|
|
6981
|
+
return [a11 * x2 - b4 * y2 + dx, dy - b4 * x2 - a11 * y2];
|
|
7117
6982
|
}
|
|
7118
6983
|
transform2.invert = function(x2, y2) {
|
|
7119
6984
|
return [sx * (ai2 * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai2 * y2)];
|
|
@@ -7126,7 +6991,7 @@ function projection(project) {
|
|
|
7126
6991
|
})();
|
|
7127
6992
|
}
|
|
7128
6993
|
function projectionMutator(projectAt) {
|
|
7129
|
-
var project,
|
|
6994
|
+
var project, k2 = 150, x2 = 480, y2 = 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;
|
|
7130
6995
|
function projection2(point) {
|
|
7131
6996
|
return projectRotateTransform(point[0] * radians, point[1] * radians);
|
|
7132
6997
|
}
|
|
@@ -7137,41 +7002,41 @@ function projectionMutator(projectAt) {
|
|
|
7137
7002
|
projection2.stream = function(stream) {
|
|
7138
7003
|
return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
|
|
7139
7004
|
};
|
|
7140
|
-
projection2.preclip = function(
|
|
7141
|
-
return arguments.length ? (preclip =
|
|
7005
|
+
projection2.preclip = function(_2) {
|
|
7006
|
+
return arguments.length ? (preclip = _2, theta = void 0, reset()) : preclip;
|
|
7142
7007
|
};
|
|
7143
|
-
projection2.postclip = function(
|
|
7144
|
-
return arguments.length ? (postclip =
|
|
7008
|
+
projection2.postclip = function(_2) {
|
|
7009
|
+
return arguments.length ? (postclip = _2, x02 = y02 = x12 = y12 = null, reset()) : postclip;
|
|
7145
7010
|
};
|
|
7146
|
-
projection2.clipAngle = function(
|
|
7147
|
-
return arguments.length ? (preclip = +
|
|
7011
|
+
projection2.clipAngle = function(_2) {
|
|
7012
|
+
return arguments.length ? (preclip = +_2 ? clipCircle(theta = _2 * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees;
|
|
7148
7013
|
};
|
|
7149
|
-
projection2.clipExtent = function(
|
|
7150
|
-
return arguments.length ? (postclip =
|
|
7014
|
+
projection2.clipExtent = function(_2) {
|
|
7015
|
+
return arguments.length ? (postclip = _2 == null ? (x02 = y02 = x12 = y12 = null, identity$1) : clipRectangle(x02 = +_2[0][0], y02 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset()) : x02 == null ? null : [[x02, y02], [x12, y12]];
|
|
7151
7016
|
};
|
|
7152
|
-
projection2.scale = function(
|
|
7153
|
-
return arguments.length ? (
|
|
7017
|
+
projection2.scale = function(_2) {
|
|
7018
|
+
return arguments.length ? (k2 = +_2, recenter()) : k2;
|
|
7154
7019
|
};
|
|
7155
|
-
projection2.translate = function(
|
|
7156
|
-
return arguments.length ? (x2 = +
|
|
7020
|
+
projection2.translate = function(_2) {
|
|
7021
|
+
return arguments.length ? (x2 = +_2[0], y2 = +_2[1], recenter()) : [x2, y2];
|
|
7157
7022
|
};
|
|
7158
|
-
projection2.center = function(
|
|
7159
|
-
return arguments.length ? (lambda =
|
|
7023
|
+
projection2.center = function(_2) {
|
|
7024
|
+
return arguments.length ? (lambda = _2[0] % 360 * radians, phi = _2[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
|
|
7160
7025
|
};
|
|
7161
|
-
projection2.rotate = function(
|
|
7162
|
-
return arguments.length ? (deltaLambda =
|
|
7026
|
+
projection2.rotate = function(_2) {
|
|
7027
|
+
return arguments.length ? (deltaLambda = _2[0] % 360 * radians, deltaPhi = _2[1] % 360 * radians, deltaGamma = _2.length > 2 ? _2[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
|
|
7163
7028
|
};
|
|
7164
|
-
projection2.angle = function(
|
|
7165
|
-
return arguments.length ? (alpha =
|
|
7029
|
+
projection2.angle = function(_2) {
|
|
7030
|
+
return arguments.length ? (alpha = _2 % 360 * radians, recenter()) : alpha * degrees;
|
|
7166
7031
|
};
|
|
7167
|
-
projection2.reflectX = function(
|
|
7168
|
-
return arguments.length ? (sx =
|
|
7032
|
+
projection2.reflectX = function(_2) {
|
|
7033
|
+
return arguments.length ? (sx = _2 ? -1 : 1, recenter()) : sx < 0;
|
|
7169
7034
|
};
|
|
7170
|
-
projection2.reflectY = function(
|
|
7171
|
-
return arguments.length ? (sy =
|
|
7035
|
+
projection2.reflectY = function(_2) {
|
|
7036
|
+
return arguments.length ? (sy = _2 ? -1 : 1, recenter()) : sy < 0;
|
|
7172
7037
|
};
|
|
7173
|
-
projection2.precision = function(
|
|
7174
|
-
return arguments.length ? (projectResample = resample(projectTransform, delta2 =
|
|
7038
|
+
projection2.precision = function(_2) {
|
|
7039
|
+
return arguments.length ? (projectResample = resample(projectTransform, delta2 = _2 * _2), reset()) : sqrt(delta2);
|
|
7175
7040
|
};
|
|
7176
7041
|
projection2.fitExtent = function(extent, object2) {
|
|
7177
7042
|
return fitExtent(projection2, extent, object2);
|
|
@@ -7186,7 +7051,7 @@ function projectionMutator(projectAt) {
|
|
|
7186
7051
|
return fitHeight(projection2, height, object2);
|
|
7187
7052
|
};
|
|
7188
7053
|
function recenter() {
|
|
7189
|
-
var center = scaleTranslateRotate(
|
|
7054
|
+
var center = scaleTranslateRotate(k2, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k2, x2 - center[0], y2 - center[1], sx, sy, alpha);
|
|
7190
7055
|
rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
|
|
7191
7056
|
projectTransform = compose(project, transform2);
|
|
7192
7057
|
projectRotateTransform = compose(rotate, projectTransform);
|
|
@@ -7213,22 +7078,22 @@ function geoMercator() {
|
|
|
7213
7078
|
return mercatorProjection(mercatorRaw).scale(961 / tau);
|
|
7214
7079
|
}
|
|
7215
7080
|
function mercatorProjection(project) {
|
|
7216
|
-
var
|
|
7217
|
-
|
|
7218
|
-
return arguments.length ? (scale(
|
|
7081
|
+
var m2 = projection(project), center = m2.center, scale = m2.scale, translate = m2.translate, clipExtent = m2.clipExtent, x02 = null, y02, x12, y12;
|
|
7082
|
+
m2.scale = function(_2) {
|
|
7083
|
+
return arguments.length ? (scale(_2), reclip()) : scale();
|
|
7219
7084
|
};
|
|
7220
|
-
|
|
7221
|
-
return arguments.length ? (translate(
|
|
7085
|
+
m2.translate = function(_2) {
|
|
7086
|
+
return arguments.length ? (translate(_2), reclip()) : translate();
|
|
7222
7087
|
};
|
|
7223
|
-
|
|
7224
|
-
return arguments.length ? (center(
|
|
7088
|
+
m2.center = function(_2) {
|
|
7089
|
+
return arguments.length ? (center(_2), reclip()) : center();
|
|
7225
7090
|
};
|
|
7226
|
-
|
|
7227
|
-
return arguments.length ? (
|
|
7091
|
+
m2.clipExtent = function(_2) {
|
|
7092
|
+
return arguments.length ? (_2 == null ? x02 = y02 = x12 = y12 = null : (x02 = +_2[0][0], y02 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reclip()) : x02 == null ? null : [[x02, y02], [x12, y12]];
|
|
7228
7093
|
};
|
|
7229
7094
|
function reclip() {
|
|
7230
|
-
var
|
|
7231
|
-
return clipExtent(x02 == null ? [[
|
|
7095
|
+
var k2 = pi * scale(), t = m2(rotation(m2.rotate()).invert([0, 0]));
|
|
7096
|
+
return clipExtent(x02 == null ? [[t[0] - k2, t[1] - k2], [t[0] + k2, t[1] + k2]] : project === mercatorRaw ? [[Math.max(t[0] - k2, x02), y02], [Math.min(t[0] + k2, x12), y12]] : [[x02, Math.max(t[1] - k2, y02)], [x12, Math.min(t[1] + k2, y12)]]);
|
|
7232
7097
|
}
|
|
7233
7098
|
return reclip();
|
|
7234
7099
|
}
|
|
@@ -7238,18 +7103,18 @@ function identity(x2) {
|
|
|
7238
7103
|
function transform(transform2) {
|
|
7239
7104
|
if (transform2 == null) return identity;
|
|
7240
7105
|
var x02, y02, kx = transform2.scale[0], ky = transform2.scale[1], dx = transform2.translate[0], dy = transform2.translate[1];
|
|
7241
|
-
return function(input,
|
|
7242
|
-
if (!
|
|
7243
|
-
var
|
|
7106
|
+
return function(input, i3) {
|
|
7107
|
+
if (!i3) x02 = y02 = 0;
|
|
7108
|
+
var j2 = 2, n2 = input.length, output = new Array(n2);
|
|
7244
7109
|
output[0] = (x02 += input[0]) * kx + dx;
|
|
7245
7110
|
output[1] = (y02 += input[1]) * ky + dy;
|
|
7246
|
-
while (
|
|
7111
|
+
while (j2 < n2) output[j2] = input[j2], ++j2;
|
|
7247
7112
|
return output;
|
|
7248
7113
|
};
|
|
7249
7114
|
}
|
|
7250
7115
|
function reverse(array, n2) {
|
|
7251
|
-
var
|
|
7252
|
-
while (
|
|
7116
|
+
var t, j2 = array.length, i3 = j2 - n2;
|
|
7117
|
+
while (i3 < --j2) t = array[i3], array[i3++] = array[j2], array[j2] = t;
|
|
7253
7118
|
}
|
|
7254
7119
|
function topojsonFeature(topology, o2) {
|
|
7255
7120
|
if (typeof o2 === "string") o2 = topology.objects[o2];
|
|
@@ -7263,19 +7128,19 @@ function feature(topology, o2) {
|
|
|
7263
7128
|
}
|
|
7264
7129
|
function object(topology, o2) {
|
|
7265
7130
|
var transformPoint = transform(topology.transform), arcs = topology.arcs;
|
|
7266
|
-
function arc(
|
|
7131
|
+
function arc(i3, points) {
|
|
7267
7132
|
if (points.length) points.pop();
|
|
7268
|
-
for (var
|
|
7269
|
-
points.push(transformPoint(
|
|
7133
|
+
for (var a11 = arcs[i3 < 0 ? ~i3 : i3], k2 = 0, n2 = a11.length; k2 < n2; ++k2) {
|
|
7134
|
+
points.push(transformPoint(a11[k2], k2));
|
|
7270
7135
|
}
|
|
7271
|
-
if (
|
|
7136
|
+
if (i3 < 0) reverse(points, n2);
|
|
7272
7137
|
}
|
|
7273
|
-
function point(
|
|
7274
|
-
return transformPoint(
|
|
7138
|
+
function point(p4) {
|
|
7139
|
+
return transformPoint(p4);
|
|
7275
7140
|
}
|
|
7276
7141
|
function line(arcs2) {
|
|
7277
7142
|
var points = [];
|
|
7278
|
-
for (var
|
|
7143
|
+
for (var i3 = 0, n2 = arcs2.length; i3 < n2; ++i3) arc(arcs2[i3], points);
|
|
7279
7144
|
if (points.length < 2) points.push(points[0]);
|
|
7280
7145
|
return points;
|
|
7281
7146
|
}
|
|
@@ -7341,11 +7206,11 @@ const choroplethStyles = tv({
|
|
|
7341
7206
|
legendScale: "flex items-center justify-between text-caption-xs text-fg-muted tabular-nums"
|
|
7342
7207
|
}
|
|
7343
7208
|
});
|
|
7344
|
-
function isTopology(
|
|
7345
|
-
return !Array.isArray(
|
|
7209
|
+
function isTopology(g2) {
|
|
7210
|
+
return !Array.isArray(g2) && g2.type === "Topology";
|
|
7346
7211
|
}
|
|
7347
|
-
function isFeatureCollection(
|
|
7348
|
-
return !Array.isArray(
|
|
7212
|
+
function isFeatureCollection(g2) {
|
|
7213
|
+
return !Array.isArray(g2) && g2.type === "FeatureCollection";
|
|
7349
7214
|
}
|
|
7350
7215
|
function normalizeFeatures(geography, topologyObject) {
|
|
7351
7216
|
if (Array.isArray(geography)) return geography;
|
|
@@ -7396,22 +7261,22 @@ const ChoroplethMap = forwardRef(
|
|
|
7396
7261
|
}
|
|
7397
7262
|
);
|
|
7398
7263
|
const pathGen = geoPath(proj);
|
|
7399
|
-
return features.map((
|
|
7400
|
-
feature:
|
|
7401
|
-
d: pathGen(
|
|
7402
|
-
centroid: pathGen.centroid(
|
|
7264
|
+
return features.map((f2) => ({
|
|
7265
|
+
feature: f2,
|
|
7266
|
+
d: pathGen(f2) ?? "",
|
|
7267
|
+
centroid: pathGen.centroid(f2)
|
|
7403
7268
|
}));
|
|
7404
7269
|
}, [features, projection2, width, height]);
|
|
7405
|
-
const getId = (
|
|
7406
|
-
if (getFeatureId) return getFeatureId(
|
|
7407
|
-
if (
|
|
7408
|
-
const
|
|
7409
|
-
return
|
|
7270
|
+
const getId = (f2) => {
|
|
7271
|
+
if (getFeatureId) return getFeatureId(f2);
|
|
7272
|
+
if (f2.id != null) return f2.id;
|
|
7273
|
+
const p4 = f2.properties ?? {};
|
|
7274
|
+
return p4.id ?? p4.ID ?? "";
|
|
7410
7275
|
};
|
|
7411
|
-
const getName = (
|
|
7412
|
-
if (getFeatureName) return getFeatureName(
|
|
7413
|
-
const
|
|
7414
|
-
return String(
|
|
7276
|
+
const getName = (f2) => {
|
|
7277
|
+
if (getFeatureName) return getFeatureName(f2);
|
|
7278
|
+
const p4 = f2.properties ?? {};
|
|
7279
|
+
return String(p4.name ?? p4.nome ?? p4.NOME ?? p4.Name ?? getId(f2));
|
|
7415
7280
|
};
|
|
7416
7281
|
const numeric = Object.values(values).filter(
|
|
7417
7282
|
(v2) => typeof v2 === "number" && Number.isFinite(v2)
|
|
@@ -7425,8 +7290,8 @@ const ChoroplethMap = forwardRef(
|
|
|
7425
7290
|
if (value === void 0 || !Number.isFinite(value)) return noDataVar;
|
|
7426
7291
|
if (colorScale) return colorScale(value, { min, max });
|
|
7427
7292
|
const range = max - min;
|
|
7428
|
-
const
|
|
7429
|
-
const clamped = Math.max(0, Math.min(1,
|
|
7293
|
+
const t = range > 0 ? (value - min) / range : 1;
|
|
7294
|
+
const clamped = Math.max(0, Math.min(1, t));
|
|
7430
7295
|
const pct = 12 + clamped * 88;
|
|
7431
7296
|
return `color-mix(in srgb, ${scaleVar} ${pct}%, ${surfaceVar})`;
|
|
7432
7297
|
};
|
|
@@ -7514,6 +7379,1080 @@ const ChoroplethMap = forwardRef(
|
|
|
7514
7379
|
}
|
|
7515
7380
|
);
|
|
7516
7381
|
ChoroplethMap.displayName = "ChoroplethMap";
|
|
7382
|
+
const THEMES = { light: "", dark: ".dark" };
|
|
7383
|
+
const ChartContext = React.createContext(null);
|
|
7384
|
+
function useChart() {
|
|
7385
|
+
const ctx = React.useContext(ChartContext);
|
|
7386
|
+
if (!ctx) {
|
|
7387
|
+
throw new Error("useChart deve ser usado dentro de <ChartContainer>");
|
|
7388
|
+
}
|
|
7389
|
+
return ctx;
|
|
7390
|
+
}
|
|
7391
|
+
const ChartContainer = React.forwardRef(({ id, className, children, config, ...props }, ref) => {
|
|
7392
|
+
const uniqueId = React.useId();
|
|
7393
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
7394
|
+
return /* @__PURE__ */ jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxs(
|
|
7395
|
+
"div",
|
|
7396
|
+
{
|
|
7397
|
+
"data-chart": chartId,
|
|
7398
|
+
ref,
|
|
7399
|
+
className: cn(
|
|
7400
|
+
"flex aspect-video justify-center text-caption-sm",
|
|
7401
|
+
"[&_.recharts-cartesian-axis-tick_text]:fill-fg-muted",
|
|
7402
|
+
"[&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-[var(--color-chart-grid)]",
|
|
7403
|
+
"[&_.recharts-curve.recharts-tooltip-cursor]:stroke-border-default",
|
|
7404
|
+
"[&_.recharts-dot[stroke='#fff']]:stroke-transparent",
|
|
7405
|
+
"[&_.recharts-layer]:outline-none",
|
|
7406
|
+
"[&_.recharts-polar-grid_[stroke='#ccc']]:stroke-[var(--color-chart-grid)]",
|
|
7407
|
+
"[&_.recharts-radial-bar-background-sector]:fill-bg-muted",
|
|
7408
|
+
"[&_.recharts-rectangle.recharts-tooltip-cursor]:fill-bg-muted",
|
|
7409
|
+
"[&_.recharts-reference-line_[stroke='#ccc']]:stroke-border-default",
|
|
7410
|
+
"[&_.recharts-sector[stroke='#fff']]:stroke-transparent",
|
|
7411
|
+
"[&_.recharts-sector]:outline-none",
|
|
7412
|
+
"[&_.recharts-surface]:outline-none",
|
|
7413
|
+
className
|
|
7414
|
+
),
|
|
7415
|
+
...props,
|
|
7416
|
+
children: [
|
|
7417
|
+
/* @__PURE__ */ jsx(ChartStyle, { id: chartId, config }),
|
|
7418
|
+
/* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, { children })
|
|
7419
|
+
]
|
|
7420
|
+
}
|
|
7421
|
+
) });
|
|
7422
|
+
});
|
|
7423
|
+
ChartContainer.displayName = "ChartContainer";
|
|
7424
|
+
const ChartStyle = ({ id, config }) => {
|
|
7425
|
+
const colorConfig = Object.entries(config).filter(
|
|
7426
|
+
([, c3]) => c3.theme || c3.color
|
|
7427
|
+
);
|
|
7428
|
+
if (!colorConfig.length) return null;
|
|
7429
|
+
return /* @__PURE__ */ jsx(
|
|
7430
|
+
"style",
|
|
7431
|
+
{
|
|
7432
|
+
dangerouslySetInnerHTML: {
|
|
7433
|
+
__html: Object.entries(THEMES).map(
|
|
7434
|
+
([theme, prefix]) => `
|
|
7435
|
+
${prefix} [data-chart=${id}] {
|
|
7436
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
7437
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
7438
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
7439
|
+
}).filter(Boolean).join("\n")}
|
|
7440
|
+
}
|
|
7441
|
+
`
|
|
7442
|
+
).join("\n")
|
|
7443
|
+
}
|
|
7444
|
+
}
|
|
7445
|
+
);
|
|
7446
|
+
};
|
|
7447
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
7448
|
+
const ChartTooltipContent = React.forwardRef(
|
|
7449
|
+
({
|
|
7450
|
+
active,
|
|
7451
|
+
payload,
|
|
7452
|
+
label,
|
|
7453
|
+
className,
|
|
7454
|
+
indicator = "dot",
|
|
7455
|
+
hideLabel = false,
|
|
7456
|
+
hideIndicator = false,
|
|
7457
|
+
labelFormatter,
|
|
7458
|
+
formatter,
|
|
7459
|
+
nameKey,
|
|
7460
|
+
labelKey
|
|
7461
|
+
}, ref) => {
|
|
7462
|
+
const { config } = useChart();
|
|
7463
|
+
const tooltipLabel = React.useMemo(() => {
|
|
7464
|
+
if (hideLabel || !payload?.length) return null;
|
|
7465
|
+
const [item] = payload;
|
|
7466
|
+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
|
|
7467
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
7468
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
|
|
7469
|
+
if (labelFormatter) {
|
|
7470
|
+
return /* @__PURE__ */ jsx("div", { className: "font-medium text-fg-default", children: labelFormatter(value, payload) });
|
|
7471
|
+
}
|
|
7472
|
+
if (!value) return null;
|
|
7473
|
+
return /* @__PURE__ */ jsx("div", { className: "font-medium text-fg-default", children: value });
|
|
7474
|
+
}, [label, labelFormatter, payload, hideLabel, labelKey, config]);
|
|
7475
|
+
if (!active || !payload?.length) return null;
|
|
7476
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
7477
|
+
return /* @__PURE__ */ jsxs(
|
|
7478
|
+
"div",
|
|
7479
|
+
{
|
|
7480
|
+
ref,
|
|
7481
|
+
className: cn(
|
|
7482
|
+
"grid min-w-[8rem] items-start gap-gp-sm rounded-radius-lg border border-border-default bg-bg-surface-elevated px-pad-lg py-pad-md text-caption-sm shadow-sh-lg",
|
|
7483
|
+
className
|
|
7484
|
+
),
|
|
7485
|
+
children: [
|
|
7486
|
+
!nestLabel ? tooltipLabel : null,
|
|
7487
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-gp-sm", children: payload.map((item, index) => {
|
|
7488
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
7489
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
7490
|
+
const indicatorColor = item.color || item.payload?.fill;
|
|
7491
|
+
return /* @__PURE__ */ jsx(
|
|
7492
|
+
"div",
|
|
7493
|
+
{
|
|
7494
|
+
className: cn(
|
|
7495
|
+
"flex w-full flex-wrap items-stretch gap-gp-md [&>svg]:size-icon-xs [&>svg]:text-fg-muted",
|
|
7496
|
+
indicator === "dot" && "items-center"
|
|
7497
|
+
),
|
|
7498
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, String(item.name), item, index, item.payload) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7499
|
+
itemConfig?.icon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx(
|
|
7500
|
+
"div",
|
|
7501
|
+
{
|
|
7502
|
+
className: cn(
|
|
7503
|
+
"shrink-0 rounded-radius-xs",
|
|
7504
|
+
indicator === "dot" && "size-2.5",
|
|
7505
|
+
indicator === "line" && "w-1",
|
|
7506
|
+
indicator === "dashed" && "w-0 border-[1.5px] border-dashed bg-transparent",
|
|
7507
|
+
nestLabel && indicator === "dashed" && "my-0.5"
|
|
7508
|
+
),
|
|
7509
|
+
style: {
|
|
7510
|
+
backgroundColor: indicator === "dashed" ? "transparent" : indicatorColor,
|
|
7511
|
+
borderColor: indicatorColor
|
|
7512
|
+
}
|
|
7513
|
+
}
|
|
7514
|
+
),
|
|
7515
|
+
/* @__PURE__ */ jsxs(
|
|
7516
|
+
"div",
|
|
7517
|
+
{
|
|
7518
|
+
className: cn(
|
|
7519
|
+
"flex flex-1 justify-between leading-none",
|
|
7520
|
+
nestLabel ? "items-end" : "items-center"
|
|
7521
|
+
),
|
|
7522
|
+
children: [
|
|
7523
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-gp-2xs", children: [
|
|
7524
|
+
nestLabel ? tooltipLabel : null,
|
|
7525
|
+
/* @__PURE__ */ jsx("span", { className: "text-fg-muted", children: itemConfig?.label || item.name })
|
|
7526
|
+
] }),
|
|
7527
|
+
item.value !== void 0 && /* @__PURE__ */ jsx("span", { className: "font-medium tabular-nums text-fg-default", children: typeof item.value === "number" ? item.value.toLocaleString("pt-BR") : item.value })
|
|
7528
|
+
]
|
|
7529
|
+
}
|
|
7530
|
+
)
|
|
7531
|
+
] })
|
|
7532
|
+
},
|
|
7533
|
+
item.dataKey ?? index
|
|
7534
|
+
);
|
|
7535
|
+
}) })
|
|
7536
|
+
]
|
|
7537
|
+
}
|
|
7538
|
+
);
|
|
7539
|
+
}
|
|
7540
|
+
);
|
|
7541
|
+
ChartTooltipContent.displayName = "ChartTooltipContent";
|
|
7542
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
7543
|
+
const ChartLegendContent = React.forwardRef(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
|
|
7544
|
+
const { config } = useChart();
|
|
7545
|
+
if (!payload?.length) return null;
|
|
7546
|
+
return /* @__PURE__ */ jsx(
|
|
7547
|
+
"div",
|
|
7548
|
+
{
|
|
7549
|
+
ref,
|
|
7550
|
+
className: cn(
|
|
7551
|
+
"flex items-center justify-center gap-gp-xl",
|
|
7552
|
+
verticalAlign === "top" ? "pb-pad-md" : "pt-pad-md",
|
|
7553
|
+
className
|
|
7554
|
+
),
|
|
7555
|
+
children: payload.map((item) => {
|
|
7556
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
|
7557
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
7558
|
+
return /* @__PURE__ */ jsxs(
|
|
7559
|
+
"div",
|
|
7560
|
+
{
|
|
7561
|
+
className: "flex items-center gap-gp-sm text-fg-muted [&>svg]:size-icon-xs [&>svg]:text-fg-muted",
|
|
7562
|
+
children: [
|
|
7563
|
+
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx(
|
|
7564
|
+
"div",
|
|
7565
|
+
{
|
|
7566
|
+
className: "size-2.5 shrink-0 rounded-radius-xs",
|
|
7567
|
+
style: { backgroundColor: item.color }
|
|
7568
|
+
}
|
|
7569
|
+
),
|
|
7570
|
+
itemConfig?.label
|
|
7571
|
+
]
|
|
7572
|
+
},
|
|
7573
|
+
item.value
|
|
7574
|
+
);
|
|
7575
|
+
})
|
|
7576
|
+
}
|
|
7577
|
+
);
|
|
7578
|
+
});
|
|
7579
|
+
ChartLegendContent.displayName = "ChartLegendContent";
|
|
7580
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
7581
|
+
if (typeof payload !== "object" || payload === null) return void 0;
|
|
7582
|
+
const inner = "payload" in payload && typeof payload.payload === "object" ? payload.payload : void 0;
|
|
7583
|
+
let configLabelKey = key;
|
|
7584
|
+
const p4 = payload;
|
|
7585
|
+
if (key in p4 && typeof p4[key] === "string") {
|
|
7586
|
+
configLabelKey = p4[key];
|
|
7587
|
+
} else if (inner && key in inner && typeof inner[key] === "string") {
|
|
7588
|
+
configLabelKey = inner[key];
|
|
7589
|
+
}
|
|
7590
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
7591
|
+
}
|
|
7592
|
+
function asText$1(v2) {
|
|
7593
|
+
return v2 == null ? "" : String(v2);
|
|
7594
|
+
}
|
|
7595
|
+
function isEmptyVal(v2) {
|
|
7596
|
+
if (v2 == null) return true;
|
|
7597
|
+
if (typeof v2 === "string") return v2.length === 0;
|
|
7598
|
+
if (Array.isArray(v2)) return v2.length === 0;
|
|
7599
|
+
return false;
|
|
7600
|
+
}
|
|
7601
|
+
function matchOp(op, val, fv) {
|
|
7602
|
+
const a11 = asText$1(val).toLowerCase();
|
|
7603
|
+
const b4 = asText$1(fv).toLowerCase();
|
|
7604
|
+
switch (op) {
|
|
7605
|
+
case "equals":
|
|
7606
|
+
return a11 === b4;
|
|
7607
|
+
case "neq":
|
|
7608
|
+
return a11 !== b4;
|
|
7609
|
+
case "contains":
|
|
7610
|
+
return a11.includes(b4);
|
|
7611
|
+
case "notContains":
|
|
7612
|
+
return !a11.includes(b4);
|
|
7613
|
+
case "startsWith":
|
|
7614
|
+
return a11.startsWith(b4);
|
|
7615
|
+
case "endsWith":
|
|
7616
|
+
return a11.endsWith(b4);
|
|
7617
|
+
case "gt":
|
|
7618
|
+
return Number(val) > Number(fv);
|
|
7619
|
+
case "lt":
|
|
7620
|
+
return Number(val) < Number(fv);
|
|
7621
|
+
case "gte":
|
|
7622
|
+
return Number(val) >= Number(fv);
|
|
7623
|
+
case "lte":
|
|
7624
|
+
return Number(val) <= Number(fv);
|
|
7625
|
+
case "between": {
|
|
7626
|
+
const [lo, hi] = Array.isArray(fv) ? fv : [void 0, void 0];
|
|
7627
|
+
const n2 = Number(val);
|
|
7628
|
+
return (lo == null || n2 >= Number(lo)) && (hi == null || n2 <= Number(hi));
|
|
7629
|
+
}
|
|
7630
|
+
case "isEmpty":
|
|
7631
|
+
return isEmptyVal(val);
|
|
7632
|
+
case "isNotEmpty":
|
|
7633
|
+
return !isEmptyVal(val);
|
|
7634
|
+
default:
|
|
7635
|
+
return a11 === b4;
|
|
7636
|
+
}
|
|
7637
|
+
}
|
|
7638
|
+
function applyFilterModel(items, model, fieldsById) {
|
|
7639
|
+
const active = (model?.items ?? []).filter(
|
|
7640
|
+
(it) => it.operator === "isEmpty" || it.operator === "isNotEmpty" || !isEmptyVal(it.value)
|
|
7641
|
+
);
|
|
7642
|
+
if (active.length === 0) return items;
|
|
7643
|
+
const byField = /* @__PURE__ */ new Map();
|
|
7644
|
+
for (const it of active) {
|
|
7645
|
+
if (!byField.has(it.field)) byField.set(it.field, []);
|
|
7646
|
+
byField.get(it.field).push(it);
|
|
7647
|
+
}
|
|
7648
|
+
const matchField = (item, fieldId, group) => {
|
|
7649
|
+
const field = fieldsById.get(fieldId);
|
|
7650
|
+
if (!field) return true;
|
|
7651
|
+
const val = field.accessor(item);
|
|
7652
|
+
const anyOf = group.filter((g2) => g2.operator === "isAnyOf").map((g2) => g2.value);
|
|
7653
|
+
const noneOf = group.filter((g2) => g2.operator === "isNoneOf").map((g2) => g2.value);
|
|
7654
|
+
const scalar = group.filter((g2) => g2.operator !== "isAnyOf" && g2.operator !== "isNoneOf");
|
|
7655
|
+
if (anyOf.length && !anyOf.some((v2) => matchOp("equals", val, v2))) return false;
|
|
7656
|
+
if (noneOf.length && noneOf.some((v2) => matchOp("equals", val, v2))) return false;
|
|
7657
|
+
for (const g2 of scalar) {
|
|
7658
|
+
if (!matchOp(g2.operator, val, g2.value)) return false;
|
|
7659
|
+
}
|
|
7660
|
+
return true;
|
|
7661
|
+
};
|
|
7662
|
+
return items.filter((item) => {
|
|
7663
|
+
for (const [fieldId, group] of byField) {
|
|
7664
|
+
if (!matchField(item, fieldId, group)) return false;
|
|
7665
|
+
}
|
|
7666
|
+
return true;
|
|
7667
|
+
});
|
|
7668
|
+
}
|
|
7669
|
+
const EMPTY_MODEL = { items: [], logicOperator: "AND" };
|
|
7670
|
+
const EMPTY_QUERY = { search: "", filterModel: EMPTY_MODEL };
|
|
7671
|
+
function asText(v2) {
|
|
7672
|
+
return typeof v2 === "string" || typeof v2 === "number" ? String(v2) : "";
|
|
7673
|
+
}
|
|
7674
|
+
function loadPersisted(key) {
|
|
7675
|
+
if (!key || typeof localStorage === "undefined") return null;
|
|
7676
|
+
try {
|
|
7677
|
+
const raw = localStorage.getItem(`ds-datalist:${key}`);
|
|
7678
|
+
if (!raw) return null;
|
|
7679
|
+
const p4 = JSON.parse(raw);
|
|
7680
|
+
return {
|
|
7681
|
+
search: p4.search ?? "",
|
|
7682
|
+
filterModel: p4.filterModel?.items ? { items: p4.filterModel.items, logicOperator: p4.filterModel.logicOperator ?? "AND" } : EMPTY_MODEL
|
|
7683
|
+
};
|
|
7684
|
+
} catch {
|
|
7685
|
+
return null;
|
|
7686
|
+
}
|
|
7687
|
+
}
|
|
7688
|
+
function useDataList({
|
|
7689
|
+
items,
|
|
7690
|
+
mode,
|
|
7691
|
+
filterFields,
|
|
7692
|
+
views,
|
|
7693
|
+
persistKey,
|
|
7694
|
+
defaultExpandedIds,
|
|
7695
|
+
onQueryChange,
|
|
7696
|
+
onSelectionChange
|
|
7697
|
+
}) {
|
|
7698
|
+
const [query, setQuery] = useState(
|
|
7699
|
+
() => loadPersisted(persistKey) ?? EMPTY_QUERY
|
|
7700
|
+
);
|
|
7701
|
+
const [activeViewId, setActiveViewId] = useState(null);
|
|
7702
|
+
const [selected, setSelected] = useState(/* @__PURE__ */ new Set());
|
|
7703
|
+
const [expanded, setExpanded] = useState(
|
|
7704
|
+
() => defaultExpandedIds ?? /* @__PURE__ */ new Set()
|
|
7705
|
+
);
|
|
7706
|
+
useEffect(() => {
|
|
7707
|
+
if (!persistKey || typeof localStorage === "undefined") return;
|
|
7708
|
+
try {
|
|
7709
|
+
localStorage.setItem(`ds-datalist:${persistKey}`, JSON.stringify(query));
|
|
7710
|
+
} catch {
|
|
7711
|
+
}
|
|
7712
|
+
}, [persistKey, query]);
|
|
7713
|
+
const onQueryChangeRef = useRef(onQueryChange);
|
|
7714
|
+
onQueryChangeRef.current = onQueryChange;
|
|
7715
|
+
useEffect(() => {
|
|
7716
|
+
if (mode !== "server") return;
|
|
7717
|
+
const t = setTimeout(() => onQueryChangeRef.current?.(query), 250);
|
|
7718
|
+
return () => clearTimeout(t);
|
|
7719
|
+
}, [mode, query]);
|
|
7720
|
+
const setSearch = useCallback((search) => {
|
|
7721
|
+
setActiveViewId(null);
|
|
7722
|
+
setQuery((q2) => ({ ...q2, search }));
|
|
7723
|
+
}, []);
|
|
7724
|
+
const setFilterModel = useCallback((filterModel) => {
|
|
7725
|
+
setActiveViewId(null);
|
|
7726
|
+
setQuery((q2) => ({ ...q2, filterModel }));
|
|
7727
|
+
}, []);
|
|
7728
|
+
const applyView = useCallback((view) => {
|
|
7729
|
+
setActiveViewId(view?.id ?? null);
|
|
7730
|
+
setQuery(view ? view.query : EMPTY_QUERY);
|
|
7731
|
+
}, []);
|
|
7732
|
+
const toggleSelect = useCallback(
|
|
7733
|
+
(id) => {
|
|
7734
|
+
setSelected((prev) => {
|
|
7735
|
+
const next = new Set(prev);
|
|
7736
|
+
next.has(id) ? next.delete(id) : next.add(id);
|
|
7737
|
+
onSelectionChange?.(next);
|
|
7738
|
+
return next;
|
|
7739
|
+
});
|
|
7740
|
+
},
|
|
7741
|
+
[onSelectionChange]
|
|
7742
|
+
);
|
|
7743
|
+
const clearSelection = useCallback(() => {
|
|
7744
|
+
setSelected(() => {
|
|
7745
|
+
const next = /* @__PURE__ */ new Set();
|
|
7746
|
+
onSelectionChange?.(next);
|
|
7747
|
+
return next;
|
|
7748
|
+
});
|
|
7749
|
+
}, [onSelectionChange]);
|
|
7750
|
+
const replaceSelection = useCallback(
|
|
7751
|
+
(next) => {
|
|
7752
|
+
setSelected(next);
|
|
7753
|
+
onSelectionChange?.(next);
|
|
7754
|
+
},
|
|
7755
|
+
[onSelectionChange]
|
|
7756
|
+
);
|
|
7757
|
+
const toggleExpand = useCallback((id) => {
|
|
7758
|
+
setExpanded((prev) => {
|
|
7759
|
+
const next = new Set(prev);
|
|
7760
|
+
next.has(id) ? next.delete(id) : next.add(id);
|
|
7761
|
+
return next;
|
|
7762
|
+
});
|
|
7763
|
+
}, []);
|
|
7764
|
+
const fieldsById = useMemo(() => {
|
|
7765
|
+
const m2 = /* @__PURE__ */ new Map();
|
|
7766
|
+
for (const f2 of filterFields ?? []) m2.set(f2.id, f2);
|
|
7767
|
+
return m2;
|
|
7768
|
+
}, [filterFields]);
|
|
7769
|
+
const matchesSearch = useCallback(
|
|
7770
|
+
(item) => {
|
|
7771
|
+
const s = query.search.trim().toLowerCase();
|
|
7772
|
+
if (!s) return true;
|
|
7773
|
+
const hay = [
|
|
7774
|
+
asText(item.title),
|
|
7775
|
+
asText(item.subtitle),
|
|
7776
|
+
asText(item.description),
|
|
7777
|
+
...(filterFields ?? []).map((f2) => asText(f2.accessor(item)))
|
|
7778
|
+
].join(" ").toLowerCase();
|
|
7779
|
+
return hay.includes(s);
|
|
7780
|
+
},
|
|
7781
|
+
[query.search, filterFields]
|
|
7782
|
+
);
|
|
7783
|
+
const processedItems = useMemo(() => {
|
|
7784
|
+
if (mode === "server") return items;
|
|
7785
|
+
const searched = query.search ? items.filter(matchesSearch) : items;
|
|
7786
|
+
return applyFilterModel(searched, query.filterModel, fieldsById);
|
|
7787
|
+
}, [mode, items, query.search, query.filterModel, matchesSearch, fieldsById]);
|
|
7788
|
+
return {
|
|
7789
|
+
query,
|
|
7790
|
+
activeViewId,
|
|
7791
|
+
setSearch,
|
|
7792
|
+
setFilterModel,
|
|
7793
|
+
applyView,
|
|
7794
|
+
views: views ?? [],
|
|
7795
|
+
selected,
|
|
7796
|
+
toggleSelect,
|
|
7797
|
+
clearSelection,
|
|
7798
|
+
replaceSelection,
|
|
7799
|
+
expanded,
|
|
7800
|
+
toggleExpand,
|
|
7801
|
+
setExpanded,
|
|
7802
|
+
processedItems
|
|
7803
|
+
};
|
|
7804
|
+
}
|
|
7805
|
+
const ALL_VIEW_ID = "__all__";
|
|
7806
|
+
function toColumns(fields) {
|
|
7807
|
+
return fields.map((f2) => ({
|
|
7808
|
+
key: f2.id,
|
|
7809
|
+
label: f2.label,
|
|
7810
|
+
filterType: f2.type,
|
|
7811
|
+
type: f2.type === "select" ? "select" : f2.type === "number" ? "number" : "text",
|
|
7812
|
+
options: f2.options
|
|
7813
|
+
}));
|
|
7814
|
+
}
|
|
7815
|
+
function toAppliedFilters(model, fieldsById) {
|
|
7816
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
7817
|
+
for (const item of model.items) {
|
|
7818
|
+
const isEmpty = item.operator !== "isEmpty" && item.operator !== "isNotEmpty" && (item.value == null || item.value === "" || Array.isArray(item.value) && item.value.length === 0);
|
|
7819
|
+
if (isEmpty) continue;
|
|
7820
|
+
const key = `${item.field}|${item.operator}`;
|
|
7821
|
+
if (!grouped.has(key)) grouped.set(key, []);
|
|
7822
|
+
grouped.get(key).push(item);
|
|
7823
|
+
}
|
|
7824
|
+
return Array.from(grouped.entries()).map(([key, items]) => {
|
|
7825
|
+
const field = fieldsById.get(items[0].field);
|
|
7826
|
+
const columnLabel = field?.label ?? items[0].field;
|
|
7827
|
+
const labelOf = (v2) => field?.options?.find((o2) => o2.value === String(v2))?.label ?? String(v2);
|
|
7828
|
+
const values = [];
|
|
7829
|
+
for (const it of items) {
|
|
7830
|
+
if (Array.isArray(it.value))
|
|
7831
|
+
for (const v2 of it.value) values.push(labelOf(v2));
|
|
7832
|
+
else if (it.value != null && it.value !== "")
|
|
7833
|
+
values.push(labelOf(it.value));
|
|
7834
|
+
}
|
|
7835
|
+
const value = values.length <= 2 ? values : `${values.length} selecionados`;
|
|
7836
|
+
return {
|
|
7837
|
+
id: key,
|
|
7838
|
+
columnLabel,
|
|
7839
|
+
op: items[0].operator,
|
|
7840
|
+
value
|
|
7841
|
+
};
|
|
7842
|
+
});
|
|
7843
|
+
}
|
|
7844
|
+
function DataListToolbar({
|
|
7845
|
+
title: title2,
|
|
7846
|
+
count,
|
|
7847
|
+
views,
|
|
7848
|
+
activeViewId,
|
|
7849
|
+
onApplyView,
|
|
7850
|
+
searchable,
|
|
7851
|
+
searchPlaceholder,
|
|
7852
|
+
search,
|
|
7853
|
+
onSearch,
|
|
7854
|
+
filterFields,
|
|
7855
|
+
filterModel,
|
|
7856
|
+
onFilterModelChange,
|
|
7857
|
+
onRefresh,
|
|
7858
|
+
toolbarActions,
|
|
7859
|
+
moreActions,
|
|
7860
|
+
loading
|
|
7861
|
+
}) {
|
|
7862
|
+
const hasActions = !!toolbarActions && toolbarActions.length > 0;
|
|
7863
|
+
const moreItems = (moreActions ?? []).map((a11) => ({
|
|
7864
|
+
label: a11.label,
|
|
7865
|
+
icon: a11.icon,
|
|
7866
|
+
onClick: a11.onClick,
|
|
7867
|
+
destructive: a11.destructive,
|
|
7868
|
+
disabled: a11.disabled,
|
|
7869
|
+
separator: a11.separator
|
|
7870
|
+
}));
|
|
7871
|
+
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
7872
|
+
const columns = useMemo(() => toColumns(filterFields ?? []), [filterFields]);
|
|
7873
|
+
const fieldsById = useMemo(() => {
|
|
7874
|
+
const m2 = /* @__PURE__ */ new Map();
|
|
7875
|
+
for (const f2 of filterFields ?? []) m2.set(f2.id, f2);
|
|
7876
|
+
return m2;
|
|
7877
|
+
}, [filterFields]);
|
|
7878
|
+
const appliedFilters = useMemo(
|
|
7879
|
+
() => toAppliedFilters(filterModel, fieldsById),
|
|
7880
|
+
[filterModel, fieldsById]
|
|
7881
|
+
);
|
|
7882
|
+
const filterCount = appliedFilters.length;
|
|
7883
|
+
const [openChipKey, setOpenChipKey] = useState(null);
|
|
7884
|
+
const isEmptyVal2 = (v2) => v2 == null || v2 === "" || Array.isArray(v2) && v2.length === 0;
|
|
7885
|
+
const setGroupValue = (field, operator, value) => {
|
|
7886
|
+
const rest = filterModel.items.filter(
|
|
7887
|
+
(i3) => !(i3.field === field && i3.operator === operator)
|
|
7888
|
+
);
|
|
7889
|
+
const next = isEmptyVal2(value) ? rest : [
|
|
7890
|
+
...rest,
|
|
7891
|
+
{
|
|
7892
|
+
id: `${field}-${operator}`,
|
|
7893
|
+
field,
|
|
7894
|
+
operator,
|
|
7895
|
+
value
|
|
7896
|
+
}
|
|
7897
|
+
];
|
|
7898
|
+
onFilterModelChange({ ...filterModel, items: next });
|
|
7899
|
+
};
|
|
7900
|
+
const renderEditableChip = (f2, defaultChip) => {
|
|
7901
|
+
const [field, operator] = f2.id.split("|");
|
|
7902
|
+
const fieldDef = fieldsById.get(field);
|
|
7903
|
+
if (!fieldDef) return defaultChip;
|
|
7904
|
+
const isMulti = operator === "isAnyOf" || operator === "isNoneOf";
|
|
7905
|
+
const isTuple = operator === "between";
|
|
7906
|
+
const regType = isMulti ? "multiSelect" : fieldDef.type;
|
|
7907
|
+
const def = columnTypeRegistry.get(regType);
|
|
7908
|
+
const groupItems = filterModel.items.filter(
|
|
7909
|
+
(i3) => i3.field === field && i3.operator === operator
|
|
7910
|
+
);
|
|
7911
|
+
const currentValue = isTuple ? groupItems[0]?.value : isMulti ? groupItems.flatMap(
|
|
7912
|
+
(i3) => Array.isArray(i3.value) ? i3.value : i3.value != null ? [i3.value] : []
|
|
7913
|
+
) : groupItems[0]?.value;
|
|
7914
|
+
return /* @__PURE__ */ jsxs(
|
|
7915
|
+
Popover,
|
|
7916
|
+
{
|
|
7917
|
+
open: openChipKey === f2.id,
|
|
7918
|
+
onOpenChange: (o2) => setOpenChipKey(o2 ? f2.id : null),
|
|
7919
|
+
children: [
|
|
7920
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: defaultChip }),
|
|
7921
|
+
/* @__PURE__ */ jsx(PopoverContent, { align: "start", className: "p-0", children: def.renderFastFilterInput({
|
|
7922
|
+
value: currentValue,
|
|
7923
|
+
onChange: (v2) => setGroupValue(field, operator, v2),
|
|
7924
|
+
options: fieldDef.options,
|
|
7925
|
+
onClose: () => setOpenChipKey(null)
|
|
7926
|
+
}) })
|
|
7927
|
+
]
|
|
7928
|
+
}
|
|
7929
|
+
);
|
|
7930
|
+
};
|
|
7931
|
+
const tabs = views.length > 0 ? [
|
|
7932
|
+
{ id: ALL_VIEW_ID, name: title2 ?? "Todos" },
|
|
7933
|
+
...views.map((v2) => ({ id: v2.id, name: v2.label }))
|
|
7934
|
+
] : void 0;
|
|
7935
|
+
const savedViewsSlot = tabs ? /* @__PURE__ */ jsx(
|
|
7936
|
+
ToolbarTabs,
|
|
7937
|
+
{
|
|
7938
|
+
tabs,
|
|
7939
|
+
activeId: activeViewId ?? ALL_VIEW_ID,
|
|
7940
|
+
onSelect: (id) => onApplyView(
|
|
7941
|
+
id === ALL_VIEW_ID ? null : views.find((v2) => v2.id === id) ?? null
|
|
7942
|
+
),
|
|
7943
|
+
ariaLabel: "Visões"
|
|
7944
|
+
}
|
|
7945
|
+
) : title2 ? /* @__PURE__ */ jsxs("h2", { className: "text-title-md font-semibold text-fg-default", children: [
|
|
7946
|
+
title2,
|
|
7947
|
+
typeof count === "number" && /* @__PURE__ */ jsx("span", { className: "ml-gp-sm text-body-sm font-normal text-fg-muted", children: count })
|
|
7948
|
+
] }) : void 0;
|
|
7949
|
+
const removeFilter = (groupKey) => {
|
|
7950
|
+
const [field, operator] = groupKey.split("|");
|
|
7951
|
+
onFilterModelChange({
|
|
7952
|
+
...filterModel,
|
|
7953
|
+
items: filterModel.items.filter(
|
|
7954
|
+
(i3) => !(i3.field === field && i3.operator === operator)
|
|
7955
|
+
)
|
|
7956
|
+
});
|
|
7957
|
+
};
|
|
7958
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7959
|
+
/* @__PURE__ */ jsx(
|
|
7960
|
+
TableToolbar,
|
|
7961
|
+
{
|
|
7962
|
+
savedViews: savedViewsSlot,
|
|
7963
|
+
refresh: onRefresh ? /* @__PURE__ */ jsx(
|
|
7964
|
+
ToolbarToolButton,
|
|
7965
|
+
{
|
|
7966
|
+
icon: /* @__PURE__ */ jsx(RefreshCw, { className: loading ? "animate-spin" : void 0 }),
|
|
7967
|
+
"aria-label": "Atualizar",
|
|
7968
|
+
title: "Atualizar",
|
|
7969
|
+
onClick: onRefresh
|
|
7970
|
+
}
|
|
7971
|
+
) : void 0,
|
|
7972
|
+
search: searchable ? /* @__PURE__ */ jsx(
|
|
7973
|
+
ToolbarSearch,
|
|
7974
|
+
{
|
|
7975
|
+
value: search,
|
|
7976
|
+
placeholder: searchPlaceholder ?? "Buscar...",
|
|
7977
|
+
onChange: (e2) => onSearch(e2.target.value)
|
|
7978
|
+
}
|
|
7979
|
+
) : void 0,
|
|
7980
|
+
filter: filterFields && filterFields.length > 0 ? /* @__PURE__ */ jsx(
|
|
7981
|
+
ToolbarFilterButton,
|
|
7982
|
+
{
|
|
7983
|
+
isActive: filterCount > 0,
|
|
7984
|
+
hasIndicator: filterCount > 0,
|
|
7985
|
+
onClick: () => setDrawerOpen(true)
|
|
7986
|
+
}
|
|
7987
|
+
) : void 0,
|
|
7988
|
+
actions: hasActions ? /* @__PURE__ */ jsx(ToolbarActions, { actions: toolbarActions, extraItems: moreItems }) : void 0,
|
|
7989
|
+
more: !hasActions && moreActions && moreActions.length > 0 ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
7990
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
7991
|
+
ToolbarToolButton,
|
|
7992
|
+
{
|
|
7993
|
+
icon: /* @__PURE__ */ jsx(MoreHorizontal, {}),
|
|
7994
|
+
"aria-label": "Mais ações",
|
|
7995
|
+
title: "Mais ações"
|
|
7996
|
+
}
|
|
7997
|
+
) }),
|
|
7998
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", sideOffset: 4, children: moreActions.map(
|
|
7999
|
+
(a11, i3) => a11.separator ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, `s${i3}`) : /* @__PURE__ */ jsxs(
|
|
8000
|
+
DropdownMenuItem,
|
|
8001
|
+
{
|
|
8002
|
+
variant: a11.destructive ? "destructive" : "default",
|
|
8003
|
+
disabled: a11.disabled,
|
|
8004
|
+
onSelect: () => a11.onClick?.(),
|
|
8005
|
+
children: [
|
|
8006
|
+
a11.icon,
|
|
8007
|
+
a11.label
|
|
8008
|
+
]
|
|
8009
|
+
},
|
|
8010
|
+
a11.label?.toString() ?? i3
|
|
8011
|
+
)
|
|
8012
|
+
) })
|
|
8013
|
+
] }) : void 0
|
|
8014
|
+
}
|
|
8015
|
+
),
|
|
8016
|
+
/* @__PURE__ */ jsx(
|
|
8017
|
+
ToolbarApplied,
|
|
8018
|
+
{
|
|
8019
|
+
filters: appliedFilters,
|
|
8020
|
+
onRemove: removeFilter,
|
|
8021
|
+
onClearAll: () => onFilterModelChange({ ...filterModel, items: [] }),
|
|
8022
|
+
separator: false,
|
|
8023
|
+
renderChip: (f2, defaultChip) => renderEditableChip(f2, defaultChip)
|
|
8024
|
+
}
|
|
8025
|
+
),
|
|
8026
|
+
filterFields && filterFields.length > 0 && /* @__PURE__ */ jsx(
|
|
8027
|
+
ToolbarSimpleFilterDrawer,
|
|
8028
|
+
{
|
|
8029
|
+
open: drawerOpen,
|
|
8030
|
+
onOpenChange: setDrawerOpen,
|
|
8031
|
+
columns,
|
|
8032
|
+
filterModel,
|
|
8033
|
+
onFilterModelChange
|
|
8034
|
+
}
|
|
8035
|
+
)
|
|
8036
|
+
] });
|
|
8037
|
+
}
|
|
8038
|
+
function DataListVirtualized({
|
|
8039
|
+
items,
|
|
8040
|
+
density,
|
|
8041
|
+
estimateItemSize,
|
|
8042
|
+
selectable,
|
|
8043
|
+
selectedIds,
|
|
8044
|
+
openId,
|
|
8045
|
+
onToggleSelect,
|
|
8046
|
+
onItemClick,
|
|
8047
|
+
renderItem,
|
|
8048
|
+
getMenuItems,
|
|
8049
|
+
height = 480
|
|
8050
|
+
}) {
|
|
8051
|
+
const parentRef = useRef(null);
|
|
8052
|
+
const gap = density === "compact" ? 8 : 10;
|
|
8053
|
+
const v2 = useVirtualizer({
|
|
8054
|
+
count: items.length,
|
|
8055
|
+
getScrollElement: () => parentRef.current,
|
|
8056
|
+
estimateSize: () => estimateItemSize,
|
|
8057
|
+
// mede a altura REAL de cada card — sem isso o estimateItemSize (76) reservava
|
|
8058
|
+
// mais espaço que o card renderizado e o excedente aparecia como "gap" grande.
|
|
8059
|
+
measureElement: (el) => el.getBoundingClientRect().height,
|
|
8060
|
+
overscan: 8,
|
|
8061
|
+
gap
|
|
8062
|
+
});
|
|
8063
|
+
return /* @__PURE__ */ jsx("div", { ref: parentRef, className: "overflow-auto scrollbar-thin", style: { height }, children: /* @__PURE__ */ jsx("div", { style: { height: v2.getTotalSize(), position: "relative", width: "100%" }, children: v2.getVirtualItems().map((row) => {
|
|
8064
|
+
const item = items[row.index];
|
|
8065
|
+
return /* @__PURE__ */ jsx(
|
|
8066
|
+
"div",
|
|
8067
|
+
{
|
|
8068
|
+
"data-index": row.index,
|
|
8069
|
+
ref: v2.measureElement,
|
|
8070
|
+
style: {
|
|
8071
|
+
position: "absolute",
|
|
8072
|
+
top: 0,
|
|
8073
|
+
left: 0,
|
|
8074
|
+
width: "100%",
|
|
8075
|
+
transform: `translateY(${row.start}px)`
|
|
8076
|
+
},
|
|
8077
|
+
children: /* @__PURE__ */ jsx(
|
|
8078
|
+
ListItem,
|
|
8079
|
+
{
|
|
8080
|
+
item,
|
|
8081
|
+
state: {
|
|
8082
|
+
selected: selectedIds.has(item.id),
|
|
8083
|
+
open: openId === item.id,
|
|
8084
|
+
dragging: false,
|
|
8085
|
+
depth: 0
|
|
8086
|
+
},
|
|
8087
|
+
density,
|
|
8088
|
+
renderItem,
|
|
8089
|
+
getMenuItems,
|
|
8090
|
+
onClick: onItemClick,
|
|
8091
|
+
selectable,
|
|
8092
|
+
onToggleSelect
|
|
8093
|
+
}
|
|
8094
|
+
)
|
|
8095
|
+
},
|
|
8096
|
+
item.id
|
|
8097
|
+
);
|
|
8098
|
+
}) }) });
|
|
8099
|
+
}
|
|
8100
|
+
function DataListSkeleton({ count = 3 }) {
|
|
8101
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-gp-lg", "aria-hidden": "true", children: Array.from({ length: count }).map((_2, i3) => /* @__PURE__ */ jsxs(
|
|
8102
|
+
"div",
|
|
8103
|
+
{
|
|
8104
|
+
className: "w-full p-pad-xl bg-bg-surface border border-border-subtle dark:border-border-default rounded-radius-lg",
|
|
8105
|
+
children: [
|
|
8106
|
+
/* @__PURE__ */ jsx("div", { className: cn("h-[12px] rounded-radius-full bg-bg-muted animate-pulse", "w-1/3 mb-gp-md") }),
|
|
8107
|
+
/* @__PURE__ */ jsx("div", { className: cn("h-[12px] rounded-radius-full bg-bg-muted animate-pulse", "w-2/3") })
|
|
8108
|
+
]
|
|
8109
|
+
},
|
|
8110
|
+
i3
|
|
8111
|
+
)) });
|
|
8112
|
+
}
|
|
8113
|
+
function DataListInfinite({
|
|
8114
|
+
onLoadMore,
|
|
8115
|
+
hasMore,
|
|
8116
|
+
loading,
|
|
8117
|
+
skeletonCount = 3
|
|
8118
|
+
}) {
|
|
8119
|
+
const sentinelRef = useRef(null);
|
|
8120
|
+
const onLoadMoreRef = useRef(onLoadMore);
|
|
8121
|
+
onLoadMoreRef.current = onLoadMore;
|
|
8122
|
+
useEffect(() => {
|
|
8123
|
+
const el = sentinelRef.current;
|
|
8124
|
+
if (!el || !hasMore || loading) return;
|
|
8125
|
+
const io = new IntersectionObserver(
|
|
8126
|
+
(entries) => {
|
|
8127
|
+
if (entries[0]?.isIntersecting) onLoadMoreRef.current();
|
|
8128
|
+
},
|
|
8129
|
+
{ rootMargin: "200px" }
|
|
8130
|
+
);
|
|
8131
|
+
io.observe(el);
|
|
8132
|
+
return () => io.disconnect();
|
|
8133
|
+
}, [hasMore, loading]);
|
|
8134
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8135
|
+
loading && /* @__PURE__ */ jsx(DataListSkeleton, { count: skeletonCount }),
|
|
8136
|
+
hasMore && /* @__PURE__ */ jsx("div", { ref: sentinelRef, className: "h-px w-full", "aria-hidden": "true" })
|
|
8137
|
+
] });
|
|
8138
|
+
}
|
|
8139
|
+
function mergeLoaded(items, loaded) {
|
|
8140
|
+
if (Object.keys(loaded).length === 0) return items;
|
|
8141
|
+
return items.map((it) => {
|
|
8142
|
+
const children = loaded[it.id] ?? it.children;
|
|
8143
|
+
const mergedChildren = children ? mergeLoaded(children, loaded) : void 0;
|
|
8144
|
+
return mergedChildren ? { ...it, children: mergedChildren } : it;
|
|
8145
|
+
});
|
|
8146
|
+
}
|
|
8147
|
+
function DataList(props) {
|
|
8148
|
+
const {
|
|
8149
|
+
items,
|
|
8150
|
+
layout = "standard",
|
|
8151
|
+
groups,
|
|
8152
|
+
renderItem,
|
|
8153
|
+
getMenuItems,
|
|
8154
|
+
onItemClick,
|
|
8155
|
+
openId,
|
|
8156
|
+
groupSurface,
|
|
8157
|
+
density = "comfortable",
|
|
8158
|
+
title: title2,
|
|
8159
|
+
searchable,
|
|
8160
|
+
searchPlaceholder,
|
|
8161
|
+
filterFields,
|
|
8162
|
+
views,
|
|
8163
|
+
onRefresh,
|
|
8164
|
+
toolbarActions,
|
|
8165
|
+
moreActions,
|
|
8166
|
+
mode = "client",
|
|
8167
|
+
loading,
|
|
8168
|
+
total,
|
|
8169
|
+
onQueryChange,
|
|
8170
|
+
onLoadMore,
|
|
8171
|
+
hasMore,
|
|
8172
|
+
loadingMore,
|
|
8173
|
+
virtualized,
|
|
8174
|
+
estimateItemSize = 76,
|
|
8175
|
+
onLoadChildren,
|
|
8176
|
+
defaultExpandedIds,
|
|
8177
|
+
branchHighlight,
|
|
8178
|
+
selectable,
|
|
8179
|
+
onSelectionChange,
|
|
8180
|
+
bulkActions,
|
|
8181
|
+
enableDnD,
|
|
8182
|
+
onReorder,
|
|
8183
|
+
onMove,
|
|
8184
|
+
persistKey,
|
|
8185
|
+
fillHeight,
|
|
8186
|
+
className,
|
|
8187
|
+
emptyState
|
|
8188
|
+
} = props;
|
|
8189
|
+
const [loaded, setLoaded] = useState({});
|
|
8190
|
+
const baseItems = useMemo(() => mergeLoaded(items, loaded), [items, loaded]);
|
|
8191
|
+
const ctrl = useDataList({
|
|
8192
|
+
items: baseItems,
|
|
8193
|
+
mode,
|
|
8194
|
+
filterFields,
|
|
8195
|
+
views,
|
|
8196
|
+
persistKey,
|
|
8197
|
+
defaultExpandedIds,
|
|
8198
|
+
onQueryChange,
|
|
8199
|
+
onSelectionChange
|
|
8200
|
+
});
|
|
8201
|
+
const handleExpandedChange = useCallback(
|
|
8202
|
+
(next) => {
|
|
8203
|
+
const added = [...next].find((id) => !ctrl.expanded.has(id));
|
|
8204
|
+
ctrl.setExpanded(next);
|
|
8205
|
+
if (added && onLoadChildren && !loaded[added]) {
|
|
8206
|
+
onLoadChildren(added).then(
|
|
8207
|
+
(children) => setLoaded((p4) => ({ ...p4, [added]: children }))
|
|
8208
|
+
);
|
|
8209
|
+
}
|
|
8210
|
+
},
|
|
8211
|
+
[ctrl, onLoadChildren, loaded]
|
|
8212
|
+
);
|
|
8213
|
+
const useVirtual = Boolean(virtualized) && layout === "standard";
|
|
8214
|
+
const dndEnabled = Boolean(enableDnD) && !useVirtual;
|
|
8215
|
+
const count = mode === "server" ? total : ctrl.processedItems.length;
|
|
8216
|
+
const body2 = useVirtual ? /* @__PURE__ */ jsx(
|
|
8217
|
+
DataListVirtualized,
|
|
8218
|
+
{
|
|
8219
|
+
items: ctrl.processedItems,
|
|
8220
|
+
density,
|
|
8221
|
+
estimateItemSize,
|
|
8222
|
+
selectable,
|
|
8223
|
+
selectedIds: ctrl.selected,
|
|
8224
|
+
openId,
|
|
8225
|
+
onToggleSelect: ctrl.toggleSelect,
|
|
8226
|
+
onItemClick,
|
|
8227
|
+
renderItem,
|
|
8228
|
+
getMenuItems
|
|
8229
|
+
}
|
|
8230
|
+
) : /* @__PURE__ */ jsx(
|
|
8231
|
+
List,
|
|
8232
|
+
{
|
|
8233
|
+
layout,
|
|
8234
|
+
items: ctrl.processedItems,
|
|
8235
|
+
groups,
|
|
8236
|
+
renderItem,
|
|
8237
|
+
getMenuItems,
|
|
8238
|
+
onItemClick,
|
|
8239
|
+
openId,
|
|
8240
|
+
groupSurface,
|
|
8241
|
+
density,
|
|
8242
|
+
branchHighlight,
|
|
8243
|
+
selectable,
|
|
8244
|
+
selectedIds: ctrl.selected,
|
|
8245
|
+
onSelectionChange: ctrl.replaceSelection,
|
|
8246
|
+
expandedIds: ctrl.expanded,
|
|
8247
|
+
onExpandedChange: handleExpandedChange,
|
|
8248
|
+
enableDnD: dndEnabled,
|
|
8249
|
+
onReorder,
|
|
8250
|
+
onMove,
|
|
8251
|
+
loading,
|
|
8252
|
+
emptyState
|
|
8253
|
+
}
|
|
8254
|
+
);
|
|
8255
|
+
const selCount = ctrl.selected.size;
|
|
8256
|
+
const scrollBody = fillHeight && !useVirtual;
|
|
8257
|
+
const listBlock = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8258
|
+
body2,
|
|
8259
|
+
onLoadMore && !useVirtual && /* @__PURE__ */ jsx(
|
|
8260
|
+
DataListInfinite,
|
|
8261
|
+
{
|
|
8262
|
+
onLoadMore,
|
|
8263
|
+
hasMore: Boolean(hasMore),
|
|
8264
|
+
loading: Boolean(loadingMore)
|
|
8265
|
+
}
|
|
8266
|
+
)
|
|
8267
|
+
] });
|
|
8268
|
+
return /* @__PURE__ */ jsxs(
|
|
8269
|
+
"div",
|
|
8270
|
+
{
|
|
8271
|
+
className: cn(
|
|
8272
|
+
"flex flex-col gap-gp-lg",
|
|
8273
|
+
fillHeight && "min-h-0",
|
|
8274
|
+
className
|
|
8275
|
+
),
|
|
8276
|
+
children: [
|
|
8277
|
+
/* @__PURE__ */ jsx(
|
|
8278
|
+
DataListToolbar,
|
|
8279
|
+
{
|
|
8280
|
+
title: title2,
|
|
8281
|
+
count,
|
|
8282
|
+
views: ctrl.views,
|
|
8283
|
+
activeViewId: ctrl.activeViewId,
|
|
8284
|
+
onApplyView: ctrl.applyView,
|
|
8285
|
+
searchable,
|
|
8286
|
+
searchPlaceholder,
|
|
8287
|
+
search: ctrl.query.search,
|
|
8288
|
+
onSearch: ctrl.setSearch,
|
|
8289
|
+
filterFields,
|
|
8290
|
+
filterModel: ctrl.query.filterModel,
|
|
8291
|
+
onFilterModelChange: ctrl.setFilterModel,
|
|
8292
|
+
onRefresh,
|
|
8293
|
+
toolbarActions,
|
|
8294
|
+
moreActions,
|
|
8295
|
+
loading
|
|
8296
|
+
}
|
|
8297
|
+
),
|
|
8298
|
+
selectable && selCount > 0 && bulkActions && bulkActions.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-gp-md rounded-radius-lg border border-border-brand-subtle bg-bg-brand-subtle px-pad-xl py-pad-md", children: [
|
|
8299
|
+
/* @__PURE__ */ jsxs("span", { className: "text-body-sm font-medium text-fg-default", children: [
|
|
8300
|
+
selCount,
|
|
8301
|
+
" selecionado(s)"
|
|
8302
|
+
] }),
|
|
8303
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-gp-sm", children: [
|
|
8304
|
+
bulkActions.map((a11, i3) => /* @__PURE__ */ jsx(
|
|
8305
|
+
Button,
|
|
8306
|
+
{
|
|
8307
|
+
size: "sm",
|
|
8308
|
+
variant: a11.destructive ? "soft" : "soft",
|
|
8309
|
+
color: a11.destructive ? "critical" : "secondary",
|
|
8310
|
+
iconLeft: a11.icon,
|
|
8311
|
+
onClick: () => a11.onClick(ctrl.selected),
|
|
8312
|
+
children: a11.label
|
|
8313
|
+
},
|
|
8314
|
+
i3
|
|
8315
|
+
)),
|
|
8316
|
+
/* @__PURE__ */ jsx(
|
|
8317
|
+
Button,
|
|
8318
|
+
{
|
|
8319
|
+
size: "sm",
|
|
8320
|
+
variant: "ghost",
|
|
8321
|
+
color: "secondary",
|
|
8322
|
+
onClick: ctrl.clearSelection,
|
|
8323
|
+
children: "Limpar"
|
|
8324
|
+
}
|
|
8325
|
+
)
|
|
8326
|
+
] })
|
|
8327
|
+
] }),
|
|
8328
|
+
scrollBody ? /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden scrollbar-thin pr-pad-xs", children: listBlock }) : listBlock
|
|
8329
|
+
]
|
|
8330
|
+
}
|
|
8331
|
+
);
|
|
8332
|
+
}
|
|
8333
|
+
const toastVariants = tv({
|
|
8334
|
+
slots: {
|
|
8335
|
+
root: "flex w-full flex-col gap-gp-md rounded-radius-xl border border-border-default bg-bg-surface p-pad-2xl text-left shadow-sh-lg",
|
|
8336
|
+
row: "flex items-center gap-gp-xl",
|
|
8337
|
+
iconChip: "flex size-form-md shrink-0 items-center justify-center rounded-radius-lg [&_svg]:size-[18px]",
|
|
8338
|
+
content: "flex min-w-0 flex-1 flex-col gap-gp-2xs",
|
|
8339
|
+
title: "text-body-sm font-semibold text-fg-default",
|
|
8340
|
+
description: "text-body-sm text-fg-muted",
|
|
8341
|
+
rightCluster: "flex shrink-0 items-center gap-gp-sm",
|
|
8342
|
+
meta: "whitespace-nowrap text-caption-sm text-fg-subtle",
|
|
8343
|
+
footer: "flex items-center justify-end gap-gp-xs"
|
|
8344
|
+
},
|
|
8345
|
+
variants: {
|
|
8346
|
+
status: {
|
|
8347
|
+
default: { iconChip: "bg-bg-muted text-fg-default" },
|
|
8348
|
+
info: { iconChip: "bg-bg-info-muted text-fg-info" },
|
|
8349
|
+
success: { iconChip: "bg-bg-success-muted text-fg-success" },
|
|
8350
|
+
warning: { iconChip: "bg-bg-warning-muted text-fg-warning" },
|
|
8351
|
+
danger: { iconChip: "bg-bg-danger-muted text-fg-danger" }
|
|
8352
|
+
}
|
|
8353
|
+
},
|
|
8354
|
+
defaultVariants: {
|
|
8355
|
+
status: "default"
|
|
8356
|
+
}
|
|
8357
|
+
});
|
|
8358
|
+
const DEFAULT_ICON = {
|
|
8359
|
+
default: /* @__PURE__ */ jsx(Bell, {}),
|
|
8360
|
+
info: /* @__PURE__ */ jsx(Info, {}),
|
|
8361
|
+
success: /* @__PURE__ */ jsx(CircleCheck, {}),
|
|
8362
|
+
warning: /* @__PURE__ */ jsx(TriangleAlert, {}),
|
|
8363
|
+
danger: /* @__PURE__ */ jsx(OctagonX, {})
|
|
8364
|
+
};
|
|
8365
|
+
const TONE_PROPS = {
|
|
8366
|
+
brand: { color: "primary", variant: "filled" },
|
|
8367
|
+
neutral: { color: "secondary", variant: "soft" },
|
|
8368
|
+
danger: { color: "critical", variant: "soft" }
|
|
8369
|
+
};
|
|
8370
|
+
function ActionButton({ action }) {
|
|
8371
|
+
const tone = TONE_PROPS[action.tone ?? "brand"];
|
|
8372
|
+
return /* @__PURE__ */ jsx(
|
|
8373
|
+
Button,
|
|
8374
|
+
{
|
|
8375
|
+
color: tone.color,
|
|
8376
|
+
variant: tone.variant,
|
|
8377
|
+
size: "xs",
|
|
8378
|
+
iconLeft: action.iconLeft,
|
|
8379
|
+
iconRight: action.iconRight,
|
|
8380
|
+
onClick: action.onClick,
|
|
8381
|
+
children: action.label
|
|
8382
|
+
}
|
|
8383
|
+
);
|
|
8384
|
+
}
|
|
8385
|
+
function ToastCard({
|
|
8386
|
+
status = "default",
|
|
8387
|
+
title: title2,
|
|
8388
|
+
description: description2,
|
|
8389
|
+
icon,
|
|
8390
|
+
meta,
|
|
8391
|
+
action,
|
|
8392
|
+
cancel,
|
|
8393
|
+
onClose,
|
|
8394
|
+
toastId
|
|
8395
|
+
}) {
|
|
8396
|
+
const s = toastVariants({ status });
|
|
8397
|
+
const hasFooter = Boolean(cancel);
|
|
8398
|
+
const inlineAction = action && !hasFooter ? action : null;
|
|
8399
|
+
const handleClose = () => {
|
|
8400
|
+
onClose?.();
|
|
8401
|
+
if (toastId !== void 0) toast$1.dismiss(toastId);
|
|
8402
|
+
};
|
|
8403
|
+
return /* @__PURE__ */ jsxs("div", { className: s.root(), children: [
|
|
8404
|
+
/* @__PURE__ */ jsxs("div", { className: s.row(), children: [
|
|
8405
|
+
/* @__PURE__ */ jsx("span", { className: s.iconChip(), children: icon ?? DEFAULT_ICON[status] }),
|
|
8406
|
+
/* @__PURE__ */ jsxs("div", { className: s.content(), children: [
|
|
8407
|
+
/* @__PURE__ */ jsx("div", { className: s.title(), children: title2 }),
|
|
8408
|
+
description2 && /* @__PURE__ */ jsx("div", { className: s.description(), children: description2 })
|
|
8409
|
+
] }),
|
|
8410
|
+
(meta || inlineAction || onClose) && /* @__PURE__ */ jsxs("div", { className: s.rightCluster(), children: [
|
|
8411
|
+
meta && /* @__PURE__ */ jsx("span", { className: s.meta(), children: meta }),
|
|
8412
|
+
inlineAction && /* @__PURE__ */ jsx(ActionButton, { action: inlineAction }),
|
|
8413
|
+
onClose && /* @__PURE__ */ jsx(
|
|
8414
|
+
Button,
|
|
8415
|
+
{
|
|
8416
|
+
color: "secondary",
|
|
8417
|
+
variant: "ghost",
|
|
8418
|
+
size: "icon-2xs",
|
|
8419
|
+
"aria-label": "Fechar",
|
|
8420
|
+
iconLeft: /* @__PURE__ */ jsx(X2, {}),
|
|
8421
|
+
onClick: handleClose
|
|
8422
|
+
}
|
|
8423
|
+
)
|
|
8424
|
+
] })
|
|
8425
|
+
] }),
|
|
8426
|
+
hasFooter && /* @__PURE__ */ jsxs("div", { className: s.footer(), children: [
|
|
8427
|
+
cancel && /* @__PURE__ */ jsx(ActionButton, { action: { tone: "neutral", ...cancel } }),
|
|
8428
|
+
action && /* @__PURE__ */ jsx(ActionButton, { action })
|
|
8429
|
+
] })
|
|
8430
|
+
] });
|
|
8431
|
+
}
|
|
8432
|
+
const STRIP_SONNER_BOX = {
|
|
8433
|
+
toast: "!bg-transparent !border-0 !p-0 !shadow-none"
|
|
8434
|
+
};
|
|
8435
|
+
function show(opts, status) {
|
|
8436
|
+
const { duration, position, id, ...card } = opts;
|
|
8437
|
+
return toast$1.custom(
|
|
8438
|
+
(t) => /* @__PURE__ */ jsx(ToastCard, { ...card, status, toastId: t }),
|
|
8439
|
+
{ duration, position, id, classNames: STRIP_SONNER_BOX }
|
|
8440
|
+
);
|
|
8441
|
+
}
|
|
8442
|
+
const toast = Object.assign(
|
|
8443
|
+
(opts) => show(opts, "default"),
|
|
8444
|
+
{
|
|
8445
|
+
success: (opts) => show(opts, "success"),
|
|
8446
|
+
error: (opts) => show(opts, "danger"),
|
|
8447
|
+
warning: (opts) => show(opts, "warning"),
|
|
8448
|
+
info: (opts) => show(opts, "info"),
|
|
8449
|
+
// passthrough nativo do Sonner
|
|
8450
|
+
promise: toast$1.promise,
|
|
8451
|
+
dismiss: toast$1.dismiss,
|
|
8452
|
+
custom: toast$1.custom,
|
|
8453
|
+
loading: toast$1.loading
|
|
8454
|
+
}
|
|
8455
|
+
);
|
|
7517
8456
|
const BRANDS = [
|
|
7518
8457
|
{ id: "default", label: "iGreen", swatch: "oklch(0.5248 0.1415 150.9)" },
|
|
7519
8458
|
{ id: "blue", label: "Azul", swatch: "oklch(0.52 0.180 264)" },
|
|
@@ -7526,7 +8465,7 @@ const CHANGE_EVENT = "igreen-ds-brand-change";
|
|
|
7526
8465
|
const ATTR = "data-theme";
|
|
7527
8466
|
function useBrand(options) {
|
|
7528
8467
|
const brands = options?.brands ?? BRANDS;
|
|
7529
|
-
const ids = useMemo(() => brands.map((
|
|
8468
|
+
const ids = useMemo(() => brands.map((b4) => b4.id).join(","), [brands]);
|
|
7530
8469
|
const isBrand = useCallback(
|
|
7531
8470
|
(value) => typeof value === "string" && ids.split(",").includes(value),
|
|
7532
8471
|
[ids]
|
|
@@ -7572,85 +8511,94 @@ function useBrand(options) {
|
|
|
7572
8511
|
}, [ids]);
|
|
7573
8512
|
const toggle = useCallback(() => {
|
|
7574
8513
|
const lista = ids.split(",");
|
|
7575
|
-
const
|
|
7576
|
-
setBrand(lista[(
|
|
8514
|
+
const i3 = lista.indexOf(brand);
|
|
8515
|
+
setBrand(lista[(i3 + 1) % lista.length] ?? fallback);
|
|
7577
8516
|
}, [brand, ids, setBrand, fallback]);
|
|
7578
8517
|
const current = useMemo(
|
|
7579
|
-
() => brands.find((
|
|
8518
|
+
() => brands.find((b4) => b4.id === brand) ?? brands[0],
|
|
7580
8519
|
[brands, brand]
|
|
7581
8520
|
);
|
|
7582
8521
|
return { brand, brands, current, setBrand, toggle, isBrand };
|
|
7583
8522
|
}
|
|
7584
8523
|
export {
|
|
7585
|
-
|
|
8524
|
+
u as AddViewModal,
|
|
7586
8525
|
A as AlertModal,
|
|
7587
8526
|
A2 as AppShell,
|
|
7588
8527
|
Avatar,
|
|
7589
8528
|
BRANDS,
|
|
7590
|
-
Badge,
|
|
8529
|
+
B2 as Badge,
|
|
7591
8530
|
B as BulkActionButton,
|
|
7592
|
-
|
|
8531
|
+
v as BulkActionsBar,
|
|
7593
8532
|
Button,
|
|
7594
8533
|
ButtonGroup,
|
|
7595
8534
|
CardCheckbox,
|
|
8535
|
+
ChartContainer,
|
|
8536
|
+
ChartLegend,
|
|
8537
|
+
ChartLegendContent,
|
|
8538
|
+
ChartStyle,
|
|
8539
|
+
ChartTooltip,
|
|
8540
|
+
ChartTooltipContent,
|
|
7596
8541
|
Chip,
|
|
7597
|
-
|
|
7598
|
-
|
|
8542
|
+
a as ChipGroup,
|
|
8543
|
+
b2 as ChipGroupItem,
|
|
7599
8544
|
ChoroplethMap,
|
|
7600
8545
|
ColorPicker,
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
8546
|
+
C as ColsPanel,
|
|
8547
|
+
w as ColsPopover,
|
|
8548
|
+
x as Combobox,
|
|
7604
8549
|
ConversationListItem,
|
|
7605
8550
|
DEFAULT_COLOR_PRESETS,
|
|
7606
|
-
|
|
8551
|
+
y as DEFAULT_FILTER_OPERATORS,
|
|
7607
8552
|
DEFAULT_MESSAGE_VARIABLES,
|
|
8553
|
+
DataList,
|
|
7608
8554
|
D as DataTable,
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
8555
|
+
z as DataTableActionsCell,
|
|
8556
|
+
E as DataTableEditCell,
|
|
8557
|
+
G as DataTableEmpty,
|
|
8558
|
+
H as DataTableFloatingBulkBar,
|
|
8559
|
+
I as DataTableLoading,
|
|
8560
|
+
J as DataTableNoResults,
|
|
8561
|
+
K as DataTableTotalizerRow,
|
|
7616
8562
|
DatePicker,
|
|
7617
8563
|
DateSeparatorChip,
|
|
7618
8564
|
EmptyState,
|
|
7619
|
-
|
|
8565
|
+
M as FLOATING_PANEL_SIZE_PX,
|
|
7620
8566
|
FileUploadField,
|
|
7621
|
-
|
|
8567
|
+
N as FilterPanel,
|
|
7622
8568
|
FilterPopover,
|
|
7623
8569
|
d as FloatingPanel,
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
8570
|
+
O as FloatingPanelField,
|
|
8571
|
+
Q as FloatingPanelSection,
|
|
8572
|
+
R as FooterTable,
|
|
8573
|
+
S as FooterTableSkeleton,
|
|
7628
8574
|
FormField,
|
|
7629
|
-
|
|
8575
|
+
U as FormFieldCheckbox,
|
|
7630
8576
|
F as FormFieldInput,
|
|
7631
8577
|
b as FormFieldSelect,
|
|
7632
|
-
|
|
8578
|
+
V as FormFieldSwitch,
|
|
7633
8579
|
c as FormFieldTextarea,
|
|
7634
8580
|
H2 as Header,
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
8581
|
+
c2 as HeaderBreadcrumb,
|
|
8582
|
+
d2 as HeaderMessages,
|
|
8583
|
+
e as HeaderNotifications,
|
|
8584
|
+
f as HeaderSearch,
|
|
8585
|
+
g as HeaderThemeSwitcher,
|
|
7640
8586
|
Icon,
|
|
7641
8587
|
Input,
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
8588
|
+
O2 as InputGroup,
|
|
8589
|
+
P2 as InputGroupAddon,
|
|
8590
|
+
Q2 as InputGroupButton,
|
|
8591
|
+
R2 as InputGroupInput,
|
|
8592
|
+
S3 as InputGroupText,
|
|
8593
|
+
T as InputGroupTextarea,
|
|
8594
|
+
W as Kanban,
|
|
8595
|
+
a10 as Kpi,
|
|
8596
|
+
b3 as KpiDelta,
|
|
8597
|
+
K2 as KpiGroup,
|
|
8598
|
+
List,
|
|
8599
|
+
ListItem,
|
|
7652
8600
|
MarkdownText,
|
|
7653
|
-
|
|
8601
|
+
M2 as MenuSidebar,
|
|
7654
8602
|
MessageAck,
|
|
7655
8603
|
MessageBubble,
|
|
7656
8604
|
MessageComposer,
|
|
@@ -7658,68 +8606,69 @@ export {
|
|
|
7658
8606
|
MessageVariablesPicker,
|
|
7659
8607
|
Modal,
|
|
7660
8608
|
MonthYearPicker,
|
|
7661
|
-
|
|
7662
|
-
|
|
8609
|
+
X as MoreMenu,
|
|
8610
|
+
w2 as MoreMenuCheckboxItem,
|
|
7663
8611
|
DropdownMenuItem as MoreMenuItem,
|
|
7664
8612
|
DropdownMenuLabel as MoreMenuLabel,
|
|
7665
|
-
|
|
7666
|
-
|
|
8613
|
+
G2 as MoreMenuRadioGroup,
|
|
8614
|
+
H3 as MoreMenuRadioItem,
|
|
7667
8615
|
DropdownMenuSeparator as MoreMenuSeparator,
|
|
7668
|
-
|
|
8616
|
+
P3 as PageHeader,
|
|
7669
8617
|
P as Panel,
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
8618
|
+
Y as PanelBody,
|
|
8619
|
+
G3 as PanelCloseAction,
|
|
8620
|
+
H4 as PanelContent,
|
|
8621
|
+
Z as PanelFooter,
|
|
8622
|
+
_ as PanelHeader,
|
|
8623
|
+
F2 as PanelRoot,
|
|
8624
|
+
O3 as PanelTrigger,
|
|
8625
|
+
$ as SELECTION_COLUMN_WIDTH,
|
|
8626
|
+
S2 as SidebarBrandIcon,
|
|
8627
|
+
h as SidebarItem,
|
|
8628
|
+
i as SidebarPanel,
|
|
8629
|
+
j as SidebarPill,
|
|
8630
|
+
k as SidebarRail,
|
|
8631
|
+
l as SidebarSection,
|
|
8632
|
+
m as SidebarSubgroup,
|
|
7685
8633
|
SingleMenuSidebar,
|
|
7686
|
-
|
|
7687
|
-
|
|
8634
|
+
a0 as SortPanel,
|
|
8635
|
+
a1 as SortPopover,
|
|
7688
8636
|
Spinner,
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
8637
|
+
a2 as TABLE_HEADER_HEIGHT,
|
|
8638
|
+
a3 as Table,
|
|
8639
|
+
a4 as TableBody,
|
|
8640
|
+
a5 as TableCardRow,
|
|
8641
|
+
a6 as TableCell,
|
|
8642
|
+
a7 as TableHead,
|
|
8643
|
+
a8 as TableHeadCell,
|
|
8644
|
+
a9 as TableRow,
|
|
8645
|
+
TableToolbar,
|
|
8646
|
+
aa as TableToolbarViews,
|
|
8647
|
+
ToastCard,
|
|
8648
|
+
ToolbarApplied,
|
|
7700
8649
|
ab as ToolbarDivider,
|
|
7701
8650
|
ToolbarFilterControl,
|
|
7702
8651
|
ToolbarMobileDialog,
|
|
7703
8652
|
ToolbarMobileSection,
|
|
7704
8653
|
ToolbarMobileSheet,
|
|
7705
8654
|
ac as ToolbarSaveButton,
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
8655
|
+
ToolbarSearch,
|
|
8656
|
+
ad as ToolbarSegmented,
|
|
8657
|
+
ae as ToolbarSettingsMenu,
|
|
7709
8658
|
ToolbarSimpleFilterDrawer,
|
|
7710
|
-
|
|
8659
|
+
ToolbarTabs,
|
|
7711
8660
|
ToolbarToolButton,
|
|
7712
|
-
|
|
7713
|
-
|
|
8661
|
+
U2 as UserMenu,
|
|
8662
|
+
af as ViewsPopover,
|
|
7714
8663
|
actionColumn,
|
|
7715
|
-
|
|
7716
|
-
badgeVariants,
|
|
7717
|
-
|
|
8664
|
+
ag as avatarVariants,
|
|
8665
|
+
aO as badgeVariants,
|
|
8666
|
+
a22 as buttonVariants,
|
|
7718
8667
|
cardCheckbox,
|
|
7719
|
-
|
|
7720
|
-
|
|
8668
|
+
n as chipCount,
|
|
8669
|
+
o as chipVariants,
|
|
7721
8670
|
colorPickerStyles,
|
|
7722
|
-
|
|
8671
|
+
columnTypeRegistry,
|
|
7723
8672
|
conversationListItemStyles,
|
|
7724
8673
|
currencyColumn,
|
|
7725
8674
|
customColumn,
|
|
@@ -7727,11 +8676,11 @@ export {
|
|
|
7727
8676
|
dateSeparatorChipStyles,
|
|
7728
8677
|
emailColumn,
|
|
7729
8678
|
emptyStateStyles,
|
|
7730
|
-
|
|
8679
|
+
ah as floatingPanelStyles,
|
|
7731
8680
|
iconStyles,
|
|
7732
8681
|
icons,
|
|
7733
|
-
|
|
7734
|
-
|
|
8682
|
+
a12 as inputGroupVariants,
|
|
8683
|
+
i2 as inputVariants,
|
|
7735
8684
|
isFilterEntryActive,
|
|
7736
8685
|
markdownTextStyles,
|
|
7737
8686
|
messageAckStyles,
|
|
@@ -7739,20 +8688,23 @@ export {
|
|
|
7739
8688
|
messageComposerStyles,
|
|
7740
8689
|
messageVariablesPickerStyles,
|
|
7741
8690
|
numberColumn,
|
|
7742
|
-
|
|
7743
|
-
|
|
8691
|
+
p3 as pageHeaderStyles,
|
|
8692
|
+
ai as panelContainer,
|
|
7744
8693
|
phoneColumn,
|
|
7745
8694
|
p as presetView,
|
|
7746
|
-
|
|
8695
|
+
aj as savedViewsMockService,
|
|
7747
8696
|
statusColumn,
|
|
7748
8697
|
textColumn,
|
|
8698
|
+
toast,
|
|
8699
|
+
toastVariants,
|
|
7749
8700
|
useBrand,
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
8701
|
+
useChart,
|
|
8702
|
+
ak as useColumnResize,
|
|
8703
|
+
al as useColumnWidths,
|
|
8704
|
+
p2 as useControllable,
|
|
8705
|
+
am as useDataTableContext,
|
|
8706
|
+
an as useFloatingPanelResize,
|
|
8707
|
+
q as useMediaQuery,
|
|
7756
8708
|
u2 as useTheme,
|
|
7757
8709
|
useToolbarFilterControl,
|
|
7758
8710
|
useToolbarFilters,
|