@react-spectrum/s2 3.0.0-nightly-bebc9764a-241010 → 3.0.0-nightly-a45e2a5ec-241011
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Card.cjs +3 -3
- package/dist/Card.cjs.map +1 -1
- package/dist/Card.css.map +1 -1
- package/dist/Card.mjs +3 -3
- package/dist/Card.mjs.map +1 -1
- package/dist/CardView.cjs +7 -2
- package/dist/CardView.cjs.map +1 -1
- package/dist/CardView.css.map +1 -1
- package/dist/CardView.mjs +9 -5
- package/dist/CardView.mjs.map +1 -1
- package/dist/Slider.cjs +33 -33
- package/dist/Slider.cjs.map +1 -1
- package/dist/Slider.css +86 -86
- package/dist/Slider.css.map +1 -1
- package/dist/Slider.mjs +33 -33
- package/dist/Slider.mjs.map +1 -1
- package/dist/TableView.cjs +34 -7
- package/dist/TableView.cjs.map +1 -1
- package/dist/TableView.css.map +1 -1
- package/dist/TableView.mjs +34 -8
- package/dist/TableView.mjs.map +1 -1
- package/dist/main.cjs +2 -0
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +3 -3
- package/dist/module.mjs.map +1 -1
- package/dist/types.d.ts +7 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/Card.tsx +2 -2
- package/src/CardView.tsx +17 -12
- package/src/Slider.tsx +2 -3
- package/src/TableView.tsx +47 -19
- package/src/index.ts +2 -2
package/dist/TableView.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"ACkHqB;EAAA;;;;EAQP;;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAuT+B;;;;EAAA;;;;EAAA;;;;EAGxB;;;;EA0FQ;;;;EAOZ;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA2CkB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAwBJ;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA0BT;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAyBG;;;;EAAA;;;;EAAA;;;;EASL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAWL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA6F6C;;;;EAwBxC;;;;EAQM;;;;EAIM;;;;EAAA;;;;EAwFnB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAmCa;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAUN;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA0FR;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAoEoC;;;;;;;;;;;;;;AAj9B3B;EAQP;;;;;AARO;;AAAA;EAAA;IAQP;;;;IAoZe;;;;IAOZ;;;;IA2CkB;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAwBJ;;;;IAAA;;;;IA0BT;;;;IAAA;;;;IAAA;;;;IAkCF;;;;IAWL;;;;IA6F6C;;;;IA4H/C;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AA9vBC;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAscqB;;;;IAwBJ;;;;IA0BT;;;;IAAA;;;;IAAA;;;;IA6CP;;;;IAAA;;;;IA4PW;;;;IAoGd;;;;IAAA;;;;IAAA;;;;;;AAxqBY","sources":["2240c4c45ca0caf3","packages/@react-spectrum/s2/src/TableView.tsx"],"sourcesContent":["@import \"5b1d6c31fe4487e1\";\n@import \"f77e406826513ab2\";\n@import \"8dbcf3cea8cfcf9c\";\n@import \"890f8aae714c4bd1\";\n@import \"48b36de5a4ffba52\";\n@import \"f6b070bd01650099\";\n@import \"cdde521fb70eb9ad\";\n@import \"d7adc374eba6f78a\";\n@import \"35aaf22940bf2f2a\";\n@import \"32213075f389df20\";\n@import \"b0feba60a0629310\";\n@import \"7c09a91fbb0fbaa4\";\n@import \"b2c69c7a7ed62426\";\n@import \"07b0d08572549118\";\n@import \"5e5dc59c220c1582\";\n@import \"0c3bd1e2e2accabc\";\n@import \"be20f998f58af945\";\n@import \"dd6f10cdba64c3a3\";\n@import \"06cceb4ec05a1b8a\";\n@import \"8cc40857bd78d993\";\n@import \"36e840b6feb3c919\";\n@import \"b0c207aa30d06f1f\";\n@import \"0d7bafdf4e6377cb\";\n@import \"219f545e8afc3f03\";\n@import \"c40132ec5eb61ae5\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n Button,\n CellRenderProps,\n Collection,\n ColumnRenderProps,\n ColumnResizer,\n Key,\n Provider,\n Cell as RACCell,\n CellProps as RACCellProps,\n CheckboxContext as RACCheckboxContext,\n Column as RACColumn,\n ColumnProps as RACColumnProps,\n Row as RACRow,\n RowProps as RACRowProps,\n Table as RACTable,\n TableBody as RACTableBody,\n TableBodyProps as RACTableBodyProps,\n TableHeader as RACTableHeader,\n TableHeaderProps as RACTableHeaderProps,\n TableProps as RACTableProps,\n ResizableTableContainer,\n RowRenderProps,\n TableBodyRenderProps,\n TableRenderProps,\n UNSTABLE_TableLayout,\n UNSTABLE_TableLoadingIndicator,\n UNSTABLE_Virtualizer,\n useSlottedContext,\n useTableOptions\n} from 'react-aria-components';\nimport {centerPadding, getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {Checkbox} from './Checkbox';\nimport Chevron from '../ui-icons/Chevron';\nimport {colorMix, fontRelative, lightDark, size, style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {ColumnSize} from '@react-types/table';\nimport {DOMRef, LoadingState, Node} from '@react-types/shared';\nimport {GridNode} from '@react-types/grid';\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {LayoutNode} from '@react-stately/layout';\nimport {Menu, MenuItem, MenuTrigger} from './Menu';\nimport {mergeStyles} from '../style/runtime';\nimport Nubbin from '../ui-icons/S2_Icon_MoveHorizontalCircleTableWidget_16_N.svg';\nimport {ProgressCircle} from './ProgressCircle';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, ReactNode, useCallback, useContext, useMemo, useRef, useState} from 'react';\nimport {Rect} from '@react-stately/virtualizer';\nimport SortDownArrow from '../s2wf-icons/S2_Icon_SortDown_20_N.svg';\nimport SortUpArrow from '../s2wf-icons/S2_Icon_SortUp_20_N.svg';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLoadMore} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useScale} from './utils';\nimport {VisuallyHidden} from 'react-aria';\n\ninterface S2TableProps {\n /** Whether the Table should be displayed with a quiet style. */\n isQuiet?: boolean,\n /**\n * Sets the amount of vertical padding within each cell.\n * @default 'regular'\n */\n density?: 'compact' | 'spacious' | 'regular',\n /**\n * Sets the overflow behavior for the cell contents.\n * @default 'truncate'\n */\n overflowMode?: 'wrap' | 'truncate',\n // TODO: will we contine with onAction or rename to onRowAction like it is in RAC?\n /** Handler that is called when a user performs an action on a row. */\n onAction?: (key: Key) => void,\n /**\n * Handler that is called when a user starts a column resize.\n */\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void,\n /**\n * Handler that is called when a user performs a column resize.\n * Can be used with the width property on columns to put the column widths into\n * a controlled state.\n */\n onResize?: (widths: Map<Key, ColumnSize>) => void,\n /**\n * Handler that is called after a user performs a column resize.\n * Can be used to store the widths of columns for another future session.\n */\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void,\n /** The current loading state of the table. */\n loadingState?: LoadingState,\n /** Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */\n onLoadMore?: () => any\n}\n\n// TODO: Note that loadMore and loadingState are now on the Table instead of on the TableBody\nexport interface TableViewProps extends Omit<RACTableProps, 'style' | 'disabledBehavior' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, UnsafeStyles, S2TableProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nlet InternalTableContext = createContext<TableViewProps & {layout?: S2TableLayout<unknown>, setIsInResizeMode?:(val: boolean) => void, isInResizeMode?: boolean}>({});\n\nconst tableWrapper = style({\n minHeight: 0,\n minWidth: 0,\n display: 'flex',\n isolation: 'isolate',\n disableTapHighlight: true\n});\n\nconst table = style<TableRenderProps & S2TableProps & {isCheckboxSelection?: boolean}>({\n width: 'full',\n userSelect: 'none',\n minHeight: 0,\n minWidth: 0,\n fontFamily: 'sans',\n fontWeight: 'normal',\n overflow: 'auto',\n backgroundColor: {\n default: 'gray-25',\n isQuiet: 'transparent',\n forcedColors: 'Background'\n },\n outlineColor: {\n default: 'gray-300',\n isFocusVisible: 'focus-ring',\n forcedColors: 'ButtonBorder'\n },\n outlineWidth: {\n default: 1,\n isQuiet: 0,\n isFocusVisible: 2\n },\n outlineStyle: 'solid',\n borderRadius: {\n default: size(6),\n isQuiet: 'none'\n },\n // Multiple browser bugs from scrollIntoView and scrollPadding:\n // Bug: Table doesn't scroll items into view perfectly in Chrome\n // https://issues.chromium.org/issues/365913982\n // Bug: Table scrolls to the left when navigating up/down through the checkboxes when body is scrolled to the right.\n // https://issues.chromium.org/issues/40067778\n // https://bugs.webkit.org/show_bug.cgi?id=272799\n // Base reproduction: https://codepen.io/lfdanlu/pen/zYVVGPW\n scrollPaddingTop: 32,\n scrollPaddingStart: {\n isCheckboxSelection: 40\n }\n}, getAllowedOverrides({height: true}));\n\n// component-height-100\nconst DEFAULT_HEADER_HEIGHT = {\n medium: 32,\n large: 40\n};\n\nconst ROW_HEIGHTS = {\n compact: {\n medium: 32, // table-row-height-medium-compact (aka component-height-100)\n large: 40\n },\n regular: {\n medium: 40, // table-row-height-medium-regular\n large: 50\n },\n spacious: {\n medium: 48, // table-row-height-medium-spacious\n large: 60\n }\n};\n\nexport class S2TableLayout<T> extends UNSTABLE_TableLayout<T> {\n constructor(options) {\n super({...options, loaderHeight: 60});\n }\n\n protected isStickyColumn(node: GridNode<T>): boolean {\n return node.props.isSticky;\n }\n\n protected buildCollection(): LayoutNode[] {\n let [header, body] = super.buildCollection();\n let {children, layoutInfo} = body;\n // TableLayout's buildCollection always sets the body width to the max width between the header width, but\n // we want the body to be sticky and only as wide as the table so it is always in view if loading/empty\n if (children?.length === 0) {\n layoutInfo.rect.width = this.virtualizer.visibleRect.width - 80;\n }\n\n return [\n header,\n body\n ];\n }\n\n protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode {\n let layoutNode = super.buildLoader(node, x, y);\n let {layoutInfo} = layoutNode;\n layoutInfo.allowOverflow = true;\n layoutInfo.rect.width = this.virtualizer.visibleRect.width;\n layoutInfo.isSticky = true;\n return layoutNode;\n }\n\n protected buildBody(y: number): LayoutNode {\n let layoutNode = super.buildBody(y);\n let {children, layoutInfo} = layoutNode;\n // Needs overflow for sticky loader\n layoutInfo.allowOverflow = true;\n // If loading or empty, we'll want the body to be sticky and centered\n if (children?.length === 0) {\n layoutInfo.rect = new Rect(40, 40, this.virtualizer.visibleRect.width - 80, this.virtualizer.visibleRect.height - 80);\n layoutInfo.isSticky = true;\n }\n\n return {...layoutNode, layoutInfo};\n }\n\n protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {\n let layoutNode = super.buildRow(node, x, y);\n layoutNode.layoutInfo.allowOverflow = true;\n // Needs overflow for sticky selection/drag cells\n return layoutNode;\n }\n\n protected buildTableHeader(): LayoutNode {\n let layoutNode = super.buildTableHeader();\n // Needs overflow for sticky selection/drag column\n layoutNode.layoutInfo.allowOverflow = true;\n return layoutNode;\n }\n\n protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {\n let layoutNode = super.buildColumn(node, x, y);\n // Needs overflow for the resize handle\n layoutNode.layoutInfo.allowOverflow = true;\n return layoutNode;\n }\n}\n\nfunction TableView(props: TableViewProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_style,\n UNSAFE_className,\n isQuiet = false,\n density = 'regular',\n overflowMode = 'truncate',\n styles,\n loadingState,\n onLoadMore,\n onResize: propsOnResize,\n onResizeStart: propsOnResizeStart,\n onResizeEnd: propsOnResizeEnd,\n onAction,\n ...otherProps\n } = props;\n\n let domRef = useDOMRef(ref);\n let scale = useScale();\n let layout = useMemo(() => {\n return new S2TableLayout({\n rowHeight: overflowMode === 'wrap'\n ? undefined\n : ROW_HEIGHTS[density][scale],\n estimatedRowHeight: overflowMode === 'wrap'\n ? ROW_HEIGHTS[density][scale]\n : undefined,\n // No need for estimated headingHeight since the headers aren't affected by overflow mode: wrap\n headingHeight: DEFAULT_HEADER_HEIGHT[scale]\n });\n }, [overflowMode, density, scale]);\n\n // Starts when the user selects resize from the menu, ends when resizing ends\n // used to control the visibility of the resizer Nubbin\n let [isInResizeMode, setIsInResizeMode] = useState(false);\n let onResizeStart = useCallback((widths) => {\n propsOnResizeStart?.(widths);\n }, [propsOnResizeStart]);\n let onResizeEnd = useCallback((widths) => {\n setIsInResizeMode(false);\n propsOnResizeEnd?.(widths);\n }, [propsOnResizeEnd, setIsInResizeMode]);\n\n let context = useMemo(() => ({\n isQuiet,\n density,\n overflowMode,\n loadingState,\n isInResizeMode,\n setIsInResizeMode\n }), [isQuiet, density, overflowMode, loadingState, isInResizeMode, setIsInResizeMode]);\n\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n let scrollRef = useRef(null);\n let memoedLoadMoreProps = useMemo(() => ({\n isLoading: isLoading,\n onLoadMore\n }), [isLoading, onLoadMore]);\n useLoadMore(memoedLoadMoreProps, scrollRef);\n let isCheckboxSelection = props.selectionMode === 'multiple' || props.selectionMode === 'single';\n\n return (\n <ResizableTableContainer\n // TODO: perhaps this ref should be attached to the RACTable but it expects a table type ref which isn't true in the virtualized case\n ref={domRef}\n onResize={propsOnResize}\n onResizeEnd={onResizeEnd}\n onResizeStart={onResizeStart}\n className={(UNSAFE_className || '') + mergeStyles(tableWrapper, styles)}\n style={UNSAFE_style}>\n <UNSTABLE_Virtualizer layout={layout}>\n <InternalTableContext.Provider value={context}>\n <RACTable\n ref={scrollRef}\n // Fix webkit bug where scrollbars appear above the checkboxes/other table elements\n style={{WebkitTransform: 'translateZ(0)'}}\n className={renderProps => table({\n ...renderProps,\n isCheckboxSelection,\n isQuiet\n })}\n selectionBehavior=\"toggle\"\n onRowAction={onAction}\n {...otherProps} />\n </InternalTableContext.Provider>\n </UNSTABLE_Virtualizer>\n </ResizableTableContainer>\n );\n}\n\nconst centeredWrapper = style({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 'full',\n height: 'full'\n});\n\nexport interface TableBodyProps<T> extends Omit<RACTableBodyProps<T>, 'style' | 'className' | 'dependencies'> {}\n\n/**\n * The body of a `<Table>`, containing the table rows.\n */\nexport function TableBody<T extends object>(props: TableBodyProps<T>) {\n let {items, renderEmptyState, children} = props;\n let {loadingState} = useContext(InternalTableContext);\n let emptyRender;\n let renderer = children;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let loadMoreSpinner = (\n <UNSTABLE_TableLoadingIndicator className={style({height: 'full', width: 'full'})}>\n <div className={centeredWrapper}>\n <ProgressCircle\n isIndeterminate\n aria-label={stringFormatter.format('table.loadingMore')} />\n </div>\n </UNSTABLE_TableLoadingIndicator>\n );\n\n // If the user is rendering their rows in dynamic fashion, wrap their render function in Collection so we can inject\n // the loader. Otherwise it is a static renderer and thus we can simply add the table loader after\n // TODO: this assumes that the user isn't providing their children in some wrapper though and/or isn't doing a map of children\n // (though I guess they wouldn't provide items then so the check for this is still valid in the latter case)...\n if (typeof children === 'function' && items) {\n renderer = (\n <>\n <Collection items={items}>\n {children}\n </Collection>\n {loadingState === 'loadingMore' && loadMoreSpinner}\n </>\n );\n } else {\n renderer = (\n <>\n {children}\n {loadingState === 'loadingMore' && loadMoreSpinner}\n </>\n );\n }\n\n if (renderEmptyState != null && loadingState !== 'loading') {\n emptyRender = (props: TableBodyRenderProps) => (\n <div className={centeredWrapper}>\n {renderEmptyState(props)}\n </div>\n );\n } else if (loadingState === 'loading') {\n emptyRender = () => (\n <div className={centeredWrapper}>\n <ProgressCircle\n isIndeterminate\n aria-label={stringFormatter.format('table.loading')} />\n </div>\n );\n }\n\n return (\n <RACTableBody\n className={style({height: 'full'})}\n {...props}\n renderEmptyState={emptyRender}\n dependencies={[loadingState]}>\n {renderer}\n </RACTableBody>\n );\n}\n\nconst cellFocus = {\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineOffset: -2,\n outlineWidth: 2,\n outlineColor: 'focus-ring',\n borderRadius: size(6)\n} as const;\n\nfunction CellFocusRing() {\n return <div role=\"presentation\" className={style({...cellFocus, position: 'absolute', inset: 0})({isFocusVisible: true})} />;\n}\n\nconst columnStyles = style({\n height: '[inherit]',\n boxSizing: 'border-box',\n color: {\n default: 'neutral',\n forcedColors: 'ButtonText'\n },\n paddingX: {\n default: 16,\n isColumnResizable: 0\n },\n textAlign: {\n align: {\n start: 'start',\n center: 'center',\n end: 'end'\n }\n },\n outlineStyle: 'none',\n position: 'relative',\n fontSize: 'control',\n fontFamily: 'sans',\n fontWeight: 'bold',\n display: 'flex',\n borderColor: {\n default: 'gray-300',\n forcedColors: 'ButtonBorder'\n },\n borderTopWidth: {\n default: 0,\n isQuiet: 1\n },\n borderBottomWidth: 1,\n borderStartWidth: 0,\n borderEndWidth: {\n default: 0,\n isColumnResizable: 1\n },\n borderStyle: 'solid',\n forcedColorAdjust: 'none'\n});\n\nexport interface ColumnProps extends RACColumnProps {\n /** Whether the column should render a divider between it and the next column. */\n showDivider?: boolean,\n /** Whether the column allows resizing. */\n allowsResizing?: boolean,\n /**\n * The alignment of the column's contents relative to its allotted width.\n * @default 'start'\n */\n align?: 'start' | 'center' | 'end',\n /** The content to render as the column header. */\n children: ReactNode\n}\n\n/**\n * A column within a `<Table>`.\n */\nexport function Column(props: ColumnProps) {\n let {isHeaderRowHovered} = useContext(InternalTableHeaderContext);\n let {isQuiet} = useContext(InternalTableContext);\n let {allowsResizing, children, align = 'start'} = props;\n let isColumnResizable = allowsResizing;\n\n return (\n <RACColumn {...props} style={{borderInlineEndColor: 'transparent'}} className={renderProps => columnStyles({...renderProps, isColumnResizable, align, isQuiet})}>\n {({allowsSorting, sortDirection, isFocusVisible, sort, startResize, isHovered}) => (\n <>\n {/* Note this is mainly for column's without a dropdown menu. If there is a dropdown menu, the button is styled to have a focus ring for simplicity\n (no need to juggle showing this focus ring if focus is on the menu button and not if it is on the resizer) */}\n {/* Separate absolutely positioned element because appyling the ring on the column directly via outline means the ring's required borderRadius will cause the bottom gray border to curve as well */}\n {isFocusVisible && <CellFocusRing />}\n {isColumnResizable ?\n (\n <ResizableColumnContents allowsSorting={allowsSorting} sortDirection={sortDirection} sort={sort} startResize={startResize} isHovered={isHeaderRowHovered || isHovered} align={align}>\n {children}\n </ResizableColumnContents>\n ) : (\n <ColumnContents allowsSorting={allowsSorting} sortDirection={sortDirection}>\n {children}\n </ColumnContents>\n )\n }\n </>\n )}\n </RACColumn>\n );\n}\n\nconst columnContentWrapper = style({\n minWidth: 0,\n display: 'flex',\n alignItems: 'center',\n width: 'full'\n});\n\nconst sortIcon = style({\n size: fontRelative(16),\n flexShrink: 0,\n marginEnd: {\n default: 8,\n isButton: 'text-to-visual'\n },\n verticalAlign: {\n default: 'bottom',\n isButton: 0\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\ninterface ColumnContentProps extends Pick<ColumnRenderProps, 'allowsSorting' | 'sortDirection'>, Pick<ColumnProps, 'children'> {}\n\nfunction ColumnContents(props: ColumnContentProps) {\n let {allowsSorting, sortDirection, children} = props;\n\n return (\n <div className={columnContentWrapper}>\n {allowsSorting && (\n <Provider\n values={[\n [IconContext, {\n styles: sortIcon({})\n }]\n ]}>\n {sortDirection != null && (\n sortDirection === 'ascending' ? <SortUpArrow /> : <SortDownArrow />\n )}\n </Provider>\n )}\n <span className={style({truncate: true, width: 'full'})}>\n {children}\n </span>\n </div>\n );\n}\n\nconst resizableMenuButtonWrapper = style({\n ...cellFocus,\n color: 'gray-800', // body-color\n width: 'full',\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n justifyContent: {\n align: {\n default: 'start',\n center: 'center',\n end: 'end'\n }\n },\n // TODO: when align: end, the dropdown arrow is misaligned with the text, not sure how best to make the svg be flush with the end of the button other than modifying the\n // paddingEnd\n paddingX: 16,\n backgroundColor: 'transparent',\n borderStyle: 'none',\n fontSize: 'control',\n fontFamily: 'sans',\n fontWeight: 'bold'\n});\n\nconst resizerHandleContainer = style({\n display: {\n default: 'none',\n isResizing: 'block',\n isHovered: 'block'\n },\n width: 12,\n height: 'full',\n position: 'absolute',\n top: 0,\n insetEnd: size(-6),\n cursor: {\n default: 'none',\n resizableDirection: {\n 'left': 'e-resize',\n 'right': 'w-resize',\n 'both': 'ew-resize'\n }\n },\n // So that the user can still hover + drag the resizer even though it's hit area is partially in the adjacent column's space\n '--focus-ring-color': {\n type: 'outlineColor',\n value: 'focus-ring'\n }\n});\n\nconst resizerHandle = style({\n backgroundColor: {\n default: 'transparent',\n isHovered: 'gray-300',\n isFocusVisible: '--focus-ring-color',\n isResizing: '--focus-ring-color',\n forcedColors: {\n default: 'Background',\n isHovered: 'ButtonBorder',\n isFocusVisible: 'Highlight',\n isResizing: 'Highlight'\n }\n },\n height: {\n default: 'full',\n isResizing: 'screen'\n },\n width: {\n default: size(1),\n isResizing: size(2)\n },\n position: 'absolute',\n insetStart: size(6)\n});\n\nconst columnHeaderText = style({\n truncate: true,\n // Make it so the text doesn't completely disappear when column is resized to smallest width + both sort and chevron icon is rendered\n minWidth: fontRelative(16),\n flexGrow: 0,\n flexShrink: 1,\n flexBasis: 'auto'\n});\n\nconst chevronIcon = style({\n rotate: 90,\n marginStart: 'text-to-visual',\n minWidth: fontRelative(16),\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst nubbin = style({\n position: 'absolute',\n top: 0,\n insetStart: size(-1),\n size: fontRelative(16),\n fill: {\n default: '--focus-ring-color',\n forcedColors: 'Highlight'\n },\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'white',\n forcedColors: 'HighlightText'\n }\n }\n});\n\ninterface ResizableColumnContentProps extends Pick<ColumnRenderProps, 'allowsSorting' | 'sort' | 'sortDirection' | 'startResize' | 'isHovered'>, Pick<ColumnProps, 'align' | 'children'> {}\n\nfunction ResizableColumnContents(props: ResizableColumnContentProps) {\n let {allowsSorting, sortDirection, sort, startResize, children, isHovered, align} = props;\n let {setIsInResizeMode, isInResizeMode} = useContext(InternalTableContext);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n const onMenuSelect = (key) => {\n switch (key) {\n case 'sort-asc':\n sort('ascending');\n break;\n case 'sort-desc':\n sort('descending');\n break;\n case 'resize':\n setIsInResizeMode?.(true);\n startResize();\n break;\n }\n };\n\n let items = useMemo(() => {\n let options = [\n {\n label: stringFormatter.format('table.resizeColumn'),\n id: 'resize'\n }\n ];\n if (allowsSorting) {\n options = [\n {\n label: stringFormatter.format('table.sortAscending'),\n id: 'sort-asc'\n },\n {\n label: stringFormatter.format('table.sortDescending'),\n id: 'sort-desc'\n },\n ...options\n ];\n }\n return options;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allowsSorting]);\n\n let buttonAlignment = 'start';\n let menuAlign = 'start' as 'start' | 'end';\n if (align === 'center') {\n buttonAlignment = 'center';\n } else if (align === 'end') {\n buttonAlignment = 'end';\n menuAlign = 'end';\n }\n\n return (\n <>\n <MenuTrigger align={menuAlign}>\n <Button className={(renderProps) => resizableMenuButtonWrapper({...renderProps, align: buttonAlignment})}>\n {allowsSorting && (\n <Provider\n values={[\n [IconContext, {\n styles: sortIcon({isButton: true})\n }]\n ]}>\n {sortDirection != null && (\n sortDirection === 'ascending' ? <SortUpArrow /> : <SortDownArrow />\n )}\n </Provider>\n )}\n <div className={columnHeaderText}>\n {children}\n </div>\n <Chevron size=\"M\" className={chevronIcon} />\n </Button>\n <Menu onAction={onMenuSelect} items={items} styles={style({minWidth: 128})}>\n {(item) => <MenuItem>{item?.label}</MenuItem>}\n </Menu>\n </MenuTrigger>\n <div data-react-aria-prevent-focus=\"true\">\n <ColumnResizer data-react-aria-prevent-focus=\"true\" className={({resizableDirection, isResizing}) => resizerHandleContainer({resizableDirection, isResizing, isHovered: isInResizeMode || isHovered})}>\n {({isFocusVisible, isResizing}) => (\n <>\n <ResizerIndicator isInResizeMode={isInResizeMode} isFocusVisible={isFocusVisible} isHovered={isHovered} isResizing={isResizing} />\n {(isFocusVisible || isInResizeMode) && isResizing && <div className={nubbin}><Nubbin /></div>}\n </>\n )}\n </ColumnResizer>\n </div>\n </>\n );\n}\n\nfunction ResizerIndicator({isFocusVisible, isHovered, isResizing, isInResizeMode}) {\n return (\n <div className={resizerHandle({isFocusVisible, isHovered: isHovered || isInResizeMode, isResizing})} />\n );\n}\n\nconst tableHeader = style({\n height: 'full',\n width: 'full',\n backgroundColor: 'gray-75',\n // Attempt to prevent 1px area where you can see scrolled cell content between the table outline and the table header\n marginTop: '[-1px]'\n});\n\nconst selectAllCheckbox = style({\n marginStart: 16 // table-edge-to-content, same between mobile and desktop\n});\n\nconst selectAllCheckboxColumn = style({\n padding: 0,\n height: 'full',\n boxSizing: 'border-box',\n outlineStyle: 'none',\n position: 'relative',\n alignContent: 'center',\n borderColor: {\n default: 'gray-300',\n forcedColors: 'ButtonBorder'\n },\n borderXWidth: 0,\n borderTopWidth: {\n default: 0,\n isQuiet: 1\n },\n borderBottomWidth: 1,\n borderStyle: 'solid',\n backgroundColor: 'gray-75'\n});\n\nlet InternalTableHeaderContext = createContext<{isHeaderRowHovered?: boolean}>({isHeaderRowHovered: false});\n\nexport interface TableHeaderProps<T> extends Omit<RACTableHeaderProps<T>, 'style' | 'className' | 'dependencies' | 'onHoverChange' | 'onHoverStart' | 'onHoverEnd'> {}\n\n/**\n * A header within a `<Table>`, containing the table columns.\n */\nexport function TableHeader<T extends object>({columns, children}: TableHeaderProps<T>) {\n let scale = useScale();\n let {selectionBehavior, selectionMode} = useTableOptions();\n let {isQuiet} = useContext(InternalTableContext);\n let [isHeaderRowHovered, setHeaderRowHovered] = useState(false);\n\n return (\n <InternalTableHeaderContext.Provider value={{isHeaderRowHovered}}>\n <RACTableHeader onHoverChange={setHeaderRowHovered} className={tableHeader}>\n {/* Add extra columns for selection. */}\n {selectionBehavior === 'toggle' && (\n // Also isSticky prop is applied just for the layout, will decide what the RAC api should be later\n // @ts-ignore\n <RACColumn isSticky width={scale === 'medium' ? 40 : 52} minWidth={scale === 'medium' ? 40 : 52} className={selectAllCheckboxColumn({isQuiet})}>\n {({isFocusVisible}) => (\n <>\n {selectionMode === 'single' &&\n <>\n {isFocusVisible && <CellFocusRing />}\n <VisuallyHiddenSelectAllLabel />\n </>\n }\n {selectionMode === 'multiple' &&\n <Checkbox isEmphasized styles={selectAllCheckbox} slot=\"selection\" />\n }\n </>\n )}\n </RACColumn>\n )}\n <Collection items={columns}>\n {children}\n </Collection>\n </RACTableHeader>\n </InternalTableHeaderContext.Provider>\n );\n}\n\nfunction VisuallyHiddenSelectAllLabel() {\n let checkboxProps = useSlottedContext(RACCheckboxContext, 'selection');\n\n return (\n <VisuallyHidden>{checkboxProps?.['aria-label']}</VisuallyHidden>\n );\n}\n\nconst commonCellStyles = {\n borderColor: 'transparent',\n borderBottomWidth: 1,\n borderTopWidth: 0,\n borderXWidth: 0,\n borderStyle: 'solid',\n position: 'relative',\n color: {\n default: 'gray-800',\n forcedColors: 'ButtonText'\n },\n outlineStyle: 'none',\n paddingX: 16 // table-edge-to-content\n} as const;\n\nconst cell = style<CellRenderProps & S2TableProps & {isDivider: boolean}>({\n ...commonCellStyles,\n color: 'neutral',\n paddingY: centerPadding(),\n minHeight: {\n default: 40,\n density: {\n compact: 32,\n spacious: 48\n }\n },\n boxSizing: 'border-box',\n height: 'full',\n width: 'full',\n fontSize: 'control',\n alignItems: 'center',\n display: 'flex',\n borderStyle: {\n default: 'none',\n isDivider: 'solid'\n },\n borderEndWidth: {\n default: 0,\n isDivider: 1\n },\n borderColor: {\n default: 'gray-300',\n forcedColors: 'ButtonBorder'\n }\n});\n\nconst stickyCell = {\n backgroundColor: 'gray-25'\n} as const;\n\nconst checkboxCellStyle = style({\n ...commonCellStyles,\n ...stickyCell,\n paddingStart: 16,\n alignContent: 'center',\n height: '[calc(100% - 1px)]',\n borderBottomWidth: 0,\n backgroundColor: '--rowBackgroundColor'\n});\n\nconst cellContent = style({\n truncate: true,\n whiteSpace: {\n default: 'nowrap',\n overflowMode: {\n wrap: 'normal'\n }\n },\n textAlign: {\n align: {\n start: 'start',\n center: 'center',\n end: 'end'\n }\n },\n width: 'full',\n isolation: 'isolate',\n padding: {\n default: 4,\n isSticky: 0\n },\n margin: {\n default: -4,\n isSticky: 0\n },\n backgroundColor: {\n default: 'transparent',\n isSticky: '--rowBackgroundColor'\n }\n});\n\nexport interface CellProps extends RACCellProps, Pick<ColumnProps, 'align' | 'showDivider'> {\n /** @private */\n isSticky?: boolean,\n /** The content to render as the cell children. */\n children: ReactNode\n}\n\n/**\n * A cell within a table row.\n */\nexport function Cell(props: CellProps) {\n let {children, isSticky, showDivider = false, align, textValue, ...otherProps} = props;\n let tableVisualOptions = useContext(InternalTableContext);\n textValue ||= typeof children === 'string' ? children : undefined;\n\n return (\n <RACCell\n // Also isSticky prop is applied just for the layout, will decide what the RAC api should be later\n // @ts-ignore\n isSticky={isSticky}\n className={renderProps => cell({\n ...renderProps,\n ...tableVisualOptions,\n isDivider: showDivider\n })}\n textValue={textValue}\n {...otherProps}>\n {({isFocusVisible}) => (\n <>\n {isFocusVisible && <CellFocusRing />}\n <span className={cellContent({...tableVisualOptions, isSticky, align: align || 'start'})}>{children}</span>\n </>\n )}\n </RACCell>\n );\n}\n\n// Use color-mix instead of transparency so sticky cells work correctly.\nconst selectedBackground = lightDark(colorMix('gray-25', 'informative-900', 10), colorMix('gray-25', 'informative-700', 10));\nconst selectedActiveBackground = lightDark(colorMix('gray-25', 'informative-900', 15), colorMix('gray-25', 'informative-700', 15));\nconst rowBackgroundColor = {\n default: {\n default: 'gray-25',\n isQuiet: 'transparent'\n },\n isFocusVisibleWithin: colorMix('gray-25', 'gray-900', 7), // table-row-hover-color\n isHovered: colorMix('gray-25', 'gray-900', 7), // table-row-hover-color\n isPressed: colorMix('gray-25', 'gray-900', 10), // table-row-hover-color\n isSelected: {\n default: selectedBackground, // table-selected-row-background-color, opacity /10\n isFocusVisibleWithin: selectedActiveBackground, // table-selected-row-background-color, opacity /15\n isHovered: selectedActiveBackground, // table-selected-row-background-color, opacity /15\n isPressed: selectedActiveBackground // table-selected-row-background-color, opacity /15\n },\n forcedColors: {\n default: 'Background'\n }\n} as const;\n\nconst row = style<RowRenderProps & S2TableProps>({\n height: 'full',\n position: 'relative',\n boxSizing: 'border-box',\n backgroundColor: '--rowBackgroundColor',\n '--rowBackgroundColor': {\n type: 'backgroundColor',\n value: rowBackgroundColor\n },\n '--rowFocusIndicatorColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n // TODO: outline here is to emulate v3 forcedColors experience but runs into the same problem where the sticky column covers the outline\n // This doesn't quite work because it gets cut off by the checkbox cell background masking element, figure out another way. Could shrink the checkbox cell's content even more\n // and offset it by margin top but that messes up the checkbox centering a bit\n // outlineWidth: {\n // forcedColors: {\n // isFocusVisible: 2\n // }\n // },\n // outlineOffset: {\n // forcedColors: {\n // isFocusVisible: -1\n // }\n // },\n // outlineColor: {\n // forcedColors: {\n // isFocusVisible: 'ButtonBorder'\n // }\n // },\n // outlineStyle: {\n // default: 'none',\n // forcedColors: {\n // isFocusVisible: 'solid'\n // }\n // },\n outlineStyle: 'none',\n borderTopWidth: 0,\n borderBottomWidth: 1,\n borderStartWidth: 0,\n borderEndWidth: 0,\n borderStyle: 'solid',\n borderColor: {\n default: 'gray-300',\n forcedColors: 'ButtonBorder'\n },\n forcedColorAdjust: 'none'\n});\n\nexport interface RowProps<T> extends Pick<RACRowProps<T>, 'id' | 'columns' | 'children' | 'textValue'> {}\n\n/**\n * A row within a `<Table>`.\n */\nexport function Row<T extends object>({id, columns, children, ...otherProps}: RowProps<T>) {\n let {selectionBehavior, selectionMode} = useTableOptions();\n let tableVisualOptions = useContext(InternalTableContext);\n\n return (\n <RACRow\n id={id}\n className={renderProps => row({\n ...renderProps,\n ...tableVisualOptions\n }) + (renderProps.isFocusVisible && ' ' + raw('&:before { content: \"\"; display: inline-block; position: sticky; inset-inline-start: 0; width: 3px; height: 100%; margin-inline-end: -3px; margin-block-end: 1px; z-index: 3; background-color: var(--rowFocusIndicatorColor)'))}\n {...otherProps}>\n {selectionMode !== 'none' && selectionBehavior === 'toggle' && (\n <Cell isSticky className={checkboxCellStyle}>\n <Checkbox isEmphasized slot=\"selection\" />\n </Cell>\n )}\n <Collection items={columns}>\n {children}\n </Collection>\n </RACRow>\n );\n}\n\n/**\n * Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.\n */\nconst _TableView = forwardRef(TableView);\nexport {_TableView as TableView};\n"],"names":[],"version":3,"file":"TableView.css.map"}
|
|
1
|
+
{"mappings":"ACoHqB;EAAA;;;;EAQP;;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAgU+B;;;;EAAA;;;;EAAA;;;;EAGxB;;;;EA2FQ;;;;EAOZ;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA2CkB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAwBJ;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA0BT;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAyBG;;;;EAAA;;;;EAAA;;;;EASL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAWL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA6F6C;;;;EAwBxC;;;;EAQM;;;;EAIM;;;;EAAA;;;;EAgGnB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAmCa;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAUN;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA4FR;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAoEoC;;;;;;;;;;;;;;AAr+B3B;EAQP;;;;;AARO;;AAAA;EAAA;IAQP;;;;IA8Ze;;;;IAOZ;;;;IA2CkB;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAwBJ;;;;IAAA;;;;IA0BT;;;;IAAA;;;;IAAA;;;;IAkCF;;;;IAWL;;;;IA6F6C;;;;IAoI/C;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAhxBC;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAgdqB;;;;IAwBJ;;;;IA0BT;;;;IAAA;;;;IAAA;;;;IA6CP;;;;IAAA;;;;IAoQW;;;;IAsGd;;;;IAAA;;;;IAAA;;;;;;AAzrBY","sources":["2240c4c45ca0caf3","packages/@react-spectrum/s2/src/TableView.tsx"],"sourcesContent":["@import \"5b1d6c31fe4487e1\";\n@import \"f77e406826513ab2\";\n@import \"8dbcf3cea8cfcf9c\";\n@import \"890f8aae714c4bd1\";\n@import \"48b36de5a4ffba52\";\n@import \"f6b070bd01650099\";\n@import \"cdde521fb70eb9ad\";\n@import \"d7adc374eba6f78a\";\n@import \"35aaf22940bf2f2a\";\n@import \"32213075f389df20\";\n@import \"b0feba60a0629310\";\n@import \"7c09a91fbb0fbaa4\";\n@import \"b2c69c7a7ed62426\";\n@import \"07b0d08572549118\";\n@import \"5e5dc59c220c1582\";\n@import \"0c3bd1e2e2accabc\";\n@import \"be20f998f58af945\";\n@import \"dd6f10cdba64c3a3\";\n@import \"06cceb4ec05a1b8a\";\n@import \"8cc40857bd78d993\";\n@import \"36e840b6feb3c919\";\n@import \"b0c207aa30d06f1f\";\n@import \"0d7bafdf4e6377cb\";\n@import \"219f545e8afc3f03\";\n@import \"c40132ec5eb61ae5\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n Button,\n CellRenderProps,\n Collection,\n ColumnRenderProps,\n ColumnResizer,\n ContextValue,\n Key,\n Provider,\n Cell as RACCell,\n CellProps as RACCellProps,\n CheckboxContext as RACCheckboxContext,\n Column as RACColumn,\n ColumnProps as RACColumnProps,\n Row as RACRow,\n RowProps as RACRowProps,\n Table as RACTable,\n TableBody as RACTableBody,\n TableBodyProps as RACTableBodyProps,\n TableHeader as RACTableHeader,\n TableHeaderProps as RACTableHeaderProps,\n TableProps as RACTableProps,\n ResizableTableContainer,\n RowRenderProps,\n TableBodyRenderProps,\n TableRenderProps,\n UNSTABLE_TableLayout,\n UNSTABLE_TableLoadingIndicator,\n UNSTABLE_Virtualizer,\n useSlottedContext,\n useTableOptions\n} from 'react-aria-components';\nimport {centerPadding, getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {Checkbox} from './Checkbox';\nimport Chevron from '../ui-icons/Chevron';\nimport {colorMix, fontRelative, lightDark, size, style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {ColumnSize} from '@react-types/table';\nimport {DOMRef, DOMRefValue, forwardRefType, LoadingState, Node} from '@react-types/shared';\nimport {GridNode} from '@react-types/grid';\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {LayoutNode} from '@react-stately/layout';\nimport {Menu, MenuItem, MenuTrigger} from './Menu';\nimport {mergeStyles} from '../style/runtime';\nimport Nubbin from '../ui-icons/S2_Icon_MoveHorizontalCircleTableWidget_16_N.svg';\nimport {ProgressCircle} from './ProgressCircle';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, ReactNode, useCallback, useContext, useMemo, useRef, useState} from 'react';\nimport {Rect} from '@react-stately/virtualizer';\nimport SortDownArrow from '../s2wf-icons/S2_Icon_SortDown_20_N.svg';\nimport SortUpArrow from '../s2wf-icons/S2_Icon_SortUp_20_N.svg';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLoadMore} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useScale} from './utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\nimport {VisuallyHidden} from 'react-aria';\n\ninterface S2TableProps {\n /** Whether the Table should be displayed with a quiet style. */\n isQuiet?: boolean,\n /**\n * Sets the amount of vertical padding within each cell.\n * @default 'regular'\n */\n density?: 'compact' | 'spacious' | 'regular',\n /**\n * Sets the overflow behavior for the cell contents.\n * @default 'truncate'\n */\n overflowMode?: 'wrap' | 'truncate',\n // TODO: will we contine with onAction or rename to onRowAction like it is in RAC?\n /** Handler that is called when a user performs an action on a row. */\n onAction?: (key: Key) => void,\n /**\n * Handler that is called when a user starts a column resize.\n */\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void,\n /**\n * Handler that is called when a user performs a column resize.\n * Can be used with the width property on columns to put the column widths into\n * a controlled state.\n */\n onResize?: (widths: Map<Key, ColumnSize>) => void,\n /**\n * Handler that is called after a user performs a column resize.\n * Can be used to store the widths of columns for another future session.\n */\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void,\n /** The current loading state of the table. */\n loadingState?: LoadingState,\n /** Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */\n onLoadMore?: () => any\n}\n\n// TODO: Note that loadMore and loadingState are now on the Table instead of on the TableBody\nexport interface TableViewProps extends Omit<RACTableProps, 'style' | 'disabledBehavior' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, UnsafeStyles, S2TableProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nlet InternalTableContext = createContext<TableViewProps & {layout?: S2TableLayout<unknown>, setIsInResizeMode?:(val: boolean) => void, isInResizeMode?: boolean}>({});\n\nconst tableWrapper = style({\n minHeight: 0,\n minWidth: 0,\n display: 'flex',\n isolation: 'isolate',\n disableTapHighlight: true\n});\n\nconst table = style<TableRenderProps & S2TableProps & {isCheckboxSelection?: boolean}>({\n width: 'full',\n userSelect: 'none',\n minHeight: 0,\n minWidth: 0,\n fontFamily: 'sans',\n fontWeight: 'normal',\n overflow: 'auto',\n backgroundColor: {\n default: 'gray-25',\n isQuiet: 'transparent',\n forcedColors: 'Background'\n },\n outlineColor: {\n default: 'gray-300',\n isFocusVisible: 'focus-ring',\n forcedColors: 'ButtonBorder'\n },\n outlineWidth: {\n default: 1,\n isQuiet: 0,\n isFocusVisible: 2\n },\n outlineStyle: 'solid',\n borderRadius: {\n default: size(6),\n isQuiet: 'none'\n },\n // Multiple browser bugs from scrollIntoView and scrollPadding:\n // Bug: Table doesn't scroll items into view perfectly in Chrome\n // https://issues.chromium.org/issues/365913982\n // Bug: Table scrolls to the left when navigating up/down through the checkboxes when body is scrolled to the right.\n // https://issues.chromium.org/issues/40067778\n // https://bugs.webkit.org/show_bug.cgi?id=272799\n // Base reproduction: https://codepen.io/lfdanlu/pen/zYVVGPW\n scrollPaddingTop: 32,\n scrollPaddingStart: {\n isCheckboxSelection: 40\n }\n}, getAllowedOverrides({height: true}));\n\n// component-height-100\nconst DEFAULT_HEADER_HEIGHT = {\n medium: 32,\n large: 40\n};\n\nconst ROW_HEIGHTS = {\n compact: {\n medium: 32, // table-row-height-medium-compact (aka component-height-100)\n large: 40\n },\n regular: {\n medium: 40, // table-row-height-medium-regular\n large: 50\n },\n spacious: {\n medium: 48, // table-row-height-medium-spacious\n large: 60\n }\n};\n\nexport class S2TableLayout<T> extends UNSTABLE_TableLayout<T> {\n constructor(options) {\n super({...options, loaderHeight: 60});\n }\n\n protected isStickyColumn(node: GridNode<T>): boolean {\n return node.props.isSticky;\n }\n\n protected buildCollection(): LayoutNode[] {\n let [header, body] = super.buildCollection();\n let {children, layoutInfo} = body;\n // TableLayout's buildCollection always sets the body width to the max width between the header width, but\n // we want the body to be sticky and only as wide as the table so it is always in view if loading/empty\n if (children?.length === 0) {\n layoutInfo.rect.width = this.virtualizer.visibleRect.width - 80;\n }\n\n return [\n header,\n body\n ];\n }\n\n protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode {\n let layoutNode = super.buildLoader(node, x, y);\n let {layoutInfo} = layoutNode;\n layoutInfo.allowOverflow = true;\n layoutInfo.rect.width = this.virtualizer.visibleRect.width;\n layoutInfo.isSticky = true;\n return layoutNode;\n }\n\n protected buildBody(y: number): LayoutNode {\n let layoutNode = super.buildBody(y);\n let {children, layoutInfo} = layoutNode;\n // Needs overflow for sticky loader\n layoutInfo.allowOverflow = true;\n // If loading or empty, we'll want the body to be sticky and centered\n if (children?.length === 0) {\n layoutInfo.rect = new Rect(40, 40, this.virtualizer.visibleRect.width - 80, this.virtualizer.visibleRect.height - 80);\n layoutInfo.isSticky = true;\n }\n\n return {...layoutNode, layoutInfo};\n }\n\n protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {\n let layoutNode = super.buildRow(node, x, y);\n layoutNode.layoutInfo.allowOverflow = true;\n // Needs overflow for sticky selection/drag cells\n return layoutNode;\n }\n\n protected buildTableHeader(): LayoutNode {\n let layoutNode = super.buildTableHeader();\n // Needs overflow for sticky selection/drag column\n layoutNode.layoutInfo.allowOverflow = true;\n return layoutNode;\n }\n\n protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {\n let layoutNode = super.buildColumn(node, x, y);\n // Needs overflow for the resize handle\n layoutNode.layoutInfo.allowOverflow = true;\n return layoutNode;\n }\n}\n\nexport const TableContext = createContext<ContextValue<TableViewProps, DOMRefValue<HTMLDivElement>>>(null);\n\nfunction TableView(props: TableViewProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, TableContext);\n let {\n UNSAFE_style,\n UNSAFE_className,\n isQuiet = false,\n density = 'regular',\n overflowMode = 'truncate',\n styles,\n loadingState,\n onLoadMore,\n onResize: propsOnResize,\n onResizeStart: propsOnResizeStart,\n onResizeEnd: propsOnResizeEnd,\n onAction,\n ...otherProps\n } = props;\n\n let domRef = useDOMRef(ref);\n let scale = useScale();\n let layout = useMemo(() => {\n return new S2TableLayout({\n rowHeight: overflowMode === 'wrap'\n ? undefined\n : ROW_HEIGHTS[density][scale],\n estimatedRowHeight: overflowMode === 'wrap'\n ? ROW_HEIGHTS[density][scale]\n : undefined,\n // No need for estimated headingHeight since the headers aren't affected by overflow mode: wrap\n headingHeight: DEFAULT_HEADER_HEIGHT[scale]\n });\n }, [overflowMode, density, scale]);\n\n // Starts when the user selects resize from the menu, ends when resizing ends\n // used to control the visibility of the resizer Nubbin\n let [isInResizeMode, setIsInResizeMode] = useState(false);\n let onResizeStart = useCallback((widths) => {\n propsOnResizeStart?.(widths);\n }, [propsOnResizeStart]);\n let onResizeEnd = useCallback((widths) => {\n setIsInResizeMode(false);\n propsOnResizeEnd?.(widths);\n }, [propsOnResizeEnd, setIsInResizeMode]);\n\n let context = useMemo(() => ({\n isQuiet,\n density,\n overflowMode,\n loadingState,\n isInResizeMode,\n setIsInResizeMode\n }), [isQuiet, density, overflowMode, loadingState, isInResizeMode, setIsInResizeMode]);\n\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n let scrollRef = useRef(null);\n let memoedLoadMoreProps = useMemo(() => ({\n isLoading: isLoading,\n onLoadMore\n }), [isLoading, onLoadMore]);\n useLoadMore(memoedLoadMoreProps, scrollRef);\n let isCheckboxSelection = props.selectionMode === 'multiple' || props.selectionMode === 'single';\n\n return (\n <ResizableTableContainer\n // TODO: perhaps this ref should be attached to the RACTable but it expects a table type ref which isn't true in the virtualized case\n ref={domRef}\n onResize={propsOnResize}\n onResizeEnd={onResizeEnd}\n onResizeStart={onResizeStart}\n className={(UNSAFE_className || '') + mergeStyles(tableWrapper, styles)}\n style={UNSAFE_style}>\n <UNSTABLE_Virtualizer layout={layout}>\n <InternalTableContext.Provider value={context}>\n <RACTable\n ref={scrollRef}\n // Fix webkit bug where scrollbars appear above the checkboxes/other table elements\n style={{WebkitTransform: 'translateZ(0)'}}\n className={renderProps => table({\n ...renderProps,\n isCheckboxSelection,\n isQuiet\n })}\n selectionBehavior=\"toggle\"\n onRowAction={onAction}\n {...otherProps} />\n </InternalTableContext.Provider>\n </UNSTABLE_Virtualizer>\n </ResizableTableContainer>\n );\n}\n\nconst centeredWrapper = style({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 'full',\n height: 'full'\n});\n\nexport interface TableBodyProps<T> extends Omit<RACTableBodyProps<T>, 'style' | 'className' | 'dependencies'> {}\n\nfunction TableBody<T extends object>(props: TableBodyProps<T>, ref: DOMRef<HTMLDivElement>) {\n let {items, renderEmptyState, children} = props;\n let domRef = useDOMRef(ref);\n let {loadingState} = useContext(InternalTableContext);\n let emptyRender;\n let renderer = children;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let loadMoreSpinner = (\n <UNSTABLE_TableLoadingIndicator className={style({height: 'full', width: 'full'})}>\n <div className={centeredWrapper}>\n <ProgressCircle\n isIndeterminate\n aria-label={stringFormatter.format('table.loadingMore')} />\n </div>\n </UNSTABLE_TableLoadingIndicator>\n );\n\n // If the user is rendering their rows in dynamic fashion, wrap their render function in Collection so we can inject\n // the loader. Otherwise it is a static renderer and thus we can simply add the table loader after\n // TODO: this assumes that the user isn't providing their children in some wrapper though and/or isn't doing a map of children\n // (though I guess they wouldn't provide items then so the check for this is still valid in the latter case)...\n if (typeof children === 'function' && items) {\n renderer = (\n <>\n <Collection items={items}>\n {children}\n </Collection>\n {loadingState === 'loadingMore' && loadMoreSpinner}\n </>\n );\n } else {\n renderer = (\n <>\n {children}\n {loadingState === 'loadingMore' && loadMoreSpinner}\n </>\n );\n }\n\n if (renderEmptyState != null && loadingState !== 'loading') {\n emptyRender = (props: TableBodyRenderProps) => (\n <div className={centeredWrapper}>\n {renderEmptyState(props)}\n </div>\n );\n } else if (loadingState === 'loading') {\n emptyRender = () => (\n <div className={centeredWrapper}>\n <ProgressCircle\n isIndeterminate\n aria-label={stringFormatter.format('table.loading')} />\n </div>\n );\n }\n\n return (\n <RACTableBody\n // @ts-ignore\n ref={domRef}\n className={style({height: 'full'})}\n {...props}\n renderEmptyState={emptyRender}\n dependencies={[loadingState]}>\n {renderer}\n </RACTableBody>\n );\n}\n\n/**\n * The body of a `<Table>`, containing the table rows.\n */\nlet _TableBody = /*#__PURE__*/ (forwardRef as forwardRefType)(TableBody);\nexport {_TableBody as TableBody};\n\nconst cellFocus = {\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineOffset: -2,\n outlineWidth: 2,\n outlineColor: 'focus-ring',\n borderRadius: size(6)\n} as const;\n\nfunction CellFocusRing() {\n return <div role=\"presentation\" className={style({...cellFocus, position: 'absolute', inset: 0})({isFocusVisible: true})} />;\n}\n\nconst columnStyles = style({\n height: '[inherit]',\n boxSizing: 'border-box',\n color: {\n default: 'neutral',\n forcedColors: 'ButtonText'\n },\n paddingX: {\n default: 16,\n isColumnResizable: 0\n },\n textAlign: {\n align: {\n start: 'start',\n center: 'center',\n end: 'end'\n }\n },\n outlineStyle: 'none',\n position: 'relative',\n fontSize: 'control',\n fontFamily: 'sans',\n fontWeight: 'bold',\n display: 'flex',\n borderColor: {\n default: 'gray-300',\n forcedColors: 'ButtonBorder'\n },\n borderTopWidth: {\n default: 0,\n isQuiet: 1\n },\n borderBottomWidth: 1,\n borderStartWidth: 0,\n borderEndWidth: {\n default: 0,\n isColumnResizable: 1\n },\n borderStyle: 'solid',\n forcedColorAdjust: 'none'\n});\n\nexport interface ColumnProps extends RACColumnProps {\n /** Whether the column should render a divider between it and the next column. */\n showDivider?: boolean,\n /** Whether the column allows resizing. */\n allowsResizing?: boolean,\n /**\n * The alignment of the column's contents relative to its allotted width.\n * @default 'start'\n */\n align?: 'start' | 'center' | 'end',\n /** The content to render as the column header. */\n children: ReactNode\n}\n\n/**\n * A column within a `<Table>`.\n */\nexport const Column = forwardRef(function Column(props: ColumnProps, ref: DOMRef<HTMLDivElement>) {\n let {isHeaderRowHovered} = useContext(InternalTableHeaderContext);\n let {isQuiet} = useContext(InternalTableContext);\n let {allowsResizing, children, align = 'start'} = props;\n let domRef = useDOMRef(ref);\n let isColumnResizable = allowsResizing;\n\n return (\n <RACColumn {...props} ref={domRef} style={{borderInlineEndColor: 'transparent'}} className={renderProps => columnStyles({...renderProps, isColumnResizable, align, isQuiet})}>\n {({allowsSorting, sortDirection, isFocusVisible, sort, startResize, isHovered}) => (\n <>\n {/* Note this is mainly for column's without a dropdown menu. If there is a dropdown menu, the button is styled to have a focus ring for simplicity\n (no need to juggle showing this focus ring if focus is on the menu button and not if it is on the resizer) */}\n {/* Separate absolutely positioned element because appyling the ring on the column directly via outline means the ring's required borderRadius will cause the bottom gray border to curve as well */}\n {isFocusVisible && <CellFocusRing />}\n {isColumnResizable ?\n (\n <ResizableColumnContents allowsSorting={allowsSorting} sortDirection={sortDirection} sort={sort} startResize={startResize} isHovered={isHeaderRowHovered || isHovered} align={align}>\n {children}\n </ResizableColumnContents>\n ) : (\n <ColumnContents allowsSorting={allowsSorting} sortDirection={sortDirection}>\n {children}\n </ColumnContents>\n )\n }\n </>\n )}\n </RACColumn>\n );\n});\n\nconst columnContentWrapper = style({\n minWidth: 0,\n display: 'flex',\n alignItems: 'center',\n width: 'full'\n});\n\nconst sortIcon = style({\n size: fontRelative(16),\n flexShrink: 0,\n marginEnd: {\n default: 8,\n isButton: 'text-to-visual'\n },\n verticalAlign: {\n default: 'bottom',\n isButton: 0\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\ninterface ColumnContentProps extends Pick<ColumnRenderProps, 'allowsSorting' | 'sortDirection'>, Pick<ColumnProps, 'children'> {}\n\nfunction ColumnContents(props: ColumnContentProps) {\n let {allowsSorting, sortDirection, children} = props;\n\n return (\n <div className={columnContentWrapper}>\n {allowsSorting && (\n <Provider\n values={[\n [IconContext, {\n styles: sortIcon({})\n }]\n ]}>\n {sortDirection != null && (\n sortDirection === 'ascending' ? <SortUpArrow /> : <SortDownArrow />\n )}\n </Provider>\n )}\n <span className={style({truncate: true, width: 'full'})}>\n {children}\n </span>\n </div>\n );\n}\n\nconst resizableMenuButtonWrapper = style({\n ...cellFocus,\n color: 'gray-800', // body-color\n width: 'full',\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n justifyContent: {\n align: {\n default: 'start',\n center: 'center',\n end: 'end'\n }\n },\n // TODO: when align: end, the dropdown arrow is misaligned with the text, not sure how best to make the svg be flush with the end of the button other than modifying the\n // paddingEnd\n paddingX: 16,\n backgroundColor: 'transparent',\n borderStyle: 'none',\n fontSize: 'control',\n fontFamily: 'sans',\n fontWeight: 'bold'\n});\n\nconst resizerHandleContainer = style({\n display: {\n default: 'none',\n isResizing: 'block',\n isHovered: 'block'\n },\n width: 12,\n height: 'full',\n position: 'absolute',\n top: 0,\n insetEnd: size(-6),\n cursor: {\n default: 'none',\n resizableDirection: {\n 'left': 'e-resize',\n 'right': 'w-resize',\n 'both': 'ew-resize'\n }\n },\n // So that the user can still hover + drag the resizer even though it's hit area is partially in the adjacent column's space\n '--focus-ring-color': {\n type: 'outlineColor',\n value: 'focus-ring'\n }\n});\n\nconst resizerHandle = style({\n backgroundColor: {\n default: 'transparent',\n isHovered: 'gray-300',\n isFocusVisible: '--focus-ring-color',\n isResizing: '--focus-ring-color',\n forcedColors: {\n default: 'Background',\n isHovered: 'ButtonBorder',\n isFocusVisible: 'Highlight',\n isResizing: 'Highlight'\n }\n },\n height: {\n default: 'full',\n isResizing: 'screen'\n },\n width: {\n default: size(1),\n isResizing: size(2)\n },\n position: 'absolute',\n insetStart: size(6)\n});\n\nconst columnHeaderText = style({\n truncate: true,\n // Make it so the text doesn't completely disappear when column is resized to smallest width + both sort and chevron icon is rendered\n minWidth: fontRelative(16),\n flexGrow: 0,\n flexShrink: 1,\n flexBasis: 'auto'\n});\n\nconst chevronIcon = style({\n rotate: 90,\n marginStart: 'text-to-visual',\n minWidth: fontRelative(16),\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst nubbin = style({\n position: 'absolute',\n top: 0,\n insetStart: size(-1),\n size: fontRelative(16),\n fill: {\n default: '--focus-ring-color',\n forcedColors: 'Highlight'\n },\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'white',\n forcedColors: 'HighlightText'\n }\n }\n});\n\ninterface ResizableColumnContentProps extends Pick<ColumnRenderProps, 'allowsSorting' | 'sort' | 'sortDirection' | 'startResize' | 'isHovered'>, Pick<ColumnProps, 'align' | 'children'> {}\n\nfunction ResizableColumnContents(props: ResizableColumnContentProps) {\n let {allowsSorting, sortDirection, sort, startResize, children, isHovered, align} = props;\n let {setIsInResizeMode, isInResizeMode} = useContext(InternalTableContext);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n const onMenuSelect = (key) => {\n switch (key) {\n case 'sort-asc':\n sort('ascending');\n break;\n case 'sort-desc':\n sort('descending');\n break;\n case 'resize':\n setIsInResizeMode?.(true);\n startResize();\n break;\n }\n };\n\n let items = useMemo(() => {\n let options = [\n {\n label: stringFormatter.format('table.resizeColumn'),\n id: 'resize'\n }\n ];\n if (allowsSorting) {\n options = [\n {\n label: stringFormatter.format('table.sortAscending'),\n id: 'sort-asc'\n },\n {\n label: stringFormatter.format('table.sortDescending'),\n id: 'sort-desc'\n },\n ...options\n ];\n }\n return options;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allowsSorting]);\n\n let buttonAlignment = 'start';\n let menuAlign = 'start' as 'start' | 'end';\n if (align === 'center') {\n buttonAlignment = 'center';\n } else if (align === 'end') {\n buttonAlignment = 'end';\n menuAlign = 'end';\n }\n\n return (\n <>\n <MenuTrigger align={menuAlign}>\n <Button className={(renderProps) => resizableMenuButtonWrapper({...renderProps, align: buttonAlignment})}>\n {allowsSorting && (\n <Provider\n values={[\n [IconContext, {\n styles: sortIcon({isButton: true})\n }]\n ]}>\n {sortDirection != null && (\n sortDirection === 'ascending' ? <SortUpArrow /> : <SortDownArrow />\n )}\n </Provider>\n )}\n <div className={columnHeaderText}>\n {children}\n </div>\n <Chevron size=\"M\" className={chevronIcon} />\n </Button>\n <Menu onAction={onMenuSelect} items={items} styles={style({minWidth: 128})}>\n {(item) => <MenuItem>{item?.label}</MenuItem>}\n </Menu>\n </MenuTrigger>\n <div data-react-aria-prevent-focus=\"true\">\n <ColumnResizer data-react-aria-prevent-focus=\"true\" className={({resizableDirection, isResizing}) => resizerHandleContainer({resizableDirection, isResizing, isHovered: isInResizeMode || isHovered})}>\n {({isFocusVisible, isResizing}) => (\n <>\n <ResizerIndicator isInResizeMode={isInResizeMode} isFocusVisible={isFocusVisible} isHovered={isHovered} isResizing={isResizing} />\n {(isFocusVisible || isInResizeMode) && isResizing && <div className={nubbin}><Nubbin /></div>}\n </>\n )}\n </ColumnResizer>\n </div>\n </>\n );\n}\n\nfunction ResizerIndicator({isFocusVisible, isHovered, isResizing, isInResizeMode}) {\n return (\n <div className={resizerHandle({isFocusVisible, isHovered: isHovered || isInResizeMode, isResizing})} />\n );\n}\n\nconst tableHeader = style({\n height: 'full',\n width: 'full',\n backgroundColor: 'gray-75',\n // Attempt to prevent 1px area where you can see scrolled cell content between the table outline and the table header\n marginTop: '[-1px]'\n});\n\nconst selectAllCheckbox = style({\n marginStart: 16 // table-edge-to-content, same between mobile and desktop\n});\n\nconst selectAllCheckboxColumn = style({\n padding: 0,\n height: 'full',\n boxSizing: 'border-box',\n outlineStyle: 'none',\n position: 'relative',\n alignContent: 'center',\n borderColor: {\n default: 'gray-300',\n forcedColors: 'ButtonBorder'\n },\n borderXWidth: 0,\n borderTopWidth: {\n default: 0,\n isQuiet: 1\n },\n borderBottomWidth: 1,\n borderStyle: 'solid',\n backgroundColor: 'gray-75'\n});\n\nlet InternalTableHeaderContext = createContext<{isHeaderRowHovered?: boolean}>({isHeaderRowHovered: false});\n\nexport interface TableHeaderProps<T> extends Omit<RACTableHeaderProps<T>, 'style' | 'className' | 'dependencies' | 'onHoverChange' | 'onHoverStart' | 'onHoverEnd'> {}\n\nfunction TableHeader<T extends object>({columns, children}: TableHeaderProps<T>, ref: DOMRef<HTMLDivElement>) {\n let scale = useScale();\n let {selectionBehavior, selectionMode} = useTableOptions();\n let {isQuiet} = useContext(InternalTableContext);\n let [isHeaderRowHovered, setHeaderRowHovered] = useState(false);\n let domRef = useDOMRef(ref);\n\n return (\n <InternalTableHeaderContext.Provider value={{isHeaderRowHovered}}>\n <RACTableHeader\n // @ts-ignore\n ref={domRef}\n onHoverChange={setHeaderRowHovered}\n className={tableHeader}>\n {/* Add extra columns for selection. */}\n {selectionBehavior === 'toggle' && (\n // Also isSticky prop is applied just for the layout, will decide what the RAC api should be later\n // @ts-ignore\n <RACColumn isSticky width={scale === 'medium' ? 40 : 52} minWidth={scale === 'medium' ? 40 : 52} className={selectAllCheckboxColumn({isQuiet})}>\n {({isFocusVisible}) => (\n <>\n {selectionMode === 'single' &&\n <>\n {isFocusVisible && <CellFocusRing />}\n <VisuallyHiddenSelectAllLabel />\n </>\n }\n {selectionMode === 'multiple' &&\n <Checkbox isEmphasized styles={selectAllCheckbox} slot=\"selection\" />\n }\n </>\n )}\n </RACColumn>\n )}\n <Collection items={columns}>\n {children}\n </Collection>\n </RACTableHeader>\n </InternalTableHeaderContext.Provider>\n );\n}\n\n/**\n * A header within a `<Table>`, containing the table columns.\n */\nlet _TableHeader = /*#__PURE__*/ (forwardRef as forwardRefType)(TableHeader);\nexport {_TableHeader as TableHeader};\n\nfunction VisuallyHiddenSelectAllLabel() {\n let checkboxProps = useSlottedContext(RACCheckboxContext, 'selection');\n\n return (\n <VisuallyHidden>{checkboxProps?.['aria-label']}</VisuallyHidden>\n );\n}\n\nconst commonCellStyles = {\n borderColor: 'transparent',\n borderBottomWidth: 1,\n borderTopWidth: 0,\n borderXWidth: 0,\n borderStyle: 'solid',\n position: 'relative',\n color: {\n default: 'gray-800',\n forcedColors: 'ButtonText'\n },\n outlineStyle: 'none',\n paddingX: 16 // table-edge-to-content\n} as const;\n\nconst cell = style<CellRenderProps & S2TableProps & {isDivider: boolean}>({\n ...commonCellStyles,\n color: 'neutral',\n paddingY: centerPadding(),\n minHeight: {\n default: 40,\n density: {\n compact: 32,\n spacious: 48\n }\n },\n boxSizing: 'border-box',\n height: 'full',\n width: 'full',\n fontSize: 'control',\n alignItems: 'center',\n display: 'flex',\n borderStyle: {\n default: 'none',\n isDivider: 'solid'\n },\n borderEndWidth: {\n default: 0,\n isDivider: 1\n },\n borderColor: {\n default: 'gray-300',\n forcedColors: 'ButtonBorder'\n }\n});\n\nconst stickyCell = {\n backgroundColor: 'gray-25'\n} as const;\n\nconst checkboxCellStyle = style({\n ...commonCellStyles,\n ...stickyCell,\n paddingStart: 16,\n alignContent: 'center',\n height: '[calc(100% - 1px)]',\n borderBottomWidth: 0,\n backgroundColor: '--rowBackgroundColor'\n});\n\nconst cellContent = style({\n truncate: true,\n whiteSpace: {\n default: 'nowrap',\n overflowMode: {\n wrap: 'normal'\n }\n },\n textAlign: {\n align: {\n start: 'start',\n center: 'center',\n end: 'end'\n }\n },\n width: 'full',\n isolation: 'isolate',\n padding: {\n default: 4,\n isSticky: 0\n },\n margin: {\n default: -4,\n isSticky: 0\n },\n backgroundColor: {\n default: 'transparent',\n isSticky: '--rowBackgroundColor'\n }\n});\n\nexport interface CellProps extends RACCellProps, Pick<ColumnProps, 'align' | 'showDivider'> {\n /** @private */\n isSticky?: boolean,\n /** The content to render as the cell children. */\n children: ReactNode\n}\n\n/**\n * A cell within a table row.\n */\nexport const Cell = forwardRef(function Cell(props: CellProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isSticky, showDivider = false, align, textValue, ...otherProps} = props;\n let domRef = useDOMRef(ref);\n let tableVisualOptions = useContext(InternalTableContext);\n textValue ||= typeof children === 'string' ? children : undefined;\n\n return (\n <RACCell\n ref={domRef}\n // Also isSticky prop is applied just for the layout, will decide what the RAC api should be later\n // @ts-ignore\n isSticky={isSticky}\n className={renderProps => cell({\n ...renderProps,\n ...tableVisualOptions,\n isDivider: showDivider\n })}\n textValue={textValue}\n {...otherProps}>\n {({isFocusVisible}) => (\n <>\n {isFocusVisible && <CellFocusRing />}\n <span className={cellContent({...tableVisualOptions, isSticky, align: align || 'start'})}>{children}</span>\n </>\n )}\n </RACCell>\n );\n});\n\n// Use color-mix instead of transparency so sticky cells work correctly.\nconst selectedBackground = lightDark(colorMix('gray-25', 'informative-900', 10), colorMix('gray-25', 'informative-700', 10));\nconst selectedActiveBackground = lightDark(colorMix('gray-25', 'informative-900', 15), colorMix('gray-25', 'informative-700', 15));\nconst rowBackgroundColor = {\n default: {\n default: 'gray-25',\n isQuiet: 'transparent'\n },\n isFocusVisibleWithin: colorMix('gray-25', 'gray-900', 7), // table-row-hover-color\n isHovered: colorMix('gray-25', 'gray-900', 7), // table-row-hover-color\n isPressed: colorMix('gray-25', 'gray-900', 10), // table-row-hover-color\n isSelected: {\n default: selectedBackground, // table-selected-row-background-color, opacity /10\n isFocusVisibleWithin: selectedActiveBackground, // table-selected-row-background-color, opacity /15\n isHovered: selectedActiveBackground, // table-selected-row-background-color, opacity /15\n isPressed: selectedActiveBackground // table-selected-row-background-color, opacity /15\n },\n forcedColors: {\n default: 'Background'\n }\n} as const;\n\nconst row = style<RowRenderProps & S2TableProps>({\n height: 'full',\n position: 'relative',\n boxSizing: 'border-box',\n backgroundColor: '--rowBackgroundColor',\n '--rowBackgroundColor': {\n type: 'backgroundColor',\n value: rowBackgroundColor\n },\n '--rowFocusIndicatorColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n // TODO: outline here is to emulate v3 forcedColors experience but runs into the same problem where the sticky column covers the outline\n // This doesn't quite work because it gets cut off by the checkbox cell background masking element, figure out another way. Could shrink the checkbox cell's content even more\n // and offset it by margin top but that messes up the checkbox centering a bit\n // outlineWidth: {\n // forcedColors: {\n // isFocusVisible: 2\n // }\n // },\n // outlineOffset: {\n // forcedColors: {\n // isFocusVisible: -1\n // }\n // },\n // outlineColor: {\n // forcedColors: {\n // isFocusVisible: 'ButtonBorder'\n // }\n // },\n // outlineStyle: {\n // default: 'none',\n // forcedColors: {\n // isFocusVisible: 'solid'\n // }\n // },\n outlineStyle: 'none',\n borderTopWidth: 0,\n borderBottomWidth: 1,\n borderStartWidth: 0,\n borderEndWidth: 0,\n borderStyle: 'solid',\n borderColor: {\n default: 'gray-300',\n forcedColors: 'ButtonBorder'\n },\n forcedColorAdjust: 'none'\n});\n\nexport interface RowProps<T> extends Pick<RACRowProps<T>, 'id' | 'columns' | 'children' | 'textValue'> {}\n\nfunction Row<T extends object>({id, columns, children, ...otherProps}: RowProps<T>, ref: DOMRef<HTMLDivElement>) {\n let {selectionBehavior, selectionMode} = useTableOptions();\n let tableVisualOptions = useContext(InternalTableContext);\n let domRef = useDOMRef(ref);\n\n return (\n <RACRow\n // @ts-ignore\n ref={domRef}\n id={id}\n className={renderProps => row({\n ...renderProps,\n ...tableVisualOptions\n }) + (renderProps.isFocusVisible && ' ' + raw('&:before { content: \"\"; display: inline-block; position: sticky; inset-inline-start: 0; width: 3px; height: 100%; margin-inline-end: -3px; margin-block-end: 1px; z-index: 3; background-color: var(--rowFocusIndicatorColor)'))}\n {...otherProps}>\n {selectionMode !== 'none' && selectionBehavior === 'toggle' && (\n <Cell isSticky className={checkboxCellStyle}>\n <Checkbox isEmphasized slot=\"selection\" />\n </Cell>\n )}\n <Collection items={columns}>\n {children}\n </Collection>\n </RACRow>\n );\n}\n\n/**\n * A row within a `<Table>`.\n */\nlet _Row = /*#__PURE__*/ (forwardRef as forwardRefType)(Row);\nexport {_Row as Row};\n\n/**\n * Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.\n */\nconst _TableView = forwardRef(TableView);\nexport {_TableView as TableView};\n"],"names":[],"version":3,"file":"TableView.css.map"}
|
package/dist/TableView.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import {ProgressCircle as $41ddd91dbbf0c389$export$c79b9d6b4cc92af7} from "./Pro
|
|
|
10
10
|
import $5a632e895c21f138$export$2e2bcd8739ae039 from "../icons/SortDown.mjs";
|
|
11
11
|
import $415c33109ddcfc45$export$2e2bcd8739ae039 from "../icons/SortUp.mjs";
|
|
12
12
|
import {useScale as $859432f3b3573fcb$export$a8d2043b2d807f4d} from "./utils.mjs";
|
|
13
|
+
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
|
|
13
14
|
import {jsx as $auVFN$jsx, jsxs as $auVFN$jsxs, Fragment as $auVFN$Fragment} from "react/jsx-runtime";
|
|
14
15
|
import {UNSTABLE_TableLayout as $auVFN$UNSTABLE_TableLayout, ResizableTableContainer as $auVFN$ResizableTableContainer, UNSTABLE_Virtualizer as $auVFN$UNSTABLE_Virtualizer, Table as $auVFN$Table, UNSTABLE_TableLoadingIndicator as $auVFN$UNSTABLE_TableLoadingIndicator, Collection as $auVFN$Collection, TableBody as $auVFN$TableBody, Column as $auVFN$Column, Provider as $auVFN$Provider, Button as $auVFN$Button, ColumnResizer as $auVFN$ColumnResizer, useTableOptions as $auVFN$useTableOptions, TableHeader as $auVFN$TableHeader, useSlottedContext as $auVFN$useSlottedContext, CheckboxContext as $auVFN$CheckboxContext, Cell as $auVFN$Cell, Row as $auVFN$Row} from "react-aria-components";
|
|
15
16
|
import {createContext as $auVFN$createContext, useMemo as $auVFN$useMemo, useState as $auVFN$useState, useCallback as $auVFN$useCallback, useRef as $auVFN$useRef, useContext as $auVFN$useContext, forwardRef as $auVFN$forwardRef} from "react";
|
|
@@ -52,6 +53,7 @@ function $parcel$interopDefault(a) {
|
|
|
52
53
|
|
|
53
54
|
|
|
54
55
|
|
|
56
|
+
|
|
55
57
|
let $0fcd5fb617970a1d$var$InternalTableContext = /*#__PURE__*/ (0, $auVFN$createContext)({});
|
|
56
58
|
const $0fcd5fb617970a1d$var$tableWrapper = " . oa oba qa qba _Zd __Fa __R-yksgrp";
|
|
57
59
|
const $0fcd5fb617970a1d$var$table = function anonymous(props, overrides) {
|
|
@@ -203,7 +205,9 @@ class $0fcd5fb617970a1d$export$4e03bdf0174fd602 extends (0, $auVFN$UNSTABLE_Tabl
|
|
|
203
205
|
return layoutNode;
|
|
204
206
|
}
|
|
205
207
|
}
|
|
208
|
+
const $0fcd5fb617970a1d$export$93e4b0b2cc49b648 = /*#__PURE__*/ (0, $auVFN$createContext)(null);
|
|
206
209
|
function $0fcd5fb617970a1d$var$TableView(props, ref) {
|
|
210
|
+
[props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $0fcd5fb617970a1d$export$93e4b0b2cc49b648);
|
|
207
211
|
let { UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className, isQuiet: isQuiet = false, density: density = 'regular', overflowMode: overflowMode = 'truncate', styles: styles, loadingState: loadingState, onLoadMore: onLoadMore, onResize: propsOnResize, onResizeStart: propsOnResizeStart, onResizeEnd: propsOnResizeEnd, onAction: onAction, ...otherProps } = props;
|
|
208
212
|
let domRef = (0, $auVFN$useDOMRef)(ref);
|
|
209
213
|
let scale = (0, $859432f3b3573fcb$export$a8d2043b2d807f4d)();
|
|
@@ -292,8 +296,9 @@ function $0fcd5fb617970a1d$var$TableView(props, ref) {
|
|
|
292
296
|
});
|
|
293
297
|
}
|
|
294
298
|
const $0fcd5fb617970a1d$var$centeredWrapper = " . _Zd _1c _2d l4 k4";
|
|
295
|
-
function $0fcd5fb617970a1d$
|
|
299
|
+
function $0fcd5fb617970a1d$var$TableBody(props, ref) {
|
|
296
300
|
let { items: items, renderEmptyState: renderEmptyState, children: children } = props;
|
|
301
|
+
let domRef = (0, $auVFN$useDOMRef)(ref);
|
|
297
302
|
let { loadingState: loadingState } = (0, $auVFN$useContext)($0fcd5fb617970a1d$var$InternalTableContext);
|
|
298
303
|
let emptyRender;
|
|
299
304
|
let renderer = children;
|
|
@@ -339,6 +344,8 @@ function $0fcd5fb617970a1d$export$76ccd210b9029917(props) {
|
|
|
339
344
|
})
|
|
340
345
|
});
|
|
341
346
|
return /*#__PURE__*/ (0, $auVFN$jsx)((0, $auVFN$TableBody), {
|
|
347
|
+
// @ts-ignore
|
|
348
|
+
ref: domRef,
|
|
342
349
|
className: " . k4",
|
|
343
350
|
...props,
|
|
344
351
|
renderEmptyState: emptyRender,
|
|
@@ -348,6 +355,9 @@ function $0fcd5fb617970a1d$export$76ccd210b9029917(props) {
|
|
|
348
355
|
children: renderer
|
|
349
356
|
});
|
|
350
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* The body of a `<Table>`, containing the table rows.
|
|
360
|
+
*/ let $0fcd5fb617970a1d$export$76ccd210b9029917 = /*#__PURE__*/ (0, $auVFN$forwardRef)($0fcd5fb617970a1d$var$TableBody);
|
|
351
361
|
const $0fcd5fb617970a1d$var$cellFocus = {
|
|
352
362
|
outlineStyle: {
|
|
353
363
|
default: 'none',
|
|
@@ -447,13 +457,15 @@ const $0fcd5fb617970a1d$var$columnStyles = function anonymous(props) {
|
|
|
447
457
|
rules += ' _zb';
|
|
448
458
|
return rules;
|
|
449
459
|
};
|
|
450
|
-
|
|
460
|
+
const $0fcd5fb617970a1d$export$816b5d811295e6bc = /*#__PURE__*/ (0, $auVFN$forwardRef)(function Column(props, ref) {
|
|
451
461
|
let { isHeaderRowHovered: isHeaderRowHovered } = (0, $auVFN$useContext)($0fcd5fb617970a1d$var$InternalTableHeaderContext);
|
|
452
462
|
let { isQuiet: isQuiet } = (0, $auVFN$useContext)($0fcd5fb617970a1d$var$InternalTableContext);
|
|
453
463
|
let { allowsResizing: allowsResizing, children: children, align: align = 'start' } = props;
|
|
464
|
+
let domRef = (0, $auVFN$useDOMRef)(ref);
|
|
454
465
|
let isColumnResizable = allowsResizing;
|
|
455
466
|
return /*#__PURE__*/ (0, $auVFN$jsx)((0, $auVFN$Column), {
|
|
456
467
|
...props,
|
|
468
|
+
ref: domRef,
|
|
457
469
|
style: {
|
|
458
470
|
borderInlineEndColor: 'transparent'
|
|
459
471
|
},
|
|
@@ -482,7 +494,7 @@ function $0fcd5fb617970a1d$export$816b5d811295e6bc(props) {
|
|
|
482
494
|
]
|
|
483
495
|
})
|
|
484
496
|
});
|
|
485
|
-
}
|
|
497
|
+
});
|
|
486
498
|
const $0fcd5fb617970a1d$var$columnContentWrapper = " . qa qba _Zd _1c l4";
|
|
487
499
|
const $0fcd5fb617970a1d$var$sortIcon = function anonymous(props) {
|
|
488
500
|
let rules = " .";
|
|
@@ -779,16 +791,19 @@ const $0fcd5fb617970a1d$var$selectAllCheckboxColumn = function anonymous(props)
|
|
|
779
791
|
let $0fcd5fb617970a1d$var$InternalTableHeaderContext = /*#__PURE__*/ (0, $auVFN$createContext)({
|
|
780
792
|
isHeaderRowHovered: false
|
|
781
793
|
});
|
|
782
|
-
function $0fcd5fb617970a1d$
|
|
794
|
+
function $0fcd5fb617970a1d$var$TableHeader({ columns: columns, children: children }, ref) {
|
|
783
795
|
let scale = (0, $859432f3b3573fcb$export$a8d2043b2d807f4d)();
|
|
784
796
|
let { selectionBehavior: selectionBehavior, selectionMode: selectionMode } = (0, $auVFN$useTableOptions)();
|
|
785
797
|
let { isQuiet: isQuiet } = (0, $auVFN$useContext)($0fcd5fb617970a1d$var$InternalTableContext);
|
|
786
798
|
let [isHeaderRowHovered, setHeaderRowHovered] = (0, $auVFN$useState)(false);
|
|
799
|
+
let domRef = (0, $auVFN$useDOMRef)(ref);
|
|
787
800
|
return /*#__PURE__*/ (0, $auVFN$jsx)($0fcd5fb617970a1d$var$InternalTableHeaderContext.Provider, {
|
|
788
801
|
value: {
|
|
789
802
|
isHeaderRowHovered: isHeaderRowHovered
|
|
790
803
|
},
|
|
791
804
|
children: /*#__PURE__*/ (0, $auVFN$jsxs)((0, $auVFN$TableHeader), {
|
|
805
|
+
// @ts-ignore
|
|
806
|
+
ref: domRef,
|
|
792
807
|
onHoverChange: setHeaderRowHovered,
|
|
793
808
|
className: $0fcd5fb617970a1d$var$tableHeader,
|
|
794
809
|
children: [
|
|
@@ -825,6 +840,9 @@ function $0fcd5fb617970a1d$export$f850895b287ef28e({ columns: columns, children:
|
|
|
825
840
|
})
|
|
826
841
|
});
|
|
827
842
|
}
|
|
843
|
+
/**
|
|
844
|
+
* A header within a `<Table>`, containing the table columns.
|
|
845
|
+
*/ let $0fcd5fb617970a1d$export$f850895b287ef28e = /*#__PURE__*/ (0, $auVFN$forwardRef)($0fcd5fb617970a1d$var$TableHeader);
|
|
828
846
|
function $0fcd5fb617970a1d$var$VisuallyHiddenSelectAllLabel() {
|
|
829
847
|
let checkboxProps = (0, $auVFN$useSlottedContext)((0, $auVFN$CheckboxContext), 'selection');
|
|
830
848
|
return /*#__PURE__*/ (0, $auVFN$jsx)((0, $auVFN$VisuallyHidden), {
|
|
@@ -938,11 +956,13 @@ const $0fcd5fb617970a1d$var$cellContent = function anonymous(props) {
|
|
|
938
956
|
else rules += ' ba';
|
|
939
957
|
return rules;
|
|
940
958
|
};
|
|
941
|
-
|
|
959
|
+
const $0fcd5fb617970a1d$export$f6f0c3fe4ec306ea = /*#__PURE__*/ (0, $auVFN$forwardRef)(function Cell(props, ref) {
|
|
942
960
|
let { children: children, isSticky: isSticky, showDivider: showDivider = false, align: align, textValue: textValue, ...otherProps } = props;
|
|
961
|
+
let domRef = (0, $auVFN$useDOMRef)(ref);
|
|
943
962
|
let tableVisualOptions = (0, $auVFN$useContext)($0fcd5fb617970a1d$var$InternalTableContext);
|
|
944
963
|
textValue ||= typeof children === 'string' ? children : undefined;
|
|
945
964
|
return /*#__PURE__*/ (0, $auVFN$jsx)((0, $auVFN$Cell), {
|
|
965
|
+
ref: domRef,
|
|
946
966
|
// Also isSticky prop is applied just for the layout, will decide what the RAC api should be later
|
|
947
967
|
// @ts-ignore
|
|
948
968
|
isSticky: isSticky,
|
|
@@ -967,7 +987,7 @@ function $0fcd5fb617970a1d$export$f6f0c3fe4ec306ea(props) {
|
|
|
967
987
|
]
|
|
968
988
|
})
|
|
969
989
|
});
|
|
970
|
-
}
|
|
990
|
+
});
|
|
971
991
|
// Use color-mix instead of transparency so sticky cells work correctly.
|
|
972
992
|
const $0fcd5fb617970a1d$var$selectedBackground = "[light-dark(color-mix(in srgb, light-dark(rgb(255, 255, 255), rgb(17, 17, 17)), light-dark(rgb(59, 99, 251), rgb(86, 129, 255)) 10%), color-mix(in srgb, light-dark(rgb(255, 255, 255), rgb(17, 17, 17)), light-dark(rgb(93, 137, 255), rgb(52, 91, 248)) 10%))]";
|
|
973
993
|
const $0fcd5fb617970a1d$var$selectedActiveBackground = "[light-dark(color-mix(in srgb, light-dark(rgb(255, 255, 255), rgb(17, 17, 17)), light-dark(rgb(59, 99, 251), rgb(86, 129, 255)) 15%), color-mix(in srgb, light-dark(rgb(255, 255, 255), rgb(17, 17, 17)), light-dark(rgb(93, 137, 255), rgb(52, 91, 248)) 15%))]";
|
|
@@ -1019,10 +1039,13 @@ const $0fcd5fb617970a1d$var$row = function anonymous(props) {
|
|
|
1019
1039
|
rules += ' _zb';
|
|
1020
1040
|
return rules;
|
|
1021
1041
|
};
|
|
1022
|
-
function $0fcd5fb617970a1d$
|
|
1042
|
+
function $0fcd5fb617970a1d$var$Row({ id: id, columns: columns, children: children, ...otherProps }, ref) {
|
|
1023
1043
|
let { selectionBehavior: selectionBehavior, selectionMode: selectionMode } = (0, $auVFN$useTableOptions)();
|
|
1024
1044
|
let tableVisualOptions = (0, $auVFN$useContext)($0fcd5fb617970a1d$var$InternalTableContext);
|
|
1045
|
+
let domRef = (0, $auVFN$useDOMRef)(ref);
|
|
1025
1046
|
return /*#__PURE__*/ (0, $auVFN$jsxs)((0, $auVFN$Row), {
|
|
1047
|
+
// @ts-ignore
|
|
1048
|
+
ref: domRef,
|
|
1026
1049
|
id: id,
|
|
1027
1050
|
className: (renderProps)=>$0fcd5fb617970a1d$var$row({
|
|
1028
1051
|
...renderProps,
|
|
@@ -1045,10 +1068,13 @@ function $0fcd5fb617970a1d$export$b59bdbef9ce70de2({ id: id, columns: columns, c
|
|
|
1045
1068
|
]
|
|
1046
1069
|
});
|
|
1047
1070
|
}
|
|
1071
|
+
/**
|
|
1072
|
+
* A row within a `<Table>`.
|
|
1073
|
+
*/ let $0fcd5fb617970a1d$export$b59bdbef9ce70de2 = /*#__PURE__*/ (0, $auVFN$forwardRef)($0fcd5fb617970a1d$var$Row);
|
|
1048
1074
|
/**
|
|
1049
1075
|
* Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.
|
|
1050
1076
|
*/ const $0fcd5fb617970a1d$export$b3c27e869d856b7 = /*#__PURE__*/ (0, $auVFN$forwardRef)($0fcd5fb617970a1d$var$TableView);
|
|
1051
1077
|
|
|
1052
1078
|
|
|
1053
|
-
export {$0fcd5fb617970a1d$export$4e03bdf0174fd602 as S2TableLayout, $0fcd5fb617970a1d$export$76ccd210b9029917 as TableBody, $0fcd5fb617970a1d$export$816b5d811295e6bc as Column, $0fcd5fb617970a1d$export$f850895b287ef28e as TableHeader, $0fcd5fb617970a1d$export$f6f0c3fe4ec306ea as Cell, $0fcd5fb617970a1d$export$b59bdbef9ce70de2 as Row, $0fcd5fb617970a1d$export$b3c27e869d856b7 as TableView};
|
|
1079
|
+
export {$0fcd5fb617970a1d$export$4e03bdf0174fd602 as S2TableLayout, $0fcd5fb617970a1d$export$93e4b0b2cc49b648 as TableContext, $0fcd5fb617970a1d$export$76ccd210b9029917 as TableBody, $0fcd5fb617970a1d$export$816b5d811295e6bc as Column, $0fcd5fb617970a1d$export$f850895b287ef28e as TableHeader, $0fcd5fb617970a1d$export$f6f0c3fe4ec306ea as Cell, $0fcd5fb617970a1d$export$b59bdbef9ce70de2 as Row, $0fcd5fb617970a1d$export$b3c27e869d856b7 as TableView};
|
|
1054
1080
|
//# sourceMappingURL=TableView.mjs.map
|