@sarunyu/system-one 4.9.34 → 4.9.36

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.js CHANGED
@@ -3049,7 +3049,7 @@ function RemovableTag({
3049
3049
  X,
3050
3050
  {
3051
3051
  size: 12,
3052
- weight: "bold",
3052
+ weight: "regular",
3053
3053
  color: iconColor,
3054
3054
  className: "shrink-0"
3055
3055
  }
@@ -3588,7 +3588,7 @@ const DropdownMultiple = forwardRef(
3588
3588
  Check,
3589
3589
  {
3590
3590
  size: 12,
3591
- weight: "bold",
3591
+ weight: "regular",
3592
3592
  className: "text-primary-action"
3593
3593
  }
3594
3594
  )
@@ -4231,7 +4231,7 @@ function ToastCloseButton({
4231
4231
  colorClass
4232
4232
  ),
4233
4233
  onClick: onClose,
4234
- children: /* @__PURE__ */ jsx(X, { size: 12, weight: "bold" })
4234
+ children: /* @__PURE__ */ jsx(X, { size: 12, weight: "regular" })
4235
4235
  }
4236
4236
  );
4237
4237
  }
@@ -4422,7 +4422,7 @@ const OptionList = forwardRef(
4422
4422
  Check,
4423
4423
  {
4424
4424
  size: 16,
4425
- weight: "bold",
4425
+ weight: "regular",
4426
4426
  className: "text-primary-action"
4427
4427
  }
4428
4428
  ) })
@@ -4792,7 +4792,7 @@ const Tag = forwardRef(function Tag2({
4792
4792
  className: cn(
4793
4793
  "inline-flex items-center justify-center rounded-[2px] transition-colors",
4794
4794
  s.closeButton,
4795
- !isDisabled && "cursor-pointer hover:bg-black/10"
4795
+ !isDisabled && "cursor-pointer hover:bg-black/10 dark:hover:bg-white/10"
4796
4796
  ),
4797
4797
  children: /* @__PURE__ */ jsx(CloseIcon, { disabled: isDisabled, className: s.closeIcon })
4798
4798
  }
@@ -4870,7 +4870,7 @@ function StickyShadowEdge({ direction }) {
4870
4870
  "aria-hidden": "true",
4871
4871
  className: "pointer-events-none absolute inset-y-0 left-[-10px] w-2.5",
4872
4872
  style: {
4873
- background: "linear-gradient(90deg, rgba(16,24,40,0.00) 0%, rgba(16,24,40,0.03) 55%, rgba(16,24,40,0.08) 100%)"
4873
+ background: "linear-gradient(90deg, rgba(var(--scroll-shadow-rgb),0.00) 0%, rgba(var(--scroll-shadow-rgb),0.03) 55%, rgba(var(--scroll-shadow-rgb),0.08) 100%)"
4874
4874
  }
4875
4875
  }
4876
4876
  );
@@ -4881,7 +4881,7 @@ function StickyShadowEdge({ direction }) {
4881
4881
  "aria-hidden": "true",
4882
4882
  className: "pointer-events-none absolute inset-y-0 right-[-10px] w-2.5",
4883
4883
  style: {
4884
- background: "linear-gradient(90deg, rgba(16,24,40,0.08) 0%, rgba(16,24,40,0.03) 45%, rgba(16,24,40,0.00) 100%)"
4884
+ background: "linear-gradient(90deg, rgba(var(--scroll-shadow-rgb),0.08) 0%, rgba(var(--scroll-shadow-rgb),0.03) 45%, rgba(var(--scroll-shadow-rgb),0.00) 100%)"
4885
4885
  }
4886
4886
  }
4887
4887
  );
@@ -6139,6 +6139,207 @@ function Breadcrumb({ items, className }) {
6139
6139
  ] }, index2);
6140
6140
  }) });
6141
6141
  }
