|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { FlowComponent, JSX, mergeProps } from "solid-js";
|
|
|
|
|
import { FlowComponent, JSX, mergeProps, onMount, splitProps } from "solid-js";
|
|
|
|
|
|
|
|
|
|
const Collapsible: FlowComponent<
|
|
|
|
|
{
|
|
|
|
@ -8,7 +8,15 @@ const Collapsible: FlowComponent<
|
|
|
|
|
label: string | JSX.Element;
|
|
|
|
|
} & JSX.HTMLAttributes<HTMLDivElement>
|
|
|
|
|
> = (p) => {
|
|
|
|
|
const props = mergeProps({ activeTitleColor: "text-black" }, p);
|
|
|
|
|
const mprops = mergeProps({ activeTitleColor: "text-black" }, p);
|
|
|
|
|
let [props, rest] = splitProps(mprops, [
|
|
|
|
|
"activeTitleColor",
|
|
|
|
|
"onChange",
|
|
|
|
|
"value",
|
|
|
|
|
"label",
|
|
|
|
|
"class",
|
|
|
|
|
"children",
|
|
|
|
|
]);
|
|
|
|
|
let inputRef: HTMLInputElement = undefined!;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
@ -19,7 +27,7 @@ const Collapsible: FlowComponent<
|
|
|
|
|
props.class
|
|
|
|
|
}
|
|
|
|
|
onFocus={(evt) => {
|
|
|
|
|
if (props.value) {
|
|
|
|
|
if (inputRef.checked) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -27,6 +35,7 @@ const Collapsible: FlowComponent<
|
|
|
|
|
inputRef.checked = true;
|
|
|
|
|
inputRef.dispatchEvent(new InputEvent("change", { bubbles: true }));
|
|
|
|
|
}}
|
|
|
|
|
{...rest}
|
|
|
|
|
>
|
|
|
|
|
<input
|
|
|
|
|
ref={inputRef}
|
|
|
|
|