@rehagro/ui 1.0.16 → 1.0.18
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.d.mts +1 -1
- package/dist/native.d.ts +1 -1
- package/dist/native.js +76 -66
- package/dist/native.js.map +1 -1
- package/dist/native.mjs +76 -66
- package/dist/native.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -233,6 +233,54 @@ var CloseIcon = (props) => /* @__PURE__ */ jsx(
|
|
|
233
233
|
children: /* @__PURE__ */ 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" })
|
|
234
234
|
}
|
|
235
235
|
);
|
|
236
|
+
function CaretLeftIcon({ className, ...props }) {
|
|
237
|
+
return /* @__PURE__ */ jsx(
|
|
238
|
+
"svg",
|
|
239
|
+
{
|
|
240
|
+
width: "16",
|
|
241
|
+
height: "16",
|
|
242
|
+
viewBox: "0 0 16 16",
|
|
243
|
+
fill: "none",
|
|
244
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
245
|
+
className,
|
|
246
|
+
...props,
|
|
247
|
+
children: /* @__PURE__ */ jsx(
|
|
248
|
+
"path",
|
|
249
|
+
{
|
|
250
|
+
d: "M10 12L6 8L10 4",
|
|
251
|
+
stroke: "currentColor",
|
|
252
|
+
strokeWidth: "1.5",
|
|
253
|
+
strokeLinecap: "round",
|
|
254
|
+
strokeLinejoin: "round"
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
function CaretRightIcon({ className, ...props }) {
|
|
261
|
+
return /* @__PURE__ */ jsx(
|
|
262
|
+
"svg",
|
|
263
|
+
{
|
|
264
|
+
width: "16",
|
|
265
|
+
height: "16",
|
|
266
|
+
viewBox: "0 0 16 16",
|
|
267
|
+
fill: "none",
|
|
268
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
269
|
+
className,
|
|
270
|
+
...props,
|
|
271
|
+
children: /* @__PURE__ */ jsx(
|
|
272
|
+
"path",
|
|
273
|
+
{
|
|
274
|
+
d: "M6 4L10 8L6 12",
|
|
275
|
+
stroke: "currentColor",
|
|
276
|
+
strokeWidth: "1.5",
|
|
277
|
+
strokeLinecap: "round",
|
|
278
|
+
strokeLinejoin: "round"
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
}
|
|
236
284
|
var variantIconMap = {
|
|
237
285
|
info: InfoIcon,
|
|
238
286
|
warning: WarningIcon,
|
|
@@ -2720,6 +2768,159 @@ var Typography = forwardRef(function Typography2({ variant = "body", color = "de
|
|
|
2720
2768
|
children
|
|
2721
2769
|
);
|
|
2722
2770
|
});
|
|
2771
|
+
function getVisiblePages(currentPage, totalPages, maxVisible) {
|
|
2772
|
+
if (totalPages <= maxVisible) {
|
|
2773
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
2774
|
+
}
|
|
2775
|
+
const half = Math.floor(maxVisible / 2);
|
|
2776
|
+
let start = currentPage - half;
|
|
2777
|
+
let end = currentPage + half;
|
|
2778
|
+
if (start < 1) {
|
|
2779
|
+
start = 1;
|
|
2780
|
+
end = maxVisible;
|
|
2781
|
+
}
|
|
2782
|
+
if (end > totalPages) {
|
|
2783
|
+
end = totalPages;
|
|
2784
|
+
start = totalPages - maxVisible + 1;
|
|
2785
|
+
}
|
|
2786
|
+
const pages = [];
|
|
2787
|
+
if (start > 1) {
|
|
2788
|
+
pages.push(1);
|
|
2789
|
+
if (start > 2) {
|
|
2790
|
+
pages.push("ellipsis-start");
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
for (let i = start; i <= end; i++) {
|
|
2794
|
+
if (i >= 1 && i <= totalPages && !pages.includes(i)) {
|
|
2795
|
+
pages.push(i);
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
if (end < totalPages) {
|
|
2799
|
+
if (end < totalPages - 1) {
|
|
2800
|
+
pages.push("ellipsis-end");
|
|
2801
|
+
}
|
|
2802
|
+
if (!pages.includes(totalPages)) {
|
|
2803
|
+
pages.push(totalPages);
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
return pages;
|
|
2807
|
+
}
|
|
2808
|
+
var Pagination = forwardRef(function Pagination2({
|
|
2809
|
+
currentPage,
|
|
2810
|
+
totalPages,
|
|
2811
|
+
onPageChange,
|
|
2812
|
+
maxVisible = 5,
|
|
2813
|
+
showArrows = true,
|
|
2814
|
+
className = "",
|
|
2815
|
+
disabled = false
|
|
2816
|
+
}, ref) {
|
|
2817
|
+
const visiblePages = useMemo(
|
|
2818
|
+
() => getVisiblePages(currentPage, totalPages, maxVisible),
|
|
2819
|
+
[currentPage, totalPages, maxVisible]
|
|
2820
|
+
);
|
|
2821
|
+
const canGoPrev = currentPage > 1;
|
|
2822
|
+
const canGoNext = currentPage < totalPages;
|
|
2823
|
+
const handlePageClick = (page) => {
|
|
2824
|
+
if (!disabled && page !== currentPage && page >= 1 && page <= totalPages) {
|
|
2825
|
+
onPageChange(page);
|
|
2826
|
+
}
|
|
2827
|
+
};
|
|
2828
|
+
const handlePrev = () => {
|
|
2829
|
+
if (!disabled && canGoPrev) {
|
|
2830
|
+
onPageChange(currentPage - 1);
|
|
2831
|
+
}
|
|
2832
|
+
};
|
|
2833
|
+
const handleNext = () => {
|
|
2834
|
+
if (!disabled && canGoNext) {
|
|
2835
|
+
onPageChange(currentPage + 1);
|
|
2836
|
+
}
|
|
2837
|
+
};
|
|
2838
|
+
if (totalPages <= 1) {
|
|
2839
|
+
return null;
|
|
2840
|
+
}
|
|
2841
|
+
return /* @__PURE__ */ jsxs(
|
|
2842
|
+
"nav",
|
|
2843
|
+
{
|
|
2844
|
+
ref,
|
|
2845
|
+
role: "navigation",
|
|
2846
|
+
"aria-label": "Pagina\xE7\xE3o",
|
|
2847
|
+
className: [
|
|
2848
|
+
"rh-flex rh-flex-row rh-items-center rh-justify-end rh-gap-1",
|
|
2849
|
+
disabled ? "rh-opacity-50 rh-pointer-events-none" : "",
|
|
2850
|
+
className
|
|
2851
|
+
].filter(Boolean).join(" "),
|
|
2852
|
+
children: [
|
|
2853
|
+
showArrows && /* @__PURE__ */ jsx(
|
|
2854
|
+
"button",
|
|
2855
|
+
{
|
|
2856
|
+
type: "button",
|
|
2857
|
+
onClick: handlePrev,
|
|
2858
|
+
disabled: !canGoPrev || disabled,
|
|
2859
|
+
"aria-label": "P\xE1gina anterior",
|
|
2860
|
+
className: [
|
|
2861
|
+
"rh-w-8 rh-h-8 rh-rounded-full rh-flex rh-items-center rh-justify-center",
|
|
2862
|
+
"rh-bg-transparent",
|
|
2863
|
+
"rh-transition-colors rh-duration-150",
|
|
2864
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring",
|
|
2865
|
+
canGoPrev && !disabled ? "rh-text-gray-700 hover:rh-bg-gray-100 rh-cursor-pointer" : "rh-text-gray-300 rh-cursor-not-allowed"
|
|
2866
|
+
].filter(Boolean).join(" "),
|
|
2867
|
+
children: /* @__PURE__ */ jsx(CaretLeftIcon, { className: "rh-w-4 rh-h-4" })
|
|
2868
|
+
}
|
|
2869
|
+
),
|
|
2870
|
+
visiblePages.map((page, index) => {
|
|
2871
|
+
if (page === "ellipsis-start" || page === "ellipsis-end") {
|
|
2872
|
+
return /* @__PURE__ */ jsx(
|
|
2873
|
+
"span",
|
|
2874
|
+
{
|
|
2875
|
+
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",
|
|
2876
|
+
"aria-hidden": "true",
|
|
2877
|
+
children: "..."
|
|
2878
|
+
},
|
|
2879
|
+
page
|
|
2880
|
+
);
|
|
2881
|
+
}
|
|
2882
|
+
const isActive = page === currentPage;
|
|
2883
|
+
return /* @__PURE__ */ jsx(
|
|
2884
|
+
"button",
|
|
2885
|
+
{
|
|
2886
|
+
type: "button",
|
|
2887
|
+
onClick: () => handlePageClick(page),
|
|
2888
|
+
disabled,
|
|
2889
|
+
"aria-label": `P\xE1gina ${page}`,
|
|
2890
|
+
"aria-current": isActive ? "page" : void 0,
|
|
2891
|
+
className: [
|
|
2892
|
+
"rh-w-8 rh-h-8 rh-rounded-full rh-flex rh-items-center rh-justify-center",
|
|
2893
|
+
"rh-font-display rh-text-xs rh-font-bold rh-leading-5",
|
|
2894
|
+
"rh-transition-colors rh-duration-150",
|
|
2895
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring focus-visible:rh-ring-offset-1",
|
|
2896
|
+
isActive ? "rh-bg-primary rh-text-white" : "rh-bg-transparent rh-text-gray-700 hover:rh-bg-gray-100 rh-cursor-pointer"
|
|
2897
|
+
].filter(Boolean).join(" "),
|
|
2898
|
+
children: page
|
|
2899
|
+
},
|
|
2900
|
+
page
|
|
2901
|
+
);
|
|
2902
|
+
}),
|
|
2903
|
+
showArrows && /* @__PURE__ */ jsx(
|
|
2904
|
+
"button",
|
|
2905
|
+
{
|
|
2906
|
+
type: "button",
|
|
2907
|
+
onClick: handleNext,
|
|
2908
|
+
disabled: !canGoNext || disabled,
|
|
2909
|
+
"aria-label": "Pr\xF3xima p\xE1gina",
|
|
2910
|
+
className: [
|
|
2911
|
+
"rh-w-8 rh-h-8 rh-rounded-full rh-flex rh-items-center rh-justify-center",
|
|
2912
|
+
"rh-bg-transparent",
|
|
2913
|
+
"rh-transition-colors rh-duration-150",
|
|
2914
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring",
|
|
2915
|
+
canGoNext && !disabled ? "rh-text-gray-700 hover:rh-bg-gray-100 rh-cursor-pointer" : "rh-text-gray-300 rh-cursor-not-allowed"
|
|
2916
|
+
].filter(Boolean).join(" "),
|
|
2917
|
+
children: /* @__PURE__ */ jsx(CaretRightIcon, { className: "rh-w-4 rh-h-4" })
|
|
2918
|
+
}
|
|
2919
|
+
)
|
|
2920
|
+
]
|
|
2921
|
+
}
|
|
2922
|
+
);
|
|
2923
|
+
});
|
|
2723
2924
|
var Container = forwardRef(
|
|
2724
2925
|
function Container2({ fluid = false, className = "", children, ...rest }, ref) {
|
|
2725
2926
|
return /* @__PURE__ */ jsx(
|
|
@@ -2889,6 +3090,6 @@ var GridItem = forwardRef(
|
|
|
2889
3090
|
}
|
|
2890
3091
|
);
|
|
2891
3092
|
|
|
2892
|
-
export { Avatar, Button, Card, CardContent, CardFooter, CardHeader, Checkbox, CloseIcon, Container, DeleteIcon, EditIcon, ErrorIcon, GridContainer, GridItem, IconButton, InfoIcon, NeutralIcon, PlusIcon, ProgressBar, RehagroProvider, SearchIcon, Select, Spinner, SuccessIcon, Table, Tag, TagInput, TextInput, Toast, ToastContainer, ToastProvider, ToggleGroup, Tooltip, Typography, WarningIcon, useToast };
|
|
3093
|
+
export { Avatar, Button, Card, CardContent, CardFooter, CardHeader, CaretLeftIcon, CaretRightIcon, Checkbox, CloseIcon, Container, DeleteIcon, EditIcon, ErrorIcon, GridContainer, GridItem, IconButton, InfoIcon, NeutralIcon, Pagination, PlusIcon, ProgressBar, RehagroProvider, SearchIcon, Select, Spinner, SuccessIcon, Table, Tag, TagInput, TextInput, Toast, ToastContainer, ToastProvider, ToggleGroup, Tooltip, Typography, WarningIcon, useToast };
|
|
2893
3094
|
//# sourceMappingURL=index.mjs.map
|
|
2894
3095
|
//# sourceMappingURL=index.mjs.map
|