@bouku/core 0.1.8 → 0.2.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.
Files changed (65) hide show
  1. package/dist/components/button/_.d.ts +9 -0
  2. package/dist/components/button/_.js +10 -0
  3. package/dist/components/button/copy.d.ts +12 -5
  4. package/dist/components/button/copy.js +13 -4
  5. package/dist/components/button/normal.d.ts +20 -5
  6. package/dist/components/button/normal.js +21 -9
  7. package/dist/components/button/upload.d.ts +5 -6
  8. package/dist/components/button/upload.js +8 -9
  9. package/dist/components/card/_.d.ts +2 -0
  10. package/dist/components/card/_.js +10 -0
  11. package/dist/components/card/callout.d.ts +8 -0
  12. package/dist/components/card/callout.js +22 -0
  13. package/dist/components/card/media.d.ts +15 -0
  14. package/dist/components/card/media.js +10 -0
  15. package/dist/components/container/_.d.ts +5 -0
  16. package/dist/components/container/_.js +29 -0
  17. package/dist/components/container/absolute.d.ts +9 -0
  18. package/dist/components/container/absolute.js +12 -0
  19. package/dist/components/container/fade.d.ts +7 -0
  20. package/dist/components/container/fade.js +20 -0
  21. package/dist/components/container/flex.d.ts +17 -0
  22. package/dist/components/container/flex.js +49 -0
  23. package/dist/components/container/rnd.d.ts +10 -0
  24. package/dist/components/container/rnd.js +32 -0
  25. package/dist/components/container/scroll.d.ts +14 -0
  26. package/dist/components/container/scroll.js +11 -0
  27. package/dist/components/index.d.ts +6 -17
  28. package/dist/components/index.js +6 -29
  29. package/dist/components/layout/_.d.ts +2 -1
  30. package/dist/components/layout/_.js +5 -3
  31. package/dist/components/layout/footer.js +1 -1
  32. package/dist/components/layout/section.js +1 -1
  33. package/dist/components/list/search-bar.js +2 -2
  34. package/dist/components/miscellaneous/accordion/index.d.ts +9 -0
  35. package/dist/components/miscellaneous/accordion/index.js +22 -0
  36. package/dist/components/miscellaneous/accordion/tab.d.ts +4 -0
  37. package/dist/components/miscellaneous/accordion/tab.js +35 -0
  38. package/dist/components/miscellaneous/dropdown/index.d.ts +10 -0
  39. package/dist/components/miscellaneous/dropdown/index.js +22 -0
  40. package/dist/components/miscellaneous/glow/index.d.ts +10 -0
  41. package/dist/components/miscellaneous/glow/index.js +8 -0
  42. package/dist/components/miscellaneous/index.d.ts +6 -0
  43. package/dist/components/miscellaneous/index.js +18 -0
  44. package/dist/components/miscellaneous/pagination/index.d.ts +9 -0
  45. package/dist/components/miscellaneous/pagination/index.js +21 -0
  46. package/dist/components/miscellaneous/progress/index.d.ts +4 -0
  47. package/dist/components/miscellaneous/progress/index.js +12 -0
  48. package/dist/components/miscellaneous/table/header.d.ts +10 -0
  49. package/dist/components/miscellaneous/table/header.js +20 -0
  50. package/dist/components/miscellaneous/table/index.d.ts +15 -0
  51. package/dist/components/miscellaneous/table/index.js +37 -0
  52. package/dist/components/miscellaneous/table/row.d.ts +22 -0
  53. package/dist/components/miscellaneous/table/row.js +40 -0
  54. package/dist/components/miscellaneous/table/sorter.d.ts +10 -0
  55. package/dist/components/miscellaneous/table/sorter.js +53 -0
  56. package/dist/components/table/index.d.ts +0 -5
  57. package/dist/components/text/_.d.ts +1 -0
  58. package/dist/components/text/_.js +3 -1
  59. package/dist/components/text/heading.d.ts +24 -0
  60. package/dist/components/text/heading.js +26 -0
  61. package/dist/utils/hooks/clock.d.ts +4 -4
  62. package/dist/utils/hooks/clock.js +8 -5
  63. package/dist/utils/types/element.d.ts +5 -0
  64. package/dist/utils/types/element.js +0 -1
  65. package/package.json +1 -1
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Button Component Entrypoint.
3
+
4
+ * Includes buttons for various purposes:
5
+ *
6
+ * - Standard base component.
7
+ * - Copy value to clipboard.
8
+ * - File upload trigger.
9
+ **/
1
10
  export { default as Button } from "./normal";
