@fayz-ai/ui 0.24.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NXFVYZY7.js → chunk-G73HZNFI.js} +30 -9
- package/dist/chunk-G73HZNFI.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/primitives/index.js +1 -1
- package/dist/primitives/list-view.d.ts +0 -11
- package/dist/primitives/list-view.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-NXFVYZY7.js.map +0 -1
|
@@ -1098,6 +1098,18 @@ function FilterChip({ allLabel, options, value, onChange, label, icon: Icon2, cl
|
|
|
1098
1098
|
] });
|
|
1099
1099
|
}
|
|
1100
1100
|
var ICON_BTN = "fz-tap text-muted-foreground";
|
|
1101
|
+
function pageNumbers(page, totalPages) {
|
|
1102
|
+
const fixas = /* @__PURE__ */ new Set([1, totalPages, page - 1, page, page + 1]);
|
|
1103
|
+
const visiveis = [...fixas].filter((n) => n >= 1 && n <= totalPages).sort((a, b) => a - b);
|
|
1104
|
+
const saida = [];
|
|
1105
|
+
for (const n of visiveis) {
|
|
1106
|
+
const anterior = saida[saida.length - 1];
|
|
1107
|
+
if (anterior !== void 0 && n - anterior === 2) saida.push(anterior + 1);
|
|
1108
|
+
else if (anterior !== void 0 && n - anterior > 2) saida.push(-1);
|
|
1109
|
+
saida.push(n);
|
|
1110
|
+
}
|
|
1111
|
+
return saida;
|
|
1112
|
+
}
|
|
1101
1113
|
function ListFilters({ tagFilter, filters, advanced, label, count, wideCount }) {
|
|
1102
1114
|
const wide = useIsWide();
|
|
1103
1115
|
const [open, setOpen] = useState(false);
|
|
@@ -1207,9 +1219,7 @@ function ListView({
|
|
|
1207
1219
|
}, [onSearchChange, searchDebounce]);
|
|
1208
1220
|
const totalItems = total ?? data.length;
|
|
1209
1221
|
const totalPages = Math.max(1, Math.ceil(totalItems / pageSize));
|
|
1210
|
-
const
|
|
1211
|
-
const windowStart = Math.max(1, Math.min(page - Math.floor(PAGE_WINDOW / 2), totalPages - PAGE_WINDOW + 1));
|
|
1212
|
-
const pageWindow = Array.from({ length: Math.min(PAGE_WINDOW, totalPages) }, (_, i) => windowStart + i);
|
|
1222
|
+
const pageWindow = pageNumbers(page, totalPages);
|
|
1213
1223
|
const showPagination = onPageChange && totalItems > pageSize;
|
|
1214
1224
|
const showSearch = !!onSearchChange;
|
|
1215
1225
|
const showTags = tags && tags.length > 0 && onTagChange;
|
|
@@ -1262,7 +1272,13 @@ function ListView({
|
|
|
1262
1272
|
// `flex-wrap`, então uma primeira cria que ocupa a linha
|
|
1263
1273
|
// inteira empurra o resto para baixo sozinha. Sem filtros,
|
|
1264
1274
|
// a busca volta a partilhar a linha com atualizar/exportar.
|
|
1265
|
-
|
|
1275
|
+
// `basis-full` SEM `flex-1`, e não os dois: `flex-1` é
|
|
1276
|
+
// `flex: 1 1 0%`, que fixa `flex-basis: 0%` — e o Tailwind
|
|
1277
|
+
// emite `basis-*` ANTES de `flex-*`, então os dois juntos
|
|
1278
|
+
// deixam o `flex-1` ganhar e a busca continua a encolher
|
|
1279
|
+
// até "Busc". Sozinha na linha ela não precisa crescer:
|
|
1280
|
+
// a base de 100% já é a linha inteira.
|
|
1281
|
+
/* @__PURE__ */ jsxs("div", { className: cn("relative min-w-0", searchOwnRow ? "basis-full" : "flex-1"), children: [
|
|
1266
1282
|
/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
1267
1283
|
/* @__PURE__ */ jsx(
|
|
1268
1284
|
"input",
|
|
@@ -1334,7 +1350,7 @@ function ListView({
|
|
|
1334
1350
|
totalItems.toLocaleString()
|
|
1335
1351
|
] }),
|
|
1336
1352
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
1337
|
-
totalPages >
|
|
1353
|
+
totalPages > 1 && /* @__PURE__ */ jsx(
|
|
1338
1354
|
"button",
|
|
1339
1355
|
{
|
|
1340
1356
|
type: "button",
|
|
@@ -1356,7 +1372,12 @@ function ListView({
|
|
|
1356
1372
|
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
|
|
1357
1373
|
}
|
|
1358
1374
|
),
|
|
1359
|
-
pageWindow.map((n) =>
|
|
1375
|
+
pageWindow.map((n, i) => n === -1 ? (
|
|
1376
|
+
// Sem `onClick` e fora da ordem de tabulação: é um sinal de que
|
|
1377
|
+
// há páginas ali, não um destino. Um "…" clicável promete um
|
|
1378
|
+
// salto que ninguém sabe para onde vai.
|
|
1379
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "px-0.5 text-xs text-muted-foreground", children: "\u2026" }, `gap-${i}`)
|
|
1380
|
+
) : /* @__PURE__ */ jsx(
|
|
1360
1381
|
"button",
|
|
1361
1382
|
{
|
|
1362
1383
|
type: "button",
|
|
@@ -1379,7 +1400,7 @@ function ListView({
|
|
|
1379
1400
|
children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
1380
1401
|
}
|
|
1381
1402
|
),
|
|
1382
|
-
totalPages >
|
|
1403
|
+
totalPages > 1 && /* @__PURE__ */ jsx(
|
|
1383
1404
|
"button",
|
|
1384
1405
|
{
|
|
1385
1406
|
type: "button",
|
|
@@ -2874,5 +2895,5 @@ function StockEntryForm({
|
|
|
2874
2895
|
}
|
|
2875
2896
|
|
|
2876
2897
|
export { Badge, Breadcrumb, BulkActionBar, ChevronPager, CurrencyInput, DatePicker, DateRangeChip, DotBadge, DraftCommitBar, FilterCheckBox, FilterCheckList, FilterCheckRow, FilterChip, FilterSection, Input, ListView, Markdown, MarkdownEditor, MiniCalendar, Modal, ModalBody, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, MultiSelect, PhoneField, PhoneLink, RefreshButton, RowActions, SearchCombobox, SearchField, SearchSelect, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, StatTiles, StockEntryForm, Tabs, TabsContent, TabsList, TabsTrigger, Thumbnail, TimePicker, ToastProvider, WHATSAPP_BRAND_COLOR, WhatsAppIcon, badgeVariants, formatPhone2 as formatPhone, normalizePhone, renderMarkdown, setRowActionsLabel, toLocalISODate, useRowSelection };
|
|
2877
|
-
//# sourceMappingURL=chunk-
|
|
2878
|
-
//# sourceMappingURL=chunk-
|
|
2898
|
+
//# sourceMappingURL=chunk-G73HZNFI.js.map
|
|
2899
|
+
//# sourceMappingURL=chunk-G73HZNFI.js.map
|