@mediaradar/design-components 0.24.0 → 0.26.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/index.d.cts CHANGED
@@ -1884,6 +1884,12 @@ interface PagerProps {
1884
1884
  onPage: (p: number) => void;
1885
1885
  /** Disables every control, e.g. while the list loads the next page. */
1886
1886
  disabled?: boolean;
1887
+ /**
1888
+ * The navigation landmark's name. Give each pager its own when a page has
1889
+ * more than one ("Exports pages", "Accounts pages"), so a screen reader's
1890
+ * landmark list can tell them apart.
1891
+ */
1892
+ label?: string;
1887
1893
  }
1888
1894
  /**
1889
1895
  * @pattern Pager
@@ -1897,15 +1903,18 @@ interface PagerProps {
1897
1903
  * first/last steps, the range readout and the rows-per-page select.
1898
1904
  * @tokens rounded-control, text-text-secondary, bg-brand-primaryAction, text-brand-onprimary, hover:bg-subtle, hover:text-text-primary, text-text-tertiary
1899
1905
  * @dependencies lucide-react
1900
- * @a11y Page controls are buttons with their own aria-labels, and the current
1901
- * page is marked with aria-current. Don't relabel them with visible text
1902
- * alone -- the labels are what a screen reader announces.
1906
+ * @a11y Renders its own <nav aria-label="Pagination"> landmark, like
1907
+ * TablePagination, so don't wrap it in another <nav>. Pass `label` to name it
1908
+ * when a page has more than one pager. Page controls are buttons with their
1909
+ * own aria-labels, and the current page is marked with aria-current. Don't
1910
+ * relabel them with visible text alone -- the labels are what a screen reader
1911
+ * announces.
1903
1912
  * @usage
1904
1913
  * ```tsx
1905
1914
  * <Pager page={page} totalPages={totalPages} onPage={setPage} />
1906
1915
  * ```
1907
1916
  */
1908
- declare function Pager({ page, totalPages, onPage, disabled }: PagerProps): react.JSX.Element;
1917
+ declare function Pager({ page, totalPages, onPage, disabled, label }: PagerProps): react.JSX.Element;
1909
1918
 
