UNPKG

koval-ui

Version:

React components collection with minimalistic design. Supports theming, layout, and input validation.

1 lines 1.32 kB
{"version":3,"file":"ViewUnitCell.cjs","sources":["../../../../../src/lib/DataTable/cells/ViewUnitCell.tsx"],"sourcesContent":["import type {FC, ComponentProps} from 'react';\n\nimport type {UnitDisplayModes} from '@/lib/Number';\nimport {NumberUnit} from '@/lib/Number';\nimport type {Locale, Units} from '@/internal/locale';\n\nimport classes from './Cells.module.css';\nimport type {CellComponent} from './../types.ts';\n\nexport type Props = ComponentProps<CellComponent> & {\n unit?: keyof typeof Units;\n unitDisplay?: keyof typeof UnitDisplayModes;\n};\n\nexport const ViewUnitCell: FC<Props> = ({value, cellContext, unit, ...restProps}) => {\n const locale = cellContext.table.options.meta?.locale as Locale;\n return (\n <div className={classes.viewNumberCell}>\n <NumberUnit {...restProps} unit={unit} locale={locale} value={Number(value)} />\n </div>\n );\n};\n"],"names":["ViewUnitCell","value","cellContext","unit","restProps","locale","_a","jsx","classes","NumberUnit"],"mappings":"+MAcaA,EAA0B,CAAC,CAAC,MAAAC,EAAO,YAAAC,EAAa,KAAAC,EAAM,GAAGC,KAAe,OACjF,MAAMC,GAASC,EAAAJ,EAAY,MAAM,QAAQ,OAA1B,YAAAI,EAAgC,OAC/C,OACKC,EAAAA,IAAA,MAAA,CAAI,UAAWC,EAAAA,QAAQ,eACpB,SAACD,MAAAE,EAAAA,WAAA,CAAY,GAAGL,EAAW,KAAAD,EAAY,OAAAE,EAAgB,MAAO,OAAOJ,CAAK,CAAG,CAAA,EACjF,CAER"}