@bouko/react 2.5.3 → 2.5.5

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 (108) hide show
  1. package/dist/components/animate/configs.d.ts +136 -136
  2. package/dist/components/animate/configs.js +62 -62
  3. package/dist/components/animate/index.d.ts +54 -54
  4. package/dist/components/animate/index.js +33 -33
  5. package/dist/components/attachment.d.ts +2 -2
  6. package/dist/components/attachment.js +18 -18
  7. package/dist/components/button/ghost.d.ts +7 -7
  8. package/dist/components/button/ghost.js +8 -8
  9. package/dist/components/button/load.d.ts +11 -10
  10. package/dist/components/button/load.js +35 -35
  11. package/dist/components/button/normal.d.ts +11 -11
  12. package/dist/components/button/normal.js +38 -37
  13. package/dist/components/button.d.ts +10 -10
  14. package/dist/components/button.js +22 -22
  15. package/dist/components/carousel/index.d.ts +11 -11
  16. package/dist/components/carousel/index.js +19 -19
  17. package/dist/components/checkbox.d.ts +8 -8
  18. package/dist/components/checkbox.js +13 -13
  19. package/dist/components/dropdown/normal.d.ts +10 -10
  20. package/dist/components/dropdown/normal.js +19 -19
  21. package/dist/components/fade-carousel.d.ts +4 -4
  22. package/dist/components/fade-carousel.js +14 -14
  23. package/dist/components/field.d.ts +10 -10
  24. package/dist/components/field.js +10 -10
  25. package/dist/components/form/footer.js +2 -2
  26. package/dist/components/form/functions.d.ts +1 -1
  27. package/dist/components/form/functions.js +28 -28
  28. package/dist/components/form/types.d.ts +38 -38
  29. package/dist/components/form/types.js +1 -1
  30. package/dist/components/heading/normal.d.ts +29 -29
  31. package/dist/components/heading/normal.js +22 -22
  32. package/dist/components/heading/page.d.ts +25 -25
  33. package/dist/components/heading/page.js +23 -23
  34. package/dist/components/index.d.ts +12 -12
  35. package/dist/components/index.js +12 -12
  36. package/dist/components/input.d.ts +37 -37
  37. package/dist/components/input.js +40 -40
  38. package/dist/components/layout/fade.d.ts +7 -7
  39. package/dist/components/layout/fade.js +15 -15
  40. package/dist/components/layout/flex.d.ts +16 -16
  41. package/dist/components/layout/flex.js +42 -42
  42. package/dist/components/layout/heading.d.ts +1 -3
  43. package/dist/components/layout/heading.js +2 -2
  44. package/dist/components/layout/separator.d.ts +3 -3
  45. package/dist/components/layout/separator.js +5 -5
  46. package/dist/components/list/index.d.ts +2 -2
  47. package/dist/components/list/index.js +2 -2
  48. package/dist/components/list/item.d.ts +9 -9
  49. package/dist/components/list/item.js +7 -7
  50. package/dist/components/list/variants/bullet.d.ts +9 -9
  51. package/dist/components/list/variants/bullet.js +16 -16
  52. package/dist/components/list/variants/number.d.ts +10 -10
  53. package/dist/components/list/variants/number.js +18 -18
  54. package/dist/components/multiple-choice.d.ts +2 -2
  55. package/dist/components/multiple-choice.js +12 -12
  56. package/dist/components/search-bar.d.ts +14 -13
  57. package/dist/components/search-bar.js +22 -22
  58. package/dist/components/select.d.ts +6 -6
  59. package/dist/components/select.js +24 -24
  60. package/dist/components/text/badge.d.ts +16 -16
  61. package/dist/components/text/badge.js +28 -28
  62. package/dist/components/textarea.d.ts +7 -7
  63. package/dist/components/textarea.js +11 -11
  64. package/dist/components/upload/file.d.ts +8 -8
  65. package/dist/components/upload/file.js +23 -15
  66. package/dist/components/waveform/index.d.ts +8 -8
  67. package/dist/components/waveform/index.js +11 -11
  68. package/dist/components/waveform/patterns.d.ts +1 -1
  69. package/dist/components/waveform/patterns.js +27 -27
  70. package/dist/core/format.d.ts +3 -3
  71. package/dist/core/format.js +34 -34
  72. package/dist/core/functions.d.ts +13 -13
  73. package/dist/core/functions.js +79 -79
  74. package/dist/core/types.d.ts +14 -14
  75. package/dist/core/types.js +2 -2
  76. package/dist/hooks/audio/sound.d.ts +1 -1
  77. package/dist/hooks/audio/sound.js +6 -6
  78. package/dist/hooks/clock/interval.d.ts +8 -8
  79. package/dist/hooks/clock/interval.js +25 -25
  80. package/dist/hooks/element/container.d.ts +5 -4
  81. package/dist/hooks/element/container.js +7 -7
  82. package/dist/hooks/element/resize.d.ts +1 -1
  83. package/dist/hooks/element/resize.js +12 -12
  84. package/dist/hooks/index.d.ts +4 -4
  85. package/dist/hooks/index.js +4 -4
  86. package/dist/index.d.ts +14 -14
  87. package/dist/index.js +14 -14
  88. package/package.json +3 -35
  89. package/dist/assets/icons/check copy.svg +0 -6
  90. package/dist/assets/icons/check-circle copy.svg +0 -6
  91. package/dist/assets/icons/chevron copy.svg +0 -6
  92. package/dist/assets/icons/paperclip copy.svg +0 -6
  93. package/dist/assets/icons/spinner copy.svg +0 -6
  94. package/dist/assets/icons/x-circle copy.svg +0 -6
  95. package/dist/components/badge.d.ts +0 -5
  96. package/dist/components/badge.js +0 -4
  97. package/dist/components/flex.d.ts +0 -16
  98. package/dist/components/flex.js +0 -8
  99. package/dist/components/form/fields.d.ts +0 -16
  100. package/dist/components/form/fields.js +0 -21
  101. package/dist/components/form/loaders.d.ts +0 -3
  102. package/dist/components/form/loaders.js +0 -11
  103. package/dist/components/form/test-next.d.ts +0 -1
  104. package/dist/components/form/test-next.js +0 -6
  105. package/dist/components/search/index.d.ts +0 -6
  106. package/dist/components/search/index.js +0 -12
  107. package/dist/hooks/color.d.ts +0 -7
  108. package/dist/hooks/color.js +0 -8
