File size: 796 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { createCheckbox } from "@melt-ui/svelte";
import { getContext, setContext } from "svelte";
import { removeUndefined, getOptionUpdater, createBitAttrs } from "../../internal/index.js";
export function getCheckboxData() {
    const NAME = "checkbox";
    const PARTS = ["root", "input", "indicator"];
    return {
        NAME,
        PARTS,
    };
}
export function setCtx(props) {
    const { NAME, PARTS } = getCheckboxData();
    const getAttrs = createBitAttrs(NAME, PARTS);
    const checkbox = { ...createCheckbox(removeUndefined(props)), getAttrs };
    setContext(NAME, checkbox);
    return {
        ...checkbox,
        updateOption: getOptionUpdater(checkbox.options),
    };
}
export function getCtx() {
    const { NAME } = getCheckboxData();
    return getContext(NAME);
}