@bouku/core 0.0.8 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/layout/section.d.ts +12 -10
- package/dist/components/layout/section.js +13 -9
- package/dist/components/layout/separator.d.ts +2 -1
- package/dist/components/layout/separator.js +2 -1
- package/dist/components/table/row.d.ts +1 -1
- package/dist/components/table/row.js +1 -1
- package/dist/components/table/sorter.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
type Props = {
|
|
2
|
+
style?: string;
|
|
3
|
+
title: string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
};
|
|
2
6
|
/**
|
|
3
|
-
*
|
|
7
|
+
* Layout Section Component.
|
|
4
8
|
*
|
|
5
|
-
* Generic layout wrapper used to group related
|
|
6
|
-
*
|
|
9
|
+
* Generic layout wrapper used to group related content under
|
|
10
|
+
* a titled section with a visual separator for consistency.
|
|
7
11
|
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
12
|
+
* @param style - Custom classes for the content container.
|
|
13
|
+
* @param title - The section title displayed at top.
|
|
14
|
+
* @param content - Element(s) rendered below the separator.
|
|
10
15
|
**/
|
|
11
|
-
declare const Section: ({ title,
|
|
12
|
-
title: string;
|
|
13
|
-
content: ReactNode;
|
|
14
|
-
}) => import("react").JSX.Element;
|
|
16
|
+
declare const Section: ({ style, title, children }: Props) => import("react").JSX.Element;
|
|
15
17
|
export default Section;
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const flex_1 = require("./flex");
|
|
5
|
+
const separator_1 = require("./separator");
|
|
6
|
+
const style_1 = require("@bouko/style");
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
8
|
+
* Layout Section Component.
|
|
7
9
|
*
|
|
8
|
-
* Generic layout wrapper used to group related
|
|
9
|
-
*
|
|
10
|
+
* Generic layout wrapper used to group related content under
|
|
11
|
+
* a titled section with a visual separator for consistency.
|
|
10
12
|
*
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
+
* @param style - Custom classes for the content container.
|
|
14
|
+
* @param title - The section title displayed at top.
|
|
15
|
+
* @param content - Element(s) rendered below the separator.
|
|
13
16
|
**/
|
|
14
|
-
const Section = ({ title,
|
|
15
|
-
const
|
|
16
|
-
container: "gap-
|
|
17
|
-
|
|
17
|
+
const Section = ({ style, title, children }) => ((0, jsx_runtime_1.jsxs)(flex_1.ColumnBox, { style: s.container, children: [(0, jsx_runtime_1.jsx)("span", { className: s.title, children: title }), (0, jsx_runtime_1.jsx)(separator_1.Separator, { style: "mb-2" }), (0, jsx_runtime_1.jsx)("div", { className: (0, style_1.cn)(s.content, style), children: children })] }));
|
|
18
|
+
const s = {
|
|
19
|
+
container: "gap-3 w-full",
|
|
20
|
+
title: "text-xl font-bold text-primary",
|
|
21
|
+
content: "w-full"
|
|
18
22
|
};
|
|
19
23
|
exports.default = Section;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Separator = Separator;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const style_1 = require("@bouko/style");
|
|
6
6
|
function Separator({ style }) {
|
|
7
7
|
return (0, jsx_runtime_1.jsx)("hr", { className: (0, style_1.cn)("w-full text-border-dark", style) });
|
|
8
8
|
}
|
|
9
|
+
exports.default = Separator;
|
|
@@ -10,6 +10,6 @@ interface Props<T> {
|
|
|
10
10
|
count: number;
|
|
11
11
|
}
|
|
12
12
|
export type Row = Record<string, CellValue>;
|
|
13
|
-
export type CellValue = string | number | boolean;
|
|
13
|
+
export type CellValue = string | number | boolean | object;
|
|
14
14
|
export declare function TableRow<T extends Row>({ config, data, count }: Props<T>): import("react").JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -22,7 +22,7 @@ function TableRow({ config, data, count }) {
|
|
|
22
22
|
cellValue = (0, ts_helper_kit_1.padNum)(cellValue, options.pad);
|
|
23
23
|
else if ((0, exports.isDateLike)(cellValue.toString()))
|
|
24
24
|
cellValue = new Date(cellValue.toString()).toLocaleDateString();
|
|
25
|
-
return ((0, jsx_runtime_1.jsxs)(flex_1.RowBox, { style: s.cell, children: [options && options?.link && (0, jsx_runtime_1.jsx)("a", { className: "text-primary underline duration-200 hover:text-accent", href: options.link?.replace("[x]", rawValue), children: cellValue }), options && !options?.link && ((0, jsx_runtime_1.jsx)("span", { className: "truncate", children: value === true ? (0, jsx_runtime_1.jsx)(check_circle_svg_1.default, { className: "text-success" }) : value === false ? (0, jsx_runtime_1.jsx)(x_circle_svg_1.default, { className: "text-error" }) : cellValue }))] }, i));
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(flex_1.RowBox, { style: s.cell, children: [options && options?.link && (0, jsx_runtime_1.jsx)("a", { className: "text-primary underline duration-200 hover:text-accent", href: options.link?.replace("[x]", rawValue), children: cellValue }), options && !options?.link && ((0, jsx_runtime_1.jsx)("span", { className: "truncate", children: value === true ? (0, jsx_runtime_1.jsx)(check_circle_svg_1.default, { className: "text-success" }) : value === false ? (0, jsx_runtime_1.jsx)(x_circle_svg_1.default, { className: "text-error" }) : (typeof cellValue === "object" ? JSON.stringify(cellValue) : cellValue) }))] }, i));
|
|
26
26
|
}), count > 1 && ((0, jsx_runtime_1.jsx)("span", { className: "absolute top-0 left-0 pb-px px-1 bg-surface-light border-b border-r rounded-br border-border-light font-bold font-mono text-px text-accent", children: count }))] }));
|
|
27
27
|
}
|
|
28
28
|
const s = {
|