@bouko/react 2.6.6 → 2.6.8

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 (98) hide show
  1. package/dist/colors/core.d.ts +10 -10
  2. package/dist/colors/core.js +25 -25
  3. package/dist/colors/index.d.ts +26 -26
  4. package/dist/colors/index.js +43 -43
  5. package/dist/colors/types.d.ts +11 -11
  6. package/dist/colors/types.js +7 -7
  7. package/dist/components/animate/configs.d.ts +136 -136
  8. package/dist/components/animate/configs.js +62 -62
  9. package/dist/components/animate/index.d.ts +54 -54
  10. package/dist/components/animate/index.js +33 -33
  11. package/dist/components/attachment.d.ts +2 -2
  12. package/dist/components/attachment.js +18 -18
  13. package/dist/components/audio/timestamp.d.ts +12 -0
  14. package/dist/components/audio/timestamp.js +10 -0
  15. package/dist/components/button/icon.d.ts +10 -10
  16. package/dist/components/button/icon.js +19 -19
  17. package/dist/components/button/normal.d.ts +11 -11
  18. package/dist/components/button/normal.js +39 -39
  19. package/dist/components/carousel/index.d.ts +11 -11
  20. package/dist/components/carousel/index.js +19 -19
  21. package/dist/components/checkbox.d.ts +8 -8
  22. package/dist/components/checkbox.js +13 -13
  23. package/dist/components/dropdown/normal.d.ts +10 -10
  24. package/dist/components/dropdown/normal.js +19 -19
  25. package/dist/components/fade-carousel.d.ts +4 -4
  26. package/dist/components/fade-carousel.js +14 -14
  27. package/dist/components/field.d.ts +10 -10
  28. package/dist/components/field.js +10 -10
  29. package/dist/components/form/functions.d.ts +1 -1
  30. package/dist/components/form/functions.js +28 -28
  31. package/dist/components/form/types.d.ts +38 -38
  32. package/dist/components/form/types.js +1 -1
  33. package/dist/components/heading/normal.d.ts +29 -29
  34. package/dist/components/heading/normal.js +22 -22
  35. package/dist/components/heading/page.d.ts +25 -25
  36. package/dist/components/heading/page.js +23 -23
  37. package/dist/components/index.d.ts +15 -14
  38. package/dist/components/index.js +15 -14
  39. package/dist/components/input.d.ts +37 -37
  40. package/dist/components/input.js +40 -40
  41. package/dist/components/layout/absolute.d.ts +9 -9
  42. package/dist/components/layout/absolute.js +9 -9
  43. package/dist/components/layout/fade.d.ts +7 -7
  44. package/dist/components/layout/fade.js +15 -15
  45. package/dist/components/layout/flex.d.ts +16 -16
  46. package/dist/components/layout/flex.js +42 -42
  47. package/dist/components/layout/separator.d.ts +3 -3
  48. package/dist/components/layout/separator.js +5 -5
  49. package/dist/components/list/index.d.ts +2 -2
  50. package/dist/components/list/index.js +2 -2
  51. package/dist/components/list/item.d.ts +9 -9
  52. package/dist/components/list/item.js +7 -7
  53. package/dist/components/list/variants/bullet.d.ts +9 -9
  54. package/dist/components/list/variants/bullet.js +16 -16
  55. package/dist/components/list/variants/number.d.ts +10 -10
  56. package/dist/components/list/variants/number.js +18 -18
  57. package/dist/components/multiple-choice.d.ts +2 -2
  58. package/dist/components/multiple-choice.js +12 -12
  59. package/dist/components/search-bar.d.ts +13 -14
  60. package/dist/components/search-bar.js +22 -22
  61. package/dist/components/select.d.ts +6 -6
  62. package/dist/components/select.js +24 -24
  63. package/dist/components/text/badge.d.ts +17 -16
  64. package/dist/components/text/badge.js +35 -28
  65. package/dist/components/textarea.d.ts +7 -7
  66. package/dist/components/textarea.js +11 -11
  67. package/dist/components/upload/file.d.ts +8 -8
  68. package/dist/components/upload/file.js +23 -23
  69. package/dist/components/waveform/index.d.ts +8 -8
  70. package/dist/components/waveform/index.js +11 -11
  71. package/dist/components/waveform/patterns.d.ts +1 -1
  72. package/dist/components/waveform/patterns.js +27 -27
  73. package/dist/core/classes.js +1 -1
  74. package/dist/core/format.d.ts +3 -3
  75. package/dist/core/format.js +34 -34
  76. package/dist/core/functions.d.ts +10 -10
  77. package/dist/core/functions.js +76 -76
  78. package/dist/core/types.d.ts +15 -15
  79. package/dist/core/types.js +2 -2
  80. package/dist/core/variants.d.ts +5 -5
  81. package/dist/core/variants.js +6 -6
  82. package/dist/format/index.d.ts +2 -2
  83. package/dist/format/index.js +33 -33
  84. package/dist/hooks/audio/sound.d.ts +1 -1
  85. package/dist/hooks/audio/sound.js +6 -6
  86. package/dist/hooks/clock/interval.d.ts +8 -8
  87. package/dist/hooks/clock/interval.js +25 -25
  88. package/dist/hooks/element/container.d.ts +4 -5
  89. package/dist/hooks/element/container.js +7 -7
  90. package/dist/hooks/element/index.d.ts +4 -5
  91. package/dist/hooks/element/index.js +9 -9
  92. package/dist/hooks/element/resize.d.ts +1 -1
  93. package/dist/hooks/element/resize.js +12 -12
  94. package/dist/hooks/index.d.ts +5 -5
  95. package/dist/hooks/index.js +5 -5
  96. package/dist/index.d.ts +14 -14
  97. package/dist/index.js +14 -14
  98. package/package.json +5 -2
