@sikka/hawa 0.12.5-next → 0.12.6-next

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.mts CHANGED
@@ -477,6 +477,7 @@ type DataTableProps<DataProps = {}> = {
477
477
  paginationPosition?: "top" | "bottom";
478
478
  condensed?: boolean;
479
479
  isLoading?: boolean;
480
+ enableGoTo?: boolean;
480
481
  defaultSort?: string;
481
482
  texts?: {
482
483
  searchPlaceholder?: string;
@@ -486,6 +487,7 @@ type DataTableProps<DataProps = {}> = {
486
487
  filter?: string;
487
488
  of?: string;
488
489
  total?: string;
490
+ goTo?: string;
489
491
  };
490
492
  };
491
493
  declare module "@tanstack/table-core" {
package/dist/index.d.ts CHANGED
@@ -477,6 +477,7 @@ type DataTableProps<DataProps = {}> = {
477
477
  paginationPosition?: "top" | "bottom";
478
478
  condensed?: boolean;
479
479
  isLoading?: boolean;
480
+ enableGoTo?: boolean;
480
481
  defaultSort?: string;
481
482
  texts?: {
482
483
  searchPlaceholder?: string;
@@ -486,6 +487,7 @@ type DataTableProps<DataProps = {}> = {
486
487
  filter?: string;
487
488
  of?: string;
488
489
  total?: string;
490
+ goTo?: string;
489
491
  };
490
492
  };
491
493
  declare module "@tanstack/table-core" {
package/dist/index.js CHANGED
@@ -5136,7 +5136,7 @@ var DataTable = function(_param) {
5136
5136
  "data",
5137
5137
  "paginationPosition"
5138
5138
  ]);
5139
- var _props_texts, _props_itemsPerPage, _props_texts1, _table_getRowModel_rows, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6;
5139
+ var _props_texts, _props_itemsPerPage, _props_texts1, _table_getRowModel_rows, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6, _props_texts7;
5140
5140
  var _React39_useState = _sliced_to_array(React39.useState([
5141
5141
  {
5142
5142
  id: props.defaultSort || "",
@@ -5233,7 +5233,25 @@ var DataTable = function(_param) {
5233
5233
  dir: props.direction
5234
5234
  }, /* @__PURE__ */ React39.createElement("span", null, (_props_texts3 = props.texts) === null || _props_texts3 === void 0 ? void 0 : _props_texts3.total), " ", /* @__PURE__ */ React39.createElement("span", null, table.getFilteredRowModel().rows.length.toLocaleString())), table.getPageCount() !== 0 && /* @__PURE__ */ React39.createElement("div", {
5235
5235
  className: "hawa-flex hawa-w-fit hawa-flex-row hawa-items-center hawa-gap-2 "
5236
- }, /* @__PURE__ */ React39.createElement(DropdownMenu, {
5236
+ }, props.enableGoTo && /* @__PURE__ */ React39.createElement("div", {
5237
+ className: "hawa-flex hawa-flex-row hawa-justify-center hawa-items-center hawa-gap-2"
5238
+ }, /* @__PURE__ */ React39.createElement("span", {
5239
+ className: "hawa-text-sm"
5240
+ }, (_props_texts4 = props.texts) === null || _props_texts4 === void 0 ? void 0 : _props_texts4.goTo), /* @__PURE__ */ React39.createElement("input", {
5241
+ max: table.getPageCount(),
5242
+ min: 0,
5243
+ type: "number",
5244
+ defaultValue: table.getState().pagination.pageIndex + 1,
5245
+ onChange: function(e) {
5246
+ var page = Number(e.target.value) - 1;
5247
+ var max = table.getPageCount();
5248
+ if (!isNaN(page) && Number(page) > max) {
5249
+ page = max - 1;
5250
+ }
5251
+ table.setPageIndex(page);
5252
+ },
5253
+ className: "hawa-w-16 hawa-text-sm hawa-border hawa-rounded hawa-p-1 hawa-px-2"
5254
+ })), /* @__PURE__ */ React39.createElement(DropdownMenu, {
5237
5255
  size: "sm",
5238
5256
  width: "sm",
5239
5257
  direction: props.direction,
@@ -5263,7 +5281,7 @@ var DataTable = function(_param) {
5263
5281
  variant: "outline",
5264
5282
  size: "icon",
5265
5283
  className: "hawa-h-fit hawa-w-fit hawa-p-0 hawa-px-2 hawa-py-1 "
5266
- }, "".concat(table.getState().pagination.pageSize, " / ").concat((_props_texts4 = props.texts) === null || _props_texts4 === void 0 ? void 0 : _props_texts4.page)),
5284
+ }, "".concat(table.getState().pagination.pageSize, " / ").concat((_props_texts5 = props.texts) === null || _props_texts5 === void 0 ? void 0 : _props_texts5.page)),
5267
5285
  onItemSelect: function(e) {
5268
5286
  return table.setPageSize(Number(e));
5269
5287
  }
@@ -5271,11 +5289,11 @@ var DataTable = function(_param) {
5271
5289
  className: "hawa-flex hawa-w-fit hawa-flex-row hawa-items-center hawa-gap-2 hawa-text-sm "
5272
5290
  }, /* @__PURE__ */ React39.createElement("span", {
5273
5291
  className: "hawa-flex hawa-items-center hawa-gap-1"
5274
- }, /* @__PURE__ */ React39.createElement("div", null, (_props_texts5 = props.texts) === null || _props_texts5 === void 0 ? void 0 : _props_texts5.page), /* @__PURE__ */ React39.createElement("div", {
5292
+ }, /* @__PURE__ */ React39.createElement("div", null, (_props_texts6 = props.texts) === null || _props_texts6 === void 0 ? void 0 : _props_texts6.page), /* @__PURE__ */ React39.createElement("div", {
5275
5293
  className: "hawa-flex hawa-flex-row hawa-gap-1"
5276
5294
  }, /* @__PURE__ */ React39.createElement("span", {
5277
5295
  className: "hawa-font-bold"
5278
- }, table.getState().pagination.pageIndex + 1), /* @__PURE__ */ React39.createElement("span", null, (_props_texts6 = props.texts) === null || _props_texts6 === void 0 ? void 0 : _props_texts6.of), /* @__PURE__ */ React39.createElement("span", {
5296
+ }, table.getState().pagination.pageIndex + 1), /* @__PURE__ */ React39.createElement("span", null, (_props_texts7 = props.texts) === null || _props_texts7 === void 0 ? void 0 : _props_texts7.of), /* @__PURE__ */ React39.createElement("span", {
5279
5297
  className: "hawa-font-bold"
5280
5298
  }, table.getPageCount())))), /* @__PURE__ */ React39.createElement(Button, {
5281
5299
  "aria-label": "Previous Table Page",
package/dist/index.mjs CHANGED
@@ -4918,7 +4918,24 @@ var DataTable = ({
4918
4918
  /* @__PURE__ */ React39.createElement("span", null, props.texts?.total),
4919
4919
  " ",
4920
4920
  /* @__PURE__ */ React39.createElement("span", null, table.getFilteredRowModel().rows.length.toLocaleString())
4921
- ), table.getPageCount() !== 0 && /* @__PURE__ */ React39.createElement("div", { className: "hawa-flex hawa-w-fit hawa-flex-row hawa-items-center hawa-gap-2 " }, /* @__PURE__ */ React39.createElement(
4921
+ ), table.getPageCount() !== 0 && /* @__PURE__ */ React39.createElement("div", { className: "hawa-flex hawa-w-fit hawa-flex-row hawa-items-center hawa-gap-2 " }, props.enableGoTo && /* @__PURE__ */ React39.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-center hawa-items-center hawa-gap-2" }, /* @__PURE__ */ React39.createElement("span", { className: "hawa-text-sm" }, props.texts?.goTo), /* @__PURE__ */ React39.createElement(
4922
+ "input",
4923
+ {
4924
+ max: table.getPageCount(),
4925
+ min: 0,
4926
+ type: "number",
4927
+ defaultValue: table.getState().pagination.pageIndex + 1,
4928
+ onChange: (e) => {
4929
+ let page = Number(e.target.value) - 1;
4930
+ const max = table.getPageCount();
4931
+ if (!isNaN(page) && Number(page) > max) {
4932
+ page = max - 1;
4933
+ }
4934
+ table.setPageIndex(page);
4935
+ },
4936
+ className: "hawa-w-16 hawa-text-sm hawa-border hawa-rounded hawa-p-1 hawa-px-2"
4937
+ }
4938
+ )), /* @__PURE__ */ React39.createElement(
4922
4939
  DropdownMenu,
4923
4940
  {
4924
4941
  size: "sm",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.12.5-next",
3
+ "version": "0.12.6-next",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {