@ceed/ads 0.0.30 → 0.0.31

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.
@@ -21,5 +21,5 @@ declare const Button: React.ForwardRefExoticComponent<Omit<{
21
21
  loadingPosition?: "center" | "end" | "start" | undefined;
22
22
  } & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
23
23
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
24
- }, "color" | "tabIndex" | "variant" | "sx" | "disabled" | "size" | "component" | keyof import("@mui/joy").ButtonSlotsAndSlotProps | "action" | "endDecorator" | "focusVisibleClassName" | "fullWidth" | "startDecorator" | "loading" | "loadingIndicator" | "loadingPosition"> & MotionProps, "ref"> & React.RefAttributes<unknown>>;
24
+ }, "color" | "tabIndex" | "variant" | "sx" | "disabled" | "size" | "component" | keyof import("@mui/joy").ButtonSlotsAndSlotProps | "action" | "endDecorator" | "focusVisibleClassName" | "fullWidth" | "startDecorator" | "loading" | "loadingIndicator" | "loadingPosition"> & MotionProps, "ref"> & React.RefAttributes<HTMLElement>>;
25
25
  export { Button };
@@ -13,7 +13,7 @@ import React, { forwardRef } from "react";
13
13
  import { Button as JoyButton } from "@mui/joy";
14
14
  import { motion } from "framer-motion";
15
15
  var MotionButton = motion(JoyButton);
