najm-kit 0.0.13 → 0.0.15

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.d.ts CHANGED
@@ -2310,7 +2310,7 @@ declare const createTableStore: () => {
2310
2310
  declare const HEADER_COLORS: {
2311
2311
  readonly primary: {
2312
2312
  readonly bg: "bg-primary/15";
2313
- readonly text: "[&_th]:text-primary";
2313
+ readonly text: "[&_th]:text-foreground";
2314
2314
  readonly row: "hover:bg-primary/5";
2315
2315
  };
2316
2316
  readonly violet: {
package/dist/index.mjs CHANGED
@@ -2406,7 +2406,7 @@ function Checkbox({ className, ...props }) {
2406
2406
  {
2407
2407
  "data-slot": "checkbox",
2408
2408
  className: cn(
2409
- "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
2409
+ "peer border-foreground/40 dark:border-foreground/50 dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
2410
2410
  className
2411
2411
  ),
2412
2412
  ...props,
@@ -3576,7 +3576,7 @@ function TableHead({ className, ...props }) {
3576
3576
  return /* @__PURE__ */ jsx("th", { "data-slot": "table-head", className: cn("text-foreground h-9 px-3 text-left align-middle text-xs font-medium uppercase tracking-wide whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props });
3577
3577
  }
3578
3578
  function TableCell({ className, ...props }) {
3579
- return /* @__PURE__ */ jsx("td", { "data-slot": "table-cell", className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props });
3579
+ return /* @__PURE__ */ jsx("td", { "data-slot": "table-cell", className: cn("px-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props });
3580
3580
  }
3581
3581
  function TableCaption({ className, ...props }) {
3582
3582
  return /* @__PURE__ */ jsx("caption", { "data-slot": "table-caption", className: cn("text-muted-foreground mt-4 text-sm", className), ...props });
@@ -7678,7 +7678,7 @@ function useTableKeyboard(options = {}) {
7678
7678
 
7679
7679
  // src/components/table/tableColors.ts
7680
7680
  var HEADER_COLORS = {
7681
- primary: { bg: "bg-primary/15", text: "[&_th]:text-primary", row: "hover:bg-primary/5" },
7681
+ primary: { bg: "bg-primary/15", text: "[&_th]:text-foreground", row: "hover:bg-primary/5" },
7682
7682
  violet: { bg: "bg-violet-600/30", text: "[&_th]:text-violet-800 dark:[&_th]:text-violet-300", row: "hover:bg-violet-500/5" },
7683
7683
  blue: { bg: "bg-blue-600/30", text: "[&_th]:text-blue-800 dark:[&_th]:text-blue-300", row: "hover:bg-blue-500/5" },
7684
7684
  emerald: { bg: "bg-emerald-600/30", text: "[&_th]:text-emerald-800 dark:[&_th]:text-emerald-400", row: "hover:bg-emerald-500/5" },
@@ -7812,7 +7812,7 @@ function NTableContent({ effectiveMode }) {
7812
7812
  onContextMenu: handleBackgroundContextMenu,
7813
7813
  children: /* @__PURE__ */ jsxs(Table, { children: [
7814
7814
  /* @__PURE__ */ jsx(TableHeader, { "data-ntable-table-header": true, className: cn("bg-card sticky top-0 z-10", colorStyle?.text, headerClassName, bordered && "[&_tr]:border-border", classNames?.tableHeader), children: table.getHeaderGroups().map((hg) => /* @__PURE__ */ jsxs(TableRow, { className: cn("hover:bg-transparent", bordered && "border-border"), children: [
7815
- showCheckbox && /* @__PURE__ */ jsx(TableHead, { className: cn("w-10 text-foreground h-12", colorStyle?.bg), children: /* @__PURE__ */ jsx(
7815
+ showCheckbox && /* @__PURE__ */ jsx(TableHead, { className: cn("w-10 text-foreground h-12 text-center", colorStyle?.bg), children: /* @__PURE__ */ jsx(
7816
7816
  Checkbox,
7817
7817
  {
7818
7818
  "aria-label": "Select all rows",
@@ -7846,7 +7846,7 @@ function NTableContent({ effectiveMode }) {
7846
7846
  } : void 0,
7847
7847
  className: cn(colorStyle?.row, classNames?.row, onRowClick && "cursor-pointer", isSelectedByRowId && "bg-brand/5 hover:bg-brand/5", bordered && "border-border"),
7848
7848
  children: [
7849
- showCheckbox && /* @__PURE__ */ jsx(TableCell, { className: "h-14 w-10", children: /* @__PURE__ */ jsx(
7849
+ showCheckbox && /* @__PURE__ */ jsx(TableCell, { className: "h-14 w-10 text-center", children: /* @__PURE__ */ jsx(
7850
7850
  Checkbox,
7851
7851
  {
7852
7852
  "aria-label": `Select row ${row.id}`,
@@ -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/dist/styles.css CHANGED
@@ -2420,6 +2420,9 @@ video {
2420
2420
  .border-emerald-500\/60 {
2421
2421
  border-color: rgb(16 185 129 / 0.6);
2422
2422
  }
2423
+ .border-foreground\/40 {
2424
+ border-color: hsl(var(--najm-foreground) / 0.4);
2425
+ }
2423
2426
  .border-green-500\/30 {
2424
2427
  border-color: rgb(34 197 94 / 0.3);
2425
2428
  }
@@ -4202,6 +4205,9 @@ video {
4202
4205
  .dark\:border-0:is(.dark *) {
4203
4206
  border-width: 0px;
4204
4207
  }
4208
+ .dark\:border-foreground\/50:is(.dark *) {
4209
+ border-color: hsl(var(--najm-foreground) / 0.5);
4210
+ }
4205
4211
  .dark\:bg-\[\#222b38\]:is(.dark *) {
4206
4212
  --tw-bg-opacity: 1;
4207
4213
  background-color: rgb(34 43 56 / var(--tw-bg-opacity, 1));
@@ -5001,8 +5007,8 @@ video {
5001
5007
  --tw-text-opacity: 1;
5002
5008
  color: rgb(6 95 70 / var(--tw-text-opacity, 1));
5003
5009
  }
5004
- .\[\&_th\]\:text-primary th {
5005
- color: hsl(var(--najm-primary));
5010
+ .\[\&_th\]\:text-foreground th {
5011
+ color: hsl(var(--najm-foreground));
5006
5012
  }
5007
5013
  .\[\&_th\]\:text-rose-800 th {
5008
5014
  --tw-text-opacity: 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najm-kit",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "description": "Reusable React UI component package for Najm framework",
6
6
  "main": "./dist/index.mjs",