@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
50 lines (46 loc) • 1.74 kB
JavaScript
"use client";
import { styled } from "../../core/system/factory.js";
import { createComponent } from "../../core/components/create-component.js";
import { formatNumberStyle } from "./format-number.style.js";
import { useFormatNumber } from "./use-format-number.js";
import { jsx } from "react/jsx-runtime";
//#region src/components/format/format-number.tsx
const { PropsContext: FormatNumberPropsContext, usePropsContext: useFormatNumberPropsContext, withContext } = createComponent("format-number", formatNumberStyle);
/**
* `Format` is used to format dates, numbers, and bytes according to a specific locale.
*
* @see https://yamada-ui.com/docs/components/format
*/
const FormatNumber = withContext(({ style, compactDisplay, currency, currencyDisplay, currencySign, locale, localeMatcher, maximumFractionDigits, maximumSignificantDigits, minimumFractionDigits, minimumIntegerDigits, minimumSignificantDigits, notation, numberingSystem, roundingIncrement, roundingMode, roundingPriority, signDisplay, trailingZeroDisplay, unit, unitDisplay, useGrouping, value,...rest }) => {
const text = useFormatNumber(value, {
style,
compactDisplay,
currency,
currencyDisplay,
currencySign,
locale,
localeMatcher,
maximumFractionDigits,
maximumSignificantDigits,
minimumFractionDigits,
minimumIntegerDigits,
minimumSignificantDigits,
notation,
numberingSystem,
roundingIncrement,
roundingMode,
roundingPriority,
signDisplay,
trailingZeroDisplay,
unit,
unitDisplay,
useGrouping
});
return /* @__PURE__ */ jsx(styled.span, {
...rest,
children: text
});
})();
//#endregion
export { FormatNumber, FormatNumberPropsContext, useFormatNumberPropsContext };
//# sourceMappingURL=format-number.js.map