@blakesteve/roster 4.1.0 → 4.2.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.
@@ -1,13 +1,29 @@
1
1
  import { default as React } from 'react';
2
2
  import { VariantProps } from 'class-variance-authority';
3
3
  import { eyebrowVariants } from './eyebrow-variants';
4
- export interface EyebrowProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof eyebrowVariants> {
4
+ type EyebrowOwnProps<E extends React.ElementType> = VariantProps<typeof eyebrowVariants> & {
5
5
  children: React.ReactNode;
6
6
  /**
7
7
  * Element to render. Defaults to `span` so it stays inline and carries no
8
8
  * heading semantics: an eyebrow labels a section, it is not the heading.
9
+ *
10
+ * Props follow the element. `as="a"` accepts `href`, `target`, and `rel`;
11
+ * `as="label"` accepts `htmlFor`. An eyebrow that renders a link should not
12
+ * have to be wrapped in one to get an href.
9
13
  */
10
- as?: React.ElementType;
14
+ as?: E;
15
+ };
16
+ export type EyebrowProps<E extends React.ElementType = "span"> = EyebrowOwnProps<E> & Omit<React.ComponentPropsWithRef<E>, keyof EyebrowOwnProps<E>>;
17
+ /**
18
+ * Written as a plain generic function rather than through `forwardRef`: that
19
+ * helper's return type is not generic, so the element type collapses the
20
+ * moment it passes through and `as="a"` stops admitting `href` — the exact bug
21
+ * this signature exists to fix. React 19 passes `ref` as an ordinary prop, so
22
+ * the wrapper buys nothing here anyway; `ref` rides along in `...props` and
23
+ * lands on whatever element `as` selected.
24
+ */
25
+ declare function Eyebrow<E extends React.ElementType = "span">({ as, className, size, tone, weight, children, ...props }: EyebrowProps<E>): import("react/jsx-runtime").JSX.Element;
26
+ declare namespace Eyebrow {
27
+ var displayName: string;
11
28
  }
12
- declare const Eyebrow: React.ForwardRefExoticComponent<EyebrowProps & React.RefAttributes<HTMLElement>>;
13
29
  export { Eyebrow };
@@ -7,6 +7,21 @@ export interface ThemeToggleProps extends Omit<ButtonProps, "onClick" | "childre
7
7
  onThemeChange?: (mode: "light" | "dark") => void;
8
8
  /** Renders the current mode beside the icon. */
9
9
  showLabel?: boolean;
10
+ /**
11
+ * Visible text when the page is light, if `showLabel` is set. Names the
12
+ * CURRENT state, not the destination — the accessible label does the
13
+ * opposite, because a button's name should say what pressing it does.
14
+ *
15
+ * Both take nodes, so a product with its own vocabulary for the two states
16
+ * ("Press sheet" / "Blueline", "Day" / "Night") can say so.
17
+ */
18
+ lightLabel?: React.ReactNode;
19
+ /** Visible text when the page is dark, if `showLabel` is set. */
20
+ darkLabel?: React.ReactNode;
21
+ /** Icon shown when the page is light. Defaults to a moon. */
22
+ lightIcon?: React.ReactNode;
23
+ /** Icon shown when the page is dark. Defaults to a sun. */
24
+ darkIcon?: React.ReactNode;
10
25
  /** Accessible label offering to switch to dark. */
11
26
  toDarkLabel?: string;
12
27
  /** Accessible label offering to switch back to light. */
@@ -1,14 +1,53 @@
1
1
  import { default as React } from 'react';
2
2
  import { VariantProps } from 'class-variance-authority';
3
3
  import { breadcrumbVariants } from './breadcrumb-variants';
4
- export type BreadcrumbItem = {
5
- label: string;
4
+ /**
5
+ * The shape a crumb's link component is called with. `next/link`, React
6
+ * Router's `Link`, and a plain `<a>` all satisfy it as-is.
7
+ */
8
+ export type BreadcrumbLinkProps = {
6
9
  href: string;
10
+ className?: string;
11
+ children: React.ReactNode;
12
+ "aria-label"?: string;
13
+ };
14
+ export type BreadcrumbItem = {
15
+ /** Takes a node, so a crumb can carry an icon or its own styling. */
16
+ label: React.ReactNode;
17
+ /**
18
+ * Omit to render the crumb as plain text. The last crumb is treated as the
19
+ * current page regardless, since that is what a breadcrumb trail means.
20
+ */
21
+ href?: string;
22
+ /** Applied to this crumb only. */
23
+ className?: string;
7
24
  };
8
25
  export interface BreadcrumbsProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof breadcrumbVariants> {
9
26
  items: BreadcrumbItem[];
10
27
  separator?: React.ReactNode;
11
28
  showHomeIcon?: boolean;
29
+ /** Where the home icon points. */
30
+ homeHref?: string;
31
+ /**
32
+ * Renders every crumb that has an `href`. Defaults to Roster's `Link`, which
33
+ * is a plain `<a>` — fine for a static site, wrong inside a router, where an
34
+ * `<a>` turns each hop into a full page load. Pass `next/link` or your
35
+ * router's equivalent and navigation stays client-side.
36
+ *
37
+ * ```tsx
38
+ * import NextLink from "next/link";
39
+ * <Breadcrumbs linkComponent={NextLink} items={items} />
40
+ * ```
41
+ *
42
+ * **Pass it from a client component.** This is a function prop, and functions
43
+ * cannot cross the React Server Component boundary — handing `NextLink` to
44
+ * Breadcrumbs from a server component fails the render with "Functions cannot
45
+ * be passed directly to Client Components". Bind it in a small `"use client"`
46
+ * wrapper and the pages that use that wrapper stay server-rendered.
47
+ */
48
+ linkComponent?: React.ComponentType<BreadcrumbLinkProps>;
49
+ /** Applied to the current (last) crumb, for a per-page accent. */
50
+ currentClassName?: string;
12
51
  }
13
- declare const Breadcrumbs: ({ items, separator, showHomeIcon, variant, className, ...props }: BreadcrumbsProps) => import("react/jsx-runtime").JSX.Element;
52
+ declare const Breadcrumbs: ({ items, separator, showHomeIcon, homeHref, linkComponent, currentClassName, variant, className, ...props }: BreadcrumbsProps) => import("react/jsx-runtime").JSX.Element;
14
53
  export { Breadcrumbs };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-DN9b_g1N.cjs"),j=require("react"),n=require("@tanstack/react-table"),p=n.tableFeatures({rowSortingFeature:n.rowSortingFeature,rowPaginationFeature:n.rowPaginationFeature,sortedRowModel:n.createSortedRowModel(),paginatedRowModel:n.createPaginatedRowModel(),sortFns:n.sortFns});function R({columns:a,data:r,className:i,tableClassName:l,paginationClassName:x,variant:c="default",size:u="md",hoverable:g=!1}){const[m,d]=j.useState([]),t=n.useTable({features:p,data:r,columns:a,onSortingChange:d,state:{sorting:m},initialState:{pagination:{pageIndex:0,pageSize:10}}});return e.jsxRuntimeExports.jsxs("div",{className:e.cn("flex flex-col gap-4",i),children:[e.jsxRuntimeExports.jsxs(e.Table,{variant:c,size:u,hoverable:g,className:l,children:[e.jsxRuntimeExports.jsx(e.TableHeader,{children:t.getHeaderGroups().map(o=>e.jsxRuntimeExports.jsx(e.TableRow,{children:o.headers.map(s=>e.jsxRuntimeExports.jsx(e.TableHead,{children:s.isPlaceholder?null:e.jsxRuntimeExports.jsxs("div",{className:e.cn("flex items-center gap-2 transition-opacity",s.column.getCanSort()&&"cursor-pointer select-none opacity-80 hover:opacity-100"),onClick:s.column.getToggleSortingHandler(),children:[n.flexRender(s.column.columnDef.header,s.getContext()),s.column.getCanSort()&&e.jsxRuntimeExports.jsx("span",{className:"w-4 flex justify-center text-primary-500",children:s.column.getIsSorted()==="asc"?e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faCaretUp}):s.column.getIsSorted()==="desc"?e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faCaretDown}):null})]})},s.id))},o.id))}),e.jsxRuntimeExports.jsx(e.TableBody,{children:t.getRowModel().rows?.length?t.getRowModel().rows.map(o=>e.jsxRuntimeExports.jsx(e.TableRow,{children:o.getAllCells().map(s=>e.jsxRuntimeExports.jsx(e.TableCell,{children:n.flexRender(s.column.columnDef.cell,s.getContext())},s.id))},o.id)):e.jsxRuntimeExports.jsx(e.TableRow,{children:e.jsxRuntimeExports.jsx(e.TableCell,{colSpan:a.length,className:"h-24 text-center text-gray-500 dark:text-gray-400 italic",children:"No results found."})})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.cn("flex flex-col sm:flex-row items-center justify-between gap-4 px-2",x),children:[e.jsxRuntimeExports.jsxs("div",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:["Page"," ",e.jsxRuntimeExports.jsx("strong",{className:"text-gray-900 dark:text-gray-100",children:t.state.pagination.pageIndex+1})," ","of"," ",e.jsxRuntimeExports.jsx("strong",{className:"text-gray-900 dark:text-gray-100",children:t.getPageCount()})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.setPageIndex(0),disabled:!t.getCanPreviousPage(),"aria-label":"Go to first page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAnglesLeft})}),e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),"aria-label":"Go to previous page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAngleLeft})}),e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),"aria-label":"Go to next page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAngleRight})}),e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.setPageIndex(t.getPageCount()-1),disabled:!t.getCanNextPage(),"aria-label":"Go to last page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAnglesRight})})]})]})]})}exports.DataTable=R;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-Cqm_mtRS.cjs"),p=require("react"),n=require("@tanstack/react-table"),a=require("./utils-D2U2F80P.cjs"),R=n.tableFeatures({rowSortingFeature:n.rowSortingFeature,rowPaginationFeature:n.rowPaginationFeature,sortedRowModel:n.createSortedRowModel(),paginatedRowModel:n.createPaginatedRowModel(),sortFns:n.sortFns});function f({columns:r,data:i,className:l,tableClassName:x,paginationClassName:c,variant:u="default",size:g="md",hoverable:m=!1}){const[d,j]=p.useState([]),t=n.useTable({features:R,data:i,columns:r,onSortingChange:j,state:{sorting:d},initialState:{pagination:{pageIndex:0,pageSize:10}}});return e.jsxRuntimeExports.jsxs("div",{className:a.cn("flex flex-col gap-4",l),children:[e.jsxRuntimeExports.jsxs(e.Table,{variant:u,size:g,hoverable:m,className:x,children:[e.jsxRuntimeExports.jsx(e.TableHeader,{children:t.getHeaderGroups().map(o=>e.jsxRuntimeExports.jsx(e.TableRow,{children:o.headers.map(s=>e.jsxRuntimeExports.jsx(e.TableHead,{children:s.isPlaceholder?null:e.jsxRuntimeExports.jsxs("div",{className:a.cn("flex items-center gap-2 transition-opacity",s.column.getCanSort()&&"cursor-pointer select-none opacity-80 hover:opacity-100"),onClick:s.column.getToggleSortingHandler(),children:[n.flexRender(s.column.columnDef.header,s.getContext()),s.column.getCanSort()&&e.jsxRuntimeExports.jsx("span",{className:"w-4 flex justify-center text-primary-500",children:s.column.getIsSorted()==="asc"?e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faCaretUp}):s.column.getIsSorted()==="desc"?e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faCaretDown}):null})]})},s.id))},o.id))}),e.jsxRuntimeExports.jsx(e.TableBody,{children:t.getRowModel().rows?.length?t.getRowModel().rows.map(o=>e.jsxRuntimeExports.jsx(e.TableRow,{children:o.getAllCells().map(s=>e.jsxRuntimeExports.jsx(e.TableCell,{children:n.flexRender(s.column.columnDef.cell,s.getContext())},s.id))},o.id)):e.jsxRuntimeExports.jsx(e.TableRow,{children:e.jsxRuntimeExports.jsx(e.TableCell,{colSpan:r.length,className:"h-24 text-center text-gray-500 dark:text-gray-400 italic",children:"No results found."})})})]}),e.jsxRuntimeExports.jsxs("div",{className:a.cn("flex flex-col sm:flex-row items-center justify-between gap-4 px-2",c),children:[e.jsxRuntimeExports.jsxs("div",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:["Page"," ",e.jsxRuntimeExports.jsx("strong",{className:"text-gray-900 dark:text-gray-100",children:t.state.pagination.pageIndex+1})," ","of"," ",e.jsxRuntimeExports.jsx("strong",{className:"text-gray-900 dark:text-gray-100",children:t.getPageCount()})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.setPageIndex(0),disabled:!t.getCanPreviousPage(),"aria-label":"Go to first page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAnglesLeft})}),e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),"aria-label":"Go to previous page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAngleLeft})}),e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),"aria-label":"Go to next page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAngleRight})}),e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.setPageIndex(t.getPageCount()-1),disabled:!t.getCanNextPage(),"aria-label":"Go to last page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAnglesRight})})]})]})]})}exports.DataTable=f;
