@enyxs/wikex-components 0.11.50 → 0.11.51
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/README.md +4 -0
- package/dist/chrome-model.js +23 -0
- package/dist/chrome-model.mjs +23 -0
- package/dist/fees.js +26 -12
- package/dist/fees.mjs +26 -12
- package/dist/index.js +165 -82
- package/dist/index.mjs +165 -82
- package/dist/products.js +26 -12
- package/dist/products.mjs +26 -12
- package/dist/ui.d.mts +2 -1
- package/dist/ui.d.ts +2 -1
- package/dist/ui.js +26 -12
- package/dist/ui.mjs +26 -12
- package/package.json +1 -1
package/dist/products.js
CHANGED
|
@@ -124,24 +124,24 @@ var import_react_i18next = require("react-i18next");
|
|
|
124
124
|
// src/commodity-original/components/Pagination/style.ts
|
|
125
125
|
var import_styled_components2 = require("styled-components");
|
|
126
126
|
var PaginationNav = import_styled_components2.styled.nav.withConfig({
|
|
127
|
-
componentId: "sc-
|
|
127
|
+
componentId: "sc-e6c46071-0"
|
|
128
128
|
})([
|
|
129
129
|
`display:flex;justify-content:center;`
|
|
130
130
|
]);
|
|
131
131
|
var PaginationList = import_styled_components2.styled.ul.withConfig({
|
|
132
|
-
componentId: "sc-
|
|
132
|
+
componentId: "sc-e6c46071-1"
|
|
133
133
|
})([
|
|
134
134
|
`display:flex;margin:0;padding:0;align-items:center;gap:8px;list-style:none;`
|
|
135
135
|
]);
|
|
136
136
|
var PaginationItem = import_styled_components2.styled.li.withConfig({
|
|
137
|
-
componentId: "sc-
|
|
137
|
+
componentId: "sc-e6c46071-2"
|
|
138
138
|
})([
|
|
139
139
|
`display:flex;`
|
|
140
140
|
]);
|
|
141
141
|
var PaginationButton = import_styled_components2.styled.button.withConfig({
|
|
142
|
-
componentId: "sc-
|
|
142
|
+
componentId: "sc-e6c46071-3"
|
|
143
143
|
})([
|
|
144
|
-
`display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
144
|
+
`box-sizing:border-box;text-decoration:none;display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
145
145
|
`;border-radius:4px;padding:4px;color:`,
|
|
146
146
|
`;background:`,
|
|
147
147
|
`;font-family:var(--font-manrope),Arial,Helvetica,sans-serif;font-size:14px;font-weight:500;line-height:18px;cursor:pointer;transition:color 160ms ease,background-color 160ms ease,border-color 160ms ease;&[data-control]{border-color:transparent;background:transparent;}&[data-active]{border-color:`,
|
|
@@ -154,7 +154,7 @@ var PaginationButton = import_styled_components2.styled.button.withConfig({
|
|
|
154
154
|
`;outline-offset:2px;}`
|
|
155
155
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.text.secondary, ({ theme }) => theme.colors.background.canvas, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.foreground, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.background.hover, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
|
|
156
156
|
var PaginationArrow = import_styled_components2.styled.span.withConfig({
|
|
157
|
-
componentId: "sc-
|
|
157
|
+
componentId: "sc-e6c46071-4"
|
|
158
158
|
})([
|
|
159
159
|
`width:16px;height:16px;background:currentColor;mask:url("`,
|
|
160
160
|
`") center / contain no-repeat;-webkit-mask:url("`,
|
|
@@ -187,6 +187,7 @@ function Pagination({
|
|
|
187
187
|
page,
|
|
188
188
|
pageCount,
|
|
189
189
|
onPageChange,
|
|
190
|
+
getPageHref,
|
|
190
191
|
siblingCount = 1,
|
|
191
192
|
ariaLabel,
|
|
192
193
|
labels,
|
|
@@ -198,6 +199,13 @@ function Pagination({
|
|
|
198
199
|
const items = getPaginationItems(currentPage, safePageCount, siblingCount);
|
|
199
200
|
const hasPreviousPage = currentPage > 1;
|
|
200
201
|
const hasNextPage = currentPage < safePageCount;
|
|
202
|
+
const pageClick = (page2) => (event) => {
|
|
203
|
+
if (getPageHref) {
|
|
204
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
}
|
|
207
|
+
onPageChange(page2);
|
|
208
|
+
};
|
|
201
209
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
202
210
|
PaginationNav,
|
|
203
211
|
{
|
|
@@ -207,33 +215,39 @@ function Pagination({
|
|
|
207
215
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
208
216
|
PaginationButton,
|
|
209
217
|
{
|
|
218
|
+
as: getPageHref && hasPreviousPage ? "a" : "button",
|
|
219
|
+
href: getPageHref && hasPreviousPage ? getPageHref(currentPage - 1) : void 0,
|
|
210
220
|
"aria-label": labels?.previous ?? t("pagination.previous"),
|
|
211
221
|
"data-control": "previous",
|
|
212
222
|
disabled: !hasPreviousPage,
|
|
213
|
-
onClick: (
|
|
214
|
-
type: "button",
|
|
223
|
+
onClick: pageClick(currentPage - 1),
|
|
224
|
+
type: getPageHref && hasPreviousPage ? void 0 : "button",
|
|
215
225
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationArrow, { "data-direction": "previous" })
|
|
216
226
|
}
|
|
217
227
|
) }),
|
|
218
228
|
items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationItem, { children: item === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationButton, { "aria-hidden": "true", disabled: true, tabIndex: -1, type: "button", children: "\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
219
229
|
PaginationButton,
|
|
220
230
|
{
|
|
231
|
+
as: getPageHref ? "a" : "button",
|
|
232
|
+
href: getPageHref?.(item),
|
|
221
233
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
222
234
|
"aria-label": item === currentPage ? labels?.current(item) ?? t("pagination.current", { page: item }) : labels?.page(item) ?? t("pagination.page", { page: item }),
|
|
223
235
|
"data-active": item === currentPage || void 0,
|
|
224
|
-
onClick: (
|
|
225
|
-
type: "button",
|
|
236
|
+
onClick: pageClick(item),
|
|
237
|
+
type: getPageHref ? void 0 : "button",
|
|
226
238
|
children: item
|
|
227
239
|
}
|
|
228
240
|
) }, `${item}-${index}`)),
|
|
229
241
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
230
242
|
PaginationButton,
|
|
231
243
|
{
|
|
244
|
+
as: getPageHref && hasNextPage ? "a" : "button",
|
|
245
|
+
href: getPageHref && hasNextPage ? getPageHref(currentPage + 1) : void 0,
|
|
232
246
|
"aria-label": labels?.next ?? t("pagination.next"),
|
|
233
247
|
"data-control": "next",
|
|
234
248
|
disabled: !hasNextPage,
|
|
235
|
-
onClick: (
|
|
236
|
-
type: "button",
|
|
249
|
+
onClick: pageClick(currentPage + 1),
|
|
250
|
+
type: getPageHref && hasNextPage ? void 0 : "button",
|
|
237
251
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationArrow, { "data-direction": "next" })
|
|
238
252
|
}
|
|
239
253
|
) })
|
package/dist/products.mjs
CHANGED
|
@@ -86,24 +86,24 @@ import { useTranslation } from "react-i18next";
|
|
|
86
86
|
// src/commodity-original/components/Pagination/style.ts
|
|
87
87
|
import { styled as styled2 } from "styled-components";
|
|
88
88
|
var PaginationNav = styled2.nav.withConfig({
|
|
89
|
-
componentId: "sc-
|
|
89
|
+
componentId: "sc-e6c46071-0"
|
|
90
90
|
})([
|
|
91
91
|
`display:flex;justify-content:center;`
|
|
92
92
|
]);
|
|
93
93
|
var PaginationList = styled2.ul.withConfig({
|
|
94
|
-
componentId: "sc-
|
|
94
|
+
componentId: "sc-e6c46071-1"
|
|
95
95
|
})([
|
|
96
96
|
`display:flex;margin:0;padding:0;align-items:center;gap:8px;list-style:none;`
|
|
97
97
|
]);
|
|
98
98
|
var PaginationItem = styled2.li.withConfig({
|
|
99
|
-
componentId: "sc-
|
|
99
|
+
componentId: "sc-e6c46071-2"
|
|
100
100
|
})([
|
|
101
101
|
`display:flex;`
|
|
102
102
|
]);
|
|
103
103
|
var PaginationButton = styled2.button.withConfig({
|
|
104
|
-
componentId: "sc-
|
|
104
|
+
componentId: "sc-e6c46071-3"
|
|
105
105
|
})([
|
|
106
|
-
`display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
106
|
+
`box-sizing:border-box;text-decoration:none;display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
107
107
|
`;border-radius:4px;padding:4px;color:`,
|
|
108
108
|
`;background:`,
|
|
109
109
|
`;font-family:var(--font-manrope),Arial,Helvetica,sans-serif;font-size:14px;font-weight:500;line-height:18px;cursor:pointer;transition:color 160ms ease,background-color 160ms ease,border-color 160ms ease;&[data-control]{border-color:transparent;background:transparent;}&[data-active]{border-color:`,
|
|
@@ -116,7 +116,7 @@ var PaginationButton = styled2.button.withConfig({
|
|
|
116
116
|
`;outline-offset:2px;}`
|
|
117
117
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.text.secondary, ({ theme }) => theme.colors.background.canvas, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.foreground, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.background.hover, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
|
|
118
118
|
var PaginationArrow = styled2.span.withConfig({
|
|
119
|
-
componentId: "sc-
|
|
119
|
+
componentId: "sc-e6c46071-4"
|
|
120
120
|
})([
|
|
121
121
|
`width:16px;height:16px;background:currentColor;mask:url("`,
|
|
122
122
|
`") center / contain no-repeat;-webkit-mask:url("`,
|
|
@@ -149,6 +149,7 @@ function Pagination({
|
|
|
149
149
|
page,
|
|
150
150
|
pageCount,
|
|
151
151
|
onPageChange,
|
|
152
|
+
getPageHref,
|
|
152
153
|
siblingCount = 1,
|
|
153
154
|
ariaLabel,
|
|
154
155
|
labels,
|
|
@@ -160,6 +161,13 @@ function Pagination({
|
|
|
160
161
|
const items = getPaginationItems(currentPage, safePageCount, siblingCount);
|
|
161
162
|
const hasPreviousPage = currentPage > 1;
|
|
162
163
|
const hasNextPage = currentPage < safePageCount;
|
|
164
|
+
const pageClick = (page2) => (event) => {
|
|
165
|
+
if (getPageHref) {
|
|
166
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
}
|
|
169
|
+
onPageChange(page2);
|
|
170
|
+
};
|
|
163
171
|
return /* @__PURE__ */ jsx2(
|
|
164
172
|
PaginationNav,
|
|
165
173
|
{
|
|
@@ -169,33 +177,39 @@ function Pagination({
|
|
|
169
177
|
/* @__PURE__ */ jsx2(PaginationItem, { children: /* @__PURE__ */ jsx2(
|
|
170
178
|
PaginationButton,
|
|
171
179
|
{
|
|
180
|
+
as: getPageHref && hasPreviousPage ? "a" : "button",
|
|
181
|
+
href: getPageHref && hasPreviousPage ? getPageHref(currentPage - 1) : void 0,
|
|
172
182
|
"aria-label": labels?.previous ?? t("pagination.previous"),
|
|
173
183
|
"data-control": "previous",
|
|
174
184
|
disabled: !hasPreviousPage,
|
|
175
|
-
onClick: (
|
|
176
|
-
type: "button",
|
|
185
|
+
onClick: pageClick(currentPage - 1),
|
|
186
|
+
type: getPageHref && hasPreviousPage ? void 0 : "button",
|
|
177
187
|
children: /* @__PURE__ */ jsx2(PaginationArrow, { "data-direction": "previous" })
|
|
178
188
|
}
|
|
179
189
|
) }),
|
|
180
190
|
items.map((item, index) => /* @__PURE__ */ jsx2(PaginationItem, { children: item === "ellipsis" ? /* @__PURE__ */ jsx2(PaginationButton, { "aria-hidden": "true", disabled: true, tabIndex: -1, type: "button", children: "\u2026" }) : /* @__PURE__ */ jsx2(
|
|
181
191
|
PaginationButton,
|
|
182
192
|
{
|
|
193
|
+
as: getPageHref ? "a" : "button",
|
|
194
|
+
href: getPageHref?.(item),
|
|
183
195
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
184
196
|
"aria-label": item === currentPage ? labels?.current(item) ?? t("pagination.current", { page: item }) : labels?.page(item) ?? t("pagination.page", { page: item }),
|
|
185
197
|
"data-active": item === currentPage || void 0,
|
|
186
|
-
onClick: (
|
|
187
|
-
type: "button",
|
|
198
|
+
onClick: pageClick(item),
|
|
199
|
+
type: getPageHref ? void 0 : "button",
|
|
188
200
|
children: item
|
|
189
201
|
}
|
|
190
202
|
) }, `${item}-${index}`)),
|
|
191
203
|
/* @__PURE__ */ jsx2(PaginationItem, { children: /* @__PURE__ */ jsx2(
|
|
192
204
|
PaginationButton,
|
|
193
205
|
{
|
|
206
|
+
as: getPageHref && hasNextPage ? "a" : "button",
|
|
207
|
+
href: getPageHref && hasNextPage ? getPageHref(currentPage + 1) : void 0,
|
|
194
208
|
"aria-label": labels?.next ?? t("pagination.next"),
|
|
195
209
|
"data-control": "next",
|
|
196
210
|
disabled: !hasNextPage,
|
|
197
|
-
onClick: (
|
|
198
|
-
type: "button",
|
|
211
|
+
onClick: pageClick(currentPage + 1),
|
|
212
|
+
type: getPageHref && hasNextPage ? void 0 : "button",
|
|
199
213
|
children: /* @__PURE__ */ jsx2(PaginationArrow, { "data-direction": "next" })
|
|
200
214
|
}
|
|
201
215
|
) })
|
package/dist/ui.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ type PaginationProps = {
|
|
|
16
16
|
page: number;
|
|
17
17
|
pageCount: number;
|
|
18
18
|
onPageChange: (page: number) => void;
|
|
19
|
+
getPageHref?: (page: number) => string;
|
|
19
20
|
siblingCount?: number;
|
|
20
21
|
ariaLabel?: string;
|
|
21
22
|
labels?: {
|
|
@@ -26,7 +27,7 @@ type PaginationProps = {
|
|
|
26
27
|
};
|
|
27
28
|
className?: string;
|
|
28
29
|
};
|
|
29
|
-
declare function Pagination({ page, pageCount, onPageChange, siblingCount, ariaLabel, labels, className, }: PaginationProps): react.JSX.Element;
|
|
30
|
+
declare function Pagination({ page, pageCount, onPageChange, getPageHref, siblingCount, ariaLabel, labels, className, }: PaginationProps): react.JSX.Element;
|
|
30
31
|
|
|
31
32
|
type BreadcrumbItemData = {
|
|
32
33
|
label: string;
|
package/dist/ui.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ type PaginationProps = {
|
|
|
16
16
|
page: number;
|
|
17
17
|
pageCount: number;
|
|
18
18
|
onPageChange: (page: number) => void;
|
|
19
|
+
getPageHref?: (page: number) => string;
|
|
19
20
|
siblingCount?: number;
|
|
20
21
|
ariaLabel?: string;
|
|
21
22
|
labels?: {
|
|
@@ -26,7 +27,7 @@ type PaginationProps = {
|
|
|
26
27
|
};
|
|
27
28
|
className?: string;
|
|
28
29
|
};
|
|
29
|
-
declare function Pagination({ page, pageCount, onPageChange, siblingCount, ariaLabel, labels, className, }: PaginationProps): react.JSX.Element;
|
|
30
|
+
declare function Pagination({ page, pageCount, onPageChange, getPageHref, siblingCount, ariaLabel, labels, className, }: PaginationProps): react.JSX.Element;
|
|
30
31
|
|
|
31
32
|
type BreadcrumbItemData = {
|
|
32
33
|
label: string;
|
package/dist/ui.js
CHANGED
|
@@ -171,24 +171,24 @@ var chevron_right_default = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL
|
|
|
171
171
|
// src/commodity-original/components/Pagination/style.ts
|
|
172
172
|
var import_styled_components2 = require("styled-components");
|
|
173
173
|
var PaginationNav = import_styled_components2.styled.nav.withConfig({
|
|
174
|
-
componentId: "sc-
|
|
174
|
+
componentId: "sc-e6c46071-0"
|
|
175
175
|
})([
|
|
176
176
|
`display:flex;justify-content:center;`
|
|
177
177
|
]);
|
|
178
178
|
var PaginationList = import_styled_components2.styled.ul.withConfig({
|
|
179
|
-
componentId: "sc-
|
|
179
|
+
componentId: "sc-e6c46071-1"
|
|
180
180
|
})([
|
|
181
181
|
`display:flex;margin:0;padding:0;align-items:center;gap:8px;list-style:none;`
|
|
182
182
|
]);
|
|
183
183
|
var PaginationItem = import_styled_components2.styled.li.withConfig({
|
|
184
|
-
componentId: "sc-
|
|
184
|
+
componentId: "sc-e6c46071-2"
|
|
185
185
|
})([
|
|
186
186
|
`display:flex;`
|
|
187
187
|
]);
|
|
188
188
|
var PaginationButton = import_styled_components2.styled.button.withConfig({
|
|
189
|
-
componentId: "sc-
|
|
189
|
+
componentId: "sc-e6c46071-3"
|
|
190
190
|
})([
|
|
191
|
-
`display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
191
|
+
`box-sizing:border-box;text-decoration:none;display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
192
192
|
`;border-radius:4px;padding:4px;color:`,
|
|
193
193
|
`;background:`,
|
|
194
194
|
`;font-family:var(--font-manrope),Arial,Helvetica,sans-serif;font-size:14px;font-weight:500;line-height:18px;cursor:pointer;transition:color 160ms ease,background-color 160ms ease,border-color 160ms ease;&[data-control]{border-color:transparent;background:transparent;}&[data-active]{border-color:`,
|
|
@@ -201,7 +201,7 @@ var PaginationButton = import_styled_components2.styled.button.withConfig({
|
|
|
201
201
|
`;outline-offset:2px;}`
|
|
202
202
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.text.secondary, ({ theme }) => theme.colors.background.canvas, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.foreground, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.background.hover, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
|
|
203
203
|
var PaginationArrow = import_styled_components2.styled.span.withConfig({
|
|
204
|
-
componentId: "sc-
|
|
204
|
+
componentId: "sc-e6c46071-4"
|
|
205
205
|
})([
|
|
206
206
|
`width:16px;height:16px;background:currentColor;mask:url("`,
|
|
207
207
|
`") center / contain no-repeat;-webkit-mask:url("`,
|
|
@@ -234,6 +234,7 @@ function Pagination({
|
|
|
234
234
|
page,
|
|
235
235
|
pageCount,
|
|
236
236
|
onPageChange,
|
|
237
|
+
getPageHref,
|
|
237
238
|
siblingCount = 1,
|
|
238
239
|
ariaLabel,
|
|
239
240
|
labels,
|
|
@@ -245,6 +246,13 @@ function Pagination({
|
|
|
245
246
|
const items = getPaginationItems(currentPage, safePageCount, siblingCount);
|
|
246
247
|
const hasPreviousPage = currentPage > 1;
|
|
247
248
|
const hasNextPage = currentPage < safePageCount;
|
|
249
|
+
const pageClick = (page2) => (event) => {
|
|
250
|
+
if (getPageHref) {
|
|
251
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
252
|
+
event.preventDefault();
|
|
253
|
+
}
|
|
254
|
+
onPageChange(page2);
|
|
255
|
+
};
|
|
248
256
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
249
257
|
PaginationNav,
|
|
250
258
|
{
|
|
@@ -254,33 +262,39 @@ function Pagination({
|
|
|
254
262
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
255
263
|
PaginationButton,
|
|
256
264
|
{
|
|
265
|
+
as: getPageHref && hasPreviousPage ? "a" : "button",
|
|
266
|
+
href: getPageHref && hasPreviousPage ? getPageHref(currentPage - 1) : void 0,
|
|
257
267
|
"aria-label": labels?.previous ?? t("pagination.previous"),
|
|
258
268
|
"data-control": "previous",
|
|
259
269
|
disabled: !hasPreviousPage,
|
|
260
|
-
onClick: (
|
|
261
|
-
type: "button",
|
|
270
|
+
onClick: pageClick(currentPage - 1),
|
|
271
|
+
type: getPageHref && hasPreviousPage ? void 0 : "button",
|
|
262
272
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationArrow, { "data-direction": "previous" })
|
|
263
273
|
}
|
|
264
274
|
) }),
|
|
265
275
|
items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationItem, { children: item === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationButton, { "aria-hidden": "true", disabled: true, tabIndex: -1, type: "button", children: "\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
266
276
|
PaginationButton,
|
|
267
277
|
{
|
|
278
|
+
as: getPageHref ? "a" : "button",
|
|
279
|
+
href: getPageHref?.(item),
|
|
268
280
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
269
281
|
"aria-label": item === currentPage ? labels?.current(item) ?? t("pagination.current", { page: item }) : labels?.page(item) ?? t("pagination.page", { page: item }),
|
|
270
282
|
"data-active": item === currentPage || void 0,
|
|
271
|
-
onClick: (
|
|
272
|
-
type: "button",
|
|
283
|
+
onClick: pageClick(item),
|
|
284
|
+
type: getPageHref ? void 0 : "button",
|
|
273
285
|
children: item
|
|
274
286
|
}
|
|
275
287
|
) }, `${item}-${index}`)),
|
|
276
288
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
277
289
|
PaginationButton,
|
|
278
290
|
{
|
|
291
|
+
as: getPageHref && hasNextPage ? "a" : "button",
|
|
292
|
+
href: getPageHref && hasNextPage ? getPageHref(currentPage + 1) : void 0,
|
|
279
293
|
"aria-label": labels?.next ?? t("pagination.next"),
|
|
280
294
|
"data-control": "next",
|
|
281
295
|
disabled: !hasNextPage,
|
|
282
|
-
onClick: (
|
|
283
|
-
type: "button",
|
|
296
|
+
onClick: pageClick(currentPage + 1),
|
|
297
|
+
type: getPageHref && hasNextPage ? void 0 : "button",
|
|
284
298
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PaginationArrow, { "data-direction": "next" })
|
|
285
299
|
}
|
|
286
300
|
) })
|
package/dist/ui.mjs
CHANGED
|
@@ -134,24 +134,24 @@ var chevron_right_default = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL
|
|
|
134
134
|
// src/commodity-original/components/Pagination/style.ts
|
|
135
135
|
import { styled as styled2 } from "styled-components";
|
|
136
136
|
var PaginationNav = styled2.nav.withConfig({
|
|
137
|
-
componentId: "sc-
|
|
137
|
+
componentId: "sc-e6c46071-0"
|
|
138
138
|
})([
|
|
139
139
|
`display:flex;justify-content:center;`
|
|
140
140
|
]);
|
|
141
141
|
var PaginationList = styled2.ul.withConfig({
|
|
142
|
-
componentId: "sc-
|
|
142
|
+
componentId: "sc-e6c46071-1"
|
|
143
143
|
})([
|
|
144
144
|
`display:flex;margin:0;padding:0;align-items:center;gap:8px;list-style:none;`
|
|
145
145
|
]);
|
|
146
146
|
var PaginationItem = styled2.li.withConfig({
|
|
147
|
-
componentId: "sc-
|
|
147
|
+
componentId: "sc-e6c46071-2"
|
|
148
148
|
})([
|
|
149
149
|
`display:flex;`
|
|
150
150
|
]);
|
|
151
151
|
var PaginationButton = styled2.button.withConfig({
|
|
152
|
-
componentId: "sc-
|
|
152
|
+
componentId: "sc-e6c46071-3"
|
|
153
153
|
})([
|
|
154
|
-
`display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
154
|
+
`box-sizing:border-box;text-decoration:none;display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
155
155
|
`;border-radius:4px;padding:4px;color:`,
|
|
156
156
|
`;background:`,
|
|
157
157
|
`;font-family:var(--font-manrope),Arial,Helvetica,sans-serif;font-size:14px;font-weight:500;line-height:18px;cursor:pointer;transition:color 160ms ease,background-color 160ms ease,border-color 160ms ease;&[data-control]{border-color:transparent;background:transparent;}&[data-active]{border-color:`,
|
|
@@ -164,7 +164,7 @@ var PaginationButton = styled2.button.withConfig({
|
|
|
164
164
|
`;outline-offset:2px;}`
|
|
165
165
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.text.secondary, ({ theme }) => theme.colors.background.canvas, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.foreground, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.background.hover, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
|
|
166
166
|
var PaginationArrow = styled2.span.withConfig({
|
|
167
|
-
componentId: "sc-
|
|
167
|
+
componentId: "sc-e6c46071-4"
|
|
168
168
|
})([
|
|
169
169
|
`width:16px;height:16px;background:currentColor;mask:url("`,
|
|
170
170
|
`") center / contain no-repeat;-webkit-mask:url("`,
|
|
@@ -197,6 +197,7 @@ function Pagination({
|
|
|
197
197
|
page,
|
|
198
198
|
pageCount,
|
|
199
199
|
onPageChange,
|
|
200
|
+
getPageHref,
|
|
200
201
|
siblingCount = 1,
|
|
201
202
|
ariaLabel,
|
|
202
203
|
labels,
|
|
@@ -208,6 +209,13 @@ function Pagination({
|
|
|
208
209
|
const items = getPaginationItems(currentPage, safePageCount, siblingCount);
|
|
209
210
|
const hasPreviousPage = currentPage > 1;
|
|
210
211
|
const hasNextPage = currentPage < safePageCount;
|
|
212
|
+
const pageClick = (page2) => (event) => {
|
|
213
|
+
if (getPageHref) {
|
|
214
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
215
|
+
event.preventDefault();
|
|
216
|
+
}
|
|
217
|
+
onPageChange(page2);
|
|
218
|
+
};
|
|
211
219
|
return /* @__PURE__ */ jsx2(
|
|
212
220
|
PaginationNav,
|
|
213
221
|
{
|
|
@@ -217,33 +225,39 @@ function Pagination({
|
|
|
217
225
|
/* @__PURE__ */ jsx2(PaginationItem, { children: /* @__PURE__ */ jsx2(
|
|
218
226
|
PaginationButton,
|
|
219
227
|
{
|
|
228
|
+
as: getPageHref && hasPreviousPage ? "a" : "button",
|
|
229
|
+
href: getPageHref && hasPreviousPage ? getPageHref(currentPage - 1) : void 0,
|
|
220
230
|
"aria-label": labels?.previous ?? t("pagination.previous"),
|
|
221
231
|
"data-control": "previous",
|
|
222
232
|
disabled: !hasPreviousPage,
|
|
223
|
-
onClick: (
|
|
224
|
-
type: "button",
|
|
233
|
+
onClick: pageClick(currentPage - 1),
|
|
234
|
+
type: getPageHref && hasPreviousPage ? void 0 : "button",
|
|
225
235
|
children: /* @__PURE__ */ jsx2(PaginationArrow, { "data-direction": "previous" })
|
|
226
236
|
}
|
|
227
237
|
) }),
|
|
228
238
|
items.map((item, index) => /* @__PURE__ */ jsx2(PaginationItem, { children: item === "ellipsis" ? /* @__PURE__ */ jsx2(PaginationButton, { "aria-hidden": "true", disabled: true, tabIndex: -1, type: "button", children: "\u2026" }) : /* @__PURE__ */ jsx2(
|
|
229
239
|
PaginationButton,
|
|
230
240
|
{
|
|
241
|
+
as: getPageHref ? "a" : "button",
|
|
242
|
+
href: getPageHref?.(item),
|
|
231
243
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
232
244
|
"aria-label": item === currentPage ? labels?.current(item) ?? t("pagination.current", { page: item }) : labels?.page(item) ?? t("pagination.page", { page: item }),
|
|
233
245
|
"data-active": item === currentPage || void 0,
|
|
234
|
-
onClick: (
|
|
235
|
-
type: "button",
|
|
246
|
+
onClick: pageClick(item),
|
|
247
|
+
type: getPageHref ? void 0 : "button",
|
|
236
248
|
children: item
|
|
237
249
|
}
|
|
238
250
|
) }, `${item}-${index}`)),
|
|
239
251
|
/* @__PURE__ */ jsx2(PaginationItem, { children: /* @__PURE__ */ jsx2(
|
|
240
252
|
PaginationButton,
|
|
241
253
|
{
|
|
254
|
+
as: getPageHref && hasNextPage ? "a" : "button",
|
|
255
|
+
href: getPageHref && hasNextPage ? getPageHref(currentPage + 1) : void 0,
|
|
242
256
|
"aria-label": labels?.next ?? t("pagination.next"),
|
|
243
257
|
"data-control": "next",
|
|
244
258
|
disabled: !hasNextPage,
|
|
245
|
-
onClick: (
|
|
246
|
-
type: "button",
|
|
259
|
+
onClick: pageClick(currentPage + 1),
|
|
260
|
+
type: getPageHref && hasNextPage ? void 0 : "button",
|
|
247
261
|
children: /* @__PURE__ */ jsx2(PaginationArrow, { "data-direction": "next" })
|
|
248
262
|
}
|
|
249
263
|
) })
|