@eqtylab/equality 2.5.0 → 3.1.0
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/global-theme-config.css +9 -1
- package/dist/index.cjs +59 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +60 -10
- package/dist/index.js.map +1 -1
- package/dist/pagination.module.module.css.module.css +79 -0
- package/dist/theme-preflight-global.css +229 -222
- package/dist/theme-preflight-scoped.css +229 -223
- package/dist/theme.module.css +1 -1
- package/dist/theme.module.module.css.module.css +37 -37
- package/package.json +6 -3
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
@import './generated/tailwind-tokens.css';
|
|
11
11
|
|
|
12
12
|
@import './theme-base.css';
|
|
13
|
-
@import './theme-preflight-global.css';
|
|
14
13
|
@import './theme-components.css';
|
|
15
14
|
@import './theme-utilities.css';
|
|
15
|
+
|
|
16
|
+
/* NOTE: preflight is deliberately NOT imported here. It is an opt-in import so
|
|
17
|
+
that host sites with their own base styles can skip it or scope it:
|
|
18
|
+
|
|
19
|
+
@import '@eqtylab/equality/preflight.css' layer(base); // own the document
|
|
20
|
+
@import '@eqtylab/equality/preflight-scoped.css' layer(base); // reset only inside
|
|
21
|
+
// [data-equality-root]
|
|
22
|
+
Import this file first so the layer order above is registered before the
|
|
23
|
+
preflight lands in `base`. */
|
package/dist/index.cjs
CHANGED
|
@@ -2801,6 +2801,8 @@ var SelectSeparator = React15__namespace.forwardRef(({ className, ...props }, re
|
|
|
2801
2801
|
SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
|
|
2802
2802
|
var ChevronLeftIcon2 = LucideIcons.ChevronLeft;
|
|
2803
2803
|
var ChevronRightIcon3 = LucideIcons.ChevronRight;
|
|
2804
|
+
var ChevronsLeftIcon = LucideIcons.ChevronsLeft;
|
|
2805
|
+
var ChevronsRightIcon = LucideIcons.ChevronsRight;
|
|
2804
2806
|
var Pagination = ({
|
|
2805
2807
|
currentPage,
|
|
2806
2808
|
totalItems,
|
|
@@ -2810,6 +2812,7 @@ var Pagination = ({
|
|
|
2810
2812
|
onItemsPerPageChange,
|
|
2811
2813
|
itemsPerPageOptions = [10, 25, 50, 100],
|
|
2812
2814
|
showInfo = true,
|
|
2815
|
+
showFirstLast = true,
|
|
2813
2816
|
maxVisiblePages = 5,
|
|
2814
2817
|
className = "",
|
|
2815
2818
|
type = "",
|
|
@@ -2819,8 +2822,9 @@ var Pagination = ({
|
|
|
2819
2822
|
const startItem = Math.min(filteredItems, 1 + (currentPage - 1) * itemsPerPage);
|
|
2820
2823
|
const endItem = Math.min(currentPage * itemsPerPage, filteredItems);
|
|
2821
2824
|
const hasFilteredItems = filteredItems > 0;
|
|
2822
|
-
const isFirstPage = currentPage
|
|
2823
|
-
const isLastPage = currentPage
|
|
2825
|
+
const isFirstPage = currentPage <= 1;
|
|
2826
|
+
const isLastPage = currentPage >= totalPages;
|
|
2827
|
+
const showFirstLastButtons = showFirstLast && totalPages > maxVisiblePages;
|
|
2824
2828
|
if (totalItems <= itemsPerPageOptions[0]) {
|
|
2825
2829
|
return null;
|
|
2826
2830
|
}
|
|
@@ -2848,12 +2852,18 @@ var Pagination = ({
|
|
|
2848
2852
|
onItemsPerPageChange?.(newItemsPerPage);
|
|
2849
2853
|
onPageChange(1);
|
|
2850
2854
|
};
|
|
2855
|
+
const handleFirstPage = () => {
|
|
2856
|
+
handlePageChange(1);
|
|
2857
|
+
};
|
|
2851
2858
|
const handlePreviousPage = () => {
|
|
2852
2859
|
handlePageChange(Math.max(1, currentPage - 1));
|
|
2853
2860
|
};
|
|
2854
2861
|
const handleNextPage = () => {
|
|
2855
2862
|
handlePageChange(Math.min(totalPages, currentPage + 1));
|
|
2856
2863
|
};
|
|
2864
|
+
const handleLastPage = () => {
|
|
2865
|
+
handlePageChange(totalPages);
|
|
2866
|
+
};
|
|
2857
2867
|
const getVisiblePages = () => {
|
|
2858
2868
|
const pageButtons = [];
|
|
2859
2869
|
let startPage = 1;
|
|
@@ -2866,7 +2876,7 @@ var Pagination = ({
|
|
|
2866
2876
|
startPage = totalPages - maxVisiblePages + 1;
|
|
2867
2877
|
} else {
|
|
2868
2878
|
startPage = currentPage - halfVisible;
|
|
2869
|
-
endPage =
|
|
2879
|
+
endPage = startPage + maxVisiblePages - 1;
|
|
2870
2880
|
}
|
|
2871
2881
|
}
|
|
2872
2882
|
for (let i = startPage; i <= endPage; i++) {
|
|
@@ -2877,6 +2887,8 @@ var Pagination = ({
|
|
|
2877
2887
|
variant: currentPage === i ? "primary" : "tertiary",
|
|
2878
2888
|
size: "sm",
|
|
2879
2889
|
onClick: () => handlePageChange(i),
|
|
2890
|
+
"aria-label": `Page ${i} of ${totalPages}`,
|
|
2891
|
+
"aria-current": currentPage === i ? "page" : void 0,
|
|
2880
2892
|
children: i
|
|
2881
2893
|
},
|
|
2882
2894
|
i
|
|
@@ -2893,7 +2905,14 @@ var Pagination = ({
|
|
|
2893
2905
|
" to"
|
|
2894
2906
|
] }),
|
|
2895
2907
|
onItemsPerPageChange ? /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: itemsPerPage.toString(), onValueChange: handleItemsPerPageChange, children: [
|
|
2896
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2908
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2909
|
+
SelectTrigger,
|
|
2910
|
+
{
|
|
2911
|
+
className: styles36__default.default["items-per-page-trigger"],
|
|
2912
|
+
"aria-label": "Items per page",
|
|
2913
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {})
|
|
2914
|
+
}
|
|
2915
|
+
),
|
|
2897
2916
|
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: itemsPerPageOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.toString(), children: option }, option)) })
|
|
2898
2917
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: endItem }),
|
|
2899
2918
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
@@ -2903,7 +2922,18 @@ var Pagination = ({
|
|
|
2903
2922
|
type
|
|
2904
2923
|
] })
|
|
2905
2924
|
] }) }),
|
|
2906
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
2925
|
+
/* @__PURE__ */ jsxRuntime.jsxs("nav", { className: styles36__default.default["page-navigation-container"], "aria-label": "Pagination", children: [
|
|
2926
|
+
showFirstLastButtons && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2927
|
+
Button,
|
|
2928
|
+
{
|
|
2929
|
+
variant: "tertiary",
|
|
2930
|
+
size: "sm",
|
|
2931
|
+
onClick: handleFirstPage,
|
|
2932
|
+
disabled: isFirstPage,
|
|
2933
|
+
"aria-label": "First page",
|
|
2934
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronsLeftIcon, {})
|
|
2935
|
+
}
|
|
2936
|
+
),
|
|
2907
2937
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2908
2938
|
Button,
|
|
2909
2939
|
{
|
|
@@ -2926,6 +2956,17 @@ var Pagination = ({
|
|
|
2926
2956
|
"aria-label": "Next page",
|
|
2927
2957
|
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon3, {})
|
|
2928
2958
|
}
|
|
2959
|
+
),
|
|
2960
|
+
showFirstLastButtons && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2961
|
+
Button,
|
|
2962
|
+
{
|
|
2963
|
+
variant: "tertiary",
|
|
2964
|
+
size: "sm",
|
|
2965
|
+
onClick: handleLastPage,
|
|
2966
|
+
disabled: isLastPage,
|
|
2967
|
+
"aria-label": `Last page (${totalPages})`,
|
|
2968
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronsRightIcon, {})
|
|
2969
|
+
}
|
|
2929
2970
|
)
|
|
2930
2971
|
] })
|
|
2931
2972
|
] });
|
|
@@ -4178,10 +4219,19 @@ var PortalContainerProvider = ({ container, children }) => /* @__PURE__ */ jsxRu
|
|
|
4178
4219
|
var ThemeProvider = ({ customVars, portalContainer, children }) => {
|
|
4179
4220
|
const [ownPortalContainer, setOwnPortalContainer] = React15__namespace.useState(null);
|
|
4180
4221
|
const usesOwnPortal = portalContainer === void 0;
|
|
4181
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PortalContainerProvider, { container: usesOwnPortal ? ownPortalContainer : portalContainer, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4222
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PortalContainerProvider, { container: usesOwnPortal ? ownPortalContainer : portalContainer, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4223
|
+
"div",
|
|
4224
|
+
{
|
|
4225
|
+
id: "equality-theme-provider-root",
|
|
4226
|
+
"data-equality-root": true,
|
|
4227
|
+
className: styles63__default.default.root,
|
|
4228
|
+
style: customVars,
|
|
4229
|
+
children: [
|
|
4230
|
+
children,
|
|
4231
|
+
usesOwnPortal && /* @__PURE__ */ jsxRuntime.jsx(Portal8, { ref: setOwnPortalContainer })
|
|
4232
|
+
]
|
|
4233
|
+
}
|
|
4234
|
+
) });
|
|
4185
4235
|
};
|
|
4186
4236
|
|
|
4187
4237
|
exports.Alert = Alert;
|