@bouko/react 2.8.9 → 2.9.1

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.
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ColumnBox, RowBox } from "./layout/flex";
3
3
  import Badge from "./text/badge";
4
- export const MediaRow = ({ media, title, subtitle, badge, styles = {}, }) => (_jsxs(RowBox, { style: `items-center gap-3 ${styles.container ?? ""}`, children: [_jsx("img", { src: media, className: "size-10 border border-border rounded", alt: title }), _jsxs(ColumnBox, { style: "gap-px min-w-0", children: [_jsxs(RowBox, { style: "items-center gap-2 min-w-0", children: [_jsx("span", { className: `text-primary text-sm font-semibold truncate ${styles.title ?? ""}`, children: title }), badge && _jsx(Badge, { size: "sm", children: badge })] }), subtitle && (_jsx("span", { className: `text-xs text-primary-dark ${styles.subtitle}`, children: subtitle }))] })] }));
4
+ export const MediaRow = ({ media, title, subtitle, badge, styles = {}, }) => (_jsxs(RowBox, { style: `items-center gap-3 ${styles.container ?? ""}`, children: [_jsx("img", { src: media, className: "size-10 w-10 h-10 border border-border rounded", alt: title }), _jsxs(ColumnBox, { style: "gap-px min-w-0", children: [_jsxs(RowBox, { style: "items-center gap-2 min-w-0", children: [_jsx("span", { className: `text-primary text-sm font-semibold truncate ${styles.title ?? ""}`, children: title }), badge && _jsx(Badge, { size: "sm", children: badge })] }), subtitle && (_jsx("span", { className: `text-xs text-primary-dark ${styles.subtitle}`, children: subtitle }))] })] }));
@@ -1,14 +1,14 @@
1
- import { JSX, Dispatch, SetStateAction } from "react";
1
+ import { Dispatch, SetStateAction } from "react";
2
+ type RowProps<T> = {
3
+ data: T;
4
+ hovered: boolean;
5
+ setHovered: Dispatch<SetStateAction<number | null>>;
6
+ index: number;
7
+ };
2
8
  type Props<T> = {
3
9
  style?: string;
4
10
  items: T[];
5
- element: ({ data, hovered, setHovered, index }: {
6
- data: T;
7
- hovered: boolean;
8
- setHovered: Dispatch<SetStateAction<number | null>>;
9
- index: number;
10
- key: number;
11
- }) => JSX.Element;
11
+ element: React.ComponentType<RowProps<T>>;
12
12
  };
13
- export declare function ScrollBox<T>({ style, items, element }: Props<T>): import("react/jsx-runtime").JSX.Element;
13
+ export declare function ScrollBox<T>({ style, items, element: Row }: Props<T>): import("react/jsx-runtime").JSX.Element;
14
14
  export {};
@@ -2,13 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { cn } from "@bouko/style";
4
4
  import { ColumnBox } from "./layout/flex";
5
- export function ScrollBox({ style, items, element }) {
5
+ export function ScrollBox({ style, items, element: Row }) {
6
6
  const [hoveredIndex, setHoveredIndex] = useState(null);
7
- return (_jsx(ColumnBox, { style: cn("grow gap-1 w-full overflow-y-auto", style), children: items.map((x, i) => (element({
8
- data: x,
9
- hovered: hoveredIndex === i,
10
- setHovered: setHoveredIndex,
11
- index: i,
12
- key: i
13
- }))) }));
7
+ return (_jsx(ColumnBox, { style: cn("grow gap-1 w-full overflow-y-auto", style), children: items.map((x, i) => (_jsx(Row, { data: x, hovered: hoveredIndex === i, setHovered: setHoveredIndex, index: i }, i))) }));
14
8
  }
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn, css } from "@bouko/style";
3
- export const TabItem = ({ name, icon, isActive }) => (_jsxs("div", { className: cn(styles, isActive && "bg-background-light text-primary hover:cursor-default"), children: [_jsx("div", { className: cn("duration-200", isActive && "text-accent"), children: icon }), name] }));
3
+ export const TabItem = ({ name, icon, isActive }) => (_jsxs("div", { className: cn(styles, isActive && "!bg-surface-light text-primary hover:cursor-default"), children: [_jsx("div", { className: cn("duration-200", isActive && "text-accent"), children: icon }), name] }));
4
4
  const styles = css({
5
5
  base: "flex items-center gap-2 px-2 py-1 rounded-xs duration-200 cursor-pointer",
6
- color: "bg-background-light/70 hover:bg-background-light/90 border border-border-dark",
7
- text: "font-semibold text-sm text-primary-darker"
6
+ color: "bg-surface-dark hover:bg-surface border border-border-dark",
7
+ text: "font-medium text-sm text-primary-dark"
8
8
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "2.8.9",
4
+ "version": "2.9.1",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",
@@ -22,6 +22,7 @@
22
22
  "dependencies": {
23
23
  "@bouko/audio": "^0.1.0",
24
24
  "@bouko/form": "^0.5.7",
25
+ "@bouko/notify": "^0.1.8",
25
26
  "@bouko/style": "^0.1.7",
26
27
  "@bouko/time": "^0.1.3",
27
28
  "@bouko/ts": "^0.3.5",