Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { Button } from '@sim/emcn'
interface PublicChatActionButtonProps
extends Omit<
ComponentProps<typeof Button>,
'variant' | 'size' | 'iconSize' | 'iconPadding' | 'className'
'variant' | 'size' | 'iconSize' | 'iconPadding' | 'className' | 'shape'
> {
variant: 'primary' | 'quiet'
'aria-label': string
}

/** Public chat's circular composer action, retaining its primary and quiet palettes. */
export const PublicChatActionButton = forwardRef<HTMLButtonElement, PublicChatActionButtonProps>(
(props, ref) => <Button {...props} ref={ref} className='size-[28px] rounded-full p-0' />
(props, ref) => <Button {...props} ref={ref} iconSize='regular' shape='round' />
)
PublicChatActionButton.displayName = 'PublicChatActionButton'
4 changes: 2 additions & 2 deletions apps/sim/app/playground/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default function PlaygroundPage() {
aria-label='Go back'
variant='ghost'
onClick={() => router.back()}
className='size-8 p-0'
iconSize='roomy'
>
<ArrowLeft className='size-4' />
</Button>
Expand All @@ -187,7 +187,7 @@ export default function PlaygroundPage() {
aria-label={isDarkMode ? 'Light mode' : 'Dark mode'}
variant='default'
onClick={toggleDarkMode}
className='size-8 p-0'
iconSize='roomy'
>
{isDarkMode ? <Sun className='size-4' /> : <Moon className='size-4' />}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,11 @@ export function ResizableImageView({ node, selected, editor, getPos }: ReactNode
type='button'
variant='ghost'
size='icon'
iconSize={{ base: 'touch', sm: 'roomy' }}
iconPadding='sm'
aria-label='Resize image'
onPointerDown={startResize}
className='absolute right-0 bottom-0 flex size-10 cursor-nwse-resize touch-none items-end justify-end p-1 sm:size-8'
className='absolute right-0 bottom-0 cursor-nwse-resize touch-none items-end justify-end'
>
<span className='size-3 rounded-[3px] border border-[var(--bg)] bg-[var(--brand-secondary)]' />
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ describe('ToolbarButton', () => {
)

const button = host.querySelector('button[aria-label="Add to Chat"]')
expect(button?.className).toContain('size-[28px]')
expect(button?.classList.contains('size-10')).toBe(true)
expect(button?.classList.contains('sm:size-7')).toBe(true)
expect(button?.querySelector('svg')?.className.baseVal).toContain('size-[12px]')
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ComponentType, SVGProps } from 'react'
import { Button, cn, Tooltip } from '@sim/emcn'
import { Button, Tooltip } from '@sim/emcn'

interface ToolbarButtonProps {
/** Any SVG icon component, e.g. from `@sim/emcn/icons`. */
Expand Down Expand Up @@ -28,17 +28,15 @@ export function ToolbarButton({
<Tooltip.Trigger asChild>
<Button
type='button'
variant={isActive ? 'active' : 'ghost'}
variant={isActive ? 'active' : 'quiet'}
size='icon'
iconSize={{ base: 'touch', sm: 'regular' }}
aria-label={label}
aria-pressed={isActive}
disabled={disabled}
onPointerDown={(event) => event.preventDefault()}
onClick={onClick}
className={cn(
'size-10 focus-visible:bg-[var(--surface-hover)] sm:size-[28px]',
!isActive && 'hover-hover:bg-[var(--surface-hover)]'
)}
className='focus-visible:bg-[var(--surface-hover)]'
>
<Icon className={iconSize === 'compact' ? 'size-[12px]' : 'size-[14px]'} />
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('MicButton', () => {
const waveform = container.querySelector('svg[viewBox="0 0 18 18"]')
const bars = waveform?.querySelectorAll('line')

expect(button?.className).toContain('size-[28px]')
expect(button?.classList.contains('size-7')).toBe(true)
expect(button?.className).toContain('overflow-hidden')
expect(button?.className).toContain('rounded-full')
expect(waveform?.classList.contains('size-[18px]')).toBe(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,13 @@ export const MicButton = memo(function MicButton({
<Tooltip.Trigger asChild>
<Button
type='button'
variant={isListening ? 'active' : 'ghost'}
variant={isListening ? 'active' : 'quiet'}
Comment thread
BillLeoutsakosvl346 marked this conversation as resolved.
iconSize='regular'
shape='round'
onClick={onToggle}
aria-label={isListening ? 'Stop listening' : 'Voice input'}
aria-pressed={isListening}
className={cn(
'relative size-[28px] overflow-hidden rounded-full p-0 transition-[background-color,color,scale] duration-150 ease-out active:scale-[0.96] motion-reduce:transition-none motion-reduce:active:scale-100',
!isListening &&
'text-[var(--text-icon)] hover-hover:bg-[var(--surface-hover)] hover-hover:text-[var(--text-icon)]'
)}
className='relative overflow-hidden transition-[background-color,color,scale] duration-150 ease-out active:scale-[0.96] motion-reduce:transition-none motion-reduce:active:scale-100'
Comment thread
BillLeoutsakosvl346 marked this conversation as resolved.
>
<span
className={cn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import {
FieldError,
RequiredLabel,
} from '@/app/workspace/[workspaceId]/tables/[tableId]/components/sidebar-fields'
import {
TableSidebarHeader,
TableSidebarHeaderAction,
} from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-sidebar-header/table-sidebar-header'
import { useAddTableColumn, useUpdateColumn } from '@/hooks/queries/tables'
import { SelectOptionsEditor } from '../select-field'
import { columnTypeOptionsForTable } from './column-types'
Expand Down Expand Up @@ -263,19 +267,12 @@ function ColumnConfigBody({

return (
<div className='flex h-full flex-col'>
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
<TableSidebarHeader>
<h2 className='text-[var(--text-primary)] text-small'>Configure column</h2>
<Button
variant='ghost'
size='sm'
onClick={onClose}
iconPadding='sm'
className='size-7'
aria-label='Close'
>
<TableSidebarHeaderAction onClick={onClose} aria-label='Close'>
<X className='size-[14px]' />
</Button>
</div>
</TableSidebarHeaderAction>
</TableSidebarHeader>

<div className='flex-1 overflow-y-auto overflow-x-hidden px-2 pt-3 pb-2 [overflow-anchor:none]'>
{/* `disabled` on the fieldset reaches every native control inside,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import type { ColumnDefinition, WorkflowGroup, WorkflowGroupOutput } from '@/lib
import { columnMatchesRef, getColumnId } from '@/lib/table/column-keys'
import { deriveOutputColumnName } from '@/lib/table/column-naming'
import { FieldError } from '@/app/workspace/[workspaceId]/tables/[tableId]/components/sidebar-fields'
import {
TableSidebarHeader,
TableSidebarHeaderAction,
} from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-sidebar-header/table-sidebar-header'
import type { EnrichmentConfig as EnrichmentDef } from '@/enrichments/types'
import {
useAddWorkflowGroup,
Expand Down Expand Up @@ -232,31 +236,21 @@ export function EnrichmentConfig({

return (
<div className='flex h-full flex-col'>
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
<TableSidebarHeader>
<div className='flex min-w-0 items-center gap-1.5'>
<Button
variant='ghost'
size='sm'
<TableSidebarHeaderAction
onClick={onBack}
iconPadding='sm'
className='size-7 flex-none'
className='flex-none'
aria-label='Back to enrichments'
>
<ArrowLeft className='size-[14px]' />
</Button>
</TableSidebarHeaderAction>
<OverflowText label={enrichment.name} className='text-[var(--text-primary)] text-small' />
</div>
<Button
variant='ghost'
size='sm'
onClick={onClose}
iconPadding='sm'
className='size-7 flex-none'
aria-label='Close'
>
<TableSidebarHeaderAction onClick={onClose} className='flex-none' aria-label='Close'>
<X className='size-[14px]' />
</Button>
</div>
</TableSidebarHeaderAction>
</TableSidebarHeader>

<div className='flex-1 overflow-y-auto overflow-x-hidden px-2 pt-3 pb-2 [overflow-anchor:none]'>
<div className='flex flex-col gap-[9.5px]'>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
'use client'

import { useState } from 'react'
import { Button, ChipInput, cn } from '@sim/emcn'
import { ChipInput, cn } from '@sim/emcn'
import { Search, X } from '@sim/emcn/icons'
import type { ColumnDefinition, WorkflowGroup } from '@/lib/table'
import {
TableSidebarHeader,
TableSidebarHeaderAction,
} from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-sidebar-header/table-sidebar-header'
import { ALL_ENRICHMENTS } from '@/enrichments'
import { getEnrichment } from '@/enrichments/registry'
import type { EnrichmentConfig as EnrichmentDef } from '@/enrichments/types'
Expand Down Expand Up @@ -71,19 +75,12 @@ function EnrichmentsSidebarBody({
if (editGroup && !editEnrichment) {
return (
<div className='flex h-full flex-col'>
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
<TableSidebarHeader>
<h2 className='text-[var(--text-primary)] text-small'>Enrichment</h2>
<Button
variant='ghost'
size='sm'
onClick={onClose}
iconPadding='sm'
className='size-7 flex-none'
aria-label='Close'
>
<TableSidebarHeaderAction onClick={onClose} className='flex-none' aria-label='Close'>
<X className='size-[14px]' />
</Button>
</div>
</TableSidebarHeaderAction>
</TableSidebarHeader>
<div className='flex flex-1 items-center justify-center px-6 text-center'>
<p className='text-[var(--text-tertiary)] text-small'>
This enrichment ("{editGroup.enrichmentId}") is no longer available. Delete the column
Expand Down Expand Up @@ -118,19 +115,12 @@ function EnrichmentsSidebarBody({

return (
<div className='flex h-full flex-col'>
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
<TableSidebarHeader>
<h2 className='text-[var(--text-primary)] text-small'>Enrichments</h2>
<Button
variant='ghost'
size='sm'
onClick={onClose}
iconPadding='sm'
className='size-7 flex-none'
aria-label='Close'
>
<TableSidebarHeaderAction onClick={onClose} className='flex-none' aria-label='Close'>
<X className='size-[14px]' />
</Button>
</div>
</TableSidebarHeaderAction>
</TableSidebarHeader>

<div className='px-2 pt-3'>
<ChipInput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { type ButtonHTMLAttributes, forwardRef, type ReactNode } from 'react'
import { Button, cn } from '@sim/emcn'

interface TableSidebarHeaderProps {
children: ReactNode
}

export function TableSidebarHeader({ children }: TableSidebarHeaderProps) {
return (
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
{children}
</div>
)
}

interface TableSidebarHeaderActionProps extends ButtonHTMLAttributes<HTMLButtonElement> {
'aria-label': string
}

export const TableSidebarHeaderAction = forwardRef<
HTMLButtonElement,
TableSidebarHeaderActionProps
>(({ className, ...props }, ref) => (
<Button
{...props}
ref={ref}
variant='ghost'
size='sm'
iconSize='regular'
iconPadding='sm'
Comment thread
BillLeoutsakosvl346 marked this conversation as resolved.
className={cn(
'focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--text-muted)_30%,transparent)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface-2)]',
className
)}
/>
))

TableSidebarHeaderAction.displayName = 'TableSidebarHeaderAction'
Loading
Loading