@rehagro/ui 1.0.16 → 1.0.17
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 +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +204 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +202 -1
- package/dist/index.mjs.map +1 -1
- package/dist/native.js.map +1 -1
- package/dist/native.mjs.map +1 -1
- package/dist/styles.css +3 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -656,6 +656,24 @@ declare const Typography: React__default.ForwardRefExoticComponent<React__defaul
|
|
|
656
656
|
as?: keyof JSX.IntrinsicElements;
|
|
657
657
|
} & React__default.RefAttributes<HTMLElement>>;
|
|
658
658
|
|
|
659
|
+
type PaginationProps = {
|
|
660
|
+
/** Current active page (1-indexed) */
|
|
661
|
+
currentPage: number;
|
|
662
|
+
/** Total number of pages */
|
|
663
|
+
totalPages: number;
|
|
664
|
+
/** Callback when page changes */
|
|
665
|
+
onPageChange: (page: number) => void;
|
|
666
|
+
/** Maximum number of page buttons to show (default: 5) */
|
|
667
|
+
maxVisible?: number;
|
|
668
|
+
/** Show prev/next arrows (default: true) */
|
|
669
|
+
showArrows?: boolean;
|
|
670
|
+
/** Custom class for the container */
|
|
671
|
+
className?: string;
|
|
672
|
+
/** Disable pagination */
|
|
673
|
+
disabled?: boolean;
|
|
674
|
+
};
|
|
675
|
+
declare const Pagination: React__default.ForwardRefExoticComponent<PaginationProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
676
|
+
|
|
659
677
|
type ContainerProps = React__default.HTMLAttributes<HTMLDivElement> & {
|
|
660
678
|
/**
|
|
661
679
|
* Remove o padding horizontal lateral.
|
|
@@ -757,4 +775,8 @@ declare const NeutralIcon: (props: IconProps) => react_jsx_runtime.JSX.Element;
|
|
|
757
775
|
|
|
758
776
|
declare const CloseIcon: (props: IconProps) => react_jsx_runtime.JSX.Element;
|
|
759
777
|
|
|
760
|
-
|
|
778
|
+
declare function CaretLeftIcon({ className, ...props }: IconProps): react_jsx_runtime.JSX.Element;
|
|
779
|
+
|
|
780
|
+
declare function CaretRightIcon({ className, ...props }: IconProps): react_jsx_runtime.JSX.Element;
|
|
781
|
+
|
|
782
|
+
export { Avatar, type AvatarProps, type AvatarSize, type AvatarVariant, Button, ButtonColor, type ButtonProps, type ButtonRadius, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardPadding, type CardProps, type CardRadius, type CardVariant, CaretLeftIcon, CaretRightIcon, Checkbox, type CheckboxProps, type CheckboxSize, CloseIcon, Container, type ContainerProps, DeleteIcon, EditIcon, ErrorIcon, GridContainer, type GridContainerProps, GridItem, type GridItemProps, type GridSpan, IconButton, type IconButtonColor, type IconButtonProps, type IconButtonRadius, type IconButtonSize, type IconButtonVariant, type IconProps, InfoIcon, type MobileSpan, NeutralIcon, Pagination, type PaginationProps, PlusIcon, ProgressBar, type ProgressBarProps, type ProgressBarSize, RehagroProvider, type RehagroProviderProps, type RehagroTheme, SearchIcon, Select, type SelectMultipleProps, type SelectOption, type SelectProps, type SelectRadius, type SelectSingleProps, type SelectSize, type SelectStatus, type SortDirection, Spinner, type SpinnerProps, type SpinnerSize, SuccessIcon, Table, type TableColumn, type TableProps, type TableSize, type TableSort, type TableVariant, Tag, TagInput, type TagInputOption, type TagInputProps, type TagInputRadius, type TagInputSize, type TagInputStatus, type TagProps, type TagSize, TextInput, type TextInputProps, type TextInputRadius, type TextInputSize, type TextInputStatus, Toast, type ToastAppearance, ToastContainer, type ToastFn, type ToastItem, type ToastLink, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, type ToastVariant, ToggleGroup, type ToggleGroupOption, type ToggleGroupProps, type ToggleGroupRadius, type ToggleGroupSize, Tooltip, type TooltipPlacement, type TooltipProps, type TooltipSize, type TooltipVariant, Typography, type TypographyColor, type TypographyProps, type TypographyVariant, WarningIcon, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -656,6 +656,24 @@ declare const Typography: React__default.ForwardRefExoticComponent<React__defaul
|
|
|
656
656
|
as?: keyof JSX.IntrinsicElements;
|
|
657
657
|
} & React__default.RefAttributes<HTMLElement>>;
|
|
658
658
|
|
|
659
|
+
type PaginationProps = {
|
|
660
|
+
/** Current active page (1-indexed) */
|
|
661
|
+
currentPage: number;
|
|
662
|
+
/** Total number of pages */
|
|
663
|
+
totalPages: number;
|
|
664
|
+
/** Callback when page changes */
|
|
665
|
+
onPageChange: (page: number) => void;
|
|
666
|
+
/** Maximum number of page buttons to show (default: 5) */
|
|
667
|
+
maxVisible?: number;
|
|
668
|
+
/** Show prev/next arrows (default: true) */
|
|
669
|
+
showArrows?: boolean;
|
|
670
|
+
/** Custom class for the container */
|
|
671
|
+
className?: string;
|
|
672
|
+
/** Disable pagination */
|
|
673
|
+
disabled?: boolean;
|
|
674
|
+
};
|
|
675
|
+
declare const Pagination: React__default.ForwardRefExoticComponent<PaginationProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
676
|
+
|
|
659
677
|
type ContainerProps = React__default.HTMLAttributes<HTMLDivElement> & {
|
|
660
678
|
/**
|
|
661
679
|
* Remove o padding horizontal lateral.
|
|
@@ -757,4 +775,8 @@ declare const NeutralIcon: (props: IconProps) => react_jsx_runtime.JSX.Element;
|
|
|
757
775
|
|
|
758
776
|
declare const CloseIcon: (props: IconProps) => react_jsx_runtime.JSX.Element;
|
|
759
777
|
|
|
760
|
-
|
|
778
|
+
declare function CaretLeftIcon({ className, ...props }: IconProps): react_jsx_runtime.JSX.Element;
|
|
779
|
+
|
|
780
|
+
declare function CaretRightIcon({ className, ...props }: IconProps): react_jsx_runtime.JSX.Element;
|
|
781
|
+
|
|
782
|
+
export { Avatar, type AvatarProps, type AvatarSize, type AvatarVariant, Button, ButtonColor, type ButtonProps, type ButtonRadius, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardPadding, type CardProps, type CardRadius, type CardVariant, CaretLeftIcon, CaretRightIcon, Checkbox, type CheckboxProps, type CheckboxSize, CloseIcon, Container, type ContainerProps, DeleteIcon, EditIcon, ErrorIcon, GridContainer, type GridContainerProps, GridItem, type GridItemProps, type GridSpan, IconButton, type IconButtonColor, type IconButtonProps, type IconButtonRadius, type IconButtonSize, type IconButtonVariant, type IconProps, InfoIcon, type MobileSpan, NeutralIcon, Pagination, type PaginationProps, PlusIcon, ProgressBar, type ProgressBarProps, type ProgressBarSize, RehagroProvider, type RehagroProviderProps, type RehagroTheme, SearchIcon, Select, type SelectMultipleProps, type SelectOption, type SelectProps, type SelectRadius, type SelectSingleProps, type SelectSize, type SelectStatus, type SortDirection, Spinner, type SpinnerProps, type SpinnerSize, SuccessIcon, Table, type TableColumn, type TableProps, type TableSize, type TableSort, type TableVariant, Tag, TagInput, type TagInputOption, type TagInputProps, type TagInputRadius, type TagInputSize, type TagInputStatus, type TagProps, type TagSize, TextInput, type TextInputProps, type TextInputRadius, type TextInputSize, type TextInputStatus, Toast, type ToastAppearance, ToastContainer, type ToastFn, type ToastItem, type ToastLink, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, type ToastVariant, ToggleGroup, type ToggleGroupOption, type ToggleGroupProps, type ToggleGroupRadius, type ToggleGroupSize, Tooltip, type TooltipPlacement, type TooltipProps, type TooltipSize, type TooltipVariant, Typography, type TypographyColor, type TypographyProps, type TypographyVariant, WarningIcon, useToast };
|
package/dist/index.js
CHANGED
|
@@ -239,6 +239,54 @@ var CloseIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
239
239
|
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" })
|
|
240
240
|
}
|
|
241
241
|
);
|
|
242
|
+
function CaretLeftIcon({ className, ...props }) {
|
|
243
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
244
|
+
"svg",
|
|
245
|
+
{
|
|
246
|
+
width: "16",
|
|
247
|
+
height: "16",
|
|
248
|
+
viewBox: "0 0 16 16",
|
|
249
|
+
fill: "none",
|
|
250
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
251
|
+
className,
|
|
252
|
+
...props,
|
|
253
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
254
|
+
"path",
|
|
255
|
+
{
|
|
256
|
+
d: "M10 12L6 8L10 4",
|
|
257
|
+
stroke: "currentColor",
|
|
258
|
+
strokeWidth: "1.5",
|
|
259
|
+
strokeLinecap: "round",
|
|
260
|
+
strokeLinejoin: "round"
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
function CaretRightIcon({ className, ...props }) {
|
|
267
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
268
|
+
"svg",
|
|
269
|
+
{
|
|
270
|
+
width: "16",
|
|
271
|
+
height: "16",
|
|
272
|
+
viewBox: "0 0 16 16",
|
|
273
|
+
fill: "none",
|
|
274
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
275
|
+
className,
|
|
276
|
+
...props,
|
|
277
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
278
|
+
"path",
|
|
279
|
+
{
|
|
280
|
+
d: "M6 4L10 8L6 12",
|
|
281
|
+
stroke: "currentColor",
|
|
282
|
+
strokeWidth: "1.5",
|
|
283
|
+
strokeLinecap: "round",
|
|
284
|
+
strokeLinejoin: "round"
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
}
|
|
242
290
|
var variantIconMap = {
|
|
243
291
|
info: InfoIcon,
|
|
244
292
|
warning: WarningIcon,
|
|
@@ -2726,6 +2774,159 @@ var Typography = React8.forwardRef(function Typography2({ variant = "body", colo
|
|
|
2726
2774
|
children
|
|
2727
2775
|
);
|
|
2728
2776
|
});
|
|
2777
|
+
function getVisiblePages(currentPage, totalPages, maxVisible) {
|
|
2778
|
+
if (totalPages <= maxVisible) {
|
|
2779
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
2780
|
+
}
|
|
2781
|
+
const half = Math.floor(maxVisible / 2);
|
|
2782
|
+
let start = currentPage - half;
|
|
2783
|
+
let end = currentPage + half;
|
|
2784
|
+
if (start < 1) {
|
|
2785
|
+
start = 1;
|
|
2786
|
+
end = maxVisible;
|
|
2787
|
+
}
|
|
2788
|
+
if (end > totalPages) {
|
|
2789
|
+
end = totalPages;
|
|
2790
|
+
start = totalPages - maxVisible + 1;
|
|
2791
|
+
}
|
|
2792
|
+
const pages = [];
|
|
2793
|
+
if (start > 1) {
|
|
2794
|
+
pages.push(1);
|
|
2795
|
+
if (start > 2) {
|
|
2796
|
+
pages.push("ellipsis-start");
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
for (let i = start; i <= end; i++) {
|
|
2800
|
+
if (i >= 1 && i <= totalPages && !pages.includes(i)) {
|
|
2801
|
+
pages.push(i);
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
if (end < totalPages) {
|
|
2805
|
+
if (end < totalPages - 1) {
|
|
2806
|
+
pages.push("ellipsis-end");
|
|
2807
|
+
}
|
|
2808
|
+
if (!pages.includes(totalPages)) {
|
|
2809
|
+
pages.push(totalPages);
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
return pages;
|
|
2813
|
+
}
|
|
2814
|
+
var Pagination = React8.forwardRef(function Pagination2({
|
|
2815
|
+
currentPage,
|
|
2816
|
+
totalPages,
|
|
2817
|
+
onPageChange,
|
|
2818
|
+
maxVisible = 5,
|
|
2819
|
+
showArrows = true,
|
|
2820
|
+
className = "",
|
|
2821
|
+
disabled = false
|
|
2822
|
+
}, ref) {
|
|
2823
|
+
const visiblePages = React8.useMemo(
|
|
2824
|
+
() => getVisiblePages(currentPage, totalPages, maxVisible),
|
|
2825
|
+
[currentPage, totalPages, maxVisible]
|
|
2826
|
+
);
|
|
2827
|
+
const canGoPrev = currentPage > 1;
|
|
2828
|
+
const canGoNext = currentPage < totalPages;
|
|
2829
|
+
const handlePageClick = (page) => {
|
|
2830
|
+
if (!disabled && page !== currentPage && page >= 1 && page <= totalPages) {
|
|
2831
|
+
onPageChange(page);
|
|
2832
|
+
}
|
|
2833
|
+
};
|
|
2834
|
+
const handlePrev = () => {
|
|
2835
|
+
if (!disabled && canGoPrev) {
|
|
2836
|
+
onPageChange(currentPage - 1);
|
|
2837
|
+
}
|
|
2838
|
+
};
|
|
2839
|
+
const handleNext = () => {
|
|
2840
|
+
if (!disabled && canGoNext) {
|
|
2841
|
+
onPageChange(currentPage + 1);
|
|
2842
|
+
}
|
|
2843
|
+
};
|
|
2844
|
+
if (totalPages <= 1) {
|
|
2845
|
+
return null;
|
|
2846
|
+
}
|
|
2847
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2848
|
+
"nav",
|
|
2849
|
+
{
|
|
2850
|
+
ref,
|
|
2851
|
+
role: "navigation",
|
|
2852
|
+
"aria-label": "Pagina\xE7\xE3o",
|
|
2853
|
+
className: [
|
|
2854
|
+
"rh-flex rh-flex-row rh-items-center rh-justify-end rh-gap-1",
|
|
2855
|
+
disabled ? "rh-opacity-50 rh-pointer-events-none" : "",
|
|
2856
|
+
className
|
|
2857
|
+
].filter(Boolean).join(" "),
|
|
2858
|
+
children: [
|
|
2859
|
+
showArrows && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2860
|
+
"button",
|
|
2861
|
+
{
|
|
2862
|
+
type: "button",
|
|
2863
|
+
onClick: handlePrev,
|
|
2864
|
+
disabled: !canGoPrev || disabled,
|
|
2865
|
+
"aria-label": "P\xE1gina anterior",
|
|
2866
|
+
className: [
|
|
2867
|
+
"rh-w-8 rh-h-8 rh-rounded-full rh-flex rh-items-center rh-justify-center",
|
|
2868
|
+
"rh-bg-transparent",
|
|
2869
|
+
"rh-transition-colors rh-duration-150",
|
|
2870
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring",
|
|
2871
|
+
canGoPrev && !disabled ? "rh-text-gray-700 hover:rh-bg-gray-100 rh-cursor-pointer" : "rh-text-gray-300 rh-cursor-not-allowed"
|
|
2872
|
+
].filter(Boolean).join(" "),
|
|
2873
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(CaretLeftIcon, { className: "rh-w-4 rh-h-4" })
|
|
2874
|
+
}
|
|
2875
|
+
),
|
|
2876
|
+
visiblePages.map((page, index) => {
|
|
2877
|
+
if (page === "ellipsis-start" || page === "ellipsis-end") {
|
|
2878
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2879
|
+
"span",
|
|
2880
|
+
{
|
|
2881
|
+
className: "rh-w-8 rh-h-8 rh-flex rh-items-center rh-justify-center rh-text-gray-500 rh-font-display rh-text-xs rh-font-bold",
|
|
2882
|
+
"aria-hidden": "true",
|
|
2883
|
+
children: "..."
|
|
2884
|
+
},
|
|
2885
|
+
page
|
|
2886
|
+
);
|
|
2887
|
+
}
|
|
2888
|
+
const isActive = page === currentPage;
|
|
2889
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2890
|
+
"button",
|
|
2891
|
+
{
|
|
2892
|
+
type: "button",
|
|
2893
|
+
onClick: () => handlePageClick(page),
|
|
2894
|
+
disabled,
|
|
2895
|
+
"aria-label": `P\xE1gina ${page}`,
|
|
2896
|
+
"aria-current": isActive ? "page" : void 0,
|
|
2897
|
+
className: [
|
|
2898
|
+
"rh-w-8 rh-h-8 rh-rounded-full rh-flex rh-items-center rh-justify-center",
|
|
2899
|
+
"rh-font-display rh-text-xs rh-font-bold rh-leading-5",
|
|
2900
|
+
"rh-transition-colors rh-duration-150",
|
|
2901
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring focus-visible:rh-ring-offset-1",
|
|
2902
|
+
isActive ? "rh-bg-primary rh-text-white" : "rh-bg-transparent rh-text-gray-700 hover:rh-bg-gray-100 rh-cursor-pointer"
|
|
2903
|
+
].filter(Boolean).join(" "),
|
|
2904
|
+
children: page
|
|
2905
|
+
},
|
|
2906
|
+
page
|
|
2907
|
+
);
|
|
2908
|
+
}),
|
|
2909
|
+
showArrows && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2910
|
+
"button",
|
|
2911
|
+
{
|
|
2912
|
+
type: "button",
|
|
2913
|
+
onClick: handleNext,
|
|
2914
|
+
disabled: !canGoNext || disabled,
|
|
2915
|
+
"aria-label": "Pr\xF3xima p\xE1gina",
|
|
2916
|
+
className: [
|
|
2917
|
+
"rh-w-8 rh-h-8 rh-rounded-full rh-flex rh-items-center rh-justify-center",
|
|
2918
|
+
"rh-bg-transparent",
|
|
2919
|
+
"rh-transition-colors rh-duration-150",
|
|
2920
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring",
|
|
2921
|
+
canGoNext && !disabled ? "rh-text-gray-700 hover:rh-bg-gray-100 rh-cursor-pointer" : "rh-text-gray-300 rh-cursor-not-allowed"
|
|
2922
|
+
].filter(Boolean).join(" "),
|
|
2923
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(CaretRightIcon, { className: "rh-w-4 rh-h-4" })
|
|
2924
|
+
}
|
|
2925
|
+
)
|
|
2926
|
+
]
|
|
2927
|
+
}
|
|
2928
|
+
);
|
|
2929
|
+
});
|
|
2729
2930
|
var Container = React8.forwardRef(
|
|
2730
2931
|
function Container2({ fluid = false, className = "", children, ...rest }, ref) {
|
|
2731
2932
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2901,6 +3102,8 @@ exports.Card = Card;
|
|
|
2901
3102
|
exports.CardContent = CardContent;
|
|
2902
3103
|
exports.CardFooter = CardFooter;
|
|
2903
3104
|
exports.CardHeader = CardHeader;
|
|
3105
|
+
exports.CaretLeftIcon = CaretLeftIcon;
|
|
3106
|
+
exports.CaretRightIcon = CaretRightIcon;
|
|
2904
3107
|
exports.Checkbox = Checkbox;
|
|
2905
3108
|
exports.CloseIcon = CloseIcon;
|
|
2906
3109
|
exports.Container = Container;
|
|
@@ -2912,6 +3115,7 @@ exports.GridItem = GridItem;
|
|
|
2912
3115
|
exports.IconButton = IconButton;
|
|
2913
3116
|
exports.InfoIcon = InfoIcon;
|
|
2914
3117
|
exports.NeutralIcon = NeutralIcon;
|
|
3118
|
+
exports.Pagination = Pagination;
|
|
2915
3119
|
exports.PlusIcon = PlusIcon;
|
|
2916
3120
|
exports.ProgressBar = ProgressBar;
|
|
2917
3121
|
exports.RehagroProvider = RehagroProvider;
|