@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
30 lines • 1.22 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
const _excluded = ["value", "className", "label"];
import React from 'react';
import classnames from 'classnames';
import { useTranslation, useValueProps } from '../../hooks';
import ValueBlock from '../../ValueBlock';
import useCountry from './useCountry';
function SelectCountry(props) {
var _getCountryNameByIso;
const translations = useTranslation().SelectCountry;
const _useValueProps = useValueProps(props),
{
value,
className,
label = translations.label
} = _useValueProps,
rest = _objectWithoutProperties(_useValueProps, _excluded);
const {
getCountryNameByIso
} = useCountry();
return React.createElement(ValueBlock, _extends({
label: label,
className: classnames('dnb-forms-value-select-country', className)
}, rest), (_getCountryNameByIso = getCountryNameByIso(value)) !== null && _getCountryNameByIso !== void 0 ? _getCountryNameByIso : value);
}
SelectCountry.useCountry = useCountry;
SelectCountry._supportsSpacingProps = true;
export default SelectCountry;
//# sourceMappingURL=SelectCountry.js.map