DuyTa's picture
Upload folder using huggingface_hub
bc20498 verified
raw
history blame
800 Bytes
import { createBitAttrs, getOptionUpdater, removeUndefined } from "../../internal/index.js";
import { createPinInput } from "@melt-ui/svelte";
import { getContext, setContext } from "svelte";
export function getPinInputData() {
const NAME = "pin-input";
const PARTS = ["root", "input", "hidden-input"];
return {
NAME,
PARTS,
};
}
export function setCtx(props) {
const { NAME, PARTS } = getPinInputData();
const getAttrs = createBitAttrs(NAME, PARTS);
const pinInput = { ...createPinInput(removeUndefined(props)), getAttrs };
setContext(NAME, pinInput);
return {
...pinInput,
updateOption: getOptionUpdater(pinInput.options),
};
}
export function getCtx() {
const { NAME } = getPinInputData();
return getContext(NAME);
}