Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Chore cleanup remove radio (#45218)

Gildas Garcia6e564c59291a
diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyEditor/PolicyAllowedOperation.tsx b/apps/studio/components/interfaces/Auth/Policies/PolicyEditor/PolicyAllowedOperation.tsx
index fd20df50d21..6581438f9bd 100644
--- a/apps/studio/components/interfaces/Auth/Policies/PolicyEditor/PolicyAllowedOperation.tsx
+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyEditor/PolicyAllowedOperation.tsx
@@ -1,5 +1,5 @@
import { noop } from 'lodash'
-import { Radio } from 'ui'
+import { RadioGroupCard, RadioGroupCardItem } from 'ui'
interface PolicyAllowedOperationProps {
operation: string
@@ -20,18 +20,17 @@ const PolicyAllowedOperation = ({
</div>
<div className="w-2/3">
<div className="flex items-center space-x-8">
- <Radio.Group type="small-cards" size="tiny" id="allowed-operation">
+ <RadioGroupCard
+ id="allowed-operation"
+ name="allowed-operation"
+ className="flex flex-wrap gap-3"
+ value={operation}
+ onValueChange={(value) => onSelectOperation(value)}
+ >
{['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'ALL'].map((op) => (
- <Radio
- key={op}
- name="allowed-operation"
- label={op}
- value={op}
- checked={operation === op}
- onChange={(e) => onSelectOperation(e.target.value)}
- />
+ <RadioGroupCardItem key={op} value={op} id={`r${op}`} label={op} className="w-24" />
))}
- </Radio.Group>
+ </RadioGroupCard>
</div>
</div>
</div>
diff --git a/apps/studio/components/interfaces/Database/Functions/CreateFunction/index.tsx b/apps/studio/components/interfaces/Database/Functions/CreateFunction/index.tsx
index 7174a79ea59..c52987f8f4a 100644
--- a/apps/studio/components/interfaces/Database/Functions/CreateFunction/index.tsx
+++ b/apps/studio/components/interfaces/Database/Functions/CreateFunction/index.tsx
@@ -15,7 +15,8 @@ import {
FormLabel,
FormMessage,
Input_Shadcn_,
- Radio,
+ RadioGroupStacked,
+ RadioGroupStackedItem,
ScrollArea,
Select_Shadcn_,
SelectContent_Shadcn_,
@@ -341,20 +342,16 @@ export const CreateFunction = ({
render={({ field }) => (
<FormItem>
<FormControl className="col-span-8">
- {/* TODO: This RadioGroup imports Formik state, replace it with a clean component */}
- <Radio.Group
- type="cards"
- layout="vertical"
- onChange={(event) =>
- field.onChange(event.target.value == 'SECURITY_DEFINER')
+ <RadioGroupStacked
+ onValueChange={(value) =>
+ field.onChange(value == 'SECURITY_DEFINER')
}
value={field.value ? 'SECURITY_DEFINER' : 'SECURITY_INVOKER'}
>
- <Radio
+ <RadioGroupStackedItem
+ value="SECURITY_INVOKER"
id="SECURITY_INVOKER"
label="SECURITY INVOKER"
- value="SECURITY_INVOKER"
- checked={!field.value}
description={
<>
Function is to be executed with the privileges of the user
@@ -362,11 +359,10 @@ export const CreateFunction = ({
</>
}
/>
- <Radio
+ <RadioGroupStackedItem
+ value="SECURITY_DEFINER"
id="SECURITY_DEFINER"
label="SECURITY DEFINER"
- value="SECURITY_DEFINER"
- checked={field.value}
description={
<>
Function is to be executed with the privileges of the user
@@ -374,7 +370,7 @@ export const CreateFunction = ({
</>
}
/>
- </Radio.Group>
+ </RadioGroupStacked>
</FormControl>
<FormMessage />
</FormItem>
diff --git a/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
index a291ed1a3b0..696e40af7fe 100644
--- a/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
@@ -9,7 +9,8 @@ import {
AlertDescription_Shadcn_,
AlertTitle_Shadcn_,
cn,
- Radio,
+ RadioGroupCard,
+ RadioGroupCardItem,
SidePanel,
} from 'ui'
@@ -149,65 +150,62 @@ const CustomDomainSidePanel = () => {
</p>
<div className={cn('!mt-8 pb-4', !hasAccessToCustomDomain && 'opacity-75')}>
- <Radio.Group
- type="large-cards"
- size="tiny"
+ <RadioGroupCard
id="custom-domain"
- onChange={(event: any) => setSelectedOption(event.target.value)}
+ className="flex flex-wrap gap-3"
+ value={selectedOption}
+ onValueChange={(value) => setSelectedOption(value)}
>
- <Radio
- name="custom-domain"
- checked={selectedOption === 'cd_none'}
- className="col-span-4 !p-0"
- label="No custom domain"
+ <RadioGroupCardItem
value="cd_none"
- >
- <div className="w-full group">
- <div className="border-b border-default px-4 py-2 group-hover:border-control">
- <p className="text-sm">No custom domain</p>
- </div>
- <div className="px-4 py-2">
- <p className="text-foreground-light">
- Use the default supabase domain for your API
- </p>
- <div className="flex items-center space-x-1 mt-2">
- <p className="text-foreground text-sm" translate="no">
- $0
- </p>
- <p className="text-foreground-light translate-y-[1px]"> / month</p>
- </div>
- </div>
- </div>
- </Radio>
- {availableOptions.map((option) => (
- <Radio
- className="col-span-4 !p-0"
- name="custom-domain"
- key={option.identifier}
- disabled={!hasAccessToCustomDomain}
- checked={selectedOption === option.identifier}
- label={option.name}
- value={option.identifier}
- >
- <div className="w-full group">
+ id="cd_none"
+ label={
+ <div className="w-full group text-left">
<div className="border-b border-default px-4 py-2 group-hover:border-control">
- <p className="text-sm">{option.name}</p>
+ <p className="text-sm">No custom domain</p>
</div>
<div className="px-4 py-2">
<p className="text-foreground-light">
- Present a branded experience to your users
+ Use the default supabase domain for your API
</p>
<div className="flex items-center space-x-1 mt-2">
<p className="text-foreground text-sm" translate="no">
- {formatCurrency(option.price)}
+ $0
</p>
<p className="text-foreground-light translate-y-[1px]"> / month</p>
</div>
</div>
</div>
- </Radio>
+ }
+ showIndicator={false}
+ />
+ {availableOptions.map((option) => (
+ <RadioGroupCardItem
+ key={option.identifier}
+ value={option.identifier}
+ id={option.identifier}
+ label={
+ <div className="w-full group text-left">
+ <div className="border-b border-default px-4 py-2 group-hover:border-control">
+ <p className="text-sm">{option.name}</p>
+ </div>
+ <div className="px-4 py-2">
+ <p className="text-foreground-light">
+ Present a branded experience to your users
+ </p>
+ <div className="flex items-center space-x-1 mt-2">
+ <p className="text-foreground text-sm" translate="no">
+ {formatCurrency(option.price)}
+ </p>
+ <p className="text-foreground-light translate-y-[1px]"> / month</p>
+ </div>
+ </div>
+ </div>
+ }
+ showIndicator={false}
+ />
))}
- </Radio.Group>
+ </RadioGroupCard>
</div>
{hasChanges && selectedOption !== 'cd_none' && (
diff --git a/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
index 2ba835538a2..845e9d08f70 100644
--- a/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
@@ -10,7 +10,8 @@ import {
Button,
cn,
CriticalIcon,
- Radio,
+ RadioGroupCard,
+ RadioGroupCardItem,
SidePanel,
} from 'ui'
@@ -279,43 +280,41 @@ const PITRSidePanel = () => {
/>
) : null}
- <Radio.Group
- type="large-cards"
- size="tiny"
+ <RadioGroupCard
id="pitr"
- label={<p className="text-sm">Choose the duration of recovery</p>}
- onChange={(event: any) => setSelectedOption(event.target.value)}
+ className="flex flex-wrap gap-3"
+ value={selectedOption}
+ onValueChange={(value) => setSelectedOption(value)}
+ disabled={!hasAccessToPitrVariants || subscriptionCompute === undefined}
>
{availableOptions.map((option) => (
- <Radio
- name="pitr"
- disabled={!hasAccessToPitrVariants || subscriptionCompute === undefined}
- className="col-span-4 !p-0"
+ <RadioGroupCardItem
key={option.identifier}
- checked={selectedOption === option.identifier}
- label={<span className="text-sm">{option.name}</span>}
value={option.identifier}
- >
- <div className="w-full group">
- <div className="border-b border-default px-4 py-2">
- <p className="text-sm">{option.name}</p>
- </div>
- <div className="px-4 py-2">
- <p className="text-foreground-light">
- Allow database restorations to any time up to{' '}
- {option.identifier.split('_')[1]} days ago
- </p>
- <div className="flex items-center space-x-1 mt-2">
- <p className="text-foreground text-sm" translate="no">
- {formatCurrency(option.price)}
+ id={option.identifier}
+ label={
+ <div className="w-full group">
+ <div className="border-b border-default px-4 py-2">
+ <p className="text-sm">{option.name}</p>
+ </div>
+ <div className="px-4 py-2">
+ <p className="text-foreground-light">
+ Allow database restorations to any time up to{' '}
+ {option.identifier.split('_')[1]} days ago
</p>
- <p className="text-foreground-light translate-y-[1px]"> / month</p>
+ <div className="flex items-center space-x-1 mt-2">
+ <p className="text-foreground text-sm" translate="no">
+ {formatCurrency(option.price)}
+ </p>
+ <p className="text-foreground-light translate-y-[1px]"> / month</p>
+ </div>
</div>
</div>
- </div>
- </Radio>
+ }
+ showIndicator={false}
+ />
))}
- </Radio.Group>
+ </RadioGroupCard>
</div>
)}
diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx
index e8daf813637..b859ad94383 100644
--- a/packages/ui/index.tsx
+++ b/packages/ui/index.tsx
@@ -40,7 +40,6 @@ export * from './src/components/Select'
export * from './src/components/Listbox'
export * from './src/components/Checkbox'
export * from './src/components/Input'
-export * from './src/components/Radio'
export * from './src/components/Toggle'
export * from './src/components/ExpandingTextArea'
diff --git a/packages/ui/src/components/Radio/Radio.module.css b/packages/ui/src/components/Radio/Radio.module.css
deleted file mode 100644
index 98658cbb773..00000000000
--- a/packages/ui/src/components/Radio/Radio.module.css
+++ /dev/null
@@ -1,109 +0,0 @@
-/* .sbui-radio-fieldset {
- @apply border-none p-0 m-0;
-} */
-
-.sbui-radio-container {
- @apply relative cursor-pointer flex p-0 py-2 border-none;
-}
-
-/* .sbui-radio-container--card {
- @apply p-4 border border-solid border-gray-200 dark:border-gray-500;
-} */
-
-.sbui-radio-container--card--active {
- @apply bg-brand-100 bg-opacity-20 border-brand-200 z-10;
-}
-
-/* .sbui-radio-container--card:first-child {
- @apply rounded-tl-md rounded-tr-md;
-}
-
-.sbui-radio-container--card:last-child {
- @apply rounded-bl-md rounded-br-md;
-} */
-
-.sbui-radio-label {
- @apply flex flex-row cursor-pointer;
-}
-
-.sbui-radio-label-text {
- @apply block text-sm font-medium dark:text-white;
-}
-
-.sbui-radio-label-text .sbui-radio__label-text-before,
-.sbui-radio-label-text .sbui-radio__label-text-after {
- @apply text-gray-400 dark:text-gray-300;
-}
-
-.sbui-radio-label-description {
- @apply block text-sm text-gray-400 dark:text-gray-300;
-}
-
-/* .sbui-radio {
- @apply h-4 w-4 ml-0 mr-3.5 rounded-2xl border border-solid transition-all;
-
- @apply text-brand-600 cursor-pointer border-gray-500;
- @apply focus:ring-brand-300 hover:border-brand-400 focus:outline-none;
-
- @apply dark:bg-transparent dark:hover:border-brand-400;
-} */
-
-/* .sbui-radio:checked {
- border-color: transparent;
- background-color: currentColor;
- background-size: 100% 100%;
- background-position: center;
- background-repeat: no-repeat;
-}
-
-.sbui-radio:checked {
- background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
-} */
-
-/* .sbui-radio {
- -webkit-appearance: none;
- -moz-appearance: none;
- appearance: none;
- -webkit-print-color-adjust: exact;
- print-color-adjust: exact;
- background-origin: border-box;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- flex-shrink: 0;
-} */
-
-.sbui-radio-group-contents {
- @apply dark:bg-transparent rounded-md -space-y-px;
-}
-
-/*
- Label sizes
-*/
-
-.sbui-radio-container--tiny .sbui-radio-label,
-.sbui-radio-container--tiny .sbui-radio-label-text,
-.sbui-radio-container--tiny .sbui-radio-label-description {
- @apply text-xs;
-}
-.sbui-radio-container--small .sbui-radio-label,
-.sbui-radio-container--small .sbui-radio-label-text,
-.sbui-radio-container--small .sbui-radio-label-description {
- @apply text-sm;
-}
-.sbui-radio-container--medium .sbui-radio-label,
-.sbui-radio-container--medium .sbui-radio-label-text,
-.sbui-radio-container--medium .sbui-radio-label-description {
- @apply text-sm;
-}
-.sbui-radio-container--large .sbui-radio-label,
-.sbui-radio-container--large .sbui-radio-label-text,
-.sbui-radio-container--large .sbui-radio-label-description {
- @apply text-base;
-}
-.sbui-radio-container--xlarge .sbui-radio-label,
-.sbui-radio-container--xlarge .sbui-radio-label-text,
-.sbui-radio-container--xlarge .sbui-radio-label-description {
- @apply text-base;
-}
diff --git a/packages/ui/src/components/Radio/Radio.tsx b/packages/ui/src/components/Radio/Radio.tsx
deleted file mode 100644
index c8f1842538d..00000000000
--- a/packages/ui/src/components/Radio/Radio.tsx
+++ /dev/null
@@ -1,275 +0,0 @@
-'use client'
-
-import React, { useEffect, useState } from 'react'
-
-import { FormLayout } from '../../lib/Layout/FormLayout/FormLayout'
-import styleHandler from '../../lib/theme/styleHandler'
-import { generateUID } from './../../lib/utils/randomIdGenerator'
-import { RadioContext } from './RadioContext'
-
-interface GroupProps {
- allowedValues?: any
- checkboxes?: any
- id?: any
- layout?: 'horizontal' | 'vertical'
- error?: any
- descriptionText?: any
- label?: any
- afterLabel?: string
- beforeLabel?: string
- labelOptional?: any
- name?: any
- type?: 'cards' | 'list' | 'small-cards' | 'large-cards'
- transform?: any
- value?: any
- className?: any
- children?: React.ReactNode
- options?: Array<InputProps>
- onChange?(x: React.ChangeEvent<HTMLInputElement>): void
- size?: 'tiny' | 'small' | 'medium' | 'large' | 'xlarge'
- validation?: (x: any) => void
- groupClassName?: string
- labelsLayout?: 'horizontal' | 'vertical'
-}
-
-/**
- * @deprecated Use `import { RadioGroup_Shadcn_ } from "ui"` instead
- */
-function RadioGroup({
- id,
- layout,
- error,
- descriptionText,
- label,
- afterLabel,
- beforeLabel,
- labelOptional,
- children,
- className,
- type = 'list',
- options,
- value,
- name,
- onChange,
- size = 'medium',
- validation,
- groupClassName,
- labelsLayout = 'vertical',
-}: GroupProps) {
- const [activeId, setActiveId] = useState('')
-
- const __styles = styleHandler('radio')
-
- useEffect(() => {
- setActiveId(value)
- }, [value])
-
- function parentCallback(e: React.ChangeEvent<HTMLInputElement>) {
- if (onChange) onChange(e)
- setActiveId(e.target.id)
- }
-
- return (
- <fieldset name={name} className={className}>
- <FormLayout
- nonBoxInput={true}
- label={label}
- afterLabel={afterLabel}
- beforeLabel={beforeLabel}
- labelOptional={labelOptional}
- layout={layout}
- id={id}
- error={error}
- descriptionText={descriptionText}
- size={size}
- labelLayout={labelsLayout}
- >
- <div className={groupClassName || __styles.variants[type].group}>
- <RadioContext.Provider value={{ parentCallback, type, name, activeId, parentSize: size }}>
- {options
- ? options.map((option: InputProps) => {
- return (
- <Radio
- id={option.id}
- label={option.label}
- beforeLabel={option.beforeLabel}
- afterLabel={option.afterLabel}
- value={option.value}
- description={option.description}
- />
- )
- })
- : children}
- </RadioContext.Provider>
- </div>
- </FormLayout>
- </fieldset>
- )
-}
-
-interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
- label: string | React.ReactNode
- afterLabel?: string | React.ReactNode
- beforeLabel?: string | React.ReactNode
- description?: string | React.ReactNode
- size?: 'tiny' | 'small' | 'medium' | 'large' | 'xlarge'
- hidden?: boolean
- align?: 'vertical' | 'horizontal'
- optionalLabel?: 'string' | React.ReactNode
- addOnBefore?: React.ReactNode
- children?: React.ReactNode
-}
-
-/**
- * @deprecated Use ./RadioGroupItem_Shadcn_ instead
- */
-function Radio({
- id = generateUID(),
- disabled,
- value,
- label,
- afterLabel,
- beforeLabel,
- description,
- name,
- checked,
- className,
- onChange,
- onBlur,
- hidden = false,
- size = 'medium',
- align = 'vertical',
- optionalLabel,
- addOnBefore,
- children,
-}: InputProps) {
- const __styles = styleHandler('radio')
-
- const inputName = name
-
- return (
- <RadioContext.Consumer>
- {({ parentCallback, type, name, activeId, parentSize }) => {
- // if id does not exist, use label
-
- const markupId = id
-
- // if name does not exist on Radio then use Context Name from Radio.Group
- const markupName = name || inputName
-
- // console.log('markupName', markupName)
- // @ts-ignore
- size = parentSize || size
-
- // check if radio id is via parent component
- // then check if radio checked prop is true or false
- // if no boolean exists the checkbox will rely on native control
- const active =
- activeId === markupId ? true : checked ? true : checked === false ? false : undefined
-
- let classes = [
- className,
- __styles.variants[type].container.base,
- // __styles.variants[type].container.align[align],
- type === 'list' && !hidden && __styles.variants[type].container.size[size],
- ]
-
- classes.push(__styles.variants[type].base)
- classes.push(__styles.variants[type].size[size])
-
- if (active) {
- classes.push(__styles.variants[type].active)
- } else {
- classes.push(__styles.variants[type].inactive)
- }
-
- if (disabled) {
- classes.push(__styles.disabled)
- }
-
- if (type !== 'list') hidden = true
-
- function onInputChange(e: React.ChangeEvent<HTMLInputElement>) {
- // '`onChange` callback for parent component
- if (parentCallback) {
- parentCallback(e)
- }
- // '`onChange` callback for this component
- if (onChange) onChange(e)
- }
-
- return (
- <label htmlFor={markupId} className={classes.join(' ')}>
- <input
- id={markupId}
- name={markupName}
- type="radio"
- className={[
- __styles.base,
- __styles.size[size],
- hidden && __styles.hidden,
- __styles.variants[type].radio_offset,
- '',
- ].join(' ')}
- checked={active}
- disabled={disabled}
- value={value ? value : markupId}
- onChange={(e) => onInputChange(e)}
- onBlur={onBlur}
- />
- {addOnBefore}
- {children || (
- <>
- <div
- className={[
- __styles.label.base,
- __styles.label[size],
- __styles.variants[type].container.align[align],
- ].join(' ')}
- >
- {beforeLabel && (
- <div
- className={[__styles.label_before.base, __styles.label_before[size]].join(
- ' '
- )}
- >
- {beforeLabel}
- </div>
- )}
- <div>{label}</div>
- {afterLabel && (
- <div
- className={[__styles.label_after.base, __styles.label_after[size]].join(' ')}
- >
- {afterLabel}
- </div>
- )}
- {description && (
- <div
- className={[__styles.description.base, __styles.description[size]].join(' ')}
- >
- {description}
- </div>
- )}
- </div>
- {optionalLabel && (
- <div
- className={[__styles.optionalLabel.base, __styles.optionalLabel[size]].join(
- ' '
- )}
- >
- {optionalLabel}
- </div>
- )}
- </>
- )}
- </label>
- )
- }}
- </RadioContext.Consumer>
- )
-}
-
-Radio.Group = RadioGroup
-
-export default Radio
diff --git a/packages/ui/src/components/Radio/RadioContext.tsx b/packages/ui/src/components/Radio/RadioContext.tsx
deleted file mode 100644
index 08bcd309eaf..00000000000
--- a/packages/ui/src/components/Radio/RadioContext.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { createContext } from 'react'
-
-// Make sure the shape of the default value passed to
-// createContext matches the shape that the consumers expect!
-export const RadioContext = createContext({
- parentCallback: (e: any) => {},
- type: '',
- name: '',
- activeId: '',
- parentSize: '',
-})
diff --git a/packages/ui/src/components/Radio/index.tsx b/packages/ui/src/components/Radio/index.tsx
deleted file mode 100644
index 6b47866173f..00000000000
--- a/packages/ui/src/components/Radio/index.tsx
+++ /dev/null
@@ -1,4 +0,0 @@
-import Radio from './Radio'
-
-export default Radio
-export { default as Radio } from './Radio'
diff --git a/packages/ui/src/components/RadioOld/Radio.css b/packages/ui/src/components/RadioOld/Radio.css
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/packages/ui/src/components/RadioOld/Radio.js b/packages/ui/src/components/RadioOld/Radio.js
deleted file mode 100644
index e2293e5b041..00000000000
--- a/packages/ui/src/components/RadioOld/Radio.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import PropTypes from 'prop-types'
-import React from 'react'
-
-import './Radio.css'
-
-/**
- * @deprecated Use `import { RadioGroup_Shadcn_, RadioGroupItem_Shadcn_ } from "ui"` instead
- */
-const Radio = ({ className = '', label = '', containerClassName = '', children, ...props }) => {
- return (
- <label className={`inline-flex items-center ${containerClassName}`}>
- <input type="radio" className={`form-radio border-solid h-4 w-4 ${className}`} {...props} />
- <span className="ml-2">{label}</span>
- </label>
- )
-}
-
-Radio.propTypes = {
- label: PropTypes.string,
- className: PropTypes.string,
-}
-
-export default Radio
diff --git a/packages/ui/src/components/RadioOld/Radio.test.jsx b/packages/ui/src/components/RadioOld/Radio.test.jsx
deleted file mode 100644
index 511e0f47452..00000000000
--- a/packages/ui/src/components/RadioOld/Radio.test.jsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { describe, it } from 'vitest'
-
-describe('#Radio', () => {
- it('should render radio correctly', () => {
- // render(
- // // <Radio data-testid="form-radio" />
- // )
- // expect(screen.queryByTestId('form-radio')).toBeInTheDocument()
- })
-
- it('should show label', () => {
- // render(
- // <Radio data-testid="form-radio" label="JavaScript" />
- // )
- // expect(screen.queryByText('JavaScript')).toBeInTheDocument()
- })
-})
diff --git a/packages/ui/src/components/RadioOld/index.js b/packages/ui/src/components/RadioOld/index.js
deleted file mode 100644
index e200e77534e..00000000000
--- a/packages/ui/src/components/RadioOld/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export { default as Radio } from './Radio'
diff --git a/packages/ui/src/components/radio-group-card.tsx b/packages/ui/src/components/radio-group-card.tsx
index 88f75e9d30a..82d5f13c88f 100644
--- a/packages/ui/src/components/radio-group-card.tsx
+++ b/packages/ui/src/components/radio-group-card.tsx
@@ -16,7 +16,7 @@ RadioGroupCard.displayName = RadioGroupPrimitive.Root.displayName
interface RadioGroupCardItemProps {
image?: React.ReactNode
- label: string | React.ReactNode
+ label: React.ReactNode
showIndicator?: boolean
}
@@ -52,13 +52,13 @@ const RadioGroupCardItem = React.forwardRef<
{showIndicator && (
<div
className="
- aspect-square h-4 w-4
+ aspect-square h-4 w-4
rounded-full border group-data-[state=checked]:border-foreground-muted
group-focus:border-foreground-muted
group-hover:border-foreground-muted
- ring-offset-background
- group-focus:outline-none
- group-focus-visible:ring-2 group-focus-visible:ring-ring group-focus-visible:ring-offset-2
+ ring-offset-background
+ group-focus:outline-none
+ group-focus-visible:ring-2 group-focus-visible:ring-ring group-focus-visible:ring-offset-2
group-disabled:cursor-not-allowed group-disabled:opacity-50
flex items-center justify-center
transition
diff --git a/packages/ui/src/components/radio-group-stacked.tsx b/packages/ui/src/components/radio-group-stacked.tsx
index 5d8ea4cf1da..d6638a61bd8 100644
--- a/packages/ui/src/components/radio-group-stacked.tsx
+++ b/packages/ui/src/components/radio-group-stacked.tsx
@@ -24,9 +24,9 @@ RadioGroupStacked.displayName = 'RadioGroupStacked'
interface RadioGroupStackedItemProps {
image?: React.ReactNode
- label: string
+ label: React.ReactNode
showIndicator?: boolean
- description?: string
+ description?: React.ReactNode
}
const RadioGroupStackedItem = React.forwardRef<
diff --git a/packages/ui/src/lib/theme/defaultTheme.ts b/packages/ui/src/lib/theme/defaultTheme.ts
index aecccbdc5a2..e61e10cb6e5 100644
--- a/packages/ui/src/lib/theme/defaultTheme.ts
+++ b/packages/ui/src/lib/theme/defaultTheme.ts
@@ -570,248 +570,6 @@ export default {
group: `space-y-3`,
},
- /*
- * Radio
- *
- *
- * This Radio requires a plugin in your config:
-
- ```
- // tailwind.config.js
- module.exports = {
- // ...
- plugins: [
- // ...
- require('@tailwindcss/forms'),
- ],
- }
- ```
- *
- *
- */
-
- radio: {
- base: `
- absolute
- ${defaults.focus}
- focus:ring-brand-400
- border-strong
-
- text-brand
- shadow-sm
- cursor-pointer
- peer
-
- bg-surface-100
- `,
- hidden: `absolute opacity-0`,
- size: {
- tiny: `h-3 w-3`,
- small: `h-3.5 w-3.5`,
- medium: `h-4 w-4`,
- large: `h-5 w-5`,
- xlarge: `h-5 w-5`,
- },
- variants: {
- cards: {
- container: {
- base: `relative cursor-pointer flex`,
- align: {
- vertical: 'flex flex-col space-y-1',
- horizontal: 'flex flex-row space-x-2',
- },
- },
- group: `-space-y-px shadow-sm`,
- base: `
- transition
- border
- first:rounded-tl-md first:rounded-tr-md
- last:rounded-bl-md last:rounded-br-md
- `,
- size: {
- tiny: `px-5 py-3`,
- small: `px-6 py-4`,
- medium: `px-6 py-4`,
- large: `px-8 p-4`,
- xlarge: `px-8 p-4`,
- },
- inactive: `
- bg-surface-200
- border-alternative
- hover:border-strong
- hover:bg-surface-300
- `,
- active: `
- bg-selection z-10
- border-stronger
- border-1
- `,
- radio_offset: 'left-4',
- },
-
- 'stacked-cards': {
- container: {
- base: `relative cursor-pointer flex items-center justify-between`,
- align: {
- vertical: 'flex flex-col space-y-1',
- horizontal: 'flex flex-row space-x-2',
- },
- },
- group: `space-y-3`,
- base: `
- transition
- rounded-md
- border
- shadow-sm
- `,
- size: {
- tiny: `px-5 py-3`,
- small: `px-6 py-4`,
- medium: `px-6 py-4`,
- large: `px-8 p-4`,
- xlarge: `px-8 p-4`,
- },
- inactive: `
- bg-surface-200
- border-alternative
- hover:border-strong
- hover:bg-surface-300
- `,
- active: `
- bg-selection z-10
- border-stronger
- border-1
- `,
- radio_offset: 'left-4',
- },
-
- 'small-cards': {
- container: {
- base: `relative cursor-pointer flex`,
- align: {
- vertical: 'flex flex-col space-y-1 items-center justify-center',
- horizontal: 'flex flex-row space-x-2',
- },
- },
- group: `flex flex-row gap-3`,
- base: `
- transition
- border
- rounded-lg
- grow
- items-center
- flex-wrap
- justify-center
- shadow-sm
- `,
- size: {
- tiny: `px-5 py-3`,
- small: `px-6 py-4`,
- medium: `px-6 py-4`,
- large: `px-8 p-4`,
- xlarge: `px-8 p-4`,
- },
- inactive: `
- bg-surface-200
- border-alternative
- hover:border-strong
- hover:bg-surface-300
- `,
- active: `
- bg-selection z-10
- border-stronger border-1
- `,
- radio_offset: 'left-4',
- },
-
- 'large-cards': {
- container: {
- base: `relative cursor-pointer flex`,
- align: {
- vertical: 'flex flex-col space-y-1',
- horizontal: 'flex flex-row space-x-2',
- },
- },
- group: `grid grid-cols-12 gap-3`,
- base: `
- transition
- border border-stronger
- shadow-sm
- rounded-lg
- grow
- `,
- size: {
- tiny: `px-5 py-3`,
- small: `px-6 py-4`,
- medium: `px-6 py-4`,
- large: `px-8 p-4`,
- xlarge: `px-8 p-4`,
- },
- inactive: `
- bg-surface-200
- border-alternative
- hover:border-strong
- hover:bg-surface-300
- `,
- active: `
- bg-selection z-10
- border-strong
- border-1
- `,
- radio_offset: 'left-4',
- },
-
- list: {
- container: {
- base: `relative cursor-pointer flex`,
- size: {
- tiny: `pl-6`,
- small: `pl-6`,
- medium: `pl-7`,
- large: `pl-7`,
- xlarge: `pl-7`,
- },
- align: {
- vertical: 'flex flex-col space-y-1',
- horizontal: 'flex flex-row space-x-2',
- },
- },
- group: `space-y-4`,
- base: ``,
- size: {
- tiny: `0`,
- small: `0`,
- medium: `0`,
- large: `0`,
- xlarge: `0`,
- },
- active: ``,
- radio_offset: 'left-0',
- },
- },
- label: {
- base: `text-foreground-light cursor-pointer`,
- ...defaults.size.text,
- },
- label_before: {
- base: 'text-border',
- ...defaults.size.text,
- },
- label_after: {
- base: 'text-border',
- ...defaults.size.text,
- },
- description: {
- base: `text-foreground-lighter`,
- ...defaults.size.text,
- },
- optionalLabel: {
- base: `text-foreground-lighter`,
- ...defaults.size.text,
- },
- disabled: `opacity-50 cursor-auto border-dashed`,
- },
-
sidepanel: {
base: `
z-50