16
- var Button = forwardRef(function (props) {
16
+ var Button = forwardRef(function (props, ref) {
17
17
  // prop destruction
18
18
  // lib hooks
19
19
  // state, ref, querystring hooks
@@ -22,7 +22,7 @@ var Button = forwardRef(function (props) {
22
22
  // calculated values
23
23
  // effects
24
24
  // handlers
25
- return (React.createElement(MotionButton, __assign({}, props)));
25
+ return (React.createElement(MotionButton, __assign({ ref: ref }, props)));
26
26
  });
27
27
  export { Button };
28
28
  Button.displayName = "Button";
@@ -94,6 +94,20 @@ var Resizer = function (ref) { return (React.createElement(Box, { sx: {
94
94
  document.addEventListener("mousemove", onMouseMove);
95
95
  document.addEventListener("mouseup", onMouseUp);
96
96
  } })); };
97
+ var HeadCell = function (props) {
98
+ var _a, _b, _c;
99
+ var ref = useRef(null);
100
+ var style = {
101
+ width: props.width,
102
+ minWidth: (_a = props.minWidth) !== null && _a !== void 0 ? _a : "50px",
103
+ maxWidth: props.maxWidth,
104
+ textAlign: props.type === "number" ? "end" : "start",
105
+ position: props.stickyHeader ? undefined : "relative",
106
+ };
107
+ var resizer = ((_b = props.resizable) !== null && _b !== void 0 ? _b : true) ? Resizer(ref) : null;
108
+ return (React.createElement("th", { ref: ref, key: props.field, style: style }, (_c = props.headerName) !== null && _c !== void 0 ? _c : props.field,
109
+ resizer));
110
+ };
97
111
  function useDataTableRenderer(_a) {
98
112
  var rows = _a.rows, columns = _a.columns, totalRowsProp = _a.rowCount, paginationModel = _a.paginationModel, onPaginationModelChange = _a.onPaginationModelChange, _b = _a.selectionModel, selectionModel = _b === void 0 ? [] : _b, onSelectionModelChange = _a.onSelectionModelChange, stickyHeader = _a.stickyHeader;
99
113
  var _c = useState((paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.page) || 1), page = _c[0], setPage = _c[1];
@@ -128,20 +142,27 @@ function useDataTableRenderer(_a) {
128
142
  page: page,
129
143
  pageSize: pageSize,
130
144
  onPaginationModelChange: handlePageChange,
131
- getColumnHeader: useCallback(function (column) {
132
- var _a, _b, _c;
133
- var ref = useRef(null);
134
- var style = {
135
- width: column.width,
136
- minWidth: (_a = column.minWidth) !== null && _a !== void 0 ? _a : "50px",
137
- maxWidth: column.maxWidth,
138
- textAlign: column.type === "number" ? "end" : "start",
139
- position: stickyHeader ? undefined : "relative",
140
- };
141
- var resizer = ((_b = column.resizable) !== null && _b !== void 0 ? _b : true) ? Resizer(ref) : null;
142
- return (React.createElement("th", { ref: ref, key: column.field, style: style }, (_c = column.headerName) !== null && _c !== void 0 ? _c : column.field,
143
- resizer));
144
- }, [stickyHeader, columns]),
145
+ HeadCell: HeadCell,
146
+ // HeadCell: useCallback(
147
+ // (column: Column<any>) => {
148
+ // const ref = useRef<HTMLTableCellElement>(null);
149
+ // const style = {
150
+ // width: column.width,
151
+ // minWidth: column.minWidth ?? "50px",
152
+ // maxWidth: column.maxWidth,
153
+ // textAlign: column.type === "number" ? "end" : "start",
154
+ // position: stickyHeader ? undefined : "relative",
155
+ // } as React.CSSProperties;
156
+ // const resizer = column.resizable ?? true ? Resizer(ref) : null;
157
+ // return (
158
+ // <th ref={ref} key={column.field as string} style={style}>
159
+ // {column.headerName ?? (column.field as string)}
160
+ // {resizer}
161
+ // </th>
162
+ // );
163
+ // },
164
+ // [stickyHeader, columns]
165
+ // ),
145
166
  dataInPage: dataInPage,
146
167
  isAllSelected: isAllSelected, // all rows are selected on this page
147
168
  isTotalSelected: isTotalSelected,
@@ -180,7 +201,7 @@ function DataTable(props) {
180
201
  ___ = props.onPaginationModelChange, // onPaginationModelChange is used in useDataTableRenderer
181
202
  paginationModel = props.paginationModel, _a = props.slots, _b = _a === void 0 ? {} : _a, _c = _b.checkbox, RenderCheckbox = _c === void 0 ? Checkbox : _c, Toolbar = _b.toolbar, Footer = _b.footer, _d = props.slotProps, _e = _d === void 0 ? {} : _d, _f = _e.checkbox, checkboxProps = _f === void 0 ? {} : _f, toolbarProps = _e.toolbar, _g = _e.background, backgroundProps = _g === void 0 ? {} : _g, innerProps = __rest(props, ["rows", "checkboxSelection", "selectionModel", "onSelectionModelChange", "rowCount", "columns", "onPaginationModelChange", "paginationModel", "slots", "slotProps"]);
182
203
  // lib hooks
183
- var _h = useDataTableRenderer(props), columns = _h.columns, isAllSelected = _h.isAllSelected, isSelectedRow = _h.isSelectedRow, onAllCheckboxChange = _h.onAllCheckboxChange, onCheckboxChange = _h.onCheckboxChange, rowCount = _h.rowCount, page = _h.page, pageSize = _h.pageSize, onPaginationModelChange = _h.onPaginationModelChange, dataInPage = _h.dataInPage, isTotalSelected = _h.isTotalSelected, onTotalSelect = _h.onTotalSelect, getColumnHeader = _h.getColumnHeader;
204
+ var _h = useDataTableRenderer(props), columns = _h.columns, isAllSelected = _h.isAllSelected, isSelectedRow = _h.isSelectedRow, onAllCheckboxChange = _h.onAllCheckboxChange, onCheckboxChange = _h.onCheckboxChange, rowCount = _h.rowCount, page = _h.page, pageSize = _h.pageSize, onPaginationModelChange = _h.onPaginationModelChange, dataInPage = _h.dataInPage, isTotalSelected = _h.isTotalSelected, onTotalSelect = _h.onTotalSelect, HeadCell = _h.HeadCell;
184
205
  // state, ref, querystring hooks
185
206
  // form hooks
186
207
  // query hooks
@@ -233,7 +254,7 @@ function DataTable(props) {
233
254
  textAlign: "center",
234
255
  } },
235
256
  React.createElement(RenderCheckbox, __assign({ onChange: onAllCheckboxChange, checked: isAllSelected, indeterminate: (selectionModel || []).length > 0 && !isAllSelected }, checkboxProps)))),
236
- columns.map(getColumnHeader))),
257
+ columns.map(function (c) { return (React.createElement(HeadCell, __assign({ key: c.field, stickyHeader: props.stickyHeader }, c))); }))),
237
258
  React.createElement("tbody", null, dataInPage.map(function (row, rowIndex) {
238
259
  var rowId = "".concat(rowIndex + (page - 1) * pageSize);
239
260
  return (React.createElement("tr", { key: rowId, role: checkboxSelection ? "checkbox" : undefined, tabIndex: checkboxSelection ? -1 : undefined, onClick: checkboxSelection
package/framer/index.js CHANGED
@@ -31915,14 +31915,17 @@ var Box_default2 = Box2;
31915
31915
  import { forwardRef as forwardRef75 } from "react";
31916
31916
  import { motion as motion3 } from "framer-motion";
31917
31917
  var MotionButton = motion3(Button_default);
31918
- var Button3 = forwardRef75((props) => {
31919
- return /* @__PURE__ */ jsx2(
31920
- MotionButton,
31921
- {
31922
- ...props
31923
- }
31924
- );
31925
- });
31918
+ var Button3 = forwardRef75(
31919
+ (props, ref) => {
31920
+ return /* @__PURE__ */ jsx2(
31921
+ MotionButton,
31922
+ {
31923
+ ref,
31924
+ ...props
31925
+ }
31926
+ );
31927
+ }
31928
+ );
31926
31929
  Button3.displayName = "Button";
31927
31930
 
31928
31931
  // src/components/Button/index.ts
@@ -32244,6 +32247,21 @@ var Resizer = (ref) => /* @__PURE__ */ jsx2(
32244
32247
  }
32245
32248
  }
32246
32249
  );
32250
+ var HeadCell = (props) => {
32251
+ const ref = useRef40(null);
32252
+ const style4 = {
32253
+ width: props.width,
32254
+ minWidth: props.minWidth ?? "50px",
32255
+ maxWidth: props.maxWidth,
32256
+ textAlign: props.type === "number" ? "end" : "start",
32257
+ position: props.stickyHeader ? void 0 : "relative"
32258
+ };
32259
+ const resizer = props.resizable ?? true ? Resizer(ref) : null;
32260
+ return /* @__PURE__ */ jsxs2("th", { ref, style: style4, children: [
32261
+ props.headerName ?? props.field,
32262
+ resizer
32263
+ ] }, props.field);
32264
+ };
32247
32265
  function useDataTableRenderer({
32248
32266
  rows,
32249
32267
  columns,
@@ -32298,24 +32316,27 @@ function useDataTableRenderer({
32298
32316
  page,
32299
32317
  pageSize,
32300
32318
  onPaginationModelChange: handlePageChange,
32301
- getColumnHeader: useCallback23(
32302
- (column2) => {
32303
- const ref = useRef40(null);
32304
- const style4 = {
32305
- width: column2.width,
32306
- minWidth: column2.minWidth ?? "50px",
32307
- maxWidth: column2.maxWidth,
32308
- textAlign: column2.type === "number" ? "end" : "start",
32309
- position: stickyHeader ? void 0 : "relative"
32310
- };
32311
- const resizer = column2.resizable ?? true ? Resizer(ref) : null;
32312
- return /* @__PURE__ */ jsxs2("th", { ref, style: style4, children: [
32313
- column2.headerName ?? column2.field,
32314
- resizer
32315
- ] }, column2.field);
32316
- },
32317
- [stickyHeader, columns]
32318
- ),
32319
+ HeadCell,
32320
+ // HeadCell: useCallback(
32321
+ // (column: Column<any>) => {
32322
+ // const ref = useRef<HTMLTableCellElement>(null);
32323
+ // const style = {
32324
+ // width: column.width,
32325
+ // minWidth: column.minWidth ?? "50px",
32326
+ // maxWidth: column.maxWidth,
32327
+ // textAlign: column.type === "number" ? "end" : "start",
32328
+ // position: stickyHeader ? undefined : "relative",
32329
+ // } as React.CSSProperties;
32330
+ // const resizer = column.resizable ?? true ? Resizer(ref) : null;
32331
+ // return (
32332
+ // <th ref={ref} key={column.field as string} style={style}>
32333
+ // {column.headerName ?? (column.field as string)}
32334
+ // {resizer}
32335
+ // </th>
32336
+ // );
32337
+ // },
32338
+ // [stickyHeader, columns]
32339
+ // ),
32319
32340
  dataInPage,
32320
32341
  isAllSelected,
32321
32342
  // all rows are selected on this page
@@ -32395,7 +32416,7 @@ function DataTable(props) {
32395
32416
  dataInPage,
32396
32417
  isTotalSelected,
32397
32418
  onTotalSelect,
32398
- getColumnHeader
32419
+ HeadCell: HeadCell2
32399
32420
  } = useDataTableRenderer(props);
32400
32421
  return /* @__PURE__ */ jsxs2(Box_default2, { children: [
32401
32422
  /* @__PURE__ */ jsxs2(
@@ -32489,7 +32510,14 @@ function DataTable(props) {
32489
32510
  )
32490
32511
  }
32491
32512
  ),
32492
- columns.map(getColumnHeader)
32513
+ columns.map((c) => /* @__PURE__ */ jsx2(
32514
+ HeadCell2,
32515
+ {
32516
+ stickyHeader: props.stickyHeader,
32517
+ ...c
32518
+ },
32519
+ c.field
32520
+ ))
32493
32521
  ] }) }),
32494
32522
  /* @__PURE__ */ jsx2("tbody", { children: dataInPage.map((row, rowIndex) => {
32495
32523
  const rowId = `${rowIndex + (page - 1) * pageSize}`;
@@ -33139,10 +33167,10 @@ var dataTablePropertyControls = {
33139
33167
  },
33140
33168
  defaultValue: []
33141
33169
  },
33142
- pageSize: {
33143
- type: ControlType7.Number,
33144
- defaultValue: 20
33145
- },
33170
+ // pageSize: {
33171
+ // type: ControlType.Number,
33172
+ // defaultValue: 20,
33173
+ // },
33146
33174
  stickyHeader: {
33147
33175
  type: ControlType7.Boolean,
33148
33176
  defaultValue: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ceed/ads",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "description": "UI tool for Ecube Labs front-end developers",