@pushwoosh/dumb-components 4.17.0 → 4.17.2

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.
@@ -3,7 +3,7 @@ import { Color } from '@pushwoosh/kit-constants';
3
3
  import { Vertical } from '@pushwoosh/kit-helpers';
4
4
  import { Text } from '@pushwoosh/kit-typography';
5
5
  import { Lang } from './polyglot';
6
- import { Bubble, Phone, PhoneHeader, Placeholder, Thread } from './styles';
6
+ import { Bubble, Phone, PhoneHeader, Placeholder, SenderName, Thread } from './styles';
7
7
  /** Renders a text message in a phone thread: sender on top, one bubble, segment count below. */
8
8
  export function SmsPreview(props) {
9
9
  const {
@@ -18,8 +18,7 @@ export function SmsPreview(props) {
18
18
  "$alignContent": "start",
19
19
  children: [_jsxs(Phone, {
20
20
  children: [_jsxs(PhoneHeader, {
21
- children: [_jsx(Text, {
22
- "$variant": "h4",
21
+ children: [_jsx(SenderName, {
23
22
  children: senderName
24
23
  }), _jsx(Text, {
25
24
  "$color": Color.LOCKED,
@@ -4,6 +4,9 @@ export declare const Phone: import("styled-components/dist/types").IStyledCompon
4
4
  export declare const PhoneHeader: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
5
5
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
6
6
  }> & string;
7
+ export declare const SenderName: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
8
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
9
+ }> & string;
7
10
  export declare const Thread: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
8
11
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
9
12
  }> & string;
@@ -1,5 +1,5 @@
1
1
  import styled from 'styled-components';
2
- import { Color, FontSize, ShapeRadius } from '@pushwoosh/kit-constants';
2
+ import { Color, FontFamily, FontSize, FontWeight, LineHeight, ShapeRadius } from '@pushwoosh/kit-constants';
3
3
  export const Phone = styled.div.withConfig({
4
4
  displayName: "Phone",
5
5
  componentId: "sc-1wraspo-0"
@@ -8,15 +8,19 @@ export const PhoneHeader = styled.div.withConfig({
8
8
  displayName: "PhoneHeader",
9
9
  componentId: "sc-1wraspo-1"
10
10
  })(["display:flex;flex-direction:column;gap:2px;padding:12px;border-bottom:1px solid ", ";text-align:center;"], Color.DIVIDER);
11
+ export const SenderName = styled.span.withConfig({
12
+ displayName: "SenderName",
13
+ componentId: "sc-1wraspo-2"
14
+ })(["color:", ";font-family:", ";font-size:", ";font-weight:", ";line-height:", ";"], Color.MAIN, FontFamily.MAIN, FontSize.HEADING4, FontWeight.MEDIUM, LineHeight.HEADING4);
11
15
  export const Thread = styled.div.withConfig({
12
16
  displayName: "Thread",
13
- componentId: "sc-1wraspo-2"
17
+ componentId: "sc-1wraspo-3"
14
18
  })(["display:flex;flex-direction:column;min-height:160px;padding:16px 12px;"]);
15
19
  export const Bubble = styled.div.withConfig({
16
20
  displayName: "Bubble",
17
- componentId: "sc-1wraspo-3"
21
+ componentId: "sc-1wraspo-4"
18
22
  })(["padding:10px 12px;border-radius:16px 16px 16px 4px;background-color:", ";color:", ";font-size:", ";line-height:1.4;white-space:pre-wrap;word-break:break-word;unicode-bidi:plaintext;text-align:start;"], Color.DIVIDER, Color.MAIN, FontSize.REGULAR);
19
23
  export const Placeholder = styled.div.withConfig({
20
24
  displayName: "Placeholder",
21
- componentId: "sc-1wraspo-4"
25
+ componentId: "sc-1wraspo-5"
22
26
  })(["padding:12px;border:1px dashed ", ";border-radius:", ";color:", ";font-size:", ";text-align:center;"], Color.FORM, ShapeRadius.SECTION, Color.LOCKED, FontSize.SMALL);
@@ -1,7 +1,7 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { TooltipProps } from './types';
3
3
  /**
4
- * Wraps an element and shows a contextual tooltip on hover/focus, with configurable
4
+ * Wraps an element and shows a contextual tooltip on hover/keyboard focus, with configurable
5
5
  * position, width and color. Positioning is handled by floating-ui, so the tooltip
6
6
  * flips to a fallback placement when the requested one would overflow the viewport. Use
7
7
  * {@link TooltipTrigger} for a standalone help icon.
@@ -6,7 +6,7 @@ import { DEFAULT_MAX_WIDTH } from './constants';
6
6
  import { Arrow, TooltipBox } from './styles';
7
7
  import { useTooltipPosition } from './useTooltipPosition';
8
8
  /**
9
- * Wraps an element and shows a contextual tooltip on hover/focus, with configurable
9
+ * Wraps an element and shows a contextual tooltip on hover/keyboard focus, with configurable
10
10
  * position, width and color. Positioning is handled by floating-ui, so the tooltip
11
11
  * flips to a fallback placement when the requested one would overflow the viewport. Use
12
12
  * {@link TooltipTrigger} for a standalone help icon.
@@ -70,14 +70,19 @@ export function Tooltip({
70
70
  }
71
71
  const show = () => setIsHovered(true);
72
72
  const hide = () => setIsHovered(false);
73
+ const showOnKeyboardFocus = event => {
74
+ if (event.target instanceof Element && event.target.matches(':focus-visible')) {
75
+ show();
76
+ }
77
+ };
73
78
  referenceEl.addEventListener('mouseenter', show);
74
79
  referenceEl.addEventListener('mouseleave', hide);
75
- referenceEl.addEventListener('focusin', show);
80
+ referenceEl.addEventListener('focusin', showOnKeyboardFocus);
76
81
  referenceEl.addEventListener('focusout', hide);
77
82
  return () => {
78
83
  referenceEl.removeEventListener('mouseenter', show);
79
84
  referenceEl.removeEventListener('mouseleave', hide);
80
- referenceEl.removeEventListener('focusin', show);
85
+ referenceEl.removeEventListener('focusin', showOnKeyboardFocus);
81
86
  referenceEl.removeEventListener('focusout', hide);
82
87
  };
83
88
  }, [referenceEl, isControlled]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "4.17.0",
3
+ "version": "4.17.2",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -48,7 +48,7 @@
48
48
  "@pushwoosh/kit-constants": "^3.2.1",
49
49
  "@pushwoosh/kit-helpers": "^4.17.2",
50
50
  "@pushwoosh/kit-icons": "^3.0.2",
51
- "@pushwoosh/kit-typography": "^2.1.2",
51
+ "@pushwoosh/kit-typography": "^2.2.0",
52
52
  "@tippyjs/react": "^4.2.6",
53
53
  "@uiw/codemirror-themes": "^4.23.8",
54
54
  "@uiw/react-codemirror": "^4.25.12",