@chassis-ui/react 0.3.0 → 0.4.1
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/README.md +2 -2
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/avatar.d.ts +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button.d.ts +1 -1
- package/dist/card.d.ts +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox.d.ts +2 -2
- package/dist/checkbox.js +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chunks/{Button-Cptd4Yk7.d.ts → Button-BuZ_GOHS.d.ts} +2 -2
- package/dist/chunks/{Link-nrd0JWlO.d.ts → Link-CKymd2ru.d.ts} +2 -2
- package/dist/chunks/Link-DyZyAQFj.js +2 -0
- package/dist/chunks/Link-DyZyAQFj.js.map +1 -0
- package/dist/chunks/{MenuToggle-BdQtF7FV.js → MenuToggle-7RQ0dmtZ.js} +2 -2
- package/dist/chunks/{MenuToggle-BdQtF7FV.js.map → MenuToggle-7RQ0dmtZ.js.map} +1 -1
- package/dist/chunks/alert-3kTBfWFw.js +2 -0
- package/dist/chunks/{alert-BXI-_qlt.js.map → alert-3kTBfWFw.js.map} +1 -1
- package/dist/chunks/{avatar-S3dGy6Qc.js → avatar-MklqAKcz.js} +2 -2
- package/dist/chunks/{avatar-S3dGy6Qc.js.map → avatar-MklqAKcz.js.map} +1 -1
- package/dist/chunks/{breadcrumb-s6J9itez.js → breadcrumb-CHxTiZLt.js} +2 -2
- package/dist/chunks/{breadcrumb-s6J9itez.js.map → breadcrumb-CHxTiZLt.js.map} +1 -1
- package/dist/chunks/breakpoints-CGk8szzR.js +2 -0
- package/dist/chunks/breakpoints-CGk8szzR.js.map +1 -0
- package/dist/chunks/breakpoints-ECy4lKQT.d.ts +6 -0
- package/dist/chunks/card-CTP9K8xG.js +2 -0
- package/dist/chunks/card-CTP9K8xG.js.map +1 -0
- package/dist/chunks/{checkbox-ChACalAw.js → checkbox-ZyQn5Ku5.js} +2 -2
- package/dist/chunks/{checkbox-ChACalAw.js.map → checkbox-ZyQn5Ku5.js.map} +1 -1
- package/dist/chunks/colorClassNames-CEh5Yzfp.js +2 -0
- package/dist/chunks/colorClassNames-CEh5Yzfp.js.map +1 -0
- package/dist/chunks/datagrid-DOYxx0sF.js +3 -0
- package/dist/chunks/datagrid-DOYxx0sF.js.map +1 -0
- package/dist/chunks/flex-B52oLCCC.js +2 -0
- package/dist/chunks/flex-B52oLCCC.js.map +1 -0
- package/dist/chunks/grid-C7tO-ppc.js +2 -0
- package/dist/chunks/grid-C7tO-ppc.js.map +1 -0
- package/dist/chunks/{index-Bm2NpgND.d.ts → index-0jbACjYQ.d.ts} +2 -2
- package/dist/chunks/{index-D9PZHY_I.d.ts → index-B19ZH3fm.d.ts} +2 -2
- package/dist/chunks/{index-COsIPd8L.d.ts → index-B1kw0jzM.d.ts} +2 -2
- package/dist/chunks/{index-e7SJkI_m.d.ts → index-BLS1jhSJ.d.ts} +2 -2
- package/dist/chunks/{index-DjrEvKd-.d.ts → index-BMkbJVHg.d.ts} +2 -2
- package/dist/chunks/{index-t_x6jj7l.d.ts → index-BOx8v-oT.d.ts} +2 -2
- package/dist/chunks/index-BSLneLYu.d.ts +79 -0
- package/dist/chunks/{index-BnR7wjax.d.ts → index-BfEJYF4c.d.ts} +2 -2
- package/dist/chunks/{index-CRfm7W6C.d.ts → index-C9gzVqwX.d.ts} +2 -2
- package/dist/chunks/{index-DjXRq-n3.d.ts → index-CHQR8x8_.d.ts} +6 -12
- package/dist/chunks/{index-BTTeKpiE.d.ts → index-CIwzgZJi.d.ts} +2 -2
- package/dist/chunks/{index-I-H3VJ-L.d.ts → index-CYvVmTPR.d.ts} +4 -4
- package/dist/chunks/{index-qMq_-GY2.d.ts → index-CjT_4IZx.d.ts} +3 -3
- package/dist/chunks/index-CxjNw4ss.d.ts +216 -0
- package/dist/chunks/{index-DgHvXzVh.d.ts → index-DHcztR18.d.ts} +3 -3
- package/dist/chunks/{index-DXjbI7Yv.d.ts → index-DM01FX3a.d.ts} +3 -3
- package/dist/chunks/{index-CYgBmZ8w.d.ts → index-DP5xugE-.d.ts} +2 -2
- package/dist/chunks/{index-FKh7iFQE.d.ts → index-DPCwFiJL.d.ts} +2 -2
- package/dist/chunks/{index-DJr_ZK4b.d.ts → index-DQImhbhy.d.ts} +2 -2
- package/dist/chunks/{index-CJXKl97l.d.ts → index-DtvHH_Mb.d.ts} +2 -2
- package/dist/chunks/{index-CJzKu7QI.d.ts → index-Dzga1f4w.d.ts} +3 -3
- package/dist/chunks/{index-CKx1KHED.d.ts → index-NGgDkhyn.d.ts} +18 -25
- package/dist/chunks/{index-Dfy1YW5j.d.ts → index-U27Ar174.d.ts} +2 -2
- package/dist/chunks/{index-CsMIgBsd.d.ts → index-YJ9QdBuq.d.ts} +9 -10
- package/dist/chunks/{index-Dh5CaHTP.d.ts → index-aRdgpeRb.d.ts} +2 -2
- package/dist/chunks/{index-BO9jLOIb.d.ts → index-lSPcxiii.d.ts} +2 -2
- package/dist/chunks/{index-DceCODH9.d.ts → index-x0vZRyoU.d.ts} +2 -2
- package/dist/chunks/{list-BQCkwWjF.js → list-07e2a1Ym.js} +2 -2
- package/dist/chunks/{list-BQCkwWjF.js.map → list-07e2a1Ym.js.map} +1 -1
- package/dist/chunks/{menu-98EAD9nj.js → menu-Upf6P-2P.js} +2 -2
- package/dist/chunks/{menu-98EAD9nj.js.map → menu-Upf6P-2P.js.map} +1 -1
- package/dist/chunks/{nav-TiZuTHC6.js → nav-DI6oEULI.js} +2 -2
- package/dist/chunks/{nav-TiZuTHC6.js.map → nav-DI6oEULI.js.map} +1 -1
- package/dist/chunks/{nav-overflow-Ay5mM5Gc.js → nav-overflow-DlLer6EK.js} +2 -2
- package/dist/chunks/{nav-overflow-Ay5mM5Gc.js.map → nav-overflow-DlLer6EK.js.map} +1 -1
- package/dist/chunks/{notification-Ds24wnPq.js → notification-Dbci5Ka3.js} +2 -2
- package/dist/chunks/{notification-Ds24wnPq.js.map → notification-Dbci5Ka3.js.map} +1 -1
- package/dist/chunks/pagination-BREQp-ZC.js +2 -0
- package/dist/chunks/{pagination-BkOquk-x.js.map → pagination-BREQp-ZC.js.map} +1 -1
- package/dist/chunks/placeholder-DhNpUJqv.js +2 -0
- package/dist/chunks/placeholder-DhNpUJqv.js.map +1 -0
- package/dist/chunks/progress-BqgWezdG.js +2 -0
- package/dist/chunks/progress-BqgWezdG.js.map +1 -0
- package/dist/chunks/{radio-DOFYCfJi.js → radio-B6gJdtoN.js} +2 -2
- package/dist/chunks/{radio-DOFYCfJi.js.map → radio-B6gJdtoN.js.map} +1 -1
- package/dist/chunks/{renderFormCheck-DZh_5Df8.d.ts → renderFormCheck-nKgpa_a3.d.ts} +2 -2
- package/dist/chunks/skeleton-Bjv9gGd3.js +2 -0
- package/dist/chunks/skeleton-Bjv9gGd3.js.map +1 -0
- package/dist/chunks/spacingClassName-DVhk8m3P.js.map +1 -1
- package/dist/chunks/spinner-DBuvQvMR.js +2 -0
- package/dist/chunks/spinner-DBuvQvMR.js.map +1 -0
- package/dist/chunks/stack-DK5F53VT.js +2 -0
- package/dist/chunks/stack-DK5F53VT.js.map +1 -0
- package/dist/chunks/static-table-uu297Liz.js +2 -0
- package/dist/chunks/{static-table-D0M4oc_t.js.map → static-table-uu297Liz.js.map} +1 -1
- package/dist/chunks/{table-Cy6uEuEP.js → table-DPLOygg0.js} +2 -2
- package/dist/chunks/{table-Cy6uEuEP.js.map → table-DPLOygg0.js.map} +1 -1
- package/dist/chunks/tableClassName-DleBjOj2.js +2 -0
- package/dist/chunks/tableClassName-DleBjOj2.js.map +1 -0
- package/dist/chunks/{types-CS_40Txv.d.ts → types-D6FM7bYR.d.ts} +16 -2
- package/dist/close-button.d.ts +1 -1
- package/dist/datagrid.d.ts +1 -1
- package/dist/datagrid.js +1 -1
- package/dist/flex.d.ts +1 -1
- package/dist/flex.js +1 -1
- package/dist/grid.d.ts +2 -2
- package/dist/grid.js +1 -1
- package/dist/index.d.ts +32 -32
- package/dist/index.js +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.js +1 -1
- package/dist/list.d.ts +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.d.ts +1 -1
- package/dist/menu.js +1 -1
- package/dist/nav-overflow.d.ts +1 -1
- package/dist/nav-overflow.js +1 -1
- package/dist/nav.d.ts +1 -1
- package/dist/nav.js +1 -1
- package/dist/navbar.d.ts +1 -1
- package/dist/notification.d.ts +1 -1
- package/dist/notification.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/placeholder.d.ts +1 -1
- package/dist/placeholder.js +1 -1
- package/dist/progress.d.ts +1 -1
- package/dist/progress.js +1 -1
- package/dist/radio.d.ts +1 -1
- package/dist/radio.js +1 -1
- package/dist/skeleton.d.ts +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/spinner.d.ts +1 -1
- package/dist/spinner.js +1 -1
- package/dist/stack.d.ts +1 -1
- package/dist/stack.js +1 -1
- package/dist/static-table.d.ts +1 -1
- package/dist/static-table.js +1 -1
- package/dist/stepper.d.ts +1 -1
- package/dist/switch.d.ts +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/toast.d.ts +1 -1
- package/package.json +4 -4
- package/dist/chunks/Link-CZsWCnQb.js +0 -2
- package/dist/chunks/Link-CZsWCnQb.js.map +0 -1
- package/dist/chunks/alert-BXI-_qlt.js +0 -2
- package/dist/chunks/breakpoints-CJ-498B7.d.ts +0 -7
- package/dist/chunks/breakpoints-o_2Ev7ir.js +0 -2
- package/dist/chunks/breakpoints-o_2Ev7ir.js.map +0 -1
- package/dist/chunks/card-YXn3bj_d.js +0 -2
- package/dist/chunks/card-YXn3bj_d.js.map +0 -1
- package/dist/chunks/datagrid-CH3Cy-q7.js +0 -3
- package/dist/chunks/datagrid-CH3Cy-q7.js.map +0 -1
- package/dist/chunks/flex-CmlJbKVj.js +0 -2
- package/dist/chunks/flex-CmlJbKVj.js.map +0 -1
- package/dist/chunks/grid-DK_vxz-4.js +0 -2
- package/dist/chunks/grid-DK_vxz-4.js.map +0 -1
- package/dist/chunks/index-CVUMS0x7.d.ts +0 -74
- package/dist/chunks/index-RHJhkSY-.d.ts +0 -273
- package/dist/chunks/pagination-BkOquk-x.js +0 -2
- package/dist/chunks/placeholder-BCr83sUn.js +0 -2
- package/dist/chunks/placeholder-BCr83sUn.js.map +0 -1
- package/dist/chunks/progress-zWkTltor.js +0 -2
- package/dist/chunks/progress-zWkTltor.js.map +0 -1
- package/dist/chunks/skeleton-BrD2JwNx.js +0 -2
- package/dist/chunks/skeleton-BrD2JwNx.js.map +0 -1
- package/dist/chunks/spinner-DblhvrHL.js +0 -2
- package/dist/chunks/spinner-DblhvrHL.js.map +0 -1
- package/dist/chunks/stack-CsMiQbpq.js +0 -2
- package/dist/chunks/stack-CsMiQbpq.js.map +0 -1
- package/dist/chunks/static-table-D0M4oc_t.js +0 -2
- package/dist/chunks/tableClassName-CZA2Bse8.js +0 -2
- package/dist/chunks/tableClassName-CZA2Bse8.js.map +0 -1
package/dist/switch.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SwitchProps, t as Switch } from "./chunks/index-
|
|
1
|
+
import { n as SwitchProps, t as Switch } from "./chunks/index-lSPcxiii.js";
|
|
2
2
|
export { Switch, type SwitchProps };
|
package/dist/table.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TableColumn, c as TableCellProps, d as Table, f as TableProps, i as TableHeaderProps, l as TableBody, n as TableRowProps, o as TableColumnProps, r as TableHeader, s as TableCell, t as TableRow, u as TableBodyProps } from "./chunks/index-
|
|
1
|
+
import { a as TableColumn, c as TableCellProps, d as Table, f as TableProps, i as TableHeaderProps, l as TableBody, n as TableRowProps, o as TableColumnProps, r as TableHeader, s as TableCell, t as TableRow, u as TableBodyProps } from "./chunks/index-C9gzVqwX.js";
|
|
2
2
|
export { Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableColumn, type TableColumnProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps };
|
package/dist/table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as e,i as t,n,o as r,r as i,t as a}from"./chunks/table-
|
|
1
|
+
"use client";import{a as e,i as t,n,o as r,r as i,t as a}from"./chunks/table-DPLOygg0.js";export{r as Table,e as TableBody,t as TableCell,i as TableColumn,n as TableHeader,a as TableRow};
|
package/dist/toast.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as Toast, a as closeToast, c as ToasterProps, d as ToastHeader, f as ToastHeaderProps, g as ToastBodyProps, h as ToastBody, i as addToast, l as ToastIcon, m as ToastFooterProps, n as useToast, o as toastQueue, p as ToastFooter, r as ToastContent, s as Toaster, t as UseToastResult, u as ToastIconProps, v as ToastProps } from "./chunks/index-
|
|
1
|
+
import { _ as Toast, a as closeToast, c as ToasterProps, d as ToastHeader, f as ToastHeaderProps, g as ToastBodyProps, h as ToastBody, i as addToast, l as ToastIcon, m as ToastFooterProps, n as useToast, o as toastQueue, p as ToastFooter, r as ToastContent, s as Toaster, t as UseToastResult, u as ToastIconProps, v as ToastProps } from "./chunks/index-DP5xugE-.js";
|
|
2
2
|
export { Toast, ToastBody, type ToastBodyProps, type ToastContent, ToastFooter, type ToastFooterProps, ToastHeader, type ToastHeaderProps, ToastIcon, type ToastIconProps, type ToastProps, Toaster, type ToasterProps, type UseToastResult, addToast, closeToast, toastQueue, useToast };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chassis-ui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Chassis UI Components Library for React.js",
|
|
6
6
|
"keywords": [
|
|
@@ -146,8 +146,8 @@
|
|
|
146
146
|
"devDependencies": {
|
|
147
147
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
148
148
|
"@arethetypeswrong/core": "^0.18.5",
|
|
149
|
-
"@chassis-ui/css": "^0.
|
|
150
|
-
"@chassis-ui/tokens": "^0.
|
|
149
|
+
"@chassis-ui/css": "^0.7.2",
|
|
150
|
+
"@chassis-ui/tokens": "^0.7.0",
|
|
151
151
|
"@playwright/test": "1.63.0",
|
|
152
152
|
"@storybook/addon-a11y": "^10.6.1",
|
|
153
153
|
"@storybook/addon-docs": "^10.6.1",
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
"vitest": "^4.1.11"
|
|
182
182
|
},
|
|
183
183
|
"peerDependencies": {
|
|
184
|
-
"@chassis-ui/css": ">=0.
|
|
184
|
+
"@chassis-ui/css": ">=0.7.0 <0.8.0",
|
|
185
185
|
"react": "^19.0.0",
|
|
186
186
|
"react-dom": "^19.0.0"
|
|
187
187
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as e,f as t,g as n,p as r}from"./slot-CNhFZdHF.js";import{t as i}from"./useForkedRef-DVEfT-KI.js";import{t as a}from"./polymorphic-BhGNZQja.js";import{t as o}from"./useButtonSemantics-CILM_lhi.js";import{t as s}from"./useDisabledAnchorGuard-Cz58UCXy.js";import{n as c}from"./scrollspy-D_lPjb92.js";import l from"react";import u from"classnames";import{mergeProps as d}from"react-aria";function f({children:a,active:f,className:p,color:m,component:h,disabled:g,href:_,iconLink:v,onClick:y,reset:b,stretched:x,type:S=`button`,...C},w){let T=r(h,_,`a`),E=n(T,_,C),D=t(E),O=E===`component`,k=c(g),A=k.onClick,j=s(E===`anchor`,g,A?e=>{y?.(e),A(e)}:y),M=!D&&!O&&!!y,{buttonProps:N,forkedRef:P}=o(w,{disabled:g,onClick:y}),F=M?P:w,I=i(F,k.ref),L=f||!!k.mark,R=f?`page`:k.mark===`current`?`true`:void 0,z=u(m&&`link-${m}`,{"icon-link":v,"fg-reset":b,"stretched-link":x},{active:L,disabled:g},p);return l.createElement(T,{...d(C,M?N:{}),className:z,...e(E,_,`Link`),...R&&{"aria-current":R},...E===`anchor`&&g&&{"aria-disabled":!0,tabIndex:-1},...!M&&{onClick:j},...E===`button`&&{disabled:g,type:S},ref:k.ref?I:F},a)}const p=a(f,`Link`);export{p as t};
|
|
2
|
-
//# sourceMappingURL=Link-CZsWCnQb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Link-CZsWCnQb.js","names":[],"sources":["../../src/components/link/Link.tsx"],"sourcesContent":["import React, {\n ElementType,\n ForwardRefRenderFunction,\n MouseEventHandler,\n ReactElement,\n Ref\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps } from 'react-aria'\n\nimport { ContextColor } from '../../types'\nimport { useButtonSemantics, useDisabledAnchorGuard, useForkedRef } from '../../hooks'\nimport { hrefProps, isInteractiveKind, linkElement, resolveLinkKind } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { useScrollspyLink } from '../../utils/scrollspy'\n\ntype LinkOwnProps<C extends ElementType> = {\n /**\n * Toggle the active state for the component.\n */\n active?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the link color to one of Chassis context colors, including its interactive\n * (`:hover`/`:focus`/`:active`/`:visited`) states.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * The href attribute specifies the URL of the page the link goes to. Reaches an `<a>` or a\n * component reference (a router link); dropped, with a warning in development, when\n * `component` is another element. Declared explicitly here — rather than left to flow through\n * generically from whatever `C` is — so consumers that wrap `Link` (`MenuItem`, `ListItem`,\n * `NavLink`) can read it with a concrete type regardless of `component`.\n */\n href?: string\n /**\n * Fires on click.\n */\n onClick?: MouseEventHandler<HTMLElement>\n /**\n * Aligns a leading or trailing icon with the link text using flexbox, with a gap between\n * them and an offset underline. Icons need to be passed as `children` alongside the text.\n * Named `iconLink` rather than `icon` to avoid colliding with components (e.g. `MenuItem`)\n * that already have their own, differently-typed `icon` prop for the icon content itself.\n */\n iconLink?: boolean\n /**\n * Removes the foreground color override, so the link inherits its color from the nearest\n * ancestor instead of the default link color.\n */\n reset?: boolean\n /**\n * Expands the link's click target to fill its positioned ancestor (the nearest ancestor with\n * a `position` other than `static`).\n */\n stretched?: boolean\n /**\n * Specifies the type of button. Only applies when `component=\"button\"`. Different browsers may\n * use different default types for the `<button>` element, so always specify it explicitly.\n */\n type?: 'button' | 'submit' | 'reset'\n}\n\nexport type LinkProps<C extends ElementType = 'a'> = PolymorphicComponentProps<C, LinkOwnProps<C>>\n\ntype LinkComponent = (<C extends ElementType = 'a'>(\n props: LinkProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction LinkRender<C extends ElementType = 'a'>(\n {\n children,\n active,\n className,\n color,\n component,\n disabled,\n href,\n iconLink,\n onClick,\n reset,\n stretched,\n type = 'button',\n ...rest\n }: LinkProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = linkElement(component, href, 'a')\n // The kind rather than the tag, counting a router link with `href` or `to` as an anchor: under `asChild`, `Component` is a `Slot` standing in for the\n // caller's element, and a slotted `<a>` needs what `component=\"a\"` gets.\n const kind = resolveLinkKind(Component, href, rest)\n\n const isInteractive = isInteractiveKind(kind)\n // A component reference without a link target (a router link with `href` or `to` is an anchor,\n // see `resolveLinkKind`) has its own visual identity and is trusted to\n // handle its own keyboard/role semantics, same as `CloseButton`'s `isComponentReference` escape\n // hatch — synthesizing `role=\"button\"` and Enter/Space handling on top of it would stamp the\n // wrong ARIA role onto whatever it actually renders (e.g. an `<a>`) and can double-fire a click\n // (native anchor Enter→click, plus the synthesized keydown→click).\n const isComponentReference = kind === 'component'\n // Inside a `Scrollspy`, the link registers its element, is marked when its section is the one\n // being read, and scrolls to it smoothly when the `Scrollspy` is set to (`src/utils/scrollspy.ts`).\n const spy = useScrollspyLink(disabled)\n const spyClick = spy.onClick\n const clickHandler: MouseEventHandler<HTMLElement> | undefined = spyClick\n ? (event) => {\n onClick?.(event)\n spyClick(event)\n }\n : onClick\n // `<a>` has no real `disabled` attribute, so a disabled anchor link still fires click (and\n // still navigates) unless it's blocked here, same guard `Button`/`CloseButton` apply. A real\n // `<button>` already stops clicks on its own once the `disabled` attribute below is set.\n const handleClick = useDisabledAnchorGuard<HTMLElement>(kind === 'anchor', disabled, clickHandler)\n\n // A `component` that isn't a native interactive element gets a raw onClick with no\n // keyboard semantics otherwise — mouse-only, unlike `Button`/`CloseButton`, which\n // synthesize this via `useButtonSemantics` for exactly this \"arbitrary component\" case. A\n // component reference is excluded (see `isComponentReference` above).\n const needsButtonSemantics = !isInteractive && !isComponentReference && !!onClick\n const { buttonProps, forkedRef } = useButtonSemantics<HTMLElement>(ref as Ref<HTMLElement>, {\n disabled,\n onClick\n })\n const ownRef = needsButtonSemantics ? forkedRef : ref\n const spyRef = useForkedRef(ownRef as Ref<HTMLElement>, spy.ref)\n // A link to the section being read is `active` and `aria-current=\"true\"`: the current place in\n // the page, not the current page. A link it belongs under, such as its menu's toggle, only\n // looks active. An `active` given as a prop wins.\n const isActive = active || !!spy.mark\n const ariaCurrent = active ? 'page' : spy.mark === 'current' ? 'true' : undefined\n\n const _className = classNames(\n color && `link-${color}`,\n { 'icon-link': iconLink, 'fg-reset': reset, 'stretched-link': stretched },\n { active: isActive, disabled },\n className\n )\n\n return (\n <Component\n {...(mergeProps(rest, needsButtonSemantics ? buttonProps : {}) as Record<string, unknown>)}\n className={_className}\n {...hrefProps(kind, href, 'Link')}\n {...(ariaCurrent && { 'aria-current': ariaCurrent })}\n {...(kind === 'anchor' && disabled && { 'aria-disabled': true, tabIndex: -1 })}\n {...(!needsButtonSemantics && { onClick: handleClick })}\n {...(kind === 'button' && { disabled, type })}\n ref={spy.ref ? spyRef : ownRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const Link = createPolymorphicComponent<LinkComponent>(\n LinkRender as ForwardRefRenderFunction<Element, LinkProps<ElementType>>,\n 'Link'\n)\n"],"mappings":"0YAoFA,SAAS,EACP,CACE,WACA,SACA,YACA,QACA,YACA,WACA,OACA,WACA,UACA,QACA,YACA,OAAO,SACP,GAAG,GAEL,EACA,CACA,IAAM,EAAY,EAAY,EAAW,EAAM,GAAG,EAG5C,EAAO,EAAgB,EAAW,EAAM,CAAI,EAE5C,EAAgB,EAAkB,CAAI,EAOtC,EAAuB,IAAS,YAGhC,EAAM,EAAiB,CAAQ,EAC/B,EAAW,EAAI,QAUf,EAAc,EAAoC,IAAS,SAAU,EATV,EAC5D,GAAU,CACT,IAAU,CAAK,EACf,EAAS,CAAK,CAChB,EACA,CAI6F,EAM3F,EAAuB,CAAC,GAAiB,CAAC,GAAwB,CAAC,CAAC,EACpE,CAAE,cAAa,aAAc,EAAgC,EAAyB,CAC1F,WACA,SACF,CAAC,EACK,EAAS,EAAuB,EAAY,EAC5C,EAAS,EAAa,EAA4B,EAAI,GAAG,EAIzD,EAAW,GAAU,CAAC,CAAC,EAAI,KAC3B,EAAc,EAAS,OAAS,EAAI,OAAS,UAAY,OAAS,IAAA,GAElE,EAAa,EACjB,GAAS,QAAQ,IACjB,CAAE,YAAa,EAAU,WAAY,EAAO,iBAAkB,CAAU,EACxE,CAAE,OAAQ,EAAU,UAAS,EAC7B,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CACE,GAAK,EAAW,EAAM,EAAuB,EAAc,CAAC,CAAC,EAC7D,UAAW,EACX,GAAI,EAAU,EAAM,EAAM,MAAM,EAChC,GAAK,GAAe,CAAE,eAAgB,CAAY,EAClD,GAAK,IAAS,UAAY,GAAY,CAAE,gBAAiB,GAAM,SAAU,EAAG,EAC5E,GAAK,CAAC,GAAwB,CAAE,QAAS,CAAY,EACrD,GAAK,IAAS,UAAY,CAAE,WAAU,MAAK,EAC3C,IAAK,EAAI,IAAM,EAAS,CAGf,EADR,CACQ,CAEf,CAEA,MAAa,EAAO,EAClB,EACA,MACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{c as e}from"./slot-CNhFZdHF.js";import{t}from"./useForkedRef-DVEfT-KI.js";import{t as n}from"./polymorphic-BhGNZQja.js";import{t as r}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as i}from"./useDialogElement-CgOnJAzu.js";import{t as a}from"./Icon-DLB1f88W.js";import{t as o}from"./CloseButton-DPgQztE0.js";import{t as s}from"./Button-BoymWE-L.js";import c,{createContext as l,forwardRef as u,useCallback as d,useContext as f,useId as p,useRef as m,useState as h}from"react";import g from"classnames";const _=l({close:()=>{},registerPart:()=>()=>{}}),v=()=>f(_),y=u(({"aria-describedby":t,"aria-labelledby":n,backdrop:r=`static`,children:a,className:s,closeButton:l,closeLabel:u,defaultVisible:f,instant:p,keyboard:m=!1,onClick:v,onClose:y,onClosePrevented:b,onHidden:x,onShow:S,onShown:C,onVisibleChange:w,open:T,visible:E,...D},O)=>{let{close:k,forkedRef:A,handleBackdropClick:j,handleCancel:M,hiding:N,staticBounce:P}=i({backdrop:r,defaultVisible:f,instant:p,isModal:!0,keyboard:m,onClick:v,onClose:y,onClosePrevented:b,onHidden:x,onShow:S,onShown:C,onVisibleChange:w,open:T,ref:O,visible:E}),[F,I]=h([]),L=d((e,t,n)=>{let r={id:n,kind:e,node:t};return I(e=>[...e,r]),()=>I(e=>e.filter(e=>e!==r))},[]),R=e=>F.filter(t=>t.kind===e).sort((e,t)=>e.node.compareDocumentPosition(t.node)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1).map(({id:e})=>e),z=n||e(...R(`title`)),B=t||e(...R(`description`)),V={close:k,registerPart:L};return c.createElement(_.Provider,{value:V},c.createElement(`dialog`,{"aria-describedby":B,"aria-labelledby":z,role:`alertdialog`,...D,open:T,className:g(`alert`,`dialog`,{instant:p,hiding:N,"dialog-static":P},s),onCancel:M,onClick:j,ref:A},a,l&&c.createElement(o,{label:u,onClick:k})))});y.displayName=`Alert`;function b({children:e,className:t,component:n,...r},i){let a=n??`div`;return c.createElement(a,{className:g(`alert-body`,t),...r,ref:i},e)}const x=n(b,`AlertBody`),S=u(({color:e=`default`,onClick:t,...n},r)=>{let{close:i}=v();return c.createElement(s,{color:e,"data-autofocus":``,...n,onClick:e=>{t?.(e),e.defaultPrevented||i()},ref:r})});S.displayName=`AlertCancel`;function C(e){let t=m(null),{registerPart:n}=v(),i=m({});return r(()=>{let r=t.current,a=r?.id||void 0;a!==i.current.id&&(i.current.unregister?.(),i.current=r&&a?{id:a,unregister:n(e,r,a)}:{})}),r(()=>()=>{i.current.unregister?.(),i.current={}},[n]),t}function w({children:e,className:n,component:r,id:i,...a},o){let s=r??`code`,l=p(),u=C(`description`),d=t(o,u);return c.createElement(s,{className:g(`alert-code`,n),id:i??l,...a,ref:d},e)}const T=n(w,`AlertCode`);function E({children:e,className:t,component:n,stacked:r,...i},a){let o=n??`div`;return c.createElement(o,{className:g(`alert-footer`,{stacked:r},t),...i,ref:a},e)}const D=n(E,`AlertFooter`),O=u(({className:e,color:t,...n},r)=>c.createElement(a,{className:g(`alert-icon`,t&&`icon-${t}`,e),...n,ref:r}));O.displayName=`AlertIcon`;function k({children:e,className:n,component:r,id:i,...a},o){let s=r??`p`,l=p(),u=C(`description`),d=t(o,u);return c.createElement(s,{className:n,id:i??l,...a,ref:d},e)}const A=n(k,`AlertText`);function j({children:e,className:n,component:r,id:i,...a},o){let s=r??`h2`,l=p(),u=C(`title`),d=t(o,u);return c.createElement(s,{className:g(`alert-title`,n),id:i??l,...a,ref:d},e)}const M=n(j,`AlertTitle`);export{T as a,y as c,D as i,A as n,S as o,O as r,x as s,M as t};
|
|
2
|
-
//# sourceMappingURL=alert-BXI-_qlt.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
//#region src/utils/breakpoints.d.ts
|
|
2
|
-
type Span = 'auto' | number | string | boolean;
|
|
3
|
-
type WidthSpan = 'auto' | number | string | boolean;
|
|
4
|
-
type FlexDirection = 'row' | 'column';
|
|
5
|
-
//#endregion
|
|
6
|
-
export { Span as n, WidthSpan as r, FlexDirection as t };
|
|
7
|
-
//# sourceMappingURL=breakpoints-CJ-498B7.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints-o_2Ev7ir.js","names":[],"sources":["../../src/utils/breakpoints.ts"],"sourcesContent":["import { Breakpoint } from '../types'\n\n// Mobile-first ascending order. Every responsive layout prop (`Flex`/`Stack`/`Row`/`Col`/\n// `Skeleton`'s `responsive`) keys its overrides by these literal chassis-css breakpoint names.\nexport const BREAKPOINTS: Breakpoint[] = ['sm', 'md', 'lg', 'xl', '2xl']\n\n// A column span: a track count, `'auto'` for a natural-width track, or `true` for the bare (no\n// explicit width) case. `Col` maps it to the `col-{n}` / `col` classes of chassis-css's flexbox\n// grid, and the type goes when `Col` does.\nexport type Span = 'auto' | number | string | boolean\n\n// A width in twelfths of the parent: a count, `'auto'` for the natural width, or `true` to fill\n// the rest of a flex row. `Skeleton` maps it to chassis-css's width utilities. The same values as\n// `Span`, kept apart so the skeleton doesn't depend on a type of the flexbox grid.\nexport type WidthSpan = 'auto' | number | string | boolean\n\n/**\n * Builds the class list for a component's base layout plus per-breakpoint overrides supplied via\n * a `responsive` prop — the pattern shared by `Flex`, `Stack`, and (from Phase 2) `Row`/`Col`.\n *\n * `toClassNames` maps one breakpoint's layout value to class name fragments for a given prefix\n * (`''` for the base/unprefixed case, `` `${breakpoint}:` `` otherwise). Falsy entries in its\n * return value are fine — `classnames` drops them at the call site — so fields the layout object\n * doesn't set can just map to `undefined`/`false`.\n */\nexport function buildResponsiveClassNames<TLayout>(\n toClassNames: (layout: TLayout, prefix: string) => Array<string | false | null | undefined>,\n base: TLayout,\n responsive?: Partial<Record<Breakpoint, TLayout>>\n): Array<string | false | null | undefined> {\n const responsiveClassNames = responsive\n ? BREAKPOINTS.filter((bp) => responsive[bp]).flatMap((bp) =>\n toClassNames(responsive[bp] as TLayout, `${bp}:`)\n )\n : []\n\n return [...toClassNames(base, ''), ...responsiveClassNames]\n}\n\nexport type FlexDirection = 'row' | 'column'\n\n// A `buildResponsiveClassNames` `toClassNames` fn for the `flex-row`/`flex-column` direction\n// toggle shared by `Card` and `CardBody`, both of which map a `direction` prop to the same\n// chassis-css class.\nexport const flexDirectionClassNames = (\n direction: FlexDirection | undefined,\n prefix: string\n): Array<string | false | undefined> => [direction && `${prefix}flex-${direction}`]\n"],"mappings":"AAIA,MAAa,EAA4B,CAAC,KAAM,KAAM,KAAM,KAAM,KAAK,EAqBvE,SAAgB,EACd,EACA,EACA,EAC0C,CAC1C,IAAM,EAAuB,EACzB,EAAY,OAAQ,GAAO,EAAW,EAAG,CAAC,CAAC,QAAS,GAClD,EAAa,EAAW,GAAgB,GAAG,EAAG,EAAE,CAClD,EACA,CAAC,EAEL,MAAO,CAAC,GAAG,EAAa,EAAM,EAAE,EAAG,GAAG,CAAoB,CAC5D,CAOA,MAAa,GACX,EACA,IACsC,CAAC,GAAa,GAAG,EAAO,OAAO,GAAW"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./polymorphic-BhGNZQja.js";import{t}from"./Link-CZsWCnQb.js";import{n,t as r}from"./breakpoints-o_2Ev7ir.js";import{t as i}from"./spacingClassName-DVhk8m3P.js";import a from"react";import o from"classnames";function s({children:e,className:t,component:s,direction:c,gap:l,responsive:u,...d},f){let p=s??`div`,m=o(`card-body`,r(n,c,u),i(`gap`,l),t);return a.createElement(p,{className:m,...d,ref:f},e)}const c=e(s,`CardBody`);function l({children:e,className:t,component:n,...r},i){let s=n??`div`,c=o(`card-footer`,t);return a.createElement(s,{className:c,...r,ref:i},e)}const u=e(l,`CardFooter`),d=(e,t)=>[e?`${t}card-image-${e}`:t===``?`card-image`:null];function f({children:e,className:t,component:n,orientation:i,responsive:s,...c},l){let u=n??`img`,f=o(r(d,i,s),t);return a.createElement(u,{className:f,...c,ref:l},e)}const p=e(f,`CardImage`);function m({children:e,component:t,className:n,...r},i){let s=t??`h6`,c=o(`card-subtitle`,n);return a.createElement(s,{className:c,...r,ref:i},e)}const h=e(m,`CardSubtitle`);function g({children:e,component:t,className:n,...r},i){let s=t??`p`,c=o(`card-text`,n);return a.createElement(s,{className:c,...r,ref:i},e)}const _=e(g,`CardText`);function v({children:e,component:t,className:n,...r},i){let s=t??`h5`,c=o(`card-title`,n);return a.createElement(s,{className:c,...r,ref:i},e)}const y=e(v,`CardTitle`);function b({children:e,className:t,color:i,component:s,direction:l,footer:d,image:f,imageAlt:m,imageOrientation:g=`top`,responsive:v,size:b,subtitle:x,text:S,title:C,variant:w,...T},E){let D=s??`div`,O=o(`card`,i,{context:!!i,solid:w===`solid`,smooth:w===`smooth`,outline:w===`outline`,sm:b===`sm`,lg:b===`lg`},r(n,l,v),t),k=f!=null||C!=null||x!=null||d!=null||S!=null,A=C!=null||x!=null||S!=null||e!=null,j=typeof f==`string`?a.createElement(p,{orientation:g,src:f,alt:m??``}):f;return a.createElement(D,{className:O,...T,ref:E},k?a.createElement(a.Fragment,null,f!=null&&g===`top`&&j,A&&a.createElement(c,null,C!=null&&a.createElement(y,null,C),x!=null&&a.createElement(h,null,x),S!=null&&a.createElement(_,null,S),e),f!=null&&g===`bottom`&&j,d!=null&&a.createElement(u,null,d)):e)}const x=e(b,`Card`);function S({children:e,className:t,component:n,...r},i){let s=n??`div`,c=o(`card-group`,t);return a.createElement(s,{className:c,...r,ref:i},e)}const C=e(S,`CardGroup`);function w({children:e,className:t,component:n,...r},i){let s=n??`div`,c=o(`card-header`,t);return a.createElement(s,{className:c,...r,ref:i},e)}const T=e(w,`CardHeader`);function E({children:e,className:t,component:n,...r},i){let s=n??`div`,c=o(`card-overlay`,t);return a.createElement(s,{className:c,...r,ref:i},e)}const D=e(E,`CardImageOverlay`);function O({children:e,className:n,...r},i){let s=o(`card-link`,n);return a.createElement(t,{className:s,...r,ref:i},e)}const k=e(O,`CardLink`);export{x as a,h as c,c as d,C as i,p as l,D as n,y as o,T as r,_ as s,k as t,u};
|
|
2
|
-
//# sourceMappingURL=card-YXn3bj_d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card-YXn3bj_d.js","names":[],"sources":["../../src/components/card/CardBody.tsx","../../src/components/card/CardFooter.tsx","../../src/components/card/CardImage.tsx","../../src/components/card/CardSubtitle.tsx","../../src/components/card/CardText.tsx","../../src/components/card/CardTitle.tsx","../../src/components/card/Card.tsx","../../src/components/card/CardGroup.tsx","../../src/components/card/CardHeader.tsx","../../src/components/card/CardImageOverlay.tsx","../../src/components/card/CardLink.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { Breakpoint, Spacing } from '../../types'\nimport {\n buildResponsiveClassNames,\n flexDirectionClassNames,\n FlexDirection\n} from '../../utils/breakpoints'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { spacingClassName } from '../../utils/spacingClassName'\n\ntype CardBodyOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Switches the body from its default stacked (column) layout to a side-by-side (row) layout —\n * for placing an image beside text within a single padded region. Wrap the image and text in\n * `Col` to control each side's width, and nest another `CardBody` (with `.p-0`) for the text\n * side so it doesn't receive double padding.\n */\n direction?: FlexDirection\n /**\n * Spacing between children, mapped to the `gap-*` utility classes. Overrides the card's default\n * gap between body children.\n */\n gap?: Spacing | 0\n /**\n * Overrides `direction` at one or more breakpoints.\n */\n responsive?: Partial<Record<Breakpoint, FlexDirection>>\n}\n\nexport type CardBodyProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CardBodyOwnProps<C>\n>\n\ntype CardBodyComponent = (<C extends ElementType = 'div'>(\n props: CardBodyProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardBodyRender<C extends ElementType = 'div'>(\n { children, className, component, direction, gap, responsive, ...rest }: CardBodyProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n 'card-body',\n buildResponsiveClassNames(flexDirectionClassNames, direction, responsive),\n spacingClassName('gap', gap),\n className\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardBody = createPolymorphicComponent<CardBodyComponent>(\n CardBodyRender as ForwardRefRenderFunction<Element, CardBodyProps<ElementType>>,\n 'CardBody'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardFooterOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardFooterProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CardFooterOwnProps<C>\n>\n\ntype CardFooterComponent = (<C extends ElementType = 'div'>(\n props: CardFooterProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardFooterRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: CardFooterProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('card-footer', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardFooter = createPolymorphicComponent<CardFooterComponent>(\n CardFooterRender as ForwardRefRenderFunction<Element, CardFooterProps<ElementType>>,\n 'CardFooter'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { Breakpoint } from '../../types'\nimport { buildResponsiveClassNames } from '../../utils/breakpoints'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardImageOrientation = 'top' | 'bottom' | 'start' | 'end'\n\ntype CardImageOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component —\n * e.g. a framework's own `Image` component. Its own props (`src`, `fill`, `priority`, etc.)\n * are type-checked at the call site once passed here.\n */\n component?: C\n /**\n * Orientates the image to the top or bottom of the card as an \"image cap\", or to the start/end\n * for a horizontal layout. Omit to round all four corners for use inside `CardBody`.\n */\n orientation?: CardImageOrientation\n /**\n * Overrides `orientation` at one or more breakpoints — e.g. `{ lg: 'start' }` to switch an\n * image cap from `top` to `start` once the card lays out horizontally.\n */\n responsive?: Partial<Record<Breakpoint, CardImageOrientation>>\n}\n\nexport type CardImageProps<C extends ElementType = 'img'> = PolymorphicComponentProps<\n C,\n CardImageOwnProps<C>\n>\n\ntype CardImageComponent = (<C extends ElementType = 'img'>(\n props: CardImageProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nconst layoutClassNames = (orientation: CardImageOrientation | undefined, prefix: string) => [\n orientation ? `${prefix}card-image-${orientation}` : prefix === '' ? 'card-image' : null\n]\n\nfunction CardImageRender<C extends ElementType = 'img'>(\n { children, className, component, orientation, responsive, ...rest }: CardImageProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'img'\n const _className = classNames(\n buildResponsiveClassNames(layoutClassNames, orientation, responsive),\n className\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardImage = createPolymorphicComponent<CardImageComponent>(\n CardImageRender as ForwardRefRenderFunction<Element, CardImageProps<ElementType>>,\n 'CardImage'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardSubtitleOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardSubtitleProps<C extends ElementType = 'h6'> = PolymorphicComponentProps<\n C,\n CardSubtitleOwnProps<C>\n>\n\ntype CardSubtitleComponent = (<C extends ElementType = 'h6'>(\n props: CardSubtitleProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardSubtitleRender<C extends ElementType = 'h6'>(\n { children, component, className, ...rest }: CardSubtitleProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'h6'\n const _className = classNames('card-subtitle', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardSubtitle = createPolymorphicComponent<CardSubtitleComponent>(\n CardSubtitleRender as ForwardRefRenderFunction<Element, CardSubtitleProps<ElementType>>,\n 'CardSubtitle'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardTextOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardTextProps<C extends ElementType = 'p'> = PolymorphicComponentProps<\n C,\n CardTextOwnProps<C>\n>\n\ntype CardTextComponent = (<C extends ElementType = 'p'>(\n props: CardTextProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardTextRender<C extends ElementType = 'p'>(\n { children, component, className, ...rest }: CardTextProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'p'\n const _className = classNames('card-text', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardText = createPolymorphicComponent<CardTextComponent>(\n CardTextRender as ForwardRefRenderFunction<Element, CardTextProps<ElementType>>,\n 'CardText'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardTitleOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardTitleProps<C extends ElementType = 'h5'> = PolymorphicComponentProps<\n C,\n CardTitleOwnProps<C>\n>\n\ntype CardTitleComponent = (<C extends ElementType = 'h5'>(\n props: CardTitleProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardTitleRender<C extends ElementType = 'h5'>(\n { children, component, className, ...rest }: CardTitleProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'h5'\n const _className = classNames('card-title', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardTitle = createPolymorphicComponent<CardTitleComponent>(\n CardTitleRender as ForwardRefRenderFunction<Element, CardTitleProps<ElementType>>,\n 'CardTitle'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, ReactNode } from 'react'\nimport classNames from 'classnames'\n\nimport { Breakpoint, ContextColor, ContextStyle, Sizing } from '../../types'\nimport {\n buildResponsiveClassNames,\n flexDirectionClassNames,\n FlexDirection\n} from '../../utils/breakpoints'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { CardBody } from './CardBody'\nimport { CardFooter } from './CardFooter'\nimport { CardImage } from './CardImage'\nimport { CardSubtitle } from './CardSubtitle'\nimport { CardText } from './CardText'\nimport { CardTitle } from './CardTitle'\n\ntype CardOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Switches the card from its default stacked (column) layout to a side-by-side (row) layout.\n * Wrap the image and body in `Col` to control each side's width.\n */\n direction?: FlexDirection\n /**\n * Shorthand for a `CardFooter`, rendered after the image/title/subtitle/text/`children` block.\n */\n footer?: ReactNode\n /**\n * Shorthand for a `CardImage` — pass either a `src` URL (combine with `imageAlt`/\n * `imageOrientation`) or a fully-formed element — a `<CardImage>`, `<Skeleton>`,\n * `<Placeholder>`, or anything else — rendered as-is in its place. `imageAlt`/`imageOrientation`\n * only apply to the `src` form; set them directly on your own element otherwise. For a\n * horizontal layout or an overlay, omit this and compose `CardImage` directly as a child\n * instead.\n */\n image?: ReactNode\n /**\n * Accessible alt text for `image`. Ignored unless `image` is set.\n */\n imageAlt?: string\n /**\n * Orientates `image` to the top (default) or bottom of the card.\n */\n imageOrientation?: 'top' | 'bottom'\n /**\n * Overrides `direction` at one or more breakpoints — e.g. `{ lg: 'row' }` to lay the card\n * out horizontally from `lg` up while stacking below it.\n */\n responsive?: Partial<Record<Breakpoint, FlexDirection>>\n /**\n * Sets the size of the component to one of Chassis component sizes.\n */\n size?: Sizing\n /**\n * Shorthand for a `CardSubtitle`, rendered directly after `title`.\n */\n subtitle?: ReactNode\n /**\n * Shorthand for a `CardText`, rendered after `title`/`subtitle`.\n */\n text?: ReactNode\n /**\n * Shorthand for a `CardTitle`. Set alongside `subtitle`/`text` (or plain `children`, e.g. a\n * `Button`) to build a standard card without composing `CardBody`/`CardTitle` yourself — all\n * render together inside a single `CardBody`, in that order. Only takes effect when at least\n * one of `image`/`title`/`subtitle`/`text`/`footer` is set; otherwise `children` render as-is,\n * so full manual composition (`CardHeader`, lists, overlays, nav headers, …) keeps working\n * unchanged. Mixing shorthand props with a manually-composed `children` tree isn't supported —\n * pick one approach per card.\n */\n title?: ReactNode\n /**\n * Sets the context style of the component. `basic` (the default) renders with no extra class.\n */\n variant?: ContextStyle\n}\n\nexport type CardProps<C extends ElementType = 'div'> = PolymorphicComponentProps<C, CardOwnProps<C>>\n\ntype CardComponent = (<C extends ElementType = 'div'>(\n props: CardProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardRender<C extends ElementType = 'div'>(\n {\n children,\n className,\n color,\n component,\n direction,\n footer,\n image,\n imageAlt,\n imageOrientation = 'top',\n responsive,\n size,\n subtitle,\n text,\n title,\n variant,\n ...rest\n }: CardProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n 'card',\n color,\n {\n context: !!color,\n solid: variant === 'solid',\n smooth: variant === 'smooth',\n outline: variant === 'outline',\n sm: size === 'sm',\n lg: size === 'lg'\n },\n buildResponsiveClassNames(flexDirectionClassNames, direction, responsive),\n className\n )\n\n const hasShorthand =\n image != null || title != null || subtitle != null || footer != null || text != null\n const hasBodyContent = title != null || subtitle != null || text != null || children != null\n const renderedImage =\n typeof image === 'string' ? (\n <CardImage orientation={imageOrientation} src={image} alt={imageAlt ?? ''} />\n ) : (\n image\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {hasShorthand ? (\n <>\n {image != null && imageOrientation === 'top' && renderedImage}\n {hasBodyContent && (\n <CardBody>\n {title != null && <CardTitle>{title}</CardTitle>}\n {subtitle != null && <CardSubtitle>{subtitle}</CardSubtitle>}\n {text != null && <CardText>{text}</CardText>}\n {children}\n </CardBody>\n )}\n {image != null && imageOrientation === 'bottom' && renderedImage}\n {footer != null && <CardFooter>{footer}</CardFooter>}\n </>\n ) : (\n children\n )}\n </Component>\n )\n}\n\nexport const Card = createPolymorphicComponent<CardComponent>(\n CardRender as ForwardRefRenderFunction<Element, CardProps<ElementType>>,\n 'Card'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardGroupOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardGroupProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CardGroupOwnProps<C>\n>\n\ntype CardGroupComponent = (<C extends ElementType = 'div'>(\n props: CardGroupProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// Arranges direct-child Cards as an equal-width row, joined edge-to-edge, once its container\n// reaches the sm container breakpoint — below that, cards stack vertically. Requires a\n// `.contains-inline` ancestor (not applied by CardGroup itself, e.g. a wrapping\n// `<div className=\"contains-inline\">`) to establish the container query context.\nfunction CardGroupRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: CardGroupProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('card-group', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardGroup = createPolymorphicComponent<CardGroupComponent>(\n CardGroupRender as ForwardRefRenderFunction<Element, CardGroupProps<ElementType>>,\n 'CardGroup'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardHeaderOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardHeaderProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CardHeaderOwnProps<C>\n>\n\ntype CardHeaderComponent = (<C extends ElementType = 'div'>(\n props: CardHeaderProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardHeaderRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: CardHeaderProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('card-header', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardHeader = createPolymorphicComponent<CardHeaderComponent>(\n CardHeaderRender as ForwardRefRenderFunction<Element, CardHeaderProps<ElementType>>,\n 'CardHeader'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardImageOverlayOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardImageOverlayProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CardImageOverlayOwnProps<C>\n>\n\ntype CardImageOverlayComponent = (<C extends ElementType = 'div'>(\n props: CardImageOverlayProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardImageOverlayRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: CardImageOverlayProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('card-overlay', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardImageOverlay = createPolymorphicComponent<CardImageOverlayComponent>(\n CardImageOverlayRender as ForwardRefRenderFunction<Element, CardImageOverlayProps<ElementType>>,\n 'CardImageOverlay'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { createPolymorphicComponent, PolymorphicRef } from '../../utils/polymorphic'\nimport { Link, LinkProps } from '../link/Link'\n\ntype CardLinkOwnProps = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n}\n\nexport type CardLinkProps<C extends ElementType = 'a'> = LinkProps<C> & CardLinkOwnProps\n\ntype CardLinkComponent = (<C extends ElementType = 'a'>(\n props: CardLinkProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardLinkRender<C extends ElementType = 'a'>(\n { children, className, ...rest }: CardLinkProps<C>,\n ref: PolymorphicRef<C>\n) {\n const _className = classNames('card-link', className)\n\n return (\n <Link\n className={_className}\n {...(rest as Record<string, unknown>)}\n ref={ref as PolymorphicRef<ElementType>}\n >\n {children}\n </Link>\n )\n}\n\nexport const CardLink = createPolymorphicComponent<CardLinkComponent>(\n CardLinkRender as ForwardRefRenderFunction<Element, CardLinkProps<ElementType>>,\n 'CardLink'\n)\n"],"mappings":"mQAoDA,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,YAAW,MAAK,aAAY,GAAG,GACjE,EACA,CACA,IAAM,EAAY,GAAa,MACzB,EAAa,EACjB,YACA,EAA0B,EAAyB,EAAW,CAAU,EACxE,EAAiB,MAAO,CAAG,EAC3B,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,CAEf,CAEA,MAAa,EAAW,EACtB,EACA,UACF,EC7CA,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,GAAG,GACrC,EACA,CACA,IAAM,EAAY,GAAa,MACzB,EAAa,EAAW,cAAe,CAAS,EAEtD,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,CAEf,CAEA,MAAa,EAAa,EACxB,EACA,YACF,ECDM,GAAoB,EAA+C,IAAmB,CAC1F,EAAc,GAAG,EAAO,aAAa,IAAgB,IAAW,GAAK,aAAe,IACtF,EAEA,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,cAAa,aAA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EACA,CACA,IAAM,EAAY,GAAa,MACzB,EAAa,EAAW,eAAgB,CAAS,EAEvD,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,CAEf,CAEA,MAAa,EAAmB,EAC9B,EACA,kBACF,EC3BA,SAAS,EACP,CAAE,WAAU,YAAW,GAAG,GAC1B,EACA,CACA,IAAM,EAAa,EAAW,YAAa,CAAS,EAEpD,OACE,EAAA,cAAC,EAAD,CACE,UAAW,EACX,GAAK,EACA,KAGD,EADH,CACG,CAEV,CAEA,MAAa,EAAW,EACtB,EACA,UACF"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useForkedRef-DVEfT-KI.js";import{n as t}from"./lazyElement-tfMG21pZ.js";import n,{forwardRef as r,useEffect as i,useId as a,useMemo as o,useRef as s,useState as c}from"react";import l from"classnames";import{useCheckbox as u}from"react-aria";import{useToggleState as d}from"react-stately";import{Cell as f,CheckboxContext as p,Column as m,Row as h,Table as g,TableBody as _,TableHeader as v,TableLayout as y,TableLoadMoreItem as b,Virtualizer as x,useSlottedContext as S}from"react-aria-components";const C=/^\d+(\.\d+)?%?$/,w=e=>e!=null&&(typeof e==`number`||C.test(e)),T=(e,t)=>typeof e==`number`?e:e.endsWith(`%`)?parseFloat(e)/100*t:parseFloat(e);function E(e,t){let n=new Map,r=0,i=!0;for(let a of e){if(!i||!w(a.defaultWidth)){i=!1,n.set(a.id,null);continue}let e=T(a.defaultWidth,t);w(a.minWidth)&&(e=Math.max(e,T(a.minWidth,t))),w(a.maxWidth)&&(e=Math.min(e,T(a.maxWidth,t))),n.set(a.id,{id:a.id,offset:r,width:e}),r+=e}return n}const D=e=>{let t=new Map;return e.querySelectorAll(`[role="columnheader"]`).forEach(e=>{let n=Number(e.getAttribute(`aria-colindex`));!Number.isInteger(n)||n<1||t.set(n-1,{offset:e.offsetLeft,width:e.offsetWidth})}),t};function O(e,t){let[n,r]=c(0),[a,s]=c(()=>new Map);i(()=>{let e=t.current;if(!e||typeof ResizeObserver>`u`)return;let n=()=>{r(e.clientWidth),s(D(e))};n();let i=new ResizeObserver(n);return i.observe(e),()=>i.disconnect()},[t]);let l=o(()=>E(e,n),[e,n]);return o(()=>{let t=new Map;return e.forEach((e,n)=>{let r=l.get(e.id),i=a.get(n);r?t.set(e.id,r):i&&t.set(e.id,{id:e.id,...i})}),t},[e,l,a])}const k=e=>`[aria-colindex="${e+1}"]`,A=({header:e,instanceClassName:r,containerRef:a})=>{let s=t(e).props.children,c=o(()=>typeof s==`function`?[]:n.Children.toArray(s),[s]),l=c.map(e=>{if(!n.isValidElement(e))return``;let{defaultWidth:t,maxWidth:r,minWidth:i,pin:a}=e.props;return`${t??``}/${i??``}/${r??``}/${a??``}`}).join(`|`),{all:u,endIndices:d,startIndices:f}=o(()=>{let e={all:[],endIndices:[],startIndices:[]};return c.forEach((t,r)=>{if(!n.isValidElement(t))return;let{defaultWidth:i,maxWidth:a,minWidth:o,pin:s}=t.props;e.all.push({id:r,defaultWidth:i,maxWidth:a,minWidth:o}),s===`start`?e.startIndices.push(r):s===`end`&&e.endIndices.push(r)}),e},[l]),p=O(u,a),m=o(()=>{let e=new Map,t=0;for(let n=d.length-1;n>=0;n--){let r=d[n];if(r==null)continue;let i=p.get(r)?.width??0;e.set(r,{index:r,rightOffset:t}),t+=i}return e},[d,p]);if(i(()=>{let e=a.current;if(!e||m.size===0)return;let t=null,n=new Set,r=()=>{t=null;let r=e.clientWidth,i=e.scrollLeft;e.querySelectorAll(`[role="row"]`).forEach(e=>{m.forEach(({index:t,rightOffset:a})=>{let o=e.querySelector(k(t))?.parentElement;if(!o)return;let s=p.get(t);if(!s)return;let c=s.offset+s.width,l=r-a-c+i;o.style.transform=`translateX(${l}px)`,o.style.zIndex=`2`,n.add(o)})})},i=()=>{t??=requestAnimationFrame(r)};i(),e.addEventListener(`scroll`,i,{passive:!0});let o=typeof ResizeObserver>`u`?null:new ResizeObserver(i);o?.observe(e);let s=typeof MutationObserver>`u`?null:new MutationObserver(i);return s?.observe(e,{childList:!0,subtree:!0}),()=>{t!=null&&cancelAnimationFrame(t),e.removeEventListener(`scroll`,i),o?.disconnect(),s?.disconnect(),n.forEach(e=>{e.style.transform=``,e.style.zIndex=``})}},[a,m,p]),f.length===0&&d.length===0)return null;let h=[];if(f.length>0){let e=Math.max(...f);h.push(`.${r}.datagrid-scrolled-start ${k(e)} { box-shadow: var(--datagrid-pin-cue-shadow-start); }`)}if(d.length>0){let e=Math.min(...d);h.push(`.${r}.datagrid-scrolled-end ${k(e)} { box-shadow: var(--datagrid-pin-cue-shadow-end); }`)}return n.createElement(`style`,null,h.join(`
|
|
2
|
-
`))};var j=class extends y{isStickyColumn(e){let t=e.type===`column`?e.index:e.colIndex??e.index;return t!=null&&this.collection.columns[t]?.props?.pin===`start`}buildRowGroup(...e){let t=super.buildRowGroup(...e);return t.layoutInfo.rect.height=Math.max(0,t.layoutInfo.rect.height),t}};const M=r(({align:t,bordered:r,borderless:u,children:d,className:f,color:p,disabledKeys:m,estimatedRowHeight:h,footer:_,hover:v,onSelectionChange:y,onSortChange:b,rowHeight:S,selectedKeys:C,selectionMode:w=`none`,sm:T,sortDescriptor:E,...D},O)=>{let k=S===`auto`,M=o(()=>new j(k?{estimatedRowHeight:h,headingHeight:h}:{rowHeight:S}),[k,S,h]),N=s(null),P=e(O,N),F=`datagrid-${a().replace(/[^a-zA-Z0-9]/g,``)}`,[I,L]=c(!1),[R,z]=c(!1);i(()=>{let e=N.current;if(!e)return;let t=()=>{L(e.scrollLeft>0),z(Math.ceil(e.scrollLeft+e.clientWidth)<e.scrollWidth)};t(),e.addEventListener(`scroll`,t,{passive:!0});let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),()=>{e.removeEventListener(`scroll`,t),n?.disconnect()}},[]);let B=l(`datagrid`,F,p,{[`align-${t}`]:t,bordered:r,borderless:u,hoverable:v,sm:T,"datagrid-scrolled-start":I,"datagrid-scrolled-end":R},f);return n.createElement(x,{layout:M,shouldObserveItemSize:k},n.createElement(g,{"aria-label":D[`aria-label`],"aria-labelledby":D[`aria-labelledby`],className:B||void 0,disabledKeys:m,onSelectionChange:y,onSortChange:b,ref:P,selectedKeys:C,selectionMode:w,sortDescriptor:E,render:e=>n.createElement(`div`,{...e,"aria-describedby":e[`aria-describedby`]||void 0})},d),_&&n.createElement(`div`,{className:l(`datagrid-footer`,{borderless:u})},_),n.createElement(A,{containerRef:N,header:d[0],instanceClassName:F}))});M.displayName=`DataGrid`;const N={id:`__datagrid-body-loader__`},P=({children:e,className:t,dependencies:r,isLoading:i,items:a,loadingContent:s,onLoadMore:c,renderEmptyState:u})=>{let d=c!=null&&a!=null,f=o(()=>d?[...a,N]:a,[d,a]),p=o(()=>d?[...r??[],i,c,s]:r,[r,d,i,c,s]),m=d?t=>t===N?n.createElement(b,{className:`datagrid-loader`,isLoading:i,onLoadMore:i?void 0:c},s):e(t):e;return n.createElement(_,{className:l(`datagrid-body`,t),dependencies:p,items:f,renderEmptyState:u},m)},F=({children:e,className:t,colSpan:r,id:i,textValue:a})=>n.createElement(f,{className:l(`datagrid-cell`,t),colSpan:r,id:i,textValue:a},e),I=({allowsSorting:e,children:t,className:r,defaultWidth:i,id:a,isRowHeader:o,maxWidth:s,minWidth:c,pin:u,textValue:d})=>n.createElement(m,{allowsSorting:e,className:l(`datagrid-col`,u&&`datagrid-col-pinned-${u}`,r),defaultWidth:i,id:a,isRowHeader:o,maxWidth:s,minWidth:c,textValue:d,pin:u},e?({sortDirection:e})=>n.createElement(n.Fragment,null,t,n.createElement(`span`,{"aria-hidden":`true`,className:`datagrid-sort-icon`},e===`ascending`?`▲`:e===`descending`?`▼`:`⇅`)):t),L=({children:e,className:t,columns:r,dependencies:i})=>n.createElement(v,{className:l(`datagrid-header`,t),columns:r,dependencies:i},e),R=({children:e,className:t,columns:r,id:i,textValue:a})=>n.createElement(h,{className:l(`datagrid-row`,t),columns:r,id:i,textValue:a},e),z=e=>{let t=S(p,`selection`);if(!t)throw Error(`${e} must be rendered inside a DataGrid with selection enabled.`);return t},B=({className:e})=>{let t=z(`DataGridSelectionCell`);return n.createElement(H,{checkboxProps:t,className:e})},V=({className:e})=>{let t=z(`DataGridSelectAllCell`);return n.createElement(H,{checkboxProps:t,className:e})},H=({checkboxProps:e,className:t})=>{let r=d(e),i=s(null),{inputProps:a}=u(e,r,i);return n.createElement(`input`,{...a,"aria-describedby":void 0,className:t??`check-input`,ref:i})};export{I as a,M as c,L as i,B as n,F as o,R as r,P as s,V as t};
|
|
3
|
-
//# sourceMappingURL=datagrid-CH3Cy-q7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datagrid-CH3Cy-q7.js","names":["AriaTable","AriaTableBody","AriaCell","AriaColumn","AriaTableHeader","AriaRow"],"sources":["../../src/components/datagrid/useColumnGeometry.ts","../../src/components/datagrid/DataGridPinBehavior.tsx","../../src/components/datagrid/DataGridTableLayout.ts","../../src/components/datagrid/DataGrid.tsx","../../src/components/datagrid/DataGridBody.tsx","../../src/components/datagrid/DataGridCell.tsx","../../src/components/datagrid/DataGridColumn.tsx","../../src/components/datagrid/DataGridHeader.tsx","../../src/components/datagrid/DataGridRow.tsx","../../src/components/datagrid/DataGridSelectionCell.tsx"],"sourcesContent":["import { RefObject, useEffect, useMemo, useState } from 'react'\nimport { Key } from 'react-aria-components'\nimport { ColumnSize, ColumnStaticSize } from 'react-stately'\n\nexport interface ColumnGeometryColumn {\n /**\n * The column's unique id — matches `DataGridColumn`'s `id`/collection key.\n */\n id: Key\n /**\n * Mirrors `DataGridColumn`'s prop of the same name.\n */\n defaultWidth?: ColumnSize | null\n /**\n * Mirrors `DataGridColumn`'s prop of the same name.\n */\n minWidth?: ColumnStaticSize | null\n /**\n * Mirrors `DataGridColumn`'s prop of the same name.\n */\n maxWidth?: ColumnStaticSize | null\n}\n\nexport interface ColumnOffset {\n id: Key\n /**\n * Cumulative distance in pixels from the start edge of the row to this column's start edge.\n */\n offset: number\n width: number\n}\n\nconst STATIC_SIZE_PATTERN = /^\\d+(\\.\\d+)?%?$/\n\n/**\n * Whether a `ColumnSize` resolves to a definite pixel value without waiting for layout: a plain\n * number, a numeric string (`'150'`), or a percentage string (`'50%'`) — resolvable as soon as\n * the container's own width is known. An `'<n>fr'` string is proportional — it only resolves to\n * pixels once the layout engine has distributed the container's remaining space among every\n * fractional column, so it's excluded here.\n */\nexport const isStaticColumnSize = (size: ColumnSize | null | undefined): size is ColumnStaticSize =>\n size != null && (typeof size === 'number' || STATIC_SIZE_PATTERN.test(size))\n\nconst resolveStaticWidth = (size: ColumnStaticSize, containerWidth: number): number => {\n if (typeof size === 'number') return size\n return size.endsWith('%') ? (parseFloat(size) / 100) * containerWidth : parseFloat(size)\n}\n\n/**\n * Computes cumulative left-edge offsets for a list of columns from their declared\n * `defaultWidth`/`minWidth`/`maxWidth` props, without reading the DOM. Only correct for a column\n * whose own width — and every preceding column's width — is statically resolvable (see\n * `isStaticColumnSize`): a column at or after the first `fr`-sized column has no offset that can\n * be known before layout runs, so it resolves to `null`. Callers should fall back to\n * `useColumnGeometry`'s DOM measurement for those.\n */\nexport function calculateStaticColumnOffsets(\n columns: readonly ColumnGeometryColumn[],\n containerWidth: number\n): Map<Key, ColumnOffset | null> {\n const offsets = new Map<Key, ColumnOffset | null>()\n let offset = 0\n let resolvable = true\n\n for (const column of columns) {\n if (!resolvable || !isStaticColumnSize(column.defaultWidth)) {\n resolvable = false\n offsets.set(column.id, null)\n continue\n }\n\n let width = resolveStaticWidth(column.defaultWidth, containerWidth)\n if (isStaticColumnSize(column.minWidth)) {\n width = Math.max(width, resolveStaticWidth(column.minWidth, containerWidth))\n }\n if (isStaticColumnSize(column.maxWidth)) {\n width = Math.min(width, resolveStaticWidth(column.maxWidth, containerWidth))\n }\n\n offsets.set(column.id, { id: column.id, offset, width })\n offset += width\n }\n\n return offsets\n}\n\ninterface MeasuredRect {\n offset: number\n width: number\n}\n\n/**\n * Measures the mounted column-header cells, keyed by their 0-based column position.\n *\n * Keyed off each cell's own `aria-colindex` (1-based, assigned from the column's position in the\n * resolved collection) rather than its position among the cells that happen to be in the DOM: the\n * layout engine windows columns horizontally as well as rows, so `querySelectorAll` returns only\n * the headers intersecting the horizontal viewport. Matching those positionally to the full column\n * list — as this used to — mapped every column past the first unmounted one onto the wrong rect.\n * A header without the attribute is skipped rather than guessed at.\n */\nconst measureColumnHeaders = (container: HTMLElement): Map<number, MeasuredRect> => {\n const measured = new Map<number, MeasuredRect>()\n container.querySelectorAll<HTMLElement>('[role=\"columnheader\"]').forEach((cell) => {\n const colIndex = Number(cell.getAttribute('aria-colindex'))\n if (!Number.isInteger(colIndex) || colIndex < 1) return\n measured.set(colIndex - 1, { offset: cell.offsetLeft, width: cell.offsetWidth })\n })\n return measured\n}\n\n/**\n * Resolves each column's rendered left-offset and width, independent of the virtualizer's\n * private layout internals. Statically-sized columns (see `isStaticColumnSize`) resolve\n * immediately from their declared props; `fr`-sized (proportional) columns fall back to\n * `ResizeObserver`-measured DOM rects of the mounted `[role=\"columnheader\"]` cells inside\n * `containerRef`, matched to `columns` by `aria-colindex` (see `measureColumnHeaders`), since\n * those only resolve to real pixels after the layout engine has actually distributed space.\n */\nexport function useColumnGeometry(\n columns: readonly ColumnGeometryColumn[],\n containerRef: RefObject<HTMLElement | null>\n): Map<Key, ColumnOffset> {\n const [containerWidth, setContainerWidth] = useState(0)\n const [measured, setMeasured] = useState<Map<number, MeasuredRect>>(() => new Map())\n\n useEffect(() => {\n const container = containerRef.current\n if (!container || typeof ResizeObserver === 'undefined') return\n\n const measure = () => {\n setContainerWidth(container.clientWidth)\n setMeasured(measureColumnHeaders(container))\n }\n\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(container)\n return () => observer.disconnect()\n }, [containerRef])\n\n const staticOffsets = useMemo(\n () => calculateStaticColumnOffsets(columns, containerWidth),\n [columns, containerWidth]\n )\n\n return useMemo(() => {\n const result = new Map<Key, ColumnOffset>()\n columns.forEach((column, index) => {\n const staticOffset = staticOffsets.get(column.id)\n const measuredRect = measured.get(index)\n if (staticOffset) {\n result.set(column.id, staticOffset)\n } else if (measuredRect) {\n result.set(column.id, { id: column.id, ...measuredRect })\n }\n })\n return result\n }, [columns, staticOffsets, measured])\n}\n","import React, { ReactElement, RefObject, useEffect, useMemo } from 'react'\n\nimport { resolveLazy } from '../../utils/lazyElement'\nimport { DataGridColumnProps } from './DataGridColumn'\nimport { DataGridHeaderProps } from './DataGridHeader'\nimport { ColumnGeometryColumn, useColumnGeometry } from './useColumnGeometry'\n\nexport interface DataGridPinBehaviorProps<T> {\n /**\n * The same header element passed as `DataGrid`'s first child. Read directly (rather than via\n * `TableStateContext`) because react-aria-components' virtualized `<Table>` only ever renders\n * DOM output for its own collection-derived tree — an arbitrary extra child (like this\n * component, if it were nested inside `<Table>`) never mounts, regardless of context\n * availability. Only the static-children form of `DataGridHeader` can be introspected this\n * way; the `columns`/render-function form gets no pinned-column behavior from here (`pin=\n * \"start\"`'s positioning still works either way — see `DataGridTableLayout`, which reads pin\n * state off the resolved collection instead, not off this introspection).\n */\n header: ReactElement<DataGridHeaderProps<T>>\n /**\n * A CSS class unique to this `DataGrid` instance, scoping the generated rules below so\n * multiple grids on the same page (with different pinned columns) don't collide.\n */\n instanceClassName: string\n /**\n * Ref to `DataGrid`'s own scrolling root — used both to measure `fr`-sized pinned columns via\n * `useColumnGeometry` and, for `pin=\"end\"`, to find and reposition its cells on scroll (see\n * below).\n */\n containerRef: RefObject<HTMLElement | null>\n}\n\ninterface PinnedColumnInfo {\n index: number\n /** Cumulative width of the end-pinned columns after this one — its distance from the edge. */\n rightOffset: number\n}\n\ninterface DeclaredColumns {\n all: ColumnGeometryColumn[]\n endIndices: number[]\n startIndices: number[]\n}\n\n/**\n * A cell's (1-based) `aria-colindex` for the (0-based) column position it was declared at.\n *\n * Every cell and column header react-aria-components renders carries `aria-colindex`, set from the\n * column's position in the resolved collection — which is the declaration order this component\n * reads off the header's JSX. That makes it the one stable handle from a declared column back to\n * its rendered DOM, and the reason nothing here counts DOM children: the layout engine windows\n * columns horizontally as well as rows (only the cells intersecting the horizontal viewport are\n * mounted, see `datagrid.mdx`'s Scope section), so a row's child count is the size of the mounted\n * window, not the column count. The `nth-child`/`nth-last-child` arithmetic this used to do was\n * therefore only correct while every column happened to be mounted, and silently moved and\n * shadowed the wrong cells in exactly the wide grids pinning exists for.\n */\nconst colIndexSelector = (index: number) => `[aria-colindex=\"${index + 1}\"]`\n\n/**\n * Handles the two things `DataGrid`'s own layout subclass (`DataGridTableLayout`) can't:\n *\n * - `pin=\"end\"`'s positioning. `DataGridTableLayout` reuses the layout engine's own sticky\n * mechanism for `pin=\"start\"`, but that mechanism is hardcoded to the leading edge — there's no\n * upstream hook for a trailing-edge pin. A pure-CSS `position: sticky; right: 0` equivalent\n * doesn't work either: for the *last* child of a horizontally-scrolling container, the browser's\n * own max-scroll bound is defined such that its gap to the viewport's trailing edge never goes\n * negative until the very last pixel of scroll — sticky has nothing to correct until then, so it\n * renders exactly like `position: absolute` for the entire scroll range up to that point (this is\n * a well-known, verified-here CSS limitation, not specific to this layout). So `pin=\"end\"` is\n * positioned imperatively instead: on every scroll (and on mount/resize), each `pin=\"end\"`\n * column's auto-generated wrapper div gets a `transform: translateX(...)` that keeps it flush\n * against the scroll viewport's trailing edge, computed from `useColumnGeometry`'s cumulative\n * offsets, plus the `z-index` that keeps it above the cells it now overlaps. This bypasses React\n * for those two styles, similar to how other virtualized grids (e.g. AG-Grid) handle right-pinned\n * columns — react-aria-components' own layout doesn't re-render an already-mounted cell's style on\n * a plain scroll (its `layoutInfo` doesn't depend on scroll position), so there's no fight between\n * this and React's own reconciliation; newly-mounted rows (from vertical scroll bringing fresh\n * cells into the virtualized window) are covered by the same scroll-driven sync running again.\n * - The scroll-cue box-shadow on the boundary column of each pinned group (the last `pin=\"start\"`\n * column, the first `pin=\"end\"` column) — shown only once the grid has actually scrolled far\n * enough to hide content under it, via the `datagrid-scrolled-start`/`datagrid-scrolled-end`\n * classes `DataGrid` toggles on scroll. This part stays pure CSS since box-shadow, unlike\n * sticky's position offsets, has no \"last child\" gotcha.\n *\n * Rendered as a plain sibling of `DataGrid`'s `<Table>`, not inside it.\n */\nexport const DataGridPinBehavior = <T extends object>({\n header,\n instanceClassName,\n containerRef\n}: DataGridPinBehaviorProps<T>) => {\n // A header written in a Server Component can arrive as a lazy node (see `utils/lazyElement`).\n const headerChildren = resolveLazy(header).props.children\n\n // Re-derived only when a column's own sizing/pin props actually change, not on every parent\n // render: `useColumnGeometry` keys its memoized result off this array's identity, and the\n // scroll-sync effect below keys off that result in turn — rebuilding it unconditionally tore\n // down and re-registered the effect's scroll listener and its two observers on every single\n // `DataGrid` render.\n const columnElements = useMemo(\n () => (typeof headerChildren === 'function' ? [] : React.Children.toArray(headerChildren)),\n [headerChildren]\n )\n const declaredKey = columnElements\n .map((element) => {\n if (!React.isValidElement<DataGridColumnProps>(element)) return ''\n const { defaultWidth, maxWidth, minWidth, pin } = element.props\n return `${defaultWidth ?? ''}/${minWidth ?? ''}/${maxWidth ?? ''}/${pin ?? ''}`\n })\n .join('|')\n\n const {\n all: allColumns,\n endIndices,\n startIndices\n } = useMemo<DeclaredColumns>(() => {\n const declared: DeclaredColumns = { all: [], endIndices: [], startIndices: [] }\n columnElements.forEach((element, index) => {\n if (!React.isValidElement<DataGridColumnProps>(element)) return\n const { defaultWidth, maxWidth, minWidth, pin } = element.props\n declared.all.push({ id: index, defaultWidth, maxWidth, minWidth })\n if (pin === 'start') declared.startIndices.push(index)\n else if (pin === 'end') declared.endIndices.push(index)\n })\n return declared\n // `declaredKey` is the value-based identity of `columnElements` — a fresh JSX array every\n // render, so its own reference can't be the dependency.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [declaredKey])\n\n const offsets = useColumnGeometry(allColumns, containerRef)\n\n // Cumulative width of the end-pinned columns after this one, keyed by column index — how far\n // from the viewport's trailing edge each one needs to sit so they stack correctly.\n const endPinnedInfo = useMemo(() => {\n const info = new Map<number, PinnedColumnInfo>()\n let right = 0\n for (let i = endIndices.length - 1; i >= 0; i--) {\n const index = endIndices[i]\n if (index == null) continue\n const width = offsets.get(index)?.width ?? 0\n info.set(index, { index, rightOffset: right })\n right += width\n }\n return info\n }, [endIndices, offsets])\n\n useEffect(() => {\n const container = containerRef.current\n if (!container || endPinnedInfo.size === 0) return\n\n let frame: number | null = null\n // The wrappers this effect has written inline styles onto, so they can be handed back\n // unstyled when it tears down — un-pinning a column at runtime (or unmounting this behavior\n // while the grid stays) otherwise left its cells stuck at their last scroll offset.\n const styled = new Set<HTMLElement>()\n\n const sync = () => {\n frame = null\n const clientWidth = container.clientWidth\n const scrollLeft = container.scrollLeft\n const rows = container.querySelectorAll<HTMLElement>('[role=\"row\"]')\n rows.forEach((row) => {\n endPinnedInfo.forEach(({ index, rightOffset }) => {\n const cell = row.querySelector<HTMLElement>(colIndexSelector(index))\n const wrapper = cell?.parentElement\n if (!wrapper) return\n const offset = offsets.get(index)\n if (!offset) return\n const rightEdge = offset.offset + offset.width\n const delta = clientWidth - rightOffset - rightEdge + scrollLeft\n wrapper.style.transform = `translateX(${delta}px)`\n // Above the unpinned cells it now overlaps. Set here rather than in the generated\n // stylesheet below because the virtualizer writes the wrapper's own `z-index` inline,\n // which no plain rule can outrank without `!important`.\n wrapper.style.zIndex = '2'\n styled.add(wrapper)\n })\n })\n }\n\n const scheduleSync = () => {\n if (frame == null) frame = requestAnimationFrame(sync)\n }\n\n scheduleSync()\n container.addEventListener('scroll', scheduleSync, { passive: true })\n const resizeObserver =\n typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(scheduleSync)\n resizeObserver?.observe(container)\n const mutationObserver =\n typeof MutationObserver === 'undefined' ? null : new MutationObserver(scheduleSync)\n mutationObserver?.observe(container, { childList: true, subtree: true })\n\n return () => {\n if (frame != null) cancelAnimationFrame(frame)\n container.removeEventListener('scroll', scheduleSync)\n resizeObserver?.disconnect()\n mutationObserver?.disconnect()\n styled.forEach((wrapper) => {\n wrapper.style.transform = ''\n wrapper.style.zIndex = ''\n })\n }\n }, [containerRef, endPinnedInfo, offsets])\n\n if (startIndices.length === 0 && endIndices.length === 0) return null\n\n const rules: string[] = []\n\n if (startIndices.length > 0) {\n const lastStartIndex = Math.max(...startIndices)\n rules.push(\n `.${instanceClassName}.datagrid-scrolled-start ${colIndexSelector(lastStartIndex)} { box-shadow: var(--datagrid-pin-cue-shadow-start); }`\n )\n }\n\n if (endIndices.length > 0) {\n const firstEndIndex = Math.min(...endIndices)\n rules.push(\n `.${instanceClassName}.datagrid-scrolled-end ${colIndexSelector(firstEndIndex)} { box-shadow: var(--datagrid-pin-cue-shadow-end); }`\n )\n }\n\n return <style>{rules.join('\\n')}</style>\n}\n","import { TableLayout } from 'react-aria-components'\n\ninterface StickyColumnNode {\n type: string\n index: number\n colIndex?: number | null\n}\n\n/**\n * `DataGrid`'s own subclass of react-aria-components' `TableLayout`, overriding the (protected,\n * hardcoded-`false` upstream) `isStickyColumn` hook so a `pin=\"start\"` `DataGridColumn` uses the\n * layout engine's own sticky-positioning machinery — the same mechanism that already makes the\n * header row pin to the top (`buildTableHeader` sets `layoutInfo.isSticky = true` unconditionally\n * there). The subclass exists instead of a pure-CSS `position: sticky` override because\n * react-aria-components' own `TableLayout` never overrides `isStickyColumn`, so no column becomes\n * visually sticky by default — and because the engine, not CSS, owns each cell wrapper's `left`.\n *\n * `pin=\"end\"` isn't handled here — the engine's sticky positioning is hardcoded to the leading\n * edge (`position: sticky; left: ...`, mirrored to `right` only for RTL *direction*, never per\n * column), so there's no upstream mechanism to reuse for a trailing pin in an LTR grid. See\n * `DataGrid.scss`'s `nth-last-child`-based rules for that half instead.\n */\nexport class DataGridTableLayout<T> extends TableLayout<T> {\n protected isStickyColumn(node: StickyColumnNode): boolean {\n const colIndex = node.type === 'column' ? node.index : (node.colIndex ?? node.index)\n if (colIndex == null) return false\n const column = this.collection.columns[colIndex]\n return (column?.props as { pin?: 'start' | 'end' } | undefined)?.pin === 'start'\n }\n\n // An empty body fills the viewport below the header. On the server the viewport has no size,\n // so the body came out as tall as minus the header (`height: -40px`), which CSS doesn't allow.\n protected buildRowGroup(...args: Parameters<TableLayout<T>['buildRowGroup']>) {\n const group = super.buildRowGroup(...args)\n group.layoutInfo.rect.height = Math.max(0, group.layoutInfo.rect.height)\n return group\n }\n}\n","import React, {\n ReactElement,\n ReactNode,\n Ref,\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState\n} from 'react'\nimport classNames from 'classnames'\nimport {\n Key,\n Selection,\n SortDescriptor,\n Table as AriaTable,\n Virtualizer\n} from 'react-aria-components'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { ContextColor } from '../../types'\nimport { DataGridBodyProps } from './DataGridBody'\nimport { DataGridHeaderProps } from './DataGridHeader'\nimport { DataGridPinBehavior } from './DataGridPinBehavior'\nimport { DataGridTableLayout } from './DataGridTableLayout'\nimport './DataGrid.scss'\n\n// No `striped`/`stacked` props: zebra-striping via CSS `:nth-of-type` (Table's approach) isn't\n// virtualization-safe — a windowed row's DOM siblings are only the currently-mounted rows, not\n// every logical row, so the stripe parity would flip as the mounted window's starting index\n// changes during scroll. A correct implementation needs the row's real index at render time, not\n// a pure-CSS trick; deferred rather than shipped broken.\ninterface DataGridOwnProps<T extends object> {\n /**\n * An accessible label for the grid, used when there's no visible heading.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible heading element for the grid.\n */\n 'aria-labelledby'?: string\n /**\n * Set the vertical alignment of cell content. Mirrors `Table`'s prop of the same name for API\n * parity — same as `Table`, this awaits chassis-css adding the matching `.align-*` styles.\n */\n align?: 'bottom' | 'middle' | 'top'\n /**\n * Add borders on all sides of the grid and cells.\n */\n bordered?: boolean\n /**\n * Remove borders on all sides of the grid and cells.\n */\n borderless?: boolean\n /**\n * A `DataGridHeader` and a `DataGridBody`, each built from `DataGridColumn`/`DataGridRow`/\n * `DataGridCell`.\n */\n children: [ReactElement<DataGridHeaderProps<T>>, ReactElement<DataGridBodyProps<T>>]\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component.\n */\n color?: ContextColor\n /**\n * A list of row keys to disable. Disabled rows cannot be selected, focused, or interacted with.\n */\n disabledKeys?: Iterable<Key>\n /**\n * Content shown below the grid, e.g. a totals row or a \"load more\" control. Rendered as plain\n * markup outside the grid's own scrollable/virtualized region — not part of the\n * keyboard-navigable grid, and never scrolls out of view along with the body rows. Mirrors\n * `Table`'s `footer` prop for API parity.\n */\n footer?: ReactNode\n /**\n * Enable a hover state on grid rows.\n */\n hover?: boolean\n /**\n * Handler that is called when the selection changes.\n */\n onSelectionChange?: (keys: Selection) => void\n /**\n * Handler that is called when a column is sorted.\n */\n onSortChange?: (descriptor: SortDescriptor) => void\n /**\n * The currently selected row keys (controlled).\n */\n selectedKeys?: Selection\n /**\n * The type of selection that is allowed.\n */\n selectionMode?: 'none' | 'single' | 'multiple'\n /**\n * Make the grid more compact by cutting all cell padding.\n */\n sm?: boolean\n /**\n * The current sort column and direction.\n */\n sortDescriptor?: SortDescriptor\n}\n\ntype DataGridRowHeightProps =\n | {\n /**\n * Row height in pixels, or `\"auto\"` to measure each row from its own rendered content\n * instead of a single fixed height shared by every row (pair it with a required\n * `estimatedRowHeight`, and see the docs site's \"Variable row height\" section for the\n * tradeoffs). A fixed number renders every row, including the header, at that exact\n * height; content taller than it visually overflows rather than growing the row.\n */\n rowHeight: number\n estimatedRowHeight?: never\n }\n | {\n rowHeight: 'auto'\n /**\n * Seeds the virtualizer's scroll-position math for rows that haven't been measured yet.\n * Required when `rowHeight=\"auto\"` — pick a value close to the typical row's real height\n * to minimize scroll-jump on first measurement. A row's real height can still turn out far\n * from this estimate once it renders, which can cause a visible scroll-jump for rows the\n * viewport hasn't reached yet.\n */\n estimatedRowHeight: number\n }\n\nexport type DataGridProps<T extends object> = DataGridOwnProps<T> & DataGridRowHeightProps\n\nconst DataGridInner = <T extends object>(\n {\n align,\n bordered,\n borderless,\n children,\n className,\n color,\n disabledKeys,\n estimatedRowHeight,\n footer,\n hover,\n onSelectionChange,\n onSortChange,\n rowHeight,\n selectedKeys,\n selectionMode = 'none',\n sm,\n sortDescriptor,\n ...rest\n }: DataGridProps<T>,\n forwardedRef: Ref<HTMLDivElement>\n) => {\n const isVariableRowHeight = rowHeight === 'auto'\n const layout = useMemo(\n () =>\n new DataGridTableLayout<T>(\n // `headingHeight` is pinned to `estimatedRowHeight` (fixed, not itself an estimate) in\n // variable-height mode — leaving it unset falls back to `estimatedRowHeight` as an\n // *estimate* for the header too, which sounds harmless but isn't: the header's own\n // sticky-positioned outer wrapper (built once in `buildTableHeader`, see\n // `DataGridTableLayout`'s doc comment for why the header is sticky at all) is never\n // recomputed when a column-header cell's later real measurement corrects its height, so\n // the outer wrapper's stale height desyncs from the cell's real one, spilling header\n // content into the body's first row instead of the header growing to fit it. Fixing the\n // header's height sidesteps that gap instead of shipping it.\n isVariableRowHeight\n ? { estimatedRowHeight, headingHeight: estimatedRowHeight }\n : { rowHeight }\n ),\n [isVariableRowHeight, rowHeight, estimatedRowHeight]\n )\n const gridRef = useRef<HTMLDivElement>(null)\n const ref = useForkedRef(forwardedRef, gridRef)\n\n // A stable per-instance class, scoping DataGridPinBehavior's generated CSS so multiple grids on\n // the same page (each with their own pinned columns) don't collide.\n const rawId = useId()\n const instanceClassName = `datagrid-${rawId.replace(/[^a-zA-Z0-9]/g, '')}`\n\n // Drives the pin=start/pin=end scroll-cue box-shadow — see DataGridPinBehavior — which should\n // only appear once there's actually hidden content under the pinned column to cue.\n const [scrolledStart, setScrolledStart] = useState(false)\n const [scrolledEnd, setScrolledEnd] = useState(false)\n\n useEffect(() => {\n const grid = gridRef.current\n if (!grid) return\n\n const updateScrollState = () => {\n setScrolledStart(grid.scrollLeft > 0)\n setScrolledEnd(Math.ceil(grid.scrollLeft + grid.clientWidth) < grid.scrollWidth)\n }\n\n updateScrollState()\n grid.addEventListener('scroll', updateScrollState, { passive: true })\n const observer =\n typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(updateScrollState)\n observer?.observe(grid)\n return () => {\n grid.removeEventListener('scroll', updateScrollState)\n observer?.disconnect()\n }\n }, [])\n\n const _className = classNames(\n 'datagrid',\n instanceClassName,\n color,\n {\n [`align-${align}`]: align,\n bordered,\n borderless,\n hoverable: hover,\n sm,\n 'datagrid-scrolled-start': scrolledStart,\n 'datagrid-scrolled-end': scrolledEnd\n },\n className\n )\n\n return (\n <Virtualizer layout={layout} shouldObserveItemSize={isVariableRowHeight}>\n <AriaTable\n aria-label={rest['aria-label']}\n aria-labelledby={rest['aria-labelledby']}\n className={_className || undefined}\n disabledKeys={disabledKeys}\n onSelectionChange={onSelectionChange}\n onSortChange={onSortChange}\n ref={ref}\n selectedKeys={selectedKeys}\n selectionMode={selectionMode}\n sortDescriptor={sortDescriptor}\n // react-aria joins the grid's descriptions without dropping an empty result, so a grid\n // with none had `aria-describedby=\"\"`.\n render={(props) => (\n <div\n {...(props as React.ComponentProps<'div'>)}\n aria-describedby={props['aria-describedby'] || undefined}\n />\n )}\n >\n {children}\n </AriaTable>\n {footer && <div className={classNames('datagrid-footer', { borderless })}>{footer}</div>}\n <DataGridPinBehavior\n containerRef={gridRef}\n header={children[0]}\n instanceClassName={instanceClassName}\n />\n </Virtualizer>\n )\n}\n\n// `forwardRef` erases type parameters, so the generic component is cast back to a generic\n// signature for callers — same pattern `Table` uses.\nexport const DataGrid = forwardRef(DataGridInner) as <T extends object>(\n props: DataGridProps<T> & { ref?: Ref<HTMLDivElement> }\n) => ReactElement\n\n;(DataGrid as { displayName?: string }).displayName = 'DataGrid'\n","import React, { ReactElement, ReactNode, useMemo } from 'react'\nimport classNames from 'classnames'\nimport {\n TableBody as AriaTableBody,\n TableBodyRenderProps,\n TableLoadMoreItem\n} from 'react-aria-components'\n\n// A unique value appended to `items` internally to represent the trailing \"load more\" row in\n// react-aria-components' collection. `TableLoadMoreItem` has to be returned from the per-item\n// render function like any other row — react-aria-components' `useCachedChildren` only supports\n// EITHER `items` + a render function OR static `children`, never a mix of both in the same\n// `children` prop, so a `<TableLoadMoreItem>` placed as a plain JSX sibling inside `<TableBody>`\n// is silently dropped (or crashes, if `children` becomes an array mixing the render function in).\n// Checked by reference (`item === LOADER_ITEM`), so it can never collide with a real `T` the way a\n// `{ __loader: true }` marker object might if compared structurally. Its `id` matters too, not\n// just its identity: react-aria-components derives each rendered item's React key from\n// `rendered.props.id ?? item?.key ?? item?.id ?? <positional index>` (`useCachedChildren`) —\n// `TableLoadMoreItem` doesn't accept an `id` prop itself, so without this object's own `id` the\n// loader's key falls back to its position in the array, which collides with a real row whenever a\n// row's own `id` happens to equal that count (e.g. a 2-item list with a row literally id `\"2\"`).\nconst LOADER_ITEM = { id: '__datagrid-body-loader__' }\n\ninterface DataGridBodyOwnProps {\n /**\n * A string of all className you want applied to the body row group.\n */\n className?: string\n /**\n * Values that should invalidate the row cache when using the `items`/render-function form of\n * `children` — e.g. a value from outside `items` that the render function reads. Without this,\n * changing that outside value won't re-render already-cached rows, since dynamic rows are only\n * rebuilt when `items` or `dependencies` change by reference, not on every parent re-render.\n */\n dependencies?: ReadonlyArray<unknown>\n /**\n * Content shown in place of rows when `items` is empty.\n */\n renderEmptyState?: (props: TableBodyRenderProps) => React.ReactNode\n}\n\n/**\n * The `items` + render-function form. `isLoading`/`loadingContent`/`onLoadMore` live here rather\n * than alongside the static form because the loader row is generated by appending to `items` and\n * rendering through that same function — there's no growing dataset to load more of, and nothing\n * to render the loader with, in a hand-written list of `DataGridRow` elements.\n */\ninterface DataGridBodyDynamicProps<T> {\n /**\n * A render function called once per item in `items`, returning that row's `DataGridRow`.\n */\n children: (item: T) => ReactElement\n /**\n * Whether more items are currently being fetched. Shows `loadingContent` in the loader row while\n * true, and — until this goes back to `false` — suppresses further `onLoadMore` calls, so one\n * scroll-into-view doesn't fire the callback again before the in-flight fetch resolves.\n */\n isLoading?: boolean\n /**\n * A list of row data objects, rendered via the function form of `children`.\n */\n items: Iterable<T>\n /**\n * Content rendered inside the loader row while `isLoading` is true, e.g. a spinner. Only takes\n * effect alongside `onLoadMore`.\n */\n loadingContent?: ReactNode\n /**\n * Called when the grid scrolls near its last row, so more data can be fetched and appended to\n * `items`. Pair with `isLoading` so a fetch already in flight isn't triggered again before it\n * resolves.\n */\n onLoadMore?: () => void\n}\n\n/** The static form: `DataGridRow` elements written out directly. */\ninterface DataGridBodyStaticProps {\n /**\n * `DataGridRow` elements.\n */\n children: ReactElement | ReactElement[]\n isLoading?: never\n items?: never\n loadingContent?: never\n onLoadMore?: never\n}\n\n/**\n * Split into a static and a dynamic form so the two can't be mixed: the loader row is appended to\n * `items` and rendered through `children`, so `onLoadMore` alongside a static list of elements used\n * to type-check and then throw at render (\"children is not a function\") the moment the loader row\n * came up.\n */\nexport type DataGridBodyProps<T> = DataGridBodyOwnProps &\n (DataGridBodyDynamicProps<T> | DataGridBodyStaticProps)\n\n/**\n * Body row group for `DataGrid`, containing `DataGridRow`s. Unlike `Table`'s sub-parts, this\n * renders directly — it's a thin wrapper over react-aria-components' own `TableBody`.\n *\n * Always carries the `datagrid-body` class — see `DataGridHeader`'s equivalent note.\n */\nexport const DataGridBody = <T extends object>({\n children,\n className,\n dependencies,\n isLoading,\n items,\n loadingContent,\n onLoadMore,\n renderEmptyState\n}: DataGridBodyProps<T>) => {\n const hasLoader = onLoadMore != null && items != null\n\n const itemsWithLoader = useMemo(() => {\n if (!hasLoader) return items\n return [...(items as Iterable<T>), LOADER_ITEM] as Iterable<T>\n }, [hasLoader, items])\n\n // react-aria-components caches each rendered row by item identity (see `dependencies`'s own doc\n // comment above) — the loader branch below reads `isLoading`/`onLoadMore`/`loadingContent`, none\n // of which are part of `items`, so without surfacing them here the cached loader row would keep\n // whatever `isLoading` value (and stale `onLoadMore` closure) was in scope the first time it\n // rendered, never picking up a later change.\n const dependenciesWithLoader = useMemo(\n () =>\n hasLoader ? [...(dependencies ?? []), isLoading, onLoadMore, loadingContent] : dependencies,\n [dependencies, hasLoader, isLoading, onLoadMore, loadingContent]\n )\n\n const bodyChildren = hasLoader\n ? (item: T) =>\n (item as unknown) === LOADER_ITEM ? (\n <TableLoadMoreItem\n className=\"datagrid-loader\"\n isLoading={isLoading}\n // Suppresses re-triggering onLoadMore while a fetch is already in flight — the\n // underlying sentinel has no built-in debounce of its own and calls onLoadMore again\n // whenever it (re-)observes the sentinel still intersecting, e.g. after the collection\n // changes but the loader row hasn't yet scrolled out of view.\n onLoadMore={isLoading ? undefined : onLoadMore}\n >\n {loadingContent}\n </TableLoadMoreItem>\n ) : (\n // `hasLoader` implies the dynamic form of the props union, whose `children` is the\n // render function — `onLoadMore` isn't assignable alongside static children.\n (children as (item: T) => ReactElement)(item)\n )\n : children\n\n return (\n <AriaTableBody\n className={classNames('datagrid-body', className)}\n dependencies={dependenciesWithLoader}\n items={itemsWithLoader}\n renderEmptyState={renderEmptyState}\n >\n {bodyChildren}\n </AriaTableBody>\n )\n}\n","import React, { ReactNode } from 'react'\nimport { Key, Cell as AriaCell } from 'react-aria-components'\nimport classNames from 'classnames'\n\nexport interface DataGridCellProps {\n /**\n * The contents of the cell.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the cell.\n */\n className?: string\n /**\n * Indicates how many columns the cell spans.\n */\n colSpan?: number\n /**\n * The unique id of the cell.\n */\n id?: Key\n /**\n * A string representation of the cell's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * A cell within a `DataGrid` row. Unlike `Table`'s sub-parts, this renders directly — it's a\n * thin wrapper over react-aria-components' own `Cell`.\n */\nexport const DataGridCell = ({\n children,\n className,\n colSpan,\n id,\n textValue\n}: DataGridCellProps) => (\n <AriaCell\n className={classNames('datagrid-cell', className)}\n colSpan={colSpan}\n id={id}\n textValue={textValue}\n >\n {children}\n </AriaCell>\n)\n","import React, { ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { Key, Column as AriaColumn } from 'react-aria-components'\nimport { ColumnSize, ColumnStaticSize } from 'react-stately'\n\nexport interface DataGridColumnProps {\n /**\n * Whether the column allows sorting. Adds a sort indicator and makes the header\n * clickable/keyboard-activatable.\n */\n allowsSorting?: boolean\n /**\n * Rendered contents of the column header.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the column header.\n */\n className?: string\n /**\n * The initial width of the column, e.g. for a narrow selection/icon column — a plain number or\n * `'<n>%'` for a fixed size, or `'<n>fr'` to share remaining space with other fractional\n * columns in proportion (columns default to `'1fr'`, so they split space evenly unless given\n * one of these). Unlike `Table`, which sizes a narrow column via `width: 1%` relying on native\n * `<table>` auto-layout, `DataGrid`'s virtualized layout computes every column's width itself —\n * a CSS `width` rule on the cell has no effect, so this prop is the only way to size a column.\n */\n defaultWidth?: ColumnSize | null\n /**\n * The unique id of the column, referenced by `sortDescriptor.column`.\n */\n id?: Key\n /**\n * Whether this column is a row header, announced by assistive technology during row\n * navigation.\n */\n isRowHeader?: boolean\n /**\n * The maximum width of the column, as a fixed pixel number or `'<n>%'`.\n */\n maxWidth?: ColumnStaticSize | null\n /**\n * The minimum width of the column, as a fixed pixel number or `'<n>%'`.\n */\n minWidth?: ColumnStaticSize | null\n /**\n * Pin the column so it stays visible while the grid scrolls horizontally: `'start'` pins it to\n * the leading edge, `'end'` to the trailing edge. Stacks correctly with other pinned columns on\n * the same side, in declaration order.\n */\n pin?: 'start' | 'end'\n /**\n * A string representation of the column header, used for accessibility announcements. Defaults\n * to `children` when it's a plain string — set this explicitly when the header contains\n * anything else (an icon, a `Tooltip`, etc.).\n */\n textValue?: string\n}\n\n/**\n * A column within `DataGrid`. Unlike `Table`'s sub-parts, this renders directly — it's a thin\n * wrapper over react-aria-components' own `Column`.\n *\n * When `allowsSorting` is set, renders a sort indicator after `children` — mirrors `Table`'s own\n * `TableColumnHeader`, but reads the active direction from react-aria-components' own\n * `ColumnRenderProps` (via the `children` render-prop form) instead of reaching into table state\n * directly, since this wrapper has no state of its own to read.\n */\nexport const DataGridColumn = ({\n allowsSorting,\n children,\n className,\n defaultWidth,\n id,\n isRowHeader,\n maxWidth,\n minWidth,\n pin,\n textValue\n}: DataGridColumnProps) => (\n <AriaColumn\n allowsSorting={allowsSorting}\n className={classNames('datagrid-col', pin && `datagrid-col-pinned-${pin}`, className)}\n defaultWidth={defaultWidth}\n id={id}\n isRowHeader={isRowHeader}\n maxWidth={maxWidth}\n minWidth={minWidth}\n textValue={textValue}\n // `pin` isn't a react-aria-components `Column` prop, but its collection builder preserves\n // the full props object it's given verbatim (see react-stately's `Column.getCollectionNode`)\n // — passing it through here is what makes it reach `column.props.pin` in\n // `DataGridTableLayout`'s `isStickyColumn` override, which is what positions `pin=\"start\"`.\n // `pin=\"end\"` is handled separately by `DataGridPinBehavior`, which reads the same prop off\n // the header's JSX rather than the resolved collection.\n {...({ pin } as Record<string, unknown>)}\n >\n {allowsSorting\n ? ({ sortDirection }) => (\n <>\n {children}\n <span aria-hidden=\"true\" className=\"datagrid-sort-icon\">\n {sortDirection === 'ascending' ? '▲' : sortDirection === 'descending' ? '▼' : '⇅'}\n </span>\n </>\n )\n : children}\n </AriaColumn>\n)\n","import React, { ReactElement, ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { TableHeader as AriaTableHeader } from 'react-aria-components'\n\nexport interface DataGridHeaderProps<T> {\n /**\n * `DataGridColumn` elements, or a render function paired with `columns` for dynamic column\n * generation.\n */\n children: ReactNode | ((column: T) => ReactElement)\n /**\n * A string of all className you want applied to the header row group.\n */\n className?: string\n /**\n * A list of column data objects, rendered via the function form of `children`.\n */\n columns?: Iterable<T>\n /**\n * Values that should invalidate the column cache when using the `columns`/render-function form\n * of `children` — see `DataGridBody`'s `dependencies` for why this matters.\n */\n dependencies?: ReadonlyArray<unknown>\n}\n\n/**\n * Header row group for `DataGrid`, containing `DataGridColumn`s. Unlike `Table`'s sub-parts,\n * this renders directly — it's a thin wrapper over react-aria-components' own `TableHeader`.\n *\n * Always carries the `datagrid-header` class (not just the caller's `className`) — `DataGrid.scss`\n * uses it to tell header cells from body cells, since react-aria-components renders both as plain\n * `[role=\"rowgroup\"]` divs with no structural difference to select on otherwise.\n */\nexport const DataGridHeader = <T extends object>({\n children,\n className,\n columns,\n dependencies\n}: DataGridHeaderProps<T>) => (\n <AriaTableHeader\n className={classNames('datagrid-header', className)}\n columns={columns}\n dependencies={dependencies}\n >\n {children}\n </AriaTableHeader>\n)\n","import React, { ReactElement, ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { Key, Row as AriaRow } from 'react-aria-components'\n\nexport interface DataGridRowProps<T> {\n /**\n * `DataGridCell` elements, or a render function called once per column with that column's\n * data — required when the row's parent `DataGridBody` uses the `items`/render-function form.\n */\n children: ReactNode | ((column: T) => ReactElement)\n /**\n * A string of all className you want applied to the row.\n */\n className?: string\n /**\n * A list of column data objects, rendered via the function form of `children`.\n */\n columns?: Iterable<T>\n /**\n * The unique id of the row, referenced by `selectedKeys`/`disabledKeys`.\n */\n id?: Key\n /**\n * A string representation of the row's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * A row within `DataGrid`. Unlike `Table`'s sub-parts, this renders directly — it's a thin\n * wrapper over react-aria-components' own `Row`.\n */\nexport const DataGridRow = <T extends object>({\n children,\n className,\n columns,\n id,\n textValue\n}: DataGridRowProps<T>) => (\n <AriaRow\n className={classNames('datagrid-row', className)}\n columns={columns}\n id={id}\n textValue={textValue}\n >\n {children}\n </AriaRow>\n)\n","import React, { useRef } from 'react'\nimport { AriaCheckboxProps, useCheckbox } from 'react-aria'\nimport { useToggleState } from 'react-stately'\nimport { CheckboxContext, CheckboxProps, useSlottedContext } from 'react-aria-components'\n\nexport interface DataGridSelectionCellProps {\n /**\n * A string of all className you want applied to the checkbox, replacing the default\n * `check-input`.\n */\n className?: string\n}\n\n/**\n * Reads the selection checkbox props react-aria-components' own `Row`/`TableHeader` publish on\n * `CheckboxContext`'s `selection` slot — the same ones its `<Checkbox slot=\"selection\">` would\n * consume, already carrying the localized label, the row-header `aria-labelledby`, and the\n * selected/disabled/indeterminate state.\n *\n * Reading them off that context (rather than calling react-aria's `useTableSelectionCheckbox`/\n * `useTableSelectAllCheckbox` against `TableStateContext` ourselves, as this file used to) is what\n * keeps this working when more than one copy of `react-aria` is installed. Those hooks resolve the\n * grid's id through a module-scoped `WeakMap` that only `useTable` populates, in whichever copy\n * ran it — always the copy bundled inside `react-aria-components` here, since its `Table` is what\n * calls `useTable`. `react-aria-components` pins `react-aria` to an exact version, so a consumer\n * whose own `react-aria` resolves anywhere else in our `^` range gets a second copy and the lookup\n * throws `Error: Unknown grid` on every selection cell. Letting react-aria-components compute the\n * props in its own copy sidesteps that entirely, and drops the duplicated `rowKey` this component\n * used to need — the context is already scoped to the row it's rendered in, so a `rowKey` that\n * disagreed with the surrounding `DataGridRow` can no longer silently toggle a different row.\n */\nconst useSelectionCheckboxProps = (component: string): AriaCheckboxProps => {\n const props = useSlottedContext(CheckboxContext, 'selection') as CheckboxProps | null | undefined\n if (!props) {\n throw new Error(`${component} must be rendered inside a DataGrid with selection enabled.`)\n }\n return props as AriaCheckboxProps\n}\n\n/**\n * Selection checkbox for one `DataGrid` row — place inside a `DataGridCell`.\n *\n * react-aria-components' own `Checkbox` always visually hides its native `<input>` behind a custom\n * indicator the caller must supply. This renders a plain native `<input className=\"check-input\">`\n * instead, wired to the same state, so it picks up chassis-css's existing checkbox styling for\n * free with no new CSS of its own.\n */\nexport const DataGridSelectionCell = ({ className }: DataGridSelectionCellProps) => {\n const checkboxProps = useSelectionCheckboxProps('DataGridSelectionCell')\n return <DataGridCheckboxInput checkboxProps={checkboxProps} className={className} />\n}\n\n/**\n * \"Select all\" checkbox for `DataGrid`'s header row — place inside a `DataGridColumn`. See\n * `DataGridSelectionCell` for why this bypasses react-aria-components' own `Checkbox`.\n */\nexport const DataGridSelectAllCell = ({ className }: DataGridSelectionCellProps) => {\n const checkboxProps = useSelectionCheckboxProps('DataGridSelectAllCell')\n return <DataGridCheckboxInput checkboxProps={checkboxProps} className={className} />\n}\n\nconst DataGridCheckboxInput = ({\n checkboxProps,\n className\n}: {\n checkboxProps: AriaCheckboxProps\n className?: string\n}) => {\n const toggleState = useToggleState(checkboxProps)\n const ref = useRef<HTMLInputElement>(null)\n const { inputProps } = useCheckbox(checkboxProps, toggleState, ref)\n\n // `aria-describedby` after the spread: react-aria's own adds ids it never renders (FORMS.md,\n // gotcha 6).\n return (\n <input\n {...inputProps}\n aria-describedby={undefined}\n className={className ?? 'check-input'}\n ref={ref}\n />\n )\n}\n"],"mappings":"yiBAgCA,MAAM,EAAsB,kBASf,EAAsB,GACjC,GAAQ,OAAS,OAAO,GAAS,UAAY,EAAoB,KAAK,CAAI,GAEtE,GAAsB,EAAwB,IAC9C,OAAO,GAAS,SAAiB,EAC9B,EAAK,SAAS,GAAG,EAAK,WAAW,CAAI,EAAI,IAAO,EAAiB,WAAW,CAAI,EAWzF,SAAgB,EACd,EACA,EAC+B,CAC/B,IAAM,EAAU,IAAI,IAChB,EAAS,EACT,EAAa,GAEjB,IAAK,IAAM,KAAU,EAAS,CAC5B,GAAI,CAAC,GAAc,CAAC,EAAmB,EAAO,YAAY,EAAG,CAC3D,EAAa,GACb,EAAQ,IAAI,EAAO,GAAI,IAAI,EAC3B,QACF,CAEA,IAAI,EAAQ,EAAmB,EAAO,aAAc,CAAc,EAC9D,EAAmB,EAAO,QAAQ,IACpC,EAAQ,KAAK,IAAI,EAAO,EAAmB,EAAO,SAAU,CAAc,CAAC,GAEzE,EAAmB,EAAO,QAAQ,IACpC,EAAQ,KAAK,IAAI,EAAO,EAAmB,EAAO,SAAU,CAAc,CAAC,GAG7E,EAAQ,IAAI,EAAO,GAAI,CAAE,GAAI,EAAO,GAAI,SAAQ,OAAM,CAAC,EACvD,GAAU,CACZ,CAEA,OAAO,CACT,CAiBA,MAAM,EAAwB,GAAsD,CAClF,IAAM,EAAW,IAAI,IAMrB,OALA,EAAU,iBAA8B,uBAAuB,CAAC,CAAC,QAAS,GAAS,CACjF,IAAM,EAAW,OAAO,EAAK,aAAa,eAAe,CAA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AuB,EACvE,OAAO,EAAA,cAAC,EAAD,CAAsC,gBAA0B,WAAY,CAAA,CACrF,EAMa,GAAyB,CAAE,eAA4C,CAClF,IAAM,EAAgB,EAA0B,uBAAuB,EACvE,OAAO,EAAA,cAAC,EAAD,CAAsC,gBAA0B,WAAY,CAAA,CACrF,EAEM,GAAyB,CAC7B,gBACA,eAII,CACJ,IAAM,EAAc,EAAe,CAAa,EAC1C,EAAM,EAAyB,IAAI,EACnC,CAAE,cAAe,EAAY,EAAe,EAAa,CAAG,EAIlE,OACE,EAAA,cAAC,QAAD,CACE,GAAI,EACJ,mBAAkB,IAAA,GAClB,UAAW,GAAa,cACnB,KACN,CAAA,CAEL"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./polymorphic-BhGNZQja.js";import{t}from"./breakpoints-o_2Ev7ir.js";import{t as n}from"./spacingClassName-DVhk8m3P.js";import r from"react";import i from"classnames";const a=({direction:e,wrap:t,justify:r,align:i,alignContent:a,gap:o,rowGap:s,columnGap:c},l)=>[e&&`${l}flex-${e}`,t&&`${l}flex-${t}`,r&&`${l}justify-content-${r}`,i&&`${l}align-items-${i}`,a&&`${l}align-content-${a}`,n(`gap`,o,l),n(`row-gap`,s,l),n(`column-gap`,c,l)];function o({children:e,className:n,component:o,inline:s,direction:c,wrap:l,justify:u,align:d,alignContent:f,gap:p,rowGap:m,columnGap:h,responsive:g,..._},v){let y=o??`div`,b=i(s?`d-inline-flex`:`d-flex`,t(a,{direction:c,wrap:l,justify:u,align:d,alignContent:f,gap:p,rowGap:m,columnGap:h},g),n);return r.createElement(y,{className:b,..._,ref:v},e)}const s=e(o,`Flex`);export{s as t};
|
|
2
|
-
//# sourceMappingURL=flex-CmlJbKVj.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flex-CmlJbKVj.js","names":[],"sources":["../../src/components/flex/Flex.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { buildResponsiveClassNames } from '../../utils/breakpoints'\nimport { spacingClassName } from '../../utils/spacingClassName'\nimport { Breakpoint, Spacing } from '../../types'\n\nexport interface FlexLayout {\n /**\n * Sets `flex-direction`. Omit for the browser default (`row`).\n */\n direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse'\n /**\n * Sets `flex-wrap`. Omit for the browser default (`nowrap`).\n */\n wrap?: 'wrap' | 'nowrap' | 'wrap-reverse'\n /**\n * Sets `justify-content`, aligning items along the main axis.\n */\n justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly'\n /**\n * Sets `align-items`, aligning items along the cross axis.\n */\n align?: 'start' | 'end' | 'center' | 'baseline' | 'stretch'\n /**\n * Sets `align-content`, distributing wrapped lines along the cross axis. Has no effect on\n * single-line (non-wrapping) containers.\n */\n alignContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'stretch'\n /**\n * Spacing between children on both axes, mapped to the `gap-*` utility classes. Overridden per\n * axis by `rowGap`/`columnGap` where set.\n */\n gap?: Spacing | 0\n /**\n * Spacing between rows (the cross axis when wrapped), mapped to the `row-gap-*` utility\n * classes. Independent of `gap`/`columnGap`.\n */\n rowGap?: Spacing | 0\n /**\n * Spacing between columns (the main axis), mapped to the `column-gap-*` utility classes.\n * Independent of `gap`/`rowGap`.\n */\n columnGap?: Spacing | 0\n}\n\ntype FlexOwnProps<C extends ElementType> = FlexLayout & {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Renders an inline flex container (`.d-inline-flex`) instead of a block-level one (`.d-flex`,\n * the default).\n */\n inline?: boolean\n /**\n * Overrides any of `direction`/`wrap`/`justify`/`align`/`alignContent`/`gap`/`rowGap`/\n * `columnGap` at one or more breakpoints, via regular viewport media queries (unlike `Stack`'s\n * `responsive` prop, this doesn't require a `.contains-inline` ancestor).\n */\n responsive?: Partial<Record<Breakpoint, FlexLayout>>\n}\n\nexport type FlexProps<C extends ElementType = 'div'> = PolymorphicComponentProps<C, FlexOwnProps<C>>\n\ntype FlexComponent = (<C extends ElementType = 'div'>(\n props: FlexProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nconst layoutClassNames = (\n { direction, wrap, justify, align, alignContent, gap, rowGap, columnGap }: FlexLayout,\n prefix: string\n) => [\n direction && `${prefix}flex-${direction}`,\n wrap && `${prefix}flex-${wrap}`,\n justify && `${prefix}justify-content-${justify}`,\n align && `${prefix}align-items-${align}`,\n alignContent && `${prefix}align-content-${alignContent}`,\n spacingClassName('gap', gap, prefix),\n spacingClassName('row-gap', rowGap, prefix),\n spacingClassName('column-gap', columnGap, prefix)\n]\n\nfunction FlexRender<C extends ElementType = 'div'>(\n {\n children,\n className,\n component,\n inline,\n direction,\n wrap,\n justify,\n align,\n alignContent,\n gap,\n rowGap,\n columnGap,\n responsive,\n ...rest\n }: FlexProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n inline ? 'd-inline-flex' : 'd-flex',\n buildResponsiveClassNames(\n layoutClassNames,\n { direction, wrap, justify, align, alignContent, gap, rowGap, columnGap },\n responsive\n ),\n className\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const Flex = createPolymorphicComponent<FlexComponent>(\n FlexRender as ForwardRefRenderFunction<Element, FlexProps<ElementType>>,\n 'Flex'\n)\n"],"mappings":"0NA+EA,MAAM,GACJ,CAAE,YAAW,OAAM,UAAS,QAAO,eAAc,MAAK,SAAQ,aAC9D,IACG,CACH,GAAa,GAAG,EAAO,OAAO,IAC9B,GAAQ,GAAG,EAAO,OAAO,IACzB,GAAW,GAAG,EAAO,kBAAkB,IACvC,GAAS,GAAG,EAAO,cAAc,IACjC,GAAgB,GAAG,EAAO,gBAAgB,IAC1C,EAAiB,MAAO,EAAK,CAAM,EACnC,EAAiB,UAAW,EAAQ,CAAM,EAC1C,EAAiB,aAAc,EAAW,CAAM,CAClD,EAEA,SAAS,EACP,CACE,WACA,YACA,YACA,SACA,YACA,OACA,UACA,QACA,eACA,MACA,SACA,YACA,aACA,GAAG,GAEL,EACA,CACA,IAAM,EAAY,GAAa,MACzB,EAAa,EACjB,EAAS,gBAAkB,SAC3B,EACE,EACA,CAAE,YAAW,OAAM,UAAS,QAAO,eAAc,MAAK,SAAQ,WAAU,EACxE,CACF,EACA,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,CAEf,CAEA,MAAa,EAAO,EAClB,EACA,MACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{v as e}from"./slot-CNhFZdHF.js";import{t}from"./polymorphic-BhGNZQja.js";import{t as n}from"./breakpoints-o_2Ev7ir.js";import{t as r}from"./spacingClassName-DVhk8m3P.js";import i,{forwardRef as a}from"react";import o from"classnames";const s=({span:e,offset:t,order:n},r)=>[typeof e==`number`||typeof e==`string`?`${r}col-${e}`:null,e===!0?`${r}col`:null,typeof t==`number`||typeof t==`string`?`${r}offset-${t}`:null,typeof n==`number`||typeof n==`string`?`${r}order-${n}`:null],c=a(({children:t,className:r,span:a,offset:c,order:l,responsive:u,...d},f)=>{e(!0,`Col: Row and Col are deprecated with the flexbox grid of @chassis-ui/css, use Grid and GridItem instead. They will be removed in a future major version.`);let p=n(s,{span:a,offset:c,order:l},u),m=o(a===void 0&&`col`,p,r);return i.createElement(`div`,{className:m,...d,ref:f},t)});c.displayName=`Col`;function l({children:e,className:t,component:n,fluidUntil:r,fluid:a,...s},c){let l=n??`div`,u=o(`container`,a&&`fluid`,r,t);return i.createElement(l,{className:u,...s,ref:c},e)}const u=t(l,`Container`),d=new Set([`zero`,`4xs`,`3xs`,`2xs`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`]),f=(e,t=``)=>e!==void 0&&d.has(e)?`${t}gap-${e}`:null,p=e=>e!==void 0&&!d.has(e)?e:void 0,m=e=>e!==void 0&&Number.isInteger(e)&&e>=1&&e<=12;function h({children:e,className:t,component:r,columns:a,rows:s,gap:c,responsive:l,fill:u,min:d,style:h,...g},_){let v=r??`div`,y=m(a),b=o(u?`grid-fill`:`grid`,n(({columns:e,gap:t},n)=>[!u&&e!==void 0&&`${n}grid-cols-${e}`,f(t,n)],{columns:y?a:void 0,gap:c},l),t),x={...h},S=p(c);return S!==void 0&&(x[`--cx-grid-gap`]=S),u?d!==void 0&&(x[`--cx-grid-min`]=d):(a!==void 0&&!y&&(x[`--cx-grid-columns`]=a),s!==void 0&&(x[`--cx-grid-rows`]=s)),i.createElement(v,{className:b,style:x,...g,ref:_},e)}const g=t(h,`Grid`),_=({span:e,start:t,rowSpan:n,rowStart:r},i)=>[e===void 0?null:`${i}col-span-${e}`,t===void 0?null:`${i}col-start-${t}`,n===void 0?null:`${i}row-span-${n}`,r===void 0?null:`${i}row-start-${r}`];function v({children:e,className:t,component:r,span:a,start:s,rowSpan:c,rowStart:l,responsive:u,subgrid:d,rows:m,gap:h,style:g,...v},y){let b=r??`div`,x=o(n(_,{span:a,start:s,rowSpan:c,rowStart:l},u),d&&`grid grid-cols-subgrid`,d&&f(h),t),S={...g};if(d){m!==void 0&&(S[`--cx-grid-rows`]=m);let e=p(h);e!==void 0&&(S[`--cx-grid-gap`]=e)}return i.createElement(b,{className:x,style:S,...v,ref:y},e)}const y=t(v,`GridItem`),b=({cols:e,gutter:t,gutterX:n,gutterY:i},a)=>[e?`${a}row-cols-${e}`:null,r(`g`,t,a),r(`gx`,n,a),r(`gy`,i,a)],x=a(({children:t,className:r,cols:a,gutter:s,gutterX:c,gutterY:l,responsive:u,...d},f)=>{e(!0,`Row: Row and Col are deprecated with the flexbox grid of @chassis-ui/css, use Grid and GridItem instead. They will be removed in a future major version.`);let p=o(`row`,n(b,{cols:a,gutter:s,gutterX:c,gutterY:l},u),r);return i.createElement(`div`,{className:p,...d,ref:f},t)});x.displayName=`Row`;export{c as a,u as i,y as n,g as r,x as t};
|
|
2
|
-
//# sourceMappingURL=grid-DK_vxz-4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grid-DK_vxz-4.js","names":["layoutClassNames","layoutClassNames"],"sources":["../../src/components/grid/Col.tsx","../../src/components/grid/Container.tsx","../../src/types.ts","../../src/components/grid/gap.ts","../../src/components/grid/Grid.tsx","../../src/components/grid/GridItem.tsx","../../src/components/grid/Row.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nimport { Span, buildResponsiveClassNames } from '../../utils/breakpoints'\nimport { devWarning } from '../../utils/devWarning'\nimport { Breakpoint } from '../../types'\n\nexport interface ColLayout {\n /**\n * Columns (of 12) this Col spans, or `'auto'`/`true` for a natural-width column.\n *\n * @type { 'auto' | number | string | boolean }\n */\n span?: Span\n /**\n * Columns to offset the start of this Col by.\n */\n offset?: number | string\n /**\n * Visual order relative to sibling columns.\n *\n * @type { 'first' | 'last' | number | string }\n */\n order?: 'first' | 'last' | number | string\n}\n\n/**\n * @deprecated Use `GridItemProps`: `Col` is deprecated with the flexbox grid of `@chassis-ui/css`.\n */\nexport interface ColProps extends HTMLAttributes<HTMLDivElement>, ColLayout {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Overrides `span`/`offset`/`order` at a breakpoint and up.\n *\n * @type { Partial<Record<'sm' | 'md' | 'lg' | 'xl' | '2xl', { span?: 'auto' | number | string | boolean, offset?: number | string, order?: 'first' | 'last' | number | string }>> }\n */\n responsive?: Partial<Record<Breakpoint, ColLayout>>\n}\n\nconst layoutClassNames = ({ span, offset, order }: ColLayout, prefix: string) => [\n typeof span === 'number' || typeof span === 'string' ? `${prefix}col-${span}` : null,\n span === true ? `${prefix}col` : null,\n typeof offset === 'number' || typeof offset === 'string' ? `${prefix}offset-${offset}` : null,\n typeof order === 'number' || typeof order === 'string' ? `${prefix}order-${order}` : null\n]\n\n/**\n * @deprecated Use `GridItem` in a `Grid`, with `start` for `offset`. A column as wide as its\n * content (`span=\"auto\"`) has no grid equivalent: use `Flex`. `@chassis-ui/css` deprecates its\n * flexbox grid (`.row`, `.col-*`) in 0.6 and removes it in 0.7, and `Col` goes with it.\n */\nexport const Col = forwardRef<HTMLDivElement, ColProps>(\n ({ children, className, span, offset, order, responsive, ...rest }, ref) => {\n devWarning(\n true,\n 'Col: Row and Col are deprecated with the flexbox grid of @chassis-ui/css, use Grid and ' +\n 'GridItem instead. They will be removed in a future major version.'\n )\n\n const layoutClassList = buildResponsiveClassNames(\n layoutClassNames,\n { span, offset, order },\n responsive\n )\n\n // The base breakpoint only gets its equal-width flex sizing from an explicit `span` (base or\n // `col`'s own class) or from the fallback bare `col` below — `offset`/`order` alone (or a\n // `span` set only inside `responsive`) don't provide it, so without this the column would\n // render at `flex: 0 1 auto` instead of a proper flexible column below the first tier that\n // sets a span.\n const _className = classNames(span === undefined && 'col', layoutClassList, className)\n\n return (\n <div className={_className} {...rest} ref={ref}>\n {children}\n </div>\n )\n }\n)\n\nCol.displayName = 'Col'\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { Breakpoint } from '../../types'\n\ntype ContainerOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Set container 100% wide until the given breakpoint, after which it scales up with `max-width`\n * at every larger breakpoint.\n *\n * @type Breakpoint\n */\n fluidUntil?: Breakpoint\n /**\n * Set container 100% wide, spanning the entire width of the viewport.\n */\n fluid?: boolean\n}\n\nexport type ContainerProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ContainerOwnProps<C>\n>\n\ntype ContainerComponent = (<C extends ElementType = 'div'>(\n props: ContainerProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ContainerRender<C extends ElementType = 'div'>(\n { children, className, component, fluidUntil, fluid, ...rest }: ContainerProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('container', fluid && 'fluid', fluidUntil, className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const Container = createPolymorphicComponent<ContainerComponent>(\n ContainerRender as ForwardRefRenderFunction<Element, ContainerProps<ElementType>>,\n 'Container'\n)\n","/**\n * Breakpoints\n */\nexport type Breakpoint = 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\n/**\n * Context colors\n */\nexport type ContextColor =\n | 'default'\n | 'alternate'\n | 'primary'\n | 'secondary'\n | 'neutral'\n | 'success'\n | 'danger'\n | 'warning'\n | 'info'\n | 'black'\n | 'white'\n\n/**\n * Context styles\n */\nexport type ContextStyle = 'basic' | 'solid' | 'outline' | 'smooth'\n\n/**\n * Component sizes\n */\nexport type Sizing = 'sm' | 'md' | 'lg'\n\n/**\n * Extended sizes\n */\nexport type ExtendedSizing = '2xs' | 'xs' | Sizing | 'xl' | '2xl'\n\n/**\n * Spacing values. `SPACING` is the runtime source of truth — `Spacing` is derived from it so the\n * two can't drift apart; anything needing the values at runtime (e.g. validating a string against\n * the scale) should import `SPACING`, not hand-copy the list.\n */\nexport const SPACING = [\n 'zero',\n '4xs',\n '3xs',\n '2xs',\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl'\n] as const\n\nexport type Spacing = (typeof SPACING)[number]\n\n/**\n * Font families\n */\nexport type FontFamily = 'text' | 'display' | 'code' | 'html'\n\n/**\n * Font weights\n */\nexport type FontWeight = 'elegant' | 'normal' | 'strong' | 'mass'\n\n/**\n * Font sizes\n */\nexport type FontSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl'\n\n/**\n * Component placements\n */\nexport type Placements =\n | 'auto'\n | 'auto-start'\n | 'auto-end'\n | 'top-end'\n | 'top'\n | 'top-start'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'left-start'\n | 'left'\n | 'left-end'\n\n/**\n * Component shapes\n */\nexport type Shapes =\n | 'rounded'\n | 'rounded-top'\n | 'rounded-end'\n | 'rounded-bottom'\n | 'rounded-start'\n | 'rounded-circle'\n | 'rounded-pill'\n | 'rounded-0'\n | 'rounded-1'\n | 'rounded-2'\n | 'rounded-3'\n\nexport type TextColor =\n | ContextColor\n | 'main'\n | 'subtle'\n | 'slight'\n | 'solid'\n | 'inverse'\n | 'highlight'\n | 'active'\n | 'contrast'\n\nexport type Triggers = 'hover' | 'focus' | 'click'\n","import { SPACING } from '../../types'\n\nconst SPACING_TOKENS = new Set<string>(SPACING)\n\n// A `Spacing` token is chassis-css's own `gap-{token}` utility, which a breakpoint prefix makes\n// responsive. Anything else (a raw CSS value, e.g. `\"1rem\"` or `\".25rem 1rem\"`) has no class and\n// goes to the `--cx-grid-gap` custom property instead: see `gapValue`.\nexport const gapClassName = (gap: string | undefined, prefix = ''): string | null =>\n gap !== undefined && SPACING_TOKENS.has(gap) ? `${prefix}gap-${gap}` : null\n\nexport const gapValue = (gap: string | undefined): string | undefined =>\n gap !== undefined && !SPACING_TOKENS.has(gap) ? gap : undefined\n","import React, { CSSProperties, ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { buildResponsiveClassNames } from '../../utils/breakpoints'\nimport { Breakpoint, Spacing } from '../../types'\nimport { gapClassName, gapValue } from './gap'\n\ntype GridStyle = CSSProperties & {\n '--cx-grid-columns'?: number\n '--cx-grid-rows'?: number\n '--cx-grid-gap'?: string\n '--cx-grid-min'?: string\n}\n\nexport interface GridLayout {\n /**\n * Number of columns in the grid template from this breakpoint up, mapped to the\n * `grid-cols-{n}` class (1 to 12). Has no effect when `fill` is set.\n */\n columns?: number\n /**\n * Gap between grid items from this breakpoint up, mapped to the `gap-{token}` class.\n */\n gap?: Spacing\n}\n\ntype GridOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Number of columns in the grid template (the column count of `@chassis-ui/css` when omitted,\n * `12` by default). A count from 1 to 12 is mapped to the `grid-cols-{n}` class, which applies\n * to this grid alone. Any other count has no class and is set via the `--cx-grid-columns`\n * custom property, which a grid nested in this one inherits: give that grid `columns` of its\n * own. Has no effect when `fill` is set.\n */\n columns?: number\n /**\n * Number of rows in the grid template, set via the `--cx-grid-rows` custom property (defaults\n * to `1` in CSS when omitted). Has no effect when `fill` is set.\n */\n rows?: number\n /**\n * Gap between grid items: a `Spacing` token (mapped to the `gap-{token}` class) or any raw CSS\n * `gap` value, including a `\"{row} {column}\"` pair (set via the `--cx-grid-gap` custom\n * property). The gutter of the current breakpoint when omitted.\n *\n * @type { Spacing | string }\n */\n gap?: Spacing | (string & {})\n /**\n * Overrides `columns`/`gap` at a breakpoint and up, with the `grid-cols-{n}` and `gap-{token}`\n * classes.\n *\n * @type { Partial<Record<'sm' | 'md' | 'lg' | 'xl' | '2xl', { columns?: number, gap?: Spacing }>> }\n */\n responsive?: Partial<Record<Breakpoint, GridLayout>>\n /**\n * Renders `.grid-fill` instead of `.grid` — columns expand equally to fill the available\n * width, with the column count determined by the number of children rather than `columns`.\n */\n fill?: boolean\n /**\n * Minimum column width of a `fill` grid, set via the `--cx-grid-min` custom property: any CSS\n * length, e.g. `\"12rem\"`. Children wrap to a new row when they would get narrower. Only\n * relevant when `fill` is set.\n */\n min?: string\n}\n\nexport type GridProps<C extends ElementType = 'div'> = PolymorphicComponentProps<C, GridOwnProps<C>>\n\n// chassis-css has `grid-cols-1` to `grid-cols-12`.\nconst hasColumnsClass = (columns: number | undefined) =>\n columns !== undefined && Number.isInteger(columns) && columns >= 1 && columns <= 12\n\ntype GridComponent = (<C extends ElementType = 'div'>(\n props: GridProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction GridRender<C extends ElementType = 'div'>(\n {\n children,\n className,\n component,\n columns,\n rows,\n gap,\n responsive,\n fill,\n min,\n style,\n ...rest\n }: GridProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n\n // A class where chassis-css has one: `--cx-grid-columns` set inline is inherited by every grid\n // nested in this one, which then has this grid's column count instead of its own. Only a base\n // count with no class falls back to the property; a breakpoint's can't, since an inline style\n // holds no media query. `.grid-fill` counts its own columns.\n const columnsClass = hasColumnsClass(columns)\n\n const layoutClassNames = (\n { columns, gap }: { columns?: number; gap?: string },\n prefix: string\n ) => [\n !fill && columns !== undefined && `${prefix}grid-cols-${columns}`,\n gapClassName(gap, prefix)\n ]\n\n const _className = classNames(\n fill ? 'grid-fill' : 'grid',\n buildResponsiveClassNames(\n layoutClassNames,\n { columns: columnsClass ? columns : undefined, gap },\n responsive\n ),\n className\n )\n\n const _style: GridStyle = { ...style }\n const _gap = gapValue(gap)\n\n if (_gap !== undefined) _style['--cx-grid-gap'] = _gap\n\n if (fill) {\n if (min !== undefined) _style['--cx-grid-min'] = min\n } else {\n if (columns !== undefined && !columnsClass) _style['--cx-grid-columns'] = columns\n if (rows !== undefined) _style['--cx-grid-rows'] = rows\n }\n\n return (\n <Component className={_className} style={_style} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const Grid = createPolymorphicComponent<GridComponent>(\n GridRender as ForwardRefRenderFunction<Element, GridProps<ElementType>>,\n 'Grid'\n)\n","import React, { CSSProperties, ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { buildResponsiveClassNames } from '../../utils/breakpoints'\nimport { Breakpoint, Spacing } from '../../types'\nimport { gapClassName, gapValue } from './gap'\n\ntype GridItemStyle = CSSProperties & {\n '--cx-grid-rows'?: number\n '--cx-grid-gap'?: string\n}\n\nexport interface GridItemLayout {\n /**\n * Number of grid column tracks (of the parent `<Grid>`'s `columns`) this item spans, mapped to\n * the `col-span-{n}` class, or `'full'` for every track of the row (`col-span-full`). An item\n * with no `span` is one track wide.\n *\n * @type { number | 'full' }\n */\n span?: number | 'full'\n /**\n * Grid column line to start this item at, mapped to the `col-start-{n}` class. `'auto'`\n * (`col-start-auto`) returns the item to the flow, to undo a start line at a wider breakpoint.\n *\n * @type { number | 'auto' }\n */\n start?: number | 'auto'\n /**\n * Number of grid row tracks this item spans, mapped to the `row-span-{n}` class.\n */\n rowSpan?: number\n /**\n * Grid row line to start this item at, mapped to the `row-start-{n}` class, or `'auto'`\n * (`row-start-auto`) to return it to the flow.\n *\n * @type { number | 'auto' }\n */\n rowStart?: number | 'auto'\n}\n\ntype GridItemOwnProps<C extends ElementType> = GridItemLayout & {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Overrides `span`/`start`/`rowSpan`/`rowStart` at a breakpoint and up.\n *\n * @type { Partial<Record<'sm' | 'md' | 'lg' | 'xl' | '2xl', { span?: number | 'full', start?: number | 'auto', rowSpan?: number, rowStart?: number | 'auto' }>> }\n */\n responsive?: Partial<Record<Breakpoint, GridItemLayout>>\n /**\n * Turns this item into a nested subgrid: adds `.grid`/`.grid-cols-subgrid` alongside its\n * `col-span-{n}`/`col-start-{n}` placement classes, so its own children inherit the parent\n * `<Grid>`'s column tracks instead of defining new ones. Combine with `span` — a subgrid\n * item must itself be a grid item of the parent for `grid-template-columns: subgrid` to take\n * effect, which is why `subgrid` lives on `<GridItem>` (the element actually placed as a grid\n * item) rather than on a `<Grid>` nested inside it.\n */\n subgrid?: boolean\n /**\n * Number of rows in the subgrid's own row template, set via the `--cx-grid-rows` custom\n * property (defaults to `1` in CSS when omitted). Only relevant when `subgrid` is set —\n * subgrid only inherits the parent's column tracks, not its rows.\n */\n rows?: number\n /**\n * Gap between the subgrid's children: a `Spacing` token (mapped to the `gap-{token}` class) or\n * any raw CSS `gap` value (set via the `--cx-grid-gap` custom property). Only relevant when\n * `subgrid` is set. A subgrid has the gap of its own: when the parent `<Grid>` takes a `gap`\n * token, give the subgrid the same one, or its children are narrower than the parent's tracks.\n *\n * @type { Spacing | string }\n */\n gap?: Spacing | (string & {})\n}\n\nexport type GridItemProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n GridItemOwnProps<C>\n>\n\ntype GridItemComponent = (<C extends ElementType = 'div'>(\n props: GridItemProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nconst layoutClassNames = ({ span, start, rowSpan, rowStart }: GridItemLayout, prefix: string) => [\n span === undefined ? null : `${prefix}col-span-${span}`,\n start === undefined ? null : `${prefix}col-start-${start}`,\n rowSpan === undefined ? null : `${prefix}row-span-${rowSpan}`,\n rowStart === undefined ? null : `${prefix}row-start-${rowStart}`\n]\n\nfunction GridItemRender<C extends ElementType = 'div'>(\n {\n children,\n className,\n component,\n span,\n start,\n rowSpan,\n rowStart,\n responsive,\n subgrid,\n rows,\n gap,\n style,\n ...rest\n }: GridItemProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n buildResponsiveClassNames(layoutClassNames, { span, start, rowSpan, rowStart }, responsive),\n subgrid && 'grid grid-cols-subgrid',\n subgrid && gapClassName(gap),\n className\n )\n\n const _style: GridItemStyle = { ...style }\n\n if (subgrid) {\n if (rows !== undefined) _style['--cx-grid-rows'] = rows\n const _gap = gapValue(gap)\n if (_gap !== undefined) _style['--cx-grid-gap'] = _gap\n }\n\n return (\n <Component className={_className} style={_style} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const GridItem = createPolymorphicComponent<GridItemComponent>(\n GridItemRender as ForwardRefRenderFunction<Element, GridItemProps<ElementType>>,\n 'GridItem'\n)\n","import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nimport { buildResponsiveClassNames } from '../../utils/breakpoints'\nimport { devWarning } from '../../utils/devWarning'\nimport { spacingClassName } from '../../utils/spacingClassName'\nimport { Breakpoint, Spacing } from '../../types'\n\nexport interface RowLayout {\n /**\n * Equal-width columns per row, or `'auto'` for content-sized columns.\n *\n * @type { 'auto' | number | string }\n */\n cols?: 'auto' | number | string\n /**\n * Gutter width on both axes.\n *\n * @type { Spacing | 0 }\n */\n gutter?: Spacing | 0\n /**\n * Horizontal gutter width.\n *\n * @type { Spacing | 0 }\n */\n gutterX?: Spacing | 0\n /**\n * Vertical gutter width.\n *\n * @type { Spacing | 0 }\n */\n gutterY?: Spacing | 0\n}\n\n/**\n * @deprecated Use `GridProps`: `Row` is deprecated with the flexbox grid of `@chassis-ui/css`.\n */\nexport interface RowProps extends HTMLAttributes<HTMLDivElement>, RowLayout {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Overrides `cols`/`gutter`/`gutterX`/`gutterY` at a breakpoint and up.\n *\n * @type { Partial<Record<'sm' | 'md' | 'lg' | 'xl' | '2xl', { cols?: 'auto' | number | string, gutter?: Spacing | 0, gutterX?: Spacing | 0, gutterY?: Spacing | 0 }>> }\n */\n responsive?: Partial<Record<Breakpoint, RowLayout>>\n}\n\nconst layoutClassNames = ({ cols, gutter, gutterX, gutterY }: RowLayout, prefix: string) => [\n cols ? `${prefix}row-cols-${cols}` : null,\n spacingClassName('g', gutter, prefix),\n spacingClassName('gx', gutterX, prefix),\n spacingClassName('gy', gutterY, prefix)\n]\n\n/**\n * @deprecated Use `Grid`, with `columns` for `cols` and `gap` for `gutter`. `@chassis-ui/css`\n * deprecates its flexbox grid (`.row`, `.col-*`) in 0.6 and removes it in 0.7, and `Row` goes\n * with it.\n */\nexport const Row = forwardRef<HTMLDivElement, RowProps>(\n ({ children, className, cols, gutter, gutterX, gutterY, responsive, ...rest }, ref) => {\n devWarning(\n true,\n 'Row: Row and Col are deprecated with the flexbox grid of @chassis-ui/css, use Grid and ' +\n 'GridItem instead. They will be removed in a future major version.'\n )\n\n const _className = classNames(\n 'row',\n buildResponsiveClassNames(layoutClassNames, { cols, gutter, gutterX, gutterY }, responsive),\n className\n )\n\n return (\n <div className={_className} {...rest} ref={ref}>\n {children}\n </div>\n )\n }\n)\n\nRow.displayName = 'Row'\n"],"mappings":"kRA0CA,MAAMA,GAAoB,CAAE,OAAM,SAAQ,SAAoB,IAAmB,CAC/E,OAAO,GAAS,UAAY,OAAO,GAAS,SAAW,GAAG,EAAO,MAAM,IAAS,KAChF,IAAS,GAAO,GAAG,EAAO,KAAO,KACjC,OAAO,GAAW,UAAY,OAAO,GAAW,SAAW,GAAG,EAAO,SAAS,IAAW,KACzF,OAAO,GAAU,UAAY,OAAO,GAAU,SAAW,GAAG,EAAO,QAAQ,IAAU,IACvF,EAOa,EAAM,GAChB,CAAE,WAAU,YAAW,OAAM,SAAQ,QAAO,aAAY,GAAG,GAAQ,IAAQ,CAC1E,EACE,GACA,0JAEF,EAEA,IAAM,EAAkB,EACtBA,EACA,CAAE,OAAM,SAAQ,OAAM,EACtB,CACF,EAOM,EAAa,EAAW,IAAS,IAAA,IAAa,MAAO,EAAiB,CAAS,EAErF,OACE,EAAA,cAAC,MAAD,CAAK,UAAW,EAAY,GAAI,EAAW,KAEtC,EADF,CACE,CAET,CACF,EAEA,EAAI,YAAc,MC1ClB,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,aAAY,QAAO,GAAG,GACxD,EACA,CACA,IAAM,EAAY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,EAAA,cAAC,MAAD,CAAK,UAAW,EAAY,GAAI,EAAW,KAEtC,EADF,CACE,CAET,CACF,EAEA,EAAI,YAAc"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import "./focus-ring-SR_LwaN7.js";
|
|
2
|
-
import { n as PolymorphicRef, t as PolymorphicComponentProps } from "./polymorphic-CVHbTHSN.js";
|
|
3
|
-
import { s as Spacing, t as Breakpoint } from "./types-CS_40Txv.js";
|
|
4
|
-
import { ElementType, ReactElement } from "react";
|
|
5
|
-
//#region src/components/flex/Flex.d.ts
|
|
6
|
-
interface FlexLayout {
|
|
7
|
-
/**
|
|
8
|
-
* Sets `flex-direction`. Omit for the browser default (`row`).
|
|
9
|
-
*/
|
|
10
|
-
direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
11
|
-
/**
|
|
12
|
-
* Sets `flex-wrap`. Omit for the browser default (`nowrap`).
|
|
13
|
-
*/
|
|
14
|
-
wrap?: 'wrap' | 'nowrap' | 'wrap-reverse';
|
|
15
|
-
/**
|
|
16
|
-
* Sets `justify-content`, aligning items along the main axis.
|
|
17
|
-
*/
|
|
18
|
-
justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly';
|
|
19
|
-
/**
|
|
20
|
-
* Sets `align-items`, aligning items along the cross axis.
|
|
21
|
-
*/
|
|
22
|
-
align?: 'start' | 'end' | 'center' | 'baseline' | 'stretch';
|
|
23
|
-
/**
|
|
24
|
-
* Sets `align-content`, distributing wrapped lines along the cross axis. Has no effect on
|
|
25
|
-
* single-line (non-wrapping) containers.
|
|
26
|
-
*/
|
|
27
|
-
alignContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'stretch';
|
|
28
|
-
/**
|
|
29
|
-
* Spacing between children on both axes, mapped to the `gap-*` utility classes. Overridden per
|
|
30
|
-
* axis by `rowGap`/`columnGap` where set.
|
|
31
|
-
*/
|
|
32
|
-
gap?: Spacing | 0;
|
|
33
|
-
/**
|
|
34
|
-
* Spacing between rows (the cross axis when wrapped), mapped to the `row-gap-*` utility
|
|
35
|
-
* classes. Independent of `gap`/`columnGap`.
|
|
36
|
-
*/
|
|
37
|
-
rowGap?: Spacing | 0;
|
|
38
|
-
/**
|
|
39
|
-
* Spacing between columns (the main axis), mapped to the `column-gap-*` utility classes.
|
|
40
|
-
* Independent of `gap`/`rowGap`.
|
|
41
|
-
*/
|
|
42
|
-
columnGap?: Spacing | 0;
|
|
43
|
-
}
|
|
44
|
-
type FlexOwnProps<C extends ElementType> = FlexLayout & {
|
|
45
|
-
/**
|
|
46
|
-
* A string of all className you want applied to the component.
|
|
47
|
-
*/
|
|
48
|
-
className?: string;
|
|
49
|
-
/**
|
|
50
|
-
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
51
|
-
*/
|
|
52
|
-
component?: C;
|
|
53
|
-
/**
|
|
54
|
-
* Renders an inline flex container (`.d-inline-flex`) instead of a block-level one (`.d-flex`,
|
|
55
|
-
* the default).
|
|
56
|
-
*/
|
|
57
|
-
inline?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Overrides any of `direction`/`wrap`/`justify`/`align`/`alignContent`/`gap`/`rowGap`/
|
|
60
|
-
* `columnGap` at one or more breakpoints, via regular viewport media queries (unlike `Stack`'s
|
|
61
|
-
* `responsive` prop, this doesn't require a `.contains-inline` ancestor).
|
|
62
|
-
*/
|
|
63
|
-
responsive?: Partial<Record<Breakpoint, FlexLayout>>;
|
|
64
|
-
};
|
|
65
|
-
type FlexProps<C extends ElementType = 'div'> = PolymorphicComponentProps<C, FlexOwnProps<C>>;
|
|
66
|
-
type FlexComponent = (<C extends ElementType = 'div'>(props: FlexProps<C> & {
|
|
67
|
-
ref?: PolymorphicRef<C>;
|
|
68
|
-
}) => ReactElement | null) & {
|
|
69
|
-
displayName?: string;
|
|
70
|
-
};
|
|
71
|
-
declare const Flex: FlexComponent;
|
|
72
|
-
//#endregion
|
|
73
|
-
export { FlexProps as n, Flex as t };
|
|
74
|
-
//# sourceMappingURL=index-CVUMS0x7.d.ts.map
|