@sikka/hawa 0.11.17-next → 0.11.18-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
@@ -466,6 +466,7 @@ type DataTableProps<DataProps = {}> = {
466
466
  direction?: "rtl" | "ltr";
467
467
  columns: ColumnDef<DataProps>[];
468
468
  data: DataProps[];
469
+ itemsPerPage?: any[];
469
470
  showCount?: boolean;
470
471
  condensed?: boolean;
471
472
  isLoading?: boolean;
package/dist/index.d.ts CHANGED
@@ -466,6 +466,7 @@ type DataTableProps<DataProps = {}> = {
466
466
  direction?: "rtl" | "ltr";
467
467
  columns: ColumnDef<DataProps>[];
468
468
  data: DataProps[];
469
+ itemsPerPage?: any[];
469
470
  showCount?: boolean;
470
471
  condensed?: boolean;
471
472
  isLoading?: boolean;
package/dist/index.js CHANGED
@@ -5086,7 +5086,7 @@ var DataTable = function(_param) {
5086
5086
  "columns",
5087
5087
  "data"
5088
5088
  ]);
5089
- var _props_texts, _table_getRowModel_rows, _props_texts1, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6, _props_texts7, _props_texts8, _props_texts9, _props_texts10;
5089
+ var _props_texts, _props_itemsPerPage, _props_texts1, _table_getRowModel_rows, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6;
5090
5090
  var _React38_useState = _sliced_to_array(React38.useState([
5091
5091
  {
5092
5092
  id: props.defaultSort || "",
@@ -5121,12 +5121,19 @@ var DataTable = function(_param) {
5121
5121
  expanded: expanded
5122
5122
  }
5123
5123
  });
5124
+ var pageText = ((_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.page) || "page";
5125
+ var itemsPerPageOptions = (_props_itemsPerPage = props.itemsPerPage) === null || _props_itemsPerPage === void 0 ? void 0 : _props_itemsPerPage.map(function(item) {
5126
+ return {
5127
+ label: "".concat(item, " / ").concat(pageText),
5128
+ value: item
5129
+ };
5130
+ });
5124
5131
  return /* @__PURE__ */ React38.createElement("div", {
5125
5132
  className: "hawa-flex hawa-w-full hawa-flex-col hawa-gap-4"
5126
5133
  }, /* @__PURE__ */ React38.createElement("div", {
5127
5134
  className: "hawa-flex hawa-items-center"
5128
5135
  }, /* @__PURE__ */ React38.createElement(Input, {
5129
- placeholder: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.searchPlaceholder,
5136
+ placeholder: (_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.searchPlaceholder,
5130
5137
  value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : "",
5131
5138
  onChange: function(event) {
5132
5139
  return setGlobalFilter(event.target.value);
@@ -5164,38 +5171,38 @@ var DataTable = function(_param) {
5164
5171
  }) : /* @__PURE__ */ React38.createElement(TableRow, null, /* @__PURE__ */ React38.createElement(TableCell, {
5165
5172
  colSpan: columns.length,
5166
5173
  className: "hawa-h-24 hawa-text-center"
5167
- }, (_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.noData))))), /* @__PURE__ */ React38.createElement("div", {
5174
+ }, (_props_texts2 = props.texts) === null || _props_texts2 === void 0 ? void 0 : _props_texts2.noData))))), /* @__PURE__ */ React38.createElement("div", {
5168
5175
  className: "hawa-flex hawa-items-center hawa-justify-between"
5169
5176
  }, !props.showCount && /* @__PURE__ */ React38.createElement("div", {
5170
5177
  className: "hawa-flex hawa-w-fit hawa-flex-row hawa-items-center hawa-gap-2 hawa-text-sm hawa-text-muted-foreground"
5171
5178
  }), props.showCount && /* @__PURE__ */ React38.createElement("div", {
5172
5179
  className: "text-sm text-muted-foreground",
5173
5180
  dir: props.direction
5174
- }, /* @__PURE__ */ React38.createElement("span", null, (_props_texts2 = props.texts) === null || _props_texts2 === void 0 ? void 0 : _props_texts2.total), " ", /* @__PURE__ */ React38.createElement("span", null, table.getFilteredRowModel().rows.length)), table.getPageCount() !== 0 && /* @__PURE__ */ React38.createElement("div", {
5181
+ }, /* @__PURE__ */ React38.createElement("span", null, (_props_texts3 = props.texts) === null || _props_texts3 === void 0 ? void 0 : _props_texts3.total), " ", /* @__PURE__ */ React38.createElement("span", null, table.getFilteredRowModel().rows.length.toLocaleString())), table.getPageCount() !== 0 && /* @__PURE__ */ React38.createElement("div", {
5175
5182
  className: "hawa-flex hawa-w-fit hawa-flex-row hawa-items-center hawa-gap-2 "
5176
5183
  }, /* @__PURE__ */ React38.createElement(DropdownMenu, {
5177
5184
  size: "sm",
5178
- width: "parent",
5185
+ width: "sm",
5179
5186
  direction: props.direction,
5180
- items: [
5187
+ items: itemsPerPageOptions || [
5181
5188
  {
5182
- label: "10 / ".concat((_props_texts3 = props.texts) === null || _props_texts3 === void 0 ? void 0 : _props_texts3.page),
5189
+ label: "10 / ".concat(pageText),
5183
5190
  value: 10
5184
5191
  },
5185
5192
  {
5186
- label: "20 / ".concat((_props_texts4 = props.texts) === null || _props_texts4 === void 0 ? void 0 : _props_texts4.page),
5193
+ label: "20 / ".concat(pageText),
5187
5194
  value: 20
5188
5195
  },
5189
5196
  {
5190
- label: "30 / ".concat((_props_texts5 = props.texts) === null || _props_texts5 === void 0 ? void 0 : _props_texts5.page),
5197
+ label: "30 / ".concat(pageText),
5191
5198
  value: 30
5192
5199
  },
5193
5200
  {
5194
- label: "40 / ".concat((_props_texts6 = props.texts) === null || _props_texts6 === void 0 ? void 0 : _props_texts6.page),
5201
+ label: "40 / ".concat(pageText),
5195
5202
  value: 40
5196
5203
  },
5197
5204
  {
5198
- label: "50 / ".concat((_props_texts7 = props.texts) === null || _props_texts7 === void 0 ? void 0 : _props_texts7.page),
5205
+ label: "50 / ".concat(pageText),
5199
5206
  value: 50
5200
5207
  }
5201
5208
  ],
@@ -5203,7 +5210,7 @@ var DataTable = function(_param) {
5203
5210
  variant: "outline",
5204
5211
  size: "icon",
5205
5212
  className: "hawa-h-fit hawa-w-fit hawa-p-0 hawa-px-2 hawa-py-1 "
5206
- }, "".concat(table.getState().pagination.pageSize, " / ").concat((_props_texts8 = props.texts) === null || _props_texts8 === void 0 ? void 0 : _props_texts8.page)),
5213
+ }, "".concat(table.getState().pagination.pageSize, " / ").concat((_props_texts4 = props.texts) === null || _props_texts4 === void 0 ? void 0 : _props_texts4.page)),
5207
5214
  onItemSelect: function(e) {
5208
5215
  return table.setPageSize(Number(e));
5209
5216
  }
@@ -5211,13 +5218,14 @@ var DataTable = function(_param) {
5211
5218
  className: "hawa-flex hawa-w-fit hawa-flex-row hawa-items-center hawa-gap-2 hawa-text-sm "
5212
5219
  }, /* @__PURE__ */ React38.createElement("span", {
5213
5220
  className: "hawa-flex hawa-items-center hawa-gap-1"
5214
- }, /* @__PURE__ */ React38.createElement("div", null, (_props_texts9 = props.texts) === null || _props_texts9 === void 0 ? void 0 : _props_texts9.page), /* @__PURE__ */ React38.createElement("div", {
5221
+ }, /* @__PURE__ */ React38.createElement("div", null, (_props_texts5 = props.texts) === null || _props_texts5 === void 0 ? void 0 : _props_texts5.page), /* @__PURE__ */ React38.createElement("div", {
5215
5222
  className: "hawa-flex hawa-flex-row hawa-gap-1"
5216
5223
  }, /* @__PURE__ */ React38.createElement("span", {
5217
5224
  className: "hawa-font-bold"
5218
- }, table.getState().pagination.pageIndex + 1), /* @__PURE__ */ React38.createElement("span", null, (_props_texts10 = props.texts) === null || _props_texts10 === void 0 ? void 0 : _props_texts10.of), /* @__PURE__ */ React38.createElement("span", {
5225
+ }, table.getState().pagination.pageIndex + 1), /* @__PURE__ */ React38.createElement("span", null, (_props_texts6 = props.texts) === null || _props_texts6 === void 0 ? void 0 : _props_texts6.of), /* @__PURE__ */ React38.createElement("span", {
5219
5226
  className: "hawa-font-bold"
5220
5227
  }, table.getPageCount())))), /* @__PURE__ */ React38.createElement(Button, {
5228
+ "aria-label": "Previous Table Page",
5221
5229
  variant: "outline",
5222
5230
  size: "smallIcon",
5223
5231
  onClick: function() {
@@ -5237,6 +5245,7 @@ var DataTable = function(_param) {
5237
5245
  fillRule: "evenodd",
5238
5246
  d: "M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
5239
5247
  }))), /* @__PURE__ */ React38.createElement(Button, {
5248
+ "aria-label": "Next Table Page",
5240
5249
  variant: "outline",
5241
5250
  size: "smallIcon",
5242
5251
  onClick: function() {
@@ -5246,12 +5255,12 @@ var DataTable = function(_param) {
5246
5255
  className: cn(props.direction === "rtl" && "hawa-rotate-180")
5247
5256
  }, /* @__PURE__ */ React38.createElement("svg", {
5248
5257
  "aria-label": "Chevron Right Icon",
5249
- stroke: "currentColor",
5250
5258
  fill: "currentColor",
5251
- strokeWidth: "0",
5252
- viewBox: "0 0 16 16",
5259
+ stroke: "currentColor",
5260
+ width: "1em",
5253
5261
  height: "1em",
5254
- width: "1em"
5262
+ strokeWidth: "0",
5263
+ viewBox: "0 0 16 16"
5255
5264
  }, /* @__PURE__ */ React38.createElement("path", {
5256
5265
  fillRule: "evenodd",
5257
5266
  d: "M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
package/dist/index.mjs CHANGED
@@ -4783,6 +4783,11 @@ var DataTable = ({
4783
4783
  expanded
4784
4784
  }
4785
4785
  });
4786
+ const pageText = props.texts?.page || "page";
4787
+ const itemsPerPageOptions = props.itemsPerPage?.map((item) => ({
4788
+ label: `${item} / ${pageText}`,
4789
+ value: item
4790
+ }));
4786
4791
  return /* @__PURE__ */ React38.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-col hawa-gap-4" }, /* @__PURE__ */ React38.createElement("div", { className: "hawa-flex hawa-items-center" }, /* @__PURE__ */ React38.createElement(
4787
4792
  Input,
4788
4793
  {
@@ -4840,19 +4845,19 @@ var DataTable = ({
4840
4845
  },
4841
4846
  /* @__PURE__ */ React38.createElement("span", null, props.texts?.total),
4842
4847
  " ",
4843
- /* @__PURE__ */ React38.createElement("span", null, table.getFilteredRowModel().rows.length)
4848
+ /* @__PURE__ */ React38.createElement("span", null, table.getFilteredRowModel().rows.length.toLocaleString())
4844
4849
  ), table.getPageCount() !== 0 && /* @__PURE__ */ React38.createElement("div", { className: "hawa-flex hawa-w-fit hawa-flex-row hawa-items-center hawa-gap-2 " }, /* @__PURE__ */ React38.createElement(
4845
4850
  DropdownMenu,
4846
4851
  {
4847
4852
  size: "sm",
4848
- width: "parent",
4853
+ width: "sm",
4849
4854
  direction: props.direction,
4850
- items: [
4851
- { label: `10 / ${props.texts?.page}`, value: 10 },
4852
- { label: `20 / ${props.texts?.page}`, value: 20 },
4853
- { label: `30 / ${props.texts?.page}`, value: 30 },
4854
- { label: `40 / ${props.texts?.page}`, value: 40 },
4855
- { label: `50 / ${props.texts?.page}`, value: 50 }
4855
+ items: itemsPerPageOptions || [
4856
+ { label: `10 / ${pageText}`, value: 10 },
4857
+ { label: `20 / ${pageText}`, value: 20 },
4858
+ { label: `30 / ${pageText}`, value: 30 },
4859
+ { label: `40 / ${pageText}`, value: 40 },
4860
+ { label: `50 / ${pageText}`, value: 50 }
4856
4861
  ],
4857
4862
  trigger: /* @__PURE__ */ React38.createElement(
4858
4863
  Button,
@@ -4868,6 +4873,7 @@ var DataTable = ({
4868
4873
  ), /* @__PURE__ */ React38.createElement("div", { className: "hawa-flex hawa-w-fit hawa-flex-row hawa-items-center hawa-gap-2 hawa-text-sm " }, /* @__PURE__ */ React38.createElement("span", { className: "hawa-flex hawa-items-center hawa-gap-1" }, /* @__PURE__ */ React38.createElement("div", null, props.texts?.page), /* @__PURE__ */ React38.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-1" }, /* @__PURE__ */ React38.createElement("span", { className: "hawa-font-bold" }, table.getState().pagination.pageIndex + 1), /* @__PURE__ */ React38.createElement("span", null, props.texts?.of), /* @__PURE__ */ React38.createElement("span", { className: "hawa-font-bold" }, table.getPageCount())))), /* @__PURE__ */ React38.createElement(
4869
4874
  Button,
4870
4875
  {
4876
+ "aria-label": "Previous Table Page",
4871
4877
  variant: "outline",
4872
4878
  size: "smallIcon",
4873
4879
  onClick: () => table.previousPage(),
@@ -4896,6 +4902,7 @@ var DataTable = ({
4896
4902
  ), /* @__PURE__ */ React38.createElement(
4897
4903
  Button,
4898
4904
  {
4905
+ "aria-label": "Next Table Page",
4899
4906
  variant: "outline",
4900
4907
  size: "smallIcon",
4901
4908
  onClick: () => table.nextPage(),
@@ -4906,12 +4913,12 @@ var DataTable = ({
4906
4913
  "svg",
4907
4914
  {
4908
4915
  "aria-label": "Chevron Right Icon",
4909
- stroke: "currentColor",
4910
4916
  fill: "currentColor",
4911
- strokeWidth: "0",
4912
- viewBox: "0 0 16 16",
4917
+ stroke: "currentColor",
4918
+ width: "1em",
4913
4919
  height: "1em",
4914
- width: "1em"
4920
+ strokeWidth: "0",
4921
+ viewBox: "0 0 16 16"
4915
4922
  },
4916
4923
  /* @__PURE__ */ React38.createElement(
4917
4924
  "path",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.11.17-next",
3
+ "version": "0.11.18-next",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {