@skyscanner/backpack-web 36.18.0 → 37.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/bpk-component-button/src/BpkButtonBase.module.css +1 -1
  2. package/bpk-component-button/src/BpkButtonV2/BpkButton.module.css +1 -1
  3. package/bpk-component-carousel/src/BpkCarousel.js +0 -2
  4. package/bpk-component-checkbox/src/BpkCheckbox.module.css +1 -1
  5. package/bpk-component-link/src/BpkLink.js +11 -5
  6. package/bpk-component-link/src/BpkLink.module.css +1 -1
  7. package/bpk-component-overlay/src/BpkOverlay.d.ts +2 -2
  8. package/bpk-component-overlay/src/BpkOverlay.js +4 -4
  9. package/bpk-component-overlay/src/BpkOverlay.module.css +1 -1
  10. package/bpk-component-page-indicator/index.d.ts +6 -0
  11. package/bpk-component-page-indicator/index.js +3 -1
  12. package/bpk-component-page-indicator/src/BpkPageIndicator.d.ts +21 -0
  13. package/bpk-component-page-indicator/src/BpkPageIndicator.js +49 -68
  14. package/bpk-component-page-indicator/src/NavButton.d.ts +15 -0
  15. package/bpk-component-page-indicator/src/NavButton.js +22 -35
  16. package/bpk-component-tooltip/index.d.ts +4 -4
  17. package/bpk-component-tooltip/index.js +2 -2
  18. package/bpk-component-tooltip/src/BpkTooltip.d.ts +17 -4
  19. package/bpk-component-tooltip/src/BpkTooltip.js +100 -23
  20. package/bpk-component-tooltip/src/BpkTooltip.module.css +1 -1
  21. package/bpk-mixins/_buttons.scss +5 -1
  22. package/bpk-mixins/_forms.scss +5 -26
  23. package/bpk-mixins/_typography.scss +101 -8
  24. package/package.json +1 -1
  25. package/unstable__bpk-mixins/_buttons.scss +5 -1
  26. package/unstable__bpk-mixins/_forms.scss +5 -28
  27. package/unstable__bpk-mixins/_typography.scss +101 -8
  28. package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +0 -54
  29. package/bpk-component-tooltip/src/BpkTooltipPortal.js +0 -154
@@ -22,42 +22,119 @@ This is the component for the tooltip that is displayed to users.
22
22
  The actual component that developers create (i.e. the default export from this package) is BpkTooltipPortal.
23
23
  */
24
24
 
25
+ import { cloneElement, useRef, useState, useEffect } from 'react';
26
+ import { arrow, FloatingArrow, FloatingPortal, offset, shift, useFloating, useHover, useInteractions, useRole } from '@floating-ui/react';
27
+ import { surfaceHighlightDay } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
25
28
  import { TransitionInitialMount, cssModules } from "../../bpk-react-utils";
26
29
  import { ARROW_ID, TOOLTIP_TYPES } from "./constants";
27
30
  import STYLES from "./BpkTooltip.module.css";
28
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
31
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
29
32
  const getClassName = cssModules(STYLES);
33
+
34
+ // The stroke width is used to set the border width of the arrow.
35
+ const strokeWidth = 1;
36
+ // This function is to ensure the arrow alignment when used on the top and bottom
37
+ // doesn't look clipped away from the tooltip. This is due to our use of box-shadows that makes it look floating away,
38
+ // so we need to compensate slightly to make it look as one.
39
+ const getArrowAlignment = placement => {
40
+ if (placement.includes('bottom')) {
41
+ return {
42
+ bottom: '98%'
43
+ };
44
+ }
45
+ if (placement.includes('top')) {
46
+ return {
47
+ top: '98%'
48
+ };
49
+ }
50
+ return undefined;
51
+ };
52
+ const hasTouchSupport = () => !!(typeof window !== 'undefined' && ('ontouchstart' in window || navigator.maxTouchPoints > 0));
30
53
  const BpkTooltip = ({
54
+ ariaLabel,
31
55
  children,
32
- className = null,
56
+ hideOnTouchDevices = true,
33
57
  id,
58
+ isOpen = false,
34
59
  padded = true,
60
+ placement = 'bottom',
61
+ target,
35
62
  type = TOOLTIP_TYPES.light,
36
63
  ...rest
37
64
  }) => {
38
- const classNames = getClassName('bpk-tooltip', className);
65
+ const [isOpenState, setIsOpenState] = useState(isOpen);
66
+ const arrowRef = useRef(null);
67
+ useEffect(() => {
68
+ if (!isOpen) {
69
+ setIsOpenState(false);
70
+ }
71
+ }, [isOpen]);
72
+ const {
73
+ context,
74
+ floatingStyles,
75
+ refs
76
+ } = useFloating({
77
+ open: isOpenState,
78
+ onOpenChange: setIsOpenState,
79
+ placement,
80
+ middleware: [offset(8), shift(), arrow({
81
+ element: arrowRef
82
+ })]
83
+ });
84
+ const hover = useHover(context, {
85
+ mouseOnly: !hasTouchSupport() || !hideOnTouchDevices
86
+ });
87
+ const role = useRole(context, {
88
+ role: 'tooltip'
89
+ });
90
+ const {
91
+ getFloatingProps,
92
+ getReferenceProps
93
+ } = useInteractions([hover, role]);
94
+ const targetWithAccessibilityProps = /*#__PURE__*/cloneElement(target, {
95
+ tabIndex: '0',
96
+ 'aria-label': ariaLabel,
97
+ role: 'tooltip',
98
+ ref: refs.setReference,
99
+ ...getReferenceProps()
100
+ });
101
+ const classNames = getClassName('bpk-tooltip');
39
102
  const innerClassNames = getClassName('bpk-tooltip__inner', type === TOOLTIP_TYPES.dark && 'bpk-tooltip__inner--dark', padded && 'bpk-tooltip__inner--padded');
40
103
  const arrowClassNames = getClassName('bpk-tooltip__arrow', type === TOOLTIP_TYPES.dark && 'bpk-tooltip__arrow--dark');
41
- return /*#__PURE__*/_jsx(TransitionInitialMount, {
42
- appearClassName: getClassName('bpk-tooltip--appear'),
43
- appearActiveClassName: getClassName('bpk-tooltip--appear-active'),
44
- transitionTimeout: 200,
45
- children: /*#__PURE__*/_jsxs("section", {
46
- id: id,
47
- tabIndex: -1,
48
- role: "dialog",
49
- className: classNames,
50
- ...rest,
51
- children: [/*#__PURE__*/_jsx("span", {
52
- id: ARROW_ID,
53
- "data-popper-arrow": true,
54
- className: arrowClassNames,
55
- role: "presentation"
56
- }), /*#__PURE__*/_jsx("div", {
57
- className: innerClassNames,
58
- children: children
59
- })]
60
- })
104
+ return /*#__PURE__*/_jsxs(_Fragment, {
105
+ children: [targetWithAccessibilityProps, isOpenState && /*#__PURE__*/_jsx(FloatingPortal, {
106
+ children: /*#__PURE__*/_jsx("div", {
107
+ className: getClassName('bpk-tooltip--container'),
108
+ ref: refs.setFloating,
109
+ style: floatingStyles,
110
+ ...getFloatingProps(),
111
+ children: /*#__PURE__*/_jsx(TransitionInitialMount, {
112
+ appearClassName: getClassName('bpk-tooltip--appear'),
113
+ appearActiveClassName: getClassName('bpk-tooltip--appear-active'),
114
+ transitionTimeout: 200,
115
+ children: /*#__PURE__*/_jsxs("section", {
116
+ id: id,
117
+ tabIndex: -1,
118
+ role: "dialog",
119
+ className: classNames,
120
+ ...rest,
121
+ children: [/*#__PURE__*/_jsx(FloatingArrow, {
122
+ ref: arrowRef,
123
+ context: context,
124
+ id: ARROW_ID,
125
+ className: arrowClassNames,
126
+ role: "presentation",
127
+ stroke: surfaceHighlightDay,
128
+ strokeWidth: strokeWidth,
129
+ style: getArrowAlignment(context.placement)
130
+ }), /*#__PURE__*/_jsx("div", {
131
+ className: innerClassNames,
132
+ children: children
133
+ })]
134
+ })
135
+ })
136
+ })
137
+ })]
61
138
  });
62
139
  };
63
140
  export default BpkTooltip;
@@ -15,4 +15,4 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- .bpk-tooltip-portal{z-index:900}.bpk-tooltip-portal--target{display:inline-block}.bpk-tooltip{transition:opacity 200ms ease-in-out,transform 200ms ease-in-out;outline:0;opacity:1}.bpk-tooltip--appear{opacity:0}.bpk-tooltip-portal[data-popper-placement=top] .bpk-tooltip--appear:not(.bpk-tooltip--appear-active){transform:translate(0, -1rem);transition:none}.bpk-tooltip-portal[data-popper-placement=right] .bpk-tooltip--appear:not(.bpk-tooltip--appear-active){transform:translate(1rem, 0);transition:none}.bpk-tooltip-portal[data-popper-placement=bottom] .bpk-tooltip--appear:not(.bpk-tooltip--appear-active){transform:translate(0, 1rem);transition:none}.bpk-tooltip-portal[data-popper-placement=left] .bpk-tooltip--appear:not(.bpk-tooltip--appear-active){transform:translate(-1rem, 0);transition:none}.bpk-tooltip--appear-active{transform:translate(0, 0);transition:opacity 200ms ease-in-out,transform 200ms ease-in-out;opacity:1}.bpk-tooltip__arrow{position:absolute;width:.5rem;height:.5rem;transform:rotate(45deg);border:.0625rem solid rgba(0,0,0,0);background:inherit;background-color:#fff}.bpk-tooltip-portal[data-popper-placement=top] .bpk-tooltip__arrow{bottom:-0.1875rem;border-right-color:#c1c7cf;border-bottom-color:#c1c7cf}.bpk-tooltip-portal[data-popper-placement=right] .bpk-tooltip__arrow{left:-0.1875rem;border-bottom-color:#c1c7cf;border-left-color:#c1c7cf}.bpk-tooltip-portal[data-popper-placement=bottom] .bpk-tooltip__arrow{top:-0.1875rem;border-top-color:#c1c7cf;border-left-color:#c1c7cf}.bpk-tooltip-portal[data-popper-placement=left] .bpk-tooltip__arrow{right:-0.1875rem;border-top-color:#c1c7cf;border-right-color:#c1c7cf}.bpk-tooltip__arrow--dark{background-color:#05203c}.bpk-tooltip-portal[data-popper-placement=top] .bpk-tooltip__arrow--dark{border-right-color:#05203c;border-bottom-color:#05203c}.bpk-tooltip-portal[data-popper-placement=right] .bpk-tooltip__arrow--dark{border-bottom-color:#05203c;border-left-color:#05203c}.bpk-tooltip-portal[data-popper-placement=bottom] .bpk-tooltip__arrow--dark{border-top-color:#05203c;border-left-color:#05203c}.bpk-tooltip-portal[data-popper-placement=left] .bpk-tooltip__arrow--dark{border-top-color:#05203c;border-right-color:#05203c}.bpk-tooltip__inner{overflow:hidden;border:.0625rem solid #e0e4e9;background-color:#fff;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}.bpk-tooltip__inner--padded{padding:.5rem 1rem}.bpk-tooltip__inner--dark{color:#fff;border:.0625rem solid #05203c;background-color:#05203c;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}
18
+ .bpk-tooltip--container{z-index:900}.bpk-tooltip{transition:opacity 200ms ease-in-out;outline:0;opacity:1;border:.0625rem solid #e0e4e9;background-color:#fff;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}.bpk-tooltip--appear{opacity:0}.bpk-tooltip--appear-active{opacity:1}.bpk-tooltip__arrow{width:.5rem;height:.5rem;fill:#fff}.bpk-tooltip__arrow--dark{fill:#05203c}.bpk-tooltip__inner--padded{padding:.5rem 1rem}.bpk-tooltip__inner--dark{color:#fff;border:.0625rem solid #05203c;background-color:#05203c;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}
@@ -395,7 +395,11 @@
395
395
  background: none; /* stylelint-disable-line order/order, order/properties-order */
396
396
  box-shadow: none;
397
397
 
398
- @include bpk-link;
398
+ @include bpk-link--implicit;
399
+
400
+ &::after {
401
+ bottom: auto;
402
+ }
399
403
 
400
404
  padding: $vertical-padding 0; /* stylelint-disable-line order/order, order/properties-order */
401
405
  color: $bpk-private-button-link-normal-foreground-day;
@@ -627,34 +627,13 @@
627
627
  /// @include bpk-checkbox__checkmark();
628
628
  /// }
629
629
  @mixin bpk-checkbox__checkmark {
630
- &::before,
631
- &::after {
632
- position: absolute;
633
- content: '';
634
- transform: rotate(45deg);
635
- border-radius: $bpk-border-size-lg;
636
- background-color: $bpk-text-primary-inverse-day;
637
- }
638
-
639
- &::before {
640
- top: bpk-spacing-md() - $bpk-one-pixel-rem;
641
- left: 0;
642
- width: bpk-spacing-lg() / 3;
643
- height: bpk-spacing-sm() - $bpk-one-pixel-rem;
644
- }
645
-
646
- &::after {
647
- top: bpk-spacing-sm() / 2;
648
- left: bpk-spacing-md() - $bpk-one-pixel-rem;
649
- width: bpk-spacing-sm() - $bpk-one-pixel-rem;
650
- height: bpk-spacing-md() + ($bpk-one-pixel-rem * 3);
651
- }
630
+ background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22white%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E');
631
+ background-repeat: no-repeat;
632
+ background-position: $bpk-one-pixel-rem center;
633
+ background-size: calc(100% - $bpk-one-pixel-rem * 2.5) auto;
652
634
 
653
635
  &:disabled {
654
- &::before,
655
- &::after {
656
- background-color: $bpk-text-disabled-day;
657
- }
636
+ background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22lightgrey%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E');
658
637
  }
659
638
  }
660
639
 
@@ -782,6 +782,8 @@
782
782
  /// }
783
783
 
784
784
  @mixin bpk-link {
785
+ position: relative;
786
+ display: inline-block;
785
787
  padding: 0;
786
788
  border: 0;
787
789
  background-color: transparent;
@@ -789,34 +791,117 @@
789
791
  cursor: pointer;
790
792
  appearance: none;
791
793
 
792
- @include bpk-themeable-property(color, --bpk-link-color, $bpk-text-link-day);
794
+ @include bpk-themeable-property(
795
+ color,
796
+ --bpk-link-color,
797
+ $bpk-text-primary-day
798
+ );
793
799
 
794
800
  @include bpk-hover {
795
- text-decoration: underline;
801
+ text-decoration: none;
796
802
 
797
803
  @include bpk-themeable-property(
798
804
  color,
799
805
  --bpk-link-hover-color,
800
- $bpk-text-link-day
806
+ $bpk-text-primary-day
801
807
  );
808
+
809
+ &::after {
810
+ width: 0%;
811
+ }
802
812
  }
803
813
 
804
814
  &:visited {
805
815
  @include bpk-themeable-property(
806
816
  color,
807
817
  --bpk-link-visited-color,
808
- $bpk-text-link-day
818
+ $bpk-text-primary-day
809
819
  );
810
820
  }
811
821
 
822
+ &:active {
823
+ @include bpk-themeable-property(
824
+ color,
825
+ --bpk-link-active-color,
826
+ $bpk-text-primary-day
827
+ );
828
+
829
+ &::after {
830
+ width: 0%;
831
+ }
832
+ }
833
+
834
+ &::after {
835
+ position: absolute;
836
+ bottom: 0;
837
+ content: '';
838
+ display: block;
839
+ width: 100%;
840
+ height: tokens.$bpk-border-size-sm;
841
+ transition:
842
+ width 0.2s ease 0s,
843
+ left 0.2s ease 0s;
844
+
845
+ @include bpk-themeable-property(
846
+ background,
847
+ --bpk-link-color,
848
+ $bpk-text-primary-day
849
+ );
850
+
851
+ @media (prefers-reduced-motion) {
852
+ transition:
853
+ width 0s ease 0s,
854
+ left 0s ease 0s;
855
+ }
856
+ }
857
+ }
858
+
859
+ /// Implicit inline link.
860
+ ///
861
+ /// @example scss
862
+ /// .selector {
863
+ /// @include bpk-link();
864
+ /// @include bpk-link--implicit();
865
+ /// }
866
+
867
+ @mixin bpk-link--implicit {
868
+ @include bpk-themeable-property(
869
+ color,
870
+ --bpk-link-color,
871
+ $bpk-text-primary-day
872
+ );
873
+
874
+ @include bpk-hover {
875
+ @include bpk-themeable-property(
876
+ color,
877
+ --bpk-link-hover-color,
878
+ $bpk-text-primary-day
879
+ );
880
+
881
+ &::after {
882
+ width: 100%;
883
+ }
884
+ }
885
+
886
+ &::after {
887
+ width: 0;
888
+ transition:
889
+ width 0.2s ease 0s,
890
+ left 0.2s ease 0s;
891
+ }
892
+
812
893
  &:active {
813
894
  text-decoration: underline;
814
895
 
815
896
  @include bpk-themeable-property(
816
897
  color,
817
898
  --bpk-link-active-color,
818
- $bpk-text-link-day
899
+ $bpk-text-primary-day
819
900
  );
901
+
902
+ &::after {
903
+ width: 100%;
904
+ }
820
905
  }
821
906
  }
822
907
 
@@ -845,6 +930,14 @@
845
930
  );
846
931
  }
847
932
 
933
+ &::after {
934
+ @include bpk-themeable-property(
935
+ background,
936
+ --bpk-link-alternate-color,
937
+ $bpk-text-on-dark-day
938
+ );
939
+ }
940
+
848
941
  &:visited {
849
942
  @include bpk-themeable-property(
850
943
  color,
@@ -877,14 +970,14 @@
877
970
  /// }
878
971
 
879
972
  @mixin bpk-link--active {
880
- color: $bpk-text-link-day;
973
+ color: $bpk-text-primary-day;
881
974
 
882
975
  &:visited {
883
- color: $bpk-text-link-day;
976
+ color: $bpk-text-primary-day;
884
977
  }
885
978
 
886
979
  &:active {
887
- color: $bpk-text-link-day;
980
+ color: $bpk-text-primary-day;
888
981
  }
889
982
  }
890
983
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "36.18.0",
3
+ "version": "37.0.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -395,7 +395,11 @@
395
395
  background: none; /* stylelint-disable-line order/order, order/properties-order */
396
396
  box-shadow: none;
397
397
 
398
- @include typography.bpk-link;
398
+ @include typography.bpk-link--implicit;
399
+
400
+ &::after {
401
+ bottom: auto;
402
+ }
399
403
 
400
404
  padding: $vertical-padding 0; /* stylelint-disable-line order/order, order/properties-order */
401
405
  color: tokens.$bpk-private-button-link-normal-foreground-day;
@@ -18,8 +18,6 @@
18
18
 
19
19
  /* stylelint-disable at-rule-disallowed-list */
20
20
 
21
- @use "sass:math";
22
-
23
21
  @use 'tokens.scss';
24
22
  @use 'typography.scss';
25
23
  @use 'utils.scss';
@@ -629,34 +627,13 @@
629
627
  /// @include bpk-checkbox__checkmark();
630
628
  /// }
631
629
  @mixin bpk-checkbox__checkmark {
632
- &::before,
633
- &::after {
634
- position: absolute;
635
- content: '';
636
- transform: rotate(45deg);
637
- border-radius: tokens.$bpk-border-size-lg;
638
- background-color: tokens.$bpk-text-primary-inverse-day;
639
- }
640
-
641
- &::before {
642
- top: tokens.bpk-spacing-md() - tokens.$bpk-one-pixel-rem;
643
- left: 0;
644
- width: math.div(tokens.bpk-spacing-lg(), 3);
645
- height: tokens.bpk-spacing-sm() - tokens.$bpk-one-pixel-rem;
646
- }
647
-
648
- &::after {
649
- top: tokens.bpk-spacing-sm() * 0.5;
650
- left: tokens.bpk-spacing-md() - tokens.$bpk-one-pixel-rem;
651
- width: tokens.bpk-spacing-sm() - tokens.$bpk-one-pixel-rem;
652
- height: tokens.bpk-spacing-md() + (tokens.$bpk-one-pixel-rem * 3);
653
- }
630
+ background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22white%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E');
631
+ background-repeat: no-repeat;
632
+ background-position: tokens.$bpk-one-pixel-rem center;
633
+ background-size: calc(100% - tokens.$bpk-one-pixel-rem * 2.5) auto;
654
634
 
655
635
  &:disabled {
656
- &::before,
657
- &::after {
658
- background-color: tokens.$bpk-text-disabled-day;
659
- }
636
+ background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22lightgrey%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E');
660
637
  }
661
638
  }
662
639
 
@@ -782,6 +782,8 @@
782
782
  /// }
783
783
 
784
784
  @mixin bpk-link {
785
+ position: relative;
786
+ display: inline-block;
785
787
  padding: 0;
786
788
  border: 0;
787
789
  background-color: transparent;
@@ -789,34 +791,117 @@
789
791
  cursor: pointer;
790
792
  appearance: none;
791
793
 
792
- @include utils.bpk-themeable-property(color, --bpk-link-color, tokens.$bpk-text-link-day);
794
+ @include utils.bpk-themeable-property(
795
+ color,
796
+ --bpk-link-color,
797
+ tokens.$bpk-text-primary-day
798
+ );
793
799
 
794
800
  @include utils.bpk-hover {
795
- text-decoration: underline;
801
+ text-decoration: none;
796
802
 
797
803
  @include utils.bpk-themeable-property(
798
804
  color,
799
805
  --bpk-link-hover-color,
800
- tokens.$bpk-text-link-day
806
+ tokens.$bpk-text-primary-day
801
807
  );
808
+
809
+ &::after {
810
+ width: 0%;
811
+ }
802
812
  }
803
813
 
804
814
  &:visited {
805
815
  @include utils.bpk-themeable-property(
806
816
  color,
807
817
  --bpk-link-visited-color,
808
- tokens.$bpk-text-link-day
818
+ tokens.$bpk-text-primary-day
809
819
  );
810
820
  }
811
821
 
822
+ &:active {
823
+ @include utils.bpk-themeable-property(
824
+ color,
825
+ --bpk-link-active-color,
826
+ tokens.$bpk-text-primary-day
827
+ );
828
+
829
+ &::after {
830
+ width: 0%;
831
+ }
832
+ }
833
+
834
+ &::after {
835
+ position: absolute;
836
+ bottom: 0;
837
+ content: '';
838
+ display: block;
839
+ width: 100%;
840
+ height: tokens.$bpk-border-size-sm;
841
+ transition:
842
+ width 0.2s ease 0s,
843
+ left 0.2s ease 0s;
844
+
845
+ @include utils.bpk-themeable-property(
846
+ background,
847
+ --bpk-link-color,
848
+ tokens.$bpk-text-primary-day
849
+ );
850
+
851
+ @media (prefers-reduced-motion) {
852
+ transition:
853
+ width 0s ease 0s,
854
+ left 0s ease 0s;
855
+ }
856
+ }
857
+ }
858
+
859
+ /// Implicit inline link.
860
+ ///
861
+ /// @example scss
862
+ /// .selector {
863
+ /// @include bpk-link();
864
+ /// @include bpk-link--implicit();
865
+ /// }
866
+
867
+ @mixin bpk-link--implicit {
868
+ @include utils.bpk-themeable-property(
869
+ color,
870
+ --bpk-link-color,
871
+ tokens.$bpk-text-primary-day
872
+ );
873
+
874
+ @include utils.bpk-hover {
875
+ @include utils.bpk-themeable-property(
876
+ color,
877
+ --bpk-link-hover-color,
878
+ tokens.$bpk-text-primary-day
879
+ );
880
+
881
+ &::after {
882
+ width: 100%;
883
+ }
884
+ }
885
+
886
+ &::after {
887
+ width: 0;
888
+ transition:
889
+ width 0.2s ease 0s,
890
+ left 0.2s ease 0s;
891
+ }
892
+
812
893
  &:active {
813
894
  text-decoration: underline;
814
895
 
815
896
  @include utils.bpk-themeable-property(
816
897
  color,
817
898
  --bpk-link-active-color,
818
- tokens.$bpk-text-link-day
899
+ tokens.$bpk-text-primary-day
819
900
  );
901
+
902
+ &::after {
903
+ width: 100%;
904
+ }
820
905
  }
821
906
  }
822
907
 
@@ -845,6 +930,14 @@
845
930
  );
846
931
  }
847
932
 
933
+ &::after {
934
+ @include utils.bpk-themeable-property(
935
+ background,
936
+ --bpk-link-alternate-color,
937
+ tokens.$bpk-text-on-dark-day
938
+ );
939
+ }
940
+
848
941
  &:visited {
849
942
  @include utils.bpk-themeable-property(
850
943
  color,
@@ -877,14 +970,14 @@
877
970
  /// }
878
971
 
879
972
  @mixin bpk-link--active {
880
- color: tokens.$bpk-text-link-day;
973
+ color: tokens.$bpk-text-primary-day;
881
974
 
882
975
  &:visited {
883
- color: tokens.$bpk-text-link-day;
976
+ color: tokens.$bpk-text-primary-day;
884
977
  }
885
978
 
886
979
  &:active {
887
- color: tokens.$bpk-text-link-day;
980
+ color: tokens.$bpk-text-primary-day;
888
981
  }
889
982
  }
890
983
 
@@ -1,54 +0,0 @@
1
- import { Component } from 'react';
2
- import type { ReactNode, ReactElement } from 'react';
3
- import { createPopper } from '@popperjs/core';
4
- import type { TooltipProps } from './BpkTooltip';
5
- export type Props = TooltipProps & {
6
- /**
7
- * Tooltips are invisible to assistive technologies such as screen readers.
8
- * To improve accessibility, `ariaLabel` is required to describe the content of the tooltip to assistive technologies.
9
- * The label will be used on the `target` element, so any existing `aria-label` attached to `target` will be overridden.
10
- */
11
- ariaLabel: string;
12
- /**
13
- * "target" should be a DOM element with a "ref" attached to it.
14
- */
15
- target: ReactElement<any>;
16
- children: ReactNode | string;
17
- placement?: 'top' | 'right' | 'bottom' | 'left' | 'auto';
18
- hideOnTouchDevices?: boolean;
19
- portalStyle?: object;
20
- portalClassName?: string;
21
- renderTarget: null | (() => null | HTMLElement);
22
- /**
23
- * Please refer to the [documentation](https://popper.js.org/docs/v2/modifiers/) for the underlying positioning library "Popper.js".
24
- * You can achieve various behaviours such as allowing the tooltip to overflow the viewport etc.
25
- */
26
- popperModifiers?: object[];
27
- };
28
- type State = {
29
- isOpen: boolean;
30
- };
31
- declare class BpkTooltipPortal extends Component<Props, State> {
32
- popper?: ReturnType<typeof createPopper> | null;
33
- targetRef?: Element | null;
34
- static defaultProps: {
35
- className: null;
36
- padded: boolean;
37
- type: "light";
38
- placement: string;
39
- hideOnTouchDevices: boolean;
40
- portalStyle: null;
41
- portalClassName: null;
42
- renderTarget: null;
43
- popperModifiers: null;
44
- };
45
- constructor(props: Props);
46
- componentDidMount(): void;
47
- componentWillUnmount(): void;
48
- onOpen: (tooltipElement: HTMLElement, targetElement?: HTMLElement | null | undefined) => void;
49
- beforeClose: (done: () => void | null) => void;
50
- openTooltip: () => void;
51
- closeTooltip: () => void;
52
- render(): import("react/jsx-runtime").JSX.Element;
53
- }
54
- export default BpkTooltipPortal;