Skip to content

Commit 8e9d5fd

Browse files
BillLeoutsakosvl346Bill Leoutsakos
andauthored
refactor(ui): narrow local style forwarding and preview geometry (#8144)
Co-authored-by: Bill Leoutsakos <billleoutsakos@Bills-MacBook-Pro.local>
1 parent 9d176cd commit 8e9d5fd

7 files changed

Lines changed: 27 additions & 25 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/components/custom-tool-editor/custom-tool-code-field.tsx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ export function CustomToolCodeField({
284284
}}
285285
className='w-64'
286286
style={{
287-
position: 'absolute',
288287
top: `${dropdownPosition.top}px`,
289288
left: `${dropdownPosition.left}px`,
290289
}}
@@ -309,7 +308,6 @@ export function CustomToolCodeField({
309308
}}
310309
className='w-64'
311310
style={{
312-
position: 'absolute',
313311
top: `${dropdownPosition.top}px`,
314312
left: `${dropdownPosition.left}px`,
315313
}}

‎apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ const MARKDOWN_COMPONENTS = {
264264
th({ children, style }: ThProps) {
265265
return (
266266
<th
267-
style={style}
267+
style={{ textAlign: style?.textAlign }}
268268
className='whitespace-nowrap border-[var(--border)] border-b px-3 py-2 text-left font-semibold text-[var(--text-primary)] text-sm leading-6'
269269
>
270270
{children}
@@ -274,7 +274,7 @@ const MARKDOWN_COMPONENTS = {
274274
td({ children, style }: TdProps) {
275275
return (
276276
<td
277-
style={style}
277+
style={{ textAlign: style?.textAlign }}
278278
className='whitespace-nowrap border-[var(--border)] border-b px-3 py-2 text-[var(--text-primary)] text-sm leading-6'
279279
>
280280
{children}

‎apps/sim/app/workspace/[workspaceId]/settings/components/mcp/components/mcp-server-form-modal/mcp-server-form-modal.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function FormattedInput({
180180
onClose={envVarProps.onClose}
181181
className='w-full'
182182
maxHeight='200px'
183-
style={{ position: 'absolute', top: '100%', left: 0, zIndex: 99999 }}
183+
style={{ top: '100%', left: 0, zIndex: 99999 }}
184184
/>
185185
)}
186186
</div>

‎apps/sim/app/workspace/[workspaceId]/settings/components/secrets/components/secret-value-field/secret-value-field.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ const VIEWER_MASK_LENGTH = 10
1111

1212
type SecretValueFieldProps = Omit<
1313
ComponentProps<'input'>,
14-
'type' | 'value' | 'onChange' | 'readOnly'
14+
'type' | 'value' | 'onChange' | 'readOnly' | 'style'
1515
> & {
16+
/** The chip owns field styling; callers use className for layout. */
17+
style?: never
1618
value: string
1719
onChange?: (value: string) => void
1820
/**
@@ -47,7 +49,7 @@ export function SecretValueField({
4749
readOnly = false,
4850
onFocus,
4951
onBlur,
50-
style,
52+
style: _style,
5153
className,
5254
...props
5355
}: SecretValueFieldProps) {
@@ -68,7 +70,6 @@ export function SecretValueField({
6870
type='text'
6971
value={displayValue}
7072
readOnly
71-
style={style}
7273
inputClassName={visuallyMaskEditableValue ? '[-webkit-text-security:disc]' : undefined}
7374
onChange={(event) => {
7475
if (editable) onChange?.(event.target.value)

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/env-var-dropdown/env-var-dropdown.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface EnvVarDropdownProps {
3333
/** Callback when the dropdown should close */
3434
onClose?: () => void
3535
/** Custom styles for positioning */
36-
style?: React.CSSProperties
36+
style?: Pick<React.CSSProperties, 'top' | 'left' | 'zIndex'>
3737
/** Workspace ID for loading workspace-specific environment variables */
3838
workspaceId?: string
3939
/** Maximum height for the dropdown */
@@ -286,7 +286,7 @@ export const EnvVarDropdown: React.FC<EnvVarDropdownProps> = ({
286286
<div
287287
className={cn('pointer-events-none', className)}
288288
style={{
289-
...style,
289+
zIndex: style?.zIndex,
290290
position: inputElement ? 'fixed' : 'absolute',
291291
top: inputElement ? `${caretViewport.top}px` : style?.top,
292292
left: inputElement ? `${caretViewport.left}px` : style?.left,

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ interface TagDropdownProps {
8181
/** Callback when the dropdown should close */
8282
onClose?: () => void
8383
/** Custom styles for positioning */
84-
style?: React.CSSProperties
84+
style?: Pick<React.CSSProperties, 'top' | 'left' | 'zIndex'>
8585
/** Reference to the input element for caret positioning */
8686
inputRef?: React.RefObject<HTMLTextAreaElement | HTMLInputElement | null>
8787
}
@@ -1616,7 +1616,7 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
16161616
<div
16171617
className={cn('pointer-events-none', className)}
16181618
style={{
1619-
...style,
1619+
zIndex: style?.zIndex,
16201620
position: inputElement ? 'fixed' : 'absolute',
16211621
top: inputElement ? `${caretViewport.top}px` : style?.top,
16221622
left: inputElement ? `${caretViewport.left}px` : style?.left,

‎apps/sim/lib/pptx-renderer/core/viewer.ts‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -611,14 +611,14 @@ export class PptxViewer extends EventTarget {
611611
item.style.cssText = 'width: fit-content; margin: 0 auto 20px;'
612612

613613
const wrapper = document.createElement('div')
614-
wrapper.style.cssText = `
615-
width: ${displayWidth}px;
616-
height: ${displayHeight}px;
617-
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
618-
overflow: hidden;
619-
position: relative;
620-
background: var(--white);
621-
`
614+
Object.assign(wrapper.style, {
615+
width: `${displayWidth}px`,
616+
height: `${displayHeight}px`,
617+
boxShadow: '0 2px 8px rgba(0,0,0,0.15)',
618+
overflow: 'hidden',
619+
position: 'relative',
620+
background: 'var(--white)',
621+
})
622622

623623
item.appendChild(wrapper)
624624

@@ -860,11 +860,14 @@ export class PptxViewer extends EventTarget {
860860
this.mountedSlides.add(this.currentSlide)
861861

862862
const wrapper = document.createElement('div')
863-
wrapper.style.cssText = `
864-
width: ${displayWidth}px; height: ${displayHeight}px;
865-
margin: 0 auto; overflow: hidden; position: relative;
866-
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
867-
`
863+
Object.assign(wrapper.style, {
864+
width: `${displayWidth}px`,
865+
height: `${displayHeight}px`,
866+
margin: '0 auto',
867+
overflow: 'hidden',
868+
position: 'relative',
869+
boxShadow: '0 2px 8px rgba(0,0,0,0.15)',
870+
})
868871

869872
try {
870873
const handle = renderSlideInternal(this.presentation, slide, {

0 commit comments

Comments
 (0)