Skip to content

Commit c9c702b

Browse files
committed
fix review comments
1 parent 593cdca commit c9c702b

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

packages/@react-spectrum/s2/src/Tooltip.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,15 @@ import {DOMProps, DOMRef, GlobalDOMAttributes} from '@react-types/shared';
2727
import {style} from '../style' with {type: 'macro'};
2828
import {useDOMRef} from '@react-spectrum/utils';
2929

30-
export interface TooltipTriggerProps extends Omit<AriaTooltipTriggerComponentProps, 'children' | 'closeDelay' | keyof GlobalDOMAttributes>, Pick<AriaTooltipProps, 'shouldFlip' | 'containerPadding' | 'offset' | 'crossOffset'> {
30+
export interface TooltipTriggerProps extends Omit<AriaTooltipTriggerComponentProps, 'children' | 'closeDelay' | keyof GlobalDOMAttributes>, Pick<AriaTooltipProps, 'shouldFlip' | 'containerPadding' | 'crossOffset'> {
3131
/** The content of the tooltip. */
3232
children: ReactNode,
3333
/**
3434
* The placement of the element with respect to its anchor element.
3535
*
3636
* @default 'top'
3737
*/
38-
placement?: 'start' | 'end' | 'right' | 'left' | 'top' | 'bottom',
39-
/**
40-
* The offset of the tooltip from the trigger.
41-
*
42-
* @default 4
43-
*/
44-
offset?: number
38+
placement?: 'start' | 'end' | 'right' | 'left' | 'top' | 'bottom'
4539
}
4640

4741
export interface TooltipProps extends Omit<AriaTooltipProps, 'children' | 'className' | 'style' | 'triggerRef' | 'UNSTABLE_portalContainer' | 'isEntering' | 'isExiting' | 'placement' | 'containerPadding' | 'offset' | 'crossOffset' | 'shouldFlip' | 'arrowBoundaryOffset' | 'isOpen' | 'defaultOpen' | 'onOpenChange' | keyof GlobalDOMAttributes>, DOMProps, UnsafeStyles {
@@ -145,7 +139,6 @@ export const Tooltip = forwardRef(function Tooltip(props: TooltipProps, ref: DOM
145139
let {
146140
containerPadding,
147141
crossOffset,
148-
offset = 4,
149142
placement = 'top',
150143
shouldFlip
151144
} = useContext(InternalTooltipTriggerContext);
@@ -172,7 +165,7 @@ export const Tooltip = forwardRef(function Tooltip(props: TooltipProps, ref: DOM
172165
arrowBoundaryOffset={borderRadius}
173166
containerPadding={containerPadding}
174167
crossOffset={crossOffset}
175-
offset={offset}
168+
offset={4}
176169
placement={placement}
177170
shouldFlip={shouldFlip}
178171
ref={tooltipRef}
@@ -201,7 +194,6 @@ export function TooltipTrigger(props: TooltipTriggerProps): ReactNode {
201194
let {
202195
containerPadding,
203196
crossOffset,
204-
offset,
205197
placement,
206198
shouldFlip,
207199
...triggerProps
@@ -213,7 +205,6 @@ export function TooltipTrigger(props: TooltipTriggerProps): ReactNode {
213205
value={{
214206
containerPadding: containerPadding,
215207
crossOffset: crossOffset,
216-
offset: offset,
217208
placement: placement,
218209
shouldFlip: shouldFlip
219210
}}>

packages/dev/s2-docs/pages/s2/Tooltip.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const description = 'Displays a description of an element on hover or foc
1111

1212
<PageDescription>{docs.exports.Tooltip.description}</PageDescription>
1313

14-
```tsx render docs={docs.exports.TooltipTrigger} links={docs.links} props={['placement', 'offset', 'crossOffset', 'shouldFlip']} type="s2"
14+
```tsx render docs={docs.exports.TooltipTrigger} links={docs.links} props={['placement', 'crossOffset', 'shouldFlip']} type="s2"
1515
"use client";
1616
import {Tooltip, TooltipTrigger, ActionButton} from '@react-spectrum/s2';
1717
import Edit from '@react-spectrum/s2/icons/Edit';

starters/docs/src/SearchField.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@ export interface SearchFieldProps extends AriaSearchFieldProps {
1515
description?: string;
1616
errorMessage?: string | ((validation: ValidationResult) => string);
1717
placeholder?: string;
18-
autoFocus?: boolean;
1918
}
2019

2120
export function SearchField(
22-
{ label, description, errorMessage, placeholder, autoFocus, ...props }: SearchFieldProps
21+
{ label, description, errorMessage, placeholder, ...props }: SearchFieldProps
2322
) {
2423
return (
2524
(
2625
<AriaSearchField {...props}>
2726
{label && <Label>{label}</Label>}
2827
<Search size={18} />
29-
<Input placeholder={placeholder} className="react-aria-Input inset" autoFocus={autoFocus} />
28+
<Input placeholder={placeholder} className="react-aria-Input inset" />
3029
<Button className="clear-button"><X size={14} /></Button>
3130
{description && <Description>{description}</Description>}
3231
<FieldError>{errorMessage}</FieldError>

starters/tailwind/src/SearchField.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@ export interface SearchFieldProps extends AriaSearchFieldProps {
1515
description?: string;
1616
errorMessage?: string | ((validation: ValidationResult) => string);
1717
placeholder?: string;
18-
autoFocus?: boolean;
1918
}
2019

2120
export function SearchField(
22-
{ label, description, errorMessage, placeholder, autoFocus, ...props }: SearchFieldProps
21+
{ label, description, errorMessage, placeholder, ...props }: SearchFieldProps
2322
) {
2423
return (
2524
<AriaSearchField {...props} className={composeTailwindRenderProps(props.className, 'group flex flex-col gap-1 min-w-[40px] font-sans')}>
2625
{label && <Label>{label}</Label>}
2726
<FieldGroup>
2827
<SearchIcon aria-hidden className="w-4 h-4 ml-2 text-neutral-500 dark:text-neutral-400 forced-colors:text-[ButtonText] group-disabled:text-neutral-200 dark:group-disabled:text-neutral-600 forced-colors:group-disabled:text-[GrayText]" />
29-
<Input placeholder={placeholder} className="pl-2 [&::-webkit-search-cancel-button]:hidden" autoFocus={autoFocus} />
28+
<Input placeholder={placeholder} className="pl-2 [&::-webkit-search-cancel-button]:hidden" />
3029
<FieldButton className="mr-1 w-6 group-empty:invisible">
3130
<XIcon aria-hidden className="w-4 h-4" />
3231
</FieldButton>

0 commit comments

Comments
 (0)