1910
1919
  declare const SIZES$1: {
1911
1920
  /** Matches a 15px lucide icon exactly, so a workspace name in a menu row
@@ -2444,7 +2453,7 @@ interface PageHeaderProps {
2444
2453
  */
2445
2454
  declare function PageHeader({ title, description, actions, back, className }: PageHeaderProps): react.JSX.Element;
2446
2455
 
2447
- type ModalSize = "sm" | "md" | "lg";
2456
+ type ModalSize = "sm" | "md" | "lg" | "xl";
2448
2457
  interface ModalProps {
2449
2458
  /** Whether the dialog is showing. */
2450
2459
  open: boolean;
@@ -2454,7 +2463,7 @@ interface ModalProps {
2454
2463
  title: ReactNode;
2455
2464
  /** One line under the title, when the title alone doesn't say enough. */
2456
2465
  description?: ReactNode;
2457
- /** sm 440 for a confirm, md 640 for a form, lg 880 for a table or a list. */
2466
+ /** sm 440 for a confirm, md 640 for a form, lg 880 for a table or a list, xl 1200 for a full workspace. */
2458
2467
  size?: ModalSize;
2459
2468
  /** The buttons along the bottom, right-aligned -- primary last. */
2460
2469
  footer?: ReactNode;
@@ -2464,12 +2473,14 @@ interface ModalProps {
2464
2473
  /**
2465
2474
  * @pattern Modal
2466
2475
  * @description A dialog over a dimmed page: title, optional one-line
2467
- * description, content, and a footer of buttons. Three widths -- sm 440 for a
2468
- * confirm, md 640 for a form, lg 880 for a table or a list -- over the warm
2469
- * scrim, which flips with dark mode.
2476
+ * description, content, and a footer of buttons. Four widths -- sm 440 for a
2477
+ * confirm, md 640 for a form, lg 880 for a table or a list, xl 1200 for a
2478
+ * full workspace -- over the warm scrim, which flips with dark mode.
2470
2479
  * @variant sm - 440px. A confirm: one question, two buttons.
2471
2480
  * @variant md - 640px. Default. A form.
2472
2481
  * @variant lg - 880px. A table, a long list, a preview.
2482
+ * @variant xl - 1200px. A full workspace: a column picker, a detail view with
2483
+ * its own tabs or panes, a grid.
2473
2484
  * @tokens bg-scrim, z-modal, rounded-card, border-border-default, bg-surface,
2474
2485
  * shadow-overlay, text-base, font-semibold, text-text-primary, text-sm,
2475
2486
  * text-text-secondary, text-text-tertiary, hover:bg-subtle,
@@ -2485,12 +2496,12 @@ interface ModalProps {
2485
2496
  * `description`. The close button is labelled "Close".
2486
2497
  * @use for a task the user has to finish or cancel before going back to the
2487
2498
  * page: confirm a delete, name a list, pick export options.
2488
- * @use `sm` for confirms, `md` for forms, `lg` for tables -- pick by content,
2489
- * never a custom width.
2499
+ * @use `sm` for confirms, `md` for forms, `lg` for tables, `xl` only for a
2500
+ * full workspace -- pick by content, never a custom width.
2490
2501
  * @use one primary Button, last in `footer`, with a secondary "Cancel" before it.
2491
2502
  * @avoid a modal for a message that needs no answer -- use Toast.
2492
2503
  * @avoid a modal opened from another modal.
2493
- * @avoid a `className` width override; if none of the three fit, raise it as
2504
+ * @avoid a `className` width override; if none of the four fit, raise it as
2494
2505
  * a design question.
2495
2506
  * @usage
2496
2507
  * ```tsx
package/dist/index.d.ts CHANGED
@@ -1884,6 +1884,12 @@ interface PagerProps {
1884
1884
  onPage: (p: number) => void;
1885
1885
  /** Disables every control, e.g. while the list loads the next page. */
1886
1886
  disabled?: boolean;
1887
+ /**
1888
+ * The navigation landmark's name. Give each pager its own when a page has
1889
+ * more than one ("Exports pages", "Accounts pages"), so a screen reader's
1890
+ * landmark list can tell them apart.
1891
+ */
1892
+ label?: string;
1887
1893
  }
1888
1894
  /**
1889
1895
  * @pattern Pager
@@ -1897,15 +1903,18 @@ interface PagerProps {
1897
1903
  * first/last steps, the range readout and the rows-per-page select.
1898
1904
  * @tokens rounded-control, text-text-secondary, bg-brand-primaryAction, text-brand-onprimary, hover:bg-subtle, hover:text-text-primary, text-text-tertiary
1899
1905
  * @dependencies lucide-react
1900
- * @a11y Page controls are buttons with their own aria-labels, and the current
1901
- * page is marked with aria-current. Don't relabel them with visible text
1902
- * alone -- the labels are what a screen reader announces.
1906
+ * @a11y Renders its own <nav aria-label="Pagination"> landmark, like
1907
+ * TablePagination, so don't wrap it in another <nav>. Pass `label` to name it
1908
+ * when a page has more than one pager. Page controls are buttons with their
1909
+ * own aria-labels, and the current page is marked with aria-current. Don't
1910
+ * relabel them with visible text alone -- the labels are what a screen reader
1911
+ * announces.
1903
1912
  * @usage
1904
1913
  * ```tsx
1905
1914
  * <Pager page={page} totalPages={totalPages} onPage={setPage} />
1906
1915
  * ```
1907
1916
  */
1908
- declare function Pager({ page, totalPages, onPage, disabled }: PagerProps): react.JSX.Element;
1917
+ declare function Pager({ page, totalPages, onPage, disabled, label }: PagerProps): react.JSX.Element;
1909
1918
 
1910
1919
  declare const SIZES$1: {
1911
1920
  /** Matches a 15px lucide icon exactly, so a workspace name in a menu row
@@ -2444,7 +2453,7 @@ interface PageHeaderProps {
2444
2453
  */
2445
2454
  declare function PageHeader({ title, description, actions, back, className }: PageHeaderProps): react.JSX.Element;
2446
2455
 
2447
- type ModalSize = "sm" | "md" | "lg";
2456
+ type ModalSize = "sm" | "md" | "lg" | "xl";
2448
2457
  interface ModalProps {
2449
2458
  /** Whether the dialog is showing. */
2450
2459
  open: boolean;
@@ -2454,7 +2463,7 @@ interface ModalProps {
2454
2463
  title: ReactNode;
2455
2464
  /** One line under the title, when the title alone doesn't say enough. */
2456
2465
  description?: ReactNode;
2457
- /** sm 440 for a confirm, md 640 for a form, lg 880 for a table or a list. */
2466
+ /** sm 440 for a confirm, md 640 for a form, lg 880 for a table or a list, xl 1200 for a full workspace. */
2458
2467
  size?: ModalSize;
2459
2468
  /** The buttons along the bottom, right-aligned -- primary last. */
2460
2469
  footer?: ReactNode;
@@ -2464,12 +2473,14 @@ interface ModalProps {
2464
2473
  /**
2465
2474
  * @pattern Modal
2466
2475
  * @description A dialog over a dimmed page: title, optional one-line
2467
- * description, content, and a footer of buttons. Three widths -- sm 440 for a
2468
- * confirm, md 640 for a form, lg 880 for a table or a list -- over the warm
2469
- * scrim, which flips with dark mode.
2476
+ * description, content, and a footer of buttons. Four widths -- sm 440 for a
2477
+ * confirm, md 640 for a form, lg 880 for a table or a list, xl 1200 for a
2478
+ * full workspace -- over the warm scrim, which flips with dark mode.
2470
2479
  * @variant sm - 440px. A confirm: one question, two buttons.
2471
2480
  * @variant md - 640px. Default. A form.
2472
2481
  * @variant lg - 880px. A table, a long list, a preview.
2482
+ * @variant xl - 1200px. A full workspace: a column picker, a detail view with
2483
+ * its own tabs or panes, a grid.
2473
2484
  * @tokens bg-scrim, z-modal, rounded-card, border-border-default, bg-surface,
2474
2485
  * shadow-overlay, text-base, font-semibold, text-text-primary, text-sm,
2475
2486
  * text-text-secondary, text-text-tertiary, hover:bg-subtle,
@@ -2485,12 +2496,12 @@ interface ModalProps {
2485
2496
  * `description`. The close button is labelled "Close".
2486
2497
  * @use for a task the user has to finish or cancel before going back to the
2487
2498
  * page: confirm a delete, name a list, pick export options.
2488
- * @use `sm` for confirms, `md` for forms, `lg` for tables -- pick by content,
2489
- * never a custom width.
2499
+ * @use `sm` for confirms, `md` for forms, `lg` for tables, `xl` only for a
2500
+ * full workspace -- pick by content, never a custom width.
2490
2501
  * @use one primary Button, last in `footer`, with a secondary "Cancel" before it.
2491
2502
  * @avoid a modal for a message that needs no answer -- use Toast.
2492
2503
  * @avoid a modal opened from another modal.
2493
- * @avoid a `className` width override; if none of the three fit, raise it as
2504
+ * @avoid a `className` width override; if none of the four fit, raise it as
2494
2505
  * a design question.
2495
2506
  * @usage
2496
2507
  * ```tsx
package/dist/index.js CHANGED
@@ -3217,9 +3217,9 @@ function pageWindow(current, total) {
3217
3217
  }
3218
3218
  return out;
3219
3219
  }
3220
- function Pager({ page, totalPages, onPage, disabled = false }) {
3220
+ function Pager({ page, totalPages, onPage, disabled = false, label = "Pagination" }) {
3221
3221
  const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-[13px] transition-colors disabled:pointer-events-none disabled:opacity-30";
3222
- return /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-1", children: [
3222
+ return /* @__PURE__ */ jsxs30("nav", { "aria-label": label, className: "flex items-center gap-1", children: [
3223
3223
  /* @__PURE__ */ jsx32(
3224
3224
  "button",
3225
3225
  {
@@ -4063,7 +4063,10 @@ import { jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
4063
4063
  var WIDTH = {
4064
4064
  sm: "max-w-110",
4065
4065
  md: "max-w-160",
4066
- lg: "max-w-220"
4066
+ lg: "max-w-220",
4067
+ // A whole workspace in a dialog: a column picker, a detail view with its
4068
+ // own tabs, a grid of events. 880 squeezed their tables into scrolling.
4069
+ xl: "max-w-300"
4067
4070
  };
4068
4071
  var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
4069
4072
  function Modal({ open, onClose, title, description, size = "md", footer, children, className }) {