@bouku/core 0.2.2 → 0.2.3
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/button/_.d.ts +1 -0
- package/dist/components/button/_.js +3 -1
- package/dist/components/button/actions.d.ts +14 -0
- package/dist/components/button/actions.js +8 -0
- package/dist/utils/types/element.d.ts +5 -0
- package/package.json +7 -2
- package/dist/assets/styles/button.css +0 -76
- package/dist/components/accordion/index.d.ts +0 -6
- package/dist/components/accordion/index.js +0 -12
- package/dist/components/accordion/tab.d.ts +0 -4
- package/dist/components/accordion/tab.js +0 -35
- package/dist/components/dropdown/normal.d.ts +0 -10
- package/dist/components/dropdown/normal.js +0 -22
- package/dist/components/fade/_.d.ts +0 -1
- package/dist/components/fade/_.js +0 -8
- package/dist/components/fade/circle.d.ts +0 -10
- package/dist/components/fade/circle.js +0 -8
- package/dist/components/heading/_.d.ts +0 -2
- package/dist/components/heading/_.js +0 -10
- package/dist/components/heading/normal.d.ts +0 -24
- package/dist/components/heading/normal.js +0 -26
- package/dist/components/heading/page.d.ts +0 -25
- package/dist/components/heading/page.js +0 -26
- package/dist/components/information/_.d.ts +0 -1
- package/dist/components/information/_.js +0 -8
- package/dist/components/information/card.d.ts +0 -8
- package/dist/components/information/card.js +0 -22
- package/dist/components/layout/absolute.d.ts +0 -9
- package/dist/components/layout/absolute.js +0 -12
- package/dist/components/layout/fade.d.ts +0 -7
- package/dist/components/layout/fade.js +0 -20
- package/dist/components/layout/flex.d.ts +0 -17
- package/dist/components/layout/flex.js +0 -49
- package/dist/components/layout/media-row.d.ts +0 -15
- package/dist/components/layout/media-row.js +0 -11
- package/dist/components/layout/rnd.d.ts +0 -10
- package/dist/components/layout/rnd.js +0 -32
- package/dist/components/layout/scroll-box.d.ts +0 -14
- package/dist/components/layout/scroll-box.js +0 -11
- package/dist/components/pagination/index.d.ts +0 -9
- package/dist/components/pagination/index.js +0 -21
- package/dist/components/progress/_.d.ts +0 -1
- package/dist/components/progress/_.js +0 -8
- package/dist/components/progress/bar.d.ts +0 -4
- package/dist/components/progress/bar.js +0 -12
- package/dist/components/table/_.d.ts +0 -1
- package/dist/components/table/_.js +0 -8
- package/dist/components/table/header.d.ts +0 -10
- package/dist/components/table/header.js +0 -20
- package/dist/components/table/index.d.ts +0 -15
- package/dist/components/table/index.js +0 -37
- package/dist/components/table/normal.d.ts +0 -7
- package/dist/components/table/normal.js +0 -20
- package/dist/components/table/row.d.ts +0 -22
- package/dist/components/table/row.js +0 -40
- package/dist/components/table/sorter.d.ts +0 -10
- package/dist/components/table/sorter.js +0 -53
- package/dist/ui/button/_.d.ts +0 -2
- package/dist/ui/button/_.js +0 -10
- package/dist/ui/button/copy.d.ts +0 -6
- package/dist/ui/button/copy.js +0 -16
- package/dist/ui/button/normal.d.ts +0 -11
- package/dist/ui/button/normal.js +0 -48
- package/dist/ui/date/_.d.ts +0 -1
- package/dist/ui/date/_.js +0 -8
- package/dist/ui/date/time-ago.d.ts +0 -7
- package/dist/ui/date/time-ago.js +0 -13
- package/dist/ui/dropdown/normal.d.ts +0 -10
- package/dist/ui/dropdown/normal.js +0 -22
- package/dist/ui/fade/_.d.ts +0 -1
- package/dist/ui/fade/_.js +0 -8
- package/dist/ui/fade/circle.d.ts +0 -10
- package/dist/ui/fade/circle.js +0 -8
- package/dist/ui/heading/_.d.ts +0 -2
- package/dist/ui/heading/_.js +0 -10
- package/dist/ui/heading/normal.d.ts +0 -24
- package/dist/ui/heading/normal.js +0 -26
- package/dist/ui/heading/page.d.ts +0 -25
- package/dist/ui/heading/page.js +0 -26
- package/dist/ui/index.d.ts +0 -19
- package/dist/ui/index.js +0 -45
- package/dist/ui/information/_.d.ts +0 -1
- package/dist/ui/information/_.js +0 -8
- package/dist/ui/information/card.d.ts +0 -7
- package/dist/ui/information/card.js +0 -20
- package/dist/ui/layout/_.d.ts +0 -2
- package/dist/ui/layout/_.js +0 -10
- package/dist/ui/layout/absolute.d.ts +0 -9
- package/dist/ui/layout/absolute.js +0 -12
- package/dist/ui/layout/fade.d.ts +0 -7
- package/dist/ui/layout/fade.js +0 -20
- package/dist/ui/layout/flex.d.ts +0 -17
- package/dist/ui/layout/flex.js +0 -49
- package/dist/ui/layout/footer.d.ts +0 -15
- package/dist/ui/layout/footer.js +0 -13
- package/dist/ui/layout/media-row.d.ts +0 -15
- package/dist/ui/layout/media-row.js +0 -11
- package/dist/ui/layout/rnd.d.ts +0 -10
- package/dist/ui/layout/rnd.js +0 -32
- package/dist/ui/layout/scroll-box.d.ts +0 -14
- package/dist/ui/layout/scroll-box.js +0 -11
- package/dist/ui/layout/section.d.ts +0 -15
- package/dist/ui/layout/section.js +0 -19
- package/dist/ui/layout/separator.d.ts +0 -3
- package/dist/ui/layout/separator.js +0 -8
- package/dist/ui/link/_.d.ts +0 -1
- package/dist/ui/link/_.js +0 -8
- package/dist/ui/link/tab.d.ts +0 -22
- package/dist/ui/link/tab.js +0 -30
- package/dist/ui/list/index.d.ts +0 -2
- package/dist/ui/list/index.js +0 -10
- package/dist/ui/list/item.d.ts +0 -9
- package/dist/ui/list/item.js +0 -9
- package/dist/ui/list/search-bar.d.ts +0 -14
- package/dist/ui/list/search-bar.js +0 -33
- package/dist/ui/list/variants/bullet.d.ts +0 -9
- package/dist/ui/list/variants/bullet.js +0 -21
- package/dist/ui/list/variants/number.d.ts +0 -10
- package/dist/ui/list/variants/number.js +0 -23
- package/dist/ui/pagination/index.d.ts +0 -9
- package/dist/ui/pagination/index.js +0 -21
- package/dist/ui/progress/_.d.ts +0 -1
- package/dist/ui/progress/_.js +0 -8
- package/dist/ui/progress/bar.d.ts +0 -4
- package/dist/ui/progress/bar.js +0 -12
- package/dist/ui/table/_.d.ts +0 -1
- package/dist/ui/table/_.js +0 -8
- package/dist/ui/table/normal.d.ts +0 -7
- package/dist/ui/table/normal.js +0 -20
- package/dist/ui/text/_.d.ts +0 -2
- package/dist/ui/text/_.js +0 -10
- package/dist/ui/text/badge.d.ts +0 -18
- package/dist/ui/text/badge.js +0 -42
- package/dist/ui/text/input.d.ts +0 -39
- package/dist/ui/text/input.js +0 -50
package/dist/ui/list/item.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Item;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const style_1 = require("@bouko/style");
|
|
6
|
-
;
|
|
7
|
-
function Item({ marker, content, centerMarker, index }) {
|
|
8
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.cn)("flex items-start text-sm", centerMarker && "items-center"), children: [marker, content] }, index));
|
|
9
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
type Props<T> = {
|
|
2
|
-
style?: Styles;
|
|
3
|
-
placeholder?: string;
|
|
4
|
-
trigger?: React.ReactNode;
|
|
5
|
-
submit: (query: string) => void;
|
|
6
|
-
oops?: (x: string) => void;
|
|
7
|
-
};
|
|
8
|
-
type Styles = {
|
|
9
|
-
container?: string;
|
|
10
|
-
input?: string;
|
|
11
|
-
trigger?: string;
|
|
12
|
-
};
|
|
13
|
-
export declare function SearchBar<T>({ style, placeholder, trigger, submit, oops }: Props<T>): import("react").JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.SearchBar = SearchBar;
|
|
8
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const input_1 = __importDefault(require("../text/input"));
|
|
11
|
-
const fade_1 = __importDefault(require("../layout/fade"));
|
|
12
|
-
const flex_1 = require("../layout/flex");
|
|
13
|
-
const normal_1 = __importDefault(require("../button/normal"));
|
|
14
|
-
const style_1 = require("@bouko/style");
|
|
15
|
-
function SearchBar({ style = {}, placeholder, trigger, submit, oops = console.log }) {
|
|
16
|
-
const [query, setQuery] = (0, react_1.useState)("");
|
|
17
|
-
const styles = (0, style_1.mergeStyles)(base, style);
|
|
18
|
-
const search = async () => {
|
|
19
|
-
if (query === "")
|
|
20
|
-
return;
|
|
21
|
-
try {
|
|
22
|
-
await submit(query);
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
oops(err.message);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
return ((0, jsx_runtime_1.jsxs)(flex_1.RowBox, { style: styles.container, children: [(0, jsx_runtime_1.jsx)(fade_1.default, { style: "grow", gradient: "from-slate-950", children: (0, jsx_runtime_1.jsx)(input_1.default, { variant: "ghost", style: styles.input, placeholder: placeholder, value: query, update: setQuery, onEnter: search }) }), trigger && ((0, jsx_runtime_1.jsx)(normal_1.default, { variant: "ghost", style: style?.trigger, action: search, disabled: query === "", children: trigger }))] }));
|
|
29
|
-
}
|
|
30
|
-
const base = {
|
|
31
|
-
container: "items-center gap-3 sm:gap-5 w-xl max-w-full pl-4 sm:pl-5 pr-2 sm:pr-4 py-2 sm:py-3 bg-slate-950 border border-border rounded-md",
|
|
32
|
-
input: "text-base sm:text-lg tracking-wide"
|
|
33
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React, { type ReactNode } from "react";
|
|
2
|
-
interface Props {
|
|
3
|
-
style?: string;
|
|
4
|
-
title?: string;
|
|
5
|
-
items: ReactNode[];
|
|
6
|
-
centerMarker?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export default function BulletList({ style, title, items, centerMarker }: Props): React.JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.default = BulletList;
|
|
8
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const item_1 = __importDefault(require("../item"));
|
|
10
|
-
const style_1 = require("@bouko/style");
|
|
11
|
-
;
|
|
12
|
-
function BulletList({ style, title, items, centerMarker }) {
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.cn)(styles.base, style), children: [!!title && (0, jsx_runtime_1.jsx)("span", { className: styles.title, children: title }), (0, jsx_runtime_1.jsx)("div", { className: (0, style_1.cn)(styles.base, style, !!title && "ml-2"), children: items.map((x, i) => ((0, jsx_runtime_1.jsx)(item_1.default, { marker: (0, jsx_runtime_1.jsx)(Marker, {}), content: x, index: i, centerMarker: centerMarker }, i))) })] }, title));
|
|
14
|
-
}
|
|
15
|
-
function Marker() {
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)("span", { className: "mr-3 text-accent", children: "\u2022" }));
|
|
17
|
-
}
|
|
18
|
-
const styles = {
|
|
19
|
-
base: "flex flex-col gap-1 w-full",
|
|
20
|
-
title: "mb-1 text-base"
|
|
21
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React, { type ReactNode } from "react";
|
|
2
|
-
interface Props {
|
|
3
|
-
style?: string;
|
|
4
|
-
marker?: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
items: ReactNode[];
|
|
7
|
-
centerMarker?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export default function NumberList({ style, marker, title, items, centerMarker }: Props): React.JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.default = NumberList;
|
|
8
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const item_1 = __importDefault(require("../item"));
|
|
10
|
-
const style_1 = require("@bouko/style");
|
|
11
|
-
;
|
|
12
|
-
function NumberList({ style, marker, title, items, centerMarker }) {
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.cn)(styles.base, style), children: [!!title && (0, jsx_runtime_1.jsx)("span", { className: styles.title, children: title }), (0, jsx_runtime_1.jsx)("div", { className: (0, style_1.cn)(styles.base, style, !!title && "ml-2"), children: items.map((x, i) => ((0, jsx_runtime_1.jsx)(item_1.default, { marker: (0, jsx_runtime_1.jsx)(Marker, { style: marker, x: i + 1 }), content: x, index: i, centerMarker: centerMarker }, i))) }, "content")] }, "list"));
|
|
14
|
-
}
|
|
15
|
-
function Marker({ style, x }) {
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, style_1.cn)(styles.marker, style), children: (0, jsx_runtime_1.jsx)("span", { className: styles.label, children: x }) }));
|
|
17
|
-
}
|
|
18
|
-
const styles = {
|
|
19
|
-
base: "flex flex-col gap-6 w-full text-primary-dark",
|
|
20
|
-
title: "mb-1 text-base text-primary",
|
|
21
|
-
marker: "flex justify-center items-center mt-1 mr-6 min-w-7 w-7 aspect-square bg-radial-[at_50%_75%] from-accent-light to-accent to-accent-dark to-90% border border-accent-darker rounded-full shadow-glow-soft",
|
|
22
|
-
label: "font-bold text-background-lighter select-none"
|
|
23
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = Pagination;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const chevron_left_svg_1 = __importDefault(require("../../assets/icons/chevron-left.svg"));
|
|
9
|
-
const chevron_right_svg_1 = __importDefault(require("../../assets/icons/chevron-right.svg"));
|
|
10
|
-
const flex_1 = require("../layout/flex");
|
|
11
|
-
const normal_1 = require("../button/normal");
|
|
12
|
-
const style_1 = require("@bouko/style");
|
|
13
|
-
function Pagination({ style, page, prev, next, totalPages = 99 }) {
|
|
14
|
-
const canPrev = page > 1;
|
|
15
|
-
const canNext = totalPages > 0 ? page < totalPages : true;
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)(flex_1.RowBox, { style: (0, style_1.cn)(s.container, style), children: [(0, jsx_runtime_1.jsx)(normal_1.Button, { size: "xs", style: "rounded-none rounded-l-sm", action: prev, disabled: !canPrev, children: (0, jsx_runtime_1.jsx)(chevron_left_svg_1.default, {}) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-px justify-center items-center w-11 h-6 px-2 bg-border-dark/20 border-y border-border-dark text-xs font-medium", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-primary", children: page }), "/", (0, jsx_runtime_1.jsx)("span", { className: "text-primary-darker", children: totalPages || 99 })] }), (0, jsx_runtime_1.jsx)(normal_1.Button, { size: "xs", style: "rounded-none rounded-r-sm", action: next, disabled: !canNext, children: (0, jsx_runtime_1.jsx)(chevron_right_svg_1.default, {}) })] }));
|
|
17
|
-
}
|
|
18
|
-
const s = {
|
|
19
|
-
container: "justify-center items-center text-primary-darker select-none",
|
|
20
|
-
subcontainer: "gap-2",
|
|
21
|
-
};
|
package/dist/ui/progress/_.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ProgressBar } from "./bar";
|
package/dist/ui/progress/_.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ProgressBar = void 0;
|
|
7
|
-
var bar_1 = require("./bar");
|
|
8
|
-
Object.defineProperty(exports, "ProgressBar", { enumerable: true, get: function () { return __importDefault(bar_1).default; } });
|
package/dist/ui/progress/bar.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = ProgressBar;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const style_1 = require("@bouko/style");
|
|
6
|
-
function ProgressBar({ value, style }) {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, style_1.cn)(s.container, style), children: (0, jsx_runtime_1.jsx)("div", { className: s.filled, style: { width: (value * 100) + "%" } }) }));
|
|
8
|
-
}
|
|
9
|
-
const s = {
|
|
10
|
-
container: "flex grow h-1 rounded-full bg-surface overflow-hidden",
|
|
11
|
-
filled: "h-full bg-accent"
|
|
12
|
-
};
|
package/dist/ui/table/_.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Table } from "./normal";
|
package/dist/ui/table/_.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Table = void 0;
|
|
7
|
-
var normal_1 = require("./normal");
|
|
8
|
-
Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return __importDefault(normal_1).default; } });
|
package/dist/ui/table/normal.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.default = Table;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const flex_1 = require("../layout/flex");
|
|
7
|
-
const _1 = require("../button/_");
|
|
8
|
-
const ts_1 = require("@bouko/ts");
|
|
9
|
-
const style_1 = require("@bouko/style");
|
|
10
|
-
function Table({ columns, items }) {
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)(flex_1.ColumnBox, { style: s.table, children: [(0, jsx_runtime_1.jsx)(flex_1.RowBox, { style: s.header, children: columns.map((x, i) => ((0, jsx_runtime_1.jsx)(flex_1.RowBox, { style: (0, style_1.cn)(s.columnLabel, i === 0 ? "justify-start" : i === columns.length - 1 ? "justify-end" : "justify-center"), children: x }, i))) }), (0, jsx_runtime_1.jsx)(flex_1.ColumnBox, { style: s.rows, children: items.map((x, i) => ((0, jsx_runtime_1.jsx)(flex_1.RowBox, { style: (0, style_1.cn)(s.row, i % 2 === 0 && "bg-surface", i === 0 ? "border-none" : i === items.length - 1 ? "border-none" : "border-b"), children: columns.map((key, j) => ((0, jsx_runtime_1.jsxs)(flex_1.RowBox, { style: (0, style_1.cn)(s.cell, j === 0 ? "justify-start" : j === columns.length - 1 ? "justify-end" : "justify-center"), children: [key === "id" ? (0, ts_1.shortenStr)(x[key]) : (x[key] ?? "N/A"), key === "id" && (0, jsx_runtime_1.jsx)(_1.CopyButton, { style: "text-primary-dark", value: (x["id"] || "N/A").toString() })] }, j))) }, i))) })] }));
|
|
12
|
-
}
|
|
13
|
-
const s = {
|
|
14
|
-
table: "grow w-full border border-border rounded-md overflow-hidden",
|
|
15
|
-
header: "w-full px-4 py-3 bg-background-light border-b border-border",
|
|
16
|
-
columnLabel: "flex-1 uppercase text-primary-dark font-light text-sm",
|
|
17
|
-
rows: "grow overflow-y-auto no-scrollbar",
|
|
18
|
-
row: "w-full px-4 py-4 border-b border-border",
|
|
19
|
-
cell: "flex-1 items-center gap-2"
|
|
20
|
-
};
|
package/dist/ui/text/_.d.ts
DELETED
package/dist/ui/text/_.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Input = exports.Badge = void 0;
|
|
7
|
-
var badge_1 = require("./badge");
|
|
8
|
-
Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return __importDefault(badge_1).default; } });
|
|
9
|
-
var input_1 = require("./input");
|
|
10
|
-
Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return __importDefault(input_1).default; } });
|
package/dist/ui/text/badge.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Component } from "../../utils";
|
|
2
|
-
type Props = Component & {
|
|
3
|
-
color?: string;
|
|
4
|
-
icon?: React.ReactNode;
|
|
5
|
-
size?: "xs" | "sm" | "md";
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Color-themed badge component.
|
|
9
|
-
*
|
|
10
|
-
* To use a CSS variable it must exist and be passed in the
|
|
11
|
-
* form `--variable-name`. Any other format may cause unexpected
|
|
12
|
-
* results. CSS variables use 'color-mix' which is not supported in
|
|
13
|
-
* some old browsers such as Safari 15.3 and Internet Explorer.
|
|
14
|
-
*
|
|
15
|
-
* @param {string} color - Color of badge. (optional, default = accent)
|
|
16
|
-
**/
|
|
17
|
-
export declare function Badge({ style, color, size, icon, children }: Props): import("react").JSX.Element | null;
|
|
18
|
-
export default Badge;
|
package/dist/ui/text/badge.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Badge = Badge;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const style_1 = require("@bouko/style");
|
|
6
|
-
const tailwind_variants_1 = require("tailwind-variants");
|
|
7
|
-
/**
|
|
8
|
-
* Color-themed badge component.
|
|
9
|
-
*
|
|
10
|
-
* To use a CSS variable it must exist and be passed in the
|
|
11
|
-
* form `--variable-name`. Any other format may cause unexpected
|
|
12
|
-
* results. CSS variables use 'color-mix' which is not supported in
|
|
13
|
-
* some old browsers such as Safari 15.3 and Internet Explorer.
|
|
14
|
-
*
|
|
15
|
-
* @param {string} color - Color of badge. (optional, default = accent)
|
|
16
|
-
**/
|
|
17
|
-
function Badge({ style, color = "--color-accent", size = "md", icon, children }) {
|
|
18
|
-
if (!children)
|
|
19
|
-
return null;
|
|
20
|
-
if (color === "future")
|
|
21
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 test-badge", children: [icon && (0, jsx_runtime_1.jsx)("div", { className: "text-primary-dark", children: icon }), (0, jsx_runtime_1.jsx)("span", { children: children })] }));
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)("span", { className: (0, style_1.cn)(base({ size }), style), style: styles(color), children: children }));
|
|
23
|
-
}
|
|
24
|
-
const styles = (color) => ({
|
|
25
|
-
background: (0, style_1.opacitize)(color),
|
|
26
|
-
border: `1px solid var(${color})`,
|
|
27
|
-
borderRadius: "calc(infinity * 1px)",
|
|
28
|
-
textAlign: "center",
|
|
29
|
-
fontWeight: "600",
|
|
30
|
-
color: "var(--color-primary)"
|
|
31
|
-
});
|
|
32
|
-
const base = (0, tailwind_variants_1.tv)({
|
|
33
|
-
base: "w-min",
|
|
34
|
-
variants: {
|
|
35
|
-
size: {
|
|
36
|
-
xs: "px-1 py-px text-[0.5rem]",
|
|
37
|
-
sm: "px-1 py-px text-xs",
|
|
38
|
-
md: "px-2 py-1 text-sm"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
exports.default = Badge;
|
package/dist/ui/text/input.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
type FieldProps<T> = {
|
|
3
|
-
id?: string;
|
|
4
|
-
label?: string;
|
|
5
|
-
style?: string;
|
|
6
|
-
value?: T;
|
|
7
|
-
update?: (x: T) => void;
|
|
8
|
-
updateForm?: (id: string, x: T) => void;
|
|
9
|
-
required?: boolean;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
note?: ReactNode;
|
|
12
|
-
};
|
|
13
|
-
type Variant = "normal" | "ghost";
|
|
14
|
-
type Props<T> = FieldProps<T> & {
|
|
15
|
-
type?: "text" | "number" | "email" | "password";
|
|
16
|
-
variant?: Variant;
|
|
17
|
-
style?: string;
|
|
18
|
-
placeholder?: string;
|
|
19
|
-
onEnter?: (x: string) => void;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Text field component.
|
|
23
|
-
*
|
|
24
|
-
* Wraps the native `input` element with custom styling and validation.
|
|
25
|
-
* It displays an optional label and note, and can be marked as required.
|
|
26
|
-
* Optional callback for when the user presses `Enter` key.
|
|
27
|
-
* The value is controlled externally via props, usually `useState`.
|
|
28
|
-
*
|
|
29
|
-
* Variants:
|
|
30
|
-
* - `normal`: Standard input with primary color scheme.
|
|
31
|
-
* - `ghost`: Transparent for injecting input inside other component.
|
|
32
|
-
*
|
|
33
|
-
* @param {Variant} variant - Visual style variant. (optional, default = normal)
|
|
34
|
-
* @param {string} style - Additional class names for styling. (optional)
|
|
35
|
-
* @param {string} placeholder - Placeholder text for the input. (optional)
|
|
36
|
-
* @param {Function} onEnter - Callback when `Enter` key is pressed. (optional)
|
|
37
|
-
**/
|
|
38
|
-
export default function Input<T>({ id, type, variant, style, value, update, updateForm, onEnter, disabled, placeholder, ...props }: Props<T>): import("react").JSX.Element;
|
|
39
|
-
export {};
|
package/dist/ui/text/input.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Input;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const style_1 = require("@bouko/style");
|
|
6
|
-
const tailwind_variants_1 = require("tailwind-variants");
|
|
7
|
-
function Field({ style, label, required = true, note, children }) {
|
|
8
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.cn)(fieldStyles.container, style), children: [label && (0, jsx_runtime_1.jsxs)("span", { className: fieldStyles.label, children: [label, " ", !required ? (0, jsx_runtime_1.jsx)("span", { className: "italic text-slate-400", children: "(optional)" }) : ""] }), children, note && (0, jsx_runtime_1.jsx)("span", { className: fieldStyles.note, children: note })] }));
|
|
9
|
-
}
|
|
10
|
-
const fieldStyles = {
|
|
11
|
-
container: "flex flex-col shrink-0 gap-1 overflow-hidden",
|
|
12
|
-
label: "text-xs text-primary-dark",
|
|
13
|
-
note: "mt-1 text-xs text-slate-500 whitespace-pre-line"
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Text field component.
|
|
17
|
-
*
|
|
18
|
-
* Wraps the native `input` element with custom styling and validation.
|
|
19
|
-
* It displays an optional label and note, and can be marked as required.
|
|
20
|
-
* Optional callback for when the user presses `Enter` key.
|
|
21
|
-
* The value is controlled externally via props, usually `useState`.
|
|
22
|
-
*
|
|
23
|
-
* Variants:
|
|
24
|
-
* - `normal`: Standard input with primary color scheme.
|
|
25
|
-
* - `ghost`: Transparent for injecting input inside other component.
|
|
26
|
-
*
|
|
27
|
-
* @param {Variant} variant - Visual style variant. (optional, default = normal)
|
|
28
|
-
* @param {string} style - Additional class names for styling. (optional)
|
|
29
|
-
* @param {string} placeholder - Placeholder text for the input. (optional)
|
|
30
|
-
* @param {Function} onEnter - Callback when `Enter` key is pressed. (optional)
|
|
31
|
-
**/
|
|
32
|
-
function Input({ id, type = "text", variant, style, value, update, updateForm, onEnter, disabled, placeholder, ...props }) {
|
|
33
|
-
const handleUpdate = (value) => {
|
|
34
|
-
if (id && updateForm)
|
|
35
|
-
updateForm(id, value);
|
|
36
|
-
else if (update)
|
|
37
|
-
update(value);
|
|
38
|
-
};
|
|
39
|
-
return ((0, jsx_runtime_1.jsx)(Field, { ...props, children: (0, jsx_runtime_1.jsx)("input", { type: type, className: (0, style_1.cn)(styles({ variant }), style), placeholder: placeholder || `Enter ${id}`, value: value, onChange: ({ target: { value } }) => handleUpdate(value), onKeyUp: ({ key }) => key === "Enter" && value ? onEnter?.(value) : null, disabled: disabled }) }));
|
|
40
|
-
}
|
|
41
|
-
const styles = (0, tailwind_variants_1.tv)({
|
|
42
|
-
base: "px-3 py-2 duration-200 rounded text-xs sm:text-sm placeholder:text-primary-darker text-primary disabled:brightness-90 disabled:cursor-not-allowed",
|
|
43
|
-
defaultVariants: { variant: "normal" },
|
|
44
|
-
variants: {
|
|
45
|
-
variant: {
|
|
46
|
-
normal: "bg-input border border-outline focus:border-outline-light outline-none",
|
|
47
|
-
ghost: "p-0 bg-transparent border-none outline-none"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|