@snksergio/design-system 0.1.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 +260 -0
- package/dist-lib/chunks/app-shell-BNTvOETJ.mjs +2681 -0
- package/dist-lib/chunks/app-shell-BNTvOETJ.mjs.map +1 -0
- package/dist-lib/chunks/app-shell-CDy42aNI.mjs +2663 -0
- package/dist-lib/chunks/app-shell-CDy42aNI.mjs.map +1 -0
- package/dist-lib/chunks/app-shell-mocks-kWIVSzLs.mjs +208 -0
- package/dist-lib/chunks/app-shell-mocks-kWIVSzLs.mjs.map +1 -0
- package/dist-lib/chunks/app-shell-mocks-oO_IV3Gw.mjs +207 -0
- package/dist-lib/chunks/app-shell-mocks-oO_IV3Gw.mjs.map +1 -0
- package/dist-lib/chunks/badge-B_2Zt52o.mjs +797 -0
- package/dist-lib/chunks/badge-B_2Zt52o.mjs.map +1 -0
- package/dist-lib/chunks/badge-DKpXURa1.mjs +813 -0
- package/dist-lib/chunks/badge-DKpXURa1.mjs.map +1 -0
- package/dist-lib/chunks/chat-v2-mocks-BV9Wha_Z.mjs +192 -0
- package/dist-lib/chunks/chat-v2-mocks-BV9Wha_Z.mjs.map +1 -0
- package/dist-lib/chunks/chat-v2-mocks-DvZRkhmz.mjs +193 -0
- package/dist-lib/chunks/chat-v2-mocks-DvZRkhmz.mjs.map +1 -0
- package/dist-lib/chunks/chip-group-CsKBBHW2.mjs +796 -0
- package/dist-lib/chunks/chip-group-CsKBBHW2.mjs.map +1 -0
- package/dist-lib/chunks/chip-group-D3D0i72q.mjs +780 -0
- package/dist-lib/chunks/chip-group-D3D0i72q.mjs.map +1 -0
- package/dist-lib/chunks/clientes-showcase-mocks-BMfbNNJh.mjs +185 -0
- package/dist-lib/chunks/clientes-showcase-mocks-BMfbNNJh.mjs.map +1 -0
- package/dist-lib/chunks/clientes-showcase-mocks-Cq9u3nGZ.mjs +169 -0
- package/dist-lib/chunks/clientes-showcase-mocks-Cq9u3nGZ.mjs.map +1 -0
- package/dist-lib/chunks/input-374MpdBL.mjs +72 -0
- package/dist-lib/chunks/input-374MpdBL.mjs.map +1 -0
- package/dist-lib/chunks/input-DF4XAWmr.mjs +56 -0
- package/dist-lib/chunks/input-DF4XAWmr.mjs.map +1 -0
- package/dist-lib/chunks/page-header-Dw-3wqAG.mjs +75 -0
- package/dist-lib/chunks/page-header-Dw-3wqAG.mjs.map +1 -0
- package/dist-lib/chunks/page-header-mC1gGtOI.mjs +76 -0
- package/dist-lib/chunks/page-header-mC1gGtOI.mjs.map +1 -0
- package/dist-lib/chunks/panel-Ds15whqp.mjs +9717 -0
- package/dist-lib/chunks/panel-Ds15whqp.mjs.map +1 -0
- package/dist-lib/chunks/panel-bzNmFlEZ.mjs +9737 -0
- package/dist-lib/chunks/panel-bzNmFlEZ.mjs.map +1 -0
- package/dist-lib/chunks/useTheme-BUPLZBMs.mjs +66 -0
- package/dist-lib/chunks/useTheme-BUPLZBMs.mjs.map +1 -0
- package/dist-lib/chunks/useTheme-Dee4mo-A.mjs +65 -0
- package/dist-lib/chunks/useTheme-Dee4mo-A.mjs.map +1 -0
- package/dist-lib/index.cjs +1207 -0
- package/dist-lib/index.cjs.map +1 -0
- package/dist-lib/index.d.ts +2 -0
- package/dist-lib/index.mjs +1209 -0
- package/dist-lib/index.mjs.map +1 -0
- package/dist-lib/preview/chat.cjs +1120 -0
- package/dist-lib/preview/chat.cjs.map +1 -0
- package/dist-lib/preview/chat.d.ts +6 -0
- package/dist-lib/preview/chat.mjs +1120 -0
- package/dist-lib/preview/chat.mjs.map +1 -0
- package/dist-lib/preview/clientes.cjs +897 -0
- package/dist-lib/preview/clientes.cjs.map +1 -0
- package/dist-lib/preview/clientes.d.ts +6 -0
- package/dist-lib/preview/clientes.mjs +897 -0
- package/dist-lib/preview/clientes.mjs.map +1 -0
- package/dist-lib/preview/dashboard.cjs +733 -0
- package/dist-lib/preview/dashboard.cjs.map +1 -0
- package/dist-lib/preview/dashboard.d.ts +4 -0
- package/dist-lib/preview/dashboard.mjs +733 -0
- package/dist-lib/preview/dashboard.mjs.map +1 -0
- package/dist-lib/preview/mocks.cjs +15 -0
- package/dist-lib/preview/mocks.cjs.map +1 -0
- package/dist-lib/preview/mocks.d.ts +2 -0
- package/dist-lib/preview/mocks.mjs +15 -0
- package/dist-lib/preview/mocks.mjs.map +1 -0
- package/dist-lib/theme.css +668 -0
- package/dist-lib/tokens.cjs +915 -0
- package/dist-lib/tokens.cjs.map +1 -0
- package/dist-lib/tokens.d.ts +2 -0
- package/dist-lib/tokens.mjs +915 -0
- package/dist-lib/tokens.mjs.map +1 -0
- package/package.json +142 -0
|
@@ -0,0 +1,797 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useState, useRef, useCallback, useEffect, createContext, forwardRef, useContext } from "react";
|
|
4
|
+
import { ArrowUp, ArrowDown, ArrowUpDown, Minus, Check } from "lucide-react";
|
|
5
|
+
import { t as tv, c as cn } from "./chip-group-D3D0i72q.mjs";
|
|
6
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
7
|
+
const tableStyles = tv({
|
|
8
|
+
slots: {
|
|
9
|
+
/* Root grid container. Aplica container-type pra container queries.
|
|
10
|
+
flex flex-col: scroll child usa flex-1 min-h-0 pra esticar quando há altura forçada
|
|
11
|
+
(consumer aplica `max-h-[Npx]` no Table) ou pegar altura natural quando não há. */
|
|
12
|
+
root: [
|
|
13
|
+
"relative flex flex-col w-full",
|
|
14
|
+
"bg-bg-table border border-border-table rounded-radius-xl shadow-sh-sm",
|
|
15
|
+
"overflow-hidden",
|
|
16
|
+
"[container-type:inline-size]"
|
|
17
|
+
],
|
|
18
|
+
/* Container que faz o scroll (envolve head + body).
|
|
19
|
+
flex-1 + min-h-0: estica até preencher o root quando há altura forçada;
|
|
20
|
+
caso contrário, altura natural do conteúdo (flex-1 sem espaço extra = no-op).
|
|
21
|
+
overflow-auto: scroll-X sempre disponível (colunas largas); scroll-Y só ativa
|
|
22
|
+
quando o conteúdo excede a altura (que só acontece com max-h externo).
|
|
23
|
+
scrollbar-thin: classe global do projeto (globals.css) — alpha responsivo light/dark. */
|
|
24
|
+
scroll: [
|
|
25
|
+
"flex-1 min-h-0 overflow-auto relative",
|
|
26
|
+
"scrollbar-thin"
|
|
27
|
+
],
|
|
28
|
+
/* Header row (flex de TableHeadCell). Sticky default. */
|
|
29
|
+
head: [
|
|
30
|
+
"flex w-max min-w-full",
|
|
31
|
+
"bg-bg-table-head border-b border-border-table",
|
|
32
|
+
"z-20"
|
|
33
|
+
],
|
|
34
|
+
/* Cell do header — type, padding, alinhamento. */
|
|
35
|
+
headCell: [
|
|
36
|
+
"relative flex items-center gap-gp-md shrink-0",
|
|
37
|
+
"h-[42px] px-pad-2xl",
|
|
38
|
+
"text-[13px] font-semibold leading-none",
|
|
39
|
+
"text-fg-muted",
|
|
40
|
+
"select-none",
|
|
41
|
+
"hover:text-fg-default"
|
|
42
|
+
],
|
|
43
|
+
/* Body container — contém as rows. */
|
|
44
|
+
body: [
|
|
45
|
+
"flex flex-col w-max min-w-full"
|
|
46
|
+
],
|
|
47
|
+
/* Row (flex de TableCell). */
|
|
48
|
+
row: [
|
|
49
|
+
"group/row relative flex w-full",
|
|
50
|
+
"border-b border-border-table last:border-b-0",
|
|
51
|
+
"bg-bg-table",
|
|
52
|
+
"transition-colors duration-150"
|
|
53
|
+
],
|
|
54
|
+
/* Cell — content cell padrão. */
|
|
55
|
+
cell: [
|
|
56
|
+
"flex items-center shrink-0",
|
|
57
|
+
"px-pad-2xl",
|
|
58
|
+
"text-[13px] text-fg-default",
|
|
59
|
+
"whitespace-nowrap overflow-hidden"
|
|
60
|
+
],
|
|
61
|
+
/* Drag handle do resize — barrinha invisível no edge direito.
|
|
62
|
+
Apenas a linha dentro do header (after:). Sem projeção pra baixo (before:)
|
|
63
|
+
porque pseudo-elements absolute COM h-screen ainda contam pro scrollHeight
|
|
64
|
+
do ancestral com overflow-auto, esticando o body verticalmente. */
|
|
65
|
+
resizeHandle: [
|
|
66
|
+
"absolute right-0 top-0 bottom-0 w-[6px] cursor-col-resize z-10",
|
|
67
|
+
// Linha 1px vertical dentro do header — aparece no hover do TH
|
|
68
|
+
"after:content-[''] after:absolute after:left-1/2 after:-translate-x-1/2",
|
|
69
|
+
"after:top-[8px] after:bottom-[8px] after:w-px after:bg-transparent",
|
|
70
|
+
"after:transition-all after:duration-150",
|
|
71
|
+
"group-hover/headcell:after:bg-border-default",
|
|
72
|
+
// Hover direto no handle → linha brand 2px full-height
|
|
73
|
+
"hover:after:bg-bg-brand hover:after:w-[2px] hover:after:top-0 hover:after:bottom-0",
|
|
74
|
+
// DRAG ATIVO → mantém linha brand visível independente do :hover
|
|
75
|
+
"data-[dragging=true]:after:bg-bg-brand data-[dragging=true]:after:w-[2px] data-[dragging=true]:after:top-0 data-[dragging=true]:after:bottom-0"
|
|
76
|
+
],
|
|
77
|
+
/* Ícone de sort no head cell. */
|
|
78
|
+
sortIcon: [
|
|
79
|
+
"shrink-0 size-icon-xs",
|
|
80
|
+
"transition-opacity duration-150"
|
|
81
|
+
],
|
|
82
|
+
/* Ícone de tipo de coluna no head (Hash, User, AtSign…). */
|
|
83
|
+
typeIcon: [
|
|
84
|
+
"shrink-0 size-[13px] text-fg-muted opacity-70",
|
|
85
|
+
"group-hover/headcell:opacity-100"
|
|
86
|
+
],
|
|
87
|
+
/* Badge brand com índice de sort (1, 2, 3). */
|
|
88
|
+
sortBadge: [
|
|
89
|
+
"inline-flex items-center justify-center shrink-0",
|
|
90
|
+
"min-w-[18px] h-[18px] px-[5px]",
|
|
91
|
+
"rounded-radius-xs bg-bg-brand text-fg-on-brand",
|
|
92
|
+
"text-[10.5px] font-bold leading-none tabular-nums"
|
|
93
|
+
],
|
|
94
|
+
/* Stack absolute na borda direita do head cell — agrupa sort e headMenu.
|
|
95
|
+
Largura dinâmica: encolhe quando itens estão "hidden", cresce quando aparecem no hover. */
|
|
96
|
+
headRightStack: [
|
|
97
|
+
"absolute right-pad-md top-1/2 -translate-y-1/2 z-[1]",
|
|
98
|
+
// 8px de respiro da borda direita
|
|
99
|
+
"inline-flex items-center gap-gp-xs",
|
|
100
|
+
"bg-bg-table-head pl-pad-xs",
|
|
101
|
+
"pointer-events-none"
|
|
102
|
+
],
|
|
103
|
+
/* Sort ativo (asc/desc) — sempre visível quando isSorted=true. */
|
|
104
|
+
headSortActive: [
|
|
105
|
+
"inline-flex items-center gap-gp-xs shrink-0",
|
|
106
|
+
"text-fg-default"
|
|
107
|
+
],
|
|
108
|
+
/* Sort hint (sortable mas inativo) — display:none default, inline-flex no hover.
|
|
109
|
+
Como é display:none, NÃO ocupa espaço no stack até aparecer. */
|
|
110
|
+
headSortHint: [
|
|
111
|
+
"hidden group-hover/headcell:inline-flex items-center shrink-0",
|
|
112
|
+
"text-fg-muted opacity-60"
|
|
113
|
+
],
|
|
114
|
+
/* Head menu wrapper — display:none default, inline-flex no hover.
|
|
115
|
+
Tem pointer-events:auto pra restaurar interatividade (parent stack tem pointer-events:none). */
|
|
116
|
+
headMenuItem: [
|
|
117
|
+
// Esconde por padrao; revela quando:
|
|
118
|
+
// 1. hover no header (group-hover) — UX padrao
|
|
119
|
+
// 2. focus interno (focus-within) — keyboard navigation
|
|
120
|
+
// 3. dropdown interno aberto (:has data-state=open) — mantem visivel
|
|
121
|
+
// enquanto user move cursor pra dentro do menu portal
|
|
122
|
+
// 4. data-menu-active=true no botao — mantem visivel durante a janela
|
|
123
|
+
// de close animation (~200ms) pra portal nao perder a ancora
|
|
124
|
+
"hidden items-center shrink-0",
|
|
125
|
+
"group-hover/headcell:inline-flex",
|
|
126
|
+
"focus-within:inline-flex",
|
|
127
|
+
"has-[[data-state=open]]:inline-flex",
|
|
128
|
+
"has-[[data-menu-active=true]]:inline-flex",
|
|
129
|
+
"pointer-events-auto"
|
|
130
|
+
],
|
|
131
|
+
/* Card mode — wrapper de cada row no modo card. */
|
|
132
|
+
cardWrap: [
|
|
133
|
+
"flex flex-col w-full p-pad-card-sm gap-gp-md",
|
|
134
|
+
"border-b border-border-table last:border-b-0",
|
|
135
|
+
"bg-bg-table"
|
|
136
|
+
],
|
|
137
|
+
/* Card mode — header do card (primary + checkbox + actions). */
|
|
138
|
+
cardHeader: [
|
|
139
|
+
"flex items-center justify-between gap-gp-md"
|
|
140
|
+
],
|
|
141
|
+
/* Card mode — body items (label/value). */
|
|
142
|
+
cardItem: [
|
|
143
|
+
"flex flex-col gap-gp-2xs"
|
|
144
|
+
],
|
|
145
|
+
/* Card mode — label da coluna acima do valor. */
|
|
146
|
+
cardLabel: [
|
|
147
|
+
"text-subheading-xs text-fg-muted"
|
|
148
|
+
],
|
|
149
|
+
/* Card mode — valor abaixo do label. */
|
|
150
|
+
cardValue: [
|
|
151
|
+
"text-paragraph-sm text-fg-default"
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
variants: {
|
|
155
|
+
density: {
|
|
156
|
+
compact: { row: "h-[40px]", cell: "py-0", headCell: "" },
|
|
157
|
+
standard: { row: "h-[56px]", cell: "py-0", headCell: "" },
|
|
158
|
+
comfortable: { row: "h-[64px]", cell: "py-0", headCell: "" }
|
|
159
|
+
},
|
|
160
|
+
sticky: {
|
|
161
|
+
true: { head: "sticky top-0" },
|
|
162
|
+
false: {}
|
|
163
|
+
},
|
|
164
|
+
selected: {
|
|
165
|
+
true: {
|
|
166
|
+
row: [
|
|
167
|
+
"bg-bg-table-row-selected hover:bg-bg-table-row-selected-hover",
|
|
168
|
+
"before:content-[''] before:absolute before:left-0 before:top-0 before:bottom-0 before:w-[3px] before:bg-bg-brand before:z-[5] before:pointer-events-none"
|
|
169
|
+
].join(" "),
|
|
170
|
+
cardWrap: "bg-bg-table-row-selected hover:bg-bg-table-row-selected-hover"
|
|
171
|
+
},
|
|
172
|
+
false: {
|
|
173
|
+
row: "hover:bg-bg-table-row-hover",
|
|
174
|
+
cardWrap: "hover:bg-bg-table-row-hover"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
clickable: {
|
|
178
|
+
true: { row: "cursor-pointer", cardWrap: "cursor-pointer" },
|
|
179
|
+
false: {}
|
|
180
|
+
},
|
|
181
|
+
pinned: {
|
|
182
|
+
left: { headCell: "sticky z-10 bg-bg-table-head", cell: "sticky z-[5] bg-inherit" },
|
|
183
|
+
right: { headCell: "sticky z-10 bg-bg-table-head", cell: "sticky z-[5] bg-inherit" }
|
|
184
|
+
},
|
|
185
|
+
align: {
|
|
186
|
+
left: { cell: "justify-start text-left", headCell: "justify-start text-left" },
|
|
187
|
+
center: { cell: "justify-center text-center", headCell: "justify-center text-center" },
|
|
188
|
+
right: { cell: "justify-end text-right", headCell: "justify-end text-right" }
|
|
189
|
+
},
|
|
190
|
+
sortable: {
|
|
191
|
+
true: { headCell: "cursor-pointer hover:text-fg-default" },
|
|
192
|
+
false: {}
|
|
193
|
+
},
|
|
194
|
+
ellipsis: {
|
|
195
|
+
true: { cell: "overflow-hidden [&>*]:truncate" },
|
|
196
|
+
false: {}
|
|
197
|
+
},
|
|
198
|
+
cellBorders: {
|
|
199
|
+
true: {
|
|
200
|
+
// `:has(+ [data-purpose='actions'])`: a cell ANTES da coluna actions
|
|
201
|
+
// perde border-right — evita o divider visual encostado na actions.
|
|
202
|
+
headCell: "border-r border-border-table last:border-r-0 has-[+_[data-purpose='actions']]:border-r-0",
|
|
203
|
+
cell: "border-r border-border-table last:border-r-0 has-[+_[data-purpose='actions']]:border-r-0"
|
|
204
|
+
},
|
|
205
|
+
false: {}
|
|
206
|
+
},
|
|
207
|
+
/** Variant pra cells de coluna especial (selection / actions).
|
|
208
|
+
*
|
|
209
|
+
* - `selection`: remove padding pra checkbox 28px caber em 56px e centralizar.
|
|
210
|
+
* - `actions`: header em branco (sem texto/menu), sem border-right, padding
|
|
211
|
+
* horizontal mínimo. Usado quando `type: "actions"` no DataTableColumnDef.
|
|
212
|
+
* Border-right removida via `!border-r-0` (override do cellBorders=true). */
|
|
213
|
+
purpose: {
|
|
214
|
+
default: {},
|
|
215
|
+
selection: {
|
|
216
|
+
headCell: "px-0 py-0",
|
|
217
|
+
cell: "px-0 py-0"
|
|
218
|
+
},
|
|
219
|
+
actions: {
|
|
220
|
+
headCell: "!border-r-0 px-pad-md",
|
|
221
|
+
cell: "!border-r-0 px-pad-md"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
defaultVariants: {
|
|
226
|
+
density: "standard",
|
|
227
|
+
sticky: true,
|
|
228
|
+
selected: false,
|
|
229
|
+
clickable: false,
|
|
230
|
+
align: "left",
|
|
231
|
+
sortable: false,
|
|
232
|
+
ellipsis: false,
|
|
233
|
+
cellBorders: true,
|
|
234
|
+
purpose: "default"
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
const DEFAULT_MIN = 60;
|
|
238
|
+
const DEFAULT_MAX = 800;
|
|
239
|
+
function useColumnResize({
|
|
240
|
+
currentWidth,
|
|
241
|
+
minWidth = DEFAULT_MIN,
|
|
242
|
+
maxWidth = DEFAULT_MAX,
|
|
243
|
+
onResize,
|
|
244
|
+
onResizeEnd,
|
|
245
|
+
onResizeLiveDOM
|
|
246
|
+
}) {
|
|
247
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
248
|
+
const onResizeRef = useRef(onResize);
|
|
249
|
+
const onResizeEndRef = useRef(onResizeEnd);
|
|
250
|
+
const onResizeLiveDOMRef = useRef(onResizeLiveDOM);
|
|
251
|
+
const minRef = useRef(minWidth);
|
|
252
|
+
const maxRef = useRef(maxWidth);
|
|
253
|
+
onResizeRef.current = onResize;
|
|
254
|
+
onResizeEndRef.current = onResizeEnd;
|
|
255
|
+
onResizeLiveDOMRef.current = onResizeLiveDOM;
|
|
256
|
+
minRef.current = minWidth;
|
|
257
|
+
maxRef.current = maxWidth;
|
|
258
|
+
const stateRef = useRef({ startX: 0, startWidth: 0, lastWidth: currentWidth, dragging: false });
|
|
259
|
+
stateRef.current.lastWidth = currentWidth;
|
|
260
|
+
const handlersRef = useRef(null);
|
|
261
|
+
if (!handlersRef.current) {
|
|
262
|
+
handlersRef.current = {
|
|
263
|
+
move: (e) => {
|
|
264
|
+
if (!stateRef.current.dragging) return;
|
|
265
|
+
const delta = e.clientX - stateRef.current.startX;
|
|
266
|
+
const next = Math.min(
|
|
267
|
+
maxRef.current,
|
|
268
|
+
Math.max(minRef.current, stateRef.current.startWidth + delta)
|
|
269
|
+
);
|
|
270
|
+
stateRef.current.lastWidth = next;
|
|
271
|
+
onResizeLiveDOMRef.current?.(next);
|
|
272
|
+
onResizeRef.current?.(next);
|
|
273
|
+
},
|
|
274
|
+
up: () => {
|
|
275
|
+
if (!stateRef.current.dragging) return;
|
|
276
|
+
stateRef.current.dragging = false;
|
|
277
|
+
setIsDragging(false);
|
|
278
|
+
document.removeEventListener("mousemove", handlersRef.current.move);
|
|
279
|
+
document.removeEventListener("mouseup", handlersRef.current.up);
|
|
280
|
+
document.body.style.cursor = "";
|
|
281
|
+
document.body.style.userSelect = "";
|
|
282
|
+
onResizeEndRef.current?.(stateRef.current.lastWidth);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
const onMouseDown = useCallback(
|
|
287
|
+
(e) => {
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
e.stopPropagation();
|
|
290
|
+
stateRef.current = {
|
|
291
|
+
startX: e.clientX,
|
|
292
|
+
startWidth: currentWidth,
|
|
293
|
+
lastWidth: currentWidth,
|
|
294
|
+
dragging: true
|
|
295
|
+
};
|
|
296
|
+
setIsDragging(true);
|
|
297
|
+
document.addEventListener("mousemove", handlersRef.current.move);
|
|
298
|
+
document.addEventListener("mouseup", handlersRef.current.up);
|
|
299
|
+
document.body.style.cursor = "col-resize";
|
|
300
|
+
document.body.style.userSelect = "none";
|
|
301
|
+
},
|
|
302
|
+
[currentWidth]
|
|
303
|
+
);
|
|
304
|
+
useEffect(() => {
|
|
305
|
+
return () => {
|
|
306
|
+
if (stateRef.current.dragging && handlersRef.current) {
|
|
307
|
+
document.removeEventListener("mousemove", handlersRef.current.move);
|
|
308
|
+
document.removeEventListener("mouseup", handlersRef.current.up);
|
|
309
|
+
document.body.style.cursor = "";
|
|
310
|
+
document.body.style.userSelect = "";
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}, []);
|
|
314
|
+
return {
|
|
315
|
+
onMouseDown,
|
|
316
|
+
isDragging
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
const TableContext = createContext({
|
|
320
|
+
density: "standard",
|
|
321
|
+
cellBorders: true,
|
|
322
|
+
resizingField: null,
|
|
323
|
+
setResizingField: () => {
|
|
324
|
+
},
|
|
325
|
+
isScrolled: false
|
|
326
|
+
});
|
|
327
|
+
function useTableContext() {
|
|
328
|
+
return useContext(TableContext);
|
|
329
|
+
}
|
|
330
|
+
const styles$1 = tableStyles();
|
|
331
|
+
function Table({
|
|
332
|
+
density = "standard",
|
|
333
|
+
cardBreakpoint = 768,
|
|
334
|
+
cellBorders = true,
|
|
335
|
+
ariaLabel,
|
|
336
|
+
className,
|
|
337
|
+
scrollRef: externalScrollRef,
|
|
338
|
+
children
|
|
339
|
+
}) {
|
|
340
|
+
const cardCss = cardBreakpoint === false ? void 0 : { "--table-card-bp": `${cardBreakpoint}px` };
|
|
341
|
+
const [resizingField, setResizingField] = useState(null);
|
|
342
|
+
const [isScrolled, setIsScrolled] = useState(false);
|
|
343
|
+
const internalScrollRef = useRef(null);
|
|
344
|
+
const scrollRef = externalScrollRef ?? internalScrollRef;
|
|
345
|
+
useEffect(() => {
|
|
346
|
+
const el = scrollRef.current;
|
|
347
|
+
if (!el) return;
|
|
348
|
+
const onScroll = () => setIsScrolled(el.scrollTop > 0);
|
|
349
|
+
el.addEventListener("scroll", onScroll, { passive: true });
|
|
350
|
+
onScroll();
|
|
351
|
+
return () => el.removeEventListener("scroll", onScroll);
|
|
352
|
+
}, [scrollRef]);
|
|
353
|
+
return /* @__PURE__ */ jsx(
|
|
354
|
+
TableContext.Provider,
|
|
355
|
+
{
|
|
356
|
+
value: { density, cellBorders, resizingField, setResizingField, isScrolled },
|
|
357
|
+
children: /* @__PURE__ */ jsx(
|
|
358
|
+
"div",
|
|
359
|
+
{
|
|
360
|
+
role: "grid",
|
|
361
|
+
"aria-label": ariaLabel,
|
|
362
|
+
"data-density": density,
|
|
363
|
+
"data-resizing-col": resizingField ?? void 0,
|
|
364
|
+
className: cn(styles$1.root(), className),
|
|
365
|
+
style: cardCss,
|
|
366
|
+
children: /* @__PURE__ */ jsx("div", { ref: scrollRef, className: styles$1.scroll(), children })
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
function TableHead({
|
|
373
|
+
sticky = true,
|
|
374
|
+
className,
|
|
375
|
+
rootProps,
|
|
376
|
+
children
|
|
377
|
+
}) {
|
|
378
|
+
const { isScrolled } = useTableContext();
|
|
379
|
+
return /* @__PURE__ */ jsx(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
...rootProps,
|
|
383
|
+
role: "rowgroup",
|
|
384
|
+
"data-scrolled": isScrolled ? "true" : void 0,
|
|
385
|
+
className: cn(tableStyles({ sticky }).head(), className),
|
|
386
|
+
children: /* @__PURE__ */ jsx("div", { role: "row", className: "flex w-full", children })
|
|
387
|
+
}
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
function TableBody({
|
|
391
|
+
className,
|
|
392
|
+
style,
|
|
393
|
+
rootProps,
|
|
394
|
+
virtualized,
|
|
395
|
+
children
|
|
396
|
+
}) {
|
|
397
|
+
const virtualStyle = virtualized ? {
|
|
398
|
+
height: virtualized.totalHeight,
|
|
399
|
+
position: "relative",
|
|
400
|
+
minWidth: "100%",
|
|
401
|
+
...style
|
|
402
|
+
} : style;
|
|
403
|
+
return /* @__PURE__ */ jsx(
|
|
404
|
+
"div",
|
|
405
|
+
{
|
|
406
|
+
...rootProps,
|
|
407
|
+
role: "rowgroup",
|
|
408
|
+
className: cn(
|
|
409
|
+
styles$1.body(),
|
|
410
|
+
virtualized && "!block",
|
|
411
|
+
className
|
|
412
|
+
),
|
|
413
|
+
style: virtualStyle,
|
|
414
|
+
children
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
const TableRow = forwardRef(function TableRow2({
|
|
419
|
+
selected = false,
|
|
420
|
+
open = false,
|
|
421
|
+
focused = false,
|
|
422
|
+
clickable,
|
|
423
|
+
onClick,
|
|
424
|
+
className,
|
|
425
|
+
rootProps,
|
|
426
|
+
children
|
|
427
|
+
}, ref) {
|
|
428
|
+
const { density } = useTableContext();
|
|
429
|
+
const isClickable = clickable ?? !!onClick;
|
|
430
|
+
const highlighted = selected || open;
|
|
431
|
+
const dataState = selected && open ? "selected open" : selected ? "selected" : open ? "open" : void 0;
|
|
432
|
+
return /* @__PURE__ */ jsx(
|
|
433
|
+
"div",
|
|
434
|
+
{
|
|
435
|
+
...rootProps,
|
|
436
|
+
ref,
|
|
437
|
+
role: "row",
|
|
438
|
+
"aria-selected": selected || void 0,
|
|
439
|
+
"data-state": dataState,
|
|
440
|
+
"data-focused": focused || void 0,
|
|
441
|
+
tabIndex: focused ? 0 : -1,
|
|
442
|
+
className: cn(
|
|
443
|
+
tableStyles({ selected: highlighted, clickable: isClickable, density }).row(),
|
|
444
|
+
// Focus visual — bg tinted (match checkbox selected) + outline brand interno.
|
|
445
|
+
// Outline em vez de ring/border pra não interferir com sticky/bordas.
|
|
446
|
+
focused && "bg-bg-table-row-selected hover:bg-bg-table-row-selected-hover outline outline-2 outline-offset-[-2px] outline-bg-brand z-[6] relative",
|
|
447
|
+
className
|
|
448
|
+
),
|
|
449
|
+
onClick,
|
|
450
|
+
children
|
|
451
|
+
}
|
|
452
|
+
);
|
|
453
|
+
});
|
|
454
|
+
const TableCell = forwardRef(function TableCell2({
|
|
455
|
+
field,
|
|
456
|
+
tooltip,
|
|
457
|
+
width,
|
|
458
|
+
pinned,
|
|
459
|
+
pinOffset,
|
|
460
|
+
align = "left",
|
|
461
|
+
ellipsis = false,
|
|
462
|
+
label,
|
|
463
|
+
className,
|
|
464
|
+
rootProps,
|
|
465
|
+
purpose = "default",
|
|
466
|
+
children
|
|
467
|
+
}, ref) {
|
|
468
|
+
const { density, cellBorders, resizingField } = useTableContext();
|
|
469
|
+
const isResizingThisCol = field !== void 0 && resizingField === field;
|
|
470
|
+
const style = {};
|
|
471
|
+
if (width !== void 0) {
|
|
472
|
+
style.width = width;
|
|
473
|
+
style.minWidth = width;
|
|
474
|
+
style.maxWidth = width;
|
|
475
|
+
}
|
|
476
|
+
if (pinned === "left" && pinOffset !== void 0) style.left = pinOffset;
|
|
477
|
+
if (pinned === "right" && pinOffset !== void 0) style.right = pinOffset;
|
|
478
|
+
return /* @__PURE__ */ jsx(
|
|
479
|
+
"div",
|
|
480
|
+
{
|
|
481
|
+
...rootProps,
|
|
482
|
+
ref,
|
|
483
|
+
role: "gridcell",
|
|
484
|
+
"data-pinned": pinned,
|
|
485
|
+
"data-label": label,
|
|
486
|
+
"data-field": field,
|
|
487
|
+
"data-purpose": purpose,
|
|
488
|
+
"data-resize-active": isResizingThisCol ? "true" : void 0,
|
|
489
|
+
title: tooltip,
|
|
490
|
+
className: cn(
|
|
491
|
+
tableStyles({ pinned, align, ellipsis, density, cellBorders, purpose }).cell(),
|
|
492
|
+
// Linha brand 2px alinhada com o centro do resize handle do header (~2px do edge)
|
|
493
|
+
isResizingThisCol && "relative after:absolute after:right-[2px] after:top-0 after:bottom-0 after:w-[2px] after:bg-bg-brand after:pointer-events-none",
|
|
494
|
+
className
|
|
495
|
+
),
|
|
496
|
+
style,
|
|
497
|
+
children
|
|
498
|
+
}
|
|
499
|
+
);
|
|
500
|
+
});
|
|
501
|
+
const TableHeadCell = forwardRef(function TableHeadCell2({
|
|
502
|
+
field,
|
|
503
|
+
width,
|
|
504
|
+
pinned,
|
|
505
|
+
pinOffset,
|
|
506
|
+
align = "left",
|
|
507
|
+
sortable = false,
|
|
508
|
+
sortDirection = null,
|
|
509
|
+
sortIndex = 1,
|
|
510
|
+
onSortClick,
|
|
511
|
+
icon: Icon,
|
|
512
|
+
headMenu,
|
|
513
|
+
resizable,
|
|
514
|
+
onResize,
|
|
515
|
+
onResizeEnd,
|
|
516
|
+
className,
|
|
517
|
+
style: extraStyle,
|
|
518
|
+
rootProps,
|
|
519
|
+
purpose = "default",
|
|
520
|
+
children
|
|
521
|
+
}, forwardedRef) {
|
|
522
|
+
const { density, cellBorders, setResizingField } = useTableContext();
|
|
523
|
+
const headCellRef = useRef(null);
|
|
524
|
+
const setRefs = useCallback((el) => {
|
|
525
|
+
headCellRef.current = el;
|
|
526
|
+
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
527
|
+
else if (forwardedRef) forwardedRef.current = el;
|
|
528
|
+
}, [forwardedRef]);
|
|
529
|
+
const resize = useColumnResize({
|
|
530
|
+
currentWidth: width ?? 160,
|
|
531
|
+
// Live DOM update — escreve `style.width` direto nas cells com `data-field`
|
|
532
|
+
// correspondente, escopado ao `[role="grid"]` ancestral. Síncrono, sem React,
|
|
533
|
+
// zero re-render durante o drag. Documented hook API via `onResizeLiveDOM`
|
|
534
|
+
// (vs `onResize` que vai pro state externo, normalmente debounced ao mouseup).
|
|
535
|
+
onResizeLiveDOM: field ? (w) => {
|
|
536
|
+
const grid = headCellRef.current?.closest('[role="grid"]');
|
|
537
|
+
grid?.querySelectorAll(`[data-field="${field}"]`).forEach((el) => {
|
|
538
|
+
el.style.width = `${w}px`;
|
|
539
|
+
el.style.minWidth = `${w}px`;
|
|
540
|
+
el.style.maxWidth = `${w}px`;
|
|
541
|
+
});
|
|
542
|
+
} : void 0,
|
|
543
|
+
onResize,
|
|
544
|
+
onResizeEnd
|
|
545
|
+
});
|
|
546
|
+
useEffect(() => {
|
|
547
|
+
if (resize.isDragging && field) {
|
|
548
|
+
setResizingField(field);
|
|
549
|
+
return () => setResizingField(null);
|
|
550
|
+
}
|
|
551
|
+
}, [resize.isDragging, field, setResizingField]);
|
|
552
|
+
const style = {};
|
|
553
|
+
if (width !== void 0) {
|
|
554
|
+
style.width = width;
|
|
555
|
+
style.minWidth = width;
|
|
556
|
+
style.maxWidth = width;
|
|
557
|
+
}
|
|
558
|
+
if (pinned === "left" && pinOffset !== void 0) style.left = pinOffset;
|
|
559
|
+
if (pinned === "right" && pinOffset !== void 0) style.right = pinOffset;
|
|
560
|
+
const ariaSort = sortable ? sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : "none" : void 0;
|
|
561
|
+
const isSorted = sortDirection === "asc" || sortDirection === "desc";
|
|
562
|
+
return /* @__PURE__ */ jsxs(
|
|
563
|
+
"div",
|
|
564
|
+
{
|
|
565
|
+
...rootProps,
|
|
566
|
+
ref: setRefs,
|
|
567
|
+
role: "columnheader",
|
|
568
|
+
"aria-sort": ariaSort,
|
|
569
|
+
"data-pinned": pinned,
|
|
570
|
+
"data-sort": sortDirection ?? void 0,
|
|
571
|
+
"data-field": field,
|
|
572
|
+
"data-purpose": purpose,
|
|
573
|
+
className: cn(
|
|
574
|
+
"group/headcell",
|
|
575
|
+
tableStyles({ pinned, align, sortable, density, cellBorders, purpose }).headCell(),
|
|
576
|
+
className
|
|
577
|
+
),
|
|
578
|
+
style: { ...style, ...extraStyle },
|
|
579
|
+
onClick: sortable ? onSortClick : void 0,
|
|
580
|
+
children: [
|
|
581
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: styles$1.typeIcon(), size: 13, strokeWidth: 1.7, "aria-hidden": true }),
|
|
582
|
+
/* @__PURE__ */ jsx(
|
|
583
|
+
"span",
|
|
584
|
+
{
|
|
585
|
+
className: cn(
|
|
586
|
+
"flex-1 min-w-0",
|
|
587
|
+
align === "center" ? "flex items-center justify-center" : align === "right" ? cn(
|
|
588
|
+
"truncate text-right",
|
|
589
|
+
// Reserva espaço pro headRightStack (absolute right-pad-md ~8px +
|
|
590
|
+
// sort badge + sort indicator + headMenu button + gaps) quando há
|
|
591
|
+
// algo a renderizar. Sem isso, o texto right-aligned é coberto pelo
|
|
592
|
+
// stack quando aparece no hover (bg-bg-table-head do stack mascara).
|
|
593
|
+
(sortable || headMenu) && "pr-[60px]"
|
|
594
|
+
) : "truncate text-left"
|
|
595
|
+
),
|
|
596
|
+
children
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
(sortable || headMenu) && /* @__PURE__ */ jsxs("span", { className: styles$1.headRightStack(), children: [
|
|
600
|
+
isSorted && /* @__PURE__ */ jsxs("span", { className: styles$1.headSortActive(), children: [
|
|
601
|
+
sortIndex !== void 0 && /* @__PURE__ */ jsx("span", { className: styles$1.sortBadge(), children: sortIndex }),
|
|
602
|
+
/* @__PURE__ */ jsx(SortIndicator, { direction: sortDirection })
|
|
603
|
+
] }),
|
|
604
|
+
sortable && !isSorted && /* @__PURE__ */ jsx("span", { className: styles$1.headSortHint(), children: /* @__PURE__ */ jsx(SortIndicator, { direction: null }) }),
|
|
605
|
+
headMenu && /* @__PURE__ */ jsx("span", { className: styles$1.headMenuItem(), children: headMenu })
|
|
606
|
+
] }),
|
|
607
|
+
resizable && /* @__PURE__ */ jsx(
|
|
608
|
+
"div",
|
|
609
|
+
{
|
|
610
|
+
className: styles$1.resizeHandle(),
|
|
611
|
+
"data-dragging": resize.isDragging,
|
|
612
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
613
|
+
onMouseDown: resize.onMouseDown,
|
|
614
|
+
onClick: (e) => e.stopPropagation(),
|
|
615
|
+
onMouseEnter: () => field && setResizingField(field),
|
|
616
|
+
onMouseLeave: () => {
|
|
617
|
+
if (!resize.isDragging) setResizingField(null);
|
|
618
|
+
},
|
|
619
|
+
"aria-hidden": true
|
|
620
|
+
}
|
|
621
|
+
)
|
|
622
|
+
]
|
|
623
|
+
}
|
|
624
|
+
);
|
|
625
|
+
});
|
|
626
|
+
function SortIndicator({ direction }) {
|
|
627
|
+
if (direction === "asc") return /* @__PURE__ */ jsx(ArrowUp, { className: styles$1.sortIcon(), "aria-hidden": true });
|
|
628
|
+
if (direction === "desc") return /* @__PURE__ */ jsx(ArrowDown, { className: styles$1.sortIcon(), "aria-hidden": true });
|
|
629
|
+
return /* @__PURE__ */ jsx(ArrowUpDown, { className: styles$1.sortIcon(), "aria-hidden": true });
|
|
630
|
+
}
|
|
631
|
+
const styles = tableStyles();
|
|
632
|
+
function TableCardRow({
|
|
633
|
+
header,
|
|
634
|
+
headerActions,
|
|
635
|
+
items,
|
|
636
|
+
selected = false,
|
|
637
|
+
open = false,
|
|
638
|
+
clickable,
|
|
639
|
+
onClick,
|
|
640
|
+
className
|
|
641
|
+
}) {
|
|
642
|
+
const isClickable = clickable ?? !!onClick;
|
|
643
|
+
const highlighted = selected || open;
|
|
644
|
+
const dataState = selected && open ? "selected open" : selected ? "selected" : open ? "open" : void 0;
|
|
645
|
+
return /* @__PURE__ */ jsxs(
|
|
646
|
+
"div",
|
|
647
|
+
{
|
|
648
|
+
role: "article",
|
|
649
|
+
"aria-selected": selected || void 0,
|
|
650
|
+
"data-state": dataState,
|
|
651
|
+
className: cn(
|
|
652
|
+
tableStyles({ selected: highlighted, clickable: isClickable }).cardWrap(),
|
|
653
|
+
className
|
|
654
|
+
),
|
|
655
|
+
onClick,
|
|
656
|
+
children: [
|
|
657
|
+
/* @__PURE__ */ jsxs("div", { className: styles.cardHeader(), children: [
|
|
658
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-gp-md min-w-0", children: header }),
|
|
659
|
+
headerActions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-gp-xs shrink-0", children: headerActions })
|
|
660
|
+
] }),
|
|
661
|
+
items.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-gp-md", children: items.map((item, i) => /* @__PURE__ */ jsxs("div", { className: styles.cardItem(), children: [
|
|
662
|
+
/* @__PURE__ */ jsx("span", { className: styles.cardLabel(), children: item.label }),
|
|
663
|
+
/* @__PURE__ */ jsx("span", { className: styles.cardValue(), children: item.value })
|
|
664
|
+
] }, item.key ?? i)) })
|
|
665
|
+
]
|
|
666
|
+
}
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
const Checkbox = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
670
|
+
CheckboxPrimitive.Root,
|
|
671
|
+
{
|
|
672
|
+
ref,
|
|
673
|
+
className: cn(
|
|
674
|
+
"peer relative flex size-4 shrink-0 items-center justify-center cursor-pointer",
|
|
675
|
+
"rounded-radius-xs",
|
|
676
|
+
"bg-bg-input dark:bg-bg-muted",
|
|
677
|
+
"border-[1.5px] border-border-input",
|
|
678
|
+
"transition-[background-color,border-color,box-shadow] outline-none",
|
|
679
|
+
"hover:border-border-default",
|
|
680
|
+
"focus-visible:shadow-sh-ring",
|
|
681
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
682
|
+
"data-[state=checked]:bg-bg-brand data-[state=checked]:border-border-brand",
|
|
683
|
+
"data-[state=indeterminate]:bg-bg-brand data-[state=indeterminate]:border-border-brand",
|
|
684
|
+
className
|
|
685
|
+
),
|
|
686
|
+
...props,
|
|
687
|
+
children: /* @__PURE__ */ jsx(
|
|
688
|
+
CheckboxPrimitive.Indicator,
|
|
689
|
+
{
|
|
690
|
+
className: cn("grid place-content-center text-fg-on-brand"),
|
|
691
|
+
children: props.checked === "indeterminate" ? /* @__PURE__ */ jsx(Minus, { className: "size-3", strokeWidth: 3 }) : /* @__PURE__ */ jsx(Check, { className: "size-3", strokeWidth: 3 })
|
|
692
|
+
}
|
|
693
|
+
)
|
|
694
|
+
}
|
|
695
|
+
));
|
|
696
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
697
|
+
const badgeVariants = tv({
|
|
698
|
+
base: [
|
|
699
|
+
"inline-flex items-center justify-center",
|
|
700
|
+
"border border-transparent",
|
|
701
|
+
"font-semibold leading-none whitespace-nowrap",
|
|
702
|
+
"transition-colors",
|
|
703
|
+
"focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-secondary",
|
|
704
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
705
|
+
],
|
|
706
|
+
variants: {
|
|
707
|
+
color: {
|
|
708
|
+
primary: "",
|
|
709
|
+
secondary: "",
|
|
710
|
+
critical: "",
|
|
711
|
+
success: "",
|
|
712
|
+
warning: "",
|
|
713
|
+
info: ""
|
|
714
|
+
},
|
|
715
|
+
variant: {
|
|
716
|
+
solid: "",
|
|
717
|
+
soft: "",
|
|
718
|
+
outline: "bg-transparent",
|
|
719
|
+
ghost: "bg-transparent border-transparent"
|
|
720
|
+
},
|
|
721
|
+
size: {
|
|
722
|
+
sm: "h-comp-2xs px-pad-sm text-[10px] gap-gp-2xs [&_svg]:size-3",
|
|
723
|
+
// 20px / 6 / 10
|
|
724
|
+
md: "h-comp-xs px-pad-md text-label-xs gap-gp-xs [&_svg]:size-3.5",
|
|
725
|
+
// 24px / 8 / 12 (default)
|
|
726
|
+
lg: "h-comp-sm px-pad-lg text-[13px] gap-gp-sm [&_svg]:size-4"
|
|
727
|
+
// 28px / 10 / 13
|
|
728
|
+
},
|
|
729
|
+
shape: {
|
|
730
|
+
default: "rounded-radius-sm",
|
|
731
|
+
// 6px — counter, value tags
|
|
732
|
+
pill: "rounded-radius-full"
|
|
733
|
+
// pill — status chips
|
|
734
|
+
}
|
|
735
|
+
},
|
|
736
|
+
compoundVariants: [
|
|
737
|
+
/* ── Primary (brand) ─────────────────────────────────────────────── */
|
|
738
|
+
{ color: "primary", variant: "solid", class: "bg-bg-brand text-fg-on-brand" },
|
|
739
|
+
{ color: "primary", variant: "soft", class: "bg-bg-brand-subtle text-fg-brand" },
|
|
740
|
+
{ color: "primary", variant: "outline", class: "border-border-brand text-fg-brand" },
|
|
741
|
+
{ color: "primary", variant: "ghost", class: "text-fg-brand" },
|
|
742
|
+
/* ── Secondary (neutral) ─────────────────────────────────────────── */
|
|
743
|
+
{ color: "secondary", variant: "solid", class: "bg-bg-emphasis text-fg-default" },
|
|
744
|
+
{ color: "secondary", variant: "soft", class: "bg-bg-muted text-fg-muted" },
|
|
745
|
+
{ color: "secondary", variant: "outline", class: "border-border-default text-fg-default" },
|
|
746
|
+
{ color: "secondary", variant: "ghost", class: "text-fg-muted" },
|
|
747
|
+
/* ── Critical (danger) ───────────────────────────────────────────── */
|
|
748
|
+
{ color: "critical", variant: "solid", class: "bg-bg-danger text-fg-on-danger" },
|
|
749
|
+
{ color: "critical", variant: "soft", class: "bg-bg-danger-muted text-fg-danger" },
|
|
750
|
+
{ color: "critical", variant: "outline", class: "border-border-danger-muted text-fg-danger" },
|
|
751
|
+
{ color: "critical", variant: "ghost", class: "text-fg-danger" },
|
|
752
|
+
/* ── Success ─────────────────────────────────────────────────────── */
|
|
753
|
+
{ color: "success", variant: "solid", class: "bg-bg-success text-fg-on-success" },
|
|
754
|
+
{ color: "success", variant: "soft", class: "bg-bg-success-muted text-fg-success" },
|
|
755
|
+
{ color: "success", variant: "outline", class: "border-border-success-muted text-fg-success" },
|
|
756
|
+
{ color: "success", variant: "ghost", class: "text-fg-success" },
|
|
757
|
+
/* ── Warning ─────────────────────────────────────────────────────── */
|
|
758
|
+
{ color: "warning", variant: "solid", class: "bg-bg-warning text-fg-on-warning" },
|
|
759
|
+
{ color: "warning", variant: "soft", class: "bg-bg-warning-muted text-fg-warning" },
|
|
760
|
+
{ color: "warning", variant: "outline", class: "border-border-warning-muted text-fg-warning" },
|
|
761
|
+
{ color: "warning", variant: "ghost", class: "text-fg-warning" },
|
|
762
|
+
/* ── Info ────────────────────────────────────────────────────────── */
|
|
763
|
+
{ color: "info", variant: "solid", class: "bg-bg-info text-fg-on-info" },
|
|
764
|
+
{ color: "info", variant: "soft", class: "bg-bg-info-muted text-fg-info" },
|
|
765
|
+
{ color: "info", variant: "outline", class: "border-border-info-muted text-fg-info" },
|
|
766
|
+
{ color: "info", variant: "ghost", class: "text-fg-info" }
|
|
767
|
+
],
|
|
768
|
+
defaultVariants: {
|
|
769
|
+
color: "secondary",
|
|
770
|
+
variant: "soft",
|
|
771
|
+
size: "md",
|
|
772
|
+
shape: "default"
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
function Badge({ className, color, variant, size, shape, ...props }) {
|
|
776
|
+
return /* @__PURE__ */ jsx(
|
|
777
|
+
"span",
|
|
778
|
+
{
|
|
779
|
+
className: badgeVariants({ color, variant, size, shape, className }),
|
|
780
|
+
...props
|
|
781
|
+
}
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
export {
|
|
785
|
+
Badge as B,
|
|
786
|
+
Checkbox as C,
|
|
787
|
+
Table as T,
|
|
788
|
+
TableBody as a,
|
|
789
|
+
TableCardRow as b,
|
|
790
|
+
TableCell as c,
|
|
791
|
+
TableHead as d,
|
|
792
|
+
TableHeadCell as e,
|
|
793
|
+
TableRow as f,
|
|
794
|
+
badgeVariants as g,
|
|
795
|
+
useColumnResize as u
|
|
796
|
+
};
|
|
797
|
+
//# sourceMappingURL=badge-B_2Zt52o.mjs.map
|