Skip to content

Commit

Permalink
BREAKING CHANGE(web-react): Add spirit infix to data-placement in T…
Browse files Browse the repository at this point in the history
…ooltip #DS-585

Also added `spirit` infix to internal implementations of components where
it controls CSS behaviour.

 ## Migration Guide

If you need advanced positioning of Tooltip with Floating UI, you need
to change `data-placement` prop to `data-spirit-placement`.

- `<Tooltip data-placement={placement} …>` → `<Tooltip data-spirit-placement={placement} …>`

See updated README of the Tooltip component.

Please refer back to this guide or reach out to our team
if you encounter any issues during migration.
  • Loading branch information
crishpeen committed Jul 17, 2023
1 parent 19fb0b0 commit 37fe950
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('useCollapseAriaProps', () => {

expect(result.current.ariaProps).toBeDefined();
expect(result.current.ariaProps.root).toBeDefined();
expect(result.current.ariaProps.root['data-breakpoint']).toBeUndefined();
expect(result.current.ariaProps.root['data-spirit-breakpoint']).toBeUndefined();
expect(result.current.ariaProps.trigger['aria-expanded']).toBeTruthy();
expect(result.current.ariaProps.trigger['aria-controls']).toBe(props.id);
expect(result.current.props.id).toBe(props.id);
Expand All @@ -27,6 +27,6 @@ describe('useCollapseAriaProps', () => {
} as SpiritCollapseProps;
const { result } = renderHook(() => useCollapseAriaProps(props));

expect(result.current.ariaProps.root['data-breakpoint']).toBe('mobile');
expect(result.current.ariaProps.root['data-spirit-breakpoint']).toBe('mobile');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CollapseProps, BaseCollapseProps, Booleanish } from '../../types';

const ATTRIBUTE_ARIA_EXPANDED = 'aria-expanded';
const ATTRIBUTE_ARIA_CONTROLS = 'aria-controls';
const ATTRIBUTE_DATA_BREAKPOINT = 'data-breakpoint';
const ATTRIBUTE_DATA_BREAKPOINT = 'data-spirit-breakpoint';

export interface CollapseAria {
ariaProps: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Booleanish, ClickEvent, DropdownBreakpoint, DropdownFullWidthMode } fro
const NAME_ARIA_EXPANDED = 'aria-expanded';
const NAME_ARIA_CONTROLS = 'aria-controls';
/** @deprecated Will be removed in the next major version. */
const NAME_DATA_BREAKPOINT = 'data-breakpoint';
const NAME_DATA_FULLWIDTHMODE = 'data-fullwidthmode';
const NAME_DATA_BREAKPOINT = 'data-spirit-breakpoint';
const NAME_DATA_FULLWIDTHMODE = 'data-spirit-fullwidthmode';

export enum fullWidthModeKeys {
'off' = 'off',
Expand Down
4 changes: 2 additions & 2 deletions packages/web-react/src/components/Tooltip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const { getReferenceProps, getFloatingProps } = useInteractions([hover, focus, d
top: y ?? 0,
left: x ?? 0,
}}
data-placement={placement}
data-spirit-placement={placement}
{...getFloatingProps()}
>
Hello there!
Expand Down Expand Up @@ -212,7 +212,7 @@ const { getReferenceProps, getFloatingProps } = useInteractions([hover, focus, d
top: y ?? 0,
left: x ?? 0,
}}
data-placement={placement}
data-spirit-placement={placement}
{...getFloatingProps()}
>
Hello there!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Story: ComponentStory<typeof Tooltip> = () => {
top: y ?? 0,
left: x ?? 0,
}}
data-placement={placement}
data-spirit-placement={placement}
{...getFloatingProps()}
>
Hello there!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const Story: ComponentStory<typeof Tooltip> = () => {
top: y ?? 0,
left: x ?? 0,
}}
data-placement={placement}
data-spirit-placement={placement}
{...getFloatingProps()}
>
Hello there!
Expand Down

0 comments on commit 37fe950

Please sign in to comment.