| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 | var __defProp = Object.defineProperty;var __getOwnPropDesc = Object.getOwnPropertyDescriptor;var __getOwnPropNames = Object.getOwnPropertyNames;var __hasOwnProp = Object.prototype.hasOwnProperty;var __export = (target, all) => {  for (var name in all)    __defProp(target, name, { get: all[name], enumerable: true });};var __copyProps = (to, from, except, desc) => {  if (from && typeof from === "object" || typeof from === "function") {    for (let key of __getOwnPropNames(from))      if (!__hasOwnProp.call(to, key) && key !== except)        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });  }  return to;};var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);var stdin_exports = {};__export(stdin_exports, {  checkerProps: () => checkerProps,  default: () => stdin_default});module.exports = __toCommonJS(stdin_exports);var import_vue = require("vue");var import_vue2 = require("vue");var import_utils = require("../utils");var import_icon = require("../icon");const checkerProps = {  name: import_utils.unknownProp,  shape: (0, import_utils.makeStringProp)("round"),  disabled: Boolean,  iconSize: import_utils.numericProp,  modelValue: import_utils.unknownProp,  checkedColor: String,  labelPosition: String,  labelDisabled: Boolean};var stdin_default = (0, import_vue2.defineComponent)({  props: (0, import_utils.extend)({}, checkerProps, {    bem: (0, import_utils.makeRequiredProp)(Function),    role: String,    parent: Object,    checked: Boolean,    bindGroup: import_utils.truthProp  }),  emits: ["click", "toggle"],  setup(props, {    emit,    slots  }) {    const iconRef = (0, import_vue2.ref)();    const getParentProp = (name) => {      if (props.parent && props.bindGroup) {        return props.parent.props[name];      }    };    const disabled = (0, import_vue2.computed)(() => getParentProp("disabled") || props.disabled);    const direction = (0, import_vue2.computed)(() => getParentProp("direction"));    const iconStyle = (0, import_vue2.computed)(() => {      const checkedColor = props.checkedColor || getParentProp("checkedColor");      if (checkedColor && props.checked && !disabled.value) {        return {          borderColor: checkedColor,          backgroundColor: checkedColor        };      }    });    const onClick = (event) => {      const {        target      } = event;      const icon = iconRef.value;      const iconClicked = icon === target || (icon == null ? void 0 : icon.contains(target));      if (!disabled.value && (iconClicked || !props.labelDisabled)) {        emit("toggle");      }      emit("click", event);    };    const renderIcon = () => {      const {        bem,        shape,        checked      } = props;      const iconSize = props.iconSize || getParentProp("iconSize");      return (0, import_vue.createVNode)("div", {        "ref": iconRef,        "class": bem("icon", [shape, {          disabled: disabled.value,          checked        }]),        "style": {          fontSize: (0, import_utils.addUnit)(iconSize)        }      }, [slots.icon ? slots.icon({        checked,        disabled: disabled.value      }) : (0, import_vue.createVNode)(import_icon.Icon, {        "name": "success",        "style": iconStyle.value      }, null)]);    };    const renderLabel = () => {      if (slots.default) {        return (0, import_vue.createVNode)("span", {          "class": props.bem("label", [props.labelPosition, {            disabled: disabled.value          }])        }, [slots.default()]);      }    };    return () => {      const nodes = props.labelPosition === "left" ? [renderLabel(), renderIcon()] : [renderIcon(), renderLabel()];      return (0, import_vue.createVNode)("div", {        "role": props.role,        "class": props.bem([{          disabled: disabled.value,          "label-disabled": props.labelDisabled        }, direction.value]),        "tabindex": disabled.value ? void 0 : 0,        "aria-checked": props.checked,        "onClick": onClick      }, [nodes]);    };  }});
 |