@juv/codego-react-ui 3.1.1 → 3.1.4

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
@@ -2131,13 +2131,19 @@ var import_react_dom = require("react-dom");
2131
2131
 
2132
2132
  // src/components/tools/decryptPayload.ts
2133
2133
  var import_crypto_js = __toESM(require("crypto-js"), 1);
2134
- var import_meta = {};
2135
2134
  function getLaravelSecretKey() {
2136
- const viteKey = import_meta.env["VITE_LARAVEL_KEY"];
2135
+ const viteKey = (() => {
2136
+ try {
2137
+ return new Function("return import.meta.env")();
2138
+ } catch {
2139
+ return void 0;
2140
+ }
2141
+ })()?.VITE_LARAVEL_KEY;
2137
2142
  const legacyKey = globalThis?.process?.env?.REACT_APP_LARAVEL_KEY;
2138
- const key = viteKey || legacyKey;
2143
+ const windowKey = globalThis?.__LARAVEL_KEY__;
2144
+ const key = viteKey || legacyKey || windowKey;
2139
2145
  if (!key) {
2140
- throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env.");
2146
+ throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env or inject window.__LARAVEL_KEY__ via Blade.");
2141
2147
  }
2142
2148
  return key;
2143
2149
  }
@@ -2155,13 +2161,13 @@ function parseLaravelEncryptedPayload(payload) {
2155
2161
  }
2156
2162
  return JSON.parse(jsonStr);
2157
2163
  }