@@ -1,17 +1,18 @@
1
1
  "use client";
2
- import { q as e, U as C, a1 as S, a2 as o, a0 as P, F as s, aa as v, ab as w, v as i, W as y, Z as c, G as l, ac as N, ad as R, ae as T, af as k } from "./Table-DNbzjCZM.js";
2
+ import { j as e, T as C, a as S, b as o, c as P, F as s, f as w, d as y, e as v, g as c, B as l, h as N, i as R, k as T, l as k } from "./Table-BaJ8qfrV.js";
3
3
  import { useState as F } from "react";
4
- import { tableFeatures as I, sortFns as A, rowPaginationFeature as M, rowSortingFeature as z, createPaginatedRowModel as G, createSortedRowModel as D, useTable as H, flexRender as g } from "@tanstack/react-table";
4
+ import { tableFeatures as I, sortFns as A, rowPaginationFeature as M, rowSortingFeature as z, createPaginatedRowModel as D, createSortedRowModel as G, useTable as H, flexRender as g } from "@tanstack/react-table";
5
+ import { c as i } from "./utils-DtaLkIY8.js";
5
6
  const B = I({
6
7
  rowSortingFeature: z,
7
8
  rowPaginationFeature: M,
8
- sortedRowModel: D(),
9
- paginatedRowModel: G(),
9
+ sortedRowModel: G(),
10
+ paginatedRowModel: D(),
10
11
  // The whole built-in registry, not a subset: DataTable is generic over
11
12
  // consumer data, so auto sort detection has to be able to reach any of them.
12
13
  sortFns: A
13
14
  });
