/**
 * ldesign v0.2.2
 * (c) 2022年9月20日 swimly
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { defineComponent, toRefs, ref, inject, computed } from '@vue/composition-api';
import { SelectOptionGroupProps } from './props.js';
import { useLNodeJSX } from '../../hooks/lnode.js';
import { usePrefixClass, useConfig } from '../config-provider/useConfig.js';
import useCommonClassName from '../../hooks/use-common-classname.js';
import 'lodash/isEmpty';
import 'lodash/isFunction';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../../hooks/render-lnode.js';
import 'lodash/isString';
import 'lodash/isObject';
import '../config-provider/context.js';
import 'lodash';
import '../../chunks/zh_CN.js';
import '../config-provider/type.js';

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _OptionGroup = defineComponent({
  name: "LOptionGroup",
  props: _objectSpread({}, SelectOptionGroupProps),
  setup: function setup(props2) {
    var _toRefs = toRefs(props2),
        divider = _toRefs.divider;

    var ulRef = ref(null);
    var tSelect = inject("tSelect");

    var _useCommonClassName = useCommonClassName(),
        sizeClassNames = _useCommonClassName.sizeClassNames;

    var COMPONENT_NAME = usePrefixClass("select");

    var _useConfig = useConfig("classPrefix"),
        classPrefix = _useConfig.classPrefix;

    var classes = computed(function () {
      var _ref;

      return ["".concat(COMPONENT_NAME.value, "-option-group"), (_ref = {}, _defineProperty(_ref, sizeClassNames[tSelect.size], tSelect && tSelect.size), _defineProperty(_ref, "".concat(COMPONENT_NAME.value, "-option-group__divider"), divider), _ref)];
    });
    return {
      classes: classes,
      ulRef: ulRef,
      classPrefix: classPrefix,
      componentName: COMPONENT_NAME
    };
  },
  render: function render() {
    var h = arguments[0];
    var renderTNode = useLNodeJSX();
    var children = renderTNode("default");
    return h("li", {
      "class": this.classes
    }, [h("div", {
      "class": "".concat(this.componentName, "-option-group__header")
    }, [this.label]), h("ul", {
      "class": "".concat(this.classPrefix, "-select__list"),
      "ref": "ulRef"
    }, [children])]);
  }
});

export { _OptionGroup as default };
//# sourceMappingURL=option-group.js.map