2158
- function decryptLaravelPayload(payload) {
2159
- const secretKey = getLaravelSecretKey();
2164
+ function decryptLaravelPayload(payload, secretKey) {
2165
+ const resolvedKey = secretKey ?? getLaravelSecretKey();
2160
2166
  const parsed = parseLaravelEncryptedPayload(payload);
2161
2167
  if (parsed.tag) {
2162
2168
  throw new Error("Unsupported Laravel cipher (AEAD tag present). Expected AES-*-CBC payload.");
2163
2169
  }
2164
- const key = parseLaravelKey(secretKey);
2170
+ const key = parseLaravelKey(resolvedKey);
2165
2171
  const expectedMac = import_crypto_js.default.HmacSHA256(parsed.iv + parsed.value, key).toString();
2166
2172
  if (expectedMac !== parsed.mac) {
2167
2173
  throw new Error("Invalid payload MAC (wrong key or tampered payload).");
@@ -2178,7 +2184,6 @@ function decryptLaravelPayload(payload) {
2178
2184
  if (!plaintext) {
2179
2185
  throw new Error("Decryption produced empty plaintext (wrong key/cipher).");
2180
2186
  }
2181
- console.log("Decrypted payload:", plaintext);
2182
2187
  return JSON.parse(plaintext);
2183
2188
  }
2184
2189
 
@@ -4899,7 +4904,7 @@ Input.displayName = "Input";
4899
4904
 
4900
4905
  // src/components/ui/data-grid.tsx
4901
4906
  var import_jsx_runtime28 = require("react/jsx-runtime");
4902
- function useServerDataGrid({ url, params, encrypt }) {
4907
+ function useServerDataGrid({ url, params, encrypt, key }) {
4903
4908
  const [data, setData] = React24.useState([]);
4904
4909
  const [columns, setColumns] = React24.useState([]);
4905
4910
  const [currentPage, setCurrentPage] = React24.useState(1);
@@ -4913,7 +4918,7 @@ function useServerDataGrid({ url, params, encrypt }) {
4913
4918
  setError(null);
4914
4919
  import_axios.default.get(url, { params: { ...params, page: currentPage } }).then(({ data: res }) => {
4915
4920
  if (cancelled) return;
4916
- const payload = encrypt ? decryptLaravelPayload(res) : res;
4921
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
4917
4922
  setData(payload.data);
4918
4923
  const rawTotal = payload.total;
4919
4924
  const rawPerPage = payload.per_page;
@@ -4932,9 +4937,9 @@ function useServerDataGrid({ url, params, encrypt }) {
4932
4937
  setPagination(pg);
4933
4938
  if (payload.data.length > 0) {
4934
4939
  setColumns(
4935
- Object.keys(payload.data[0]).map((key) => ({
4936
- key,
4937
- header: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
4940
+ Object.keys(payload.data[0]).map((key2) => ({
4941
+ key: key2,
4942
+ header: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
4938
4943
  }))
4939
4944
  );
4940
4945
  }
@@ -5193,9 +5198,9 @@ function DataGrid({
5193
5198
  const [viewItem, setViewItem] = React24.useState(null);
5194
5199
  const [editItem, setEditItem] = React24.useState(null);
5195
5200
  const [deleteItem, setDeleteItem] = React24.useState(null);
5196
- const [tableData, setTableData] = React24.useState(data);
5201
+ const [tableData, setTableData] = React24.useState(data ?? []);
5197
5202
  React24.useEffect(() => {
5198
- setTableData(data);
5203
+ setTableData(data ?? []);
5199
5204
  }, [data]);
5200
5205
  const actionIdKey = defaultActions?.idKey ?? (typeof rowKey === "string" ? rowKey : "id");
5201
5206
  const autoFields = React24.useMemo(() => {
@@ -5240,7 +5245,7 @@ function DataGrid({
5240
5245
  document.addEventListener("mousedown", handler);
5241
5246
  return () => document.removeEventListener("mousedown", handler);
5242
5247
  }, []);
5243
- let processed = data.filter(
5248
+ let processed = (data ?? []).filter(
5244
5249
  (row) => Object.entries(filters).every(([k, v]) => {
5245
5250
  if (!v) return true;
5246
5251
  const cell = String(row[k] ?? "").toLowerCase();
@@ -5438,7 +5443,16 @@ function DataGrid({
5438
5443
  serverPagination && (() => {
5439
5444
  const { pagination, currentPage: cp, goToPage } = serverPagination;
5440
5445
  const totalServerPages = pagination.last_page ?? Math.ceil(pagination.total / pagination.per_page);
5441
- const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
5446
+ const pills = [];
5447
+ if (totalServerPages <= 7) {
5448
+ for (let i = 1; i <= totalServerPages; i++) pills.push(i);
5449
+ } else if (cp <= 4) {
5450
+ pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
5451
+ } else if (cp >= totalServerPages - 3) {
5452
+ pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
5453
+ } else {
5454
+ pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
5455
+ }
5442
5456
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
5443
5457
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
5444
5458
  pagination.total,
@@ -5457,18 +5471,20 @@ function DataGrid({
5457
5471
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ChevronLeft, { className: "h-4 w-4" })
5458
5472
  }
5459
5473
  ),
5460
- pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5461
- "button",
5462
- {
5463
- onClick: () => goToPage(p),
5464
- className: cn(
5465
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
5466
- p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
5467
- ),
5468
- children: p
5469
- },
5470
- p
5471
- )),
5474
+ pills.map(
5475
+ (p, i) => p < 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5476
+ "button",
5477
+ {
5478
+ onClick: () => goToPage(p),
5479
+ className: cn(
5480
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
5481
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
5482
+ ),
5483
+ children: p
5484
+ },
5485
+ p
5486
+ )
5487
+ ),
5472
5488
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5473
5489
  "button",
5474
5490
  {
@@ -9552,7 +9568,7 @@ var import_react_dom2 = require("react-dom");
9552
9568
  var import_axios2 = __toESM(require("axios"), 1);
9553
9569
  var import_lucide_react28 = require("lucide-react");
9554
9570
  var import_jsx_runtime55 = require("react/jsx-runtime");
9555
- function useServerTable({ url, params, encrypt }) {
9571
+ function useServerTable({ url, params, encrypt, key }) {
9556
9572
  const [data, setData] = React44.useState([]);
9557
9573
  const [columns, setColumns] = React44.useState([]);
9558
9574
  const [currentPage, setCurrentPage] = React44.useState(1);
@@ -9568,7 +9584,7 @@ function useServerTable({ url, params, encrypt }) {
9568
9584
  params: { ...params, page: currentPage }
9569
9585
  }).then(({ data: res }) => {
9570
9586
  if (cancelled) return;
9571
- const payload = encrypt ? decryptLaravelPayload(res) : res;
9587
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
9572
9588
  setData(payload.data);
9573
9589
  const rawTotal = payload.total;
9574
9590
  const rawPerPage = payload.per_page;
@@ -9587,9 +9603,9 @@ function useServerTable({ url, params, encrypt }) {
9587
9603
  setPagination(pg);
9588
9604
  if (payload.data.length > 0) {
9589
9605
  setColumns(
9590
- Object.keys(payload.data[0]).map((key) => ({
9591
- key,
9592
- title: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
9606
+ Object.keys(payload.data[0]).map((key2) => ({
9607
+ key: key2,
9608
+ title: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
9593
9609
  }))
9594
9610
  );
9595
9611
  }
@@ -9926,9 +9942,9 @@ function Table({
9926
9942
  const [viewItem, setViewItem] = React44.useState(null);
9927
9943
  const [editItem, setEditItem] = React44.useState(null);
9928
9944
  const [deleteItem, setDeleteItem] = React44.useState(null);
9929
- const [tableData, setTableData] = React44.useState(data);
9945
+ const [tableData, setTableData] = React44.useState(data ?? []);
9930
9946
  React44.useEffect(() => {
9931
- setTableData(data);
9947
+ setTableData(data ?? []);
9932
9948
  }, [data]);
9933
9949
  const actionIdKey = defaultActions?.idKey ?? idKey;
9934
9950
  const autoFields = React44.useMemo(() => {
@@ -10251,7 +10267,16 @@ function Table({
10251
10267
  serverPagination && (() => {
10252
10268
  const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
10253
10269
  const totalServerPages = pagination2.last_page ?? Math.ceil(pagination2.total / pagination2.per_page);
10254
- const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
10270
+ const pills = [];
10271
+ if (totalServerPages <= 7) {
10272
+ for (let i = 1; i <= totalServerPages; i++) pills.push(i);
10273
+ } else if (cp <= 4) {
10274
+ pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
10275
+ } else if (cp >= totalServerPages - 3) {
10276
+ pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
10277
+ } else {
10278
+ pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
10279
+ }
10255
10280
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
10256
10281
  /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
10257
10282
  pagination2.total,
@@ -10270,18 +10295,20 @@ function Table({
10270
10295
  children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react28.ChevronLeft, { className: "h-4 w-4" })
10271
10296
  }
10272
10297
  ),
10273
- pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
10274
- "button",
10275
- {
10276
- onClick: () => goToPage(p),
10277
- className: cn(
10278
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
10279
- p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
10280
- ),
10281
- children: p
10282
- },
10283
- p
10284
- )),
10298
+ pills.map(
10299
+ (p, i) => p < 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
10300
+ "button",
10301
+ {
10302
+ onClick: () => goToPage(p),
10303
+ className: cn(
10304
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
10305
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
10306
+ ),
10307
+ children: p
10308
+ },
10309
+ p
10310
+ )
10311
+ ),
10285
10312
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
10286
10313
  "button",
10287
10314
  {
package/dist/index.d.cts CHANGED
@@ -361,8 +361,10 @@ interface UseServerTableOptions {
361
361
  url: string;
362
362
  /** Extra query params merged on every request */
363
363
  params?: Record<string, string | number>;
364
- /** If true, the response is expected to be a Laravel-encrypted payload and will be decrypted using VITE_LARAVEL_KEY */
364
+ /** If true, the response is expected to be a Laravel-encrypted payload */
365
365
  encrypt?: boolean;
366
+ /** Laravel APP_KEY used for decryption. Pass import.meta.env["VITE_LARAVEL_KEY"] */
367
+ key?: string;
366
368
  }
367
369
  interface UseServerTableReturn<T> {
368
370
  data: T[];
@@ -380,7 +382,7 @@ interface ServerPaginationProp {
380
382
  currentPage: number;
381
383
  goToPage: (page: number) => void;
382
384
  }
383
- declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt }: UseServerTableOptions): UseServerTableReturn<T>;
385
+ declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt, key }: UseServerTableOptions): UseServerTableReturn<T>;
384
386
  type ActionFieldType = "input" | "password" | "textarea" | "checkbox" | "toggle" | "select" | "radio" | "slider" | "tag-input" | "otp" | "combobox" | "color-picker" | "date-range" | "rich-text" | "file-upload" | "repeater";
385
387
  interface ActionField {
386
388
  key: string;
@@ -467,8 +469,10 @@ interface ServerDataGridProp {
467
469
  interface UseServerDataGridOptions {
468
470
  url: string;
469
471
  params?: Record<string, string | number>;
470
- /** If true, the response is expected to be a Laravel-encrypted payload and will be decrypted using VITE_LARAVEL_KEY */
472
+ /** If true, the response is expected to be a Laravel-encrypted payload */
471
473
  encrypt?: boolean;
474
+ /** Laravel APP_KEY used for decryption. Pass import.meta.env["VITE_LARAVEL_KEY"] */
475
+ key?: string;
472
476
  }
473
477
  interface UseServerDataGridReturn<T> {
474
478
  data: T[];
@@ -481,7 +485,7 @@ interface UseServerDataGridReturn<T> {
481
485
  goToPage: (page: number) => void;
482
486
  reload: () => void;
483
487
  }
484
- declare function useServerDataGrid<T extends Record<string, any>>({ url, params, encrypt }: UseServerDataGridOptions): UseServerDataGridReturn<T>;
488
+ declare function useServerDataGrid<T extends Record<string, any>>({ url, params, encrypt, key }: UseServerDataGridOptions): UseServerDataGridReturn<T>;
485
489
  type SortDir = "asc" | "desc" | null;
486
490
  interface DataGridColumn<T> {
487
491
  key: keyof T | string;
package/dist/index.d.ts CHANGED
@@ -361,8 +361,10 @@ interface UseServerTableOptions {
361
361
  url: string;
362
362
  /** Extra query params merged on every request */
363
363
  params?: Record<string, string | number>;
364
- /** If true, the response is expected to be a Laravel-encrypted payload and will be decrypted using VITE_LARAVEL_KEY */
364
+ /** If true, the response is expected to be a Laravel-encrypted payload */
365
365
  encrypt?: boolean;
366
+ /** Laravel APP_KEY used for decryption. Pass import.meta.env["VITE_LARAVEL_KEY"] */
367
+ key?: string;
366
368
  }
367
369
  interface UseServerTableReturn<T> {
368
370
  data: T[];
@@ -380,7 +382,7 @@ interface ServerPaginationProp {
380
382
  currentPage: number;
381
383
  goToPage: (page: number) => void;
382
384
  }
383
- declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt }: UseServerTableOptions): UseServerTableReturn<T>;
385
+ declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt, key }: UseServerTableOptions): UseServerTableReturn<T>;
384
386
  type ActionFieldType = "input" | "password" | "textarea" | "checkbox" | "toggle" | "select" | "radio" | "slider" | "tag-input" | "otp" | "combobox" | "color-picker" | "date-range" | "rich-text" | "file-upload" | "repeater";
385
387
  interface ActionField {
386
388
  key: string;
@@ -467,8 +469,10 @@ interface ServerDataGridProp {
467
469
  interface UseServerDataGridOptions {
468
470
  url: string;
469
471
  params?: Record<string, string | number>;
470
- /** If true, the response is expected to be a Laravel-encrypted payload and will be decrypted using VITE_LARAVEL_KEY */
472
+ /** If true, the response is expected to be a Laravel-encrypted payload */
471
473
  encrypt?: boolean;
474
+ /** Laravel APP_KEY used for decryption. Pass import.meta.env["VITE_LARAVEL_KEY"] */
475
+ key?: string;
472
476
  }
473
477
  interface UseServerDataGridReturn<T> {
474
478
  data: T[];
@@ -481,7 +485,7 @@ interface UseServerDataGridReturn<T> {
481
485
  goToPage: (page: number) => void;
482
486
  reload: () => void;
483
487
  }
484
- declare function useServerDataGrid<T extends Record<string, any>>({ url, params, encrypt }: UseServerDataGridOptions): UseServerDataGridReturn<T>;
488
+ declare function useServerDataGrid<T extends Record<string, any>>({ url, params, encrypt, key }: UseServerDataGridOptions): UseServerDataGridReturn<T>;
485
489
  type SortDir = "asc" | "desc" | null;
486
490
  interface DataGridColumn<T> {
487
491
  key: keyof T | string;
@@ -59632,13 +59632,19 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
59632
59632
 
59633
59633
  // src/components/tools/decryptPayload.ts
59634
59634
  var import_crypto_js = __toESM(require_crypto_js(), 1);
59635
- var import_meta = {};
59636
59635
  function getLaravelSecretKey() {
59637
- const viteKey = import_meta.env["VITE_LARAVEL_KEY"];
59636
+ const viteKey = (() => {
59637
+ try {
59638
+ return new Function("return import.meta.env")();
59639
+ } catch {
59640
+ return void 0;
59641
+ }
59642
+ })()?.VITE_LARAVEL_KEY;
59638
59643
  const legacyKey = globalThis?.process?.env?.REACT_APP_LARAVEL_KEY;
59639
- const key = viteKey || legacyKey;
59644
+ const windowKey = globalThis?.__LARAVEL_KEY__;
59645
+ const key = viteKey || legacyKey || windowKey;
59640
59646
  if (!key) {
59641
- throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env.");
59647
+ throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env or inject window.__LARAVEL_KEY__ via Blade.");
59642
59648
  }
59643
59649
  return key;
59644
59650
  }
@@ -59656,13 +59662,13 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
59656
59662
  }
59657
59663
  return JSON.parse(jsonStr);
59658
59664
  }
59659
- function decryptLaravelPayload(payload) {
59660
- const secretKey = getLaravelSecretKey();
59665
+ function decryptLaravelPayload(payload, secretKey) {
59666
+ const resolvedKey = secretKey ?? getLaravelSecretKey();
59661
59667
  const parsed = parseLaravelEncryptedPayload(payload);
59662
59668
  if (parsed.tag) {
59663
59669
  throw new Error("Unsupported Laravel cipher (AEAD tag present). Expected AES-*-CBC payload.");
59664
59670
  }
59665
- const key = parseLaravelKey(secretKey);
59671
+ const key = parseLaravelKey(resolvedKey);
59666
59672
  const expectedMac = import_crypto_js.default.HmacSHA256(parsed.iv + parsed.value, key).toString();
59667
59673
  if (expectedMac !== parsed.mac) {
59668
59674
  throw new Error("Invalid payload MAC (wrong key or tampered payload).");
@@ -59679,7 +59685,6 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
59679
59685
  if (!plaintext) {
59680
59686
  throw new Error("Decryption produced empty plaintext (wrong key/cipher).");
59681
59687
  }
59682
- console.log("Decrypted payload:", plaintext);
59683
59688
  return JSON.parse(plaintext);
59684
59689
  }
59685
59690
 
@@ -68023,7 +68028,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
68023
68028
 
68024
68029
  // src/components/ui/data-grid.tsx
68025
68030
  var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
68026
- function useServerDataGrid({ url: url2, params, encrypt }) {
68031
+ function useServerDataGrid({ url: url2, params, encrypt, key }) {
68027
68032
  const [data, setData] = React24.useState([]);
68028
68033
  const [columns, setColumns] = React24.useState([]);
68029
68034
  const [currentPage, setCurrentPage] = React24.useState(1);
@@ -68037,7 +68042,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
68037
68042
  setError(null);
68038
68043
  axios_default.get(url2, { params: { ...params, page: currentPage } }).then(({ data: res }) => {
68039
68044
  if (cancelled) return;
68040
- const payload = encrypt ? decryptLaravelPayload(res) : res;
68045
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
68041
68046
  setData(payload.data);
68042
68047
  const rawTotal = payload.total;
68043
68048
  const rawPerPage = payload.per_page;
@@ -68056,9 +68061,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
68056
68061
  setPagination(pg);
68057
68062
  if (payload.data.length > 0) {
68058
68063
  setColumns(
68059
- Object.keys(payload.data[0]).map((key) => ({
68060
- key,
68061
- header: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
68064
+ Object.keys(payload.data[0]).map((key2) => ({
68065
+ key: key2,
68066
+ header: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
68062
68067
  }))
68063
68068
  );
68064
68069
  }
@@ -68317,9 +68322,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
68317
68322
  const [viewItem, setViewItem] = React24.useState(null);
68318
68323
  const [editItem, setEditItem] = React24.useState(null);
68319
68324
  const [deleteItem, setDeleteItem] = React24.useState(null);
68320
- const [tableData, setTableData] = React24.useState(data);
68325
+ const [tableData, setTableData] = React24.useState(data ?? []);
68321
68326
  React24.useEffect(() => {
68322
- setTableData(data);
68327
+ setTableData(data ?? []);
68323
68328
  }, [data]);
68324
68329
  const actionIdKey = defaultActions?.idKey ?? (typeof rowKey === "string" ? rowKey : "id");
68325
68330
  const autoFields = React24.useMemo(() => {
@@ -68364,7 +68369,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
68364
68369
  document.addEventListener("mousedown", handler);
68365
68370
  return () => document.removeEventListener("mousedown", handler);
68366
68371
  }, []);
68367
- let processed = data.filter(
68372
+ let processed = (data ?? []).filter(
68368
68373
  (row) => Object.entries(filters).every(([k, v]) => {
68369
68374
  if (!v) return true;
68370
68375
  const cell = String(row[k] ?? "").toLowerCase();
@@ -68562,7 +68567,16 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
68562
68567
  serverPagination && (() => {
68563
68568
  const { pagination, currentPage: cp, goToPage } = serverPagination;
68564
68569
  const totalServerPages = pagination.last_page ?? Math.ceil(pagination.total / pagination.per_page);
68565
- const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
68570
+ const pills = [];
68571
+ if (totalServerPages <= 7) {
68572
+ for (let i = 1; i <= totalServerPages; i++) pills.push(i);
68573
+ } else if (cp <= 4) {
68574
+ pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
68575
+ } else if (cp >= totalServerPages - 3) {
68576
+ pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
68577
+ } else {
68578
+ pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
68579
+ }
68566
68580
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
68567
68581
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
68568
68582
  pagination.total,
@@ -68581,18 +68595,20 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
68581
68595
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronLeft, { className: "h-4 w-4" })
68582
68596
  }
68583
68597
  ),
68584
- pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
68585
- "button",
68586
- {
68587
- onClick: () => goToPage(p),
68588
- className: cn(
68589
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
68590
- p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
68591
- ),
68592
- children: p
68593
- },
68594
- p
68595
- )),
68598
+ pills.map(
68599
+ (p, i) => p < 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
68600
+ "button",
68601
+ {
68602
+ onClick: () => goToPage(p),
68603
+ className: cn(
68604
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
68605
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
68606
+ ),
68607
+ children: p
68608
+ },
68609
+ p
68610
+ )
68611
+ ),
68596
68612
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
68597
68613
  "button",
68598
68614
  {
@@ -73087,7 +73103,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
73087
73103
  var React46 = __toESM(require_react(), 1);
73088
73104
  var import_react_dom3 = __toESM(require_react_dom(), 1);
73089
73105
  var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
73090
- function useServerTable({ url: url2, params, encrypt }) {
73106
+ function useServerTable({ url: url2, params, encrypt, key }) {
73091
73107
  const [data, setData] = React46.useState([]);
73092
73108
  const [columns, setColumns] = React46.useState([]);
73093
73109
  const [currentPage, setCurrentPage] = React46.useState(1);
@@ -73103,7 +73119,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
73103
73119
  params: { ...params, page: currentPage }
73104
73120
  }).then(({ data: res }) => {
73105
73121
  if (cancelled) return;
73106
- const payload = encrypt ? decryptLaravelPayload(res) : res;
73122
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
73107
73123
  setData(payload.data);
73108
73124
  const rawTotal = payload.total;
73109
73125
  const rawPerPage = payload.per_page;
@@ -73122,9 +73138,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
73122
73138
  setPagination(pg);
73123
73139
  if (payload.data.length > 0) {
73124
73140
  setColumns(
73125
- Object.keys(payload.data[0]).map((key) => ({
73126
- key,
73127
- title: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
73141
+ Object.keys(payload.data[0]).map((key2) => ({
73142
+ key: key2,
73143
+ title: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
73128
73144
  }))
73129
73145
  );
73130
73146
  }
@@ -73461,9 +73477,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
73461
73477
  const [viewItem, setViewItem] = React46.useState(null);
73462
73478
  const [editItem, setEditItem] = React46.useState(null);
73463
73479
  const [deleteItem, setDeleteItem] = React46.useState(null);
73464
- const [tableData, setTableData] = React46.useState(data);
73480
+ const [tableData, setTableData] = React46.useState(data ?? []);
73465
73481
  React46.useEffect(() => {
73466
- setTableData(data);
73482
+ setTableData(data ?? []);
73467
73483
  }, [data]);
73468
73484
  const actionIdKey = defaultActions?.idKey ?? idKey;
73469
73485
  const autoFields = React46.useMemo(() => {
@@ -73786,7 +73802,16 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
73786
73802
  serverPagination && (() => {
73787
73803
  const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
73788
73804
  const totalServerPages = pagination2.last_page ?? Math.ceil(pagination2.total / pagination2.per_page);
73789
- const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
73805
+ const pills = [];
73806
+ if (totalServerPages <= 7) {
73807
+ for (let i = 1; i <= totalServerPages; i++) pills.push(i);
73808
+ } else if (cp <= 4) {
73809
+ pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
73810
+ } else if (cp >= totalServerPages - 3) {
73811
+ pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
73812
+ } else {
73813
+ pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
73814
+ }
73790
73815
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
73791
73816
  /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
73792
73817
  pagination2.total,
@@ -73805,18 +73830,20 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
73805
73830
  children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ChevronLeft, { className: "h-4 w-4" })
73806
73831
  }
73807
73832
  ),
73808
- pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
73809
- "button",
73810
- {
73811
- onClick: () => goToPage(p),
73812
- className: cn(
73813
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
73814
- p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
73815
- ),
73816
- children: p
73817
- },
73818
- p
73819
- )),
73833
+ pills.map(
73834
+ (p, i) => p < 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
73835
+ "button",
73836
+ {
73837
+ onClick: () => goToPage(p),
73838
+ className: cn(
73839
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
73840
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
73841
+ ),
73842
+ children: p
73843
+ },
73844
+ p
73845
+ )
73846
+ ),
73820
73847
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
73821
73848
  "button",
73822
73849
  {
package/dist/index.js CHANGED
@@ -2001,11 +2001,18 @@ import { createPortal as createPortal2 } from "react-dom";
2001
2001
  // src/components/tools/decryptPayload.ts
2002
2002
  import CryptoJS from "crypto-js";
2003
2003
  function getLaravelSecretKey() {
2004
- const viteKey = import.meta.env["VITE_LARAVEL_KEY"];
2004
+ const viteKey = (() => {
2005
+ try {
2006
+ return new Function("return import.meta.env")();
2007
+ } catch {
2008
+ return void 0;
2009
+ }
2010
+ })()?.VITE_LARAVEL_KEY;
2005
2011
  const legacyKey = globalThis?.process?.env?.REACT_APP_LARAVEL_KEY;
2006
- const key = viteKey || legacyKey;
2012
+ const windowKey = globalThis?.__LARAVEL_KEY__;
2013
+ const key = viteKey || legacyKey || windowKey;
2007
2014
  if (!key) {
2008
- throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env.");
2015
+ throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env or inject window.__LARAVEL_KEY__ via Blade.");
2009
2016
  }
2010
2017
  return key;
2011
2018
  }
@@ -2023,13 +2030,13 @@ function parseLaravelEncryptedPayload(payload) {
2023
2030
  }
2024
2031
  return JSON.parse(jsonStr);
2025
2032
  }
2026
- function decryptLaravelPayload(payload) {
2027
- const secretKey = getLaravelSecretKey();
2033
+ function decryptLaravelPayload(payload, secretKey) {
2034
+ const resolvedKey = secretKey ?? getLaravelSecretKey();
2028
2035
  const parsed = parseLaravelEncryptedPayload(payload);
2029
2036
  if (parsed.tag) {
2030
2037
  throw new Error("Unsupported Laravel cipher (AEAD tag present). Expected AES-*-CBC payload.");
2031
2038
  }
2032
- const key = parseLaravelKey(secretKey);
2039
+ const key = parseLaravelKey(resolvedKey);
2033
2040
  const expectedMac = CryptoJS.HmacSHA256(parsed.iv + parsed.value, key).toString();
2034
2041
  if (expectedMac !== parsed.mac) {
2035
2042
  throw new Error("Invalid payload MAC (wrong key or tampered payload).");
@@ -2046,7 +2053,6 @@ function decryptLaravelPayload(payload) {
2046
2053
  if (!plaintext) {
2047
2054
  throw new Error("Decryption produced empty plaintext (wrong key/cipher).");
2048
2055
  }
2049
- console.log("Decrypted payload:", plaintext);
2050
2056
  return JSON.parse(plaintext);
2051
2057
  }
2052
2058
 
@@ -4784,7 +4790,7 @@ Input.displayName = "Input";
4784
4790
 
4785
4791
  // src/components/ui/data-grid.tsx
4786
4792
  import { Fragment as Fragment9, jsx as jsx28, jsxs as jsxs27 } from "react/jsx-runtime";
4787
- function useServerDataGrid({ url, params, encrypt }) {
4793
+ function useServerDataGrid({ url, params, encrypt, key }) {
4788
4794
  const [data, setData] = React24.useState([]);
4789
4795
  const [columns, setColumns] = React24.useState([]);
4790
4796
  const [currentPage, setCurrentPage] = React24.useState(1);
@@ -4798,7 +4804,7 @@ function useServerDataGrid({ url, params, encrypt }) {
4798
4804
  setError(null);
4799
4805
  axios.get(url, { params: { ...params, page: currentPage } }).then(({ data: res }) => {
4800
4806
  if (cancelled) return;
4801
- const payload = encrypt ? decryptLaravelPayload(res) : res;
4807
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
4802
4808
  setData(payload.data);
4803
4809
  const rawTotal = payload.total;
4804
4810
  const rawPerPage = payload.per_page;
@@ -4817,9 +4823,9 @@ function useServerDataGrid({ url, params, encrypt }) {
4817
4823
  setPagination(pg);
4818
4824
  if (payload.data.length > 0) {
4819
4825
  setColumns(
4820
- Object.keys(payload.data[0]).map((key) => ({
4821
- key,
4822
- header: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
4826
+ Object.keys(payload.data[0]).map((key2) => ({
4827
+ key: key2,
4828
+ header: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
4823
4829
  }))
4824
4830
  );
4825
4831
  }
@@ -5078,9 +5084,9 @@ function DataGrid({
5078
5084
  const [viewItem, setViewItem] = React24.useState(null);
5079
5085
  const [editItem, setEditItem] = React24.useState(null);
5080
5086
  const [deleteItem, setDeleteItem] = React24.useState(null);
5081
- const [tableData, setTableData] = React24.useState(data);
5087
+ const [tableData, setTableData] = React24.useState(data ?? []);
5082
5088
  React24.useEffect(() => {
5083
- setTableData(data);
5089
+ setTableData(data ?? []);
5084
5090
  }, [data]);
5085
5091
  const actionIdKey = defaultActions?.idKey ?? (typeof rowKey === "string" ? rowKey : "id");
5086
5092
  const autoFields = React24.useMemo(() => {
@@ -5125,7 +5131,7 @@ function DataGrid({
5125
5131
  document.addEventListener("mousedown", handler);
5126
5132
  return () => document.removeEventListener("mousedown", handler);
5127
5133
  }, []);
5128
- let processed = data.filter(
5134
+ let processed = (data ?? []).filter(
5129
5135
  (row) => Object.entries(filters).every(([k, v]) => {
5130
5136
  if (!v) return true;
5131
5137
  const cell = String(row[k] ?? "").toLowerCase();
@@ -5323,7 +5329,16 @@ function DataGrid({
5323
5329
  serverPagination && (() => {
5324
5330
  const { pagination, currentPage: cp, goToPage } = serverPagination;
5325
5331
  const totalServerPages = pagination.last_page ?? Math.ceil(pagination.total / pagination.per_page);
5326
- const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
5332
+ const pills = [];
5333
+ if (totalServerPages <= 7) {
5334
+ for (let i = 1; i <= totalServerPages; i++) pills.push(i);
5335
+ } else if (cp <= 4) {
5336
+ pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
5337
+ } else if (cp >= totalServerPages - 3) {
5338
+ pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
5339
+ } else {
5340
+ pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
5341
+ }
5327
5342
  return /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
5328
5343
  /* @__PURE__ */ jsxs27("span", { className: "text-xs text-muted-foreground", children: [
5329
5344
  pagination.total,
@@ -5342,18 +5357,20 @@ function DataGrid({
5342
5357
  children: /* @__PURE__ */ jsx28(ChevronLeft5, { className: "h-4 w-4" })
5343
5358
  }
5344
5359
  ),
5345
- pageLinks.map((p) => /* @__PURE__ */ jsx28(
5346
- "button",
5347
- {
5348
- onClick: () => goToPage(p),
5349
- className: cn(
5350
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
5351
- p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
5352
- ),
5353
- children: p
5354
- },
5355
- p
5356
- )),
5360
+ pills.map(
5361
+ (p, i) => p < 0 ? /* @__PURE__ */ jsx28("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ jsx28(
5362
+ "button",
5363
+ {
5364
+ onClick: () => goToPage(p),
5365
+ className: cn(
5366
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
5367
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
5368
+ ),
5369
+ children: p
5370
+ },
5371
+ p
5372
+ )
5373
+ ),
5357
5374
  /* @__PURE__ */ jsx28(
5358
5375
  "button",
5359
5376
  {
@@ -9437,7 +9454,7 @@ import { createPortal as createPortal4 } from "react-dom";
9437
9454
  import axios2 from "axios";
9438
9455
  import { ChevronLeft as ChevronLeft6, ChevronRight as ChevronRight9, Search as Search5, Trash2 as Trash23, ChevronsUpDown as ChevronsUpDown2, ChevronUp as ChevronUp2, ChevronDown as ChevronDown7, X as X13, Eye as Eye2, Pencil as Pencil2, Trash as Trash3, Loader2 as Loader22 } from "lucide-react";
9439
9456
  import { Fragment as Fragment15, jsx as jsx55, jsxs as jsxs48 } from "react/jsx-runtime";
9440
- function useServerTable({ url, params, encrypt }) {
9457
+ function useServerTable({ url, params, encrypt, key }) {
9441
9458
  const [data, setData] = React44.useState([]);
9442
9459
  const [columns, setColumns] = React44.useState([]);
9443
9460
  const [currentPage, setCurrentPage] = React44.useState(1);
@@ -9453,7 +9470,7 @@ function useServerTable({ url, params, encrypt }) {
9453
9470
  params: { ...params, page: currentPage }
9454
9471
  }).then(({ data: res }) => {
9455
9472
  if (cancelled) return;
9456
- const payload = encrypt ? decryptLaravelPayload(res) : res;
9473
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
9457
9474
  setData(payload.data);
9458
9475
  const rawTotal = payload.total;
9459
9476
  const rawPerPage = payload.per_page;
@@ -9472,9 +9489,9 @@ function useServerTable({ url, params, encrypt }) {
9472
9489
  setPagination(pg);
9473
9490
  if (payload.data.length > 0) {
9474
9491
  setColumns(
9475
- Object.keys(payload.data[0]).map((key) => ({
9476
- key,
9477
- title: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
9492
+ Object.keys(payload.data[0]).map((key2) => ({
9493
+ key: key2,
9494
+ title: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
9478
9495
  }))
9479
9496
  );
9480
9497
  }
@@ -9811,9 +9828,9 @@ function Table({
9811
9828
  const [viewItem, setViewItem] = React44.useState(null);
9812
9829
  const [editItem, setEditItem] = React44.useState(null);
9813
9830
  const [deleteItem, setDeleteItem] = React44.useState(null);
9814
- const [tableData, setTableData] = React44.useState(data);
9831
+ const [tableData, setTableData] = React44.useState(data ?? []);
9815
9832
  React44.useEffect(() => {
9816
- setTableData(data);
9833
+ setTableData(data ?? []);
9817
9834
  }, [data]);
9818
9835
  const actionIdKey = defaultActions?.idKey ?? idKey;
9819
9836
  const autoFields = React44.useMemo(() => {
@@ -10136,7 +10153,16 @@ function Table({
10136
10153
  serverPagination && (() => {
10137
10154
  const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
10138
10155
  const totalServerPages = pagination2.last_page ?? Math.ceil(pagination2.total / pagination2.per_page);
10139
- const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
10156
+ const pills = [];
10157
+ if (totalServerPages <= 7) {
10158
+ for (let i = 1; i <= totalServerPages; i++) pills.push(i);
10159
+ } else if (cp <= 4) {
10160
+ pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
10161
+ } else if (cp >= totalServerPages - 3) {
10162
+ pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
10163
+ } else {
10164
+ pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
10165
+ }
10140
10166
  return /* @__PURE__ */ jsxs48("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
10141
10167
  /* @__PURE__ */ jsxs48("span", { className: "text-xs text-muted-foreground", children: [
10142
10168
  pagination2.total,
@@ -10155,18 +10181,20 @@ function Table({
10155
10181
  children: /* @__PURE__ */ jsx55(ChevronLeft6, { className: "h-4 w-4" })
10156
10182
  }
10157
10183
  ),
10158
- pageLinks.map((p) => /* @__PURE__ */ jsx55(
10159
- "button",
10160
- {
10161
- onClick: () => goToPage(p),
10162
- className: cn(
10163
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
10164
- p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
10165
- ),
10166
- children: p
10167
- },
10168
- p
10169
- )),
10184
+ pills.map(
10185
+ (p, i) => p < 0 ? /* @__PURE__ */ jsx55("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ jsx55(
10186
+ "button",
10187
+ {
10188
+ onClick: () => goToPage(p),
10189
+ className: cn(
10190
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
10191
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
10192
+ ),
10193
+ children: p
10194
+ },
10195
+ p
10196
+ )
10197
+ ),
10170
10198
  /* @__PURE__ */ jsx55(
10171
10199
  "button",
10172
10200
  {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "3.1.1",
7
+ "version": "3.1.4",
8
8
  "description": "Reusable React UI components",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.js",