@umami/react-zen 0.192.0 → 0.194.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.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +17 -2
- package/dist/index.mjs +17 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -406,16 +406,17 @@ declare function Grid({ display, justifyContent, justifyItems, alignContent, ali
|
|
|
406
406
|
interface DataCardProps extends GridProps {
|
|
407
407
|
data?: {
|
|
408
408
|
id: string;
|
|
409
|
-
label:
|
|
410
|
-
value:
|
|
409
|
+
label: ReactNode;
|
|
410
|
+
value: any;
|
|
411
411
|
}[];
|
|
412
412
|
}
|
|
413
413
|
declare function DataCard({ data, ...props }: DataCardProps): react.JSX.Element;
|
|
414
414
|
|
|
415
415
|
interface DataTableProps extends TableProps {
|
|
416
416
|
data?: any[];
|
|
417
|
+
displayMode?: 'table' | 'cards';
|
|
417
418
|
}
|
|
418
|
-
declare function DataTable({ data, className, children, ...props }: DataTableProps): react.JSX.Element;
|
|
419
|
+
declare function DataTable({ data, displayMode, className, children, ...props }: DataTableProps): react.JSX.Element;
|
|
419
420
|
interface DataColumnProps extends Omit<HTMLAttributes<any>, 'children'> {
|
|
420
421
|
id: string;
|
|
421
422
|
label?: ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -406,16 +406,17 @@ declare function Grid({ display, justifyContent, justifyItems, alignContent, ali
|
|
|
406
406
|
interface DataCardProps extends GridProps {
|
|
407
407
|
data?: {
|
|
408
408
|
id: string;
|
|
409
|
-
label:
|
|
410
|
-
value:
|
|
409
|
+
label: ReactNode;
|
|
410
|
+
value: any;
|
|
411
411
|
}[];
|
|
412
412
|
}
|
|
413
413
|
declare function DataCard({ data, ...props }: DataCardProps): react.JSX.Element;
|
|
414
414
|
|
|
415
415
|
interface DataTableProps extends TableProps {
|
|
416
416
|
data?: any[];
|
|
417
|
+
displayMode?: 'table' | 'cards';
|
|
417
418
|
}
|
|
418
|
-
declare function DataTable({ data, className, children, ...props }: DataTableProps): react.JSX.Element;
|
|
419
|
+
declare function DataTable({ data, displayMode, className, children, ...props }: DataTableProps): react.JSX.Element;
|
|
419
420
|
interface DataColumnProps extends Omit<HTMLAttributes<any>, 'children'> {
|
|
420
421
|
id: string;
|
|
421
422
|
label?: ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -33275,7 +33275,7 @@ var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
|
33275
33275
|
function DataCard({ data = [], ...props }) {
|
|
33276
33276
|
const rows = mapIdProperty(data);
|
|
33277
33277
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Grid, { width: "100%", ...props, children: rows.map((row) => {
|
|
33278
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Grid, { columns: "180px 1fr", border: "bottom", gapX: "3", children: [
|
|
33278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Grid, { columns: "180px 1fr", border: "bottom", borderColor: "4", gapX: "3", children: [
|
|
33279
33279
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Row, { paddingY: "3", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { size: "3", weight: "bold", children: row?.label }) }),
|
|
33280
33280
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Row, { paddingY: "3", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { size: "3", children: row?.value }) })
|
|
33281
33281
|
] }, row?.id);
|
|
@@ -33344,7 +33344,13 @@ var DataTable_default = { "datatable": "DataTable_datatable__MWRkN", "cell": "Da
|
|
|
33344
33344
|
// src/components/DataTable.tsx
|
|
33345
33345
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
33346
33346
|
var import_react189 = require("react");
|
|
33347
|
-
function DataTable({
|
|
33347
|
+
function DataTable({
|
|
33348
|
+
data = [],
|
|
33349
|
+
displayMode = "table",
|
|
33350
|
+
className,
|
|
33351
|
+
children,
|
|
33352
|
+
...props
|
|
33353
|
+
}) {
|
|
33348
33354
|
const rows = mapIdProperty(data);
|
|
33349
33355
|
const widths = [];
|
|
33350
33356
|
const columns = import_react188.Children.map(children, (child) => {
|
|
@@ -33355,6 +33361,15 @@ function DataTable({ data = [], className, children, ...props }) {
|
|
|
33355
33361
|
return null;
|
|
33356
33362
|
})?.filter((n) => n);
|
|
33357
33363
|
const gridTemplateColumns2 = widths.join(" ");
|
|
33364
|
+
if (displayMode === "cards") {
|
|
33365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Grid, { gap: "6", width: "100%", children: rows.map((row, index) => {
|
|
33366
|
+
const items = columns?.filter(({ hidden }) => !hidden).map(({ id, label, children: children2 }) => {
|
|
33367
|
+
const value = typeof children2 === "function" ? children2(row, index) : children2 ?? row[id];
|
|
33368
|
+
return { id, label, value };
|
|
33369
|
+
});
|
|
33370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DataCard, { data: items }, row.id);
|
|
33371
|
+
}) });
|
|
33372
|
+
}
|
|
33358
33373
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Table2, { ...props, className: (0, import_classnames28.default)(DataTable_default.datatable, className), children: [
|
|
33359
33374
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns?.map(({ id, label, as, hidden, width, ...columnProps }) => {
|
|
33360
33375
|
if (hidden) {
|
package/dist/index.mjs
CHANGED
|
@@ -33153,7 +33153,7 @@ import { jsx as jsx41, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
|
33153
33153
|
function DataCard({ data = [], ...props }) {
|
|
33154
33154
|
const rows = mapIdProperty(data);
|
|
33155
33155
|
return /* @__PURE__ */ jsx41(Grid, { width: "100%", ...props, children: rows.map((row) => {
|
|
33156
|
-
return /* @__PURE__ */ jsxs22(Grid, { columns: "180px 1fr", border: "bottom", gapX: "3", children: [
|
|
33156
|
+
return /* @__PURE__ */ jsxs22(Grid, { columns: "180px 1fr", border: "bottom", borderColor: "4", gapX: "3", children: [
|
|
33157
33157
|
/* @__PURE__ */ jsx41(Row, { paddingY: "3", children: /* @__PURE__ */ jsx41(Text, { size: "3", weight: "bold", children: row?.label }) }),
|
|
33158
33158
|
/* @__PURE__ */ jsx41(Row, { paddingY: "3", children: /* @__PURE__ */ jsx41(Text, { size: "3", children: row?.value }) })
|
|
33159
33159
|
] }, row?.id);
|
|
@@ -33222,7 +33222,13 @@ var DataTable_default = { "datatable": "DataTable_datatable__MWRkN", "cell": "Da
|
|
|
33222
33222
|
// src/components/DataTable.tsx
|
|
33223
33223
|
import { jsx as jsx43, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
33224
33224
|
import { createElement as createElement8 } from "react";
|
|
33225
|
-
function DataTable({
|
|
33225
|
+
function DataTable({
|
|
33226
|
+
data = [],
|
|
33227
|
+
displayMode = "table",
|
|
33228
|
+
className,
|
|
33229
|
+
children,
|
|
33230
|
+
...props
|
|
33231
|
+
}) {
|
|
33226
33232
|
const rows = mapIdProperty(data);
|
|
33227
33233
|
const widths = [];
|
|
33228
33234
|
const columns = Children2.map(children, (child) => {
|
|
@@ -33233,6 +33239,15 @@ function DataTable({ data = [], className, children, ...props }) {
|
|
|
33233
33239
|
return null;
|
|
33234
33240
|
})?.filter((n) => n);
|
|
33235
33241
|
const gridTemplateColumns2 = widths.join(" ");
|
|
33242
|
+
if (displayMode === "cards") {
|
|
33243
|
+
return /* @__PURE__ */ jsx43(Grid, { gap: "6", width: "100%", children: rows.map((row, index) => {
|
|
33244
|
+
const items = columns?.filter(({ hidden }) => !hidden).map(({ id, label, children: children2 }) => {
|
|
33245
|
+
const value = typeof children2 === "function" ? children2(row, index) : children2 ?? row[id];
|
|
33246
|
+
return { id, label, value };
|
|
33247
|
+
});
|
|
33248
|
+
return /* @__PURE__ */ jsx43(DataCard, { data: items }, row.id);
|
|
33249
|
+
}) });
|
|
33250
|
+
}
|
|
33236
33251
|
return /* @__PURE__ */ jsxs23(Table2, { ...props, className: (0, import_classnames28.default)(DataTable_default.datatable, className), children: [
|
|
33237
33252
|
/* @__PURE__ */ jsx43(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns?.map(({ id, label, as, hidden, width, ...columnProps }) => {
|
|
33238
33253
|
if (hidden) {
|