UNPKG

@yamada-ui/native-table

Version:

Yamada UI native table component

265 lines (255 loc) • 8.04 kB
"use client" "use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var index_exports = {}; __export(index_exports, { NativeTable: () => NativeTable, TableCaption: () => TableCaption, TableContainer: () => TableContainer, TableStyleProvider: () => TableStyleProvider, Tbody: () => Tbody, Td: () => Td, Tfoot: () => Tfoot, Th: () => Th, Thead: () => Thead, Tr: () => Tr, useTableStyles: () => useTableStyles }); module.exports = __toCommonJS(index_exports); // src/native-table.tsx var import_core = require("@yamada-ui/core"); var import_utils = require("@yamada-ui/utils"); var import_jsx_runtime = require("react/jsx-runtime"); var [TableStyleProvider, useTableStyles] = (0, import_utils.createContext)({ name: "TableStyleContext", errorMessage: `useTableStyles returned is 'undefined'. Seems you forgot to wrap the components in "<Table />" or "<NativeTable />" or "<PagingTable />"` }); var NativeTable = (0, import_core.forwardRef)( (props, ref) => { const [styles, mergedProps] = (0, import_core.useComponentMultiStyle)("NativeTable", props); const { className, layout, ...rest } = (0, import_core.omitThemeProps)(mergedProps, [ "withBorder", "withColumnBorders", "highlightOnHover" ]); const css = { tableLayout: layout, ...styles.table }; return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableStyleProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( import_core.ui.table, { ref, className: (0, import_utils.cx)("ui-table", className), __css: css, ...rest } ) }); } ); NativeTable.displayName = "NativeTable"; NativeTable.__ui__ = "NativeTable"; // src/table-caption.tsx var import_core2 = require("@yamada-ui/core"); var import_utils2 = require("@yamada-ui/utils"); var import_jsx_runtime2 = require("react/jsx-runtime"); var TableCaption = (0, import_core2.forwardRef)( ({ className, placement = "bottom", ...rest }, ref) => { const styles = useTableStyles(); const css = { captionSide: placement, ...styles.caption }; return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( import_core2.ui.caption, { ref, className: (0, import_utils2.cx)("ui-table__caption", className), __css: css, ...rest } ); } ); TableCaption.displayName = "TableCaption"; TableCaption.__ui__ = "TableCaption"; // src/table-container.tsx var import_core3 = require("@yamada-ui/core"); var import_utils3 = require("@yamada-ui/utils"); var import_jsx_runtime3 = require("react/jsx-runtime"); var TableContainer = (0, import_core3.forwardRef)( ({ className, overflow, overflowX, ...rest }, ref) => { var _a; const css = { display: "block", maxW: "100%", overflowX: (_a = overflow != null ? overflow : overflowX) != null ? _a : "auto", overflowY: "hidden", WebkitOverflowScrolling: "touch", whiteSpace: "nowrap" }; return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( import_core3.ui.div, { ref, className: (0, import_utils3.cx)("ui-table__container", className), __css: css, ...rest } ); } ); TableContainer.displayName = "TableContainer"; TableContainer.__ui__ = "TableContainer"; // src/tbody.tsx var import_core4 = require("@yamada-ui/core"); var import_utils4 = require("@yamada-ui/utils"); var import_jsx_runtime4 = require("react/jsx-runtime"); var Tbody = (0, import_core4.forwardRef)( ({ className, ...rest }, ref) => { const styles = useTableStyles(); const css = { ...styles.tbody }; return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( import_core4.ui.tbody, { ref, className: (0, import_utils4.cx)("ui-table__tbody", className), __css: css, ...rest } ); } ); Tbody.displayName = "Tbody"; Tbody.__ui__ = "Tbody"; // src/td.tsx var import_core5 = require("@yamada-ui/core"); var import_utils5 = require("@yamada-ui/utils"); var import_jsx_runtime5 = require("react/jsx-runtime"); var Td = (0, import_core5.forwardRef)( ({ className, isNumeric, numeric = isNumeric, ...rest }, ref) => { const styles = useTableStyles(); const css = { ...styles.td }; return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)( import_core5.ui.td, { ref, className: (0, import_utils5.cx)("ui-table__td", className), "data-is-numeric": numeric, __css: css, ...rest } ); } ); Td.displayName = "Td"; Td.__ui__ = "Td"; // src/tfoot.tsx var import_core6 = require("@yamada-ui/core"); var import_utils6 = require("@yamada-ui/utils"); var import_jsx_runtime6 = require("react/jsx-runtime"); var Tfoot = (0, import_core6.forwardRef)( ({ className, ...rest }, ref) => { const styles = useTableStyles(); const css = { ...styles.tfoot }; return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)( import_core6.ui.tfoot, { ref, className: (0, import_utils6.cx)("ui-table__tfoot", className), __css: css, ...rest } ); } ); Tfoot.displayName = "Tfoot"; Tfoot.__ui__ = "Tfoot"; // src/th.tsx var import_core7 = require("@yamada-ui/core"); var import_utils7 = require("@yamada-ui/utils"); var import_jsx_runtime7 = require("react/jsx-runtime"); var Th = (0, import_core7.forwardRef)( ({ className, isNumeric, numeric = isNumeric, __css, ...rest }, ref) => { const styles = useTableStyles(); const css = { ...styles.th, ...__css }; return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( import_core7.ui.th, { ref, className: (0, import_utils7.cx)("ui-table__th", className), "data-is-numeric": numeric, __css: css, ...rest } ); } ); Th.displayName = "Th"; Th.__ui__ = "Th"; // src/thead.tsx var import_core8 = require("@yamada-ui/core"); var import_utils8 = require("@yamada-ui/utils"); var import_jsx_runtime8 = require("react/jsx-runtime"); var Thead = (0, import_core8.forwardRef)( ({ className, ...rest }, ref) => { const styles = useTableStyles(); const css = { ...styles.thead }; return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)( import_core8.ui.thead, { ref, className: (0, import_utils8.cx)("ui-table__thead", className), __css: css, ...rest } ); } ); Thead.displayName = "Thead"; Thead.__ui__ = "Thead"; // src/tr.tsx var import_core9 = require("@yamada-ui/core"); var import_utils9 = require("@yamada-ui/utils"); var import_jsx_runtime9 = require("react/jsx-runtime"); var Tr = (0, import_core9.forwardRef)(({ className, ...rest }, ref) => { const styles = useTableStyles(); const css = { ...styles.tr }; return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( import_core9.ui.tr, { ref, className: (0, import_utils9.cx)("ui-table__tr", className), __css: css, ...rest } ); }); Tr.displayName = "Tr"; Tr.__ui__ = "Tr"; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { NativeTable, TableCaption, TableContainer, TableStyleProvider, Tbody, Td, Tfoot, Th, Thead, Tr, useTableStyles }); //# sourceMappingURL=index.js.map