2
11
  export { default as CopyButton } from "./copy";
3
12
  export { default as FileUploader } from "./upload";
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ /**
3
+ * Button Component Entrypoint.
4
+
5
+ * Includes buttons for various purposes:
6
+ *
7
+ * - Standard base component.
8
+ * - Copy value to clipboard.
9
+ * - File upload trigger.
10
+ **/
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -10,3 +19,4 @@ var copy_1 = require("./copy");
10
19
  Object.defineProperty(exports, "CopyButton", { enumerable: true, get: function () { return __importDefault(copy_1).default; } });
11
20
  var upload_1 = require("./upload");
12
21
  Object.defineProperty(exports, "FileUploader", { enumerable: true, get: function () { return __importDefault(upload_1).default; } });
22
+ //
@@ -1,6 +1,13 @@
1
- import { ButtonProps } from "./normal";
2
- type Props = ButtonProps & {
1
+ import { type ButtonProps } from "./normal";
2
+ /**
3
+ * Copy Button Component.
4
+ *
5
+ * Built on top of the base button component,
6
+ * made for copying a value to the clipboard.
7
+ *
8
+ * @param value - To be copied onto clipboard.
9
+ * @param action - Function to execute after copy. (optional)
10
+ **/
11
+ export default function CopyButton({ value, action, ...props }: ButtonProps & {
3
12
  value: string;
4
- };
5
- export default function CopyButton({ value, action, children, ...props }: Props): import("react").JSX.Element;
6
- export {};
13
+ }): import("react").JSX.Element;
@@ -5,12 +5,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = CopyButton;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
- const normal_1 = require("./normal");
8
+ const normal_1 = __importDefault(require("./normal"));
9
9
  const copy_svg_1 = __importDefault(require("../../assets/icons/copy.svg"));
