Skip to content

Commit 4d8b655

Browse files
authored
Exposing prop disabledBehavior to TableView (#6832)
1 parent aa9f32d commit 4d8b655

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

packages/@adobe/spectrum-css-temp/components/table/skin.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ tbody.spectrum-Table-body {
180180
background-color: var(--spectrum-table-row-background-color-down);
181181
}
182182

183+
&.is-disabled .spectrum-Table-cell.is-disabled {
184+
color: var(--spectrum-alias-text-color-disabled);
185+
}
186+
183187
/* Alternative to border on rows. Using box shadow since they don't take room unlike border which would cause wiggles
184188
* in the highlight case and displace the sticky indicator. Also allows for a nicer bottom curved border to match the container,
185189
* the bottom border curved corners were cut off when using borders.

packages/@react-spectrum/table/src/TableViewWrapper.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import type {AriaLabelingProps, DOMProps, DOMRef, Key, SpectrumSelectionProps, StyleProps} from '@react-types/shared';
13+
import type {AriaLabelingProps, DisabledBehavior, DOMProps, DOMRef, Key, SpectrumSelectionProps, StyleProps} from '@react-types/shared';
1414
import type {ColumnSize, TableProps} from '@react-types/table';
1515
import type {DragAndDropHooks} from '@react-spectrum/dnd';
1616
import React, {JSX, ReactElement} from 'react';
@@ -33,6 +33,11 @@ export interface SpectrumTableProps<T> extends TableProps<T>, SpectrumSelectionP
3333
isQuiet?: boolean,
3434
/** Sets what the TableView should render when there is no content to display. */
3535
renderEmptyState?: () => JSX.Element,
36+
/**
37+
* Whether `disabledKeys` applies to all interactions, or only selection.
38+
* @default "selection"
39+
*/
40+
disabledBehavior?: DisabledBehavior,
3641
/** Handler that is called when a user performs an action on a row. */
3742
onAction?: (key: Key) => void,
3843
/**

packages/@react-spectrum/table/stories/Table.stories.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ export default {
117117
},
118118
disallowEmptySelection: {
119119
control: 'boolean'
120+
},
121+
disabledBehavior: {
122+
control: 'select',
123+
options: ['all', 'selection']
120124
}
121125
}
122126
} as ComponentMeta<typeof TableView>;

0 commit comments

Comments
 (0)