@bouko/react 2.5.4 → 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 -38
  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,42 +1,42 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn, tv } from "@bouko/style";
3
- /**
4
- * Flex containers with configurable alignment and styling.
5
- *
6
- * @param {string} style - Additional styles for container.
7
- * @param {ReactNode} children - Child elements to render inside the row.
8
- * @param {Props} opts - Variant options for styling.
9
- **/
10
- export function RowBox({ style, children, ...opts }) {
11
- if (!children)
12
- return null;
13
- return (_jsx("div", { className: cn(row(opts), style), children: children }));
14
- }
15
- export function ColumnBox({ style, children, ...opts }) {
16
- if (!children)
17
- return null;
18
- return (_jsx("div", { className: cn(column(opts), style), children: children }));
19
- }
20
- /**
21
- * Styling variants for flex options.
22
- *
23
- * @param {boolean} centerX - center children horizontally
24
- * @param {boolean} centerY - center children vertically
25
- * @param {boolean} center - center children on both axis
26
- **/
27
- const row = tv({
28
- base: "flex",
29
- variants: {
30
- centerX: { true: "justify-center" },
31
- centerY: { true: "items-center" },
32
- center: { true: "items-center justify-center" }
33
- }
34
- });
35
- const column = tv({
36
- base: "flex flex-col",
37
- variants: {
38
- centerX: { true: "items-center" },
39
- centerY: { true: "justify-center" },
40
- center: { true: "items-center justify-center" }
41
- }
42
- });
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn, tv } from "@bouko/style";
3
+ /**
4
+ * Flex containers with configurable alignment and styling.
5
+ *
6
+ * @param {string} style - Additional styles for container.
7
+ * @param {ReactNode} children - Child elements to render inside the row.
8
+ * @param {Props} opts - Variant options for styling.
9
+ **/
10
+ export function RowBox({ style, children, ...opts }) {
11
+ if (!children)
12
+ return null;
13
+ return (_jsx("div", { className: cn(row(opts), style), children: children }, void 0));
14
+ }
15
+ export function ColumnBox({ style, children, ...opts }) {
16
+ if (!children)
17
+ return null;
18
+ return (_jsx("div", { className: cn(column(opts), style), children: children }, void 0));
19
+ }
20
+ /**
21
+ * Styling variants for flex options.
22
+ *
23
+ * @param {boolean} centerX - center children horizontally
24
+ * @param {boolean} centerY - center children vertically
25
+ * @param {boolean} center - center children on both axis
26
+ **/
27
+ const row = tv({
28
+ base: "flex",
29
+ variants: {
30
+ centerX: { true: "justify-center" },
31
+ centerY: { true: "items-center" },
32
+ center: { true: "items-center justify-center" }
33
+ }
34
+ });
35
+ const column = tv({
36
+ base: "flex flex-col",
37
+ variants: {
38
+ centerX: { true: "items-center" },
39
+ centerY: { true: "justify-center" },
40
+ center: { true: "items-center justify-center" }
41
+ }
42
+ });
@@ -24,8 +24,6 @@ export {};
24
24
  /**
25
25
  * Problems
26
26
  *
27
- * - Perfect `mergeStyles`
28
- * - Perfect `RowBox`
29
- * - Perfect `ColumnBox`
30
27
  * - Perfect `Badge`
28
+ * - Long `subtitle` style
31
29
  **/
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { mergeStyles } from "@bouko/style";
3
3
  import { RowBox, ColumnBox } from "./flex";