10
- function CopyButton({ value, action, children, ...props }) {
11
- const submit = async () => {
10
+ /**
11
+ * Copy Button Component.
12
+ *
13
+ * Built on top of the base button component,
14
+ * made for copying a value to the clipboard.
15
+ *
16
+ * @param value - To be copied onto clipboard.
17
+ * @param action - Function to execute after copy. (optional)
18
+ **/
19
+ function CopyButton({ value, action, ...props }) {
20
+ const copyAndContinue = async () => {
12
21
  await navigator.clipboard.writeText(value);
13
22
  await action?.();
14
23
  };
15
- return ((0, jsx_runtime_1.jsxs)(normal_1.Button, { action: submit, ...props, children: [(0, jsx_runtime_1.jsx)(copy_svg_1.default, {}), children] }));
24
+ return ((0, jsx_runtime_1.jsx)(normal_1.default, { ...props, icon: (0, jsx_runtime_1.jsx)(copy_svg_1.default, {}), action: copyAndContinue }));
16
25
  }
@@ -1,11 +1,26 @@
1
- import type { ReactNode } from "react";
2
- import type { Component } from "../../utils";
1
+ import { type Component } from "../../utils";
3
2
  export type ButtonProps = Component & {
4
3
  size?: "xs" | "sm" | "md" | "lg";
5
- variant?: "surface" | "accent" | "outline" | "ghost" | "error" | "future";
6
- icon?: ReactNode;
4
+ variant?: "surface" | "accent" | "outline" | "ghost" | "error";
5
+ icon?: React.ReactNode;
7
6
  action?: () => void;
8
7
  disabled?: boolean;
9
8
  };
10
- export declare function Button({ style, size, variant, icon, children, disabled, action }: ButtonProps): import("react").JSX.Element;
9
+ /**
10
+ * Base Button Component.
11
+ *
12
+ * Configurable sizes, visual variants, icons, and styles.
13
+ * Built-in loading-state handling where the button is
14
+ * disabled until the action completes. If the button has
15
+ * an icon, it's replaced by a spinner during execution.
16
+ *
17
+ * @param style - Additional classes applied to the button.
18
+ * @param size - Button size. (optional)
19
+ * @param variant - Button visual style. (optional)
20
+ * @param icon - Icon displayed before the content. (optional)
21
+ * @param action - Function executed when the button is clicked.
22
+ * @param disabled - Whether the button is disabled.
23
+ * @param children - Content displayed inside the button.
24
+ **/
25
+ export declare function Button({ style, size, variant, icon, action, disabled, children }: ButtonProps): import("react").JSX.Element;
11
26
  export default Button;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  "use strict";
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -6,10 +7,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
7
  exports.Button = Button;
7
8
  const jsx_runtime_1 = require("react/jsx-runtime");
8
9
  const react_1 = require("react");
9
- const style_1 = require("../../utils/functions/style");
10
+ const utils_1 = require("../../utils");
10
11
  const tailwind_variants_1 = require("tailwind-variants");
11
12
  const spinner_svg_1 = __importDefault(require("../../assets/icons/spinner.svg"));
12
- function Button({ style, size, variant, icon, children, disabled, action }) {
13
+ /**
14
+ * Base Button Component.
15
+ *
16
+ * Configurable sizes, visual variants, icons, and styles.
17
+ * Built-in loading-state handling where the button is
18
+ * disabled until the action completes. If the button has
19
+ * an icon, it's replaced by a spinner during execution.
20
+ *
21
+ * @param style - Additional classes applied to the button.
22
+ * @param size - Button size. (optional)
23
+ * @param variant - Button visual style. (optional)
24
+ * @param icon - Icon displayed before the content. (optional)
25
+ * @param action - Function executed when the button is clicked.
26
+ * @param disabled - Whether the button is disabled.
27
+ * @param children - Content displayed inside the button.
28
+ **/
29
+ function Button({ style, size = "md", variant = "surface", icon, action, disabled, children }) {
13
30
  const [isLoading, setLoading] = (0, react_1.useState)(false);
14
31
  const handleClick = async () => {
15
32
  if (action) {
@@ -18,16 +35,12 @@ function Button({ style, size, variant, icon, children, disabled, action }) {
18
35
  setLoading(false);
19
36
  }
20
37
  };
21
- return ((0, jsx_runtime_1.jsxs)("button", { className: (0, style_1.cn)(styles({ size, variant }), style), onClick: handleClick, disabled: disabled || isLoading, children: [icon && isLoading
38
+ return ((0, jsx_runtime_1.jsxs)("button", { className: (0, utils_1.cn)(styles({ size, variant }), style), onClick: handleClick, disabled: disabled || isLoading, children: [icon && isLoading
22
39
  ? (0, jsx_runtime_1.jsx)(spinner_svg_1.default, { className: "animate-spin" })
23
40
  : icon, children] }));
24
41
  }
25
42
  const styles = (0, tailwind_variants_1.tv)({
26
43
  base: "relative flex justify-center items-center border outline-none rounded font-semibold duration-200 cursor-pointer disabled:cursor-not-allowed hover:brightness-115",
27
- defaultVariants: {
28
- size: "md",
29
- variant: "surface"
30
- },
31
44
  variants: {
32
45
  size: {
33
46
  xs: "gap-1 px-2 py-2 text-sm rounded-full",
@@ -40,8 +53,7 @@ const styles = (0, tailwind_variants_1.tv)({
40
53
  accent: "bg-accent border-accent-dark text-background",
41
54
  outline: "bg-transparent border-accent text-accent",
42
55
  ghost: "bg-transparent border-transparent text-primary-dark",
43
- error: "bg-error border-error-dark text-background",
44
- future: "backdrop-blur-sm test-button"
56
+ error: "bg-error border-error-dark text-background"
45
57
  }
46
58
  }
47
59
  });
@@ -1,10 +1,9 @@
1
- type FileType = "csv" | "pdf";
2
- type Props<T> = {
3
- type?: FileType | FileType[];
4
- variant?: "accent" | "surface";
1
+ import { type ButtonProps } from "./normal";
2
+ type FileType = "csv" | "pdf" | "xlsx";
3
+ type Props = ButtonProps & {
5
4
  url: string;
6
- next?: (data: T) => void;
5
+ accept?: FileType | FileType[];
7
6
  oops?: (err: string) => void;
8
7
  };
9
- export default function FileUploader<T>({ type, variant, url, next, oops }: Props<T>): import("react").JSX.Element;
8
+ export default function FileUploader<T>({ accept, url, action, oops, disabled, ...props }: Props): import("react").JSX.Element;
10
9
  export {};
@@ -7,15 +7,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.default = FileUploader;
8
8
  const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  const react_1 = require("react");
10
- const upload_svg_1 = __importDefault(require("../../assets/icons/upload.svg"));
11
- const core_1 = require("@bouku/core");
12
10
  const snatch_http_1 = require("snatch-http");
13
- function FileUploader({ type, variant = "accent", url, next, oops }) {
14
- const inputRef = (0, react_1.useRef)(null);
15
- const clickButton = () => inputRef.current?.click();
11
+ const normal_1 = __importDefault(require("./normal"));
12
+ const upload_svg_1 = __importDefault(require("../../assets/icons/upload.svg"));
13
+ function FileUploader({ accept, url, action, oops, disabled, ...props }) {
14
+ const ref = (0, react_1.useRef)(null);
16
15
  const [isLoading, setLoading] = (0, react_1.useState)(false);
17
- const typesArray = type ? (Array.isArray(type) ? type : [type]) : undefined;
18
- const acceptAttribute = typesArray?.map((t) => `.${t}`).join(", ");
16
+ const fileTypes = accept ? (Array.isArray(accept) ? accept : [accept]) : undefined;
17
+ const acceptAttribute = fileTypes?.map((t) => `.${t}`).join(", ");
19
18
  const handleUpload = async (event) => {
20
19
  const file = event.target.files?.[0];
21
20
  if (!file)
@@ -24,7 +23,7 @@ function FileUploader({ type, variant = "accent", url, next, oops }) {
24
23
  const formData = new FormData();
25
24
  formData.append("data", file);
26
25
  const handleSuccess = (data) => {
27
- next?.(data);
26
+ action?.();
28
27
  setLoading(false);
29
28
  };
30
29
  await (0, snatch_http_1.postApi)({
@@ -38,5 +37,5 @@ function FileUploader({ type, variant = "accent", url, next, oops }) {
38
37
  if (event.target)
39
38
  event.target.value = "";
40
39
  };
41
- return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(core_1.Button, { variant: variant, action: clickButton, disabled: isLoading, children: [(0, jsx_runtime_1.jsx)(upload_svg_1.default, {}), "Upload ", typesArray?.length === 1 ? typesArray[0].toUpperCase() : "File"] }), (0, jsx_runtime_1.jsx)("input", { ref: inputRef, type: "file", className: "hidden", accept: acceptAttribute, onChange: handleUpload })] }));
40
+ return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(normal_1.default, { ...props, icon: (0, jsx_runtime_1.jsx)(upload_svg_1.default, {}), action: () => ref.current?.click(), disabled: disabled || isLoading, children: ["Upload", fileTypes?.length === 1 ? fileTypes[0].toUpperCase() : "File"] }), (0, jsx_runtime_1.jsx)("input", { type: "file", className: "hidden", accept: acceptAttribute, onChange: handleUpload, ref: ref })] }));
42
41
  }
@@ -0,0 +1,2 @@
1
+ export { default as CalloutCard } from "./callout";
2
+ export { default as MediaCard } from "./media";
@@ -0,0 +1,10 @@
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.MediaCard = exports.CalloutCard = void 0;
7
+ var callout_1 = require("./callout");
8
+ Object.defineProperty(exports, "CalloutCard", { enumerable: true, get: function () { return __importDefault(callout_1).default; } });
9
+ var media_1 = require("./media");
10
+ Object.defineProperty(exports, "MediaCard", { enumerable: true, get: function () { return __importDefault(media_1).default; } });
@@ -0,0 +1,8 @@
1
+ type Props = {
2
+ label: string;
3
+ value?: string | number | null;
4
+ units?: string;
5
+ note?: string;
6
+ };
7
+ export declare const Card: ({ label, value, units, note }: Props) => import("react").JSX.Element;
8
+ export default Card;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Card = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const flex_1 = require("../container/flex");
6
+ const Card = ({ label, value, units, note }) => ((0, jsx_runtime_1.jsxs)(flex_1.ColumnBox, { style: s.card, children: [(0, jsx_runtime_1.jsx)("span", { className: s.label, children: label }), (0, jsx_runtime_1.jsxs)("span", { className: s.value, children: [formatValue(value), " ", units] }), (0, jsx_runtime_1.jsx)("span", { className: s.note, children: note })] }));
7
+ exports.Card = Card;
8
+ const formatValue = (x) => {
9
+ if (!x)
10
+ return "N/A";
11
+ if (typeof x === "string")
12
+ return x;
13
+ else if (typeof x === "number")
14
+ return x.toLocaleString("en-US");
15
+ };
16
+ const s = {
17
+ card: "gap-2 flex-1 p-5 bg-surface border border-border-light rounded-md shadow hover:brightness-120 duration-200",
18
+ label: "text-sm font-mono tracking-wide text-primary-dark uppercase",
19
+ value: "text-5xl font-bold",
20
+ note: "text-xs text-primary-dark"
21
+ };
22
+ exports.default = exports.Card;
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from "react";
2
+ type MediaRowProps = {
3
+ media: string;
4
+ title: string;
5
+ subtitle?: ReactNode;
6
+ badge?: string;
7
+ styles?: {
8
+ container?: string;
9
+ media?: string;
10
+ title?: string;
11
+ subtitle?: string;
12
+ };
13
+ };
14
+ declare const MediaCard: ({ media, title, subtitle, badge, styles, }: MediaRowProps) => import("react").JSX.Element;
15
+ export default MediaCard;
@@ -0,0 +1,10 @@
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
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const flex_1 = require("../container/flex");
8
+ const badge_1 = __importDefault(require("../text/badge"));
9
+ const MediaCard = ({ media, title, subtitle, badge, styles = {}, }) => ((0, jsx_runtime_1.jsxs)(flex_1.RowBox, { style: `items-center gap-3 ${styles.container ?? ""}`, children: [(0, jsx_runtime_1.jsx)("img", { src: media, className: "size-10 w-10 h-10 border border-border rounded", alt: title }), (0, jsx_runtime_1.jsxs)(flex_1.ColumnBox, { style: "gap-px min-w-0", children: [(0, jsx_runtime_1.jsxs)(flex_1.RowBox, { style: "items-center gap-2 min-w-0", children: [(0, jsx_runtime_1.jsx)("span", { className: `text-primary text-sm font-semibold truncate ${styles.title ?? ""}`, children: title }), badge && (0, jsx_runtime_1.jsx)(badge_1.default, { size: "xs", children: badge })] }), subtitle && ((0, jsx_runtime_1.jsx)("span", { className: `text-xs text-primary-dark ${styles.subtitle}`, children: subtitle }))] })] }));
10
+ exports.default = MediaCard;
@@ -0,0 +1,5 @@
1
+ export { default as AbsoluteBox } from "./absolute";
2
+ export { default as FadeBox } from "./fade";
3
+ export { default as Rnd } from "./rnd";
4
+ export { default as ScrollBox } from "./scroll";
5
+ export * from "./flex";
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.ScrollBox = exports.Rnd = exports.FadeBox = exports.AbsoluteBox = void 0;
21
+ var absolute_1 = require("./absolute");
22
+ Object.defineProperty(exports, "AbsoluteBox", { enumerable: true, get: function () { return __importDefault(absolute_1).default; } });
23
+ var fade_1 = require("./fade");
24
+ Object.defineProperty(exports, "FadeBox", { enumerable: true, get: function () { return __importDefault(fade_1).default; } });
25
+ var rnd_1 = require("./rnd");
26
+ Object.defineProperty(exports, "Rnd", { enumerable: true, get: function () { return __importDefault(rnd_1).default; } });
27
+ var scroll_1 = require("./scroll");
28
+ Object.defineProperty(exports, "ScrollBox", { enumerable: true, get: function () { return __importDefault(scroll_1).default; } });
29
+ __exportStar(require("./flex"), exports);
@@ -0,0 +1,9 @@
1
+ import { ReactNode, RefObject } from "react";
2
+ type Props = {
3
+ pos?: string;
4
+ style?: string;
5
+ ref?: RefObject<HTMLDivElement | null>;
6
+ children: ReactNode;
7
+ };
8
+ export default function AbsoluteBox({ pos, style, ref, children }: Props): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = AbsoluteBox;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const style_1 = require("../../utils/functions/style");
6
+ function AbsoluteBox({ pos, style, ref, children }) {
7
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, style_1.cn)(styles.container, pos), ref: ref, children: (0, jsx_runtime_1.jsx)("div", { className: (0, style_1.cn)(styles.subcontainer, style), children: children }) }));
8
+ }
9
+ const styles = {
10
+ container: "absolute",
11
+ subcontainer: "relative w-full h-full"
12
+ };
@@ -0,0 +1,7 @@
1
+ import type { Component } from "../../utils/types/element";
2
+ type Props = Component & {
3
+ direction?: "up" | "left" | "down";
4
+ gradient?: string;
5
+ };
6
+ export declare function FadeBox({ style, direction, gradient, children }: Props): import("react").JSX.Element;
7
+ export default FadeBox;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FadeBox = FadeBox;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const style_1 = require("../../utils/functions/style");
6
+ const tailwind_variants_1 = require("tailwind-variants");
7
+ function FadeBox({ style, direction = "up", gradient, children }) {
8
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.cn)("relative", style), children: [children, (0, jsx_runtime_1.jsx)("div", { className: (0, style_1.cn)(styles({ direction }), gradient) })] }));
9
+ }
10
+ const styles = (0, tailwind_variants_1.tv)({
11
+ base: "absolute from-background",
12
+ variants: {
13
+ direction: {
14
+ up: "left-0 bottom-0 w-full h-full bg-gradient-to-t",
15
+ left: "top-0 right-0 w-12 h-full bg-gradient-to-l",
16
+ down: "top-0 left-0 w-full h-full bg-gradient-to-b"
17
+ }
18
+ }
19
+ });
20
+ exports.default = FadeBox;
@@ -0,0 +1,17 @@
1
+ import { Component, Hoverable } from "../../utils";
2
+ type Props = Component & Hoverable & {
3
+ center?: boolean;
4
+ centerX?: boolean;
5
+ centerY?: boolean;
6
+ equal?: boolean;
7
+ };
8
+ /**
9
+ * Flex containers with configurable alignment and styling.
10
+ *
11
+ * @param {string} style - Additional styles for container.
12
+ * @param {ReactNode} children - Child elements to render inside the row.
13
+ * @param {Props} opts - Variant options for styling.
14
+ **/
15
+ export declare function RowBox({ style, children, onHover, onLeave, ...opts }: Props): import("react").JSX.Element | null;
16
+ export declare function ColumnBox({ style, children, onHover, onLeave, ...opts }: Props): import("react").JSX.Element | null;
17
+ export {};
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RowBox = RowBox;
4
+ exports.ColumnBox = ColumnBox;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const style_1 = require("../../utils/functions/style");
7
+ const tailwind_variants_1 = require("tailwind-variants");
8
+ /**
9
+ * Flex containers with configurable alignment and styling.
10
+ *
11
+ * @param {string} style - Additional styles for container.
12
+ * @param {ReactNode} children - Child elements to render inside the row.
13
+ * @param {Props} opts - Variant options for styling.
14
+ **/
15
+ function RowBox({ style, children, onHover, onLeave, ...opts }) {
16
+ if (!children)
17
+ return null;
18
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, style_1.cn)(row(opts), style), onMouseEnter: onHover, onMouseLeave: onLeave, children: children }));
19
+ }
20
+ function ColumnBox({ style, children, onHover, onLeave, ...opts }) {
21
+ if (!children)
22
+ return null;
23
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, style_1.cn)(column(opts), style), onMouseEnter: onHover, onMouseLeave: onLeave, children: children }));
24
+ }
25
+ /**
26
+ * Styling variants for flex options.
27
+ *
28
+ * @param {boolean} centerX - center children horizontally
29
+ * @param {boolean} centerY - center children vertically
30
+ * @param {boolean} center - center children on both axis
31
+ **/
32
+ const row = (0, tailwind_variants_1.tv)({
33
+ base: "flex",
34
+ variants: {
35
+ centerX: { true: "justify-center" },
36
+ centerY: { true: "items-center" },
37
+ center: { true: "items-center justify-center" },
38
+ equal: { true: "[&>*]:flex-1 [&>*]:shrink-0" }
39
+ }
40
+ });
41
+ const column = (0, tailwind_variants_1.tv)({
42
+ base: "flex flex-col",
43
+ variants: {
44
+ centerX: { true: "items-center" },
45
+ centerY: { true: "justify-center" },
46
+ center: { true: "items-center justify-center" },
47
+ equal: { true: "[&>*]:flex-1" }
48
+ }
49
+ });
@@ -0,0 +1,10 @@
1
+ type Props = {
2
+ style?: string;
3
+ min: number;
4
+ max: number;
5
+ minWidth?: number;
6
+ update: (min: number, size: number) => void;
7
+ children: React.ReactNode;
8
+ };
9
+ export default function RnD({ style, min, max, minWidth, update, children }: Props): import("react").JSX.Element;
10
+ export {};
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = RnD;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_rnd_1 = require("react-rnd");
7
+ const style_1 = require("../../utils/functions/style");
8
+ function RnD({ style, min, max, minWidth, update, children }) {
9
+ const gapSize = max - min;
10
+ const handleResize = (x, width) => {
11
+ update(x, width);
12
+ };
13
+ const handleDrag = (x) => {
14
+ update(x, gapSize);
15
+ };
16
+ return ((0, jsx_runtime_1.jsx)(react_rnd_1.Rnd, { ...opts(min, max, minWidth), className: (0, style_1.cn)("flex! justify-center items-center overflow-hidden", style), size: { width: gapSize, height: "100%" }, position: { x: min, y: 0 }, onResize: (e, dir, ref, d, pos) => handleResize(pos.x, ref.offsetWidth), onDragStop: (e, d) => handleDrag(d.x), children: children }));
17
+ }
18
+ const opts = (min, max, minWidth) => ({
19
+ bounds: "parent",
20
+ axis: "x",
21
+ minWidth: minWidth || 30,
22
+ default: {
23
+ x: min,
24
+ y: 0,
25
+ width: max - min,
26
+ height: "100%"
27
+ },
28
+ enableResizing: {
29
+ left: true,
30
+ right: true
31
+ }
32
+ });
@@ -0,0 +1,14 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ type RowProps<T> = {
3
+ data: T;
4
+ hovered: boolean;
5
+ setHovered: Dispatch<SetStateAction<number | null>>;
6
+ index: number;
7
+ };
8
+ type Props<T> = {
9
+ style?: string;
10
+ items: T[];
11
+ element: React.ComponentType<RowProps<T>>;
12
+ };
13
+ export default function ScrollBox<T>({ style, items, element: Row }: Props<T>): import("react").JSX.Element;
14
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = ScrollBox;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const style_1 = require("../../utils/functions/style");
7
+ const flex_1 = require("./flex");
8
+ function ScrollBox({ style, items, element: Row }) {
9
+ const [hoveredIndex, setHoveredIndex] = (0, react_1.useState)(null);
10
+ return ((0, jsx_runtime_1.jsx)(flex_1.ColumnBox, { style: (0, style_1.cn)("grow gap-1 w-full overflow-y-auto", style), children: items.map((x, i) => ((0, jsx_runtime_1.jsx)(Row, { data: x, hovered: hoveredIndex === i, setHovered: setHoveredIndex, index: i }, i))) }));
11
+ }
@@ -1,20 +1,9 @@
1
- export { default as Accordion } from "./accordion";
2
- export { default as Table } from "./table";
3
- export { default as Separator } from "./layout/separator";
4
- export { default as FadeBox } from "./layout/fade";
5
- export { default as AbsoluteBox } from "./layout/absolute";
6
- export * from "./layout/flex";
7
- export * from "./layout/_";
8
- export * from "./heading/_";
9
1
  export * from "./button/_";
