@pushwoosh/dumb-components 1.0.69 → 1.0.70

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
+ import styled from 'styled-components';
2
3
  import { Color } from '@pushwoosh/kit-constants';
3
- import { Text } from '@pushwoosh/kit-typography';
4
+ import { variants } from '@pushwoosh/kit-typography/map';
4
5
  import { filters } from './filters';
5
6
  import { stringifyScalarOrVariable, unpackScalarOrValue } from './helpers';
6
7
  import { ifOperatorFns } from './parser';
@@ -84,25 +85,25 @@ function getColor(color) {
84
85
  }
85
86
  return color;
86
87
  }
88
+ const Txt = styled.span.withConfig({
89
+ displayName: "Txt",
90
+ componentId: "sc-nm71u5-0"
91
+ })(["", " ", ""], ({
92
+ $color
93
+ }) => $color && `color: ${$color};`, ({
94
+ $variant
95
+ }) => $variant && variants[$variant]);
87
96
  export function renderToReact(ast, context) {
88
97
  return renderNodesToArray(ast, context, (tagNode, children, key) => {
89
98
  const TagName = tagNode.name;
90
99
  const props = Object.fromEntries(Object.entries(tagNode.params).map(([key, value]) => [key, unpackScalarOrValue(value, context)]));
91
100
  if (TagName === 'text') {
92
- return [React.createElement(Text, {
101
+ return [React.createElement(Txt, {
93
102
  "$variant": props.variant,
94
103
  "$color": getColor(props.color),
95
104
  key: key
96
105
  }, children)];
97
106
  }
98
- if (TagName === 'color') {
99
- return [React.createElement("span", {
100
- style: {
101
- color: getColor(props.color)
102
- },
103
- key: key
104
- }, children)];
105
- }
106
107
  return [React.createElement(TagName, {
107
108
  ...props,
108
109
  key: key