@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
1 lines • 5 kB
Source Map (JSON)
{"version":3,"file":"native-table.cjs","names":["createSlotComponent","nativeTableStyle","styled"],"sources":["../../../../src/components/native-table/native-table.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n CSSProps,\n HTMLStyledProps,\n SimpleDirection,\n ThemeProps,\n} from \"../../core\"\nimport type { NativeTableStyle } from \"./native-table.style\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { nativeTableStyle } from \"./native-table.style\"\n\nexport interface NativeTableRootProps\n extends HTMLStyledProps<\"table\">,\n ThemeProps<NativeTableStyle> {\n /**\n * The CSS `table-layout` property.\n */\n layout?: CSSProps[\"tableLayout\"]\n /**\n * Whether to enable the scroll area.\n *\n * @default false\n */\n withScrollArea?: boolean\n /**\n * The props for the scroll area.\n */\n scrollAreaProps?: NativeTableAreaProps\n}\n\nconst {\n PropsContext: NativeTablePropsContext,\n usePropsContext: useNativeTablePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<NativeTableRootProps, NativeTableStyle>(\n \"native-table\",\n nativeTableStyle,\n)\n\nexport { NativeTablePropsContext, useNativeTablePropsContext }\n\n/**\n * `NativeTable` is a component for efficiently organizing and displaying data.\n *\n * @see https://yamada-ui.com/docs/components/native-table\n */\nexport const NativeTableRoot = withProvider(\n ({ withScrollArea, scrollAreaProps, ...rest }) => {\n if (withScrollArea) {\n return (\n <NativeTableScrollArea {...scrollAreaProps}>\n <styled.table {...rest} />\n </NativeTableScrollArea>\n )\n } else {\n return <styled.table {...rest} />\n }\n },\n \"root\",\n)(undefined, ({ layout: tableLayout, ...rest }) => ({\n tableLayout,\n ...rest,\n}))\n\ninterface NativeTableAreaProps\n extends HTMLStyledProps,\n ThemeProps<NativeTableStyle> {}\n\nconst NativeTableScrollArea = withContext<\"div\", NativeTableAreaProps>(\n \"div\",\n \"scrollArea\",\n)()\n\nexport interface CaptionProps extends HTMLStyledProps<\"caption\"> {\n /**\n * The placement of the table caption.\n *\n * @default 'end'\n */\n placement?: SimpleDirection\n}\n\nexport const Caption = withContext<\"caption\", CaptionProps>(\n \"caption\",\n \"caption\",\n)(undefined, ({ placement = \"end\", ...rest }) => ({\n \"data-placement\": placement,\n captionSide: placement === \"end\" ? \"bottom\" : \"top\",\n ...rest,\n}))\n\nexport interface TheadProps extends HTMLStyledProps<\"thead\"> {}\n\nexport const Thead = withContext<\"thead\", TheadProps>(\"thead\", \"thead\")()\n\nexport interface TbodyProps extends HTMLStyledProps<\"tbody\"> {}\n\nexport const Tbody = withContext<\"tbody\", TbodyProps>(\"tbody\", \"tbody\")()\n\nexport interface TfootProps extends HTMLStyledProps<\"tfoot\"> {}\n\nexport const Tfoot = withContext<\"tfoot\", TfootProps>(\"tfoot\", \"tfoot\")()\n\nexport interface ColgroupProps extends HTMLStyledProps<\"colgroup\"> {}\n\nexport const Colgroup = withContext<\"colgroup\", ColgroupProps>(\n \"colgroup\",\n \"colgroup\",\n)()\n\nexport interface ColProps extends HTMLStyledProps<\"col\"> {}\n\nexport const Col = withContext<\"col\", ColProps>(\"col\", \"col\")()\n\nexport interface TrProps extends HTMLStyledProps<\"tr\"> {}\n\nexport const Tr = withContext<\"tr\", TrProps>(\"tr\", \"tr\")()\n\nexport interface ThProps extends HTMLStyledProps<\"th\"> {\n /**\n * Aligns the cell content to the right.\n *\n * @default false\n */\n numeric?: boolean\n}\n\nexport const Th = withContext<\"th\", ThProps>(\"th\", \"th\")(\n undefined,\n ({ numeric, ...rest }) => ({\n \"data-numeric\": numeric,\n ...rest,\n }),\n)\n\nexport interface TdProps extends HTMLStyledProps<\"td\"> {\n /**\n * Aligns the cell content to the right.\n *\n * @default false\n */\n numeric?: boolean\n}\n\nexport const Td = withContext<\"td\", TdProps>(\"td\", \"td\")(\n undefined,\n ({ numeric, ...rest }) => ({\n \"data-numeric\": numeric,\n ...rest,\n }),\n)\n"],"mappings":";;;;;;;;;;;AA+BA,MAAM,EACJ,cAAc,yBACd,iBAAiB,4BACjB,aACA,iBACEA,6CACF,gBACAC,4CACD;;;;;;AASD,MAAa,kBAAkB,cAC5B,EAAE,gBAAgB,gBAAiB,GAAG,WAAW;AAChD,KAAI,eACF,QACE,2CAAC;EAAsB,GAAI;YACzB,2CAACC,uBAAO,SAAM,GAAI,OAAQ;GACJ;KAG1B,QAAO,2CAACA,uBAAO,SAAM,GAAI,OAAQ;GAGrC,OACD,CAAC,SAAY,EAAE,QAAQ,YAAa,GAAG,YAAY;CAClD;CACA,GAAG;CACJ,EAAE;AAMH,MAAM,wBAAwB,YAC5B,OACA,aACD,EAAE;AAWH,MAAa,UAAU,YACrB,WACA,UACD,CAAC,SAAY,EAAE,YAAY,MAAO,GAAG,YAAY;CAChD,kBAAkB;CAClB,aAAa,cAAc,QAAQ,WAAW;CAC9C,GAAG;CACJ,EAAE;AAIH,MAAa,QAAQ,YAAiC,SAAS,QAAQ,EAAE;AAIzE,MAAa,QAAQ,YAAiC,SAAS,QAAQ,EAAE;AAIzE,MAAa,QAAQ,YAAiC,SAAS,QAAQ,EAAE;AAIzE,MAAa,WAAW,YACtB,YACA,WACD,EAAE;AAIH,MAAa,MAAM,YAA6B,OAAO,MAAM,EAAE;AAI/D,MAAa,KAAK,YAA2B,MAAM,KAAK,EAAE;AAW1D,MAAa,KAAK,YAA2B,MAAM,KAAK,CACtD,SACC,EAAE,QAAS,GAAG,YAAY;CACzB,gBAAgB;CAChB,GAAG;CACJ,EACF;AAWD,MAAa,KAAK,YAA2B,MAAM,KAAK,CACtD,SACC,EAAE,QAAS,GAAG,YAAY;CACzB,gBAAgB;CAChB,GAAG;CACJ,EACF"}