@wordrhyme/auto-crud 1.3.5 → 1.3.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/dist/index.cjs CHANGED
@@ -2062,6 +2062,12 @@ function DataTableSortList({ table, disabled,...props }) {
2062
2062
  window.addEventListener("keydown", onKeyDown);
2063
2063
  return () => window.removeEventListener("keydown", onKeyDown);
2064
2064
  }, []);
2065
+ const onTriggerKeyDown = react.useCallback((event) => {
2066
+ if (REMOVE_SORT_SHORTCUTS.includes(event.key.toLowerCase()) && sorting.length > 0) {
2067
+ event.preventDefault();
2068
+ onSortingReset();
2069
+ }
2070
+ }, [sorting.length, onSortingReset]);
2065
2071
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__wordrhyme_shadcn_ui.Sortable, {
2066
2072
  value: sorting,
2067
2073
  onValueChange: onSortingChange,
@@ -2073,24 +2079,17 @@ function DataTableSortList({ table, disabled,...props }) {
2073
2079
  asChild: true,
2074
2080
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__wordrhyme_shadcn.Button, {
2075
2081
  variant: "outline",
2076
- size: "sm",
2077
- className: "font-normal",
2078
- onKeyDown: react.useCallback((event) => {
2079
- if (REMOVE_SORT_SHORTCUTS.includes(event.key.toLowerCase()) && sorting.length > 0) {
2080
- event.preventDefault();
2081
- onSortingReset();
2082
- }
2083
- }, [sorting.length, onSortingReset]),
2082
+ size: "icon-sm",
2083
+ "aria-label": "Sort rows",
2084
+ title: "Sort rows",
2085
+ className: cn(sorting.length > 0 && "w-auto gap-1 px-2"),
2086
+ onKeyDown: onTriggerKeyDown,
2084
2087
  disabled,
2085
- children: [
2086
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ArrowDownUp, { className: "text-muted-foreground" }),
2087
- "Sort",
2088
- sorting.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Badge, {
2089
- variant: "secondary",
2090
- className: "h-[18.24px] rounded-[3.2px] px-[5.12px] font-mono font-normal text-[10.4px]",
2091
- children: sorting.length
2092
- })
2093
- ]
2088
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ArrowDownUp, { className: "text-muted-foreground" }), sorting.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Badge, {
2089
+ variant: "secondary",
2090
+ className: "h-[18.24px] rounded-[3.2px] px-[5.12px] font-mono font-normal text-[10.4px]",
2091
+ children: sorting.length
2092
+ })]
2094
2093
  })
2095
2094
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__wordrhyme_shadcn.PopoverContent, {
2096
2095
  "aria-labelledby": labelId,
@@ -2260,14 +2259,15 @@ function DataTableViewOptions({ table, disabled,...props }) {
2260
2259
  const columns = react.useMemo(() => table.getAllColumns().filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide()), [table]);
2261
2260
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__wordrhyme_shadcn.Popover, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.PopoverTrigger, {
2262
2261
  asChild: true,
2263
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__wordrhyme_shadcn.Button, {
2262
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Button, {
2264
2263
  "aria-label": "Toggle columns",
2264
+ title: "Toggle columns",
2265
2265
  role: "combobox",
2266
2266
  variant: "outline",
2267
- size: "sm",
2268
- className: "ml-auto flex h-8 font-normal",
2267
+ size: "icon-sm",
2268
+ className: "ml-auto",
2269
2269
  disabled,
2270
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Settings2, { className: "text-muted-foreground" }), "View"]
2270
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Settings2, { className: "text-muted-foreground" })
2271
2271
  })
2272
2272
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.PopoverContent, {
2273
2273
  className: "w-44 p-0",
@@ -3974,7 +3974,7 @@ const filterModeConfig = {
3974
3974
  tooltip: "Linear-style command filters"
3975
3975
  }
3976
3976
  };
