UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

1 lines 1.7 kB
{"version":3,"file":"format-byte.cjs","names":["createComponent","formatByteStyle","useFormatByte","styled"],"sources":["../../../../src/components/format/format-byte.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { FormatByteStyle } from \"./format-byte.style\"\nimport type { FormatBytesOptions } from \"./use-format-byte\"\nimport { createComponent, styled } from \"../../core\"\nimport { formatByteStyle } from \"./format-byte.style\"\nimport { useFormatByte } from \"./use-format-byte\"\n\nexport interface FormatByteProps\n extends HTMLStyledProps<\"span\">,\n ThemeProps<FormatByteStyle>,\n FormatBytesOptions {\n /**\n * The byte size to format\n */\n value: number\n}\n\nconst {\n PropsContext: FormatBytePropsContext,\n usePropsContext: useFormatBytePropsContext,\n withContext,\n} = createComponent<FormatByteProps, FormatByteStyle>(\n \"format-byte\",\n formatByteStyle,\n)\n\nexport { FormatBytePropsContext, useFormatBytePropsContext }\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 FormatByte = withContext(\n ({ locale, unit, unitDisplay, value, ...rest }) => {\n const text = useFormatByte(value, { locale, unit, unitDisplay })\n\n return <styled.span {...rest}>{text}</styled.span>\n },\n)()\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAM,EACJ,cAAc,wBACd,iBAAiB,2BACjB,gBACEA,yCACF,eACAC,0CACD;;;;;;AASD,MAAa,aAAa,aACvB,EAAE,QAAQ,MAAM,aAAa,MAAO,GAAG,WAAW;CACjD,MAAM,OAAOC,sCAAc,OAAO;EAAE;EAAQ;EAAM;EAAa,CAAC;AAEhE,QAAO,2CAACC,uBAAO;EAAK,GAAI;YAAO;GAAmB;EAErD,EAAE"}