10
- export { default as Pagination } from "./pagination";
11
- export { default as Section } from "./layout/section";
12
- export { default as Dropdown } from "./dropdown/normal";
13
- export * from "./fade/_";
14
- export * from "./list";
15
- export * from "./layout/media-row";
16
- export * from "./layout/scroll-box";
2
+ export * from "./card/_";
3
+ export * from "./container/_";
17
4
  export * from "./date/_";
18
- export * from "./information/_";
19
- export * from "./progress/_";
5
+ export * from "./layout/_";
6
+ export * from "./link/_";
7
+ export * from "./list";
8
+ export * from "./miscellaneous";
20
9
  export * from "./text/_";
@@ -13,36 +13,13 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
16
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.Dropdown = exports.Section = exports.Pagination = exports.AbsoluteBox = exports.FadeBox = exports.Separator = exports.Table = exports.Accordion = void 0;
21
- var accordion_1 = require("./accordion");
22
- Object.defineProperty(exports, "Accordion", { enumerable: true, get: function () { return __importDefault(accordion_1).default; } });
23
- var table_1 = require("./table");
24
- Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return __importDefault(table_1).default; } });
25
- var separator_1 = require("./layout/separator");
26
- Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return __importDefault(separator_1).default; } });
27
- var fade_1 = require("./layout/fade");
28
- Object.defineProperty(exports, "FadeBox", { enumerable: true, get: function () { return __importDefault(fade_1).default; } });
29
- var absolute_1 = require("./layout/absolute");
30
- Object.defineProperty(exports, "AbsoluteBox", { enumerable: true, get: function () { return __importDefault(absolute_1).default; } });
31
- __exportStar(require("./layout/flex"), exports);
32
- __exportStar(require("./layout/_"), exports);
33
- __exportStar(require("./heading/_"), exports);
34
17
  __exportStar(require("./button/_"), exports);
