Skip to content

Commit

Permalink
Exposing prop disabledBehavior to TableView (adobe#6832)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktabors committed Aug 7, 2024
1 parent aa9f32d commit 4d8b655
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/@adobe/spectrum-css-temp/components/table/skin.css
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ tbody.spectrum-Table-body {
background-color: var(--spectrum-table-row-background-color-down);
}

&.is-disabled .spectrum-Table-cell.is-disabled {
color: var(--spectrum-alias-text-color-disabled);
}

/* Alternative to border on rows. Using box shadow since they don't take room unlike border which would cause wiggles
* in the highlight case and displace the sticky indicator. Also allows for a nicer bottom curved border to match the container,
* the bottom border curved corners were cut off when using borders.
Expand Down
7 changes: 6 additions & 1 deletion packages/@react-spectrum/table/src/TableViewWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* governing permissions and limitations under the License.
*/

import type {AriaLabelingProps, DOMProps, DOMRef, Key, SpectrumSelectionProps, StyleProps} from '@react-types/shared';
import type {AriaLabelingProps, DisabledBehavior, DOMProps, DOMRef, Key, SpectrumSelectionProps, StyleProps} from '@react-types/shared';
import type {ColumnSize, TableProps} from '@react-types/table';
import type {DragAndDropHooks} from '@react-spectrum/dnd';
import React, {JSX, ReactElement} from 'react';
Expand All @@ -33,6 +33,11 @@ export interface SpectrumTableProps<T> extends TableProps<T>, SpectrumSelectionP
isQuiet?: boolean,
/** Sets what the TableView should render when there is no content to display. */
renderEmptyState?: () => JSX.Element,
/**
* Whether `disabledKeys` applies to all interactions, or only selection.
* @default "selection"
*/
disabledBehavior?: DisabledBehavior,
/** Handler that is called when a user performs an action on a row. */
onAction?: (key: Key) => void,
/**
Expand Down
4 changes: 4 additions & 0 deletions packages/@react-spectrum/table/stories/Table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ export default {
},
disallowEmptySelection: {
control: 'boolean'
},
disabledBehavior: {
control: 'select',
options: ['all', 'selection']
}
}
} as ComponentMeta<typeof TableView>;
Expand Down

0 comments on commit 4d8b655

Please sign in to comment.