najm-kit 0.0.13 → 0.0.14

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.
Files changed (2) hide show
  1. package/dist/index.mjs +23 -16
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -8188,6 +8188,7 @@ function NTablePagination() {
8188
8188
  fallback: "default"
8189
8189
  });
8190
8190
  const triggerBorderClass = borderColorClassForDegree(resolvedBorderDegree);
8191
+ const useDegreeBorder = bordered || borderDegree || resolvedBorderDegree !== "default";
8191
8192
  if (!table || !showContent || !showPagination || viewMode === "json" || viewMode === "files") return null;
8192
8193
  const filteredRows = table.getFilteredRowModel().rows;
8193
8194
  const selectedRows = table.getFilteredSelectedRowModel().rows;
@@ -8222,7 +8223,14 @@ function NTablePagination() {
8222
8223
  (!isPaginationControlled || manualPagination) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8223
8224
  /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Rows/page" }),
8224
8225
  /* @__PURE__ */ jsxs(Select, { value: `${pageSize}`, onValueChange: handlePageSizeChange, children: [
8225
- /* @__PURE__ */ jsx(SelectTrigger, { className: cn("h-8 w-[80px]", bordered && triggerBorderClass), children: /* @__PURE__ */ jsx(SelectValue, { placeholder: pageSize }) }),
8226
+ /* @__PURE__ */ jsx(
8227
+ SelectTrigger,
8228
+ {
8229
+ "data-border-degree": useDegreeBorder ? resolvedBorderDegree : void 0,
8230
+ className: cn("h-8 w-[80px]", useDegreeBorder && triggerBorderClass),
8231
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder: pageSize })
8232
+ }
8233
+ ),
8226
8234
  /* @__PURE__ */ jsx(SelectContent, { side: "top", children: currentPageSizeOptions.map((size) => /* @__PURE__ */ jsx(SelectItem, { value: `${size}`, children: size }, size)) })
8227
8235
  ] })
8228
8236
  ] }),
