/**
 * ldesign v0.3.13
 * (c) 2023 ldesign
 * @license MIT
 */

import { defineComponent, computed, createVNode } from 'vue';
import { useBaseClassName } from '../hooks.js';
import ColorSlider from './slider.js';
import '../../hooks/useConfig.js';
import '../../config-provider/useConfig.js';
import 'lodash/cloneDeep';
import 'lodash/isFunction';
import 'lodash/isString';
import '../../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import 'lodash/isArray';
import '../../_common/js/global-config/default-config.js';
import '../../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import '../../_chunks/dep-512eb181.js';
import 'dayjs';
import '../../_chunks/dep-ac28b67c.js';
import '../../config-provider/type.js';
import '@babel/runtime/helpers/defineProperty';
import '../const.js';
import '../../_common/js/color-picker/constants.js';
import '../utils/index.js';
import '../../_common/js/color-picker/index.js';
import '../../_common/js/color-picker/cmyk.js';
import '../../_common/js/color-picker/color.js';
import '@babel/runtime/helpers/slicedToArray';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import 'tinycolor2';
import '../../_common/js/color-picker/gradient.js';
import 'lodash/isNull';
import '../../_common/js/color-picker/draggable.js';
import './base-props.js';

var AlphaSlider = defineComponent({
  name: "AlphaSlider",
  inheritAttrs: false,
  props: {
    color: {
      type: Object
    },
    disabled: {
      type: Boolean,
      "default": false
    },
    onChange: {
      type: Function,
      "default": function _default() {
        return function () {};
      }
    }
  },
  setup: function setup(props) {
    var baseClassName = useBaseClassName();
    var handleChange = function handleChange(v, isDragEnd) {
      props.onChange(v / 100, isDragEnd);
    };
    var railStyle = computed(function () {
      return {
        background: "linear-gradient(to right, rgba(0, 0, 0, 0), ".concat(props.color.rgb, ")")
      };
    });
    return {
      baseClassName: baseClassName,
      railStyle: railStyle,
      handleChange: handleChange
    };
  },
  render: function render() {
    var baseClassName = this.baseClassName;
    return createVNode(ColorSlider, {
      "class": ["".concat(baseClassName, "__alpha"), "".concat(baseClassName, "--bg-alpha")],
      "color": this.color,
      "value": this.color.alpha * 100,
      "onChange": this.handleChange,
      "rail-style": this.railStyle,
      "max-value": 100,
      "disabled": this.disabled,
      "type": "alpha"
    }, null);
  }
});

export { AlphaSlider as default };
//# sourceMappingURL=alpha.js.map
