@pushwoosh/dumb-components 4.12.0 → 4.12.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.
@@ -65,6 +65,7 @@ export const DropdownMenu = ({
65
65
  rects
66
66
  }) {
67
67
  if (fullWidth) {
68
+ // eslint-disable-next-line react/dom-no-flush-sync -- floating-ui size() needs the width applied before it measures
68
69
  flushSync(() => setWidth(rects.reference.width));
69
70
  }
70
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "4.12.0",
3
+ "version": "4.12.1",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -36,8 +36,8 @@
36
36
  "@codemirror/view": "^6.43.11",
37
37
  "@floating-ui/react-dom": "^2.1.2",
38
38
  "@lezer/highlight": "^1.2.1",
39
- "@pushwoosh/kit-constants": "^3.0.0",
40
- "@pushwoosh/kit-helpers": "^4.16.1",
39
+ "@pushwoosh/kit-constants": "^3.1.0",
40
+ "@pushwoosh/kit-helpers": "^4.16.2",
41
41
  "@pushwoosh/kit-icons": "^2.3.15",
42
42
  "@pushwoosh/kit-typography": "^2.0.0",
43
43
  "@tippyjs/react": "^4.2.6",
@@ -255,13 +255,11 @@ function parseTokens(tokensArg) {
255
255
  Control: () => {
256
256
  const controlNodeName = token.value;
257
257
  const chidrens = [[], []];
258
- let args = '';
259
258
  currentTokenIndex++;
260
- if (tokens[currentTokenIndex] && tokens[currentTokenIndex].type === 'ControlArg') {
261
- args = tokens[currentTokenIndex].value;
262
- } else {
259
+ if (!tokens[currentTokenIndex] || tokens[currentTokenIndex].type !== 'ControlArg') {
263
260
  throw new Error(`Syntax error: expected argument for ${controlNodeName} at line ${token.lineNo}`);
264
261
  }
262
+ const args = tokens[currentTokenIndex].value;
265
263
  currentTokenIndex++;
266
264
  if (pairedControlTokens[controlNodeName]) {
267
265
  const controlChildren = parseUntil(tokens, 'ControlEnd');
@@ -1,4 +1,3 @@
1
- import { createElement as _createElement } from "react";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import styled from 'styled-components';
4
3
  import { Color } from '@pushwoosh/kit-constants';
@@ -104,7 +103,7 @@ const Txt = styled.span.withConfig({
104
103
  export function renderToReact(ast, context) {
105
104
  return renderNodesToArray(ast, context, (tagNode, children, key) => {
106
105
  const TagName = tagNode.name;
107
- const props = Object.fromEntries(Object.entries(tagNode.params).map(([key, value]) => [key, unpackScalarOrValue(value, context)]));
106
+ const props = Object.fromEntries(Object.entries(tagNode.params).filter(([name]) => name !== 'key').map(([name, value]) => [name, unpackScalarOrValue(value, context)]));
108
107
  if (TagName === 'text') {
109
108
  return [_jsx(Txt, {
110
109
  "$variant": props.variant,
@@ -115,14 +114,13 @@ export function renderToReact(ast, context) {
115
114
  }, key)];
116
115
  }
117
116
  if (voidTags.has(TagName)) {
118
- return [_createElement(TagName, {
119
- ...props,
120
- key: key
121
- })];
117
+ return [_jsx(TagName, {
118
+ ...props
119
+ }, key)];
122
120
  }
123
- return [_createElement(TagName, {
121
+ return [_jsx(TagName, {
124
122
  ...props,
125
- key: key
126
- }, children)];
123
+ children: children
124
+ }, key)];
127
125
  });
128
126
  }