@@ -8412,26 +8420,26 @@ function TableSettingsMenu() {
8412
8420
  const modeItems = [];
8413
8421
  if (showViewToggle) {
8414
8422
  if (filteredModes.includes("table"))
8415
- modeItems.push({ value: "table", label: "Table", icon: /* @__PURE__ */ jsx(List, { className: "h-4 w-4" }) });
8423
+ modeItems.push({ value: "table", label: "Table", ariaLabel: "Table view", icon: /* @__PURE__ */ jsx(List, { className: "h-4 w-4" }) });
8416
8424
  if (filteredModes.includes("cards") && cardComponent)
8417
- modeItems.push({ value: "cards", label: "Cards", icon: /* @__PURE__ */ jsx(LayoutGrid, { className: "h-4 w-4" }) });
8425
+ modeItems.push({ value: "cards", label: "Cards", ariaLabel: "Cards view", icon: /* @__PURE__ */ jsx(LayoutGrid, { className: "h-4 w-4" }) });
8418
8426
  if (filteredModes.includes("json") && (jsonValue !== void 0 || renderJson))
8419
- modeItems.push({ value: "json", label: "JSON", icon: /* @__PURE__ */ jsx(Code, { className: "h-4 w-4" }) });
8427
+ modeItems.push({ value: "json", label: "JSON", ariaLabel: "JSON view", icon: /* @__PURE__ */ jsx(Code, { className: "h-4 w-4" }) });
8420
8428
  if (filteredModes.includes("files"))
8421
- modeItems.push({ value: "files", label: "Files", icon: /* @__PURE__ */ jsx(FolderOpen, { className: "h-4 w-4" }) });
8429
+ modeItems.push({ value: "files", label: "Files", ariaLabel: "Files view", icon: /* @__PURE__ */ jsx(FolderOpen, { className: "h-4 w-4" }) });
8422
8430
  }
8423
8431
  const columns = table?.getAllColumns?.().filter((c) => c.getCanHide()) ?? [];
8424
8432
  const hasModes = modeItems.length > 0;
8425
8433
  const hasColumns = columns.length > 0;
8426
8434
  return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
8427
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(BaseInput, { className: "w-auto cursor-pointer px-3", onClick: (e) => e.preventDefault(), bordered, borderDegree, children: /* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-4 w-4 shrink-0 text-muted-foreground" }) }) }),
8435
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(BaseInput, { "aria-label": "Table settings", className: "w-auto cursor-pointer px-3", bordered, borderDegree, children: /* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-4 w-4 shrink-0 text-muted-foreground" }) }) }),
8428
8436
  /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-56 bg-card", children: [
8429
8437
  showViewToggle && hasModes && /* @__PURE__ */ jsxs(Fragment, { children: [
8430
8438
  /* @__PURE__ */ jsxs(DropdownMenuLabel, { className: "flex items-center gap-2", children: [
8431
8439
  /* @__PURE__ */ jsx(Eye, { className: "h-3.5 w-3.5" }),
8432
8440
  "View"
8433
8441
  ] }),
8434
- /* @__PURE__ */ jsx(DropdownMenuRadioGroup, { value: viewMode, onValueChange: (v) => setViewMode(v), children: modeItems.map((item) => /* @__PURE__ */ jsxs(DropdownMenuRadioItem, { value: item.value, children: [
8442
+ /* @__PURE__ */ jsx(DropdownMenuRadioGroup, { value: viewMode, onValueChange: (v) => setViewMode(v), children: modeItems.map((item) => /* @__PURE__ */ jsxs(DropdownMenuRadioItem, { value: item.value, "aria-label": item.ariaLabel, children: [
8435
8443
  item.icon,
8436
8444
  /* @__PURE__ */ jsx("span", { children: item.label })
8437
8445
  ] }, item.value)) })
@@ -8478,10 +8486,10 @@ function NTableHeader() {
8478
8486
  const hideDataChrome = isLoading || error || hasNoData && !isFilteredEmpty;
8479
8487
  if (isCustomMode) {
8480
8488
  if (!showViewToggle && !showColumnVisibility && !headerSlot && !hasControls) return null;
8481
- if (hideDataChrome && !hasControls) return null;
8482
- const justify2 = headerSlot && !hideDataChrome ? "justify-between" : "justify-end";
8489
+ if (hideDataChrome) return null;
8490
+ const justify2 = headerSlot ? "justify-between" : "justify-end";
8483
8491
  return /* @__PURE__ */ jsxs("div", { "data-ntable-header": true, className: cn("flex shrink-0 items-center gap-3 flex-wrap lg:flex-nowrap", justify2, classNames?.header), children: [
8484
- headerSlot && !hideDataChrome && /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: headerSlot }),
8492
+ headerSlot && /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: headerSlot }),
8485
8493
  hasControls && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 shrink-0", children: [
8486
8494
  /* @__PURE__ */ jsx(TableSettingsMenu, {}),
8487
8495
  /* @__PURE__ */ jsx(TableAddButton, {})
@@ -8491,13 +8499,12 @@ function NTableHeader() {
8491
8499
  const hasFilters = Array.isArray(filters) && filters.length > 0;
8492
8500
  const hasToolbar = Boolean(renderToolbar);
8493
8501
  if (!hasFilters && !hasControls && !headerSlot && !hasToolbar) return null;
8494
- if (hideDataChrome && !hasControls) return null;
8495
- const onlyControls = hideDataChrome && hasControls && !headerSlot && !hasToolbar;
8496
- const justify = onlyControls ? "justify-end" : hasControls || headerSlot || hasToolbar ? "justify-between" : "justify-start";
8502
+ if (hideDataChrome) return null;
8503
+ const justify = hasControls || headerSlot || hasToolbar ? "justify-between" : "justify-start";
8497
8504
  return /* @__PURE__ */ jsxs("div", { "data-ntable-header": true, className: cn("flex shrink-0 items-center gap-3 flex-wrap lg:flex-nowrap", justify, classNames?.header), children: [
8498
- !hideDataChrome && /* @__PURE__ */ jsx(TableFilters, {}),
8499
- headerSlot && !hideDataChrome && /* @__PURE__ */ jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: headerSlot }),
8500
- !hideDataChrome && /* @__PURE__ */ jsx(TableToolbarSlot, {}),
8505
+ /* @__PURE__ */ jsx(TableFilters, {}),
8506
+ headerSlot && /* @__PURE__ */ jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: headerSlot }),
8507
+ /* @__PURE__ */ jsx(TableToolbarSlot, {}),
8501
8508
  hasControls && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 shrink-0", children: [
8502
8509
  /* @__PURE__ */ jsx(TableSettingsMenu, {}),
8503
8510
  /* @__PURE__ */ jsx(TableAddButton, {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najm-kit",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "type": "module",
5
5
  "description": "Reusable React UI component package for Najm framework",
6
6
  "main": "./dist/index.mjs",