3977
- function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection = true, exclude, actions, pinnedColumns, filterMode = "simple", search = false, onDeleteSelected, onUpdateSelected, batchUpdateFields, actionBarExtra, actionBarActions, deleteConfirmation, initialSorting, enableExport = true, showDefaultExport = true, onSelectedCountChange, onSelectedRowsChange, getSelectedRows }) {
3977
+ function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection = true, exclude, actions, pinnedColumns, filterMode, search = false, onDeleteSelected, onUpdateSelected, batchUpdateFields, actionBarExtra, actionBarActions, deleteConfirmation, initialSorting, enableExport = true, showDefaultExport = true, onSelectedCountChange, onSelectedRowsChange, getSelectedRows }) {
3978
3978
  const modes = filterMode ? Array.isArray(filterMode) ? filterMode : [filterMode] : DEFAULT_MODES;
3979
3979
  const [currentMode, setCurrentMode] = useQueryState("filterMode", parseAsStringEnum(modes).withDefault(modes[0] ?? "simple"));
3980
3980
  const showToggle = modes.length > 1;
@@ -4049,9 +4049,9 @@ function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection
4049
4049
  asChild: true,
4050
4050
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Button, {
4051
4051
  variant: "outline",
4052
- size: "sm",
4053
- className: "h-8 w-8 p-0",
4052
+ size: "icon-sm",
4054
4053
  "aria-label": `Switch filter mode, current: ${filterModeConfig[currentMode].label}`,
4054
+ title: filterModeConfig[currentMode].tooltip,
4055
4055
  children: (() => {
4056
4056
  const Icon = filterModeConfig[currentMode].icon;
4057
4057
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "size-4 text-muted-foreground" });
@@ -4118,22 +4118,15 @@ function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection
4118
4118
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4119
4119
  className: "flex min-h-[40px] min-w-0 flex-1 items-start gap-2",
4120
4120
  "data-filter-parent": true,
4121
- children: [
4122
- currentMode !== "simple" && searchInput,
4123
- currentMode !== "simple" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableSortList, {
4124
- table,
4125
- align: "start"
4126
- }),
4127
- filtersContent
4128
- ]
4121
+ children: [currentMode !== "simple" && searchInput, filtersContent]
4129
4122
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4130
4123
  className: "flex items-center gap-2",
4131
4124
  children: [
4132
- currentMode === "simple" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableSortList, {
4125
+ FilterModeSelect,
4126
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableSortList, {
4133
4127
  table,
4134
4128
  align: "end"
4135
4129
  }),
4136
- FilterModeSelect,
4137
4130
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableViewOptions, {
4138
4131
  table,
4139
4132
  align: "end"
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
  import { z } from "zod";
3
3
  import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
4
4
  import * as _tanstack_react_table0 from "@tanstack/react-table";
@@ -381,7 +381,7 @@ declare function AutoTableActionBar<TData>({
381
381
  extraActions,
382
382
  actions,
383
383
  deleteConfirmation
384
- }: AutoTableActionBarProps<TData>): react_jsx_runtime3.JSX.Element;
384
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime0.JSX.Element;
385
385
  //#endregion
386
386
  //#region src/lib/schema-bridge/types.d.ts
387
387
  /**
@@ -557,7 +557,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
557
557
  onSelectedCountChange,
558
558
  onSelectedRowsChange,
559
559
  getSelectedRows
560
- }: AutoTableProps<T>): react_jsx_runtime3.JSX.Element;
560
+ }: AutoTableProps<T>): react_jsx_runtime0.JSX.Element;
561
561
  //#endregion
562
562
  //#region src/i18n/locale.d.ts
563
563
  /**
@@ -1037,7 +1037,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
1037
1037
  toolbarActions,
1038
1038
  locale: localeProp,
1039
1039
  onCreate
1040
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime3.JSX.Element;
1040
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime0.JSX.Element;
1041
1041
  //#endregion
1042
1042
  //#region src/components/auto-crud/auto-form.d.ts
1043
1043
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
@@ -1076,7 +1076,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
1076
1076
  labelAlign,
1077
1077
  labelWidth,
1078
1078
  showSubmitButton
1079
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime3.JSX.Element;
1079
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime0.JSX.Element;
1080
1080
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
1081
1081
  ref?: React.Ref<AutoFormRef>;
1082
1082
  }) => ReturnType<typeof AutoFormInner>;
@@ -1392,7 +1392,7 @@ declare function AutoTableSimpleFilters<TData>({
1392
1392
  filters: externalFilters,
1393
1393
  onFiltersChange,
1394
1394
  leading
1395
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime3.JSX.Element | null;
1395
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime0.JSX.Element | null;
1396
1396
  //#endregion
1397
1397
  //#region src/components/auto-crud/form-modal.d.ts
1398
1398
  type ModalVariant = "dialog" | "sheet";
@@ -1436,7 +1436,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
1436
1436
  labelAlign,
1437
1437
  labelWidth,
1438
1438
  className
1439
- }: CrudFormModalProps<T>): react_jsx_runtime3.JSX.Element;
1439
+ }: CrudFormModalProps<T>): react_jsx_runtime0.JSX.Element;
1440
1440
  //#endregion
1441
1441
  //#region src/components/auto-crud/import-dialog.d.ts
1442
1442
  interface ImportDialogProps {
@@ -1458,7 +1458,7 @@ declare function ImportDialog({
1458
1458
  columns,
1459
1459
  title,
1460
1460
  locale
1461
- }: ImportDialogProps): react_jsx_runtime3.JSX.Element;
1461
+ }: ImportDialogProps): react_jsx_runtime0.JSX.Element;
1462
1462
  //#endregion
1463
1463
  //#region src/components/auto-crud/export-dialog.d.ts
1464
1464
  type ExportMode = "selected" | "filtered";
@@ -1478,7 +1478,7 @@ declare function ExportDialog({
1478
1478
  selectedCount,
1479
1479
  onExport,
1480
1480
  canExportFiltered
1481
- }: ExportDialogProps): react_jsx_runtime3.JSX.Element;
1481
+ }: ExportDialogProps): react_jsx_runtime0.JSX.Element;
1482
1482
  //#endregion
1483
1483
  //#region src/components/data-table/data-table.d.ts
1484
1484
  interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1491,7 +1491,7 @@ declare function DataTable<TData>({
1491
1491
  children,
1492
1492
  className,
1493
1493
  ...props
1494
- }: DataTableProps<TData>): react_jsx_runtime3.JSX.Element;
1494
+ }: DataTableProps<TData>): react_jsx_runtime0.JSX.Element;
1495
1495
  //#endregion
1496
1496
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1497
1497
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1502,7 +1502,7 @@ declare function DataTableAdvancedToolbar<TData>({
1502
1502
  children,
1503
1503
  className,
1504
1504
  ...props
1505
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
1505
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
1506
1506
  //#endregion
1507
1507
  //#region src/components/data-table/data-table-column-header.d.ts
1508
1508
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1514,7 +1514,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1514
1514
  label,
1515
1515
  className,
1516
1516
  ...props
1517
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
1517
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
1518
1518
  //#endregion
1519
1519
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1520
1520
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1528,7 +1528,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1528
1528
  title,
1529
1529
  options,
1530
1530
  multiple
1531
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
1531
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
1532
1532
  //#endregion
1533
1533
  //#region src/components/data-table/data-table-pagination.d.ts
1534
1534
  interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
@@ -1540,7 +1540,7 @@ declare function DataTablePagination<TData>({
1540
1540
  pageSizeOptions,
1541
1541
  className,
1542
1542
  ...props
1543
- }: DataTablePaginationProps<TData>): react_jsx_runtime3.JSX.Element;
1543
+ }: DataTablePaginationProps<TData>): react_jsx_runtime0.JSX.Element;
1544
1544
  //#endregion
1545
1545
  //#region src/components/data-table/data-table-toolbar.d.ts
1546
1546
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1551,7 +1551,7 @@ declare function DataTableToolbar<TData>({
1551
1551
  children,
1552
1552
  className,
1553
1553
  ...props
1554
- }: DataTableToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
1554
+ }: DataTableToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
1555
1555
  //#endregion
1556
1556
  //#region src/components/data-table/data-table-view-options.d.ts
1557
1557
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1562,7 +1562,7 @@ declare function DataTableViewOptions<TData>({
1562
1562
  table,
1563
1563
  disabled,
1564
1564
  ...props
1565
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime3.JSX.Element;
1565
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime0.JSX.Element;
1566
1566
  //#endregion
1567
1567
  //#region src/lib/crud-actions.d.ts
1568
1568
  type CrudActionZone = 'toolbar' | 'row' | 'batch';
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import * as _tanstack_react_table0 from "@tanstack/react-table";
3
3
  import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
4
4
  import { DropdownMenuTrigger, PopoverContent } from "@wordrhyme/shadcn";
5
5
  import { ClassValue } from "clsx";
6
- import * as react_jsx_runtime2 from "react/jsx-runtime";
6
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
7
7
  import { MultiCombobox, MultiComboboxOption, MultiComboboxProps, MultiComboboxTriggerRenderProps, Select, SelectMode, SelectOption, SelectProps, SelectSearchableDynamicProps, SelectSearchableMultipleProps, SelectSearchableProps, SelectSearchableSingleProps, SelectSimpleProps, SelectTriggerRenderProps } from "@wordrhyme/shadcn-ui";
8
8
  import { z } from "zod";
9
9
  import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
@@ -381,7 +381,7 @@ declare function AutoTableActionBar<TData>({
381
381
  extraActions,
382
382
  actions,
383
383
  deleteConfirmation
384
- }: AutoTableActionBarProps<TData>): react_jsx_runtime2.JSX.Element;
384
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime0.JSX.Element;
385
385
  //#endregion
386
386
  //#region src/lib/schema-bridge/types.d.ts
387
387
  /**
@@ -557,7 +557,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
557
557
  onSelectedCountChange,
558
558
  onSelectedRowsChange,
559
559
  getSelectedRows
560
- }: AutoTableProps<T>): react_jsx_runtime2.JSX.Element;
560
+ }: AutoTableProps<T>): react_jsx_runtime0.JSX.Element;
561
561
  //#endregion
562
562
  //#region src/i18n/locale.d.ts
563
563
  /**
@@ -1037,7 +1037,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
1037
1037
  toolbarActions,
1038
1038
  locale: localeProp,
1039
1039
  onCreate
1040
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime2.JSX.Element;
1040
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime0.JSX.Element;
1041
1041
  //#endregion
1042
1042
  //#region src/components/auto-crud/auto-form.d.ts
1043
1043
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
@@ -1076,7 +1076,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
1076
1076
  labelAlign,
1077
1077
  labelWidth,
1078
1078
  showSubmitButton
1079
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime2.JSX.Element;
1079
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime0.JSX.Element;
1080
1080
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
1081
1081
  ref?: React.Ref<AutoFormRef>;
1082
1082
  }) => ReturnType<typeof AutoFormInner>;
@@ -1392,7 +1392,7 @@ declare function AutoTableSimpleFilters<TData>({
1392
1392
  filters: externalFilters,
1393
1393
  onFiltersChange,
1394
1394
  leading
1395
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime2.JSX.Element | null;
1395
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime0.JSX.Element | null;
1396
1396
  //#endregion
1397
1397
  //#region src/components/auto-crud/form-modal.d.ts
1398
1398
  type ModalVariant = "dialog" | "sheet";
@@ -1436,7 +1436,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
1436
1436
  labelAlign,
1437
1437
  labelWidth,
1438
1438
  className
1439
- }: CrudFormModalProps<T>): react_jsx_runtime2.JSX.Element;
1439
+ }: CrudFormModalProps<T>): react_jsx_runtime0.JSX.Element;
1440
1440
  //#endregion
1441
1441
  //#region src/components/auto-crud/import-dialog.d.ts
1442
1442
  interface ImportDialogProps {
@@ -1458,7 +1458,7 @@ declare function ImportDialog({
1458
1458
  columns,
1459
1459
  title,
1460
1460
  locale
1461
- }: ImportDialogProps): react_jsx_runtime2.JSX.Element;
1461
+ }: ImportDialogProps): react_jsx_runtime0.JSX.Element;
1462
1462
  //#endregion
1463
1463
  //#region src/components/auto-crud/export-dialog.d.ts
1464
1464
  type ExportMode = "selected" | "filtered";
@@ -1478,7 +1478,7 @@ declare function ExportDialog({
1478
1478
  selectedCount,
1479
1479
  onExport,
1480
1480
  canExportFiltered
1481
- }: ExportDialogProps): react_jsx_runtime2.JSX.Element;
1481
+ }: ExportDialogProps): react_jsx_runtime0.JSX.Element;
1482
1482
  //#endregion
1483
1483
  //#region src/components/data-table/data-table.d.ts
1484
1484
  interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1491,7 +1491,7 @@ declare function DataTable<TData>({
1491
1491
  children,
1492
1492
  className,
1493
1493
  ...props
1494
- }: DataTableProps<TData>): react_jsx_runtime2.JSX.Element;
1494
+ }: DataTableProps<TData>): react_jsx_runtime0.JSX.Element;
1495
1495
  //#endregion
1496
1496
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1497
1497
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1502,7 +1502,7 @@ declare function DataTableAdvancedToolbar<TData>({
1502
1502
  children,
1503
1503
  className,
1504
1504
  ...props
1505
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
1505
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
1506
1506
  //#endregion
1507
1507
  //#region src/components/data-table/data-table-column-header.d.ts
1508
1508
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1514,7 +1514,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1514
1514
  label,
1515
1515
  className,
1516
1516
  ...props
1517
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
1517
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
1518
1518
  //#endregion
1519
1519
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1520
1520
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1528,7 +1528,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1528
1528
  title,
1529
1529
  options,
1530
1530
  multiple
1531
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
1531
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
1532
1532
  //#endregion
1533
1533
  //#region src/components/data-table/data-table-pagination.d.ts
1534
1534
  interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
@@ -1540,7 +1540,7 @@ declare function DataTablePagination<TData>({
1540
1540
  pageSizeOptions,
1541
1541
  className,
1542
1542
  ...props
1543
- }: DataTablePaginationProps<TData>): react_jsx_runtime2.JSX.Element;
1543
+ }: DataTablePaginationProps<TData>): react_jsx_runtime0.JSX.Element;
1544
1544
  //#endregion
1545
1545
  //#region src/components/data-table/data-table-toolbar.d.ts
1546
1546
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1551,7 +1551,7 @@ declare function DataTableToolbar<TData>({
1551
1551
  children,
1552
1552
  className,
1553
1553
  ...props
1554
- }: DataTableToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
1554
+ }: DataTableToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
1555
1555
  //#endregion
1556
1556
  //#region src/components/data-table/data-table-view-options.d.ts
1557
1557
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1562,7 +1562,7 @@ declare function DataTableViewOptions<TData>({
1562
1562
  table,
1563
1563
  disabled,
1564
1564
  ...props
1565
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime2.JSX.Element;
1565
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime0.JSX.Element;
1566
1566
  //#endregion
1567
1567
  //#region src/lib/crud-actions.d.ts
1568
1568
  type CrudActionZone = 'toolbar' | 'row' | 'batch';
package/dist/index.js CHANGED
@@ -2025,6 +2025,12 @@ function DataTableSortList({ table, disabled,...props }) {
2025
2025
  window.addEventListener("keydown", onKeyDown);
2026
2026
  return () => window.removeEventListener("keydown", onKeyDown);
2027
2027
  }, []);
2028
+ const onTriggerKeyDown = React.useCallback((event) => {
2029
+ if (REMOVE_SORT_SHORTCUTS.includes(event.key.toLowerCase()) && sorting.length > 0) {
2030
+ event.preventDefault();
2031
+ onSortingReset();
2032
+ }
2033
+ }, [sorting.length, onSortingReset]);
2028
2034
  return /* @__PURE__ */ jsxs(Sortable, {
2029
2035
  value: sorting,
2030
2036
  onValueChange: onSortingChange,
@@ -2036,24 +2042,17 @@ function DataTableSortList({ table, disabled,...props }) {
2036
2042
  asChild: true,
2037
2043
  children: /* @__PURE__ */ jsxs(Button, {
2038
2044
  variant: "outline",
2039
- size: "sm",
2040
- className: "font-normal",
2041
- onKeyDown: React.useCallback((event) => {
2042
- if (REMOVE_SORT_SHORTCUTS.includes(event.key.toLowerCase()) && sorting.length > 0) {
2043
- event.preventDefault();
2044
- onSortingReset();
2045
- }
2046
- }, [sorting.length, onSortingReset]),
2045
+ size: "icon-sm",
2046
+ "aria-label": "Sort rows",
2047
+ title: "Sort rows",
2048
+ className: cn(sorting.length > 0 && "w-auto gap-1 px-2"),
2049
+ onKeyDown: onTriggerKeyDown,
2047
2050
  disabled,
2048
- children: [
2049
- /* @__PURE__ */ jsx(ArrowDownUp, { className: "text-muted-foreground" }),
2050
- "Sort",
2051
- sorting.length > 0 && /* @__PURE__ */ jsx(Badge, {
2052
- variant: "secondary",
2053
- className: "h-[18.24px] rounded-[3.2px] px-[5.12px] font-mono font-normal text-[10.4px]",
2054
- children: sorting.length
2055
- })
2056
- ]
2051
+ children: [/* @__PURE__ */ jsx(ArrowDownUp, { className: "text-muted-foreground" }), sorting.length > 0 && /* @__PURE__ */ jsx(Badge, {
2052
+ variant: "secondary",
2053
+ className: "h-[18.24px] rounded-[3.2px] px-[5.12px] font-mono font-normal text-[10.4px]",
2054
+ children: sorting.length
2055
+ })]
2057
2056
  })
2058
2057
  }), /* @__PURE__ */ jsxs(PopoverContent, {
2059
2058
  "aria-labelledby": labelId,
@@ -2223,14 +2222,15 @@ function DataTableViewOptions({ table, disabled,...props }) {
2223
2222
  const columns = React.useMemo(() => table.getAllColumns().filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide()), [table]);
2224
2223
  return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
2225
2224
  asChild: true,
2226
- children: /* @__PURE__ */ jsxs(Button, {
2225
+ children: /* @__PURE__ */ jsx(Button, {
2227
2226
  "aria-label": "Toggle columns",
2227
+ title: "Toggle columns",
2228
2228
  role: "combobox",
2229
2229
  variant: "outline",
2230
- size: "sm",
2231
- className: "ml-auto flex h-8 font-normal",
2230
+ size: "icon-sm",
2231
+ className: "ml-auto",
2232
2232
  disabled,
2233
- children: [/* @__PURE__ */ jsx(Settings2, { className: "text-muted-foreground" }), "View"]
2233
+ children: /* @__PURE__ */ jsx(Settings2, { className: "text-muted-foreground" })
2234
2234
  })
2235
2235
  }), /* @__PURE__ */ jsx(PopoverContent, {
2236
2236
  className: "w-44 p-0",
@@ -3937,7 +3937,7 @@ const filterModeConfig = {
3937
3937
  tooltip: "Linear-style command filters"
3938
3938
  }
3939
3939
  };
3940
- function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection = true, exclude, actions, pinnedColumns, filterMode = "simple", search = false, onDeleteSelected, onUpdateSelected, batchUpdateFields, actionBarExtra, actionBarActions, deleteConfirmation, initialSorting, enableExport = true, showDefaultExport = true, onSelectedCountChange, onSelectedRowsChange, getSelectedRows }) {
3940
+ function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection = true, exclude, actions, pinnedColumns, filterMode, search = false, onDeleteSelected, onUpdateSelected, batchUpdateFields, actionBarExtra, actionBarActions, deleteConfirmation, initialSorting, enableExport = true, showDefaultExport = true, onSelectedCountChange, onSelectedRowsChange, getSelectedRows }) {
3941
3941
  const modes = filterMode ? Array.isArray(filterMode) ? filterMode : [filterMode] : DEFAULT_MODES;
3942
3942
  const [currentMode, setCurrentMode] = useQueryState("filterMode", parseAsStringEnum(modes).withDefault(modes[0] ?? "simple"));
3943
3943
  const showToggle = modes.length > 1;
@@ -4012,9 +4012,9 @@ function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection
4012
4012
  asChild: true,
4013
4013
  children: /* @__PURE__ */ jsx(Button, {
4014
4014
  variant: "outline",
4015
- size: "sm",
4016
- className: "h-8 w-8 p-0",
4015
+ size: "icon-sm",
4017
4016
  "aria-label": `Switch filter mode, current: ${filterModeConfig[currentMode].label}`,
4017
+ title: filterModeConfig[currentMode].tooltip,
4018
4018
  children: (() => {
4019
4019
  const Icon = filterModeConfig[currentMode].icon;
4020
4020
  return /* @__PURE__ */ jsx(Icon, { className: "size-4 text-muted-foreground" });
@@ -4081,22 +4081,15 @@ function AutoTable({ schema, data, pageCount = 1, overrides, enableRowSelection
4081
4081
  children: [/* @__PURE__ */ jsxs("div", {
4082
4082
  className: "flex min-h-[40px] min-w-0 flex-1 items-start gap-2",
4083
4083
  "data-filter-parent": true,
4084
- children: [
4085
- currentMode !== "simple" && searchInput,
4086
- currentMode !== "simple" && /* @__PURE__ */ jsx(DataTableSortList, {
4087
- table,
4088
- align: "start"
4089
- }),
4090
- filtersContent
4091
- ]
4084
+ children: [currentMode !== "simple" && searchInput, filtersContent]
4092
4085
  }), /* @__PURE__ */ jsxs("div", {
4093
4086
  className: "flex items-center gap-2",
4094
4087
  children: [
4095
- currentMode === "simple" && /* @__PURE__ */ jsx(DataTableSortList, {
4088
+ FilterModeSelect,
4089
+ /* @__PURE__ */ jsx(DataTableSortList, {
4096
4090
  table,
4097
4091
  align: "end"
4098
4092
  }),
4099
- FilterModeSelect,
4100
4093
  /* @__PURE__ */ jsx(DataTableViewOptions, {
4101
4094
  table,
4102
4095
  align: "end"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wordrhyme/auto-crud",
3
3
  "type": "module",
4
- "version": "1.3.5",
4
+ "version": "1.3.6",
5
5
  "description": "Schema-first CRUD components with auto-generated tables and forms",
6
6
  "author": "wordrhyme",
7
7
  "license": "MIT",
@@ -62,9 +62,9 @@
62
62
  "nanoid": "^5.1.6",
63
63
  "tailwind-merge": "^3.5.0",
64
64
  "vaul": "^1.1.2",
65
- "@wordrhyme/shadcn": "1.3.2",
65
+ "@wordrhyme/formily-shadcn": "1.12.9",
66
66
  "@wordrhyme/shadcn-ui": "1.32.4",
67
- "@wordrhyme/formily-shadcn": "1.12.9"
67
+ "@wordrhyme/shadcn": "1.3.2"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@tanstack/react-query": "^5.90.15",
@@ -83,9 +83,9 @@
83
83
  "typescript": "^5.9.3",
84
84
  "vitest": "^3.2.4",
85
85
  "@internal/eslint-config": "0.3.0",
86
+ "@internal/prettier-config": "0.0.1",
86
87
  "@internal/tsconfig": "0.1.0",
87
88
  "@internal/tsdown-config": "0.1.0",
88
- "@internal/prettier-config": "0.0.1",
89
89
  "@internal/vitest-config": "0.1.0"
90
90
  },
91
91
  "prettier": "@internal/prettier-config",