-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE(web-twig): Tooltip className changes
- TooltipWrapper renamed to Tooltip - Changed all stories to use the new Tooltip component structure - Updated README
- Loading branch information
1 parent
bf6682d
commit fdca44e
Showing
16 changed files
with
51 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 3 additions & 35 deletions
38
packages/web-twig/src/Resources/components/Tooltip/Tooltip.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,18 @@ | ||
{# API #} | ||
{%- set props = props | default([]) -%} | ||
{%- set _closeLabel = props.closeLabel | default('Close') -%} | ||
{%- set _id = props.id | default(null) -%} | ||
{%- set _isDismissible = props.isDismissible | default(false) -%} | ||
{%- set _placement = props.placement | default('bottom') -%} | ||
|
||
{# Class names #} | ||
{%- set _arrowClassName = _spiritClassPrefix ~ 'Tooltip__arrow' -%} | ||
{%- set _closeClassName = _spiritClassPrefix ~ 'Tooltip__close' -%} | ||
{%- set _rootClassName = _spiritClassPrefix ~ 'Tooltip' -%} | ||
{%- set _rootDismissibleClassName = _isDismissible is same as(true) ? _spiritClassPrefix ~ 'Tooltip--dismissible' : null -%} | ||
|
||
{# Attributes #} | ||
{%- set _idAttr = _id ? 'id="' ~ _id | escape('html_attr') ~ '"' : null -%} | ||
{%- set _ariaControlsAttr = _id ? 'aria-controls="' ~ _id | escape('html_attr') ~ '"' : null -%} | ||
{%- set _dataPlacementAttr = _placement ? 'data-spirit-placement="' ~ _placement | escape('html_attr') ~ '"' : null -%} | ||
{%- set _dataTargetAttr = _id ? 'data-spirit-target="#' ~ _id | escape('html_attr') ~ '"' : null -%} | ||
|
||
{# Miscellaneous #} | ||
{%- set _styleProps = useStyleProps(props) -%} | ||
{%- set _classNames = [ _rootClassName, _rootDismissibleClassName, _styleProps.className ] -%} | ||
{%- set _mainPropsWithoutReservedAttributes = props | filter((value, prop) => prop not in ['id', 'data-spirit-placement']) -%} | ||
|
||
{# Deprecations #} | ||
{% deprecated 'Tooltip: The implementation of this component is deprecated and will be replaced with the implementation of the TooltipPopover in the next major version. Please, use TooltipPopover instead.' %} | ||
{%- set _classNames = [ _rootClassName, _styleProps.className ] -%} | ||
|
||
<div | ||
{{ mainProps(_mainPropsWithoutReservedAttributes) }} | ||
{{ mainProps(props) }} | ||
{{ styleProp(_styleProps) }} | ||
{{ classProp(_classNames) }} | ||
{{ _idAttr | raw }} | ||
{{ _dataPlacementAttr | raw }} | ||
data-spirit-element="tooltip-wrapper" | ||
> | ||
{% block content %}{% endblock %} | ||
{% if _isDismissible is same as(true) %} | ||
<button | ||
type="button" | ||
class="{{ _closeClassName }}" | ||
data-spirit-dismiss="tooltip" | ||
{{ _ariaControlsAttr | raw }} | ||
{{ _dataTargetAttr | raw }} | ||
aria-expanded="true" | ||
> | ||
<Icon name="close" /> | ||
<VisuallyHidden>{{ _closeLabel }}</VisuallyHidden> | ||
</button> | ||
{% endif %} | ||
<span class="{{ _arrowClassName }}" data-spirit-element="arrow"></span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
packages/web-twig/src/Resources/components/Tooltip/TooltipWrapper.twig
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...ages/web-twig/src/Resources/components/Tooltip/__tests__/__fixtures__/tooltipWrapper.twig
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
packages/web-twig/src/Resources/components/Tooltip/stories/TooltipClickable.twig
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.