@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
1 lines • 2.94 kB
Source Map (JSON)
{"version":3,"file":"format-number.cjs","names":["createComponent","formatNumberStyle","useFormatNumber","styled"],"sources":["../../../../src/components/format/format-number.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { FormatNumberStyle } from \"./format-number.style\"\nimport type { FormatNumberOptions } from \"./use-format-number\"\nimport { createComponent, styled } from \"../../core\"\nimport { formatNumberStyle } from \"./format-number.style\"\nimport { useFormatNumber } from \"./use-format-number\"\n\nexport interface FormatNumberProps\n extends Omit<HTMLStyledProps<\"span\">, \"style\">,\n ThemeProps<FormatNumberStyle>,\n FormatNumberOptions {\n /**\n * The numeric value to be formatted.\n */\n value: number\n}\n\nconst {\n PropsContext: FormatNumberPropsContext,\n usePropsContext: useFormatNumberPropsContext,\n withContext,\n} = createComponent<FormatNumberProps, FormatNumberStyle>(\n \"format-number\",\n formatNumberStyle,\n)\n\nexport { FormatNumberPropsContext, useFormatNumberPropsContext }\n\n/**\n * `Format` is used to format dates, numbers, and bytes according to a specific locale.\n *\n * @see https://yamada-ui.com/docs/components/format\n */\nexport const FormatNumber = withContext<\"span\", FormatNumberProps>(\n ({\n style,\n compactDisplay,\n currency,\n currencyDisplay,\n currencySign,\n locale,\n localeMatcher,\n maximumFractionDigits,\n maximumSignificantDigits,\n minimumFractionDigits,\n minimumIntegerDigits,\n minimumSignificantDigits,\n notation,\n numberingSystem,\n roundingIncrement,\n roundingMode,\n roundingPriority,\n signDisplay,\n trailingZeroDisplay,\n unit,\n unitDisplay,\n useGrouping,\n value,\n ...rest\n }) => {\n const text = useFormatNumber(value, {\n style,\n compactDisplay,\n currency,\n currencyDisplay,\n currencySign,\n locale,\n localeMatcher,\n maximumFractionDigits,\n maximumSignificantDigits,\n minimumFractionDigits,\n minimumIntegerDigits,\n minimumSignificantDigits,\n notation,\n numberingSystem,\n roundingIncrement,\n roundingMode,\n roundingPriority,\n signDisplay,\n trailingZeroDisplay,\n unit,\n unitDisplay,\n useGrouping,\n })\n\n return <styled.span {...rest}>{text}</styled.span>\n },\n)()\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAM,EACJ,cAAc,0BACd,iBAAiB,6BACjB,gBACEA,yCACF,iBACAC,8CACD;;;;;;AASD,MAAa,eAAe,aACzB,EACC,OACA,gBACA,UACA,iBACA,cACA,QACA,eACA,uBACA,0BACA,uBACA,sBACA,0BACA,UACA,iBACA,mBACA,cACA,kBACA,aACA,qBACA,MACA,aACA,aACA,MACA,GAAG,WACC;CACJ,MAAM,OAAOC,0CAAgB,OAAO;EAClC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QAAO,2CAACC,uBAAO;EAAK,GAAI;YAAO;GAAmB;EAErD,EAAE"}