@cerberus-design/data-grid 0.25.3 → 1.0.0-rc.6

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.
Files changed (34) hide show
  1. package/dist/column-helpers.cjs +55 -21
  2. package/dist/column-helpers.js +55 -17
  3. package/dist/components/cerby-data-grid.client.cjs +12 -11
  4. package/dist/components/cerby-data-grid.client.js +12 -7
  5. package/dist/components/count-menu.client.cjs +46 -49
  6. package/dist/components/count-menu.client.js +46 -45
  7. package/dist/components/data-grid.client.cjs +89 -82
  8. package/dist/components/data-grid.client.js +89 -78
  9. package/dist/components/features.client.cjs +72 -76
  10. package/dist/components/features.client.js +72 -72
  11. package/dist/components/grid.client.cjs +280 -309
  12. package/dist/components/grid.client.js +281 -303
  13. package/dist/components/pagination.client.cjs +90 -113
  14. package/dist/components/pagination.client.js +90 -109
  15. package/dist/components/pinned-items.client.cjs +60 -59
  16. package/dist/components/pinned-items.client.js +60 -55
  17. package/dist/components/sort-items.client.cjs +44 -49
  18. package/dist/components/sort-items.client.js +44 -45
  19. package/dist/const.cjs +32 -43
  20. package/dist/const.js +33 -31
  21. package/dist/context.client.cjs +12 -12
  22. package/dist/context.client.js +12 -8
  23. package/dist/hooks.client.cjs +13 -20
  24. package/dist/hooks.client.js +13 -16
  25. package/dist/index.cjs +9 -15
  26. package/dist/index.js +5 -4
  27. package/dist/panda.buildinfo.json +23 -0
  28. package/dist/store.cjs +241 -284
  29. package/dist/store.js +241 -280
  30. package/dist/utils.cjs +23 -45
  31. package/dist/utils.js +23 -41
  32. package/dist/virtualizer.client.cjs +63 -53
  33. package/dist/virtualizer.client.js +63 -49
  34. package/package.json +33 -27
@@ -1,24 +1,58 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
1
+ "use client";
2
+ //#region src/column-helpers.ts
3
+ /**
4
+ * A helper to format columns which provides a heavily typed interface for
5
+ * creating column definitions used by the DataGrid component.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import { createColumnHelper } from '@cerberus/data-grid'
10
+ *
11
+ * const columnHelper = createColumnHelper<MyDataType>()
12
+ *
13
+ * const columns = [
14
+ * columnHelper.accessor('id', {
15
+ * header: 'ID',
16
+ * width: 100,
17
+ * cell: (props) => props.row.original.id,
18
+ * }),
19
+ * columnHelper.accessorFn(
20
+ * (row: User) => `${row.firstName} ${row.lastName}`,
21
+ * {
22
+ * id: 'id',
23
+ * header: 'Full Name',
24
+ * cell: (props) => <span className="custom-component">{props.value}</span>
25
+ * }
26
+ * ),
27
+ * columnHelper.display({
28
+ * id: 'actions',
29
+ * header: 'Actions',
30
+ * width: 150,
31
+ * cell: (props) => (
32
+ * <button onClick={() => handleDelete(props.row.original.id)}>
33
+ * Delete
34
+ * </button>
35
+ * ),
36
+ * }),
37
+ * ]
38
+ * ```
39
+ */
6
40
  function createColumnHelper() {
7
- return {
8
- accessor: (key, options) => ({
9
- id: options.id ?? key,
10
- accessor: (row) => row[key],
11
- ...options
12
- }),
13
- accessorFn: (accessorFn, options) => ({
14
- accessor: accessorFn,
15
- ...options
16
- }),
17
- display: (options) => ({
18
- accessor: () => void 0,
19
- ...options
20
- })
21
- };
41
+ return {
42
+ accessor: (key, options) => ({
43
+ id: options.id ?? key,
44
+ accessor: (row) => row[key],
45
+ ...options
46
+ }),
47
+ accessorFn: (accessorFn, options) => ({
48
+ accessor: accessorFn,
49
+ ...options
50
+ }),
51
+ display: (options) => ({
52
+ accessor: () => void 0,
53
+ ...options
54
+ })
55
+ };
22
56
  }
