@sarunyu/system-one 4.9.34 → 4.9.35
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.cjs +207 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +207 -0
- package/dist/index.js.map +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6158,6 +6158,207 @@ function Breadcrumb({ items, className }) {
|
|
|
6158
6158
|
] }, index2);
|
|
6159
6159
|
}) });
|
|
6160
6160
|
}
|
|
6161
|
+
function PaginationBanner({
|
|
6162
|
+
count: count2,
|
|
6163
|
+
activeIndex,
|
|
6164
|
+
onIndexChange,
|
|
6165
|
+
className
|
|
6166
|
+
}) {
|
|
6167
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6168
|
+
"div",
|
|
6169
|
+
{
|
|
6170
|
+
className: cn("flex items-center gap-1", className),
|
|
6171
|
+
role: "tablist",
|
|
6172
|
+
"aria-label": "Slide indicators",
|
|
6173
|
+
children: Array.from({ length: count2 }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6174
|
+
"button",
|
|
6175
|
+
{
|
|
6176
|
+
type: "button",
|
|
6177
|
+
role: "tab",
|
|
6178
|
+
"aria-selected": i === activeIndex,
|
|
6179
|
+
"aria-label": `Slide ${i + 1}`,
|
|
6180
|
+
onClick: () => onIndexChange == null ? void 0 : onIndexChange(i),
|
|
6181
|
+
className: cn(
|
|
6182
|
+
"h-1.5 rounded-[12px] transition-all duration-200",
|
|
6183
|
+
i === activeIndex ? "w-8 bg-bg-brand" : "w-1.5 bg-black/10 hover:bg-black/20"
|
|
6184
|
+
)
|
|
6185
|
+
},
|
|
6186
|
+
i
|
|
6187
|
+
))
|
|
6188
|
+
}
|
|
6189
|
+
);
|
|
6190
|
+
}
|
|
6191
|
+
function PaginationCarousel({
|
|
6192
|
+
progress,
|
|
6193
|
+
trackWidth = 40,
|
|
6194
|
+
className
|
|
6195
|
+
}) {
|
|
6196
|
+
const clamped = Math.min(1, Math.max(0, progress));
|
|
6197
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6198
|
+
"div",
|
|
6199
|
+
{
|
|
6200
|
+
className: cn("flex items-center", className),
|
|
6201
|
+
role: "progressbar",
|
|
6202
|
+
"aria-valuenow": Math.round(clamped * 100),
|
|
6203
|
+
"aria-valuemin": 0,
|
|
6204
|
+
"aria-valuemax": 100,
|
|
6205
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6206
|
+
"div",
|
|
6207
|
+
{
|
|
6208
|
+
className: "relative h-1.5 overflow-hidden rounded-[48px] bg-black/10",
|
|
6209
|
+
style: { width: trackWidth },
|
|
6210
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6211
|
+
"div",
|
|
6212
|
+
{
|
|
6213
|
+
className: "absolute left-0 top-0 h-full rounded-[12px] bg-bg-brand transition-all duration-200",
|
|
6214
|
+
style: { width: Math.round(clamped * trackWidth) }
|
|
6215
|
+
}
|
|
6216
|
+
)
|
|
6217
|
+
}
|
|
6218
|
+
)
|
|
6219
|
+
}
|
|
6220
|
+
);
|
|
6221
|
+
}
|
|
6222
|
+
function buildPageItems(total) {
|
|
6223
|
+
if (total <= 5) return Array.from({ length: total }, (_, i) => i + 1);
|
|
6224
|
+
return [1, 2, 3, "...", total];
|
|
6225
|
+
}
|
|
6226
|
+
function buildHiddenPages(total) {
|
|
6227
|
+
if (total <= 5) return [];
|
|
6228
|
+
return Array.from({ length: total - 4 }, (_, i) => i + 4);
|
|
6229
|
+
}
|
|
6230
|
+
function Pagination({
|
|
6231
|
+
totalPages,
|
|
6232
|
+
currentPage,
|
|
6233
|
+
onPageChange,
|
|
6234
|
+
className
|
|
6235
|
+
}) {
|
|
6236
|
+
const [dropdownOpen, setDropdownOpen] = React.useState(false);
|
|
6237
|
+
const containerRef = React.useRef(null);
|
|
6238
|
+
const ellipsisRef = React.useRef(null);
|
|
6239
|
+
React.useEffect(() => {
|
|
6240
|
+
if (!dropdownOpen) return;
|
|
6241
|
+
function handleOutside(e) {
|
|
6242
|
+
var _a;
|
|
6243
|
+
if (!((_a = containerRef.current) == null ? void 0 : _a.contains(e.target))) {
|
|
6244
|
+
setDropdownOpen(false);
|
|
6245
|
+
}
|
|
6246
|
+
}
|
|
6247
|
+
document.addEventListener("mousedown", handleOutside);
|
|
6248
|
+
return () => document.removeEventListener("mousedown", handleOutside);
|
|
6249
|
+
}, [dropdownOpen]);
|
|
6250
|
+
const pageItems = buildPageItems(totalPages);
|
|
6251
|
+
const hiddenPages = buildHiddenPages(totalPages);
|
|
6252
|
+
const goTo = (page) => {
|
|
6253
|
+
if (page >= 1 && page <= totalPages && page !== currentPage) {
|
|
6254
|
+
onPageChange == null ? void 0 : onPageChange(page);
|
|
6255
|
+
setDropdownOpen(false);
|
|
6256
|
+
}
|
|
6257
|
+
};
|
|
6258
|
+
const cell = "flex h-8 w-[39px] shrink-0 items-center justify-center text-sm leading-5 transition-colors select-none";
|
|
6259
|
+
const divider = "border-l border-border";
|
|
6260
|
+
const ellipsisLeft = ellipsisRef.current ? ellipsisRef.current.offsetLeft + ellipsisRef.current.offsetWidth / 2 : void 0;
|
|
6261
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: cn("relative inline-flex w-fit", className), children: [
|
|
6262
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6263
|
+
"nav",
|
|
6264
|
+
{
|
|
6265
|
+
"aria-label": "Pagination",
|
|
6266
|
+
className: "inline-flex w-fit overflow-hidden rounded-lg border border-border",
|
|
6267
|
+
children: [
|
|
6268
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6269
|
+
"button",
|
|
6270
|
+
{
|
|
6271
|
+
type: "button",
|
|
6272
|
+
"aria-label": "Previous page",
|
|
6273
|
+
disabled: currentPage <= 1,
|
|
6274
|
+
onClick: () => goTo(currentPage - 1),
|
|
6275
|
+
className: cn(
|
|
6276
|
+
cell,
|
|
6277
|
+
"bg-bg-default text-icon-default hover:bg-bg-default-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer"
|
|
6278
|
+
),
|
|
6279
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.CaretLeft, { size: 16, weight: "regular" })
|
|
6280
|
+
}
|
|
6281
|
+
),
|
|
6282
|
+
pageItems.map(
|
|
6283
|
+
(item, idx) => item === "..." ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6284
|
+
"button",
|
|
6285
|
+
{
|
|
6286
|
+
ref: ellipsisRef,
|
|
6287
|
+
type: "button",
|
|
6288
|
+
"aria-label": "More pages",
|
|
6289
|
+
"aria-expanded": dropdownOpen,
|
|
6290
|
+
"aria-haspopup": "listbox",
|
|
6291
|
+
onClick: () => setDropdownOpen((v) => !v),
|
|
6292
|
+
className: cn(
|
|
6293
|
+
cell,
|
|
6294
|
+
divider,
|
|
6295
|
+
"bg-bg-default text-text-default cursor-pointer hover:bg-bg-default-hover"
|
|
6296
|
+
),
|
|
6297
|
+
children: "..."
|
|
6298
|
+
},
|
|
6299
|
+
`ellipsis-${idx}`
|
|
6300
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
6301
|
+
"button",
|
|
6302
|
+
{
|
|
6303
|
+
type: "button",
|
|
6304
|
+
"aria-label": `Page ${item}`,
|
|
6305
|
+
"aria-current": item === currentPage ? "page" : void 0,
|
|
6306
|
+
onClick: () => goTo(item),
|
|
6307
|
+
className: cn(
|
|
6308
|
+
cell,
|
|
6309
|
+
divider,
|
|
6310
|
+
"cursor-pointer",
|
|
6311
|
+
item === currentPage ? "bg-bg-brand font-bold text-text-default-white" : "bg-bg-default font-normal text-text-default hover:bg-bg-default-hover"
|
|
6312
|
+
),
|
|
6313
|
+
children: item
|
|
6314
|
+
},
|
|
6315
|
+
item
|
|
6316
|
+
)
|
|
6317
|
+
),
|
|
6318
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6319
|
+
"button",
|
|
6320
|
+
{
|
|
6321
|
+
type: "button",
|
|
6322
|
+
"aria-label": "Next page",
|
|
6323
|
+
disabled: currentPage >= totalPages,
|
|
6324
|
+
onClick: () => goTo(currentPage + 1),
|
|
6325
|
+
className: cn(
|
|
6326
|
+
cell,
|
|
6327
|
+
divider,
|
|
6328
|
+
"bg-bg-default text-icon-default hover:bg-bg-default-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer"
|
|
6329
|
+
),
|
|
6330
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.CaretRight, { size: 16, weight: "regular" })
|
|
6331
|
+
}
|
|
6332
|
+
)
|
|
6333
|
+
]
|
|
6334
|
+
}
|
|
6335
|
+
),
|
|
6336
|
+
dropdownOpen && hiddenPages.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6337
|
+
"div",
|
|
6338
|
+
{
|
|
6339
|
+
role: "listbox",
|
|
6340
|
+
"aria-label": "Select page",
|
|
6341
|
+
className: "absolute bottom-full mb-1 z-50 flex w-[39px] flex-col overflow-y-auto rounded-lg border border-border bg-bg-default shadow-md [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
6342
|
+
style: { left: ellipsisLeft, transform: "translateX(-50%)", maxHeight: 160 },
|
|
6343
|
+
children: hiddenPages.map((page) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6344
|
+
"button",
|
|
6345
|
+
{
|
|
6346
|
+
type: "button",
|
|
6347
|
+
role: "option",
|
|
6348
|
+
"aria-selected": page === currentPage,
|
|
6349
|
+
onClick: () => goTo(page),
|
|
6350
|
+
className: cn(
|
|
6351
|
+
"flex h-8 w-full shrink-0 cursor-pointer items-center justify-center text-sm leading-5 transition-colors select-none",
|
|
6352
|
+
page === currentPage ? "bg-bg-brand font-bold text-text-default-white" : "bg-bg-default font-normal text-text-default hover:bg-bg-default-hover"
|
|
6353
|
+
),
|
|
6354
|
+
children: page
|
|
6355
|
+
},
|
|
6356
|
+
page
|
|
6357
|
+
))
|
|
6358
|
+
}
|
|
6359
|
+
)
|
|
6360
|
+
] });
|
|
6361
|
+
}
|
|
6161
6362
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
6162
6363
|
return function handleEvent(event) {
|
|
6163
6364
|
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
@@ -9585,6 +9786,9 @@ const index = {
|
|
|
9585
9786
|
Avatar,
|
|
9586
9787
|
AvatarStack,
|
|
9587
9788
|
Breadcrumb,
|
|
9789
|
+
Pagination,
|
|
9790
|
+
PaginationBanner,
|
|
9791
|
+
PaginationCarousel,
|
|
9588
9792
|
Tooltip,
|
|
9589
9793
|
Popover,
|
|
9590
9794
|
cn,
|
|
@@ -9607,6 +9811,9 @@ exports.Input = Input;
|
|
|
9607
9811
|
exports.Modal = Modal;
|
|
9608
9812
|
exports.Notification = Notification;
|
|
9609
9813
|
exports.OptionList = OptionList;
|
|
9814
|
+
exports.Pagination = Pagination;
|
|
9815
|
+
exports.PaginationBanner = PaginationBanner;
|
|
9816
|
+
exports.PaginationCarousel = PaginationCarousel;
|
|
9610
9817
|
exports.Popover = Popover;
|
|
9611
9818
|
exports.Radio = Radio;
|
|
9612
9819
|
exports.SearchInput = SearchInput;
|