35
- var pagination_1 = require("./pagination");
36
- Object.defineProperty(exports, "Pagination", { enumerable: true, get: function () { return __importDefault(pagination_1).default; } });
37
- var section_1 = require("./layout/section");
38
- Object.defineProperty(exports, "Section", { enumerable: true, get: function () { return __importDefault(section_1).default; } });
39
- var normal_1 = require("./dropdown/normal");
40
- Object.defineProperty(exports, "Dropdown", { enumerable: true, get: function () { return __importDefault(normal_1).default; } });
41
- __exportStar(require("./fade/_"), exports);
42
- __exportStar(require("./list"), exports);
43
- __exportStar(require("./layout/media-row"), exports);
44
- __exportStar(require("./layout/scroll-box"), exports);
18
+ __exportStar(require("./card/_"), exports);
19
+ __exportStar(require("./container/_"), exports);
45
20
  __exportStar(require("./date/_"), exports);
46
- __exportStar(require("./information/_"), exports);
47
- __exportStar(require("./progress/_"), exports);
21
+ __exportStar(require("./layout/_"), exports);
22
+ __exportStar(require("./link/_"), exports);
23
+ __exportStar(require("./list"), exports);
24
+ __exportStar(require("./miscellaneous"), exports);
48
25
  __exportStar(require("./text/_"), exports);
@@ -1,2 +1,3 @@
1
- export { default as RnD } from "./rnd";
1
+ export { default as Section } from "./section";
2
2
  export { default as Footer } from "./footer";
3
+ export { default as Separator } from "./separator";
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Footer = exports.RnD = void 0;
7
- var rnd_1 = require("./rnd");
8
- Object.defineProperty(exports, "RnD", { enumerable: true, get: function () { return __importDefault(rnd_1).default; } });
6
+ exports.Separator = exports.Footer = exports.Section = void 0;
7
+ var section_1 = require("./section");
8
+ Object.defineProperty(exports, "Section", { enumerable: true, get: function () { return __importDefault(section_1).default; } });
9
9
  var footer_1 = require("./footer");
10
10
  Object.defineProperty(exports, "Footer", { enumerable: true, get: function () { return __importDefault(footer_1).default; } });
11
+ var separator_1 = require("./separator");
12
+ Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return __importDefault(separator_1).default; } });