I have created a new component called "Dropdown.tsx" by referring to the ignition sdk-examples. However I am getting Conflict: Multiple chunks emit assets to the same filename RadComponents.js (chunks RadComponents and styles). error when I try to import the css for the prime react component I am using. The error goes away if I remove the theme css import, but my dropdown won't be styled. Can someone please help me applying the css for the prime react dropdown component. Below is my Dropdown.tsx code
import * as React from 'react';
import {
Component,
ComponentMeta,
ComponentProps,
PComponent,
PropertyTree,
SizeObject
} from '@inductiveautomation/perspective-client';
import { bind } from 'bind-decorator';
import { Dropdown as PrimeDropdown, DropdownChangeEvent } from 'primereact/dropdown';
import 'primereact/resources/themes/lara-light-indigo/theme';
export const COMPONENT_TYPE = "rad.display.dropdown";
interface DropdownProps {
placeholder: string;
options: Array<{ name: string, code: string }>;
}
export class Dropdown extends Component<ComponentProps<DropdownProps>, { selectedOption: any }> {
state = {
selectedOption: ''
};
@bind
onOptionChange(e: DropdownChangeEvent) {
this.setState({ selectedOption: e.value });
}
@bind
render() {
const { props, emit } = this.props;
return (
<div {...emit({classes: ["myDropdownContainer"]})}>
<PrimeDropdown
value={this.state.selectedOption}
onChange={this.onOptionChange}
options={props.options}
optionLabel="name"
placeholder="Select Any Option"
/>
</div>
);
}
}
export class DropdownMeta implements ComponentMeta {
getComponentType(): string {
return COMPONENT_TYPE;
}
getViewComponent(): PComponent {
return Dropdown;
}
getDefaultSize(): SizeObject {
return ({
width: 300,
height: 300
});
}
getPropsReducer(tree: PropertyTree): DropdownProps {
return {
placeholder: tree.read("placeholder", "Select a City"),
options: tree.read("options", [])
};
}
}