@itwin/quantity-formatting-react
Version:
React components and utilities for quantity formatting
50 lines • 1.64 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Select } from "@itwin/itwinui-react";
import { useTranslation } from "../../../../useTranslation.js";
/** Component use to set Fraction precision
* @internal
*/
export function FractionPrecisionSelector(props) {
const { precision, onChange, id } = props;
const { translate } = useTranslation();
const options = [
{
value: 1,
label: translate("QuantityFormat:fraction_precision.whole"),
},
{
value: 2,
label: translate("QuantityFormat:fraction_precision.half"),
},
{
value: 4,
label: translate("QuantityFormat:fraction_precision.quarter"),
},
{
value: 8,
label: translate("QuantityFormat:fraction_precision.eighth"),
},
{
value: 16,
label: translate("QuantityFormat:fraction_precision.sixteenth"),
},
{
value: 32,
label: translate("QuantityFormat:fraction_precision.over32"),
},
{
value: 64,
label: translate("QuantityFormat:fraction_precision.over64"),
},
{
value: 128,
label: translate("QuantityFormat:fraction_precision.over128"),
},
{
value: 256,
label: translate("QuantityFormat:fraction_precision.over256"),
},
];
return (_jsx(Select, { options: options, value: precision, onChange: (newValue) => onChange(newValue), size: "small", id: id }));
}
//# sourceMappingURL=FractionPrecision.js.map