@pushwoosh/dumb-components 4.8.0 → 4.8.1

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.
@@ -0,0 +1,4 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { ButtonLabelProps } from './types';
3
+ /** A button title with the glyph chats put on link and phone buttons, so they don't read as quick replies. */
4
+ export declare function ButtonLabel(props: ButtonLabelProps): ReactElement;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CallIcon, OpenIcon } from '@pushwoosh/kit-icons';
3
+ import { Label } from './styles';
4
+ /** A button title with the glyph chats put on link and phone buttons, so they don't read as quick replies. */
5
+ export function ButtonLabel(props) {
6
+ const {
7
+ button
8
+ } = props;
9
+ return _jsxs(Label, {
10
+ children: [button.kind === 'url' && _jsx(OpenIcon, {
11
+ "data-testid": "chat-button-url",
12
+ size: "small",
13
+ view: "lined"
14
+ }), button.kind === 'phone' && _jsx(CallIcon, {
15
+ "data-testid": "chat-button-phone",
16
+ size: "small",
17
+ view: "lined"
18
+ }), button.title]
19
+ });
20
+ }
@@ -0,0 +1 @@
1
+ export { ButtonLabel } from './ButtonLabel';
@@ -0,0 +1 @@
1
+ export { ButtonLabel } from './ButtonLabel';
@@ -0,0 +1,3 @@
1
+ export declare const Label: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
2
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
3
+ }> & string;
@@ -0,0 +1,5 @@
1
+ import styled from 'styled-components';
2
+ export const Label = styled.span.withConfig({
3
+ displayName: "Label",
4
+ componentId: "sc-2ivmoa-0"
5
+ })(["display:inline-flex;align-items:center;justify-content:center;gap:4px;"]);
@@ -0,0 +1,5 @@
1
+ import type { ChatButton } from '../../types';
2
+ /** Props of {@link ButtonLabel}. */
3
+ export interface ButtonLabelProps {
4
+ button: ChatButton;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -3,6 +3,7 @@ import { CardBody, CardButton, CardButtons, CardFrame, CardTitle, Thumbnail } fr
3
3
  import { RCS_MEDIA_HEIGHT } from '../../constants';
4
4
  import { rcsLayoutOf } from '../../helpers';
5
5
  import { Footer } from '../../styles';
6
+ import { ButtonLabel } from '../ButtonLabel';
6
7
  import { ChatMediaView } from '../ChatMediaView';
7
8
  import { ChatText } from '../ChatText';
8
9
  import { Deliverable } from '../Deliverable';
@@ -54,7 +55,9 @@ export function ChatCardView(props) {
54
55
  }), Boolean(card.buttons?.length) && _jsx(CardButtons, {
55
56
  children: card.buttons?.map(button => _jsx(CardButton, {
56
57
  "$skin": look.skin,
57
- children: button.title
58
+ children: _jsx(ButtonLabel, {
59
+ button: button
60
+ })
58
61
  }, button.id))
59
62
  })]
60
63
  });
@@ -3,6 +3,7 @@ import { ListIcon } from '@pushwoosh/kit-icons';
3
3
  import { InlineButton, InlineButtons } from './styles';
4
4
  import { bubbleButtonsOf } from '../../helpers';
5
5
  import { Bubble, Footer, HeaderText } from '../../styles';
6
+ import { ButtonLabel } from '../ButtonLabel';
6
7
  import { ChatMediaView } from '../ChatMediaView';
7
8
  import { ChatText } from '../ChatText';
8
9
  import { Deliverable } from '../Deliverable';
@@ -54,7 +55,9 @@ export function MessageBubble(props) {
54
55
  }), (inlineButtons.length > 0 || content.list) && _jsxs(InlineButtons, {
55
56
  children: [inlineButtons.map(button => _jsx(InlineButton, {
56
57
  "$skin": look.skin,
57
- children: button.title
58
+ children: _jsx(ButtonLabel, {
59
+ button: button
60
+ })
58
61
  }, button.id)), content.list && _jsxs(InlineButton, {
59
62
  "$skin": look.skin,
60
63
  children: [_jsx(ListIcon, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "4.8.0",
3
+ "version": "4.8.1",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",