Files
supabase/apps/studio/components/ui/DisableInteraction.tsx
Jonathan Summers-Muir 9318404e61 Feat/api keys rollout prep (#35559)
* first pass

* init

* updated types

* fix up key reveal

* Update QuickKeyCopy.tsx

* remove quick key copy

* api key pill now only allows reveal and copy if you have perm

* Update LegacyAPIKeys.tsx

* fix up layouts

* fix copy

* Fix action menu dropdown position, few small nudges

* Remove unused files.

* Remove the hardcoded and rename the feature flag for basic API keys.

* add support for name and description, some smaller improvements

* Fix the trims for the description.

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Stojan Dimitrovski <sdimitrovski@gmail.com>
2025-05-27 15:50:42 +02:00

39 lines
1007 B
TypeScript

import React, { forwardRef } from 'react'
import { cn } from 'ui'
interface DisableInteractionProps extends React.HTMLAttributes<HTMLDivElement> {
disabled?: boolean
}
/**
* DisableInteraction component
*
* A utility component that wraps content and prevents all user interactions when disabled
* including clicking, hovering, and text selection.
*
* @example
* <DisableInteraction disabled={isDisabled}>
* <YourContent />
* </DisableInteraction>
*/
export const DisableInteraction = forwardRef<HTMLDivElement, DisableInteractionProps>(
({ disabled, style, className, ...props }, ref) => (
<div
ref={ref}
{...props}
className={cn(disabled && 'opacity-50 pointer-events-none', className)}
style={{
...(disabled && {
userSelect: 'none',
WebkitUserSelect: 'none',
MozUserSelect: 'none',
msUserSelect: 'none',
}),
...style,
}}
/>
)
)
DisableInteraction.displayName = 'DisableInteraction'