14
- function E({
15
+ function J({
15
16
  columns: r,
16
17
  data: d,
17
18
  className: x,
@@ -58,11 +59,11 @@ function E({
58
59
  t.column.columnDef.header,
59
60
  t.getContext()
60
61
  ),
61
- t.column.getCanSort() && /* @__PURE__ */ e.jsx("span", { className: "w-4 flex justify-center text-primary-500", children: t.column.getIsSorted() === "asc" ? /* @__PURE__ */ e.jsx(s, { icon: v }) : t.column.getIsSorted() === "desc" ? /* @__PURE__ */ e.jsx(s, { icon: w }) : null })
62
+ t.column.getCanSort() && /* @__PURE__ */ e.jsx("span", { className: "w-4 flex justify-center text-primary-500", children: t.column.getIsSorted() === "asc" ? /* @__PURE__ */ e.jsx(s, { icon: w }) : t.column.getIsSorted() === "desc" ? /* @__PURE__ */ e.jsx(s, { icon: y }) : null })
62
63
  ]
63
64
  }
64
65
  ) }, t.id)) }, n.id)) }),
65
- /* @__PURE__ */ e.jsx(y, { children: a.getRowModel().rows?.length ? (
66
+ /* @__PURE__ */ e.jsx(v, { children: a.getRowModel().rows?.length ? (
66
67
  // No data-state on the row: row selection is not one of the
67
68
  // registered features, and v8's getIsSelected() was always false
68
69
  // here, so React omitted the attribute anyway.
@@ -151,5 +152,5 @@ function E({
151
152
  ] });
152
153
  }
153
154
  export {
154
- E as DataTable
155
+ J as DataTable
155
156
  };
@@ -1 +1 @@
1
- "use client";"use strict";
1
+ "use strict";
@@ -1 +1 @@
1
- "use client";
1
+