@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
49 lines (45 loc) • 1.98 kB
JavaScript
"use client";
import { styled } from "../../core/system/factory.js";
import { createSlotComponent } from "../../core/components/create-component.js";
import { nativeTableStyle } from "./native-table.style.js";
import { jsx } from "react/jsx-runtime";
//#region src/components/native-table/native-table.tsx
const { PropsContext: NativeTablePropsContext, usePropsContext: useNativeTablePropsContext, withContext, withProvider } = createSlotComponent("native-table", nativeTableStyle);
/**
* `NativeTable` is a component for efficiently organizing and displaying data.
*
* @see https://yamada-ui.com/docs/components/native-table
*/
const NativeTableRoot = withProvider(({ withScrollArea, scrollAreaProps,...rest }) => {
if (withScrollArea) return /* @__PURE__ */ jsx(NativeTableScrollArea, {
...scrollAreaProps,
children: /* @__PURE__ */ jsx(styled.table, { ...rest })
});
else return /* @__PURE__ */ jsx(styled.table, { ...rest });
}, "root")(void 0, ({ layout: tableLayout,...rest }) => ({
tableLayout,
...rest
}));
const NativeTableScrollArea = withContext("div", "scrollArea")();
const Caption = withContext("caption", "caption")(void 0, ({ placement = "end",...rest }) => ({
"data-placement": placement,
captionSide: placement === "end" ? "bottom" : "top",
...rest
}));
const Thead = withContext("thead", "thead")();
const Tbody = withContext("tbody", "tbody")();
const Tfoot = withContext("tfoot", "tfoot")();
const Colgroup = withContext("colgroup", "colgroup")();
const Col = withContext("col", "col")();
const Tr = withContext("tr", "tr")();
const Th = withContext("th", "th")(void 0, ({ numeric,...rest }) => ({
"data-numeric": numeric,
...rest
}));
const Td = withContext("td", "td")(void 0, ({ numeric,...rest }) => ({
"data-numeric": numeric,
...rest
}));
//#endregion
export { Caption, Col, Colgroup, NativeTablePropsContext, NativeTableRoot, Tbody, Td, Tfoot, Th, Thead, Tr, useNativeTablePropsContext };
//# sourceMappingURL=native-table.js.map