@aurora-ds/components 0.18.0 → 0.18.2

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.
@@ -19,4 +19,6 @@ export type PaginationProps = {
19
19
  };
20
20
  export type PaginationStyleParams = {
21
21
  disabled?: boolean;
22
+ /** If true, apply the active (current page) styles */
23
+ active?: boolean;
22
24
  };
package/dist/esm/index.js CHANGED
@@ -2186,7 +2186,7 @@ const Modal = ({ isOpen, onClose, label, children, isForm, action }) => {
2186
2186
  }
2187
2187
  };
2188
2188
  // body of the modal
2189
- const body = (jsxs(Fragment$1, { children: [jsxs(Stack, { justify: 'space-between', height: BUTTON_SIZE, width: '100%', children: [jsx(Text, { variant: 'h3', children: label }), !action && (jsx(IconButton, { icon: jsx(CloseIcon, {}), onClick: onClose, size: 'small', variant: 'text', textColor: 'text' }))] }), children, action && (jsxs(Stack, { justify: 'flex-end', width: '100%', children: [jsx(Button, { label: 'Cancel', onClick: onClose, variant: 'outlined' }), jsx(Button, { label: action.label, onClick: !isForm ? action.onClick : undefined, type: isForm ? 'submit' : 'button', disabled: action.disabled })] }))] }));
2189
+ const body = (jsxs(Fragment$1, { children: [jsxs(Stack, { justify: 'space-between', height: BUTTON_SIZE, width: '100%', children: [jsx(Text, { variant: 'h3', children: label }), !action && (jsx(IconButton, { icon: jsx(CloseIcon, {}), onClick: onClose, size: 'small', variant: 'text', textColor: 'text' }))] }), children, action && (jsxs(Stack, { justify: 'flex-end', width: '100%', children: [jsx(Button, { label: 'Cancel', onClick: onClose, variant: 'outlined' }), jsx(Button, { ...action, type: isForm ? 'submit' : 'button' })] }))] }));
2190
2190
  return createPortal(jsx(Fragment, { children: isVisible ? (jsx("div", { className: MODAL_STYLES.background(isFadingIn), ref: modalRef, children: jsx("div", { className: MODAL_STYLES.content(isFadingIn), children: isForm ? (jsx(Form, { onSubmit: (e) => { e.preventDefault(); safeInvokeAction(); }, children: body })) : (jsx(Fragment, { children: body })) }) })) : null }), document.body);
2191
2191
  };
2192
2192
  Modal.displayName = 'Modal';
@@ -2509,7 +2509,7 @@ const PAGINATION_STYLES = createStyles((theme) => ({
2509
2509
  alignItems: 'center',
2510
2510
  gap: theme.spacing.xs,
2511
2511
  },
2512
- pageButton: ({ disabled = false }) => ({
2512
+ pageButton: ({ disabled = false, active = false }) => ({
2513
2513
  display: 'inline-flex',
2514
2514
  alignItems: 'center',
2515
2515
  justifyContent: 'center',
@@ -2525,17 +2525,24 @@ const PAGINATION_STYLES = createStyles((theme) => ({
2525
2525
  fontFamily: 'inherit',
2526
2526
  fontSize: theme.fontSize.md,
2527
2527
  fontWeight: theme.fontWeight.medium,
2528
- backgroundColor: 'transparent',
2529
- color: theme.colors.text,
2528
+ backgroundColor: active ? theme.colors.primary : 'transparent',
2529
+ color: active ? theme.colors.onPrimary : theme.colors.text,
2530
2530
  border: 'none',
2531
2531
  opacity: disabled ? 0.4 : 1,
2532
- ':hover': disabled ? {} : {
2532
+ ':hover': disabled ? {} : (active ? {
2533
+ backgroundColor: theme.colors.primary,
2534
+ color: theme.colors.onPrimary,
2535
+ } : {
2533
2536
  backgroundColor: theme.colors.surfaceHover,
2534
- },
2535
- ':active': disabled ? {} : {
2537
+ }),
2538
+ ':active': disabled ? {} : (active ? {
2539
+ backgroundColor: theme.colors.primary,
2540
+ color: theme.colors.onPrimary,
2541
+ } : {
2536
2542
  backgroundColor: theme.colors.surfaceActive,
2537
- },
2543
+ }),
2538
2544
  }),
2545
+ // kept for backward compatibility in case some usages relied on it directly
2539
2546
  activePageButton: {
2540
2547
  backgroundColor: theme.colors.primary,
2541
2548
  color: theme.colors.onPrimary,
@@ -2627,7 +2634,7 @@ const Pagination = ({ currentPage, totalPages, onPageChange, onPrevious, onNext,
2627
2634
  const isNextDisabled = currentPage === totalPages;
2628
2635
  return (jsxs("nav", { "aria-label": ariaLabel, className: styles.root, children: [jsx("button", { type: 'button', onClick: handlePrevious, disabled: isPreviousDisabled, "aria-label": 'Page précédente', className: styles.navigationButton({ disabled: isPreviousDisabled }), children: jsx(ChevronLeftIcon, {}) }), visiblePages.map((page) => {
2629
2636
  const isActive = page === currentPage;
2630
- return (jsx("button", { type: 'button', onClick: () => handlePageClick(page), "aria-label": `Page ${page}`, "aria-current": isActive ? 'page' : undefined, className: `${styles.pageButton({ disabled: false })} ${isActive ? styles.activePageButton : ''}`, children: page }, page));
2637
+ return (jsx("button", { type: 'button', onClick: () => handlePageClick(page), "aria-label": `Page ${page}`, "aria-current": isActive ? 'page' : undefined, className: styles.pageButton({ disabled: false, active: isActive }), children: page }, page));
2631
2638
  }), jsx("button", { type: 'button', onClick: handleNext, disabled: isNextDisabled, "aria-label": 'Page suivante', className: styles.navigationButton({ disabled: isNextDisabled }), children: jsx(ChevronRightIcon, {}) })] }));
2632
2639
  };
2633
2640
  Pagination.displayName = 'Pagination';