@krak-stack/registry 0.11.5 → 0.11.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.
- package/CHANGELOG.md +10 -0
- package/dist/components/audit-log-table/react.js +152 -15
- package/dist/components/data-table/classes.d.ts +9 -3
- package/dist/components/data-table/html.d.ts +81 -9
- package/dist/components/data-table/html.js +113 -26
- package/dist/components/data-table/index.d.ts +97 -9
- package/dist/components/data-table/react.d.ts +14 -3
- package/dist/components/data-table/react.js +152 -15
- package/dist/components/data-table/schema.d.ts +175 -16
- package/dist/components/docs/html.js +1 -1
- package/dist/components/sidebar-layout/html.js +1 -1
- package/dist/components/webhook-delivery-table/html.js +113 -26
- package/dist/components/webhook-delivery-table/react.js +152 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @krak-stack/registry
|
|
2
2
|
|
|
3
|
+
## 0.11.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add an opt-in badge display for text columns in React and Effect UI data tables. Badges support configurable labels, leading icons, and variants, and filter and export by their original values.
|
|
8
|
+
|
|
9
|
+
List columns can also display each item as a badge. Read-only Effect UI lists open a dropdown even when every item fits in the cell.
|
|
10
|
+
- Keep boolean cells as checkboxes in Effect UI tables with row activation, and match inset cell focus styling across React and Effect UI.
|
|
11
|
+
- Expose the collapsed icon state to HTML sidebar headers so organization switchers use their compact styling.
|
|
12
|
+
|
|
3
13
|
## 0.11.5
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -614,6 +614,13 @@ import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
|
614
614
|
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider/react";
|
|
615
615
|
|
|
616
616
|
// ../../src/components/data-table/classes.ts
|
|
617
|
+
var booleanCellControl = "flex min-h-16 w-full items-center justify-start px-2 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0 has-[:focus-visible]:outline-2 has-[:focus-visible]:-outline-offset-2 has-[:focus-visible]:outline-ring";
|
|
618
|
+
var cellTriggerFocus = "focus-visible:ring-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring";
|
|
619
|
+
var tableBadgeTones = {
|
|
620
|
+
success: "border-emerald-200 bg-emerald-100 text-emerald-900 dark:border-emerald-900/50 dark:bg-emerald-950/50 dark:text-emerald-200",
|
|
621
|
+
info: "border-blue-200 bg-blue-100 text-blue-900 dark:border-blue-900/50 dark:bg-blue-950/50 dark:text-blue-200",
|
|
622
|
+
muted: "border-muted bg-muted text-muted-foreground dark:bg-muted/50"
|
|
623
|
+
};
|
|
617
624
|
var tableClasses = {
|
|
618
625
|
selectionCell: "w-10 p-0 align-middle",
|
|
619
626
|
selectionCenter: "grid place-items-center",
|
|
@@ -625,16 +632,16 @@ var tableClasses = {
|
|
|
625
632
|
menubar: "h-auto w-full flex-wrap justify-start border border-input bg-transparent",
|
|
626
633
|
cell: "overflow-hidden",
|
|
627
634
|
cellContent: "min-w-0 wrap-anywhere",
|
|
628
|
-
actionTrigger:
|
|
635
|
+
actionTrigger: `size-8 ${cellTriggerFocus}`,
|
|
629
636
|
actionsCell: "sticky right-0 z-20 w-10 min-w-10 cursor-default bg-background p-0 transition-colors group-hover/row:bg-[color-mix(in_oklab,var(--muted)_50%,var(--background))]",
|
|
630
637
|
actionsAlign: "flex min-h-12 items-center justify-end pe-1",
|
|
631
638
|
header: "relative h-12 p-0",
|
|
632
639
|
stickyHeader: "sticky top-0 z-30 bg-background",
|
|
633
640
|
stickyHeaderRule: "after:border-border after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:border-b",
|
|
634
|
-
headerTrigger:
|
|
641
|
+
headerTrigger: `absolute inset-0 h-full w-full min-w-0 justify-start rounded-none px-2 pe-4 ${cellTriggerFocus}`,
|
|
635
642
|
resizeHandle: "absolute inset-y-0 right-0 z-10 w-2 cursor-col-resize touch-none outline-none after:absolute after:inset-y-3 after:right-0 after:w-px after:bg-border hover:after:w-0.5 hover:after:bg-primary/60 focus-visible:after:w-0.5 focus-visible:after:bg-ring",
|
|
636
643
|
relationshipCell: "grid min-h-16 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0",
|
|
637
|
-
relationshipTrigger:
|
|
644
|
+
relationshipTrigger: `h-full w-full min-w-0 justify-between rounded-none px-2 text-start ${cellTriggerFocus}`,
|
|
638
645
|
reference: "flex min-w-0 items-center gap-2",
|
|
639
646
|
referenceAvatar: "relative grid size-8 shrink-0 place-items-center overflow-hidden bg-muted text-xs font-medium",
|
|
640
647
|
referenceText: "flex min-w-0 flex-col leading-tight",
|
|
@@ -656,7 +663,7 @@ import { Csv } from "effect/encoding";
|
|
|
656
663
|
import { Command, Component as Component2, Subscription, UiSchema as UiSchema2 } from "effect/ui";
|
|
657
664
|
|
|
658
665
|
// ../../src/components/data-table/schema.ts
|
|
659
|
-
import { DateTime as DateTime2, Option as Option2, Schema as Schema4, Struct as Struct2, Tuple } from "effect";
|
|
666
|
+
import { DateTime as DateTime2, Option as Option2, Predicate, Schema as Schema4, Struct as Struct2, Tuple } from "effect";
|
|
660
667
|
var TableClassesOverridesSchema = Schema4.Record(Schema4.Literals(Struct2.keys(tableClasses)), Schema4.optionalKey(Schema4.String)).annotate({ identifier: "TableClassesOverrides" });
|
|
661
668
|
var DataTableCommonPropsSchema = Schema4.Struct({
|
|
662
669
|
classes: Schema4.optional(TableClassesOverridesSchema),
|
|
@@ -764,8 +771,33 @@ var column = {
|
|
|
764
771
|
emptyLabel: Schema4.optionalKey(Schema4.String),
|
|
765
772
|
nulls: Schema4.optionalKey(Schema4.Literals(["first", "last"]))
|
|
766
773
|
};
|
|
774
|
+
var DataTableBadgeOptionSchema = Schema4.Struct({
|
|
775
|
+
value: Schema4.NonEmptyString,
|
|
776
|
+
label: Schema4.optionalKey(Schema4.String),
|
|
777
|
+
variant: Schema4.optionalKey(Schema4.Literals([
|
|
778
|
+
"default",
|
|
779
|
+
"secondary",
|
|
780
|
+
"outline",
|
|
781
|
+
"destructive",
|
|
782
|
+
"success",
|
|
783
|
+
"info",
|
|
784
|
+
"muted"
|
|
785
|
+
]))
|
|
786
|
+
}).annotate({ identifier: "DataTableBadgeOption" });
|
|
787
|
+
var BadgeIcon = Schema4.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "DataTableBadgeIcon" });
|
|
788
|
+
var DataTableBadgeOptionsSchema = Schema4.Struct({
|
|
789
|
+
options: Schema4.optionalKey(Schema4.Array(DataTableBadgeOptionSchema.mapFields((fields) => ({
|
|
790
|
+
...fields,
|
|
791
|
+
icon: Schema4.optionalKey(BadgeIcon)
|
|
792
|
+
}))))
|
|
793
|
+
}).annotate({ identifier: "DataTableBadgeOptions" });
|
|
767
794
|
var DataTableFieldSchema = Schema4.Union([
|
|
768
|
-
Schema4.Struct({
|
|
795
|
+
Schema4.Struct({
|
|
796
|
+
...column,
|
|
797
|
+
type: Schema4.Literal("text"),
|
|
798
|
+
display: Schema4.optionalKey(Schema4.Literal("badge")),
|
|
799
|
+
typeOptions: Schema4.optionalKey(DataTableBadgeOptionsSchema)
|
|
800
|
+
}),
|
|
769
801
|
Schema4.Struct({
|
|
770
802
|
...column,
|
|
771
803
|
type: Schema4.Literal("number"),
|
|
@@ -808,7 +840,7 @@ var DataTableFieldSchema = Schema4.Union([
|
|
|
808
840
|
options: Schema4.optionalKey(Schema4.Array(DataTableItemSchema)),
|
|
809
841
|
allowRemove: Schema4.optionalKey(Schema4.Boolean),
|
|
810
842
|
itemActions: Schema4.optionalKey(Schema4.Array(DataTableActionSchema)),
|
|
811
|
-
display: Schema4.optionalKey(Schema4.Literals(["list", "icon"])),
|
|
843
|
+
display: Schema4.optionalKey(Schema4.Literals(["list", "icon", "badge"])),
|
|
812
844
|
visibleCount: Schema4.optionalKey(Schema4.Int.check(Schema4.isGreaterThanOrEqualTo(0))),
|
|
813
845
|
actionsLabel: Schema4.optionalKey(Schema4.String),
|
|
814
846
|
manageLabel: Schema4.optionalKey(Schema4.String)
|
|
@@ -1102,7 +1134,33 @@ var matchesFilterText = (value, filter) => {
|
|
|
1102
1134
|
return text.endsWith(query);
|
|
1103
1135
|
}
|
|
1104
1136
|
};
|
|
1105
|
-
var tableFilterKind = (column, hasOptions = false) => hasOptions || column.type === "list" ? "values" : column.type === "reference" ? "text" : column.type === "dateTime" ? "date" : column.type ?? "text";
|
|
1137
|
+
var tableFilterKind = (column, hasOptions = false) => hasOptions || column.type === "list" || column.display === "badge" ? "values" : column.type === "reference" ? "text" : column.type === "dateTime" ? "date" : column.type ?? "text";
|
|
1138
|
+
var tableBadgeValue = (value) => isTableText(value) && value !== "" ? value : null;
|
|
1139
|
+
var tableBadge = (input, config) => {
|
|
1140
|
+
const value = tableBadgeValue(input);
|
|
1141
|
+
if (value === null)
|
|
1142
|
+
return null;
|
|
1143
|
+
const option = config?.options?.find((option) => option.value === value);
|
|
1144
|
+
return {
|
|
1145
|
+
value,
|
|
1146
|
+
label: option?.label ?? value,
|
|
1147
|
+
variant: option?.variant ?? "secondary",
|
|
1148
|
+
option
|
|
1149
|
+
};
|
|
1150
|
+
};
|
|
1151
|
+
var tableBadgeFilterOptions = (values, config) => {
|
|
1152
|
+
const options = new Map(config?.options?.map(({ value, label }) => [value, label ?? value]));
|
|
1153
|
+
for (const input of values) {
|
|
1154
|
+
const value = tableBadgeValue(input);
|
|
1155
|
+
if (value !== null && !options.has(value))
|
|
1156
|
+
options.set(value, value);
|
|
1157
|
+
}
|
|
1158
|
+
return [...options].map(([value, label]) => ({ value, label }));
|
|
1159
|
+
};
|
|
1160
|
+
var tableBadgeSearchText = (value, config) => {
|
|
1161
|
+
const badge = tableBadge(value, config);
|
|
1162
|
+
return badge ? `${badge.label} ${badge.value}` : "";
|
|
1163
|
+
};
|
|
1106
1164
|
var matchesTableFilter = (filter, value, type, text, values) => {
|
|
1107
1165
|
switch (filter.kind) {
|
|
1108
1166
|
case "text":
|
|
@@ -1136,13 +1194,20 @@ var filterTableColumns = (rows, columns, filters) => {
|
|
|
1136
1194
|
return rows;
|
|
1137
1195
|
return rows.filter((row) => active.every((filter) => {
|
|
1138
1196
|
const value = row.cells[filter.id];
|
|
1139
|
-
|
|
1197
|
+
const column = byId.get(filter.id);
|
|
1198
|
+
return matchesTableFilter(filter, value, column?.type, () => isTableText(value) ? value : isTableReference(value) ? `${value.label} ${value.description ?? ""}`.trim() : "", () => {
|
|
1199
|
+
if (column?.type === "text" && column.display === "badge") {
|
|
1200
|
+
const key = tableBadgeValue(value);
|
|
1201
|
+
return key === null ? [] : [key];
|
|
1202
|
+
}
|
|
1203
|
+
return isTableList(value) ? value.map(({ value }) => value) : [];
|
|
1204
|
+
});
|
|
1140
1205
|
}));
|
|
1141
1206
|
};
|
|
1142
1207
|
var columnValue = (column, value) => {
|
|
1143
1208
|
switch (column.type) {
|
|
1144
1209
|
case "text":
|
|
1145
|
-
return isTableText(value) ? value : null;
|
|
1210
|
+
return column.display === "badge" ? tableBadgeValue(value) : isTableText(value) ? value : null;
|
|
1146
1211
|
case "number":
|
|
1147
1212
|
case "boolean":
|
|
1148
1213
|
case "date":
|
|
@@ -1196,6 +1261,8 @@ var filterTableRows = (rows, columns, search, locale) => {
|
|
|
1196
1261
|
const searchable = columns.filter(({ searchable }) => searchable !== false);
|
|
1197
1262
|
return rows.filter((row) => searchable.some((column) => {
|
|
1198
1263
|
const value = row.cells[column.id];
|
|
1264
|
+
if (column.type === "text" && column.display === "badge")
|
|
1265
|
+
return tableBadgeSearchText(value, column.typeOptions).toLocaleLowerCase(locale).includes(query);
|
|
1199
1266
|
if (column.type === "date" || column.type === "dateTime") {
|
|
1200
1267
|
const date = resolveDate(value, column.type);
|
|
1201
1268
|
return !!date && `${formatDateValue(date, column, locale)} ${dateIsoValue(date)}`.toLocaleLowerCase(locale).includes(query);
|
|
@@ -2125,6 +2192,8 @@ var booleanLabel = (value, options) => value ? options?.trueLabel : options?.fal
|
|
|
2125
2192
|
var getDataTableExportValue = (row, column, locale = "en") => {
|
|
2126
2193
|
const value = row.values.get(column.id);
|
|
2127
2194
|
const colDef = column.colDef;
|
|
2195
|
+
if (colDef.type === "text" && colDef.display === "badge")
|
|
2196
|
+
return tableBadgeValue(value);
|
|
2128
2197
|
if (colDef.type === "number") {
|
|
2129
2198
|
const number = Option4.getOrUndefined(decodeNumberValue(value));
|
|
2130
2199
|
if (number === undefined)
|
|
@@ -2153,7 +2222,9 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
|
|
|
2153
2222
|
const value = row.values.get(column.id);
|
|
2154
2223
|
const colDef = column.colDef;
|
|
2155
2224
|
let text = dataTableValueText(value);
|
|
2156
|
-
if (colDef.type === "
|
|
2225
|
+
if (colDef.type === "text" && colDef.display === "badge") {
|
|
2226
|
+
text = tableBadgeSearchText(value, colDef.typeOptions);
|
|
2227
|
+
} else if (colDef.type === "date" || colDef.type === "dateTime") {
|
|
2157
2228
|
const date = resolveDate(value, colDef.type);
|
|
2158
2229
|
text = date ? `${formatDateValue(date, colDef, locale)} ${dateIsoValue(date)}` : "";
|
|
2159
2230
|
} else if (colDef.type === "number") {
|
|
@@ -2169,11 +2240,14 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
|
|
|
2169
2240
|
var getDataTableFilterColumns = (columns) => columns.flatMap((column) => column.colDef.filterable === false ? [] : ((column.colDef.fields?.length) ? getDataTableFieldColumns(column) : [column]).filter(({ colDef }) => colDef.filterable !== false));
|
|
2170
2241
|
var getDataTableFilterKind = ({
|
|
2171
2242
|
colDef
|
|
2172
|
-
}) => tableFilterKind(colDef, !!colDef.filterOptions);
|
|
2243
|
+
}) => tableFilterKind(colDef.type === "text" ? colDef : { type: colDef.type }, !!colDef.filterOptions);
|
|
2173
2244
|
var getDataTableFilterOptions = (rows, column) => {
|
|
2174
2245
|
const { colDef } = column;
|
|
2175
2246
|
if (colDef.filterOptions)
|
|
2176
2247
|
return colDef.filterOptions;
|
|
2248
|
+
if (colDef.type === "text" && colDef.display === "badge") {
|
|
2249
|
+
return tableBadgeFilterOptions(rows.map((row) => row.values.get(column.id)), colDef.typeOptions);
|
|
2250
|
+
}
|
|
2177
2251
|
const options = new Map;
|
|
2178
2252
|
if (colDef.type === "list") {
|
|
2179
2253
|
for (const row of rows) {
|
|
@@ -2198,7 +2272,15 @@ var filterDataTableColumnRows = (rows, columns, filters) => {
|
|
|
2198
2272
|
colDef: column.colDef
|
|
2199
2273
|
}) : row.values.get(column.id);
|
|
2200
2274
|
const { colDef } = column;
|
|
2201
|
-
return matchesTableFilter(filter, value, colDef.type, () => dataTableValueText(value), () =>
|
|
2275
|
+
return matchesTableFilter(filter, value, colDef.type, () => dataTableValueText(value), () => {
|
|
2276
|
+
if (colDef.type === "list")
|
|
2277
|
+
return colDef.typeOptions.getItems(row.data).map((item) => item.value ?? item.label);
|
|
2278
|
+
if (colDef.type === "text" && colDef.display === "badge") {
|
|
2279
|
+
const key = tableBadgeValue(value);
|
|
2280
|
+
return key === null ? [] : [key];
|
|
2281
|
+
}
|
|
2282
|
+
return [dataTableValueText(value)];
|
|
2283
|
+
});
|
|
2202
2284
|
}));
|
|
2203
2285
|
};
|
|
2204
2286
|
var sortDataTableRows = (rows, columns, sorting) => {
|
|
@@ -2214,6 +2296,12 @@ var sortDataTableRows = (rows, columns, sorting) => {
|
|
|
2214
2296
|
const leftValue = left.row.values.get(sort.id);
|
|
2215
2297
|
const rightValue = right.row.values.get(sort.id);
|
|
2216
2298
|
const colDef = column.colDef;
|
|
2299
|
+
if (!colDef.comparator && colDef.type === "text" && colDef.display === "badge") {
|
|
2300
|
+
const comparison = compareTableSortValues(tableBadgeValue(leftValue), tableBadgeValue(rightValue), sort.direction);
|
|
2301
|
+
if (comparison !== 0)
|
|
2302
|
+
return comparison;
|
|
2303
|
+
continue;
|
|
2304
|
+
}
|
|
2217
2305
|
if (!colDef.comparator && (colDef.type === "number" || colDef.type === "boolean" || colDef.type === "date" || colDef.type === "dateTime")) {
|
|
2218
2306
|
const comparison = compareTableSortValues(tableSortScalar(colDef.type, leftValue), tableSortScalar(colDef.type, rightValue), sort.direction, colDef.typeOptions?.nulls);
|
|
2219
2307
|
if (comparison !== 0)
|
|
@@ -2365,6 +2453,27 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
2365
2453
|
...params
|
|
2366
2454
|
});
|
|
2367
2455
|
const colDef = column.colDef;
|
|
2456
|
+
if (colDef.type === "text" && colDef.display === "badge") {
|
|
2457
|
+
if (colDef.valueFormatter)
|
|
2458
|
+
return colDef.valueFormatter(params);
|
|
2459
|
+
const badge = tableBadge(value, colDef.typeOptions);
|
|
2460
|
+
if (!badge)
|
|
2461
|
+
return colDef.typeOptions?.emptyLabel ?? "—";
|
|
2462
|
+
const { variant, label, option } = badge;
|
|
2463
|
+
const tone = variant === "success" || variant === "info" || variant === "muted" ? tableBadgeTones[variant] : undefined;
|
|
2464
|
+
return /* @__PURE__ */ jsxs3(Badge, {
|
|
2465
|
+
variant: variant === "success" || variant === "info" || variant === "muted" ? "outline" : variant,
|
|
2466
|
+
className: tone,
|
|
2467
|
+
children: [
|
|
2468
|
+
option?.icon && /* @__PURE__ */ jsx3("span", {
|
|
2469
|
+
"aria-hidden": "true",
|
|
2470
|
+
className: "inline-flex shrink-0 [&_svg]:size-3",
|
|
2471
|
+
children: option.icon
|
|
2472
|
+
}),
|
|
2473
|
+
label
|
|
2474
|
+
]
|
|
2475
|
+
});
|
|
2476
|
+
}
|
|
2368
2477
|
if (colDef.type === "reference") {
|
|
2369
2478
|
if (colDef.valueFormatter)
|
|
2370
2479
|
return colDef.valueFormatter(params);
|
|
@@ -2392,7 +2501,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
2392
2501
|
const options = colDef.typeOptions;
|
|
2393
2502
|
return /* @__PURE__ */ jsx3("label", {
|
|
2394
2503
|
"data-slot": "data-table-boolean-cell",
|
|
2395
|
-
className: cn(
|
|
2504
|
+
className: cn(booleanCellControl, options?.onChange && !options.disabled?.(row.data) && "hover:bg-muted/50 cursor-pointer"),
|
|
2396
2505
|
onClick: (event) => event.stopPropagation(),
|
|
2397
2506
|
onPointerDown: (event) => event.stopPropagation(),
|
|
2398
2507
|
children: /* @__PURE__ */ jsx3(Checkbox, {
|
|
@@ -4064,7 +4173,9 @@ var GalleryTag = ({
|
|
|
4064
4173
|
if ((value == null || value === "") && !column.colDef.cellRenderer)
|
|
4065
4174
|
return null;
|
|
4066
4175
|
const content = renderCell(row, column, locale, labels);
|
|
4067
|
-
|
|
4176
|
+
const { colDef } = column;
|
|
4177
|
+
const displaysBadges = colDef.type === "text" && colDef.display === "badge" || colDef.type === "list" && colDef.typeOptions.display === "badge";
|
|
4178
|
+
return colDef.cellRenderer || colDef.valueFormatter || displaysBadges ? /* @__PURE__ */ jsxs3("div", {
|
|
4068
4179
|
className: "flex min-w-0 items-center gap-1",
|
|
4069
4180
|
children: [
|
|
4070
4181
|
icon,
|
|
@@ -4781,7 +4892,7 @@ var EditableDataTableListCell = ({
|
|
|
4781
4892
|
} : undefined,
|
|
4782
4893
|
trigger: /* @__PURE__ */ jsxs3(Button2, {
|
|
4783
4894
|
"aria-label": manageLabel,
|
|
4784
|
-
className:
|
|
4895
|
+
className: tableClasses.relationshipTrigger,
|
|
4785
4896
|
variant: "ghost",
|
|
4786
4897
|
children: [
|
|
4787
4898
|
/* @__PURE__ */ jsx3(DataTableListSummaryContent, {
|
|
@@ -5022,6 +5133,32 @@ var DataTableListSummaryContent = ({
|
|
|
5022
5133
|
})
|
|
5023
5134
|
});
|
|
5024
5135
|
}
|
|
5136
|
+
if (display === "badge") {
|
|
5137
|
+
return /* @__PURE__ */ jsxs3("span", {
|
|
5138
|
+
className: "inline-flex min-w-0 flex-wrap items-center gap-1",
|
|
5139
|
+
children: [
|
|
5140
|
+
visible.map((item, index) => /* @__PURE__ */ jsx3(Badge, {
|
|
5141
|
+
variant: "secondary",
|
|
5142
|
+
children: item.label
|
|
5143
|
+
}, item.value ?? `${item.label}-${index}`)),
|
|
5144
|
+
remaining ? /* @__PURE__ */ jsxs3(Badge, {
|
|
5145
|
+
variant: "secondary",
|
|
5146
|
+
children: [
|
|
5147
|
+
"+",
|
|
5148
|
+
remaining
|
|
5149
|
+
]
|
|
5150
|
+
}) : null,
|
|
5151
|
+
remaining && showMenu ? /* @__PURE__ */ jsx3(DataTableListMenu, {
|
|
5152
|
+
actions: [],
|
|
5153
|
+
display,
|
|
5154
|
+
force: true,
|
|
5155
|
+
items: normalized,
|
|
5156
|
+
locale,
|
|
5157
|
+
messages
|
|
5158
|
+
}) : null
|
|
5159
|
+
]
|
|
5160
|
+
});
|
|
5161
|
+
}
|
|
5025
5162
|
return /* @__PURE__ */ jsxs3("span", {
|
|
5026
5163
|
className: "inline-flex min-w-0 items-center gap-2 text-sm",
|
|
5027
5164
|
children: [
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { TableClassesOverrides } from "./schema.js";
|
|
2
|
+
export declare const booleanCellControl = "flex min-h-16 w-full items-center justify-start px-2 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0 has-[:focus-visible]:outline-2 has-[:focus-visible]:-outline-offset-2 has-[:focus-visible]:outline-ring";
|
|
3
|
+
export declare const tableBadgeTones: {
|
|
4
|
+
success: string;
|
|
5
|
+
info: string;
|
|
6
|
+
muted: string;
|
|
7
|
+
};
|
|
2
8
|
export declare const tableClasses: {
|
|
3
9
|
readonly selectionCell: "w-10 p-0 align-middle";
|
|
4
10
|
readonly selectionCenter: "grid place-items-center";
|
|
@@ -10,16 +16,16 @@ export declare const tableClasses: {
|
|
|
10
16
|
readonly menubar: "h-auto w-full flex-wrap justify-start border border-input bg-transparent";
|
|
11
17
|
readonly cell: "overflow-hidden";
|
|
12
18
|
readonly cellContent: "min-w-0 wrap-anywhere";
|
|
13
|
-
readonly actionTrigger: "size-8 focus-visible:ring-
|
|
19
|
+
readonly actionTrigger: "size-8 focus-visible:ring-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring";
|
|
14
20
|
readonly actionsCell: "sticky right-0 z-20 w-10 min-w-10 cursor-default bg-background p-0 transition-colors group-hover/row:bg-[color-mix(in_oklab,var(--muted)_50%,var(--background))]";
|
|
15
21
|
readonly actionsAlign: "flex min-h-12 items-center justify-end pe-1";
|
|
16
22
|
readonly header: "relative h-12 p-0";
|
|
17
23
|
readonly stickyHeader: "sticky top-0 z-30 bg-background";
|
|
18
24
|
readonly stickyHeaderRule: "after:border-border after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:border-b";
|
|
19
|
-
readonly headerTrigger: "absolute inset-0 h-full w-full min-w-0 justify-start rounded-none px-2 pe-4 focus-visible:ring-
|
|
25
|
+
readonly headerTrigger: "absolute inset-0 h-full w-full min-w-0 justify-start rounded-none px-2 pe-4 focus-visible:ring-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring";
|
|
20
26
|
readonly resizeHandle: "absolute inset-y-0 right-0 z-10 w-2 cursor-col-resize touch-none outline-none after:absolute after:inset-y-3 after:right-0 after:w-px after:bg-border hover:after:w-0.5 hover:after:bg-primary/60 focus-visible:after:w-0.5 focus-visible:after:bg-ring";
|
|
21
27
|
readonly relationshipCell: "grid min-h-16 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0";
|
|
22
|
-
readonly relationshipTrigger: "h-full w-full min-w-0 justify-between rounded-none px-2 text-start focus-visible:ring-
|
|
28
|
+
readonly relationshipTrigger: "h-full w-full min-w-0 justify-between rounded-none px-2 text-start focus-visible:ring-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring";
|
|
23
29
|
readonly reference: "flex min-w-0 items-center gap-2";
|
|
24
30
|
readonly referenceAvatar: "relative grid size-8 shrink-0 place-items-center overflow-hidden bg-muted text-xs font-medium";
|
|
25
31
|
readonly referenceText: "flex min-w-0 flex-col leading-tight";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Component } from "effect/ui";
|
|
2
2
|
import { Html } from "effect/ui/html";
|
|
3
3
|
export { DataTableEdit, DataTableEvents } from "./index.js";
|
|
4
|
-
export type { DataTableAction, DataTableCellValue, DataTableColumn, DataTableProps, DataTablePublicState, DataTableRow, DataTableSort, } from "./schema.js";
|
|
4
|
+
export type { DataTableAction, DataTableCellValue, DataTableColumn, DataTableProps, DataTablePublicState, DataTableRow, DataTableSort, DataTableBadgeOptions, } from "./schema.js";
|
|
5
5
|
export declare const DataTable: Component.Component<"DataTable", {
|
|
6
6
|
readonly classes?: {
|
|
7
7
|
readonly actionTrigger?: string | undefined;
|
|
@@ -80,6 +80,15 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
80
80
|
readonly emptyLabel?: string | undefined;
|
|
81
81
|
readonly nulls?: "first" | "last" | undefined;
|
|
82
82
|
readonly type: "text";
|
|
83
|
+
readonly display?: "badge" | undefined;
|
|
84
|
+
readonly typeOptions?: {
|
|
85
|
+
readonly options?: readonly {
|
|
86
|
+
readonly value: string;
|
|
87
|
+
readonly label?: string | undefined;
|
|
88
|
+
readonly variant?: "default" | "destructive" | "info" | "muted" | "outline" | "secondary" | "success" | undefined;
|
|
89
|
+
readonly icon?: (<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">) | undefined;
|
|
90
|
+
}[] | undefined;
|
|
91
|
+
} | undefined;
|
|
83
92
|
readonly fields?: readonly ({
|
|
84
93
|
readonly id: string;
|
|
85
94
|
readonly headerName: string;
|
|
@@ -96,6 +105,15 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
96
105
|
readonly emptyLabel?: string | undefined;
|
|
97
106
|
readonly nulls?: "first" | "last" | undefined;
|
|
98
107
|
readonly type: "text";
|
|
108
|
+
readonly display?: "badge" | undefined;
|
|
109
|
+
readonly typeOptions?: {
|
|
110
|
+
readonly options?: readonly {
|
|
111
|
+
readonly value: string;
|
|
112
|
+
readonly label?: string | undefined;
|
|
113
|
+
readonly variant?: "default" | "destructive" | "info" | "muted" | "outline" | "secondary" | "success" | undefined;
|
|
114
|
+
readonly icon?: (<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">) | undefined;
|
|
115
|
+
}[] | undefined;
|
|
116
|
+
} | undefined;
|
|
99
117
|
} | {
|
|
100
118
|
readonly id: string;
|
|
101
119
|
readonly headerName: string;
|
|
@@ -237,7 +255,7 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
237
255
|
readonly variant?: "default" | "destructive" | undefined;
|
|
238
256
|
readonly disabled?: boolean | undefined;
|
|
239
257
|
}[] | undefined;
|
|
240
|
-
readonly display?: "icon" | "list" | undefined;
|
|
258
|
+
readonly display?: "badge" | "icon" | "list" | undefined;
|
|
241
259
|
readonly visibleCount?: number | undefined;
|
|
242
260
|
readonly actionsLabel?: string | undefined;
|
|
243
261
|
readonly manageLabel?: string | undefined;
|
|
@@ -284,6 +302,15 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
284
302
|
readonly emptyLabel?: string | undefined;
|
|
285
303
|
readonly nulls?: "first" | "last" | undefined;
|
|
286
304
|
readonly type: "text";
|
|
305
|
+
readonly display?: "badge" | undefined;
|
|
306
|
+
readonly typeOptions?: {
|
|
307
|
+
readonly options?: readonly {
|
|
308
|
+
readonly value: string;
|
|
309
|
+
readonly label?: string | undefined;
|
|
310
|
+
readonly variant?: "default" | "destructive" | "info" | "muted" | "outline" | "secondary" | "success" | undefined;
|
|
311
|
+
readonly icon?: (<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">) | undefined;
|
|
312
|
+
}[] | undefined;
|
|
313
|
+
} | undefined;
|
|
287
314
|
} | {
|
|
288
315
|
readonly id: string;
|
|
289
316
|
readonly headerName: string;
|
|
@@ -425,7 +452,7 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
425
452
|
readonly variant?: "default" | "destructive" | undefined;
|
|
426
453
|
readonly disabled?: boolean | undefined;
|
|
427
454
|
}[] | undefined;
|
|
428
|
-
readonly display?: "icon" | "list" | undefined;
|
|
455
|
+
readonly display?: "badge" | "icon" | "list" | undefined;
|
|
429
456
|
readonly visibleCount?: number | undefined;
|
|
430
457
|
readonly actionsLabel?: string | undefined;
|
|
431
458
|
readonly manageLabel?: string | undefined;
|
|
@@ -462,6 +489,15 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
462
489
|
readonly emptyLabel?: string | undefined;
|
|
463
490
|
readonly nulls?: "first" | "last" | undefined;
|
|
464
491
|
readonly type: "text";
|
|
492
|
+
readonly display?: "badge" | undefined;
|
|
493
|
+
readonly typeOptions?: {
|
|
494
|
+
readonly options?: readonly {
|
|
495
|
+
readonly value: string;
|
|
496
|
+
readonly label?: string | undefined;
|
|
497
|
+
readonly variant?: "default" | "destructive" | "info" | "muted" | "outline" | "secondary" | "success" | undefined;
|
|
498
|
+
readonly icon?: (<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">) | undefined;
|
|
499
|
+
}[] | undefined;
|
|
500
|
+
} | undefined;
|
|
465
501
|
} | {
|
|
466
502
|
readonly id: string;
|
|
467
503
|
readonly headerName: string;
|
|
@@ -603,7 +639,7 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
603
639
|
readonly variant?: "default" | "destructive" | undefined;
|
|
604
640
|
readonly disabled?: boolean | undefined;
|
|
605
641
|
}[] | undefined;
|
|
606
|
-
readonly display?: "icon" | "list" | undefined;
|
|
642
|
+
readonly display?: "badge" | "icon" | "list" | undefined;
|
|
607
643
|
readonly visibleCount?: number | undefined;
|
|
608
644
|
readonly actionsLabel?: string | undefined;
|
|
609
645
|
readonly manageLabel?: string | undefined;
|
|
@@ -646,6 +682,15 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
646
682
|
readonly emptyLabel?: string | undefined;
|
|
647
683
|
readonly nulls?: "first" | "last" | undefined;
|
|
648
684
|
readonly type: "text";
|
|
685
|
+
readonly display?: "badge" | undefined;
|
|
686
|
+
readonly typeOptions?: {
|
|
687
|
+
readonly options?: readonly {
|
|
688
|
+
readonly value: string;
|
|
689
|
+
readonly label?: string | undefined;
|
|
690
|
+
readonly variant?: "default" | "destructive" | "info" | "muted" | "outline" | "secondary" | "success" | undefined;
|
|
691
|
+
readonly icon?: (<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">) | undefined;
|
|
692
|
+
}[] | undefined;
|
|
693
|
+
} | undefined;
|
|
649
694
|
} | {
|
|
650
695
|
readonly id: string;
|
|
651
696
|
readonly headerName: string;
|
|
@@ -787,7 +832,7 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
787
832
|
readonly variant?: "default" | "destructive" | undefined;
|
|
788
833
|
readonly disabled?: boolean | undefined;
|
|
789
834
|
}[] | undefined;
|
|
790
|
-
readonly display?: "icon" | "list" | undefined;
|
|
835
|
+
readonly display?: "badge" | "icon" | "list" | undefined;
|
|
791
836
|
readonly visibleCount?: number | undefined;
|
|
792
837
|
readonly actionsLabel?: string | undefined;
|
|
793
838
|
readonly manageLabel?: string | undefined;
|
|
@@ -832,6 +877,15 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
832
877
|
readonly emptyLabel?: string | undefined;
|
|
833
878
|
readonly nulls?: "first" | "last" | undefined;
|
|
834
879
|
readonly type: "text";
|
|
880
|
+
readonly display?: "badge" | undefined;
|
|
881
|
+
readonly typeOptions?: {
|
|
882
|
+
readonly options?: readonly {
|
|
883
|
+
readonly value: string;
|
|
884
|
+
readonly label?: string | undefined;
|
|
885
|
+
readonly variant?: "default" | "destructive" | "info" | "muted" | "outline" | "secondary" | "success" | undefined;
|
|
886
|
+
readonly icon?: (<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">) | undefined;
|
|
887
|
+
}[] | undefined;
|
|
888
|
+
} | undefined;
|
|
835
889
|
} | {
|
|
836
890
|
readonly id: string;
|
|
837
891
|
readonly headerName: string;
|
|
@@ -973,7 +1027,7 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
973
1027
|
readonly variant?: "default" | "destructive" | undefined;
|
|
974
1028
|
readonly disabled?: boolean | undefined;
|
|
975
1029
|
}[] | undefined;
|
|
976
|
-
readonly display?: "icon" | "list" | undefined;
|
|
1030
|
+
readonly display?: "badge" | "icon" | "list" | undefined;
|
|
977
1031
|
readonly visibleCount?: number | undefined;
|
|
978
1032
|
readonly actionsLabel?: string | undefined;
|
|
979
1033
|
readonly manageLabel?: string | undefined;
|
|
@@ -1016,6 +1070,15 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
1016
1070
|
readonly emptyLabel?: string | undefined;
|
|
1017
1071
|
readonly nulls?: "first" | "last" | undefined;
|
|
1018
1072
|
readonly type: "text";
|
|
1073
|
+
readonly display?: "badge" | undefined;
|
|
1074
|
+
readonly typeOptions?: {
|
|
1075
|
+
readonly options?: readonly {
|
|
1076
|
+
readonly value: string;
|
|
1077
|
+
readonly label?: string | undefined;
|
|
1078
|
+
readonly variant?: "default" | "destructive" | "info" | "muted" | "outline" | "secondary" | "success" | undefined;
|
|
1079
|
+
readonly icon?: (<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">) | undefined;
|
|
1080
|
+
}[] | undefined;
|
|
1081
|
+
} | undefined;
|
|
1019
1082
|
} | {
|
|
1020
1083
|
readonly id: string;
|
|
1021
1084
|
readonly headerName: string;
|
|
@@ -1157,7 +1220,7 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
1157
1220
|
readonly variant?: "default" | "destructive" | undefined;
|
|
1158
1221
|
readonly disabled?: boolean | undefined;
|
|
1159
1222
|
}[] | undefined;
|
|
1160
|
-
readonly display?: "icon" | "list" | undefined;
|
|
1223
|
+
readonly display?: "badge" | "icon" | "list" | undefined;
|
|
1161
1224
|
readonly visibleCount?: number | undefined;
|
|
1162
1225
|
readonly actionsLabel?: string | undefined;
|
|
1163
1226
|
readonly manageLabel?: string | undefined;
|
|
@@ -1193,7 +1256,7 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
1193
1256
|
readonly variant?: "default" | "destructive" | undefined;
|
|
1194
1257
|
readonly disabled?: boolean | undefined;
|
|
1195
1258
|
}[] | undefined;
|
|
1196
|
-
readonly display?: "icon" | "list" | undefined;
|
|
1259
|
+
readonly display?: "badge" | "icon" | "list" | undefined;
|
|
1197
1260
|
readonly visibleCount?: number | undefined;
|
|
1198
1261
|
readonly actionsLabel?: string | undefined;
|
|
1199
1262
|
readonly manageLabel?: string | undefined;
|
|
@@ -1213,6 +1276,15 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
1213
1276
|
readonly emptyLabel?: string | undefined;
|
|
1214
1277
|
readonly nulls?: "first" | "last" | undefined;
|
|
1215
1278
|
readonly type: "text";
|
|
1279
|
+
readonly display?: "badge" | undefined;
|
|
1280
|
+
readonly typeOptions?: {
|
|
1281
|
+
readonly options?: readonly {
|
|
1282
|
+
readonly value: string;
|
|
1283
|
+
readonly label?: string | undefined;
|
|
1284
|
+
readonly variant?: "default" | "destructive" | "info" | "muted" | "outline" | "secondary" | "success" | undefined;
|
|
1285
|
+
readonly icon?: (<Msg>(h: Html.H<Msg>, { size, color, strokeWidth, className, }?: import("../../lib/lucide-effect.js").LucideIconProps) => Html.SvgElement<Msg, never, SVGSVGElement, "svg">) | undefined;
|
|
1286
|
+
}[] | undefined;
|
|
1287
|
+
} | undefined;
|
|
1216
1288
|
} | {
|
|
1217
1289
|
readonly id: string;
|
|
1218
1290
|
readonly headerName: string;
|
|
@@ -1354,7 +1426,7 @@ export declare const DataTable: Component.Component<"DataTable", {
|
|
|
1354
1426
|
readonly variant?: "default" | "destructive" | undefined;
|
|
1355
1427
|
readonly disabled?: boolean | undefined;
|
|
1356
1428
|
}[] | undefined;
|
|
1357
|
-
readonly display?: "icon" | "list" | undefined;
|
|
1429
|
+
readonly display?: "badge" | "icon" | "list" | undefined;
|
|
1358
1430
|
readonly visibleCount?: number | undefined;
|
|
1359
1431
|
readonly actionsLabel?: string | undefined;
|
|
1360
1432
|
readonly manageLabel?: string | undefined;
|