@@ -1,9 +1,9 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from "@bouko/style";
3
- export default function AbsoluteBox({ pos, style, ref, children }) {
4
- return (_jsx("div", { className: cn(styles.container, pos), ref: ref, children: _jsx("div", { className: cn(styles.subcontainer, style), children: children }, void 0) }, void 0));
5
- }
6
- const styles = {
7
- container: "absolute",
8
- subcontainer: "relative w-full h-full"
9
- };
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "@bouko/style";
3
+ export default function AbsoluteBox({ pos, style, ref, children }) {
4
+ return (_jsx("div", { className: cn(styles.container, pos), ref: ref, children: _jsx("div", { className: cn(styles.subcontainer, style), children: children }) }));
5
+ }
6
+ const styles = {
7
+ container: "absolute",
8
+ subcontainer: "relative w-full h-full"
9
+ };
@@ -1,7 +1,7 @@
1
- import { Component } from "../../core/types";
2
- declare type Props = Component & {
3
- direction?: "left" | "down";
4
- gradient?: string;
5
- };
6
- export declare function FadeBox({ style, direction, gradient, children }: Props): import("react/jsx-runtime").JSX.Element;
7
- export default FadeBox;
1
+ import { Component } from "../../core/types";
2
+ type Props = Component & {
3
+ direction?: "left" | "down";
4
+ gradient?: string;
5
+ };
6
+ export declare function FadeBox({ style, direction, gradient, children }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export default FadeBox;
@@ -1,15 +1,15 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn, tv } from "@bouko/style";
3
- export function FadeBox({ style, direction = "left", gradient, children }) {
4
- return (_jsxs("div", { className: cn("relative", style), children: [children, _jsx("div", { className: cn(styles({ direction }), gradient) }, void 0)] }, void 0));
5
- }
6
- const styles = tv({
7
- base: "absolute from-background",
8
- variants: {
9
- direction: {
10
- left: "top-0 right-0 w-12 h-full bg-gradient-to-l",
11
- down: "top-0 left-0 w-full h-full bg-gradient-to-b"
12
- }
13
- }
14
- });
15
- export default FadeBox;
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn, tv } from "@bouko/style";
3
+ export function FadeBox({ style, direction = "left", gradient, children }) {
4
+ return (_jsxs("div", { className: cn("relative", style), children: [children, _jsx("div", { className: cn(styles({ direction }), gradient) })] }));
5
+ }
6
+ const styles = tv({
7
+ base: "absolute from-background",
8
+ variants: {
9
+ direction: {
10
+ left: "top-0 right-0 w-12 h-full bg-gradient-to-l",
11
+ down: "top-0 left-0 w-full h-full bg-gradient-to-b"
12
+ }
13
+ }
14
+ });
15
+ export default FadeBox;
@@ -1,16 +1,16 @@
1
- import type { Component } from "../../core/types";
2
- declare type Props = Component & {
3
- center?: boolean;
4
- centerX?: boolean;
5
- centerY?: boolean;
6
- };
7
- /**
8
- * Flex containers with configurable alignment and styling.
9
- *
10
- * @param {string} style - Additional styles for container.
11
- * @param {ReactNode} children - Child elements to render inside the row.
12
- * @param {Props} opts - Variant options for styling.
13
- **/
14
- export declare function RowBox({ style, children, ...opts }: Props): import("react/jsx-runtime").JSX.Element | null;
15
- export declare function ColumnBox({ style, children, ...opts }: Props): import("react/jsx-runtime").JSX.Element | null;
16
- export {};
1
+ import type { Component } from "../../core/types";
2
+ type Props = Component & {
3
+ center?: boolean;
4
+ centerX?: boolean;
5
+ centerY?: boolean;
6
+ };
7
+ /**
8
+ * Flex containers with configurable alignment and styling.
9
+ *
10
+ * @param {string} style - Additional styles for container.
11
+ * @param {ReactNode} children - Child elements to render inside the row.
12
+ * @param {Props} opts - Variant options for styling.
13
+ **/
14
+ export declare function RowBox({ style, children, ...opts }: Props): import("react/jsx-runtime").JSX.Element | null;
15
+ export declare function ColumnBox({ style, children, ...opts }: Props): import("react/jsx-runtime").JSX.Element | null;
16
+ export {};
@@ -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 }, 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
- });
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,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) }, void 0);
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,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 }, 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
+ "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,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 }, 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
+ "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,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 }, 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
+ 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,14 +1,13 @@
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
+ 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,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 Input from "./input";
5
- import FadeBox from "./layout/fade";
6
- import { RowBox } from "./layout/flex";
7
- import Button from "./button/normal";
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-3 sm:gap-5 w-xl max-w-full pl-4 sm:pl-5 pr-2 sm:pr-4 py-2 sm:py-3 bg-slate-950 border border-border rounded-md",
21
- input: "text-base sm: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 Input from "./input";
5
+ import FadeBox from "./layout/fade";
6
+ import { RowBox } from "./layout/flex";
7
+ import Button from "./button/normal";
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-3 sm:gap-5 w-xl max-w-full pl-4 sm:pl-5 pr-2 sm:pr-4 py-2 sm:py-3 bg-slate-950 border border-border rounded-md",
21
+ input: "text-base sm:text-lg tracking-wide"
22
+ };
@@ -1,6 +1,6 @@
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
+ 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,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)" }, 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
+ "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,16 +1,17 @@
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
+ import type { Component } from "../../core/types";
2
+ type Props = Component & {
3
+ color?: string;
4
+ size?: "sm" | "md";
5
+ };
6
+ /**
7
+ * Color-themed badge component.
8
+ *
9
+ * To use a CSS variable it must exist and be passed in the
10
+ * form `--variable-name`. Any other format may cause unexpected
11
+ * results. CSS variables use 'color-mix' which is not supported in
12
+ * some old browsers such as Safari 15.3 and Internet Explorer.
13
+ *
14
+ * @param {string} color - Color of badge. (optional, default = accent)
15
+ **/
16
+ export declare function Badge({ style, color, size, children }: Props): import("react/jsx-runtime").JSX.Element | null;
17
+ export default Badge;