@underverse-ui/underverse 0.1.28 → 0.1.30
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 +109 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +109 -93
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4095,6 +4095,7 @@ var Pagination = ({
|
|
|
4095
4095
|
showPageNumbers = true,
|
|
4096
4096
|
showInfo = false,
|
|
4097
4097
|
disabled = false,
|
|
4098
|
+
alignment = "left",
|
|
4098
4099
|
pageSize,
|
|
4099
4100
|
pageSizeOptions,
|
|
4100
4101
|
onPageSizeChange,
|
|
@@ -4102,6 +4103,17 @@ var Pagination = ({
|
|
|
4102
4103
|
labels
|
|
4103
4104
|
}) => {
|
|
4104
4105
|
const t = useTranslations4("Pagination");
|
|
4106
|
+
const getTextAlignmentClass = (align) => {
|
|
4107
|
+
switch (align) {
|
|
4108
|
+
case "left":
|
|
4109
|
+
return "text-left";
|
|
4110
|
+
case "center":
|
|
4111
|
+
return "text-center";
|
|
4112
|
+
case "right":
|
|
4113
|
+
return "text-right";
|
|
4114
|
+
}
|
|
4115
|
+
};
|
|
4116
|
+
const textAlignmentClass = getTextAlignmentClass(alignment);
|
|
4105
4117
|
const createPageArray = () => {
|
|
4106
4118
|
const delta = 2;
|
|
4107
4119
|
const range = [];
|
|
@@ -4154,103 +4166,107 @@ var Pagination = ({
|
|
|
4154
4166
|
};
|
|
4155
4167
|
if (totalPages <= 1) return null;
|
|
4156
4168
|
return /* @__PURE__ */ jsxs22("nav", { className: cn("flex flex-col gap-4", className), "aria-label": labels?.navigationLabel || t("navigationLabel"), children: [
|
|
4157
|
-
showInfo && totalItems && /* @__PURE__ */ jsx24("div", { className: "text-sm text-muted-foreground
|
|
4158
|
-
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
size,
|
|
4164
|
-
icon: ChevronsLeft,
|
|
4165
|
-
onClick: () => onChange(1),
|
|
4166
|
-
disabled: disabled || page === 1,
|
|
4167
|
-
className: "hidden sm:flex",
|
|
4168
|
-
title: labels?.firstPage || t("firstPage"),
|
|
4169
|
-
"aria-label": labels?.firstPage || t("firstPage"),
|
|
4170
|
-
"aria-disabled": disabled || page === 1
|
|
4171
|
-
}
|
|
4172
|
-
),
|
|
4173
|
-
showPrevNext && /* @__PURE__ */ jsx24(
|
|
4174
|
-
Button_default,
|
|
4175
|
-
{
|
|
4176
|
-
variant: getButtonVariant(false),
|
|
4177
|
-
size,
|
|
4178
|
-
icon: ChevronLeft,
|
|
4179
|
-
onClick: () => onChange(Math.max(1, page - 1)),
|
|
4180
|
-
disabled: disabled || page === 1,
|
|
4181
|
-
title: labels?.previousPage || t("previousPage"),
|
|
4182
|
-
"aria-label": labels?.previousPage || t("previousPage"),
|
|
4183
|
-
"aria-disabled": disabled || page === 1,
|
|
4184
|
-
children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: labels?.previous || t("previous") })
|
|
4185
|
-
}
|
|
4186
|
-
),
|
|
4187
|
-
showPageNumbers && createPageArray().map((p, i) => {
|
|
4188
|
-
if (p === "...") {
|
|
4189
|
-
return /* @__PURE__ */ jsx24(Button_default, { variant: "ghost", size, disabled: true, icon: MoreHorizontal2, className: "cursor-default" }, i);
|
|
4190
|
-
}
|
|
4191
|
-
const pageNumber = p;
|
|
4192
|
-
const isActive = page === pageNumber;
|
|
4193
|
-
return /* @__PURE__ */ jsx24(
|
|
4169
|
+
showInfo && totalItems && /* @__PURE__ */ jsx24("div", { className: cn("text-sm text-muted-foreground", textAlignmentClass), children: labels?.showingResults ? labels.showingResults({ startItem: startItem || 0, endItem: endItem || 0, totalItems }) : t("showingResults", { startItem: startItem || 0, endItem: endItem || 0, totalItems }) }),
|
|
4170
|
+
/* @__PURE__ */ jsxs22("div", { className: cn("flex items-center justify-between", {
|
|
4171
|
+
"flex-row-reverse": alignment === "right" || alignment === "center"
|
|
4172
|
+
}), children: [
|
|
4173
|
+
/* @__PURE__ */ jsxs22("div", { className: cn("flex items-center gap-1"), children: [
|
|
4174
|
+
showFirstLast && /* @__PURE__ */ jsx24(
|
|
4194
4175
|
Button_default,
|
|
4195
4176
|
{
|
|
4196
|
-
variant: getButtonVariant(
|
|
4177
|
+
variant: getButtonVariant(false),
|
|
4197
4178
|
size,
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
)
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4179
|
+
icon: ChevronsLeft,
|
|
4180
|
+
onClick: () => onChange(1),
|
|
4181
|
+
disabled: disabled || page === 1,
|
|
4182
|
+
className: "hidden sm:flex",
|
|
4183
|
+
title: labels?.firstPage || t("firstPage"),
|
|
4184
|
+
"aria-label": labels?.firstPage || t("firstPage"),
|
|
4185
|
+
"aria-disabled": disabled || page === 1
|
|
4186
|
+
}
|
|
4187
|
+
),
|
|
4188
|
+
showPrevNext && /* @__PURE__ */ jsx24(
|
|
4189
|
+
Button_default,
|
|
4190
|
+
{
|
|
4191
|
+
variant: getButtonVariant(false),
|
|
4192
|
+
size,
|
|
4193
|
+
icon: ChevronLeft,
|
|
4194
|
+
onClick: () => onChange(Math.max(1, page - 1)),
|
|
4195
|
+
disabled: disabled || page === 1,
|
|
4196
|
+
title: labels?.previousPage || t("previousPage"),
|
|
4197
|
+
"aria-label": labels?.previousPage || t("previousPage"),
|
|
4198
|
+
"aria-disabled": disabled || page === 1,
|
|
4199
|
+
children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: labels?.previous || t("previous") })
|
|
4200
|
+
}
|
|
4201
|
+
),
|
|
4202
|
+
showPageNumbers && createPageArray().map((p, i) => {
|
|
4203
|
+
if (p === "...") {
|
|
4204
|
+
return /* @__PURE__ */ jsx24(Button_default, { variant: "ghost", size, disabled: true, icon: MoreHorizontal2, className: "cursor-default" }, i);
|
|
4205
|
+
}
|
|
4206
|
+
const pageNumber = p;
|
|
4207
|
+
const isActive = page === pageNumber;
|
|
4208
|
+
return /* @__PURE__ */ jsx24(
|
|
4209
|
+
Button_default,
|
|
4210
|
+
{
|
|
4211
|
+
variant: getButtonVariant(isActive),
|
|
4212
|
+
size,
|
|
4213
|
+
onClick: () => onChange(pageNumber),
|
|
4214
|
+
disabled,
|
|
4215
|
+
className: cn("min-w-[2.5rem]", isActive && "font-semibold"),
|
|
4216
|
+
"aria-label": labels?.pageNumber ? labels.pageNumber(pageNumber) : t("pageNumber", { page: pageNumber }),
|
|
4217
|
+
"aria-current": isActive ? "page" : void 0,
|
|
4218
|
+
children: pageNumber
|
|
4219
|
+
},
|
|
4220
|
+
i
|
|
4221
|
+
);
|
|
4222
|
+
}),
|
|
4223
|
+
showPrevNext && /* @__PURE__ */ jsx24(
|
|
4224
|
+
Button_default,
|
|
4225
|
+
{
|
|
4226
|
+
variant: getButtonVariant(false),
|
|
4227
|
+
size,
|
|
4228
|
+
iconRight: ChevronRight2,
|
|
4229
|
+
onClick: () => onChange(Math.min(totalPages, page + 1)),
|
|
4230
|
+
disabled: disabled || page === totalPages,
|
|
4231
|
+
title: labels?.nextPage || t("nextPage"),
|
|
4232
|
+
"aria-label": labels?.nextPage || t("nextPage"),
|
|
4233
|
+
"aria-disabled": disabled || page === totalPages,
|
|
4234
|
+
children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: labels?.next || t("next") })
|
|
4235
|
+
}
|
|
4236
|
+
),
|
|
4237
|
+
showFirstLast && /* @__PURE__ */ jsx24(
|
|
4238
|
+
Button_default,
|
|
4239
|
+
{
|
|
4240
|
+
variant: getButtonVariant(false),
|
|
4241
|
+
size,
|
|
4242
|
+
icon: ChevronsRight,
|
|
4243
|
+
onClick: () => onChange(totalPages),
|
|
4244
|
+
disabled: disabled || page === totalPages,
|
|
4245
|
+
className: "hidden sm:flex",
|
|
4246
|
+
title: labels?.lastPage || t("lastPage"),
|
|
4247
|
+
"aria-label": labels?.lastPage || t("lastPage"),
|
|
4248
|
+
"aria-disabled": disabled || page === totalPages
|
|
4249
|
+
}
|
|
4250
|
+
)
|
|
4241
4251
|
] }),
|
|
4242
|
-
/* @__PURE__ */
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4252
|
+
pageSizeOptions && onPageSizeChange && /* @__PURE__ */ jsxs22("div", { className: cn("flex items-center gap-2 text-sm"), children: [
|
|
4253
|
+
/* @__PURE__ */ jsxs22("span", { className: "text-muted-foreground", children: [
|
|
4254
|
+
labels?.itemsPerPage || t("itemsPerPage"),
|
|
4255
|
+
":"
|
|
4256
|
+
] }),
|
|
4257
|
+
/* @__PURE__ */ jsx24("div", { className: "w-20", children: /* @__PURE__ */ jsx24(
|
|
4258
|
+
Combobox,
|
|
4259
|
+
{
|
|
4260
|
+
options: pageSizeOptionsStrings,
|
|
4261
|
+
value: pageSize?.toString() || "10",
|
|
4262
|
+
onChange: handlePageSizeChange,
|
|
4263
|
+
placeholder: "10",
|
|
4264
|
+
searchPlaceholder: labels?.search || t("search"),
|
|
4265
|
+
emptyText: labels?.noOptions || t("noOptions"),
|
|
4266
|
+
disabled
|
|
4267
|
+
}
|
|
4268
|
+
) })
|
|
4269
|
+
] })
|
|
4254
4270
|
] })
|
|
4255
4271
|
] });
|
|
4256
4272
|
};
|