"use strict";

var _define = require("./preactement/define");
var _Dropdown = require("../Dropdown");
var _wrapperUtils = require("./wrapperUtils");
var _jsxRuntime = require("preact/compat/jsx-runtime");
const attributes = [
// Using the lowercase HTML attribute name rather than `auto-focus` so it's
// more natural. There's no reason for us to worry about name collisions.
'autofocus', 'aria-disabled', 'class-name', 'disabled', 'error-message', 'error-placement', 'field-class-name', 'options', 'label', 'label-class-name', 'label-id', 'hint', 'hint-id', 'name', 'requirements-label', 'root-id', 'size', 'value', 'default-value'];

/* eslint-disable @typescript-eslint/no-namespace */

/* eslint-enable */

const Wrapper = _ref => {
  let {
    children,
    options,
    rootId,
    ...otherProps
  } = _ref;
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.Dropdown, {
    ...otherProps,
    autoFocus: (0, _wrapperUtils.parseBooleanAttr)(otherProps.autofocus),
    disabled: (0, _wrapperUtils.parseBooleanAttr)(otherProps.disabled),
    "aria-disabled": (0, _wrapperUtils.parseBooleanAttr)(otherProps.ariaDisabled),
    options: typeof options === 'string' ? JSON.parse(options) : options,
    id: rootId,
    children: options ? undefined : children
  });
};
(0, _define.define)('ds-dropdown', () => Wrapper, {
  attributes,
  events: ['onChange', 'onBlur']
});