23
-
57
+ //#endregion
24
58
  exports.createColumnHelper = createColumnHelper;
@@ -1,20 +1,58 @@
1
- 'use client';
1
+ "use client";
2
+ //#region src/column-helpers.ts
3
+ /**
4
+ * A helper to format columns which provides a heavily typed interface for
5
+ * creating column definitions used by the DataGrid component.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import { createColumnHelper } from '@cerberus/data-grid'
10
+ *
11
+ * const columnHelper = createColumnHelper<MyDataType>()
12
+ *
13
+ * const columns = [
14
+ * columnHelper.accessor('id', {
15
+ * header: 'ID',
16
+ * width: 100,
17
+ * cell: (props) => props.row.original.id,
18
+ * }),
19
+ * columnHelper.accessorFn(
20
+ * (row: User) => `${row.firstName} ${row.lastName}`,
21
+ * {
22
+ * id: 'id',
23
+ * header: 'Full Name',
24
+ * cell: (props) => <span className="custom-component">{props.value}</span>
25
+ * }
26
+ * ),
27
+ * columnHelper.display({
28
+ * id: 'actions',
29
+ * header: 'Actions',
30
+ * width: 150,
31
+ * cell: (props) => (
32
+ * <button onClick={() => handleDelete(props.row.original.id)}>
33
+ * Delete
34
+ * </button>
35
+ * ),
36
+ * }),
37
+ * ]
38
+ * ```
39
+ */
2
40
  function createColumnHelper() {
3
- return {
4
- accessor: (key, options) => ({
5
- id: options.id ?? key,
6
- accessor: (row) => row[key],
7
- ...options
8
- }),
9
- accessorFn: (accessorFn, options) => ({
10
- accessor: accessorFn,
11
- ...options
12
- }),
13
- display: (options) => ({
14
- accessor: () => void 0,
15
- ...options
16
- })
17
- };
41
+ return {
42
+ accessor: (key, options) => ({
43
+ id: options.id ?? key,
44
+ accessor: (row) => row[key],
45
+ ...options
46
+ }),
47
+ accessorFn: (accessorFn, options) => ({
48
+ accessor: accessorFn,
49
+ ...options
50
+ }),
51
+ display: (options) => ({
52
+ accessor: () => void 0,
53
+ ...options
54
+ })
55
+ };
18
56
  }
19
-
57
+ //#endregion
20
58
  export { createColumnHelper };
@@ -1,14 +1,15 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const jsxRuntime = require('react/jsx-runtime');
7
- const react = require('@cerberus-design/react');
8
- const dataGrid_client = require('./data-grid.client.cjs');
9
-
1
+ "use client";
2
+ "use client";
3
+ const require_data_grid_client = require("./data-grid.client.cjs");
4
+ let _cerberus_design_react = require("@cerberus-design/react");
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ //#region src/components/cerby-data-grid.client.tsx
7
+ /**
8
+ * A Data Grid wrapped in the CerberusProvider in order to provide the necessary
9
+ * context for the grid to function properly.
10
+ */
10
11
  function CerberusDataGrid(props) {
11
- return /* @__PURE__ */ jsxRuntime.jsx(react.CerberusProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(dataGrid_client.DataGrid, { ...props }) });
12
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.CerberusProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_data_grid_client.DataGrid, { ...props }) });
12
13
  }
13
-
14
+ //#endregion
14
15
  exports.CerberusDataGrid = CerberusDataGrid;
@@ -1,10 +1,15 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { CerberusProvider } from '@cerberus-design/react';
4
- import { DataGrid } from './data-grid.client.js';
5
-
1
+ "use client";
2
+ "use client";
3
+ import { DataGrid } from "./data-grid.client.js";
4
+ import { CerberusProvider } from "@cerberus-design/react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/components/cerby-data-grid.client.tsx
7
+ /**
8
+ * A Data Grid wrapped in the CerberusProvider in order to provide the necessary
9
+ * context for the grid to function properly.
10
+ */
6
11
  function CerberusDataGrid(props) {
7
- return /* @__PURE__ */ jsx(CerberusProvider, { children: /* @__PURE__ */ jsx(DataGrid, { ...props }) });
12
+ return /* @__PURE__ */ jsx(CerberusProvider, { children: /* @__PURE__ */ jsx(DataGrid, { ...props }) });
8
13
  }