@@ -1,10 +1,11 @@
1
- import type { ReactNode } from "react";
2
- export type ButtonProps = {
3
- variant?: "primary" | "outline" | "ghost";
4
- size?: "xs" | "sm" | "md" | "lg";
5
- style?: string;
6
- onClick?: () => void;
7
- disabled?: boolean;
8
- children: ReactNode;
9
- };
10
- export default function LoadButton({ size, variant, style, onClick, children, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
1
+ import type { ReactNode } from "react";
2
+ export declare type ButtonProps = {
3
+ variant?: "primary" | "outline" | "ghost";
4
+ size?: "xs" | "sm" | "md" | "lg";
5
+ style?: string;
6
+ icon?: ReactNode;
7
+ onClick?: () => void;
8
+ disabled?: boolean;
9
+ children: ReactNode;
10
+ };
11
+ export default function LoadButton({ size, variant, style, icon, onClick, children, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -1,35 +1,35 @@
1
- "use state";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { cn, tv } from "@bouko/style";
5
- import CheckCircle from "../../assets/icons/check-circle.svg";
6
- import Spinner from "../../assets/icons/spinner.svg";
7
- export default function LoadButton({ size, variant, style, onClick, children, ...props }) {
8
- const [isLoading, setLoading] = useState(false);
9
- const submit = async () => {
10
- setLoading(true);
11
- try {
12
- await onClick?.();
13
- }
14
- catch { }
15
- setLoading(false);
16
- };
17
- return (_jsxs("button", { className: cn(styles({ variant, size }), style), onClick: submit, ...props, children: [isLoading ? _jsx(Spinner, { className: "animate-spin" }) : _jsx(CheckCircle, {}), children] }));
18
- }
19
- const styles = tv({
20
- base: "flex justify-center items-center gap-2 bg-accent hover:bg-accent-dark border border-accent-dark rounded font-semibold text-background-light duration-200 cursor-pointer disabled:cursor-not-allowed",
21
- defaultVariants: { size: "md" },
22
- variants: {
23
- variant: {
24
- primary: "bg-primary hover:bg-primary-dark border-primary-dark",
25
- outline: "!bg-transparent border-accent hover:border-accent-dark text-primary",
26
- ghost: "!bg-transparent border-transparent text-accent hover:text-accent-dark"
27
- },
28
- size: {
29
- xs: "px-3 py-1 text-xs",
30
- sm: "px-4 py-2 text-xs sm:text-sm",
31
- md: "px-4 py-2",
32
- lg: "px-5 py-3 text-lg"
33
- }
34
- }
35
- });
1
+ "use state";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { cn, tv } from "@bouko/style";
5
+ import CheckCircle from "../../assets/icons/check-circle.svg";
6
+ import Spinner from "../../assets/icons/spinner.svg";
7
+ export default function LoadButton({ size, variant, style, icon, onClick, children, ...props }) {
8
+ const [isLoading, setLoading] = useState(false);
9
+ const submit = async () => {
10
+ setLoading(true);
11
+ try {
12
+ await onClick?.();
13
+ }
14
+ catch { }
15
+ setLoading(false);
16
+ };
17
+ return (_jsxs("button", { className: cn(styles({ variant, size }), style), onClick: submit, ...props, children: [isLoading ? _jsx(Spinner, { className: "animate-spin" }, void 0) : (icon || _jsx(CheckCircle, {}, void 0)), children] }, void 0));
18
+ }
19
+ const styles = tv({
20
+ base: "flex justify-center items-center gap-2 bg-accent hover:bg-accent-dark border border-accent-dark rounded font-semibold text-background-light duration-200 cursor-pointer disabled:cursor-not-allowed",
21
+ defaultVariants: { size: "md" },
22
+ variants: {
23
+ variant: {
24
+ primary: "bg-primary hover:bg-primary-dark border-primary-dark",
25
+ outline: "!bg-transparent border-accent hover:border-accent-dark text-primary",
26
+ ghost: "!bg-transparent border-transparent text-accent hover:text-accent-dark"
27
+ },
28
+ size: {
29
+ xs: "px-3 py-1 text-xs",
30
+ sm: "px-4 py-2 text-xs sm:text-sm",
31
+ md: "px-4 py-2",
32
+ lg: "px-5 py-3 text-lg"
33
+ }
34
+ }
35
+ });
@@ -1,11 +1,11 @@
1
- import { ReactNode } from "react";
2
- import { Component } from "../../core/types";
3
- export type ButtonProps = Component & {
4
- variant?: "primary" | "outline" | "ghost";
5
- size?: "xs" | "sm" | "md" | "lg";
6
- icon?: ReactNode;
7
- action?: () => void;
8
- disabled?: boolean;
9
- };
10
- export declare function Button({ size, variant, style, icon, action, disabled, children }: ButtonProps): import("react/jsx-runtime").JSX.Element;
11
- export default Button;
1
+ import { ReactNode } from "react";
2
+ import type { Component } from "../../core/types";
3
+ export declare type ButtonProps = Component & {
4
+ variant?: "primary" | "outline" | "ghost" | "secondary";
5
+ size?: "xs" | "sm" | "md" | "lg";
6
+ icon?: ReactNode;
7
+ action?: () => void;
8
+ disabled?: boolean;
9
+ };
10
+ export declare function Button({ size, variant, style, icon, action, disabled, children }: ButtonProps): import("react/jsx-runtime").JSX.Element;
11
+ export default Button;
@@ -1,37 +1,38 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { cn, tv } from "@bouko/style";
5
- import Spinner from "../../assets/icons/spinner.svg";
6
- export function Button({ size, variant, style, icon, action, disabled, children }) {
7
- const [isLoading, setLoading] = useState(false);
8
- const submit = async () => {
9
- setLoading(true);
10
- try {
11
- await action?.();
12
- }
13
- catch { }
14
- setLoading(false);
15
- };
16
- return (_jsxs("button", { className: cn(styles({ variant, size }), variant === "ghost" && "p-0", style), onClick: submit, disabled: disabled || isLoading, children: [icon && isLoading
17
- ? _jsx(Spinner, { className: "animate-spin" })
18
- : icon, children] }));
19
- }
20
- const styles = tv({
21
- base: "flex justify-center items-center gap-2 bg-accent hover:bg-accent-dark border border-accent-dark rounded font-semibold text-background-light duration-200 cursor-pointer disabled:cursor-not-allowed",
22
- defaultVariants: { size: "md" },
23
- variants: {
24
- variant: {
25
- primary: "bg-primary hover:bg-primary-dark border-primary-dark",
26
- outline: "bg-transparent border-accent hover:border-accent-dark text-primary",
27
- ghost: "bg-transparent border-transparent text-accent hover:brightness-110"
28
- },
29
- size: {
30
- xs: "px-3 py-1 text-xs",
31
- sm: "px-4 py-2 text-xs sm:text-sm",
32
- md: "px-4 py-2",
33
- lg: "px-5 py-3 text-lg"
34
- }
35
- }
36
- });
37
- export default Button;
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { cn, tv } from "@bouko/style";
5
+ import Spinner from "../../assets/icons/spinner.svg";
6
+ export function Button({ size, variant, style, icon, action, disabled, children }) {
7
+ const [isLoading, setLoading] = useState(false);
8
+ const submit = async () => {
9
+ setLoading(true);
10
+ try {
11
+ await action?.();
12
+ }
13
+ catch { }
14
+ setLoading(false);
15
+ };
16
+ return (_jsxs("button", { className: cn(styles({ variant, size }), variant === "ghost" && "p-0", style), onClick: submit, disabled: disabled || isLoading, children: [icon && isLoading
17
+ ? _jsx(Spinner, { className: "animate-spin" }, void 0)
18
+ : icon, children] }, void 0));
19
+ }
20
+ const styles = tv({
21
+ base: "flex justify-center items-center gap-2 bg-accent border border-accent-darker rounded font-semibold text-background-light duration-200 cursor-pointer disabled:cursor-not-allowed hover:brightness-110",
22
+ defaultVariants: { size: "md" },
23
+ variants: {
24
+ variant: {
25
+ primary: "bg-primary border-primary-dark",
26
+ outline: "bg-transparent border-accent hover:border-accent-dark text-primary",
27
+ ghost: "bg-transparent border-transparent text-accent hover:brightness-110",
28
+ secondary: "bg-background-dark dark:bg-background-light border-border-dark dark:border-border-light text-background-darker dark:text-primary"
29
+ },
30
+ size: {
31
+ xs: "px-3 py-1 text-xs",
32
+ sm: "px-3 py-2 text-xs sm:text-sm",
33
+ md: "px-4 py-2",
34
+ lg: "px-5 py-3 text-lg"
35
+ }
36
+ }
37
+ });
38
+ export default Button;
@@ -1,10 +1,10 @@
1
- import type { ReactNode } from "react";
2
- export type ButtonProps = {
3
- variant?: "primary" | "outline" | "ghost";
4
- size?: "xs" | "sm" | "md" | "lg";
5
- style?: string;
6
- onClick?: () => void;
7
- disabled?: boolean;
8
- children: ReactNode;
9
- };
10
- export declare function Button({ size, variant, style, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
1
+ import type { ReactNode } from "react";
2
+ export declare type ButtonProps = {
3
+ variant?: "primary" | "outline" | "ghost";
4
+ size?: "xs" | "sm" | "md" | "lg";
5
+ style?: string;
6
+ onClick?: () => void;
7
+ disabled?: boolean;
8
+ children: ReactNode;
9
+ };
10
+ export declare function Button({ size, variant, style, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -1,22 +1,22 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn, tv } from "@bouko/style";
3
- export function Button({ size, variant, style, ...props }) {
4
- return (_jsx("button", { className: cn(styles({ variant, size }), style), ...props }));
5
- }
6
- const styles = tv({
7
- base: "flex justify-center items-center gap-2 bg-accent hover:bg-accent-dark border border-accent-dark rounded font-semibold text-background-light duration-200 cursor-pointer disabled:cursor-not-allowed",
8
- defaultVariants: { size: "md" },
9
- variants: {
10
- variant: {
11
- primary: "bg-primary hover:bg-primary-dark border-primary-dark",
12
- outline: "!bg-transparent border-accent hover:border-accent-dark text-primary",
13
- ghost: "!bg-transparent border-transparent text-accent hover:text-accent-dark"
14
- },
15
- size: {
16
- xs: "px-3 py-1 text-xs",
17
- sm: "px-4 py-2 text-xs sm:text-sm",
18
- md: "px-4 py-2",
19
- lg: "px-5 py-3 text-lg"
20
- }
21
- }
22
- });
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn, tv } from "@bouko/style";
3
+ export function Button({ size, variant, style, ...props }) {
4
+ return (_jsx("button", { className: cn(styles({ variant, size }), style), ...props }, void 0));
5
+ }
6
+ const styles = tv({
7
+ base: "flex justify-center items-center gap-2 bg-accent hover:bg-accent-dark border border-accent-dark rounded font-semibold text-background-light duration-200 cursor-pointer disabled:cursor-not-allowed",
8
+ defaultVariants: { size: "md" },
9
+ variants: {
10
+ variant: {
11
+ primary: "bg-primary hover:bg-primary-dark border-primary-dark",
12
+ outline: "!bg-transparent border-accent hover:border-accent-dark text-primary",
13
+ ghost: "!bg-transparent border-transparent text-accent hover:text-accent-dark"
14
+ },
15
+ size: {
16
+ xs: "px-3 py-1 text-xs",
17
+ sm: "px-4 py-2 text-xs sm:text-sm",
18
+ md: "px-4 py-2",
19
+ lg: "px-5 py-3 text-lg"
20
+ }
21
+ }
22
+ });
@@ -1,11 +1,11 @@
1
- import { ReactNode } from "react";
2
- export type CarouselProps<T = ReactNode> = {
3
- container?: string;
4
- items: T[];
5
- direction?: "horizontal" | "vertical";
6
- interval?: number;
7
- duration?: number;
8
- autoplay?: boolean;
9
- style?: string;
10
- };
11
- export declare function Carousel({ container, style, items, direction, autoplay, interval, ...props }: CarouselProps): import("react/jsx-runtime").JSX.Element;
1
+ import { ReactNode } from "react";
2
+ export declare type CarouselProps<T = ReactNode> = {
3
+ container?: string;
4
+ items: T[];
5
+ direction?: "horizontal" | "vertical";
6
+ interval?: number;
7
+ duration?: number;
8
+ autoplay?: boolean;
9
+ style?: string;
10
+ };
11
+ export declare function Carousel({ container, style, items, direction, autoplay, interval, ...props }: CarouselProps): import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,19 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { AnimatePresence } from "framer-motion";
4
- import { Animation } from "../animate";
5
- import { useState, useEffect } from "react";
6
- import { opacity, slideX, slideY } from "../animate";
7
- import { cn } from "@bouko/style";
8
- export function Carousel({ container, style, items, direction = "horizontal", autoplay = true, interval = 3000, ...props }) {
9
- const [index, setIndex] = useState(0);
10
- useEffect(() => {
11
- if (items.length === 0 || !autoplay)
12
- return;
13
- const intervalTracker = setInterval(() => {
14
- setIndex((prev) => (prev + 1) % items.length);
15
- }, interval);
16
- return () => clearInterval(intervalTracker);
17
- }, [items.length, interval, autoplay]);
18
- return (_jsx("div", { className: cn("flex items-center", container), children: _jsx(AnimatePresence, { mode: "wait", children: _jsx(Animation, { style: cn("w-full", style), variants: [opacity(), direction === "horizontal" ? slideX() : slideY()], children: items[index], ...props }, index) }) }));
19
- }
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { AnimatePresence } from "framer-motion";
4
+ import { Animation } from "../animate";
5
+ import { useState, useEffect } from "react";
6
+ import { opacity, slideX, slideY } from "../animate";
7
+ import { cn } from "@bouko/style";
8
+ export function Carousel({ container, style, items, direction = "horizontal", autoplay = true, interval = 3000, ...props }) {
9
+ const [index, setIndex] = useState(0);
10
+ useEffect(() => {
11
+ if (items.length === 0 || !autoplay)
12
+ return;
13
+ const intervalTracker = setInterval(() => {
14
+ setIndex((prev) => (prev + 1) % items.length);
15
+ }, interval);
16
+ return () => clearInterval(intervalTracker);
17
+ }, [items.length, interval, autoplay]);
18
+ return (_jsx("div", { className: cn("flex items-center", container), children: _jsx(AnimatePresence, { mode: "wait", children: _jsx(Animation, { style: cn("w-full", style), variants: [opacity(), direction === "horizontal" ? slideX() : slideY()], children: items[index], ...props }, index) }, void 0) }, void 0));
19
+ }
@@ -1,8 +1,8 @@
1
- type Props = {
2
- style?: string;
3
- label: string;
4
- value: boolean;
5
- update: (x: boolean) => void;
6
- };
7
- export default function Checkbox({ style, label, value, update }: Props): import("react/jsx-runtime").JSX.Element;
8
- export {};
1
+ declare type Props = {
2
+ style?: string;
3
+ label: string;
4
+ value: boolean;
5
+ update: (x: boolean) => void;
6
+ };
7
+ export default function Checkbox({ style, label, value, update }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -1,13 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import Check from "../assets/icons/check.svg";
3
- import { cn } from "@bouko/style";
4
- export default function Checkbox({ style, label, value, update }) {
5
- const isChecked = !!value;
6
- return (_jsxs("div", { className: cn(styles.container, style), children: [_jsx("div", { className: cn(styles.box, isChecked && "bg-accent"), onClick: () => update(!isChecked), children: isChecked && _jsx(Check, { className: styles.check }) }), _jsx("span", { className: styles.label, children: label })] }));
7
- }
8
- const styles = {
9
- container: "flex gap-3 items-center",
10
- box: "flex justify-center items-center size-4 min-w-4 hover:bg-accent border rounded border-border-light duration-200 cursor-pointer",
11
- check: "size-2 text-background",
12
- label: "text-xs text-primary-dark"
13
- };
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Check from "../assets/icons/check.svg";
3
+ import { cn } from "@bouko/style";
4
+ export default function Checkbox({ style, label, value, update }) {
5
+ const isChecked = !!value;
6
+ return (_jsxs("div", { className: cn(styles.container, style), children: [_jsx("div", { className: cn(styles.box, isChecked && "bg-accent"), onClick: () => update(!isChecked), children: isChecked && _jsx(Check, { className: styles.check }, void 0) }, void 0), _jsx("span", { className: styles.label, children: label }, void 0)] }, void 0));
7
+ }
8
+ const styles = {
9
+ container: "flex gap-3 items-center",
10
+ box: "flex justify-center items-center size-4 min-w-4 hover:bg-accent border rounded border-border-light duration-200 cursor-pointer",
11
+ check: "size-2 text-background",
12
+ label: "text-xs text-primary-dark"
13
+ };
@@ -1,10 +1,10 @@
1
- import { ReactNode } from "react";
2
- type Option = {
3
- label: ReactNode;
4
- action: () => void;
5
- };
6
- export default function Dropdown({ options, children }: {
7
- options: Option[];
8
- children: ReactNode;
9
- }): import("react/jsx-runtime").JSX.Element;
10
- export {};
1
+ import { ReactNode } from "react";
2
+ declare type Option = {
3
+ label: ReactNode;
4
+ action: () => void;
5
+ };
6
+ export default function Dropdown({ options, children }: {
7
+ options: Option[];
8
+ children: ReactNode;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -1,19 +1,19 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { AnimatePresence, motion } from "framer-motion";
5
- export default function Dropdown({ options, children }) {
6
- const [isOpen, setOpen] = useState(false);
7
- const boom = (action) => {
8
- action();
9
- setOpen(false);
10
- };
11
- return (_jsxs("div", { className: styles.container, children: [_jsx("div", { onClick: () => setOpen(true), children: children }), _jsx(AnimatePresence, { children: isOpen && (_jsx(motion.div, { className: styles.dropdown, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: options.map(({ label, action }, i) => (_jsx("div", { className: "cursor-pointer duration-200 hover:brightness-115", onClick: () => boom(action), children: label }, i))) }, "dropdown")) })] }));
12
- }
13
- const styles = {
14
- container: "relative shrink-0",
15
- subcontainer: "flex flex-col gap-1 w-full",
16
- label: "text-xs text-slate-600",
17
- trigger: "flex justify-between items-center px-3 py-2 bg-slate-200/50 hover:bg-slate-200/80 border border-slate-300 outline-blue-500 rounded text-sm duration-200 cursor-pointer",
18
- dropdown: "absolute mt-2 z-50 flex flex-col items-end justify-end gap-1 w-full bg-slate-950 rounded border border-border-dark p-3 pr-4 text-sm max-h-46 overflow-y-auto"
19
- };
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { AnimatePresence, motion } from "framer-motion";
5
+ export default function Dropdown({ options, children }) {
6
+ const [isOpen, setOpen] = useState(false);
7
+ const boom = (action) => {
8
+ action();
9
+ setOpen(false);
10
+ };
11
+ return (_jsxs("div", { className: styles.container, children: [_jsx("div", { onClick: () => setOpen(true), children: children }, void 0), _jsx(AnimatePresence, { children: isOpen && (_jsx(motion.div, { className: styles.dropdown, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: options.map(({ label, action }, i) => (_jsx("div", { className: "cursor-pointer duration-200 hover:brightness-115", onClick: () => boom(action), children: label }, i))) }, "dropdown")) }, void 0)] }, void 0));
12
+ }
13
+ const styles = {
14
+ container: "relative shrink-0",
15
+ subcontainer: "flex flex-col gap-1 w-full",
16
+ label: "text-xs text-slate-600",
17
+ trigger: "flex justify-between items-center px-3 py-2 bg-slate-200/50 hover:bg-slate-200/80 border border-slate-300 outline-blue-500 rounded text-sm duration-200 cursor-pointer",
18
+ dropdown: "absolute mt-2 z-50 flex flex-col items-end justify-end gap-1 w-full bg-slate-950 rounded border border-border-dark p-3 pr-4 text-sm max-h-46 overflow-y-auto"
19
+ };
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from "react";
2
- export default function FadeCarousel({ items }: {
3
- items: ReactNode[];
4
- }): import("react/jsx-runtime").JSX.Element;
1
+ import { type ReactNode } from "react";
2
+ export default function FadeCarousel({ items }: {
3
+ items: ReactNode[];
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,14 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useState, useEffect } from "react";
4
- import { AnimatePresence, motion } from "framer-motion";
5
- export default function FadeCarousel({ items }) {
6
- const [index, setIndex] = useState(0);
7
- useEffect(() => {
8
- const interval = setInterval(() => {
9
- setIndex((prev) => (prev + 1) % items.length);
10
- }, 2000);
11
- return () => clearInterval(interval);
12
- }, []);
13
- return (_jsx(AnimatePresence, { mode: "wait", children: _jsx(motion.div, { className: "absolute", transition: { duration: 0.5 }, initial: { opacity: 0, y: 5 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -5 }, children: items[index] }, index) }));
14
- }
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useState, useEffect } from "react";
4
+ import { AnimatePresence, motion } from "framer-motion";
5
+ export default function FadeCarousel({ items }) {
6
+ const [index, setIndex] = useState(0);
7
+ useEffect(() => {
8
+ const interval = setInterval(() => {
9
+ setIndex((prev) => (prev + 1) % items.length);
10
+ }, 2000);
11
+ return () => clearInterval(interval);
12
+ }, []);
13
+ return (_jsx(AnimatePresence, { mode: "wait", children: _jsx(motion.div, { className: "absolute", transition: { duration: 0.5 }, initial: { opacity: 0, y: 5 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -5 }, children: items[index] }, index) }, void 0));
14
+ }
@@ -1,10 +1,10 @@
1
- import type { InputHTMLAttributes, ReactNode } from "react";
2
- type Props = InputHTMLAttributes<HTMLInputElement> & {
3
- label?: string;
4
- style?: string;
5
- required?: boolean;
6
- note?: ReactNode;
7
- children: ReactNode;
8
- };
9
- export default function Field({ style, label, required, note, children }: Props): import("react/jsx-runtime").JSX.Element;
10
- export {};
1
+ import type { InputHTMLAttributes, ReactNode } from "react";
2
+ declare type Props = InputHTMLAttributes<HTMLInputElement> & {
3
+ label?: string;
4
+ style?: string;
5
+ required?: boolean;
6
+ note?: ReactNode;
7
+ children: ReactNode;
8
+ };
9
+ export default function Field({ style, label, required, note, children }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -1,10 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from "@bouko/style";
3
- export default function Field({ style, label, required = true, note, children }) {
4
- return (_jsxs("div", { className: cn(styles.container, style), children: [label && _jsxs("span", { className: styles.label, children: [label, " ", !required ? _jsx("span", { className: "italic text-slate-400", children: "(optional)" }) : ""] }), children, note && _jsx("span", { className: styles.note, children: note })] }));
5
- }
6
- const styles = {
7
- container: "flex flex-col shrink-0 gap-1 w-full overflow-hidden",
8
- label: "text-xs text-primary-dark",
9
- note: "mt-1 text-xs text-slate-500 whitespace-pre-line"
10
- };
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "@bouko/style";
3
+ export default function Field({ style, label, required = true, note, children }) {
4
+ return (_jsxs("div", { className: cn(styles.container, style), children: [label && _jsxs("span", { className: styles.label, children: [label, " ", !required ? _jsx("span", { className: "italic text-slate-400", children: "(optional)" }, void 0) : ""] }, void 0), children, note && _jsx("span", { className: styles.note, children: note }, void 0)] }, void 0));
5
+ }
6
+ const styles = {
7
+ container: "flex flex-col shrink-0 gap-1 w-full overflow-hidden",
8
+ label: "text-xs text-primary-dark",
9
+ note: "mt-1 text-xs text-slate-500 whitespace-pre-line"
10
+ };
@@ -3,8 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { Button } from "../button";
5
5
  import { RowBox } from "../layout/flex";
6
- import CheckCircle from "../../assets/icons/check-circle.svg";
7
- import Spinner from "../../assets/icons/spinner.svg";
6
+ import CheckCircle from "./assets/check-circle.svg";
7
+ import Spinner from "./assets/spinner.svg";
8
8
  export default function FormFooter({ data, validator, submit, clear }) {
9
9
  const isValid = validator.safeParse(data).success;
10
10
  const [isLoading, setLoading] = useState(false);
@@ -1 +1 @@
1
- export declare const parseData: <T extends Record<string, unknown>>(data: T) => T;
1
+ export declare const parseData: <T extends Record<string, unknown>>(data: T) => T;
@@ -1,28 +1,28 @@
1
- export const parseData = (data) => {
2
- const copy = JSON.parse(JSON.stringify(data));
3
- for (const [key, value] of Object.entries(data)) {
4
- if (key === "created_at")
5
- copy[key] = new Date(value);
6
- else if (key === "timestamp")
7
- copy[key] = new Date(value.replaceAll("'", ""));
8
- else if (parseAllowedDate(value))
9
- copy[key] = new Date(value);
10
- }
11
- return copy;
12
- };
13
- function parseAllowedDate(input) {
14
- // ISO 8601 strict (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss+hh:mm)
15
- const isoStrictRegex = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2}))?$/;
16
- // MySQL/Postgres style with space + offset without colon (YYYY-MM-DD HH:mm:ss+hhmm)
17
- const spaceOffsetRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}[+-]\d{4}$/;
18
- let normalized = input;
19
- if (spaceOffsetRegex.test(input)) {
20
- // Convert to ISO by replacing space with T and adding colon in offset
21
- normalized = input.replace(" ", "T").replace(/([+-]\d{2})(\d{2})$/, "$1:$2");
22
- }
23
- else if (!isoStrictRegex.test(input)) {
24
- return null; // Not allowed format
25
- }
26
- const date = new Date(normalized);
27
- return !isNaN(date.getTime()) ? date : null;
28
- }
1
+ export const parseData = (data) => {
2
+ const copy = JSON.parse(JSON.stringify(data));
3
+ for (const [key, value] of Object.entries(data)) {
4
+ if (key === "created_at")
5
+ copy[key] = new Date(value);
6
+ else if (key === "timestamp")
7
+ copy[key] = new Date(value.replaceAll("'", ""));
8
+ else if (parseAllowedDate(value))
9
+ copy[key] = new Date(value);
10
+ }
11
+ return copy;
12
+ };
13
+ function parseAllowedDate(input) {
14
+ // ISO 8601 strict (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss+hh:mm)
15
+ const isoStrictRegex = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2}))?$/;
16
+ // MySQL/Postgres style with space + offset without colon (YYYY-MM-DD HH:mm:ss+hhmm)
17
+ const spaceOffsetRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}[+-]\d{4}$/;
18
+ let normalized = input;
19
+ if (spaceOffsetRegex.test(input)) {
20
+ // Convert to ISO by replacing space with T and adding colon in offset
21
+ normalized = input.replace(" ", "T").replace(/([+-]\d{2})(\d{2})$/, "$1:$2");
22
+ }
23
+ else if (!isoStrictRegex.test(input)) {
24
+ return null; // Not allowed format
25
+ }
26
+ const date = new Date(normalized);
27
+ return !isNaN(date.getTime()) ? date : null;
28
+ }