import { computed } from 'vue'; import '../../../form/index.mjs'; import '../../../../utils/index.mjs'; import '../../../../hooks/index.mjs'; import { useCheckboxDisabled } from './use-checkbox-disabled.mjs'; import { useCheckboxEvent } from './use-checkbox-event.mjs'; import { useCheckboxModel } from './use-checkbox-model.mjs'; import { useCheckboxStatus } from './use-checkbox-status.mjs'; import { useFormItem, useFormItemInputId } from '../../../form/src/hooks/use-form-item.mjs'; import { isArray } from '@vue/shared'; import { useDeprecated } from '../../../../hooks/use-deprecated/index.mjs'; import { isPropAbsent } from '../../../../utils/types.mjs'; const useCheckbox = (props, slots) => { const { formItem: elFormItem } = useFormItem(); const { model, isGroup, isLimitExceeded } = useCheckboxModel(props); const { isFocused, isChecked, checkboxButtonSize, checkboxSize, hasOwnLabel, actualValue } = useCheckboxStatus(props, slots, { model }); const { isDisabled } = useCheckboxDisabled({ model, isChecked }); const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: elFormItem, disableIdGeneration: hasOwnLabel, disableIdManagement: isGroup }); const { handleChange, onClickRoot } = useCheckboxEvent(props, { model, isLimitExceeded, hasOwnLabel, isDisabled, isLabeledByFormItem }); const setStoreValue = () => { function addToStore() { var _a, _b; if (isArray(model.value) && !model.value.includes(actualValue.value)) { model.value.push(actualValue.value); } else { model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true; } } props.checked && addToStore(); }; setStoreValue(); useDeprecated({ from: "label act as value", replacement: "value", version: "3.0.0", scope: "el-checkbox", ref: "https://element-plus.org/en-US/component/checkbox.html" }, computed(() => isGroup.value && isPropAbsent(props.value))); useDeprecated({ from: "true-label", replacement: "true-value", version: "3.0.0", scope: "el-checkbox", ref: "https://element-plus.org/en-US/component/checkbox.html" }, computed(() => !!props.trueLabel)); useDeprecated({ from: "false-label", replacement: "false-value", version: "3.0.0", scope: "el-checkbox", ref: "https://element-plus.org/en-US/component/checkbox.html" }, computed(() => !!props.falseLabel)); return { inputId, isLabeledByFormItem, isChecked, isDisabled, isFocused, checkboxButtonSize, checkboxSize, hasOwnLabel, model, actualValue, handleChange, onClickRoot }; }; export { useCheckbox }; //# sourceMappingURL=use-checkbox.mjs.map