The issue here is I have lit element components that get wrapped in React using lit-labs-react. I have 1 component working with styles and rendering successfully. Then adding another component causes the error below. Seems to only happen when using components in storybook. Has anyone came across this issue in storybook before? I would've thought since these styles are encapsulated within the shadowDOM, it wouldn't have these issues. Maybe a loading/timing issue of when the styles apply?
The error:
css-tag.ts:143 Uncaught TypeError: Failed to set the 'adoptedStyleSheets' property on 'ShadowRoot': Failed to convert value to 'CSSStyleSheet'.
Within the component here is how lit element loads styles:
import TextareaStyles from "./textarea.scss";
static get styles() {
return [TextareaStyles];
}
The usage:
import React from "react";
import { createComponent } from "@lit-labs/react";
import { Textarea } from "@bitdev/textarea";
export const Textarea = createComponent({
tagName: "textarea",
elementClass: Textarea,
react: React,
events: {
oninput: "event-textarea-on-input",
},
});
Then adding this within MDX file for preview like so:
import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
import { Textarea } from "./textarea.component";
<Canvas>
<Story name="Textarea">
<Textarea rows={7}></Textarea>
</Story>
</Canvas>