6142
+ function PaginationBanner({
6143
+ count: count2,
6144
+ activeIndex,
6145
+ onIndexChange,
6146
+ className
6147
+ }) {
6148
+ return /* @__PURE__ */ jsx(
6149
+ "div",
6150
+ {
6151
+ className: cn("flex items-center gap-1", className),
6152
+ role: "tablist",
6153
+ "aria-label": "Slide indicators",
6154
+ children: Array.from({ length: count2 }, (_, i) => /* @__PURE__ */ jsx(
6155
+ "button",
6156
+ {
6157
+ type: "button",
6158
+ role: "tab",
6159
+ "aria-selected": i === activeIndex,
6160
+ "aria-label": `Slide ${i + 1}`,
6161
+ onClick: () => onIndexChange == null ? void 0 : onIndexChange(i),
6162
+ className: cn(
6163
+ "h-1.5 rounded-[12px] transition-all duration-200",
6164
+ i === activeIndex ? "w-8 bg-bg-brand" : "w-1.5 bg-black/10 dark:bg-white/10 hover:bg-black/20 dark:hover:bg-white/20"
6165
+ )
6166
+ },
6167
+ i
6168
+ ))
6169
+ }
6170
+ );
6171
+ }
6172
+ function PaginationCarousel({
6173
+ progress,
6174
+ trackWidth = 40,
6175
+ className
6176
+ }) {
6177
+ const clamped = Math.min(1, Math.max(0, progress));
6178
+ return /* @__PURE__ */ jsx(
6179
+ "div",
6180
+ {
6181
+ className: cn("flex items-center", className),
6182
+ role: "progressbar",
6183
+ "aria-valuenow": Math.round(clamped * 100),
6184
+ "aria-valuemin": 0,
6185
+ "aria-valuemax": 100,
6186
+ children: /* @__PURE__ */ jsx(
6187
+ "div",
6188
+ {
6189
+ className: "relative h-1.5 overflow-hidden rounded-[48px] bg-black/10 dark:bg-white/10",
6190
+ style: { width: trackWidth },
6191
+ children: /* @__PURE__ */ jsx(
6192
+ "div",
6193
+ {
6194
+ className: "absolute left-0 top-0 h-full rounded-[12px] bg-bg-brand transition-all duration-200",
6195
+ style: { width: Math.round(clamped * trackWidth) }
6196
+ }
6197
+ )
6198
+ }
6199
+ )
6200
+ }
6201
+ );
6202
+ }
6203
+ function buildPageItems(total) {
6204
+ if (total <= 5) return Array.from({ length: total }, (_, i) => i + 1);
6205
+ return [1, 2, 3, "...", total];
6206
+ }
6207
+ function buildHiddenPages(total) {
6208
+ if (total <= 5) return [];
6209
+ return Array.from({ length: total - 4 }, (_, i) => i + 4);
6210
+ }
6211
+ function Pagination({
6212
+ totalPages,
6213
+ currentPage,
6214
+ onPageChange,
6215
+ className
6216
+ }) {
6217
+ const [dropdownOpen, setDropdownOpen] = useState(false);
6218
+ const containerRef = useRef(null);
6219
+ const ellipsisRef = useRef(null);
6220
+ useEffect(() => {
6221
+ if (!dropdownOpen) return;
6222
+ function handleOutside(e) {
6223
+ var _a;
6224
+ if (!((_a = containerRef.current) == null ? void 0 : _a.contains(e.target))) {
6225
+ setDropdownOpen(false);
6226
+ }
6227
+ }
6228
+ document.addEventListener("mousedown", handleOutside);
6229
+ return () => document.removeEventListener("mousedown", handleOutside);
6230
+ }, [dropdownOpen]);
6231
+ const pageItems = buildPageItems(totalPages);
6232
+ const hiddenPages = buildHiddenPages(totalPages);
6233
+ const goTo = (page) => {
6234
+ if (page >= 1 && page <= totalPages && page !== currentPage) {
6235
+ onPageChange == null ? void 0 : onPageChange(page);
6236
+ setDropdownOpen(false);
6237
+ }
6238
+ };
6239
+ const cell = "flex h-8 w-[39px] shrink-0 items-center justify-center text-sm leading-5 transition-colors select-none";
6240
+ const divider = "border-l border-border";
6241
+ const ellipsisLeft = ellipsisRef.current ? ellipsisRef.current.offsetLeft + ellipsisRef.current.offsetWidth / 2 : void 0;
6242
+ return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: cn("relative inline-flex w-fit", className), children: [
6243
+ /* @__PURE__ */ jsxs(
6244
+ "nav",
6245
+ {
6246
+ "aria-label": "Pagination",
6247
+ className: "inline-flex w-fit overflow-hidden rounded-lg border border-border",
6248
+ children: [
6249
+ /* @__PURE__ */ jsx(
6250
+ "button",
6251
+ {
6252
+ type: "button",
6253
+ "aria-label": "Previous page",
6254
+ disabled: currentPage <= 1,
6255
+ onClick: () => goTo(currentPage - 1),
6256
+ className: cn(
6257
+ cell,
6258
+ "bg-bg-default text-icon-default hover:bg-bg-default-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer"
6259
+ ),
6260
+ children: /* @__PURE__ */ jsx(CaretLeft, { size: 16, weight: "regular" })
6261
+ }
6262
+ ),
6263
+ pageItems.map(
6264
+ (item, idx) => item === "..." ? /* @__PURE__ */ jsx(
6265
+ "button",
6266
+ {
6267
+ ref: ellipsisRef,
6268
+ type: "button",
6269
+ "aria-label": "More pages",
6270
+ "aria-expanded": dropdownOpen,
6271
+ "aria-haspopup": "listbox",
6272
+ onClick: () => setDropdownOpen((v) => !v),
6273
+ className: cn(
6274
+ cell,
6275
+ divider,
6276
+ "bg-bg-default text-text-default cursor-pointer hover:bg-bg-default-hover"
6277
+ ),
6278
+ children: "..."
6279
+ },
6280
+ `ellipsis-${idx}`
6281
+ ) : /* @__PURE__ */ jsx(
6282
+ "button",
6283
+ {
6284
+ type: "button",
6285
+ "aria-label": `Page ${item}`,
6286
+ "aria-current": item === currentPage ? "page" : void 0,
6287
+ onClick: () => goTo(item),
6288
+ className: cn(
6289
+ cell,
6290
+ divider,
6291
+ "cursor-pointer",
6292
+ item === currentPage ? "bg-bg-brand font-bold text-text-default-white" : "bg-bg-default font-normal text-text-default hover:bg-bg-default-hover"
6293
+ ),
6294
+ children: item
6295
+ },
6296
+ item
6297
+ )
6298
+ ),
6299
+ /* @__PURE__ */ jsx(
6300
+ "button",
6301
+ {
6302
+ type: "button",
6303
+ "aria-label": "Next page",
6304
+ disabled: currentPage >= totalPages,
6305
+ onClick: () => goTo(currentPage + 1),
6306
+ className: cn(
6307
+ cell,
6308
+ divider,
6309
+ "bg-bg-default text-icon-default hover:bg-bg-default-hover disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer"
6310
+ ),
6311
+ children: /* @__PURE__ */ jsx(CaretRight, { size: 16, weight: "regular" })
6312
+ }
6313
+ )
6314
+ ]
6315
+ }
6316
+ ),
6317
+ dropdownOpen && hiddenPages.length > 0 && /* @__PURE__ */ jsx(
6318
+ "div",
6319
+ {
6320
+ role: "listbox",
6321
+ "aria-label": "Select page",
6322
+ 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",
6323
+ style: { left: ellipsisLeft, transform: "translateX(-50%)", maxHeight: 160 },
6324
+ children: hiddenPages.map((page) => /* @__PURE__ */ jsx(
6325
+ "button",
6326
+ {
6327
+ type: "button",
6328
+ role: "option",
6329
+ "aria-selected": page === currentPage,
6330
+ onClick: () => goTo(page),
6331
+ className: cn(
6332
+ "flex h-8 w-full shrink-0 cursor-pointer items-center justify-center text-sm leading-5 transition-colors select-none",
6333
+ page === currentPage ? "bg-bg-brand font-bold text-text-default-white" : "bg-bg-default font-normal text-text-default hover:bg-bg-default-hover"
6334
+ ),
6335
+ children: page
6336
+ },
6337
+ page
6338
+ ))
6339
+ }
6340
+ )
6341
+ ] });
6342
+ }
6142
6343
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
6143
6344
  return function handleEvent(event) {
6144
6345
  originalEventHandler == null ? void 0 : originalEventHandler(event);
@@ -9566,6 +9767,9 @@ const index = {
9566
9767
  Avatar,
9567
9768
  AvatarStack,
9568
9769
  Breadcrumb,
9770
+ Pagination,
9771
+ PaginationBanner,
9772
+ PaginationCarousel,
9569
9773
  Tooltip,
9570
9774
  Popover,
9571
9775
  cn,
@@ -9589,6 +9793,9 @@ export {
9589
9793
  Modal,
9590
9794
  Notification,
9591
9795
  OptionList,
9796
+ Pagination,
9797
+ PaginationBanner,
9798
+ PaginationCarousel,
9592
9799
  Popover,
9593
9800
  Radio,
9594
9801
  SearchInput,