@alexandregme/zljs 2.0.0 → 2.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/CHANGELOG.md CHANGED
@@ -8,6 +8,52 @@ A change that needs action in an app has a **Migration** note. When updating, re
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [2.1.0] - 2026-11-03
12
+
13
+ ### Added
14
+
15
+ - `aria-label` on `DataGrid`, to name the grid for screen readers. It defaults to `Tabela de dados`
16
+ - `@ag-grid-community/locale` as a dependency, for the AG Grid texts
17
+
18
+ ### Changed
19
+
20
+ - AG Grid moved from 35 to 36 (`ag-grid-community`, `ag-grid-react` and `@ag-grid-community/locale` 36.2.0). In Chrome, 35 rendered a `DataGrid` blank (header collapsed, rows at 0px until a window resize) when a grid was destroyed and another created in the same task, such as a route change between two pages with a grid or a Storybook story switch; 36 fixes it. AG Grid 36 also renamed its DOM classes: `ag-body-viewport` is now `ag-grid-scrolling-container`, and `ag-pinned-left-header` is now `.ag-header .ag-grid-pinned-left-cells`
21
+ - `DataGrid` has a minimum height of 320px, so its rows show in a parent with no height. A parent with a height smaller than that now overflows
22
+ - The AG Grid texts in `DataGrid` are in Brazilian Portuguese, such as `Aplicar` and `Sem linhas para mostrar`
23
+ - The accent color of `DataGrid` follows `--color-zl-primary`
24
+ - `Limpar todos` in `DataGrid` also clears the search
25
+
26
+ ### Fixed
27
+
28
+ - The status bar of `DataGrid` holds 4.5:1 on its text, and its filters are separated from the count by a border instead of a `|` that screen readers read out
29
+ - The row count of `DataGrid` is a `role="status"` with a name, so it is announced when it changes, and it no longer shows `0 / N` before the grid is ready
30
+ - Each remove button of an active filter in `DataGrid` is named after its column, such as `Remover filtro Nome`. They all had the same name
31
+ - The buttons of the column filter in `DataGrid` hold 4.5:1, and its controls and the column headers draw a real focus outline, which also shows in forced colors mode
32
+ - `width` on a `DataGrid` column is respected. Fitting the columns to their content replaced it
33
+ - A filter tag in `DataGrid` shows its value for a number of 0, a range, a date, a filter with no value and combined conditions. These showed raw JSON
34
+
35
+ ### Removed
36
+
37
+ - The `.ag-theme-alpine` rules in `styles.css`. `DataGrid` never rendered that class, so they had no effect on it
38
+
39
+ #### Migration
40
+
41
+ Only for an app that renders its own AG Grid with the `ag-theme-alpine` class and relied on these rules: search for `ag-theme-alpine`, and copy the rules it needs. `DataGrid` needs nothing.
42
+
43
+ An app that lists `ag-grid-community` or `ag-grid-react` in its own `package.json` must move them to `^36.2.0` too, so a single copy of AG Grid is installed: two copies register their modules twice and warn. Search for `ag-grid` in `package.json`. An app with its own CSS or tests on the AG Grid DOM (`ag-body-viewport`, `ag-center-cols-container`, `ag-pinned-left-header`) must follow the [AG Grid 36 upgrade guide](https://www.ag-grid.com/react-data-grid/upgrading-to-ag-grid-36/). An app that uses only `DataGrid` changes nothing.
44
+
45
+ ## [2.0.1] - 2026-11-03
46
+
47
+ ### Changed
48
+
49
+ - The colored toasts of `Toaster` follow the `--color-zl-*` theme values: the text is the `-strong` value, the background is the color at 15% over white and the border is the color at 30%. `error` uses `danger`
50
+
51
+ ### Fixed
52
+
53
+ - `Toaster` holds 4.5:1 on the text of each toast type. The rich colors of Sonner stayed under it on their light backgrounds
54
+ - A toast from `useToastStore` no longer replaces a toast from `toast()` that is showing. Both numbered their toasts from 1
55
+ - A toast and its close button draw a real focus outline in the text color. Their `box-shadow` ring was about 1.6:1 and disappeared in forced colors mode
56
+
11
57
  ## [2.0.0] - 2026-11-03
12
58
 
13
59
  ### Added
@@ -323,7 +369,9 @@ Replace the shade with the class of the `color` being tested, for example `/(^|\
323
369
 
324
370
  The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
325
371
 
326
- [Unreleased]: https://github.com/alexandregme/zljs/compare/v2.0.0...HEAD
372
+ [Unreleased]: https://github.com/alexandregme/zljs/compare/v2.1.0...HEAD
373
+ [2.1.0]: https://github.com/alexandregme/zljs/compare/v2.0.1...v2.1.0
374
+ [2.0.1]: https://github.com/alexandregme/zljs/compare/v2.0.0...v2.0.1
327
375
  [2.0.0]: https://github.com/alexandregme/zljs/compare/v1.19.1...v2.0.0
328
376
  [1.19.1]: https://github.com/alexandregme/zljs/compare/v1.19.0...v1.19.1
329
377
  [1.19.0]: https://github.com/alexandregme/zljs/compare/v1.18.1...v1.19.0
@@ -166,16 +166,40 @@ var useToastStore = create()(
166
166
  // core/toaster/toaster.tsx
167
167
  import { useEffect } from "react";
168
168
  import { Toaster as SonnerToaster, toast } from "sonner";
169
+
170
+ // core/toaster/toaster.styles.ts
171
+ import { tv as tv4 } from "tailwind-variants";
172
+ var focusOutline = "focus-visible:outline-2! focus-visible:outline-offset-2! focus-visible:outline-current!";
173
+ var toaster = tv4({
174
+ slots: {
175
+ toast: focusOutline,
176
+ closeButton: focusOutline
177
+ }
178
+ });
179
+ var toasterColors = {
180
+ "--success-text": "var(--color-zl-success-strong)",
181
+ "--success-bg": "color-mix(in oklab, var(--color-zl-success) 15%, white)",
182
+ "--success-border": "color-mix(in oklab, var(--color-zl-success) 30%, white)",
183
+ "--info-text": "var(--color-zl-info-strong)",
184
+ "--info-bg": "color-mix(in oklab, var(--color-zl-info) 15%, white)",
185
+ "--info-border": "color-mix(in oklab, var(--color-zl-info) 30%, white)",
186
+ "--warning-text": "var(--color-zl-warning-strong)",
187
+ "--warning-bg": "color-mix(in oklab, var(--color-zl-warning) 15%, white)",
188
+ "--warning-border": "color-mix(in oklab, var(--color-zl-warning) 30%, white)",
189
+ "--error-text": "var(--color-zl-danger-strong)",
190
+ "--error-bg": "color-mix(in oklab, var(--color-zl-danger) 15%, white)",
191
+ "--error-border": "color-mix(in oklab, var(--color-zl-danger) 30%, white)"
192
+ };
193
+
194
+ // core/toaster/toaster.tsx
169
195
  import { jsx as jsx4 } from "react/jsx-runtime";
170
196
  var Toaster = () => {
171
197
  const toasts = useToastStore((s) => s.toasts);
172
198
  const removeToast = useToastStore((s) => s.removeToast);
199
+ const { toast: toastStyles, closeButton } = toaster();
173
200
  useEffect(() => {
174
201
  toasts.forEach((t) => {
175
- toast[t.type](t.message, {
176
- id: t.id,
177
- onDismiss: () => removeToast(t.id)
178
- });
202
+ toast[t.type](t.message, { id: `store-${t.id}` });
179
203
  removeToast(t.id);
180
204
  });
181
205
  }, [toasts, removeToast]);
@@ -187,7 +211,11 @@ var Toaster = () => {
187
211
  closeButton: true,
188
212
  duration: 4e3,
189
213
  expand: true,
190
- visibleToasts: 5
214
+ visibleToasts: 5,
215
+ style: toasterColors,
216
+ toastOptions: {
217
+ classNames: { toast: toastStyles(), closeButton: closeButton() }
218
+ }
191
219
  }
192
220
  );
193
221
  };
@@ -350,8 +378,8 @@ var spinnerIcons = {
350
378
  };
351
379
 
352
380
  // core/spinner/spinner.styles.ts
353
- import { tv as tv4 } from "tailwind-variants";
354
- var spinner = tv4({
381
+ import { tv as tv5 } from "tailwind-variants";
382
+ var spinner = tv5({
355
383
  base: "inline-flex animate-spin"
356
384
  });
357
385
 
@@ -373,8 +401,8 @@ var Spinner = ({
373
401
  );
374
402
 
375
403
  // core/loader/loader.styles.ts
376
- import { tv as tv5 } from "tailwind-variants";
377
- var loader = tv5({
404
+ import { tv as tv6 } from "tailwind-variants";
405
+ var loader = tv6({
378
406
  base: "flex fixed inset-0 justify-center items-center bg-black/20 text-zl-primary z-50"
379
407
  });
380
408
 
package/dist/index.d.ts CHANGED
@@ -58,9 +58,10 @@ interface DataGridProps<T extends Record<string, unknown> = Record<string, unkno
58
58
  columns: DataGridColumn<T>[];
59
59
  data: T[];
60
60
  showSearch?: boolean;
61
+ "aria-label"?: string;
61
62
  }
62
63
 
63
- declare const DataGrid: <T extends Record<string, unknown> = Record<string, unknown>>({ columns, data, showSearch, }: DataGridProps<T>) => react.JSX.Element;
64
+ declare const DataGrid: <T extends Record<string, unknown> = Record<string, unknown>>({ columns, data, showSearch, "aria-label": ariaLabel, }: DataGridProps<T>) => react.JSX.Element;
64
65
 
65
66
  type CheckboxVariant = "default" | "card";
66
67
  interface CheckboxProps {
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  usePageStore,
13
13
  useRouterStore,
14
14
  useToastStore
15
- } from "./chunk-O6UAZGBC.js";
15
+ } from "./chunk-5VIR5UAF.js";
16
16
  import {
17
17
  Error,
18
18
  FormInput,
@@ -176,15 +176,9 @@ var Button = ({
176
176
  };
177
177
 
178
178
  // core/data-grid/data-grid.tsx
179
- import {
180
- AllCommunityModule,
181
- ModuleRegistry,
182
- themeAlpine
183
- } from "ag-grid-community";
179
+ import { AG_GRID_LOCALE_BR } from "@ag-grid-community/locale";
180
+ import { AllCommunityModule, ModuleRegistry } from "ag-grid-community";
184
181
  import { AgGridReact } from "ag-grid-react";
185
- import { useState as useState2, useCallback } from "react";
186
-
187
- // core/data-grid/data-grid-toolbar.tsx
188
182
  import { useState } from "react";
189
183
 
190
184
  // core/forms/checkbox/checkbox.tsx
@@ -459,18 +453,15 @@ var TextArea = ({
459
453
 
460
454
  // core/data-grid/data-grid-toolbar.tsx
461
455
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
462
- var DataGridToolbar = ({ gridApi }) => {
463
- const [searchTerm, setSearchTerm] = useState("");
464
- const handleSearch = () => {
465
- gridApi?.setGridOption("quickFilterText", searchTerm);
466
- };
467
- const handleClear = () => {
468
- setSearchTerm("");
469
- gridApi?.setGridOption("quickFilterText", "");
470
- };
456
+ var DataGridToolbar = ({
457
+ searchTerm,
458
+ onSearchTermChange,
459
+ onSearch,
460
+ onClear
461
+ }) => {
471
462
  const handleKeyDown = (e) => {
472
463
  if (e.key === "Enter") {
473
- handleSearch();
464
+ onSearch();
474
465
  }
475
466
  };
476
467
  return /* @__PURE__ */ jsxs6(
@@ -485,12 +476,12 @@ var DataGridToolbar = ({ gridApi }) => {
485
476
  "aria-label": "Buscar na tabela",
486
477
  placeholder: "Buscar...",
487
478
  value: searchTerm,
488
- onChange: (e) => setSearchTerm(e.target.value),
479
+ onChange: (e) => onSearchTermChange(e.target.value),
489
480
  onKeyDown: handleKeyDown
490
481
  }
491
482
  ),
492
- /* @__PURE__ */ jsx7(Button, { icon: "Search", color: "primary", onClick: handleSearch, children: "Buscar" }),
493
- /* @__PURE__ */ jsx7(Button, { icon: "X", color: "danger", onClick: handleClear, children: "Limpar" })
483
+ /* @__PURE__ */ jsx7(Button, { icon: "Search", color: "primary", onClick: onSearch, children: "Buscar" }),
484
+ /* @__PURE__ */ jsx7(Button, { icon: "X", color: "danger", onClick: onClear, children: "Limpar" })
494
485
  ]
495
486
  }
496
487
  );
@@ -547,175 +538,182 @@ var DataGridStatusBar = ({
547
538
  totalRows,
548
539
  displayedRows,
549
540
  activeFilters,
550
- gridApi
541
+ onClearFilter,
542
+ onClearAll
551
543
  }) => {
552
544
  const isFiltered = displayedRows !== totalRows || activeFilters.length > 0;
553
- const handleClearFilter = (column) => {
554
- if (!gridApi) return;
555
- const filterInstance = gridApi.getColumnFilterInstance(column);
556
- if (filterInstance) {
557
- filterInstance.then((filter) => {
558
- filter?.setModel(null);
559
- gridApi.onFilterChanged();
560
- });
561
- }
562
- };
563
- const handleClearAllFilters = () => {
564
- if (!gridApi) return;
565
- gridApi.setFilterModel(null);
566
- };
545
+ const count = isFiltered ? `${displayedRows} / ${totalRows} registros` : `${totalRows} registros`;
567
546
  return /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3 px-2 py-1.5 bg-slate-100 border border-slate-200 rounded text-sm text-slate-600 mb-2", children: [
568
- /* @__PURE__ */ jsx9("span", { className: "font-medium", children: isFiltered ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
569
- /* @__PURE__ */ jsx9("span", { className: "text-blue-600", children: displayedRows }),
570
- /* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: " / " }),
571
- /* @__PURE__ */ jsx9("span", { children: totalRows }),
572
- /* @__PURE__ */ jsx9("span", { className: "text-slate-500 ml-1", children: "registros" })
573
- ] }) : /* @__PURE__ */ jsxs8(Fragment2, { children: [
574
- /* @__PURE__ */ jsx9("span", { children: totalRows }),
575
- /* @__PURE__ */ jsx9("span", { className: "text-slate-500 ml-1", children: "registros" })
576
- ] }) }),
577
- activeFilters.length > 0 && /* @__PURE__ */ jsxs8(Fragment2, { children: [
578
- /* @__PURE__ */ jsx9("span", { className: "text-slate-300", children: "|" }),
579
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2 flex-wrap", children: [
580
- /* @__PURE__ */ jsx9("span", { className: "text-slate-500", children: "Filtros:" }),
581
- activeFilters.map((filter) => /* @__PURE__ */ jsxs8(
582
- Tag,
583
- {
584
- onRemove: () => handleClearFilter(filter.column),
585
- children: [
586
- /* @__PURE__ */ jsxs8("span", { className: "font-medium", children: [
587
- filter.headerName,
588
- ":"
589
- ] }),
590
- /* @__PURE__ */ jsx9("span", { children: filter.value })
591
- ]
592
- },
593
- filter.column
594
- )),
595
- /* @__PURE__ */ jsx9(Button, { variant: "link", color: "none", onClick: handleClearAllFilters, children: "Limpar todos" })
596
- ] })
597
- ] })
547
+ /* @__PURE__ */ jsxs8("span", { role: "status", "aria-label": count, className: "font-medium", children: [
548
+ isFiltered && /* @__PURE__ */ jsxs8(Fragment2, { children: [
549
+ /* @__PURE__ */ jsx9(Text, { as: "span", variant: "caption", color: "primary", children: displayedRows }),
550
+ " ",
551
+ /* @__PURE__ */ jsx9(Text, { as: "span", variant: "caption", children: "/" }),
552
+ " "
553
+ ] }),
554
+ /* @__PURE__ */ jsx9(Text, { as: "span", variant: "caption", children: totalRows }),
555
+ " ",
556
+ /* @__PURE__ */ jsx9(Text, { as: "span", variant: "caption", children: "registros" })
557
+ ] }),
558
+ activeFilters.length > 0 && /* @__PURE__ */ jsx9(Fragment2, { children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2 flex-wrap border-l border-slate-300 pl-3", children: [
559
+ /* @__PURE__ */ jsx9(Text, { as: "span", variant: "caption", children: "Filtros:" }),
560
+ activeFilters.map((filter) => /* @__PURE__ */ jsx9(
561
+ Tag,
562
+ {
563
+ onRemove: () => onClearFilter(filter.column),
564
+ removeLabel: `Remover filtro ${filter.headerName}`,
565
+ children: `${filter.headerName}: ${filter.value}`
566
+ },
567
+ filter.column
568
+ )),
569
+ /* @__PURE__ */ jsx9(Button, { variant: "link", color: "none", onClick: onClearAll, children: "Limpar todos" })
570
+ ] }) })
598
571
  ] });
599
572
  };
600
573
 
601
- // core/data-grid/data-grid.tsx
602
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
603
- ModuleRegistry.registerModules([AllCommunityModule]);
604
- var tailwind = {
574
+ // core/data-grid/data-grid.const.ts
575
+ import { themeAlpine } from "ag-grid-community";
576
+ var dataGridPalette = {
605
577
  slate: {
606
578
  50: "#f8fafc",
607
- 100: "#f1f5f9",
608
579
  200: "#e2e8f0",
609
580
  600: "#475569",
610
- 700: "#334155",
611
- 800: "#1e293b"
581
+ 700: "#334155"
612
582
  },
613
583
  sky: {
614
- 50: "#f0f9ff",
615
584
  100: "#e0f2fe"
616
585
  },
617
586
  blue: {
618
587
  100: "#dbeafe"
619
588
  }
620
589
  };
621
- var customTheme = themeAlpine.withParams({
622
- headerBackgroundColor: tailwind.slate[700],
623
- headerTextColor: tailwind.slate[50],
624
- oddRowBackgroundColor: tailwind.slate[50],
625
- rowHoverColor: tailwind.sky[100],
626
- selectedRowBackgroundColor: tailwind.blue[100],
627
- borderColor: tailwind.slate[200],
628
- headerColumnBorder: tailwind.slate[600],
590
+ var dataGridTheme = themeAlpine.withParams({
591
+ accentColor: "var(--color-zl-primary)",
592
+ headerBackgroundColor: dataGridPalette.slate[700],
593
+ headerTextColor: dataGridPalette.slate[50],
594
+ oddRowBackgroundColor: dataGridPalette.slate[50],
595
+ rowHoverColor: dataGridPalette.sky[100],
596
+ selectedRowBackgroundColor: dataGridPalette.blue[100],
597
+ borderColor: dataGridPalette.slate[200],
598
+ headerColumnBorder: dataGridPalette.slate[600],
629
599
  fontSize: 13,
630
600
  headerHeight: 36,
631
601
  rowHeight: 32,
632
602
  cellHorizontalPadding: 8
633
603
  });
604
+
605
+ // core/data-grid/data-grid.styles.ts
606
+ import { tv as tv8 } from "tailwind-variants";
607
+ var dataGrid = tv8({
608
+ slots: {
609
+ base: "grid grid-rows-[auto_auto_1fr] grid-cols-1 h-full w-full",
610
+ table: "ag-grid h-full min-h-80 w-full z-0"
611
+ }
612
+ });
613
+
614
+ // core/data-grid/data-grid.tsx
615
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
616
+ ModuleRegistry.registerModules([AllCommunityModule]);
634
617
  var DataGrid = ({
635
618
  columns,
636
619
  data,
637
- showSearch = true
620
+ showSearch = true,
621
+ "aria-label": ariaLabel = "Tabela de dados"
638
622
  }) => {
639
- const [gridApi, setGridApi] = useState2(null);
640
- const [displayedRows, setDisplayedRows] = useState2(0);
641
- const [activeFilters, setActiveFilters] = useState2([]);
642
- const updateFilterState = useCallback(
643
- (api) => {
644
- setDisplayedRows(api.getDisplayedRowCount());
645
- const filterModel = api.getFilterModel();
646
- const filters = [];
647
- if (filterModel) {
648
- Object.entries(filterModel).forEach(([colId, model]) => {
649
- const colDef = columns.find((c) => c.field === colId);
650
- const headerName = colDef?.headerName || colId;
651
- const filterValue = model?.filter || model?.values?.join(", ") || JSON.stringify(model);
652
- filters.push({
653
- column: colId,
654
- headerName,
655
- value: filterValue
656
- });
657
- });
658
- }
659
- setActiveFilters(filters);
660
- },
661
- [columns]
662
- );
663
- const handleGridReady = (params) => {
664
- setGridApi(params.api);
665
- setDisplayedRows(params.api.getDisplayedRowCount());
623
+ const [gridApi, setGridApi] = useState(null);
624
+ const [searchTerm, setSearchTerm] = useState("");
625
+ const [displayedRows, setDisplayedRows] = useState(data.length);
626
+ const [activeFilters, setActiveFilters] = useState([]);
627
+ const columnDefs = columns.map((column) => ({
628
+ ...column,
629
+ suppressAutoSize: column.width !== void 0
630
+ }));
631
+ const handleGridReady = ({ api }) => {
632
+ api.setGridAriaProperty("label", ariaLabel);
633
+ setGridApi(api);
666
634
  };
667
- const handleFilterChanged = useCallback(() => {
668
- if (gridApi) {
669
- updateFilterState(gridApi);
670
- }
671
- }, [gridApi, updateFilterState]);
672
- const handleModelUpdated = useCallback(() => {
673
- if (gridApi) {
674
- setDisplayedRows(gridApi.getDisplayedRowCount());
675
- }
676
- }, [gridApi]);
677
- return /* @__PURE__ */ jsxs9(
678
- "div",
679
- {
680
- "data-testid": "data-grid",
681
- className: "grid grid-rows-[auto_auto_1fr] grid-cols-1 h-full w-full",
682
- children: [
683
- showSearch && /* @__PURE__ */ jsx10(DataGridToolbar, { gridApi }),
684
- /* @__PURE__ */ jsx10(
685
- DataGridStatusBar,
686
- {
687
- totalRows: data.length,
688
- displayedRows,
689
- activeFilters,
690
- gridApi
691
- }
692
- ),
693
- /* @__PURE__ */ jsx10("div", { className: "ag-grid h-full w-full z-0", children: /* @__PURE__ */ jsx10(
694
- AgGridReact,
695
- {
696
- theme: customTheme,
697
- columnDefs: columns,
698
- rowData: data,
699
- domLayout: "normal",
700
- autoSizeStrategy: { type: "fitCellContents" },
701
- onGridReady: handleGridReady,
702
- onFilterChanged: handleFilterChanged,
703
- onModelUpdated: handleModelUpdated,
704
- defaultColDef: {
705
- filterParams: {
706
- buttons: ["reset", "apply"]
707
- }
708
- }
635
+ const handleFilterChanged = async ({ api }) => {
636
+ const filters = await Promise.all(
637
+ Object.entries(api.getFilterModel()).map(
638
+ async ([column, model]) => ({
639
+ column,
640
+ headerName: api.getDisplayNameForColumn(
641
+ api.getColumn(column),
642
+ "header"
643
+ ),
644
+ value: (await api.getColumnFilterInstance(column)).getModelAsString(
645
+ model
646
+ )
647
+ })
648
+ )
649
+ );
650
+ setActiveFilters(filters);
651
+ };
652
+ const handleModelUpdated = ({ api }) => {
653
+ setDisplayedRows(api.getDisplayedRowCount());
654
+ };
655
+ const handleSearch = () => {
656
+ gridApi?.setGridOption("quickFilterText", searchTerm);
657
+ };
658
+ const handleClearSearch = () => {
659
+ setSearchTerm("");
660
+ gridApi?.setGridOption("quickFilterText", "");
661
+ };
662
+ const handleClearFilter = (column) => {
663
+ gridApi?.setColumnFilterModel(column, null).then(() => {
664
+ gridApi.onFilterChanged();
665
+ });
666
+ };
667
+ const handleClearAll = () => {
668
+ handleClearSearch();
669
+ gridApi?.setFilterModel(null);
670
+ };
671
+ const { base, table } = dataGrid();
672
+ return /* @__PURE__ */ jsxs9("div", { "data-testid": "data-grid", className: base(), children: [
673
+ showSearch && /* @__PURE__ */ jsx10(
674
+ DataGridToolbar,
675
+ {
676
+ searchTerm,
677
+ onSearchTermChange: setSearchTerm,
678
+ onSearch: handleSearch,
679
+ onClear: handleClearSearch
680
+ }
681
+ ),
682
+ /* @__PURE__ */ jsx10(
683
+ DataGridStatusBar,
684
+ {
685
+ totalRows: data.length,
686
+ displayedRows,
687
+ activeFilters,
688
+ onClearFilter: handleClearFilter,
689
+ onClearAll: handleClearAll
690
+ }
691
+ ),
692
+ /* @__PURE__ */ jsx10("div", { className: table(), children: /* @__PURE__ */ jsx10(
693
+ AgGridReact,
694
+ {
695
+ theme: dataGridTheme,
696
+ columnDefs,
697
+ rowData: data,
698
+ domLayout: "normal",
699
+ autoSizeStrategy: { type: "fitCellContents" },
700
+ localeText: AG_GRID_LOCALE_BR,
701
+ onGridReady: handleGridReady,
702
+ onFilterChanged: handleFilterChanged,
703
+ onModelUpdated: handleModelUpdated,
704
+ defaultColDef: {
705
+ filterParams: {
706
+ buttons: ["reset", "apply"]
709
707
  }
710
- ) })
711
- ]
712
- }
713
- );
708
+ }
709
+ }
710
+ ) })
711
+ ] });
714
712
  };
715
713
 
716
714
  // core/stats-card/stats-card.styles.ts
717
- import { tv as tv8 } from "tailwind-variants";
718
- var statsCard = tv8({
715
+ import { tv as tv9 } from "tailwind-variants";
716
+ var statsCard = tv9({
719
717
  base: "p-4 rounded-lg",
720
718
  variants: {
721
719
  color: {
@@ -742,11 +740,11 @@ var StatsCard = ({ label: label5, value, color }) => {
742
740
  import * as Dialog from "@radix-ui/react-dialog";
743
741
 
744
742
  // core/modal/modal.styles.ts
745
- import { tv as tv9 } from "tailwind-variants";
746
- var overlay = tv9({
743
+ import { tv as tv10 } from "tailwind-variants";
744
+ var overlay = tv10({
747
745
  base: "fixed inset-0 bg-black/50"
748
746
  });
749
- var content = tv9({
747
+ var content = tv10({
750
748
  base: "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white rounded-lg shadow-lg p-6 w-full focus:outline-none max-h-[90vh] overflow-y-auto",
751
749
  variants: {
752
750
  size: {
@@ -761,16 +759,16 @@ var content = tv9({
761
759
  size: "md"
762
760
  }
763
761
  });
764
- var header = tv9({
762
+ var header = tv10({
765
763
  base: "flex items-start justify-between"
766
764
  });
767
- var title = tv9({
765
+ var title = tv10({
768
766
  base: "text-lg font-semibold text-gray-900 m-0"
769
767
  });
770
- var description = tv9({
768
+ var description = tv10({
771
769
  base: "text-sm text-gray-600 mt-2"
772
770
  });
773
- var body = tv9({
771
+ var body = tv10({
774
772
  base: "mt-4"
775
773
  });
776
774
 
@@ -839,12 +837,12 @@ var WhatsAppButton = ({
839
837
  };
840
838
 
841
839
  // core/sidebar/sidebar.tsx
842
- import { useState as useState3 } from "react";
840
+ import { useState as useState2 } from "react";
843
841
  import Link from "next/link.js";
844
842
 
845
843
  // core/sidebar/sidebar.styles.ts
846
- import { tv as tv10 } from "tailwind-variants";
847
- var sidebar = tv10({
844
+ import { tv as tv11 } from "tailwind-variants";
845
+ var sidebar = tv11({
848
846
  base: "h-screen bg-neutral-800 text-neutral-300 flex flex-col overflow-hidden transition-all duration-200 divide-y divide-neutral-600/50",
849
847
  variants: {
850
848
  collapsed: {
@@ -856,16 +854,16 @@ var sidebar = tv10({
856
854
  collapsed: false
857
855
  }
858
856
  });
859
- var nav = tv10({
857
+ var nav = tv11({
860
858
  base: "flex-1 min-h-0 overflow-y-auto overflow-x-hidden divide-y divide-neutral-600/50"
861
859
  });
862
- var header2 = tv10({
860
+ var header2 = tv11({
863
861
  base: "shrink-0 p-2"
864
862
  });
865
- var section = tv10({
863
+ var section = tv11({
866
864
  base: "grid gap-1 p-2"
867
865
  });
868
- var item = tv10({
866
+ var item = tv11({
869
867
  // [&>*+*] is the label: Text takes no className, and the icon comes first, so a link with no label has nothing to hide.
870
868
  base: "flex items-center rounded-md transition-colors h-10 px-3 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current [&>*+*]:truncate [&>*+*]:transition-all [&>*+*]:duration-200",
871
869
  variants: {
@@ -883,7 +881,7 @@ var item = tv10({
883
881
  collapsed: false
884
882
  }
885
883
  });
886
- var footer = tv10({
884
+ var footer = tv11({
887
885
  base: "shrink-0 h-16 p-3 flex items-center gap-3",
888
886
  variants: {
889
887
  collapsed: {
@@ -891,13 +889,13 @@ var footer = tv10({
891
889
  }
892
890
  }
893
891
  });
894
- var avatar = tv10({
892
+ var avatar = tv11({
895
893
  base: "shrink-0 size-8 rounded-full bg-neutral-600 text-white text-xs font-medium flex items-center justify-center"
896
894
  });
897
- var userInfo = tv10({
895
+ var userInfo = tv11({
898
896
  base: "flex flex-col min-w-0 text-white [&>*]:truncate [&>*:last-child]:text-xs [&>*:last-child]:text-neutral-400"
899
897
  });
900
- var toggleButton = tv10({
898
+ var toggleButton = tv11({
901
899
  base: "shrink-0 h-14 grid p-2 [&>button]:justify-start [&>button]:px-3 [&>button]:overflow-hidden [&>button]:whitespace-nowrap"
902
900
  });
903
901
 
@@ -920,7 +918,7 @@ var Sidebar = ({
920
918
  homeLabel,
921
919
  onLogout
922
920
  }) => {
923
- const [collapsed, setCollapsed] = useState3(defaultCollapsed);
921
+ const [collapsed, setCollapsed] = useState2(defaultCollapsed);
924
922
  const initials = getInitials(user.name);
925
923
  return /* @__PURE__ */ jsxs12("aside", { className: sidebar({ collapsed }), children: [
926
924
  homeHref && /* @__PURE__ */ jsx14("div", { className: header2(), children: /* @__PURE__ */ jsxs12(
@@ -7,7 +7,7 @@ import {
7
7
  Toaster,
8
8
  usePageStore,
9
9
  useRouterStore
10
- } from "../chunk-O6UAZGBC.js";
10
+ } from "../chunk-5VIR5UAF.js";
11
11
 
12
12
  // core/next/root-layout/root-layout.styles.ts
13
13
  import { tv } from "tailwind-variants";
@@ -1,32 +1,13 @@
1
- /* AG Grid Custom Styles */
2
- .ag-theme-alpine {
3
- --ag-header-background-color: #f8fafc;
4
- --ag-header-foreground-color: #334155;
5
- --ag-header-cell-hover-background-color: #e2e8f0;
6
- --ag-odd-row-background-color: #f8fafc;
7
- --ag-row-hover-color: #e0f2fe;
8
- --ag-selected-row-background-color: #dbeafe;
9
- --ag-border-color: #e2e8f0;
10
- --ag-font-family: inherit;
11
- --ag-font-size: 14px;
12
- }
13
-
14
- .ag-theme-alpine .ag-header-cell {
15
- font-weight: 600;
16
- text-transform: uppercase;
17
- font-size: 12px;
18
- letter-spacing: 0.05em;
19
- border-right: 1px solid #475569;
20
- }
21
-
22
- .ag-theme-alpine .ag-header-cell:last-child {
23
- border-right: none;
24
- }
25
-
26
- .ag-theme-alpine .ag-row {
27
- border-bottom: 1px solid #f1f5f9;
28
- }
29
-
30
- .ag-theme-alpine .ag-row:hover {
31
- background-color: var(--ag-row-hover-color);
1
+ /* AG Grid draws focus with a box-shadow, which forced colors mode drops. The
2
+ header is dark, so its outline follows its text. */
3
+ .ag-grid .ag-header-cell:focus-visible {
4
+ outline: 2px solid currentColor;
5
+ outline-offset: -2px;
6
+ }
7
+
8
+ .ag-grid .ag-standard-button:focus-visible,
9
+ .ag-grid .ag-picker-field-wrapper:focus-visible,
10
+ .ag-grid .ag-input-field-input:focus-visible {
11
+ outline: 2px solid var(--color-zl-primary);
12
+ outline-offset: 2px;
32
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",
@@ -72,10 +72,11 @@
72
72
  "prepublishOnly": "pnpm build:lib"
73
73
  },
74
74
  "dependencies": {
75
+ "@ag-grid-community/locale": "^36.2.0",
75
76
  "@hookform/resolvers": "^5.2.2",
76
77
  "@radix-ui/react-dialog": "^1.1.15",
77
- "ag-grid-community": "^35.0.0",
78
- "ag-grid-react": "^35.0.0",
78
+ "ag-grid-community": "^36.2.0",
79
+ "ag-grid-react": "^36.2.0",
79
80
  "axios": "^1.13.5",
80
81
  "lucide-react": "^0.563.0",
81
82
  "react-hook-form": "^7.70.0",