@machinemetrics/mm-react-components 0.2.3-15 → 0.2.3-16

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.
@@ -44076,6 +44076,172 @@ const HeroMetricCard = React.forwardRef(
44076
44076
  }
44077
44077
  );
44078
44078
  HeroMetricCard.displayName = "HeroMetricCard";
44079
+ function Pagination({ className, ...props }) {
44080
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
44081
+ "nav",
44082
+ {
44083
+ role: "navigation",
44084
+ "aria-label": "pagination",
44085
+ "data-slot": "pagination",
44086
+ className: cn$1("mx-auto flex w-full justify-center", className),
44087
+ ...props
44088
+ }
44089
+ );
44090
+ }
44091
+ function PaginationContent({
44092
+ className,
44093
+ ...props
44094
+ }) {
44095
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
44096
+ "ul",
44097
+ {
44098
+ "data-slot": "pagination-content",
44099
+ className: cn$1("flex flex-row items-center gap-1", className),
44100
+ ...props
44101
+ }
44102
+ );
44103
+ }
44104
+ function PaginationItem({ ...props }) {
44105
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { "data-slot": "pagination-item", ...props });
44106
+ }
44107
+ function PaginationLink({
44108
+ className,
44109
+ isActive,
44110
+ size: size2 = "icon",
44111
+ children,
44112
+ ...props
44113
+ }) {
44114
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
44115
+ "a",
44116
+ {
44117
+ "aria-current": isActive ? "page" : void 0,
44118
+ "data-slot": "pagination-link",
44119
+ "data-active": isActive,
44120
+ className: cn$1(
44121
+ buttonVariants({
44122
+ variant: isActive ? "outline" : "ghost",
44123
+ size: size2
44124
+ }),
44125
+ className
44126
+ ),
44127
+ ...props,
44128
+ children
44129
+ }
44130
+ );
44131
+ }
44132
+ function PaginationPrevious({
44133
+ className,
44134
+ ...props
44135
+ }) {
44136
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
44137
+ PaginationLink,
44138
+ {
44139
+ "aria-label": "Go to previous page",
44140
+ size: "default",
44141
+ className: cn$1("gap-1 px-2.5 sm:pl-2.5", className),
44142
+ ...props,
44143
+ children: [
44144
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeft, {}),
44145
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "hidden sm:block", children: "Previous" })
44146
+ ]
44147
+ }
44148
+ );
44149
+ }
44150
+ function PaginationNext({
44151
+ className,
44152
+ ...props
44153
+ }) {
44154
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
44155
+ PaginationLink,
44156
+ {
44157
+ "aria-label": "Go to next page",
44158
+ size: "default",
44159
+ className: cn$1("gap-1 px-2.5 sm:pr-2.5", className),
44160
+ ...props,
44161
+ children: [
44162
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "hidden sm:block", children: "Next" }),
44163
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, {})
44164
+ ]
44165
+ }
44166
+ );
44167
+ }
44168
+ function PaginationEllipsis({
44169
+ className,
44170
+ ...props
44171
+ }) {
44172
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
44173
+ "span",
44174
+ {
44175
+ "aria-hidden": true,
44176
+ "data-slot": "pagination-ellipsis",
44177
+ className: cn$1("flex size-9 items-center justify-center", className),
44178
+ ...props,
44179
+ children: [
44180
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Ellipsis, { className: "size-4" }),
44181
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "More pages" })
44182
+ ]
44183
+ }
44184
+ );
44185
+ }
44186
+ function SimplePagination({
44187
+ currentPage,
44188
+ totalPages,
44189
+ onPageChange,
44190
+ className
44191
+ }) {
44192
+ const canGoPrevious = currentPage > 1;
44193
+ const canGoNext = currentPage < totalPages;
44194
+ const handlePrevious = (e) => {
44195
+ e.preventDefault();
44196
+ if (canGoPrevious) {
44197
+ onPageChange(currentPage - 1);
44198
+ }
44199
+ };
44200
+ const handleNext = (e) => {
44201
+ e.preventDefault();
44202
+ if (canGoNext) {
44203
+ onPageChange(currentPage + 1);
44204
+ }
44205
+ };
44206
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
44207
+ "nav",
44208
+ {
44209
+ role: "navigation",
44210
+ "aria-label": "pagination",
44211
+ "data-slot": "simple-pagination",
44212
+ className: cn$1("flex items-center justify-center gap-2", className),
44213
+ children: [
44214
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
44215
+ Button$1,
44216
+ {
44217
+ variant: "ghost",
44218
+ size: "icon",
44219
+ onClick: handlePrevious,
44220
+ disabled: !canGoPrevious,
44221
+ "aria-label": "Go to previous page",
44222
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeft, { className: "size-4" })
44223
+ }
44224
+ ),
44225
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-muted-foreground", "aria-live": "polite", children: [
44226
+ currentPage,
44227
+ " of ",
44228
+ totalPages
44229
+ ] }),
44230
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
44231
+ Button$1,
44232
+ {
44233
+ variant: "ghost",
44234
+ size: "icon",
44235
+ onClick: handleNext,
44236
+ disabled: !canGoNext,
44237
+ "aria-label": "Go to next page",
44238
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "size-4" })
44239
+ }
44240
+ )
44241
+ ]
44242
+ }
44243
+ );
44244
+ }
44079
44245
  export {
44080
44246
  Accordion,
44081
44247
  AccordionContent,
@@ -44180,6 +44346,13 @@ export {
44180
44346
  Label$2 as Label,
44181
44347
  LabeledSlider,
44182
44348
  PageHeader,
44349
+ Pagination,
44350
+ PaginationContent,
44351
+ PaginationEllipsis,
44352
+ PaginationItem,
44353
+ PaginationLink,
44354
+ PaginationNext,
44355
+ PaginationPrevious,
44183
44356
  Popover,
44184
44357
  PopoverContent,
44185
44358
  PopoverTrigger,
@@ -44207,6 +44380,7 @@ export {
44207
44380
  SheetHeader,
44208
44381
  SheetTitle,
44209
44382
  SheetTrigger,
44383
+ SimplePagination,
44210
44384
  Skeleton,
44211
44385
  Slider,
44212
44386
  Switch,