diff --git a/packages/ui/src/components/button.tsx b/packages/ui/src/components/button.tsx index f0e24d0b0..45eeedf9d 100644 --- a/packages/ui/src/components/button.tsx +++ b/packages/ui/src/components/button.tsx @@ -12,11 +12,11 @@ const buttonVariants = cva( variant: { default: 'bg-background-5 text-foreground-6 hover:bg-background-10 disabled:bg-background-6 disabled:text-foreground-9', - destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm', + destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90', outline: - 'border-borders-2 text-foreground-2 hover:border-borders-6 hover:text-foreground-8 border bg-transparent', - secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-sm', - tertiary: 'bg-tertiary text-secondary-foreground hover:bg-tertiary/80 shadow-sm', + 'border border-borders-2 bg-transparent text-foreground-2 hover:border-borders-6 hover:text-foreground-8', + secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80', + tertiary: 'bg-tertiary text-secondary-foreground shadow-sm hover:bg-tertiary/80', ghost: 'hover:bg-background-12 hover:text-accent-foreground', link: 'text-primary underline-offset-4 hover:underline', link_accent: 'text-foreground-accent underline-offset-4 hover:underline', diff --git a/packages/ui/src/components/checkbox.tsx b/packages/ui/src/components/checkbox.tsx index ecb6573c7..513aef78e 100644 --- a/packages/ui/src/components/checkbox.tsx +++ b/packages/ui/src/components/checkbox.tsx @@ -15,7 +15,7 @@ const Checkbox = forwardRef, CheckboxP
diff --git a/packages/ui/src/components/form-legend.tsx b/packages/ui/src/components/form-legend.tsx new file mode 100644 index 000000000..9deaccd37 --- /dev/null +++ b/packages/ui/src/components/form-legend.tsx @@ -0,0 +1,24 @@ +import { ReactNode } from 'react' + +import { Text } from '@components/text' + +interface FormLegendProps { + title: ReactNode + description?: ReactNode + className?: string +} + +export function FormLegend({ title, description, className }: FormLegendProps) { + return ( +
+ + {title} + + {description && ( + + {description} + + )} +
+ ) +} diff --git a/packages/ui/src/components/form-separator.tsx b/packages/ui/src/components/form-separator.tsx new file mode 100644 index 000000000..626d09de1 --- /dev/null +++ b/packages/ui/src/components/form-separator.tsx @@ -0,0 +1,17 @@ +import { cn } from '@utils/cn' + +interface FormSeparatorProps { + dashed?: boolean + dotted?: boolean + className?: string +} + +export function FormSeparator({ dashed, dotted, className }: FormSeparatorProps) { + return ( +
+ ) +} diff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.ts index 089f4a7ad..b0b81fa2c 100644 --- a/packages/ui/src/components/index.ts +++ b/packages/ui/src/components/index.ts @@ -41,6 +41,8 @@ export * from './breadcrumb' export * from './skeleton-list' export * from './dialog' export * from './path-breadcrumbs' +export * from './form-separator' +export * from './form-legend' export * as ShaBadge from './sha-badge' export * as ListActions from './list-actions' diff --git a/packages/ui/src/components/input.tsx b/packages/ui/src/components/input.tsx index 6a02de872..2feaf697f 100644 --- a/packages/ui/src/components/input.tsx +++ b/packages/ui/src/components/input.tsx @@ -12,11 +12,11 @@ export interface BaseInputProps extends Omit, 'size'>, VariantProps {} -const inputVariants = cva('text-foreground-1 bg-transparent px-2.5 py-1 disabled:cursor-not-allowed', { +const inputVariants = cva('bg-transparent px-2.5 py-1 text-foreground-1 disabled:cursor-not-allowed', { variants: { variant: { default: - 'placeholder:text-foreground-4 flex w-full rounded border text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:rounded focus-visible:outline-none', + 'flex w-full rounded border text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-foreground-4 focus-visible:rounded focus-visible:outline-none', extended: 'grow border-none focus-visible:outline-none' }, size: { @@ -72,7 +72,7 @@ const Input = forwardRef( )} {caption && ( - + {caption} )} diff --git a/packages/ui/src/components/label.tsx b/packages/ui/src/components/label.tsx index 1bb52ba5b..3468b43df 100644 --- a/packages/ui/src/components/label.tsx +++ b/packages/ui/src/components/label.tsx @@ -41,7 +41,7 @@ interface LabelProps extends VariantProps, PropsWithChildr const Label = ({ htmlFor, optional, color, variant, children, className }: LabelProps) => { return ( - {children} {optional && (optional)} + {children} {optional && (optional)} ) } diff --git a/packages/ui/src/components/manage-navigation/index.tsx b/packages/ui/src/components/manage-navigation/index.tsx index 123e31f24..4a131dc4a 100644 --- a/packages/ui/src/components/manage-navigation/index.tsx +++ b/packages/ui/src/components/manage-navigation/index.tsx @@ -127,7 +127,7 @@ export const ManageNavigation = ({
- + Pinned {!currentPinnedItems.length ? ( diff --git a/packages/ui/src/components/radio-group.tsx b/packages/ui/src/components/radio-group.tsx index f147f1aba..e8ad3108c 100644 --- a/packages/ui/src/components/radio-group.tsx +++ b/packages/ui/src/components/radio-group.tsx @@ -1,6 +1,5 @@ import { ComponentPropsWithoutRef, ElementRef, FC, forwardRef, ReactElement, ReactNode } from 'react' -import { CheckIcon } from '@radix-ui/react-icons' import * as RadioGroupPrimitive from '@radix-ui/react-radio-group' import { cn } from '@utils/cn' @@ -64,14 +63,12 @@ const RadioButton = forwardRef< - - - + ) }) diff --git a/packages/ui/src/components/select.tsx b/packages/ui/src/components/select.tsx index 9a099db36..238135d89 100644 --- a/packages/ui/src/components/select.tsx +++ b/packages/ui/src/components/select.tsx @@ -49,7 +49,7 @@ const Select: FC = ({ )} {caption && ( - + {caption} )} diff --git a/packages/ui/src/components/textarea.tsx b/packages/ui/src/components/textarea.tsx index 7a0fd4789..a0adda18b 100644 --- a/packages/ui/src/components/textarea.tsx +++ b/packages/ui/src/components/textarea.tsx @@ -46,7 +46,7 @@ const Textarea = forwardRef( )} {caption && ( - + {caption} )} diff --git a/packages/ui/src/views/pull-request/compare/components/pull-request-compare-form.tsx b/packages/ui/src/views/pull-request/compare/components/pull-request-compare-form.tsx index 19b69fdf4..e7d203eff 100644 --- a/packages/ui/src/views/pull-request/compare/components/pull-request-compare-form.tsx +++ b/packages/ui/src/views/pull-request/compare/components/pull-request-compare-form.tsx @@ -1,15 +1,11 @@ import { forwardRef } from 'react' import { FieldErrors, SubmitHandler, UseFormHandleSubmit, UseFormRegister } from 'react-hook-form' -import { MessageTheme } from '@components/form-field-set' -import * as FormFieldSet from '@components/form-field-set' +import { ErrorMessageTheme, Fieldset, Input, Textarea } from '@/components' import { Text } from '@components/text' import { z } from 'zod' -import { Input, Textarea } from '@harnessio/ui/components' - // Define the form schema -// eslint-disable-next-line @typescript-eslint/no-unused-vars const formSchemaCompare = z.object({ title: z.string().min(1, { message: 'Please provide a pull request title' }), description: z.string().optional() @@ -35,26 +31,30 @@ const PullRequestCompareForm = forwardRef } return (
- - - - Title - - - {errors.title && ( - {errors.title.message?.toString()} - )} - - - Description -