@flytedan/flytebot-design-system 0.67.4 → 0.68.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.cjs +67 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +67 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +31 -8
package/dist/index.cjs
CHANGED
|
@@ -4193,6 +4193,24 @@ function CsiHero({ band = "weak", crp, label, className = "" }) {
|
|
|
4193
4193
|
// src/components/data/DataTable.tsx
|
|
4194
4194
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4195
4195
|
var STACK_MAX_WIDTH = 640;
|
|
4196
|
+
function RowActionButton({ action, size }) {
|
|
4197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4198
|
+
IconButton,
|
|
4199
|
+
{
|
|
4200
|
+
icon: action.icon,
|
|
4201
|
+
label: action.label,
|
|
4202
|
+
size,
|
|
4203
|
+
disabled: action.disabled,
|
|
4204
|
+
onClick: (e) => {
|
|
4205
|
+
e.stopPropagation();
|
|
4206
|
+
action.onClick();
|
|
4207
|
+
}
|
|
4208
|
+
}
|
|
4209
|
+
);
|
|
4210
|
+
}
|
|
4211
|
+
function RowActionCell({ action }) {
|
|
4212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("td", { className: "fd-table-action", children: action ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(RowActionButton, { action, size: "sm" }) : null });
|
|
4213
|
+
}
|
|
4196
4214
|
var cellOf = (c, row) => c.render ? c.render(row) : row[c.key];
|
|
4197
4215
|
function rowInteraction(row, onRowClick) {
|
|
4198
4216
|
if (!onRowClick) return {};
|
|
@@ -4220,6 +4238,7 @@ function DataTable({
|
|
|
4220
4238
|
selectedIds,
|
|
4221
4239
|
rowTitle,
|
|
4222
4240
|
onRowClick,
|
|
4241
|
+
rowAction,
|
|
4223
4242
|
rowKey = "id",
|
|
4224
4243
|
loading = false,
|
|
4225
4244
|
refreshing = false,
|
|
@@ -4256,27 +4275,37 @@ function DataTable({
|
|
|
4256
4275
|
onSort,
|
|
4257
4276
|
rowTitle,
|
|
4258
4277
|
onRowClick,
|
|
4278
|
+
rowAction,
|
|
4259
4279
|
isSelected
|
|
4260
4280
|
}
|
|
4261
4281
|
) : /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("table", { className: ["fd-table", compact3 ? "fd-table-compact" : ""].filter(Boolean).join(" "), children: [
|
|
4262
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime44.
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4282
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("tr", { children: [
|
|
4283
|
+
columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4284
|
+
"th",
|
|
4285
|
+
{
|
|
4286
|
+
scope: "col",
|
|
4287
|
+
style: { width: c.width },
|
|
4288
|
+
className: [c.numeric ? "is-num" : "", sort && sort.key === c.key ? "is-sorted" : ""].filter(Boolean).join(" "),
|
|
4289
|
+
"aria-sort": sort && sort.key === c.key ? sort.dir === "asc" ? "ascending" : "descending" : void 0,
|
|
4290
|
+
children: c.sortable && onSort ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SortButton, { column: c, sort, onSort }) : c.label
|
|
4291
|
+
},
|
|
4292
|
+
c.key
|
|
4293
|
+
)),
|
|
4294
|
+
rowAction ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("th", { scope: "col", className: "fd-table-action-head", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "fd-sr-only", children: "Actions" }) }) : null
|
|
4295
|
+
] }) }),
|
|
4296
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("tbody", { className: stale ? "fd-stale" : void 0, children: loading ? Array.from({ length: skeletonRows }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("tr", { children: [
|
|
4297
|
+
columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("td", { className: c.numeric ? "is-num" : "", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "fd-skel fd-skel-text", style: { display: "inline-block", height: 13, width: c.numeric ? 52 : i % 3 === 0 ? "72%" : "88%" } }) }, c.key)),
|
|
4298
|
+
rowAction ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("td", { className: "fd-table-action" }) : null
|
|
4299
|
+
] }, i)) : rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
4274
4300
|
"tr",
|
|
4275
4301
|
{
|
|
4276
4302
|
"aria-selected": isSelected(r) ? "true" : void 0,
|
|
4277
4303
|
title: rowTitle ? rowTitle(r) : void 0,
|
|
4278
4304
|
...rowInteraction(r, onRowClick),
|
|
4279
|
-
children:
|
|
4305
|
+
children: [
|
|
4306
|
+
columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("td", { className: c.numeric ? "is-num" : "", children: cellOf(c, r) }, c.key)),
|
|
4307
|
+
rowAction ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(RowActionCell, { action: rowAction(r) }) : null
|
|
4308
|
+
]
|
|
4280
4309
|
},
|
|
4281
4310
|
r[rowKey]
|
|
4282
4311
|
)) })
|
|
@@ -4289,7 +4318,7 @@ function DataTable({
|
|
|
4289
4318
|
] }) }) : null
|
|
4290
4319
|
] });
|
|
4291
4320
|
}
|
|
4292
|
-
function StackedRows({ columns, rows, rowKey, loading, stale, skeletonRows, sort, onSort, rowTitle, onRowClick, isSelected }) {
|
|
4321
|
+
function StackedRows({ columns, rows, rowKey, loading, stale, skeletonRows, sort, onSort, rowTitle, onRowClick, rowAction, isSelected }) {
|
|
4293
4322
|
const sortable = onSort ? columns.filter((c) => c.sortable) : [];
|
|
4294
4323
|
const primary = columns.filter((c) => c.phone === "primary");
|
|
4295
4324
|
const secondary = columns.filter((c) => c.phone === "secondary");
|
|
@@ -4308,31 +4337,34 @@ function StackedRows({ columns, rows, rowKey, loading, stale, skeletonRows, sort
|
|
|
4308
4337
|
c.key
|
|
4309
4338
|
);
|
|
4310
4339
|
}) }) : null,
|
|
4311
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: stale ? "fd-dt-cards fd-stale" : "fd-dt-cards", children: loading ? Array.from({ length: skeletonRows }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "fd-dt-card", children: [
|
|
4340
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: stale ? "fd-dt-cards fd-stale" : "fd-dt-cards", children: loading ? Array.from({ length: skeletonRows }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fd-dt-item", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "fd-dt-card", children: [
|
|
4312
4341
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: 14, width: i % 3 === 0 ? "55%" : "70%" } }),
|
|
4313
4342
|
secondary.length ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: 12, width: "40%" } }) : null
|
|
4314
|
-
] }, i)) : rows.map((r) => {
|
|
4343
|
+
] }) }, i)) : rows.map((r) => {
|
|
4315
4344
|
const selected = isSelected(r);
|
|
4345
|
+
const action = rowAction ? rowAction(r) : null;
|
|
4316
4346
|
const semantics = onRowClick ? { role: "button", "aria-pressed": selected } : { "aria-current": selected ? "true" : void 0 };
|
|
4317
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "fd-dt-item", children: [
|
|
4348
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
4349
|
+
"div",
|
|
4350
|
+
{
|
|
4351
|
+
className: "fd-dt-card",
|
|
4352
|
+
title: rowTitle ? rowTitle(r) : void 0,
|
|
4353
|
+
"data-selected": selected ? "true" : void 0,
|
|
4354
|
+
...semantics,
|
|
4355
|
+
...rowInteraction(r, onRowClick),
|
|
4356
|
+
children: [
|
|
4357
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fd-dt-card-title", children: primary.map((c) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: c.numeric ? "is-num" : void 0, children: cellOf(c, r) }, c.key)) }),
|
|
4358
|
+
secondary.length ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fd-dt-card-meta", children: secondary.map((c) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: c.numeric ? "is-num" : void 0, children: [
|
|
4359
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "fd-dt-card-label", children: c.label }),
|
|
4360
|
+
" ",
|
|
4361
|
+
cellOf(c, r)
|
|
4362
|
+
] }, c.key)) }) : null
|
|
4363
|
+
]
|
|
4364
|
+
}
|
|
4365
|
+
),
|
|
4366
|
+
action ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fd-dt-action", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(RowActionButton, { action, size: "md" }) }) : null
|
|
4367
|
+
] }, r[rowKey]);
|
|
4336
4368
|
}) })
|
|
4337
4369
|
] });
|
|
4338
4370
|
}
|