4
- import { default as Badge } from "../text/badge";
4
+ import { Badge } from "../text/badge";
5
5
  /**
6
6
  * Text heading with badge, title, subtitle.
7
7
  *
@@ -18,5 +18,5 @@ const base = {
18
18
  container: "items-center",
19
19
  badge: "mb-2",
20
20
  title: "items-center gap-2 text-xl sm:text-2xl 2xl:text-3xl font-bold text-primary",
21
- subtitle: "items-center gap-2 max-sm:text-sm 2xl:text-lg text-primary-light dark:text-primary-dark"
21
+ subtitle: "items-center gap-2 max-sm:text-sm 2xl:text-lg text-center text-primary-light dark:text-primary-dark"
22
22
  };
@@ -1,3 +1,3 @@
1
- export default function Separator({ style }: {
2
- style?: string;
3
- }): import("react/jsx-runtime").JSX.Element;
1
+ export default function Separator({ style }: {
2
+ style?: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from "@bouko/style";
3
- export default function Separator({ style }) {
4
- return _jsx("hr", { className: cn("w-full text-border-dark", style) });
5
- }
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "@bouko/style";
3
+ export default function Separator({ style }) {
4
+ return _jsx("hr", { className: cn("w-full text-border-dark", style) }, void 0);
5
+ }
@@ -1,2 +1,2 @@
1
- export { default as BulletList } from "./variants/bullet";
2
- export { default as NumberList } from "./variants/number";
1
+ export { default as BulletList } from "./variants/bullet";
2
+ export { default as NumberList } from "./variants/number";
@@ -1,2 +1,2 @@
1
- export { default as BulletList } from "./variants/bullet";
2
- export { default as NumberList } from "./variants/number";
1
+ export { default as BulletList } from "./variants/bullet";
2
+ export { default as NumberList } from "./variants/number";
@@ -1,9 +1,9 @@
1
- import { type ReactNode } from "react";
2
- interface Props {
3
- marker: ReactNode;
4
- content: ReactNode;
5
- index: number;
6
- centerMarker?: boolean;
7
- }
8
- export default function Item({ marker, content, centerMarker, index }: Props): import("react/jsx-runtime").JSX.Element;
9
- export {};
1
+ import { type ReactNode } from "react";
2
+ interface Props {
3
+ marker: ReactNode;
4
+ content: ReactNode;
5
+ index: number;
6
+ centerMarker?: boolean;
7
+ }
8
+ export default function Item({ marker, content, centerMarker, index }: Props): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -1,7 +1,7 @@
1
- import { jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Animation } from "../animate";
3
- import { cn } from "@bouko/style";
4
- ;
5
- export default function Item({ marker, content, centerMarker, index }) {
6
- return (_jsxs(Animation, { style: cn("flex items-start text-sm", centerMarker && "items-center"), children: [marker, content] }, index));
7
- }
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Animation } from "../animate";
3
+ import { cn } from "@bouko/style";
4
+ ;
5
+ export default function Item({ marker, content, centerMarker, index }) {
6
+ return (_jsxs(Animation, { style: cn("flex items-start text-sm", centerMarker && "items-center"), children: [marker, content] }, index));
7
+ }
@@ -1,9 +1,9 @@
1
- import { 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): import("react/jsx-runtime").JSX.Element;
9
- export {};
1
+ import { 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): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -1,16 +1,16 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import Item from "../item";
4
- import { Animation } from "../../animate/";
5
- import { cn } from "@bouko/style";
6
- ;
7
- export default function BulletList({ style, title, items, centerMarker }) {
8
- return (_jsxs(Animation, { style: cn(styles.base, style), children: [!!title && _jsx("span", { className: styles.title, children: title }), _jsx(Animation, { style: cn(styles.base, style, !!title && "ml-2"), children: items.map((x, i) => (_jsx(Item, { marker: _jsx(Marker, {}), content: x, index: i, centerMarker: centerMarker }, i))) })] }, title));
9
- }
10
- function Marker() {
11
- return (_jsx("span", { className: "mr-3 text-accent", children: "\u2022" }));
12
- }
13
- const styles = {
14
- base: "flex flex-col gap-1 w-full",
15
- title: "mb-1 text-base"
16
- };
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Item from "../item";
4
+ import { Animation } from "../../animate/";
5
+ import { cn } from "@bouko/style";
6
+ ;
7
+ export default function BulletList({ style, title, items, centerMarker }) {
8
+ return (_jsxs(Animation, { style: cn(styles.base, style), children: [!!title && _jsx("span", { className: styles.title, children: title }, void 0), _jsx(Animation, { style: cn(styles.base, style, !!title && "ml-2"), children: items.map((x, i) => (_jsx(Item, { marker: _jsx(Marker, {}, void 0), content: x, index: i, centerMarker: centerMarker }, i))) }, void 0)] }, title));
9
+ }
10
+ function Marker() {
11
+ return (_jsx("span", { className: "mr-3 text-accent", children: "\u2022" }, void 0));
12
+ }
13
+ const styles = {
14
+ base: "flex flex-col gap-1 w-full",
15
+ title: "mb-1 text-base"
16
+ };
@@ -1,10 +1,10 @@
1
- import { 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): import("react/jsx-runtime").JSX.Element;
10
- export {};
1
+ import { 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): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -1,18 +1,18 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import Item from "../item";
4
- import { Animation } from "../../animate";
5
- import { cn } from "@bouko/style";
6
- ;
7
- export default function NumberList({ style, marker, title, items, centerMarker }) {
8
- return (_jsxs(Animation, { style: cn(styles.base, style), children: [!!title && _jsx("span", { className: styles.title, children: title }), _jsx(Animation, { style: cn(styles.base, style, !!title && "ml-2"), children: items.map((x, i) => (_jsx(Item, { marker: _jsx(Marker, { style: marker, x: i + 1 }), content: x, index: i, centerMarker: centerMarker }, i))) }, "content")] }, "list"));
9
- }
10
- function Marker({ style, x }) {
11
- return (_jsx("div", { className: cn(styles.marker, style), children: _jsx("span", { className: styles.label, children: x }) }));
12
- }
13
- const styles = {
14
- base: "flex flex-col gap-6 w-full text-primary-dark",
15
- title: "mb-1 text-base text-primary",
16
- 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",
17
- label: "font-bold text-background-lighter select-none"
18
- };
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Item from "../item";
4
+ import { Animation } from "../../animate";
5
+ import { cn } from "@bouko/style";
6
+ ;
7
+ export default function NumberList({ style, marker, title, items, centerMarker }) {
8
+ return (_jsxs(Animation, { style: cn(styles.base, style), children: [!!title && _jsx("span", { className: styles.title, children: title }, void 0), _jsx(Animation, { style: cn(styles.base, style, !!title && "ml-2"), children: items.map((x, i) => (_jsx(Item, { marker: _jsx(Marker, { style: marker, x: i + 1 }, void 0), content: x, index: i, centerMarker: centerMarker }, i))) }, "content")] }, "list"));
9
+ }
10
+ function Marker({ style, x }) {
11
+ return (_jsx("div", { className: cn(styles.marker, style), children: _jsx("span", { className: styles.label, children: x }, void 0) }, void 0));
12
+ }
13
+ const styles = {
14
+ base: "flex flex-col gap-6 w-full text-primary-dark",
15
+ title: "mb-1 text-base text-primary",
16
+ 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",
17
+ label: "font-bold text-background-lighter select-none"
18
+ };
@@ -1,2 +1,2 @@
1
- import { type OptionField } from "./form/types";
2
- export default function MultipleChoice<T>({ id, label, options, style, value, update, required }: OptionField<string>): import("react/jsx-runtime").JSX.Element;
1
+ import { type OptionField } from "./form/types";
2
+ export default function MultipleChoice<T>({ id, label, options, style, value, update, required }: OptionField<string>): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,12 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import Field from "./field";
3
- import { cn } from "@bouko/style";
4
- export default function MultipleChoice({ id, label, options, style, value, update, required = true }) {
5
- return (_jsx(Field, { style: style, label: label, required: required, children: _jsx("div", { className: styles.options, children: options.map((x, i) => (_jsxs("div", { className: styles.item, children: [_jsx(Dot, { ...x, active: x.id === value, select: () => id ? update(x.id) : null }), x.label] }, i))) }) }));
6
- }
7
- const Dot = ({ active, select }) => (_jsx("div", { className: cn(styles.dot, active && "bg-accent border-accent-dark"), onClick: select }));
8
- const styles = {
9
- options: "flex shrink-0 flex-col gap-1 mt-px w-full",
10
- item: "flex items-center gap-3 text-sm",
11
- dot: "size-3 bg-background-dark/50 hover:bg-background-dark duration-200 cursor-pointer border border-background-darker rounded-full"
12
- };
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Field from "./field";
3
+ import { cn } from "@bouko/style";
4
+ export default function MultipleChoice({ id, label, options, style, value, update, required = true }) {
5
+ return (_jsx(Field, { style: style, label: label, required: required, children: _jsx("div", { className: styles.options, children: options.map((x, i) => (_jsxs("div", { className: styles.item, children: [_jsx(Dot, { ...x, active: x.id === value, select: () => id ? update(x.id) : null }, void 0), x.label] }, i))) }, void 0) }, void 0));
6
+ }
7
+ const Dot = ({ active, select }) => (_jsx("div", { className: cn(styles.dot, active && "bg-accent border-accent-dark"), onClick: select }, void 0));
8
+ const styles = {
9
+ options: "flex shrink-0 flex-col gap-1 mt-px w-full",
10
+ item: "flex items-center gap-3 text-sm",
11
+ dot: "size-3 bg-background-dark/50 hover:bg-background-dark duration-200 cursor-pointer border border-background-darker rounded-full"
12
+ };
@@ -1,13 +1,14 @@
1
- type Props<T> = {
2
- style?: Styles;
3
- placeholder?: string;
4
- trigger?: React.ReactNode;
5
- submit: (query: string) => Promise<T>;
6
- };
7
- type Styles = {
8
- container?: string;
9
- input?: string;
10
- trigger?: string;
11
- };
12
- export declare function SearchBar<T>({ style, placeholder, trigger, submit }: Props<T>): import("react/jsx-runtime").JSX.Element;
13
- export {};
1
+ /// <reference types="react" />
2
+ declare type Props<T> = {
3
+ style?: Styles;
4
+ placeholder?: string;
5
+ trigger?: React.ReactNode;
6
+ submit: (query: string) => Promise<T>;
7
+ };
8
+ declare type Styles = {
9
+ container?: string;
10
+ input?: string;
11
+ trigger?: string;
12
+ };
13
+ export declare function SearchBar<T>({ style, placeholder, trigger, submit }: Props<T>): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -1,22 +1,22 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { RowBox } from "./layout/flex";
5
- import { FadeBox } from "./layout/fade";
6
- import { Button } from "./button/normal";
7
- import Input from "./input";
8
- import { mergeStyles } from "@bouko/style";
9
- export function SearchBar({ style = {}, placeholder, trigger, submit }) {
10
- const [query, setQuery] = useState("");
11
- const styles = mergeStyles(base, style);
12
- const search = async () => {
13
- if (query === "")
14
- return;
15
- await submit(query);
16
- };
17
- return (_jsxs(RowBox, { style: styles.container, children: [_jsx(FadeBox, { style: "grow", gradient: "from-slate-950", children: _jsx(Input, { variant: "ghost", style: styles.input, placeholder: placeholder, value: query, update: setQuery, onEnter: search }) }), trigger && (_jsx(Button, { variant: "ghost", style: style?.trigger, action: search, children: trigger }))] }));
18
- }
19
- const base = {
20
- container: "items-center gap-5 w-xl max-w-full pl-5 pr-4 py-3 bg-slate-950 border border-border rounded-md",
21
- input: "text-lg tracking-wide"
22
- };
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { RowBox } from "./layout/flex";
5
+ import { FadeBox } from "./layout/fade";
6
+ import { Button } from "./button/normal";
7
+ import Input from "./input";
8
+ import { mergeStyles } from "@bouko/style";
9
+ export function SearchBar({ style = {}, placeholder, trigger, submit }) {
10
+ const [query, setQuery] = useState("");
11
+ const styles = mergeStyles(base, style);
12
+ const search = async () => {
13
+ if (query === "")
14
+ return;
15
+ await submit(query);
16
+ };
17
+ return (_jsxs(RowBox, { style: styles.container, children: [_jsx(FadeBox, { style: "grow", gradient: "from-slate-950", children: _jsx(Input, { variant: "ghost", style: styles.input, placeholder: placeholder, value: query, update: setQuery, onEnter: search }, void 0) }, void 0), trigger && (_jsx(Button, { variant: "ghost", style: style?.trigger, action: search, children: trigger }, void 0))] }, void 0));
18
+ }
19
+ const base = {
20
+ container: "items-center gap-5 w-xl max-w-full pl-5 pr-4 py-3 bg-slate-950 border border-border rounded-md",
21
+ input: "text-lg tracking-wide"
22
+ };
@@ -1,6 +1,6 @@
1
- import { type OptionField } from "./form/types";
2
- type Props<T> = OptionField<T> & {
3
- placeholder?: string;
4
- };
5
- export default function Select({ id, style, label, required, value, options, update, note }: Props<string>): import("react/jsx-runtime").JSX.Element;
6
- export {};
1
+ import { type OptionField } from "./form/types";
2
+ declare type Props<T> = OptionField<T> & {
3
+ placeholder?: string;
4
+ };
5
+ export default function Select({ id, style, label, required, value, options, update, note }: Props<string>): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1,24 +1,24 @@
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
- import Chevron from "../assets/icons/chevron.svg";
6
- import { cn } from "@bouko/style";
7
- export default function Select({ id, style, label, required = true, value, options, update, note }) {
8
- const [isOpen, setOpen] = useState(false);
9
- const active = options.find(x => x.id === value);
10
- const select = (x) => {
11
- if (id)
12
- update(x);
13
- setOpen(false);
14
- };
15
- return (_jsxs("div", { className: cn(styles.container, style), children: [_jsxs("div", { className: styles.subcontainer, children: [label && _jsxs("span", { className: styles.label, children: [label, " ", !required ? _jsx("span", { className: "italic text-slate-400", children: "(optional)" }) : ""] }), _jsxs("div", { className: cn(styles.trigger, !active?.label && "capitalize"), onClick: () => setOpen(x => !x), children: [active ? active.label ?? active.id : "None", _jsx(Chevron, { className: cn("text-xs text-slate-400 duration-200", isOpen && "rotate-180") })] }), note && !isOpen && _jsx("span", { className: styles.note, children: note })] }), _jsx(AnimatePresence, { children: isOpen && (_jsx(motion.div, { className: styles.dropdown, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: options.map(({ id, label }) => (_jsx("span", { className: cn("w-full p-2 border-l-3 border-transparent hover:text-blue-600 duration-200 cursor-pointer", active?.id === id && "border-blue-600 bg-blue-500/10", !label && "capitalize"), onClick: () => select(id), children: label ?? id }, id))) }, "dropdown")) })] }));
16
- }
17
- const styles = {
18
- container: "relative shrink-0 w-full",
19
- subcontainer: "flex flex-col gap-1 w-full",
20
- label: "text-xs text-slate-600",
21
- 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",
22
- dropdown: "absolute mt-2 z-50 flex flex-col gap-1 w-full bg-slate-100 rounded border border-slate-300 py-1 text-xs max-h-46 overflow-y-auto",
23
- note: "mt-1 text-xs text-slate-500"
24
- };
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
+ import Chevron from "../assets/icons/chevron.svg";
6
+ import { cn } from "@bouko/style";
7
+ export default function Select({ id, style, label, required = true, value, options, update, note }) {
8
+ const [isOpen, setOpen] = useState(false);
9
+ const active = options.find(x => x.id === value);
10
+ const select = (x) => {
11
+ if (id)
12
+ update(x);
13
+ setOpen(false);
14
+ };
15
+ return (_jsxs("div", { className: cn(styles.container, style), children: [_jsxs("div", { className: styles.subcontainer, children: [label && _jsxs("span", { className: styles.label, children: [label, " ", !required ? _jsx("span", { className: "italic text-slate-400", children: "(optional)" }, void 0) : ""] }, void 0), _jsxs("div", { className: cn(styles.trigger, !active?.label && "capitalize"), onClick: () => setOpen(x => !x), children: [active ? active.label ?? active.id : "None", _jsx(Chevron, { className: cn("text-xs text-slate-400 duration-200", isOpen && "rotate-180") }, void 0)] }, void 0), note && !isOpen && _jsx("span", { className: styles.note, children: note }, void 0)] }, void 0), _jsx(AnimatePresence, { children: isOpen && (_jsx(motion.div, { className: styles.dropdown, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: options.map(({ id, label }) => (_jsx("span", { className: cn("w-full p-2 border-l-3 border-transparent hover:text-blue-600 duration-200 cursor-pointer", active?.id === id && "border-blue-600 bg-blue-500/10", !label && "capitalize"), onClick: () => select(id), children: label ?? id }, id))) }, "dropdown")) }, void 0)] }, void 0));
16
+ }
17
+ const styles = {
18
+ container: "relative shrink-0 w-full",
19
+ subcontainer: "flex flex-col gap-1 w-full",
20
+ label: "text-xs text-slate-600",
21
+ 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",
22
+ dropdown: "absolute mt-2 z-50 flex flex-col gap-1 w-full bg-slate-100 rounded border border-slate-300 py-1 text-xs max-h-46 overflow-y-auto",
23
+ note: "mt-1 text-xs text-slate-500"
24
+ };
@@ -1,16 +1,16 @@
1
- import type { Component } from "../../core/types";
2
- type Props = Component & {
3
- color?: string;
4
- };
5
- /**
6
- * Color-themed badge component.
7
- *
8
- * To use a CSS variable it must exist and be passed in the
9
- * form `--variable-name`. Any other format may cause unexpected
10
- * results. CSS variables use 'color-mix' which is not supported in
11
- * some old browsers such as Safari 15.3 and Internet Explorer.
12
- *
13
- * @param {string} color - Color of badge. (optional, default = accent)
14
- **/
15
- export declare function Badge({ style, color, children }: Props): import("react/jsx-runtime").JSX.Element | null;
16
- export default Badge;
1
+ import type { Component } from "../../core/types";
2
+ declare type Props = Component & {
3
+ color?: string;
4
+ };
5
+ /**
6
+ * Color-themed badge component.
7
+ *
8
+ * To use a CSS variable it must exist and be passed in the
9
+ * form `--variable-name`. Any other format may cause unexpected
10
+ * results. CSS variables use 'color-mix' which is not supported in
11
+ * some old browsers such as Safari 15.3 and Internet Explorer.
12
+ *
13
+ * @param {string} color - Color of badge. (optional, default = accent)
14
+ **/
15
+ export declare function Badge({ style, color, children }: Props): import("react/jsx-runtime").JSX.Element | null;
16
+ export default Badge;
@@ -1,28 +1,28 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn, css, opacitize } from "@bouko/style";
3
- /**
4
- * Color-themed badge component.
5
- *
6
- * To use a CSS variable it must exist and be passed in the
7
- * form `--variable-name`. Any other format may cause unexpected
8
- * results. CSS variables use 'color-mix' which is not supported in
9
- * some old browsers such as Safari 15.3 and Internet Explorer.
10
- *
11
- * @param {string} color - Color of badge. (optional, default = accent)
12
- **/
13
- export function Badge({ style, color = "--color-accent", children }) {
14
- if (!children)
15
- return null;
16
- return (_jsx("span", { className: cn(styles(color), style), children: children }));
17
- }
18
- const styles = (color) => css({
19
- width: "min-content",
20
- padding: "0.25rem 0.75rem",
21
- background: opacitize(color),
22
- border: `1px solid var(${color})`,
23
- borderRadius: "100%",
24
- fontSize: "0.75rem",
25
- fontWeight: "600",
26
- color: "var(--color-primary)"
27
- });
28
- export default Badge;
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn, css, opacitize } from "@bouko/style";
3
+ /**
4
+ * Color-themed badge component.
5
+ *
6
+ * To use a CSS variable it must exist and be passed in the
7
+ * form `--variable-name`. Any other format may cause unexpected
8
+ * results. CSS variables use 'color-mix' which is not supported in
9
+ * some old browsers such as Safari 15.3 and Internet Explorer.
10
+ *
11
+ * @param {string} color - Color of badge. (optional, default = accent)
12
+ **/
13
+ export function Badge({ style, color = "--color-accent", children }) {
14
+ if (!children)
15
+ return null;
16
+ return (_jsx("span", { className: cn(styles(color), style), children: children }, void 0));
17
+ }
18
+ const styles = (color) => css({
19
+ width: "min-content",
20
+ padding: "0.25rem 0.75rem",
21
+ background: opacitize(color),
22
+ border: `1px solid var(${color})`,
23
+ borderRadius: "100%",
24
+ fontSize: "0.75rem",
25
+ fontWeight: "600",
26
+ color: "var(--color-primary)"
27
+ });
28
+ export default Badge;
@@ -1,7 +1,7 @@
1
- import { type Field as FieldProps } from "./form/types";
2
- type Props<T> = FieldProps<T> & {
3
- rows?: number;
4
- placeholder?: string;
5
- };
6
- export default function TextArea({ id, style, label, required, note, value, update, ...props }: Props<string>): import("react/jsx-runtime").JSX.Element;
7
- export {};
1
+ import { type Field as FieldProps } from "./form/types";
2
+ declare type Props<T> = FieldProps<T> & {
3
+ rows?: number;
4
+ placeholder?: string;
5
+ };
6
+ export default function TextArea({ id, style, label, required, note, value, update, ...props }: Props<string>): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -1,11 +1,11 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import Field from "./field";
3
- export default function TextArea({ id, style, label, required = true, note, value, update, ...props }) {
4
- return (_jsx(Field, { style: style, label: label, required: required, note: note, children: _jsx("textarea", { className: styles.textarea, onChange: ({ target: { value } }) => update(value), value: value ?? "", ...props }) }));
5
- }
6
- const styles = {
7
- container: "flex flex-col gap-1 overflow-hidden",
8
- label: "text-xs text-slate-600",
9
- textarea: "px-3 py-2 bg-input border border-outline focus:border-outline-light rounded text-sm resize-none",
10
- note: "mt-1 text-xs text-slate-500"
11
- };
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Field from "./field";
3
+ export default function TextArea({ id, style, label, required = true, note, value, update, ...props }) {
4
+ return (_jsx(Field, { style: style, label: label, required: required, note: note, children: _jsx("textarea", { className: styles.textarea, onChange: ({ target: { value } }) => update(value), value: value ?? "", ...props }, void 0) }, void 0));
5
+ }
6
+ const styles = {
7
+ container: "flex flex-col gap-1 overflow-hidden",
8
+ label: "text-xs text-slate-600",
9
+ textarea: "px-3 py-2 bg-input border border-outline focus:border-outline-light rounded text-sm resize-none",
10
+ note: "mt-1 text-xs text-slate-500"
11
+ };
@@ -1,8 +1,8 @@
1
- import type { SetState } from "../form/types";
2
- type Props = {
3
- style?: string;
4
- accept?: string[];
5
- update: SetState<File>;
6
- };
7
- export default function FileUploader({ style, accept, update }: Props): import("react/jsx-runtime").JSX.Element;
8
- export {};
1
+ import type { SetState } from "@bouko/form";
2
+ declare type Props = {
3
+ style?: string;
4
+ accept?: string[];
5
+ update: SetState<File>;
6
+ };
7
+ export declare function FileUploader({ style, accept, update }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export default FileUploader;