9
-
14
+ //#endregion
10
15
  export { CerberusDataGrid };
@@ -1,52 +1,49 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const jsxRuntime = require('react/jsx-runtime');
7
- const react = require('@cerberus-design/react');
8
- const signals = require('@cerberus-design/signals');
9
- const jsx = require('styled-system/jsx');
10
- const context_client = require('../context.client.cjs');
11
-
1
+ "use client";
2
+ "use client";
3
+ const require_context_client = require("../context.client.cjs");
4
+ let _cerberus_design_react = require("@cerberus-design/react");
5
+ let _cerberus_design_signals = require("@cerberus-design/signals");
6
+ let styled_system_jsx = require("styled-system/jsx");
7
+ let react_jsx_runtime = require("react/jsx-runtime");
8
+ //#region src/components/count-menu.client.tsx
12
9
  function CountMenu(props) {
13
- const state = context_client.useDataGridContext();
14
- const { icons } = react.useCerberusContext();
15
- const pageSize = signals.useRead(state.pageSize);
16
- const range = signals.useRead(state.pageRange);
17
- const Icon = icons.caretDown;
18
- const collection = react.createSelectCollection(
19
- range.map((size) => {
20
- const sizeStr = String(size);
21
- return { value: sizeStr, label: sizeStr };
22
- })
23
- );
24
- return /* @__PURE__ */ jsxRuntime.jsx(jsx.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Field, { label: "Select a page size", hideLabel: true, flexDirection: "row", children: /* @__PURE__ */ jsxRuntime.jsxs(
25
- react.SelectParts.Root,
26
- {
27
- ...props,
28
- collection,
29
- defaultValue: [String(pageSize)],
30
- size: "sm",
31
- children: [
32
- /* @__PURE__ */ jsxRuntime.jsx(react.SelectParts.Control, { children: /* @__PURE__ */ jsxRuntime.jsxs(
33
- react.SelectParts.Trigger,
34
- {
35
- border: "none",
36
- minW: "initial",
37
- gap: "xs",
38
- ps: "0",
39
- pe: "0",
40
- children: [
41
- /* @__PURE__ */ jsxRuntime.jsx(react.SelectParts.ValueText, {}),
42
- /* @__PURE__ */ jsxRuntime.jsx(jsx.HStack, { children: /* @__PURE__ */ jsxRuntime.jsx(react.SelectParts.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(Icon, {}) }) })
43
- ]
44
- }
45
- ) }),
46
- /* @__PURE__ */ jsxRuntime.jsx(react.SelectParts.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsx(react.SelectParts.Content, { minW: "7rem", children: /* @__PURE__ */ jsxRuntime.jsx(react.For, { each: collection.items, children: (item) => /* @__PURE__ */ jsxRuntime.jsx(react.Option, { item }, item.value) }) }) })
47
- ]
48
- }
49
- ) }) });
10
+ const state = require_context_client.useDataGridContext();
11
+ const { icons } = (0, _cerberus_design_react.useCerberusContext)();
12
+ const pageSize = (0, _cerberus_design_signals.useRead)(state.pageSize);
13
+ const range = (0, _cerberus_design_signals.useRead)(state.pageRange);
14
+ const Icon = icons.caretDown;
15
+ const collection = (0, _cerberus_design_react.createSelectCollection)(range.map((size) => {
16
+ const sizeStr = String(size);
17
+ return {
18
+ value: sizeStr,
19
+ label: sizeStr
20
+ };
21
+ }));
22
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(styled_system_jsx.Box, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.Field, {
23
+ label: "Select a page size",
24
+ hideLabel: true,
25
+ flexDirection: "row",
26
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_cerberus_design_react.SelectParts.Root, {
27
+ ...props,
28
+ collection,
29
+ defaultValue: [String(pageSize)],
30
+ size: "sm",
31
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.SelectParts.Control, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_cerberus_design_react.SelectParts.Trigger, {
32
+ border: "none",
33
+ minW: "initial",
34
+ gap: "xs",
35
+ ps: "0",
36
+ pe: "0",
37
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.SelectParts.ValueText, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(styled_system_jsx.HStack, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.SelectParts.Indicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {}) }) })]
38
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.SelectParts.Positioner, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.SelectParts.Content, {
39
+ minW: "7rem",
40
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.For, {
41
+ each: collection.items,
42
+ children: (item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.Option, { item }, item.value)
43
+ })
44
+ }) })]
45
+ })
46
+ }) });
50
47
  }
