UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

26 lines 996 B
import React, { useCallback } from 'react'; import StringValue from "../String/index.js"; import { format, cleanNumber } from "../../../../components/number-format/NumberUtils.js"; import useTranslation from "../../hooks/useTranslation.js"; import { isValueEmpty } from "../../ValueBlock/index.js"; function OrganizationNumber(props) { var _props$label; const translations = useTranslation().OrganizationNumber; const toInput = useCallback(value => { if (isValueEmpty(value)) { return undefined; } return format(cleanNumber(value), { org: true }).toString(); }, []); const stringValueProps = { ...props, label: (_props$label = props.label) !== null && _props$label !== void 0 ? _props$label : props.inline ? undefined : translations.label, toInput }; return React.createElement(StringValue, stringValueProps); } OrganizationNumber._supportsSpacingProps = true; export default OrganizationNumber; //# sourceMappingURL=OrganizationNumber.js.map