@umami/react-zen 0.94.0 → 0.96.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/dist/index.d.ts +5 -3
- package/dist/index.js +4 -2
- package/dist/index.mjs +4 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -433,18 +433,20 @@ declare module '@umami/react-zen/Dialog' {
|
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
declare module '@umami/react-zen/DataTable' {
|
|
436
|
-
import { ReactNode } from 'react';
|
|
437
|
-
import {
|
|
436
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
437
|
+
import { TableProps } from 'react-aria-components';
|
|
438
438
|
export interface DataTableProps extends TableProps {
|
|
439
439
|
data?: any[];
|
|
440
440
|
}
|
|
441
441
|
export function DataTable({ data, className, children, ...props }: DataTableProps): import("react").JSX.Element;
|
|
442
|
-
export interface DataColumnProps extends
|
|
442
|
+
export interface DataColumnProps extends Omit<HTMLAttributes<any>, 'children'> {
|
|
443
443
|
id: string;
|
|
444
444
|
label?: ReactNode;
|
|
445
445
|
align?: 'start' | 'center' | 'end';
|
|
446
|
+
width?: string;
|
|
446
447
|
as?: string;
|
|
447
448
|
hidden?: boolean;
|
|
449
|
+
children?: ReactNode | ((props: DataColumnProps) => void);
|
|
448
450
|
}
|
|
449
451
|
export function DataColumn(props: DataColumnProps): null;
|
|
450
452
|
}
|
package/dist/index.js
CHANGED
|
@@ -30346,12 +30346,14 @@ var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
|
30346
30346
|
var import_react180 = require("react");
|
|
30347
30347
|
function DataTable({ data = [], className, children, ...props }) {
|
|
30348
30348
|
const items = data.length && data?.[0]?.id === void 0 ? data.map((record, id) => ({ ...record, id })) : data;
|
|
30349
|
+
const widths = [];
|
|
30349
30350
|
const columns = import_react179.Children.map(children, (child) => {
|
|
30351
|
+
widths.push(child?.props?.width || "1fr");
|
|
30350
30352
|
return { ...child.props };
|
|
30351
30353
|
});
|
|
30352
|
-
const gridTemplateColumns2 =
|
|
30354
|
+
const gridTemplateColumns2 = widths.join(" ");
|
|
30353
30355
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Table2, { ...props, className: (0, import_classnames24.default)(DataTable_default.datatable, className), children: [
|
|
30354
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.filter((n) => n).map(({ id, label, as, hidden, ...columnProps }) => {
|
|
30356
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.filter((n) => n).map(({ id, label, as, hidden, width, ...columnProps }) => {
|
|
30355
30357
|
if (hidden) {
|
|
30356
30358
|
return null;
|
|
30357
30359
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -30235,12 +30235,14 @@ import { jsx as jsx33, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
|
30235
30235
|
import { createElement as createElement6 } from "react";
|
|
30236
30236
|
function DataTable({ data = [], className, children, ...props }) {
|
|
30237
30237
|
const items = data.length && data?.[0]?.id === void 0 ? data.map((record, id) => ({ ...record, id })) : data;
|
|
30238
|
+
const widths = [];
|
|
30238
30239
|
const columns = Children2.map(children, (child) => {
|
|
30240
|
+
widths.push(child?.props?.width || "1fr");
|
|
30239
30241
|
return { ...child.props };
|
|
30240
30242
|
});
|
|
30241
|
-
const gridTemplateColumns2 =
|
|
30243
|
+
const gridTemplateColumns2 = widths.join(" ");
|
|
30242
30244
|
return /* @__PURE__ */ jsxs16(Table2, { ...props, className: (0, import_classnames24.default)(DataTable_default.datatable, className), children: [
|
|
30243
|
-
/* @__PURE__ */ jsx33(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.filter((n) => n).map(({ id, label, as, hidden, ...columnProps }) => {
|
|
30245
|
+
/* @__PURE__ */ jsx33(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.filter((n) => n).map(({ id, label, as, hidden, width, ...columnProps }) => {
|
|
30244
30246
|
if (hidden) {
|
|
30245
30247
|
return null;
|
|
30246
30248
|
}
|