51
-
48
+ //#endregion
52
49
  exports.CountMenu = CountMenu;
@@ -1,48 +1,49 @@
1
- 'use client';
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { useCerberusContext, createSelectCollection, Field, SelectParts, For, Option } from '@cerberus-design/react';
4
- import { useRead } from '@cerberus-design/signals';
5
- import { Box, HStack } from 'styled-system/jsx';
6
- import { useDataGridContext } from '../context.client.js';
7
-
1
+ "use client";
2
+ "use client";
3
+ import { useDataGridContext } from "../context.client.js";
4
+ import { Field, For, Option, SelectParts, createSelectCollection, useCerberusContext } from "@cerberus-design/react";
5
+ import { useRead } from "@cerberus-design/signals";
6
+ import { Box, HStack } from "styled-system/jsx";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/count-menu.client.tsx
8
9
  function CountMenu(props) {
9
- const state = useDataGridContext();
10
- const { icons } = useCerberusContext();
11
- const pageSize = useRead(state.pageSize);
12
- const range = useRead(state.pageRange);
13
- const Icon = icons.caretDown;
14
- const collection = createSelectCollection(
15
- range.map((size) => {
16
- const sizeStr = String(size);
17
- return { value: sizeStr, label: sizeStr };
18
- })
19
- );
20
- return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Field, { label: "Select a page size", hideLabel: true, flexDirection: "row", children: /* @__PURE__ */ jsxs(
21
- SelectParts.Root,
22
- {
23
- ...props,
24
- collection,
25
- defaultValue: [String(pageSize)],
26
- size: "sm",
27
- children: [
28
- /* @__PURE__ */ jsx(SelectParts.Control, { children: /* @__PURE__ */ jsxs(
29
- SelectParts.Trigger,
30
- {
31
- border: "none",
32
- minW: "initial",
33
- gap: "xs",
34
- ps: "0",
35
- pe: "0",
36
- children: [
37
- /* @__PURE__ */ jsx(SelectParts.ValueText, {}),
38
- /* @__PURE__ */ jsx(HStack, { children: /* @__PURE__ */ jsx(SelectParts.Indicator, { children: /* @__PURE__ */ jsx(Icon, {}) }) })
39
- ]
40
- }
41
- ) }),
42
- /* @__PURE__ */ jsx(SelectParts.Positioner, { children: /* @__PURE__ */ jsx(SelectParts.Content, { minW: "7rem", children: /* @__PURE__ */ jsx(For, { each: collection.items, children: (item) => /* @__PURE__ */ jsx(Option, { item }, item.value) }) }) })
43
- ]
44
- }
45
- ) }) });
10
+ const state = useDataGridContext();
11
+ const { icons } = useCerberusContext();
12
+ const pageSize = useRead(state.pageSize);
13
+ const range = useRead(state.pageRange);
14
+ const Icon = icons.caretDown;
15
+ const collection = createSelectCollection(range.map((size) => {
16
+ const sizeStr = String(size);
17
+ return {
18
+ value: sizeStr,
19
+ label: sizeStr
20
+ };
21
+ }));
22
+ return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Field, {
23
+ label: "Select a page size",
24
+ hideLabel: true,
25
+ flexDirection: "row",
26
+ children: /* @__PURE__ */ jsxs(SelectParts.Root, {
27
+ ...props,
28
+ collection,
29
+ defaultValue: [String(pageSize)],
30
+ size: "sm",
31
+ children: [/* @__PURE__ */ jsx(SelectParts.Control, { children: /* @__PURE__ */ jsxs(SelectParts.Trigger, {
32
+ border: "none",
33
+ minW: "initial",
34
+ gap: "xs",
35
+ ps: "0",
36
+ pe: "0",
37
+ children: [/* @__PURE__ */ jsx(SelectParts.ValueText, {}), /* @__PURE__ */ jsx(HStack, { children: /* @__PURE__ */ jsx(SelectParts.Indicator, { children: /* @__PURE__ */ jsx(Icon, {}) }) })]
38
+ }) }), /* @__PURE__ */ jsx(SelectParts.Positioner, { children: /* @__PURE__ */ jsx(SelectParts.Content, {
39
+ minW: "7rem",
40
+ children: /* @__PURE__ */ jsx(For, {
41
+ each: collection.items,
42
+ children: (item) => /* @__PURE__ */ jsx(Option, { item }, item.value)
43
+ })
44
+ }) })]
45
+ })
46
+ }) });
46
47
  }
