@machinemetrics/mm-react-components 0.2.3-19 → 0.2.3-20
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/App.d.ts.map +1 -1
- package/dist/components/ui/data-table/TableView.d.ts.map +1 -1
- package/dist/components/ui/data-table/index.d.ts +3 -1
- package/dist/components/ui/data-table/index.d.ts.map +1 -1
- package/dist/components/ui/data-table/parts/BatchActionsToolbar.d.ts +6 -0
- package/dist/components/ui/data-table/parts/BatchActionsToolbar.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/ColGroup.d.ts +7 -0
- package/dist/components/ui/data-table/parts/ColGroup.d.ts.map +1 -0
- package/dist/components/ui/data-table/toolbar/DataTableToolbar.d.ts.map +1 -1
- package/dist/components/ui/data-table/types.d.ts +9 -1
- package/dist/components/ui/data-table/types.d.ts.map +1 -1
- package/dist/lib/mm-react-components.css +1 -1
- package/dist/mm-react-components.es.js +70 -26
- package/dist/mm-react-components.es.js.map +1 -1
- package/dist/mm-react-components.umd.js +7 -7
- package/dist/mm-react-components.umd.js.map +1 -1
- package/dist/preview/ColorsPreview.d.ts +7 -0
- package/dist/preview/ColorsPreview.d.ts.map +1 -0
- package/dist/preview/DataTablePreview.d.ts.map +1 -1
- package/dist/preview/DateRangePickerPreview.d.ts.map +1 -1
- package/dist/tailwind.base.config.js +2 -1
- package/dist/themes/carbide.css +60 -19
- package/package.json +1 -1
- package/src/index.css +12 -0
|
@@ -26055,7 +26055,23 @@ function DataTableToolbar({
|
|
|
26055
26055
|
"aria-label": "Search",
|
|
26056
26056
|
placeholder: "Search",
|
|
26057
26057
|
value: globalFilter,
|
|
26058
|
-
onChange: (event) =>
|
|
26058
|
+
onChange: (event) => {
|
|
26059
|
+
const value = event.target.value;
|
|
26060
|
+
onGlobalFilterChange(value);
|
|
26061
|
+
if (opts.onSearchChange) {
|
|
26062
|
+
opts.onSearchChange(value);
|
|
26063
|
+
}
|
|
26064
|
+
},
|
|
26065
|
+
onKeyDown: (event) => {
|
|
26066
|
+
if (event.key === "Enter" || event.keyCode === 13) {
|
|
26067
|
+
event.preventDefault();
|
|
26068
|
+
event.stopPropagation();
|
|
26069
|
+
const value = event.currentTarget.value.trim();
|
|
26070
|
+
if (opts.onSearchSubmit && value) {
|
|
26071
|
+
opts.onSearchSubmit(value);
|
|
26072
|
+
}
|
|
26073
|
+
}
|
|
26074
|
+
},
|
|
26059
26075
|
className: "h-10 min-w-[16rem] flex-1 mmc-input--search"
|
|
26060
26076
|
}
|
|
26061
26077
|
) }) : null
|
|
@@ -26089,7 +26105,12 @@ function DataTableToolbar({
|
|
|
26089
26105
|
) : null
|
|
26090
26106
|
] })
|
|
26091
26107
|
] }),
|
|
26092
|
-
opts.belowControls
|
|
26108
|
+
typeof opts.belowControls === "function" ? opts.belowControls({
|
|
26109
|
+
globalFilter,
|
|
26110
|
+
onSearchChange: opts.onSearchChange,
|
|
26111
|
+
onSearchSubmit: opts.onSearchSubmit,
|
|
26112
|
+
loading
|
|
26113
|
+
}) : opts.belowControls ?? null
|
|
26093
26114
|
] });
|
|
26094
26115
|
}
|
|
26095
26116
|
/**
|
|
@@ -29795,6 +29816,40 @@ function TableBody({
|
|
|
29795
29816
|
row.id
|
|
29796
29817
|
)) : /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("td", { colSpan: resolvedColumns.length, className: "h-24 text-center", children: "No results." }) }) });
|
|
29797
29818
|
}
|
|
29819
|
+
function BatchActionsToolbar({
|
|
29820
|
+
selectedCount,
|
|
29821
|
+
onDeleteSelected
|
|
29822
|
+
}) {
|
|
29823
|
+
if (selectedCount <= 0) return null;
|
|
29824
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-2 px-1", children: [
|
|
29825
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm", children: [
|
|
29826
|
+
selectedCount,
|
|
29827
|
+
" selected"
|
|
29828
|
+
] }),
|
|
29829
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29830
|
+
Button$1,
|
|
29831
|
+
{
|
|
29832
|
+
variant: "destructive",
|
|
29833
|
+
size: "sm",
|
|
29834
|
+
onClick: () => {
|
|
29835
|
+
if (onDeleteSelected) {
|
|
29836
|
+
onDeleteSelected(selectedCount);
|
|
29837
|
+
return;
|
|
29838
|
+
}
|
|
29839
|
+
alert(`Delete ${selectedCount} row(s)`);
|
|
29840
|
+
},
|
|
29841
|
+
children: "Delete"
|
|
29842
|
+
}
|
|
29843
|
+
)
|
|
29844
|
+
] });
|
|
29845
|
+
}
|
|
29846
|
+
function ColGroup({ columns, debug: debug2 }) {
|
|
29847
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("colgroup", { children: columns.map((col) => {
|
|
29848
|
+
const width = col.id === "select" ? TABLE_TOKENS.selectionColumnWidth : col.id === "actions" ? TABLE_TOKENS.actionsColumnWidth : col.getSize();
|
|
29849
|
+
if (debug2) debug2("colgroup width", String(col.id), width);
|
|
29850
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("col", { style: { width } }, String(col.id));
|
|
29851
|
+
}) });
|
|
29852
|
+
}
|
|
29798
29853
|
function DataTable({
|
|
29799
29854
|
columns,
|
|
29800
29855
|
data,
|
|
@@ -29929,25 +29984,12 @@ function DataTable({
|
|
|
29929
29984
|
options: toolbar
|
|
29930
29985
|
}
|
|
29931
29986
|
),
|
|
29932
|
-
table.getFilteredSelectedRowModel().rows.length > 0 && /* @__PURE__ */ jsxRuntimeExports.
|
|
29933
|
-
|
|
29934
|
-
|
|
29935
|
-
|
|
29936
|
-
|
|
29937
|
-
|
|
29938
|
-
Button$1,
|
|
29939
|
-
{
|
|
29940
|
-
variant: "destructive",
|
|
29941
|
-
size: "sm",
|
|
29942
|
-
onClick: () => {
|
|
29943
|
-
alert(
|
|
29944
|
-
`Delete ${table.getFilteredSelectedRowModel().rows.length} row(s)`
|
|
29945
|
-
);
|
|
29946
|
-
},
|
|
29947
|
-
children: "Delete"
|
|
29948
|
-
}
|
|
29949
|
-
)
|
|
29950
|
-
] }),
|
|
29987
|
+
table.getFilteredSelectedRowModel().rows.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29988
|
+
BatchActionsToolbar,
|
|
29989
|
+
{
|
|
29990
|
+
selectedCount: table.getFilteredSelectedRowModel().rows.length
|
|
29991
|
+
}
|
|
29992
|
+
),
|
|
29951
29993
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29952
29994
|
"div",
|
|
29953
29995
|
{
|
|
@@ -29981,11 +30023,13 @@ function DataTable({
|
|
|
29981
30023
|
ref: tableRef,
|
|
29982
30024
|
className: "w-full caption-bottom text-sm table-fixed",
|
|
29983
30025
|
children: [
|
|
29984
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29985
|
-
|
|
29986
|
-
|
|
29987
|
-
|
|
29988
|
-
|
|
30026
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30027
|
+
ColGroup,
|
|
30028
|
+
{
|
|
30029
|
+
columns: table.getVisibleLeafColumns(),
|
|
30030
|
+
debug: debug2
|
|
30031
|
+
}
|
|
30032
|
+
),
|
|
29989
30033
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29990
30034
|
TableHeader,
|
|
29991
30035
|
{
|