47
-
48
+ //#endregion
48
49
  export { CountMenu };
@@ -1,85 +1,92 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const jsxRuntime = require('react/jsx-runtime');
7
- const react$1 = require('@cerberus-design/react');
8
- const signals = require('@cerberus-design/signals');
9
- const react = require('react');
10
- const jsx = require('styled-system/jsx');
11
- const _const = require('../const.cjs');
12
- const context_client = require('../context.client.cjs');
13
- const store = require('../store.cjs');
14
- const grid_client = require('./grid.client.cjs');
15
- const pagination_client = require('./pagination.client.cjs');
16
-
1
+ "use client";
2
+ "use client";
3
+ const require_const = require("../const.cjs");
4
+ const require_context_client = require("../context.client.cjs");
5
+ const require_store = require("../store.cjs");
6
+ const require_grid_client = require("./grid.client.cjs");
7
+ const require_pagination_client = require("./pagination.client.cjs");
8
+ let _cerberus_design_react = require("@cerberus-design/react");
9
+ let _cerberus_design_signals = require("@cerberus-design/signals");
10
+ let react = require("react");
11
+ let styled_system_jsx = require("styled-system/jsx");
12
+ let react_jsx_runtime = require("react/jsx-runtime");
13
+ //#region src/components/data-grid.client.tsx
17
14
  function DataGridEl(props) {
18
- const { data } = props;
19
- const store$1 = react.useMemo(
20
- () => store.createGridStore({
21
- data,
22
- columns: props.columns,
23
- initialState: props.initialState,
24
- rowSize: props.rowSize,
25
- onPageChange: props.onPageChange
26
- }),
27
- // eslint-disable-next-line react-hooks/exhaustive-deps
28
- []
29
- );
30
- const [ready, setReady] = signals.useSignal(false);
31
- const rootRef = react.useRef(null);
32
- react.useEffect(() => {
33
- store$1.updateData(data);
34
- }, [data, store$1]);
35
- react.useEffect(() => {
36
- const el = rootRef.current;
37
- if (!el) return;
38
- const observer = new ResizeObserver((entries) => {
39
- for (const entry of entries) {
40
- store$1.setContainerWidth(entry.contentRect.width);
41
- }
42
- });
43
- observer.observe(el);
44
- const cleanupSignalEffect = signals.createEffect(() => {
45
- Object.entries(store$1.rootCssVars()).forEach(([key, val]) => {
46
- el.style.setProperty(key, val);
47
- });
48
- });
49
- setReady(true);
50
- return () => {
51
- observer.disconnect();
52
- cleanupSignalEffect();
53
- };
54
- }, [store$1, setReady]);
55
- return /* @__PURE__ */ jsxRuntime.jsxs(context_client.DataGridProvider, { createStore: () => store$1, children: [
56
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Show, { when: props.toolbar, children: () => /* @__PURE__ */ jsxRuntime.jsx(jsx.HStack, { "data-scope": _const.SCOPE, "data-part": _const.PARTS.TOOLBAR, w: "full", children: props.toolbar }) }),
57
- /* @__PURE__ */ jsxRuntime.jsxs(
58
- jsx.Stack,
59
- {
60
- "data-scope": _const.SCOPE,
61
- "data-part": _const.PARTS.ROOT,
62
- dir: "columns",
63
- maxH: "inherit",
64
- minH: "inherit",
65
- gap: "0",
66
- h: "full",
67
- bgColor: "page.surface.100/55",
68
- border: "1px solid",
69
- borderColor: "page.border.initial",
70
- rounded: "lg",
71
- overflow: "hidden",
72
- w: "full",
73
- ref: rootRef,
74
- children: [
75
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Show, { when: ready, children: () => /* @__PURE__ */ jsxRuntime.jsx(grid_client.GridViewport, {}) }),
76
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Show, { when: props.footer, children: () => /* @__PURE__ */ jsxRuntime.jsx(jsx.HStack, { "data-scope": _const.SCOPE, "data-part": _const.PARTS.FOOTER, w: "full", children: props.footer }) }),
77
- /* @__PURE__ */ jsxRuntime.jsx(pagination_client.GridPagination, {})
78
- ]
79
- }
80
- )
81
- ] });
15
+ const { data } = props;
16
+ const store = (0, react.useMemo)(() => require_store.createGridStore({
17
+ data,
18
+ columns: props.columns,
19
+ initialState: props.initialState,
20
+ rowSize: props.rowSize,
21
+ onPageChange: props.onPageChange
22
+ }), []);
23
+ const [ready, setReady] = (0, _cerberus_design_signals.useSignal)(false);
24
+ const rootRef = (0, react.useRef)(null);
25
+ (0, react.useEffect)(() => {
26
+ store.updateData(data);
27
+ }, [data, store]);
28
+ (0, react.useEffect)(() => {
29
+ const el = rootRef.current;
30
+ if (!el) return;
31
+ const observer = new ResizeObserver((entries) => {
32
+ for (const entry of entries) store.setContainerWidth(entry.contentRect.width);
33
+ });
34
+ observer.observe(el);
35
+ const cleanupSignalEffect = (0, _cerberus_design_signals.createEffect)(() => {
36
+ Object.entries(store.rootCssVars()).forEach(([key, val]) => {
37
+ el.style.setProperty(key, val);
38
+ });
39
+ });
40
+ setReady(true);
41
+ return () => {
42
+ observer.disconnect();
43
+ cleanupSignalEffect();
44
+ };
45
+ }, [store, setReady]);
46
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_context_client.DataGridProvider, {
47
+ createStore: () => store,
48
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.Show, {
49
+ when: props.toolbar,
50
+ children: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(styled_system_jsx.HStack, {
51
+ "data-scope": require_const.SCOPE,
52
+ "data-part": require_const.PARTS.TOOLBAR,
53
+ w: "full",
54
+ children: props.toolbar
55
+ })
56
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(styled_system_jsx.Stack, {
57
+ "data-scope": require_const.SCOPE,
58
+ "data-part": require_const.PARTS.ROOT,
59
+ dir: "columns",
60
+ maxH: "inherit",
61
+ minH: "inherit",
62
+ gap: "0",
63
+ h: "full",
64
+ bgColor: "page.surface.100/55",
65
+ border: "1px solid",
66
+ borderColor: "page.border.initial",
67
+ rounded: "lg",
68
+ overflow: "hidden",
69
+ w: "full",
70
+ ref: rootRef,
71
+ children: [
72
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.Show, {
73
+ when: ready,
74
+ children: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_grid_client.GridViewport, {})
75
+ }),
76
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.Show, {
77
+ when: props.footer,
78
+ children: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(styled_system_jsx.HStack, {
79
+ "data-scope": require_const.SCOPE,
80
+ "data-part": require_const.PARTS.FOOTER,
81
+ w: "full",
82
+ children: props.footer
83
+ })
84
+ }),
85
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_pagination_client.GridPagination, {})
86
+ ]
87
+ })]
88
+ });
82
89
  }
83
- const DataGrid = react.memo(DataGridEl);
84
-
90
+ var DataGrid = (0, react.memo)(DataGridEl);
91
+ //#endregion
85
92
  exports.DataGrid = DataGrid;